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::Circles Class Reference

A set of concentric circles and the faces they enclose. More...

Detailed Description

Definition at line 77 of file CirclesAndPolys.H.

Public Member Functions

 Circles (std::vector< Ring > rings, const std::array< double, 3 > &center={0, 0, 0})
 Container to describe a set of concentric circles (note circles treated as two 180 degree arcs) More...
 
const std::vector< Ring > & getRings () const
 
void setRings (std::vector< Ring > rings)
 
void addRing (const Ring &ring)
 
const std::array< double, 3 > & getCenter () const
 
void setCenter (const std::array< double, 3 > &center)
 

Static Public Member Functions

static std::array< double, 3 > getRotatedPoint (const std::array< double, 3 > &center, const std::array< double, 2 > &rotation)
 

Protected Member Functions

NEM::GEO::GeoManager createGeo () const override
 Construct a NEM::GEO::GeoManager. More...
 

Static Protected Member Functions

static void mergeGeo (NEM::GEO::GeoManager &keepGeo, NEM::GEO::GeoManager &&removeGeo)
 Merge two 2d NEM::GEO::GeoManager objects by cutting shapes in removeGeo from shapes in keepGeo and sewing the resulting faces. More...
 

Private Attributes

std::vector< Ringrings_
 

Inherits NEM::NUCMESH::ShapeBase.

Constructor & Destructor Documentation

◆ Circles()

NEM::NUCMESH::Circles::Circles ( std::vector< Ring rings,
const std::array< double, 3 > &  center = {0, 0, 0} 
)
explicit
Parameters
ringsRadius and meshing description of each ring
centerCenter of shapes

Definition at line 307 of file CirclesAndPolys.C.

308  : ShapeBase(center), rings_(std::move(rings)) {}
std::vector< Ring > rings_
ShapeBase(const std::array< double, 3 > &center={0, 0, 0})
Definition: ShapeBase.C:56

Member Function Documentation

◆ addRing()

void NEM::NUCMESH::Circles::addRing ( const Ring ring)

Definition at line 316 of file CirclesAndPolys.C.

References rings_.

316 { this->rings_.emplace_back(ring); }
std::vector< Ring > rings_

◆ createGeo()

NEM::GEO::GeoManager NEM::NUCMESH::Circles::createGeo ( ) const
overrideprotectedvirtual
Returns
A NEM::GEO::GeoManager object representing the shape described by this object

Implements NEM::NUCMESH::ShapeBase.

Definition at line 318 of file CirclesAndPolys.C.

References NEM::NUCMESH::drawNested(), NEM::NUCMESH::ShapeBase::getCenter(), NEM::NUCMESH::Ring::radius, and rings_.

318  {
319  return drawNested(2, rings_, this->getCenter(), [this](const Ring &ring) {
320  return getRingVerticesAndCircEdges(this->getCenter(), 2, ring.radius, 0);
321  });
322 }
std::vector< Ring > rings_
NEM::GEO::GeoManager drawNested(int numSides, const std::vector< RingT > &rings, const std::array< double, 3 > &center, FVertCirc funcVertsCircEdges)
const std::array< double, 3 > & getCenter() const
Definition: ShapeBase.C:50

◆ getCenter()

const std::array< double, 3 > & NEM::NUCMESH::ShapeBase::getCenter ( ) const
inherited

◆ getRings()

const std::vector< Ring > & NEM::NUCMESH::Circles::getRings ( ) const

Definition at line 310 of file CirclesAndPolys.C.

References rings_.

310 { return rings_; }
std::vector< Ring > rings_

◆ getRotatedPoint()

std::array< double, 3 > NEM::NUCMESH::ShapeBase::getRotatedPoint ( const std::array< double, 3 > &  center,
const std::array< double, 2 > &  rotation 
)
staticinherited
Parameters
centerCenter of circle
rotation{Radius, angle in degrees}
Returns
Point on circle with center center and normal [0, 0, 1], radius rotation[0] and angle (in degrees) rotation[1]

Definition at line 58 of file ShapeBase.C.

Referenced by NEM::NUCMESH::PolarArray::createGeo(), and NEM::DRV::JSON::modify_helper().

60  {
61  auto angle = rotation[1] * M_PI / 180.;
62  return {center[0] + rotation[0] * std::cos(angle),
63  center[1] + rotation[0] * std::sin(angle), center[2]};
64 }

◆ mergeGeo()

void NEM::NUCMESH::ShapeBase::mergeGeo ( NEM::GEO::GeoManager keepGeo,
NEM::GEO::GeoManager &&  removeGeo 
)
staticprotectedinherited
Parameters
[in,out]keepGeoMerge geometry from removeGeo into this object
[in]removeGeoMove geometry and data from this object into keepGeo

Definition at line 66 of file ShapeBase.C.

