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

Class to describe meshing an edge by StdMeshers_NumberOfSegments. More...

Detailed Description

Definition at line 126 of file NucMeshShapeData.H.

Public Member Functions

 EdgeSegments (std::string groupName, int numSegments)
 
void setupAlgos (const TopoDS_Shape &shape, SMESH_Gen &generator, SMESH_Mesh &mesh, std::vector< std::unique_ptr< SMESH_Hypothesis >> &generatedHyps) const override
 Method that is called when a GeoManager instance tries to mesh shape. More...
 
void updateModified (const TopoDS_Shape &shape, const TopTools_ListOfShape &modifiedShapes, NEM::GEO::GeoManager &geoMetadata) const override
 
virtual void updateGenerated (const TopoDS_Shape &shape, const TopTools_ListOfShape &generatedShapes, GeoManager &geoMetadata) const
 Method that is called when a geometry operation generates new shapes. More...
 
virtual void updateDeleted (const TopoDS_Shape &shape, GeoManager &geoMetadata)
 Method that is called when geoMetadata removes shape. More...
 

Public Attributes

std::string groupName
 
SMDSAbs_ElementType type
 

Protected Types

using CRTPBase = CopyOverrideShapeData< EdgeSegments, SideSetEdge >
 

Private Attributes

int numSegments_
 

Inherits NEM::NUCMESH::CopyOverrideShapeData< EdgeSegments, SideSetEdge >.

Member Typedef Documentation

◆ CRTPBase

Constructor & Destructor Documentation

◆ EdgeSegments()

NEM::NUCMESH::EdgeSegments::EdgeSegments ( std::string  groupName,
int  numSegments 
)
explicit

Definition at line 104 of file NucMeshShapeData.C.

105  : CRTPBase(std::move(groupName)), numSegments_(numSegments) {}
CopyOverrideShapeData< EdgeSegments, SideSetEdge > CRTPBase

Member Function Documentation

◆ setupAlgos()

void NEM::NUCMESH::EdgeSegments::setupAlgos ( const TopoDS_Shape &  shape,
SMESH_Gen &  generator,
SMESH_Mesh &  mesh,
std::vector< std::unique_ptr< SMESH_Hypothesis >> &  generatedHyps 
) const
overridevirtual

Default implementation does nothing

Parameters
[in]shapeShape to mesh
[in,out]generatorGenerator that will mesh
[in,out]meshMesh that will mesh
[out]generatedHypsOutput list of created hypotheses/algorithms (for memory management; will be deleted when the GeoManager instance is deleted)

Reimplemented from NEM::NUCMESH::SideSetEdge.

Definition at line 107 of file NucMeshShapeData.C.

References numSegments_, and NEM::NUCMESH::SideSetEdge::setupAlgos().

109  {
110  this->SideSetEdge::setupAlgos(shape, generator, mesh, generatedHyps);
111  auto hypId = generator.GetANewId();
112  auto hypothesis = new StdMeshers_NumberOfSegments{hypId, &generator};
113  hypothesis->SetNumberOfSegments(numSegments_);
114  generatedHyps.emplace_back(hypothesis);
115  mesh.AddHypothesis(shape, hypId);
116  std::list<const SMESHDS_Hypothesis *> algos;
117  SMESH_HypoFilter filter(SMESH_HypoFilter::IsAlgo());
118  filter.And(SMESH_HypoFilter::IsApplicableTo(shape));
119  mesh.GetHypotheses(mesh.GetShapeToMesh(), filter, algos, false);
120  int algoId = -1;
121  for (auto &hyp : algos) {
122  if (auto algo = dynamic_cast<const SMESH_Algo *>(hyp)) {
123  // The method is not virtual, and doesn't allow us to modify algo, so
124  // const_cast should be safe
125  auto allowed_hyps =
126  const_cast<SMESH_Algo *>(algo)->GetCompatibleHypothesis();
127  if (std::find(allowed_hyps.begin(), allowed_hyps.end(),
128  hypothesis->GetName()) != allowed_hyps.end()) {
129  algoId = algo->GetID();
130  }
131  }
132  }
133  if (algoId < 0) {
134  algoId = generator.GetANewId();
135  auto algo = new StdMeshers_Regular_1D{algoId, &generator};
136  generatedHyps.emplace_back(algo);
137  }
138  mesh.AddHypothesis(shape, algoId);
139 }
void setupAlgos(const TopoDS_Shape &shape, SMESH_Gen &generator, SMESH_Mesh &mesh, std::vector< std::unique_ptr< SMESH_Hypothesis >> &generatedHyps) const override
Method that is called when a GeoManager instance tries to mesh shape.
std::shared_ptr< meshBase > mesh

◆ updateDeleted()

virtual void NEM::GEO::ShapeData::updateDeleted ( const TopoDS_Shape &  shape,
GeoManager geoMetadata 
)
inlinevirtualinherited

Default implementation does nothing

Parameters
[in]shapeShape to be removed
[in,out]geoMetadataGeometry-to-data map to alter

Definition at line 83 of file ShapeData.H.

84  {};

◆ updateGenerated()

virtual void NEM::GEO::ShapeData::updateGenerated ( const TopoDS_Shape &  shape,
const TopTools_ListOfShape generatedShapes,
GeoManager geoMetadata 
) const
inlinevirtualinherited

Default implementation does nothing

Parameters
[in]shapeArgument to operation; shape existing in geoMetadata
[in]generatedShapesShapes provided by a call to op.Generated(shape) for some geometry operation
[in,out]geoMetadataGeometry-to-data map to alter

Definition at line 62 of file ShapeData.H.

64  {};

◆ updateModified()

void NEM::NUCMESH::CopyOverrideShapeData< EdgeSegments , SideSetEdge >::updateModified ( const TopoDS_Shape &  shape,
const TopTools_ListOfShape modifiedShapes,
NEM::GEO::GeoManager geoMetadata 
) const
inlineoverridevirtualinherited

Reimplemented from NEM::NUCMESH::CopyOverrideShapeData< SideSetEdge, GroupData >.

Definition at line 75 of file NucMeshShapeData.H.

77  {
78  for (auto &modifiedShape : modifiedShapes) {
79  geoMetadata.getMap()[modifiedShape] =
80  std::shared_ptr<NEM::GEO::ShapeData>{
81  new T{*static_cast<const T *>(this)}};
82  }
83  }
MapType & getMap()
Definition: GeoManager.C:186

Member Data Documentation

◆ groupName

std::string NEM::NUCMESH::GroupData::groupName
inherited

Definition at line 102 of file NucMeshShapeData.H.

Referenced by NEM::NUCMESH::GroupData::setupAlgos().

◆ numSegments_

int NEM::NUCMESH::EdgeSegments::numSegments_
private

Definition at line 137 of file NucMeshShapeData.H.

Referenced by setupAlgos().

◆ type

SMDSAbs_ElementType NEM::NUCMESH::GroupData::type
inherited

Definition at line 103 of file NucMeshShapeData.H.

Referenced by NEM::NUCMESH::GroupData::setupAlgos().


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