3 #ifndef DUNE_ALBERTA_ELEMENTINFO_HH 4 #define DUNE_ALBERTA_ELEMENTINFO_HH 32 struct BasicNodeProjection;
64 #if !DUNE_ALBERTA_CACHE_COORDINATES 71 explicit ElementInfo (
const InstancePtr &instance );
87 operator bool ()
const {
return (instance_ != null()); }
100 MeshPointer
mesh ()
const;
110 void setMark (
int refCount )
const;
127 template<
int codim >
128 int twist (
int subEntity )
const;
137 #if !DUNE_ALBERTA_CACHE_COORDINATES 144 template<
class Functor >
147 template<
class Functor >
157 const Element *element,
int level,
int type = 0 );
164 static void fill (
Mesh *mesh,
const ALBERTA MACRO_EL *mel,
ALBERTA EL_INFO &elInfo );
165 static void fill (
int ichild,
const ALBERTA EL_INFO &parentInfo,
ALBERTA EL_INFO &elInfo );
167 void addReference ()
const;
168 void removeReference ()
const;
170 static InstancePtr null ();
171 static Stack &stack ();
173 InstancePtr instance_;
195 #if !DUNE_ALBERTA_CACHE_COORDINATES 239 ElementInfo (&neighbor)[ maxLevelNeighbors ],
int (&faceInNeighbor)[ maxLevelNeighbors ] );
243 macroNeighbor (
const ElementInfo &element,
const int face, ElementInfo &neighbor );
255 : macroIndex_( -1 ), level_( 0 ), path_( 0 )
258 Seed (
const int macroIndex,
const int level,
const unsigned long path )
259 : macroIndex_( macroIndex ), level_( level ), path_( path )
267 bool operator< (
const Seed &other )
const 269 const bool ml = (macroIndex() < other.
macroIndex());
270 const bool me = (macroIndex() == other.
macroIndex());
273 const bool pl = (path() < other.
path());
274 return ml | (me & (ll | (le & pl)));
278 bool operator<= (
const Seed &other )
const {
return !(other < *
this); }
279 bool operator> (
const Seed &other )
const {
return (other < *
this); }
280 bool operator>= (
const Seed &other )
const {
return !(*
this < other); }
282 bool isValid ( )
const {
return macroIndex_ != -1; }
285 int level ()
const {
return level_; }
286 unsigned long path ()
const {
return path_; }
301 : instance_( instance )
309 : instance_( null() )
321 instance_->
parent() = null();
326 elInfo().fill_flag = fillFlags;
330 elInfo().opp_vertex[ k ] = -1;
332 fill( mesh, ¯oElement,
elInfo() );
342 instance_->
parent() = null();
348 elInfo().fill_flag = fillFlags;
352 elInfo().opp_vertex[ k ] = -1;
357 unsigned long path = seed.
path();
358 for(
int i = 0; i < seed.
level(); ++i )
361 child->
parent() = instance_;
365 child->
elInfo.opp_vertex[ k ] = -2;
375 assert( this->
seed() == seed );
381 : instance_( other.instance_ )
391 swap( instance_, other.instance_ );
405 other.addReference();
407 instance_ = other.instance_;
416 swap( instance_, other.instance_ );
424 return (instance_->elInfo.el == other.instance_->elInfo.el);
432 return (instance_->elInfo.el != other.instance_->elInfo.el);
441 assert(
elInfo().macro_el != NULL );
459 assert( father != NULL );
461 const int index = (father->child[ 0 ] == element ? 0 : 1);
462 assert( father->child[ index ] == element );
473 child->
parent() = instance_;
478 child->
elInfo.opp_vertex[ k ] = -2;
488 assert( !(*
this) ==
false );
499 unsigned long path = 0;
504 const unsigned long child =
static_cast< unsigned long >( father->child[ 1 ] ==
element );
505 path = (path << 1) | child;
509 if( level !=
elInfo().level )
510 DUNE_THROW( NotImplemented,
"Seed for fake elements not implemented." );
547 return instance_->elInfo.el_type;
562 assert( (refCount >= -128) && (refCount < 127) );
563 el()->mark = refCount;
574 const int macroFace =
elInfo().macro_wall[ face ];
585 assert( (face >= 0) && (face <
numFaces) );
587 Library< dimWorld >::leafNeighbor( *
this, face, neighbor );
596 assert( (face >= 0) && (face <
numFaces) );
597 return Library< dimWorld >::levelNeighbors( *
this, face,
neighbor, faceInNeighbor );
602 template<
int codim >
624 const int macroFace =
elInfo().macro_wall[ face ];
636 assert( (face >= 0) && (face < N_WALLS_MAX) );
639 const int macroFace =
elInfo().macro_wall[ face ];
652 assert( (face >= 0) && (face < N_WALLS_MAX) );
655 const int macroFace =
elInfo().macro_wall[ face ];
656 return (macroFace < 0 ? NULL :
macroElement().wall_trafo[ macroFace ]);
665 assert( (face >= 0) && (face < N_WALLS_MAX) );
668 const int macroFace =
elInfo().macro_wall[ face ];
692 template<
class Functor >
705 template<
class Functor >
728 assert( (face >= 0) && (face <
numFaces) );
730 return elInfo().neigh[ face ];
744 return (instance_->elInfo);
754 instance->
parent() = null();
758 instance->
elInfo.macro_el = NULL;
760 instance->
elInfo.parent = NULL;
774 instance->
parent() = null();
785 return IS_LEAF_EL( element );
793 return (element->mark < depth);
803 ALBERTA fill_macro_info( mesh, mel, &elInfo );
810 ALBERTA fill_elinfo( ichild, FILL_ANY, &parentInfo, &elInfo );
817 ++(instance_->refCount);
831 stack().release( instance );
841 return stack().null();
914 #endif // #if HAVE_ALBERTA 916 #endif // #ifndef DUNE_ALBERTA_ELEMENTINFO_HH Seed()
Definition: elementinfo.hh:254
void hierarchicTraverse(Functor &functor) const
Definition: elementinfo.hh:693
static const Flags boundaryId
Definition: misc.hh:243
~ElementInfo()
Definition: elementinfo.hh:395
bool operator!=(const ElementInfo &other) const
Definition: elementinfo.hh:430
bool isBoundary(int face) const
Definition: elementinfo.hh:618
ALBERTA FLAGS Flags
Definition: misc.hh:229
ElementInfo()
Definition: elementinfo.hh:308
Definition: elementinfo.hh:252
InstancePtr allocate()
Definition: elementinfo.hh:882
bool operator==(const ElementInfo &other) const
Definition: elementinfo.hh:422
static const Flags neighbor
Definition: misc.hh:235
bool isValid() const
Definition: elementinfo.hh:282
const MacroElement & macroElement() const
Definition: elementinfo.hh:438
int twist(int subEntity) const
Definition: elementinfo.hh:603
ElementInfo child(int i) const
Definition: elementinfo.hh:468
static const int numVertices
Definition: elementinfo.hh:53
GeometryCacheProxy< dim > GeometryCache
Definition: elementinfo.hh:65
ALBERTA MESH Mesh
Definition: misc.hh:50
ALBERTA AFF_TRAFO AffineTransformation
Definition: misc.hh:49
Definition: elementinfo.hh:40
Definition: elementinfo.hh:182
void setMark(int refCount) const
Definition: elementinfo.hh:559
static const Flags coords
Definition: misc.hh:233
ALBERTA REAL_D GlobalVector
Definition: misc.hh:47
ALBERTA EL_INFO elInfo
Definition: elementinfo.hh:184
GeometryCache geometryCache() const
Definition: elementinfo.hh:138
Definition: macroelement.hh:20
int indexInFather() const
Definition: elementinfo.hh:455
static const int dimension
Definition: elementinfo.hh:51
const GlobalVector & coordinate(int vertex) const
Definition: elementinfo.hh:683
InstancePtr null()
Definition: elementinfo.hh:905
Definition: geometrycache.hh:88
Stack()
Definition: elementinfo.hh:859
int levelNeighbors(const int face, ElementInfo(&neighbor)[maxLevelNeighbors], int(&faceInNeighbor)[maxLevelNeighbors]) const
Definition: elementinfo.hh:594
static const Flags nothing
Definition: misc.hh:231
MeshPointer mesh() const
Definition: elementinfo.hh:517
#define ALBERTA
Definition: albertaheader.hh:27
void swap(Dune::PersistentContainer< G, T > &a, Dune::PersistentContainer< G, T > &b)
Definition: utility/persistentcontainer.hh:81
int getMark() const
Definition: elementinfo.hh:552
int level() const
Definition: elementinfo.hh:531
ElementInfo & operator=(const ElementInfo &other)
Definition: elementinfo.hh:403
unsigned long path() const
Definition: elementinfo.hh:286
const Element * neighbor(int face) const
Definition: elementinfo.hh:726
void leafTraverse(Functor &functor) const
Definition: elementinfo.hh:706
static int twist(const Element *element, int subEntity)
Definition: misc.hh:535
Alberta::MeshPointer< dimension > MeshPointer
Definition: elementinfo.hh:57
bool isBoundary(const int face) const
Definition: macroelement.hh:40
const Element * element() const
Definition: elementinfo.hh:719
bool mightVanish() const
Definition: elementinfo.hh:524
Definition: geometrycache.hh:21
int macroIndex() const
Definition: elementinfo.hh:284
int twistInNeighbor(int face) const
Definition: elementinfo.hh:610
BasicNodeProjection * boundaryProjection(int face) const
Definition: elementinfo.hh:662
Alberta::GeometryCache< dim > geometryCache
Definition: elementinfo.hh:197
static const int numFaces
Definition: elementinfo.hh:54
ALBERTA EL Element
Definition: misc.hh:51
ElementInfo leafNeighbor(const int face) const
Definition: elementinfo.hh:583
Definition: elementinfo.hh:207
AffineTransformation * transformation(int face) const
Definition: elementinfo.hh:649
ElementInfo father() const
Definition: elementinfo.hh:447
bool isLeaf() const
Definition: elementinfo.hh:486
Definition: common.hh:179
Definition: albertagrid/projection.hh:204
int boundaryId(int face) const
Definition: elementinfo.hh:633
Alberta::MacroElement< dimension > MacroElement
Definition: elementinfo.hh:56
Include standard header files.
Definition: agrid.hh:59
int boundaryId(const int face) const
Definition: macroelement.hh:47
Element * el() const
Definition: elementinfo.hh:735
static ElementInfo createFake(const MeshPointer &mesh, const Element *element, int level, int type=0)
Definition: elementinfo.hh:750
bool hasCoordinates() const
Definition: elementinfo.hh:677
static const int maxLevelNeighbors
Definition: elementinfo.hh:62
ALBERTA EL_INFO & elInfo() const
Definition: elementinfo.hh:742
unsigned int refCount
Definition: elementinfo.hh:185
Seed(const int macroIndex, const int level, const unsigned long path)
Definition: elementinfo.hh:258
static const Flags standard
Definition: misc.hh:253
int type() const
Definition: elementinfo.hh:538
Alberta::FillFlags< dimension > FillFlags
Definition: elementinfo.hh:58
~Stack()
Definition: elementinfo.hh:869
bool hasLeafNeighbor(const int face) const
Definition: elementinfo.hh:568
Seed seed() const
Definition: elementinfo.hh:494
int level() const
Definition: elementinfo.hh:285
static const int maxNeighbors
Definition: elementinfo.hh:60
InstancePtr & parent()
Definition: elementinfo.hh:187
void release(InstancePtr &p)
Definition: elementinfo.hh:895