gmsh-TingyuanDoc  0.1
An Open-Source Timing-driven Analytical Mixed-size FPGA Placer
GModelIO_GEO.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 GMODELIO_GEO_H
7 #define GMODELIO_GEO_H
8 
9 class GModel;
10 class ExtrudeParams;
11 class gmshSurface;
12 class List_T;
13 class Tree_T;
14 
16 public:
17  // this will become private
21 
22 private:
23  std::multimap<int, std::vector<int> > _meshCompounds;
26  void _allocateAll();
27  void _freeAll();
28  bool _changed;
29  bool _transform(int mode, const std::vector<std::pair<int, int> > &dimTags,
30  double x, double y, double z, double dx, double dy, double dz,
31  double a, double b, double c, double d);
32  bool _extrude(int mode, const std::vector<std::pair<int, int> > &inDimTags,
33  double x, double y, double z, double dx, double dy, double dz,
34  double ax, double ay, double az, double angle,
35  std::vector<std::pair<int, int> > &outDimTags,
36  ExtrudeParams *e = 0);
37  bool _addCompoundSpline(int &tag, const std::vector<int> &curveTags,
38  int numPoints, bool bspline);
39 
40 public:
43  void destroy()
44  {
45  _freeAll();
46  _allocateAll();
47  }
48 
49  // have the internals changed since the last synchronisation?
50  bool getChanged() const { return _changed; }
51 
52  // set/get max tag of entity for each dimension (0, 1, 2, 3), as well as
53  // -2 for shells and -1 for wires
54  void setMaxTag(int dim, int val);
55  int getMaxTag(int dim) const;
56 
57  // add shapes (if tag is < 0, a new tag is automatically created and returned)
58  bool addVertex(int &tag, double x, double y, double z, double lc);
59  bool addVertex(int &tag, double x, double y, gmshSurface *s, double lc);
60  bool addLine(int &tag, int startTag, int endTag);
61  bool addLine(int &tag, const std::vector<int> &pointTags);
62  bool addCircleArc(int &tag, int startTag, int centerTag, int endTag,
63  double nx = 0., double ny = 0., double nz = 0.);
64  bool addEllipseArc(int &tag, int startTag, int centerTag, int majorTag,
65  int endTag, double nx = 0., double ny = 0.,
66  double nz = 0.);
67  bool addSpline(int &tag, const std::vector<int> &pointTags);
68  bool addBezier(int &tag, const std::vector<int> &pointTags);
69  bool addBSpline(int &tag, const std::vector<int> &pointTags,
70  const std::vector<double> &seqknots = std::vector<double>());
71  bool addCompoundSpline(int &tag, const std::vector<int> &curveTags,
72  int numPoints);
73  bool addCompoundBSpline(int &tag, const std::vector<int> &curveTags,
74  int numPoints);
75  bool addCurveLoop(int &tag, const std::vector<int> &curveTags,
76  bool reorient = false);
77  bool addCurveLoops(const std::vector<int> &curveTags,
78  std::vector<int> &curveLoopTags);
79  bool addPlaneSurface(int &tag, const std::vector<int> &wireTags);
80  bool addDiscreteSurface(int &tag);
81  bool addSurfaceFilling(int &tag, const std::vector<int> &wireTags,
82  int sphereCenterTag = -1);
83  bool addSurfaceLoop(int &tag, const std::vector<int> &surfaceTags);
84  bool addVolume(int &tag, const std::vector<int> &shellTags);
85 
86  // extrude and revolve
87  bool extrude(const std::vector<std::pair<int, int> > &inDimTags, double dx,
88  double dy, double dz,
89  std::vector<std::pair<int, int> > &outDimTags,
90  ExtrudeParams *e = 0);
91  bool revolve(const std::vector<std::pair<int, int> > &inDimTags, double x,
92  double y, double z, double ax, double ay, double az,
93  double angle, std::vector<std::pair<int, int> > &outDimTags,
94  ExtrudeParams *e = 0);
95  bool twist(const std::vector<std::pair<int, int> > &inDimTags, double x,
96  double y, double z, double dx, double dy, double dz, double ax,
97  double ay, double az, double angle,
98  std::vector<std::pair<int, int> > &outDimTags,
99  ExtrudeParams *e = 0);
100  bool boundaryLayer(const std::vector<std::pair<int, int> > &inDimTags,
101  std::vector<std::pair<int, int> > &outDimTags,
102  ExtrudeParams *e = 0);
103 
104  // apply transformations
105  bool translate(const std::vector<std::pair<int, int> > &dimTags, double dx,
106  double dy, double dz);
107  bool rotate(const std::vector<std::pair<int, int> > &dimTags, double x,
108  double y, double z, double ax, double ay, double az,
109  double angle);
110  bool dilate(const std::vector<std::pair<int, int> > &dimTags, double x,
111  double y, double z, double a, double b, double c);
112  bool symmetry(const std::vector<std::pair<int, int> > &dimTags, double a,
113  double b, double c, double d);
114 
115  // split entities
116  bool splitCurve(int tag, const std::vector<int> &pointTags,
117  std::vector<int> &curveTags);
118  bool intersectCurvesWithSurface(const std::vector<int> &curveTags,
119  int surfaceTag, std::vector<int> &pointTags);
120 
121  // copy and remove
122  bool copy(const std::vector<std::pair<int, int> > &inDimTags,
123  std::vector<std::pair<int, int> > &outDimTags);
124  bool remove(int dim, int tag, bool recursive = false);
125  bool remove(const std::vector<std::pair<int, int> > &dimTags,
126  bool recursive = false);
127 
128  // manipulate physical groups
129  void resetPhysicalGroups();
130  bool modifyPhysicalGroup(int dim, int tag, int op,
131  const std::vector<int> &tags);
132  int getMaxPhysicalTag() const { return _maxPhysicalNum; }
133  void setMaxPhysicalTag(int val) { _maxPhysicalNum = val; }
134 
135  // coherence
136  void removeAllDuplicates();
137  bool mergeVertices(const std::vector<int> &tags);
138 
139  // set meshing constraints
140  void setCompoundMesh(int dim, const std::vector<int> &tags);
141  void setMeshSize(int dim, int tag, double size);
142  void setDegenerated(int dim, int tag);
143  void setTransfiniteLine(int tag, int nPoints, int type, double coef);
144  void setTransfiniteSurface(int tag, int arrangement,
145  const std::vector<int> &cornerTags);
146  void setTransfiniteVolume(int tag, const std::vector<int> &cornerTags);
147  void setTransfiniteVolumeQuadTri(int tag);
148  void setRecombine(int dim, int tag, double angle);
149  void setSmoothing(int tag, int val);
150  void setReverseMesh(int dim, int tag, bool val = 1);
151  void setMeshAlgorithm(int dim, int tag, int val);
152  void setMeshSizeFromBoundary(int dim, int tag, int val);
153 
154  // synchronize internal CAD data with the given GModel
155  void synchronize(GModel *model, bool resetMeshAttributes = true);
156 
157  // queries
158  bool getVertex(int tag, double &x, double &y, double &z);
159 
160  // create coordinate systems
161  gmshSurface *newGeometrySphere(int tag, int centerTag, int pointTag);
162  gmshSurface *newGeometryPolarSphere(int tag, int centerTag, int pointTag);
163 };
164 
165 #endif
GEO_Internals::Curves
Tree_T * Curves
Definition: GModelIO_GEO.h:18
GEO_Internals::removeAllDuplicates
void removeAllDuplicates()
Definition: GModelIO_GEO.cpp:1077
GEO_Internals::PhysicalGroups
List_T * PhysicalGroups
Definition: GModelIO_GEO.h:20
tags
static std::map< SPoint2, unsigned int > tags
Definition: drawGraph2d.cpp:400
GEO_Internals::addBSpline
bool addBSpline(int &tag, const std::vector< int > &pointTags, const std::vector< double > &seqknots=std::vector< double >())
Definition: GModelIO_GEO.cpp:297
GEO_Internals::Volumes
Tree_T * Volumes
Definition: GModelIO_GEO.h:18
GEO_Internals::DelCurves
Tree_T * DelCurves
Definition: GModelIO_GEO.h:19
GEO_Internals::getMaxTag
int getMaxTag(int dim) const
Definition: GModelIO_GEO.cpp:99
GEO_Internals::boundaryLayer
bool boundaryLayer(const std::vector< std::pair< int, int > > &inDimTags, std::vector< std::pair< int, int > > &outDimTags, ExtrudeParams *e=0)
Definition: GModelIO_GEO.cpp:804
GEO_Internals::extrude
bool extrude(const std::vector< std::pair< int, int > > &inDimTags, double dx, double dy, double dz, std::vector< std::pair< int, int > > &outDimTags, ExtrudeParams *e=0)
Definition: GModelIO_GEO.cpp:774
GEO_Internals::~GEO_Internals
~GEO_Internals()
Definition: GModelIO_GEO.h:42
GEO_Internals::_maxPointNum
int _maxPointNum
Definition: GModelIO_GEO.h:24
GEO_Internals::SurfaceLoops
Tree_T * SurfaceLoops
Definition: GModelIO_GEO.h:18
GEO_Internals::rotate
bool rotate(const std::vector< std::pair< int, int > > &dimTags, double x, double y, double z, double ax, double ay, double az, double angle)
Definition: GModelIO_GEO.cpp:848
GEO_Internals::_maxPhysicalNum
int _maxPhysicalNum
Definition: GModelIO_GEO.h:25
GEO_Internals::setMaxTag
void setMaxTag(int dim, int val)
Definition: GModelIO_GEO.cpp:87
angle
double angle(const SVector3 &a, const SVector3 &b)
Definition: SVector3.h:157
GEO_Internals::setTransfiniteVolumeQuadTri
void setTransfiniteVolumeQuadTri(int tag)
Definition: GModelIO_GEO.cpp:1234
GEO_Internals::setTransfiniteLine
void setTransfiniteLine(int tag, int nPoints, int type, double coef)
Definition: GModelIO_GEO.cpp:1136
GEO_Internals::setMeshSizeFromBoundary
void setMeshSizeFromBoundary(int dim, int tag, int val)
Definition: GModelIO_GEO.cpp:1353
GEO_Internals::modifyPhysicalGroup
bool modifyPhysicalGroup(int dim, int tag, int op, const std::vector< int > &tags)
Definition: GModelIO_GEO.cpp:1000
GEO_Internals::setTransfiniteSurface
void setTransfiniteSurface(int tag, int arrangement, const std::vector< int > &cornerTags)
Definition: GModelIO_GEO.cpp:1163
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
GEO_Internals::_freeAll
void _freeAll()
Definition: GModelIO_GEO.cpp:52
GEO_Internals::addCompoundBSpline
bool addCompoundBSpline(int &tag, const std::vector< int > &curveTags, int numPoints)
Definition: GModelIO_GEO.cpp:394
GEO_Internals::setRecombine
void setRecombine(int dim, int tag, double angle)
Definition: GModelIO_GEO.cpp:1252
List_T
Definition: ListUtils.h:9
Tree_T
Definition: TreeUtils.h:12
GEO_Internals::DelPhysicalGroups
List_T * DelPhysicalGroups
Definition: GModelIO_GEO.h:20
GEO_Internals::addSurfaceFilling
bool addSurfaceFilling(int &tag, const std::vector< int > &wireTags, int sphereCenterTag=-1)
Definition: GModelIO_GEO.cpp:630
GEO_Internals::setMaxPhysicalTag
void setMaxPhysicalTag(int val)
Definition: GModelIO_GEO.h:133
GEO_Internals::DelSurfaces
Tree_T * DelSurfaces
Definition: GModelIO_GEO.h:19
GEO_Internals::addEllipseArc
bool addEllipseArc(int &tag, int startTag, int centerTag, int majorTag, int endTag, double nx=0., double ny=0., double nz=0.)
Definition: GModelIO_GEO.cpp:209
GEO_Internals::addLine
bool addLine(int &tag, int startTag, int endTag)
Definition: GModelIO_GEO.cpp:141
GEO_Internals::addVolume
bool addVolume(int &tag, const std::vector< int > &shellTags)
Definition: GModelIO_GEO.cpp:701
GEO_Internals::Points
Tree_T * Points
Definition: GModelIO_GEO.h:18
GEO_Internals::_maxLineNum
int _maxLineNum
Definition: GModelIO_GEO.h:24
GEO_Internals::addSpline
bool addSpline(int &tag, const std::vector< int > &pointTags)
Definition: GModelIO_GEO.cpp:245
gmshSurface
Definition: gmshSurface.h:22
GEO_Internals::Surfaces
Tree_T * Surfaces
Definition: GModelIO_GEO.h:18
GEO_Internals::addDiscreteSurface
bool addDiscreteSurface(int &tag)
Definition: GModelIO_GEO.cpp:617
GEO_Internals::DelPoints
Tree_T * DelPoints
Definition: GModelIO_GEO.h:19
GModel
Definition: GModel.h:44
GEO_Internals::DelVolumes
Tree_T * DelVolumes
Definition: GModelIO_GEO.h:19
GEO_Internals::_transform
bool _transform(int mode, const std::vector< std::pair< int, int > > &dimTags, double x, double y, double z, double dx, double dy, double dz, double a, double b, double c, double d)
Definition: GModelIO_GEO.cpp:812
GEO_Internals::symmetry
bool symmetry(const std::vector< std::pair< int, int > > &dimTags, double a, double b, double c, double d)
Definition: GModelIO_GEO.cpp:862
GEO_Internals::_changed
bool _changed
Definition: GModelIO_GEO.h:28
GEO_Internals::GEO_Internals
GEO_Internals()
Definition: GModelIO_GEO.h:41
GEO_Internals::splitCurve
bool splitCurve(int tag, const std::vector< int > &pointTags, std::vector< int > &curveTags)
Definition: GModelIO_GEO.cpp:868
GEO_Internals::setCompoundMesh
void setCompoundMesh(int dim, const std::vector< int > &tags)
Definition: GModelIO_GEO.cpp:1111
GEO_Internals::setDegenerated
void setDegenerated(int dim, int tag)
Definition: GModelIO_GEO.cpp:1128
GEO_Internals::setMeshAlgorithm
void setMeshAlgorithm(int dim, int tag, int val)
Definition: GModelIO_GEO.cpp:1344
GEO_Internals::getVertex
bool getVertex(int tag, double &x, double &y, double &z)
Definition: GModelIO_GEO.cpp:1616
GEO_Internals::getMaxPhysicalTag
int getMaxPhysicalTag() const
Definition: GModelIO_GEO.h:132
GEO_Internals::addVertex
bool addVertex(int &tag, double x, double y, double z, double lc)
Definition: GModelIO_GEO.cpp:112
GEO_Internals::_maxSurfaceLoopNum
int _maxSurfaceLoopNum
Definition: GModelIO_GEO.h:25
GEO_Internals::dilate
bool dilate(const std::vector< std::pair< int, int > > &dimTags, double x, double y, double z, double a, double b, double c)
Definition: GModelIO_GEO.cpp:855
GEO_Internals::_allocateAll
void _allocateAll()
Definition: GModelIO_GEO.cpp:29
GEO_Internals::newGeometrySphere
gmshSurface * newGeometrySphere(int tag, int centerTag, int pointTag)
Definition: GModelIO_GEO.cpp:1628
GEO_Internals::addCurveLoops
bool addCurveLoops(const std::vector< int > &curveTags, std::vector< int > &curveLoopTags)
Definition: GModelIO_GEO.cpp:529
GEO_Internals::destroy
void destroy()
Definition: GModelIO_GEO.h:43
GEO_Internals::getChanged
bool getChanged() const
Definition: GModelIO_GEO.h:50
GEO_Internals::_addCompoundSpline
bool _addCompoundSpline(int &tag, const std::vector< int > &curveTags, int numPoints, bool bspline)
Definition: GModelIO_GEO.cpp:336
GEO_Internals::translate
bool translate(const std::vector< std::pair< int, int > > &dimTags, double dx, double dy, double dz)
Definition: GModelIO_GEO.cpp:842
GEO_Internals::addCircleArc
bool addCircleArc(int &tag, int startTag, int centerTag, int endTag, double nx=0., double ny=0., double nz=0.)
Definition: GModelIO_GEO.cpp:175
GEO_Internals::intersectCurvesWithSurface
bool intersectCurvesWithSurface(const std::vector< int > &curveTags, int surfaceTag, std::vector< int > &pointTags)
Definition: GModelIO_GEO.cpp:889
GEO_Internals::mergeVertices
bool mergeVertices(const std::vector< int > &tags)
Definition: GModelIO_GEO.cpp:1083
GEO_Internals::setReverseMesh
void setReverseMesh(int dim, int tag, bool val=1)
Definition: GModelIO_GEO.cpp:1309
GEO_Internals::revolve
bool revolve(const std::vector< std::pair< int, int > > &inDimTags, double x, double y, double z, double ax, double ay, double az, double angle, std::vector< std::pair< int, int > > &outDimTags, ExtrudeParams *e=0)
Definition: GModelIO_GEO.cpp:783
z
const double z
Definition: GaussQuadratureQuad.cpp:56
GEO_Internals::copy
bool copy(const std::vector< std::pair< int, int > > &inDimTags, std::vector< std::pair< int, int > > &outDimTags)
Definition: GModelIO_GEO.cpp:913
GEO_Internals::twist
bool twist(const std::vector< std::pair< int, int > > &inDimTags, double x, double y, double z, double dx, double dy, double dz, double ax, double ay, double az, double angle, std::vector< std::pair< int, int > > &outDimTags, ExtrudeParams *e=0)
Definition: GModelIO_GEO.cpp:793
GEO_Internals::addCompoundSpline
bool addCompoundSpline(int &tag, const std::vector< int > &curveTags, int numPoints)
Definition: GModelIO_GEO.cpp:387
GEO_Internals::addPlaneSurface
bool addPlaneSurface(int &tag, const std::vector< int > &wireTags)
Definition: GModelIO_GEO.cpp:592
GEO_Internals::remove
bool remove(int dim, int tag, bool recursive=false)
Definition: GModelIO_GEO.cpp:969
GEO_Internals::setSmoothing
void setSmoothing(int tag, int val)
Definition: GModelIO_GEO.cpp:1291
GEO_Internals::addSurfaceLoop
bool addSurfaceLoop(int &tag, const std::vector< int > &surfaceTags)
Definition: GModelIO_GEO.cpp:680
GEO_Internals::setMeshSize
void setMeshSize(int dim, int tag, double size)
Definition: GModelIO_GEO.cpp:1117
GEO_Internals::_extrude
bool _extrude(int mode, const std::vector< std::pair< int, int > > &inDimTags, double x, double y, double z, double dx, double dy, double dz, double ax, double ay, double az, double angle, std::vector< std::pair< int, int > > &outDimTags, ExtrudeParams *e=0)
Definition: GModelIO_GEO.cpp:722
GEO_Internals::resetPhysicalGroups
void resetPhysicalGroups()
Definition: GModelIO_GEO.cpp:992
GEO_Internals::synchronize
void synchronize(GModel *model, bool resetMeshAttributes=true)
Definition: GModelIO_GEO.cpp:1370
GEO_Internals::EdgeLoops
Tree_T * EdgeLoops
Definition: GModelIO_GEO.h:18
GEO_Internals
Definition: GModelIO_GEO.h:15
ExtrudeParams
Definition: ExtrudeParams.h:26
GEO_Internals::_maxSurfaceNum
int _maxSurfaceNum
Definition: GModelIO_GEO.h:24
GEO_Internals::setTransfiniteVolume
void setTransfiniteVolume(int tag, const std::vector< int > &cornerTags)
Definition: GModelIO_GEO.cpp:1201
GEO_Internals::_maxVolumeNum
int _maxVolumeNum
Definition: GModelIO_GEO.h:25
GEO_Internals::newGeometryPolarSphere
gmshSurface * newGeometryPolarSphere(int tag, int centerTag, int pointTag)
Definition: GModelIO_GEO.cpp:1648
GEO_Internals::addCurveLoop
bool addCurveLoop(int &tag, const std::vector< int > &curveTags, bool reorient=false)
Definition: GModelIO_GEO.cpp:401
GEO_Internals::_meshCompounds
std::multimap< int, std::vector< int > > _meshCompounds
Definition: GModelIO_GEO.h:23
GEO_Internals::addBezier
bool addBezier(int &tag, const std::vector< int > &pointTags)
Definition: GModelIO_GEO.cpp:271
GEO_Internals::_maxLineLoopNum
int _maxLineLoopNum
Definition: GModelIO_GEO.h:24