ug4
grid_base_objects.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2009-2015: G-CSC, Goethe University Frankfurt
3  * Author: Sebastian Reiter
4  *
5  * This file is part of UG4.
6  *
7  * UG4 is free software: you can redistribute it and/or modify it under the
8  * terms of the GNU Lesser General Public License version 3 (as published by the
9  * Free Software Foundation) with the following additional attribution
10  * requirements (according to LGPL/GPL v3 §7):
11  *
12  * (1) The following notice must be displayed in the Appropriate Legal Notices
13  * of covered and combined works: "Based on UG4 (www.ug4.org/license)".
14  *
15  * (2) The following notice must be displayed at a prominent place in the
16  * terminal output of covered works: "Based on UG4 (www.ug4.org/license)".
17  *
18  * (3) The following bibliography is recommended for citation and must be
19  * preserved in all covered files:
20  * "Reiter, S., Vogel, A., Heppner, I., Rupp, M., and Wittum, G. A massively
21  * parallel geometric multigrid solver on hierarchically distributed grids.
22  * Computing and visualization in science 16, 4 (2013), 151-164"
23  * "Vogel, A., Reiter, S., Rupp, M., Nägel, A., and Wittum, G. UG4 -- a novel
24  * flexible software system for simulating pde based models on high performance
25  * computers. Computing and visualization in science 16, 4 (2013), 165-179"
26  *
27  * This program is distributed in the hope that it will be useful,
28  * but WITHOUT ANY WARRANTY; without even the implied warranty of
29  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
30  * GNU Lesser General Public License for more details.
31  */
32 
33 #ifndef __H__LIB_GRID__GEOMETRIC_BASE_OBJECTS__
34 #define __H__LIB_GRID__GEOMETRIC_BASE_OBJECTS__
35 
36 #include <list>
37 #include <cassert>
38 #include <iostream>
39 #include <utility>
40 #include "common/types.h"
41 #include "common/common.h"
42 #include "common/assert.h"
49 
50 namespace ug
51 {
54 // CONSTANTS
55 
59 {
60  VERTEX = 0,
64  NUM_GEOMETRIC_BASE_OBJECTS //always last!!!
65 };
66 
67 extern const char* GRID_BASE_OBJECT_SINGULAR_NAMES[];
68 extern const char* GRID_BASE_OBJECT_PLURAL_NAMES[];
69 
71 // Reference-Object IDs
74 {
86 };
87 
88 inline
90 {
91  int tmp = roid;
92  return roid = static_cast<ReferenceObjectID>(++tmp);
93 };
94 
96 inline
97 std::ostream& operator<< (std::ostream& outStream, ReferenceObjectID type)
98 {
99  switch(type)
100  {
101  case ROID_UNKNOWN: outStream << "(invalid)"; break;
102  case ROID_VERTEX: outStream << "Vertex"; break;
103  case ROID_EDGE: outStream << "Edge"; break;
104  case ROID_TRIANGLE: outStream << "Triangle"; break;
105  case ROID_QUADRILATERAL: outStream << "Quadrilateral"; break;
106  case ROID_TETRAHEDRON: outStream << "Tetrahedron"; break;
107  case ROID_OCTAHEDRON: outStream << "Octahedron"; break;
108  case ROID_HEXAHEDRON: outStream << "Hexahedron"; break;
109  case ROID_PRISM: outStream << "Prism"; break;
110  case ROID_PYRAMID: outStream << "Pyramid"; break;
111  default: throw(UGError("Unknown ReferenceObjectID in operator<<"));
112  }
113  return outStream;
114 };
115 
116 
118 // PREDECLARATIONS
119 class Grid;
120 template<class TElem> class ElementStorage;
121 
122 class GridObject; // geometric base object
123 class Vertex; // base for all 0-dimensional grid objects.
124 class Edge; // base for all 1-dimensional grid objects.
125 class Face; // base for all 2-dimensional grid objects.
126 class Volume; // base for all 3-dimensional grid objects.
127 
128 class EdgeDescriptor; // describes an edge.
129 class FaceDescriptor; // describes a face.
130 class VolumeDescriptor; // describes a volume.
131 
132 class EdgeVertices; // manages the vertices of an edge. Base for Edge and EdgeDescriptor.
133 class FaceVertices; // manages the vertices of a face. Base for Face and FaceDescriptor.
134 class VolumeVertices; // manages the vertices of a volume. Base for Volume and VolumeDescriptor.
135 
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> >;
140 
148 // GridObject
150 
156 class UG_API GridObject/* : public SmallObject<>*/
157 {
158  friend class Grid;
163 
164  public:
165  virtual ~GridObject() {}
166 
168 
169  virtual GridObject* create_empty_instance() const {return NULL;}
170 
171  virtual int container_section() const = 0;
172  virtual int base_object_id() const = 0;
179 
181 
183  virtual bool is_constraining() const {return false;}
184 
186 
188  virtual bool is_constrained() const {return false;}
189 
191 
194  virtual void remove_constraint_link(const Vertex* vrt) {}
195  virtual void remove_constraint_link(const Edge* e) {}
196  virtual void remove_constraint_link(const Face* f) {}
200 
205  inline uint grid_data_index() const {return m_gridDataIndex;}
206 
207  protected:
209 
212  inline void set_grid_data_index(uint index) {m_gridDataIndex = index;}
213 
214  protected:
215  uint m_gridDataIndex;// index to grid-attached data.
216 };
217 
218 
219 
221 // Vertex
223 
230 class UG_API Vertex : public GridObject
231 {
232  friend class Grid;
233  public:
235 
236  // lower dimensional Base Object
237  typedef void lower_dim_base_object;
238 
239  // higher dimensional Base Object
241 
244  typedef Vertex side;
245  typedef Edge sideof;
246 
247  static const bool HAS_SIDES = false;
248  static const bool CAN_BE_SIDE = true;
249 
251  static const int dim = 0;
252 
253  static const int BASE_OBJECT_ID = VERTEX;
254 
255  static const size_t NUM_VERTICES = 1;
256 
257  public:
258  inline static bool type_match(GridObject* pObj) {return dynamic_cast<Vertex*>(pObj) != NULL;}
259 
260  virtual ~Vertex() {}
261 
262  inline uint num_sides() const {return 0;}
263 
264  virtual int container_section() const {return -1;}
265  virtual int base_object_id() const {return VERTEX;}
267 
269 
272  inline uint32 get_hash_value() const {return m_hashValue;}
273 
274  protected:
275  uint32 m_hashValue;// a unique value for each vertex in a grid.
276 };
277 
278 
280 
286 public:
287  typedef Vertex* const* ConstVertexArray;
288 
290  VertexDescriptor(Vertex* v) : m_v(v) {}
291  VertexDescriptor(const VertexDescriptor& d) : m_v (d.m_v) {}
292 
293  VertexDescriptor& operator = (const VertexDescriptor& d)
294  {m_v = d.m_v; return *this;}
295 
296  inline void set_vertex(Vertex* v) {m_v = v;}
297  inline void set_vertex(uint, Vertex* v) {m_v = v;}
298 
299  inline Vertex* vertex () const {return m_v;}
300  virtual Vertex* vertex(size_t) const {return m_v;}
301  Vertex* operator[](size_t) const {return m_v;}
302 
303  virtual ConstVertexArray vertices() const {return &m_v;}
304  virtual size_t num_vertices() const {return 1;}
305 
306 // compatibility with std::vector for some template routines
308  inline size_t size() const {return 1;}
309 
310 private:
312 };
313 
314 
317 {
318  public:
319  typedef Vertex* const* ConstVertexArray;
320 
321  virtual ~IVertexGroup() {};
322  virtual Vertex* vertex(size_t index) const = 0;
323  virtual ConstVertexArray vertices() const = 0;
324  virtual size_t num_vertices() const = 0;
325 
326  // compatibility with std::vector for some template routines
328  inline size_t size() const {return num_vertices();}
330  inline Vertex* operator[](size_t index) const {return vertex(index);}
331 };
332 
333 
336 {
337  public:
339  CustomVertexGroup(size_t numVrts) {m_vrts.resize(numVrts);}
340  virtual ~CustomVertexGroup() {}
341 
342  virtual Vertex* vertex(size_t index) const {return m_vrts[index];}
343  virtual ConstVertexArray vertices() const {return &m_vrts.front();}
344  virtual size_t num_vertices() const {return m_vrts.size();}
345 
346  void set_num_vertices(size_t newSize) {m_vrts.resize(newSize);}
347  void resize(size_t newSize) {m_vrts.resize(newSize);}
348  void clear() {m_vrts.clear();}
349  void push_back(Vertex* vrt) {m_vrts.push_back(vrt);}
350  void set_vertex(size_t index, Vertex* vrt) {m_vrts[index] = vrt;}
351 
352  private:
353  std::vector<Vertex*> m_vrts;
354 };
355 
356 
357 
359 // EdgeVertices
362 {
363  friend class Grid;
364  public:
365  virtual ~EdgeVertices() {}
366  virtual Vertex* vertex(size_t index) const {return m_vertices[index];}
367  virtual ConstVertexArray vertices() const {return m_vertices;}
368  virtual size_t num_vertices() const {return 2;}
369 
370  // compatibility with std::vector for some template routines
372  inline size_t size() const {return 2;}
374  Vertex* operator[](size_t index) const {return m_vertices[index];}
375 
376  protected:
377  inline void assign_edge_vertices(const EdgeVertices& ev)
378  {
379  m_vertices[0] = ev.m_vertices[0];
380  m_vertices[1] = ev.m_vertices[1];
381  }
382 
383  protected:
384  Vertex* m_vertices[2];
385 };
386 
388 // Edge
390 
396 class UG_API Edge : public GridObject, public EdgeVertices
397 {
398  friend class Grid;
399  public:
401 
402  // lower dimensional Base Object
404  // higher dimensional Base Object
406 
407  typedef Vertex side;
408  typedef Face sideof;
409 
410  static const bool HAS_SIDES = true;
411  static const bool CAN_BE_SIDE = true;
412 
414  static const int dim = 1;
415 
416  static const int BASE_OBJECT_ID = EDGE;
417 
418  static const size_t NUM_VERTICES = 2;
419 
420  public:
421  inline static bool type_match(GridObject* pObj) {return dynamic_cast<Edge*>(pObj) != NULL;}
422 
423  virtual ~Edge() {}
424 
425  virtual int container_section() const {return -1;}
426  virtual int base_object_id() const {return EDGE;}
428 
429  inline uint num_sides() const {return 2;}
430 
432 
434  bool get_opposing_side(Vertex* v, Vertex** vrtOut);
435 
437 
451  virtual bool refine(std::vector<Edge*>& vNewEdgesOut,
452  Vertex* newVertex,
453  Vertex** pSubstituteVrts = NULL) {return false;}
454 
455  protected:
456  inline void set_vertex(uint index, Vertex* pVrt) {m_vertices[index] = pVrt;}
457 };
458 
459 
461 // EdgeDescriptor
464 {
465  public:
466  EdgeDescriptor();
467  EdgeDescriptor(const EdgeDescriptor& ed);
468  EdgeDescriptor(Vertex* vrt1, Vertex* vrt2);
469 
470  EdgeDescriptor& operator = (const EdgeDescriptor& ed);
471 
472  inline void set_vertex(uint index, Vertex* vrt) {m_vertices[index] = vrt;}
473  inline void set_vertices(Vertex* vrt1, Vertex* vrt2)
474  {
475  m_vertices[0] = vrt1;
476  m_vertices[1] = vrt2;
477  }
478 };
479 
480 
481 
483 {
484  public:
485  virtual ~FaceVertices() {}
486  virtual Vertex* vertex(size_t index) const {UG_ASSERT(0, "SHOULDN'T BE CALLED"); return NULL;}
487  virtual ConstVertexArray vertices() const {UG_ASSERT(0, "SHOULDN'T BE CALLED"); return NULL;}
488  virtual size_t num_vertices() const {UG_ASSERT(0, "SHOULDN'T BE CALLED"); return 0;}
489 
490  // compatibility with std::vector for some template routines
492  inline size_t size() const {return num_vertices();}
494  inline Vertex* operator[](size_t index) const {return vertex(index);}
495 };
496 
498 // Face
500 
509 class UG_API Face : public GridObject, public FaceVertices
510 {
511  friend class Grid;
512  public:
514 
515  // lower dimensional Base Object
517  // higher dimensional Base Object
519 
520  typedef Edge side;
521  typedef Volume sideof;
522 
523  static const bool HAS_SIDES = true;
524  static const bool CAN_BE_SIDE = true;
525 
527  static const int dim = 2;
528  static const int BASE_OBJECT_ID = FACE;
529 
530  public:
531  inline static bool type_match(GridObject* pObj) {return dynamic_cast<Face*>(pObj) != NULL;}
532 
533  virtual ~Face() {}
534 
536 
537  virtual EdgeDescriptor edge_desc(int index) const
538  {return EdgeDescriptor(vertex(index), vertex((index+1) % size()));}
539 
541 
542  virtual void edge_desc(int index, EdgeDescriptor& edOut) const
543  {edOut.set_vertices(vertex(index), vertex((index+1) % size()));}
544 
545  inline uint num_edges() const {return (uint)num_vertices();}
546  inline uint num_sides() const {return num_edges();}
547 
548  virtual int container_section() const {return -1;}
549  virtual int base_object_id() const {return FACE;}
551 
556  virtual Edge* create_edge(int index) {return NULL;}
557 
558 
560 
562  virtual bool get_opposing_side(EdgeVertices* e, EdgeDescriptor& edOut) const {return false;}
563 
565 
568  virtual std::pair<GridBaseObjectId, int>
569  get_opposing_object(Vertex* vrt) const {UG_THROW("Base method not implemented.");}
570 
572 
573  int get_local_side_index(EdgeVertices* e) const;
574 
594  virtual bool refine(std::vector<Face*>& vNewFacesOut,
595  Vertex** newFaceVertexOut,
596  Vertex** newEdgeVertices,
597  Vertex* newFaceVertex = NULL,
598  Vertex** pSubstituteVertices = NULL,
599  int snapPointIndex = -1) {return false;}
600 
601 
603 
615  virtual bool is_regular_ref_rule(int edgeMarks) const {return false;}
616 
629  virtual bool collapse_edge(std::vector<Face*>& vNewFacesOut,
630  int edgeIndex, Vertex* newVertex,
631  Vertex** pSubstituteVertices = NULL) {return false;}
632 
646  virtual bool collapse_edges(std::vector<Face*>& vNewFacesOut,
647  std::vector<Vertex*>& vNewEdgeVertices,
648  Vertex** pSubstituteVertices = NULL) {return false;}
649 
650 // BEGIN Depreciated
659  virtual void create_faces_by_edge_split(int splitEdgeIndex,
660  Vertex* newVertex,
661  std::vector<Face*>& vNewFacesOut,
662  Vertex** pSubstituteVertices = NULL) {};
663 // END Depreciated
664 
666  //virtual void create_faces_by_edge_collapse(int collapseEdgeIndex,
667  // Vertex* newVertex,
668  // std::vector<Face*>& vNewFacesOut) = 0;
669 
670  protected:
671  virtual void set_vertex(uint index, Vertex* pVrt) {UG_ASSERT(0, "SHOULDN'T BE CALLED");}
672 };
673 
674 
676 
678 const int MAX_FACE_VERTICES = 4;
679 
681 // FaceDescriptor
684 {
685  public:
686  FaceDescriptor();
687  FaceDescriptor(uint numVertices);
688  FaceDescriptor(const FaceDescriptor& fd);
690  m_numVertices(3)
691  {m_vertices[0] = v0; m_vertices[1] = v1; m_vertices[2] = v2;}
692 
693  FaceDescriptor(Vertex* v0, Vertex* v1, Vertex* v2, Vertex* v3) :
694  m_numVertices(4)
695  {m_vertices[0] = v0; m_vertices[1] = v1; m_vertices[2] = v2; m_vertices[3] = v3;}
696 
697  virtual ~FaceDescriptor() {}
698 
699  FaceDescriptor& operator = (const FaceDescriptor& fd);
700 
701  virtual Vertex* vertex(size_t index) const {return m_vertices[index];}
702  virtual ConstVertexArray vertices() const {return m_vertices;}
703  virtual size_t num_vertices() const {return m_numVertices;}
704 
705  inline void set_num_vertices(uint numVertices) {m_numVertices = numVertices;}
706  inline void set_vertex(uint index, Vertex* vrt)
707  {m_vertices[index] = vrt;}
708 
709  protected:
710  Vertex* m_vertices[MAX_FACE_VERTICES];
712 };
713 
714 
717 // VOLUMES
718 
720 // VolumeVertices
723 {
724  public:
725  virtual ~VolumeVertices() {}
726 
727  virtual Vertex* vertex(size_t index) const {UG_ASSERT(0, "SHOULDN'T BE CALLED"); return NULL;}
728  virtual ConstVertexArray vertices() const {UG_ASSERT(0, "SHOULDN'T BE CALLED"); return NULL;}
729  virtual size_t num_vertices() const {UG_ASSERT(0, "SHOULDN'T BE CALLED"); return 0;}
730 
731  // compatibility with std::vector for some template routines
733  inline size_t size() const {return num_vertices();}
735  inline Vertex* operator[](size_t index) const {return vertex(index);}
736 };
737 
739 // Volume
741 
753 class UG_API Volume : public GridObject, public VolumeVertices
754 {
755  friend class Grid;
756  public:
758 
759  // lower dimensional Base Object
761  // higher dimensional Base Object
763 
764  typedef Face side;
765  // this is just by convention. Use can_be_side() to stop recursions.
766  typedef Volume sideof;
767 
768  static const bool HAS_SIDES = true;
769  static const bool CAN_BE_SIDE = false;
770 
772  static const int dim = 3;
773  static const int BASE_OBJECT_ID = VOLUME;
774 
775  public:
776  inline static bool type_match(GridObject* pObj) {return dynamic_cast<Volume*>(pObj) != NULL;}
777 
778  virtual ~Volume() {}
779 
780  virtual EdgeDescriptor edge_desc(int index) const {return EdgeDescriptor(NULL, NULL);}
781  virtual void edge_desc(int index, EdgeDescriptor& edOut) const {edOut = EdgeDescriptor(NULL, NULL);}
782  virtual uint num_edges() const {return 0;}
783 
784  virtual FaceDescriptor face_desc(int index) const {return FaceDescriptor(0);}
785  virtual void face_desc(int index, FaceDescriptor& fdOut) const {fdOut = FaceDescriptor(0);}
786  virtual uint num_faces() const {return 0;}
787  inline uint num_sides() const {return num_faces();}
788 
789  virtual Edge* create_edge(int index) {return NULL;}
790  virtual Face* create_face(int index) {return NULL;}
791 
793 
794  virtual void get_vertex_indices_of_edge(size_t& ind1Out,
795  size_t& ind2Out,
796  size_t edgeInd) const
797  {UG_THROW("Base method not implemented.");};
798 
800 
801  virtual void get_vertex_indices_of_face(std::vector<size_t>& indsOut,
802  size_t side) const
803  {UG_THROW("Base method not implemented.");}
804 
806 
807  virtual int get_edge_index_from_vertices( const size_t vi0,
808  const size_t vi1) const
809  {UG_THROW("Base method not implemented.");};
810 
812 
813  virtual int get_face_edge_index ( const size_t faceInd,
814  const size_t faceEdgeInd) const
815  {UG_THROW("Base method not implemented.");};
816 
818 
820  virtual bool get_opposing_side(FaceVertices* f, FaceDescriptor& fdOut) const {return false;}
821 
823 
826  virtual std::pair<GridBaseObjectId, int>
828  {UG_THROW("Base method not implemented.");}
829 
831  int get_local_side_index(FaceVertices* f) const;
832 
873  virtual bool refine(std::vector<Volume*>& vNewVolumesOut,
874  Vertex** ppNewVertexOut,
875  Vertex** newEdgeVertices,
876  Vertex** newFaceVertices,
877  Vertex* newVolumeVertex,
878  const Vertex& prototypeVertex,
879  Vertex** pSubstituteVertices = NULL,
880  vector3* corners = NULL,
881  bool* isSnapPoint = NULL) {return false;}
882 
883 
885 
897  virtual bool is_regular_ref_rule(int edgeMarks) const {return false;}
898 
911  virtual bool collapse_edge(std::vector<Volume*>& vNewVolumesOut,
912  int edgeIndex, Vertex* newVertex,
913  std::vector<Vertex*>* pvSubstituteVertices = NULL) {return false;}
914 
923  virtual void get_flipped_orientation(VolumeDescriptor& vdOut) const;
924 
925  virtual int container_section() const {return -1;}
926  virtual int base_object_id() const {return VOLUME;}
928 
930  //virtual void create_volumes_by_edge_split(int splitEdgeIndex,
931  // Vertex* newVertex,
932  // std::vector<Volume*>& vNewFacesOut) = 0;
933 
935  //virtual void create_Volumes_by_edge_collapse(int collapseEdgeIndex,
936  // Vertex* newVertex,
937  // std::vector<Volume*>& vNewFacesOut) = 0;
938  protected:
939  virtual void set_vertex(uint index, Vertex* pVrt) {UG_ASSERT(0, "SHOULDN'T BE CALLED");}
940 };
941 
942 
944 
945 const int MAX_VOLUME_VERTICES = 8;
946 
948 // VolumeDescriptor
951 {
952  public:
954  VolumeDescriptor(uint numVertices);
956 
957  virtual ~VolumeDescriptor() {}
958 
959  VolumeDescriptor& operator = (const VolumeDescriptor& vv);
960  VolumeDescriptor& operator = (const VolumeVertices& vv);
961 
962  virtual Vertex* vertex(size_t index) const {return m_vertices[index];}
963  virtual ConstVertexArray vertices() const {return m_vertices;}
964  virtual size_t num_vertices() const {return m_numVertices;}
965 
966  inline void set_num_vertices(uint numVertices) {m_numVertices = numVertices;}
967  inline void set_vertex(uint index, Vertex* vrt) {m_vertices[index] = vrt;}
968 
969  protected:
972 };
973 
974 
975 
978 
980 template <int dim> struct GeomObjBaseTypeByDim;
981 
982 template <> struct GeomObjBaseTypeByDim<0>{
984 };
985 
986 template <> struct GeomObjBaseTypeByDim<1>{
988 };
989 
990 template <> struct GeomObjBaseTypeByDim<2>{
992 };
993 
994 template <> struct GeomObjBaseTypeByDim<3>{
996 };
997 
1003 
1009 template <class TGeomObjPtrType>
1011 {typedef void base_type;};
1012 
1013 template <>
1015 {typedef Vertex base_type;};
1016 
1017 template <>
1019 {typedef Edge base_type;};
1020 
1021 template <>
1023 {typedef Face base_type;};
1024 
1025 template <>
1027 {typedef Volume base_type;};
1033 // hash-funtions for vertices
1035 size_t hash_key(Vertex* key);
1036 
1038 // hash-funtions for edges
1040 
1046 size_t hash_key(EdgeVertices* key);
1047 size_t hash_key(const EdgeVertices* key);
1048 
1050 
1051 size_t hash_key(Edge* key);
1052 
1054 
1055 size_t hash_key(EdgeDescriptor* key);
1056 
1058 // hash-funtions for faces
1060 
1066 size_t hash_key(FaceVertices* key);
1067 size_t hash_key(const FaceVertices* key);
1068 
1070 
1071 size_t hash_key(Face* key);
1072 
1074 
1075 size_t hash_key(FaceDescriptor* key);
1076 
1078 // hash-funtions for volumes
1080 
1086 size_t hash_key(VolumeVertices* key);
1087 size_t hash_key(const VolumeVertices* key);
1088 
1090 
1091 size_t hash_key(Volume* key);
1092 
1094 
1095 size_t hash_key(VolumeDescriptor* key);
1096 
1097 }// end of namespace
1098 
1099 #endif
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
static const int dim
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
the ug namespace
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
typedefs for ugmath