X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSMESH_I%2FSMESH_Gen_i.cxx;h=522732e50e80239d9924cb1c4a2360bc63875f35;hb=a40ee3d1dedd8e1a29aae95e0ab9ac5ed2660869;hp=493abb9081ec5b599d70a419d04d13e8343a8580;hpb=92372a5f825f3aabb36c5068a3c98da45e6201ac;p=modules%2Fsmesh.git diff --git a/src/SMESH_I/SMESH_Gen_i.cxx b/src/SMESH_I/SMESH_Gen_i.cxx index 493abb908..522732e50 100644 --- a/src/SMESH_I/SMESH_Gen_i.cxx +++ b/src/SMESH_I/SMESH_Gen_i.cxx @@ -1168,7 +1168,6 @@ CORBA::Boolean SMESH_Gen_i::Compute( SMESH::SMESH_Mesh_ptr theMesh, // Update Python script TPythonDump() << "isDone = " << this << ".Compute( " << theMesh << ", " << theShapeObject << ")"; - TPythonDump() << "if not isDone: print 'Mesh', " << theMesh << ", ': computation failed'"; try { // get mesh servant @@ -1283,12 +1282,33 @@ SMESH_Gen_i::FindGeometryByMeshElement( SMESH::SMESH_Mesh_ptr theMesh, ::SMESH_Mesh & mesh = meshServant->GetImpl(); SMESHDS_Mesh* meshDS = mesh.GetMeshDS(); // find the element in mesh - if ( const SMDS_MeshElement * elem = meshDS->FindElement( theElementID ) ) + if ( const SMDS_MeshElement * elem = meshDS->FindElement( theElementID ) ) { // find a shape id by the element if ( int shapeID = ::SMESH_MeshEditor( &mesh ).FindShape( elem )) { // get a geom object by the shape id GEOM::GEOM_Object_var geom = ShapeToGeomObject( meshDS->IndexToShape( shapeID )); if ( geom->_is_nil() ) { + // try to find a published sub-shape + SALOMEDS::SObject_var mainSO = ObjectToSObject( myCurrentStudy, mainShape ); + SALOMEDS::ChildIterator_var it; + if ( !mainSO->_is_nil() ) + it = myCurrentStudy->NewChildIterator( mainSO ); + if ( !it->_is_nil() ) { + for ( it->InitEx(true); it->More(); it->Next() ) { + GEOM::GEOM_Object_var subGeom = + GEOM::GEOM_Object::_narrow( SObjectToObject( it->Value() )); + if ( !subGeom->_is_nil() ) { + GEOM::ListOfLong_var subList = subGeom->GetSubShapeIndices(); + if ( subList->length() == 1 && shapeID == subList[0] ) { + geom = subGeom; + break; + } + } + } + } + } + if ( geom->_is_nil() ) { + // explode GEOM::GEOM_IShapesOperations_var op = geomGen->GetIShapesOperations( GetCurrentStudyID() ); if ( !op->_is_nil() ) @@ -1299,6 +1319,7 @@ SMESH_Gen_i::FindGeometryByMeshElement( SMESH::SMESH_Mesh_ptr theMesh, return geom._retn(); } } + } } return GEOM::GEOM_Object::_nil(); } @@ -2552,6 +2573,7 @@ bool SMESH_Gen_i::Load( SALOMEDS::SComponent_ptr theComponent, } // close hypotheses root HDF group aTopGroup->CloseOnDisk(); + aTopGroup = 0; } // --> then we should read&create algorithms @@ -2651,6 +2673,7 @@ bool SMESH_Gen_i::Load( SALOMEDS::SComponent_ptr theComponent, } // close algorithms root HDF group aTopGroup->CloseOnDisk(); + aTopGroup = 0; } // --> the rest groups should be meshes @@ -3292,7 +3315,8 @@ bool SMESH_Gen_i::Load( SALOMEDS::SComponent_ptr theComponent, } } // close mesh group - aTopGroup->CloseOnDisk(); + if(aTopGroup) + aTopGroup->CloseOnDisk(); } // close HDF file aFile->CloseOnDisk(); @@ -3340,6 +3364,19 @@ void SMESH_Gen_i::Close( SALOMEDS::SComponent_ptr theComponent ) delete myStudyContextMap[ studyId ]; myStudyContextMap.erase( studyId ); } + + // delete SMESH_Mesh's + StudyContextStruct* context = myGen.GetStudyContext( studyId ); + map< int, SMESH_Mesh* >::iterator i_mesh = context->mapMesh.begin(); + for ( ; i_mesh != context->mapMesh.end(); ++i_mesh ) + delete i_mesh->second; + // delete SMESHDS_Mesh's + // it's too long on big meshes +// if ( context->myDocument ) { +// delete context->myDocument; +// context->myDocument = 0; +// } + return; }