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=5724095a89cc6d565c0e9a3823c29d723704b488;hp=25f0c2c7faa0c680b485a26728beeae876271157;hb=3785fda32c59dfa7cf1ac7c680cc185be0bdcdfc;hpb=b7a7d49664daa32e1befb558280e13ed0bde37c9 diff --git a/src/SMESH_I/SMESH_Gen_i.cxx b/src/SMESH_I/SMESH_Gen_i.cxx index 25f0c2c7f..5724095a8 100644 --- a/src/SMESH_I/SMESH_Gen_i.cxx +++ b/src/SMESH_I/SMESH_Gen_i.cxx @@ -1930,7 +1930,7 @@ CORBA::Boolean SMESH_Gen_i::Compute( SMESH::SMESH_Mesh_ptr theMesh, ASSERT( meshServant ); if ( meshServant ) { meshServant->Load(); - // NPAL16168: "geometrical group edition from a submesh don't modifiy mesh computation" + // NPAL16168: "geometrical group edition from a submesh don't modify mesh computation" meshServant->CheckGeomModif(); // get local TopoDS_Shape TopoDS_Shape myLocShape; @@ -1947,6 +1947,7 @@ CORBA::Boolean SMESH_Gen_i::Compute( SMESH::SMESH_Mesh_ptr theMesh, bool ok = myGen.Compute( myLocMesh, myLocShape, how ); meshServant->CreateGroupServants(); // algos can create groups (issue 0020918) myLocMesh.GetMeshDS()->Modified(); + UpdateIcons( theMesh ); return ok; } } @@ -2015,7 +2016,7 @@ SMESH::MeshPreviewStruct* SMESH_Gen_i::Precompute( SMESH::SMESH_Mesh_ptr theMesh meshServant->Load(); ASSERT( meshServant ); if ( meshServant ) { - // NPAL16168: "geometrical group edition from a submesh don't modifiy mesh computation" + // NPAL16168: "geometrical group edition from a submesh don't modify mesh computation" meshServant->CheckGeomModif(); // get local TopoDS_Shape TopoDS_Shape myLocShape; @@ -2212,7 +2213,7 @@ SMESH::long_array* SMESH_Gen_i::Evaluate(SMESH::SMESH_Mesh_ptr theMesh, ASSERT( meshServant ); if ( meshServant ) { meshServant->Load(); - // NPAL16168: "geometrical group edition from a submesh don't modifiy mesh computation" + // NPAL16168: "geometrical group edition from a submesh don't modify mesh computation" meshServant->CheckGeomModif(); // get local TopoDS_Shape TopoDS_Shape myLocShape; @@ -2958,7 +2959,7 @@ char* SMESH_Gen_i::GetMEDVersion(const char* theFileName) /*! * SMESH_Gen_i::CheckCompatibility * - * Check compatibility of file with MED format being used. + * Check compatibility of file with MED format being used, read only. */ //================================================================================ CORBA::Boolean SMESH_Gen_i::CheckCompatibility(const char* theFileName) @@ -2966,6 +2967,18 @@ CORBA::Boolean SMESH_Gen_i::CheckCompatibility(const char* theFileName) return MED::CheckCompatibility( theFileName ); } +//================================================================================ +/*! + * SMESH_Gen_i::CheckWriteCompatibility + * + * Check compatibility of file with MED format being used, for append on write. + */ +//================================================================================ +CORBA::Boolean SMESH_Gen_i::CheckWriteCompatibility(const char* theFileName) +{ + return MED::CheckCompatibility( theFileName, true ); +} + //================================================================================ /*! * SMESH_Gen_i::GetMeshNames @@ -2975,10 +2988,12 @@ CORBA::Boolean SMESH_Gen_i::CheckCompatibility(const char* theFileName) //================================================================================ SMESH::string_array* SMESH_Gen_i::GetMeshNames(const char* theFileName) { + //MESSAGE("GetMeshNames " << theFileName); SMESH::string_array_var aResult = new SMESH::string_array(); MED::PWrapper aMed = MED::CrWrapperR( theFileName ); MED::TErr anErr; MED::TInt aNbMeshes = aMed->GetNbMeshes( &anErr ); + //MESSAGE("---" << aNbMeshes); if( anErr >= 0 ) { aResult->length( aNbMeshes ); for( MED::TInt i = 0; i < aNbMeshes; i++ ) { @@ -3074,7 +3089,6 @@ SALOMEDS::TMPFile* SMESH_Gen_i::Save( SALOMEDS::SComponent_ptr theComponent, myMesh->Load(); // load from study file if not yet done TPythonDump pd; // not to dump GetGroups() SMESH::ListOfGroups_var groups = myMesh->GetGroups(); - pd << ""; // to avoid optimizing pd out for ( CORBA::ULong i = 0; i < groups->length(); ++i ) { SMESH_GroupBase_i* grImpl = SMESH::DownCast( groups[i]); @@ -3328,6 +3342,17 @@ SALOMEDS::TMPFile* SMESH_Gen_i::Save( SALOMEDS::SComponent_ptr theComponent, } } + // Store file info + std::string info = myImpl->FileInfoToString(); + if ( !info.empty() ) + { + aSize[ 0 ] = info.size(); + aDataset = new HDFdataset( "file info", aTopGroup, HDF_STRING, aSize, 1 ); + aDataset->CreateOnDisk(); + aDataset->WriteOnDisk( (char*) info.data() ); + aDataset->CloseOnDisk(); + } + // write applied hypotheses if exist SALOMEDS::SObject_wrap myHypBranch; found = gotBranch->FindSubObject( GetRefOnAppliedHypothesisTag(), myHypBranch.inout() ); @@ -4001,7 +4026,7 @@ bool SMESH_Gen_i::Load( SALOMEDS::SComponent_ptr theComponent, const char* theURL, bool isMultiFile ) { - if (!myStudyContext) + //if (!myStudyContext) UpdateStudy(); SALOMEDS::Study_var aStudy = getStudyServant(); /* if( !theComponent->_is_nil() ) @@ -4352,6 +4377,18 @@ bool SMESH_Gen_i::Load( SALOMEDS::SComponent_ptr theComponent, myNewMeshImpl->GetImpl().GetMeshDS()->SetPersistentId( *meshPersistentId ); delete [] meshPersistentId; } + + // Restore file info + if ( aTopGroup->ExistInternalObject( "file info" )) + { + aDataset = new HDFdataset( "file info", aTopGroup ); + aDataset->OpenOnDisk(); + size = aDataset->GetSize(); + std::string info( size, ' '); + aDataset->ReadFromDisk( (char*) info.data() ); + aDataset->CloseOnDisk(); + myNewMeshImpl->FileInfoFromString( info ); + } } } } // reading MESHes