From dc782198ad877d12796f3d1e6dc68205056c60c7 Mon Sep 17 00:00:00 2001 From: eap Date: Fri, 19 Oct 2018 15:07:22 +0300 Subject: [PATCH] 23608: [EDF] HYDRO: crash when compute copied mesh 23609: [EDF] HYDRO: wrong warning appears 23607: [EDF] HYDRO: Copy mesh with geometry - problems of Copy elements --- src/SMESH_I/SMESH_Gen_i.cxx | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/src/SMESH_I/SMESH_Gen_i.cxx b/src/SMESH_I/SMESH_Gen_i.cxx index 6abff9383..d66a1f95d 100644 --- a/src/SMESH_I/SMESH_Gen_i.cxx +++ b/src/SMESH_I/SMESH_Gen_i.cxx @@ -3160,12 +3160,20 @@ namespace // utils for CopyMeshWithGeom() if ( 0 < oldID && oldID < (int)myGIPMap->length() ) { - if (( myGIPMap[ oldID ].length() == 1 ) || - ( myGIPMap[ oldID ].length() > 1 && - getShapeType( mySrcMesh_i, oldID ) == TopAbs_VERTEX )) + if ( myGIPMap[ oldID ].length() == 1 ) { newID = myGIPMap[ oldID ][ 0 ]; } + else if ( myGIPMap[ oldID ].length() > 1 && + getShapeType( mySrcMesh_i, oldID ) == TopAbs_VERTEX ) + { + // select a meshed VERTEX + SMESH_subMesh* newSM; + for ( CORBA::ULong i = 0; i < myGIPMap[ oldID ].length() && !newID; ++i ) + if (( newSM = myNewMesh_i->GetImpl().GetSubMeshContaining( myGIPMap[ oldID ][ i ] )) && + ( !newSM->IsEmpty() )) + newID = myGIPMap[ oldID ][ i ]; + } } return newID; } @@ -3401,7 +3409,7 @@ namespace // utils for CopyMeshWithGeom() seq[ seq->length() - 1 ] = item; } } -} +} // namespace // utils for CopyMeshWithGeom() //================================================================================ /*! @@ -3637,6 +3645,8 @@ throw ( SALOME::SALOME_Exception ) if ( SMESH_subMesh* newSM = newMesh_i->GetImpl().GetSubMeshContaining( newID )) newSM->ComputeStateEngine( SMESH_subMesh::CHECK_COMPUTE_STATE ); } + + newMeshDS->Modified(); } @@ -3647,7 +3657,7 @@ throw ( SALOME::SALOME_Exception ) SALOME::GenericObj_wrap< SMESH::FilterManager > filterMgr = CreateFilterManager(); SMESH::ListOfGroups_var groups = theSourceMesh->GetGroups(); - CORBA::ULong nbGroups = groups->length(), nbAddedGroups = 0; + CORBA::ULong nbGroups = theToCopyGroups ? groups->length() : 0, nbAddedGroups = 0; for ( CORBA::ULong i = 0; i < nbGroups + nbAddedGroups; ++i ) { SMESH::SMESH_Group_var stdlGroup = SMESH::SMESH_Group::_narrow ( groups[ i ]); @@ -3801,6 +3811,8 @@ throw ( SALOME::SALOME_Exception ) } // loop on groups + newMeshDS->CompactMesh(); + // set mesh name SALOMEDS::SObject_wrap soNew = ObjectToSObject( study, theNewMesh ); SALOMEDS::SObject_wrap soOld = ObjectToSObject( study, theSourceMesh ); -- 2.39.2