5#ifndef DUNE_ALBERTA_REFINEMENT_HH
6#define DUNE_ALBERTA_REFINEMENT_HH
30 template<
int dim,
int codim >
43 static_assert(((dim >= 1) && (dim <= 3)),
44 "Alberta supports only dimensions 1, 2, 3");
72 template<
class LevelProv
ider >
79 template<
class Functor >
82 for(
int i = 0; i <
count(); ++i )
83 functor( (*
this)[ i ] );
86 template<
int codim,
class Functor >
97 assert( (i >= 0) && (i < count()) );
98 return list_[ i ].el_info.el;
103 template<
class LevelProv
ider >
107 assert( (i >= 0) && (i < count()) );
112 template<
class LevelProv
ider >
116 assert( (i >= 0) && (i < count()) );
118 const Element *element = (*this)[ i ];
119 const int level = levelProvider( element );
127 assert( (i >= 0) && (i < count()) );
128 return list_[ i ].el_info.el_type;
135 return (list_[ i ].neigh[ neighbor ] != NULL);
141 assert( hasNeighbor( i, neighbor ) );
142 return (list_[ i ].neigh[ neighbor ]->no);
153 template<
class Functor >
156 for(
int i = 0; i < patch.
count(); ++i )
158 Element *
const father = patch[ i ];
159 functor( father->child[ 0 ], 0 );
160 functor( father->child[ 1 ], 0 );
168 template<
class Functor >
171 functor( patch[ 0 ]->child[ 0 ], dim );
178 template<
class Functor >
182 Element *
const firstFather = patch[ 0 ];
184 Element *
const firstChild = firstFather->child[ 0 ];
185 functor( firstChild, 0 );
186 functor( firstChild, 1 );
188 functor( firstFather->child[ 1 ], 1 );
190 if( patch.
count() > 1 )
192 Element *
const father = patch[ 1 ];
193 functor( father->child[ 0 ], 1 );
201 template<
class Functor >
205 Element *
const firstFather = patch[ 0 ];
207 Element *
const firstChild = firstFather->child[ 0 ];
208 functor( firstChild, 0 );
209 functor( firstChild, 1 );
210 functor( firstChild, 2 );
212 Element *
const secondChild = firstFather->child[ 1 ];
213 functor( secondChild, 1 );
214 functor( secondChild, 2 );
216 for(
int i = 1; i < patch.
count(); ++i )
218 Element *
const father = patch[ i ];
226 assert( lr_set != 0 );
228 functor( father->child[ 0 ], 0 );
232 functor( father->child[ 0 ], 2 );
233 functor( father->child[ 1 ], (type == 0 ? 1 : 2) );
237 functor( father->child[ 0 ], 1 );
238 functor( father->child[ 1 ], (type == 0 ? 2 : 1) );
248 template<
class Functor >
252 Element *
const firstFather = patch[ 0 ];
254 Element *
const firstChild = firstFather->child[ 0 ];
255 functor( firstChild, 2 );
256 functor( firstChild, 4 );
257 functor( firstChild, 5 );
259 functor( firstFather->child[ 1 ], 2 );
261 for(
int i = 1; i < patch.
count(); ++i )
263 Element *
const father = patch[ i ];
270 assert( lr_set != 0 );
275 functor( father->child[ 0 ], 4 );
279 functor( father->child[ 0 ], 5 );
297 static const int dim = 1;
304 static const Real coords[ 2 ][ dim+1 ][ dim ]
305 = { { {0.0}, {0.5} }, { {0.5}, {1.0} } };
306 assert( (i >= 0) && (i <= dim) );
307 return coords[ child ][ i ];
314 static const int dim = 2;
321 static const Real coords[ 2 ][ dim+1 ][ dim ]
322 = { { {0.0, 1.0}, {0.0, 0.0}, {0.5, 0.0} },
323 { {1.0, 0.0}, {0.0, 1.0}, {0.5, 0.0} } };
324 assert( (i >= 0) && (i <= dim) );
325 return coords[ child ][ i ];
332 static const int dim = 3;
339 static const Real coords[ 2 ][ dim+1 ][ dim ]
340 = { { {0.0, 0.0, 0.0}, {0.0, 1.0, 0.0}, {0.0, 0.0, 1.0}, {0.5, 0.0, 0.0} },
341 { {1.0, 0.0, 0.0}, {0.0, 1.0, 0.0}, {0.0, 0.0, 1.0}, {0.5, 0.0, 0.0} } };
342 static const int flip[ 2 ][ 2 ][ dim+1 ]
343 = { { {0, 1, 2, 3}, {0, 1, 2, 3} }, { {0, 2, 1, 3}, {0, 1, 2, 3} } };
344 assert( (i >= 0) && (i <= dim) );
345 i = flip[ child ][ orientation ][ i ];
346 return coords[ child ][ i ];
provides a wrapper for ALBERTA's el_info structure
#define ALBERTA
Definition: albertaheader.hh:29
Include standard header files.
Definition: agrid.hh:60
ALBERTA REAL_B LocalVector
Definition: misc.hh:49
ALBERTA EL Element
Definition: misc.hh:54
ALBERTA REAL Real
Definition: misc.hh:48
Definition: meshpointer.hh:40
static ElementInfo createFake(const MeshPointer &mesh, const Element *element, int level, int type=0)
Definition: elementinfo.hh:752
Definition: refinement.hh:31
Definition: refinement.hh:40
int neighborIndex(int i, int neighbor) const
Definition: refinement.hh:139
int elementType(int i) const
Definition: refinement.hh:125
int count() const
Definition: refinement.hh:67
ElementInfo elementInfo(int i, const LevelProvider &levelProvider) const
Definition: refinement.hh:105
void forEach(Functor &functor) const
Definition: refinement.hh:80
Element * operator[](int i) const
Definition: refinement.hh:95
void forEachInteriorSubChild(Functor &functor) const
Definition: refinement.hh:87
static const int dimension
Definition: refinement.hh:47
bool hasNeighbor(int i, int neighbor) const
Definition: refinement.hh:133
Patch(ElementList *list, int count)
Definition: refinement.hh:58
Alberta::ElementInfo< dimension > ElementInfo
Definition: refinement.hh:49
ALBERTA RC_LIST_EL ElementList
Definition: refinement.hh:51
static void apply(Functor &functor, const Patch< dim > &patch)
Definition: refinement.hh:154
static void apply(Functor &functor, const Patch< dim > &patch)
Definition: refinement.hh:169
static void apply(Functor &functor, const Patch< 2 > &patch)
Definition: refinement.hh:179
static void apply(Functor &functor, const Patch< 3 > &patch)
Definition: refinement.hh:202
static void apply(Functor &functor, const Patch< 3 > &patch)
Definition: refinement.hh:249
Definition: refinement.hh:292
static const LocalVector & coordinate(int child, int, int i)
Definition: refinement.hh:302
static const LocalVector & coordinate(int child, int, int i)
Definition: refinement.hh:319
static const LocalVector & coordinate(int child, int orientation, int i)
Definition: refinement.hh:337