NEMoSys  0.63.0
A modular, extensible resource with robust automated mesh generation, mesh quality analysis, adaptive mesh refinement, and data transfer between arbitrary meshes.
NEM::NUCMESH Namespace Reference

Classes

class  Circles
 A set of concentric circles and the faces they enclose. More...
 
class  CirclesAndPolys
 A set of concentric circles and polygons and the faces they enclose. More...
 
class  CopyOverrideShapeData
 CRTP pattern to implement NEM::GEO::ShapeData::updateModified by copying. More...
 
class  EdgeSegments
 Class to describe meshing an edge by StdMeshers_NumberOfSegments. More...
 
class  GroupData
 Class to hold the material/physical group of a geometry. More...
 
class  HexagonalArray
 
class  NucMeshGeo
 
class  NucMeshShapeData
 
class  PolarArray
 Arrange a series of other ShapeBase objects along a circular arc. More...
 
struct  PolyRing
 
class  QuadMeshSurface
 Structured quad mesh (assuming edges meshed appropriately) or quad-dominant mesh. More...
 
class  RectangularArray
 
struct  Ring
 
struct  RingMeshOption
 
class  ShapeBase
 Abstract base class for types that create NEM::GEO::GeoManager. More...
 
class  ShapesArray
 Abstract base class representing a set of other ShapeBase objects, with a transformation applied to each. More...
 
class  SideSetEdge
 
class  TriMeshSurface
 Apply a tri mesh to a face. More...
 

Functions

template<typename RingT , typename FVertCirc >
NEM::GEO::GeoManager drawNested (int numSides, const std::vector< RingT > &rings, const std::array< double, 3 > &center, FVertCirc funcVertsCircEdges)
 

Function Documentation

◆ drawNested()

template<typename RingT , typename FVertCirc >
NEM::GEO::GeoManager NEM::NUCMESH::drawNested ( int  numSides,
const std::vector< RingT > &  rings,
const std::array< double, 3 > &  center,
FVertCirc  funcVertsCircEdges 
)

Definition at line 172 of file CirclesAndPolys.C.

References NEM::NUCMESH::RingMeshOption::QUAD, NEM::NUCMESH::RingMeshOption::STRUCT, and NEM::NUCMESH::RingMeshOption::TRI.

Referenced by NEM::NUCMESH::CirclesAndPolys::createGeo(), and NEM::NUCMESH::Circles::createGeo().

