X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=blobdiff_plain;f=src%2FSMESH_I%2FSMESH_Gen_i.cxx;h=3afdb9f1f87ad9e92f2c3b5edc571cd7fbd230e4;hp=824655a8775c4ecb7d7f2d8052a879a2ed8cf4b0;hb=b22e182dd1a2c30be324b21074158390d00714b3;hpb=5ac2bd91a85417fd289aea0907264cb2d155d76d diff --git a/src/SMESH_I/SMESH_Gen_i.cxx b/src/SMESH_I/SMESH_Gen_i.cxx index 824655a87..3afdb9f1f 100644 --- a/src/SMESH_I/SMESH_Gen_i.cxx +++ b/src/SMESH_I/SMESH_Gen_i.cxx @@ -2422,6 +2422,7 @@ SMESH_Gen_i::ConcatenateCommon(const SMESH::ListOfIDSources& theMeshesArray, ::SMESH_MeshEditor aNewEditor(&aLocMesh); SMESH::ListOfGroups_var aListOfGroups; + ::SMESH_MeshEditor::ElemFeatures elemType; std::vector aNodesArray; // loop on sub-meshes @@ -2476,31 +2477,12 @@ SMESH_Gen_i::ConcatenateCommon(const SMESH::ListOfIDSources& theMeshesArray, } // creates a corresponding element on existent nodes in new mesh - aNewElem = 0; - switch ( anElem->GetEntityType() ) - { - case SMDSEntity_Polyhedra: - if ( const SMDS_VtkVolume* aVolume = - dynamic_cast (anElem)) - { - aNewElem = aNewMeshDS->AddPolyhedralVolume( aNodesArray, - aVolume->GetQuantities() ); - } - break; - case SMDSEntity_Ball: - if ( const SMDS_BallElement* aBall = - dynamic_cast (anElem)) - { - aNewElem = aNewEditor.AddElement( aNodesArray, SMDSAbs_Ball, - /*isPoly=*/false, /*id=*/0, - aBall->GetDiameter() ); - } - break; - case SMDSEntity_Node: - break; - default: - aNewElem = aNewEditor.AddElement( aNodesArray, anElem->GetType(), anElem->IsPoly() ); - } + if ( anElem->GetType() == SMDSAbs_Node ) + aNewElem = 0; + else + aNewElem = + aNewEditor.AddElement( aNodesArray, elemType.Init( anElem, /*basicOnly=*/false )); + if ( aNewElem ) elemsMap.insert( make_pair( anElem, aNewElem )); @@ -2650,11 +2632,12 @@ SMESH_Gen_i::ConcatenateCommon(const SMESH::ListOfIDSources& theMeshesArray, } // if an IDSource is a mesh } //meshes loop - if (theMergeNodesAndElements) { - // merge nodes + if (theMergeNodesAndElements) // merge nodes + { TIDSortedNodeSet aMeshNodes; // no input nodes SMESH_MeshEditor::TListOfListOfNodes aGroupsOfNodes; - aNewEditor.FindCoincidentNodes( aMeshNodes, theMergeTolerance, aGroupsOfNodes ); + aNewEditor.FindCoincidentNodes( aMeshNodes, theMergeTolerance, aGroupsOfNodes, + /*SeparateCornersAndMedium=*/ false ); aNewEditor.MergeNodes( aGroupsOfNodes ); // merge elements aNewEditor.MergeEqualElements(); @@ -2737,6 +2720,7 @@ SMESH::SMESH_Mesh_ptr SMESH_Gen_i::CopyMesh(SMESH::SMESH_IDSource_ptr meshPart, } SMESHDS_Mesh* newMeshDS = newMesh_i->GetImpl().GetMeshDS(); ::SMESH_MeshEditor editor( &newMesh_i->GetImpl() ); + ::SMESH_MeshEditor::ElemFeatures elemType; // 3. Get elements to copy @@ -2808,30 +2792,12 @@ SMESH::SMESH_Mesh_ptr SMESH_Gen_i::CopyMesh(SMESH::SMESH_IDSource_ptr meshPart, // add elements if ( elem->GetType() != SMDSAbs_Node ) { - int ID = toKeepIDs ? elem->GetID() : 0; - const SMDS_MeshElement * newElem; - switch ( elem->GetEntityType() ) { - case SMDSEntity_Polyhedra: - if ( toKeepIDs ) - newElem = editor.GetMeshDS()-> - AddPolyhedralVolumeWithID( nodes, - static_cast(elem)->GetQuantities(), - ID); - else - newElem = editor.GetMeshDS()-> - AddPolyhedralVolume( nodes, - static_cast(elem)->GetQuantities()); - break; - case SMDSEntity_Ball: - newElem = editor.AddElement( nodes, SMDSAbs_Ball, false, ID, - static_cast(elem)->GetDiameter()); - break; - default: - newElem = editor.AddElement( nodes,elem->GetType(),elem->IsPoly(),ID); + elemType.Init( elem, /*basicOnly=*/false ); + if ( toKeepIDs ) elemType.SetID( elem->GetID() ); + const SMDS_MeshElement * newElem = editor.AddElement( nodes, elemType ); if ( toCopyGroups && !toKeepIDs ) e2eMapByType[ elem->GetType() ].insert( make_pair( elem, newElem )); - } } } // while ( srcElemIt->more() )