+ hdf_group[2]->CloseOnDisk();
+ MESSAGE("End of Algos Save");
+
+ }
+//************branch 3 : meshes
+ else if (gotBranch->Tag() >= 3)
+ { //meshes = tag > 3
+
+ SALOMEDS::GenericAttribute_var anAttr;
+ SALOMEDS::AttributeIOR_var anIOR;
+ if (gotBranch->FindAttribute(anAttr, "AttributeIOR"))
+ {
+ anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
+
+ SMESH::SMESH_Mesh_var myMesh =
+ SMESH::SMESH_Mesh::_narrow(_orb->string_to_object(anIOR->
+ Value()));
+ studyId = myMesh->GetStudyId();
+ SCRUTE(studyId);
+
+ StudyContext_iStruct *myStudyContext =
+ _mapStudyContext_i[studyId];
+ int meshId = myMesh->GetId();
+ SMESH_Mesh_i *meshServant = myStudyContext->mapMesh_i[meshId];
+ ::SMESH_Mesh & myLocMesh = meshServant->GetImpl();
+ SMESHDS_Mesh *mySMESHDSMesh = myLocMesh.GetMeshDS();
+
+ SCRUTE(mySMESHDSMesh->NbNodes());
+ if (mySMESHDSMesh->NbNodes() > 0)
+ {
+ //checks if the mesh is not empty
+ Mesh_Writer *myWriter = SMESHDriver::GetMeshWriter("MED");
+ myWriter->SetFile(meshfile.ToCString());
+ myWriter->SetMesh(mySMESHDSMesh);
+ myWriter->SetMeshId(gotBranch->Tag());
+ myWriter->Add();
+ }
+ else
+ meshfile = "No data";
+
+ //********** opening of the HDF group
+ sprintf(name_meshgroup, "Mesh %d", gotBranch->Tag());
+ SCRUTE(name_meshgroup);
+ hdf_group[gotBranch->Tag()] =
+ new HDFgroup(name_meshgroup, hdf_file);
+ hdf_group[gotBranch->Tag()]->CreateOnDisk();
+ //**********
+
+ //********** file where the data are stored
+ longueur = strlen(meshfile.ToCString()) + 1;
+ size[0] = longueur;
+ strcpy(name_dataset, "Mesh data");
+ hdf_dataset[cmpt_ds] =
+ new HDFdataset(name_dataset, hdf_group[gotBranch->Tag()],
+ HDF_STRING, size, 1);
+ hdf_dataset[cmpt_ds]->CreateOnDisk();
+ hdf_dataset[cmpt_ds]->WriteOnDisk(meshfile.ToCString());
+ hdf_dataset[cmpt_ds]->CloseOnDisk();
+ cmpt_ds++;
+ //**********
+
+ //********** ref on shape
+ Standard_CString myRefOnObject = "";
+ SALOMEDS::SObject_var myRef, myShape;
+ _found = gotBranch->FindSubObject(Tag_RefOnShape, myRef);
+ if (_found)
+ {
+ ok = myRef->ReferencedObject(myShape);
+ myRefOnObject = myShape->GetID();
+ SCRUTE(myRefOnObject);
+
+ longueur = strlen(myRefOnObject) + 1;
+ if (longueur > 1)
+ {
+ size[0] = longueur;
+ strcpy(name_dataset, "Ref on shape");
+ hdf_dataset[cmpt_ds] =
+ new HDFdataset(name_dataset,
+ hdf_group[gotBranch->Tag()], HDF_STRING, size, 1);
+ hdf_dataset[cmpt_ds]->CreateOnDisk();
+ hdf_dataset[cmpt_ds]->WriteOnDisk(myRefOnObject);
+ hdf_dataset[cmpt_ds]->CloseOnDisk();
+ cmpt_ds++;
+
+ }
+ }
+ //**********
+
+ //********** ref on applied hypothesis
+ _found =
+ gotBranch->FindSubObject(Tag_RefOnAppliedHypothesis,
+ myBranch);
+ if (_found)
+ {
+
+ strcpy(name_meshgroup, "Applied Hypothesis");
+ hdf_subgroup[Tag_RefOnAppliedHypothesis] =
+ new HDFgroup(name_meshgroup,
+ hdf_group[gotBranch->Tag()]);
+ hdf_subgroup[Tag_RefOnAppliedHypothesis]->CreateOnDisk();
+
+ it = Study->NewChildIterator(myBranch);
+ cmpt_it = 0;
+ for (; it->More(); it->Next())
+ {
+ mySObject = it->Value();
+ ok = mySObject->ReferencedObject(myRef);
+ myRefOnObject = myRef->GetID();
+
+ longueur = strlen(myRefOnObject) + 1;
+ if (longueur > 1)
+ {
+ size[0] = longueur;
+ sprintf(name_dataset, "Hyp %d", cmpt_it);
+ hdf_dataset[cmpt_ds] =
+ new HDFdataset(name_dataset,
+ hdf_subgroup[Tag_RefOnAppliedHypothesis],
+ HDF_STRING, size, 1);
+ hdf_dataset[cmpt_ds]->CreateOnDisk();
+ hdf_dataset[cmpt_ds]->WriteOnDisk(myRefOnObject);
+ hdf_dataset[cmpt_ds]->CloseOnDisk();
+ }
+ cmpt_ds++;
+ cmpt_it++;
+ }
+ hdf_subgroup[Tag_RefOnAppliedHypothesis]->CloseOnDisk();
+ }
+ //**********
+
+ //********** ref on applied algorithms
+ _found =
+ gotBranch->FindSubObject(Tag_RefOnAppliedAlgorithms,
+ myBranch);
+ if (_found)
+ {
+
+ strcpy(name_meshgroup, "Applied Algorithms");
+ hdf_subgroup[Tag_RefOnAppliedAlgorithms] =
+ new HDFgroup(name_meshgroup,
+ hdf_group[gotBranch->Tag()]);
+ hdf_subgroup[Tag_RefOnAppliedAlgorithms]->CreateOnDisk();
+
+ it = Study->NewChildIterator(myBranch);
+ cmpt_it = 0;
+ for (; it->More(); it->Next())
+ {
+ mySObject = it->Value();
+ ok = mySObject->ReferencedObject(myRef);
+ myRefOnObject = myRef->GetID();
+
+ longueur = strlen(myRefOnObject) + 1;
+ if (longueur > 1)
+ {
+ size[0] = longueur;
+ sprintf(name_dataset, "Algo %d", cmpt_it);
+ hdf_dataset[cmpt_ds] =
+ new HDFdataset(name_dataset,
+ hdf_subgroup[Tag_RefOnAppliedAlgorithms],
+ HDF_STRING, size, 1);
+ hdf_dataset[cmpt_ds]->CreateOnDisk();
+ hdf_dataset[cmpt_ds]->WriteOnDisk(myRefOnObject);
+ hdf_dataset[cmpt_ds]->CloseOnDisk();
+ }
+ cmpt_ds++;
+ cmpt_it++;
+ }
+ hdf_subgroup[Tag_RefOnAppliedAlgorithms]->CloseOnDisk();
+ }
+ MESSAGE("end of algo applied");
+ //**********
+
+ //********** submeshes on subshapes
+ int myLevel1Tag;
+ for (int i = Tag_SubMeshOnVertex; i <= Tag_SubMeshOnCompound;
+ i++)
+ {
+ _found = gotBranch->FindSubObject(i, myBranch);
+ if (_found)
+ {
+ if (i == Tag_SubMeshOnVertex)
+ strcpy(name_meshgroup, "SubMeshes On Vertex");
+ else if (i == Tag_SubMeshOnEdge)
+ strcpy(name_meshgroup, "SubMeshes On Edge");
+ else if (i == Tag_SubMeshOnFace)
+ strcpy(name_meshgroup, "SubMeshes On Face");
+ else if (i == Tag_SubMeshOnSolid)
+ strcpy(name_meshgroup, "SubMeshes On Solid");
+ else if (i == Tag_SubMeshOnCompound)
+ strcpy(name_meshgroup, "SubMeshes On Compound");
+
+ cmpt_sm++;
+ myLevel1Tag = 10 + cmpt_sm;
+ hdf_subgroup[myLevel1Tag] =
+ new HDFgroup(name_meshgroup,
+ hdf_group[gotBranch->Tag()]);
+ hdf_subgroup[myLevel1Tag]->CreateOnDisk();
+
+ itSM = Study->NewChildIterator(myBranch);
+ for (; itSM->More(); itSM->Next())
+ { //Loop on all submeshes
+ mySObject = itSM->Value();
+ cmpt_sm++;
+ myTag = 10 + cmpt_sm;
+ mySObject->FindAttribute(anAttr, "AttributeIOR");
+ anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
+ SMESH::SMESH_subMesh_var mySubMesh =
+ SMESH::SMESH_subMesh::_narrow(_orb->
+ string_to_object(anIOR->Value()));
+
+ //sprintf(name_meshgroup,"SubMesh %d",myTag);
+ sprintf(name_meshgroup, "SubMesh %ld",
+ mySubMesh->GetId());
+ SCRUTE(name_meshgroup);
+
+ hdf_subgroup[myTag] =
+ new HDFgroup(name_meshgroup,
+ hdf_subgroup[myLevel1Tag]);
+ hdf_subgroup[myTag]->CreateOnDisk();
+
+ //********** ref on shape
+ Standard_CString myRefOnObject = "";
+ SALOMEDS::SObject_var myRef, myShape;
+ bool _found2;
+ _found2 =
+ mySObject->FindSubObject(Tag_RefOnShape, myRef);
+ if (_found2)
+ {
+ ok = myRef->ReferencedObject(myShape);
+ myRefOnObject = myShape->GetID();
+ SCRUTE(myRefOnObject);
+
+ longueur = strlen(myRefOnObject) + 1;
+ if (longueur > 1)
+ {
+ size[0] = longueur;
+ strcpy(name_dataset, "Ref on shape");
+ hdf_dataset[cmpt_ds] =
+ new HDFdataset(name_dataset,
+ hdf_subgroup[myTag], HDF_STRING, size,
+ 1);
+ hdf_dataset[cmpt_ds]->CreateOnDisk();
+ hdf_dataset[cmpt_ds]->
+ WriteOnDisk(myRefOnObject);
+ hdf_dataset[cmpt_ds]->CloseOnDisk();
+ cmpt_ds++;
+ }
+ }
+ //**********
+
+ //********** ref on applied hypothesis
+ _found2 =
+ mySObject->
+ FindSubObject(Tag_RefOnAppliedHypothesis,
+ myBranch);
+ if (_found2)
+ {
+
+ strcpy(name_meshgroup, "Applied Hypothesis");
+ cmpt_sm++;
+ hdf_subgroup[10 + cmpt_sm] =
+ new HDFgroup(name_meshgroup,
+ hdf_subgroup[myTag]);
+ hdf_subgroup[10 + cmpt_sm]->CreateOnDisk();
+
+ it = Study->NewChildIterator(myBranch);
+ cmpt_it = 0;
+ for (; it->More(); it->Next())
+ {
+ mySObjectChild = it->Value();
+ ok = mySObjectChild->
+ ReferencedObject(myRef);
+ myRefOnObject = myRef->GetID();
+
+ longueur = strlen(myRefOnObject) + 1;
+ if (longueur > 1)
+ {
+ size[0] = longueur;
+ sprintf(name_dataset, "Hyp %d",
+ cmpt_it);
+ SCRUTE(cmpt_it);
+ hdf_dataset[cmpt_ds] =
+ new HDFdataset(name_dataset,
+ hdf_subgroup[10 + cmpt_sm],
+ HDF_STRING, size, 1);
+ hdf_dataset[cmpt_ds]->CreateOnDisk();
+ hdf_dataset[cmpt_ds]->
+ WriteOnDisk(myRefOnObject);
+ hdf_dataset[cmpt_ds]->CloseOnDisk();
+ }
+ cmpt_ds++;
+ cmpt_it++;
+ }
+ hdf_subgroup[10 + cmpt_sm]->CloseOnDisk();
+ }
+ //**********
+
+ //********** ref on applied algorithms
+ _found2 =
+ mySObject->
+ FindSubObject(Tag_RefOnAppliedAlgorithms,
+ myBranch);
+ SCRUTE(_found2);
+ if (_found2)
+ {
+
+ strcpy(name_meshgroup, "Applied Algorithms");
+ cmpt_sm++;
+ hdf_subgroup[10 + cmpt_sm] =
+ new HDFgroup(name_meshgroup,
+ hdf_subgroup[myTag]);
+ hdf_subgroup[10 + cmpt_sm]->CreateOnDisk();
+
+ it = Study->NewChildIterator(myBranch);
+ cmpt_it = 0;
+ for (; it->More(); it->Next())
+ {
+ mySObjectChild = it->Value();
+ ok = mySObjectChild->
+ ReferencedObject(myRef);
+ myRefOnObject = myRef->GetID();
+
+ longueur = strlen(myRefOnObject) + 1;
+ if (longueur > 1)
+ {
+ size[0] = longueur;
+ sprintf(name_dataset, "Algo %d",
+ cmpt_it);
+ hdf_dataset[cmpt_ds] =
+ new HDFdataset(name_dataset,
+ hdf_subgroup[10 + cmpt_sm],
+ HDF_STRING, size, 1);
+ hdf_dataset[cmpt_ds]->CreateOnDisk();
+ hdf_dataset[cmpt_ds]->
+ WriteOnDisk(myRefOnObject);
+ hdf_dataset[cmpt_ds]->CloseOnDisk();
+ }
+ cmpt_ds++;
+ cmpt_it++;
+ }
+ hdf_subgroup[10 + cmpt_sm]->CloseOnDisk();
+ }
+ //MESSAGE("end of algo applied");
+ //**********
+
+ hdf_subgroup[myTag]->CloseOnDisk();
+ }
+
+ hdf_subgroup[myLevel1Tag]->CloseOnDisk();
+ }
+
+ }
+ //**********
+
+ //********** closing of the HDF group
+ hdf_group[gotBranch->Tag()]->CloseOnDisk();
+ MESSAGE("End of Mesh Save");
+ //**********
+ }
+ }
+ MESSAGE("End of Meshes Save");