References NEM::GEO::GeoManager::buildCompound(), NEM::GEO::GeoManager::deleteShapes(), NEM::GEO::GeoManager::getDim(), NEM::GEO::GeoManager::insert(), NEM::GEO::GeoManager::modify(), NEM::GEO::GeoManager::setDim(), and NEM::DRV::JSON::shapeType.

Referenced by NEM::NUCMESH::ShapesArray::createGeoImpl(), and NEM::SRV::NucMeshSrv::FillOutputPortInformation().

67  {
68  auto origCompound = keepGeo.buildCompound();
69  if (origCompound.IsNull()) {
70  keepGeo = std::move(removeGeo);
71  return;
72  } else {
73  auto newCompound = removeGeo.buildCompound();
74  TopoDS_ListOfShape newShapes;
75  static constexpr std::array<TopAbs_ShapeEnum, 4> shapeTypes{
76  TopAbs_SOLID, TopAbs_FACE, TopAbs_EDGE, TopAbs_VERTEX};
77  for (auto &shapeType : shapeTypes) {
78  for (TopExp_Explorer explorer{newCompound, shapeType}; explorer.More();
79  explorer.Next()) {
80  auto &oldSubshape = explorer.Current();
81  if (auto old_metadata = removeGeo.get(oldSubshape)) {
82  keepGeo.insert(oldSubshape, std::move(*old_metadata));
83  }
84  }
85  }
86  if (!newCompound.IsNull()) {
87  keepGeo.setDim(std::max(keepGeo.getDim(), removeGeo.getDim()));
88  BRepAlgoAPI_Cut cutter{origCompound, newCompound};
89  if (cutter.HasDeleted() || cutter.HasModified() ||
90  cutter.HasGenerated()) {
91  auto deletedShapes = keepGeo.modify(cutter, {TopAbs_EDGE, TopAbs_FACE});
92  keepGeo.deleteShapes(deletedShapes[0]);
93  }
94  BRepBuilderAPI_Sewing sewer{};
95  std::vector<TopoDS_Shape> sewedShapes;
96  auto compound = keepGeo.buildCompound();
97  for (TopExp_Explorer explorer{compound, TopAbs_FACE}; explorer.More();
98  explorer.Next()) {
99  sewer.Add(explorer.Current());
100  sewedShapes.emplace_back(explorer.Current());
101  }
102  sewer.Perform();
103  auto deletedShapes =
104  keepGeo.modify(sewer, sewedShapes, {TopAbs_EDGE, TopAbs_FACE});
105  keepGeo.deleteShapes(deletedShapes);
106  }
107  }
108 }
std::pair< MapType::iterator, bool > insert(const TopoDS_Shape &shape, std::shared_ptr< ShapeData > shapeData)
Definition: GeoManager.C:181
std::shared_ptr< ShapeData > * get(const TopoDS_Shape &shape)
Get the data from the map.
Definition: GeoManager.C:162
void deleteShapes(const TopoDS_Shape &shape)
Remove a shape from the map.
Definition: GeoManager.C:127
int getDim() const
Get dimension of geometry.
Definition: GeoManager.C:50
static constexpr auto shapeType
Definition: NucMeshJson.H:81
TopoDS_Compound buildCompound() const
Create a compound from shapes present in the map that have same dimension as the instance.
Definition: GeoManager.C:145
std::vector< TopoDS_Shape > modify(BRepBuilderAPI_MakeShape &op, const std::vector< TopoDS_Shape > &shapes, const std::vector< TopAbs_ShapeEnum > &typesToTraverse={ TopAbs_VERTEX, TopAbs_EDGE, TopAbs_FACE, TopAbs_SOLID})
Modify this geoMetadata after a BRepBuilderAPI_MakeShape operation.
Definition: GeoManager.C:74
void setDim(int dim)
Set the dimension.
Definition: GeoManager.C:52

◆ setCenter()

void NEM::NUCMESH::ShapeBase::setCenter ( const std::array< double, 3 > &  center)
inherited

Definition at line 52 of file ShapeBase.C.

References NEM::NUCMESH::ShapeBase::center_.

Referenced by NEM::DRV::JSON::modify_helper().

52  {
53  center_ = center;
54 }
std::array< double, 3 > center_
Definition: ShapeBase.H:97

◆ setRings()

void NEM::NUCMESH::Circles::setRings ( std::vector< Ring rings)

Definition at line 312 of file CirclesAndPolys.C.

References rings_.

Referenced by NEM::DRV::JSON::modify_helper().

312  {
313  this->rings_ = std::move(rings);
314 }
std::vector< Ring > rings_

Member Data Documentation

◆ rings_

std::vector<Ring> NEM::NUCMESH::Circles::rings_
private

Definition at line 96 of file CirclesAndPolys.H.

Referenced by addRing(), createGeo(), getRings(), and setRings().


The documentation for this class was generated from the following files: