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

hp2Dedge/space.hh
Go to the documentation of this file.
00001 /* space class for 2D hp edge FEM
00002  */
00003 
00004 #ifndef hpSpace2Dedge_hh
00005 #define hpSpace2Dedge_hh
00006 
00007 #include <memory>
00008 #include <cstring>
00009 #include <set>
00010 #include "basics/exceptions.hh"
00011 #include "basics/typedefs.hh"
00012 #include "space/space.hh"
00013 #include "space/hpMethod.hh"
00014 #include "geometry/continuityData.hh"
00015 #include "geometry/cell2D.hh"
00016 #include "geometry/mesh.hh"
00017 #include "toolbox/scannerConnectors.hh"
00018 #include "toolbox/dynArray.hh"
00019 #include "geometry/boundaryConditions.hh"
00020 #include "hp2D/element.hh"
00021 #include "hp2D/space.hh"
00022 
00023 namespace concepts {
00024 
00025   // forward declarations
00026   template<class F>
00027   class SMatrixBase;
00028 
00029   class SMatrix1D;
00030 
00031   template<class F, int dim>
00032   class SMatrixTensor;
00033 
00034 } // namespace concepts
00035 
00036 namespace hp2Dedge {
00037   using concepts::Real;
00038 
00039   // ***************************************************************** Space **
00040 
00048   class Space : 
00049     public concepts::SpaceOnCells<Real>,
00050     public concepts::AdaptiveSpace<Real, concepts::AdaptiveAdjustP<2> > {
00051   public:
00052     typedef concepts::Scan<hp2D::Element<Real> > Scan;
00053 
00067     Space(concepts::Mesh2& msh, uint l, uint p,
00068     concepts::BoundaryConditions* bc = 0, bool trunk = false);
00069     virtual ~Space();
00070     
00071     inline uint dim() const;
00072     inline uint nelm() const;
00074     inline Scan* scan() const;
00076     inline concepts::Scan<const concepts::Quad>* interScan() const;
00077 
00078     inline uint dim();
00079     inline uint nelm();
00081     inline Scan* scan();
00083     inline concepts::Scan<const concepts::Quad>* interScan();
00084 
00085     virtual void adjust(const concepts::Element<Real>& elm,
00086       const concepts::AdaptiveAdjustP<2>& a);
00087 
00088     inline concepts::BoundaryConditions* boundary() { return bc_;}
00089 
00106     void rebuild();
00110     void recomputeShapefunctions();
00111   protected:
00112     virtual std::ostream& info(std::ostream& os) const;
00113   private:
00115     concepts::Mesh2& msh_;
00117     concepts::BoundaryConditions* bc_;
00119     bool trunk_;
00120 
00125     bool rebuild_;
00126 
00128     uint dim_;
00129 
00131     uint nelm_;
00132 
00134     concepts::Joiner<hp2D::Element<Real>*, 1>* elm_;
00135 
00137     concepts::DynArray<concepts::AdaptiveControl<> > ctrl0_;
00139     concepts::DynArray<concepts::AdaptiveControlP<1> > ctrl1_;
00141     __gnu_cxx::hash_map<uint, concepts::AdaptiveControlP<2> > ctrl2_;
00142 
00144     std::map<uint, concepts::CellData> cellList_;
00146     std::map<uint, concepts::EdgeData> edgeList_;
00147 
00149     concepts::TColumnSet<Real,2> T_;
00150     /* Linked list of cells, created for handling subdivision
00151        in 4 quadrilaterials, which lie between the four children
00152        and the father
00153      */
00154     concepts::Joiner<const concepts::Quad*, 1>* interCells_;
00155     /* list of edges, created for handling subdivision
00156        in 4 quadrilaterials, which lie between the four children
00157        and the father
00158      */
00159     std::set<uint> interEdges_;
00160 
00162     concepts::DynArray<concepts::AdaptiveAdjustP<2> > adj_;
00163 
00165     std::auto_ptr<concepts::SMatrix1D> 
00166     S1left_t_, S1right_t_, S1left_n_, S1right_n_;
00167     // --> allgemein (mit hp2D) schreiben als C-Array oder Liste
00168     //     QuadEdgeFunctions kann hineinschreiben
00169     
00172     std::auto_ptr<concepts::SMatrixBase<Real> > Smatrices2H_X_[2];
00173     std::auto_ptr<concepts::SMatrixBase<Real> > Smatrices2H_Y_[2];
00174     std::auto_ptr<concepts::SMatrixBase<Real> > Smatrices2V_X_[2];
00175     std::auto_ptr<concepts::SMatrixBase<Real> > Smatrices2V_Y_[2];
00176 
00180     std::auto_ptr<concepts::SMatrixBase<Real> > Smatrices2H_[2];
00184     std::auto_ptr<concepts::SMatrixBase<Real> > Smatrices2V_[2];
00188     std::auto_ptr<concepts::SMatrixBase<Real> > Smatrices4_[4];
00189 
00210     void meshAndPoly_(concepts::Quad2d& cell, concepts::Level<2>& L, int* P);
00211 
00216     void enforceBC_(concepts::Quad2d& cell);
00217 
00219     void createCellList_(const concepts::Connector& cntr,
00220        const concepts::CellData* father);
00222     void createEdgList_(const concepts::Cell2& cell);
00223 
00238     void enrichElm_(const concepts::Quad2d& cell, int* p);
00239 
00249     void minimumRule_(const concepts::Connector2& cntr,
00250           const concepts::Connector1& edge);
00251 
00266     void buildTColumns_(const concepts::Quad& cntr, ushort* Pmax,
00267       concepts::TColumn<Real>* T0 = 0);
00268 
00270     concepts::TColumn<Real>* buildEdge_(concepts::TColumn<Real>* T1, 
00271           const concepts::Quad& cntr,
00272           const uint* nn);
00273 
00275     concepts::TColumn<Real>* buildInterior_(concepts::TColumn<Real>* T1,
00276               const concepts::Quad& cntr,
00277               const uint* nn);
00278 
00286     void buildElements_(concepts::Quad2d& cell);
00287 
00292     void computePmax_(const concepts::Connector2& cntr, ushort Pmax[2]) const;
00293 
00300     void edgeOrientation_(const concepts::Connector2& cntr, const uint i,
00301         uint& pIndex) const;
00302 
00312     void recomputeSmatrices_(const ushort* p, const uint* nn); 
00313 
00314     void deactivate_(concepts::Edge& edg);
00315     void deactivate_(concepts::Vertex& vtx);
00316 
00327     void nonactiveRegion_(); 
00328 
00330     bool activeCell_(concepts::Cell& cell);
00331 
00335     void status_();
00336     void matlabstatus_();
00337   };
00338 
00339   uint Space::dim() const {
00340     if (rebuild_) throw conceptsException(concepts::SpaceNotBuilt());
00341     return dim_; 
00342   }
00343 
00344   uint Space::nelm() const {
00345     if (rebuild_) throw conceptsException(concepts::SpaceNotBuilt());
00346     return nelm_; 
00347   }
00348 
00349   Space::Scan* Space::scan() const {
00350     if (rebuild_) throw conceptsException(concepts::SpaceNotBuilt());
00351     return new concepts::PListScan<hp2D::Element<Real> >(*elm_);
00352   }
00353 
00354   concepts::Scan<const concepts::Quad>* Space::interScan() const {
00355     if (rebuild_) throw conceptsException(concepts::SpaceNotBuilt());
00356     return new concepts::PListScan<const concepts::Quad>(*interCells_);
00357   }
00358 
00359   uint Space::dim() {
00360     if (rebuild_) rebuild();
00361     return dim_; 
00362   }
00363 
00364   uint Space::nelm() {
00365     if (rebuild_) rebuild();
00366     return nelm_; 
00367   }
00368 
00369   Space::Scan* Space::scan() {
00370     if (rebuild_) rebuild();
00371     return new concepts::PListScan<hp2D::Element<Real> >(*elm_);
00372   }
00373 
00374   concepts::Scan<const concepts::Quad>* Space::interScan() {
00375     if (rebuild_) rebuild();
00376     return new concepts::PListScan<const concepts::Quad>(*interCells_);
00377   }
00378 
00379 } // namespace hp2Dedge
00380 
00381 #endif // hpSpace2Dedge_hh

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