gmsh-TingyuanDoc  0.1
An Open-Source Timing-driven Analytical Mixed-size FPGA Placer
GVertex.h
Go to the documentation of this file.
1 // Gmsh - Copyright (C) 1997-2022 C. Geuzaine, J.-F. Remacle
2 //
3 // See the LICENSE.txt file in the Gmsh root directory for license information.
4 // Please report all issues on https://gitlab.onelab.info/gmsh/gmsh/issues.
5 
6 #ifndef GVERTEX_H
7 #define GVERTEX_H
8 
9 #include <list>
10 #include <string>
11 #include <vector>
12 #include <stdio.h>
13 #include "GmshDefines.h"
14 #include "GEntity.h"
15 #include "GPoint.h"
16 #include "SPoint2.h"
17 #include "SPoint3.h"
18 
19 class MElement;
20 class MPoint;
21 
22 // A model vertex.
23 class GVertex : public GEntity {
24 protected:
25  std::vector<GEdge *> l_edges;
26  double meshSize;
27 
28 public:
29  GVertex(GModel *m, int tag, double ms = MAX_LC);
30  virtual ~GVertex();
31 
32  // delete mesh data
33  virtual void deleteMesh();
34 
35  // reset the mesh attributes to default values
36  virtual void resetMeshAttributes();
37 
38  // get/set the coordinates of the vertex
39  virtual GPoint point() const = 0;
40  virtual double x() const = 0;
41  virtual double y() const = 0;
42  virtual double z() const = 0;
43  virtual SPoint3 xyz() const { return SPoint3(x(), y(), z()); }
44  virtual void setPosition(GPoint &p);
45 
46  // add/delete an edge bounded by this vertex
47  void addEdge(GEdge *e);
48  void delEdge(GEdge *e);
49 
50  // regions that bound this entity or that this entity bounds.
51  virtual std::list<GRegion *> regions() const;
52 
53  // get the edges that this vertex bounds
54  virtual std::vector<GEdge *> const &edges() const { return l_edges; }
55 
56  // get number of edges
57  virtual std::size_t numEdges() const { return l_edges.size(); }
58 
59  // faces that bound this entity or that this entity bounds.
60  virtual std::vector<GFace *> faces() const;
61 
62  // get the dimension of the vertex (0)
63  virtual int dim() const { return 0; }
64 
65  // returns the parent entity for partitioned entities
66  virtual GEntity *getParentEntity() { return nullptr; }
67 
68  // is this entity an orphan?
69  virtual bool isOrphan();
70 
71  // get the geometric type of the vertex
72  virtual GeomType geomType() const { return Point; }
73 
74  // get/set the prescribed mesh size at the vertex
75  virtual inline double prescribedMeshSizeAtVertex() const { return meshSize; }
76  virtual void setPrescribedMeshSizeAtVertex(double l) { meshSize = l; }
77 
78  // get the bounding box
79  virtual SBoundingBox3d bounds(bool fast = false)
80  {
81  return SBoundingBox3d(SPoint3(x(), y(), z()));
82  }
83 
84  // reparmaterize the point onto the given face
85  virtual SPoint2 reparamOnFace(const GFace *gf, int) const;
86 
87  // return a type-specific additional information string
88  virtual std::string getAdditionalInfoString(bool multline = false);
89 
90  // export in GEO format
91  virtual void writeGEO(FILE *fp, const std::string &meshSizeParameter = "");
92 
93  // export in Python
94  virtual void writePY(FILE *fp, const std::string &meshSizeParameter = "");
95 
96  // types of elements
97  virtual void getElementTypes(std::vector<int> &types) const
98  {
99  types.clear();
100  types.push_back(TYPE_PNT);
101  };
102 
103  // get number of elements in the mesh
104  std::size_t getNumMeshElements() const { return points.size(); }
105  std::size_t getNumMeshElementsByType(const int familyType) const;
106  void getNumMeshElements(unsigned *const c) const;
107 
108  // get the element at the given index
109  MElement *getMeshElement(std::size_t index) const;
110  // get the element at the given index for a given familyType
111  MElement *getMeshElementByType(const int familyType,
112  const std::size_t index) const;
113 
114  // return true if this vertex is on a seam of the given face
115  bool isOnSeam(const GFace *gf) const;
116 
117  // relocate mesh vertex using GVertex coordinates
118  void relocateMeshVertices();
119 
120  std::vector<MPoint *> points;
121 
122  void addPoint(MPoint *p) { points.push_back(p); }
123  void addElement(int type, MElement *e);
124  void removeElement(int type, MElement *e);
125  void removeElements(int type);
126 
127  virtual bool reorder(const int elementType,
128  const std::vector<std::size_t> &ordering);
129 };
130 
131 #endif
GVertex::addEdge
void addEdge(GEdge *e)
Definition: GVertex.cpp:37
GVertex::z
virtual double z() const =0
GVertex::setPosition
virtual void setPosition(GPoint &p)
Definition: GVertex.cpp:32
GFace
Definition: GFace.h:33
GVertex::writeGEO
virtual void writeGEO(FILE *fp, const std::string &meshSizeParameter="")
Definition: GVertex.cpp:86
SPoint2
Definition: SPoint2.h:12
GVertex::resetMeshAttributes
virtual void resetMeshAttributes()
Definition: GVertex.cpp:30
GVertex::isOnSeam
bool isOnSeam(const GFace *gf) const
Definition: GVertex.cpp:138
GEntity.h
c
static double c(int i, int j, fullMatrix< double > &CA, const std::vector< SPoint3 > &P, const std::vector< SPoint3 > &Q)
Definition: discreteFrechetDistance.cpp:15
GVertex::getNumMeshElementsByType
std::size_t getNumMeshElementsByType(const int familyType) const
Definition: GVertex.cpp:112
GVertex::~GVertex
virtual ~GVertex()
Definition: GVertex.cpp:18
SPoint3
Definition: SPoint3.h:14
TYPE_PNT
#define TYPE_PNT
Definition: GmshDefines.h:64
GVertex::addElement
void addElement(int type, MElement *e)
Definition: GVertex.cpp:196
GVertex::reorder
virtual bool reorder(const int elementType, const std::vector< std::size_t > &ordering)
Definition: GVertex.cpp:227
GVertex::edges
virtual std::vector< GEdge * > const & edges() const
Definition: GVertex.h:54
GVertex::numEdges
virtual std::size_t numEdges() const
Definition: GVertex.h:57
GVertex::addPoint
void addPoint(MPoint *p)
Definition: GVertex.h:122
GVertex::removeElement
void removeElement(int type, MElement *e)
Definition: GVertex.cpp:205
GVertex::getMeshElementByType
MElement * getMeshElementByType(const int familyType, const std::size_t index) const
Definition: GVertex.cpp:130
GVertex::faces
virtual std::vector< GFace * > faces() const
Definition: GVertex.cpp:147
GVertex::regions
virtual std::list< GRegion * > regions() const
Definition: GVertex.cpp:162
MAX_LC
#define MAX_LC
Definition: GEntity.h:19
GEntity
Definition: GEntity.h:31
GPoint
Definition: GPoint.h:13
GVertex::bounds
virtual SBoundingBox3d bounds(bool fast=false)
Definition: GVertex.h:79
GVertex::writePY
virtual void writePY(FILE *fp, const std::string &meshSizeParameter="")
Definition: GVertex.cpp:98
GVertex::points
std::vector< MPoint * > points
Definition: GVertex.h:120
GVertex::deleteMesh
virtual void deleteMesh()
Definition: GVertex.cpp:20
GVertex::getMeshElement
MElement * getMeshElement(std::size_t index) const
Definition: GVertex.cpp:124
GVertex
Definition: GVertex.h:23
GVertex::prescribedMeshSizeAtVertex
virtual double prescribedMeshSizeAtVertex() const
Definition: GVertex.h:75
GModel
Definition: GModel.h:44
GVertex::getNumMeshElements
std::size_t getNumMeshElements() const
Definition: GVertex.h:104
GVertex::getElementTypes
virtual void getElementTypes(std::vector< int > &types) const
Definition: GVertex.h:97
GVertex::relocateMeshVertices
void relocateMeshVertices()
Definition: GVertex.cpp:186
GmshDefines.h
GVertex::isOrphan
virtual bool isOrphan()
Definition: GVertex.cpp:175
MElement
Definition: MElement.h:30
GEntity::tag
int tag() const
Definition: GEntity.h:280
GVertex::l_edges
std::vector< GEdge * > l_edges
Definition: GVertex.h:25
GVertex::geomType
virtual GeomType geomType() const
Definition: GVertex.h:72
GVertex::meshSize
double meshSize
Definition: GVertex.h:26
GVertex::getAdditionalInfoString
virtual std::string getAdditionalInfoString(bool multline=false)
Definition: GVertex.cpp:54
GEntity::GeomType
GeomType
Definition: GEntity.h:88
GVertex::x
virtual double x() const =0
GVertex::y
virtual double y() const =0
GVertex::getParentEntity
virtual GEntity * getParentEntity()
Definition: GVertex.h:66
GEntity::Point
@ Point
Definition: GEntity.h:90
GVertex::xyz
virtual SPoint3 xyz() const
Definition: GVertex.h:43
GVertex::delEdge
void delEdge(GEdge *e)
Definition: GVertex.cpp:43
MPoint
Definition: MPoint.h:16
GEdge
Definition: GEdge.h:26
GPoint.h
GVertex::reparamOnFace
virtual SPoint2 reparamOnFace(const GFace *gf, int) const
Definition: GVertex.cpp:49
GVertex::point
virtual GPoint point() const =0
GVertex::setPrescribedMeshSizeAtVertex
virtual void setPrescribedMeshSizeAtVertex(double l)
Definition: GVertex.h:76
SPoint3.h
GVertex::removeElements
void removeElements(int type)
Definition: GVertex.cpp:218
SBoundingBox3d
Definition: SBoundingBox3d.h:21
GVertex::dim
virtual int dim() const
Definition: GVertex.h:63
GVertex::GVertex
GVertex(GModel *m, int tag, double ms=MAX_LC)
Definition: GVertex.cpp:14
SPoint2.h