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

space/hpMethod.hh
Go to the documentation of this file.
00001 /* control structures for high order methods
00002  */
00003 
00004 #ifndef hpMethod_hh
00005 #define hpMethod_hh
00006 
00007 #include <cstring>
00008 #include "basics/level.hh"
00009 #include "toolbox/array.hh"
00010 #include "space.hh"
00011 #include "postProcess.hh"
00012 
00013 namespace concepts {
00014 
00015   // ****************************************************** AdaptiveControlP **
00016 
00025   template<int dim, class F = uint>
00026   struct AdaptiveControlP : public AdaptiveControl<F> {
00028     ushort p_[dim];
00029 
00032     AdaptiveControlP() : AdaptiveControl<F>() {
00033       std::memset(p_, 0, dim*sizeof(ushort));
00034     }
00035 
00036     bool operator!=(const AdaptiveControlP<dim,F>& a) { return this != &a; }
00037 
00038     std::ostream& info(std::ostream& os) const;
00039   };
00040 
00041   template<int dim, class F>
00042   std::ostream& operator<<(std::ostream& os, const AdaptiveControlP<dim, F>& a)
00043   {
00044     return a.info(os);
00045   }
00046 
00047   // ******************************************************* AdaptiveAdjustP **
00048 
00056   template<int dim>
00057   class AdaptiveAdjustP : public AdaptiveAdjust<dim> {
00058   public:
00062     short p_[dim];
00063     
00067     AdaptiveAdjustP() : AdaptiveAdjust<dim>() {
00068       std::memset(p_, 0, dim*sizeof(short));
00069     }
00074     AdaptiveAdjustP(short l, int* p) :
00075       AdaptiveAdjust<dim>(l) {
00076       for (int i = 0; i < dim; ++i) p_[i] = p[i];
00077     }
00082     AdaptiveAdjustP(short l, const int p) :
00083       AdaptiveAdjust<dim>(l) {
00084       for (int i = 0; i < dim; ++i) p_[i] = p;
00085     }
00090     AdaptiveAdjustP(short l, const Array<int> p) :
00091       AdaptiveAdjust<dim>(l) {
00092       conceptsAssert(p.size() == dim, Assertion());
00093       for (int i = 0; i < dim; ++i) p_[i] = p[i];
00094     }
00099     AdaptiveAdjustP(const Level<dim>& l, const int p) {
00100       this->level_ = l;
00101       for (int i = 0; i < dim; ++i) p_[i] = p;
00102     }
00107     AdaptiveAdjustP(const Level<dim>& l, const int* p) {
00108       this->level_ = l;
00109       for (int i = 0; i < dim; ++i) p_[i] = p[i];
00110     }
00115     AdaptiveAdjustP(const Level<dim>& l, const Array<int> p) {
00116       conceptsAssert(p.size() == dim, Assertion());
00117       this->level_ = l;
00118       for (int i = 0; i < dim; ++i) p_[i] = p[i];
00119     }
00120     
00121     AdaptiveAdjustP<dim>& operator=(const AdaptiveAdjustP<dim>& a);
00122 
00123     std::ostream& info(std::ostream& os) const;
00124   };
00125   
00126   template<int dim>
00127   std::ostream& operator<<(std::ostream& os, const AdaptiveAdjustP<dim>& a) {
00128     return a.info(os);
00129   }
00130 
00131   // *********************************************************** HRefinement **
00132 
00142   template<typename F, int dim>
00143   class HRefinement : public CellPostprocess<F> {
00144   public:
00148     HRefinement(AdaptiveSpace<F, AdaptiveAdjustP<dim> >& spc) : spc_(spc) {}
00149     virtual void operator() (const Element<F>& elm) throw(MissingFeature);
00150     virtual void operator() (const Cell& cell) throw(MissingFeature) {}
00151   protected:
00152     virtual std::ostream& info(std::ostream& os) const;
00153   private:
00155     AdaptiveSpace<F, AdaptiveAdjustP<dim> >& spc_;
00156   };
00157 
00158   // *********************************************************** PRefinement **
00159 
00169   template<typename F, int dim>
00170   class PRefinement : public CellPostprocess<F> {
00171   public:
00175     PRefinement(AdaptiveSpace<F, AdaptiveAdjustP<dim> >& spc) : spc_(spc) {}
00176     virtual void operator() (const Element<F>& elm) throw(MissingFeature);
00177     virtual void operator() (const Cell& cell) throw(MissingFeature) {}
00178   protected:
00179     virtual std::ostream& info(std::ostream& os) const;
00180   private:
00182     AdaptiveSpace<F, AdaptiveAdjustP<dim> >& spc_;
00183   };
00184 
00185 } // namespace concepts
00186 
00187 #endif // hpMethod_hh

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