constantrighthandside.h

Go to the documentation of this file.
00001 #ifndef  __ConstantRightHandSide_h
00002 #define  __ConstantRightHandSide_h
00003 
00004 #include  "domainrighthandside.h"
00005 
00006 /*-----------------------------------------*/
00007 
00008 namespace Gascoigne
00009 {
00010 class OneRightHandSideData : public DomainRightHandSide
00011 {
00012   protected :
00013 
00014     int ncomp;
00015 
00016   public  : 
00017 
00018     OneRightHandSideData(int n) : DomainRightHandSide(), ncomp(n) {}
00019     std::string GetName() const { return "one" ;} 
00020     int GetNcomp() const {return ncomp;}
00021     double operator()(int c, const Vertex2d& v)const {return 1.;}
00022     double operator()(int c, const Vertex3d& v)const {return 1.;}
00023 };
00024 
00025 /*-----------------------------------------*/
00026 
00027 class ConstantRightHandSideData : public DomainRightHandSide
00028 {
00029 protected :
00030   int     _comp,_ncomp;
00031   double  _d;
00032 
00033 public  : 
00034   ConstantRightHandSideData(const std::vector<std::string>& args);
00035   ConstantRightHandSideData(const int ncomp, const int comp, const double d);
00036   std::string GetName() const {return "constant";} 
00037   int GetNcomp() const {return _ncomp;}
00038   double operator()(int c, const Vertex2d& v)const;
00039   double operator()(int c, const Vertex3d& v)const;
00040 };
00041 
00042 /*-----------------------------------------*/
00043 
00044 class OneComponentRightHandSideData : public DomainRightHandSide
00045 {
00046  protected:
00047   
00048   int  ncomp, comp;  // ist die Komponente die Eins ist
00049 
00050  public:
00051   
00052   OneComponentRightHandSideData(int n, int c) : 
00053     DomainRightHandSide(), ncomp(n), comp(c) {}
00054 
00055   std::string GetName() const {return "one_onecomp";} 
00056 
00057   int GetNcomp() const { return ncomp;}
00058 
00059   double operator()(int c, const Vertex2d&)const 
00060     {
00061       if (c==comp) return 1.;
00062       return 0.;
00063     }
00064   double operator()(int c, const Vertex3d&)const 
00065     {
00066       if (c==comp) return 1.;
00067       return 0.;
00068     }
00069 };
00070 
00071 /*-----------------------------------------*/
00072 
00073 class RectangleRightHandSideData : public DomainRightHandSide
00074 {
00075   int      ncomp, comp;  // ist die Komponente die Eins ist
00076   double   x0, x1, y0, y1, z0, z1;
00077 
00078 public:
00079 
00080   RectangleRightHandSideData(int n, int c, 
00081                              double xx0, double xx1, double yy0, double yy1) : 
00082     DomainRightHandSide(), ncomp(n), comp(c) 
00083     { 
00084       x0 = xx0; x1 = xx1; y0 = yy0; y1 = yy1;
00085       z0 = z1 = 0.;
00086     }
00087   RectangleRightHandSideData(int n, int c, 
00088                              double xx0, double xx1, double yy0, double yy1,
00089                              double zz0, double zz1) : 
00090     DomainRightHandSide(), ncomp(n), comp(c) 
00091     { 
00092       x0 = xx0; x1 = xx1; y0 = yy0; y1 = yy1;
00093       z0 = zz0; z1 = zz1;
00094     }
00095 
00096   std::string GetName() const {return "RectangleRightHandSideData";} 
00097 
00098   int GetNcomp() const {return ncomp;}
00099 
00100   double operator()(int c, const Vertex2d& V)const 
00101     {
00102       if (c!=comp) return 0.;
00103       if ((V.x()>x1) || (V.x()<x0)) return 0.;
00104       if ((V.y()>y1) || (V.y()<y0)) return 0.;
00105       return 1.;
00106     }
00107   double operator()(int c, const Vertex3d& V)const 
00108     {
00109       if (c!=comp) return 0.;
00110       if ((V.x()>x1) || (V.x()<x0)) return 0.;
00111       if ((V.y()>y1) || (V.y()<y0)) return 0.;
00112       if ((V.z()>z1) || (V.z()<z0)) return 0.;
00113       return 1.;
00114     }
00115 };
00116 }
00117 
00118 #endif

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