patchdiscretization.h

Go to the documentation of this file.
00001 #ifndef  __PatchDiscretization_h
00002 #define  __PatchDiscretization_h
00003 
00004 #include  "basicdiscretization.h"
00005 #include  "patchmesh.h"
00006 #include  "gascoignemesh.h"
00007 
00008 
00009 namespace Gascoigne
00010 {
00011 
00016 
00020 
00021 class PatchDiscretization : public BasicDiscretization
00022 {
00023 protected:
00024 
00025   FemInterface*         __FEM;
00026   IntegratorInterface*  __INT;
00027 
00028   const FemInterface* GetFem() const {return __FEM;}
00029   const IntegratorInterface* GetIntegrator() const {return __INT;}
00030   IntegratorInterface*& GetIntegratorPointer() {return __INT;}
00031   FemInterface*& GetFemPointer() {return __FEM;}
00032 
00033   virtual void Transformation(FemInterface::Matrix& T, int iq) const;
00034   virtual double compute_element_mean_matrix(int iq, EntryMatrix& E) const;
00035   virtual int GetPatchNumber(const Vertex2d& p0, Vertex2d& p) const { assert(0); }
00036   virtual int GetPatchNumber(const Vertex3d& p0, Vertex3d& p) const { assert(0); }
00037   
00038   const PatchMesh* GetPatchMesh() const {
00039     const PatchMesh* MP = dynamic_cast<const PatchMesh*>(GetMesh());
00040     assert(MP);
00041     return MP;
00042   }
00043 
00044   const GascoigneMesh*  GetGascoigneMesh() const {
00045     const GascoigneMesh* MP = dynamic_cast<const GascoigneMesh*>(GetMesh());
00046     assert(MP);
00047     return MP;
00048   }
00049   
00050   double ComputePointValue(const GlobalVector& u, const Vertex2d& p0,int comp) const;
00051   double ComputePointValue(const GlobalVector& u, const Vertex3d& p0,int comp) const; 
00052 
00053   virtual void DiracRhsPoint(GlobalVector& f,const DiracRightHandSide& DRHS,const Vertex2d& p0,int i,double s) const;
00054   virtual void DiracRhsPoint(GlobalVector& f,const DiracRightHandSide& DRHS,const Vertex3d& p0,int i,double s) const;
00055 
00056   void GlobalToLocalCell(LocalVector& U, const GlobalVector& u, int iq) const;
00057 
00058 public:
00059 
00060 //
00062 //
00063   PatchDiscretization() : BasicDiscretization(), __FEM(NULL), __INT(NULL) {}
00064   ~PatchDiscretization(){
00065     if(__FEM) {delete __FEM; __FEM=NULL;}
00066     if(__INT) {delete __INT; __INT=NULL;}
00067   }
00068 
00069   std::string GetName() const {return "PatchDiscretization";}
00070   void Structure(SparseStructureInterface* S) const;
00071 
00072   void Form(GlobalVector& f, const GlobalVector& u, const Equation& EQ, double d) const;
00073   void AdjointForm(GlobalVector& f, const GlobalVector& u, const Equation& EQ, double d) const;
00074   void BoundaryForm(GlobalVector& f, const GlobalVector& u, const IntSet& Colors, const BoundaryEquation& BE, double d) const;
00075   void Matrix(MatrixInterface& A, const GlobalVector& u, const Equation& EQ, double) const;
00076   void BoundaryMatrix(MatrixInterface& A, const GlobalVector& u, const IntSet& Colors, const BoundaryEquation& BE, double d) const;
00077   void MassMatrix(MatrixInterface& M) const;
00078   void MassForm(GlobalVector& f, const GlobalVector& u, const TimePattern& TP, double s) const;
00079 
00080   void ComputeError(const GlobalVector& u, LocalVector& err, const ExactSolution* ES) const;
00081 
00082   void Rhs(GlobalVector& f, const DomainRightHandSide& RHS, double s) const;
00083   void DiracRhs(GlobalVector& f, const DiracRightHandSide& DRHS, double s) const;
00084   
00085   void BoundaryRhs(GlobalVector& f, const IntSet& Colors,  const BoundaryRightHandSide& NRHS, double s) const;
00086 
00087   void InitFilter(nvector<double>&) const;
00088 
00089   // Functionals
00090   double ComputeBoundaryFunctional(const GlobalVector& u, const IntSet& Colors, const BoundaryFunctional& BF) const;
00091   double ComputeDomainFunctional(const GlobalVector& u, const DomainFunctional& F) const;
00092   double ComputePointFunctional(const GlobalVector& u, const PointFunctional& FP) const;
00093 
00094   virtual nmatrix<double> GetLocalInterpolationWeights(int iq) const { assert(0);}
00095 
00096 };
00097 }
00098 
00099 #endif

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