ug4
grid_objects_2d.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2011-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__UG__grid_objects_2d__
34 #define __H__UG__grid_objects_2d__
35 
36 #include "../grid/grid.h"
37 #include "common/math/ugmath.h"
38 #include "common/assert.h"
39 #include "grid_objects_0d.h"
40 #include "grid_objects_1d.h"
41 
42 namespace ug
43 {
44 
47 
49 {
57 
58  CSFACE_USER // always last
59 };
60 
61 
62 // predeclarations
63 class Triangle;
64 class Quadrilateral;
65 class ConstrainedTriangle;
66 class ConstrainedQuadrilateral;
67 class ConstrainingTriangle;
68 class ConstrainingQuadrilateral;
69 
71 // NORMAL FACES
73 
75 // TriangleDescriptor
78 {
79  public:
82  TriangleDescriptor(Vertex* v1, Vertex* v2, Vertex* v3);
83 
84  inline uint num_vertices() const {return 3;}
85  inline void set_vertex(uint index, Vertex* v) {m_vertex[index] = v;}
86  inline Vertex* vertex(size_t index) const {return m_vertex[index];}
87 
88  protected:
89  Vertex* m_vertex[3];
90 };
91 
92 
93 
95 // CustomTriangle
97 
105 template <class ConcreteTriangleType, class BaseClass,
106  class RefTriType, class RefQuadType>
107 class UG_API CustomTriangle : public BaseClass
108 {
109  public:
110  static const size_t NUM_VERTICES = 3;
111 
112  public:
115  CustomTriangle(Vertex* v1, Vertex* v2, Vertex* v3);
116 
117  virtual GridObject* create_empty_instance() const {return new ConcreteTriangleType;}
119 
120  virtual Vertex* vertex(size_t index) const {return m_vertices[index];}
121  virtual Face::ConstVertexArray vertices() const {return m_vertices;}
122  virtual size_t num_vertices() const {return 3;}
123 
124  virtual EdgeDescriptor edge_desc(int index) const
125  {return EdgeDescriptor(m_vertices[index], m_vertices[(index+1) % 3]);}
126 
127  virtual void edge_desc(int index, EdgeDescriptor& edOut) const
128  {edOut.set_vertices(m_vertices[index], m_vertices[(index+1) % 3]);}
129 
130  virtual std::pair<GridBaseObjectId, int> get_opposing_object(Vertex* vrt) const;
131 
133  virtual bool refine(std::vector<Face*>& vNewFacesOut,
134  Vertex** newFaceVertexOut,
135  Vertex** newEdgeVertices,
136  Vertex* newFaceVertex = NULL,
137  Vertex** pSubstituteVertices = NULL,
138  int snapPointIndex = -1);
139 
140  virtual bool is_regular_ref_rule(int edgeMarks) const;
141 
142  virtual bool collapse_edge(std::vector<Face*>& vNewFacesOut,
143  int edgeIndex, Vertex* newVertex,
144  Vertex** pSubstituteVertices = NULL);
145 
146  virtual bool collapse_edges(std::vector<Face*>& vNewFacesOut,
147  std::vector<Vertex*>& vNewEdgeVertices,
148  Vertex** pSubstituteVertices = NULL);
149 
150 // BEGIN Depreciated
151  virtual void create_faces_by_edge_split(int splitEdgeIndex,
152  Vertex* newVertex,
153  std::vector<Face*>& vNewFacesOut,
154  Vertex** pSubstituteVertices = NULL);
155 
156  protected:
157  virtual void set_vertex(uint index, Vertex* pVrt) {m_vertices[index] = pVrt;}
158 
159  protected:
160  Vertex* m_vertices[3];
161 };
162 
163 
164 
166 // Triangle
168 
173  public CustomTriangle<Triangle, Face, Triangle, Quadrilateral>
174 {
176  public:
177  inline static bool type_match(GridObject* pObj) {return dynamic_cast<Triangle*>(pObj) != NULL;}
178 
181  Triangle(Vertex* v1, Vertex* v2, Vertex* v3) : BaseClass(v1, v2, v3) {}
182 
183  virtual int container_section() const {return CSFACE_TRIANGLE;}
184 
185  protected:
186  virtual Edge* create_edge(int index)
187  {
188  return new RegularEdge(m_vertices[index], m_vertices[(index+1) % 3]);
189  }
190 };
191 
192 template <>
194 {
195  public:
199 
202 
203  enum
204  {
205  CONTAINER_SECTION = CSFACE_TRIANGLE,
206  BASE_OBJECT_ID = FACE
207  };
208  static const ReferenceObjectID REFERENCE_OBJECT_ID = ROID_TRIANGLE;
209 };
210 
213 
214 
215 
217 // QuadrilateralDescriptor
220 {
221  public:
224  QuadrilateralDescriptor(Vertex* v1, Vertex* v2, Vertex* v3, Vertex* v4);
225 
226  inline uint num_vertices() const {return 4;}
227  inline void set_vertex(uint index, Vertex* v) {m_vertex[index] = v;}
228  inline Vertex* vertex(size_t index) const {return m_vertex[index];}
229 
230  protected:
231  Vertex* m_vertex[4];
232 };
233 
234 
235 
237 // CustomQuadrilateral
239 
247 template <class ConcreteQuadrilateralType, class BaseClass,
248  class RefTriType, class RefQuadType>
249 class UG_API CustomQuadrilateral : public BaseClass
250 {
251  public:
252  static const size_t NUM_VERTICES = 4;
253 
254  public:
255  using typename BaseClass::ConstVertexArray;
256 
260  Vertex* v3, Vertex* v4);
261 
262  virtual GridObject* create_empty_instance() const {return new ConcreteQuadrilateralType;}
264 
265  virtual Vertex* vertex(size_t index) const {return m_vertices[index];}
266  virtual Face::ConstVertexArray vertices() const {return m_vertices;}
267  virtual size_t num_vertices() const {return 4;}
268 
269  virtual EdgeDescriptor edge_desc(int index) const
270  {return EdgeDescriptor(m_vertices[index], m_vertices[(index+1) % 4]);}
271 
272  virtual void edge_desc(int index, EdgeDescriptor& edOut) const
273  {edOut.set_vertices(m_vertices[index], m_vertices[(index+1) % 4]);}
274 
275 
277 
278  virtual bool get_opposing_side(EdgeVertices* e, EdgeDescriptor& edOut) const;
279 
280  virtual std::pair<GridBaseObjectId, int> get_opposing_object(Vertex* vrt) const;
281 
283  virtual bool refine(std::vector<Face*>& vNewFacesOut,
284  Vertex** newFaceVertexOut,
285  Vertex** newEdgeVertices,
286  Vertex* newFaceVertex = NULL,
287  Vertex** pSubstituteVertices = NULL,
288  int snapPointIndex = -1);
289 
290  virtual bool is_regular_ref_rule(int edgeMarks) const;
291 
292  virtual bool collapse_edge(std::vector<Face*>& vNewFacesOut,
293  int edgeIndex, Vertex* newVertex,
294  Vertex** pSubstituteVertices = NULL);
295 
296  virtual bool collapse_edges(std::vector<Face*>& vNewFacesOut,
297  std::vector<Vertex*>& vNewEdgeVertices,
298  Vertex** pSubstituteVertices = NULL);
299 
300 // BEGIN Depreciated
301  virtual void create_faces_by_edge_split(int splitEdgeIndex,
302  Vertex* newVertex,
303  std::vector<Face*>& vNewFacesOut,
304  Vertex** pSubstituteVertices = NULL);
305 
306  protected:
307  virtual void set_vertex(uint index, Vertex* pVrt) {m_vertices[index] = pVrt;}
308 
309  protected:
310  Vertex* m_vertices[4];
311 };
312 
313 
314 
316 // Quadrilateral
318 
322  public CustomQuadrilateral<Quadrilateral, Face, Triangle, Quadrilateral>
323 {
324  public:
327 
328  inline static bool type_match(GridObject* pObj)
329  {return dynamic_cast<Quadrilateral*>(pObj) != NULL;}
330 
334  Vertex* v3, Vertex* v4) : BaseClass(v1, v2, v3, v4) {}
335 
336  virtual int container_section() const {return CSFACE_QUADRILATERAL;}
337 
338  protected:
339  virtual Edge* create_edge(int index)
340  {
341  return new RegularEdge(m_vertices[index], m_vertices[(index+1) % 4]);
342  }
343 };
344 
345 template <>
347 {
348  public:
354 
357 
358  enum
359  {
360  CONTAINER_SECTION = CSFACE_QUADRILATERAL,
361  BASE_OBJECT_ID = FACE
362  };
363  static const ReferenceObjectID REFERENCE_OBJECT_ID = ROID_QUADRILATERAL;
364 };
365 
368 
369 
370 
372 // CONSTRAINED FACES
374 
376 // ConstrainedFace
378 
383 {
384  public:
385  inline static bool type_match(GridObject* pObj)
386  {return dynamic_cast<ConstrainedFace*>(pObj) != NULL;}
387 
388  ConstrainedFace() : m_pConstrainingObject(NULL), m_parentBaseObjectId(-1) {}
390  {
391  if(m_pConstrainingObject)
392  m_pConstrainingObject->remove_constraint_link(this);
393  }
394 
396  {
397  m_pConstrainingObject = pObj;
398  if(pObj)
399  m_parentBaseObjectId = pObj->base_object_id();
400  }
401 
402  inline GridObject* get_constraining_object() {return m_pConstrainingObject;}
403 
404  inline int get_parent_base_object_id() {return m_parentBaseObjectId;}
405  inline void set_parent_base_object_id(int id)
406  {
407  if((m_parentBaseObjectId != -1) && (m_parentBaseObjectId != id)){
408  UG_THROW("Bad parent base object id specified! The given id"
409  " has to match the id of the constraining object if that"
410  " is present. Call this method only, if no constraining"
411  " object has been set!");
412  }
413  m_parentBaseObjectId = id;
414  }
415 
416  virtual bool is_constrained() const {return true;}
417 
418  virtual void remove_constraint_link(const Face* f)
419  {
420  if(m_pConstrainingObject == static_cast<const GridObject*>(f))
421  m_pConstrainingObject = NULL;
422  }
423 
424 
425  protected:
428 };
429 
430 
432 // ConstrainedTriangle
434 
438  public CustomTriangle <ConstrainedTriangle, ConstrainedFace,
439  ConstrainedTriangle, ConstrainedQuadrilateral>
440 {
444 
445  public:
446  inline static bool type_match(GridObject* pObj) {return dynamic_cast<ConstrainedTriangle*>(pObj) != NULL;}
447 
449  BaseTriangle() {}
450 
452  BaseTriangle(td) {}
453 
455  BaseTriangle(v1, v2, v3) {}
456 
457  virtual int container_section() const {return CSFACE_CONSTRAINED_TRIANGLE;}
458 
459  protected:
460  virtual Edge* create_edge(int index)
461  {
462  return new ConstrainedEdge(m_vertices[index], m_vertices[(index+1) % 3]);
463  }
464 };
465 
466 template <>
468 {
469  public:
475 
478 
479  enum
480  {
481  CONTAINER_SECTION = CSFACE_CONSTRAINED_TRIANGLE,
482  BASE_OBJECT_ID = FACE
483  };
484  static const ReferenceObjectID REFERENCE_OBJECT_ID = ROID_TRIANGLE;
485 };
486 
489 
490 
491 
493 // ConstrainedQuadrilateral
495 
499  public CustomQuadrilateral <ConstrainedQuadrilateral, ConstrainedFace,
500  ConstrainedTriangle, ConstrainedQuadrilateral>
501 {
505 
506  public:
507  inline static bool type_match(GridObject* pObj) {return dynamic_cast<ConstrainedQuadrilateral*>(pObj) != NULL;}
508 
512  Vertex* v3, Vertex* v4) : BaseClass(v1, v2, v3, v4) {}
513 
515 
516  protected:
517  virtual Edge* create_edge(int index)
518  {
519  return new ConstrainedEdge(m_vertices[index], m_vertices[(index+1) % 4]);
520  }
521 };
522 
523 
524 template <>
526 {
527  public:
533 
536 
537  enum
538  {
539  CONTAINER_SECTION = CSFACE_CONSTRAINED_QUADRILATERAL,
540  BASE_OBJECT_ID = FACE
541  };
542  static const ReferenceObjectID REFERENCE_OBJECT_ID = ROID_QUADRILATERAL;
543 };
544 
547 
548 
549 
551 // CONSTRAINING FACES
553 
555 // ConstrainingFace
557 
562 {
563 
564  public:
565  inline static bool type_match(GridObject* pObj) {return dynamic_cast<ConstrainingFace*>(pObj) != NULL;}
566 
568  {
569  for(size_t i = 0; i < m_constrainedVertices.size(); ++i){
570  m_constrainedVertices[i]->remove_constraint_link(this);
571  }
572 
573  for(size_t i = 0; i < m_constrainedEdges.size(); ++i){
574  m_constrainedEdges[i]->remove_constraint_link(this);
575  }
576 
577  for(size_t i = 0; i < m_constrainedFaces.size(); ++i){
578  m_constrainedFaces[i]->remove_constraint_link(this);
579  }
580  }
581 
582  virtual bool is_constraining() const {return true;}
583 
584  inline void add_constrained_object(Vertex* pObj)
585  {
586  UG_ASSERT(!is_constrained_object(pObj),
587  "vertex is already registered at constraining face");
588  m_constrainedVertices.push_back(pObj);
589  }
590 
591  inline void add_constrained_object(Edge* pObj)
592  {
593  UG_ASSERT(!is_constrained_object(pObj),
594  "edge is already registered at constraining face");
595  m_constrainedEdges.push_back(pObj);
596  }
597 
598  inline void add_constrained_object(Face* pObj)
599  {
600  UG_ASSERT(!is_constrained_object(pObj),
601  "face is already registered at constraining face");
602  m_constrainedFaces.push_back(pObj);
603  }
604 
605  inline bool is_constrained_object(Vertex* vrt)
606  {
607  std::vector<Vertex*>::iterator iter = find(m_constrainedVertices.begin(),
608  m_constrainedVertices.end(), vrt);
609  return iter != m_constrainedVertices.end();
610  }
611 
612  inline bool is_constrained_object(Edge* edge)
613  {
614  std::vector<Edge*>::iterator iter = find(m_constrainedEdges.begin(),
615  m_constrainedEdges.end(), edge);
616  return iter != m_constrainedEdges.end();
617  }
618 
619  inline bool is_constrained_object(Face* face)
620  {
621  std::vector<Face*>::iterator iter = find(m_constrainedFaces.begin(),
622  m_constrainedFaces.end(), face);
623  return iter != m_constrainedFaces.end();
624  }
625 
626  virtual void remove_constraint_link(const Vertex* vrt)
627  {
628  unconstrain_object(vrt);
629  }
630 
631  virtual void remove_constraint_link(const Edge* e)
632  {
633  unconstrain_object(e);
634  }
635 
636  virtual void remove_constraint_link(const Face* f)
637  {
638  unconstrain_object(f);
639  }
640 
641  inline void unconstrain_object(const Vertex* vrt)
642  {
643  std::vector<Vertex*>::iterator iter = find(m_constrainedVertices.begin(),
644  m_constrainedVertices.end(), vrt);
645  if(iter != m_constrainedVertices.end())
646  m_constrainedVertices.erase(iter);
647  }
648 
649  inline void unconstrain_object(const Edge* edge)
650  {
651  std::vector<Edge*>::iterator iter
652  = find(m_constrainedEdges.begin(),
653  m_constrainedEdges.end(), edge);
654 
655  if(iter != m_constrainedEdges.end())
656  m_constrainedEdges.erase(iter);
657  }
658 
659  inline void unconstrain_object(const Face* face)
660  {
661  std::vector<Face*>::iterator iter = find(m_constrainedFaces.begin(),
662  m_constrainedFaces.end(), face);
663  if(iter != m_constrainedFaces.end())
664  m_constrainedFaces.erase(iter);
665  }
666 
667  inline void clear_constrained_vertices() {m_constrainedVertices.clear();}
668  inline void clear_constrained_edges() {m_constrainedEdges.clear();}
669  inline void clear_constrained_faces() {m_constrainedFaces.clear();}
671  {
672  clear_constrained_vertices();
673  clear_constrained_edges();
674  clear_constrained_faces();
675  }
676 
677  inline size_t num_constrained_vertices() const
678  {return m_constrainedVertices.size();}
679 
680  inline size_t num_constrained_edges() const
681  {return m_constrainedEdges.size();}
682 
683  inline size_t num_constrained_faces() const
684  {return m_constrainedFaces.size();}
685 
686 
687  template <class TElem> size_t num_constrained() const;
688 
689 
690  inline Vertex* constrained_vertex(size_t ind) const
691  {
692  UG_ASSERT(ind < m_constrainedVertices.size(), "bad index.");
693  return m_constrainedVertices[ind];
694  }
695 
696  inline Edge* constrained_edge(size_t ind) const
697  {
698  UG_ASSERT(ind < m_constrainedEdges.size(), "bad index.");
699  return m_constrainedEdges[ind];
700  }
701 
702  inline Face* constrained_face(size_t ind) const
703  {
704  UG_ASSERT(ind < m_constrainedFaces.size(), "bad index.");
705  return m_constrainedFaces[ind];
706  }
707 
708  template <class TElem> TElem* constrained(size_t ind) const;
709 
710  protected:
711  std::vector<Vertex*> m_constrainedVertices;
712  std::vector<Edge*> m_constrainedEdges;
713  std::vector<Face*> m_constrainedFaces;
714 };
715 
716 
717 
719 // ConstrainingTriangle
721 
725  public CustomTriangle <ConstrainingTriangle, ConstrainingFace,
726  ConstrainingTriangle, ConstrainingQuadrilateral>
727 {
731 
732  public:
733  inline static bool type_match(GridObject* pObj)
734  {return dynamic_cast<ConstrainingTriangle*>(pObj) != NULL;}
735 
737  BaseTriangle() {reserve_memory();}
739  BaseTriangle(td) {reserve_memory();}
741  BaseTriangle(v1, v2, v3) {reserve_memory();}
742 
743  virtual int container_section() const {return CSFACE_CONSTRAINING_TRIANGLE;}
744 
745  protected:
747  {
748  m_constrainedEdges.reserve(3);
749  m_constrainedFaces.reserve(4);
750  }
751 
752  virtual Edge* create_edge(int index)
753  {
754  return new RegularEdge(m_vertices[index], m_vertices[(index+1) % 3]);
755  }
756 };
757 
758 template <>
760 {
761  public:
767 
770 
771  enum
772  {
773  CONTAINER_SECTION = CSFACE_CONSTRAINING_TRIANGLE,
774  BASE_OBJECT_ID = FACE
775  };
776  static const ReferenceObjectID REFERENCE_OBJECT_ID = ROID_TRIANGLE;
777 };
778 
783 
784 
785 
787 // ConstrainingQuadrilateral
789 
793  public CustomQuadrilateral <ConstrainingQuadrilateral, ConstrainingFace,
794  ConstrainingTriangle, ConstrainingQuadrilateral>
795 {
799 
800  public:
801  inline static bool type_match(GridObject* pObj) {return dynamic_cast<ConstrainingQuadrilateral*>(pObj) != NULL;}
802 
804  BaseClass() {reserve_memory();}
806  BaseClass(qd) {reserve_memory();}
808  Vertex* v3, Vertex* v4) :
809  BaseClass(v1, v2, v3, v4) {reserve_memory();}
810 
812 
813  protected:
815  {
816  m_constrainedVertices.reserve(1);
817  m_constrainedEdges.reserve(4);
818  m_constrainedFaces.reserve(4);
819  }
820 
821  virtual Edge* create_edge(int index)
822  {
823  return new RegularEdge(m_vertices[index], m_vertices[(index+1) % 4]);
824  }
825 };
826 
827 template <>
829 {
830  public:
833 
837 
840 
841  enum
842  {
844  BASE_OBJECT_ID = FACE
845  };
846  static const ReferenceObjectID REFERENCE_OBJECT_ID = ROID_QUADRILATERAL;
847 };
848 
853 
854 
855 }// end of namespace
856 
857 #endif
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
This class stores the constraining object.
Definition: grid_objects_2d.h:383
virtual ~ConstrainedFace()
Definition: grid_objects_2d.h:389
void set_parent_base_object_id(int id)
Definition: grid_objects_2d.h:405
int m_parentBaseObjectId
Definition: grid_objects_2d.h:427
GridObject * get_constraining_object()
Definition: grid_objects_2d.h:402
virtual void remove_constraint_link(const Face *f)
removes a constraint link to the grid object.
Definition: grid_objects_2d.h:418
void set_constraining_object(GridObject *pObj)
Definition: grid_objects_2d.h:395
GridObject * m_pConstrainingObject
Definition: grid_objects_2d.h:426
int get_parent_base_object_id()
Definition: grid_objects_2d.h:404
ConstrainedFace()
Definition: grid_objects_2d.h:388
static bool type_match(GridObject *pObj)
Definition: grid_objects_2d.h:385
virtual bool is_constrained() const
returns true if the object is constrained by other objects.
Definition: grid_objects_2d.h:416
a quadrilateral constrained by another object.
Definition: grid_objects_2d.h:501
static bool type_match(GridObject *pObj)
Definition: grid_objects_2d.h:507
ConstrainedQuadrilateral(const QuadrilateralDescriptor &qd)
Definition: grid_objects_2d.h:510
ConstrainedQuadrilateral(Vertex *v1, Vertex *v2, Vertex *v3, Vertex *v4)
Definition: grid_objects_2d.h:511
ConstrainedQuadrilateral()
Definition: grid_objects_2d.h:509
virtual int container_section() const
Definition: grid_objects_2d.h:514
CustomQuadrilateral< ConstrainedQuadrilateral, ConstrainedFace, ConstrainedTriangle, ConstrainedQuadrilateral > BaseClass
Definition: grid_objects_2d.h:504
virtual Edge * create_edge(int index)
create the edge with index i and return it.
Definition: grid_objects_2d.h:517
a triangle constrained by another object.
Definition: grid_objects_2d.h:440
static bool type_match(GridObject *pObj)
Definition: grid_objects_2d.h:446
CustomTriangle< ConstrainedTriangle, ConstrainedFace, ConstrainedTriangle, ConstrainedQuadrilateral > BaseTriangle
Definition: grid_objects_2d.h:443
ConstrainedTriangle(Vertex *v1, Vertex *v2, Vertex *v3)
Definition: grid_objects_2d.h:454
ConstrainedTriangle(const TriangleDescriptor &td)
Definition: grid_objects_2d.h:451
ConstrainedTriangle()
Definition: grid_objects_2d.h:448
virtual int container_section() const
Definition: grid_objects_2d.h:457
virtual Edge * create_edge(int index)
create the edge with index i and return it.
Definition: grid_objects_2d.h:460
This class is used to store constrained geometric objects.
Definition: grid_objects_2d.h:562
void unconstrain_object(const Vertex *vrt)
Definition: grid_objects_2d.h:641
bool is_constrained_object(Face *face)
Definition: grid_objects_2d.h:619
TElem * constrained(size_t ind) const
void unconstrain_object(const Face *face)
Definition: grid_objects_2d.h:659
void clear_constrained_vertices()
Definition: grid_objects_2d.h:667
void unconstrain_object(const Edge *edge)
Definition: grid_objects_2d.h:649
size_t num_constrained() const
std::vector< Face * > m_constrainedFaces
Definition: grid_objects_2d.h:713
void add_constrained_object(Vertex *pObj)
Definition: grid_objects_2d.h:584
Vertex * constrained_vertex(size_t ind) const
Definition: grid_objects_2d.h:690
std::vector< Edge * > m_constrainedEdges
Definition: grid_objects_2d.h:712
void clear_constrained_edges()
Definition: grid_objects_2d.h:668
bool is_constrained_object(Edge *edge)
Definition: grid_objects_2d.h:612
bool is_constrained_object(Vertex *vrt)
Definition: grid_objects_2d.h:605
virtual void remove_constraint_link(const Vertex *vrt)
removes a constraint link to the grid object.
Definition: grid_objects_2d.h:626
virtual ~ConstrainingFace()
Definition: grid_objects_2d.h:567
virtual void remove_constraint_link(const Face *f)
removes a constraint link to the grid object.
Definition: grid_objects_2d.h:636
Face * constrained_face(size_t ind) const
Definition: grid_objects_2d.h:702
Edge * constrained_edge(size_t ind) const
Definition: grid_objects_2d.h:696
virtual void remove_constraint_link(const Edge *e)
removes a constraint link to the grid object.
Definition: grid_objects_2d.h:631
virtual bool is_constraining() const
returns the id of the reference-object.
Definition: grid_objects_2d.h:582
void add_constrained_object(Face *pObj)
Definition: grid_objects_2d.h:598
void add_constrained_object(Edge *pObj)
Definition: grid_objects_2d.h:591
size_t num_constrained_faces() const
Definition: grid_objects_2d.h:683
static bool type_match(GridObject *pObj)
Definition: grid_objects_2d.h:565
std::vector< Vertex * > m_constrainedVertices
Definition: grid_objects_2d.h:711
void clear_constrained_objects()
Definition: grid_objects_2d.h:670
size_t num_constrained_edges() const
Definition: grid_objects_2d.h:680
void clear_constrained_faces()
Definition: grid_objects_2d.h:669
size_t num_constrained_vertices() const
Definition: grid_objects_2d.h:677
a quadrilateral constraining other objects.
Definition: grid_objects_2d.h:795
CustomQuadrilateral< ConstrainingQuadrilateral, ConstrainingFace, ConstrainingTriangle, ConstrainingQuadrilateral > BaseClass
Definition: grid_objects_2d.h:798
ConstrainingQuadrilateral(const QuadrilateralDescriptor &qd)
Definition: grid_objects_2d.h:805
ConstrainingQuadrilateral()
Definition: grid_objects_2d.h:803
virtual int container_section() const
Definition: grid_objects_2d.h:811
static bool type_match(GridObject *pObj)
Definition: grid_objects_2d.h:801
void reserve_memory()
Definition: grid_objects_2d.h:814
virtual Edge * create_edge(int index)
create the edge with index i and return it.
Definition: grid_objects_2d.h:821
ConstrainingQuadrilateral(Vertex *v1, Vertex *v2, Vertex *v3, Vertex *v4)
Definition: grid_objects_2d.h:807
a triangle constraining other objects.
Definition: grid_objects_2d.h:727
virtual Edge * create_edge(int index)
create the edge with index i and return it.
Definition: grid_objects_2d.h:752
CustomTriangle< ConstrainingTriangle, ConstrainingFace, ConstrainingTriangle, ConstrainingQuadrilateral > BaseTriangle
Definition: grid_objects_2d.h:730
void reserve_memory()
Definition: grid_objects_2d.h:746
static bool type_match(GridObject *pObj)
Definition: grid_objects_2d.h:733
ConstrainingTriangle(const TriangleDescriptor &td)
Definition: grid_objects_2d.h:738
virtual int container_section() const
Definition: grid_objects_2d.h:743
ConstrainingTriangle(Vertex *v1, Vertex *v2, Vertex *v3)
Definition: grid_objects_2d.h:740
ConstrainingTriangle()
Definition: grid_objects_2d.h:736
Concrete types share this base-type. It is not intended for direct use.
Definition: grid_objects_2d.h:250
virtual void set_vertex(uint index, Vertex *pVrt)
Definition: grid_objects_2d.h:307
virtual ReferenceObjectID reference_object_id() const
Definition: grid_objects_2d.h:263
virtual void edge_desc(int index, EdgeDescriptor &edOut) const
Definition: grid_objects_2d.h:272
virtual Vertex * vertex(size_t index) const
Definition: grid_objects_2d.h:265
virtual EdgeDescriptor edge_desc(int index) const
Definition: grid_objects_2d.h:269
CustomQuadrilateral()
Definition: grid_objects_2d.h:257
virtual Face::ConstVertexArray vertices() const
Definition: grid_objects_2d.h:266
virtual size_t num_vertices() const
Definition: grid_objects_2d.h:267
virtual GridObject * create_empty_instance() const
Definition: grid_objects_2d.h:262
Concrete types share this base-type. It is not intended for direct use.
Definition: grid_objects_2d.h:108
virtual void set_vertex(uint index, Vertex *pVrt)
Definition: grid_objects_2d.h:157
CustomTriangle()
Definition: grid_objects_2d.h:113
virtual ReferenceObjectID reference_object_id() const
Definition: grid_objects_2d.h:118
virtual EdgeDescriptor edge_desc(int index) const
Definition: grid_objects_2d.h:124
virtual Face::ConstVertexArray vertices() const
Definition: grid_objects_2d.h:121
virtual void edge_desc(int index, EdgeDescriptor &edOut) const
Definition: grid_objects_2d.h:127
virtual Vertex * vertex(size_t index) const
Definition: grid_objects_2d.h:120
virtual GridObject * create_empty_instance() const
Definition: grid_objects_2d.h:117
virtual size_t num_vertices() const
Definition: grid_objects_2d.h:122
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
Base-class for edges.
Definition: grid_base_objects.h:397
holds the vertices of an Edge or an EdgeDescriptor.
Definition: grid_base_objects.h:362
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
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
Vertex *const * ConstVertexArray
Definition: grid_base_objects.h:319
only used to initialize a quadrilateral. for all other tasks you should use FaceDescriptor.
Definition: grid_objects_2d.h:220
Vertex * vertex(size_t index) const
Definition: grid_objects_2d.h:228
void set_vertex(uint index, Vertex *v)
Definition: grid_objects_2d.h:227
QuadrilateralDescriptor()
Definition: grid_objects_2d.h:222
uint num_vertices() const
Definition: grid_objects_2d.h:226
a face with four points.
Definition: grid_objects_2d.h:323
virtual Edge * create_edge(int index)
create the edge with index i and return it.
Definition: grid_objects_2d.h:339
Quadrilateral()
Definition: grid_objects_2d.h:331
virtual int container_section() const
Definition: grid_objects_2d.h:336
Quadrilateral(const QuadrilateralDescriptor &td)
Definition: grid_objects_2d.h:332
static bool type_match(GridObject *pObj)
Definition: grid_objects_2d.h:328
CustomQuadrilateral< Quadrilateral, Face, Triangle, Quadrilateral > BaseClass
Definition: grid_objects_2d.h:326
Quadrilateral(Vertex *v1, Vertex *v2, Vertex *v3, Vertex *v4)
Definition: grid_objects_2d.h:333
Edges connect two vertices.
Definition: grid_objects_1d.h:66
only used to initialize a triangle. for all other tasks you should use FaceDescriptor.
Definition: grid_objects_2d.h:78
uint num_vertices() const
Definition: grid_objects_2d.h:84
TriangleDescriptor()
Definition: grid_objects_2d.h:80
Vertex * vertex(size_t index) const
Definition: grid_objects_2d.h:86
void set_vertex(uint index, Vertex *v)
Definition: grid_objects_2d.h:85
the most simple form of a face
Definition: grid_objects_2d.h:174
virtual int container_section() const
Definition: grid_objects_2d.h:183
CustomTriangle< Triangle, Face, Triangle, Quadrilateral > BaseClass
Definition: grid_objects_2d.h:175
static bool type_match(GridObject *pObj)
Definition: grid_objects_2d.h:177
virtual Edge * create_edge(int index)
create the edge with index i and return it.
Definition: grid_objects_2d.h:186
Triangle(const TriangleDescriptor &td)
Definition: grid_objects_2d.h:180
Triangle(Vertex *v1, Vertex *v2, Vertex *v3)
Definition: grid_objects_2d.h:181
Triangle()
Definition: grid_objects_2d.h:179
Base-class for all vertex-types.
Definition: grid_base_objects.h:231
GenericGridObjectIterator< ConstrainedQuadrilateral *, FaceIterator > iterator
Definition: grid_objects_2d.h:529
ConstGenericGridObjectIterator< ConstrainedQuadrilateral *, FaceIterator, ConstFaceIterator > const_iterator
Definition: grid_objects_2d.h:532
QuadrilateralDescriptor Descriptor
Faces can't be created directly.
Definition: grid_objects_2d.h:534
Face grid_base_object
Definition: grid_objects_2d.h:535
ConstGenericGridObjectIterator< ConstrainedTriangle *, FaceIterator, ConstFaceIterator > const_iterator
Definition: grid_objects_2d.h:474
GenericGridObjectIterator< ConstrainedTriangle *, FaceIterator > iterator
Definition: grid_objects_2d.h:471
Face grid_base_object
Definition: grid_objects_2d.h:477
TriangleDescriptor Descriptor
Faces can't be created directly.
Definition: grid_objects_2d.h:476
GenericGridObjectIterator< ConstrainingQuadrilateral *, FaceIterator > iterator
Definition: grid_objects_2d.h:832
QuadrilateralDescriptor Descriptor
Faces can't be created directly.
Definition: grid_objects_2d.h:838
ConstGenericGridObjectIterator< ConstrainingQuadrilateral *, FaceIterator, ConstFaceIterator > const_iterator
Definition: grid_objects_2d.h:836
Face grid_base_object
Definition: grid_objects_2d.h:839
ConstGenericGridObjectIterator< ConstrainingTriangle *, FaceIterator, ConstFaceIterator > const_iterator
Definition: grid_objects_2d.h:766
TriangleDescriptor Descriptor
Faces can't be created directly.
Definition: grid_objects_2d.h:768
Face grid_base_object
Definition: grid_objects_2d.h:769
GenericGridObjectIterator< ConstrainingTriangle *, FaceIterator > iterator
Definition: grid_objects_2d.h:763
GenericGridObjectIterator< Quadrilateral *, FaceIterator > iterator
Definition: grid_objects_2d.h:350
ConstGenericGridObjectIterator< Quadrilateral *, FaceIterator, ConstFaceIterator > const_iterator
Definition: grid_objects_2d.h:353
Face grid_base_object
Definition: grid_objects_2d.h:356
QuadrilateralDescriptor Descriptor
Faces can't be created directly.
Definition: grid_objects_2d.h:355
Face grid_base_object
Definition: grid_objects_2d.h:201
TriangleDescriptor Descriptor
Faces can't be created directly.
Definition: grid_objects_2d.h:200
ConstGenericGridObjectIterator< Triangle *, FaceIterator, ConstFaceIterator > const_iterator
Definition: grid_objects_2d.h:198
GenericGridObjectIterator< Triangle *, FaceIterator > iterator
Definition: grid_objects_2d.h:196
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
unsigned int uint
Definition: types.h:114
const int NUM_VERTICES
Definition: hexahedron_rules.h:45
the ug namespace
geometry_traits< ConstrainingQuadrilateral >::iterator ConstrainingQuadrilateralIterator
Definition: grid_objects_2d.h:850
IndexLayout::Interface::iterator find(IndexLayout::Interface &interface, size_t i)
Definition: parallel_index_layout.h:77
geometry_traits< Quadrilateral >::iterator QuadrilateralIterator
Definition: grid_objects_2d.h:366
ReferenceObjectID
these ids are used to identify the shape of a geometric object.
Definition: grid_base_objects.h:74
@ ROID_QUADRILATERAL
Definition: grid_base_objects.h:79
@ ROID_TRIANGLE
Definition: grid_base_objects.h:78
geometry_traits< ConstrainedTriangle >::iterator ConstrainedTriangleIterator
Definition: grid_objects_2d.h:487
ElementStorage< Face >::SectionContainer::iterator FaceIterator
Definition: grid_base_object_traits.h:79
geometry_traits< ConstrainedQuadrilateral >::iterator ConstrainedQuadrilateralIterator
Definition: grid_objects_2d.h:545
ElementStorage< Face >::SectionContainer::const_iterator ConstFaceIterator
Definition: grid_base_object_traits.h:80
geometry_traits< Quadrilateral >::const_iterator ConstQuadrilateralIterator
Definition: grid_objects_2d.h:367
geometry_traits< ConstrainedQuadrilateral >::const_iterator ConstConstrainedQuadrilateralIterator
Definition: grid_objects_2d.h:546
geometry_traits< Triangle >::iterator TriangleIterator
Definition: grid_objects_2d.h:211
geometry_traits< ConstrainingQuadrilateral >::const_iterator ConstConstrainingQuadrilateralIterator
Definition: grid_objects_2d.h:852
@ FACE
Definition: grid_base_objects.h:62
FaceContainerSections
These numbers define where in the face-section-container a face will be stored.
Definition: grid_objects_2d.h:49
@ CSFACE_CONSTRAINING_QUADRILATERAL
Definition: grid_objects_2d.h:56
@ CSFACE_QUADRILATERAL
Definition: grid_objects_2d.h:52
@ CSFACE_NONE
Definition: grid_objects_2d.h:50
@ CSFACE_TRIANGLE
Definition: grid_objects_2d.h:51
@ CSFACE_USER
Definition: grid_objects_2d.h:58
@ CSFACE_CONSTRAINED_QUADRILATERAL
Definition: grid_objects_2d.h:54
@ CSFACE_CONSTRAINED_TRIANGLE
Definition: grid_objects_2d.h:53
@ CSFACE_CONSTRAINING_TRIANGLE
Definition: grid_objects_2d.h:55
geometry_traits< ConstrainingTriangle >::iterator ConstrainingTriangleIterator
Definition: grid_objects_2d.h:780
geometry_traits< ConstrainingTriangle >::const_iterator ConstConstrainingTriangleIterator
Definition: grid_objects_2d.h:782
geometry_traits< Triangle >::const_iterator ConstTriangleIterator
Definition: grid_objects_2d.h:212
geometry_traits< ConstrainedTriangle >::const_iterator ConstConstrainedTriangleIterator
Definition: grid_objects_2d.h:488