Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members

Solver.h

Go to the documentation of this file.
00001 // Copyright (C) 2002 Johan Hoffman and Anders Logg.
00002 // Licensed under the GNU GPL Version 2.
00003 
00004 #ifndef __SOLVER_H
00005 #define __SOLVER_H
00006 
00007 #include <dolfin.h>
00008 
00009 namespace dolfin {
00010 
00011   class Solver {
00012   public:
00013 
00015     Solver();
00016 
00018     Solver(Mesh& mesh_);
00019 
00021     Solver(ODE& ode_);
00022     
00024     virtual ~Solver();
00025 
00027     virtual const char* description() = 0;
00028     
00030     virtual void solve() = 0;
00031     
00032   protected:
00033     
00034     Mesh& mesh;
00035     ODE& ode;
00036 
00037   private:
00038     
00039     // Every solver needs to have both a mesh and an ODE (since the same solver
00040     // interface is used for different equations). We create dummy objects to
00041     // be able to initialize the references if they are not used.
00042 
00043     class DummyODE : public ODE {
00044     public:
00045       DummyODE() : ODE(1) {}
00046       real u0(unsigned int i) { return 0.0; }
00047       real f(const Vector& u, real t, unsigned int i) { return 0.0; }
00048     };
00049 
00050     Mesh     dummy_mesh;
00051     DummyODE dummy_ode; 
00052     
00053   };
00054   
00055 }
00056 
00057 #endif


Documentation automatically generated with Doxygen on 10 Sep 2004.