PAL10195: SALOME V2 study with a mesh leads to SIGSEGV of SALOME V3

This commit is contained in:
jfa 2005-10-11 06:54:28 +00:00
parent d89db6381d
commit 1d0ad233cf

View File

@ -1544,15 +1544,14 @@ SALOMEDS::TMPFile* SMESH_Gen_i::Save( SALOMEDS::SComponent_ptr theComponent,
// Write datasets // Write datasets
if ( nbNodes ) if ( nbNodes )
{ {
aSize[ 0 ] = nbNodes*sizeof(int); aSize[ 0 ] = nbNodes;
// IDS // IDS
string aDSName( onFace ? "Nodes on Faces" : "Nodes on Edges"); string aDSName( onFace ? "Nodes on Faces" : "Nodes on Edges");
aDataset = new HDFdataset( (char*)aDSName.c_str(), aGroup, HDF_STRING, aSize, 1 ); aDataset = new HDFdataset( (char*)aDSName.c_str(), aGroup, HDF_INT32, aSize, 1 );
aDataset->CreateOnDisk(); aDataset->CreateOnDisk();
aDataset->WriteOnDisk( aNodeIDs ); aDataset->WriteOnDisk( aNodeIDs );
aDataset->CloseOnDisk(); aDataset->CloseOnDisk();
aSize[ 0 ] = nbNodes;
// U Positions // U Positions
aDSName = ( onFace ? "Face U positions" : "Edge positions"); aDSName = ( onFace ? "Face U positions" : "Edge positions");
aDataset = new HDFdataset( (char*)aDSName.c_str(), aGroup, HDF_FLOAT64, aSize, 1); aDataset = new HDFdataset( (char*)aDSName.c_str(), aGroup, HDF_FLOAT64, aSize, 1);
@ -2219,7 +2218,7 @@ bool SMESH_Gen_i::Load( SALOMEDS::SComponent_ptr theComponent,
if(hasData) { if(hasData) {
// Read sub-meshes from MED // Read sub-meshes from MED
if(MYDEBUG) MESSAGE("JFA - Create all sub-meshes"); if(MYDEBUG) MESSAGE("Create all sub-meshes");
myReader.CreateAllSubMeshes(); myReader.CreateAllSubMeshes();
@ -2272,10 +2271,12 @@ bool SMESH_Gen_i::Load( SALOMEDS::SComponent_ptr theComponent,
} }
else // NODE IDS else // NODE IDS
{ {
//PAL10195:int aSize = aDataset->GetSize()/sizeof(int); int aSize = aDataset->GetSize();
int aSize = aDataset->GetSize(); //PAL10195
if (aDataset->GetType() == HDF_STRING) //PAL10195 // for reading files, created from 18.07.2005 till 10.10.2005
aSize /= sizeof(int); //PAL10195 if (aDataset->GetType() == HDF_STRING)
aSize /= sizeof(int);
int* ids = new int [aSize]; int* ids = new int [aSize];
aDataset->ReadFromDisk( ids ); aDataset->ReadFromDisk( ids );
// on face or nodes? // on face or nodes?
@ -2333,11 +2334,11 @@ bool SMESH_Gen_i::Load( SALOMEDS::SComponent_ptr theComponent,
// Recompute State (as computed sub-meshes are restored from MED) // Recompute State (as computed sub-meshes are restored from MED)
if ( !aShapeObject->_is_nil() ) { if ( !aShapeObject->_is_nil() ) {
MESSAGE("JFA - Compute State Engine ..."); MESSAGE("Compute State Engine ...");
TopoDS_Shape myLocShape = GeomObjectToShape( aShapeObject ); TopoDS_Shape myLocShape = GeomObjectToShape( aShapeObject );
myNewMeshImpl->GetImpl().GetSubMesh(myLocShape)->ComputeStateEngine myNewMeshImpl->GetImpl().GetSubMesh(myLocShape)->ComputeStateEngine
(SMESH_subMesh::SUBMESH_RESTORED); (SMESH_subMesh::SUBMESH_RESTORED);
MESSAGE("JFA - Compute State Engine finished"); MESSAGE("Compute State Engine finished");
} }
// try to get groups // try to get groups