gmsh-TingyuanDoc  0.1
An Open-Source Timing-driven Analytical Mixed-size FPGA Placer
meshOctreeLibOL.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 MESH_OCTREE_LIB_OL
7 #define MESH_OCTREE_LIB_OL
8 
9 #include <vector>
10 #include <array>
11 #include <string>
12 #include "GPoint.h"
13 #include "GFace.h"
14 
15 class MTriangle;
16 
25 public:
26  SurfaceProjector() : gf(NULL), OctIdx(0) {}
27  SurfaceProjector(GFace *gf); /* read triangles and quads from GFace */
31 
43  bool initialize(GFace *gf, const std::vector<MTriangle *> &triangles, bool useCADStl = false);
44 
48  void clear();
49 
59 
72  GPoint closestPoint(const double query[3], bool evalOnCAD = false,
73  bool projectOnCAD = false) const;
74 
75 public:
77 
78 protected:
79  std::vector<std::array<double, 3> > points;
80  std::vector<std::array<int32_t, 3> > triangles;
81  std::vector<std::array<std::array<double, 2>, 3> > triangle_uvs;
82  std::vector<bool> triangle_no_uv_eval; /* no eval. at param. singularity */
83  int64_t OctIdx; /* pointer to libOL octree (C structure) */
84 
85  /* For simple CAD shapes, we have analytical formula for projection */
86  bool useAnalyticalFormula = false;
87  GFace::GeomType analyticalShape = GFace::GeomType::Unknown;
88  std::array<double, 10> analyticalParameters;
89 };
90 
91 
92 
95 
96 class libOLwrapper {
97 
98  public:
100  const std::vector<std::array<double,3> >& points,
101  const std::vector<std::array<int32_t,2> >& edges,
102  const std::vector<std::array<int32_t,3> >& triangles,
103  const std::vector<std::array<int32_t,4> >& quads,
104  const std::vector<std::array<int32_t,4> >& tetrahedra,
105  const std::vector<std::array<int32_t,5> >& pyramids,
106  const std::vector<std::array<int32_t,6> >& prisms,
107  const std::vector<std::array<int32_t,8> >& hexahedra);
108 
109  ~libOLwrapper();
110 
111  int elementsInsideBoundingBox(libOLTypTag elementType,
112  double* bboxMin, double* bboxMax,
113  std::vector<int32_t>& elements);
114 
115  protected:
116  std::vector<std::array<double,3> > points;
117  std::vector<std::array<int32_t,2> > edges;
118  std::vector<std::array<int32_t,3> > triangles;
119  std::vector<std::array<int32_t,4> > quads;
120  std::vector<std::array<int32_t,4> > tetrahedra;
121  std::vector<std::array<int32_t,5> > pyramids;
122  std::vector<std::array<int32_t,6> > prisms;
123  std::vector<std::array<int32_t,8> > hexahedra;
124  int64_t OctIdx; /* pointer to libOL octree (C structure) */
125 
126 };
127 
128 #endif
libOLwrapper::OctIdx
int64_t OctIdx
Definition: meshOctreeLibOL.h:124
libOLTypTag::LolTypTet
@ LolTypTet
SurfaceProjector::setAnalyticalProjection
bool setAnalyticalProjection(GFace *gf)
The SurfaceProjector can project with an analytical formula instead of a triangulation and a octree S...
Definition: meshOctreeLibOL.cpp:343
GFace.h
SurfaceProjector::OctIdx
int64_t OctIdx
Definition: meshOctreeLibOL.h:83
SurfaceProjector::~SurfaceProjector
~SurfaceProjector()
Definition: meshOctreeLibOL.cpp:341
GFace
Definition: GFace.h:33
libOLwrapper::prisms
std::vector< std::array< int32_t, 6 > > prisms
Definition: meshOctreeLibOL.h:122
libOLwrapper::points
std::vector< std::array< double, 3 > > points
Definition: meshOctreeLibOL.h:116
SurfaceProjector::operator=
SurfaceProjector & operator=(SurfaceProjector const &)=delete
libOLwrapper::elementsInsideBoundingBox
int elementsInsideBoundingBox(libOLTypTag elementType, double *bboxMin, double *bboxMax, std::vector< int32_t > &elements)
Definition: meshOctreeLibOL.cpp:699
libOLwrapper::quads
std::vector< std::array< int32_t, 4 > > quads
Definition: meshOctreeLibOL.h:119
libOLwrapper::~libOLwrapper
~libOLwrapper()
Definition: meshOctreeLibOL.cpp:691
SurfaceProjector::initialize
bool initialize(GFace *gf, const std::vector< MTriangle * > &triangles, bool useCADStl=false)
Fill the triangles and uvs from the triangles, then build the octree. Overwrite existing triangulatio...
Definition: meshOctreeLibOL.cpp:364
SurfaceProjector
Class to project 3D points on a triangulated surface. If a parametrization is available,...
Definition: meshOctreeLibOL.h:24
GPoint
Definition: GPoint.h:13
SurfaceProjector::SurfaceProjector
SurfaceProjector()
Definition: meshOctreeLibOL.h:26
libOLTypTag::LolTypPyr
@ LolTypPyr
SurfaceProjector::gf
GFace * gf
Definition: meshOctreeLibOL.h:76
libOLwrapper::tetrahedra
std::vector< std::array< int32_t, 4 > > tetrahedra
Definition: meshOctreeLibOL.h:120
libOLwrapper
Definition: meshOctreeLibOL.h:96
libOLwrapper::edges
std::vector< std::array< int32_t, 2 > > edges
Definition: meshOctreeLibOL.h:117
SurfaceProjector::triangles
std::vector< std::array< int32_t, 3 > > triangles
Definition: meshOctreeLibOL.h:80
libOLwrapper::triangles
std::vector< std::array< int32_t, 3 > > triangles
Definition: meshOctreeLibOL.h:118
SurfaceProjector::SurfaceProjector
SurfaceProjector(SurfaceProjector const &)=delete
libOLTypTag::LolTypQad
@ LolTypQad
SurfaceProjector::closestPoint
GPoint closestPoint(const double query[3], bool evalOnCAD=false, bool projectOnCAD=false) const
Get the query closest point on the triangulated surface.
Definition: meshOctreeLibOL.cpp:567
SurfaceProjector::triangle_uvs
std::vector< std::array< std::array< double, 2 >, 3 > > triangle_uvs
Definition: meshOctreeLibOL.h:81
SurfaceProjector::clear
void clear()
Clear the triangulation and delete the octree.
Definition: meshOctreeLibOL.cpp:329
SurfaceProjector::analyticalShape
GFace::GeomType analyticalShape
Definition: meshOctreeLibOL.h:87
libOLTypTag::LolNmbTyp
@ LolNmbTyp
libOLTypTag::LolTypTri
@ LolTypTri
SurfaceProjector::points
std::vector< std::array< double, 3 > > points
Definition: meshOctreeLibOL.h:79
GEntity::GeomType
GeomType
Definition: GEntity.h:88
libOLTypTag::LolTypPri
@ LolTypPri
MTriangle
Definition: MTriangle.h:26
libOLTypTag::LolTypHex
@ LolTypHex
SurfaceProjector::analyticalParameters
std::array< double, 10 > analyticalParameters
Definition: meshOctreeLibOL.h:88
libOLTypTag::LolTypVer
@ LolTypVer
libOLwrapper::pyramids
std::vector< std::array< int32_t, 5 > > pyramids
Definition: meshOctreeLibOL.h:121
libOLTypTag
libOLTypTag
Definition: meshOctreeLibOL.h:93
SurfaceProjector::triangle_no_uv_eval
std::vector< bool > triangle_no_uv_eval
Definition: meshOctreeLibOL.h:82
libOLTypTag::LolTypEdg
@ LolTypEdg
GPoint.h
libOLwrapper::hexahedra
std::vector< std::array< int32_t, 8 > > hexahedra
Definition: meshOctreeLibOL.h:123
SurfaceProjector::useAnalyticalFormula
bool useAnalyticalFormula
Definition: meshOctreeLibOL.h:86
libOLwrapper::libOLwrapper
libOLwrapper(const std::vector< std::array< double, 3 > > &points, const std::vector< std::array< int32_t, 2 > > &edges, const std::vector< std::array< int32_t, 3 > > &triangles, const std::vector< std::array< int32_t, 4 > > &quads, const std::vector< std::array< int32_t, 4 > > &tetrahedra, const std::vector< std::array< int32_t, 5 > > &pyramids, const std::vector< std::array< int32_t, 6 > > &prisms, const std::vector< std::array< int32_t, 8 > > &hexahedra)
Definition: meshOctreeLibOL.cpp:653