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

linearFEM/space2D.hh
Go to the documentation of this file.
00001 // space for linear FEM in 2D
00002 
00003 #ifndef linSpace2D_hh
00004 #define linSpace2D_hh
00005 
00006 #if __ICC == 800
00007 #  include <hash_map>
00008 #  define __gnu_cxx std
00009 #else
00010 #  if __GNUC__ >= 3
00011 #    include <ext/hash_map>
00012 #    if __GNUC_MINOR__ < 1 && __GNUC__ == 3
00013 #      define __gnu_cxx std
00014 #    endif
00015 #  else
00016 #    include <hash_map>
00017 #    define __gnu_cxx std
00018 #  endif
00019 #endif
00020 
00021 #include "element2D.hh"
00022 #include "basics/typedefs.hh"
00023 #include "space/space.hh"
00024 #include "space/element.hh"
00025 #include "toolbox/scannerConnectors.hh"
00026 
00027 namespace concepts {
00028 
00029   // forward declarations
00030   class Mesh2;
00031   class BoundaryConditions;
00032 
00033   // ************************************************************** Scanners **
00034 
00035   template<>
00036     class Scan<linearFEM::Triangle> : public Scan<linearFEM::Element> {
00037       public:
00038         virtual linearFEM::Triangle& operator++(int) = 0;
00039     };
00040 
00041   template<>
00042     class Scan<linearFEM::Quad> : public Scan<linearFEM::Element> {
00043       public:
00044         virtual linearFEM::Quad& operator++(int) = 0;
00045     };
00046 
00047 } // namespace concepts
00048 
00049 namespace linearFEM {
00050 
00051   // ************************************************************** Linear2d **
00052 
00056   class Linear2d : public concepts::Space<Real> {
00057     public:
00058       typedef concepts::Scan<Element> Scan;
00059       typedef void (*SMap)(const concepts::TColumn<Real>&,
00060           concepts::TColumn<Real>&);
00061 
00067       Linear2d(concepts::Mesh2& msh, uint level,
00068           concepts::BoundaryConditions* bc = 0);
00069       virtual ~Linear2d();
00070       virtual uint dim() const { return dim_; }
00071       virtual uint nelm() const { return nelm_; }
00072       virtual Scan* scan() const;
00074       void rebuild();
00080       void adjust(const Quad& elm, const short level);
00081 
00088       const SMap& S(uint i) const;
00089 
00090       static void S0(const concepts::TColumn<Real>& src,
00091           concepts::TColumn<Real>& dst); // bottom left
00092       static void S1(const concepts::TColumn<Real>& src,
00093           concepts::TColumn<Real>& dst); // bottom right
00094       static void S2(const concepts::TColumn<Real>& src,
00095           concepts::TColumn<Real>& dst); // top right
00096       static void S3(const concepts::TColumn<Real>& src,
00097           concepts::TColumn<Real>& dst); // top left
00098 
00099     protected:
00100       virtual std::ostream& info(std::ostream& os) const;
00101     private:
00103       uint dim_;
00105       uint nelm_;
00107       bool rebuild_;
00109       concepts::Mesh2& msh_;
00111       concepts::BoundaryConditions* bc_;
00113       concepts::Joiner<Element*, 1>* elm_;
00115       __gnu_cxx::hash_map<uint, short> adj_;
00117       __gnu_cxx::hash_map<uint, short> ctrl0_;
00119       __gnu_cxx::hash_map<uint, short> ctrl0L_;
00121       __gnu_cxx::hash_map<uint, short> ctrl1_;
00123       __gnu_cxx::hash_map<uint, short> ctrl1L_;
00125       __gnu_cxx::hash_map<uint, short> ctrl2_;
00127       __gnu_cxx::hash_map<uint, uint> dof_;
00128 
00129       static SMap S_[4];
00130 
00137       void rebuild0_(concepts::Connector2& cntr, const int l, int& L);
00138 
00145       void rebuild1_(concepts::Quad2d& cell, concepts::TColumn<Real>* T0 = 0);
00146 
00155       void rebuild1_(concepts::Triangle2d& cell,
00156           concepts::TColumn<Real>* T0 = 0);
00158       void deactivate_(concepts::Connector1& edg);
00159   };
00160 
00161 } // namespace linearFEM
00162 
00163 #endif // linSpace2D_hh

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