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

hp3D/space.hh
Go to the documentation of this file.
00001 /* space class for 3D hp FEM
00002  */
00003 
00004 #ifndef hpSpace3D_hh
00005 #define hpSpace3D_hh
00006 
00007 #include <memory>
00008 #include <map>
00009 #include <cstring>
00010 #include "basics/exceptions.hh"
00011 #include "basics/typedefs.hh"
00012 #include "basics/level.hh"
00013 #include "toolbox/hashMap.hh"
00014 #include "space/space.hh"
00015 #include "space/hpMethod.hh"
00016 #include "space/smatrix.hh"
00017 #include "geometry/continuityData.hh"
00018 #include "geometry/cell3D.hh"
00019 #include "geometry/mesh.hh"
00020 #include "geometry/boundaryConditions.hh"
00021 #include "toolbox/scannerConnectors.hh"
00022 #include "element.hh"
00023 
00024 namespace concepts {
00025 
00026   // forward declaration
00027   class InOutParameters;
00028 
00029   // ****************************************************************** Scan **
00030 
00031   template<>
00032   class Scan<hp3D::Element<Real> > :
00033     public concepts::Scan<concepts::ElementWithCell<Real> > {
00034   public:  
00035     hp3D::Element<Real>& operator++(int) = 0;
00036   };
00037 
00038 } // namespace concepts
00039 
00040 namespace hp3D {
00041   using concepts::Real;
00042 
00043   // forward declarations
00044   class Hexahedron;
00045   class BuildDofsBase;
00046 
00047   // ***************************************************************** Space **
00048 
00078   class Space :
00079     public concepts::SpaceOnCells<Real>,
00080     public concepts::AdaptiveSpace<Real, concepts::AdaptiveAdjustP<3> > {
00081     friend class BuildDofsBase;
00082   public:
00083     typedef concepts::Scan<hp3D::Element<Real> > Scan;
00084 
00095     Space(concepts::Mesh3& msh, uint l, uint p,
00096     concepts::BoundaryConditions* bc = 0);
00098     Space(const Space& spc);
00099     virtual ~Space();
00100     
00101     inline virtual uint dim() const;
00102     inline virtual uint nelm() const;
00103     inline virtual Scan* scan() const;
00104 
00105     inline uint dim();
00106     inline uint nelm();
00107     inline Scan* scan();
00108 
00109     virtual void adjust(const concepts::Element<Real>& elm,
00110       const concepts::AdaptiveAdjustP<3>& a);
00111 
00149     Space rebuild();
00150 
00152     const std::auto_ptr<concepts::SMatrixBase<Real> >*
00153     getSmatrices(const concepts::Hex3dSubdivision* subdiv) const;
00154 
00161     void recomputeSmatrices(const Hexahedron* elm) const;
00162 
00194     static void setTimings(concepts::InOutParameters* timings);
00198     static bool timings();
00200 
00211     void buildVertexDofs(const BuildDofsBase& b);
00219     void buildEdgeDofs(const BuildDofsBase& b);
00227     void buildFaceDofs(const BuildDofsBase& b);
00235     void buildInnerDofs(const BuildDofsBase& b);
00237   protected:
00238     virtual std::ostream& info(std::ostream& os) const;
00239   private:
00241     concepts::Mesh3& msh_;
00243     concepts::BoundaryConditions* bc_;
00247     bool rebuild_;
00248 
00250     uint dim_;
00252     uint nelm_;
00254     concepts::Joiner<Element<Real>*, 1>* elm_;
00255     concepts::Joiner<Element<Real>*, 1>* endElm_;
00257     __gnu_cxx::hash_map<uint, concepts::AdaptiveControl<> > ctrl0_;
00259     std::auto_ptr<__gnu_cxx::hash_map<uint,
00260               concepts::AdaptiveControlP<1> > > ctrl1_;
00262     std::auto_ptr<__gnu_cxx::hash_map<uint,
00263               concepts::AdaptiveControlP<2> > > ctrl2_;
00265     __gnu_cxx::hash_map<uint, concepts::AdaptiveControlP<3> > ctrl3_;
00266 
00268     std::map<uint, concepts::CellData> cellList_;
00270     std::map<uint, concepts::FaceData> faceList_;
00272     std::map<uint, concepts::EdgeData> edgeList_;
00274     std::map<uint, concepts::VertexData> vertexList_;
00275 
00277     __gnu_cxx::hash_map<uint, concepts::AdaptiveAdjustP<3> > adj_;
00278 
00280     mutable std::auto_ptr<concepts::SMatrix1D> S1left_, S1right_;
00284     mutable std::auto_ptr<concepts::SMatrixBase<Real> > Smatrices8_[8];
00288     mutable std::auto_ptr<concepts::SMatrixBase<Real> > Smatrices4x_[4],
00289       Smatrices4y_[4], Smatrices4z_[4];
00293     mutable std::auto_ptr<concepts::SMatrixBase<Real> > Smatrices2x_[2],
00294       Smatrices2y_[2], Smatrices2z_[2];
00295 
00297     static concepts::InOutParameters* timings_;
00299     static uint timeCntr_;
00300 
00304     std::auto_ptr<BuildDofsBase> buildVertexDofs_;
00308     std::auto_ptr<BuildDofsBase> buildEdgeDofs_;
00312     std::auto_ptr<BuildDofsBase> buildFaceDofs_;
00316     std::auto_ptr<BuildDofsBase> buildInnerDofs_;
00317 
00338     void meshAndPoly_(concepts::Hexahedron3d& cell,
00339           concepts::Level<3>& L, int* P);
00340 
00345     void enforceBC_(concepts::Hexahedron3d& cell);
00346 
00354     void createCellList_(const concepts::Connector& cntr,
00355        const concepts::CellData* father);
00363     void createEdgFaceList_(const concepts::Cell3& cell);
00369     void createVtxEdgList_(const concepts::Cell3& cell);
00370 
00386     void enrichElm_(const concepts::Hexahedron3d& cell, int* p);
00387 
00401     void buildElements_(concepts::Hexahedron3d& cell,
00402       ushort* Pmax,
00403       concepts::TColumn<Real>* T0 = 0);
00404 
00409     void computePmax_(const concepts::Hexahedron& cntr,
00410           ushort Pmax[3]) const;
00411 
00415     void deactivate_(const concepts::Connector2& face);
00419     void deactivate_(const concepts::Connector1& edg);
00421     void deactivate_(const concepts::Connector0& vtx);
00428     void doCorrectRefinement_(concepts::Hexahedron3d& cell,
00429             concepts::Level<3>& L) const;
00430   };
00431 
00432   uint Space::dim() const {
00433     if (rebuild_) throw conceptsException(concepts::SpaceNotBuilt());
00434     return dim_; 
00435   }
00436 
00437   uint Space::nelm() const {
00438     if (rebuild_) throw conceptsException(concepts::SpaceNotBuilt());
00439     return nelm_; 
00440   }
00441 
00442   Space::Scan* Space::scan() const {
00443     if (rebuild_) throw conceptsException(concepts::SpaceNotBuilt());
00444     return new concepts::PListScan<Element<Real> >(*elm_);
00445   }
00446 
00447   uint Space::dim() {
00448     if (rebuild_) rebuild();
00449     return dim_; 
00450   }
00451 
00452   uint Space::nelm() {
00453     if (rebuild_) rebuild();
00454     return nelm_; 
00455   }
00456 
00457   Space::Scan* Space::scan() {
00458     if (rebuild_) rebuild();
00459     return new concepts::PListScan<Element<Real> >(*elm_);
00460   }
00461 
00462 } // namespace hp3d
00463 
00464 #include "buildDofsBase.hh"
00465 
00466 #endif // hpElement3d_h

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