Salome HOME
Merge branch 'omu/multijob'
[modules/kernel.git] / src / HDFPersist / test5.cxx
1 // Copyright (C) 2007-2020  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
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.
10 //
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.
15 //
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
19 //
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22
23 //  SALOME HDFPersist : implementation of HDF persitent ( save/ restore )
24 //  File   : test5.cxx
25 //  Module : SALOME
26 //
27 #include <iostream.h>
28 #include "HDFOI.hxx"
29 #include <stdlib.h>
30
31
32 int main()
33 {
34   HDFfile *hdf_file;
35   HDFgroup *hdf_group;
36
37   try
38   {
39     // A file study.hdf with 2 groups : MESH and GEOM
40     hdf_file = new HDFfile("study.hdf");
41
42     hdf_file->CreateOnDisk();
43
44     hdf_group = new HDFgroup("GEOM",hdf_file);
45
46     hdf_group->CreateOnDisk();
47
48     hdf_group->CloseOnDisk();
49
50     delete hdf_group;
51
52     hdf_group = new HDFgroup("MESH",hdf_file); 
53
54     hdf_group->CreateOnDisk();
55
56     hdf_group->CloseOnDisk();
57
58     delete hdf_group;    
59
60     hdf_file->CloseOnDisk();
61     
62     delete hdf_file;
63
64     // a file mesh.hdf with 2 groups MESH_1 and MESH_2
65     hdf_file = new HDFfile("mesh.hdf");
66
67     hdf_file->CreateOnDisk();
68
69     hdf_group = new HDFgroup("MESH_1",hdf_file);
70
71     hdf_group->CreateOnDisk();
72
73     hdf_group->CloseOnDisk();
74
75     delete hdf_group;
76
77     hdf_group = new HDFgroup("MESH_2",hdf_file);
78
79     hdf_group->CreateOnDisk();
80
81     hdf_group->CloseOnDisk();
82
83     delete hdf_group;    
84
85     hdf_file->CloseOnDisk();
86     
87     delete hdf_file;
88
89     // a file geom.hdf with 2 groups GEOM_1 and GEOM_2
90     hdf_file = new HDFfile("geom.hdf");
91
92     hdf_file->CreateOnDisk();
93
94     hdf_group = new HDFgroup("GEOM_1",hdf_file);
95
96     hdf_group->CreateOnDisk();
97
98     hdf_group->CloseOnDisk();
99
100     delete hdf_group;
101
102     hdf_group = new HDFgroup("GEOM_2",hdf_file);
103
104     hdf_group->CreateOnDisk();
105
106     hdf_group->CloseOnDisk();
107
108     delete hdf_group;    
109
110     hdf_file->CloseOnDisk();
111     
112     delete hdf_file;
113   }
114   catch (HDFexception)
115     {
116       MESSAGE( "!!!! HDFexception !!!" )
117     }
118
119   return 0;
120 }