X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2FSMESHDS%2FSMESHDS_Mesh.cxx;h=072fcdac72fff2244320c5c19e49750c45e7c897;hb=20248b6e76a67595f7f449a71ebbf18c13429389;hp=dc1e094b02c31ed4ee97b1e0e4d64d48e8ca8a16;hpb=6bac08c1a81f34d3f21c550bd92f83654b2546a5;p=modules%2Fsmesh.git diff --git a/src/SMESHDS/SMESHDS_Mesh.cxx b/src/SMESHDS/SMESHDS_Mesh.cxx index dc1e094b0..072fcdac7 100644 --- a/src/SMESHDS/SMESHDS_Mesh.cxx +++ b/src/SMESHDS/SMESHDS_Mesh.cxx @@ -213,7 +213,7 @@ void SMESHDS_Mesh::MoveNode(const SMDS_MeshNode *n, double x, double y, double z //======================================================================= //function : ChangeElementNodes -//purpose : +//purpose : Changed nodes of an element provided that nb of nodes does not change //======================================================================= bool SMESHDS_Mesh::ChangeElementNodes(const SMDS_MeshElement * elem, @@ -708,9 +708,9 @@ SMDS_MeshFace* SMESHDS_Mesh::AddPolygonalFaceWithID (const std::vector& nod return anElem; } -SMDS_MeshFace* SMESHDS_Mesh::AddPolygonalFaceWithID - (const std::vector& nodes, - const int ID) +SMDS_MeshFace* +SMESHDS_Mesh::AddPolygonalFaceWithID (const std::vector& nodes, + const int ID) { SMDS_MeshFace *anElem = SMDS_Mesh::AddPolygonalFaceWithID(nodes, ID); if (anElem) { @@ -724,8 +724,8 @@ SMDS_MeshFace* SMESHDS_Mesh::AddPolygonalFaceWithID return anElem; } -SMDS_MeshFace* SMESHDS_Mesh::AddPolygonalFace - (const std::vector& nodes) +SMDS_MeshFace* +SMESHDS_Mesh::AddPolygonalFace (const std::vector& nodes) { SMDS_MeshFace *anElem = SMDS_Mesh::AddPolygonalFace(nodes); if (anElem) { @@ -739,6 +739,53 @@ SMDS_MeshFace* SMESHDS_Mesh::AddPolygonalFace return anElem; } + +//======================================================================= +//function : AddQuadPolygonalFace +//purpose : +//======================================================================= +SMDS_MeshFace* SMESHDS_Mesh::AddQuadPolygonalFaceWithID (const std::vector& nodes_ids, + const int ID) +{ + SMDS_MeshFace *anElem = SMDS_Mesh::AddQuadPolygonalFaceWithID(nodes_ids, ID); + if (anElem) { + myScript->AddQuadPolygonalFace(ID, nodes_ids); + } + return anElem; +} + +SMDS_MeshFace* +SMESHDS_Mesh::AddQuadPolygonalFaceWithID (const std::vector& nodes, + const int ID) +{ + SMDS_MeshFace *anElem = SMDS_Mesh::AddQuadPolygonalFaceWithID(nodes, ID); + if (anElem) { + int i, len = nodes.size(); + std::vector nodes_ids (len); + for (i = 0; i < len; i++) { + nodes_ids[i] = nodes[i]->GetID(); + } + myScript->AddQuadPolygonalFace(ID, nodes_ids); + } + return anElem; +} + +SMDS_MeshFace* +SMESHDS_Mesh::AddQuadPolygonalFace (const std::vector& nodes) +{ + SMDS_MeshFace *anElem = SMDS_Mesh::AddQuadPolygonalFace(nodes); + if (anElem) { + int i, len = nodes.size(); + std::vector nodes_ids (len); + for (i = 0; i < len; i++) { + nodes_ids[i] = nodes[i]->GetID(); + } + myScript->AddQuadPolygonalFace(anElem->GetID(), nodes_ids); + } + return anElem; +} + + //======================================================================= //function : AddPolyhedralVolume //purpose : @@ -847,16 +894,7 @@ void SMESHDS_Mesh::RemoveNode(const SMDS_MeshNode * n) { if ( n->NbInverseElements() == 0 && !(hasConstructionEdges() || hasConstructionFaces())) { - SMESHDS_SubMesh* subMesh = MeshElements( n->getshapeId() ); - SMESHDS_SubMeshIteratorPtr subIt; - if ( !subMesh ) - subIt = SubMeshes(); - for ( ; !subMesh && subIt->more(); ) { - subMesh = const_cast< SMESHDS_SubMesh* >( subIt->next() ); - if ( subMesh->IsComplexSubmesh() || !subMesh->Contains( n )) - subMesh = 0; - } - RemoveFreeNode( n, subMesh, true); + RemoveFreeNode( n, 0, true ); return; } @@ -918,7 +956,7 @@ void SMESHDS_Mesh::RemoveElement(const SMDS_MeshElement * elt) if ( elt->getshapeId() > 0 ) subMesh = MeshElements( elt->getshapeId() ); - RemoveFreeElement( elt, subMesh, true); + RemoveFreeElement( elt, subMesh, true ); return; } @@ -927,7 +965,7 @@ void SMESHDS_Mesh::RemoveElement(const SMDS_MeshElement * elt) list removedElems; list removedNodes; - SMDS_Mesh::RemoveElement(elt, removedElems, removedNodes, false); + SMDS_Mesh::RemoveElement(elt, removedElems, removedNodes, false ); removeFromContainers( this, myGroups, removedElems, false ); } @@ -953,7 +991,7 @@ void SMESHDS_Mesh::RemoveFreeElement(const SMDS_MeshElement * elt, myScript->RemoveElement(elt->GetID()); // Rm from group - // Node can belong to several groups + // Element can belong to several groups if ( fromGroups && !myGroups.empty() ) { set::iterator GrIt = myGroups.begin(); for (; GrIt != myGroups.end(); GrIt++) { @@ -965,10 +1003,12 @@ void SMESHDS_Mesh::RemoveFreeElement(const SMDS_MeshElement * elt, // Rm from sub-mesh // Element should belong to only one sub-mesh - if( subMesh ) - subMesh->RemoveElement(elt, /*deleted=*/false); + if ( !subMesh && elt->getshapeId() > 0 ) + subMesh = MeshElements( elt->getshapeId() ); + if ( subMesh ) + subMesh->RemoveElement( elt, /*deleted=*/false ); - SMDS_Mesh::RemoveFreeElement(elt); + SMDS_Mesh::RemoveFreeElement( elt ); } //================================================================================