gmsh-TingyuanDoc  0.1
An Open-Source Timing-driven Analytical Mixed-size FPGA Placer
discreteVertex.cpp
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 #include <vector>
7 #include "GmshConfig.h"
8 #include "GmshMessage.h"
9 #include "discreteVertex.h"
10 #include "MPoint.h"
11 #include "GModelIO_GEO.h"
12 #include "Geo.h"
13 
14 discreteVertex::discreteVertex(GModel *m, int num, double x, double y, double z)
15  : GVertex(m, num)
16 {
17  _v = CreateVertex(num, x, y, z, 0, 0);
19 }
20 
22 {
23  // used for temporary discrete vertices, that should not lead to the creation
24  // of the corresponding entity in GEO internals
25 }
26 
28 
29 GPoint discreteVertex::point() const { return GPoint(x(), y(), z(), this); }
30 
32 {
33  if(_v) {
34  _v->Pos.X = p.x();
35  _v->Pos.Y = p.y();
36  _v->Pos.Z = p.z();
37  }
38  if(mesh_vertices.size()) {
39  mesh_vertices[0]->x() = p.x();
40  mesh_vertices[0]->y() = p.y();
41  mesh_vertices[0]->z() = p.z();
42  }
43 }
44 
45 double discreteVertex::x() const
46 {
47  if(mesh_vertices.size()) return mesh_vertices[0]->x();
48  if(_v) return _v->Pos.X;
49  Msg::Warning("No coordinate in discrete point %d", tag());
50  return 0.;
51 }
52 
53 double discreteVertex::y() const
54 {
55  if(mesh_vertices.size()) return mesh_vertices[0]->y();
56  if(_v) return _v->Pos.Y;
57  Msg::Warning("No coordinate in discrete point %d", tag());
58  return 0.;
59 }
60 
61 double discreteVertex::z() const
62 {
63  if(mesh_vertices.size()) return mesh_vertices[0]->z();
64  if(_v) return _v->Pos.Z;
65  Msg::Warning("No coordinate in discrete point %d", tag());
66  return 0.;
67 }
Geo.h
GPoint::y
double y() const
Definition: GPoint.h:22
discreteVertex::discreteVertex
discreteVertex(GModel *m, int num, double x=0., double y=0., double z=0.)
Definition: discreteVertex.cpp:14
Msg::Warning
static void Warning(const char *fmt,...)
Definition: GmshMessage.cpp:543
discreteVertex::x
virtual double x() const
Definition: discreteVertex.cpp:45
GModelIO_GEO.h
discreteVertex::point
virtual GPoint point() const
Definition: discreteVertex.cpp:29
MPoint.h
CreateVertex
Vertex * CreateVertex(int Num, double X, double Y, double Z, double lc, double u)
Definition: Geo.cpp:106
discreteVertex::~discreteVertex
virtual ~discreteVertex()
Definition: discreteVertex.cpp:27
GmshMessage.h
discreteVertex::y
virtual double y() const
Definition: discreteVertex.cpp:53
GPoint
Definition: GPoint.h:13
discreteVertex.h
GPoint::z
double z() const
Definition: GPoint.h:23
discreteVertex::setPosition
virtual void setPosition(GPoint &p)
Definition: discreteVertex.cpp:31
GEO_Internals::Points
Tree_T * Points
Definition: GModelIO_GEO.h:18
GEntity::mesh_vertices
std::vector< MVertex * > mesh_vertices
Definition: GEntity.h:56
discreteVertex::_v
Vertex * _v
Definition: discreteVertex.h:17
GVertex
Definition: GVertex.h:23
Tree_Add
void * Tree_Add(Tree_T *tree, void *data)
Definition: TreeUtils.cpp:37
GModel
Definition: GModel.h:44
GEntity::tag
int tag() const
Definition: GEntity.h:280
discreteVertex::z
virtual double z() const
Definition: discreteVertex.cpp:61
Coord::X
double X
Definition: Geo.h:26
z
const double z
Definition: GaussQuadratureQuad.cpp:56
Coord::Z
double Z
Definition: Geo.h:26
Coord::Y
double Y
Definition: Geo.h:26
Vertex::Pos
Coord Pos
Definition: Geo.h:34
GModel::getGEOInternals
GEO_Internals * getGEOInternals()
Definition: GModel.h:315
GPoint::x
double x() const
Definition: GPoint.h:21