00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #ifndef _STENCIL_H
00011 #define _STENCIL_H
00012
00013 class Stencil
00014 {
00015 public:
00016 Stencil();
00017
00018 virtual ~Stencil();
00019
00025 virtual void addFlux( unsigned int meshIndex,
00026 vector< double >& f, const vector< vector< double > >& S,
00027 const vector< double >& diffConst ) const = 0;
00028
00029 private:
00030 };
00031
00035 class DummyStencil: public Stencil
00036 {
00037 public:
00038 DummyStencil();
00039 ~DummyStencil();
00040 void addFlux( unsigned int meshIndex, vector< double >& f,
00041 const vector< vector< double > >& S,
00042 const vector< double >& diffConst ) const;
00043 private:
00044 };
00045
00050 class LineStencil: public Stencil
00051 {
00052 public:
00053 LineStencil( double h );
00054 ~LineStencil();
00055 void addFlux( unsigned int meshIndex, vector< double >& f,
00056 const vector< vector< double > >& S,
00057 const vector< double >& diffConst ) const;
00058 private:
00059 double h_;
00060 double invHsq_;
00061 };
00062
00067 class RectangleStencil: public Stencil
00068 {
00069 public:
00070 RectangleStencil( double dx, double dy, unsigned int nx );
00071 ~RectangleStencil();
00072 void addFlux( unsigned int meshIndex, vector< double >& f,
00073 const vector< vector< double > >& S,
00074 const vector< double >& diffConst ) const;
00075 private:
00076 double dx_;
00077 double dy_;
00078 double invDxSq_;
00079 double invDySq_;
00080 unsigned int nx_;
00081 };
00082
00086 class CuboidStencil: public Stencil
00087 {
00088 public:
00089 CuboidStencil( double dx, double dy, double dz,
00090 unsigned int nx, unsigned int ny );
00091 ~CuboidStencil();
00092 void addFlux( unsigned int meshIndex, vector< double >& f,
00093 const vector< vector< double > >& S,
00094 const vector< double >& diffConst ) const;
00095 private:
00096 double dx_;
00097 double dy_;
00098 double dz_;
00099 double invDxSq_;
00100 double invDySq_;
00101 double invDzSq_;
00102 unsigned int nx_;
00103 unsigned int ny_;
00104 };
00105
00106 #endif // _STENCIL_H