3 #ifndef DUNE_ALBERTA_REFINEMENT_HH 4 #define DUNE_ALBERTA_REFINEMENT_HH 28 template<
int dim,
int codim >
41 static_assert(((dim >= 1) && (dim <= 3)),
42 "Alberta supports only dimensions 1, 2, 3");
70 template<
class LevelProv
ider >
71 ElementInfo
elementInfo (
int i,
const LevelProvider &levelProvider )
const;
77 template<
class Functor >
80 for(
int i = 0; i <
count(); ++i )
81 functor( (*
this)[ i ] );
84 template<
int codim,
class Functor >
95 assert( (i >= 0) && (i <
count()) );
96 return list_[ i ].el_info.el;
101 template<
class LevelProv
ider >
105 assert( (i >= 0) && (i <
count()) );
110 template<
class LevelProv
ider >
114 assert( (i >= 0) && (i <
count()) );
116 const Element *element = (*this)[ i ];
117 const int level = levelProvider( element );
125 assert( (i >= 0) && (i <
count()) );
126 return list_[ i ].el_info.el_type;
133 return (list_[ i ].neigh[ neighbor ] != NULL);
140 return (list_[ i ].neigh[ neighbor ]->no);
151 template<
class Functor >
154 for(
int i = 0; i < patch.
count(); ++i )
156 Element *
const father = patch[ i ];
157 functor( father->child[ 0 ], 0 );
158 functor( father->child[ 1 ], 0 );
166 template<
class Functor >
169 functor( patch[ 0 ]->child[ 0 ], dim );
176 template<
class Functor >
180 Element *
const firstFather = patch[ 0 ];
182 Element *
const firstChild = firstFather->child[ 0 ];
183 functor( firstChild, 0 );
184 functor( firstChild, 1 );
186 functor( firstFather->child[ 1 ], 1 );
188 if( patch.
count() > 1 )
190 Element *
const father = patch[ 1 ];
191 functor( father->child[ 0 ], 1 );
199 template<
class Functor >
203 Element *
const firstFather = patch[ 0 ];
205 Element *
const firstChild = firstFather->child[ 0 ];
206 functor( firstChild, 0 );
207 functor( firstChild, 1 );
208 functor( firstChild, 2 );
210 Element *
const secondChild = firstFather->child[ 1 ];
211 functor( secondChild, 1 );
212 functor( secondChild, 2 );
214 for(
int i = 1; i < patch.
count(); ++i )
216 Element *
const father = patch[ i ];
224 assert( lr_set != 0 );
226 functor( father->child[ 0 ], 0 );
230 functor( father->child[ 0 ], 2 );
231 functor( father->child[ 1 ], (type == 0 ? 1 : 2) );
235 functor( father->child[ 0 ], 1 );
236 functor( father->child[ 1 ], (type == 0 ? 2 : 1) );
246 template<
class Functor >
250 Element *
const firstFather = patch[ 0 ];
252 Element *
const firstChild = firstFather->child[ 0 ];
253 functor( firstChild, 2 );
254 functor( firstChild, 4 );
255 functor( firstChild, 5 );
257 functor( firstFather->child[ 1 ], 2 );
259 for(
int i = 1; i < patch.
count(); ++i )
261 Element *
const father = patch[ i ];
268 assert( lr_set != 0 );
273 functor( father->child[ 0 ], 4 );
277 functor( father->child[ 0 ], 5 );
295 static const int dim = 1;
299 static const LocalVector &
302 static const Real coords[ 2 ][ dim+1 ][ dim ]
303 = { { {0.0}, {0.5} }, { {0.5}, {1.0} } };
304 assert( (i >= 0) && (i <= dim) );
305 return coords[ child ][ i ];
312 static const int dim = 2;
316 static const LocalVector &
319 static const Real coords[ 2 ][ dim+1 ][ dim ]
320 = { { {0.0, 1.0}, {0.0, 0.0}, {0.5, 0.0} },
321 { {1.0, 0.0}, {0.0, 1.0}, {0.5, 0.0} } };
322 assert( (i >= 0) && (i <= dim) );
323 return coords[ child ][ i ];
330 static const int dim = 3;
334 static const LocalVector &
337 static const Real coords[ 2 ][ dim+1 ][ dim ]
338 = { { {0.0, 0.0, 0.0}, {0.0, 1.0, 0.0}, {0.0, 0.0, 1.0}, {0.5, 0.0, 0.0} },
339 { {1.0, 0.0, 0.0}, {0.0, 1.0, 0.0}, {0.0, 0.0, 1.0}, {0.5, 0.0, 0.0} } };
340 static const int flip[ 2 ][ 2 ][ dim+1 ]
341 = { { {0, 1, 2, 3}, {0, 1, 2, 3} }, { {0, 2, 1, 3}, {0, 1, 2, 3} } };
342 assert( (i >= 0) && (i <= dim) );
343 i = flip[ child ][ orientation ][ i ];
344 return coords[ child ][ i ];
352 #endif // #if HAVE_ALBERTA static const LocalVector & coordinate(int child, int orientation, int i)
Definition: refinement.hh:335
provides a wrapper for ALBERTA's el_info structure
Definition: refinement.hh:290
ALBERTA REAL_B LocalVector
Definition: misc.hh:46
int elementType(int i) const
Definition: refinement.hh:123
Definition: dofadmin.hh:21
void forEach(Functor &functor) const
Definition: refinement.hh:78
static void apply(Functor &functor, const Patch< 3 > &patch)
Definition: refinement.hh:247
#define ALBERTA
Definition: albertaheader.hh:27
Patch(ElementList *list, int count)
Definition: refinement.hh:56
void forEachInteriorSubChild(Functor &functor) const
Definition: refinement.hh:85
static void apply(Functor &functor, const Patch< dim > &patch)
Definition: refinement.hh:152
ALBERTA EL Element
Definition: misc.hh:51
static void apply(Functor &functor, const Patch< 2 > &patch)
Definition: refinement.hh:177
Element * operator[](int i) const
Definition: refinement.hh:93
static const int dimension
Definition: refinement.hh:45
static const LocalVector & coordinate(int child, int orientation, int i)
Definition: refinement.hh:300
int count() const
Definition: refinement.hh:65
Include standard header files.
Definition: agrid.hh:59
Definition: refinement.hh:37
int neighborIndex(int i, int neighbor) const
Definition: refinement.hh:137
static void apply(Functor &functor, const Patch< 3 > &patch)
Definition: refinement.hh:200
static void apply(Functor &functor, const Patch< dim > &patch)
Definition: refinement.hh:167
Definition: refinement.hh:29
bool hasNeighbor(int i, int neighbor) const
Definition: refinement.hh:131
ALBERTA RC_LIST_EL ElementList
Definition: refinement.hh:49
static const LocalVector & coordinate(int child, int orientation, int i)
Definition: refinement.hh:317
static ElementInfo createFake(const MeshPointer &mesh, const Element *element, int level, int type=0)
Definition: elementinfo.hh:750
ALBERTA REAL Real
Definition: misc.hh:45
Alberta::ElementInfo< dimension > ElementInfo
Definition: refinement.hh:47
ElementInfo elementInfo(int i, const LevelProvider &levelProvider) const
Definition: refinement.hh:103