33#ifndef __H__LIBGRID__SUBSET_HANDLER_INTERFACE__
34#define __H__LIBGRID__SUBSET_HANDLER_INTERFACE__
126// specialization of attachment_traits for Vertex
128class attachment_traits<Vertex*, ISubsetHandler>
131 typedef Vertex*& ElemRef;
132 typedef Vertex* ElemPtr;
133 typedef const Vertex* ConstElemPtr;
134 typedef ISubsetHandler* ElemHandlerPtr;
135 typedef const ISubsetHandler* ConstElemHandlerPtr;
137 static inline void invalidate_entry(ElemHandlerPtr pHandler, ElemRef elem) {elem = NULL;}
138 static inline bool entry_is_invalid(ElemHandlerPtr pHandler, ElemRef elem) {return elem != NULL;}
139 static inline uint get_data_index(ElemHandlerPtr pHandler, ConstElemPtr elem);
140 static inline void set_data_index(ElemHandlerPtr pHandler, ElemPtr elem, uint index);
143// specialization of attachment_traits for Edge
145class attachment_traits<Edge*, ISubsetHandler>
148 typedef Edge*& ElemRef;
149 typedef Edge* ElemPtr;
150 typedef const Edge* ConstElemPtr;
151 typedef ISubsetHandler* ElemHandlerPtr;
152 typedef const ISubsetHandler* ConstElemHandlerPtr;
154 static inline void invalidate_entry(ElemHandlerPtr pHandler, ElemRef elem) {elem = NULL;}
155 static inline bool entry_is_invalid(ElemHandlerPtr pHandler, ElemRef elem) {return elem != NULL;}
156 static inline uint get_data_index(ElemHandlerPtr pHandler, ConstElemPtr elem);
157 static inline void set_data_index(ElemHandlerPtr pHandler, ElemPtr elem, uint index);
160// specialization of attachment_traits for Face
162class attachment_traits<Face*, ISubsetHandler>
165 typedef Face*& ElemRef;
166 typedef Face* ElemPtr;
167 typedef const Face* ConstElemPtr;
168 typedef ISubsetHandler* ElemHandlerPtr;
169 typedef const ISubsetHandler* ConstElemHandlerPtr;
171 static inline void invalidate_entry(ElemHandlerPtr pHandler, ElemRef elem) {elem = NULL;}
172 static inline bool entry_is_invalid(ElemHandlerPtr pHandler, ElemRef elem) {return elem != NULL;}
173 static inline uint get_data_index(ElemHandlerPtr pHandler, ConstElemPtr elem);
174 static inline void set_data_index(ElemHandlerPtr pHandler, ElemPtr elem, uint index);
177// specialization of attachment_traits for Volume
179class attachment_traits<Volume*, ISubsetHandler>
182 typedef Volume*& ElemRef;
183 typedef Volume* ElemPtr;
184 typedef const Volume* ConstElemPtr;
185 typedef ISubsetHandler* ElemHandlerPtr;
186 typedef const ISubsetHandler* ConstElemHandlerPtr;
188 static inline void invalidate_entry(ElemHandlerPtr pHandler, ElemRef elem) {elem = NULL;}
189 static inline bool entry_is_invalid(ElemHandlerPtr pHandler, ElemRef elem) {return elem != NULL;}
190 static inline uint get_data_index(ElemHandlerPtr pHandler, ConstElemPtr elem);
191 static inline void set_data_index(ElemHandlerPtr pHandler, ElemPtr elem, uint index);
236 template <
class TElem>
273 bool elements_are_supported(
uint shElements)
const;
278 void set_supported_elements(
uint shElements);
282 void enable_element_support(
uint shElements);
286 void disable_element_support(
uint shElements);
291 void set_default_subset_index(
int subsetIndex);
298 void enable_subset_inheritance(
bool bEnable);
306 void enable_strict_inheritance(
bool bEnable);
311 inline void subset_required(
int index);
314 inline void subset_required(
int index)
const;
317 inline int num_subsets()
const {
return (
int)m_subsetInfos.size();}
320 const char* get_subset_name(
int subsetIndex)
const;
323 void set_subset_name(
const char*
name,
int subsetIndex);
327 void set_subset_info(
int subsetIndex,
const SubsetInfo& subsetInfo);
333 const SubsetInfo& subset_info(
int subsetIndex)
const;
336 void set_default_subset_info(
const SubsetInfo& defSI);
341 void clear_subset(
int subsetIndex);
342 void clear_subsets();
346 void insert_subset(
int subsetIndex);
348 void erase_subset(
int subsetIndex);
350 void swap_subsets(
int subsetIndex1,
int subsetIndex2);
352 void move_subset(
int indexFrom,
int indexTo);
354 void join_subsets(
int targetSub,
int sub1,
int sub2,
bool eraseUnusedSubs);
356 template <
class TIterator>
357 void assign_subset(TIterator iterBegin, TIterator iterEnd,
int subsetIndex);
360 inline int get_subset_index(
Vertex* elem)
const;
361 inline int get_subset_index(
Edge* elem)
const;
362 inline int get_subset_index(
Face* elem)
const;
363 inline int get_subset_index(
Volume* elem)
const;
369 int get_subset_index(
const char*
name)
const;
374 virtual void grid_to_be_destroyed(
Grid* grid);
375 virtual void elements_to_be_cleared(
Grid* grid);
378 virtual void vertex_created(
Grid* grid,
Vertex* vrt,
380 bool replacesParent =
false);
382 virtual void edge_created(
Grid* grid,
Edge* e,
384 bool replacesParent =
false);
386 virtual void face_created(
Grid* grid,
Face* f,
388 bool replacesParent =
false);
390 virtual void volume_created(
Grid* grid,
Volume* vol,
392 bool replacesParent =
false);
394 virtual void vertex_to_be_erased(
Grid* grid,
Vertex* vrt,
395 Vertex* replacedBy = NULL);
397 virtual void edge_to_be_erased(
Grid* grid,
Edge* e,
398 Edge* replacedBy = NULL);
400 virtual void face_to_be_erased(
Grid* grid,
Face* f,
401 Face* replacedBy = NULL);
403 virtual void volume_to_be_erased(
Grid* grid,
Volume* vol,
404 Volume* replacedBy = NULL);
406 virtual void vertices_to_be_merged(
Grid* grid,
Vertex* target,
409 virtual void edges_to_be_merged(
Grid* grid,
Edge* target,
412 virtual void faces_to_be_merged(
Grid* grid,
Face* target,
415 virtual void volumes_to_be_merged(
Grid* grid,
Volume* target,
445 virtual void assign_subset(
GridObject* elem,
int subsetIndex);
579 void set_grid(
Grid* grid);
585 void reset_subset_indices(
uint shElements = SHE_ALL);
588 void create_required_subsets(
int index);
590 inline void subset_assigned(
Vertex* v,
int subsetIndex);
591 inline void subset_assigned(
Edge* e,
int subsetIndex);
592 inline void subset_assigned(
Face* f,
int subsetIndex);
593 inline void subset_assigned(
Volume* v,
int subsetIndex);
639 template <
class TElem>
640 void elems_to_be_merged(
Grid* grid, TElem* target,
641 TElem* elem1, TElem* elem2);
location name
Definition checkpoint_util.lua:128
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
a helper class that holds a collection of possibly unconnected geometric-objects.
Definition grid_object_collection.h:96
The base class for all geometric objects, such as vertices, edges, faces, volumes,...
Definition grid_base_objects.h:157
Definition grid_observer.h:80
Definition subset_handler_interface.h:223
virtual void assign_subset(Volume *elem, int subsetIndex)=0
ASubsetIndex m_aSubsetIndex
Definition subset_handler_interface.h:746
Grid * m_pGrid
Definition subset_handler_interface.h:736
virtual bool contains_volumes(int subsetIndex) const =0
returns true if the subset contains volumes
virtual bool contains_vertices(int subsetIndex) const =0
collects all vertices that are in the given subset.
std::vector< SubsetInfo > SubsetInfoVec
Definition subset_handler_interface.h:729
virtual void assign_subset(Vertex *elem, int subsetIndex)=0
bool m_bSubsetInheritanceEnabled
Definition subset_handler_interface.h:750
Grid::traits< Edge >::SectionContainer EdgeSectionContainer
Definition subset_handler_interface.h:562
Grid::traits< Edge >::AttachedElementList AttachedEdgeList
Definition subset_handler_interface.h:557
Grid::FaceAttachmentAccessor< ASubsetIndex > m_aaSubsetIndexFACE
Definition subset_handler_interface.h:756
SubsetInfoVec m_subsetInfos
Definition subset_handler_interface.h:742
virtual void erase_subset_lists()=0
virtual bool contains_faces(int subsetIndex) const =0
returns true if the subset contains faces
virtual void assign_subset(Face *elem, int subsetIndex)=0
virtual bool contains_edges(int subsetIndex) const =0
returns true if the subset contains edges
void alter_subset_index(Volume *v, int subsetIndex)
Definition subset_handler_interface.h:614
AInt ASubsetIndex
Definition subset_handler_interface.h:727
Grid::traits< Vertex >::SectionContainer VertexSectionContainer
Definition subset_handler_interface.h:561
virtual void clear_subset_lists(int index)=0
bool m_bStrictInheritanceEnabled
Definition subset_handler_interface.h:751
void alter_subset_index(Vertex *v, int subsetIndex)
Definition subset_handler_interface.h:599
int m_defaultSubsetIndex
Definition subset_handler_interface.h:749
ISubsetHandler(const ISubsetHandler &sh)
this method is called by ISubsetHandler when attachment_support has been enabled.
Definition subset_handler_interface.h:724
Grid::traits< Vertex >::AttachedElementList AttachedVertexList
enable subset-attachment support
Definition subset_handler_interface.h:556
virtual void join_subset_lists(int target, int src1, int src2)=0
join the subset-lists but do not touch the subset-indices.
virtual void erase_subset_lists(int index)=0
erase the subset-lists but do not touch the subset-indices.
bool strict_inheritance_enabled()
Definition subset_handler_interface.h:307
Grid::VolumeAttachmentAccessor< ASubsetIndex > m_aaSubsetIndexVOL
Definition subset_handler_interface.h:757
virtual void change_subset_indices(int indOld, int indNew)=0
virtual void assign_subset(Edge *elem, int subsetIndex)=0
uint m_supportedElements
Definition subset_handler_interface.h:744
Grid::traits< Face >::AttachedElementList AttachedFaceList
Definition subset_handler_interface.h:558
int get_default_subset_index()
Definition subset_handler_interface.h:292
SubsetInfo m_defaultSubsetInfo
Definition subset_handler_interface.h:743
virtual void move_subset_lists(int indexFrom, int indexTo)=0
move the subset-lists but do not touch the subset-indices.
virtual GridObjectCollection get_grid_objects_in_subset(int subsetInd) const =0
Returns the geometric object collection for the given subset.
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
bool subset_inheritance_enabled()
Definition subset_handler_interface.h:299
Grid::EdgeAttachmentAccessor< ASubsetIndex > m_aaSubsetIndexEDGE
Definition subset_handler_interface.h:755
Grid::traits< Volume >::AttachedElementList AttachedVolumeList
Definition subset_handler_interface.h:559
Grid::traits< Face >::SectionContainer FaceSectionContainer
Definition subset_handler_interface.h:563
void alter_subset_index(Face *f, int subsetIndex)
Definition subset_handler_interface.h:609
Grid::traits< Volume >::SectionContainer VolumeSectionContainer
Definition subset_handler_interface.h:564
virtual void swap_subset_lists(int ind1, int ind2)=0
swap the subset-lists but do not touch the subset-indices.
virtual void add_required_subset_lists(int maxIndex)=0
add a subset if required - so that the subset with maxIndex exists.
Grid::VertexAttachmentAccessor< ASubsetIndex > m_aaSubsetIndexVRT
Definition subset_handler_interface.h:754
void alter_subset_index(Edge *e, int subsetIndex)
Definition subset_handler_interface.h:604
A variant can represent variables of different types.
Definition variant.h:87
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
#define UG_API
Definition ug_config.h:65
unsigned int uint
Definition types.h:114
@ SS_NONE
Definition subset_handler_interface.h:81
@ SS_USER_STATE
Definition subset_handler_interface.h:82
ElementStorage::AttachedElementList AttachedElementList
Definition grid.h:140
The traits class holds some important types for each element-type.
Definition subset_handler_interface.h:237
geometry_traits< TElem >::iterator iterator
Definition subset_handler_interface.h:238
geometry_traits< TElem >::const_iterator const_iterator
Definition subset_handler_interface.h:239
a struct that holds information associated with subsets.
Definition subset_handler_interface.h:97
PropertyMap m_propertyMap
custom properties can be stored in this map.
Definition subset_handler_interface.h:107
std::map< std::string, Variant > PropertyMap
Definition subset_handler_interface.h:104
Variant get_property(const char *name, Variant defaultValue=Variant()) const
retrieve the property with the given name
Definition subset_handler_interface.cpp:62
vector4 color
Definition subset_handler_interface.h:101
std::string name
Definition subset_handler_interface.h:99
void set_property(const char *name, Variant prop)
associate a property with the given name
Definition subset_handler_interface.cpp:50
uint subsetState
an or-combination of SubsetState flags.
Definition subset_handler_interface.h:102
SubsetInfo()
Definition subset_handler_interface.cpp:42
int materialIndex
mostly ignored.
Definition subset_handler_interface.h:100