31 #include <vtkInformation.h> 32 #include <vtkInformationVector.h> 34 #include <SMESH_ControlsDef.hxx> 35 #include <SMESH_Group.hxx> 36 #include <SMESH_Mesh.hxx> 37 #include <SMESH_MeshEditor.hxx> 38 #include <SMESH_TypeDefs.hxx> 39 #include <SMESHDS_GroupBase.hxx> 40 #include <SMESHDS_Mesh.hxx> 53 this->SetNumberOfInputPorts(0);
54 this->SetNumberOfOutputPorts(1);
58 conf_ = configuration;
66 info->Set(vtkDataObject::DATA_TYPE_NAME(),
"smeshGeoMesh");
74 vtkInformationVector **inputVector,
75 vtkInformationVector *outputVector) {
83 std::array<TIDSortedElemSet, 2> elems_nodes;
87 std::copy(elemContainer.begin(), elemContainer.end(),
88 std::inserter(elems_nodes[0], elems_nodes[0].end()));
91 std::copy(nodesContainer.begin(), nodesContainer.end(),
92 std::inserter(elems_nodes[1], elems_nodes[1].end()));
95 std::set<int> groupsToRemove;
98 if (group->GetGroupDS()->GetType() == SMDSAbs_Face) {
99 groupsToRemove.emplace(group->GetID());
102 const std::string bottomName =
"Bottom";
103 mesh->AddGroup(SMDSAbs_Face, bottomName.c_str(), -1,
104 mesh->GetShapeToMesh());
105 Handle(TColStd_HSequenceOfReal)
106 extrudeStepsSeq{
new TColStd_HSequenceOfReal{}};
108 extrudeStepsSeq->Append(step);
110 SMESH_MeshEditor::ExtrusParam extrusParam{
111 gp_Dir{gp_XYZ(0, 0, 1)}, extrudeStepsSeq,
112 SMESH_MeshEditor::EXTRUSION_FLAG_BOUNDARY |
113 SMESH_MeshEditor::EXTRUSION_FLAG_GROUPS};
114 SMESH_MeshEditor::TTElemOfElemListMap newElems;
115 SMESH_MeshEditor editor{mesh.get()};
117 editor.ExtrusionSweep(elems_nodes.data(), extrusParam, newElems);
118 for (
auto &newGroupID : *newGroups) {
119 auto group = mesh->GetGroup(newGroupID);
120 auto type = group->GetGroupDS()->GetType();
121 if (type == SMDSAbs_Volume) {
123 const std::string tempAllExtruded = bottomName +
"_extruded";
124 if (tempAllExtruded.compare(0, tempAllExtruded.size(),
125 group->GetName()) == 0) {
126 groupsToRemove.emplace(group->GetID());
128 }
else if (type == SMDSAbs_Face) {
129 const std::string tempAllTop = bottomName +
"_top";
130 if (tempAllTop.compare(0, tempAllTop.size(), group->GetName()) == 0) {
131 group->SetName(
"Top");
133 std::string groupName = group->GetName();
134 const std::string suffix =
"_top";
136 if (groupName.size() > suffix.size() &&
137 groupName.compare(groupName.size() - suffix.size(), suffix.size(),
139 groupsToRemove.emplace(group->GetID());
144 for (
auto &groupID : groupsToRemove) { mesh->RemoveGroup(groupID); }
148 outputVector->GetInformationObject(0)->Get(vtkDataObject::DATA_OBJECT()));
std::vector< std::shared_ptr< NEM::NUCMESH::ShapeBase > > geometryAndMesh
Geometry and mesh.
vtkTypeMacro(NucMeshSrv, srvBase) protected int FillOutputPortInformation(int port, vtkInformation *info) override
void setSMeshMesh(std::unique_ptr< SMESH_Mesh > &&mesh, std::shared_ptr< SMESH_Gen > gen)
vtkStandardNewMacro(NucMeshSrv)
std::shared_ptr< meshBase > mesh
virtual int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)=0
This is called by the superclass.
std::unique_ptr< SMESH_Mesh > computeMesh(SMESH_Gen &generator)
Construct a mesh using the shapes in the map and their ShapeData.
const NucMeshConf & GetConfiguration() const
SM_StdContainerWrapperFromIter< typename std::decay< PtrSMDSIterator >::type, VALUE, EqualVALUE > containerWrapper(PtrSMDSIterator &&iter)
std::vector< double > extrudeSteps
Extrude the final 2d mesh along the z-axis.
void SetConfiguration(const NucMeshConf &configuration)
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 s...
std::shared_ptr< SMESH_Gen > generator