solverinterface.h

Go to the documentation of this file.
00001 #ifndef  __SolverInterface_h
00002 #define  __SolverInterface_h
00003 
00004 #include  "gascoigne.h"
00005 #include  "matrixinterface.h"
00006 #include  "iluinterface.h"
00007 
00008 #include  "multigridmeshinterface.h"
00009 #include  "discretizationinterface.h"
00010 #include  "functional.h"
00011 
00012 #include  "problemdescriptorinterface.h"
00013 #include  "meshinterface.h"
00014 #include  "mginterpolatorinterface.h"
00015 #include  "meshtransferinterface.h"
00016 #include  "vectorinterface.h"
00017 #include  "paramfile.h"
00018 
00019 
00020 /*---------------------------------------------------------*/
00021 
00022 namespace Gascoigne
00023 {
00024   
00029 
00038   
00039   class SolverInterface
00040   {
00041     private: 
00042 
00043     protected:
00044 
00045     public:
00046       SolverInterface() {}
00047       virtual ~SolverInterface(){}
00048 
00049       virtual std::string GetName() const=0;
00050 
00051       virtual void BasicInit(int level, const ParamFile* paramfile, const int dimension)=0;
00052   
00053       virtual void SetProblem(const ProblemDescriptorInterface& PD)=0;
00054       virtual void SetDiscretization(DiscretizationInterface& DI, bool init=false)=0;
00055       virtual const ProblemDescriptorInterface* GetProblemDescriptor() const=0;
00056       virtual const ParamFile* GetParamfile() const=0;
00057 
00058       virtual bool DirectSolver() const=0;
00059   
00060       virtual void NewMesh(int l, const MeshInterface* MP)=0;
00061       virtual const MeshInterface* GetMesh() const=0;
00062 
00063       virtual void RegisterMatrix()=0;
00064       virtual void ReInitMatrix()=0;
00065 
00066       virtual void OutputSettings() const=0;
00067       virtual void ConstructInterpolator(MgInterpolatorInterface* I, const MeshTransferInterface* MT)=0;
00068 
00069       virtual void VisuGrid(const std::string& name, int i) const=0;
00070 
00071 
00072       virtual void AddNodeVector(const std::string&, const VectorInterface& q)=0;
00073       virtual void AddCellVector(const std::string&, const VectorInterface& q)=0;
00074       virtual void AddParameterVector(const std::string&, const GlobalParameterVector* q)=0;
00075       virtual void DeleteNodeVector(const std::string&)=0;
00076       virtual void DeleteCellVector(const std::string&)=0;
00077       virtual void DeleteParameterVector(const std::string&)=0;
00078       virtual void DeleteVector(Gascoigne::VectorInterface& p) const=0;
00079 
00080       virtual const DiscretizationInterface* GetDiscretization() const=0;
00081       virtual       DiscretizationInterface* GetDiscretization()      =0;
00082 
00083       //
00085       //
00086       virtual void RegisterVector(const VectorInterface& g)=0;
00087       virtual GlobalVector& GetGV(VectorInterface& u) const=0;
00088       virtual const GlobalVector& GetGV(const VectorInterface& u) const=0;
00089       virtual void ReInitVector(VectorInterface& dst)=0;
00090       virtual void ReInitVector(VectorInterface& dst, int comp)=0;
00091 
00092       //
00094       //
00095       virtual bool GetDistribute() const{abort();}
00096       virtual void SetDistribute(bool dist){abort();}
00097 
00098       virtual void HNAverage   (const VectorInterface& x) const=0;
00099       virtual void HNZero      (const VectorInterface& x) const=0;
00100       virtual void HNDistribute(VectorInterface& x) const=0;
00101 
00102       virtual void HNAverageData() const=0;
00103       virtual void HNZeroData() const=0;
00104 
00105       //
00107       //
00108       virtual void Visu(const std::string& name, const VectorInterface& u, int i) const=0;
00109       virtual void Write(const VectorInterface& u, const std::string& filename) const=0;
00110       virtual void Read(VectorInterface& u, const std::string& filename) const=0;
00111 
00112       //
00114       //
00115       virtual void InterpolateSolution(VectorInterface& u, const GlobalVector& uold) const=0;
00116 
00117       //
00119       //
00120       virtual void Rhs(VectorInterface& f, double d=1.) const=0;
00121       virtual void TimeRhsOperator(VectorInterface& f, const VectorInterface& u) const {
00122         std::cerr << "\"SolverInterface::TimeRhsOperator\" not written!" << std::endl;
00123         abort();
00124       }
00125       virtual void TimeRhs(int k, VectorInterface& f) const {
00126         std::cerr << "\"SolverInterface::TimeRhs\" not written!" << std::endl;
00127         abort();
00128       }
00129       virtual void InitialCondition(VectorInterface& f, double d=1.) const {
00130         std::cerr << "\"SolverInterface::IC\" not written!" << std::endl;
00131         abort();
00132       }
00133       virtual void L2Projection(VectorInterface& u, VectorInterface& f)  {
00134         std::cerr << "\"SolverInterface::L2Projection\" not written!" << std::endl;
00135         abort();
00136       }
00137 
00138       //
00140       //
00141       virtual void Form(VectorInterface& y, const VectorInterface& x, double d) const=0;
00142       virtual void AdjointForm(VectorInterface& y, const VectorInterface& x, double d) const { assert(0);}
00143 
00144       //
00146       //
00147       virtual void SetBoundaryVector(VectorInterface& f) const=0;
00148       virtual void SetBoundaryVectorZero(VectorInterface& f) const=0;
00149       virtual void SetBoundaryVectorStrong(VectorInterface& f, const BoundaryManager& BM, const DirichletData& DD, double d=1.) const=0;
00150   
00151       //
00153       //
00154       virtual double NewtonNorm(const VectorInterface& u) const=0;
00155 
00156       virtual void residualgmres(VectorInterface& y, const VectorInterface& x, const VectorInterface& b) const=0;
00157       virtual void MatrixResidual(VectorInterface& y, const VectorInterface& x, const VectorInterface& b) const=0;
00158       virtual void vmult(VectorInterface& y, const VectorInterface& x, double d) const=0;
00159       virtual void vmulteq(VectorInterface& y, const VectorInterface& x, double d) const=0;
00160       virtual void smooth_pre(VectorInterface& y, const VectorInterface& x, VectorInterface& h) const=0;
00161       virtual void smooth_exact(VectorInterface& y, const VectorInterface& x, VectorInterface& h) const=0;
00162       virtual void smooth_post(VectorInterface& y, const VectorInterface& x, VectorInterface& h) const=0;
00163       virtual void Zero(VectorInterface& dst) const=0;
00164 
00165       //
00167       //
00168       virtual void SubtractMean(VectorInterface& x) const=0;
00169       virtual void SubtractMeanAlgebraic(VectorInterface& x) const=0;
00170 
00171       //
00173       //
00174       virtual void AssembleMatrix(const VectorInterface& u, double d=1.)=0;
00175       virtual void DirichletMatrix() const=0;
00176       virtual void MatrixZero() const=0;
00177       virtual void ComputeIlu(const VectorInterface& u) const=0;
00178       virtual void ComputeIlu() const=0;
00179       virtual void AssembleDualMatrix(const VectorInterface& gu, double d)=0;
00180 
00181                 //
00183                 //
00184       virtual double ScalarProduct(const VectorInterface& y, const VectorInterface& x) const=0;
00185       virtual void Equ(VectorInterface& dst, double s, const VectorInterface& src) const=0;
00186       virtual void Add(VectorInterface& dst, double s, const VectorInterface& src) const=0;
00187       virtual void SAdd(double s1,VectorInterface& dst, double s2, const VectorInterface& src) const=0;
00188       virtual double Norm(const VectorInterface& dst) const=0;  
00189 
00190       
00191       //
00193       //
00194       virtual void ComputeError(const VectorInterface& u, GlobalVector& err) const=0;
00195       virtual void AssembleError(GlobalVector& eta, const VectorInterface& u, GlobalVector& err) const=0;
00196       virtual double ComputeFunctional(VectorInterface& f, const VectorInterface& u, const Functional* FP) const=0;
00197 
00198       //
00200       //
00201       virtual void BoundaryInit(VectorInterface& u) const=0;
00202       virtual void SolutionInit(VectorInterface& u) const=0;
00203 };
00204 }
00205 #endif
00206 

Generated on Thu Sep 14 10:34:36 2006 for Gascoigne by  doxygen 1.4.7