gmsh-TingyuanDoc  0.1
An Open-Source Timing-driven Analytical Mixed-size FPGA Placer
boundaryLayersData.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 BNDRYLRDATA
7 #define BNDRYLRDATA
8 
9 #include "SVector3.h"
10 #include "STensor3.h"
11 #include "MElement.h"
12 #include "MEdge.h"
13 #include "MFace.h"
14 #include <map>
15 #include <set>
16 
17 class GFace;
18 class GRegion;
19 class MTriangle;
20 class BoundaryLayerField;
21 
22 const int USEFANS__ = 1;
23 
26  std::vector<MVertex *> _column;
28  BoundaryLayerData(const SVector3 &dir, const std::vector<MVertex *> &column)
29  : _n(dir), _column(column)
30  {
31  }
32 };
33 
36  bool sense;
37  BoundaryLayerFan(MEdge e1, MEdge e2, bool s = true)
38  : _e1(e1), _e2(e2), sense(s)
39  {
40  }
41 };
42 
43 struct edgeColumn {
46  : _c1(c1), _c2(c2)
47  {
48  }
49 };
50 
52  std::map<MVertex *, BoundaryLayerFan> _fans;
53 
54 public:
55  // Element columns
56  std::map<MElement *, MElement *> _toFirst;
57  std::map<MElement *, std::vector<MElement *> > _elemColumns;
58  std::map<MFace, GFace *, MFaceLessThan> _inverse_classification;
59  std::multimap<MVertex *, BoundaryLayerData> _data;
60  size_t size() const { return _data.size(); }
61  typedef std::multimap<MVertex *, BoundaryLayerData>::iterator iter;
62  typedef std::map<MVertex *, BoundaryLayerFan>::iterator iterf;
63  std::multimap<MVertex *, MVertex *> _non_manifold_edges;
64  std::multimap<MEdge, SVector3, MEdgeLessThan> _normals;
65  void clearData()
66  {
67  _toFirst.clear();
68  _elemColumns.clear();
70  _data.clear();
71  _normals.clear();
72  _non_manifold_edges.clear();
73  _elemColumns.clear();
74  _fans.clear();
75  }
77  {
78  _toFirst.clear();
79  _elemColumns.clear();
80  }
81  iter begin() { return _data.begin(); }
82  iter end() { return _data.end(); }
83  iterf beginf() { return _fans.begin(); }
84  iterf endf() { return _fans.end(); }
86  inline void addColumn(const SVector3 &dir, MVertex *v,
87  const std::vector<MVertex *> &_column)
88  {
89  _data.insert(std::make_pair(v, BoundaryLayerData(dir, _column)));
90  }
91  inline void addFan(MVertex *v, MEdge e1, MEdge e2, bool s)
92  {
93  _fans.insert(std::make_pair(v, BoundaryLayerFan(e1, e2, s)));
94  }
95  inline const BoundaryLayerFan *getFan(MVertex *v) const
96  {
97  auto it = _fans.find(v);
98  if(it != _fans.end()) { return &it->second; }
99  return nullptr;
100  }
101  inline const BoundaryLayerData &getColumn(MVertex *v, MEdge e) const
102  {
103  auto it = _fans.find(v);
104  int N = getNbColumns(v);
105  if(N == 1) return getColumn(v, 0);
106  MEdgeEqual aaa;
107  if(it != _fans.end()) {
108  if(aaa(it->second._e1, e))
109  return getColumn(v, 0);
110  else
111  return getColumn(v, N - 1);
112  }
113  Msg::Error("Cannot handle embedded lines in boundary layers");
114  static BoundaryLayerData error;
115  return error;
116  }
117  edgeColumn getColumns(MVertex *v1, MVertex *v2, int side);
118  inline int getNbColumns(MVertex *v) const { return (int)_data.count(v); }
119  inline const BoundaryLayerData &getColumn(MVertex *v, int iColumn) const
120  {
121  int count = 0;
122  for(auto itm = _data.lower_bound(v); itm != _data.upper_bound(v); ++itm) {
123  if(count++ == iColumn) return itm->second;
124  }
125  static BoundaryLayerData error;
126  return error;
127  }
128 };
129 
133 void buildMeshMetric(GFace *gf, double *uv, SMetric3 &m, double metric[3]);
134 
135 #endif
edgeColumn::_c2
const BoundaryLayerData & _c2
Definition: boundaryLayersData.h:44
edgeColumn
Definition: boundaryLayersData.h:43
BoundaryLayerColumns::getColumns
edgeColumn getColumns(MVertex *v1, MVertex *v2, int side)
Definition: boundaryLayersData.cpp:23
BoundaryLayerColumns::getColumn
const BoundaryLayerData & getColumn(MVertex *v, MEdge e) const
Definition: boundaryLayersData.h:101
MEdge
Definition: MEdge.h:14
SMetric3
Definition: STensor3.h:17
BoundaryLayerColumns::_inverse_classification
std::map< MFace, GFace *, MFaceLessThan > _inverse_classification
Definition: boundaryLayersData.h:58
BoundaryLayerColumns::getColumn
const BoundaryLayerData & getColumn(MVertex *v, int iColumn) const
Definition: boundaryLayersData.h:119
BoundaryLayerColumns::iterf
std::map< MVertex *, BoundaryLayerFan >::iterator iterf
Definition: boundaryLayersData.h:62
GFace
Definition: GFace.h:33
MVertex
Definition: MVertex.h:24
Msg::Error
static void Error(const char *fmt,...)
Definition: GmshMessage.cpp:482
edgeColumn::_c1
const BoundaryLayerData & _c1
Definition: boundaryLayersData.h:44
BoundaryLayerColumns::endf
iterf endf()
Definition: boundaryLayersData.h:84
SVector3
Definition: SVector3.h:16
SVector3.h
BoundaryLayerColumns::size
size_t size() const
Definition: boundaryLayersData.h:60
BoundaryLayerColumns
Definition: boundaryLayersData.h:51
BoundaryLayerData::BoundaryLayerData
BoundaryLayerData(const SVector3 &dir, const std::vector< MVertex * > &column)
Definition: boundaryLayersData.h:28
BoundaryLayerColumns::_elemColumns
std::map< MElement *, std::vector< MElement * > > _elemColumns
Definition: boundaryLayersData.h:57
BoundaryLayerFan::sense
bool sense
Definition: boundaryLayersData.h:36
buildMeshMetric
void buildMeshMetric(GFace *gf, double *uv, SMetric3 &m, double metric[3])
BoundaryLayerColumns::addFan
void addFan(MVertex *v, MEdge e1, MEdge e2, bool s)
Definition: boundaryLayersData.h:91
BoundaryLayerColumns::_fans
std::map< MVertex *, BoundaryLayerFan > _fans
Definition: boundaryLayersData.h:52
BoundaryLayerFan::_e2
MEdge _e2
Definition: boundaryLayersData.h:35
BoundaryLayerColumns::BoundaryLayerColumns
BoundaryLayerColumns()
Definition: boundaryLayersData.h:85
edgeColumn::edgeColumn
edgeColumn(const BoundaryLayerData &c1, const BoundaryLayerData &c2)
Definition: boundaryLayersData.h:45
BoundaryLayerColumns::beginf
iterf beginf()
Definition: boundaryLayersData.h:83
BoundaryLayerColumns::end
iter end()
Definition: boundaryLayersData.h:82
MFace.h
BoundaryLayerColumns::_data
std::multimap< MVertex *, BoundaryLayerData > _data
Definition: boundaryLayersData.h:59
USEFANS__
const int USEFANS__
Definition: boundaryLayersData.h:22
BoundaryLayerData
Definition: boundaryLayersData.h:24
BoundaryLayerColumns::_normals
std::multimap< MEdge, SVector3, MEdgeLessThan > _normals
Definition: boundaryLayersData.h:64
BoundaryLayerData::_n
SVector3 _n
Definition: boundaryLayersData.h:25
GModel
Definition: GModel.h:44
BoundaryLayerFan::BoundaryLayerFan
BoundaryLayerFan(MEdge e1, MEdge e2, bool s=true)
Definition: boundaryLayersData.h:37
BoundaryLayerColumns::iter
std::multimap< MVertex *, BoundaryLayerData >::iterator iter
Definition: boundaryLayersData.h:61
BoundaryLayerField
Definition: Field.h:191
BoundaryLayerData::_column
std::vector< MVertex * > _column
Definition: boundaryLayersData.h:26
GRegion
Definition: GRegion.h:28
BoundaryLayerColumns::getNbColumns
int getNbColumns(MVertex *v) const
Definition: boundaryLayersData.h:118
MTriangle
Definition: MTriangle.h:26
BoundaryLayerColumns::getFan
const BoundaryLayerFan * getFan(MVertex *v) const
Definition: boundaryLayersData.h:95
BoundaryLayerColumns::_toFirst
std::map< MElement *, MElement * > _toFirst
Definition: boundaryLayersData.h:56
MEdge.h
BoundaryLayerColumns::_non_manifold_edges
std::multimap< MVertex *, MVertex * > _non_manifold_edges
Definition: boundaryLayersData.h:63
BoundaryLayerColumns::addColumn
void addColumn(const SVector3 &dir, MVertex *v, const std::vector< MVertex * > &_column)
Definition: boundaryLayersData.h:86
BoundaryLayerData::BoundaryLayerData
BoundaryLayerData()
Definition: boundaryLayersData.h:27
buildAdditionalPoints2D
bool buildAdditionalPoints2D(GFace *gf)
Definition: boundaryLayersData.cpp:19
MElement.h
STensor3.h
BoundaryLayerColumns::clearElementData
void clearElementData()
Definition: boundaryLayersData.h:76
MEdgeEqual
Definition: MEdge.h:118
getBLField
BoundaryLayerField * getBLField(GModel *gm)
Definition: boundaryLayersData.cpp:17
BoundaryLayerColumns::begin
iter begin()
Definition: boundaryLayersData.h:81
BoundaryLayerColumns::clearData
void clearData()
Definition: boundaryLayersData.h:65
buildAdditionalPoints3D
bool buildAdditionalPoints3D(GRegion *gr)
Definition: boundaryLayersData.cpp:21
c1
const double c1
Definition: GaussQuadratureHex.cpp:16
BoundaryLayerFan
Definition: boundaryLayersData.h:34
BoundaryLayerFan::_e1
MEdge _e1
Definition: boundaryLayersData.h:35