31 #include <unordered_set> 33 #include <TopExp_Explorer.hxx> 34 #include <TopoDS_Compound.hxx> 35 #include <TopoDS_Shape.hxx> 37 #include <SMESH_Gen.hxx> 38 #include <SMESH_Mesh.hxx> 39 #include <StdMeshers_Adaptive1D.hxx> 40 #include <StdMeshers_MEFISTO_2D.hxx> 41 #include <StdMeshers_Regular_1D.hxx> 49 std::unique_ptr<SMESH_Mesh>
mesh{generator.CreateMesh(
false)};
50 std::vector<std::unique_ptr<SMESH_Hypothesis>> hypotheses;
52 mesh->ShapeToMesh(compound);
54 auto edgeAlgId = generator.GetANewId();
55 hypotheses.emplace_back(
new StdMeshers_Regular_1D{edgeAlgId, &generator});
56 mesh->AddHypothesis(compound, edgeAlgId);
57 auto edgeHypId = generator.GetANewId();
58 hypotheses.emplace_back(
59 new StdMeshers_Adaptive1D{edgeHypId, &generator});
60 mesh->AddHypothesis(compound, edgeHypId);
63 auto faceAlgId = generator.GetANewId();
64 hypotheses.emplace_back(
new StdMeshers_MEFISTO_2D{faceAlgId, &generator});
65 mesh->AddHypothesis(compound, faceAlgId);
67 std::unordered_set<TopoDS_Shape, ShapeMapHasher_Hash, ShapeMapHasher_KeyEqual>
69 for (
auto &shape :
map_) {
71 static constexpr std::array<TopAbs_ShapeEnum, 4> shapeTypes{
72 TopAbs_VERTEX, TopAbs_EDGE, TopAbs_FACE, TopAbs_SOLID};
74 for (TopExp_Explorer explorer{shape.first,
shapeType}; explorer.More();
76 auto &subShape = explorer.Current();
77 auto findIter = map_.find(subShape);
78 if (findIter != map_.end() &&
79 generated_shapes.find(subShape) == generated_shapes.end()) {
81 dynamic_cast<NucMeshShapeData *>(findIter->second.get())) {
82 nmData->setupAlgos(explorer.Current(), generator, *
mesh,
85 generated_shapes.emplace(subShape);
91 generator.Compute(*
mesh, compound);
static constexpr auto shapeType
bool isChild(const TopoDS_Shape &shape) const
std::shared_ptr< meshBase > mesh
std::unique_ptr< SMESH_Mesh > computeMesh(SMESH_Gen &generator)
Construct a mesh using the shapes in the map and their ShapeData.
TopoDS_Compound buildCompound() const
Create a compound from shapes present in the map that have same dimension as the instance.