Go to the documentation of this file.00001
00002
00003 #ifndef triangleP2_HH
00004 #define triangleP2_HH
00005
00006 #include "basics/exceptions.hh"
00007 #include "basics/typedefs.hh"
00008 #include "linearFEM/element2D.hh"
00009 #include "toolbox/elementGraphics.hh"
00010 #include "toolbox/hashMap.hh"
00011 #include "space/space.hh"
00012
00013 using concepts::Real;
00014
00015 namespace concepts {
00016
00017 class Mesh2;
00018 class BoundaryConditions;
00019 }
00020
00021
00022
00027 class TriangleP2Graphics : public concepts::ElementGraphics<Real> {
00028 public:
00029 virtual void operator()(const concepts::Element<Real>& elm,
00030 enum graphicsType type,
00031 concepts::CellPostprocess<Real>& post) const;
00032 protected:
00033 virtual std::ostream& info(std::ostream& os) const;
00034 };
00035
00036
00037
00041 class TriangleP2 : public linearFEM::Element {
00042 public:
00048 TriangleP2(const concepts::Triangle2d& cell, uint idx[]) :
00049 linearFEM::Element(6, idx), cell_(cell) {}
00056 TriangleP2(const concepts::Triangle2d& cell, concepts::TColumn<Real>* T0,
00057 concepts::TColumn<Real>* T1 = 0) :
00058 linearFEM::Element(T0, T1), cell_(cell) {}
00059 virtual const concepts::Triangle& support() const {
00060 return cell_.connector(); }
00061 virtual const concepts::Triangle2d& cell() const { return cell_; }
00069 Real shapefct(const uint i, const Real xi1, const Real xi2) const;
00075 concepts::Real2d shapefctD(const uint i,
00076 const Real xi1, const Real xi2) const;
00077 virtual const concepts::ElementGraphics<Real>* graphics() const;
00078 protected:
00079 virtual std::ostream& info(std::ostream& os) const;
00080 private:
00082 const concepts::Triangle2d& cell_;
00083 static std::auto_ptr<TriangleP2Graphics> graphics_;
00084 };
00085
00086 namespace concepts {
00087 template<>
00088 class Scan<TriangleP2> : public Scan<concepts::Element<Real> > {
00089 public:
00090 virtual TriangleP2& operator++(int) = 0;
00091 };
00092 }
00093
00094
00095
00099 class TrianglesP2 : public concepts::Space<Real> {
00100 public:
00101 typedef concepts::Scan<TriangleP2> Scan;
00102 typedef void (*SMap)(const concepts::TColumn<Real>&,
00103 concepts::TColumn<Real>&);
00109 TrianglesP2(concepts::Mesh2& msh, uint level,
00110 concepts::BoundaryConditions* bc = 0);
00111 virtual ~TrianglesP2();
00112 virtual uint dim() const { return dim_; }
00113 virtual uint nelm() const { return nelm_; }
00114 virtual TrianglesP2::Scan* scan() const;
00116 void rebuild();
00117 protected:
00118 virtual std::ostream& info(std::ostream& os) const;
00119 private:
00121 uint dim_;
00123 uint nelm_;
00125 bool rebuild_;
00127 concepts::Mesh2& msh_;
00129 concepts::BoundaryConditions* bc_;
00131 concepts::Joiner<TriangleP2*, 1>* elm_;
00133 __gnu_cxx::hash_map<uint, short> adj_;
00135 __gnu_cxx::hash_map<uint, short> ctrl0_;
00137 __gnu_cxx::hash_map<uint, short> ctrl0L_;
00139 __gnu_cxx::hash_map<uint, short> ctrl1_;
00141 __gnu_cxx::hash_map<uint, short> ctrl1L_;
00143 __gnu_cxx::hash_map<uint, short> ctrl2_;
00145 __gnu_cxx::hash_map<uint, uint> dofVtx_, dofEdg_;
00146
00147 static SMap S_[4];
00148
00155 void rebuild0_(concepts::Connector2& cntr, const int l, int& L);
00164 void rebuild1_(concepts::Triangle2d& cell,
00165 concepts::TColumn<Real>* T0 = 0);
00167 void deactivate_(concepts::Connector1& edg);
00168 };
00169
00170 #endif // triangleP2_HH