33 #ifndef __H__LIB_GRID__GEOMETRIC_BASE_OBJECTS__
34 #define __H__LIB_GRID__GEOMETRIC_BASE_OBJECTS__
103 case ROID_EDGE: outStream <<
"Edge";
break;
111 default:
throw(
UGError(
"Unknown ReferenceObjectID in operator<<"));
120 template<
class TElem>
class ElementStorage;
128 class EdgeDescriptor;
129 class FaceDescriptor;
130 class VolumeDescriptor;
134 class VolumeVertices;
136 template<>
class attachment_traits<Vertex*, ElementStorage<Vertex> >;
137 template<>
class attachment_traits<Edge*, ElementStorage<Edge> >;
138 template<>
class attachment_traits<Face*, ElementStorage<Face> >;
139 template<>
class attachment_traits<Volume*, ElementStorage<Volume> >;
247 static const bool HAS_SIDES =
false;
248 static const bool CAN_BE_SIDE =
true;
253 static const int BASE_OBJECT_ID =
VERTEX;
294 {m_v = d.
m_v;
return *
this;}
308 inline size_t size()
const {
return 1;}
347 void resize(
size_t newSize) {m_vrts.resize(newSize);}
372 inline size_t size()
const {
return 2;}
410 static const bool HAS_SIDES =
true;
411 static const bool CAN_BE_SIDE =
true;
416 static const int BASE_OBJECT_ID =
EDGE;
451 virtual bool refine(std::vector<Edge*>& vNewEdgesOut,
453 Vertex** pSubstituteVrts = NULL) {
return false;}
475 m_vertices[0] = vrt1;
476 m_vertices[1] = vrt2;
523 static const bool HAS_SIDES =
true;
524 static const bool CAN_BE_SIDE =
true;
528 static const int BASE_OBJECT_ID =
FACE;
538 {
return EdgeDescriptor(vertex(index), vertex((index+1) % size()));}
543 {edOut.
set_vertices(vertex(index), vertex((index+1) % size()));}
568 virtual std::pair<GridBaseObjectId, int>
594 virtual bool refine(std::vector<Face*>& vNewFacesOut,
595 Vertex** newFaceVertexOut,
597 Vertex* newFaceVertex = NULL,
598 Vertex** pSubstituteVertices = NULL,
599 int snapPointIndex = -1) {
return false;}
630 int edgeIndex,
Vertex* newVertex,
631 Vertex** pSubstituteVertices = NULL) {
return false;}
647 std::vector<Vertex*>& vNewEdgeVertices,
648 Vertex** pSubstituteVertices = NULL) {
return false;}
661 std::vector<Face*>& vNewFacesOut,
662 Vertex** pSubstituteVertices = NULL) {};
691 {m_vertices[0] = v0; m_vertices[1] = v1; m_vertices[2] = v2;}
695 {m_vertices[0] = v0; m_vertices[1] = v1; m_vertices[2] = v2; m_vertices[3] = v3;}
707 {m_vertices[index] = vrt;}
768 static const bool HAS_SIDES =
true;
769 static const bool CAN_BE_SIDE =
false;
773 static const int BASE_OBJECT_ID =
VOLUME;
796 size_t edgeInd)
const
797 {
UG_THROW(
"Base method not implemented.");};
803 {
UG_THROW(
"Base method not implemented.");}
808 const size_t vi1)
const
809 {
UG_THROW(
"Base method not implemented.");};
814 const size_t faceEdgeInd)
const
815 {
UG_THROW(
"Base method not implemented.");};
826 virtual std::pair<GridBaseObjectId, int>
828 {
UG_THROW(
"Base method not implemented.");}
873 virtual bool refine(std::vector<Volume*>& vNewVolumesOut,
878 const Vertex& prototypeVertex,
879 Vertex** pSubstituteVertices = NULL,
881 bool* isSnapPoint = NULL) {
return false;}
912 int edgeIndex,
Vertex* newVertex,
913 std::vector<Vertex*>* pvSubstituteVertices = NULL) {
return false;}
1009 template <
class TGeomObjPtrType>
this class can be used if one wants to create a custom element from a set of vertices.
Definition: grid_base_objects.h:336
std::vector< Vertex * > m_vrts
Definition: grid_base_objects.h:353
virtual ConstVertexArray vertices() const
Definition: grid_base_objects.h:343
CustomVertexGroup()
Definition: grid_base_objects.h:338
virtual Vertex * vertex(size_t index) const
Definition: grid_base_objects.h:342
virtual size_t num_vertices() const
Definition: grid_base_objects.h:344
virtual ~CustomVertexGroup()
Definition: grid_base_objects.h:340
void set_vertex(size_t index, Vertex *vrt)
Definition: grid_base_objects.h:350
void push_back(Vertex *vrt)
Definition: grid_base_objects.h:349
CustomVertexGroup(size_t numVrts)
Definition: grid_base_objects.h:339
void set_num_vertices(size_t newSize)
Definition: grid_base_objects.h:346
void resize(size_t newSize)
Definition: grid_base_objects.h:347
void clear()
Definition: grid_base_objects.h:348
Can be used to store information about an edge and to construct an edge.
Definition: grid_base_objects.h:464
void set_vertices(Vertex *vrt1, Vertex *vrt2)
Definition: grid_base_objects.h:473
void set_vertex(uint index, Vertex *vrt)
Definition: grid_base_objects.h:472
Base-class for edges.
Definition: grid_base_objects.h:397
virtual ReferenceObjectID reference_object_id() const
Definition: grid_base_objects.h:427
Vertex lower_dim_base_object
Definition: grid_base_objects.h:403
virtual int container_section() const
Definition: grid_base_objects.h:425
bool get_opposing_side(Vertex *v, VertexDescriptor &vrtOut)
static bool type_match(GridObject *pObj)
Definition: grid_base_objects.h:421
Vertex side
Definition: grid_base_objects.h:407
Edge grid_base_object
Definition: grid_base_objects.h:400
virtual int base_object_id() const
Definition: grid_base_objects.h:426
virtual bool refine(std::vector< Edge * > &vNewEdgesOut, Vertex *newVertex, Vertex **pSubstituteVrts=NULL)
Definition: grid_base_objects.h:451
void set_vertex(uint index, Vertex *pVrt)
Definition: grid_base_objects.h:456
virtual ~Edge()
Definition: grid_base_objects.h:423
Face higher_dim_base_object
Definition: grid_base_objects.h:405
uint num_sides() const
Definition: grid_base_objects.h:429
Face sideof
Definition: grid_base_objects.h:408
holds the vertices of an Edge or an EdgeDescriptor.
Definition: grid_base_objects.h:362
virtual Vertex * vertex(size_t index) const
Definition: grid_base_objects.h:366
void assign_edge_vertices(const EdgeVertices &ev)
Definition: grid_base_objects.h:377
virtual ConstVertexArray vertices() const
Definition: grid_base_objects.h:367
size_t size() const
returns the number of vertices.
Definition: grid_base_objects.h:372
virtual ~EdgeVertices()
Definition: grid_base_objects.h:365
Vertex * operator[](size_t index) const
returns the i-th vertex.
Definition: grid_base_objects.h:374
Vertex * m_vertices[2]
Definition: grid_base_objects.h:384
virtual size_t num_vertices() const
Definition: grid_base_objects.h:368
Can be queried for the edges and vertices of a face.
Definition: grid_base_objects.h:684
virtual ~FaceDescriptor()
Definition: grid_base_objects.h:697
virtual Vertex * vertex(size_t index) const
Definition: grid_base_objects.h:701
FaceDescriptor(Vertex *v0, Vertex *v1, Vertex *v2)
Definition: grid_base_objects.h:689
void set_num_vertices(uint numVertices)
Definition: grid_base_objects.h:705
virtual size_t num_vertices() const
Definition: grid_base_objects.h:703
uint m_numVertices
Definition: grid_base_objects.h:711
virtual ConstVertexArray vertices() const
Definition: grid_base_objects.h:702
void set_vertex(uint index, Vertex *vrt)
Definition: grid_base_objects.h:706
FaceDescriptor(Vertex *v0, Vertex *v1, Vertex *v2, Vertex *v3)
Definition: grid_base_objects.h:693
Faces are 2-dimensional objects.
Definition: grid_base_objects.h:510
Volume sideof
Definition: grid_base_objects.h:521
virtual std::pair< GridBaseObjectId, int > get_opposing_object(Vertex *vrt) const
returns an index to the obbject, which lies on the opposite side of the face to the given vertex.
Definition: grid_base_objects.h:569
virtual bool refine(std::vector< Face * > &vNewFacesOut, Vertex **newFaceVertexOut, Vertex **newEdgeVertices, Vertex *newFaceVertex=NULL, Vertex **pSubstituteVertices=NULL, int snapPointIndex=-1)
Definition: grid_base_objects.h:594
Volume higher_dim_base_object
Definition: grid_base_objects.h:518
virtual ReferenceObjectID reference_object_id() const
Definition: grid_base_objects.h:550
virtual EdgeDescriptor edge_desc(int index) const
returns the i-th edge of the face.
Definition: grid_base_objects.h:537
Face grid_base_object
Definition: grid_base_objects.h:513
virtual Edge * create_edge(int index)
create the edge with index i and return it.
Definition: grid_base_objects.h:556
virtual int container_section() const
Definition: grid_base_objects.h:548
virtual bool collapse_edges(std::vector< Face * > &vNewFacesOut, std::vector< Vertex * > &vNewEdgeVertices, Vertex **pSubstituteVertices=NULL)
Definition: grid_base_objects.h:646
Edge side
Definition: grid_base_objects.h:520
virtual void create_faces_by_edge_split(int splitEdgeIndex, Vertex *newVertex, std::vector< Face * > &vNewFacesOut, Vertex **pSubstituteVertices=NULL)
Definition: grid_base_objects.h:659
static bool type_match(GridObject *pObj)
Definition: grid_base_objects.h:531
virtual bool is_regular_ref_rule(int edgeMarks) const
returns true if the specified edgeMarks would lead to a regular refinement
Definition: grid_base_objects.h:615
uint num_edges() const
Definition: grid_base_objects.h:545
virtual bool get_opposing_side(EdgeVertices *e, EdgeDescriptor &edOut) const
retrieves the edge-descriptor for the opposing side to the specified one.
Definition: grid_base_objects.h:562
virtual void set_vertex(uint index, Vertex *pVrt)
Definition: grid_base_objects.h:671
uint num_sides() const
Definition: grid_base_objects.h:546
virtual void edge_desc(int index, EdgeDescriptor &edOut) const
returns the i-th edge of the face.
Definition: grid_base_objects.h:542
Edge lower_dim_base_object
Definition: grid_base_objects.h:516
virtual ~Face()
Definition: grid_base_objects.h:533
virtual int base_object_id() const
Definition: grid_base_objects.h:549
virtual bool collapse_edge(std::vector< Face * > &vNewFacesOut, int edgeIndex, Vertex *newVertex, Vertex **pSubstituteVertices=NULL)
Definition: grid_base_objects.h:629
Definition: grid_base_objects.h:483
size_t size() const
returns the number of vertices.
Definition: grid_base_objects.h:492
virtual ConstVertexArray vertices() const
Definition: grid_base_objects.h:487
virtual Vertex * vertex(size_t index) const
Definition: grid_base_objects.h:486
virtual size_t num_vertices() const
Definition: grid_base_objects.h:488
Vertex * operator[](size_t index) const
returns the i-th vertex.
Definition: grid_base_objects.h:494
virtual ~FaceVertices()
Definition: grid_base_objects.h:485
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 GridObject * create_empty_instance() const
create an instance of the derived type
Definition: grid_base_objects.h:169
virtual bool is_constraining() const
returns the id of the reference-object.
Definition: grid_base_objects.h:183
uint grid_data_index() const
Returns the grid attachment data index of a geometric object.
Definition: grid_base_objects.h:205
virtual void remove_constraint_link(const Edge *e)
removes a constraint link to the grid object.
Definition: grid_base_objects.h:195
virtual ~GridObject()
Definition: grid_base_objects.h:165
virtual void remove_constraint_link(const Face *f)
removes a constraint link to the grid object.
Definition: grid_base_objects.h:196
virtual int container_section() const =0
uint m_gridDataIndex
Definition: grid_base_objects.h:215
virtual void remove_constraint_link(const Vertex *vrt)
removes a constraint link to the grid object.
Definition: grid_base_objects.h:194
void set_grid_data_index(uint index)
ATTENTION: Use this method with extreme care!
Definition: grid_base_objects.h:212
virtual int base_object_id() const =0
virtual bool is_constrained() const
returns true if the object is constrained by other objects.
Definition: grid_base_objects.h:188
virtual ReferenceObjectID reference_object_id() const =0
Base class for all classes which consist of a group of vertices.
Definition: grid_base_objects.h:317
size_t size() const
returns the number of vertices.
Definition: grid_base_objects.h:328
virtual ~IVertexGroup()
Definition: grid_base_objects.h:321
Vertex * operator[](size_t index) const
returns the i-th vertex.
Definition: grid_base_objects.h:330
Vertex *const * ConstVertexArray
Definition: grid_base_objects.h:319
virtual size_t num_vertices() const =0
virtual ConstVertexArray vertices() const =0
virtual Vertex * vertex(size_t index) const =0
Instances of this class or of derived classes are thrown if errors arise.
Definition: error.h:104
This descriptor is mainly useful to avoid compilation errors in templated code.
Definition: grid_base_objects.h:285
Vertex *const * ConstVertexArray
Definition: grid_base_objects.h:287
void set_vertex(Vertex *v)
Definition: grid_base_objects.h:296
virtual Vertex * vertex(size_t) const
Definition: grid_base_objects.h:300
void set_vertex(uint, Vertex *v)
Definition: grid_base_objects.h:297
Vertex * operator[](size_t) const
Definition: grid_base_objects.h:301
size_t size() const
returns the number of vertices.
Definition: grid_base_objects.h:308
VertexDescriptor(Vertex *v)
Definition: grid_base_objects.h:290
VertexDescriptor(const VertexDescriptor &d)
Definition: grid_base_objects.h:291
Vertex * m_v
Definition: grid_base_objects.h:311
virtual ConstVertexArray vertices() const
Definition: grid_base_objects.h:303
VertexDescriptor()
Definition: grid_base_objects.h:289
virtual size_t num_vertices() const
Definition: grid_base_objects.h:304
Vertex * vertex() const
Definition: grid_base_objects.h:299
Base-class for all vertex-types.
Definition: grid_base_objects.h:231
uint32 get_hash_value() const
returns a value that can be used for hashing.
Definition: grid_base_objects.h:272
virtual int base_object_id() const
Definition: grid_base_objects.h:265
static bool type_match(GridObject *pObj)
Definition: grid_base_objects.h:258
Edge higher_dim_base_object
Definition: grid_base_objects.h:240
uint num_sides() const
Definition: grid_base_objects.h:262
Vertex side
Definition: grid_base_objects.h:244
virtual ~Vertex()
Definition: grid_base_objects.h:260
virtual ReferenceObjectID reference_object_id() const
Definition: grid_base_objects.h:266
uint32 m_hashValue
Definition: grid_base_objects.h:275
void lower_dim_base_object
Definition: grid_base_objects.h:237
Vertex grid_base_object
Definition: grid_base_objects.h:234
virtual int container_section() const
Definition: grid_base_objects.h:264
Edge sideof
Definition: grid_base_objects.h:245
Holds a set of vertices which represent the corners of a volume element.
Definition: grid_base_objects.h:951
virtual ConstVertexArray vertices() const
Definition: grid_base_objects.h:963
void set_vertex(uint index, Vertex *vrt)
Definition: grid_base_objects.h:967
virtual size_t num_vertices() const
Definition: grid_base_objects.h:964
uint m_numVertices
Definition: grid_base_objects.h:971
void set_num_vertices(uint numVertices)
Definition: grid_base_objects.h:966
virtual ~VolumeDescriptor()
Definition: grid_base_objects.h:957
virtual Vertex * vertex(size_t index) const
Definition: grid_base_objects.h:962
Volumes are 3-dimensional objects.
Definition: grid_base_objects.h:754
virtual ReferenceObjectID reference_object_id() const
Definition: grid_base_objects.h:927
virtual bool is_regular_ref_rule(int edgeMarks) const
returns true if the specified edgeMarks would lead to a regular refinement
Definition: grid_base_objects.h:897
virtual void get_vertex_indices_of_edge(size_t &ind1Out, size_t &ind2Out, size_t edgeInd) const
returns the local indices of an edge of the volume.
Definition: grid_base_objects.h:794
virtual int base_object_id() const
Definition: grid_base_objects.h:926
virtual int container_section() const
Definition: grid_base_objects.h:925
virtual FaceDescriptor face_desc(int index) const
Definition: grid_base_objects.h:784
Face side
Definition: grid_base_objects.h:764
virtual bool get_opposing_side(FaceVertices *f, FaceDescriptor &fdOut) const
retrieves the face-descriptor for the opposing side to the specified one.
Definition: grid_base_objects.h:820
virtual Edge * create_edge(int index)
create the edge with index i and return it.
Definition: grid_base_objects.h:789
virtual void face_desc(int index, FaceDescriptor &fdOut) const
Definition: grid_base_objects.h:785
virtual uint num_edges() const
Definition: grid_base_objects.h:782
virtual void get_vertex_indices_of_face(std::vector< size_t > &indsOut, size_t side) const
returns the local indices of a face of the volume.
Definition: grid_base_objects.h:801
virtual void edge_desc(int index, EdgeDescriptor &edOut) const
Definition: grid_base_objects.h:781
virtual EdgeDescriptor edge_desc(int index) const
Definition: grid_base_objects.h:780
virtual int get_edge_index_from_vertices(const size_t vi0, const size_t vi1) const
returns the local index of the edge which connects the two vertex indices.
Definition: grid_base_objects.h:807
static bool type_match(GridObject *pObj)
Definition: grid_base_objects.h:776
virtual void set_vertex(uint index, Vertex *pVrt)
Definition: grid_base_objects.h:939
Volume grid_base_object
Definition: grid_base_objects.h:757
virtual int get_face_edge_index(const size_t faceInd, const size_t faceEdgeInd) const
returns the local index of the j-th edge of the i-th face of the volume
Definition: grid_base_objects.h:813
virtual std::pair< GridBaseObjectId, int > get_opposing_object(Vertex *vrt) const
returns an index to the obbject, which lies on the opposite side of the volume to the given vertex.
Definition: grid_base_objects.h:827
Volume sideof
Definition: grid_base_objects.h:766
virtual bool refine(std::vector< Volume * > &vNewVolumesOut, Vertex **ppNewVertexOut, Vertex **newEdgeVertices, Vertex **newFaceVertices, Vertex *newVolumeVertex, const Vertex &prototypeVertex, Vertex **pSubstituteVertices=NULL, vector3 *corners=NULL, bool *isSnapPoint=NULL)
Definition: grid_base_objects.h:873
virtual bool collapse_edge(std::vector< Volume * > &vNewVolumesOut, int edgeIndex, Vertex *newVertex, std::vector< Vertex * > *pvSubstituteVertices=NULL)
Definition: grid_base_objects.h:911
virtual uint num_faces() const
Definition: grid_base_objects.h:786
uint num_sides() const
Definition: grid_base_objects.h:787
virtual Face * create_face(int index)
create the face with index i and return it.
Definition: grid_base_objects.h:790
void higher_dim_base_object
Definition: grid_base_objects.h:762
Face lower_dim_base_object
Definition: grid_base_objects.h:760
virtual ~Volume()
Definition: grid_base_objects.h:778
holds the vertices of a Volume or a VolumeDescriptor
Definition: grid_base_objects.h:723
Vertex * operator[](size_t index) const
returns the i-th vertex.
Definition: grid_base_objects.h:735
virtual Vertex * vertex(size_t index) const
Definition: grid_base_objects.h:727
virtual ConstVertexArray vertices() const
Definition: grid_base_objects.h:728
size_t size() const
returns the number of vertices.
Definition: grid_base_objects.h:733
virtual ~VolumeVertices()
Definition: grid_base_objects.h:725
virtual size_t num_vertices() const
Definition: grid_base_objects.h:729
define the interface that enables you to use your own types as element-types in an AttachmentPipe.
Definition: attachment_pipe.h:305
std::ostream & operator<<(std::ostream &outStream, const ug::MathMatrix< 2, 2 > &m)
Definition: math_matrix.cpp:38
size_t hash_key(const TKey &key)
The hashing method can be specialized for different types.
Definition: hash_function.h:50
#define UG_ASSERT(expr, msg)
Definition: assert.h:70
ugtypes::uint32_t uint32
Definition: types.h:116
#define UG_THROW(msg)
Definition: error.h:57
#define UG_API
Definition: ug_config.h:65
unsigned int uint
Definition: types.h:114
int num_vertices(ug::BidirectionalMatrix< T > const &M)
Definition: bidirectional_boost.h:70
const int NUM_VERTICES
Definition: hexahedron_rules.h:45
ReferenceObjectID
these ids are used to identify the shape of a geometric object.
Definition: grid_base_objects.h:74
@ ROID_TETRAHEDRON
Definition: grid_base_objects.h:80
@ ROID_QUADRILATERAL
Definition: grid_base_objects.h:79
@ NUM_REFERENCE_OBJECTS
Definition: grid_base_objects.h:85
@ ROID_PYRAMID
Definition: grid_base_objects.h:83
@ ROID_PRISM
Definition: grid_base_objects.h:82
@ ROID_EDGE
Definition: grid_base_objects.h:77
@ ROID_UNKNOWN
Definition: grid_base_objects.h:75
@ ROID_OCTAHEDRON
Definition: grid_base_objects.h:84
@ ROID_HEXAHEDRON
Definition: grid_base_objects.h:81
@ ROID_TRIANGLE
Definition: grid_base_objects.h:78
@ ROID_VERTEX
Definition: grid_base_objects.h:76
const int MAX_FACE_VERTICES
constant that defines the maximal number of vertices per face.
Definition: grid_base_objects.h:678
const char * GRID_BASE_OBJECT_PLURAL_NAMES[]
Definition: grid_base_objects.cpp:40
const char * GRID_BASE_OBJECT_SINGULAR_NAMES[]
Definition: grid_base_objects.cpp:39
GridBaseObjectId
enumeration of the GridBaseObjects that make up a grid.
Definition: grid_base_objects.h:59
@ VOLUME
Definition: grid_base_objects.h:63
@ NUM_GEOMETRIC_BASE_OBJECTS
Definition: grid_base_objects.h:64
@ VERTEX
Definition: grid_base_objects.h:60
@ EDGE
Definition: grid_base_objects.h:61
@ FACE
Definition: grid_base_objects.h:62
ReferenceObjectID operator++(ReferenceObjectID &roid, int)
Definition: grid_base_objects.h:89
const int MAX_VOLUME_VERTICES
constant that defines the maximal number of vertices per volume element.
Definition: grid_base_objects.h:945
Vertex base_obj_type
Definition: grid_base_objects.h:983
Edge base_obj_type
Definition: grid_base_objects.h:987
Face base_obj_type
Definition: grid_base_objects.h:991
Volume base_obj_type
Definition: grid_base_objects.h:995
Definition: grid_base_objects.h:980
Edge base_type
Definition: grid_base_objects.h:1019
Face base_type
Definition: grid_base_objects.h:1023
Vertex base_type
Definition: grid_base_objects.h:1015
Volume base_type
Definition: grid_base_objects.h:1027
Definition: grid_base_objects.h:1011
void base_type
Definition: grid_base_objects.h:1011