alugrid/2d/datahandle.hh

Go to the documentation of this file.
00001 #ifndef DUNE_ALU2DGRIDDATAHANDLE_HH
00002 #define DUNE_ALU2DGRIDDATAHANDLE_HH
00003 
00004 //- system includes 
00005 #include <iostream>
00006 
00007 #include <dune/grid/common/adaptcallback.hh>
00008 
00009 //- local includes 
00010 #include "alu2dinclude.hh"
00011 
00012 using std::endl;
00013 using std::cout;
00014 using std::flush;
00015 
00016 namespace ALU2DSPACENAME {
00017 //struct AdaptRestrictProlong2dType {
00018 //};
00019 
00021 //
00022 //  --AdaptRestrictProlong 
00023 //
00025 template< class GridType, class AdaptDataHandle >
00026 class AdaptRestrictProlong2dImpl
00027 : public AdaptRestrictProlong2d ALU2DDIMWORLD( GridType::dimensionworld, GridType::elementType )
00028 {
00029   GridType & grid_;
00030   typedef Dune :: MakeableInterfaceObject<typename GridType::template Codim<0>::Entity> EntityType;
00031   typedef typename EntityType :: ImplementationType RealEntityType;
00032   typedef typename Dune::ALU2dImplTraits< GridType::dimensionworld, GridType::elementType >::HElementType HElementType ;
00033   
00034   EntityType & reFather_;
00035   EntityType & reSon_;
00036   RealEntityType & realFather_;
00037   RealEntityType & realSon_;
00038 
00039   AdaptDataHandle &rp_;
00040 
00041   int maxlevel_;
00042 
00043 
00044 public:
00046   AdaptRestrictProlong2dImpl ( GridType &grid,
00047                                EntityType &f, RealEntityType &rf,
00048                                EntityType &s, RealEntityType &rs,
00049                                AdaptDataHandle &rp )
00050    : grid_(grid)
00051     , reFather_(f)
00052     , reSon_(s)
00053     , realFather_(rf) 
00054     , realSon_(rs) 
00055     , rp_(rp) 
00056     , maxlevel_(-1) 
00057   {
00058   }
00059 
00060   virtual ~AdaptRestrictProlong2dImpl () 
00061   {
00062   }
00063 
00065   int preCoarsening ( HElementType & elem )
00066   {
00067 #if 0
00068     // set element and then start 
00069     HElementType * son = elem.down();
00070     if(elem.level() > maxlevel_) maxlevel_ = elem.level();
00071 
00072     //elem.resetRefinedTag();
00073     assert( son );
00074    
00075     realSon_.setElement(*son);
00076     realFather_.setElement(elem);
00077     rp_.restrictLocal(reFather_,reSon_,true);
00078 
00079     son = son->next();
00080     while( son )
00081     {
00082       realSon_.setElement(*son);
00083       rp_.restrictLocal(reFather_,reSon_,false);
00084       son = son->next();
00085     }
00086 #endif
00087 
00088     maxlevel_ = std::max( maxlevel_, elem.level() );
00089     //elem.resetRefinedTag();
00090     realFather_.setElement( elem );
00091     rp_.preCoarsening( reFather_ );
00092 
00093     return 0;
00094   }
00095 
00097   int postRefinement ( HElementType & elem )
00098   {
00099 #if 0
00100     // set element and then start 
00101     HElementType * son = elem.down();
00102     assert( son );
00103     //elem.resetRefinedTag();
00104    
00105     realFather_.setElement(elem);
00106     realSon_.setElement(*son);
00107     int level = realSon_.level(); 
00108     if(level > maxlevel_) maxlevel_ = level;
00109     
00110     rp_.prolongLocal(reFather_,reSon_, false);
00111 
00112     son = son->next();
00113     while( son )
00114     {
00115       assert( son );
00116   
00117       realSon_.setElement(*son);
00118       rp_.prolongLocal(reFather_,reSon_, false);
00119       
00120       son = son->next();
00121     }
00122 #endif
00123 
00124     maxlevel_ = std::max( maxlevel_, elem.level()+1 );
00125     //elem.resetRefinedTag();
00126     realFather_.setElement( elem );
00127     rp_.postRefinement( reFather_ );
00128 
00129     return 0;
00130   }
00131 
00132   int maxLevel () const { return maxlevel_; }
00133 };
00134 
00135 } // end namespace 
00136 #endif

Generated on Fri Apr 29 2011 with Doxygen (ver 1.7.1) [doxygen-log,error-log].