Skip to content
Snippets Groups Projects

Feature/dynamicpolymorphism

Merged Christian Engwer requested to merge feature/dynamicpolymorphism into master
All threads resolved!
7 files
+ 331
547
Compare changes
  • Side-by-side
  • Inline
Files
7
  • We introduce a new method category to check for the same SolverCategory of different
    components at run time.
    
    This is a drawback compared to compile time checks, but it adds a lot of flexibility as we will
    be able to  write factory classes for solvers and compose/exchange solvers at runtime.
    
    Besides this we added the following changes:
    - an additional intermediate class IterativeSolver encapsulates the data of almost all solvers
    - the solvers now inherit from IterativeSolver and can usually reuse its constructor
    - the solvers now only have to implement _one_ apply method, the other is implemented
      generically
    
    State:
    - currently the example compiles
    - none of the AMG headers has been updated yet
+ 9
3
@@ -79,6 +79,9 @@ namespace Dune {
//! every abstract base class has a virtual destructor
virtual ~LinearOperator () {}
//! Category of the linear operator (see SolverCategory::Category)
virtual SolverCategory::Category category() const = 0;
};
@@ -127,9 +130,6 @@ namespace Dune {
typedef Y range_type;
typedef typename X::field_type field_type;
//! define the category
enum {category=SolverCategory::sequential};
//! constructor: just store a reference to a matrix
explicit MatrixAdapter (const M& A) : _A_(A) {}
@@ -151,6 +151,12 @@ namespace Dune {
return _A_;
}
//! Category of the solver (see SolverCategory::Category)
virtual SolverCategory::Category category() const
{
return SolverCategory::sequential;
}
private:
const M& _A_;
};
Loading