- Home
- About DUNE
- Download
- Documentation
- Community
- Development
00001 #ifndef DUNE_ADAPTCALLBACK_HH 00002 #define DUNE_ADAPTCALLBACK_HH 00003 00010 namespace Dune 00011 { 00012 00013 // Internal Forward Declarations 00014 // ----------------------------- 00015 00016 template< class Grid, class Impl > 00017 class AdaptDataHandle; 00018 00019 00020 00021 // AdaptDataHandleInterface 00022 // ------------------------ 00023 00024 template< class Grid, class Impl > 00025 class AdaptDataHandleInterface 00026 { 00027 typedef AdaptDataHandleInterface< Grid, Impl > This; 00028 00029 friend class AdaptDataHandle< Grid, Impl >; 00030 00031 public: 00032 typedef typename Grid::template Codim< 0 >::Entity Entity; 00033 00034 private: 00035 AdaptDataHandleInterface () 00036 {} 00037 00038 AdaptDataHandleInterface ( const This & ); 00039 This &operator= ( const This & ); 00040 00041 public: 00042 void preAdapt ( const unsigned int estimateAdditionalElements ) 00043 { 00044 asImp().preAdapt( estimateAdditionalElements ); 00045 } 00046 00047 void postAdapt () 00048 { 00049 asImp().postAdapt(); 00050 } 00051 00052 void preCoarsening ( const Entity &father ) const 00053 { 00054 asImp().preCoarsening( father ); 00055 } 00056 00057 void postRefinement ( const Entity &father ) const 00058 { 00059 asImp().postRefinement( father ); 00060 } 00061 00062 protected: 00063 const Impl &asImp () const 00064 { 00065 return static_cast< const Impl & >( *this ); 00066 } 00067 00068 Impl &asImp () 00069 { 00070 return static_cast< Impl & >( *this ); 00071 } 00072 }; 00073 00074 00075 00076 // AdaptDataHandle 00077 // --------------- 00078 00079 template< class Grid, class Impl > 00080 class AdaptDataHandle 00081 : public AdaptDataHandleInterface< Grid, Impl > 00082 { 00083 typedef AdaptDataHandle< Grid, Impl > This; 00084 typedef AdaptDataHandleInterface< Grid, Impl > Base; 00085 00086 public: 00087 typedef typename Base::Entity Entity; 00088 00089 protected: 00090 AdaptDataHandle () 00091 {} 00092 00093 private: 00094 AdaptDataHandle ( const This & ); 00095 This &operator= ( const This & ); 00096 00097 void preAdapt ( const unsigned int estimateAdditionalElements ); 00098 void postAdapt (); 00099 void preCoarsening ( const Entity &father ) const; 00100 void postRefinement ( const Entity &father ) const; 00101 }; 00102 00103 00104 // CombinedAdaptProlongRestrict 00105 // ---------------------------- 00106 00108 template <class A, class B > 00109 class CombinedAdaptProlongRestrict 00110 { 00112 const A & _a; 00113 const B & _b; 00114 public: 00116 CombinedAdaptProlongRestrict ( const A & a, const B & b ) : _a ( a ) , _b ( b ) 00117 {} 00118 00120 template <class EntityType> 00121 void restrictLocal ( EntityType &father, EntityType &son, bool initialize ) const 00122 { 00123 _a.restrictLocal(father,son,initialize); 00124 _b.restrictLocal(father,son,initialize); 00125 } 00126 00128 template <class EntityType> 00129 void prolongLocal ( EntityType &father, EntityType &son, bool initialize ) const 00130 { 00131 _a.prolongLocal(father,son,initialize); 00132 _b.prolongLocal(father,son,initialize); 00133 } 00134 }; 00135 00136 } // end namespace Dune 00137 00138 #endif
Generated on Fri Apr 29 2011 with Doxygen (ver 1.7.1) [doxygen-log,error-log].