alugrid/2d/datahandle.hh

00001 #ifndef DUNE_ALU2DGRIDDATAHANDLE_HH
00002 #define DUNE_ALU2DGRIDDATAHANDLE_HH
00003 
00004 //- system includes 
00005 #include <iostream>
00006 
00007 //- local includes 
00008 #include "alu2dinclude.hh"
00009 
00010 using std::endl;
00011 using std::cout;
00012 using std::flush;
00013 
00014 namespace ALU2DSPACENAME {
00015 //struct AdaptRestrictProlong2dType {
00016 //};
00017 
00019 //
00020 //  --AdaptRestrictProlong 
00021 //
00023 template <class GridType , class RestrictProlongOperatorType >
00024  class AdaptRestrictProlong2dImpl : public AdaptRestrictProlong2dType
00025 {
00026   GridType & grid_;
00027   typedef Dune :: MakeableInterfaceObject<typename GridType::template Codim<0>::Entity> EntityType;
00028   typedef typename EntityType :: ImplementationType RealEntityType;
00029   typedef typename Hmesh_basic::helement_t HElementType ;
00030   
00031   EntityType & reFather_;
00032   EntityType & reSon_;
00033   RealEntityType & realFather_;
00034   RealEntityType & realSon_;
00035  
00036   //DofManagerType & dm_;
00037   RestrictProlongOperatorType & rp_;
00038 
00039   int maxlevel_;
00040 
00041 
00042 public:
00044   AdaptRestrictProlong2dImpl (GridType & grid, 
00045       EntityType & f, RealEntityType & rf, EntityType & s, RealEntityType & rs
00046       , RestrictProlongOperatorType & rp) 
00047     : grid_(grid)
00048     , reFather_(f)
00049     , reSon_(s)
00050     , realFather_(rf) 
00051     , realSon_(rs) 
00052     , rp_(rp) 
00053     , maxlevel_(-1) 
00054   {
00055   }
00056 
00057   virtual ~AdaptRestrictProlong2dImpl () 
00058   {
00059   }
00060 
00062   int preCoarsening ( HElementType & elem )
00063   {
00064     // set element and then start 
00065     HElementType * son = elem.down();
00066     if(elem.level() > maxlevel_) maxlevel_ = elem.level();
00067 
00068     //elem.resetRefinedTag();
00069     assert( son );
00070    
00071     realSon_.setElement(*son);
00072     realFather_.setElement(elem);
00073     rp_.restrictLocal(reFather_,reSon_,true);
00074 
00075     son = son->next();
00076     while( son )
00077     {
00078       realSon_.setElement(*son);
00079       rp_.restrictLocal(reFather_,reSon_,false);
00080       son = son->next();
00081     }
00082     return 0;
00083   }
00084 
00086   int postRefinement ( HElementType & elem )
00087   {
00088     // set element and then start 
00089     HElementType * son = elem.down();
00090     assert( son );
00091     //elem.resetRefinedTag();
00092    
00093     realFather_.setElement(elem);
00094     realSon_.setElement(*son);
00095     int level = realSon_.level(); 
00096     if(level > maxlevel_) maxlevel_ = level;
00097     
00098     rp_.prolongLocal(reFather_,reSon_, false);
00099 
00100     son = son->next();
00101     while( son )
00102     {
00103       assert( son );
00104   
00105       realSon_.setElement(*son);
00106       rp_.prolongLocal(reFather_,reSon_, false);
00107       
00108       son = son->next();
00109     }
00110     return 0;
00111   }
00112 
00113   int maxLevel () const { return maxlevel_; }
00114 };
00115 
00116 } // end namespace 
00117 #endif

Generated on 6 Nov 2008 with Doxygen (ver 1.5.6) [logfile].