Mesh Oriented datABase  (version 5.5.0)
An array-based unstructured mesh library
HDF5Common.cpp
Go to the documentation of this file.
1 #include <HDF5Common.hpp>
2 #include <H5Spublic.h>
3 #include <cassert>
4 
5 namespace moab
6 {
7 
9 {
10  hsize_t dim = 100;
11  hid_t space = H5Screate_simple( 1, &dim, NULL );
12  bool result = false;
13 
14  HDF5_Error_Func_Type fptr = 0;
15  void* fdata = 0;
16 #if defined( H5Eget_auto_vers ) && H5Eget_auto_vers > 1
17  if( 0 <= H5Eget_auto( H5E_DEFAULT, &fptr, &fdata ) ) H5Eset_auto( H5E_DEFAULT, 0, 0 );
18 #else
19  if( 0 <= H5Eget_auto( &fptr, &fdata ) ) H5Eset_auto( 0, 0 );
20 #endif
21 
22  hsize_t start = 1, count = 5;
23  H5Sselect_hyperslab( space, H5S_SELECT_SET, &start, 0, &count, 0 );
24  start = 20;
25  if( 0 <= H5Sselect_hyperslab( space, H5S_SELECT_APPEND, &start, 0, &count, 0 ) ) result = true;
26 
27  if( fptr )
28  {
29 #if defined( H5Eset_auto_vers ) && H5Eset_auto_vers > 1
30  H5Eset_auto( H5E_DEFAULT, fptr, fdata );
31 #else
32  H5Eset_auto( fptr, fdata );
33 #endif
34  }
35  H5Sclose( space );
36 
37  return result;
38 }
39 
40 } // namespace moab