From 882ff39283ea3dcbd1aa9da77b7dfb90a6c333ad Mon Sep 17 00:00:00 2001 From: eap Date: Wed, 7 Jul 2021 14:58:51 +0300 Subject: [PATCH] bos #24368 EDF 23667 - Duplicates nodes + Suppress warnings --- src/DriverDAT/DriverDAT_W_SMDS_Mesh.cxx | 8 ++-- src/SMESH/SMESH_MeshEditor.cxx | 59 +++++++++++-------------- 2 files changed, 30 insertions(+), 37 deletions(-) diff --git a/src/DriverDAT/DriverDAT_W_SMDS_Mesh.cxx b/src/DriverDAT/DriverDAT_W_SMDS_Mesh.cxx index 2eb69bd07..c3be3ad42 100644 --- a/src/DriverDAT/DriverDAT_W_SMDS_Mesh.cxx +++ b/src/DriverDAT/DriverDAT_W_SMDS_Mesh.cxx @@ -70,7 +70,7 @@ Driver_Mesh::Status DriverDAT_W_SMDS_Mesh::Perform() SCRUTE(nb_of_volumes); //fprintf(stdout, "%d %d\n", nbNodes, nbCells); - fprintf(aFileId, "%ld %ld\n", nbNodes, nbCells); + fprintf(aFileId, "%ld %ld\n", nbNodes, static_cast< long >( nbCells )); /**************************************************************************** * ECRITURE DES NOEUDS * @@ -107,7 +107,7 @@ Driver_Mesh::Status DriverDAT_W_SMDS_Mesh::Perform() smIdType nodeID = it->next()->GetID(); if ( !nodeNumByID.empty() ) nodeID = nodeNumByID[ nodeID ]; - fprintf(aFileId, "%ld ", nodeID ); + fprintf(aFileId, "%ld ", static_cast< long >( nodeID )); } fprintf(aFileId, "\n"); } @@ -123,7 +123,7 @@ Driver_Mesh::Status DriverDAT_W_SMDS_Mesh::Perform() smIdType nodeID = it->next()->GetID(); if ( !nodeNumByID.empty() ) nodeID = nodeNumByID[ nodeID ]; - fprintf(aFileId, "%ld ", nodeID ); + fprintf(aFileId, "%ld ", static_cast< long >( nodeID )); } fprintf(aFileId, "\n"); } @@ -158,7 +158,7 @@ Driver_Mesh::Status DriverDAT_W_SMDS_Mesh::Perform() smIdType nodeID = it->next()->GetID(); if ( !nodeNumByID.empty() ) nodeID = nodeNumByID[ nodeID ]; - fprintf(aFileId, "%ld ", nodeID ); + fprintf(aFileId, "%ld ", static_cast< long >( nodeID )); } fprintf(aFileId, "\n"); diff --git a/src/SMESH/SMESH_MeshEditor.cxx b/src/SMESH/SMESH_MeshEditor.cxx index 22695bac0..6b0ad7644 100644 --- a/src/SMESH/SMESH_MeshEditor.cxx +++ b/src/SMESH/SMESH_MeshEditor.cxx @@ -11107,16 +11107,9 @@ bool SMESH_MeshEditor::DoubleNodesOnGroupBoundaries( const std::vector, DownIdCompare> faceDomains; // face --> (id domain --> id volume) - std::mapcelldom; // cell vtkId --> domain + std::map celldom; // cell vtkId --> domain std::map, DownIdCompare> cellDomains; // oldNode --> (id domain --> id cell) std::map > nodeDomains; // oldId --> (domainId --> newId) - faceDomains.clear(); - celldom.clear(); - cellDomains.clear(); - nodeDomains.clear(); - std::map emptyMap; - std::set emptySet; - emptyMap.clear(); //MESSAGE(".. Number of domains :"<first; //MESSAGE(" --- face " << face.cellId); std::set oldNodes; - oldNodes.clear(); grid->GetNodeIds(oldNodes, face.cellId, face.cellType); std::set::iterator itn = oldNodes.begin(); for (; itn != oldNodes.end(); ++itn) @@ -11281,7 +11273,6 @@ bool SMESH_MeshEditor::DoubleNodesOnGroupBoundaries( const std::vectorfirst; //MESSAGE(" --- face " << face.cellId); std::set oldNodes; - oldNodes.clear(); grid->GetNodeIds(oldNodes, face.cellId, face.cellType); std::set::iterator itn = oldNodes.begin(); for (; itn != oldNodes.end(); ++itn) @@ -11342,7 +11333,6 @@ bool SMESH_MeshEditor::DoubleNodesOnGroupBoundaries( const std::vectorfirst; //MESSAGE(" --- face " << face.cellId); std::set oldNodes; - oldNodes.clear(); grid->GetNodeIds(oldNodes, face.cellId, face.cellType); int nbMultipleNodes = 0; std::set::iterator itn = oldNodes.begin(); @@ -11467,7 +11457,7 @@ bool SMESH_MeshEditor::DoubleNodesOnGroupBoundaries( const std::vector mapOfJunctionGroups; //MESSAGE(".. Creation of elements: simple junction"); - if (createJointElems) + if ( createJointElems ) { string joints2DName = "joints2D"; mapOfJunctionGroups[joints2DName] = this->myMesh->AddGroup(SMDSAbs_Face, joints2DName.c_str()); @@ -11482,15 +11472,14 @@ bool SMESH_MeshEditor::DoubleNodesOnGroupBoundaries( const std::vectorfirst; std::set oldNodes; std::set::iterator itn; - oldNodes.clear(); grid->GetNodeIds(oldNodes, face.cellId, face.cellType); - std::map domvol = itface->second; + std::map domvol = itface->second; std::map::iterator itdom = domvol.begin(); - int dom1 = itdom->first; + int dom1 = itdom->first; int vtkVolId = itdom->second; itdom++; - int dom2 = itdom->first; + int dom2 = itdom->first; SMDS_MeshCell *vol = grid->extrudeVolumeFromFace(vtkVolId, dom1, dom2, oldNodes, nodeDomains, nodeQuadDomains); stringstream grpname; @@ -11547,7 +11536,7 @@ bool SMESH_MeshEditor::DoubleNodesOnGroupBoundaries( const std::vector, std::vector >::iterator ite = edgesMultiDomains.begin(); for (; ite != edgesMultiDomains.end(); ++ite) { - vector nodes = ite->first; + vector nodes = ite->first; vector orderDom = ite->second; vector orderedNodes; if (nodes.size() == 2) @@ -11584,10 +11573,9 @@ bool SMESH_MeshEditor::DoubleNodesOnGroupBoundaries( const std::vector, DownIdCompare> faceOrEdgeDom; // cellToModify --> (id domain --> id cell) std::map feDom; // vtk id of cell to modify --> id domain - faceOrEdgeDom.clear(); - feDom.clear(); //MESSAGE(".. Modification of elements"); + SMDSAbs_ElementType domainType = (*theElems[0].begin())->GetType(); for (int idomain = idom0; idomain < nbDomains; idomain++) { std::map >::const_iterator itnod = nodeDomains.begin(); @@ -11605,13 +11593,29 @@ bool SMESH_MeshEditor::DoubleNodesOnGroupBoundaries( const std::vectorGetParentVolumes(volParents, vtkId); + int nbvol = 0; + nbvol = grid->GetParentVolumes(volParents, vtkId); + if ( domainType == SMDSAbs_Volume ) + { + nbvol = grid->GetParentVolumes(volParents, vtkId); + } + else // domainType == SMDSAbs_Face + { + const int nbFaces = grid->getDownArray(vtkType)->getNumberOfUpCells(downId); + const int *upCells = grid->getDownArray(vtkType)->getUpCells(downId); + const unsigned char* upTypes = grid->getDownArray(vtkType)->getUpTypes(downId); + for (int i=0; i< nbFaces; i++) + { + int vtkFaceId = grid->getDownArray( upTypes[i] )->getVtkCellId(upCells[i]); + if (vtkFaceId >= 0) + volParents[nbvol++] = vtkFaceId; + } + } for (int j = 0; j < nbvol; j++) if (celldom.count(volParents[j]) && (celldom[volParents[j]] == idomain)) if (!feDom.count(vtkId)) { feDom[vtkId] = idomain; - faceOrEdgeDom[aCell] = emptyMap; faceOrEdgeDom[aCell][idomain] = vtkId; // affect face or edge to the first domain only //MESSAGE("affect cell " << this->GetMeshDS()->FromVtkToSmds(vtkId) << " domain " << idomain // << " type " << vtkType << " downId " << downId); @@ -11634,7 +11638,6 @@ bool SMESH_MeshEditor::DoubleNodesOnGroupBoundaries( const std::vectorfirst; std::set oldNodes; std::set::iterator itn; - oldNodes.clear(); grid->GetNodeIds(oldNodes, face.cellId, face.cellType); //MESSAGE("examine cell, downId " << face.cellId << " type " << int(face.cellType)); std::map localClonedNodeIds; @@ -11701,10 +11704,7 @@ bool SMESH_MeshEditor::CreateFlatElementsOnFacesGroups(const std::vector clonedNodes; std::map intermediateNodes; - clonedNodes.clear(); - intermediateNodes.clear(); std::map mapOfJunctionGroups; - mapOfJunctionGroups.clear(); for ( size_t idom = 0; idom < theElems.size(); idom++ ) { @@ -11951,7 +11951,6 @@ void SMESH_MeshEditor::CreateHoleSkin(double radius, std::set setOfVolToCheck; std::vector gpnts; - gpnts.clear(); if (isNodeGroup) // --- a group of nodes is provided : find all the volumes using one or more of this nodes { @@ -12038,7 +12037,6 @@ void SMESH_MeshEditor::CreateHoleSkin(double radius, // Fill the group of inside volumes std::map mapOfNodeDistance2; - mapOfNodeDistance2.clear(); std::set setOfOutsideVol; while (!setOfVolToCheck.empty()) { @@ -12215,9 +12213,7 @@ void SMESH_MeshEditor::CreateHoleSkin(double radius, // project polylines on subshapes, and partition, to get geom faces std::map > shapeIdToVtkIdSet; // shapeId --> set of vtkId on skin - std::set emptySet; - emptySet.clear(); - std::set shapeIds; + std::set shapeIds; SMDS_ElemIteratorPtr itelem = sgrps->GetElements(); while (itelem->more()) @@ -12227,7 +12223,6 @@ void SMESH_MeshEditor::CreateHoleSkin(double radius, int vtkId = elem->GetVtkID(); if (!shapeIdToVtkIdSet.count(shapeId)) { - shapeIdToVtkIdSet[shapeId] = emptySet; shapeIds.insert(shapeId); } shapeIdToVtkIdSet[shapeId].insert(vtkId); @@ -12235,7 +12230,6 @@ void SMESH_MeshEditor::CreateHoleSkin(double radius, std::map > shapeIdToEdges; // shapeId --> set of downward edges std::set emptyEdges; - emptyEdges.clear(); std::map >::iterator itShape = shapeIdToVtkIdSet.begin(); for (; itShape != shapeIdToVtkIdSet.end(); ++itShape) @@ -12278,7 +12272,6 @@ void SMESH_MeshEditor::CreateHoleSkin(double radius, } std::list order; - order.clear(); if (nodesEdges.size() > 0) { order.push_back(nodesEdges[0]); //MESSAGE(" --- back " << order.back()+1); // SMDS id = VTK id + 1; -- 2.30.2