X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSMESH%2FSMESH_MeshEditor.cxx;h=f97e645dc67e8ef3377c411a7affeedc7fefb8ae;hb=3b4c34ed3671faa92d8554fe2e2b4cee64d9774e;hp=22695bac0567cc812b241097973dc6ae7a5bc028;hpb=db83efeef8e138c5871f1a3ca8d5d4a64653b663;p=modules%2Fsmesh.git diff --git a/src/SMESH/SMESH_MeshEditor.cxx b/src/SMESH/SMESH_MeshEditor.cxx index 22695bac0..f97e645dc 100644 --- a/src/SMESH/SMESH_MeshEditor.cxx +++ b/src/SMESH/SMESH_MeshEditor.cxx @@ -6959,9 +6959,19 @@ void SMESH_MeshEditor::MergeNodes (TListOfListOfNodes & theGroupsOfNodes, for ( size_t i = 0; i < newElemDefs.size(); ++i ) { - if ( i > 0 || !mesh->ChangeElementNodes( elem, - & newElemDefs[i].myNodes[0], - newElemDefs[i].myNodes.size() )) + bool elemChanged = false; + if ( i == 0 ) + { + if ( elem->GetGeomType() == SMDSGeom_POLYHEDRA ) + elemChanged = mesh->ChangePolyhedronNodes( elem, + newElemDefs[i].myNodes, + newElemDefs[i].myPolyhedQuantities ); + else + elemChanged = mesh->ChangeElementNodes( elem, + & newElemDefs[i].myNodes[0], + newElemDefs[i].myNodes.size() ); + } + if ( i > 0 || !elemChanged ) { if ( i == 0 ) { @@ -7128,6 +7138,7 @@ bool SMESH_MeshEditor::applyMerge( const SMDS_MeshElement* elem, // each face has to be analyzed in order to check volume validity if ( const SMDS_MeshVolume* aPolyedre = SMDS_Mesh::DownCast< SMDS_MeshVolume >( elem )) { + toRemove = false; int nbFaces = aPolyedre->NbFaces(); vector& poly_nodes = newElemDefs[0].myNodes; @@ -10781,7 +10792,23 @@ bool SMESH_MeshEditor::doubleNodes(SMESHDS_Mesh* theMeshDS, if ( theIsDoubleElem ) AddElement( newNodes, elemType.Init( anElem, /*basicOnly=*/false )); else - theMeshDS->ChangeElementNodes( anElem, &newNodes[ 0 ], newNodes.size() ); + { + // change element nodes + const SMDSAbs_EntityType geomType = anElem->GetEntityType(); + if ( geomType == SMDSEntity_Polyhedra ) + { + // special treatment for polyhedron + const SMDS_MeshVolume* aPolyhedron = SMDS_Mesh::DownCast< SMDS_MeshVolume >( anElem ); + if (!aPolyhedron) { + MESSAGE("Warning: bad volumic element"); + return false; + } + theMeshDS->ChangePolyhedronNodes( anElem, newNodes, aPolyhedron->GetQuantities() ); + } + else + // standard entity type + theMeshDS->ChangeElementNodes( anElem, &newNodes[ 0 ], newNodes.size() ); + } res = true; } @@ -11107,16 +11134,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 +11300,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 +11360,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 +11484,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 +11499,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 +11563,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 +11600,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 +11620,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 +11665,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 +11731,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 +11978,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 +12064,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 +12240,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 +12250,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 +12257,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 +12299,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;