36 #ifndef __H__LIB_GRID__MULTI_GRID_IMPL__
37 #define __H__LIB_GRID__MULTI_GRID_IMPL__
92 template <
class TElem>
96 size_t numChildren = num_children<TElem>(elem);
97 size_t numChildrenTotal = numChildren;
99 for(
size_t i = 0; i < numChildren; ++i)
102 return numChildrenTotal;
106 template<
class TGeomObj>
111 Grid::create<TGeomObj>();
121 template <
class TGeomObj>
127 Grid::create<TGeomObj>(descriptor);
145 template <
class TChild>
149 case VERTEX:
return num_children<TChild>(
static_cast<Vertex*
>(elem));
150 case EDGE:
return num_children<TChild>(
static_cast<Edge*
>(elem));
151 case FACE:
return num_children<TChild>(
static_cast<Face*
>(elem));
152 case VOLUME:
return num_children<TChild>(
static_cast<Volume*
>(elem));
157 template <
class TChild>
161 case VERTEX:
return get_child<TChild>(
static_cast<Vertex*
>(elem), ind);
162 case EDGE:
return get_child<TChild>(
static_cast<Edge*
>(elem), ind);
163 case FACE:
return get_child<TChild>(
static_cast<Face*
>(elem), ind);
164 case VOLUME:
return get_child<TChild>(
static_cast<Volume*
>(elem), ind);
169 template <
class TElem>
177 template <
class TElem>
182 UG_THROW(
"Dimension of parent too low.");
186 if(oldParent == parent)
200 template <
class TElem>
207 template <
class TElem>
229 UG_THROW(
"MultiGrid::get_info(...): No face info available!");
236 UG_THROW(
"MultiGrid::get_info(...): No vertex info available!");
266 template <
class TParent,
class TChild>
273 template <
class TChild>
276 switch(
p->base_object_id()){
284 template <
class TParent,
class TChild>
290 template <
class TChild>
293 switch(
p->base_object_id()){
301 template <
class TElem,
class TParent>
328 parentInfo.add_child(elem);
336 template <
class TElem,
class TParent>
340 UG_ASSERT(pReplaceMe,
"Only call this method with a valid element which shall be replaced.");
351 parentInfo.replace_child(elem, pReplaceMe);
364 template <
class TElem>
375 template <
class TElem,
class TParent>
381 parentInfo.remove_child(elem);
383 if(!parentInfo.has_children()){
412 template <
class TElem>
inline
414 {
return m_grid.num<TElem>();}
416 template <
class TElem>
inline
419 {
return m_grid.begin<TElem>();}
421 template <
class TElem>
inline
424 {
return m_grid.end<TElem>();}
439 {
return (
uint)m_grid.num_levels();}
441 template <
class TElem>
inline
443 {
return m_grid.num<TElem>(level);}
445 template <
class TElem>
inline
448 {
return m_grid.begin<TElem>(level);}
450 template <
class TElem>
inline
453 {
return m_grid.end<TElem>(level);}
Base-class for edges.
Definition: grid_base_objects.h:397
Faces are 2-dimensional objects.
Definition: grid_base_objects.h:510
Manages the elements of a grid and their interconnection.
Definition: grid.h:132
The base class for all geometric objects, such as vertices, edges, faces, volumes,...
Definition: grid_base_objects.h:157
virtual int base_object_id() const =0
void assign_subset(Vertex *elem, int subsetIndex)
assigns a vertex to a subset.
Definition: subset_handler_grid.cpp:204
int num_subsets() const
returns the number of subset-infos (return value is int, since SubsetIndices are of type int)
Definition: subset_handler_interface.h:317
uint num(int level) const
Definition: multi_grid_impl.hpp:413
MGWrapper(Grid &grid)
Definition: multi_grid_impl.hpp:407
Grid & m_grid
Definition: multi_grid_impl.hpp:427
geometry_traits< TElem >::iterator begin(int level)
Definition: multi_grid_impl.hpp:418
uint num_levels() const
Definition: multi_grid_impl.hpp:409
geometry_traits< TElem >::iterator end(int level)
Definition: multi_grid_impl.hpp:423
geometry_traits< TElem >::iterator end(int level)
Definition: multi_grid_impl.hpp:452
uint num(int level) const
Definition: multi_grid_impl.hpp:442
uint num_levels() const
Definition: multi_grid_impl.hpp:438
MGWrapper(MultiGrid &grid)
Definition: multi_grid_impl.hpp:436
MultiGrid & m_grid
Definition: multi_grid_impl.hpp:456
geometry_traits< TElem >::iterator begin(int level)
Definition: multi_grid_impl.hpp:447
Definition: multi_grid.h:569
Definition: multi_grid.h:72
int get_level(TElem *elem) const
Definition: multi_grid.h:206
void associate_parent(TElem *elem, GridObject *parent)
establishes a parent child connection between the given elements
Definition: multi_grid_impl.hpp:179
size_t top_level() const
index of the highest level.
Definition: multi_grid_impl.hpp:86
size_t num_children_total(TElem *elem) const
returns the total number of children and grand-children.
Definition: multi_grid_impl.hpp:94
Grid::EdgeAttachmentAccessor< AEdgeInfo > m_aaEdgeInf
Definition: multi_grid.h:549
TChild * get_child(TElem *elem, size_t ind) const
returns the i-th child of the given child-type
Definition: multi_grid.h:268
char parent_type(TElem *elem) const
returns the object-type of the parent of a given object
Definition: multi_grid_impl.hpp:202
VertexInfo & get_info(Vertex *v)
Definition: multi_grid_impl.hpp:215
GridObject * get_parent(GridObject *parent) const
Definition: multi_grid.cpp:180
Grid::VolumeAttachmentAccessor< AVolumeInfo > m_aaVolInf
Definition: multi_grid.h:551
void create_levels(int numLevels)
Definition: multi_grid.cpp:109
void remove_child(TParent *p, TChild *c)
removes a child from the given object
Definition: multi_grid_impl.hpp:285
bool has_children(TElem *elem) const
Definition: multi_grid.h:217
void set_parent_type(TElem *elem, char type)
sets the object-type of the parent of a given object
Definition: multi_grid_impl.hpp:209
void level_required(int lvl)
creates new (empty) levels until num_levels() == lvl+1
Definition: multi_grid_impl.hpp:137
SubsetHandler m_hierarchy
Definition: multi_grid.h:530
void element_created(TElem *elem)
Definition: multi_grid.h:427
Grid::VertexAttachmentAccessor< AVertexInfo > m_aaVrtInf
Definition: multi_grid.h:548
size_t num_children(TElem *elem) const
returns the number of children of the given child-type
Definition: multi_grid.h:225
geometry_traits< TGeomObj >::iterator create(size_t level)
create a custom element on a specific level.
Definition: multi_grid_impl.hpp:108
void clear_child_connections(TElem *parent)
clears the relation between a parent and its children
Definition: multi_grid_impl.hpp:171
void release_child_info(Vertex *o)
releases the info-object for the given object (if necessary)
Definition: multi_grid.h:522
void set_parent(Vertex *o, GridObject *p)
sets the parent for the given object
Definition: multi_grid.h:488
void add_child(TParent *p, TChild *c)
adds a child to the given object
Definition: multi_grid_impl.hpp:267
MultiElementAttachmentAccessor< AParentType > m_aaParentType
Definition: multi_grid.h:553
void create_child_info(Vertex *o)
creates the info-object for the given object (if necessary)
Definition: multi_grid.h:514
Grid::FaceAttachmentAccessor< AFaceInfo > m_aaFaceInf
Definition: multi_grid.h:550
void element_to_be_erased(TElem *elem)
this method is called for elements that havn't got any parent.
Definition: multi_grid_impl.hpp:365
Base-class for all vertex-types.
Definition: grid_base_objects.h:231
Volumes are 3-dimensional objects.
Definition: grid_base_objects.h:754
Definition: grid_base_object_traits.h:68
access to connected types. used internally
Definition: multi_grid_child_info.h:205
#define UG_ASSERT(expr, msg)
Definition: assert.h:70
#define UG_THROW(msg)
Definition: error.h:57
unsigned int uint
Definition: types.h:114
@ VOLUME
Definition: grid_base_objects.h:63
@ VERTEX
Definition: grid_base_objects.h:60
@ EDGE
Definition: grid_base_objects.h:61
@ FACE
Definition: grid_base_objects.h:62
Holds information about edge relations. Used internally.
Definition: multi_grid_child_info.h:95
Holds information about face relations. Used internally.
Definition: multi_grid_child_info.h:126
Holds information about vertex relations. Used internally.
Definition: multi_grid_child_info.h:63
void unregister_from_children(MultiGrid &mg)
Definition: multi_grid.cpp:594
void add_child(Vertex *elem)
Definition: multi_grid_child_info.h:67
void remove_child(Vertex *elem)
Definition: multi_grid_child_info.h:71
Holds information about volume relations. Used internally.
Definition: multi_grid_child_info.h:162