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

hp1D/space.hh
Go to the documentation of this file.
00001 /* class for the hp FEM space in 1D
00002  */
00003 
00004 #ifndef Space1D_hh
00005 #define Space1D_hh
00006 
00007 #include "basics/exceptions.hh"
00008 #include "basics/typedefs.hh"
00009 #include "geometry/mesh.hh"
00010 #include "geometry/boundaryConditions.hh"
00011 #include "space/space.hh"
00012 #include "space/hpMethod.hh"
00013 #include "toolbox/scannerConnectors.hh"
00014 #include "toolbox/dynArray.hh"
00015 #include "element.hh"
00016 
00017 namespace hp1D {
00018   using concepts::Real;
00019 
00020   // ***************************************************************** Space **
00021 
00025   class Space :
00026     public concepts::SpaceOnCells<Real>, 
00027     public concepts::AdaptiveSpace<Real, concepts::AdaptiveAdjustP<1> > {
00028   public:
00029     typedef concepts::Scan<Element<Real> > Scan;
00030 
00041     Space(concepts::Mesh1& msh, uint l, uint p,
00042           concepts::BoundaryConditions* bc = 0);
00043     virtual ~Space();
00044     
00045     inline uint dim() const;
00046     inline uint nelm() const;
00047     inline Scan* scan() const;
00048 
00049     inline uint dim();
00050     inline uint nelm();
00051     inline Scan* scan();
00052 
00053     virtual void adjust(const concepts::Element<Real>& elm,
00054                         const concepts::AdaptiveAdjustP<1>& a);
00055 
00057     void rebuild();
00058 
00062     void recomputeShapefunctions();
00063   protected:
00064     virtual std::ostream& info(std::ostream& os) const;
00065   private:
00067     concepts::Mesh1& msh_;
00069     concepts::BoundaryConditions* bc_;
00070 
00075     bool rebuild_;
00076 
00078     uint dim_;
00079 
00081     uint nelm_;
00082 
00084     concepts::Joiner<Element<Real>*, 1>* elm_;
00085 
00087     concepts::DynArray<concepts::AdaptiveControl<> > ctrl0_;
00089     concepts::DynArray<concepts::AdaptiveControlP<1> > ctrl1_;
00090 
00092     concepts::DynArray<concepts::AdaptiveAdjustP<1> > adj_;
00093 
00094     void meshAndPoly_(concepts::EdgeNd& cell, int l, int& L, int& P);
00095     void buildElements_(concepts::EdgeNd& cell,
00096       concepts::TColumn<Real>* T0 = 0);
00097     void enforceBC_(concepts::EdgeNd& cell);
00098   };
00099 
00100   uint Space::dim() const {
00101     if (rebuild_) throw conceptsException(concepts::SpaceNotBuilt());
00102     return dim_; 
00103   }
00104 
00105   uint Space::nelm() const {
00106     if (rebuild_) throw conceptsException(concepts::SpaceNotBuilt());
00107     return nelm_; 
00108   }
00109 
00110   Space::Scan* Space::scan() const {
00111     if (rebuild_) throw conceptsException(concepts::SpaceNotBuilt());
00112     return new concepts::PListScan<Element<Real> >(*elm_);
00113   }
00114 
00115   uint Space::dim() {
00116     if (rebuild_) rebuild();
00117     return dim_; 
00118   }
00119 
00120   uint Space::nelm() {
00121     if (rebuild_) rebuild();
00122     return nelm_; 
00123   }
00124 
00125   Space::Scan* Space::scan() {
00126     if (rebuild_) rebuild();
00127     return new concepts::PListScan<Element<Real> >(*elm_);
00128   }
00129 
00130 } // namespace hp1D
00131 
00132 #endif // Space1D_hh

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