33 #ifndef __H__UG__grid_objects_1d__
34 #define __H__UG__grid_objects_1d__
36 #include "../grid/grid.h"
80 m_vertices[0] = descriptor.
vertex(0);
81 m_vertices[1] = descriptor.
vertex(1);
96 virtual bool refine(std::vector<Edge*>& vNewEdgesOut,
98 Vertex** pSubstituteVrts = NULL);
106 bool refine(std::vector<RegularEdge*>& vNewEdgesOut,
108 Vertex** pSubstituteVrts = NULL);
125 BASE_OBJECT_ID =
EDGE
153 m_pConstrainingObject(NULL),
154 m_parentBaseObjectId(-1)
161 m_pConstrainingObject(NULL),
162 m_parentBaseObjectId(-1)
164 m_vertices[0] = descriptor.
vertex(0);
165 m_vertices[1] = descriptor.
vertex(1);
170 if(m_pConstrainingObject)
171 m_pConstrainingObject->remove_constraint_link(
this);
183 if(m_pConstrainingObject ==
static_cast<const GridObject*
>(e)){
184 m_pConstrainingObject = NULL;
190 if(m_pConstrainingObject ==
static_cast<const GridObject*
>(f)){
191 m_pConstrainingObject = NULL;
202 virtual bool refine(std::vector<Edge*>& vNewEdgesOut,
204 Vertex** pSubstituteVrts = NULL);
214 bool refine(std::vector<ConstrainedEdge*>& vNewEdgesOut,
216 Vertex** pSubstituteVrts = NULL);
220 m_pConstrainingObject = pObj;
230 if((m_parentBaseObjectId != -1) && (m_parentBaseObjectId !=
id)){
231 UG_THROW(
"Bad parent base object id specified! The given id"
232 " has to match the id of the constraining object if that"
233 " is present. Call this method only, if no constraining"
234 " object has been set!");
236 m_parentBaseObjectId = id;
259 BASE_OBJECT_ID =
EDGE
289 m_constrainedVertices.reserve(1);
290 m_constrainedEdges.reserve(2);
295 m_vertices[0] = descriptor.
vertex(0);
296 m_vertices[1] = descriptor.
vertex(1);
297 m_constrainedVertices.reserve(1);
298 m_constrainedEdges.reserve(2);
303 for(
size_t i = 0; i < m_constrainedVertices.size(); ++i){
304 m_constrainedVertices[i]->remove_constraint_link(
this);
307 for(
size_t i = 0; i < m_constrainedEdges.size(); ++i){
308 m_constrainedEdges[i]->remove_constraint_link(
this);
322 unconstrain_object(vrt);
327 unconstrain_object(e);
337 virtual bool refine(std::vector<Edge*>& vNewEdgesOut,
339 Vertex** pSubstituteVrts = NULL);
348 bool refine(std::vector<ConstrainingEdge*>& vNewEdgesOut,
350 Vertex** pSubstituteVrts = NULL);
355 UG_ASSERT(!is_constrained_object(pObj),
"vertex is already constrained by this edge.");
356 m_constrainedVertices.push_back(pObj);
361 UG_ASSERT(!is_constrained_object(pObj),
"edge is already constrained by this edge.");
362 m_constrainedEdges.push_back(pObj);
367 std::vector<Vertex*>::iterator iter =
find(m_constrainedVertices.begin(),
368 m_constrainedVertices.end(), vrt);
369 return iter != m_constrainedVertices.end();
374 std::vector<Edge*>::iterator iter =
find(m_constrainedEdges.begin(),
375 m_constrainedEdges.end(), edge);
376 return iter != m_constrainedEdges.end();
381 std::vector<Vertex*>::iterator iter =
find(m_constrainedVertices.begin(),
382 m_constrainedVertices.end(), vrt);
383 if(iter != m_constrainedVertices.end())
384 m_constrainedVertices.erase(iter);
389 std::vector<Edge*>::iterator iter =
find(m_constrainedEdges.begin(),
390 m_constrainedEdges.end(), edge);
391 if(iter != m_constrainedEdges.end())
392 m_constrainedEdges.erase(iter);
399 clear_constrained_vertices();
400 clear_constrained_edges();
413 UG_ASSERT(ind < m_constrainedVertices.size(),
"bad index");
414 return m_constrainedVertices[ind];
419 UG_ASSERT(ind < m_constrainedEdges.size(),
"bad index");
420 return m_constrainedEdges[ind];
444 BASE_OBJECT_ID =
EDGE
Use this class as a tool to create const_iterators to your own geometric objects.
Definition: generic_grid_object_iterator.h:70
This edge is a sub-edge of a.
Definition: grid_objects_1d.h:146
GridObject * get_constraining_object()
Definition: grid_objects_1d.h:225
static bool type_match(GridObject *pObj)
Definition: grid_objects_1d.h:149
int get_parent_base_object_id()
Definition: grid_objects_1d.h:227
GridObject * m_pConstrainingObject
Definition: grid_objects_1d.h:241
ConstrainedEdge(const EdgeDescriptor &descriptor)
Definition: grid_objects_1d.h:160
virtual ~ConstrainedEdge()
Definition: grid_objects_1d.h:168
virtual void remove_constraint_link(const Edge *e)
removes a constraint link to the grid object.
Definition: grid_objects_1d.h:181
virtual ReferenceObjectID reference_object_id() const
Definition: grid_objects_1d.h:177
void set_parent_base_object_id(int id)
Definition: grid_objects_1d.h:228
ConstrainedEdge()
Definition: grid_objects_1d.h:151
virtual void remove_constraint_link(const Face *f)
removes a constraint link to the grid object.
Definition: grid_objects_1d.h:188
virtual int container_section() const
Definition: grid_objects_1d.h:176
int m_parentBaseObjectId
Definition: grid_objects_1d.h:242
ConstrainedEdge(Vertex *v1, Vertex *v2)
Definition: grid_objects_1d.h:152
void set_constraining_object(GridObject *pObj)
Definition: grid_objects_1d.h:218
virtual GridObject * create_empty_instance() const
create an instance of the derived type
Definition: grid_objects_1d.h:174
virtual bool is_constrained() const
returns true if the object is constrained by other objects.
Definition: grid_objects_1d.h:179
contains elements of type
Definition: grid_objects_1d.h:279
void add_constrained_object(Edge *pObj)
Definition: grid_objects_1d.h:359
bool is_constrained_object(Vertex *vrt)
Definition: grid_objects_1d.h:365
ConstrainingEdge()
Definition: grid_objects_1d.h:284
void add_constrained_object(Vertex *pObj)
Definition: grid_objects_1d.h:353
virtual bool is_constraining() const
returns the id of the reference-object.
Definition: grid_objects_1d.h:317
Vertex * constrained_vertex(size_t ind) const
Definition: grid_objects_1d.h:411
TElem * constrained(size_t ind) const
virtual GridObject * create_empty_instance() const
create an instance of the derived type
Definition: grid_objects_1d.h:312
void unconstrain_object(const Vertex *vrt)
Definition: grid_objects_1d.h:379
virtual void remove_constraint_link(const Vertex *vrt)
removes a constraint link to the grid object.
Definition: grid_objects_1d.h:320
void unconstrain_object(const Edge *edge)
Definition: grid_objects_1d.h:387
ConstrainingEdge(const EdgeDescriptor &descriptor)
Definition: grid_objects_1d.h:293
virtual ReferenceObjectID reference_object_id() const
Definition: grid_objects_1d.h:315
size_t num_constrained_vertices() const
Definition: grid_objects_1d.h:404
std::vector< Edge * > m_constrainedEdges
Definition: grid_objects_1d.h:427
virtual int container_section() const
Definition: grid_objects_1d.h:314
bool is_constrained_object(Edge *edge)
Definition: grid_objects_1d.h:372
virtual void remove_constraint_link(const Edge *e)
removes a constraint link to the grid object.
Definition: grid_objects_1d.h:325
void clear_constrained_edges()
Definition: grid_objects_1d.h:396
size_t num_constrained() const
std::vector< Vertex * > m_constrainedVertices
Definition: grid_objects_1d.h:426
void clear_constrained_vertices()
Definition: grid_objects_1d.h:395
Edge * constrained_edge(size_t ind) const
Definition: grid_objects_1d.h:417
ConstrainingEdge(Vertex *v1, Vertex *v2)
Definition: grid_objects_1d.h:285
virtual ~ConstrainingEdge()
Definition: grid_objects_1d.h:301
static bool type_match(GridObject *pObj)
Definition: grid_objects_1d.h:282
void clear_constrained_objects()
Definition: grid_objects_1d.h:397
size_t num_constrained_edges() const
Definition: grid_objects_1d.h:405
Can be used to store information about an edge and to construct an edge.
Definition: grid_base_objects.h:464
Base-class for edges.
Definition: grid_base_objects.h:397
virtual Vertex * vertex(size_t index) const
Definition: grid_base_objects.h:366
Faces are 2-dimensional objects.
Definition: grid_base_objects.h:510
Use this class as a tool to create iterators to your own geometric objects.
Definition: generic_grid_object_iterator.h:44
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
Edges connect two vertices.
Definition: grid_objects_1d.h:66
virtual int container_section() const
Definition: grid_objects_1d.h:88
RegularEdge(Vertex *v1, Vertex *v2)
Definition: grid_objects_1d.h:72
static bool type_match(GridObject *pObj)
Definition: grid_objects_1d.h:69
virtual GridObject * create_empty_instance() const
create an instance of the derived type
Definition: grid_objects_1d.h:86
RegularEdge()
Definition: grid_objects_1d.h:71
virtual ReferenceObjectID reference_object_id() const
Definition: grid_objects_1d.h:89
RegularEdge(const EdgeDescriptor &descriptor)
Definition: grid_objects_1d.h:78
virtual ~RegularEdge()
Definition: grid_objects_1d.h:84
Base-class for all vertex-types.
Definition: grid_base_objects.h:231
GenericGridObjectIterator< ConstrainedEdge *, EdgeIterator > iterator
Definition: grid_objects_1d.h:249
ConstGenericGridObjectIterator< ConstrainedEdge *, EdgeIterator, ConstEdgeIterator > const_iterator
Definition: grid_objects_1d.h:251
Edge grid_base_object
Definition: grid_objects_1d.h:254
EdgeDescriptor Descriptor
Definition: grid_objects_1d.h:253
ConstGenericGridObjectIterator< ConstrainingEdge *, EdgeIterator, ConstEdgeIterator > const_iterator
Definition: grid_objects_1d.h:436
GenericGridObjectIterator< ConstrainingEdge *, EdgeIterator > iterator
Definition: grid_objects_1d.h:434
EdgeDescriptor Descriptor
Definition: grid_objects_1d.h:438
Edge grid_base_object
Definition: grid_objects_1d.h:439
ConstGenericGridObjectIterator< RegularEdge *, EdgeIterator, ConstEdgeIterator > const_iterator
Definition: grid_objects_1d.h:117
GenericGridObjectIterator< RegularEdge *, EdgeIterator > iterator
Definition: grid_objects_1d.h:115
Edge grid_base_object
Definition: grid_objects_1d.h:120
EdgeDescriptor Descriptor
Definition: grid_objects_1d.h:119
Definition: grid_base_object_traits.h:68
#define UG_ASSERT(expr, msg)
Definition: assert.h:70
#define UG_THROW(msg)
Definition: error.h:57
#define UG_API
Definition: ug_config.h:65
IndexLayout::Interface::iterator find(IndexLayout::Interface &interface, size_t i)
Definition: parallel_index_layout.h:77
geometry_traits< ConstrainedEdge >::const_iterator ConstConstrainedEdgeIterator
Definition: grid_objects_1d.h:265
ReferenceObjectID
these ids are used to identify the shape of a geometric object.
Definition: grid_base_objects.h:74
@ ROID_EDGE
Definition: grid_base_objects.h:77
ElementStorage< Edge >::SectionContainer::iterator EdgeIterator
Definition: grid_base_object_traits.h:76
ElementStorage< Edge >::SectionContainer::const_iterator ConstEdgeIterator
Definition: grid_base_object_traits.h:77
geometry_traits< RegularEdge >::iterator RegularEdgeIterator
Definition: grid_objects_1d.h:130
geometry_traits< RegularEdge >::const_iterator ConstRegularEdgeIterator
Definition: grid_objects_1d.h:131
@ EDGE
Definition: grid_base_objects.h:61
geometry_traits< ConstrainingEdge >::iterator ConstrainingEdgeIterator
Definition: grid_objects_1d.h:449
geometry_traits< ConstrainedEdge >::iterator ConstrainedEdgeIterator
Definition: grid_objects_1d.h:264
EdgeContainerSections
These numbers define where in the edge-section-container an edge will be stored.
Definition: grid_objects_1d.h:48
@ CSEDGE_REGULAR_EDGE
Definition: grid_objects_1d.h:50
@ CSEDGE_CONSTRAINING_EDGE
Definition: grid_objects_1d.h:52
@ CSEDGE_CONSTRAINED_EDGE
Definition: grid_objects_1d.h:51
@ CSEDGE_NONE
Definition: grid_objects_1d.h:49
geometry_traits< ConstrainingEdge >::const_iterator ConstConstrainingEdgeIterator
Definition: grid_objects_1d.h:450