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=ac694c4feacf8b61498e02470a72df1e959b1165;hp=ffab1b05646c38130011d64b642ac0fce86d2e11;hb=a001da2228831a5b40397df43bf3e61e7569b9f9;hpb=6c8b26afa5259e7809faf52f488c5f9daae4d1bb diff --git a/src/SMESH_I/SMESH_Gen_i.cxx b/src/SMESH_I/SMESH_Gen_i.cxx index ffab1b056..ac694c4fe 100644 --- a/src/SMESH_I/SMESH_Gen_i.cxx +++ b/src/SMESH_I/SMESH_Gen_i.cxx @@ -3158,8 +3158,12 @@ namespace // utils for CopyMeshWithGeom() if ( 0 < oldID && oldID < (int)myGIPMap->length() ) { - if ( myGIPMap[ oldID ].length() == 1 ) + if (( myGIPMap[ oldID ].length() == 1 ) || + ( myGIPMap[ oldID ].length() > 1 && + getShapeType( mySrcMesh_i, oldID ) == TopAbs_VERTEX )) + { newID = myGIPMap[ oldID ][ 0 ]; + } } return newID; } @@ -3450,6 +3454,7 @@ throw ( SALOME::SALOME_Exception ) SMESH_Mesh_i* srcMesh_i = SMESH::DownCast( theSourceMesh ); SMESH_Mesh_i* newMesh_i = SMESH::DownCast( theNewMesh ); + srcMesh_i->Load(); ShapeMapper shapeMapper( srcMesh_i, newMesh_i, this ); @@ -3563,9 +3568,9 @@ throw ( SALOME::SALOME_Exception ) // copy mesh elements, keeping IDs + SMESHDS_Mesh* newMeshDS = newMesh_i->GetImpl().GetMeshDS(); if ( theToCopyElements && theSourceMesh->NbNodes() > 0 ) { - SMESHDS_Mesh* newMeshDS = newMesh_i->GetImpl().GetMeshDS(); ::SMESH_MeshEditor editor( &newMesh_i->GetImpl() ); ::SMESH_MeshEditor::ElemFeatures elemData; @@ -3646,12 +3651,20 @@ throw ( SALOME::SALOME_Exception ) if ( !stdlGroup->_is_nil() ) { - if ( theToCopyElements ) + if ( newMeshDS->GetMeshInfo().NbElements( SMDSAbs_ElementType( elemType )) > 0 ) { SMESH::long_array_var elemIDs = stdlGroup->GetIDs(); - stdlGroup = theNewMesh->CreateGroup( elemType, name ); - stdlGroup->Add( elemIDs ); - newGroup = SMESH::SMESH_GroupBase::_narrow( stdlGroup ); + const bool isElem = ( elemType != SMESH::NODE ); + CORBA::ULong iE = 0; + for ( ; iE < elemIDs->length(); ++iE ) // check if any element has been copied + if ( newMeshDS->GetElementType( elemIDs[ iE ], isElem ) != SMDSAbs_All ) + break; + if ( iE < elemIDs->length() ) + { + stdlGroup = theNewMesh->CreateGroup( elemType, name ); + stdlGroup->Add( elemIDs ); + newGroup = SMESH::SMESH_GroupBase::_narrow( stdlGroup ); + } } } else if ( !geomGroup->_is_nil() ) @@ -3766,7 +3779,7 @@ throw ( SALOME::SALOME_Exception ) SALOMEDS::SObject_wrap newSO = ObjectToSObject( newGroup ); if ( !srcSO->_is_nil() ) { - CORBA::String_var srcID, newID; + CORBA::String_var srcID, newID(""); srcID = srcSO->GetID(); if ( !newSO->_is_nil() ) newID = newSO->GetID();