1 // Copyright (C) 2007-2023 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License, or (at your option) any later version.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 // SALOME HDFPersist : implementation of HDF persitent ( save/ restore )
34 HDFgroup *geom, *mesh;
35 HDFgroup *geom1, *geom2, *mesh1, *mesh2;
37 char name[HDF_NAME_MAX_LEN+1];
41 // the groups 'GEOM' and 'MESH' become mounted points for
42 // the files 'geom.hdf' and 'mesh.hdf' in the 'study.hdf' file
44 study = new HDFfile("study.hdf");
45 MESSAGE( ">> The HDFfile object for 'study.hdf' is created" );
47 study->OpenOnDisk(HDF_RDONLY);
48 MESSAGE( "--> The file is opened" );
50 geom = new HDFgroup("GEOM",study);
51 MESSAGE( ">> The HDFgroup object for 'GEOM' is created" );
53 geom->FileMount("geom.hdf",HDF_RDONLY);
54 MESSAGE( ">> 'GEOM' becomes a mounted point for the file 'geom.hdf'" );
57 MESSAGE( "--> The group is opened" );
59 m = geom->nInternalObjects();
60 MESSAGE( "--> There are " << m << " objects in the group" );
64 geom->InternalObjectIndentify(i,name);
65 MESSAGE( "--> First Level Internal Object Name : " << name );
68 geom1 = new HDFgroup("GEOM_1",geom);
69 MESSAGE( ">> The HDF group object is created for 'GEOM_1' with 'GEOM' as father" );
70 MESSAGE( "--> This group is in fact in the file 'geom.hdf'");
73 MESSAGE( "-> The group 'GEOM_1' is opened" );
76 MESSAGE( "-> The group 'GEOM_1' is closed" );
78 geom2 = new HDFgroup("GEOM_2",geom);
79 MESSAGE( ">> The HDF group object is created for 'GEOM_2' with 'GEOM' as father" );
80 MESSAGE( "--> This group is in fact in the file 'geom.hdf'");
83 MESSAGE( "-> The group 'GEOM_2' is opened" );
86 MESSAGE( "-> The group 'GEOM_2' is closed" );
89 MESSAGE( "-> The group 'GEOM' is closed" );
92 MESSAGE( ">> The file 'geom.hdf' is unmounted from 'GEOM' " );
94 mesh = new HDFgroup("MESH",study);
96 mesh->FileMount("mesh.hdf",HDF_RDONLY);
100 mesh1 = new HDFgroup("MESH_1",mesh);
104 mesh1->CloseOnDisk();
106 mesh2 = new HDFgroup("MESH_2",mesh);
110 mesh2->CloseOnDisk();
116 MESSAGE( ">> The same operations have been done for the file 'mesh.hdf'" )
117 MESSAGE( " and the groups MESH_1 and MESH_2" )
118 MESSAGE( "--> This file has been mounted on the group 'MESH' of the file 'study.hdf' ")
120 study->CloseOnDisk();
121 MESSAGE( ">> The study.hdf file is closed" );
123 MESSAGE( ">> Memory clean" );
134 MESSAGE( "!!! HDFexception !!! ")