Home | Doxygen Documentation | Tutorials | Developer Tools (restricted)

linDG3D/element.hh
Go to the documentation of this file.
00001 /* Classes for DG elements
00002  */
00003 
00004 #ifndef dgElement_hh
00005 #define dgElement_hh
00006 
00007 #include "basics/typedefs.hh"
00008 #include "space/element.hh"
00009 #include "geometry/cell3D.hh"
00010 #include "geometry/topology3D.hh"
00011 #include "function/vector.hh"
00012 #include "space/tmatrix.hh"
00013 #include "toolbox/elementGraphics.hh"
00014 #include "space/postProcess.hh"
00015 #include "graphics/dataDX.hh"
00016  
00017 namespace linDG3D {
00018 
00019   using concepts::Real;
00020   
00021   // Forward declarations
00022   class FvdgP0TetGraphics;
00023   class FvdgP1TetGraphics;
00024 
00025   // ************************************************************** Elements **
00029   class FvdgElement : public concepts::ElementWithCell<Real> {
00030   public:
00032     FvdgElement(const concepts::Tetrahedron3d& cell, uint idx[], uint m);
00034     const concepts::Tetrahedron& support() const { return cell_.connector(); }
00036     const concepts::TMatrixBase<Real>& T() const { return *T_; }
00038     const concepts::Real3d vertex(const uint i) const { 
00039       return cell_.vertex(i);
00040     }
00042     virtual const concepts::Tetrahedron3d& cell() const { return cell_; }
00047     virtual Real shapeFct(const uint fctIdx, const concepts::Real3d xi) const 
00048       = 0;
00054     virtual Real shapeFctEdgeCenter(const uint fctIdx, const uint edgeIdx) 
00055       const = 0;
00061     virtual Real shapeFctVertex(const uint fctIdx, const uint vtxIdx) 
00062       const = 0;
00067     virtual concepts::Real3d shapeFctGradient(const uint fctIdx) const = 0;
00073     Real solution(const concepts::Vector<Real>& sol,
00074       const concepts::Real3d xi) const;
00080     virtual Real solutionEdgeCenter(const concepts::Vector<Real>& sol,
00081             const uint edgeIdx) const = 0;
00087     virtual Real solutionVertex(const concepts::Vector<Real>& sol,
00088         const uint vertexIdx) const = 0;
00093     concepts::Real3d edgeCenter(uint edgeIdx) const;
00095     virtual const concepts::ElementGraphics<Real>* graphics() const = 0;
00096   protected:
00098     virtual std::ostream& info(std::ostream& os) const;
00099     
00100     std::auto_ptr<concepts::TMatrixBase<Real> > T_;
00101     const concepts::Tetrahedron3d& cell_;
00102     static Real eta_[6][3];
00103   };
00104 
00105   //********************************************************** FvdgP0TetElem **
00109   class FvdgP0TetElem : public FvdgElement {
00110   public:
00115     FvdgP0TetElem(const concepts::Tetrahedron3d& cell, uint idx[]);
00120     Real shapeFct(const uint fctIdx, const concepts::Real3d xi) const {
00121       return 1.0;
00122     }
00128     Real shapeFctEdgeCenter(const uint fctIdx, const uint edgeIdx) const {
00129       return 1.0;
00130     }
00136     Real shapeFctVertex(const uint fctIdx, const uint vtxIdx) const {
00137       return 1.0;
00138     }
00143     concepts::Real3d shapeFctGradient(const uint fctIdx) const {
00144       return concepts::Real3d(0.0, 0.0, 0.0);
00145     }
00151     Real solutionEdgeCenter(const concepts::Vector<Real>& sol,
00152           const uint edgeIdx) const {
00153       return sol(T_->index(0));
00154     }
00160     Real solutionVertex(const concepts::Vector<Real>& sol,
00161       const uint vertexIdx) const {
00162       return sol(T_->index(0));
00163     }
00165     const concepts::ElementGraphics<Real>* graphics() const;
00166   protected:
00168     virtual std::ostream& info(std::ostream& os) const;
00170     static std::auto_ptr<FvdgP0TetGraphics> graphics_;
00171   };
00172   
00173   //********************************************************** FvdgP1TetElem **
00177   class FvdgP1TetElem : public FvdgElement {
00178   public:
00183     FvdgP1TetElem(const concepts::Tetrahedron3d& cell, uint idx[]);
00188     Real shapeFct(const uint fctIdx, const concepts::Real3d xi) const;
00194     Real shapeFctEdgeCenter(const uint fctIdx, const uint edgeIdx) const {
00195       conceptsAssert(edgeIdx < 6, concepts::Assertion());
00196       conceptsAssert(fctIdx < 4, concepts::Assertion());
00197       return shapeFctEdgeCenter_[edgeIdx][fctIdx];
00198     }
00204     Real shapeFctVertex(const uint fctIdx, const uint vtxIdx) const {
00205       conceptsAssert(vtxIdx < 4, concepts::Assertion());
00206       conceptsAssert(fctIdx < 4, concepts::Assertion());
00207       return shapeFctVertex_[vtxIdx][fctIdx];
00208     }
00213     concepts::Real3d shapeFctGradient(const uint fctIdx) const;
00219     Real solutionEdgeCenter(const concepts::Vector<Real>& sol,
00220           const uint edgeIdx) const;
00226     Real solutionVertex(const concepts::Vector<Real>& sol,
00227       const uint vertexIdx) const;
00229     const concepts::ElementGraphics<Real>* graphics() const;
00230   protected:
00232     virtual std::ostream& info(std::ostream& os) const;
00234     static Real shapeFctEdgeCenter_[6][4];
00236     static Real shapeFctGradient_[3][4];
00238     static uint nonVanishingNbr_[6];
00240     static Real nonVanishingSign_[6];
00242     static Real shapeFctVertex_[4][4];
00244     static std::auto_ptr<FvdgP1TetGraphics> graphics_;
00245   };
00246 
00247   // *************************************************** TetrahedronGraphics **
00248 
00252   class FvdgP0TetGraphics : public concepts::ElementGraphics<Real> {
00253   public:
00254     virtual void operator()(const concepts::Element<Real>& elm,
00255           enum graphicsType type,
00256           concepts::CellPostprocess<Real>& post) const;
00257   protected:
00258     virtual std::ostream& info(std::ostream& os) const;
00259   };
00260 
00264   class FvdgP1TetGraphics : public concepts::ElementGraphics<Real> {
00265   public:
00266     virtual void operator()(const concepts::Element<Real>& elm,
00267           enum graphicsType type,
00268           concepts::CellPostprocess<Real>& post) const;
00269   protected:
00270     virtual std::ostream& info(std::ostream& os) const;
00271   };  
00272 } // namespace linDG3D
00273 
00274 #endif

Home | Doxygen Documentation | Tutorials | Developer Tools (restricted)