174  {
175  NEM::GEO::GeoManager output{2};
176  if (rings.empty()) { return output; }
177 
178  TopoDS_Vertex centerVert{BRepBuilderAPI_MakeVertex{coords2Point(center)}};
179 
180  std::vector<std::vector<TopoDS_Vertex>> vertices{}; // along the rings
181  vertices.reserve(rings.size());
182  std::vector<std::vector<TopoDS_Edge>> circumferentialEdges{};
183  circumferentialEdges.reserve(rings.size());
184  for (const auto &ring : rings) {
185  auto vertsAndEdges = funcVertsCircEdges(ring);
186  vertices.emplace_back(std::move(vertsAndEdges.first));
187  circumferentialEdges.emplace_back(std::move(vertsAndEdges.second));
188  }
189 
190  std::vector<std::vector<TopoDS_Edge>> radialEdges{};
191  radialEdges.reserve(rings.size());
192  std::vector<std::vector<TopoDS_Face>> faces{};
193  faces.reserve(rings.size());
194  {
195  auto prevVerts = vertices.begin();
196  auto iterVerts = rings.size() >= 2 ? prevVerts + 1 : vertices.end();
197  auto prevCircEdges = circumferentialEdges.begin();
198  auto iterCircEdges =
199  rings.size() >= 2 ? prevCircEdges + 1 : circumferentialEdges.end();
200  {
201  radialEdges.emplace_back();
202  faces.emplace_back();
203  auto &innerEdges = circumferentialEdges[0];
204  BRepBuilderAPI_MakeWire wireBuilder{};
205  for (const auto &edge : innerEdges) { wireBuilder.Add(edge); }
206  faces.back().emplace_back(BRepBuilderAPI_MakeFace{wireBuilder});
207  }
208  for (; iterVerts != vertices.end();
209  ++prevVerts, ++iterVerts, ++prevCircEdges, ++iterCircEdges) {
210  radialEdges.emplace_back(getRadialEdges(*prevVerts, *iterVerts));
211  faces.emplace_back(
212  getFaces(*prevCircEdges, *iterCircEdges, radialEdges.back()));
213  }
214  }
215 
216  {
217  { // innermost ring
218  switch (rings[0].meshType.meshingType) {
219  case RingMeshOption::MeshingType::STRUCT:
221  output.insertConstruct<QuadMeshSurface>(faces[0][0],
222  rings[0].material);
223  break;
224  case RingMeshOption::MeshingType::TRI:
225  default:
226  output.insertConstruct<TriMeshSurface>(faces[0][0],
227  rings[0].material);
228  break;
229  }
230  if (!rings[0].sideset.empty()) {
231  auto &ssetName = rings[0].sideset;
232  for (int i = 0; i < numSides; ++i) {
233  output.insertConstruct<SideSetEdge>(circumferentialEdges[0][i],
234  ssetName);
235  }
236  }
237  }
238  auto prevCircEdges = circumferentialEdges.begin();
239  auto iterCircEdges =
240  rings.size() >= 2 ? prevCircEdges + 1 : circumferentialEdges.end();
241  auto iterRadialEdges = radialEdges.begin() + 1;
242  auto iterFaces = faces.begin() + 1;
243  auto prevRing = rings.begin();
244  auto iterRing = rings.size() >= 2 ? prevRing + 1 : rings.end();
245  for (; iterRing != rings.end(); prevCircEdges = iterCircEdges,
246  ++iterCircEdges, ++iterRadialEdges,
247  ++iterFaces, ++iterRing, ++prevRing) {
248  auto &meshingParams = iterRing->meshType;
249  auto meshingType = meshingParams.meshingType;
250  auto &prevMeshingParams = prevRing->meshType;
251  for (int i = 0; i < numSides; ++i) {
252  switch (meshingType) {
253  case RingMeshOption::MeshingType::STRUCT:
255  output.insertConstruct<QuadMeshSurface>(iterFaces->at(i),
256  iterRing->material);
257  break;
258  case RingMeshOption::MeshingType::TRI:
259  default:
260  output.insertConstruct<TriMeshSurface>(iterFaces->at(i),
261  iterRing->material);
262  }
263  }
264  if (meshingType == RingMeshOption::MeshingType::STRUCT) {
265  if (prevMeshingParams.meshingType ==
266  RingMeshOption::MeshingType::STRUCT &&
267  prevMeshingParams.numSegments[1] != meshingParams.numSegments[1]) {
268  std::cerr << "Different number of nodes in circumferential direction "
269  "in adjacent rings may cause mesh errors.\n";
270  }
271  for (int i = 0; i < numSides; ++i) {
272  // If previous ring is NOT struct mesh, ensure
273  if (prevMeshingParams.meshingType !=
274  RingMeshOption::MeshingType::STRUCT) {
275  // In case added to map previously, override it
276  output.getMap()[prevCircEdges->at(i)].reset(new EdgeSegments{
277  prevRing->sideset, meshingParams.numSegments[1]});
278  }
279  output.insertConstruct<EdgeSegments>(iterCircEdges->at(i),
280  iterRing->sideset,
281  meshingParams.numSegments[1]);
282  output.insertConstruct<EdgeSegments>(iterRadialEdges->at(i), "",
283  meshingParams.numSegments[0]);
284  }
285  } else {
286  if (!iterRing->sideset.empty()) {
287  auto &ssetName = iterRing->sideset;
288  for (int i = 0; i < numSides; ++i) {
289  output.insertConstruct<SideSetEdge>(iterCircEdges->at(i), ssetName);
290  }
291  }
292  }
293  }
294  }
295  return output;
296 }
Class to manage TopoDS_Shapes along with metadata.
Definition: GeoManager.H:61
QUAD
Definition: exoMesh.H:55