Compare commits

..

202 Commits

Author SHA1 Message Date
gsell 7fbd5c5de1 configure.ac: set version to 2.0.0rc1; correct indentation 2016-05-20 18:08:44 +02:00
gsell 18611991a5 Python support added 2016-05-12 13:19:51 +02:00
gsell 603366bcd6 src/h5t_io.c
- format errors fixed
- bugfixes
2016-04-29 18:10:25 +02:00
gsell 17317bb261 ignore file changed 2016-04-29 16:34:33 +02:00
gsell 52d44e3b3c - re-organize file hierarchy
- years in copyright changed
2016-04-29 16:34:07 +02:00
gsell 3d6230629c some missing query function implemented, see issue#1 in Gitlab 2016-04-22 18:06:58 +02:00
gsell 44ffea4fd5 examples/H5Block/write_field.c: H5hut file renamed to example_field.h5 2016-04-15 19:02:15 +02:00
gsell 97516866c7 examples/H5Block: attach_field_attribs and dump_field_attribs added 2016-04-15 19:01:00 +02:00
gsell 1dfcd9f876 fixes for hdf5 1.10.x 2016-04-15 18:58:10 +02:00
gsell 2dd2c625b7 .gitignore: has_field added 2016-04-08 19:07:52 +02:00
gsell 3137063d22 example/H5Block:
- has_field.c added
2016-04-08 19:06:42 +02:00
gsell 9a16fa090a example/H5Block/write_field.c:
- slice in Z direction
2016-04-08 19:06:15 +02:00
gsell df0750df4c examples/H5Block/read_write_scalar_field.c:
- cleanup
2016-04-07 11:11:00 +02:00
gsell b69aa9b92d example/H5Block
- write_field added
2016-04-07 11:10:22 +02:00
gsell 99699d4bf7 documentation updated 2016-04-01 19:12:34 +02:00
gsell 9df1a57778 src/h5core/h5b_model.c:
- h5b_has_field() added
2016-04-01 19:12:15 +02:00
gsell 1ed4f3985b src/include/H5Block_attribs.h: documentation updated 2016-03-30 18:05:15 +02:00
gsell 2c850612ab functions added to query existence of file-, step-. field-attributes amd to get information by name 2016-03-29 17:49:32 +02:00
gsell bc528f27e6 more cleanup on header files 2016-03-29 15:30:30 +02:00
gsell 5444b0e0ef .gitignore: vtk2h5grid added 2016-03-29 14:57:09 +02:00
gsell ae9e4cee01 C header files:
- cleanup
2016-03-29 14:55:35 +02:00
gsell 7490eed535 tools/vtk2h5grid/Makefile.am:
- libH5hut library path changed
2016-03-29 14:49:09 +02:00
gsell 84fa4a0b0a Merge branch 'master' of git.psi.ch:H5hut/src 2016-03-29 10:47:23 +02:00
gsell 718ef785f8 doc/H5.dox: re-structured 2016-03-29 10:46:35 +02:00
gsell 7002b73e82 src/{Fortran,h5core}/Makefile.am:
- do not install the libs in src/lib
2016-03-23 22:01:55 +01:00
gsell 2a8a43af39 src/include/H5_debug.f90:
- h5_set_debug_mask(): bugfix
2016-03-23 21:51:00 +01:00
gsell f0c2f29091 src/include/H5hut.f90:
- bugfix in included files
2016-03-23 21:50:10 +01:00
gsell 5362498a95 src/include/H5_const.f90:
- bugfix in definition of H5_FAILED
2016-03-23 21:49:34 +01:00
gsell 851905361d src/Fortran/H5.c:
- h5_setprop_file_corevfd(): bugfix
2016-03-23 21:47:40 +01:00
gsell 3c8b11f9eb src/{C,Fortran}/Makefile.am:
- include_HEADERS fixed
2016-03-23 21:46:37 +01:00
gsell 4dde2b61d2 COPYING:
- year in copyright changed to 2016
2016-03-23 21:45:25 +01:00
gsell d980f4d2b9 header files and documentation reorganized and reviewed 2016-03-18 17:58:30 +01:00
gsell 3f7c84dbf5 header files and documentation reorganized 2016-03-18 16:37:13 +01:00
gsell c5a05a1261 year in copyright changed 2016-03-18 14:25:30 +01:00
gsell 230f9a7b90 year in copyright changed 2016-03-18 14:23:49 +01:00
gsell 2cd718b7a1 src/include/h5core/h5.h:
- h5_open_file1() return type is 'h5_file_p' not 'h5_file_t'
2016-03-18 11:29:36 +01:00
gsell c73d10ffb7 src/include/H5Fed_model.h:
- syntax errors fixed
2016-03-18 11:28:40 +01:00
gsell 6209bc6cf9 src/include/H5.h:
- bugfixes in H5OpenFile1() and H5GetVerbosityLevel1()
2016-03-18 11:27:29 +01:00
gsell a013d43075 src/h5core/h5_openclose.c:
- h5_open_file1(): fix return type
2016-03-18 11:26:21 +01:00
gsell f151a24796 examples/H5Part/{read,write}_core_vfd.c:
- missing 'incr' argument added to H5SetPropFileCoreVFD() call
2016-03-18 11:25:25 +01:00
gsell 9d37783868 examples/H5Block/fields.c:
- include H5hut.h
- write dims in right order
2016-03-18 11:24:08 +01:00
gsell a8444e041b examples/H5/read_file_attribs():
- type cast fixed
2016-03-18 11:22:38 +01:00
gsell dc9723dfe2 examples/H5/openclose.c
- H5SetPropFileMPIO() renamed to H5SetFileMPIOCollective()
2016-03-18 11:21:53 +01:00
gsell 91e7ed8c5b test/*:
- H5SetPropFileMPIO() renamed to H5SetPropFileMPIOCollective()
2016-03-18 11:04:11 +01:00
gsell b284ad9776 src/h5core/h5_attach.c:
- in h5_get_attachment(): redundant check of file mode removed
2016-03-17 17:55:41 +01:00
gsell f965ed4f18 src/h5core/*:
- all *_has_* functions: return TRUE, FALSE or H5_FAILURE
2016-03-17 17:53:32 +01:00
gsell 91316f314d src/include/*:
- update/review documentation
- re-introduce old API functions
2016-03-17 17:50:42 +01:00
gsell 538c9cdd76 src/h5core/h5u_model.c:
- h5u_has_view() now returns H5_SUCCESS or H5_NOK
2016-03-11 17:54:54 +01:00
gsell 28fc118118 src/h5core/h5b_model.c:
- h5b_3d_has_view() now returns H5_SUCCESS or H5_NOK
2016-03-11 17:53:30 +01:00
gsell 59fd8ea6c6 increment can now be specified for the core vfd driver 2016-03-11 17:51:17 +01:00
gsell 1273baf99e src/include/*:
- doxgen documentation reviewed
2016-03-11 17:49:09 +01:00
gsell befaccddaf doc/H5.dox:
- document structure reviewed
2016-03-11 17:48:37 +01:00
gsell 5204cb532b sdoc/Doxyfile
- reviewed
2016-03-11 17:47:59 +01:00
gsell 9917f12d96 .gitignore:
- ignore doxygen output
2016-03-11 17:46:54 +01:00
gsell 4b1d719d6c src/include/H5.h,H5Block_attribs.h:
- add/review documentation
2016-02-12 17:39:46 +01:00
gsell 43bc72b7d0 src/h5core/h5_openclose.c:
- typo fixed
2016-02-12 17:31:47 +01:00
gsell 64b4a3be09 doc/H5.dox:
- update author list
- minor changes in overall structure
2016-02-12 17:31:19 +01:00
gsell f4e7defffa doc/DoxygenLayout.xml:
- deleted
2016-02-12 17:30:38 +01:00
gsell 320fd77398 doc/Doxyfile:
- changes required by new Doxygen version
- parse only files in src/include
- enable static function
2016-02-12 17:29:32 +01:00
gsell 5714c390ec examples/*:
- type cast malloc() result
2016-02-09 10:10:57 +01:00
gsell a07d4101a2 examples/H5Block/read_write_scalar_field.c:
- type cast malloc(2) return value to make C++ happy
2016-02-09 09:55:17 +01:00
gsell 56787866fb test wheter I can commit again 2016-01-18 13:22:28 +01:00
gsell fb3b876f78 ignore zipped tar-balls 2016-01-18 13:18:55 +01:00
gsell e4ebb0f453 Makefiles.am's:
- missing head-files added
2015-10-16 18:39:35 +02:00
gsell 51f2210ff1 test/h5b_test.c:
- run  tests 'write2' and 'read2' only in parallel case
2015-10-16 18:16:27 +02:00
gsell 511fbb89de src/h5core/h5b_model.c:
- h5b_3d_set_view(): bugfix in serial code
2015-10-16 18:14:27 +02:00
gsell 87fcc4930b h5core:
- H5_VER_STRING defined from PACKAGE_VERSION as const char*
2015-10-16 18:13:18 +02:00
gsell 49460b62c3 examples:
- compile Fortran examples only if parallel is enabled
2015-10-16 18:11:56 +02:00
gsell 8ae12f7ee9 configure.ac
- copyright notice added
- set version to 1.99.15rc1
2015-10-16 18:10:46 +02:00
gsell ca7dd3b99c examples/H5Part/read_strided{.c,f.f90}
- compute and set a canonical view
2015-10-16 16:02:17 +02:00
gsell 6efdfce033 examples/H5Part/read_setnparticles{.c,f.f90}
- changes in comment lines
2015-10-16 16:01:32 +02:00
gsell 55cc6bb7d0 src/h5core/h5u_model.c
- h5u_set_num_points(): print start index of view if debug enabled
2015-10-16 15:59:24 +02:00
gsell 4fcc1ed3b3 .gitignore
- *.dSYM added
2015-10-16 15:58:12 +02:00
gsell 23bb1ced99 examples/H5Part/read_strided.c
- bugfix in printing data
2015-10-16 13:57:20 +02:00
gsell 1f629ee7f8 examples:
- output format warnings fixed
2015-10-15 17:29:18 +02:00
gsell 3c825fc71d src/Fortran/h5_private.h
- we do not have Underscore.h any more
2015-10-15 17:28:31 +02:00
gsell 089dc3e1ba src/Fortran:
- debug output warnings fixed
2015-10-15 17:27:51 +02:00
gsell 158fc17a2b src/h5core/h5t_octree_private.h
- include 'mpi.h' if PARALLEL_IO is set
2015-10-08 17:51:03 +02:00
gsell 149c144eee examples
- several simple fixes
2015-10-08 16:58:05 +02:00
gsell 4e42972ebb src/include/h5core/h5.h
- typedef MPI_Comm to int if we compile serial code
- suppress warning about unused variables in definition of MPI_Comm_size() and MPI_Comm_rank()
2015-10-08 16:57:12 +02:00
gsell 73c07240c2 .gitignore
- more to ignore
2015-10-08 16:28:47 +02:00
gsell e637522073 example/H5Fed
- fixes
- adapted to new API
2015-10-08 16:28:23 +02:00
gsell ec9626a0e5 src/h5core/h5t_xyz
- get serial mesh working again
2015-10-08 16:26:35 +02:00
gsell 86755932d9 src/h5core/h5_maps_private.h
- indentation fixes
2015-10-08 16:24:48 +02:00
gsell 95e21118e4 src/h5core/h5t_map_private.h
- bugfix: we have to use a signed type for 'low', 'mid' and ' high'
2015-10-08 16:23:46 +02:00
gsell 3fe0cc74be src/h5core/h5u_readwrite.c
- include 'h5core/h5.h' added
2015-10-08 16:19:23 +02:00
gsell 40c2c7d498 src/include/H5Fed_retrieve.h
- bugfix in allocating iterators
2015-10-08 16:17:48 +02:00
gsell cf067f7c56 src/include/h5core/h5.h
- definition of UNUSED_ARGUMENTS() moved to 'src/h5core/h5_private.h'
2015-10-08 16:14:09 +02:00
gsell 33129a4793 src/h5core/Makefile.am
- bugfix: we have to compile grid stuff in any case
2015-10-08 16:12:36 +02:00
gsell 41f2e87fc7 src/h5core/h5_module_private-h:
- bugfix in serial version of h5priv_end_throttle()
2015-10-08 16:11:01 +02:00
gsell 347a447302 configure.ac
- fix problem with AC_PROG_CC/CXX
- define 'WITH_PARALLEL_H5GRID' on '--enable-experimental'
2015-10-08 16:09:00 +02:00
gsell 03531ab4af src/h5core
- h5priv_start_throttle() and h5priv_end_throttle() are now inline
  functions, whereby the serial version is just a dummy
2015-09-11 14:41:52 +02:00
gsell 3d8ce28609 src/h5core/h5t_*
- cleanup
2015-09-11 14:12:01 +02:00
gsell cc719d116c src/h5core/h5u_models.c
- correct error message in h5u_set_num_points()
2015-09-11 14:11:23 +02:00
gsell 748eb1b3ab src/h5core/h5t_module.c:
- compile error fixed in h5t_close_mesh()
2015-09-11 14:10:25 +02:00
gsell f430c71d06 configure.ac and related Makefile.am's:
- conditionally compile examples
2015-09-11 14:09:05 +02:00
gsell 4a1d4d2d10 test/Makefile.am:
- unused h5_attach_test stuff removed
2015-09-11 14:04:53 +02:00
gsell 937d3f9c0e examples/H5Part/*
- cleanup and fixes
2015-09-11 14:04:12 +02:00
gsell 4d9d3dc879 examples/H5Part/...
- bugfixes
2015-09-09 18:25:27 +02:00
gsell 106be817d9 examples/H5Part
- reviewed
2015-09-08 20:53:07 +02:00
gsell ec3a29d7e4 src/Fortran/H5Part_model.c
- adapted to refactored h5u_get_num_points()
2015-09-08 20:52:19 +02:00
gsell c5ce2f06ac src/include/H5.f90:
- typo fixed in function name h5_setprop_file_corevfd()
2015-09-08 20:50:44 +02:00
gsell 992e8cf58e src/include/H5_const.f90
- H5_DEBUG_* masks added
2015-09-08 20:49:29 +02:00
gsell a618acf686 src/h5core/h5_errorhandling.c
src/include/h5core/h5_errorhandling.h
- h5_error(), h5_warn(), h5_info(): print message if debug-level > 3
2015-09-08 20:48:26 +02:00
gsell 47bee153ba src/h5core/h5_hdf5_private.h
- minor changes in debug output
2015-09-08 20:46:21 +02:00
gsell 390a4296b4 src/h5core/h5_hdf5.c
- hdf5_get_name_of_dataset_by_idx(): bugfix, return H5_NOK, if dataset are in step
2015-09-08 20:45:27 +02:00
gsell 4f7c666b1f src/h5core/h5u_module.c
- refactore "*num_particles*" to "*num_points*"
- h5u_set_view() can now be used for writing, there are still some limitations
2015-09-08 20:43:38 +02:00
gsell a620715ccc src/include/H5Part_io.h:
- documentation update
2015-09-08 17:50:06 +02:00
gsell 37bf9b35a6 src/h5core/h5_mpi_private.h:
- all mpi wrappers are now inline
2015-09-08 17:47:39 +02:00
gsell 2a7628c1e2 examples/H5Block/read_write_scalar_field.c:
- write of 32-bit values added
2015-09-03 17:27:47 +02:00
gsell 5a588415d0 Fortran H5Part examples:
- read_canonicalviewf.f90 read_setnparticlesf.f90, read_setviewf.f90, read_stridedf.f90 implemented
2015-09-03 17:26:54 +02:00
gsell d5fce5b2a0 examples/H5Part/write_{setviewf,stridedf}.f90:
- bugfixes: take Fortran indexing into account
2015-09-03 17:24:37 +02:00
gsell 7bf3985219 examples/H5Block/read_write_scalar_fieldf-f90:
- bugfix: open file read-only
2015-09-03 17:23:09 +02:00
gsell d939354990 example/H5/write_step_attribsf.f90:
- bugfix
2015-09-03 17:22:10 +02:00
gsell 8fb9834d3b C examples:
- fix some comments
2015-09-03 17:21:12 +02:00
gsell 2fd5d52125 src/Fortran/H5_modeul.c:
- h5_hasstep(), h5_setstep(): decrement step number by 1
2015-09-03 17:20:08 +02:00
gsell a1226feafd copyright notice fixed in examples 2015-09-03 13:31:29 +02:00
gsell cc7c558065 src/Fortran/H5.c:
- conditionally compile h5_setprop_file_mpio_posix()
2015-07-27 10:20:25 +02:00
gsell 51f90df374 Testprogramms for Fortran symbol name mangling removed 2015-07-24 18:38:58 +02:00
gsell 62c2d53324 Fortran symbol mangling simplified 2015-07-24 18:36:31 +02:00
gsell 8e9e0d84f3 change year in copyright 2015-07-23 14:59:43 +02:00
gsell d9daf9f0c7 src/h5core/h5u_module.c:
- bugfix in h5u_set_canonical_view()
2015-07-23 14:54:23 +02:00
gsell 559f2d8d9c test/*:
- fix some warning if compiled serial
2015-07-17 17:14:31 +02:00
gsell 403e535a50 ignore file edited. 2015-07-17 16:53:45 +02:00
gsell 14aa4fbd15 test/testframe.h:
- set VERBO_HI to 65535
2015-07-03 17:48:47 +02:00
gsell 319d7b4324 test/h5u_test.c:
- cleanup
2015-07-03 17:48:16 +02:00
gsell 4511fde9d1 bugfix: throttle only if VFD is MPIO independent or POSIX 2015-07-03 17:47:37 +02:00
gsell 707cafb2d8 src/h5core/h5u_model.c:
- bugfix with h5u_set_view (0, -1)
2015-07-03 17:45:49 +02:00
gsell 877b611758 test/testframe.c
- initialize 'ret_value' in 'TestPrintf()' and 'TestErrPrintf()'
2015-07-02 15:57:05 +02:00
gsell 9fb11ca838 no MPIO_POSIX in hdf5 > 1.8.12 2015-07-02 15:55:57 +02:00
gsell 7c2a315760 src/h5core/h5b_readwrite.c: fix early return in _select_hyperslab_for_writing() 2015-06-18 14:58:17 +02:00
gsell cc0135b4fc src/h5core/h5b_readwrite.c:
- fix early return in  _select_hyperslab_for_writing()

# Conflicts:
#	src/h5core/h5b_readwrite.c
2015-06-18 14:17:10 +02:00
gsell f47fbbf075 tools/vtk2h5grid/Makefile.am: fixes 2015-06-18 14:10:17 +02:00
gsell fd8c1e37b1 src/h5core/h5b_model.c:
- bugfix in serial code of h5b_3d_set_view()

# Conflicts:
#	src/h5core/h5b_model.c
2015-06-18 14:09:32 +02:00
Gsell Achim 4d770f8c84 option to shift mesh added 2015-06-18 13:51:40 +02:00
gsell 1f79b924df work on H5Block examples 2014-01-31 15:38:13 +01:00
gsell b1f143a5d7 src/examples/H5Block: ignore file added 2014-01-31 15:36:59 +01:00
gsell d6718bb866 examples/H5Part/read_canonicalviewf.f90: some fixes, but still broken 2014-01-31 15:34:20 +01:00
gsell 9deeacff51 copyright notice changed 2014-01-31 15:32:55 +01:00
gsell 5dbe8fb161 src/include/H5Block_attribs.f90: bugfix in declaration of h5bl_writefieldattrib_string() 2014-01-31 15:31:31 +01:00
gsell c3add7dde4 src/include/H5.f90: empty line removed 2014-01-31 15:30:46 +01:00
gsell 9d49361c43 some H5Block examples renamed 2014-01-31 15:29:10 +01:00
gsell 1a1878402c fixes in H5Part Fortran examples 2014-01-29 10:07:14 +01:00
gsell 069f9b64fc ignore file added to examples/H5Part 2014-01-29 10:05:15 +01:00
gsell ca6b4cc52d names of Fortran API header files fixed 2014-01-29 08:57:37 +01:00
gsell 60df95b10a most missing functions added to Fortran API 2014-01-28 17:31:22 +01:00
gsell d508f9e591 include/H5_attribs.h: reorder declarations 2014-01-28 17:30:00 +01:00
gsell 36702c6207 macros defining the names of internal attributes moved to public core file 2014-01-28 17:28:08 +01:00
gsell fa091cc2ab Fortran API files for H5Part data model renamed 2014-01-28 14:44:57 +01:00
gsell 1121a22956 Fortran API files for H5Block model renamed 2014-01-28 14:06:09 +01:00
gsell d5b8a4c0c8 ignore file edited 2013-11-15 16:50:32 +01:00
gsell 1cc3614c74 Fortran stubs added 2013-11-15 16:49:10 +01:00
gsell ca5f4abc7c comment for zero-sized selections reviewed 2013-11-15 16:46:36 +01:00
gsell 9d3c006409 MPI rank variable renamed to comm_rank 2013-11-15 16:45:06 +01:00
gsell d79d0ddf1a basic read_strided example implemented 2013-11-15 16:44:07 +01:00
gsell a1ad62bc74 'use_core_vfd.c' renamed to 'write_core_vfd.c' 2013-10-31 15:32:32 +01:00
gsell 950bcef057 explicit set of verbosity level to default; refactor variables for MPI communicator size and rank to 'comm_size' and 'comm_rank' 2013-10-31 15:30:43 +01:00
gsell 468a5d6871 H5Part examples reviewed 2013-10-31 13:44:06 +01:00
gsell cf09862f4b ignore file updated 2013-10-31 13:42:07 +01:00
gsell 6b6f290ebb MPI initialization added to vtk2h5grid.cc 2013-10-31 13:41:09 +01:00
gsell c8eecb51ae typo in filename 'examples/H5Part/use_core_vfd.c' fixed 2013-10-31 13:39:40 +01:00
gsell 23c2bdd189 typo in filename 'examples/H5Part/use_core_vfd.c' fixed 2013-10-31 13:38:27 +01:00
gsell 3e69059afc macro H5_VERBOSE_DEFAULT defined 2013-10-28 18:28:19 +01:00
gsell a6f81be2cd h5u_set_view() supports zero particle selections now, h5u_set_view_start_length() renamed to h5u_set_view_length() 2013-10-28 18:26:59 +01:00
gsell 89b91d6b46 --with-vtk added to configure.ac 2013-10-28 18:23:09 +01:00
gsell 4975de7a74 ignore list edited 2013-10-10 17:10:23 +02:00
gsell 3fe4c39e5e fix renamed macros in tests 2013-10-10 17:10:05 +02:00
gsell 89bb9ef48c missing set file property functions implemented, bugfixes 2013-10-10 17:08:32 +02:00
gsell d15993ecdc missing file property functions added 2013-10-10 17:03:13 +02:00
gsell da723dda5e missing file property functions added 2013-10-10 17:02:39 +02:00
gsell 0dcc666e5e more work on examples 2013-10-10 17:00:44 +02:00
gsell 61d17a352f same examples renamed 2013-10-10 16:56:25 +02:00
gsell 006e1cda4a examples Bench.c, H5test.c and H5testF.f90 removed 2013-09-26 16:47:51 +02:00
gsell 11e399b6c7 C and Fortran examples reviewed, new examples added 2013-09-26 15:59:09 +02:00
gsell e839226f2b unit tests adapted to new API 2013-09-26 15:54:47 +02:00
gsell 2702f846cb old file open API removed 2013-09-26 15:53:54 +02:00
gsell ee23c8cc4b Fortran API review 2013-09-26 15:51:49 +02:00
gsell c3a74c8ed4 functions added to query attributes by name 2013-09-26 15:47:43 +02:00
gsell 969acd3642 definition of H5_MAX_NAME_LEN moved to public API 2013-09-26 15:38:54 +02:00
gsell ee07f01abd C header files specified with full path 2013-09-26 15:23:54 +02:00
gsell 06f0a8b4e7 compile with -O3 if debug is disabled, compile with -Wall in always 2013-09-26 15:20:45 +02:00
gsell 205a1a5c37 .gitignore added 2013-09-02 11:20:16 +02:00
gsell 7174b36a20 fixes to Fortran API 2013-09-02 09:31:14 +02:00
gsell 273b1831d9 fixes to autotool files 2013-09-02 09:30:23 +02:00
gsell 83c5a66814 handle MPI compiler on NERSC system 2013-07-11 12:18:53 +00:00
gsell db81cb3d33 attachment test moved to examples 2013-07-11 07:50:57 +00:00
gsell 4a8eedd31e autotool fixes 2013-07-10 14:05:21 +00:00
gsell 11a1cc7c1e reformated 2013-07-10 14:04:53 +00:00
gsell a509000711 warnings popped up on Linux fixed 2013-07-05 14:45:47 +00:00
gsell a65ee3bbb7 bugfixes 2013-07-04 14:58:18 +00:00
gsell f69ee003f6 ignore list edited 2013-06-27 16:27:46 +00:00
gsell 0b18373f8c bugfixes 2013-06-27 16:25:09 +00:00
gsell 311cdad1c8 bugfix 2013-06-27 16:24:02 +00:00
gsell 6f84edd791 autotool cleanup and fixes 2013-06-27 16:21:18 +00:00
gsell 1614f9519b autotool cleanup and fixes 2013-06-27 16:20:43 +00:00
gsell 65757c1974 bug fixes, some private functions renamed, formating changes 2013-06-27 16:18:08 +00:00
gsell 80523c6df7 examples fixed 2013-06-27 16:14:22 +00:00
gsell f17f1d028c fixes for building outside source tree 2013-05-02 14:14:26 +00:00
gsell 78078c322e definitions for H5_VERBOSE_{NONE,ERROR,WARN,INFO} added 2013-05-02 14:12:43 +00:00
gsell 1284d545e1 ported to new API 2013-05-02 14:11:06 +00:00
gsell 96af35450a added something to NEWS (still work in progress) 2013-05-02 14:09:22 +00:00
gsell 5abb40125b new trunk merged from old trunk, Roman's master thesis and my changes in the sandbox 2013-04-12 12:32:58 +00:00
373 changed files with 49538 additions and 29300 deletions
+87 -74
View File
@@ -8,6 +8,7 @@
/autogen.sh -text
/configure.ac -text
doc/Doxyfile -text
doc/DoxygenLayout.xml -text
doc/Examples/meshexample.dxf -text
doc/Examples/meshexample.txt -text
doc/Examples/simple_tet.vtk -text
@@ -28,10 +29,13 @@ doc/Examples/trimesh_level1.metis.part.2 -text
doc/H5.dox -text
doc/H5X_File_Format.txt -text
doc/Makefile.am -text
doc/TracFooter.html -text
doc/TracHeader.html -text
doc/doxyfooter -text
doc/doxyheader -text
doc/html2twiki -text
doc/meshexample.dxf -text
doc/postprocess.py -text
doc/tetrahedron_refinements/1-edge/edge_01_refined/01.png -text
doc/tetrahedron_refinements/1-edge/edge_01_refined/01.pvsm -text
doc/tetrahedron_refinements/1-edge/edge_01_refined/01.txt -text
@@ -359,38 +363,75 @@ doc/tetrahedron_refinements/6-edges/edge_01-12-20-23-30-31_refined/buildlatex.ba
doc/tetrahedron_refinements/6-edges/edge_01-12-20-23-30-31_refined/output_file.jpg -text
doc/tetrahedron_refinements/README -text
doc/tetrahedron_refinements/text2vtk.py -text
examples/H5/Makefile.am -text
examples/H5/attach_file.c -text
examples/H5/file_attribs.c -text
examples/H5/openclose.c -text
examples/H5Block/H5BlockExample.pbs -text
examples/H5Block/H5BlockExampleF.f90 -text
examples/H5Block/Makefile.am -text
examples/H5Block/README -text
examples/H5Block/fields.c -text
examples/H5Block/read_write.c -text
examples/H5Fed/Makefile.am -text
examples/H5Fed/map_tet2globalid.c -text
examples/H5Fed/map_triangle2globalid.c -text
examples/H5Fed/tetmesh_adjacencies.c -text
examples/H5Fed/tetmesh_read.c -text
examples/H5Fed/tetmesh_read_tags.c -text
examples/H5Fed/tetmesh_write.c -text
examples/H5Fed/tetmesh_write1.c -text
examples/H5Fed/tetmesh_write2.c -text
examples/H5Fed/tetmesh_write_tags.c -text
examples/H5Fed/trimesh_2gnuplot.c -text
examples/H5Fed/trimesh_adjacencies.c -text
examples/H5Fed/trimesh_read.c -text
examples/H5Fed/trimesh_write.c -text
examples/H5Fed/trimesh_write_dunetest.c -text
examples/H5Fed/write_boundary.c -text
examples/H5Part/Bench.c -text
examples/H5Part/H5test.c -text
examples/H5Part/H5testF.f90 -text
examples/H5Part/Makefile.am -text
examples/H5Part/core_vfd.c -text
examples/H5Part/particles.c -text
examples/H5Part/read_canonicalview.c -text
examples/H5Part/simplef.f90 -text
examples/H5Part/stridedf.f90 -text
examples/H5Part/write_setnumparticles.c -text
examples/H5Part/write_setview.c -text
/license.txt -text
src/C++/H5Fed.cc -text
src/C++/H5Fed.hh -text
src/C++/Makefile.am -text
src/C/H5.c -text
src/C/H5Block.c -text
src/C/H5Block_readwrite.c -text
src/C/H5Part.c -text
src/C/H5_attachments.c -text
src/C/H5_attribs.c -text
src/C/Makefile.am -text
src/C/generate-h5b-readwrite.py -text
src/Fortran/H5.f90 -text
src/Fortran/H5Block.f90 -text
src/Fortran/H5.c -text
src/Fortran/H5Block.c -text
src/Fortran/H5BlockF.f90 -text
src/Fortran/H5Block_F.c -text
src/Fortran/H5Block_readwrite.f90 -text
src/Fortran/H5Block_attribs.c -text
src/Fortran/H5Block_attribsF.f90 -text
src/Fortran/H5Block_io.c -text
src/Fortran/H5Block_ioF.f90 -text
src/Fortran/H5Block_readwrite_F.c -text
src/Fortran/H5Part.f90 -text
src/Fortran/H5F.f90 -text
src/Fortran/H5Part.c -text
src/Fortran/H5PartF.f90 -text
src/Fortran/H5Part_F.c -text
src/Fortran/H5Part_io.c -text
src/Fortran/H5Part_ioF.f90 -text
src/Fortran/H5_F.c -text
src/Fortran/H5_attribs.f90 -text
src/Fortran/H5_attribs.c -text
src/Fortran/H5_attribsF.f90 -text
src/Fortran/H5_attribs_F.c -text
src/Fortran/H5_constF.f90 -text
src/Fortran/Makefile.am -text
src/Fortran/TestUnderscore.f -text
src/Fortran/TestUnderscoreC.c -text
src/Fortran/generate-h5-attribs-f.py -text
src/Fortran/h5_private.h -text
src/Makefile.am -text
src/h5core/Makefile.am -text
src/h5core/h5_attach.c -text
src/h5core/h5_attribs.c -text
src/h5core/h5_attribs_private.h -text
src/h5core/h5_core_private.h -text
src/h5core/h5_debug_private.h -text
src/h5core/h5_errorhandling.c -text
src/h5core/h5_errorhandling_private.h -text
src/h5core/h5_fcmp.c -text
@@ -399,14 +440,18 @@ src/h5core/h5_hdf5.c -text
src/h5core/h5_hdf5_private.h -text
src/h5core/h5_hsearch.c -text
src/h5core/h5_hsearch_private.h -text
src/h5core/h5_init.c -text
src/h5core/h5_init_private.h -text
src/h5core/h5_lustre.c -text
src/h5core/h5_lustre_private.h -text
src/h5core/h5_maps.c -text
src/h5core/h5_maps_private.h -text
src/h5core/h5_model.c -text
src/h5core/h5_model_private.h -text
src/h5core/h5_mpi.c -text
src/h5core/h5_mpi_private.h -text
src/h5core/h5_openclose.c -text
src/h5core/h5_private.h -text
src/h5core/h5_qsort.c -text
src/h5core/h5_qsort_private.h -text
src/h5core/h5_qsort_r.c -text
@@ -417,10 +462,10 @@ src/h5core/h5_syscall_private.h -text
src/h5core/h5_types_private.h -text
src/h5core/h5_va_macros.h -text
src/h5core/h5b_attribs.c -text
src/h5core/h5b_errorhandling_private.h -text
src/h5core/h5b_model.c -text
src/h5core/h5b_model_private.h -text
src/h5core/h5b_readwrite.c -text
src/h5core/h5b_readwrite_private.h -text
src/h5core/h5b_types_private.h -text
src/h5core/h5t_access_private.h -text
src/h5core/h5t_access_tetm.c -text
@@ -429,17 +474,19 @@ src/h5core/h5t_adjacencies.c -text
src/h5core/h5t_adjacencies_private.h -text
src/h5core/h5t_adjacencies_tetm.c -text
src/h5core/h5t_adjacencies_trim.c -text
src/h5core/h5t_core.c -text
src/h5core/h5t_core_private.h -text
src/h5core/h5t_core_tetm.c -text
src/h5core/h5t_core_trim.c -text
src/h5core/h5t_errorhandling_private.h -text
src/h5core/h5t_hsearch.c -text
src/h5core/h5t_hsearch_private.h -text
src/h5core/h5t_inquiry.c -text
src/h5core/h5t_map.c -text
src/h5core/h5t_map_private.h -text
src/h5core/h5t_model.c -text
src/h5core/h5t_model_private.h -text
src/h5core/h5t_model_tetm.c -text
src/h5core/h5t_model_trim.c -text
src/h5core/h5t_octree.c -text
src/h5core/h5t_octree_private.h -text
src/h5core/h5t_readwrite.c -text
src/h5core/h5t_readwrite_private.h -text
src/h5core/h5t_readwrite_tetm.c -text
@@ -454,88 +501,53 @@ src/h5core/h5t_store.c -text
src/h5core/h5t_store_private.h -text
src/h5core/h5t_store_tetm.c -text
src/h5core/h5t_store_trim.c -text
src/h5core/h5t_store_trim_private.h -text
src/h5core/h5t_tags.c -text
src/h5core/h5t_tags_private.h -text
src/h5core/h5t_types_private.h -text
src/h5core/h5u_errorhandling_private.h -text
src/h5core/h5u_model.c -text
src/h5core/h5u_readwrite.c -text
src/h5core/h5u_readwrite_private.h -text
src/h5core/h5u_types_private.h -text
src/include/H5.h -text
src/include/H5Block.h -text
src/include/H5Block_readwrite.h -text
src/include/H5Block_attribs.h -text
src/include/H5Block_io.h -text
src/include/H5Block_model.h -text
src/include/H5Fed.h -text
src/include/H5Fed_adjacency.h -text
src/include/H5Fed_inquiry.h -text
src/include/H5Fed_model.h -text
src/include/H5Fed_retrieve.h -text
src/include/H5Fed_store.h -text
src/include/H5Fed_tags.h -text
src/include/H5Part.h -text
src/include/H5_attachments.h -text
src/include/H5Part_io.h -text
src/include/H5Part_model.h -text
src/include/H5_attribs.h -text
src/include/H5_model.h -text
src/include/H5hut.h -text
src/include/grephdr -text
src/include/h5core/h5_attach.h -text
src/include/Makefile.am -text
src/include/h5core/Makefile.am -text
src/include/h5core/h5.h -text
src/include/h5core/h5_attribs.h -text
src/include/h5core/h5_core.h -text
src/include/h5core/h5_errno.h -text
src/include/h5core/h5_debug.h -text
src/include/h5core/h5_errorhandling.h -text
src/include/h5core/h5_hdf5.h -text
src/include/h5core/h5_maps.h -text
src/include/h5core/h5_openclose.h -text
src/include/h5core/h5_readwrite.h -text
src/include/h5core/h5_model.h -text
src/include/h5core/h5_syscall.h -text
src/include/h5core/h5_types.h -text
src/include/h5core/h5b_attribs.h -text
src/include/h5core/h5b_io.h -text
src/include/h5core/h5b_model.h -text
src/include/h5core/h5b_readwrite.h -text
src/include/h5core/h5t_adjacencies.h -text
src/include/h5core/h5t_core.h -text
src/include/h5core/h5t_inquiry.h -text
src/include/h5core/h5t_map.h -text
src/include/h5core/h5t_model.h -text
src/include/h5core/h5t_readwrite.h -text
src/include/h5core/h5t_ref_elements.h -text
src/include/h5core/h5t_octree.h -text
src/include/h5core/h5t_retrieve.h -text
src/include/h5core/h5t_storemesh.h -text
src/include/h5core/h5t_store.h -text
src/include/h5core/h5t_tags.h -text
src/include/h5core/h5u_io.h -text
src/include/h5core/h5u_model.h -text
src/include/h5core/h5u_readwrite.h -text
test/H5Block/BlockTestSpecs.txt -text
test/H5Block/H5BlockDissolveGhosts.c -text
test/H5Block/H5BlockParTestScalarField.c -text
test/H5Block/H5BlockParTestScalarField.pbs -text
test/H5Block/H5BlockParTestScalarFieldF.f90 -text
test/H5Block/H5BlockTestAttributes.c -text
test/H5Block/H5BlockTestAttributesF.f90 -text
test/H5Block/Makefile.am -text
test/H5Fed/Makefile.am -text
test/H5Fed/map_tet2globalid.c -text
test/H5Fed/map_triangle2globalid.c -text
test/H5Fed/tetmesh_adjacencies.c -text
test/H5Fed/tetmesh_read.c -text
test/H5Fed/tetmesh_read_tags.c -text
test/H5Fed/tetmesh_write.c -text
test/H5Fed/tetmesh_write1.c -text
test/H5Fed/tetmesh_write2.c -text
test/H5Fed/tetmesh_write_tags.c -text
test/H5Fed/trimesh_adjacencies.c -text
test/H5Fed/trimesh_read.c -text
test/H5Fed/trimesh_write.c -text
test/H5Fed/trimesh_write_dunetest.c -text
test/H5Fed/write_boundary.c -text
test/H5Part/Bench.c -text
test/H5Part/H5ParallelTest.cc -text
test/H5Part/H5PartAndreasTest.cc -text
test/H5Part/H5PartTest.cc -text
test/H5Part/H5PartTestParallel.cc -text
test/H5Part/H5test.cc -text
test/H5Part/H5testF.f -text
test/H5Part/H5testFpar.f90 -text
test/H5Part/Makefile.am -text
test/Makefile.am -text
test/h5_attach_test.c -text
test/h5b_read.c -text
test/h5b_test.c -text
test/h5b_write.c -text
@@ -564,7 +576,8 @@ tools/h5PartSurfaceToVtk.cc -text
tools/h5hutcc.in -text
tools/h5pAttrib.cc -text
tools/h5pToGNUplot.cc -text
tools/homdynToH5p.cc -text
tools/vtk2h5grid/Makefile.am -text
tools/vtk2h5grid/vtk2h5grid.cc -text
visit_plugins/databases/H5Part/.depend -text
visit_plugins/databases/H5Part/Makefile -text
visit_plugins/databases/H5Part/README.txt -text
+95 -76
View File
@@ -1,80 +1,99 @@
/H5hut
/INSTALL
/Makefile
/Makefile.in
/aclocal.m4
/autom4te.cache
/build
/config.guess
/config.h
/config.h.in
/config.log
/config.status
/config.sub
/configure
/depcomp
doc/Makefile
doc/Makefile.in
/install-sh
/libtool
/ltmain.sh
/m4
/missing
src/.deps
src/C++/Makefile
src/C++/Makefile.in
src/C/.deps
src/C/Makefile
src/C/Makefile.in
src/C/libH5hutC.a
src/Fortran/.deps
src/Fortran/Makefile
src/Fortran/Makefile.in
src/Makefile
src/Makefile.in
src/h5core/.deps
src/h5core/Makefile
src/h5core/Makefile.in
src/h5core/libH5hut.a
*.tar.gz
*.[oa]
*.la
*.lo
*.so
*.dSYM
*~
.deps
.dirstamp
.libs
Makefile
Makefile.in
aclocal.m4
attach_field_attributes
dump_field_attributes
autom4te.cache/
compile
config.guess
config.h
config.h.in
config.log
config.status
config.sub
configure
depcomp
examples/H5/attach_file
examples/H5/example_file_attribs.h5
examples/H5/example_step_attribs.h5
examples/H5/examples.h
examples/H5/h5hut.mod
examples/H5/openclose
examples/H5/openclosef
examples/H5/query
examples/H5/queryf
examples/H5/read_file_attribs
examples/H5/read_file_attribsf
examples/H5/read_step_attribs
examples/H5/read_step_attribsf
examples/H5/write_file_attribs
examples/H5/write_file_attribsf
examples/H5/write_step_attribs
examples/H5/write_step_attribsf
examples/H5Block/H5BlockExampleF
examples/H5Block/*.h5
examples/H5Block/fields
examples/H5Block/read_write
examples/H5Part/Bench
examples/H5Part/H5test
examples/H5Part/H5testF
examples/H5Part/core_vfd
examples/H5Part/*.h5
examples/H5Part/examples.h
examples/H5Part/h5hut.mod
examples/H5Part/particles
examples/H5Part/read_canonicalview
examples/H5Part/read_setnparticles
examples/H5Part/read_setview
examples/H5Part/read_strided
examples/H5Part/write_core_vfd
examples/H5Part/write_setnparticles
examples/H5Part/write_setnumparticles
examples/H5Part/write_setview
examples/H5Part/write_setviewf
examples/H5Part/write_strided
has_field
install-sh
libtool
ltmain.sh
m4/
missing
src/Fortran/TestUnderscore
src/Fortran/Underscore.h
src/include/H5hut.f
src/include/H5hutF.h
src/lib
/stamp-h1
/svn-prop.tmp
test/.deps
test/H5Block/H5BlockParTestScalarField
test/H5Block/H5BlockTestAttributes
test/H5Block/Makefile
test/H5Block/Makefile.in
test/H5Fed/.deps
test/H5Fed/Makefile
test/H5Fed/Makefile.in
test/H5Fed/large_tet.h5
test/H5Fed/simple_tet.h5
test/H5Fed/simple_triangle.h5
test/H5Fed/small_tet.h5
test/H5Fed/tetmesh_adjacencies
test/H5Fed/tetmesh_read
test/H5Fed/tetmesh_read_tags
test/H5Fed/tetmesh_write
test/H5Fed/tetmesh_write2
test/H5Fed/tetmesh_write_tags
test/H5Fed/trimesh_adjacencies
test/H5Fed/trimesh_read
test/H5Fed/trimesh_write
test/H5Fed/trimesh_write_dunetest
test/H5Part/Bench
test/H5Part/H5PartAndreasTest
test/H5Part/H5PartTestP
test/H5Part/H5test
test/H5Part/Makefile
test/H5Part/Makefile.in
test/Makefile
test/Makefile.in
test/h5_attach.h5
test/h5_attach_test
stamp-h1
test/h5b_test
test/h5u_test
tools/.deps
tools/Makefile
tools/Makefile.in
test/h5_attach_test
test/test.h5
tools/h5hutcc
large_tet.h5
simple_tet.h5
simple_triangle.h5
tetmesh_adjacencies
tetmesh_read
tetmesh_read_tags
tetmesh_write
tetmesh_write1
examples/H5Fed/tetmesh_write2
examples/H5Fed/trimesh_2gnuplot
examples/H5Fed/trimesh_adjacencies
examples/H5Fed/trimesh_read
examples/H5Fed/trimesh_write
examples/H5Fed/trimesh_write_dunetest
tetmesh_write_tags
write_field
*.gch
ReferencePages
vtk2h5grid
+1 -1
View File
@@ -7,4 +7,4 @@ Wes Bethel (NERSC/LBNL)
John Shalf (NERSC/LBNL)
Cristina Siegerist (NERSC/LBNL)
Please use h5part@lists.psi.ch for communicaion.
Please use h5part@lists.psi.ch for communication.
+2 -2
View File
@@ -1,6 +1,6 @@
*** Copyright Notice ***
H5hut Copyright (c) 2006-2010, The Regents of the University of California,
H5hut Copyright (c) 2006-2016, The Regents of the University of California,
through Lawrence Berkeley National Laboratory (subject to receipt of any
required approvals from the U.S. Dept. of Energy) and the Paul Scherrer
Institut (Switzerland). All rights reserved.
@@ -25,7 +25,7 @@ and to permit others to do so.
*** License agreement ***
H5Part Copyright (c) 2006-2009, The Regents of the University of California,
H5hut Copyright (c) 2006-2016, The Regents of the University of California,
through Lawrence Berkeley National Laboratory (subject to receipt of any
required approvals from the U.S. Dept. of Energy) and the Paul Scherrer
Institut (Switzerland). All rights reserved.
+15 -9
View File
@@ -1,13 +1,19 @@
ACLOCAL_AMFLAGS = -I m4
EXTRA_DIST = autogen.sh
SUBDIRS = \
src \
test \
tools
SUBDIRS = \
src \
test \
tools \
doc \
examples/H5 \
examples/H5Part \
examples/H5Block \
examples/H5Fed
MAINTAINERCLEANFILES = \
config.h \
config.log \
config.status \
stamp-h.in \
MAINTAINERCLEANFILES = \
config.h \
config.log \
config.status \
stamp-h.in \
stamp-h1
+401
View File
@@ -0,0 +1,401 @@
#### H5PART trunk ############################################################
* h5_file_t is now uintptr_t
* experimental version of parallel H5Fed
* new API function for file open using properties (similiar to hdf5 properties)
#### H5PART 1.99.10 ############################################################
* C99 compiler required
* C API with inline functions
#### H5PART 1.99.0 ############################################################
rudimental implementation of a grid manager
Important changes from version 1.6 to 1.99.0
Renamed type:
H5PartFile -> h5_file_t
h5part_int64_t -> h5_int64_t
h5part_float64_t -> h5_float_t
Renamed functions:
All function not related to a specific data model have been renamed from
H5PartFunction() to H5Function().
Example:
H5PartOpenFile() -> H5OpenFile()
Removed functions:
To simplify the API, there is just one function to open a file. It's the
same function for serial and parallel code.
#### H5PART 1.6.6 ############################################################
Fixed typo (Write instead of Read) in the h5bl_3d_read_scalar_field* Fortran
interface.
Added missing type normalization for int32 type.
Rewrite of h5pAttrib tool.
#### H5PART 1.6.5 ############################################################
Fixed several build errors reported by Iuri Prilepov on Ubuntu 11.04.
#### H5PART 1.6.4 ############################################################
Fixed bug where H5PartSetViewIndices was not setting an empty view when the
number of elements is 0.
Set a threshold on the HDF5 alignment parameter so that small metadata writes
are not aligned, which causes large gaps in the file.
#### H5PART 1.6.3 ############################################################
New build system uses libtool and can build shared libraries.
Fixed a bug that incorrectly identifies the number of selected points in a view
when using H5PartSetViewIndices.
Fixed bug in Fortran test reported by several people, as well as several
incorrect views set in the C test that were causing segfaults.
Fixed name mismatches in the Fortran interface, and an off-by-one indexing
problem.
#### H5PART 1.6.2 ############################################################
Removed H5PartSetViewEmpty
--------------------------
An empty view can now be selected with:
H5PartSetNumParticles(file, 0);
Bug Fixes to Attribute Calls in Fortran API
-------------------------------------------
Fixed a problem where attribute values were reverting to zero.
#### H5PART 1.6.1 ############################################################
Chunking in the H5Part API
--------------------------
There is now an H5Part equivalent H5PartSetChunkSize to the existing
H5BlockDefine3DChunkDims call. Both of these calls enable the chunking
mechanism in the underlying HDF5 layer. Chunking is used in combination
with the aligned open calls to pad datasets to alignment multiples
on disk.
All Steps Available on Write
----------------------------
Previously, existing steps in a file were only accessible in read-only mode.
Now, all steps are available in all modes, including write-truncate and
write-append. Thus, it is now possible to overwrite existing data in write
mode. To help alert the user to this possibility, a warning is issued every
time an existing dataset is written to. Warnings can be printed by setting
the verbosity to H5PART_VERB_WARN or higher.
New Throttling Routine
----------------------
Previously, a throttle factor of N meant that for P processors, the total
number of P writes were divided into N batches of P/N writes.
To better accommodate round-robin lustre striping, the new policy is to
execute P/N batches of N writes. Thus, matching N to the number of stripes
results in the desirable 1-1 matching of writers to stripes.
Other Fixes
-----------
* The configure script should correctly detect PGI compilers now.
* There was a small memory leak in the Fortran file open calls.
* There was a compile error with HDF5 1.6.x due to a missing assignment.
#### H5PART 1.6 ##############################################################
Updated Documentation
---------------------
The Fortran API has been added to the doxygen documentation. Most entries have
a reference to their respective C API call.
Regression Test Suite
---------------------
The test subdirectory has been reorganized to include a systematic series
of regression tests of common use cases for the API. The goal is to have both
complete coverage of the API (every call is exercised) and testing of some
unlikely or unsuspected values and cases.
Currently, the C test covers the entire H5Part API and the Fortran test is
still in development.
Benchmark Utilities
-------------------
Two benchmarking utilities, H5PartBench and H5BlockBench, have been added to
the tools collection. Both require the parallel library and have functionality
and syntax similar to the IOR benchmark:
http://sourceforge.net/projects/ior-sio/
File Mode Flags
---------------
Previously, the only flags used were H5PART_READ, H5PART_WRITE, and
H5PART_APPEND, and these were mutually exclusive. Additional flags have been
added to select the underlying virtual file driver (VFD) that HDF5 uses in
parallel mode and to accommodate the lustre filesystem:
H5PART_VFD_MPIPOSIX (use the MPI-POSIX driver, which bypasses MPI-IO)
H5PART_VFD_MPIIO_IND (use MPI-IO in independent mode)
H5PART_FS_LUSTRE (activate H5P tunings for the lustre stripe size)
These flags can be specified using the typical bitwise OR method, e.g.
char flag = H5PART_WRITE | H5PART_VFD_MPIPOSIX | H5PART_FS_LUSTRE;
will select write mode with these two additional options.
The parallel library now defaults to using the MPI-IO collective mode driver
(previously it used independent mode). The collective buffering algorithm in
the Cray XT4/5 environment has been substantially improved in the last year,
and defaulting to collective mode allows us to take advantage of these
improvements automatically.
There are also new open calls H5PartOpenAlign and H5PartOpenParallelAlign that
take an additional 'alignment' value. This value is passed to HDF5 and used to
pad out objects so that they align to filesystem boundaries. For instance, it
would make sense to use the stripe size as the alignment value when writing to
a lustre filesystem.
Unified 'View' Model
--------------------
Views are now supported in both read and write mode (previously only supported
in read mode). It is possible to specify non-sensical views: you could for
instance specify a read view that is larger than the dataset on disk. Or you
could create a write view that is larger than the data in memory. In those
cases, you will encounter an error when you try to perform a read or write
operation on a dataset.
There are two new methods for selecting views. H5PartSetNumParticlesStrided
selects a view with $n$ particles per processor, but such that the data in
memory is expected to have a 'stride' factor. For instance, if you have
particle data with fields $x$ and $y$ and a single array with entries
$x1,y1,x2,y2...$, then the stride factor is 2. Striding works for both reads
and writes and only affects the view of memory: individual fields are still
stored as individual arrays on disk.
The second new method is H5PartSetViewIndices, which allows for point
selections of datasets. You can pass a list of indices for the points you
want to select. This is useful, for instance, when interfacing with FastBit
to perform queries that select a small subset of non-contiguous particles.
Because views are now supported on write, it is possible to write a dataset
using multiple 'passes' or to leave some values unwritten.
Also, all views are now *inclusive*, so that a view of (0,9) corresponds
to the 10 items 0, 1, 2, ... 9.
Internal Handling of Dataspaces
-------------------------------
H5PartSetNumParticles and H5PartSetNumParticlesStrided now share the same
HDF5 dataspace state in the H5PartFile struct with the calls that modify
the view (H5PartSetView etc.). Previously, the memory and disk dataspaces
were regenerated from the view on every read access, which was unnecessary.
Autogeneration of API Calls
---------------------------
Python scripts have been added to automatically generate read/write call
variants for different data types.
Renamed Fortran Include
-----------------------
The automake system no longer greps the *F90.inc files to generate an include
called 'H5Part.inc'. Instead, the *F90.inc files have been renamed to *.f90,
and awk is used to generate an 'H5PartF.h' file (the same naming convention
as in MPI's 'mpif.h').
The change to *.f90 was necessary to facilitate integration of the Fortran
API into doxygen. Note that the *.f90 files will not compile, nor can they
be included directly. Simply use
include 'H5PartF.h'
in your Fortran code to include all the definitions for Fortran H5Part/H5Block
calls.
64 Char Limit on Dataset Names
------------------------------
Previously, a user could overrun internal buffers for dataset names. Now, a
fixed limit of 64 chars is imposed. Dataset names that are longer than this are
truncated and a warning is printed. We expect that most users are using
short canonical names like x, px, id, etc.
Changes to Existing API
-----------------------
The H5BlockGetFieldInfo and H5BlockGetFieldInfoByName calls now both include
a parameter for the 'type' of the field.
#### H5PART 1.4 ##############################################################
Error Handling
--------------
Now all functions, in which an error could occure, are returning a
value. This value is either a 64bit integer or a pointer.
A negative 64bit integer as result indicates an error. Values >= 0
indicates successfull execution. This is similiar to the convention
used in UNIX system calls, but we do not return -1 but the error
number (which is always negative).
For functions returning a pointer the NULL-pointer is used to indicate
an error. You can call the function H5PartGetErrno() to get the error
number. For the time being there is no strerror(3) or perror(3)
equivalent.
API Changes
-----------
There are several changes in the API of H5Part. The biggest change is
a side-effect of the implementation of strict error handling. The
impact to the existing C/C++ code is very small. But now you *can*
and *should* implement some kind of error handling. The simplest
error handling is to set an error handler which aborts the program as
soon as an error occured.
The next "biggest" change is the use of H5Part types instead of "long
long" and "double". The replacement of "long long" is "h5part_int64_t"
and for "double" "h5part_float64_t". This change has now effect in
Fortran.
In some functions the argument type changed from "int" to
"h5part_int64_t". Since on most systems "int" is a 32bit integer,
calls to these functions must be adapted to the new API. In C/C++ the
compiler will complain about it. But in Fortran you will *not* get an
error message.So, you must check your Fortran code carefully.
Changes in detail (not listed are functions where only the return
type changed from any to "h5part_int64_t"):
New API Changes to old API
h5part_int64_t void
H5PartSetNumParticles (
H5PartFile *f,
h5part_int64_t nparticles long long
);
h5part_int64_t int
H5PartWriteDataFloat64 (
H5PartFile *f,
char *name,
h5part_float64_t *dta double
);
h5part_int64_t int
H5PartWriteDataInt64 (
H5PartFile *f,
char *name,
h5part_int64_t *dta long long
);
h5part_int64_t void
H5PartSetStep (
H5PartFile *f,
h5part_int64_t step int
);
h5part_int64_t void
H5PartSetView (
H5PartFile *f,
h5part_int64_t start, long long
h5part_int64_t end long long
);
h5part_int64_t int
H5PartGetView (
H5PartFile *f,
h5part_int64_t *start, long long
h5part_int64_t *end long long
);
h5part_int64_t int
H5PartReadDataFloat64 (
H5PartFile *f,
char *name,
h5part_float64_t *dta double
);
h5part_int64_t int
H5PartReadDataInt64 (
H5PartFile *f,
char *name,
h5part_int64_t *dta long long
);
h5part_int64_t void
H5PartReadParticleStep (
H5PartFile *f,
h5part_int64_t step, int
h5part_float64_t *x, double
h5part_float64_t *y, double
h5part_float64_t *z, double
h5part_float64_t *px, double
h5part_float64_t *py, double
h5part_float64_t *pz, double
h5part_int64_t *id long long
);
New functions:
h5part_int64_t
H5PartSetVerbosityLevel (
unsigned int
);
h5part_int64_t
H5PartSetErrorHandler (
h5part_error_handler handler
);
h5part_int64_t
H5PartGetErrno (
void
);
h5part_int64_t
H5PartDefaultErrorHandler (
const char *funcname,
const h5part_int64_t eno,
const char *fmt,
...
);
h5part_int64_t
H5PartAbortErrorHandler (
const char *funcname,
const h5part_int64_t eno,
const char *fmt,
...
);
Removed functions:
int
H5PartFileIsValid (
H5PartFile *f
);
+1 -1
View File
@@ -1,7 +1,7 @@
#!/bin/sh
# Run this to generate all the initial makefiles, etc.
ACLOCAL_FLAGS="-I m4 $ACLOCAL_FLAGS"
ACLOCAL_FLAGS="-I m4 -I . $ACLOCAL_FLAGS"
LIBTOOLIZE_FLAGS="--force $LIBTOOLIZE_FLAGS"
AUTOMAKE_FLAGS="--add-missing --copy --foreign $AUTOMAKE_FLAGS"
+135
View File
@@ -0,0 +1,135 @@
# ===========================================================================
# http://www.gnu.org/software/autoconf-archive/ax_pkg_swig.html
# ===========================================================================
#
# SYNOPSIS
#
# AX_PKG_SWIG([major.minor.micro], [action-if-found], [action-if-not-found])
#
# DESCRIPTION
#
# This macro searches for a SWIG installation on your system. If found,
# then SWIG is AC_SUBST'd; if not found, then $SWIG is empty. If SWIG is
# found, then SWIG_LIB is set to the SWIG library path, and AC_SUBST'd.
#
# You can use the optional first argument to check if the version of the
# available SWIG is greater than or equal to the value of the argument. It
# should have the format: N[.N[.N]] (N is a number between 0 and 999. Only
# the first N is mandatory.) If the version argument is given (e.g.
# 1.3.17), AX_PKG_SWIG checks that the swig package is this version number
# or higher.
#
# As usual, action-if-found is executed if SWIG is found, otherwise
# action-if-not-found is executed.
#
# In configure.in, use as:
#
# AX_PKG_SWIG(1.3.17, [], [ AC_MSG_ERROR([SWIG is required to build..]) ])
# AX_SWIG_ENABLE_CXX
# AX_SWIG_MULTI_MODULE_SUPPORT
# AX_SWIG_PYTHON
#
# LICENSE
#
# Copyright (c) 2008 Sebastian Huber <sebastian-huber@web.de>
# Copyright (c) 2008 Alan W. Irwin
# Copyright (c) 2008 Rafael Laboissiere <rafael@laboissiere.net>
# Copyright (c) 2008 Andrew Collier
# Copyright (c) 2011 Murray Cumming <murrayc@openismus.com>
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation; either version 2 of the License, or (at your
# option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
# Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
#
# As a special exception, the respective Autoconf Macro's copyright owner
# gives unlimited permission to copy, distribute and modify the configure
# scripts that are the output of Autoconf when processing the Macro. You
# need not follow the terms of the GNU General Public License when using
# or distributing such scripts, even though portions of the text of the
# Macro appear in them. The GNU General Public License (GPL) does govern
# all other use of the material that constitutes the Autoconf Macro.
#
# This special exception to the GPL applies to versions of the Autoconf
# Macro released by the Autoconf Archive. When you make and distribute a
# modified version of the Autoconf Macro, you may extend this special
# exception to the GPL to apply to your modified version as well.
#serial 11
AC_DEFUN([AX_PKG_SWIG],[
# Ubuntu has swig 2.0 as /usr/bin/swig2.0
AC_PATH_PROGS([SWIG],[swig swig2.0])
if test -z "$SWIG" ; then
m4_ifval([$3],[$3],[:])
elif test -n "$1" ; then
AC_MSG_CHECKING([SWIG version])
[swig_version=`$SWIG -version 2>&1 | grep 'SWIG Version' | sed 's/.*\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*/\1/g'`]
AC_MSG_RESULT([$swig_version])
if test -n "$swig_version" ; then
# Calculate the required version number components
[required=$1]
[required_major=`echo $required | sed 's/[^0-9].*//'`]
if test -z "$required_major" ; then
[required_major=0]
fi
[required=`echo $required | sed 's/[0-9]*[^0-9]//'`]
[required_minor=`echo $required | sed 's/[^0-9].*//'`]
if test -z "$required_minor" ; then
[required_minor=0]
fi
[required=`echo $required | sed 's/[0-9]*[^0-9]//'`]
[required_patch=`echo $required | sed 's/[^0-9].*//'`]
if test -z "$required_patch" ; then
[required_patch=0]
fi
# Calculate the available version number components
[available=$swig_version]
[available_major=`echo $available | sed 's/[^0-9].*//'`]
if test -z "$available_major" ; then
[available_major=0]
fi
[available=`echo $available | sed 's/[0-9]*[^0-9]//'`]
[available_minor=`echo $available | sed 's/[^0-9].*//'`]
if test -z "$available_minor" ; then
[available_minor=0]
fi
[available=`echo $available | sed 's/[0-9]*[^0-9]//'`]
[available_patch=`echo $available | sed 's/[^0-9].*//'`]
if test -z "$available_patch" ; then
[available_patch=0]
fi
# Convert the version tuple into a single number for easier comparison.
# Using base 100 should be safe since SWIG internally uses BCD values
# to encode its version number.
required_swig_vernum=`expr $required_major \* 10000 \
\+ $required_minor \* 100 \+ $required_patch`
available_swig_vernum=`expr $available_major \* 10000 \
\+ $available_minor \* 100 \+ $available_patch`
if test $available_swig_vernum -lt $required_swig_vernum; then
AC_MSG_WARN([SWIG version >= $1 is required. You have $swig_version.])
SWIG=''
m4_ifval([$3],[$3],[])
else
AC_MSG_CHECKING([for SWIG library])
SWIG_LIB=`$SWIG -swiglib`
AC_MSG_RESULT([$SWIG_LIB])
m4_ifval([$2],[$2],[])
fi
else
AC_MSG_WARN([cannot determine SWIG version])
SWIG=''
m4_ifval([$3],[$3],[])
fi
fi
AC_SUBST([SWIG_LIB])
])
+293 -223
View File
@@ -1,72 +1,140 @@
# Every configure script must call AC_INIT before doing anything else.
# AC_INIT (package, version, [bug-report], [tarname])
AC_INIT([H5hut], [1.99.6], [h5part@lists.psi.ch], H5hut)
# Ensure that a recent enough version of Autoconf is being used.
# If the version of Autoconf being used to create configure is earlier than version,
# print an error message to the standard error output and do not create configure.
#
# Copyright (c) 2006-2016, The Regents of the University of California,
# through Lawrence Berkeley National Laboratory (subject to receipt of any
# required approvals from the U.S. Dept. of Energy) and the Paul Scherrer
# Institut (Switzerland). All rights reserved.
#
# License: see file COPYING in top level of source distribution.
#
AC_INIT([H5hut], [2.0.0rc1], [h5part@lists.psi.ch], H5hut)
AC_PREREQ(2.60)
# should be called right after AC_INIT.
# configure scripts can create a C header file containing `#define' directives.
# The AC_CONFIG_HEADERS macro selects this kind of output.
AC_CONFIG_HEADERS(config.h)
AC_CONFIG_MACRO_DIR([m4])
# AM_INIT_AUTOMAKE is required to use autoconf with automake
AM_INIT_AUTOMAKE
BUILD_LIBS='libH5hut'
USE_C='yes'
ENABLE_DEBUG='no'
ENABLE_C='yes'
ENABLE_FORTRAN='no'
ENABLE_PARALLEL='no'
ENABLE_PYTHON='no'
###############################################################################
################# --enable-xxx and --with-xxx Argument ########################
###############################################################################
# --enable-xxx and --with-xxx Arguments
AC_ARG_ENABLE(
[debug],
[AC_HELP_STRING([--enable-debug],
[Compile with debug flags [default=no]])],
[USE_DEBUG=$enableval])
[AS_HELP_STRING([--enable-debug], [Compile with debug flags [default=no]])],
[ENABLE_DEBUG=$enableval])
AM_CONDITIONAL([ENABLE_DEBUG], [test "$ENABLE_DEBUG" = "yes"])
AC_ARG_ENABLE(
[c],
[AC_HELP_STRING([--enable-c],
[AS_HELP_STRING([--enable-c],
[Compile the C interface [default=yes]])],
[USE_C=$enableval])
[ENABLE_C=$enableval])
AM_CONDITIONAL([ENABLE_C], [test "$ENABLE_C" = "yes"])
AC_ARG_ENABLE(
[fortran],
[AC_HELP_STRING([--enable-fortran],
[AS_HELP_STRING([--enable-fortran],
[Compile the Fortran interface [default=no]])],
[USE_FORTRAN=$enableval])
[ENABLE_FORTRAN=$enableval])
AM_CONDITIONAL([ENABLE_FORTRAN], [test "$ENABLE_FORTRAN" = "yes"])
AC_ARG_ENABLE(
[python],
[AS_HELP_STRING([--enable-python],
[Compile the Python interface [default=no]])],
[ENABLE_PYTHON=$enableval])
AM_CONDITIONAL([ENABLE_PYTHON], [test "$ENABLE_PYTHON" = "yes"])
AC_ARG_ENABLE(
[parallel],
[AC_HELP_STRING([--enable-parallel],
[AS_HELP_STRING([--enable-parallel],
[Compile the MPI/IO interface [default=no]])],
[USE_PARALLEL=$enableval])
[ENABLE_PARALLEL=$enableval])
AM_CONDITIONAL([ENABLE_PARALLEL], [test "$ENABLE_PARALLEL" = "yes"])
AC_ARG_ENABLE(
[large-indices],
[AC_HELP_STRING([--enable-large-indices],
[Compile with 64bit local IDs and indices [default=no]])],
[USE_LARGE_INDICES=$enableval])
AC_ARG_ENABLE(
[experimental],
[AS_HELP_STRING([--enable-experimental],
[Compile experimental code [default=no]])],
[ENABLE_EXPERIMENTAL=$enableval])
AM_CONDITIONAL([ENABLE_EXPERIMENTAL], [test "$ENABLE_EXPERIMENTAL" = "yes"])
AC_ARG_ENABLE(
[vtkconverter],
[AS_HELP_STRING([--enable-vtkconverter],
[Compile the vtk to H5hut converter for grids [default=no]])],
[ENABLE_VTKCONVERTER=$enableval])
AM_CONDITIONAL([ENABLE_VTKCONVERTER], [test "$ENABLE_VTKCONVERTER" = "yes"])
AC_ARG_ENABLE(
[examples],
[AS_HELP_STRING([--enable-examples],
[Compile the H5hut examples [default=no]])],
[ENABLE_EXAMPLES=$enableval])
AM_CONDITIONAL([ENABLE_EXAMPLES], [test "$ENABLE_EXAMPLES" = "yes"])
AC_ARG_WITH(
[hdf5],
[AC_HELP_STRING([--with-hdf5],
[AS_HELP_STRING([--with-hdf5],
[path to HDF5 installation [default=""]])],
[HDF5PATH=$withval], [HDF5PATH=""])
[HDF5_PREFIX=$withval], [])
AC_ARG_WITH(
[mpi],
[AC_HELP_STRING([--with-mpi],
[AS_HELP_STRING([--with-mpi],
[path to MPI installation [default=""]])],
[MPIPATH=$withval;PATH=$MPIPATH/bin:$PATH], [MPIPATH=""])
[PATH=$MPI_PREFIX/bin:$PATH])
AC_ARG_WITH(
[lustre],
[AC_HELP_STRING([--with-lustre],
[AS_HELP_STRING([--with-lustre],
[path to lustre user API [default=""]])],
[LUSTREPATH=$withval], [LUSTREPATH=""])
AC_ARG_WITH(
[parmetis],
[AC_HELP_STRING([--with-parmetis],
[path to ParMETIS API [default=""]])],
[PARMETIS_PREFIX=$withval], [])
AC_ARG_WITH(
[vtk],
[AC_HELP_STRING([--with-vtk],
[VTK installation path [default=""]])],
[VTK_PREFIX=$withval], [])
# Determine a C/C++ compiler to use.
CC=''
CXX=''
if test "x$ENABLE_PARALLEL" = "xyes"; then
c_compilers="mpicc cc"
cxx_compilers="mpic++ CC"
else
c_compilers="pgcc pathcc icc gcc cc_r cc"
cxx_compilers="pgcc pathcc icc g++ cc_r c++"
fi
AC_PROG_CC($c_compilers)
AC_PROG_CXX($cxx_compilers)
CC=`which $CC`
CXX=`which $CXX`
AC_PROG_CC_C99
if test "x$ac_cv_prog_cc_c99" = "xno"; then
AC_MSG_ERROR([Cannot set C compiler to use C99 standard!])
exit 1
fi
###############################################################################
############### PATH SERACH FUNCTION - to be used later... ####################
###############################################################################
@@ -98,44 +166,31 @@ PATH_Search() {
return
}
###############################################################################
# MISC SETTINGS INCLUDING C & C++ COMPILER SETTING
###############################################################################
############# MISC SETTINGS INCLUDING C & C++ COMPILER SETTING ################
###############################################################################
# Compute the canonical host-system type variable, host, and its three
# individual parts host_cpu, host_vendor, and host_os.
AC_CANONICAL_HOST
AC_PROG_MAKE_SET
CFLAGS="$CFLAGS -Wall"
CXXFLAGS="$CFLAGS -Wall"
FFLAGS="$FFLAGS -Wall"
# Determine a C/C++ compiler to use.
# If CC is not already set in the environment, check for gcc and cc, then
# for other C compilers.
# Set output variable CC to the name of the compiler found.
if test "x$USE_PARALLEL" = "xyes"; then
CCOMPILERS="mpicc cc"
CXXCOMPILERS="mpic++ c++"
# debug enabled?
AC_MSG_CHECKING([if debug is enabled])
if test "X$ENABLE_DEBUG" = "Xyes"; then
AC_MSG_RESULT([yes])
CFLAGS="$CFLAGS -g3 -O0"
CXXFLAGS="$CFLAGS -g3 -O0"
FFLAGS="$FFLAGS -g3 -O0"
else
CCOMPILERS="pgcc pathcc icc gcc cc_r cc"
CXXCOMPILERS="pgcc pathcc icc g++ cc_r c++"
AC_MSG_RESULT([no])
CFLAGS="$CFLAGS -O3"
CXXFLAGS="$CFLAGS -O3"
FFLAGS="$FFLAGS -O3"
fi
AC_PROG_CC($CCOMPILERS)
CC=`which $CC`
AC_PROG_CXX($CXXCOMPILERS)
CXX=`which $CXX`
# Use macro to set C99 mode instead of checking for gcc, which breaks with
# parallel builds.
AC_PROG_CC_C99
if test "x$ac_cv_prog_cc_c99" = "xno"; then
AC_MSG_ERROR([Cannot set C compiler to use C99 standard!])
exit 1
fi
# Set output variable INSTALL to the path of a BSD-compatible install program,
# if one is found in the current PATH.
# Otherwise, set INSTALL to `dir/install-sh -c`
AC_PROG_INSTALL
AC_PROG_AWK
@@ -178,162 +233,160 @@ AC_DEFINE_UNQUOTED(MY_UNAME, "$uname", "")
###############################################################################
######################## CONFIGURE LINE OPTIONS ###############################
###############################################################################
# PROCESS ARGUMENTS
AC_MSG_CHECKING([if debug is enabled])
if test "X$USE_DEBUG" = "Xyes"; then
AC_MSG_RESULT([yes])
CFLAGS="$CFLAGS -g"
FFLAGS="$FFLAGS -g"
else
AC_MSG_RESULT([no])
fi
############################ fortran enabled ##################################
# C enabled?
AC_MSG_CHECKING([if C interface enabled])
if test "X$USE_C" = "Xyes"; then
if test "X$ENABLE_C" = "Xyes"; then
AC_MSG_RESULT([yes])
BINDINGS="$BINDINGS C"
LIB_C="libH5hutC.la"
BUILD_LIBS="$BUILD_LIBS libH5hutC"
BUILD_TESTS="$BUILD_TESTS h5u_test h5b_test"
BUILD_TOOLS="$BUILD_TOOLS h5hutcc h5PartDcToVtk h5PartSurfaceToVtk"
else
AC_MSG_RESULT([no])
fi
############################ fortran enabled ##################################
# fortran enabled?
AC_MSG_CHECKING([if fortran interface enabled])
if test "X$USE_FORTRAN" = "Xyes"; then
if test "X$ENABLE_FORTRAN" = "Xyes"; then
AC_MSG_RESULT([yes])
BINDINGS="$BINDINGS Fortran"
LIB_FORTRAN="libH5hutF.la"
BUILD_LIBS="$BUILD_LIBS libH5hutF"
if test "X$USE_PARALLEL" = "Xyes"; then
AC_LANG_PUSH(Fortran)
FC=''
F77=''
F90=''
if test "X$ENABLE_PARALLEL" = "Xyes"; then
AC_PROG_FC(mpif90 mpif77)
else
AC_PROG_FC(pgf90 ifort xlf_r pathf90 g95 g90 ftn gfortran)
fi
if test -z "$FC" ; then
AC_MSG_ERROR([Cannot find a Fortran compiler!])
exit 1
FC=`which $FC`
# Query Fortran symbol mangling. __AC_FC_NAME_MANGLING sets
# ac_cv_{f77,fc}_mangling. The value contains three fields, separated
# by commas:
#
# lower case / upper case:
# case translation of the Fortran symbols
# underscore / no underscore:
# whether the compiler appends "_" to symbol names
# extra underscore / no extra underscore:
# whether the compiler appends an extra "_" to symbol names already
# containing at least one underscore
__AC_FC_NAME_MANGLING
if test "X${ac_cv_fc_mangling}" == "Xlower case, no underscore, no extra underscore"; then
CPPFLAGS+=" -DFC_MANGLING_LOWERCASE_NO_UNDERSCORE"
elif test "X${ac_cv_fc_mangling}" == "Xlower case, underscore, no extra underscore"; then
CPPFLAGS+=" -DFC_MANGLING_LOWERCASE_SINGLE_UNDERSCORE"
elif test "X${ac_cv_fc_mangling}" == "Xlower case, underscore, extra underscore"; then
CPPFLAGS+=" -DFC_MANGLING_LOWERCASE_DOUBLE_UNDERSCORE"
elif test "X${ac_cv_fc_mangling}" == "Xupper case, no underscore, no extra underscore"; then
CPPFLAGS+=" -DFC_MANGLING_UPPERCASE_NO_UNDERSCORE"
elif test "X${ac_cv_fc_mangling}" == "Xupper case, underscore, no extra underscore"; then
CPPFLAGS+=" -DFC_MANGLING_UPPERCASE_SINGLE_UNDERSCORE"
elif test "X${ac_cv_fc_mangling}" == "Xupper case, underscore, extra underscore"; then
CPPFLAGS+=" -DFC_MANGLING_UPPERCASE_DOUBLE_UNDERSCORE"
fi
if test $FC = "g90"; then
FFLAGS="${FFLAGS} -fno-second-underscore"
fi
if test $FC = "g95"; then
FFLAGS="${FFLAGS} -fno-second-underscore"
fi
AC_MSG_CHECKING([symbol convention in object files])
`cd src/Fortran && rm -f TestUnderscore.o TestUnderscoreC.o TestUnderscore`
`cd src/Fortran && ${FC} ${FFLAGS} -c TestUnderscore.f`
`cd src/Fortran && ${CC} ${CFLAGS} -c TestUnderscoreC.c`
`cd src/Fortran && ${FC} ${FFLAGS} -o TestUnderscore TestUnderscore.o TestUnderscoreC.o`
if test -f src/Fortran/TestUnderscore ; then
UNDERSCORE_H=Underscore.h
`cd src/Fortran && ./TestUnderscore > Underscore.h`
AC_MSG_RESULT([ok])
else
AC_MSG_RESULT([nok])
AC_MSG_ERROR([Cannot determine the symbon convention for Fortran object files!])
exit 1
fi
AC_LANG_POP(Fortran)
else
AC_MSG_RESULT([no])
fi
# python enabled?
if test "X$ENABLE_PYTHON" = "Xyes"; then
AM_PATH_PYTHON([2.5])
AX_PKG_SWIG([1.3], [], [ AC_MSG_ERROR([SWIG is required to build..]) ])
#SWIG_ENABLE_CXX
#SWIG_PYTHON
PYTHON_PREFIX=`python-config --prefix`
PYTHON_EXEC_PREFIX=`python-config --exec-prefix`
# make sure numpy is available..
AC_MSG_CHECKING([for numpy support])
NUMPY_INCLUDE=`${PYTHON} -c 'import numpy; print numpy.get_include()'`
if test "X$?" = "X0" ; then
AC_MSG_RESULT([$NUMPY_INCLUDE])
else
AC_MSG_RESULT([no])
exit 1
fi
AC_SUBST([NUMPY_INCLUDE])
#check for parallel support
if test "X$ENABLE_PARALLEL" = "Xyes"; then
AC_MSG_CHECKING([for mpi4py support])
MPI4PY_INCLUDE=`${PYTHON} -c 'import mpi4py; print mpi4py.get_include()'`
if test "X$?" = "X0" ; then
AC_MSG_RESULT([$MPI4PY_INCLUDE])
else
AC_MSG_RESULT([no])
exit 1
fi
AC_SUBST([MPI4PY_INCLUDE])
fi
AC_MSG_RESULT([ok])
else
AC_MSG_CHECKING([if python interface is enabled])
AC_MSG_RESULT([no])
fi
######################## large indices enabled ###########################
AC_MSG_CHECKING([if large indices are enabled])
if test "X$USE_LARGE_INDICES" = "Xyes"; then
AC_MSG_RESULT([yes])
CFLAGS="${CFLAGS} -DUSE_LARGE_INDICES"
else
AC_MSG_RESULT([no])
fi
######################## parallel interface enabled ###########################
AC_MSG_CHECKING([if parallel interface enabled])
if test "X$USE_PARALLEL" = "Xyes"; then
if test "X$ENABLE_PARALLEL" = "Xyes"; then
AC_MSG_RESULT([yes])
CPPFLAGS="${CPPFLAGS} -DPARALLEL_IO -DMPICH_IGNORE_CXX_SEEK"
CFLAGS="${CFLAGS} -DPARALLEL_IO -DMPICH_IGNORE_CXX_SEEK"
if test "X$ENABLE_EXPERIMENTAL" = "Xyes"; then
CPPFLAGS="$CPPFLAGS -DWITH_PARALLEL_H5GRID"
AC_MSG_CHECKING([for ParMETIS])
if test "X$PARMETIS_PREFIX" != "X"; then
CPPFLAGS="$CPPFLAGS -I$PARMETIS_PREFIX/include"
LDFLAGS="$LDFLAGS -L$PARMETIS_PREFIX/lib"
fi
AC_MSG_CHECKING([if we can compile MPI code without setting flags])
AC_TRY_LINK([#include "mpi.h"], [
MPI_Comm comm;
int n;
MPI_Comm_size( comm, &n ); ],
[AC_MSG_RESULT([yes]); r='yes'], [AC_MSG_RESULT([no]); r='no'] )
if test "X$r" = "Xno"; then
AC_MSG_ERROR([MPI wrapper can't compile or link MPI program! Please set the INCLUDE and LIBS variables manually.])
exit 1
fi
TPTARGET="${TPTARGET} H5PartTestP H5PartAndreasTest Bench"
TBTARGET="${TBTARGET} H5BlockTestAttributes"
TBTARGET="${TBTARGET} H5BlockParTestScalarField"
# parallel + fortran
if test "X$USE_FORTRAN" = "Xyes"; then
TPTARGET="${TPTARGET} H5testFpar"
TBTARGET="${TBTARGET} H5BlockParTestScalarFieldF"
fi
LIBS="$LIBS -lparmetis -lmetis"
AC_TRY_LINK([#include <parmetis.h>], [
ParMETIS_V3_PartGeom (NULL, NULL, NULL, NULL, NULL);],
[AC_MSG_RESULT([yes]); r='yes'], [AC_MSG_RESULT([no]); r='no'] )
if test "X$r" = "Xno"; then
AC_MSG_ERROR([ParMETIS])
exit 1
fi
fi
else # --enable-parallel=no
AC_MSG_RESULT([no])
TPTARGET="${TPTARGET} H5test"
TBTARGET="${TBTARGET} H5BlockTestAttributes"
if test "X$USE_FORTRAN" = "Xyes"; then
TPTARGET="${TPTARGET} H5testF"
TBTARGET="${TBTARGET} H5BlockTestAttributesF"
fi
fi
###############################################################################
######################### PATH CHECKING & SETTING #############################
###############################################################################
AC_MSG_CHECKING([for HDF5 root ])
AC_MSG_RESULT([])
if test -n "${HDF5PATH}" ; then
P=${HDF5PATH}
elif test -n "${HDF5ROOT}"; then
P=${HDF5ROOT}
elif test -n "${HDF5HOME}" ; then
P=${HDF5HOME}
elif test -n "${HDF5_DIR}" ; then
P=${HDF5_DIR}
else
P=''
P="$P /usr"
P="$P /usr/local"
P="$P /usr/local/hdf5"
P="$P /usr/local/packages/hdf5"
P="$P /apps/hdf5"
P="$P /opt/hdf5"
fi
PATH_Search HDF5ROOT "$P" include/hdf5.h
if test -z "$HDF5ROOT"; then
AC_MSG_ERROR([Cannot find an HDF5 library!])
exit 1
fi
INCLUDES="$INCLUDES -I$HDF5ROOT/include"
LDFLAGS="$LDFLAGS -L$HDF5ROOT/lib"
LIBS="$LIBS -lhdf5"
AC_MSG_CHECKING([if we need to link to libsz ])
if test -n "$HDF5ROOT"; then
if test -f $HDF5ROOT/lib/libsz.a; then
AC_MSG_RESULT([yes])
LDFLAGS="$LDFLAGS -L$HDF5ROOT/lib"
LIBS="$LIBS -lsz"
else
AC_MSG_RESULT([no])
# LIBRARY PATHS
if test -z "${HDF5_PREFIX}"; then
# alternatives to HDF5_PREFIX
if test -n "${HDF5_DIR}"; then
HDF5_PREFIX=${HDF5_DIR}
fi
fi
if test -n "${HDF5_PREFIX}"; then
CPPFLAGS="$CPPFLAGS -I$HDF5_PREFIX/include"
LDFLAGS="$LDFLAGS -L$HDF5_PREFIX/lib"
fi
AC_CHECK_LIB([z], [compress2])
AC_CHECK_LIB([hdf5], [H5open])
AS_IF([test "x$ac_cv_lib_hdf5_H5open" != xyes],
[AC_MSG_ERROR([Cannot compile and link a HDF5 program]);
exit 1])
AC_MSG_CHECKING([for lustre API ])
AC_MSG_RESULT([])
@@ -357,73 +410,90 @@ if test -z "$LUSTREROOT"; then
AC_MSG_WARN([Couldn't locate the lustre API... building without support for lustre striping!])
else
CFLAGS="$CFLAGS -DH5_USE_LUSTRE"
INCLUDES="$INCLUDES -I$LUSTREROOT/usr/include"
CPPFLAGS="$CPPFLAGS -I$LUSTREROOT/usr/include"
LDFLAGS="$LDFLAGS -L$LUSTREROOT/usr/lib"
LIBS="$LIBS -llustreapi"
fi
LIBS="$LIBS -lz -lm"
LIBS="$LIBS -lm"
###############################################################################
############## EXPORTING VARIABLES & CREATING OUTPUT FILES ####################
# TOOLS
AC_MSG_CHECKING([if we have to compile the VTK to H5hut grid converter])
if test "X$ENABLE_VTKCONVERTER" = "Xyes"; then
AC_MSG_RESULT([yes])
# :TODO: add test whether we can compile/link a prog with vtk
else
AC_MSG_RESULT([no])
fi
###############################################################################
# AC_SUBST (variable, [value])
# Create an output variable from a shell variable. Make AC_OUTPUT substitute
# the variable variable into output files (typically one or more `Makefile's).
# This means that AC_OUTPUT will replace instances of `@variable@' in input
# files with the value that the shell variable variable has when AC_OUTPUT is
# called. This value of variable should not contain literal newlines. If
# value is given, in addition assign it to variable.
AC_SUBST(HDF5ROOT)
AC_SUBST(LUSTREROOT)
# EXAMPLES
AC_MSG_CHECKING([if we have to compile the H5hut examples])
if test "X$ENABLE_EXAMPLES" = "Xyes"; then
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
fi
###############################################################################
# EXPORTING VARIABLES & CREATING OUTPUT FILES
AM_CPPFLAGS=$CPPFLAGS
AM_LDFLAGS=$LDFLAGS
AC_SUBST(HDF5_PREFIX)
AC_SUBST(CFLAGS)
AC_SUBST(FFLAGS)
AC_SUBST(INCLUDES)
AC_SUBST(LDFLAGS)
AC_SUBST(LIBS)
AC_SUBST(UNDERSCORE_H)
AC_SUBST(LIB_C)
AC_SUBST(LIB_FORTRAN)
AC_SUBST(BINDINGS)
AC_SUBST(BUILD_TESTS)
AC_SUBST(BUILD_TOOLS)
AC_SUBST(AM_CPPFLAGS)
AC_SUBST(AM_LDFLAGS)
# Make AC_OUTPUT create each `file' by copying an input file (by default `file.in'),
# substituting the output variable values.
AC_CONFIG_FILES([
Makefile
src/Makefile
src/C/Makefile
src/h5core/Makefile
src/include/Makefile
src/include/h5core/Makefile
src/C/Makefile
src/Fortran/Makefile
src/Python/Makefile
test/Makefile
test/H5Fed/Makefile
doc/Makefile
tools/Makefile
tools/h5hutcc
tools/vtk2h5grid/Makefile
examples/H5/Makefile
examples/H5Part/Makefile
examples/H5Block/Makefile
examples/H5Fed/Makefile
])
AC_OUTPUT
###############################################################################
########################## PRINTING SUMMARY ###################################
###############################################################################
# PRINTING SUMMARY
AC_MSG_RESULT([ ])
AC_MSG_RESULT([Summary:])
AC_MSG_RESULT([ ])
AC_MSG_RESULT([Host OS: $host_os])
AC_MSG_RESULT([Host CPU: $host_cpu])
AC_MSG_RESULT([Host vendor: $host_vendor])
AC_MSG_RESULT([Build libraries: $BUILD_LIBS])
AC_MSG_RESULT([Build test programs: $BUILD_TESTS])
AC_MSG_RESULT([Build tools: $BUILD_TOOLS])
AC_MSG_RESULT([CC = $CC])
AC_MSG_RESULT([CXX = $CXX])
AC_MSG_RESULT([FC = $FC])
AC_MSG_RESULT([CFLAGS = $CFLAGS])
AC_MSG_RESULT([FFLAGS = $FFLAGS])
AC_MSG_RESULT([INCLUDES = $INCLUDES])
AC_MSG_RESULT([LDFLAGS = $LDFLAGS])
AC_MSG_RESULT([AM_CPPFLAGS = $AM_CPPFLAGS])
AC_MSG_RESULT([AM_LDFLAGS = $AM_LDFLAGS])
AC_MSG_RESULT([LIBS = $LIBS])
AC_MSG_RESULT([HDF5ROOT = $HDF5ROOT])
AC_MSG_RESULT([HDF5_PREFIX = $HDF5_PREFIX])
AC_MSG_RESULT([LUSTREROOT = $LUSTREROOT])
if test "x$ENABLE_PYTHON" = "xyes"; then
AC_MSG_RESULT([PYTHON = $PYTHON])
AC_MSG_RESULT([SWIG = $SWIG])
AC_MSG_RESULT([NUMPY_INCLUDE = $NUMPY_INCLUDE])
if test "x$ENABLE_PARALLEL" = "xyes"; then
AC_MSG_RESULT([MPI4PY_INCLUDE = $MPI4PY_INCLUDE])
fi
fi
AC_MSG_RESULT([ ])
+2303 -143
View File
File diff suppressed because it is too large Load Diff
+136 -104
View File
@@ -16,7 +16,6 @@ Developers:
<UL>
<LI> Andreas Adelmann (PSI) </LI>
<LI> Achim Gsell (PSI) </LI>
<LI> Benedikt Oswald (PSI) </LI>
<LI> Mark Howison (NERSC/LBNL) </LI>
<LI> Prabhat (NERSC/LBNL) </LI>
<LI> Wes Bethel (NERSC/LBNL) </LI>
@@ -25,115 +24,148 @@ Developers:
Previous developers:
<UL>
<LI> John Shalf (NERSC/LBNL)</LI>
<LI> Benedikt Oswald (PSI) </LI>
<LI> Cristina Siegerist (NERSC/LBNL)</LI>
<LI> John Shalf (NERSC/LBNL)</LI>
</UL>
For more information, please contact the <a href="mailto:h5part@lists.psi.ch">h5part</a> mailing list.
For more information, please contact the
<a href="mailto:h5part@lists.psi.ch">h5part</a> mailing list.
\defgroup c_api C API
@{
\note The C API is implemented with '\c static \c inline' functions to minimize overhead.
\defgroup h5_c_api H5
@{
\defgroup h5_file File interface
In this section we document the interface for accessing H5hut files.
\defgroup h5_model Setting up the data model
The fundamental data model of H5hut is pretty simple. There
are (time-)steps to group data, that's it. In this section we
document the interface to these (time-)steps.
\defgroup h5_file_attribs File attributes interface
File attributes are small datasets that can be used to
describe specific properties of a file. The H5hut API provides
functions to attach (write), read and inquire file attributes.
\defgroup h5_step_attribs Step attributes interface
Step attributes are similar to file attributes but are
attached to (time-)steps. They can be used to describe
specific properties of a specific step. The H5hut API provides
functions to attach (write), read and inquire step attributes.
\defgroup h5_attach Attaching files
Sometimes it is required (or at least useful) to attach
additional information to H5hut files. H5hut provides
functions to attach other files to H5hut files. The attached
files can be of any type.
\defgroup h5_log Controlling verbosity level
Controlling the verbosity level of H5hut. By default only
error messages are printed. For debugging it might be helpful
to increase the verbosity level.
\defgroup h5_debug Controlling debug output
Debug output mainly intended for developers.
\defgroup h5_error Error handling interface
H5hut comes with two error handler. The default error handler
prints an error message (which can be suppressed by setting
the verbosity level to \c 0), sets an internal error number
and returns to the calling program with the value \c
H5_FAILURE. It is up to the programmer to handle the error
properly. In certain use-cases it make sense just to abort the
program, so no additional error handling is needed. H5hut
provides an abort error-handler for this use-cases-
@}
\defgroup h5part_c_api H5Part
@{
\defgroup h5part_model Setting up the data model
The H5Part data model interface provides functions to set and
inquire (per core) views on datasets.
\defgroup h5part_io Dataset interface
The dataset interface provides functions to read and write
datasets. The following data types are supported:
- 64-bit floating point numbers (\c h5_float64_t)
- 32-bit floating point numbers (\c h5_float32_t)
- 64-bit integers (\c h5_int64_t)
- 32-bit integers (\c h5_int32_t)
\note Before you can write or read a dataset, you have to
define a "view" on the dataset for each core.
@}
\defgroup h5block_c_api H5Block
@{
\defgroup h5block_model Setting up the data model
The H5Block data model interface provides functions to set and
inquire (per core) views on fields.
\defgroup h5block_io Interface to block structured data
H5Block provides functions to store and retrieve
- 3-dimensional fields with scalar values
- 3-dimensional fields with 3-dimensional vectors as values
The following datatypes are supported:
- 64-bit floating point numbers (\c h5_float64_t)
- 32-bit floating point numbers (\c h5_float32_t)
- 64-bit integers (\c h5_int64_t)
- 32-bit integers (\c h5_int32_t)
\defgroup h5block_attrib Attaching attributes to field data
Field attributes are small datasets that can be used to
describe specific properties of a field like origin, spacing
or coordinates. The H5hut API provides functions to attach
(write), read and inquire file attributes.
@}
@}
*/
/*!
\defgroup h5hut_c_api H5hut C API
*/
/*!
\ingroup h5hut_c_api
\defgroup h5hut_file File Handling
*/
/*!
\ingroup h5hut_c_api
\defgroup h5hut_error Error Handling
*/
/*!
\ingroup h5hut_c_api
\defgroup h5hut_model Setting up the Data Model
*/
/*!
\ingroup h5hut_c_api
\defgroup h5hut_attrib Reading and Writing Attributes
*/
/*!
\defgroup h5part_c_api H5Part C API
*/
/*!
\ingroup h5part_c_api
\defgroup h5part_model Setting up the Data Model
*/
/*!
\ingroup h5part_c_api
\defgroup h5part_data Reading and Writing Datasets
*/
/*!
\defgroup h5block_c_api H5Block C API
*/
*/!
\ingroup h5block_c_api
\defgroup h5block_model Setting up the Data Model
*/
\ingroup h5block_c_api
\defgroup h5block_data Reading and Writing Datasets
*/
\ingroup h5block_c_api
\defgroup h5block_attrib Reading and Writing Attributes
*/
/*!
\defgroup h5fed_c_api H5Fed C API
*/
/*!
\defgroup h5hut_f90_api H5hut F90 API
*/
/*!
\ingroup h5hut_f90_api
\defgroup h5hut_file_f File Handling
*/
/*!
\ingroup h5hut_f90_api
\defgroup h5hut_model_f Setting up the Data Model
*/
/*!
\ingroup h5hut_f90_api
\defgroup h5hut_attrib_f Reading and Writing Attributes
!<
/*!
\defgroup h5part_f90_api H5Part F90 API
*/
/*!
\ingroup h5part_f90_api
\defgroup h5part_model_f Setting up the Data Model
*/
/*!
\ingroup h5part_f90_api
\defgroup h5part_data_f Reading and Writing Datasets
*/
/*!
\defgroup h5block_f90_api H5Block F90 API
*/
/*!
\ingroup h5block_f90_api
\defgroup h5block_model_f Setting up the Data Model
*/
/*!
\ingroup h5block_f90_api
\defgroup h5block_data_f Reading and Writing Datasets
*/
/*!
\ingroup h5block_f90_api
\defgroup h5block_attrib_f Reading and Writing Attributes
\defgroup f90_api Fortran90 API
@{
\defgroup h5_f90_api H5
@{
\defgroup h5_file_f file interface
\defgroup h5_model_f setting up the data model
\defgroup h5_file_attribs_f reading and writing file attributes
\defgroup h5_step_attribs_f reading and writing step attributes
\defgroup h5_log_f control verbosity level
\defgroup h5_debug_f control debug output
\defgroup h5_error_f error handling interface
@}
\defgroup h5part_f90_api H5Part
@{
\defgroup h5part_model_f setting up the data model
\defgroup h5part_io_f reading and writing datasets
@}
\defgroup h5block_f90_api H5Block
@{
\defgroup h5block_model_f setting up the data model
\defgroup h5block_io_f reading and writing datasets
\defgroup h5block_attrib_f reading and writing attributes
@}
@}
*/
+3 -2
View File
@@ -9,5 +9,6 @@ doc:
doxydoc:
doxygen
clean:
${RM} -rf ReferencePages TWiki
clean-local:
$(RM) -r ReferencePages TWiki
$(RM) *~
+2
View File
@@ -0,0 +1,2 @@
+4
View File
@@ -0,0 +1,4 @@
<style type="text/css">
h1 { text-align: center; }
</style>
+39
View File
@@ -0,0 +1,39 @@
#!/usr/bin/env python
from lxml import etree
from lxml.html import builder as E
import os
import re
tree = etree.parse('tagfile')
tags = tree.xpath ('//member[@kind="function"]')
tags_per_files = {}
for tag in tags:
name = tag.find("name").text
anchor = tag.find("anchor").text
anchorfile = tag.find("anchorfile").text
if anchorfile in tags_per_files:
tags_per_files[anchorfile].append([name, anchor])
else:
tags_per_files[anchorfile] = [[name, anchor]]
prefix = None
for line in open("Doxyfile", "r"):
if re.search ("^OUTPUT_DIRECTORY", line):
prefix = line.split("=")[-1].strip()
if not prefix:
prefix = "."
parser = etree.HTMLParser()
for filename,anchors in tags_per_files.items():
print "Processing file: %s/%s" % (prefix, filename)
tree = etree.parse ("%s/%s" % (prefix, filename), parser)
for name,id in anchors:
anchor = tree.xpath ('//a[@id="%s"]' % id)
el = E.A(id="%s" % name)
anchor[0].addnext (el)
f = open ("%s/%s" % (prefix, filename), "w")
f.write (etree.tostring (tree))
+58
View File
@@ -0,0 +1,58 @@
#
# Copyright (c) 2006-2015, The Regents of the University of California,
# through Lawrence Berkeley National Laboratory (subject to receipt of any
# required approvals from the U.S. Dept. of Energy) and the Paul Scherrer
# Institut (Switzerland). All rights reserved.!
#
# License: see file COPYING in top level of source distribution.
#
AM_CPPFLAGS += -I${abs_top_srcdir}/src/include
FFLAGS += -cpp $(AM_CPPFLAGS)
AM_LDFLAGS += -L${abs_top_builddir}/src/h5core/.libs
LDADD =
if ENABLE_FORTRAN
LDADD += -lH5hutF
AM_LDFLAGS += -L${abs_top_builddir}/src/Fortran/.libs
endif
LDADD += -lH5hut
noinst_PROGRAMS =
if ENABLE_EXAMPLES
if ENABLE_C
noinst_PROGRAMS += \
attach_file \
openclose \
query \
read_file_attribs \
read_step_attribs \
write_file_attribs \
write_step_attribs
endif
if ENABLE_FORTRAN
if ENABLE_PARALLEL
noinst_PROGRAMS += \
openclosef \
queryf \
read_file_attribsf \
read_step_attribsf \
write_file_attribsf \
write_step_attribsf
openclosef_SOURCES = openclosef.f90
queryf_SOURCES = queryf.f90
read_file_attribsf_SOURCES = read_file_attribsf.f90
read_step_attribsf_SOURCES = read_step_attribsf.f90
write_file_attribsf_SOURCES = write_file_attribsf.f90
write_step_attribsf_SOURCES = write_step_attribsf.f90
endif
endif
endif
%.o : %.f90
$(FC) $(FFLAGS) -c $<
+46
View File
@@ -0,0 +1,46 @@
/*
Copyright (c) 2006-2015, The Regents of the University of California,
through Lawrence Berkeley National Laboratory (subject to receipt of any
required approvals from the U.S. Dept. of Energy) and the Paul Scherrer
Institut (Switzerland). All rights reserved.
License: see file COPYING in top level of source distribution.
*/
#include <H5hut.h>
#include <fcntl.h>
#include <stdlib.h>
#include <sys/stat.h>
#define FNAME "attach_file.h5"
#define ATTACHMENT "attach_file"
int
main (
int argc,
char* argv[]
) {
MPI_Init (&argc, &argv);
H5SetErrorHandler (H5AbortErrorhandler);
H5SetVerbosityLevel (255);
h5_file_t f = H5OpenFile (FNAME, H5_O_WRONLY, H5_PROP_DEFAULT);
H5AddAttachment (f, ATTACHMENT);
H5CloseFile (f);
f = H5OpenFile (FNAME, H5_O_RDONLY, H5_PROP_DEFAULT);
h5_ssize_t num_attachments = H5GetNumAttachments (f);
printf ("Number of attachments: %lld\n", (long long int)num_attachments);
int i;
char fname[FILENAME_MAX];
h5_size_t fsize;
for (i=0; i < num_attachments; i++) {
H5GetAttachmentInfoByIdx (f, i, fname, sizeof(fname), &fsize);
printf (
"Attachment %d: Name: %s, Size: %llu\n",
i, fname, (long long unsigned)fsize);
H5GetAttachment (f, fname);
H5DeleteAttachment (f, fname);
}
H5CloseFile (f);
return 0;
}
+33
View File
@@ -0,0 +1,33 @@
/*
Copyright (c) 2006-2015, The Regents of the University of California,
through Lawrence Berkeley National Laboratory (subject to receipt of any
required approvals from the U.S. Dept. of Energy) and the Paul Scherrer
Institut (Switzerland). All rights reserved.
License: see file COPYING in top level of source distribution.
*/
#include "H5hut.h"
int
main (
int argc,
char** argv
) {
MPI_Comm comm = MPI_COMM_WORLD;
int myproc;
int nprocs;
MPI_Init (&argc, &argv);
MPI_Comm_size (comm, &nprocs);
MPI_Comm_rank (comm, &myproc);
h5_prop_t prop = H5CreateFileProp ();
H5SetPropFileMPIOCollective (prop, &comm);
h5_file_t f = H5OpenFile ("testfile.h5", H5_O_WRONLY, prop);
H5CloseProp (prop);
H5CloseFile (f);
MPI_Finalize ();
return 0;
}
+35
View File
@@ -0,0 +1,35 @@
!
! Copyright (c) 2006-2015, The Regents of the University of California,
! through Lawrence Berkeley National Laboratory (subject to receipt of any
! required approvals from the U.S. Dept. of Energy) and the Paul Scherrer
! Institut (Switzerland). All rights reserved.!
!
! License: see file COPYING in top level of source distribution.
!
include 'H5hut.f90'
program openclose
use H5hut
implicit none
include 'mpif.h'
integer :: comm, rank, ierr
integer*8 :: file_id, status
integer*8 :: props
comm = MPI_COMM_WORLD
call mpi_init(ierr)
call mpi_comm_rank(comm, rank, ierr)
props = h5_createprop_file ()
status = h5_setprop_file_mpio_collective (props, comm)
file_id = h5_openfile ("testfile.h5", H5_O_WRONLY, props)
status = h5_closeprop (props)
status = h5_closefile (file_id);
call mpi_finalize(ierr)
end program openclose
+136
View File
@@ -0,0 +1,136 @@
/*
Copyright (c) 2006-2015, The Regents of the University of California,
through Lawrence Berkeley National Laboratory (subject to receipt of any
required approvals from the U.S. Dept. of Energy) and the Paul Scherrer
Institut (Switzerland). All rights reserved.
License: see file COPYING in top level of source distribution.
*/
#include "H5hut.h"
#define FNAME1 "example_file_attribs.h5"
#define FNAME2 "example_step_attribs.h5"
/*
Due to the way types are defined in H5hut, we cannot use "switch() {}"
*/
const char*
type2string (
h5_int64_t type
) {
if (type == H5_FLOAT64_T)
return "H5_FLOAT64_T";
if (type == H5_FLOAT32_T)
return "H5_FLOAT32_T";
if (type == H5_INT64_T)
return "H5_INT64_T";
if (type == H5_INT32_T)
return "H5_INT32_T";
if (type == H5_STRING_T)
return "H5_STRING_T";
return "unknown type";
}
static inline void
print_header (
h5_int64_t n
) {
if (n > 0) {
printf ("\t%-6s %-30s %-15s %-10s\n", "idx", "name", "type", "dim");
}
}
static inline void
print_query_result (
h5_int64_t i,
const char* const name,
h5_int64_t type,
h5_int64_t dim
) {
printf ("\t%-6lld %-30s %-15s %-10lld\n", (long long)i, name, type2string(type), (long long)dim);
}
void
query_file_attribs (
h5_int64_t f
) {
char name[H5_MAX_NAME_LEN];
h5_int64_t type;
h5_size_t dim;
// query # of file attributes
h5_int64_t n = H5GetNumFileAttribs (f);
printf ("\tNumber of file attributes: %lld\n", (long long)n);
// output name and type of all file attribute
print_header (n);
for (h5_int64_t i = 0; i < n; i++) {
H5GetFileAttribInfo (f, i, name, sizeof(name), &type, &dim);
print_query_result (i, name, type, dim);
}
printf ("\n");
}
void
query_step_attribs (
h5_int64_t f,
h5_int64_t step
) {
char name[H5_MAX_NAME_LEN];
h5_int64_t type;
h5_size_t dim;
H5SetStep (f, step);
// query # of step attributes
h5_int64_t n = H5GetNumStepAttribs (f);
printf ("\tNumber of step attributes: %lld\n", (long long)n);
// output name and type of all step attribute
print_header (n);
for (h5_int64_t i = 0; i < n; i++) {
H5GetStepAttribInfo (f, i, name, sizeof(name), &type, &dim);
print_query_result (i, name, type, dim);
}
}
void
query_file (
const char* const fname
) {
printf ("\nFile: %s\n", fname);
// if file properties is set to default, MPI_COMM_WORLD will be used
h5_file_t f = H5OpenFile (fname, H5_O_RDONLY, H5_PROP_DEFAULT);
// query and output file attribs
query_file_attribs (f);
// query # of steps, if > 0: go to first step, query and output step attribs
h5_int64_t n = H5GetNumSteps (f);
printf ("\tNumber of steps: %lld\n", (long long)n);
if (n > 0) {
// go to first step
h5_int64_t i = -1;
while (!H5HasStep (f, ++i));
query_step_attribs (f, i);
}
H5CloseFile (f);
}
int
main (
int argc,
char** argv
) {
MPI_Init (&argc, &argv);
H5AbortOnError ();
query_file (FNAME1);
query_file (FNAME2);
MPI_Finalize ();
return 0;
}
+167
View File
@@ -0,0 +1,167 @@
!
! Copyright (c) 2006-2013, The Regents of the University of California,
! through Lawrence Berkeley National Laboratory (subject to receipt of any
! required approvals from the U.S. Dept. of Energy) and the Paul Scherrer
! Institut (Switzerland). All rights reserved.!
!
! License: see file COPYING in top level of source distribution.
!
include 'H5hut.f90'
program query
use H5hut
implicit none
include 'mpif.h'
! the file name we want to read
character (len=*), parameter :: FNAME1 = "example_file_attribs.h5"
character (len=*), parameter :: FNAME2 = "example_step_attribs.h5"
! verbosity level: set it to a power of 2 minus one or zero
integer*8, parameter :: verbosity_level = 1
! used for mpi error return
integer :: ierr
call mpi_init (ierr)
! abort program on any H5hut error
call h5_abort_on_error ()
call h5_set_verbosity_level (verbosity_level)
call query_file (FNAME1);
call query_file (FNAME2);
call mpi_finalize(ierr)
call exit (ierr)
contains
subroutine query_file (fname)
character(len=*), intent(in):: fname
integer*8 file_id
integer*8 i, n, status
write (*, '("File: ", a)') fname
! if file properties is set to default, MPI_COMM_WORLD will be used
file_id = h5_openfile (fname, H5_O_RDONLY, H5_PROP_DEFAULT)
! query and output file attribs
call query_file_attribs (file_id);
! query # of steps, if > 0: go to first step, query and output step attribs
n = h5_getnsteps (file_id);
write (*, '(T8, "Number of steps: ", I0)') n
if (n > 0) then
! go to first step
i = 0;
do
if (h5_hasstep (file_id, i)) exit
i = i+1
end do
call query_step_attribs (file_id, i);
end if
status = h5_closefile (file_id)
end subroutine query_file
! print header for attribute metadata table
subroutine print_header (n)
integer*8, intent(in):: n
character(len=6), parameter :: idx = "idx"
character(len=30), parameter :: name = "name"
character(len=15), parameter :: type = "type"
character(len=10), parameter :: dim = "dim"
if (n > 0) then
write (*, '(T8, A, 1X, A, 1X, A, 1X, A)') idx, name, type, dim
end if
end subroutine print_header
! output attribute metadata
subroutine print_query_result (i, name, type, dim)
integer*8, intent(in):: i
character(len=*), intent(in):: name
integer*8, intent(in):: type
integer*8, intent(in):: dim
character(len=30) name_
character(len=15) type_, type_char
character(len=6) i_
character(len=10) dim_
if (type == H5_FLOAT64_T) then
type_char = "H5_FLOAT64_T"
else if (type == H5_FLOAT32_T) then
type_char = "H5_FLOAT32_T"
else if (type == H5_INT64_T) then
type_char = "H5_INT64_T"
else if (type == H5_INT32_T) then
type_char = "H5_INT32_T"
else if (type == H5_STRING_T) then
type_char = "H5_STRING_T"
else
type_char = "unknown type"
end if
write (i_, '(I6)') i
write (name_, '(A30)') name
write (type_, '(A15)') type_char
write (dim_, '(I10)') dim
write (*, '(T8, A6, 1X, A30, 1X, A15, 1X, A10)') adjustl(i_), adjustl(name_), adjustl(type_), adjustl(dim_)
end subroutine print_query_result
subroutine query_file_attribs (file_id)
integer*8, intent(in):: file_id
integer*8 status
integer*8 i, n
character(len=H5_MAX_NAME_LEN) name
integer*8 type, dim
! query # of file attributes
n = h5_getnfileattribs (file_id);
write (*, '(T8, "Number of file attributes: ", I0)') n
! output name and type of all file attribute
call print_header (n);
do i = 1, n
status = h5_getfileattribinfo (file_id, i, name, type, dim);
call print_query_result (i, name, type, dim);
end do
write (*,*)
end subroutine query_file_attribs
subroutine query_step_attribs (file_id, stepno)
integer*8, intent(in):: file_id
integer*8, intent(in):: stepno
integer*8 status
integer*8 i, n
character(len=H5_MAX_NAME_LEN) name
integer*8 type, dim
! Go to step #1
status = h5_setstep (file_id, stepno);
! query # of step attributes
n = h5_getnstepattribs (file_id)
write (*, '(T8, "Number of step attributes: ", i0)') n
! output name and type of all step attribute
call print_header (n)
do i = 1, n
status = h5_getstepattribinfo (file_id, i, name, type, dim)
call print_query_result (i, name, type, dim)
end do
end subroutine query_step_attribs
end program query
+85
View File
@@ -0,0 +1,85 @@
/*
Copyright (c) 2006-2015, The Regents of the University of California,
through Lawrence Berkeley National Laboratory (subject to receipt of any
required approvals from the U.S. Dept. of Energy) and the Paul Scherrer
Institut (Switzerland). All rights reserved.
License: see file COPYING in top level of source distribution.
*/
#include "H5hut.h"
#define FNAME "example_file_attribs.h5"
#define VERBOSITY H5_VERBOSE_ERROR
#define ATTR_STRING "FileAttrString"
#define ATTR_INT32 "FileAttrInt32"
#define ATTR_INT64 "FileAttrInt64"
#define ATTR_FLOAT32 "FileAttrFloat32"
#define ATTR_FLOAT64 "FileAttrFloat64"
int
main (
int argc,
char** argv
) {
H5AbortOnError ();
H5SetVerbosityLevel (VERBOSITY);
MPI_Init (&argc, &argv);
// if file properties is set to default, MPI_COMM_WORLD will be used
h5_file_t f = H5OpenFile (FNAME, H5_O_RDONLY, H5_PROP_DEFAULT);
h5_size_t len;
H5GetFileAttribInfoByName (f, ATTR_STRING, NULL, &len);
char* attr_string = (char*)malloc (len+1);
H5ReadFileAttribString (f, ATTR_STRING, attr_string);
printf ("%s: %s\n", ATTR_STRING, attr_string);
free (attr_string);
H5GetFileAttribInfoByName (f, ATTR_INT32, NULL, &len);
int32_t* attr_int32 = (int32_t*)malloc (sizeof(*attr_int32)*len);
H5ReadFileAttribInt32 (f, ATTR_INT32, attr_int32);
printf ("%s:", ATTR_INT32);
for (int i = 0; i < len; i++) {
printf (" %d", attr_int32[i]);
}
printf ("\n");
free (attr_int32);
H5GetFileAttribInfoByName (f, ATTR_INT64, NULL, &len);
int64_t* attr_int64 = (int64_t*)malloc (sizeof(*attr_int64)*len);
H5ReadFileAttribInt64 (f, ATTR_INT64, attr_int64);
printf ("%s:", ATTR_INT64);
for (int i = 0; i < len; i++) {
printf (" %lld", (long long int)attr_int64[i]);
}
printf ("\n");
free (attr_int64);
H5GetFileAttribInfoByName (f, ATTR_FLOAT32, NULL, &len);
h5_float32_t* attr_float32 = (h5_float32_t*)malloc (sizeof(*attr_float32)*len);
H5ReadFileAttribFloat32 (f, ATTR_FLOAT32, attr_float32);
printf ("%s:", ATTR_FLOAT32);
for (int i = 0; i < len; i++) {
printf (" %f", attr_float32[i]);
}
printf ("\n");
free (attr_float32);
H5GetFileAttribInfoByName (f, ATTR_FLOAT64, NULL, &len);
h5_float64_t* attr_float64 = (h5_float64_t*)malloc (sizeof(*attr_float64)*len);
H5ReadFileAttribFloat64 (f, ATTR_FLOAT64, attr_float64);
printf ("%s:", ATTR_FLOAT64);
for (int i = 0; i < len; i++) {
printf (" %f", attr_float64[i]);
}
printf ("\n");
free (attr_float64);
// cleanup
H5CloseFile (f);
MPI_Finalize ();
return 0;
}
+114
View File
@@ -0,0 +1,114 @@
!
! Copyright (c) 2006-2015, The Regents of the University of California,
! through Lawrence Berkeley National Laboratory (subject to receipt of any
! required approvals from the U.S. Dept. of Energy) and the Paul Scherrer
! Institut (Switzerland). All rights reserved.!
!
! License: see file COPYING in top level of source distribution.
!
include 'H5hut.f90'
program read_file_attribs
use H5hut
implicit none
include 'mpif.h'
! the file name we want to read
character (len=*), parameter :: FNAME = "example_file_attribs.h5"
! verbosity level: set it to
! - 1 to see error messages, if something goes wrong
! - 0 to get no output
! - a power of 2 minus one to get lot of output
! zeror zero
integer*8, parameter :: verbosity_level = 1
! we know the attribute names!
character (len=*), parameter :: ATTR_STRING = "FileAttrString"
character (len=*), parameter :: ATTR_I4 = "FileAttrInt32"
character (len=*), parameter :: ATTR_I8 = "FileAttrInt64"
character (len=*), parameter :: ATTR_R4 = "FileAttrFloat32"
character (len=*), parameter :: ATTR_R8 = "FileAttrFloat64"
! for formated output
character (len=128) :: fmt
! attribute values. Note: allocatable strings aren't supported in Fortran90
character (len=256) :: string_value
integer*4, allocatable :: i4_value (:)
integer*8, allocatable :: i8_value (:)
real*4, allocatable :: r4_value (:)
real*8, allocatable :: r8_value (:)
! used for mpi error return
integer :: ierr
! H5hut file id
integer*8 :: file_id
! H5hut API status return
integer*8 status
! type of attribute
integer*8 type
! len of attribute
integer*8 len
! loop index
integer*8 i
call mpi_init (ierr)
! abort program on any H5hut error
call h5_abort_on_error ()
call h5_set_verbosity_level (verbosity_level)
! MPI_COMM_WORLD is used, if file is opened with default properties
file_id = h5_openfile (FNAME, H5_O_RDONLY, H5_PROP_DEFAULT)
! read and output string attribute
status = h5_getfileattribinfo_by_name (file_id, ATTR_STRING, type, len)
status = h5_readfileattrib_string (file_id, ATTR_STRING, string_value)
write (fmt, "(a, i0, a)") '(a', len, ')'
write (*, "(a, ' = ')", advance='no') ATTR_STRING
write (*, fmt) string_value
! read and output 32bit integer attribute
status = h5_getfileattribinfo_by_name (file_id, ATTR_I4, type, len)
allocate (i4_value(len))
status = h5_readfileattrib_i4 (file_id, ATTR_I4, i4_value)
write (fmt, "(a, i0, a)") '(', len, 'i4)'
write (*, "(a, ' =')", advance='no') ATTR_I4
write (*, fmt) (i4_value(i), i = 1, len)
! read and output 64bit integer attribute
status = h5_getfileattribinfo_by_name (file_id, ATTR_I8, type, len)
allocate (i8_value(len))
status = h5_readfileattrib_i8 (file_id, ATTR_I8, i8_value)
write (fmt, "(a, i0, a)") '(', len, 'i4)'
write (*, "(a, ' =')", advance='no') ATTR_I8
write (*, fmt) (i8_value(i), i = 1, len)
! read and output 32bit floating point attribute
status = h5_getfileattribinfo_by_name (file_id, ATTR_R4, type, len)
allocate (r4_value(len))
status = h5_readfileattrib_r4 (file_id, ATTR_R4, r4_value)
write (fmt, "(a, i0, a)") '(', len, 'f10.5)'
write (*, "(a, ' =')", advance='no') ATTR_R4
write (*, fmt) (r4_value(i), i = 1, len)
! read and output 64bit floating point attribute
status = h5_getfileattribinfo_by_name (file_id, ATTR_R8, type, len)
allocate (r8_value(len))
status = h5_readfileattrib_r8 (file_id, ATTR_R8, r8_value)
write (fmt, "(a, i0, a)") '(', len, 'f10.5)'
write (*, "(a, ' =')", advance='no') ATTR_R8
write (*, fmt) (r8_value(i), i = 1, len)
! cleanup
status = h5_closefile (file_id)
call mpi_finalize(ierr)
end program read_file_attribs
+84
View File
@@ -0,0 +1,84 @@
/*
Copyright (c) 2006-2015, The Regents of the University of California,
through Lawrence Berkeley National Laboratory (subject to receipt of any
required approvals from the U.S. Dept. of Energy) and the Paul Scherrer
Institut (Switzerland). All rights reserved.
License: see file COPYING in top level of source distribution.
*/
#include "H5hut.h"
#define FNAME "example_step_attribs.h5"
#define ATTR_STRING "StepAttrString"
#define ATTR_INT32 "StepAttrInt32"
#define ATTR_INT64 "StepAttrInt64"
#define ATTR_FLOAT32 "StepAttrFloat32"
#define ATTR_FLOAT64 "StepAttrFloat64"
int
main (
int argc,
char** argv
) {
h5_size_t len;
MPI_Init (&argc, &argv);
H5AbortOnError ();
// if file properties is set to default, MPI_COMM_WORLD will be used
h5_file_t f = H5OpenFile (FNAME, H5_O_RDONLY, H5_PROP_DEFAULT);
H5SetStep (f, 1);
H5GetStepAttribInfoByName (f, ATTR_STRING, NULL, &len);
char* attr_string = (char*)malloc (len+1);
H5ReadStepAttribString (f, ATTR_STRING, attr_string);
printf ("%s: %s\n", ATTR_STRING, attr_string);
free (attr_string);
H5GetStepAttribInfoByName (f, ATTR_INT32, NULL, &len);
int32_t* attr_int32 = (int32_t*)malloc (sizeof(*attr_int32)*len);
H5ReadStepAttribInt32 (f, ATTR_INT32, attr_int32);
printf ("%s:", ATTR_INT32);
for (int i = 0; i < len; i++) {
printf (" %d", attr_int32[i]);
}
printf ("\n");
free (attr_int32);
H5GetStepAttribInfoByName (f, ATTR_INT64, NULL, &len);
int64_t* attr_int64 = (int64_t*)malloc (sizeof(*attr_int64)*len);
H5ReadStepAttribInt64 (f, ATTR_INT64, attr_int64);
printf ("%s:", ATTR_INT64);
for (int i = 0; i < len; i++) {
printf (" %lld", (long long int)attr_int64[i]);
}
printf ("\n");
free (attr_int64);
H5GetStepAttribInfoByName (f, ATTR_FLOAT32, NULL, &len);
h5_float32_t* attr_float32 = (h5_float32_t*)malloc (sizeof(*attr_float32)*len);
H5ReadStepAttribFloat32 (f, ATTR_FLOAT32, attr_float32);
printf ("%s:", ATTR_FLOAT32);
for (int i = 0; i < len; i++) {
printf (" %f", attr_float32[i]);
}
printf ("\n");
free (attr_float32);
H5GetStepAttribInfoByName (f, ATTR_FLOAT64, NULL, &len);
h5_float64_t* attr_float64 = (h5_float64_t*)malloc (sizeof(*attr_float64)*len);
H5ReadStepAttribFloat64 (f, ATTR_FLOAT64, attr_float64);
printf ("%s:", ATTR_FLOAT64);
for (int i = 0; i < len; i++) {
printf (" %f", attr_float64[i]);
}
printf ("\n");
free (attr_float64);
H5CloseFile (f);
MPI_Finalize ();
return 0;
}
+113
View File
@@ -0,0 +1,113 @@
!
! Copyright (c) 2006-2015, The Regents of the University of California,
! through Lawrence Berkeley National Laboratory (subject to receipt of any
! required approvals from the U.S. Dept. of Energy) and the Paul Scherrer
! Institut (Switzerland). All rights reserved.!
!
! License: see file COPYING in top level of source distribution.
!
include 'H5hut.f90'
program read_step_attribs
use H5hut
implicit none
include 'mpif.h'
! the file name we want to read
character (len=*), parameter :: FNAME = "example_file_attribs.h5"
! verbosity level: set it to a power of 2 minus one or zero
integer*8, parameter :: verbosity_level = 1
! we know the attribute names!
character (len=*), parameter :: ATTR_STRING = "StepAttrString"
character (len=*), parameter :: ATTR_I4 = "StepAttrInt32"
character (len=*), parameter :: ATTR_I8 = "StepAttrInt64"
character (len=*), parameter :: ATTR_R4 = "StepAttrFloat32"
character (len=*), parameter :: ATTR_R8 = "StepAttrFloat64"
! for formated output
character (len=128) :: fmt
! attribute values. Note: allocatable strings aren't supported in Fortran90
character (len=256) :: string_value
integer*4, allocatable :: i4_value (:)
integer*8, allocatable :: i8_value (:)
real*4, allocatable :: r4_value (:)
real*8, allocatable :: r8_value (:)
! used for mpi error return
integer :: ierr
! H5hut file id
integer*8 :: file_id
! H5hut API status return
integer*8 status
! type of attribute
integer*8 type
! len of attribute
integer*8 len
! loop index
integer*8 i
call mpi_init (ierr)
! abort program on any H5hut error
call h5_abort_on_error ()
call h5_set_verbosity_level (verbosity_level)
! MPI_COMM_WORLD is used, if file is opened with default properties
file_id = h5_openfile (FNAME, H5_O_RDONLY, H5_PROP_DEFAULT)
! open step 1
status = h5_setstep (file_id, int8(1))
! read and output string attribute
status = h5_getstepattribinfo_by_name (file_id, ATTR_STRING, type, len)
status = h5_readstepattrib_string (file_id, ATTR_STRING, string_value)
write (fmt, "(a, i0, a)") '(a', len, ')'
write (*, "(a, ' = ')", advance='no') ATTR_STRING
write (*, fmt) string_value
! read and output 32bit integer attribute
status = h5_getstepattribinfo_by_name (file_id, ATTR_I4, type, len)
allocate (i4_value(len))
status = h5_readstepattrib_i4 (file_id, ATTR_I4, i4_value)
write (fmt, "(a, i0, a)") '(', len, 'i4)'
write (*, "(a, ' =')", advance='no') ATTR_I4
write (*, fmt) (i4_value(i), i = 1, len)
! read and output 64bit integer attribute
status = h5_getstepattribinfo_by_name (file_id, ATTR_I8, type, len)
allocate (i8_value(len))
status = h5_readstepattrib_i8 (file_id, ATTR_I8, i8_value)
write (fmt, "(a, i0, a)") '(', len, 'i4)'
write (*, "(a, ' =')", advance='no') ATTR_I8
write (*, fmt) (i8_value(i), i = 1, len)
! read and output 32bit floating point attribute
status = h5_getstepattribinfo_by_name (file_id, ATTR_R4, type, len)
allocate (r4_value(len))
status = h5_readstepattrib_r4 (file_id, ATTR_R4, r4_value)
write (fmt, "(a, i0, a)") '(', len, 'f10.5)'
write (*, "(a, ' =')", advance='no') ATTR_R4
write (*, fmt) (r4_value(i), i = 1, len)
! read and output 64bit floating point attribute
status = h5_getstepattribinfo_by_name (file_id, ATTR_R8, type, len)
allocate (r8_value(len))
status = h5_readstepattrib_r8 (file_id, ATTR_R8, r8_value)
write (fmt, "(a, i0, a)") '(', len, 'f10.5)'
write (*, "(a, ' =')", advance='no') ATTR_R8
write (*, fmt) (r8_value(i), i = 1, len)
! cleanup
status = h5_closefile (file_id)
call mpi_finalize(ierr)
end program read_step_attribs
+48
View File
@@ -0,0 +1,48 @@
/*
Copyright (c) 2006-2015, The Regents of the University of California,
through Lawrence Berkeley National Laboratory (subject to receipt of any
required approvals from the U.S. Dept. of Energy) and the Paul Scherrer
Institut (Switzerland). All rights reserved.
License: see file COPYING in top level of source distribution.
*/
#include "H5hut.h"
#define FNAME "example_file_attribs.h5"
#define ATTR_STRING "FileAttrString"
#define ATTR_INT32 "FileAttrInt32"
#define ATTR_INT64 "FileAttrInt64"
#define ATTR_FLOAT32 "FileAttrFloat32"
#define ATTR_FLOAT64 "FileAttrFloat64"
#define asize(array) (sizeof(array)/sizeof(array[0]))
int
main (
int argc,
char** argv
) {
char* string_value = "This is a string attribute bound to the file.";
int32_t int32_value[] = {0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144};
int64_t int64_value[] = {42, 43, 44, 45};
h5_float32_t float32_value[] = {2.71828};
h5_float64_t float64_value[] = {3.14159265358979323846264338327950288419716939937510};
MPI_Init (&argc, &argv);
H5AbortOnError ();
// if file properties is set to default, MPI_COMM_WORLD will be used
h5_file_t f = H5OpenFile (FNAME, H5_O_WRONLY, H5_PROP_DEFAULT);
H5WriteFileAttribString (f, ATTR_STRING, string_value);
H5WriteFileAttribInt32 (f, ATTR_INT32, int32_value, asize(int32_value));
H5WriteFileAttribInt64 (f, ATTR_INT64, int64_value, asize(int64_value));
H5WriteFileAttribFloat32 (f, ATTR_FLOAT32, float32_value, asize(float32_value));
H5WriteFileAttribFloat64 (f, ATTR_FLOAT64, float64_value, asize(float32_value));
H5CloseFile (f);
MPI_Finalize ();
return 0;
}
+56
View File
@@ -0,0 +1,56 @@
!
! Copyright (c) 2006-2015, The Regents of the University of California,
! through Lawrence Berkeley National Laboratory (subject to receipt of any
! required approvals from the U.S. Dept. of Energy) and the Paul Scherrer
! Institut (Switzerland). All rights reserved.!
!
! License: see file COPYING in top level of source distribution.
!
include 'H5hut.f90'
program write_file_attribs
use H5hut
implicit none
include 'mpif.h'
integer*8, parameter :: verbosity_level = 1
character (len=*), parameter :: FNAME = "example_file_attribs.h5"
character (len=*), parameter :: ATTR_STRING = "FileAttrString"
character (len=*), parameter :: ATTR_I4 = "FileAttrInt32"
character (len=*), parameter :: ATTR_I8 = "FileAttrInt64"
character (len=*), parameter :: ATTR_R4 = "FileAttrFloat32"
character (len=*), parameter :: ATTR_R8 = "FileAttrFloat64"
character (len=*),parameter :: string_value = "This is a string attribute bound to the file."
integer*4, parameter, dimension(*) :: i4_value = (/0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144/)
integer*8, parameter, dimension(*) :: i8_value = (/42, 43, 44, 45/)
real*4, parameter, dimension(*) :: r4_value = (/2.71828/)
real*8, parameter, dimension(*) :: r8_value = (/3.141592653589793238462643383279502884197169/)
integer :: ierr
integer*8 :: file_id, status
call mpi_init(ierr)
! abort program on any H5hut error
call h5_abort_on_error()
call h5_set_verbosity_level (verbosity_level)
! MPI_COMM_WORLD is used, if file is opened with default properties
file_id = h5_openfile (FNAME, H5_O_WRONLY, H5_PROP_DEFAULT)
! write attributes
status = h5_writefileattrib_string (file_id, ATTR_STRING, string_value)
status = h5_writefileattrib_i4 (file_id, ATTR_I4, i4_value, int8(size(i4_value, 1)))
status = h5_writefileattrib_i8 (file_id, ATTR_I8, i8_value, int8(size(i8_value, 1)))
status = h5_writefileattrib_r4 (file_id, ATTR_R4, r4_value, int8(size(r4_value, 1)))
status = h5_writefileattrib_r8 (file_id, ATTR_R8, r8_value, int8(size(r8_value, 1)))
! cleanup
status = h5_closefile (file_id)
call mpi_finalize(ierr)
end program write_file_attribs
+49
View File
@@ -0,0 +1,49 @@
/*
Copyright (c) 2006-2015, The Regents of the University of California,
through Lawrence Berkeley National Laboratory (subject to receipt of any
required approvals from the U.S. Dept. of Energy) and the Paul Scherrer
Institut (Switzerland). All rights reserved.
License: see file COPYING in top level of source distribution.
*/
#include "H5hut.h"
#define FNAME "example_step_attribs.h5"
#define ATTR_STRING "StepAttrString"
#define ATTR_INT32 "StepAttrInt32"
#define ATTR_INT64 "StepAttrInt64"
#define ATTR_FLOAT32 "StepAttrFloat32"
#define ATTR_FLOAT64 "StepAttrFloat64"
#define asize(array) (sizeof(array)/sizeof(array[0]))
int
main (
int argc,
char** argv
) {
char* string_value = "This is a string attribute bound to this step.";
int32_t int32_value[] = {0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144};
int64_t int64_value[] = {42, 43, 44, 45};
h5_float32_t float32_value[] = {2.71828};
h5_float64_t float64_value[] = {3.14159265358979323846264338327950288419716939937510};
MPI_Init (&argc, &argv);
H5AbortOnError ();
// if file properties is set to default, MPI_COMM_WORLD will be used
h5_file_t f = H5OpenFile (FNAME, H5_O_WRONLY, H5_PROP_DEFAULT);
H5SetStep (f, 1);
H5WriteStepAttribString (f, ATTR_STRING, string_value);
H5WriteStepAttribInt32 (f, ATTR_INT32, int32_value, asize(int32_value));
H5WriteStepAttribInt64 (f, ATTR_INT64, int64_value, asize(int64_value));
H5WriteStepAttribFloat32 (f, ATTR_FLOAT32, float32_value, asize(float32_value));
H5WriteStepAttribFloat64 (f, ATTR_FLOAT64, float64_value, asize(float32_value));
H5CloseFile (f);
MPI_Finalize ();
return 0;
}
+59
View File
@@ -0,0 +1,59 @@
!
! Copyright (c) 2006-2015, The Regents of the University of California,
! through Lawrence Berkeley National Laboratory (subject to receipt of any
! required approvals from the U.S. Dept. of Energy) and the Paul Scherrer
! Institut (Switzerland). All rights reserved.!
!
! License: see file COPYING in top level of source distribution.
!
include 'H5hut.f90'
program write_step_attribs
use H5hut
implicit none
include 'mpif.h'
integer*8, parameter :: verbosity_level = 1
character (len=*), parameter :: FNAME = "example_step_attribs.h5"
character (len=*), parameter :: ATTR_STRING = "StepAttrString"
character (len=*), parameter :: ATTR_I4 = "StepAttrInt32"
character (len=*), parameter :: ATTR_I8 = "StepAttrInt64"
character (len=*), parameter :: ATTR_R4 = "StepAttrFloat32"
character (len=*), parameter :: ATTR_R8 = "StepAttrFloat64"
character (len=*),parameter :: string_value = "This is a string attribute bound to this step."
integer*4, parameter, dimension(*) :: i4_value = (/0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144/)
integer*8, parameter, dimension(*) :: i8_value = (/42, 43, 44, 45/)
real*4, parameter, dimension(*) :: r4_value = (/2.71828/)
real*8, parameter, dimension(*) :: r8_value = (/3.141592653589793238462643383279502884197169/)
integer :: ierr
integer*8 :: file_id, status
call mpi_init(ierr)
! abort program on any H5hut error
call h5_abort_on_error()
call h5_set_verbosity_level (verbosity_level)
! MPI_COMM_WORLD is used, if file is opened with default properties
file_id = h5_openfile (FNAME, H5_O_WRONLY, H5_PROP_DEFAULT)
! open step 1
status = h5_setstep (file_id, int8(1))
! write attributes
status = h5_writestepattrib_string (file_id, ATTR_STRING, string_value)
status = h5_writestepattrib_i4 (file_id, ATTR_I4, i4_value, int8(size(i4_value, 1)))
status = h5_writestepattrib_i8 (file_id, ATTR_I8, i8_value, int8(size(i8_value, 1)))
status = h5_writestepattrib_r4 (file_id, ATTR_R4, r4_value, int8(size(r4_value, 1)))
status = h5_writestepattrib_r8 (file_id, ATTR_R8, r8_value, int8(size(r8_value, 1)))
! cleanup
status = h5_closefile (file_id)
call mpi_finalize(ierr)
end program write_step_attribs
+3
View File
@@ -0,0 +1,3 @@
h5hut.mod
read_write_scalar_field
read_write_scalar_fieldf
+55
View File
@@ -0,0 +1,55 @@
#
# Copyright (c) 2006-2015, The Regents of the University of California,
# through Lawrence Berkeley National Laboratory (subject to receipt of any
# required approvals from the U.S. Dept. of Energy) and the Paul Scherrer
# Institut (Switzerland). All rights reserved.!
#
# License: see file COPYING in top level of source distribution.
#
AM_CPPFLAGS += -I${abs_top_srcdir}/src/include
FFLAGS += -cpp $(AM_CPPFLAGS)
AM_LDFLAGS += -L${abs_top_builddir}/src/h5core/.libs
LDADD =
if ENABLE_EXAMPLES
if ENABLE_FORTRAN
LDADD += -lH5hutF
AM_LDFLAGS += -L${abs_top_builddir}/src/Fortran/.libs
endif
LDADD += -lH5hut
noinst_PROGRAMS =
if ENABLE_C
noinst_PROGRAMS += \
attach_field_attributes \
dump_field_attributes \
fields \
has_field \
read_write_scalar_field \
write_field
endif
if ENABLE_FORTRAN
if ENABLE_PARALLEL
noinst_PROGRAMS += read_write_scalar_fieldf
endif
endif
attach_field_attributes_SOURCES = attach_field_attributes.c
dump_field_attributes_SOURCES = dump_field_attributes.c
fields_SOURCES = fields.c
has_field_SOURCES = has_field.c
read_write_scalar_field_SOURCES = read_write_scalar_field.c
read_write_scalar_fieldf_SOURCES = read_write_scalar_fieldf.f90
write_field_SOURCES = write_field.c
endif
%.o : %.f90
$(FC) $(FFLAGS) -c $<
clean-local:
$(RM) *~
@@ -0,0 +1,66 @@
/*
Copyright (c) 2006-2015, The Regents of the University of California,
through Lawrence Berkeley National Laboratory (subject to receipt of any
required approvals from the U.S. Dept. of Energy) and the Paul Scherrer
Institut (Switzerland). All rights reserved.
License: see file COPYING in top level of source distribution.
*/
#include "H5hut.h"
// name of output file
const char* fname = "example_field.h5";
// H5hut verbosity level
const h5_int64_t h5_verbosity = H5_VERBOSE_DEFAULT;
int
main (
int argc,
char* argv[]
){
// initialize MPI & H5hut
MPI_Init (&argc, &argv);
MPI_Comm comm = MPI_COMM_WORLD;
int comm_size = 1;
MPI_Comm_size (comm, &comm_size);
int comm_rank = 0;
MPI_Comm_rank (comm, &comm_rank);
H5AbortOnError ();
H5SetVerbosityLevel (h5_verbosity);
//H5SetDebugMask (-1);
// open file and create first step
h5_file_t file = H5OpenFile (fname, H5_O_RDWR, H5_PROP_DEFAULT);
H5SetStep (file, 0);
if (!H5BlockHasField (file, "data")) {
printf ("Doesn't have field data with name 'data' in step#0\n");
goto done;
}
h5_int32_t attrib[1] = { 42 };
H5BlockWriteFieldAttribInt32 (
file,
"data",
"The answer",
attrib,
sizeof (attrib) / sizeof (*attrib));
h5_float64_t origin[3] = { 0.0, 0.0, 1.0 };
H5Block3dSetFieldOrigin (
file,
"data",
origin[0], origin[1], origin[2]);
h5_float64_t spacing[3] = { 1.0, 2.0, 3.0 };
H5Block3dSetFieldSpacing (
file,
"data",
spacing[0], spacing[1], spacing[2]);
done:
// done
H5CloseFile(file);
MPI_Finalize ();
return 0;
}
+194
View File
@@ -0,0 +1,194 @@
/*
Copyright (c) 2006-2015, The Regents of the University of California,
through Lawrence Berkeley National Laboratory (subject to receipt of any
required approvals from the U.S. Dept. of Energy) and the Paul Scherrer
Institut (Switzerland). All rights reserved.
License: see file COPYING in top level of source distribution.
*/
#include "H5hut.h"
// name of output file
const char* fname = "example_field.h5";
// H5hut verbosity level
const h5_int64_t h5_verbosity = H5_VERBOSE_DEFAULT;
static inline void
dump_int64_attrib (
h5_file_t file,
const char* const field_name,
const char* const attrib_name,
h5_size_t attrib_nelems
) {
h5_int64_t attrib_data[attrib_nelems];
H5BlockReadFieldAttribInt64 (
file,
field_name,
attrib_name,
attrib_data);
printf ("Attribute: '%s'\n", attrib_name);
printf (" Type: H5_INT64_T\n");
printf (" Data: %lld", attrib_data[0]);
for (size_t i = 1; i < attrib_nelems; i++) {
printf (", %lld", attrib_data[i]);
}
printf ("\n");
}
static inline void
dump_int32_attrib (
h5_file_t file,
const char* const field_name,
const char* const attrib_name,
h5_size_t attrib_nelems
) {
h5_int32_t attrib_data[attrib_nelems];
H5BlockReadFieldAttribInt32 (
file,
field_name,
attrib_name,
attrib_data);
printf ("Attribute: '%s'\n", attrib_name);
printf (" Type: H5_INT32_T\n");
printf (" Data: %ld", (long)attrib_data[0]);
for (size_t i = 1; i < attrib_nelems; i++) {
printf (", %ld", (long)attrib_data[i]);
}
printf ("\n");
}
static inline void
dump_float64_attrib (
h5_file_t file,
const char* const field_name,
const char* const attrib_name,
h5_size_t attrib_nelems
) {
h5_float64_t attrib_data[attrib_nelems];
H5BlockReadFieldAttribFloat64 (
file,
field_name,
attrib_name,
attrib_data);
printf ("Attribute: '%s'\n", attrib_name);
printf (" Type: H5_FLOAT64_T\n");
printf (" Data: %2f", attrib_data[0]);
for (size_t i = 1; i < attrib_nelems; i++) {
printf (", %2f", attrib_data[i]);
}
printf ("\n");
}
static inline void
dump_float32_attrib (
h5_file_t file,
const char* const field_name,
const char* const attrib_name,
h5_size_t attrib_nelems
) {
h5_float32_t attrib_data[attrib_nelems];
H5BlockReadFieldAttribFloat32 (
file,
field_name,
attrib_name,
attrib_data);
printf ("Attribute: '%s'\n", attrib_name);
printf (" Type: H5_FLOAT32_T\n");
printf (" Data: %2f", attrib_data[0]);
for (size_t i = 1; i < attrib_nelems; i++) {
printf (", %2f", attrib_data[i]);
}
printf ("\n");
}
inline void
dump_string_attrib (
h5_file_t file,
const char* const field_name,
const char* const attrib_name,
h5_size_t attrib_nelems
) {
}
void
dump_attrib (
h5_file_t file,
const char* const field_name,
const char* const attrib_name,
h5_int64_t attrib_type,
h5_size_t attrib_nelems
) {
if (attrib_type == H5_INT64_T) {
dump_int64_attrib (file, field_name, attrib_name, attrib_nelems);
} else if (attrib_type == H5_INT32_T) {
dump_int32_attrib (file, field_name, attrib_name, attrib_nelems);
} else if (attrib_type == H5_FLOAT64_T) {
dump_float64_attrib (file, field_name, attrib_name, attrib_nelems);
} else if (attrib_type == H5_FLOAT32_T) {
dump_float32_attrib (file, field_name, attrib_name, attrib_nelems);
} else if (attrib_type == H5_STRING_T) {
dump_string_attrib (file, field_name, attrib_name, attrib_nelems);
}
}
int
main (
int argc,
char* argv[]
){
// initialize MPI & H5hut
MPI_Init (&argc, &argv);
MPI_Comm comm = MPI_COMM_WORLD;
int comm_size = 1;
MPI_Comm_size (comm, &comm_size);
int comm_rank = 0;
MPI_Comm_rank (comm, &comm_rank);
H5AbortOnError ();
H5SetVerbosityLevel (h5_verbosity);
//H5SetDebugMask (-1);
// open file and create first step
h5_file_t file = H5OpenFile (fname, H5_O_RDWR, H5_PROP_DEFAULT);
H5SetStep (file, 0);
// test wheter field exists
const char field_name[] = "data";
if (!H5BlockHasField (file, field_name)) {
printf ("Doesn't have field data with name 'data' in step#0\n");
goto done;
}
// get number of attributes attached to field
h5_ssize_t n_attribs = H5BlockGetNumFieldAttribs (
file,
field_name);
printf ("Field has %lld attributes attached.\n",
n_attribs);
// dump all attached attributes
for (h5_size_t i = 0; i < n_attribs; i++) {
char attrib_name[128];
h5_size_t sizeof_attrib_name = sizeof (attrib_name);
h5_int64_t attrib_type;
h5_size_t attrib_nelems;
H5BlockGetFieldAttribInfo (
file,
field_name,
i,
attrib_name, sizeof_attrib_name,
&attrib_type,
&attrib_nelems);
dump_attrib (file,
field_name,
attrib_name, attrib_type, attrib_nelems);
}
done:
// done
H5CloseFile(file);
MPI_Finalize ();
return 0;
}
+49
View File
@@ -0,0 +1,49 @@
#include <H5hut.h>
#define XSIZE 8
#define YSIZE 8
#define ZSIZE 8
#define DATASIZE XSIZE*YSIZE*ZSIZE
#define VERBOSITY H5_VERBOSE_DEFAULT
#define FNAME "example_fields.h5"
int
main (
int argc,
char** argv
) {
h5_int64_t verbosity = VERBOSITY;
h5_float64_t ex[DATASIZE];
h5_float64_t ey[DATASIZE];
h5_float64_t ez[DATASIZE];
h5_float64_t q[DATASIZE];
// initialize MPI & H5hut
int comm_rank = 0;
int comm_size = 1;
MPI_Init (&argc, &argv);
MPI_Comm comm = MPI_COMM_WORLD;
MPI_Comm_rank (comm, &comm_rank);
MPI_Comm_size (comm, &comm_size);
H5AbortOnError ();
H5SetVerbosityLevel (verbosity);
// open file and go to step#0
h5_file_t file = H5OpenFile (FNAME, H5_O_RDONLY, H5_PROP_DEFAULT);
H5SetStep (file, 0);
H5Block3dSetView (file,
comm_rank*XSIZE, (comm_rank+1)*XSIZE - 1,
0, YSIZE - 1,
0, ZSIZE - 1);
H5Block3dWriteScalarFieldFloat64(file, "Q", q);
H5Block3dWriteVector3dFieldFloat64(file, "E", ex, ey, ez);
H5CloseFile(file);
MPI_Finalize();
return H5_SUCCESS;
}
+82
View File
@@ -0,0 +1,82 @@
/*
Copyright (c) 2006-2015, The Regents of the University of California,
through Lawrence Berkeley National Laboratory (subject to receipt of any
required approvals from the U.S. Dept. of Energy) and the Paul Scherrer
Institut (Switzerland). All rights reserved.
License: see file COPYING in top level of source distribution.
*/
#include "H5hut.h"
// name of output file
const char* fname = "example_write_field.h5";
// H5hut verbosity level
const h5_int64_t h5_verbosity = H5_VERBOSE_DEFAULT;
int
main (
int argc,
char* argv[]
){
// initialize MPI & H5hut
MPI_Init (&argc, &argv);
MPI_Comm comm = MPI_COMM_WORLD;
int comm_size = 1;
MPI_Comm_size (comm, &comm_size);
int comm_rank = 0;
MPI_Comm_rank (comm, &comm_rank);
H5AbortOnError ();
H5SetVerbosityLevel (h5_verbosity);
//H5SetDebugMask (-1);
// open file and create first step
h5_file_t file = H5OpenFile (fname, H5_O_RDONLY, H5_PROP_DEFAULT);
H5SetStep (file, 0);
if (!H5BlockHasFieldData (file)) {
goto done;
}
printf ("Has field data in step#0\n");
if (!H5BlockHasField (file, "data")) {
goto done;
}
printf ("Has field data with name 'data' in step#0\n");
h5_size_t field_rank;
h5_size_t field_dims[3];
h5_size_t elem_rank;
h5_int64_t type;
H5BlockGetFieldInfoByName (
file,
"data",
&field_rank,
field_dims,
&elem_rank,
&type);
char* stype = "unknown";
if (type == H5_INT64_T) {
stype = "H5_INT64_T";
} else if (type == H5_INT32_T) {
stype = "H5_INT32_T";
} else if (type == H5_FLOAT64_T) {
stype = "H5_FLOAT64_T";
} else if (type == H5_FLOAT32_T) {
stype = "H5_FLOAT32_T";
} else if (type == H5_STRING_T) {
stype = "H5_STRING_T";
}
printf ("rank of field: %lld\n", field_rank);
printf ("dims of field: [%lld, %lld, %lld]\n",
field_dims[0], field_dims[1], field_dims[2]);
printf ("rank of field data: %lld\n", elem_rank);
printf ("type of field data: '%s'\n", stype);
done:
// done
H5CloseFile(file);
MPI_Finalize ();
return 0;
}
+552
View File
@@ -0,0 +1,552 @@
/*
Copyright (c) 2006-2015, The Regents of the University of California,
through Lawrence Berkeley National Laboratory (subject to receipt of any
required approvals from the U.S. Dept. of Energy) and the Paul Scherrer
Institut (Switzerland). All rights reserved.
License: see file COPYING in top level of source distribution.
*/
#include "H5hut.h"
#define NPROCS 8
#define DEFAULT_VERBOSITY H5_VERBOSE_DEFAULT
struct H5BlockPartition {
h5_int64_t i_start;
h5_int64_t i_end;
h5_int64_t j_start;
h5_int64_t j_end;
h5_int64_t k_start;
h5_int64_t k_end;
};
struct H5BlockPartition Layout1[1] = {
{ 0, 63, 0, 63, 0, 511 }
};
struct H5BlockPartition Layout8[8] = {
{ 0,63, 0,63, 0, 63},
{ 0,63, 0,63, 64,127},
{ 0,63, 0,63, 128,191},
{ 0,63, 0,63, 192,255},
{ 0,63, 0,63, 256,319},
{ 0,63, 0,63, 320,383},
{ 0,63, 0,63, 384,447},
{ 0,63, 0,63, 448,511}
};
struct H5BlockPartition Layout8G[8] = {
{ 0,63, 0,63, 0, 64},
{ 0,63, 0,63, 63,128},
{ 0,63, 0,63, 127,192},
{ 0,63, 0,63, 191,256},
{ 0,63, 0,63, 255,320},
{ 0,63, 0,63, 319,384},
{ 0,63, 0,63, 383,448},
{ 0,63, 0,63, 447,511}
};
struct H5BlockPartition Layout16[16] = {
{ 0,63, 0,31, 0, 63},
{ 0,63, 32,63, 0, 63},
{ 0,63, 0,31, 64,127},
{ 0,63, 32,63, 64,127},
{ 0,63, 0,31, 128,191},
{ 0,63, 32,63, 128,191},
{ 0,63, 0,31, 192,255},
{ 0,63, 32,63, 192,255},
{ 0,63, 0,31, 256,319},
{ 0,63, 32,63, 256,319},
{ 0,63, 0,31, 320,383},
{ 0,63, 32,63, 320,383},
{ 0,63, 0,31, 384,447},
{ 0,63, 32,63, 384,447},
{ 0,63, 0,31, 448,511},
{ 0,63, 32,63, 448,511}
};
struct H5BlockPartition Layout16G[16] = {
{ 0,63, 0,32, 0, 64},
{ 0,63, 31,63, 0, 64},
{ 0,63, 0,32, 63,128},
{ 0,63, 31,63, 63,128},
{ 0,63, 0,32, 127,192},
{ 0,63, 31,63, 127,192},
{ 0,63, 0,32, 191,256},
{ 0,63, 31,63, 191,256},
{ 0,63, 0,32, 255,320},
{ 0,63, 31,63, 255,320},
{ 0,63, 0,32, 319,384},
{ 0,63, 31,63, 319,384},
{ 0,63, 0,32, 383,448},
{ 0,63, 31,63, 383,448},
{ 0,63, 0,32, 447,511},
{ 0,63, 31,63, 447,511}
};
struct H5BlockPartition Layout32[32] = {
{ 0,31, 0,31, 0, 63},
{ 0,31, 32,63, 0, 63},
{ 32,63, 0,31, 0, 63},
{ 32,63, 32,63, 0, 63},
{ 0,31, 0,31, 64,127},
{ 0,31, 32,63, 64,127},
{ 32,63, 0,31, 64,127},
{ 32,63, 32,63, 64,127},
{ 0,31, 0,31, 128,191},
{ 0,31, 32,63, 128,191},
{ 32,63, 0,31, 128,191},
{ 32,63, 32,63, 128,191},
{ 0,31, 0,31, 192,255},
{ 0,31, 32,63, 192,255},
{ 32,63, 0,31, 192,255},
{ 32,63, 32,63, 192,255},
{ 0,31, 0,31, 256,319},
{ 0,31, 32,63, 256,319},
{ 32,63, 0,31, 256,319},
{ 32,63, 32,63, 256,319},
{ 0,31, 0,31, 320,383},
{ 0,31, 32,63, 320,383},
{ 32,63, 0,31, 320,383},
{ 32,63, 32,63, 320,383},
{ 0,31, 0,31, 384,447},
{ 0,31, 32,63, 384,447},
{ 32,63, 0,31, 384,447},
{ 32,63, 32,63, 384,447},
{ 0,31, 0,31, 448,511},
{ 0,31, 32,63, 448,511},
{ 32,63, 0,31, 448,511},
{ 32,63, 32,63, 448,511}
};
struct H5BlockPartition Layout32G[32] = {
{ 0,32, 0,32, 0, 64},
{ 0,32, 31,63, 0, 64},
{ 31,63, 0,32, 0, 64},
{ 31,63, 31,63, 0, 64},
{ 0,32, 0,32, 63,128},
{ 0,32, 31,63, 63,128},
{ 31,63, 0,32, 63,128},
{ 31,63, 31,63, 63,128},
{ 0,32, 0,32, 127,192},
{ 0,32, 31,63, 127,192},
{ 31,63, 0,32, 127,192},
{ 31,63, 31,63, 127,192},
{ 0,32, 0,32, 191,256},
{ 0,32, 31,63, 191,256},
{ 31,63, 0,32, 191,256},
{ 31,63, 31,63, 191,256},
{ 0,32, 0,32, 255,320},
{ 0,32, 31,63, 255,320},
{ 31,63, 0,32, 255,320},
{ 31,63, 31,63, 255,320},
{ 0,32, 0,32, 319,384},
{ 0,32, 31,63, 319,384},
{ 31,63, 0,32, 319,384},
{ 31,63, 31,63, 319,384},
{ 0,31, 0,31, 383,448},
{ 0,31, 31,63, 383,448},
{ 31,63, 0,31, 383,448},
{ 31,63, 31,63, 383,448},
{ 0,32, 0,32, 447,511},
{ 0,32, 31,63, 447,511},
{ 31,63, 0,32, 447,511},
{ 31,63, 31,63, 447,511}
};
#define _calc_index( i, i_dims, j, j_dims, k, k_dims ) \
(i + j*i_dims + k*i_dims*j_dims)
static h5_int64_t
_write_data (
h5_file_t f,
int myproc,
struct H5BlockPartition* view
) {
h5_int64_t i, j, k, idx;
h5_int64_t herr;
h5_float64_t *data;
h5_int64_t i_dims = view->i_end - view->i_start + 1;
h5_int64_t j_dims = view->j_end - view->j_start + 1;
h5_int64_t k_dims = view->k_end - view->k_start + 1;
printf ( "Writing scalar field data to step #%lld\n", (long long)H5GetStep (f));
data = (h5_float64_t*)malloc ( i_dims * j_dims * k_dims * sizeof (h5_float64_t) );
for ( i = 0; i < i_dims; i++ ) {
for ( j = 0; j < j_dims; j++ ) {
for ( k = 0; k < k_dims; k++ ) {
idx = _calc_index (
i, i_dims,
j, j_dims,
k, k_dims );
*(data + idx) = k
+ 1000*j
+ 100000*i
+ 10000000*myproc;
}
}
}
herr = H5Block3dSetView (
f,
view->i_start, view->i_end,
view->j_start, view->j_end,
view->k_start, view->k_end );
if ( herr < 0 ) return herr;
herr = H5Block3dWriteScalarFieldFloat64 ( f, "TestField", data );
if ( herr < 0 ) return herr;
free ( data );
return 1;
}
static h5_int64_t
_write_attributes (
h5_file_t f,
const int myproc
) {
printf ("Writing attributes to field '%s' in step #%lld\n",
"TestField", (long long)H5GetStep (f));
h5_int64_t herr = H5BlockWriteFieldAttribString (
f,
"TestField",
"TestString",
"42" );
if ( herr < 0 ) return -1;
h5_int32_t i4_val[1] = { 42 };
herr = H5BlockWriteFieldAttribInt32 (
f,
"TestField",
"TestInt32",
i4_val, 1 );
if ( herr < 0 ) return -1;
h5_int64_t i8_val[1] = { 42 };
herr = H5BlockWriteFieldAttribInt64 (
f,
"TestField",
"TestInt64",
i8_val, 1 );
if ( herr < 0 ) return -1;
h5_float32_t r4_val[1] = { 42.0 };
herr = H5BlockWriteFieldAttribFloat32 (
f,
"TestField",
"TestFloat32",
r4_val, 1 );
if ( herr < 0 ) return -1;
h5_float64_t r8_val[1] = { 42.0 };
herr = H5BlockWriteFieldAttribFloat64 (
f,
"TestField",
"TestFloat64",
r8_val, 1 );
if ( herr < 0 ) return -1;
herr = H5Block3dSetFieldOrigin ( f, "TestField", 1.0, 2.0, 3.0 );
if ( herr < 0 ) return -1;
herr = H5Block3dSetFieldSpacing ( f, "TestField", 2.0, 3.0, 4.0 );
if ( herr < 0 ) return -1;
return H5_SUCCESS;
}
static h5_int64_t
_write_file (
const char *fname,
const int myproc,
MPI_Comm comm,
struct H5BlockPartition *layout
) {
printf ("PROC[%d]: Open file \"%s\" for writing ...\n",
myproc, fname );
h5_file_t file = H5OpenFile (fname, H5_O_WRONLY, H5_PROP_DEFAULT);
H5SetStep (file, 0);
_write_data (file, myproc, layout);
_write_attributes (file, myproc);
H5CloseFile (file);
return H5_SUCCESS;
}
static h5_int64_t
_read_data (
h5_file_t f,
int myproc,
struct H5BlockPartition *layout
) {
h5_int64_t i, j, k, idx;
h5_float64_t *data;
h5_int64_t i_dims = layout->i_end - layout->i_start + 1;
h5_int64_t j_dims = layout->j_end - layout->j_start + 1;
h5_int64_t k_dims = layout->k_end - layout->k_start + 1;
printf ("Reading Step #%lld\n", (long long)H5GetStep (f));
data = (h5_float64_t*)malloc (i_dims * j_dims * k_dims * sizeof (*data));
H5Block3dSetView (
f,
layout->i_start, layout->i_end,
layout->j_start, layout->j_end,
layout->k_start, layout->k_end );
H5Block3dReadScalarFieldFloat64 ( f, "TestField", data );
for (i = 0; i < i_dims; i++) {
for (j = 0; j < j_dims; j++) {
for (k = 0; k < k_dims; k++) {
idx = _calc_index (
i, i_dims,
j, j_dims,
k, k_dims );
h5_float64_t value = k
+ 1000 * j
+ 100000 * i
+ 10000000 * myproc;
if (*(data + idx) != value) {
printf (
"PROC[%d]: "
"value missmatch for (%lld,%lld,%lld); is: %f;"
" should be: %f\n",
myproc,
(long long)i, (long long)j, (long long)k,
*( data + idx ), value );
return -1;
}
}
}
}
free (data);
return H5_SUCCESS;
}
static h5_int64_t
_read_attributes (
h5_file_t f,
const int myproc,
MPI_Comm comm
) {
h5_int64_t timestep = 0;
H5SetStep (f, timestep);
char sval[16];
H5BlockReadFieldAttribString (
f,
"TestField",
"TestString",
sval );
if (strcmp (sval, "42") != 0) {
printf ("Error reading string attribute: "
"Value is \"%s\" and should be \"42\"\n", sval);
}
h5_int32_t i4_val[1];
H5BlockReadFieldAttribInt32 (
f,
"TestField",
"TestInt32",
i4_val );
if (i4_val[0] != 42) {
printf ("Error reading int32 attribute: "
"Value is %lld and should be 42\n",
(long long) i4_val[0]);
}
h5_int64_t i8_val[1];
H5BlockReadFieldAttribInt64 (
f,
"TestField",
"TestInt64",
i8_val );
if (i8_val[0] != 42) {
printf ("Error reading int64 attribute: "
"Value is %lld and should be 42\n",
(long long) i8_val[0]);
}
h5_float32_t r4_val[1];
H5BlockReadFieldAttribFloat32 (
f,
"TestField",
"TestFloat32",
r4_val );
if (r4_val[0] != 42.0) {
printf ("Error reading float64 attribute: "
"Value is %f and should be 42.0\n",
r4_val[0]);
}
h5_float64_t r8_val[1];
H5BlockReadFieldAttribFloat64 (
f,
"TestField",
"TestFloat64",
r8_val );
if (r8_val[0] != 42.0) {
printf ("Error reading float64 attribute: "
"Value is %f and should be 42.0\n",
r8_val[0]);
}
h5_float64_t x_origin;
h5_float64_t y_origin;
h5_float64_t z_origin;
h5_float64_t x_spacing;
h5_float64_t y_spacing;
h5_float64_t z_spacing;
H5Block3dGetFieldOrigin (
f, "TestField",
&x_origin,
&y_origin,
&z_origin );
if (x_origin != 1.0 || y_origin != 2.0 || z_origin != 3.0) {
printf (
"Error reading field origin: Read values (%f,%f,%f)\n",
x_origin, y_origin, z_origin);
}
H5Block3dGetFieldSpacing (
f, "TestField",
&x_spacing,
&y_spacing,
&z_spacing );
if (x_spacing != 2.0 || y_spacing != 3.0 || z_spacing != 4.0) {
printf (
"Error reading field spacing: Read values (%f,%f,%f)\n",
x_spacing, y_spacing, z_spacing);
}
return H5_SUCCESS;
}
static h5_int64_t
_read_file (
const char *fname,
const int myproc,
MPI_Comm comm,
struct H5BlockPartition *layout
) {
printf ("PROC[%d]: Open file \"%s\" for reading ...\n",
myproc, fname );
h5_file_t file = H5OpenFile (fname, H5_O_RDONLY, H5_PROP_DEFAULT);
H5SetStep (file, 0);
_read_data (file, myproc, layout);
_read_attributes (file, myproc, comm);
H5CloseFile (file);
return H5_SUCCESS;
}
int
main (
int argc,
char **argv
) {
h5_int64_t verbosity = DEFAULT_VERBOSITY;
char *fname;
int opt_with_ghosts = 0;
int opt_read = 0;
int opt_write = 0;
struct H5BlockPartition *layout;
if (argc == 1) {
fprintf ( stderr,
"Usage: %s -w|-r [-g]\n",
argv[0] );
return 1;
}
while (--argc) {
if (strcmp (argv[argc], "-r") == 0)
opt_read = 1;
else if (strcmp (argv[argc], "-w") == 0)
opt_write = 1;
else if (strcmp (argv[argc], "-g") == 0)
opt_with_ghosts = 1;
else {
fprintf (stderr,
"Illegal option %s\n\n"
"Usage: %s -w -r -g\n",
argv[argc], argv[0]);
return 1;
}
}
// initialize MPI & H5hut
int comm_rank = 0;
int comm_size = 1;
MPI_Init (&argc, &argv);
MPI_Comm comm = MPI_COMM_WORLD;
MPI_Comm_rank (comm, &comm_rank);
MPI_Comm_size (comm, &comm_size);
H5AbortOnError ();
H5SetVerbosityLevel (verbosity);
switch (comm_size) {
case 1:
fname = "blockfile1.h5";
layout = &Layout1[comm_rank];
break;
case 8:
if (opt_with_ghosts) {
fname = "blockfile8G.h5";
layout = &Layout8G[comm_rank];
} else {
fname = "blockfile8.h5";
layout = &Layout8[comm_rank];
}
break;
case 16:
if (opt_with_ghosts) {
fname = "blockfile16G.h5";
layout = &Layout16G[comm_rank];
} else {
fname = "blockfile16.h5";
layout = &Layout16[comm_rank];
}
break;
case 32:
if (opt_with_ghosts) {
fname = "blockfile32G.h5";
layout = &Layout32G[comm_rank];
} else {
fname = "blockfile32.h5";
layout = &Layout32[comm_rank];
}
break;
default:
printf ( "Run this test on %d, %d, %d or %d processor(s)!\n",
1, 8, 16, 32);
return 1;
}
if (opt_write) {
_write_file (fname, comm_rank, comm, layout);
} else if (opt_read) {
_read_file (fname, comm_rank, comm, layout);
}
MPI_Finalize();
return 0;
}
@@ -0,0 +1,500 @@
!
! Copyright (c) 2006-2015, The Regents of the University of California,
! through Lawrence Berkeley National Laboratory (subject to receipt of any
! required approvals from the U.S. Dept. of Energy) and the Paul Scherrer
! Institut (Switzerland). All rights reserved.!
!
! License: see file COPYING in top level of source distribution.
!
include 'H5hut.f90'
program read_write_scalar_field
use H5hut
implicit none
include 'mpif.h'
integer :: nargs = 0
integer :: comm_rank = 0
integer :: comm_size = 1
integer :: comm = 0
integer :: mpi_err
integer*8 :: h5_err
integer :: i
character(len=32) :: arg_str
integer :: opt_read = 0
integer :: opt_write = 0
integer :: opt_with_ghosts = 0
character(len=128) :: fname
integer*8 :: layout (6)
integer*8 :: layout1 (6,1)
integer*8 :: layout8 (6,8)
integer*8 :: layout8g (6,8)
integer*8 :: layout16 (6,16)
integer*8 :: layout16g(6,16)
integer*8 :: layout32 (6,32)
integer*8 :: layout32g(6,32)
data layout1 / 1,64, 1,64, 1,512 /
data layout8 / 1,64, 1,64, 1, 64, &
1,64, 1,64, 65,128, &
1,64, 1,64, 129,192, &
1,64, 1,64, 193,256, &
1,64, 1,64, 257,320, &
1,64, 1,64, 321,384, &
1,64, 1,64, 385,448, &
1,64, 1,64, 449,512 /
data layout8g / 1,64, 1,64, 1, 65, &
1,64, 1,64, 64,129, &
1,64, 1,64, 128,193, &
1,64, 1,64, 192,257, &
1,64, 1,64, 256,321, &
1,64, 1,64, 320,385, &
1,64, 1,64, 384,449, &
1,64, 1,64, 448,512 /
data layout16 / 1,64, 1,32, 1, 64, &
1,64, 33,64, 1, 64, &
1,64, 1,32, 65,128, &
1,64, 33,64, 65,128, &
1,64, 1,32, 129,192, &
1,64, 33,64, 129,192, &
1,64, 1,32, 193,256, &
1,64, 33,64, 193,256, &
1,64, 1,32, 257,320, &
1,64, 33,64, 257,320, &
1,64, 1,32, 321,384, &
1,64, 33,64, 321,384, &
1,64, 1,32, 385,448, &
1,64, 33,64, 385,448, &
1,64, 1,32, 449,512, &
1,64, 33,64, 449,512 /
data layout16g/ 1,64, 1,33, 1, 65, &
1,64, 32,64, 1, 65, &
1,64, 1,33, 64,129, &
1,64, 32,64, 64,129, &
1,64, 1,33, 128,193, &
1,64, 32,64, 128,193, &
1,64, 1,33, 192,257, &
1,64, 32,64, 192,257, &
1,64, 1,33, 256,321, &
1,64, 32,64, 256,321, &
1,64, 1,33, 320,385, &
1,64, 32,64, 320,385, &
1,64, 1,33, 384,449, &
1,64, 32,64, 384,449, &
1,64, 1,33, 448,512, &
1,64, 32,64, 448,512 /
data layout32 / 1,32, 1,32, 1, 64, &
1,32, 33,64, 1, 64, &
33,64, 1,32, 1, 64, &
33,64, 33,64, 1, 64, &
1,32, 1,32, 65,128, &
1,32, 33,64, 65,128, &
33,64, 1,32, 65,128, &
33,64, 33,64, 65,128, &
1,32, 1,32, 129,192, &
1,32, 33,64, 129,192, &
33,64, 1,32, 129,192, &
33,64, 33,64, 129,192, &
1,32, 1,32, 193,256, &
1,32, 33,64, 193,256, &
33,64, 1,32, 193,256, &
33,64, 33,64, 193,256, &
1,32, 1,32, 257,320, &
1,32, 33,64, 257,320, &
33,64, 1,32, 257,320, &
33,64, 33,64, 257,320, &
1,32, 1,32, 321,384, &
1,32, 33,64, 321,384, &
33,64, 1,32, 321,384, &
33,64, 33,64, 321,384, &
1,32, 1,32, 385,448, &
1,32, 33,64, 385,448, &
33,64, 1,32, 385,448, &
33,64, 33,64, 385,448, &
1,32, 1,32, 449,512, &
1,32, 33,64, 449,512, &
33,64, 1,32, 449,512, &
33,64, 33,64, 449,512 /
data layout32g/ 1,33, 1,33, 1, 65, &
1,33, 32,64, 1, 65, &
32,64, 1,33, 1, 65, &
32,64, 32,64, 1, 65, &
1,33, 1,33, 64,129, &
1,33, 32,64, 64,129, &
32,64, 1,33, 64,129, &
32,64, 32,64, 64,129, &
1,33, 1,33, 128,193, &
1,33, 32,64, 128,193, &
32,64, 1,33, 128,193, &
32,64, 32,64, 128,193, &
1,33, 1,33, 192,257, &
1,33, 32,64, 192,257, &
32,64, 1,33, 192,257, &
32,64, 32,64, 192,257, &
1,33, 1,33, 256,321, &
1,33, 32,64, 256,321, &
32,64, 1,33, 256,321, &
32,64, 32,64, 256,321, &
1,33, 1,33, 320,385, &
1,33, 32,64, 320,385, &
32,64, 1,33, 320,385, &
32,64, 32,64, 320,385, &
1,33, 1,33, 384,449, &
1,33, 32,64, 384,449, &
32,64, 1,33, 384,449, &
32,64, 32,64, 384,449, &
1,33, 1,33, 448,512, &
1,33, 32,64, 448,512, &
32,64, 1,33, 448,512, &
32,64, 32,64, 448,512 /
nargs = iargc ()
if (nargs == 0) then
print *, "usage: read_write_scalarfield -w | -r [-g]"
call exit (1)
end if
do i = 1, nargs
call getarg (i, arg_str)
if (arg_str == "-r") then
opt_read = 1
else if (arg_str == "-w") then
opt_write = 1
else if (arg_str == "-g") then
opt_with_ghosts = 1
else
print *, "Illegal option ", arg_str, "\n"
print *, "Usage: read_write_scalarfield -w | -r [-g]"
call exit (1)
end if
end do
! init MPI & H5hut
comm = MPI_COMM_WORLD
call mpi_init(mpi_err)
call mpi_comm_rank(comm, comm_rank, mpi_err)
call mpi_comm_size (comm, comm_size, mpi_err)
call h5_abort_on_error ()
call h5_set_verbosity_level (511_8)
selectcase (comm_size)
case (1)
fname = "blockfile1.h5"
layout = layout1 (:, comm_rank+1)
case (8)
if (opt_with_ghosts == 1) then
fname = "blockfile8g.h5"
layout = layout8g (:, comm_rank+1)
else
fname = "blockfile8.h5"
layout = layout8 (:, comm_rank+1)
end if
case (16)
if (opt_with_ghosts == 1) then
fname = "blockfile16g.h5"
layout = layout16g (:, comm_rank+1)
else
fname = "blockfile16.h5"
layout = layout16 (:, comm_rank+1)
end if
case (32)
if (opt_with_ghosts == 1) then
fname = "blockfile32g.h5"
layout = layout32g (:, comm_rank+1)
else
fname = "blockfile32.h5"
layout = layout32 (:, comm_rank+1)
end if
case default
print *, "Run this test on 1, 8, 16 or 32 cores!"
call mpi_finalize
call exit (1)
end select
if (opt_write == 1) then
h5_err = write_file (fname, comm_rank, layout)
if (h5_err < 0) then
print "('[proc ', I3, ']: Faild to write file ', A, '!')", comm_rank, fname
end if
else if (opt_read == 1) then
h5_err = read_file (fname, comm_rank, layout)
if (h5_err < 0) then
print "('[proc ', I3, ']: Faild to read file ', A, '!')", comm_rank, fname
end if
endif
print "('[proc ', I3, ']: Cleanup.')", comm_rank
call mpi_finalize
print "('[proc ', I3, ']: Done.')", comm_rank
call exit (0)
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!
contains
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!
integer*8 function write_file (fname, comm_rank, layout)
use H5hut
implicit none
character(len=*), intent(in) :: fname
integer, intent(in) :: comm_rank
integer*8, intent(in) :: layout(6)
integer*8 :: file
integer*8 :: timestep = 1
print "('[proc ', I3, ']: Open file for writing ...')", comm_rank
file = h5_openfile (fname, H5_O_WRONLY, H5_PROP_DEFAULT)
h5_err = h5_setstep (file, timestep)
h5_err = write_field (file, comm_rank, layout)
h5_err = write_attributes (file)
h5_err = h5_closefile (file)
write_file = H5_SUCCESS
end function write_file
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!
integer*8 function write_field (file, comm_rank, layout)
use H5hut
implicit none
integer*8, intent(in) :: file
integer, intent(in) :: comm_rank
integer*8, intent(in) :: layout(6)
integer*8 :: i, j, k
integer*8 :: i_start
integer*8 :: i_end
integer*8 :: j_start
integer*8 :: j_end
integer*8 :: k_start
integer*8 :: k_end
integer*8 :: i_dims
integer*8 :: j_dims
integer*8 :: k_dims
real*8 :: value
real*8, dimension(:,:,:), allocatable :: data
i_start = layout(1)
i_end = layout(2)
j_start = layout(3)
j_end = layout(4)
k_start = layout(5)
k_end = layout(6)
i_dims = i_end - i_start + 1
j_dims = j_end - j_start + 1
k_dims = k_end - k_start + 1
allocate ( data (i_dims,j_dims, k_dims) )
print "('[proc ', I3, ']: Defining layout for writing ...')", comm_rank
print "('[proc ', I3, ']: ', I3, ':', I3, ', ', I3, ':', I3,', ', I3, ':', I3)", &
comm_rank, &
i_start, i_end, &
j_start, j_end, &
k_start, k_end
h5_err = h5bl_3d_setview (file, i_start, i_end, j_start, j_end, k_start, k_end)
do i = 1, i_dims
do j = 1, j_dims
do k = 1, k_dims
value = (k-1) + 1000*(j-1) + 100000*(i-1) + 10000000*comm_rank
data(i,j,k) = value
end do
end do
end do
print "('[proc ', I3, ']: Writing field ...')", comm_rank
h5_err = h5bl_3d_write_scalar_field_r8 ( file, "TestField", data )
write_field = 0
END FUNCTION write_field
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!
integer*8 function write_attributes (file)
use H5hut
implicit none
integer*8, intent(in) :: file
integer*8 :: h5_err = 0
character(len=128) :: s_val
integer*8 :: i8_val(1)
integer*4 :: i4_val(1)
real*8 :: r8_val(1)
real*4 :: r4_val(1)
print "('[proc ', I3, ']: Writing string attribute ...')", comm_rank
s_val = "42"
h5_err = h5bl_writefieldattrib_string ( file, "TestField", "TestString", s_val )
print "('[proc ', I3, ']: Writing int64 attribute ...')", comm_rank
i8_val(1) = 42
h5_err = h5bl_writefieldattrib_i8 ( file, "TestField", "TestInt64", i8_val, 1_8 )
print "('[proc ', I3, ']: Writing int32 attribute ...')", comm_rank
i4_val(1) = 42
h5_err = h5bl_writefieldattrib_i4 ( file, "TestField", "TestInt32", i4_val, 1_8 )
print "('[proc ', I3, ']: Writing float64 attribute ...')", comm_rank
r8_val(1) = 42.0
h5_err = h5bl_writefieldattrib_r8 ( file, "TestField", "TestFloat64", r8_val, 1_8 )
print "('[proc ', I3, ']: Writing float32 attribute ...')", comm_rank
r4_val(1) = 42.0
h5_err = h5bl_writefieldattrib_r4 ( file, "TestField", "TestFloat32", r4_val, 1_8 )
write_attributes = 0
end function write_attributes
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!
integer*8 function read_file (fname, comm_rank, layout)
use H5hut
implicit none
character(len=*), intent(in) :: fname
integer, intent(in) :: comm_rank
integer*8, intent(in) :: layout(6)
integer*8 :: file
integer*8 :: timestep = 1
print "('[proc ', I3, ']: Open file for reading ...')", comm_rank
file = h5_openfile (FNAME, H5_O_RDONLY, H5_PROP_DEFAULT)
h5_err = h5_setstep (file, timestep)
h5_err = read_field (file, comm_rank, layout)
h5_err = read_attributes (file)
h5_err = h5_closefile (file)
read_file = 0
end function read_file
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!
integer*8 function read_field (file, comm_rank, layout)
use H5hut
implicit none
integer*8, intent(in) :: file
integer, intent(in) :: comm_rank
integer*8, intent(in) :: layout(6)
integer*8 :: i, j, k
integer*8 :: i_start
integer*8 :: i_end
integer*8 :: j_start
integer*8 :: j_end
integer*8 :: k_start
integer*8 :: k_end
integer*8 :: i_dims
integer*8 :: j_dims
integer*8 :: k_dims
real*8 :: value
real*8, dimension(:,:,:), allocatable :: data
i_start = layout(1)
i_end = layout(2)
j_start = layout(3)
j_end = layout(4)
k_start = layout(5)
k_end = layout(6)
i_dims = i_end - i_start + 1
j_dims = j_end - j_start + 1
k_dims = k_end - k_start + 1
allocate ( data (i_dims, j_dims, k_dims) )
print "('[proc ', I3, ']: Defining layout for reading ...')", comm_rank
print "('[proc ', I3, ']: ', I3, ':', I3, ', ', I3, ':', I3,', ', I3, ':', I3)", &
comm_rank, &
i_start, i_end, &
j_start, j_end, &
k_start, k_end
h5_err = h5bl_3d_setview ( file, i_start, i_end, j_start, j_end, k_start, k_end )
print "('[proc ', I3, ']: Reading field ...')", comm_rank
h5_err = h5bl_3d_read_scalar_field_r8 ( file, "TestField", data )
do i = 1, i_dims
do j = 1, j_dims
do k = 1, k_dims
value = (k-1) + 1000*(j-1) + 100000*(i-1) + 10000000*comm_rank
if (data(i,j,k) /= value) then
print "('[proc ', I3, ']: error: data(',I4,',',I4,',',I4,') = ',F10.2,' /= ',F10.2)", &
i, j, k, data(i,j,k), value
read_field = -2
return
end if
end do
end do
end do
read_field = 0
end function read_field
integer*8 function read_attributes (file)
use H5hut
implicit none
integer*8, intent(in) :: file
integer*8 :: h5_err = 0
character(len=128) :: s_val
integer*8 :: i8_val(1)
integer*4 :: i4_val(1)
real*8 :: r8_val(1)
real*4 :: r4_val(1)
print "('[proc ', I3, ']: Reading string attribute ...')", comm_rank
h5_err = h5bl_readfieldattrib_string ( file, "TestField", "TestString", s_val )
IF ( s_val /= "42" ) THEN
print "('[proc ', I3, ']: Error reading string attribute: Value is ', A, ' but should be 42')", &
comm_rank, s_val
end if
print "('[proc ', I3, ']: Reading int64 attribute ...')", comm_rank
h5_err = h5bl_readfieldattrib_i8 ( file, "TestField", "TestInt64", i8_val )
if ( i8_val(1) /= 42 ) then
print "('[proc ', I3, ']: Error reading int64 attribute: Value is ', I8, ' but should be 42')", &
comm_rank, i8_val(1)
end if
print "('[proc ', I3, ']: Reading int32 attribute ...')", comm_rank
h5_err = h5bl_readfieldattrib_i4 ( file, "TestField", "TestInt32", i4_val )
if ( i4_val(1) /= 42 ) then
print "('[proc ', I3, ']: Error reading int32 attribute: Value is ', I8, ' but should be 42')", &
comm_rank, i4_val(1)
end if
print "('[proc ', I3, ']: Reading float64 attribute ...')", comm_rank
h5_err = h5bl_readfieldattrib_r8 ( file, "TestField", "TestFloat64", r8_val )
if ( r8_val(1) /= 42.0 ) then
print "('[proc ', I3, ']: Error reading float64 attribute: Value is ', F10.2, ' but should be 42.0')", &
comm_rank, r8_val(1)
end if
print "('[proc ', I3, ']: Reading float32 attribute ...')", comm_rank
h5_err = h5bl_readfieldattrib_r4 ( file, "TestField", "TestFloat32", r4_val )
if ( r4_val(1) /= 42.0 ) then
print "('[proc ', I3, ']: Error reading float32 attribute: Value is ', F10.2, ' but should be 42.0')", &
comm_rank, r4_val(1)
end if
read_attributes = h5_err
end function read_attributes
end program
+96
View File
@@ -0,0 +1,96 @@
/*
Copyright (c) 2006-2015, The Regents of the University of California,
through Lawrence Berkeley National Laboratory (subject to receipt of any
required approvals from the U.S. Dept. of Energy) and the Paul Scherrer
Institut (Switzerland). All rights reserved.
License: see file COPYING in top level of source distribution.
*/
#include "H5hut.h"
// name of output file
const char* fname = "example_field.h5";
// H5hut verbosity level
const h5_int64_t h5_verbosity = H5_VERBOSE_DEFAULT;
// number of particles we are going to write per core
const ssize_t dim_x = 8;
const ssize_t dim_y = 8;
const ssize_t dim_z = 32;
inline ssize_t idx (
ssize_t i, ssize_t i_dim,
ssize_t j, ssize_t j_dim,
ssize_t k
) {
return (i + j*i_dim + k*i_dim*j_dim);
}
int
main (
int argc,
char* argv[]
){
// initialize MPI & H5hut
MPI_Init (&argc, &argv);
MPI_Comm comm = MPI_COMM_WORLD;
int comm_size = 1;
MPI_Comm_size (comm, &comm_size);
int comm_rank = 0;
MPI_Comm_rank (comm, &comm_rank);
H5AbortOnError ();
H5SetVerbosityLevel (h5_verbosity);
// slice field in Z direction
ssize_t dim = dim_z;
ssize_t n_slices = dim / comm_size;
ssize_t remaining_slices = dim % comm_size;
ssize_t start;
if (comm_rank < remaining_slices) {
n_slices++;
start = comm_rank * n_slices;
} else {
start = comm_rank*n_slices + remaining_slices;
}
ssize_t end = start + n_slices - 1;
// setting our view
ssize_t i_start = 0;
ssize_t i_end = dim_x - 1;
ssize_t j_start = 0;
ssize_t j_end = dim_y - 1;
ssize_t k_start = start;
ssize_t k_end = end;
// create fake data
ssize_t i_dim = i_end - i_start + 1;
ssize_t j_dim = j_end - j_start + 1;
h5_int64_t data[(i_end-i_start+1) * (j_end-j_start+1) * (k_end-k_start+1)];
for (int k = k_start; k <= k_end; k++) {
for (int j = j_start; j <= j_end; j++) {
for (int i = i_start; i <= i_end; i++) {
ssize_t _idx = idx (i-i_start, i_dim, j-j_start, j_dim, k-k_start);
data[_idx] = (h5_int64_t)idx (i, dim_x, j, dim_y, k);
}
}
}
// open file and create first step
h5_file_t file = H5OpenFile (fname, H5_O_WRONLY, H5_PROP_DEFAULT);
H5SetStep (file, 0);
// set view on data for this core
H5Block3dSetView (file, i_start, i_end, j_start, j_end, k_start, k_end);
// write data
H5Block3dWriteScalarFieldInt64 (file, "data", data);
// done
H5CloseFile(file);
MPI_Finalize ();
return 0;
}
@@ -1,11 +1,20 @@
# test level Makefile.am
#
# Copyright (c) 2006-2015, The Regents of the University of California,
# through Lawrence Berkeley National Laboratory (subject to receipt of any
# required approvals from the U.S. Dept. of Energy) and the Paul Scherrer
# Institut (Switzerland). All rights reserved.!
#
# License: see file COPYING in top level of source distribution.
#
OBJEXT = o
AM_CPPFLAGS += -I${abs_top_srcdir}/src/include
FFLAGS += -cpp $(AM_CPPFLAGS)
AM_LDFLAGS += -L${abs_top_builddir}/src/h5core/.libs
AM_LDFLAGS = -L../../src/lib @LDFLAGS@
LIBS = -lH5hutC -lH5hut @LIBS@
INCLUDES = -I../../src/include @INCLUDES@
LDADD =
LDADD += -lH5hut
if ENABLE_EXAMPLES
noinst_PROGRAMS = \
tetmesh_write \
tetmesh_write1 \
@@ -16,6 +25,7 @@ noinst_PROGRAMS = \
tetmesh_read_tags \
trimesh_read \
trimesh_write \
trimesh_2gnuplot \
trimesh_adjacencies \
trimesh_write_dunetest
@@ -28,18 +38,19 @@ EXTRA_DIST = \
tetmesh_read.c \
tetmesh_read_tags.c \
tetmesh_write.c \
tetmesh_write1.c \
tetmesh_write1.c \
tetmesh_write2.c \
tetmesh_write_tags.c \
trimesh_adjacencies.c \
trimesh_read.c \
trimesh_write.c \
trimesh_2gnuplot.c \
trimesh_write_dunetest.c
endif
# map_tet2globalid.c \
# map_triangle2globalid.c \
# $(bin_SCRIPTS)
clean: clean-am
rm -f *.h5
clean-local:
$(RM) *.h5 *~
@@ -7,7 +7,6 @@
#define PRINT_UPADJACENCIES 1
#define PRINT_DOWNADJACENCIES 0
const h5_oid_t MESH_TYPE = H5_TETRAHEDRAL_MESH;
const char* FNAME = "simple_tet.h5";
typedef struct timer {
@@ -27,7 +26,7 @@ static Timer*
new (
void
) {
Timer* this = malloc (sizeof (Timer));
Timer* this = (Timer*)malloc (sizeof (Timer));
*this = Timer_;
return this;
}
@@ -500,7 +499,7 @@ traverse_elems (
static h5_err_t
traverse_level (
h5t_mesh_t* const m,
const h5t_lvl_idx_t level_id,
const h5_lvl_idx_t level_id,
int dumpit,
Timer* timer
) {
@@ -515,7 +514,7 @@ traverse_level (
static h5_err_t
traverse_mesh (
h5_file_t* const f,
h5_file_t const f,
const h5_id_t mesh_id
) {
h5t_mesh_t* mesh;
@@ -523,13 +522,13 @@ traverse_mesh (
Timer* timer = Timer_.new();
/* open mesh and get number of levels */
printf (" Opening mesh with id %lld\n", mesh_id);
printf (" Opening mesh with id %lld\n", (long long)mesh_id);
H5FedOpenTetrahedralMeshByIndex (f, mesh_id, &mesh);
h5_size_t num_levels = H5FedGetNumLevels (mesh);
printf (" Number of levels in mesh: %lld\n", (long long)num_levels);
/* loop over all levels */
h5t_lvl_idx_t level_id;
h5_lvl_idx_t level_id;
for (level_id = 0; level_id < num_levels; level_id++) {
traverse_level (mesh, level_id, dumpit, timer);
}
@@ -547,10 +546,11 @@ main (
/* abort program on error, so we don't have to handle them */
H5SetErrorHandler (H5AbortErrorhandler);
H5SetVerbosityLevel (2);
//H5SetVerbosityLevel (H5_DEBUG_ALL);
H5SetVerbosityLevel (0);
/* open file and get number of meshes */
h5_file_t *f = H5OpenFile (FNAME, H5_O_RDONLY, 0);
h5_file_t f = H5OpenFile (FNAME, H5_O_RDONLY, 0);
h5_size_t num_meshes = H5FedGetNumTetrahedralMeshes (f);
printf (" Number of meshes: %lld\n", (long long)num_meshes);
@@ -24,7 +24,7 @@ static Timer*
new (
void
) {
Timer* this = malloc (sizeof (Timer));
Timer* this = (Timer*)malloc (sizeof (Timer));
*this = Timer_;
return this;
}
@@ -280,7 +280,7 @@ traverse_elems (
static h5_err_t
traverse_level (
h5t_mesh_t* const m,
const h5t_lvl_idx_t level_id,
const h5_lvl_idx_t level_id,
int dumpit,
Timer* timer
) {
@@ -296,7 +296,7 @@ traverse_level (
static h5_err_t
traverse_mesh (
h5_file_t* const f,
h5_file_t const f,
const h5_id_t mesh_id,
int dumpit
) {
@@ -305,7 +305,7 @@ traverse_mesh (
timer->start(timer);
/* open mesh and get number of levels */
printf (" Opening mesh with id %lld\n", mesh_id);
printf (" Opening mesh with id %lld\n", (long long)mesh_id);
H5FedOpenTetrahedralMeshByIndex (f, mesh_id, &mesh);
timer->stop(timer);
printf (" %fsec\n", timer->elapsed(timer));
@@ -313,7 +313,7 @@ traverse_mesh (
printf (" Number of levels in mesh: %lld\n", (long long)num_levels);
/* loop over all levels */
h5t_lvl_idx_t level_id;
h5_lvl_idx_t level_id;
for (level_id = 0; level_id < num_levels; level_id++) {
traverse_level (mesh, level_id, dumpit, timer);
}
@@ -328,12 +328,13 @@ main (
int argc,
char* argv[]
) {
/* abort program on error, so we don't have to handle them */
H5SetErrorHandler (H5AbortErrorhandler);
H5SetVerbosityLevel (2);
H5SetVerbosityLevel (0);
/* open file and get number of meshes */
h5_file_t* f = H5OpenFile (FNAME, H5_O_RDONLY, 0);
h5_file_t f = H5OpenFile (FNAME, H5_O_RDONLY, H5_PROP_DEFAULT);
h5_size_t num_meshes = H5FedGetNumTetrahedralMeshes (f);
printf (" Number of meshes: %lld\n", (long long)num_meshes);
@@ -27,7 +27,7 @@ static Timer*
new (
void
) {
Timer* self = malloc (sizeof (Timer));
Timer* self = (Timer*)malloc (sizeof (Timer));
*self = Timer_;
return self;
}
@@ -111,7 +111,7 @@ traverse_vertices (
}
if (dumpit) {
printf (" (%llx, %llx, %llx) |",
tval[0], tval[1], tval[2]);
(long long)tval[0], (long long)tval[1], (long long)tval[2]);
}
num_entities_tagged++;
if (tval[0] != local_id ||
@@ -172,7 +172,7 @@ traverse_edges (
continue; // not tagged
if (dumpit) {
printf (" (%llx, %llx, %llx) |",
tval[0], tval[1], tval[2]);
(long long)tval[0], (long long)tval[1], (long long)tval[2]);
}
num_entities_tagged++;
@@ -236,7 +236,7 @@ traverse_triangles (
continue; // not tagged
if (dumpit) {
printf (" (%llx, %llx, %llx) |",
tval[0], tval[1], tval[2]);
(long long)tval[0], (long long)tval[1], (long long)tval[2]);
}
num_entities_tagged++;
@@ -298,7 +298,7 @@ traverse_tets (
continue; // not tagged
if (dumpit) {
printf (" (%llx, %llx, %llx) |",
tval[0], tval[1], tval[2]);
(long long)tval[0], (long long)tval[1], (long long)tval[2]);
}
num_entities_tagged++;
@@ -327,7 +327,7 @@ static h5_err_t
traverse_level (
h5t_mesh_t* const m,
h5t_tagset_t* tagset,
const h5t_lvl_idx_t level_id,
const h5_lvl_idx_t level_id,
int dumpit,
Timer* timer
) {
@@ -342,7 +342,7 @@ traverse_level (
static h5_err_t
traverse_mesh (
h5_file_t* const f,
const h5_file_t f,
const h5_id_t mesh_id,
int dumpit
) {
@@ -350,7 +350,7 @@ traverse_mesh (
Timer* timer = Timer_.new();
timer->start(timer);
/* open mesh and get number of levels */
printf (" Opening mesh with id %lld\n", mesh_id);
printf (" Opening mesh with id %lld\n", (long long)mesh_id);
H5FedOpenTetrahedralMeshByIndex (f, mesh_id, &mesh);
timer->stop(timer);
printf (" %fsec\n", timer->elapsed(timer));
@@ -362,7 +362,7 @@ traverse_mesh (
printf (" Number of levels in mesh: %lld\n", (long long)num_levels);
/* loop over all levels */
h5t_lvl_idx_t level_id;
h5_lvl_idx_t level_id;
for (level_id = 0; level_id < num_levels; level_id++) {
traverse_level (mesh, tagset, level_id, dumpit, timer);
}
@@ -383,7 +383,7 @@ main (
H5SetVerbosityLevel (2);
/* open file and get number of meshes */
h5_file_t* f = H5OpenFile (FNAME, H5_O_RDONLY, 0);
h5_file_t f = H5OpenFile (FNAME, H5_O_RDONLY, 0);
h5_size_t num_meshes = H5FedGetNumTetrahedralMeshes (f);
printf (" Number of meshes: %lld\n", (long long)num_meshes);
@@ -4,12 +4,6 @@
#include "H5hut.h"
#ifndef PARALLEL_IO
#ifndef MPI_COMM_WORLD
#define MPI_COMM_WORLD 0
#endif
#endif
const char* FNAME = "simple_tet.h5";
typedef struct vertex {
@@ -41,12 +35,13 @@ main (
int argc,
char* argv[]
) {
/* abort program on errors in library */
H5SetErrorHandler (H5AbortErrorhandler);
H5SetVerbosityLevel (5);
/* open file and add mesh */
h5_file_t* const f = H5OpenFile (FNAME, H5_O_WRONLY, 0);
h5_file_t const f = H5OpenFile (FNAME, H5_O_WRONLY, H5_PROP_DEFAULT);
h5t_mesh_t* mesh;
H5FedAddTetrahedralMesh (f, "0", &mesh);
@@ -66,13 +61,11 @@ main (
H5FedEndStoreElements (mesh);
/* add 1. Level */
H5FedAddLevel(mesh);
H5FedBeginRefineElements (mesh);
H5FedRefineElement (mesh, 0);
H5FedEndRefineElements (mesh);
/* add 2. Level */
H5FedAddLevel(mesh);
H5FedBeginRefineElements (mesh);
H5FedRefineElement (mesh, 2);
H5FedEndRefineElements (mesh);
@@ -44,7 +44,7 @@ main (
H5SetVerbosityLevel (H5_DEBUG_ALL);
/* open file and add mesh */
h5_file_t* const f = H5OpenFile (FNAME, H5_O_WRONLY, 0);
h5_file_t const f = H5OpenFile (FNAME, H5_O_WRONLY, 0);
h5t_mesh_t* mesh;
H5FedAddTetrahedralMesh (f, "0", &mesh);
@@ -64,7 +64,6 @@ main (
H5FedEndStoreElements (mesh);
/* add 1. Level */
H5FedAddLevel(mesh);
H5FedBeginRefineElements (mesh);
H5FedRefineElement (mesh, 0);
H5FedEndRefineElements (mesh);
@@ -61,7 +61,7 @@ main (
// H5SetVerbosityLevel (H5_DEBUG_ALL);
/* open file and add mesh */
h5_file_t* const f = H5OpenFile (FNAME, H5_O_WRONLY, 0);
h5_file_t const f = H5OpenFile (FNAME, H5_O_WRONLY, 0);
h5t_mesh_t* mesh;
H5FedAddTetrahedralMesh (f, "0", &mesh);
@@ -81,7 +81,6 @@ main (
H5FedEndStoreElements (mesh);
/* add 1. Level */
H5FedAddLevel(mesh);
H5FedBeginRefineElements (mesh);
H5FedRefineElement (mesh, 0);
H5FedEndRefineElements (mesh);
@@ -92,7 +91,6 @@ main (
for (level_id = 2; level_id < num_levels; level_id++) {
/* refine 4 to the power of level_id-1 elems */
H5FedAddLevel(mesh);
h5_int32_t num_elems2refine = power (4, level_id-1);
H5FedBeginRefineElements (mesh);
for (i = num_elems_last_level;
@@ -5,7 +5,6 @@
#include "H5hut.h"
const h5_oid_t MESH_TYPE = H5_TETRAHEDRAL_MESH;
const char* FNAME = "simple_tet.h5";
typedef struct timer {
@@ -23,7 +22,7 @@ static Timer*
new (
void
) {
Timer* this = malloc (sizeof (Timer));
Timer* this = (Timer*)malloc (sizeof (Timer));
*this = Timer_;
return this;
}
@@ -188,7 +187,7 @@ main (
H5SetVerbosityLevel (3);
/* open file and get number of meshes */
h5_file_t* f = H5OpenFile (FNAME, H5_O_RDWR, 0);
h5_file_t f = H5OpenFile (FNAME, H5_O_RDWR, 0);
h5t_mesh_t* mesh;
Timer* timer = Timer_.new();
timer->start(timer);
@@ -197,7 +196,7 @@ main (
h5_info (" Time to open mesh %fsec", timer->elapsed(timer));
/* open last level */
h5_size_t num_levels = H5FedGetNumLevels (mesh);
//h5_size_t num_levels = H5FedGetNumLevels (mesh);
//H5FedSetLevel (mesh, num_levels-1);
H5FedSetLevel (mesh, 0);
+95
View File
@@ -0,0 +1,95 @@
#include <stdio.h>
#include <stdlib.h>
#include "H5hut.h"
#if defined (PARALLEL_IO)
#include <mpi.h>
#endif
#define H5FedGetNumLeafElementsTotal H5FedGetNumElementsTotal
/*
Traverse elements and output coordinates
*/
static h5_err_t
traverse_elems (
h5t_mesh_t* const m
) {
/* get number of elements we have to expect */
h5_size_t num_elems_expect = H5FedGetNumLeafElementsTotal (m);
/* get iterator for co-dim 0 */
h5t_iterator_t* iter = H5FedBeginTraverseEntities (m, 0);
/* iterate over all co-dim 0 entities, i.e. elements */
h5_loc_id_t local_id;
h5_size_t num_elems = 0;
while ((local_id = H5FedTraverseEntities (iter)) >= 0) {
h5_loc_id_t local_vids[4];
H5FedGetVertexIndicesOfEntity (m, local_id, local_vids);
printf ("# cell %llx\n", (long long unsigned)local_id );
h5_float64_t P[3];
for (int i = 0; i < 3; i++) {
H5FedGetVertexCoordsByIndex (m, local_vids[i], P);
printf (" %8.6f %8.6f\n", P[0], P[1]);
}
H5FedGetVertexCoordsByIndex (m, local_vids[0], P);
printf (" %8.6f %8.6f\n", P[0], P[1]);
printf ("\n");
num_elems++;
}
/* done */
H5FedEndTraverseEntities (iter);
/* report error if we got a different number then expected */
if (num_elems != num_elems_expect) {
fprintf (stderr, "!!! Got %lld elements, but expected %lld.\n",
(long long)num_elems, (long long)num_elems_expect);
exit(1);
}
return H5_SUCCESS;
}
int
main (
int argc,
char* argv[]
) {
if (argc < 2 || argc > 3) {
fprintf (stderr, "Usage: %s FILE [LEVEL]\n", argv[0]);
exit (42);
}
/* abort program on error, so we don't have to handle them */
H5SetErrorHandler (H5AbortErrorhandler);
H5SetVerbosityLevel (0);
/* open file and get number of meshes */
h5_file_t f = H5OpenFile (argv[1], H5_O_RDONLY, H5_PROP_DEFAULT);
h5t_mesh_t* m;
H5FedOpenTriangleMeshByIndex (f, 0, &m);
int num_levels = H5FedGetNumLevels (m);
int level = num_levels-1;
if (argc >= 3) {
level = atoi (argv[2]);
}
if (level >= num_levels || level < 0) {
fprintf (stderr, "level %d out of range\n", level);
goto done;
}
H5FedSetLevel (m, level);
traverse_elems (m);
done:
H5FedCloseMesh (m);
H5CloseFile (f);
#if defined (PARALLEL_IO)
MPI_Finalize ();
#endif
return 0;
}
@@ -7,7 +7,6 @@
#define PRINT_UPADJACENCIES 1
#define PRINT_DOWNADJACENCIES 0
const h5_oid_t MESH_TYPE = H5_TRIANGLE_MESH;
const char* FNAME = "simple_triangle.h5";
static h5_err_t
@@ -244,7 +243,7 @@ traverse_elems (
clock_t t_min = CLOCKS_PER_SEC;
clock_t t_max = 0;
clock_t t = 0;
printf ("\nAdjacencies to tetrahedra\n");
printf ("\nAdjacencies to triangles\n");
h5t_iterator_t* iter = H5FedBeginTraverseEntities (m, 0);
while ((local_id = H5FedTraverseEntities (iter)) >= 0) {
print_adjacencies_of_elem (m, local_id, &t);
@@ -267,7 +266,7 @@ traverse_elems (
static h5_err_t
traverse_level (
h5t_mesh_t* const m,
const h5t_lvl_idx_t level_id
const h5_lvl_idx_t level_id
) {
printf (" Setting level to %d\n", level_id);
H5FedSetLevel (m, level_id);
@@ -279,18 +278,18 @@ traverse_level (
static h5_err_t
traverse_mesh (
h5_file_t* const f,
const h5_file_t f,
const h5_id_t mesh_id
) {
h5t_mesh_t* m;
/* open mesh and get number of levels */
printf (" Opening mesh with id %lld\n", mesh_id);
printf (" Opening mesh with id %lld\n", (long long)mesh_id);
H5FedOpenTriangleMeshByIndex (f, mesh_id, &m);
h5_size_t num_levels = H5FedGetNumLevels (m);
printf (" Number of levels in mesh: %lld\n", (long long)num_levels);
/* loop over all levels */
h5t_lvl_idx_t level_id;
h5_lvl_idx_t level_id;
for (level_id = 0; level_id < num_levels; level_id++) {
traverse_level (m, level_id);
}
@@ -310,7 +309,7 @@ main (
H5SetVerbosityLevel (2);
/* open file and get number of meshes */
h5_file_t *f = H5OpenFile (FNAME, H5_O_RDONLY, 0);
h5_file_t f = H5OpenFile (FNAME, H5_O_RDONLY, 0);
h5_size_t num_meshes = H5FedGetNumTriangleMeshes (f);
printf (" Number of meshes: %lld\n", (long long)num_meshes);
@@ -209,18 +209,18 @@ traverse_level (
static h5_err_t
traverse_mesh (
h5_file_t* const f,
const h5_file_t f,
const h5_id_t mesh_id
) {
h5t_mesh_t* m;
/* open mesh and get number of levels */
printf (" Opening mesh with id %lld\n", mesh_id);
printf (" Opening mesh with id %lld\n", (long long)mesh_id);
H5FedOpenTriangleMeshByIndex (f, mesh_id, &m);
h5_size_t num_levels = H5FedGetNumLevels (m);
printf (" Number of levels in mesh: %lld\n", (long long)num_levels);
/* loop over all levels */
h5t_lvl_idx_t level_id;
h5_lvl_idx_t level_id;
for (level_id = 0; level_id < num_levels; level_id++) {
traverse_level (m, level_id);
}
@@ -236,19 +236,12 @@ main (
char* argv[]
) {
#if defined (PARALLEL_IO)
MPI_Comm comm = MPI_COMM_WORLD;
MPI_Init (&argc, &argv);
#else
MPI_Comm comm = 0;
#endif
/* abort program on error, so we don't have to handle them */
H5SetErrorHandler (H5AbortErrorhandler);
H5SetVerbosityLevel (0);
H5SetVerbosityLevel (H5_DEBUG_ALL);
/* open file and get number of meshes */
h5_file_t* f = H5OpenFile (FNAME, H5_O_RDONLY, comm);
h5_file_t f = H5OpenFile (FNAME, H5_O_RDONLY, H5_PROP_DEFAULT);
h5_size_t num_meshes = H5FedGetNumTriangleMeshes (f);
printf (" Number of meshes: %lld\n", (long long)num_meshes);
@@ -38,7 +38,7 @@ main (
H5SetVerbosityLevel (5);
/* open file and add mesh */
h5_file_t* const f = H5OpenFile (FNAME, H5_O_WRONLY, 0);
const h5_file_t f = H5OpenFile (FNAME, H5_O_WRONLY, 0);
h5t_mesh_t* m;
H5FedAddTriangleMesh (f, "0", &m);
@@ -58,7 +58,6 @@ main (
H5FedEndStoreElements (m);
/* add 1. Level */
H5FedAddLevel(m);
H5FedBeginRefineElements (m);
H5FedRefineElement (m, 0);
H5FedEndRefineElements (m);
@@ -45,7 +45,7 @@ main (
H5SetVerbosityLevel (2);
/* open file and add mesh */
h5_file_t* const f = H5OpenFile (FNAME, H5_O_WRONLY, 0);
const h5_file_t f = H5OpenFile (FNAME, H5_O_WRONLY, 0);
h5t_mesh_t* m;
H5FedAddTriangleMesh (f, "0", &m);
+9
View File
@@ -0,0 +1,9 @@
read_core_vfd
read_core_vfdf
read_canonicalviewf
read_setnparticlesf
read_setviewf
read_stridedf
write_core_vfdf
write_setnparticlesf
write_stridedf
+78
View File
@@ -0,0 +1,78 @@
#
# Copyright (c) 2006-2015, The Regents of the University of California,
# through Lawrence Berkeley National Laboratory (subject to receipt of any
# required approvals from the U.S. Dept. of Energy) and the Paul Scherrer
# Institut (Switzerland). All rights reserved.!
#
# License: see file COPYING in top level of source distribution.
#
AM_CPPFLAGS += -I${abs_top_srcdir}/src/include
FFLAGS += -cpp $(AM_CPPFLAGS)
AM_LDFLAGS += -L${abs_top_builddir}/src/h5core/.libs
LDADD =
if ENABLE_EXAMPLES
if ENABLE_C
LDADD +=
endif
if ENABLE_FORTRAN
LDADD += -lH5hutF
AM_LDFLAGS += -L${abs_top_builddir}/src/Fortran/.libs
endif
LDADD += -lH5hut
noinst_PROGRAMS =
if ENABLE_C
noinst_PROGRAMS += \
read_core_vfd \
read_canonicalview \
read_setnparticles \
read_setview \
read_strided \
write_core_vfd \
write_setnparticles \
write_setview \
write_strided
endif
if ENABLE_FORTRAN
if ENABLE_PARALLEL
noinst_PROGRAMS += \
read_core_vfdf \
read_canonicalviewf \
read_setnparticlesf \
read_setviewf \
read_stridedf \
write_core_vfdf \
write_setnparticlesf \
write_setviewf \
write_stridedf
endif
endif
EXTRA_PROGRAMS =
read_core_vfdf_SOURCES = read_core_vfdf.f90
read_canonicalviewf_SOURCES = read_canonicalviewf.f90
read_setnparticlesf_SOURCES = read_setnparticlesf.f90
read_setviewf_SOURCES = read_setviewf.f90
read_stridedf_SOURCES = read_stridedf.f90
write_core_vfdf_SOURCES = write_core_vfdf.f90
write_setnparticlesf_SOURCES = write_setnparticlesf.f90
write_setviewf_SOURCES = write_setviewf.f90
write_stridedf_SOURCES = write_stridedf.f90
endif
%.o : %.f90
$(FC) $(FFLAGS) -c $<
clean-local:
$(RM) *~
+55
View File
@@ -0,0 +1,55 @@
/*
Copyright (c) 2006-2015, The Regents of the University of California,
through Lawrence Berkeley National Laboratory (subject to receipt of any
required approvals from the U.S. Dept. of Energy) and the Paul Scherrer
Institut (Switzerland). All rights reserved.
License: see file COPYING in top level of source distribution.
*/
#include "H5hut.h"
// name of input file
const char* fname = "example_setview.h5";
// H5hut verbosity level
const h5_int64_t h5_verbosity = H5_VERBOSE_DEFAULT;
int
main (
int argc, char* argv[]
){
// initialize MPI & H5hut
MPI_Init (&argc, &argv);
MPI_Comm comm = MPI_COMM_WORLD;
int comm_size = 1;
MPI_Comm_size (comm, &comm_size);
int comm_rank = 0;
MPI_Comm_rank (comm, &comm_rank);
H5AbortOnError ();
H5SetVerbosityLevel (h5_verbosity);
// open file and go to first step
h5_file_t file = H5OpenFile (fname, H5_O_RDONLY, H5_PROP_DEFAULT);
H5SetStep (file, 0);
// set canonical view
H5PartSetCanonicalView (file);
h5_int64_t num_particles = H5PartGetNumParticles (file);
printf ("[proc %d]: particles in view: %lld\n", comm_rank, (long long)num_particles);
// read and print data
h5_int32_t* data = calloc (num_particles, sizeof (*data));
H5PartReadDataInt32 (file, "data", data);
for (int i = 0; i < num_particles; i++) {
printf ("[proc %d]: local index = %d, value = %d\n",
comm_rank, i, data[i]);
}
// cleanup
free (data);
H5CloseFile (file);
MPI_Finalize ();
return 0;
}
+58
View File
@@ -0,0 +1,58 @@
!
! Copyright (c) 2006-2015, The Regents of the University of California,
! through Lawrence Berkeley National Laboratory (subject to receipt of any
! required approvals from the U.S. Dept. of Energy) and the Paul Scherrer
! Institut (Switzerland). All rights reserved.!
!
! License: see file COPYING in top level of source distribution.
!
include 'H5hut.f90'
program read_canonicalview
use H5hut
implicit none
include 'mpif.h'
! name of input file
character (len=*), parameter :: fname = "example_setview.h5"
! H5hut verbosity level
integer*8, parameter :: h5_verbosity = H5_VERBOSE_DEFAULT
integer :: comm, comm_size, comm_rank, mpi_ierror
integer*8 :: file, h5_ierror
integer*8 :: num_particles
integer*8 :: i
integer*4, allocatable :: data(:)
! initialize MPI & H5hut
comm = MPI_COMM_WORLD
call mpi_init (mpi_ierror)
call mpi_comm_size (comm, comm_size, mpi_ierror)
call mpi_comm_rank (comm, comm_rank, mpi_ierror)
call h5_abort_on_error ()
call h5_set_verbosity_level (h5_verbosity)
! open file and go to first step
file = h5_openfile (fname, H5_O_RDONLY, H5_PROP_DEFAULT)
h5_ierror = h5_setstep(file, 1_8)
! set canonical view
h5_ierror = h5pt_setcanonicalview (file)
num_particles = h5pt_getnpoints (file)
write (*, "('[proc ', i4, '] particles in view: ', i8)") comm_rank, num_particles
! read and print data
allocate (data (num_particles))
h5_ierror = h5pt_readdata_i4 (file, "data", data);
do i = 1, num_particles
write (*, "('[proc ', i4, ']: local index = ', i4, ', value = ', i4)") &
comm_rank, i, data(i)
end do
! cleanup
deallocate (data)
h5_ierror = h5_closefile (file)
call mpi_finalize (mpi_ierror)
end program read_canonicalview
+64
View File
@@ -0,0 +1,64 @@
/*
Copyright (c) 2006-2015, The Regents of the University of California,
through Lawrence Berkeley National Laboratory (subject to receipt of any
required approvals from the U.S. Dept. of Energy) and the Paul Scherrer
Institut (Switzerland). All rights reserved.
License: see file COPYING in top level of source distribution.
*/
/*
Note:
Running this example on more than one core is possible but the result
might not be what you expect. Please read the HDF5 documentation about
the VFD core driver.
*/
#include "H5hut.h"
// name of input file
const char* fname = "example_core_vfd.h5";
// H5hut verbosity level
const h5_int64_t h5_verbosity = H5_VERBOSE_DEFAULT;
int
main (
int argc,
char* argv[]
){
// initialize MPI & H5hut
MPI_Init (&argc, &argv);
MPI_Comm comm = MPI_COMM_WORLD;
int comm_size = 1;
MPI_Comm_size (comm, &comm_size);
int comm_rank = 0;
MPI_Comm_rank (comm, &comm_rank);
H5AbortOnError ();
H5SetVerbosityLevel (h5_verbosity);
// open file and create first step
h5_prop_t prop = H5CreateFileProp ();
H5SetPropFileCoreVFD (prop, 0);
h5_file_t file = H5OpenFile (fname, H5_O_RDONLY, prop);
H5SetStep (file, 0);
// with core cfd we read the hole file on all cores!
h5_int64_t num_particles = H5PartGetNumParticles (file);
printf ("[proc %d]: particles in view: %lld\n", comm_rank, (long long)num_particles);
// read and print data
h5_int32_t* data = calloc (num_particles, sizeof (*data));
H5PartReadDataInt32 (file, "data", data);
for (int i = 0; i < num_particles; i++) {
printf ("[proc %d]: local index = %d, value = %d\n",
comm_rank, i, data[i]);
}
// cleanup
free (data);
H5CloseFile (file);
MPI_Finalize ();
return H5_SUCCESS;
}
+62
View File
@@ -0,0 +1,62 @@
!
! Copyright (c) 2006-2015, The Regents of the University of California,
! through Lawrence Berkeley National Laboratory (subject to receipt of any
! required approvals from the U.S. Dept. of Energy) and the Paul Scherrer
! Institut (Switzerland). All rights reserved.!
!
! License: see file COPYING in top level of source distribution.
!
include 'H5hut.f90'
program read_core_vfd
use H5hut
implicit none
include 'mpif.h'
! name of input file
character (len=*), parameter :: fname = "example_core_vfd.h5"
! H5hut verbosity level
integer*8, parameter :: h5_verbosity = H5_VERBOSE_DEFAULT
integer :: comm, comm_size, comm_rank, mpi_ierror
integer*8 :: file, h5_ierror
integer*8 :: prop
integer*8 :: num_particles
integer*4 :: i
integer*4, allocatable :: data(:)
! initialize MPI & H5hut
comm = MPI_COMM_WORLD
call mpi_init (mpi_ierror)
call mpi_comm_size (comm, comm_size, mpi_ierror)
call mpi_comm_rank (comm, comm_rank, mpi_ierror)
call h5_abort_on_error ()
call h5_set_verbosity_level (h5_verbosity)
! open file and create first step
prop = h5_createprop_file ()
h5_ierror = h5_setprop_file_corevfd (prop);
file = h5_openfile (fname, H5_O_RDONLY, prop)
h5_ierror = h5_setstep(file, 1_8)
! with core cfd we read the hole file on all cores!
num_particles = h5pt_getnpoints (file)
write (*, "('[proc ', i4, ']: particles in view: ', i4)") &
comm_rank, num_particles
! read and print data
allocate (data (num_particles))
h5_ierror = h5pt_readdata_i4 (file, "data", data)
do i = 1, int (num_particles)
write (*, "('[proc ', i4, ']: local index = ', i4, ', value = ', i4)") &
comm_rank, i, data(i)
end do
! cleanup
deallocate (data)
h5_ierror = h5_closefile (file)
call mpi_finalize (mpi_ierror)
end program read_core_vfd
+63
View File
@@ -0,0 +1,63 @@
/*
Copyright (c) 2006-2015, The Regents of the University of California,
through Lawrence Berkeley National Laboratory (subject to receipt of any
required approvals from the U.S. Dept. of Energy) and the Paul Scherrer
Institut (Switzerland). All rights reserved.
License: see file COPYING in top level of source distribution.
*/
#include "H5hut.h"
// name of input file
const char* fname = "example_setnparticles.h5";
// H5hut verbosity level
const h5_int64_t h5_verbosity = H5_VERBOSE_DEFAULT;
int
main (
int argc, char* argv[]
){
// initialize MPI & H5hut
MPI_Init (&argc, &argv);
MPI_Comm comm = MPI_COMM_WORLD;
int comm_size = 1;
MPI_Comm_size (comm, &comm_size);
int comm_rank = 0;
MPI_Comm_rank (comm, &comm_rank);
H5AbortOnError ();
H5SetVerbosityLevel (h5_verbosity);
// open file and go to first step
h5_file_t file = H5OpenFile (fname, H5_O_RDONLY, H5_PROP_DEFAULT);
H5SetStep (file, 0);
// compute number of particles this process has to read
h5_ssize_t num_particles_total = H5PartGetNumParticles (file);
h5_ssize_t num_particles = num_particles_total / comm_size;
if (comm_rank+1 == comm_size)
num_particles += num_particles_total % comm_size;
printf ("[proc %d]: particles in view: %lld\n", comm_rank, (long long)num_particles);
printf ("[proc %d]: total number of particles: %lld\n",
comm_rank, (long long unsigned)num_particles_total);
// set number of particles
H5PartSetNumParticles (file, num_particles);
// read and print data
h5_int32_t* data = calloc (num_particles, sizeof (*data));
H5PartReadDataInt32 (file, "data", data);
for (int i = 0; i < num_particles; i++) {
printf ("[proc %d]: local index = %d, value = %d\n",
comm_rank, i, data[i]);
}
// cleanup
free (data);
H5CloseFile (file);
MPI_Finalize ();
return 0;
}
+66
View File
@@ -0,0 +1,66 @@
!
! Copyright (c) 2006-2015, The Regents of the University of California,
! through Lawrence Berkeley National Laboratory (subject to receipt of any
! required approvals from the U.S. Dept. of Energy) and the Paul Scherrer
! Institut (Switzerland). All rights reserved.!
!
! License: see file COPYING in top level of source distribution.
!
include 'H5hut.f90'
program read_setnparticles
use H5hut
implicit none
include 'mpif.h'
! name of input file
character (len=*), parameter :: fname = "example_setnparticles.h5"
! H5hut verbosity level
integer*8, parameter :: h5_verbosity = H5_VERBOSE_DEFAULT
integer :: comm, comm_size, comm_rank, mpi_ierror
integer*8 :: file, h5_ierror
integer*8 :: num_particles, num_particles_total
integer*8 :: i
integer*4, allocatable :: data(:)
! initialize MPI & H5hut
comm = MPI_COMM_WORLD
call mpi_init (mpi_ierror)
call mpi_comm_size (comm, comm_size, mpi_ierror)
call mpi_comm_rank (comm, comm_rank, mpi_ierror)
call h5_abort_on_error ()
call h5_set_verbosity_level (h5_verbosity)
! open file and go to first step
file = h5_openfile (fname, H5_O_RDONLY, H5_PROP_DEFAULT)
h5_ierror = h5_setstep (file, 1_8)
! compute number of particles this process has to read
num_particles_total = h5pt_getnpoints (file)
num_particles = num_particles_total / comm_size
if (comm_rank+1 == comm_size) then
num_particles = num_particles + mod (num_particles_total, comm_size)
end if
write (*, "('Total number of particles: ', i8)") num_particles_total
write (*, "('Number of particles on this core: ', i8)") num_particles
! set number of particeles
h5_ierror = h5pt_setnpoints (file, num_particles)
! read and print data
allocate (data (num_particles))
h5_ierror = h5pt_readdata_i4 (file, "data", data)
do i = 1, num_particles
write (*, "('[proc ', i4, ']: local index = ', i4, ', value = ', i4)") &
comm_rank, i, data(i)
end do
! cleanup
deallocate (data)
h5_ierror = h5_closefile (file)
call mpi_finalize (mpi_ierror)
end program read_setnparticles
+74
View File
@@ -0,0 +1,74 @@
/*
Copyright (c) 2006-2015, The Regents of the University of California,
through Lawrence Berkeley National Laboratory (subject to receipt of any
required approvals from the U.S. Dept. of Energy) and the Paul Scherrer
Institut (Switzerland). All rights reserved.
License: see file COPYING in top level of source distribution.
*/
#include "H5hut.h"
// name of input file
const char* fname = "example_setview.h5";
// H5hut verbosity level
const h5_int64_t h5_verbosity = H5_VERBOSE_DEFAULT;
int
main (
int argc, char* argv[]
){
// initialize MPI & H5hut
MPI_Init (&argc, &argv);
MPI_Comm comm = MPI_COMM_WORLD;
int comm_size = 1;
MPI_Comm_size (comm, &comm_size);
int comm_rank = 0;
MPI_Comm_rank (comm, &comm_rank);
H5AbortOnError ();
H5SetVerbosityLevel (h5_verbosity);
// open file and go to first step
h5_file_t file = H5OpenFile (fname, H5_O_RDONLY, H5_PROP_DEFAULT);
H5SetStep (file, 0);
// compute and set a "canonical" view:
// all cores get almost the same number of particles
h5_int64_t num_particles_total = H5PartGetNumParticles (file);
h5_int64_t num_particles = num_particles_total / comm_size;
h5_int64_t remainder = num_particles_total % comm_size;
h5_int64_t start = comm_rank * num_particles;
// adjust number of local particles
if (comm_rank < remainder)
num_particles++;
// adjust start
if (comm_rank < remainder)
start += comm_rank;
else
start += remainder;
// Note:
// setting end = start - 1 forces the selection of zero particles!
h5_int64_t end = start + num_particles - 1;
printf ("[proc %d]: set view to [%lld..%lld]\n", comm_rank, (long long)start, (long long)end);
H5PartSetView (file, start, end);
// read and print data
h5_int32_t* data = calloc (num_particles, sizeof (*data));
H5PartReadDataInt32 (file, "data", data);
for (int i = 0; i < num_particles; i++) {
printf ("[proc %d]: global index = %lld; local index = %d, value = %d\n",
comm_rank, (long long)(start+i), i, data[i]);
}
// cleanup
free (data);
H5CloseFile (file);
MPI_Finalize ();
return 0;
}
+83
View File
@@ -0,0 +1,83 @@
!
! Copyright (c) 2006-2015, The Regents of the University of California,
! through Lawrence Berkeley National Laboratory (subject to receipt of any
! required approvals from the U.S. Dept. of Energy) and the Paul Scherrer
! Institut (Switzerland). All rights reserved.!
!
! License: see file COPYING in top level of source distribution.
!
include 'H5hut.f90'
program read_setviewf
use H5hut
implicit none
include 'mpif.h'
! name of input file
character (len=*), parameter :: fname = "example_setview.h5"
! H5hut verbosity level
integer*8, parameter :: h5_verbosity = H5_VERBOSE_DEFAULT
integer :: comm, comm_size, comm_rank, mpi_ierror
integer*8 :: file, h5_ierror
integer*8 :: num_particles, num_particles_total
integer*8 :: i, start, end, remainder
integer*4, allocatable :: data(:)
! initialize MPI & H5hut
comm = MPI_COMM_WORLD
call mpi_init (mpi_ierror)
call mpi_comm_size (comm, comm_size, mpi_ierror)
call mpi_comm_rank (comm, comm_rank, mpi_ierror)
call h5_abort_on_error ()
call h5_set_verbosity_level (h5_verbosity)
! open file and go to first step
file = h5_openfile (fname, H5_O_RDONLY, H5_PROP_DEFAULT)
h5_ierror = h5_setstep(file, 1_8)
! compute a "canonical" view:
! all cores get almost the same number of particles
num_particles_total = h5pt_getnpoints (file);
num_particles = num_particles_total / comm_size;
remainder = mod (num_particles_total, comm_size);
start = comm_rank * num_particles;
! adjust number of local particles
if (comm_rank < remainder) then
num_particles = num_particles + 1
end if
! adjust start
if (comm_rank < remainder) then
start = start + comm_rank
else
start = start + remainder
end if
! Note:
! setting end = start - 1 forces the selection of zero particles!
end = start + num_particles - 1;
! adjust Fortran indices: in Fortran we start at 1 not 0
start = start + 1
end = end + 1
write (*, "('[proc ', i4, ']: set view to [', i4, '..', i4, ']')") comm_rank, start, end
h5_ierror = h5pt_setview (file, start, end);
! read and print data
allocate (data (num_particles))
h5_ierror = h5pt_readdata_i4 (file, "data", data);
do i = 1, num_particles
write (*, "('[proc ', i4, ']: global index = ', i4, '; local index = ', i4, ', value = ', i4)") &
comm_rank, start+i-1, i, data(i)
end do
! cleanup
deallocate (data)
h5_ierror = h5_closefile (file)
call mpi_finalize (mpi_ierror)
end program read_setviewf
+71
View File
@@ -0,0 +1,71 @@
/*
Copyright (c) 2006-2015, The Regents of the University of California,
through Lawrence Berkeley National Laboratory (subject to receipt of any
required approvals from the U.S. Dept. of Energy) and the Paul Scherrer
Institut (Switzerland). All rights reserved.
License: see file COPYING in top level of source distribution.
*/
#include "H5hut.h"
// name of input file
const char* fname = "example_strided.h5";
// H5hut verbosity level
const h5_int64_t h5_verbosity = H5_VERBOSE_DEFAULT;
//const h5_int64_t h5_verbosity = H5_DEBUG_ALL;
int
main (
int argc, char* argv[]
){
// initialize MPI & H5hut
MPI_Init (&argc, &argv);
MPI_Comm comm = MPI_COMM_WORLD;
int comm_size = 1;
MPI_Comm_size (comm, &comm_size);
int comm_rank = 0;
MPI_Comm_rank (comm, &comm_rank);
H5AbortOnError ();
H5SetVerbosityLevel (h5_verbosity);
// open file and go to first step
h5_file_t file = H5OpenFile (fname, H5_O_RDONLY, H5_PROP_DEFAULT);
H5SetStep (file, 0);
// compute number of particles this process has to read
h5_ssize_t num_particles_total = H5PartGetNumParticles (file);
h5_ssize_t num_particles = num_particles_total / comm_size;
if (comm_rank+1 == comm_size)
num_particles += num_particles_total % comm_size;
printf ("[proc %d]: particles in view: %lld\n", comm_rank, (long long)num_particles);
printf ("[proc %d]: total number of particles: %lld\n",
comm_rank, (long long unsigned)num_particles_total);
// set number of particles and memory stride
H5PartSetNumParticlesStrided (file, num_particles, 6);
// read data
h5_float64_t* data = calloc (6*num_particles, sizeof (*data));
H5PartReadDataFloat64 (file, "x", data+0);
H5PartReadDataFloat64 (file, "y", data+1);
H5PartReadDataFloat64 (file, "z", data+2);
H5PartReadDataFloat64 (file, "px", data+3);
H5PartReadDataFloat64 (file, "py", data+4);
H5PartReadDataFloat64 (file, "pz", data+5);
// print dataset "x"
for (int i = 0; i < num_particles*6; i+=6) {
printf ("[proc %d]: local index = %d, value = %6.3f\n",
comm_rank, i, data[i]);
}
// cleanup
free (data);
H5CloseFile (file);
MPI_Finalize ();
return 0;
}
+73
View File
@@ -0,0 +1,73 @@
!
! Copyright (c) 2006-2015, The Regents of the University of California,
! through Lawrence Berkeley National Laboratory (subject to receipt of any
! required approvals from the U.S. Dept. of Energy) and the Paul Scherrer
! Institut (Switzerland). All rights reserved.!
!
! License: see file COPYING in top level of source distribution.
!
include 'H5hut.f90'
program read_stridedf
use H5hut
implicit none
include 'mpif.h'
! name of input file
character (len=*), parameter :: fname = "example_strided.h5"
! H5hut verbosity level
integer*8, parameter :: h5_verbosity = H5_VERBOSE_DEFAULT
integer :: comm, comm_size, comm_rank, mpi_ierror
integer*8 :: file, h5_ierror
integer*8 :: num_particles, num_particles_total
real*8, allocatable :: data(:)
integer*8 :: i, start
! initialize MPI & H5hut
comm = MPI_COMM_WORLD
call mpi_init (mpi_error)
call mpi_comm_size (comm, comm_size, mpi_ierror)
call mpi_comm_rank (comm, comm_rank, mpi_ierror)
call h5_abort_on_error ()
call h5_set_verbosity_level (h5_verbosity)
! open file and go to first step
file = h5_openfile (fname, H5_O_RDONLY, H5_PROP_DEFAULT)
h5_ierror = h5_setstep(file, 1_8)
! compute number of particles this process has to read
num_particles_total = h5pt_getnpoints (file)
num_particles = num_particles_total / comm_size
if (comm_rank+1 == comm_size) then
num_particles = num_particles + mod (num_particles_total, comm_size)
end if
write (*, "('Total number of particles: ', i8)") num_particles_total
write (*, "('Number of particles on this core: ', i8)") num_particles
! set number of particeles and memory stride
h5_ierror = h5pt_setnpoints_strided (file, num_particles, 6_8)
! read data
allocate (data (6*num_particles))
h5_ierror = h5pt_readdata_r8 (file, "x", data(1:))
h5_ierror = h5pt_readdata_r8 (file, "y", data(2:))
h5_ierror = h5pt_readdata_r8 (file, "z", data(3:))
h5_ierror = h5pt_readdata_r8 (file, "px", data(4:))
h5_ierror = h5pt_readdata_r8 (file, "py", data(5:))
h5_ierror = h5pt_readdata_r8 (file, "pz", data(6:))
! print dataset "x"
start = 1
do i = start, num_particles*6, 6
write (*, "('[proc ', i4, ']: global index = ', i4, '; local index = ', i4, ', value = ', f10.2)") &
comm_rank, start+i-2, i, data(i)
end do
! cleanup
deallocate (data)
h5_ierror = h5_closefile (file)
call mpi_finalize (mpi_ierror)
end program read_stridedf
+66
View File
@@ -0,0 +1,66 @@
/*
Copyright (c) 2006-2015, The Regents of the University of California,
through Lawrence Berkeley National Laboratory (subject to receipt of any
required approvals from the U.S. Dept. of Energy) and the Paul Scherrer
Institut (Switzerland). All rights reserved.
License: see file COPYING in top level of source distribution.
*/
/*
Note:
Running this example on more than one core is possible but the result
might not be what you expect. Please read the HDF5 documentation about
the VFD core driver.
*/
#include "H5hut.h"
// name of output file
const char* fname = "example_core_vfd.h5";
// H5hut verbosity level
const h5_int64_t h5_verbosity = H5_VERBOSE_DEFAULT;
// number of particles we are going to write per core
const h5_int64_t num_particles = 32;
int
main (
int argc,
char* argv[]
){
// initialize MPI & H5hut
MPI_Init (&argc, &argv);
MPI_Comm comm = MPI_COMM_WORLD;
int comm_size = 1;
MPI_Comm_size (comm, &comm_size);
int comm_rank = 0;
MPI_Comm_rank (comm, &comm_rank);
H5AbortOnError ();
H5SetVerbosityLevel (h5_verbosity);
// open file and create first step
h5_prop_t prop = H5CreateFileProp ();
H5SetPropFileCoreVFD (prop, 0);
h5_file_t file = H5OpenFile (fname, H5_O_WRONLY, prop);
H5SetStep (file, 0);
// set number of particles this process is going to write
H5PartSetNumParticles(file, num_particles);
// create fake data
h5_int32_t data[num_particles];
for (int i = 0; i < num_particles; i++) {
data[i] = i + comm_rank * num_particles;
}
// write the data
H5PartWriteDataInt32 (file, "data", data);
// cleanup
H5CloseFile (file);
MPI_Finalize ();
return 0;
}
+62
View File
@@ -0,0 +1,62 @@
!
! Copyright (c) 2006-2015, The Regents of the University of California,
! through Lawrence Berkeley National Laboratory (subject to receipt of any
! required approvals from the U.S. Dept. of Energy) and the Paul Scherrer
! Institut (Switzerland). All rights reserved.!
!
! License: see file COPYING in top level of source distribution.
!
include 'H5hut.f90'
program write_core_vfd
use H5hut
implicit none
include 'mpif.h'
! name of output file
character (len=*), parameter :: fname = "example_core_vfd.h5"
! H5hut verbosity level
integer*8, parameter :: h5_verbosity = H5_VERBOSE_DEFAULT
! number of particles we are going to write per core
integer*4, parameter :: num_particles = 32
integer :: comm, comm_size, comm_rank, mpi_ierror
integer*8 :: file, h5_ierror
integer*8 :: prop
integer*4 :: i
integer*4, allocatable :: data(:)
! initialize MPI & H5hut
comm = MPI_COMM_WORLD
call mpi_init (mpi_ierror)
call mpi_comm_size (comm, comm_size, mpi_ierror)
call mpi_comm_rank (comm, comm_rank, mpi_ierror)
call h5_abort_on_error ()
call h5_set_verbosity_level (h5_verbosity)
! open file and create first step
prop = h5_createprop_file ()
h5_ierror = h5_setprop_file_corevfd (prop);
file = h5_openfile (fname, H5_O_WRONLY, prop)
h5_ierror = h5_setstep(file, 1_8)
! set number of particles this process is going to write
h5_ierror = h5pt_setnpoints (file, int8 (num_particles))
! create fake data
allocate (data (num_particles))
do i = 1, num_particles
data (i) = (i-1) + comm_rank * num_particles
end do
! write the data
h5_ierror = h5pt_writedata_i4 (file, "data", data);
! cleanup
deallocate (data)
h5_ierror = h5_closefile (file)
call mpi_finalize (mpi_ierror)
end program write_core_vfd
+57
View File
@@ -0,0 +1,57 @@
/*
Copyright (c) 2006-2015, The Regents of the University of California,
through Lawrence Berkeley National Laboratory (subject to receipt of any
required approvals from the U.S. Dept. of Energy) and the Paul Scherrer
Institut (Switzerland). All rights reserved.
License: see file COPYING in top level of source distribution.
*/
#include "H5hut.h"
// name of output file
const char* fname = "example_setnparticles.h5";
// H5hut verbosity level
const h5_int64_t h5_verbosity = H5_VERBOSE_DEFAULT;
// number of particles we are going to write per core
const h5_int64_t num_particles = 99;
int
main (
int argc,
char* argv[]
){
// initialize MPI & H5hut
MPI_Init (&argc, &argv);
MPI_Comm comm = MPI_COMM_WORLD;
int comm_size = 1;
MPI_Comm_size (comm, &comm_size);
int comm_rank = 0;
MPI_Comm_rank (comm, &comm_rank);
H5AbortOnError ();
H5SetVerbosityLevel (h5_verbosity);
// open file and create first step
h5_file_t file = H5OpenFile (fname, H5_O_WRONLY, H5_PROP_DEFAULT);
H5SetStep (file, 0);
// define number of particles this process will write
H5PartSetNumParticles (file, num_particles);
// create fake data
h5_int32_t data[num_particles];
for (int i = 0; i < num_particles; i++) {
data[i] = i + num_particles * comm_rank;
}
// write data
H5PartWriteDataInt32 (file, "data", data);
// done
H5CloseFile(file);
MPI_Finalize ();
return 0;
}
+60
View File
@@ -0,0 +1,60 @@
!
! Copyright (c) 2006-2015, The Regents of the University of California,
! through Lawrence Berkeley National Laboratory (subject to receipt of any
! required approvals from the U.S. Dept. of Energy) and the Paul Scherrer
! Institut (Switzerland). All rights reserved.!
!
! License: see file COPYING in top level of source distribution.
!
include 'H5hut.f90'
program write_setnparticles
use H5hut
implicit none
include 'mpif.h'
! name of output file
character (len=*), parameter :: fname = "example_setnparticles.h5"
! H5hut verbosity level
integer*8, parameter :: h5_verbosity = H5_VERBOSE_DEFAULT
! number of particles we are going to write per core
integer*8, parameter :: num_particles = 32
integer :: comm, comm_size, comm_rank, mpi_ierror
integer*8 :: file, h5_ierror
integer*4 :: i
integer*4, allocatable :: data(:)
! initialize MPI & H5hut
comm = MPI_COMM_WORLD
call mpi_init (mpi_ierror)
call mpi_comm_size (comm, comm_size, mpi_ierror)
call mpi_comm_rank (comm, comm_rank, mpi_ierror)
call h5_abort_on_error ()
call h5_set_verbosity_level (h5_verbosity)
! open file and create first step
file = h5_openfile (FNAME, H5_O_WRONLY, H5_PROP_DEFAULT)
h5_ierror = h5_setstep(file, 0_8)
! define number of particles this process will write
h5_ierror = h5pt_setnpoints (file, num_particles)
! create fake data
allocate (data (num_particles))
do i = 1, num_particles
data (i) = i + int(num_particles)*comm_rank
enddo
! write data
h5_ierror = h5pt_writedata_i4 (file, "data", data)
! cleanup
deallocate (data)
h5_ierror = h5_closefile (file)
call mpi_finalize (mpi_ierror)
end program write_setnparticles
+74
View File
@@ -0,0 +1,74 @@
/*
Copyright (c) 2006-2015, The Regents of the University of California,
through Lawrence Berkeley National Laboratory (subject to receipt of any
required approvals from the U.S. Dept. of Energy) and the Paul Scherrer
Institut (Switzerland). All rights reserved.
License: see file COPYING in top level of source distribution.
*/
#include "H5hut.h"
// name of output file
const char* fname = "example_setview.h5";
// H5hut verbosity level
const h5_int64_t h5_verbosity = H5_VERBOSE_DEFAULT;
// we are going to write multiple consecutive blocks
const h5_int64_t num_blocks = 4;
const h5_int64_t num_particles_per_block = 32;
int
main (
int argc,
char* argv[]
){
// initialize MPI & H5hut
MPI_Init (&argc, &argv);
MPI_Comm comm = MPI_COMM_WORLD;
int comm_size = 1;
MPI_Comm_size (comm, &comm_size);
int comm_rank = 0;
MPI_Comm_rank (comm, &comm_rank);
H5AbortOnError ();
H5SetVerbosityLevel (h5_verbosity);
// open file and create first step
h5_file_t file = H5OpenFile (fname, H5_O_WRONLY, H5_PROP_DEFAULT);
H5SetStep (file, 0);
/*
If we want to write consecutive blocks, the 'view' can be defined
with H5PartSetview(). Otherwise we have to define the total number
of particles with H5PartSetNumParticles().
*/
const h5_int64_t offset = comm_rank * num_blocks * num_particles_per_block;
H5PartSetView (
file,
offset,
offset + num_blocks*num_particles_per_block -1);
// write multiple consecutive blocks
for (int i = 0; i < num_blocks; i++) {
// create fake data
h5_int32_t data[num_particles_per_block];
for (int j = 0; j < num_particles_per_block; j++) {
data[j] = j + i*num_particles_per_block + offset;
}
// set the "view" to select a subset of the dataset
H5PartSetView (
file,
offset + i*num_particles_per_block,
offset + (i+1)*num_particles_per_block - 1);
// write data
H5PartWriteDataInt32 (file, "data", data);
}
// done
H5CloseFile(file);
MPI_Finalize();
return 0;
}
+66
View File
@@ -0,0 +1,66 @@
!
! Copyright (c) 2006-2015, The Regents of the University of California,
! through Lawrence Berkeley National Laboratory (subject to receipt of any
! required approvals from the U.S. Dept. of Energy) and the Paul Scherrer
! Institut (Switzerland). All rights reserved.!
!
! License: see file COPYING in top level of source distribution.
!
include 'H5hut.f90'
program write_setview
use H5hut
implicit none
include 'mpif.h'
! name of output file
character (len=*), parameter :: fname = "example_setview.h5"
! H5hut verbosity level
integer*8, parameter :: h5_verbosity = H5_VERBOSE_DEFAULT
! we are going to write multiple consecutive blocks
integer*8, parameter :: num_blocks = 4;
integer*8, parameter :: num_particles_per_block = 32
integer :: comm, comm_size, comm_rank, mpi_ierror
integer*8 :: file, h5_ierror
integer*8 :: i, j, offset
integer*4, allocatable :: data(:)
! initialize MPI & H5hut
comm = MPI_COMM_WORLD
call mpi_init (mpi_ierror)
call mpi_comm_size (comm, comm_size, mpi_ierror)
call mpi_comm_rank (comm, comm_rank, mpi_ierror)
call h5_abort_on_error ()
call h5_set_verbosity_level (h5_verbosity)
! open file and create first step
file = h5_openfile (FNAME, H5_O_WRONLY, H5_PROP_DEFAULT)
h5_ierror = h5_setstep(file, 1_8)
! If we want to write consecutive blocks, the 'view' can be defined
! with H5PartSetview(). Otherwise we have to define the total number
! of particles with H5PartSetNumParticles().
offset = comm_rank * num_blocks * num_particles_per_block+1
h5_ierror = h5pt_setview (file, offset, offset + num_blocks*num_particles_per_block - 1)
! write multiple consecutive blocks
allocate (data (num_particles_per_block))
do i = 1, num_blocks
! create fake data
do j = 1, num_particles_per_block
data (j) = int((j-1) + (i-1)*num_particles_per_block + offset - 1)
end do
h5_ierror = h5pt_setview (file, offset + (i-1)*num_particles_per_block, offset - 1 + i*num_particles_per_block)
! write data
h5_ierror = h5pt_writedata_i4 (file, "data", data)
end do
! cleanup
deallocate (data)
h5_ierror = h5_closefile (file)
call mpi_finalize (mpi_ierror)
end program write_setview
+74
View File
@@ -0,0 +1,74 @@
/*
Copyright (c) 2006-2015, The Regents of the University of California,
through Lawrence Berkeley National Laboratory (subject to receipt of any
required approvals from the U.S. Dept. of Energy) and the Paul Scherrer
Institut (Switzerland). All rights reserved.
License: see file COPYING in top level of source distribution.
*/
#include "H5hut.h"
// name of output file
const char* fname = "example_strided.h5";
// H5hut verbosity level
const h5_int64_t h5_verbosity = H5_VERBOSE_DEFAULT;
// number of particles we are going to write per core
const h5_int64_t num_particles = 99;
int
main (
int argc,
char* argv[]
){
// initialize MPI & H5hut
MPI_Init (&argc, &argv);
MPI_Comm comm = MPI_COMM_WORLD;
int comm_size = 1;
MPI_Comm_size (comm, &comm_size);
int comm_rank = 0;
MPI_Comm_rank (comm, &comm_rank);
H5AbortOnError ();
H5SetVerbosityLevel (h5_verbosity);
// open file and create first step
h5_file_t file = H5OpenFile (fname, H5_O_WRONLY, H5_PROP_DEFAULT);
H5SetStep (file, 0);
// create fake data
h5_float64_t data[6*num_particles];
h5_int64_t id[num_particles];
for (int i = 0; i < num_particles; i++) {
data [6*i + 0] = 0.0 + i + num_particles * comm_rank;
data [6*i + 1] = 0.1 + i + num_particles * comm_rank;
data [6*i + 2] = 0.2 + i + num_particles * comm_rank;
data [6*i + 3] = 0.3 + i + num_particles * comm_rank;
data [6*i + 4] = 0.4 + i + num_particles * comm_rank;
data [6*i + 5] = 0.5 + i + num_particles * comm_rank;
id [i] = i + num_particles * comm_rank;
}
// define number of items this processor will write and set the
// in-memory striding
H5PartSetNumParticlesStrided (file, num_particles, 6);
// write strided data
H5PartWriteDataFloat64 (file, "x", data+0);
H5PartWriteDataFloat64 (file, "y", data+1);
H5PartWriteDataFloat64 (file, "z", data+2);
H5PartWriteDataFloat64 (file, "px", data+3);
H5PartWriteDataFloat64 (file, "py", data+4);
H5PartWriteDataFloat64 (file, "pz", data+5);
// disable striding to write the ID's
H5PartSetNumParticles (file, num_particles);
H5PartWriteDataInt64 (file, "id", id);
// cleanup
H5CloseFile (file);
MPI_Finalize ();
return 0;
}
+71
View File
@@ -0,0 +1,71 @@
!
! Copyright (c) 2006-2015, The Regents of the University of California,
! through Lawrence Berkeley National Laboratory (subject to receipt of any
! required approvals from the U.S. Dept. of Energy) and the Paul Scherrer
! Institut (Switzerland). All rights reserved.!
!
! License: see file COPYING in top level of source distribution.
!
include 'H5hut.f90'
program write_stridedf
use H5hut
implicit none
include 'mpif.h'
! the file name we want to read
character (len=*), parameter :: FNAME = "example_strided.h5"
integer*8, parameter :: NPOINTS = 99
integer :: comm, rank, ierr
integer*8 :: file, status
integer*4 :: i
real*8, allocatable :: particles(:)
integer*8, allocatable :: id(:)
! init MPI & H5hut
comm = MPI_COMM_WORLD
call mpi_init(ierr)
call mpi_comm_rank(comm, rank, ierr)
call h5_abort_on_error ()
! create fake data
allocate(particles(6*NPOINTS), id(NPOINTS))
do i = 0, NPOINTS-1
particles (6*i + 1) = 0.0 + real (i + NPOINTS*rank)
particles (6*i + 2) = 0.1 + real (i + NPOINTS*rank)
particles (6*i + 3) = 0.2 + real (i + NPOINTS*rank)
particles (6*i + 4) = 0.3 + real (i + NPOINTS*rank)
particles (6*i + 5) = 0.4 + real (i + NPOINTS*rank)
particles (6*i + 6) = 0.5 + real (i + NPOINTS*rank)
id(i+1) = i+NPOINTS*rank
enddo
! open the a file for parallel writing and ceate step #0
file = h5_openfile (FNAME, H5_O_WRONLY, H5_PROP_DEFAULT)
status = h5_setstep(file, 1_8)
! define number of items this processor will write and set the
! in-memory striding
status = h5pt_setnpoints_strided (file, NPOINTS, 6_8)
! write strided data
status = h5pt_writedata_r8 (file, "x", particles(1))
status = h5pt_writedata_r8 (file, "y", particles(2))
status = h5pt_writedata_r8 (file, "z", particles(3))
status = h5pt_writedata_r8 (file, "px", particles(4))
status = h5pt_writedata_r8 (file, "py", particles(5))
status = h5pt_writedata_r8 (file, "pz", particles(6))
! disable striding to write the ID's
status = h5pt_setnpoints(file, NPOINTS)
status = h5pt_writedata_i8(file, "id", id)
! cleanup
status = h5_closefile (file)
deallocate(particles, id)
call mpi_finalize(ierr)
end program write_stridedf
-193
View File
@@ -1,193 +0,0 @@
/*
Implementation file for implementing the H5Fed application programming
interface (API) in the C++ language.
Copyright 2006-2007
Paul Scherrer Institut, Villigen, Switzerland;
Benedikt Oswald;
Achim Gsell
All rights reserved.
Authors
Benedikt Oswald, Achim Gsell
Warning
This code is under development.
*/
/*!
Some conventions:
Functions:
Name:
ThisIsAFunction()
Return values:
-1 or NULL signals an error
\note
In function names we use the words \b get and \b store insteed of
\b read and \b write, because no I/O is actually done in these
functions.
*/
/** include proprietary header files */
#include "H5Fed.hh"
/** \brief make the C API functions available so that
* we can used them in the implementation of the H5Fed class
* member functions implementations.
*/
//extern "C"
//{
// #include "../../H5Fed.h"
//}
/** activate namespaces */
using namespace std;
namespace H5Fed
{
/*!
\defgroup h5fed_cpp_api H5Fed CPP API
*/
/** \brief implement constructor without arguments */
H5Fed::H5Fed()
{
/** initialize internal variables */
filename_.erase();
}
/** \brief implement constructor without arguments */
H5Fed::H5Fed(std::string filename)
{
/** initialize internal variables */
filename_.erase();
filename_.append(filename);
}
/** \brief implement constructor */
H5Fed::~H5Fed()
{
/** initialize internal variables */
filename_.erase();
}
/** \brief Set name of H5Fed file to be accessed */
H5FED_RETURN_CODE H5Fed::filename(std::string filename)
{
/** initialize internal variables */
filename_.erase();
filename_.append(filename);
return(OKCODE);
}
/** \brief retrieve name of H5Fed file to be accessed */
std::string H5Fed::filename()
{
return(filename_);
}
/*!
\ingroup h5fed_cpp_api
Open file. This function is available in the paralell
and serial version. In the serial case \c comm may have any value.
\return
\return
\note
File is always opened in read/writer mode!
\note
Implement as wrapper of \c H5_open_file()!
*/
H5FED_RETURN_CODE H5Fed::open_file()
{
return(OKCODE);
}
/*!
\ingroup h5fed_cpp_api
Close file. This function is available in the paralell
and serial version. In the serial case \c comm may have
any value.
\return
\return
\note
File is always opened in read/writer mode!
\note
Implement as wrapper of \c H5_open_file()!
*/
H5FED_RETURN_CODE H5Fed::closeFile()
{
return(OKCODE);
}
/****** STORE routines*****************************************************/
/*!
\ingroup h5fed_c_api
Stores the the coordinates of a specific vertex at level \c level
with id \c vertex_id of the tetrahedral mesh.
\return value \c >=0 on success
\return \c -1 on error
*/
H5FED_RETURN_CODE H5Fed::storeVertexCoordinate(
unsigned int level, /*!< mesh level */
unsigned int vertex_id, /*!< global vertex id */
std::vector<double> /*!< 3-tuple of coordinates */
)
{
return(OKCODE);
}
/*!
\ingroup h5fed_c_api
Stores the 4-tuple, that contains the specific indices describing
a tetrahedron with id \c tet_id at level \c level of the tetrahedral
mesh.
\return value \c >=0 on success
\return \c -1 on error
*/
H5FED_RETURN_CODE H5Fed::H5FedStoreTetrahedron (
const unsigned int level, /*!< mesh level */
const unsigned int tet_id, /*!< global tetrahedron id */
const unsigned int parent_id, /*!< parent id if level \c >0 else \x -1 */
const std::vector<unsigned int> tet /*!< 4-tuple with vertex id's */
)
{
return(OKCODE);
}
}
-165
View File
@@ -1,165 +0,0 @@
/*
Header file for declaring the H5Fed application programming
interface (API) in the C++ language. The header files follows
the declaration of the C application programming interface.
Copyright 2006-2007
Paul Scherrer Institut, Villigen, Switzerland;
Benedikt Oswald;
Achim Gsell
All rights reserved.
Authors
Benedikt Oswald, Achim Gsell
Warning
This code is under development.
*/
/*!
Some conventions:
Functions:
Name:
ThisIsAFunction()
Return values:
-1 or NULL signals an error
\note
In function names we use the words \b get and \b store insteed of
\b read and \b write, because no I/O is actually done in these
functions.
*/
/** include standard header files */
#include <iostream>
#include <ostream>
#include <iterator>
#include <fstream>
#include <vector>
#include <iomanip>
#include <string>
#include <complex>
/** include fundamental HDF5 header files */
#include <hdf5.h>
#ifndef H5FED_HH
#define H5FED_HH
namespace H5Fed
{
/** \brief Define return codes */
enum H5FED_RETURN_CODE{OKCODE=0,ERROR=-1};
class H5Fed
{
public:
/** \brief infrastructure routines */
H5Fed(); /** \brief Constructor without argument */
H5Fed(std::string filename); /** \brief Constructor without argument */
~H5Fed(); /** \brief Class destructor */
H5FED_RETURN_CODE filename(std::string filename); /** \brief Set name of H5Fed file to be accessed */
std::string filename(); /** \brief retrieve name of H5Fed file to be accessed */
/****** General routines *****************************************************/
H5FED_RETURN_CODE open_file(); /** \brief open the file */
H5FED_RETURN_CODE closeFile(); /** \brief close the file */
/****** INQUIRY routines *****************************************************/
/****** STORE routines*****************************************************/
/*!
\ingroup h5fed_c_api
Stores the the coordinates of a specific vertex at level \c level
with id \c vertex_id of the tetrahedral mesh.
\return value \c >=0 on success
\return \c -1 on error
*/
H5FED_RETURN_CODE storeVertexCoordinate(
unsigned int level, /*!< mesh level */
unsigned int vertex_id, /*!< global vertex id */
std::vector<double> /*!< 3-tuple of coordinates */
);
/*!
\ingroup h5fed_c_api
Stores the 4-tuple, that contains the specific indices describing
a tetrahedron with id \c tet_id at level \c level of the tetrahedral
mesh.
\return value \c >=0 on success
\return \c -1 on error
*/
H5FED_RETURN_CODE H5FedStoreTetrahedron (
const unsigned int level, /*!< mesh level */
const unsigned int tet_id, /*!< global tetrahedron id */
const unsigned int parent_id, /*!< parent id if level \c >0 else \x -1 */
const std::vector<unsigned int> tet /*!< 4-tuple with vertex id's */
);
/****** UPWARD ADJACENCY routines *********************************************/
/****** DOWNWARD ADJACENCY routines *********************************************/
/****** routines for accessing degrees of freedom DoF *************************/
protected:
private:
/** book keeping */
std::string filename_; /** \brief Name of H5Fed file to be accessed */
};
}
#endif /** H5FED_HH */
-18
View File
@@ -1,18 +0,0 @@
# COMPILERS
CC = @CC@
CXX = @CXX@
LIBS = @LIBS@
INCLUDES = -I../include @INCLUDES@
OBJEXT = o
lib_LIBRARIES = libH5XX.a
include_HEADERS = H5Fed.hh
libH5XX_a_SOURCES = H5Fed.cc
libH5XX.a: $(libH5XX_a_OBJECTS)
${AR} rucs $@ $^
%.o : %.cc
$(CXX) $(CFLAGS) $(INC) -c $<
-379
View File
@@ -1,379 +0,0 @@
/*
Copyright 2007-2008
Paul Scherrer Institut, Villigen, Switzerland;
Benedikt Oswald;
Achim Gsell
All rights reserved.
Authors
Achim Gsell
Warning
This code is under development.
*/
/*!
Some conventions:
Functions:
Name:
thisIsAFunction()
Return values:
negative value or NULL signals an error
Macros:
UPPERCASE_WITH_UNDERSCORE
\note
In function names we use the words \b get and \b store insteed of
\b read and \b write, because no I/O is actually done in these
functions.
*/
#include "h5core/h5_core.h"
#include "H5.h"
/****** General routines *****************************************************/
/*!
\ingroup h5hut_file
Open file with name \c filbename. This function is available in the parallel
and serial version. In the serial case \c comm may have any value.
File mode flags are:
- H5_O_RDONLY: only reading allowed
- H5_O_WRONLY: create new file, dataset must not exist
- H5_O_APPEND: allows to append a new datasets to an existing file
- H5_O_RDWR: dataset may exist
You can also select a "virtual file driver" in the HDF5 layer using:
- H5_VFD_INDEPENDENT: MPI-IO in independent (asynchronous) mode
- H5_VFD_MPIPOSIX: parallel I/O implemented directly by HDF5, bypassing MPI-IO
\return File handle.
\return NULL on error.
*/
h5_file_p
H5OpenFile (
const char* filename, /*!< file name */
h5_int32_t flags, /*!< file open flags */
MPI_Comm comm /*!< MPI communicator */
) {
H5_API_ENTER (h5_file_p, "filename='%s', flags=%d, ...",filename,flags);
H5_API_RETURN (h5_open_file (filename, flags, comm, 0));
}
/*!
\ingroup h5hut_file
Close file and free all memory associated with the file handle.
\return \c H5_SUCCESS or error code
*/
h5_err_t
H5CloseFile (
h5_file_t* const f /*!< file handle */
) {
H5_API_ENTER (h5_err_t, "f=%p", f);
H5_API_RETURN (h5_close_file (f));
}
/*!
\ingroup h5hut_file
Verify that the file handle points to a valid H5hut file structure.
\return \c H5_SUCCESS or error code
*/
h5_err_t
H5CheckFile (
h5_file_t* const f /*!< file handle */
) {
H5_API_ENTER (h5_err_t, "f=%p", f);
H5_API_RETURN (h5_check_filehandle (f));
}
h5_err_t
H5FlushStep (
h5_file_t* const f /*!< file handle */
) {
H5_API_ENTER (h5_err_t, "f=%p", f);
H5_API_RETURN (h5_flush_step (f));
}
h5_err_t
H5FlushFile (
h5_file_t* const f /*!< file handle */
) {
H5_API_ENTER (h5_err_t, "f=%p", f);
H5_API_RETURN (h5_flush_file (f));
}
/*!
\ingroup h5hut_model
Define format of the step names.
Example: ==H5SetStepNameFormat( f, "Step", 6 )== defines step names
like ==Step#000042==.
\return \c H5_SUCCESS or error code
*/
h5_err_t
H5SetStepNameFormat (
h5_file_t* const f, /*!< Handle to file */
const char* name, /*!< Prefix */
const h5_int64_t width /*!< Width of the number */
) {
H5_API_ENTER (h5_err_t,
"f=%p, name='%s', width=%lld",
f, name, (long long) width);
H5_API_RETURN (h5_set_stepname_fmt (f, name, width));
}
/*!
\ingroup h5hut_model
Get format of the step names.
\return value \c >=0 on success
\return -1 on error
*/
h5_err_t
H5GetStepNameFormat (
h5_file_t* const f, /*!< Handle to file */
char* name, /*!< OUT: Prefix */
const h5_size_t l_name, /*!< length of buffer name */
int* width /*!< OUT: Width of the number */
) {
H5_API_ENTER (h5_err_t,
"f=%p, name=%p, l_name=%llu, width=%p",
f, name, (unsigned long long)l_name, width);
H5_API_RETURN (h5_get_stepname_fmt (f, name, l_name, width));
}
/*!
\ingroup h5hut_model
Set the current step.
\return \c H5_SUCCESS or error code
*/
h5_err_t
H5SetStep (
h5_file_t* const f, /*!< [in] Handle to open file */
const h5_id_t step /*!< [in] Step to set. */
) {
H5_API_ENTER (h5_err_t, "f=%p, step=%lld", f, (long long)step);
H5_API_RETURN (h5_set_step (f, step));
}
/*!
\ingroup h5hut_model
Get current step.
\return \c H5_SUCCESS or error code
*/
h5_id_t
H5GetStep (
h5_file_t* const f /*!< Handle to open file */
) {
H5_API_ENTER (h5_err_t, "f=%p", f);
H5_API_RETURN (h5_get_step (f));
}
/*!
\ingroup h5hut_file
Get the number of processors.
\param[in] f File handle.
\return Number of processors.
\return \c -1 on error.
*/
int
H5GetNumProcs (
h5_file_t* const f
) {
H5_API_ENTER (h5_err_t, "f=%p", f);
H5_API_RETURN (h5_get_num_procs(f));
}
/*!
\ingroup h5hut_model
Get the number of time-steps that are currently stored in the file
\c f.
It works for both reading and writing of files, but is probably
only typically used when you are reading.
\param[in] f File handle.
\return number of time-steps or error code
*/
h5_ssize_t
H5GetNumSteps (
h5_file_t* const f
) {
H5_API_ENTER (h5_err_t, "f=%p", f);
H5_API_RETURN (h5_get_num_steps(f));
}
/*!
\ingroup h5_inquiry
Query whether a particular step already exists in the file.
\param[in] f File handle.
\param[in] stepno Step number to query for existence
\return true or false
*/
h5_err_t
H5HasStep (
h5_file_t* const f,
h5_id_t stepno
) {
H5_API_ENTER (h5_err_t,
"f=%p, stepno=%lld",
f, (long long)stepno);
H5_API_RETURN (h5_has_step (f, stepno));
}
/*!
\ingroup h5hut_model
Start traversing steps.
\return \c H5_SUCCESS or error code
*/
h5_err_t
H5StartTraverseSteps (
h5_file_t* const f /*!< Handle to open file */
) {
H5_API_ENTER (h5_err_t, "f=%p", f);
H5_API_RETURN (h5_start_traverse_steps (f));
}
/*!
\ingroup h5hut_model
Traverse steps.
\return \c H5_SUCCESS or error code
*/
h5_err_t
H5TraverseSteps (
h5_file_t* const f /*!< Handle to open file */
) {
H5_API_ENTER (h5_err_t, "f=%p", f);
H5_API_RETURN (h5_traverse_steps (f));
}
/*!
\ingroup h5hut_file
Set the `throttle` factor, which causes HDF5 write and read
calls to be issued in that number of batches.
This can prevent large concurrency parallel applications that
use independent writes from overwhelming the underlying
parallel file system.
Throttling only works with the H5_VFD_MPIPOSIX or
H5_VFD_INDEPENDENT drivers and is only available in
the parallel library.
\return \c H5_SUCCESS
*/
#ifdef PARALLEL_IO
h5_err_t
H5SetThrottle (
h5_file_t* f,
int factor
) {
H5_API_ENTER (h5_err_t, "f=%p, factor=%d", f, factor);
H5_API_RETURN (h5_set_throttle(f, factor));
}
#endif // PARALLEL_IO
/*!
\ingroup h5hut_error
Set verbosity level to \c level.
\return \c H5_SUCCESS
*/
h5_err_t
H5SetVerbosityLevel (
const h5_id_t level
) {
return h5_set_debuglevel (level);
}
/*!
\ingroup h5hut_error
Set error handler to \c handler.
\return \c H5_SUCCESS
*/
h5_err_t
H5SetErrorHandler (
h5_errorhandler_t handler
) {
H5_API_ENTER (h5_err_t, "handler=%p", handler);
H5_API_RETURN (h5_set_errorhandler (handler));
}
/*!
\ingroup h5hut_error
Get current error handler.
\return Pointer to error handler.
*/
h5_errorhandler_t
H5GetErrorHandler (
void
) {
H5_API_ENTER (h5_errorhandler_t, "%s", "void");
H5_API_RETURN (h5_get_errorhandler());
}
h5_err_t
H5ReportErrorhandler (
const char* fmt,
va_list ap
) {
return h5_report_errorhandler (fmt, ap);
}
h5_err_t
H5AbortErrorhandler (
const char* fmt,
va_list ap
) {
return h5_abort_errorhandler (fmt, ap);
}
/*!
\ingroup h5hut_error
Get last error code.
\return error code
*/
h5_err_t
H5GetErrno (
void
) {
return h5_get_errno ();
}
-676
View File
@@ -1,676 +0,0 @@
/*!
\defgroup h5block_c_api H5Block C API
*/
/*!
\internal
\defgroup h5block_kernel H5Block Kernel
*/
/*!
\internal
\defgroup h5block_private H5Block Private
*/
/*!
\ingroup h5block_c_api
\defgroup h5block_model Setting up the Data Model
*/
/*!
\ingroup h5block_c_api
\defgroup h5block_data Reading and Writing Datasets
*/
/*!
\ingroup h5block_c_api
\defgroup h5block_attrib Reading and Writing Attributes
*/
/*!
\note
Different field sizes are allowed in the same time-step.
\note
The same layout can be used, if the size of the field matches the
size of the layout. If the size of the layout doesn't match the
size of the field, an error will be indicated.
\note
In write mode partitions are shrinked to make them non-overlaping. This
process may shrink the partitions more than required.
\note
In read-mode partitions may not cross boundaries. This means, if the grid
size is (X, Y, Z), all partitions must fit into this grid.
\todo
check whether layout is reasonable
API function names
*/
#include <stdlib.h>
#include <string.h>
#include "H5hut.h"
#include "h5core/h5_core.h"
/********************** defining the layout **********************************/
/*!
\ingroup h5block_model
Tests whether a view has been set, either directly with
\ref H5Block3dSetView or indirectly with \ref H5Block3dSetGrid.
\return 0 on false, 1 on true
*/
h5_int64_t
H5Block3dHasView (
h5_file_t *const f /*!< IN: File handle */
) {
H5_API_ENTER (h5_int64_t, "f=%p", f);
H5_API_RETURN (h5b_3d_has_view (f));
}
/*!
\ingroup h5block_model
Defines the partition of the field that this processor owns, using
Fortran ordering: the fastest moving index is \c i.
This routine uses an MPI_Allgather, so at large concurrency it should
be called as infrequently as possible. For instance, if several timesteps
use the same field dimensions, set the layout only once before the
first timestep.
\return \c H5_SUCCESS on success
*/
h5_err_t
H5Block3dSetView (
h5_file_t *const f, /*!< IN: File handle */
const h5_int64_t i_start, /*!< IN: start index of \c i */
const h5_int64_t i_end, /*!< IN: end index of \c i */
const h5_int64_t j_start, /*!< IN: start index of \c j */
const h5_int64_t j_end, /*!< IN: end index of \c j */
const h5_int64_t k_start, /*!< IN: start index of \c k */
const h5_int64_t k_end /*!< IN: end index of \c k */
) {
H5_API_ENTER (h5_err_t,
"f=%p, "
"i_start=%lld, i_end=%lld, "
"j_start=%lld, j_end=%lld, "
"k_start=%lld, k_end=%lld",
f,
(long long)i_start, (long long)i_end,
(long long)j_start, (long long)j_end,
(long long)k_start, (long long)k_end);
H5_API_RETURN (h5b_3d_set_view(f, i_start, i_end, j_start, j_end, k_start, k_end));
}
/*!
\ingroup h5block_model
Return the view of this processor.
\return \c H5_SUCCESS on success
*/
h5_err_t
H5Block3dGetView (
h5_file_t *const f, /*!< IN: File handle */
h5_size_t *i_start, /*!< OUT: start index of \c i */
h5_size_t *i_end, /*!< OUT: end index of \c i */
h5_size_t *j_start, /*!< OUT: start index of \c j */
h5_size_t *j_end, /*!< OUT: end index of \c j */
h5_size_t *k_start, /*!< OUT: start index of \c k */
h5_size_t *k_end /*!< OUT: end index of \c k */
) {
H5_API_ENTER (h5_err_t,
"f=%p, "
"i_start=%p, i_end=%p, "
"j_start=%p, j_end=%p, "
"k_start=%p, k_end=%p",
f,
i_start, i_end,
j_start, j_end,
k_start, k_end);
H5_API_RETURN (h5b_3d_get_view (f, i_start, i_end, j_start, j_end, k_start, k_end));
}
/*!
\ingroup h5block_model
Return the reduced (ghost-zone free) view of this processor.
\return \c H5_SUCCESS on success
*/
h5_err_t
H5Block3dGetReducedView (
h5_file_t *const f, /*!< IN: File handle */
h5_size_t *const i_start, /*!< OUT: start index of \c i */
h5_size_t *const i_end, /*!< OUT: end index of \c i */
h5_size_t *const j_start, /*!< OUT: start index of \c j */
h5_size_t *const j_end, /*!< OUT: end index of \c j */
h5_size_t *const k_start, /*!< OUT: start index of \c j */
h5_size_t *const k_end /*!< OUT: end index of \c j */
) {
H5_API_ENTER (h5_err_t,
"f=%p, "
"i_start=%p, i_end=%p, "
"j_start=%p, j_end=%p, "
"k_start=%p, k_end=%p",
f,
i_start, i_end,
j_start, j_end,
k_start, k_end);
H5_API_RETURN (h5b_3d_get_reduced_view(f, i_start, i_end, j_start, j_end, k_start, k_end));
}
/*!
\ingroup h5block_model
Define the chunk dimensions and enable chunking in the underlying
HDF5 dataset.
\return \c H5_SUCCESS on success
*/
h5_err_t
H5Block3dSetChunk (
h5_file_t *const f, /*!< IN: File handle */
const h5_size_t i, /*!< IN: size of \c i */
const h5_size_t j, /*!< IN: size of \c j */
const h5_size_t k /*!< IN: size of \c k */
) {
H5_API_ENTER (h5_err_t,
"f=%p, i=%llu, j=%llu, k=%llu",
f,
(long long unsigned)i,
(long long unsigned)j,
(long long unsigned)k);
H5_API_RETURN (h5b_3d_set_chunk(f, i, j, k));
}
/*!
\ingroup h5block_model
Lookup the chunk dimensions of the underlying HDF5 dataset.
\return \c H5_SUCCESS on success
*/
h5_err_t
H5Block3dGetChunk (
h5_file_t *const f, /*!< IN: File handle */
const char *field_name, /*!< IN: name of dataset */
h5_size_t *const i, /*!< OUT: size of \c i */
h5_size_t *const j, /*!< OUT: size of \c j */
h5_size_t *const k /*!< OUT: size of \c k */
) {
H5_API_ENTER (h5_err_t,
"f=%p, i=%p, j=%p, k=%p",
f, i, j, k);
H5_API_RETURN (h5b_3d_get_chunk(f, field_name, i, j, k));
}
#ifdef PARALLEL_IO
/*!
\ingroup h5block_model
Define an underlying 3D Cartesian grid on the processors with dimensions
(\c i,\c j,\c k). You can look up a processor's index into the grid
using \ref H5Block3dGetGridCoords.
This function can be used in conjunction with \ref H5Block3dSetDims
to setup the view for a regular grid.
The product of the dimensions must equal the size of the MPI communicator.
\return \c H5_SUCCESS on success
*/
h5_err_t
H5Block3dSetGrid (
h5_file_t *const f, /*!< IN: File handle */
const h5_size_t i, /*!< IN: dimension in \c i */
const h5_size_t j, /*!< IN: dimension in \c j */
const h5_size_t k /*!< IN: dimension in \c k */
) {
H5_API_ENTER (h5_err_t,
"f=%p, i=%llu, j=%llu, k=%llu",
f,
(long long unsigned)i,
(long long unsigned)j,
(long long unsigned)k);
H5_API_RETURN (h5b_3d_set_grid(f, i, j, k));
}
/*!
\ingroup h5block_model
Look up the index (\c i, \c j, \c k) in the grid belonging to MPI processor
\c proc.
\return \c H5_SUCCESS on success
*/
h5_err_t
H5Block3dGetGridCoords (
h5_file_t *const f, /*!< IN: File handle */
const int proc, /*!< IN: MPI processor */
h5_int64_t *i, /*!< OUT: index in \c i */
h5_int64_t *j, /*!< OUT: index in \c j */
h5_int64_t *k /*!< OUT: index in \c k */
) {
H5_API_ENTER (h5_err_t,
"f=%p, proc=%d, i=%p, j=%p, k=%p",
f, proc, i, j, k);
H5_API_RETURN (h5b_3d_get_grid_coords(f, proc, i, j, k));
}
/*!
\ingroup h5block_model
Set the dimensions of each processor's block when the field is a regular
grid.
A grid must be already set with \ref H5Block3dSetGrid, and all processors
must specify the same dimensions.
\return \c H5_SUCCESS on success
*/
h5_err_t
H5Block3dSetDims (
h5_file_t *const f, /*!< IN: File handle */
const h5_size_t i, /*!< IN: dimension in \c i */
const h5_size_t j, /*!< IN: dimension in \c j */
const h5_size_t k /*!< IN: dimension in \c k */
) {
H5_API_ENTER (h5_err_t,
"f=%p, i=%llu, j=%llu, k=%llu",
f,
(long long unsigned)i,
(long long unsigned)j,
(long long unsigned)k);
H5_API_RETURN (h5b_3d_set_dims(f, i, j, k));
}
#endif
/*!
\ingroup h5block_model
Sets the additional cells (\c i, \c j, \c k) in each direction to use as
the `halo` region (or `ghost zone`) that overlaps between neighboring
processors on the grid.
A grid with dimensions must already be set with \ref H5Block3dSetGrid and
\ref H5Block3dSetDims, and all processors must specify the same halo radii.
\return \c H5_SUCCESS on success
*/
h5_err_t
H5Block3dSetHalo (
h5_file_t *const f, /*!< IN: File handle */
const h5_size_t i, /*!< IN: radius in \c i */
const h5_size_t j, /*!< IN: radius in \c j */
const h5_size_t k /*!< IN: radius in \c k */
) {
H5_API_ENTER (h5_err_t,
"f=%p, i=%llu, j=%llu, k=%llu",
f,
(long long unsigned)i,
(long long unsigned)j,
(long long unsigned)k);
H5_API_RETURN (h5b_3d_set_halo(f, i, j, k));
}
/*!
\ingroup h5block_model
Query number of fields in current time step.
\return \c H5_SUCCESS or error code
*/
h5_ssize_t
H5BlockGetNumFields (
h5_file_t *const f /*!< IN: file handle */
) {
H5_API_ENTER (h5_ssize_t, "f=%p", f);
H5_API_RETURN (h5b_get_num_fields(f));
}
/*!
\ingroup h5block_model
Get the name, rank and dimensions of the field specified by the
index \c idx.
\c elem_rank reports the rank of the elements in the field
(e.g. scalar or vector).
This function can be used to retrieve all fields bound to the
current time-step by looping from \c 0 to the number of fields
minus one. The number of fields bound to the current time-step
can be queried by calling the function \ref H5BlockGetNumFields.
\return \c H5_SUCCESS or error code
*/
h5_err_t
H5BlockGetFieldInfo (
h5_file_t *const f, /*!< IN: file handle */
const h5_size_t idx, /*!< IN: index of field */
char *name, /*!< OUT: field name */
const h5_size_t len_name, /*!< IN: buffer size */
h5_size_t *field_rank, /*!< OUT: field rank */
h5_size_t *field_dims, /*!< OUT: field dimensions */
h5_size_t *elem_rank, /*!< OUT: element rank */
h5_int64_t *type /*!< OUT: datatype */
) {
H5_API_ENTER (h5_err_t,
"f=%p, idx=%llu, "
"name=%p, len_name=%llu, "
"field_rank=%p, field_dims=%p, elem_rank=%p, type=%p",
f, (long long unsigned)idx,
name, (long long unsigned)len_name,
field_rank, field_dims, elem_rank,
type);
H5_API_RETURN (
h5b_get_field_info (
f,
idx,
name,
len_name,
field_rank,
field_dims,
elem_rank,
type));
}
/*!
\ingroup h5block_model
Get the rank and dimensions of the field specified by its name.
See \ref H5BlockGetFieldInfo.
\return \c H5_SUCCESS or error code
*/
h5_err_t
H5BlockGetFieldInfoByName (
h5_file_t *const f, /*!< IN: file handle */
const char *name, /*!< IN: field name */
h5_size_t *field_rank, /*!< OUT: field rank */
h5_size_t *field_dims, /*!< OUT: field dimensions */
h5_size_t *elem_rank, /*!< OUT: element rank */
h5_int64_t *type /*!< OUT: datatype */
) {
H5_API_ENTER (h5_err_t,
"f=%p, name='%s', "
"field_rank=%p, field_dims=%p, elem_rank=%p, type=%p",
f, name, field_rank, field_dims, elem_rank, type);
H5_API_RETURN (
h5b_get_field_info_by_name (
f,
name,
field_rank,
field_dims,
elem_rank,
type));
}
/********************** reading and writing attribute ************************/
/*!
\ingroup h5block_attrib
Write the string \c value as attribute \c attrib_name of field
\c field_name.
\return \c H5_SUCCESS or error code
*/
h5_err_t
H5BlockWriteFieldAttribString (
h5_file_t *const f, /*!< IN: file handle */
const char *field_name, /*!< IN: field name */
const char *attrib_name, /*!< IN: attribute name */
const char *buffer /*!< IN: attribute value */
) {
H5_API_ENTER (h5_err_t,
"f=%p, "
"field_name='%s', "
"attrib_name='%s', "
"buffer='%s'",
f,
field_name,
attrib_name,
buffer);
H5_API_RETURN (
h5_write_field_attrib (
f,
field_name,
attrib_name,
H5T_NATIVE_CHAR,
buffer,
strlen(buffer) + 1));
}
/*!
\ingroup h5block_attrib
Read the string value from attribute \c attrib_name of field
\c field_name into a \c buffer.
\return \c H5_SUCCESS or error code
*/
h5_err_t
H5BlockReadFieldAttribString (
h5_file_t *const f, /*!< IN: file handle */
const char *field_name, /*!< IN: field name */
const char *attrib_name, /*!< IN: attribute name */
char *buffer /*!< OUT: attribute value */
) {
H5_API_ENTER (h5_err_t,
"f=%p, "
"field_name='%s', "
"attrib_name='%s', "
"buffer=%p",
f,
field_name,
attrib_name,
buffer);
H5_API_RETURN (
h5_read_field_attrib (
f,
field_name,
attrib_name,
H5_STRING_T,
(void*)buffer));
}
/*!
\ingroup h5block_attrib
Query the number of attributes of field \c field_name.
\return number of attributes or error code
*/
h5_ssize_t
H5BlockGetNumFieldAttribs (
h5_file_t *const f, /*<! IN: file handle */
const char *field_name /*<! IN: field name */
) {
H5_API_ENTER (h5_ssize_t, "f=%p, field_name='%s'", f, field_name);
H5_API_RETURN (h5b_get_num_field_attribs (f, field_name));
}
/*!
\ingroup h5block_attrib
Gets the name, type and number of elements of the field attribute
specified by its index.
This function can be used to retrieve all attributes bound to the
specified field by looping from \c 0 to the number of attribute
minus one. The number of attributes bound to the
field can be queried by calling \ref H5BlockGetNumFieldAttribs.
\return \c H5_SUCCESS or error code
*/
h5_err_t
H5BlockGetFieldAttribInfo (
h5_file_t *const f, /*<! IN: Handle to open file */
const char *field_name, /*<! IN: field name */
const h5_size_t attrib_idx, /*<! IN: Index of attribute to
get infos about */
char *attrib_name, /*<! OUT: Name of attribute */
const h5_size_t len_attrib_name,
/*<! IN: length of buffer \c name */
h5_int64_t *attrib_type, /*<! OUT: Type of value. */
h5_size_t *attrib_nelem /*<! OUT: Number of elements */
) {
H5_API_ENTER (h5_err_t,
"f=%p field_name='%s', "
"attrib_idx=%llu, "
"attrib_name=%p, len_attrib_name=%llu, "
"attrib_type=%p, "
"attrib_nelem=%p",
f,
field_name,
(long long unsigned)attrib_idx,
attrib_name, (long long unsigned)len_attrib_name,
attrib_type,
attrib_nelem);
H5_API_RETURN (
h5b_get_field_attrib_info (
f,
field_name,
attrib_idx,
attrib_name,
len_attrib_name,
attrib_type,
attrib_nelem));
}
#define H5BLOCK_FIELD_ORIGIN_NAME "__Origin__"
#define H5BLOCK_FIELD_SPACING_NAME "__Spacing__"
/*!
\ingroup h5block_c_api
Get field origin.
\return \c H5_SUCCESS or error code
*/
h5_err_t
H5Block3dGetFieldOrigin (
h5_file_t *f, /*!< IN: file handle */
const char *field_name, /*!< IN: field name */
h5_float64_t *x_origin, /*!< OUT: X origin */
h5_float64_t *y_origin, /*!< OUT: Y origin */
h5_float64_t *z_origin /*!< OUT: Z origin */
) {
H5_API_ENTER (h5_err_t,
"f=%p, field_name='%s', x_origin=%p, y_origin=%p, z_origin=%p",
f, field_name, x_origin, y_origin, z_origin);
h5_float64_t origin[3];
TRY (h5_read_field_attrib (
f,
field_name,
H5BLOCK_FIELD_ORIGIN_NAME,
H5_FLOAT64_T,
origin));
*x_origin = origin[0];
*y_origin = origin[1];
*z_origin = origin[2];
H5_API_RETURN (H5_SUCCESS);
}
/*!
\ingroup h5block_c_api
Set field origin.
\return \c H5_SUCCESS or error code
*/
h5_err_t
H5Block3dSetFieldOrigin (
h5_file_t *f, /*!< IN: file handle */
const char *field_name, /*!< IN: field name */
const h5_float64_t x_origin, /*!< IN: X origin */
const h5_float64_t y_origin, /*!< IN: Y origin */
const h5_float64_t z_origin /*!< IN: Z origin */
) {
H5_API_ENTER (h5_err_t,
"f=%p, field_name='%s', x_origin=%g, y_origin=%g, z_origin=%g",
f, field_name, x_origin, y_origin, z_origin);
h5_float64_t origin[3] = { x_origin, y_origin, z_origin };
H5_API_RETURN (h5_write_field_attrib (
f,
field_name,
H5BLOCK_FIELD_ORIGIN_NAME,
(hid_t)H5_FLOAT64_T,
origin,
3));
}
/*!
\ingroup h5block_c_api
Get field spacing for field \c field_name in the current time step.
\return \c H5_SUCCESS or error code
*/
h5_err_t
H5Block3dGetFieldSpacing (
h5_file_t *f, /*!< IN: file handle */
const char *field_name, /*!< IN: field name */
h5_float64_t *x_spacing, /*!< OUT: X spacing */
h5_float64_t *y_spacing, /*!< OUT: Y spacing */
h5_float64_t *z_spacing /*!< OUT: Z spacing */
) {
H5_API_ENTER (h5_err_t,
"f=%p, field_name='%s', x_spacing=%p, y_spacing=%p, z_spacing=%p",
f, field_name, x_spacing, y_spacing, z_spacing);
h5_float64_t spacing[3];
TRY (h5_read_field_attrib (
f,
field_name,
H5BLOCK_FIELD_SPACING_NAME,
H5_FLOAT64_T,
spacing));
*x_spacing = spacing[0];
*y_spacing = spacing[1];
*z_spacing = spacing[2];
H5_API_RETURN (H5_SUCCESS);
}
/*!
\ingroup h5block_c_api
Set field spacing for field \c field_name in the current time step.
\return \c H5_SUCCESS or error code
*/
h5_err_t
H5Block3dSetFieldSpacing (
h5_file_t *f, /*!< IN: file handle */
const char *field_name, /*!< IN: field name */
const h5_float64_t x_spacing, /*!< IN: X spacing */
const h5_float64_t y_spacing, /*!< IN: Y spacing */
const h5_float64_t z_spacing /*!< IN: Z spacing */
) {
H5_API_ENTER (h5_err_t,
"f=%p, field_name='%s', x_spacing=%g, y_spacing=%g, z_spacing=%g",
f, field_name, x_spacing, y_spacing, z_spacing);
h5_float64_t spacing[3] = { x_spacing, y_spacing, z_spacing };
H5_API_RETURN (h5_write_field_attrib (
f,
field_name,
H5BLOCK_FIELD_SPACING_NAME,
(hid_t)H5_FLOAT64_T,
spacing,
3));
}
-625
View File
@@ -1,625 +0,0 @@
#include "h5core/h5_core.h"
#include "H5Block_readwrite.h"
/*!
\ingroup h5block_data
Write a 3-dimensional field \c name from the buffer starting at \c data
to the current time-step using the defined field layout. Values are
floating points (64-bit).
You must use the Fortran indexing scheme to access items in \c data.
\return \c H5_SUCCESS or error code
*/
h5_err_t
H5Block3dWriteScalarFieldFloat64 (
h5_file_t *const f, /*!< IN: file handle */
const char *name, /*!< IN: name of dataset to write */
const h5_float64_t *buffer /*!< IN: pointer to write buffer */
) {
H5_API_ENTER (h5_err_t, "f=%p, name='%s', buffer=%p", f, name, buffer);
H5_API_RETURN (h5b_write_scalar_data(f, name, (void*)buffer, H5T_NATIVE_DOUBLE ));
}
/*!
\ingroup h5block_data
Read a 3-dimensional field \c name into the buffer starting at \c data from
the current time-step using the defined field layout. Values are
floating points (64-bit).
You must use the Fortran indexing scheme to access items in \c data.
\return \c H5_SUCCESS or error code
*/
h5_err_t
H5Block3dReadScalarFieldFloat64 (
h5_file_t *const f, /*!< IN: file handle */
const char *name, /*!< IN: name of dataset to read */
h5_float64_t *buffer /*!< OUT: pointer to read buffer */
) {
H5_API_ENTER (h5_err_t, "f=%p, name='%s', buffer=%p", f, name, buffer);
H5_API_RETURN (h5b_read_scalar_data(f, name, (void*)buffer, H5T_NATIVE_DOUBLE));
}
/*!
\ingroup h5block_data
*/
/*!
Write a 3-dimensional field \c name with 3-dimensional vectors as values
from the buffers starting at \c x_buf, \c y_buf and \c z_buf to the
current time-step using the defined field layout. Values are 3-dimensional
vectors with floating points (64-bit) values.
You must use the Fortran indexing scheme to access items in \c x_buf.
\return \c H5_SUCCESS or error code
*/
h5_err_t
H5Block3dWriteVector3dFieldFloat64 (
h5_file_t *const f, /*!< IN: file handle */
const char *name, /*!< IN: name of dataset to write */
const h5_float64_t *x_buf, /*!< IN: pointer to X axis buffer */
const h5_float64_t *y_buf, /*!< IN: pointer to Y axis buffer */
const h5_float64_t *z_buf /*!< IN: pointer to Z axis buffer */
) {
H5_API_ENTER (h5_err_t, "f=%p, name='%s', x_buf=%p, y_buf=%p, z_buf=%p",
f, name, x_buf, y_buf, z_buf);
H5_API_RETURN(h5b_write_vector3d_data(f, name,
(void*)x_buf, (void*)y_buf, (void*)z_buf, H5T_NATIVE_DOUBLE));
}
/*!
\ingroup h5block_data
*/
/*!
Read a 3-dimensional field \c name with 3-dimensional vectors as values
from the buffers starting at \c x_buf, \c y_buf and \c z_buf to the
current time-step using the defined field layout. Values are 3-dimensional
vectors with floating points (64-bit) values.
You must use the Fortran indexing scheme to access items in \c data.
\return \c H5_SUCCESS or error code
*/
h5_err_t
H5Block3dReadVector3dFieldFloat64 (
h5_file_t *const f, /*!< IN: file handle */
const char *name, /*!< IN: name of dataset to write */
h5_float64_t *const x_buf, /*!< OUT: pointer to X axis buffer */
h5_float64_t *const y_buf, /*!< OUT: pointer to Y axis buffer */
h5_float64_t *const z_buf /*!< OUT: pointer to Z axis buffer */
) {
H5_API_ENTER (h5_err_t, "f=%p, name='%s', x_buf=%p, y_buf=%p, z_buf=%p",
f, name, x_buf, y_buf, z_buf);
H5_API_RETURN(h5b_read_vector3d_data(f, name,
x_buf, y_buf, z_buf, H5T_NATIVE_DOUBLE));
}
/*!
\ingroup h5block_data
Write a 3-dimensional field \c name from the buffer starting at \c data
to the current time-step using the defined field layout. Values are
floating points (32-bit).
You must use the Fortran indexing scheme to access items in \c data.
\return \c H5_SUCCESS or error code
*/
h5_err_t
H5Block3dWriteScalarFieldFloat32 (
h5_file_t *const f, /*!< IN: file handle */
const char *name, /*!< IN: name of dataset to write */
const h5_float32_t *buffer /*!< IN: pointer to write buffer */
) {
H5_API_ENTER (h5_err_t, "f=%p, name='%s', buffer=%p", f, name, buffer);
H5_API_RETURN (h5b_write_scalar_data(f, name, buffer, H5T_NATIVE_FLOAT ));
}
/*!
\ingroup h5block_data
Read a 3-dimensional field \c name into the buffer starting at \c data from
the current time-step using the defined field layout. Values are
floating points (32-bit).
You must use the Fortran indexing scheme to access items in \c data.
\return \c H5_SUCCESS or error code
*/
h5_err_t
H5Block3dReadScalarFieldFloat32 (
h5_file_t *const f, /*!< IN: file handle */
const char *name, /*!< IN: name of dataset to read */
h5_float32_t *const buffer /*!< OUT: pointer to read buffer */
) {
H5_API_ENTER (h5_err_t, "f=%p, name='%s', buffer=%p", f, name, buffer);
H5_API_RETURN (h5b_read_scalar_data(f, name, buffer, H5T_NATIVE_FLOAT));
}
/*!
\ingroup h5block_data
*/
/*!
Write a 3-dimensional field \c name with 3-dimensional vectors as values
from the buffers starting at \c x_buf, \c y_buf and \c z_buf to the
current time-step using the defined field layout. Values are 3-dimensional
vectors with floating points (32-bit) values.
You must use the Fortran indexing scheme to access items in \c x_buf.
\return \c H5_SUCCESS or error code
*/
h5_err_t
H5Block3dWriteVector3dFieldFloat32 (
h5_file_t *const f, /*!< IN: file handle */
const char *name, /*!< IN: name of dataset to write */
const h5_float32_t *x_buf, /*!< IN: pointer to X axis buffer */
const h5_float32_t *y_buf, /*!< IN: pointer to Y axis buffer */
const h5_float32_t *z_buf /*!< IN: pointer to Z axis buffer */
) {
H5_API_ENTER (h5_err_t, "f=%p, name='%s', x_buf=%p, y_buf=%p, z_buf=%p",
f, name, x_buf, y_buf, z_buf);
H5_API_RETURN(h5b_write_vector3d_data(f, name,
x_buf, y_buf, z_buf, H5T_NATIVE_FLOAT));
}
/*!
\ingroup h5block_data
*/
/*!
Read a 3-dimensional field \c name with 3-dimensional vectors as values
from the buffers starting at \c x_buf, \c y_buf and \c z_buf to the
current time-step using the defined field layout. Values are 3-dimensional
vectors with floating points (32-bit) values.
You must use the Fortran indexing scheme to access items in \c data.
\return \c H5_SUCCESS or error code
*/
h5_err_t
H5Block3dReadVector3dFieldFloat32 (
h5_file_t *const f, /*!< IN: file handle */
const char *name, /*!< IN: name of dataset to write */
h5_float32_t *const x_buf, /*!< OUT: pointer to X axis buffer */
h5_float32_t *const y_buf, /*!< OUT: pointer to Y axis buffer */
h5_float32_t *const z_buf /*!< OUT: pointer to Z axis buffer */
) {
H5_API_ENTER (h5_err_t, "f=%p, name='%s', x_buf=%p, y_buf=%p, z_buf=%p",
f, name, x_buf, y_buf, z_buf);
H5_API_RETURN(h5b_read_vector3d_data(f, name,
x_buf, y_buf, z_buf, H5T_NATIVE_FLOAT));
}
/*!
\ingroup h5block_data
Write a 3-dimensional field \c name from the buffer starting at \c data
to the current time-step using the defined field layout. Values are
integers (64-bit).
You must use the Fortran indexing scheme to access items in \c data.
\return \c H5_SUCCESS or error code
*/
h5_err_t
H5Block3dWriteScalarFieldInt64 (
h5_file_t *const f, /*!< IN: file handle */
const char *name, /*!< IN: name of dataset to write */
const h5_int64_t *buffer /*!< IN: pointer to write buffer */
) {
H5_API_ENTER (h5_err_t, "f=%p, name='%s', buffer=%p", f, name, buffer);
H5_API_RETURN (h5b_write_scalar_data(f, name, buffer, H5T_NATIVE_INT64 ));
}
/*!
\ingroup h5block_data
Read a 3-dimensional field \c name into the buffer starting at \c data from
the current time-step using the defined field layout. Values are
integers (64-bit).
You must use the Fortran indexing scheme to access items in \c data.
\return \c H5_SUCCESS or error code
*/
h5_err_t
H5Block3dReadScalarFieldInt64 (
h5_file_t *const f, /*!< IN: file handle */
const char *name, /*!< IN: name of dataset to read */
h5_int64_t *const buffer /*!< OUT: pointer to read buffer */
) {
H5_API_ENTER (h5_err_t, "f=%p, name='%s', buffer=%p", f, name, buffer);
H5_API_RETURN (h5b_read_scalar_data(f, name, buffer, H5T_NATIVE_INT64));
}
/*!
\ingroup h5block_data
*/
/*!
Write a 3-dimensional field \c name with 3-dimensional vectors as values
from the buffers starting at \c x_buf, \c y_buf and \c z_buf to the
current time-step using the defined field layout. Values are 3-dimensional
vectors with integers (64-bit) values.
You must use the Fortran indexing scheme to access items in \c x_buf.
\return \c H5_SUCCESS or error code
*/
h5_err_t
H5Block3dWriteVector3dFieldInt64 (
h5_file_t *const f, /*!< IN: file handle */
const char *name, /*!< IN: name of dataset to write */
const h5_int64_t *x_buf, /*!< IN: pointer to X axis buffer */
const h5_int64_t *y_buf, /*!< IN: pointer to Y axis buffer */
const h5_int64_t *z_buf /*!< IN: pointer to Z axis buffer */
) {
H5_API_ENTER (h5_err_t, "f=%p, name='%s', x_buf=%p, y_buf=%p, z_buf=%p",
f, name, x_buf, y_buf, z_buf);
H5_API_RETURN (h5b_write_vector3d_data(f, name,
x_buf, y_buf, z_buf, H5T_NATIVE_INT64));
}
/*!
\ingroup h5block_data
*/
/*!
Read a 3-dimensional field \c name with 3-dimensional vectors as values
from the buffers starting at \c x_buf, \c y_buf and \c z_buf to the
current time-step using the defined field layout. Values are 3-dimensional
vectors with integers (64-bit) values.
You must use the Fortran indexing scheme to access items in \c data.
\return \c H5_SUCCESS or error code
*/
h5_err_t
H5Block3dReadVector3dFieldInt64 (
h5_file_t *const f, /*!< IN: file handle */
const char *name, /*!< IN: name of dataset to write */
h5_int64_t *const x_buf, /*!< OUT: pointer to X axis buffer */
h5_int64_t *const y_buf, /*!< OUT: pointer to Y axis buffer */
h5_int64_t *const z_buf /*!< OUT: pointer to Z axis buffer */
) {
H5_API_ENTER (h5_err_t, "f=%p, name='%s', x_buf=%p, y_buf=%p, z_buf=%p",
f, name, x_buf, y_buf, z_buf);
H5_API_RETURN (h5b_read_vector3d_data(f, name,
x_buf, y_buf, z_buf, H5T_NATIVE_INT64));
}
/*!
\ingroup h5block_data
Write a 3-dimensional field \c name from the buffer starting at \c data
to the current time-step using the defined field layout. Values are
integers (32-bit).
You must use the Fortran indexing scheme to access items in \c data.
\return \c H5_SUCCESS or error code
*/
h5_err_t
H5Block3dWriteScalarFieldInt32 (
h5_file_t *const f, /*!< IN: file handle */
const char *name, /*!< IN: name of dataset to write */
const h5_int32_t *buffer /*!< IN: pointer to write buffer */
) {
H5_API_ENTER (h5_err_t, "f=%p, name='%s', buffer=%p", f, name, buffer);
H5_API_RETURN (h5b_write_scalar_data(f, name, buffer, H5T_NATIVE_INT32 ));
}
/*!
\ingroup h5block_data
Read a 3-dimensional field \c name into the buffer starting at \c data from
the current time-step using the defined field layout. Values are
integers (32-bit).
You must use the Fortran indexing scheme to access items in \c data.
\return \c H5_SUCCESS or error code
*/
h5_err_t
H5Block3dReadScalarFieldInt32 (
h5_file_t *const f, /*!< IN: file handle */
const char *name, /*!< IN: name of dataset to read */
h5_int32_t *const buffer /*!< OUT: pointer to read buffer */
) {
H5_API_ENTER (h5_err_t, "f=%p, name='%s', buffer=%p", f, name, buffer);
H5_API_RETURN (h5b_read_scalar_data(f, name, buffer, H5T_NATIVE_INT32));
}
/*!
\ingroup h5block_data
*/
/*!
Write a 3-dimensional field \c name with 3-dimensional vectors as values
from the buffers starting at \c x_buf, \c y_buf and \c z_buf to the
current time-step using the defined field layout. Values are 3-dimensional
vectors with integers (32-bit) values.
You must use the Fortran indexing scheme to access items in \c x_buf.
\return \c H5_SUCCESS or error code
*/
h5_err_t
H5Block3dWriteVector3dFieldInt32 (
h5_file_t *const f, /*!< IN: file handle */
const char *name, /*!< IN: name of dataset to write */
const h5_int32_t *x_buf, /*!< IN: pointer to X axis buffer */
const h5_int32_t *y_buf, /*!< IN: pointer to Y axis buffer */
const h5_int32_t *z_buf /*!< IN: pointer to Z axis buffer */
) {
H5_API_ENTER (h5_err_t, "f=%p, name='%s', x_buf=%p, y_buf=%p, z_buf=%p",
f, name, x_buf, y_buf, z_buf);
H5_API_RETURN(h5b_write_vector3d_data(f, name,
x_buf, y_buf, z_buf, H5T_NATIVE_INT32));
}
/*!
\ingroup h5block_data
*/
/*!
Read a 3-dimensional field \c name with 3-dimensional vectors as values
from the buffers starting at \c x_buf, \c y_buf and \c z_buf to the
current time-step using the defined field layout. Values are 3-dimensional
vectors with integers (32-bit) values.
You must use the Fortran indexing scheme to access items in \c data.
\return \c H5_SUCCESS or error code
*/
h5_err_t
H5Block3dReadVector3dFieldInt32 (
h5_file_t *const f, /*!< IN: file handle */
const char *name, /*!< IN: name of dataset to write */
h5_int32_t *const x_buf, /*!< OUT: pointer to X axis buffer */
h5_int32_t *const y_buf, /*!< OUT: pointer to Y axis buffer */
h5_int32_t *const z_buf /*!< OUT: pointer to Z axis buffer */
) {
H5_API_ENTER (h5_err_t, "f=%p, name='%s', x_buf=%p, y_buf=%p, z_buf=%p",
f, name, x_buf, y_buf, z_buf);
H5_API_RETURN(h5b_read_vector3d_data(f, name,
x_buf, y_buf, z_buf, H5T_NATIVE_INT32));
}
/*!
\ingroup h5block_attrib
Write float64 \c values as attribute \c attrib_name of field
\c field_name.
\return \c H5_SUCCESS or error code
*/
h5_err_t
H5BlockWriteFieldAttribFloat64 (
h5_file_t *const f, /*!< IN: file handle */
const char *field_name, /*!< IN: field name */
const char *attrib_name, /*!< IN: attribute name */
const h5_float64_t *buffer, /*!< IN: attribute values */
const h5_size_t nelems /*!< IN: number of elements */
) {
H5_API_ENTER (h5_err_t,
"f=%p, field_name='%s', attrib_name='%s', "
"buffer=%p, nelems=%lld",
f, field_name, attrib_name, buffer, (long long)nelems);
H5_API_RETURN (h5_write_field_attrib (
f,
field_name,
attrib_name,
H5T_NATIVE_DOUBLE,
buffer,
nelems ));
}
/*!
\ingroup h5block_attrib
Read float64 values from attribute \c attrib_name of field
\c field_name into a \c buffer.
\return \c H5_SUCCESS or error code
*/
h5_err_t
H5BlockReadFieldAttribFloat64 (
h5_file_t *const f, /*!< IN: file handle */
const char *field_name, /*!< IN: field name */
const char *attrib_name, /*!< IN: attribute name */
h5_float64_t *buffer /*!< OUT: attribute values */
) {
H5_API_ENTER (h5_err_t, "f=%p, field_name='%s', attrib_name='%s', buffer=%p",
f, field_name, attrib_name, buffer);
H5_API_RETURN (h5_read_field_attrib (
f,
field_name,
attrib_name,
H5T_NATIVE_DOUBLE,
(void*)buffer ));
}
/*!
\ingroup h5block_attrib
Write float32 \c values as attribute \c attrib_name of field
\c field_name.
\return \c H5_SUCCESS or error code
*/
h5_err_t
H5BlockWriteFieldAttribFloat32 (
h5_file_t *const f, /*!< IN: file handle */
const char *field_name, /*!< IN: field name */
const char *attrib_name, /*!< IN: attribute name */
const h5_float32_t *buffer, /*!< IN: attribute values */
const h5_size_t nelems /*!< IN: number of elements */
) {
H5_API_ENTER (h5_err_t,
"f=%p, field_name='%s', attrib_name='%s', "
"buffer=%p, nelems=%lld",
f, field_name, attrib_name, buffer, (long long)nelems);
H5_API_RETURN (h5_write_field_attrib (
f,
field_name,
attrib_name,
H5T_NATIVE_FLOAT,
buffer,
nelems ));
}
/*!
\ingroup h5block_attrib
Read float32 values from attribute \c attrib_name of field
\c field_name into a \c buffer.
\return \c H5_SUCCESS or error code
*/
h5_err_t
H5BlockReadFieldAttribFloat32 (
h5_file_t *const f, /*!< IN: file handle */
const char *field_name, /*!< IN: field name */
const char *attrib_name, /*!< IN: attribute name */
h5_float32_t *const buffer /*!< OUT: attribute values */
) {
H5_API_ENTER (h5_err_t, "f=%p, field_name='%s', attrib_name='%s', buffer=%p",
f, field_name, attrib_name, buffer);
H5_API_RETURN (h5_read_field_attrib (
f,
field_name,
attrib_name,
H5T_NATIVE_FLOAT,
buffer ));
}
/*!
\ingroup h5block_attrib
Write int64 \c values as attribute \c attrib_name of field
\c field_name.
\return \c H5_SUCCESS or error code
*/
h5_err_t
H5BlockWriteFieldAttribInt64 (
h5_file_t *const f, /*!< IN: file handle */
const char *field_name, /*!< IN: field name */
const char *attrib_name, /*!< IN: attribute name */
const h5_int64_t *buffer, /*!< IN: attribute values */
const h5_size_t nelems /*!< IN: number of elements */
) {
H5_API_ENTER (h5_err_t,
"f=%p, field_name='%s', attrib_name='%s', buffer=%p, nelems=%lld",
f, field_name, attrib_name, buffer, (long long)nelems);
H5_API_RETURN (h5_write_field_attrib (
f,
field_name,
attrib_name,
H5T_NATIVE_INT64,
buffer,
nelems ));
}
/*!
\ingroup h5block_attrib
Read int64 values from attribute \c attrib_name of field
\c field_name into a \c buffer.
\return \c H5_SUCCESS or error code
*/
h5_err_t
H5BlockReadFieldAttribInt64 (
h5_file_t *const f, /*!< IN: file handle */
const char *field_name, /*!< IN: field name */
const char *attrib_name, /*!< IN: attribute name */
h5_int64_t *const buffer /*!< OUT: attribute values */
) {
H5_API_ENTER (h5_err_t, "f=%p, field_name='%s', attrib_name='%s', buffer=%p",
f, field_name, attrib_name, buffer);
H5_API_RETURN (h5_read_field_attrib (
f,
field_name,
attrib_name,
H5T_NATIVE_INT64,
buffer ));
}
/*!
\ingroup h5block_attrib
Write int32 \c values as attribute \c attrib_name of field
\c field_name.
\return \c H5_SUCCESS or error code
*/
h5_err_t
H5BlockWriteFieldAttribInt32 (
h5_file_t *const f, /*!< IN: file handle */
const char *field_name, /*!< IN: field name */
const char *attrib_name, /*!< IN: attribute name */
const h5_int32_t *buffer, /*!< IN: attribute values */
const h5_size_t nelems /*!< IN: number of elements */
) {
H5_API_ENTER (h5_err_t,
"f=%p, field_name='%s', attrib_name='%s', "
"buffer=%p, nelems=%lld",
f, field_name, attrib_name, buffer, (long long)nelems);
H5_API_RETURN (h5_write_field_attrib (
f,
field_name,
attrib_name,
H5T_NATIVE_INT32,
buffer,
nelems ));
}
/*!
\ingroup h5block_attrib
Read int32 values from attribute \c attrib_name of field
\c field_name into a \c buffer.
\return \c H5_SUCCESS or error code
*/
h5_err_t
H5BlockReadFieldAttribInt32 (
h5_file_t *const f, /*!< IN: file handle */
const char *field_name, /*!< IN: field name */
const char *attrib_name, /*!< IN: attribute name */
h5_int32_t *buffer /*!< OUT: attribute values */
) {
H5_API_ENTER (h5_err_t, "f=%p, field_name='%s', attrib_name='%s', buffer=%p",
f, field_name, attrib_name, buffer);
H5_API_RETURN (h5_read_field_attrib (
f,
field_name,
attrib_name,
H5T_NATIVE_INT32,
(void*)buffer ));
}
-604
View File
@@ -1,604 +0,0 @@
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h> /* va_arg - System dependent ?! */
#include <string.h>
#include <errno.h>
#include <fcntl.h>
#include <hdf5.h>
#ifndef WIN32
#include <unistd.h>
#else /* WIN32 */
#include <io.h>
#define open _open
#define close _close
#endif /* WIN32 */
#include "h5core/h5_core.h"
#include "H5Part.h"
/*!
\ingroup h5part_model
Set the number of particles for the current time-step.
After you call this subroutine, all subsequent
operations will assume this number of particles will be written.
For the parallel library, the \c nparticles value is the number of
particles that the \e individual task will write. You can use
a different value on different tasks.
This function uses an \c MPI_Allgather
call to aggregate each tasks number of particles and determine
the appropiate offsets. Because of the use of this MPI collective,
it is advisable to call this function as
few times as possible when running at large concurrency.
This function assumes that your particles' data fields are in stored in
contiguous 1D arrays.
For instance, the fields \e x and \e y for your particles are stored
in separate arrays \c x[] and \c y[].
If instead you store your particles as tuples, so that the values
are arranged \f$ x_1,y_1,x_2,y_2\f$... than you need to setup striding
(in this case with value 2) using \ref H5PartSetNumParticlesStrided.
\return \c H5_SUCCESS or error code
*/
h5_err_t
H5PartSetNumParticles (
h5_file_t *f, /*!< [in] Handle to open file */
h5_size_t nparticles /*!< [in] Number of particles */
) {
H5_API_ENTER (h5_err_t,
"f=%p, nparticles=%llu",
f, (long long unsigned)nparticles);
h5_size_t stride = 1;
H5_API_RETURN (h5u_set_num_particles(f, nparticles, stride));
}
/*!
\ingroup h5part_model
Set the number of particles for the current time-step.
After you call this subroutine, all subsequent
operations will assume this number of particles will be written.
For the parallel library, the \c nparticles value is the number of
particles that the \e individual task will write. You can use
a different value on different tasks.
This function uses an \c MPI_Allgather
call to aggregate each tasks number of particles and determine
the appropiate offsets. Because of the use of this MPI collective,
it is advisable to call this function as
few times as possible when running at large concurrency.
This function assumes that your particles' data fields are
stored tuples. For instance, the fields \e x and \e y of your
particles are arranged \f$x_1,y_1,x_2,y_2\f$... in a single data
array. In this example, the stride value would be 2.
If you instead have a separate array for each fields,
such as \c x[] and \c y[],
use \ref H5PartSetNumParticles.
\return \c H5_SUCCESS or error code
*/
h5_err_t
H5PartSetNumParticlesStrided (
h5_file_t *f, /*!< [in] Handle to open file */
h5_size_t nparticles, /*!< [in] Number of particles */
h5_size_t stride /*!< [in] Stride value (e.g. number of fields in the particle array) */
) {
H5_API_ENTER (h5_err_t,
"f=%p, nparticles=%llu, stride=%llu",
f, (long long unsigned)nparticles,
(long long unsigned)stride);
H5_API_RETURN (h5u_set_num_particles (f, nparticles, stride));
}
/*!
\ingroup h5part_model
Define the chunk \c size and enables chunking in the underlying
HDF5 layer.
Note that this policy wastes disk space, but can improve write
bandwidth on parallel filesystems that are sensitive to write alignment
(e.g. lustre). It is only recommended when using the MPI-POSIX or MPI-IO
independent VFDs (see \ref H5OpenFile).
\return \c H5_SUCCESS or error code
*/
h5_err_t
H5PartSetChunk (
h5_file_t *f,
h5_size_t size
) {
H5_API_ENTER (h5_err_t, "f=%p, size=%llu", f, (long long unsigned)size);
H5_API_RETURN (h5u_set_chunk (f, size));
}
/*!
\ingroup h5part_data
Write array of 64 bit floating point data to file.
After setting the number of particles with \c H5PartSetNumParticles() and
the current timestep using \c H5SetStep(), you can start writing datasets
into the file. Each dataset has a name associated with it (chosen by the
user) in order to facilitate later retrieval. The name of the dataset is
specified in the parameter \c name, which must be a null-terminated string.
There are no restrictions on naming of datasets, but it is useful to arrive
at some common naming convention when sharing data with other groups.
The writing routines also implicitly store the datatype of the array so that
the array can be reconstructed properly on other systems with incompatible
type representations.
All data that is written after setting the timestep is associated with that
timestep. While the number of particles can change for each timestep, you
cannot change the number of particles in the middle of a given timestep.
The data is committed to disk before the routine returns.
\return \c H5_SUCCESS or error code
*/
h5_err_t
H5PartWriteDataFloat64 (
h5_file_t *f, /*!< [in] Handle to open file */
const char *name, /*!< [in] Name to associate array with */
const h5_float64_t *data /*!< [in] Array to commit to disk */
) {
H5_API_ENTER (h5_err_t, "f=%p, name='%s', date=%p", f,name,data);
H5_API_RETURN (h5u_write_data (f, name, (void*)data, H5T_NATIVE_DOUBLE));
}
/*!
\ingroup h5part_data
Write array of 32 bit floating point data to file.
After setting the number of particles with \c H5PartSetNumParticles() and
the current timestep using \c H5SetStep(), you can start writing datasets
into the file. Each dataset has a name associated with it (chosen by the
user) in order to facilitate later retrieval. The name of the dataset is
specified in the parameter \c name, which must be a null-terminated string.
There are no restrictions on naming of datasets, but it is useful to arrive
at some common naming convention when sharing data with other groups.
The writing routines also implicitly store the datatype of the array so that
the array can be reconstructed properly on other systems with incompatible
type representations.
All data that is written after setting the timestep is associated with that
timestep. While the number of particles can change for each timestep, you
cannot change the number of particles in the middle of a given timestep.
The data is committed to disk before the routine returns.
\return \c H5_SUCCESS or error code
*/
h5_err_t
H5PartWriteDataFloat32 (
h5_file_t *f, /*!< [in] Handle to open file */
const char *name, /*!< [in] Name to associate array with */
const h5_float32_t *data /*!< [in] Array to commit to disk */
) {
H5_API_ENTER (h5_err_t, "f=%p, name='%s', date=%p", f,name,data);
h5_err_t h5err = h5u_write_data( f, name, (void*)data, H5T_NATIVE_FLOAT );
H5_API_RETURN (h5err);
}
/*!
\ingroup h5part_data
Write array of 64 bit integer data to file.
After setting the number of particles with \c H5PartSetNumParticles() and
the current timestep using \c H5SetStep(), you can start writing datasets
into the file. Each dataset has a name associated with it (chosen by the
user) in order to facilitate later retrieval. The name of the dataset is
specified in the parameter \c name, which must be a null-terminated string.
There are no restrictions on naming of datasets, but it is useful to arrive
at some common naming convention when sharing data with other groups.
The writing routines also implicitly store the datatype of the array so that
the array can be reconstructed properly on other systems with incompatible
type representations.
All data that is written after setting the timestep is associated with that
timestep. While the number of particles can change for each timestep, you
cannot change the number of particles in the middle of a given timestep.
The data is committed to disk before the routine returns.
\return \c H5_SUCCESS or error code
*/
h5_err_t
H5PartWriteDataInt64 (
h5_file_t *f, /*!< [in] Handle to open file */
const char *name, /*!< [in] Name to associate array with */
const h5_int64_t *data /*!< [in] Array to commit to disk */
) {
H5_API_ENTER (h5_err_t, "f=%p, name='%s', date=%p", f,name,data);
H5_API_RETURN (h5u_write_data (f, name, (void*)data, H5T_NATIVE_INT64));
}
/*!
\ingroup h5part_data
Write array of 32 bit integer data to file.
After setting the number of particles with \c H5PartSetNumParticles() and
the current timestep using \c H5SetStep(), you can start writing datasets
into the file. Each dataset has a name associated with it (chosen by the
user) in order to facilitate later retrieval. The name of the dataset is
specified in the parameter \c name, which must be a null-terminated string.
There are no restrictions on naming of datasets, but it is useful to arrive
at some common naming convention when sharing data with other groups.
The writing routines also implicitly store the datatype of the array so that
the array can be reconstructed properly on other systems with incompatible
type representations.
All data that is written after setting the timestep is associated with that
timestep. While the number of particles can change for each timestep, you
cannot change the number of particles in the middle of a given timestep.
The data is committed to disk before the routine returns.
\return \c H5_SUCCESS or error code
*/
h5_err_t
H5PartWriteDataInt32 (
h5_file_t *f, /*!< [in] Handle to open file */
const char *name, /*!< [in] Name to associate array with */
const h5_int32_t *data /*!< [in] Array to commit to disk */
) {
H5_API_ENTER (h5_err_t, "f=%p, name='%s', date=%p", f,name,data);
H5_API_RETURN (h5u_write_data (f, name, (void*)data, H5T_NATIVE_INT32));
}
/*!
\ingroup h5part_data
Read array of 64 bit floating point data from file.
When retrieving datasets from disk, you ask for them
by name. There are no restrictions on naming of arrays,
but it is useful to arrive at some common naming
convention when sharing data with other groups.
\return \c H5_SUCCESS or error code
*/
h5_err_t
H5PartReadDataFloat64 (
h5_file_t *f, /*!< [in] Handle to open file */
const char *name, /*!< [in] Name to associate dataset with */
h5_float64_t *data /*!< [out] Array of data */
) {
H5_API_ENTER (h5_err_t, "f=%p, name='%s', date=%p", f,name,data);
H5_API_RETURN (h5u_read_data (f, name, data, H5T_NATIVE_DOUBLE));
}
/*!
\ingroup h5part_data
Read array of 32 bit floating point data from file.
When retrieving datasets from disk, you ask for them
by name. There are no restrictions on naming of arrays,
but it is useful to arrive at some common naming
convention when sharing data with other groups.
\return \c H5_SUCCESS or error code
*/
h5_err_t
H5PartReadDataFloat32 (
h5_file_t *f, /*!< [in] Handle to open file */
const char *name, /*!< [in] Name to associate dataset with */
h5_float32_t *data /*!< [out] Array of data */
) {
H5_API_ENTER (h5_err_t, "f=%p, name='%s', date=%p", f,name,data);
H5_API_RETURN (h5u_read_data (f, name, data, H5T_NATIVE_FLOAT));
}
/*!
\ingroup h5part_data
Read array of 64 bit integer data from file.
When retrieving datasets from disk, you ask for them
by name. There are no restrictions on naming of arrays,
but it is useful to arrive at some common naming
convention when sharing data with other groups.
\return \c H5_SUCCESS or error code
*/
h5_err_t
H5PartReadDataInt64 (
h5_file_t *f, /*!< [in] Handle to open file */
const char *name, /*!< [in] Name to associate dataset with */
h5_int64_t *data /*!< [out] Array of data */
) {
H5_API_ENTER (h5_err_t, "f=%p, name='%s', date=%p", f,name,data);
H5_API_RETURN (h5u_read_data (f, name, data, H5T_NATIVE_INT64));
}
/*!
\ingroup h5part_data
Read array of 32 bit integer data from file.
When retrieving datasets from disk, you ask for them
by name. There are no restrictions on naming of arrays,
but it is useful to arrive at some common naming
convention when sharing data with other groups.
\return \c H5_SUCCESS or error code
*/
h5_err_t
H5PartReadDataInt32 (
h5_file_t *f, /*!< [in] Handle to open file */
const char *name, /*!< [in] Name to associate dataset with */
h5_int32_t *data /*!< [out] Array of data */
) {
H5_API_ENTER (h5_err_t, "f=%p, name='%s', date=%p", f,name,data);
H5_API_RETURN (h5u_read_data (f, name, data, H5T_NATIVE_INT32));
}
/*!
\ingroup h5part_model
Get the number of datasets that are stored at the current time-step.
\return number of datasets in current timestep or error code
*/
h5_ssize_t
H5PartGetNumDatasets (
h5_file_t *f /*!< [in] Handle to open file */
) {
H5_API_ENTER (h5_err_t, "f=%p", f);
H5_API_RETURN (h5u_get_num_datasets(f));
}
/*!
\ingroup h5part_model
This reads the name of a dataset specified by it's index in the current
time-step.
If the number of datasets is \c n, the range of \c _index is \c 0 to \c n-1.
\result \c H5_SUCCESS
*/
h5_err_t
H5PartGetDatasetName (
h5_file_t *f, /*!< [in] Handle to open file */
const h5_id_t idx, /*!< [in] Index of the dataset */
char *name, /*!< [out] Name of dataset */
const h5_size_t len /*!< [in] Size of buffer \c name */
) {
H5_API_ENTER (h5_err_t,
"f=%p, "
"idx=%lld, "
"name='%p', len=%llu, ",
f,
(long long)idx,
name, (unsigned long long)len);
H5_API_RETURN (h5u_get_dataset_info(f, idx, name, len, NULL, NULL));
}
/*!
\ingroup h5part_model
Gets the name, type and number of elements of a dataset based on its
index in the current timestep.
Type is one of the following values:
- \c H5_FLOAT64_T (for \c h5_float64_t)
- \c H5_FLOAT32_T (for \c h5_float32_t)
- \c H5_INT64_T (for \c h5_int64_t)
- \c H5_INT32_T (for \c h5_int32_t)
\return \c H5_SUCCESS
*/
h5_err_t
H5PartGetDatasetInfo (
h5_file_t *f, /*!< [in] Handle to open file */
const h5_id_t idx, /*!< [in] Index of the dataset */
char *dataset_name, /*!< [out] Name of dataset */
const h5_size_t len_dataset_name,
/*!< [in] Size of buffer \c dataset_name */
h5_int64_t *type, /*!< [out] Type of data in dataset */
h5_size_t *nelem /*!< [out] Number of elements. */
) {
H5_API_ENTER (h5_int64_t,
"f=%p, "
"idx=%lld, "
"dataset_name='%p', len_dataset_name=%llu, "
"type=%p, nelem=%p",
f,
(long long)idx,
dataset_name, (long long unsigned)len_dataset_name,
type, nelem);
H5_API_RETURN (h5u_get_dataset_info (
f, idx, dataset_name, len_dataset_name, type, nelem));
}
/*!
\ingroup h5part_model
This function returns the number of particles in this processor's view,
if a view has been set.
If not, it returns the total number of particles across all processors
from the last \ref H5PartSetNumParticles call.
If you have neither set the number of particles
nor set a view, then this returns the total number of
particles in the first data set of the current time step.
Note that H5Part assumes that all data sets within a given time step
have the same number of particles (although the number particles can
vary across time steps).
If none of these conditions are met, an error is thrown.
\return number of particles in current timestep or an error
code.
*/
h5_ssize_t
H5PartGetNumParticles (
h5_file_t *f /*!< [in] Handle to open file */
) {
H5_API_ENTER (h5_ssize_t, "f=%p", f);
CHECK_FILEHANDLE( f );
H5_API_RETURN (h5u_get_num_particles (f));
}
/*!
\ingroup h5part_model
Reset the view.
\return \c H5_SUCCESS
*/
h5_err_t
H5PartResetView (
h5_file_t *f /*!< [in] Handle to open file */
) {
H5_API_ENTER (h5_ssize_t, "f=%p", f);
H5_API_RETURN (h5u_reset_view (f));
}
/*!
\ingroup h5part_model
Check whether a view has been set, either automatically with
\ref H5PartSetNumParticles or manually with \ref H5PartSetView
or \ref H5PartSetViewIndices.
\return 0 for false or 1 for true
*/
h5_err_t
H5PartHasView (
h5_file_t *f /*!< [in] Handle to open file */
) {
H5_API_ENTER (h5_err_t, "f=%p", f);
H5_API_RETURN (h5u_has_view (f));
}
/*!
\ingroup h5part_model
For parallel I/O or for subsetting operations on the datafile,
this function allows you to define a subset of the total
particle dataset to operate on.
The concept of "view" works for both serial
and for parallel I/O. The "view" will remain in effect until a new view
is set, or the number of particles in a dataset changes, or the view is
"unset" by calling \c H5PartSetView(file,-1,-1);
Before you set a view, \ref H5PartGetNumParticles will return the
total number of particles in the current time-step (even for the parallel
reads). However, after you set a view, it will return the number of
particles contained in the view.
The range is \e inclusive: the end value is the last index of the
data.
\return \c H5_SUCCESS or error code
*/
h5_err_t
H5PartSetView (
h5_file_t *f, /*!< [in] Handle to open file */
h5_int64_t start, /*!< [in] Start particle */
h5_int64_t end /*!< [in] End particle */
) {
H5_API_ENTER (h5_err_t,
"f=%p, start=%lld, end=%lld",
f, (long long)start, (long long)end);
H5_API_RETURN (h5u_set_view (f, start, end));
}
/*!
\ingroup h5part_model
For parallel I/O or for subsetting operations on the datafile,
this function allows you to define a subset of the total
dataset to operate on by specifying a list of indices.
The concept of "view" works for both serial
and for parallel I/O. The "view" will remain in effect until a new view
is set, or the number of particles in a dataset changes, or the view is
"unset" by calling \c H5PartSetViewIndices(NULL,0);
When you perform a read or write on a view consisting of indices, it
is assumed that your buffer is \b unpacked, meaning that there is room
for all the intermediate values (which will not be touched by the read
or write).
Before you set a view, the \c H5PartGetNumParticles() will return the
total number of particles in the current time-step (even for the parallel
reads). However, after you set a view, it will return the number of
particles contained in the view.
\return \c H5_SUCCESS or error code
*/
h5_err_t
H5PartSetViewIndices (
h5_file_t *f, /*!< [in] Handle to open file */
const h5_size_t *indices, /*!< [in] List of indices */
h5_size_t nelems /*!< [in] Size of list */
) {
H5_API_ENTER (h5_err_t,
"f=%p, indices=%p, nelems=%llu",
f, indices, (long long unsigned)nelems);
H5_API_RETURN (h5u_set_view_indices (f, indices, nelems));
}
/*!
\ingroup h5part_model
Allows you to query the current view. Start and End
will be \c -1 if there is no current view established.
Use \c H5PartHasView() to see if the view is smaller than the
total dataset.
\return number of elements in the view or error code
*/
h5_err_t
H5PartGetView (
h5_file_t *f, /*!< [in] Handle to open file */
h5_int64_t *start, /*!< [out] Start particle */
h5_int64_t *end /*!< [out] End particle */
) {
H5_API_ENTER (h5_err_t,
"f=%p, start=%p, end=%p",
f, start, end);
H5_API_RETURN (h5u_get_view (f, start, end));
}
/*!
\ingroup h5part_model
If it is too tedious to manually set the start and end coordinates
for a view, the \c H5SetCanonicalView() will automatically select an
appropriate domain decomposition of the data arrays for the degree
of parallelism and set the "view" accordingly.
\return H5_SUCCESS or error code
*/
h5_err_t
H5PartSetCanonicalView (
h5_file_t *f /*!< [in] Handle to open file */
) {
H5_API_ENTER (h5_err_t, "f=%p", f);
H5_API_RETURN (h5u_set_canonical_view (f));
}
-65
View File
@@ -1,65 +0,0 @@
#include "h5core/h5_core.h"
#include "H5hut.h"
h5_ssize_t
H5GetNumAttachments (
h5_file_t* const f /*!< [in] Handle to open file */
) {
H5_API_ENTER (h5_ssize_t, "f=%p", f);
H5_API_RETURN (h5_get_num_attachments (f));
}
h5_err_t
H5GetAttachmentInfoByIdx (
h5_file_t* const f,
const h5_size_t idx, // IN
char* const fname, // OUT
h5_size_t len_fname, // IN
h5_size_t* const fsize // OUT
) {
H5_API_ENTER (h5_err_t,
"idx=%llu, fname=%p, len_fname=%llu, fsize=%p",
(long long unsigned)idx,
fname, (long long unsigned)len_fname,
fsize);
H5_API_RETURN (h5_get_attachment_info_by_idx (
f, idx, fname, len_fname, fsize));
}
h5_err_t
H5GetAttachmentInfoByName (
h5_file_t* const f,
char* const fname, // OUT
h5_size_t* const fsize // OUT
) {
H5_API_ENTER (h5_err_t, "fname='%s', fsize=%p", fname, fsize);
H5_API_RETURN (h5_get_attachment_info_by_name (
f, fname, fsize));
}
h5_err_t
H5AddAttachment (
h5_file_t* const f, /*!< [in] Handle to open file */
const char* fname /*!< [in] Name of file to attach */
) {
H5_API_ENTER (h5_err_t, "fname='%s'", fname);
H5_API_RETURN (h5_add_attachment (f, fname));
}
h5_err_t
H5GetAttachment (
h5_file_t* const f, /*!< [in] Handle to open file */
const char* fname /*!< [in] Name of attachment */
) {
H5_API_ENTER (h5_err_t, "fname='%s'", fname);
H5_API_RETURN (h5_get_attachment (f, fname));
}
h5_err_t
H5DeleteAttachment (
h5_file_t* const f,
const char* const fname
) {
H5_API_ENTER (h5_err_t, "fname='%s'", fname);
H5_API_RETURN (h5_delete_attachment (f, fname));
}
-629
View File
@@ -1,629 +0,0 @@
#include <string.h>
#include "h5core/h5_core.h"
#include "H5hut.h"
/*** WRITE ***/
/*!
\ingroup h5hut_attrib
Write an attribute \c name with the string \c value to
the file root ("/").
\return \c H5_SUCCESS or error code
*/
h5_err_t
H5WriteFileAttribString (
h5_file_t *const f, /*!< [in] Handle to open file */
const char *name, /*!< [in] Name of attribute to create */
const char *value /*!< [in] Value of attribute */
) {
H5_API_ENTER (h5_err_t, "f=%p, name='%s', value='%s'", f, name, value);
H5_API_RETURN (h5_write_attrib (
f,
H5_ATTRIB_FILE,
name,
H5T_NATIVE_CHAR,
value,
strlen(value) + 1 ));
}
/*!
\ingroup h5hut_attrib
Write an attribute \c name with the string \c value to
the current timestep.
\return \c H5_SUCCESS or error code
*/
h5_err_t
H5WriteStepAttribString (
h5_file_t *const f, /*!< [in] Handle to open file */
const char *name, /*!< [in] Name of attribute to create */
const char *value /*!< [in] Value of attribute */
) {
H5_API_ENTER (h5_err_t, "f=%p, name='%s', value='%s'", f, name, value);
H5_API_RETURN (h5_write_attrib (
f,
H5_ATTRIB_STEP,
name,
H5T_NATIVE_CHAR,
value,
strlen(value) + 1 ));
}
/*!
\ingroup h5hut_attrib
Write an attribute \c name with float32 \c values to
the file root ("/").
\return \c H5_SUCCESS or error code
*/
h5_err_t
H5WriteFileAttribFloat32 (
h5_file_t *const f, /*!< [in] Handle to open file */
const char *name, /*!< [in] Name of attribute to create */
const h5_float32_t *values, /*!< [in] Values of attribute */
const h5_size_t nelems /*!< [in] Number of values */
) {
H5_API_ENTER (h5_err_t, "f=%p, name='%s', values=%p, nelems=%llu",
f, name, values, (long long unsigned)nelems);
H5_API_RETURN (h5_write_attrib (
f,
H5_ATTRIB_FILE,
name,
H5T_NATIVE_FLOAT,
values,
nelems ));
}
/*!
\ingroup h5hut_attrib
Write an attribute \c name with float32 \c values to
the current time step.
\return \c H5_SUCCESS or error code
*/
h5_err_t
H5WriteStepAttribFloat32 (
h5_file_t *const f, /*!< [in] Handle to open file */
const char *name, /*!< [in] Name of attribute to create */
const h5_float32_t *values, /*!< [in] Values of attribute */
const h5_size_t nelems /*!< [in] Number of values */
) {
H5_API_ENTER (h5_err_t, "f=%p, name='%s', values=%p, nelems=%llu",
f, name, values, (long long unsigned)nelems);
H5_API_RETURN (h5_write_attrib (
f,
H5_ATTRIB_STEP,
name,
H5T_NATIVE_FLOAT,
values,
nelems ));
}
/*!
\ingroup h5hut_attrib
Write an attribute \c name with float64 \c values to
the file root ("/").
\return \c H5_SUCCESS or error code
*/
h5_err_t
H5WriteFileAttribFloat64 (
h5_file_t *const f, /*!< [in] Handle to open file */
const char *name, /*!< [in] Name of attribute to create */
const h5_float64_t *values, /*!< [in] Values of attribute */
const h5_size_t nelems /*!< [in] Number of values */
) {
H5_API_ENTER (h5_err_t, "f=%p, name='%s', values=%p, nelems=%llu",
f, name, values, (long long unsigned)nelems);
H5_API_RETURN (h5_write_attrib (
f,
H5_ATTRIB_FILE,
name,
H5T_NATIVE_DOUBLE,
values,
nelems));
}
/*!
\ingroup h5hut_attrib
Write an attribute \c name with float64 \c values to
the current time step.
\return \c H5_SUCCESS or error code
*/
h5_err_t
H5WriteStepAttribFloat64 (
h5_file_t *const f, /*!< [in] Handle to open file */
const char *name, /*!< [in] Name of attribute to create */
const h5_float64_t *values, /*!< [in] Values of attribute */
const h5_size_t nelems /*!< [in] Number of values */
) {
H5_API_ENTER (h5_err_t, "f=%p, name='%s', values=%p, nelems=%llu",
f, name, values, (long long unsigned)nelems);
H5_API_RETURN (h5_write_attrib (
f,
H5_ATTRIB_STEP,
name,
H5T_NATIVE_DOUBLE,
values,
nelems));
}
/*!
\ingroup h5hut_attrib
Write an attribute \c name with int32 \c values to
the file root ("/").
\return \c H5_SUCCESS or error code
*/
h5_err_t
H5WriteFileAttribInt32 (
h5_file_t *const f, /*!< [in] Handle to open file */
const char *name, /*!< [in] Name of attribute to create */
const h5_int32_t *values, /*!< [in] Values of attribute */
const h5_size_t nelems /*!< [in] Number of values */
) {
H5_API_ENTER (h5_err_t, "f=%p, name='%s', values=%p, nelems=%llu",
f, name, values, (long long unsigned)nelems);
H5_API_RETURN (h5_write_attrib (
f,
H5_ATTRIB_FILE,
name,
H5T_NATIVE_INT32,
values,
nelems));
}
/*!
\ingroup h5hut_attrib
Write an attribute \c name with int32 \c values to
the current time step.
\return \c H5_SUCCESS or error code
*/
h5_err_t
H5WriteStepAttribInt32 (
h5_file_t *const f, /*!< [in] Handle to open file */
const char *name, /*!< [in] Name of attribute to create */
const h5_int32_t *values, /*!< [in] Values of attribute */
const h5_size_t nelems /*!< [in] Number of values */
) {
H5_API_ENTER (h5_err_t, "f=%p, name='%s', values=%p, nelems=%llu",
f, name, values, (long long unsigned)nelems);
H5_API_RETURN (h5_write_attrib (
f,
H5_ATTRIB_STEP,
name,
H5T_NATIVE_INT32,
values,
nelems));
}
/*!
\ingroup h5hut_attrib
Write an attribute \c name with int64 \c values to
the file root ("/").
\return \c H5_SUCCESS or error code
*/
h5_err_t
H5WriteFileAttribInt64 (
h5_file_t *const f, /*!< [in] Handle to open file */
const char *name, /*!< [in] Name of attribute to create */
const h5_int64_t *values, /*!< [in] Values of attribute */
const h5_size_t nelems /*!< [in] Number of values */
) {
H5_API_ENTER (h5_err_t, "f=%p, name='%s', values=%p, nelems=%llu",
f, name, values, (long long unsigned)nelems);
H5_API_RETURN (h5_write_attrib (
f,
H5_ATTRIB_FILE,
name,
H5T_NATIVE_INT64,
values,
nelems));
}
/*!
\ingroup h5hut_attrib
Write an attribute \c name with int64 \c values to
the current time step.
\return \c H5_SUCCESS or error code
*/
h5_err_t
H5WriteStepAttribInt64 (
h5_file_t *const f, /*!< [in] Handle to open file */
const char *name, /*!< [in] Name of attribute to create */
const h5_int64_t *values, /*!< [in] Values of attribute */
const h5_size_t nelems /*!< [in] Number of values */
) {
H5_API_ENTER (h5_err_t, "f=%p, name='%s', values=%p, nelems=%llu",
f, name, values, (long long unsigned)nelems);
H5_API_RETURN (h5_write_attrib (
f,
H5_ATTRIB_STEP,
name,
H5T_NATIVE_INT64,
values,
nelems));
}
/*** READ ***/
/*!
\ingroup h5hut_attrib
Read a string into a \c buffer from an attribute \c name
in the file root ("/").
\return \c H5_SUCCESS or error code
*/
h5_err_t
H5ReadFileAttribString (
h5_file_t *const f, /*!< [in] Handle to open file */
const char *name, /*!< [in] Name of attribute to create */
char *buffer /*!< [out] Value of attribute */
) {
H5_API_ENTER (h5_err_t, "f=%p, name='%s', value='%s'", f, name, buffer);
H5_API_RETURN (h5_read_attrib (
f,
H5_ATTRIB_FILE,
name,
H5_STRING_T,
(void*)buffer));
}
/*!
\ingroup h5hut_attrib
Read a string into a \c buffer from an attribute \c name
in the current timestep.
\return \c H5_SUCCESS or error code
*/
h5_err_t
H5ReadStepAttribString (
h5_file_t *const f, /*!< [in] Handle to open file */
const char *name, /*!< [in] Name of attribute to create */
char *buffer /*!< [out] Value of attribute */
) {
H5_API_ENTER (h5_err_t, "f=%p, name='%s', value='%s'",
f, name, buffer);
H5_API_RETURN (h5_read_attrib (
f,
H5_ATTRIB_STEP,
name,
H5_STRING_T,
(void*)buffer));
}
/*!
\ingroup h5hut_attrib
Read int32 values into a \c buffer from an attribute \c name
in the file root ("/").
\return \c H5_SUCCESS or error code
*/
h5_err_t
H5ReadFileAttribInt32 (
h5_file_t *const f, /*!< [in] Handle to open file */
const char *name, /*!< [in] Name of attribute to create */
h5_int32_t *buffer /*!< [out] Values of attribute */
) {
H5_API_ENTER (h5_err_t, "f=%p, name='%s', buffer=%p",
f, name, buffer);
H5_API_RETURN (h5_read_attrib (
f,
H5_ATTRIB_FILE,
name,
H5_INT32_T,
(void*)buffer));
}
/*!
\ingroup h5hut_attrib
Read int32 values into a \c buffer from an attribute \c name
in the current time step.
\return \c H5_SUCCESS or error code
*/
h5_err_t
H5ReadStepAttribInt32 (
h5_file_t *const f, /*!< [in] Handle to open file */
const char *name, /*!< [in] Name of attribute to create */
h5_int32_t *buffer /*!< [out] Values of attribute */
) {
H5_API_ENTER (h5_err_t, "f=%p, name='%s', buffer=%p",
f, name, buffer);
H5_API_RETURN (h5_read_attrib (
f,
H5_ATTRIB_STEP,
name,
H5_INT32_T,
(void*)buffer));
}
/*!
\ingroup h5hut_attrib
Read int64 values into a \c buffer from an attribute \c name
in the file root ("/").
\return \c H5_SUCCESS or error code
*/
h5_err_t
H5ReadFileAttribInt64 (
h5_file_t *const f, /*!< [in] Handle to open file */
const char *name, /*!< [in] Name of attribute to create */
h5_int64_t *buffer /*!< [out] Values of attribute */
) {
H5_API_ENTER (h5_err_t, "f=%p, name='%s', buffer=%p",
f, name, buffer);
H5_API_RETURN (h5_read_attrib (
f,
H5_ATTRIB_FILE,
name,
H5_INT64_T,
(void*)buffer));
}
/*!
\ingroup h5hut_attrib
Read int64 values into a \c buffer from an attribute \c name
in the current time step.
\return \c H5_SUCCESS or error code
*/
h5_err_t
H5ReadStepAttribInt64 (
h5_file_t *const f, /*!< [in] Handle to open file */
const char *name, /*!< [in] Name of attribute to create */
h5_int64_t *buffer /*!< [out] Values of attribute */
) {
H5_API_ENTER (h5_err_t, "f=%p, name='%s', buffer=%p",
f, name, buffer);
h5_err_t h5err = h5_read_attrib (
f,
H5_ATTRIB_STEP,
name,
H5_INT64_T,
(void*)buffer);
H5_API_RETURN (h5err);
}
/*!
\ingroup h5hut_attrib
Read float32 values into a \c buffer from an attribute \c name
in the file root ("/").
\return \c H5_SUCCESS or error code
*/
h5_err_t
H5ReadFileAttribFloat32 (
h5_file_t *const f, /*!< [in] Handle to open file */
const char *name, /*!< [in] Name of attribute to create */
h5_float32_t *buffer /*!< [out] Values of attribute */
) {
H5_API_ENTER (h5_err_t, "f=%p, name='%s', buffer=%p",
f, name, buffer);
H5_API_RETURN (h5_read_attrib (
f,
H5_ATTRIB_FILE,
name,
H5_FLOAT32_T,
(void*)buffer));
}
/*!
\ingroup h5hut_attrib
Read float32 values into a \c buffer from an attribute \c name
in the current time step.
\return \c H5_SUCCESS or error code
*/
h5_err_t
H5ReadStepAttribFloat32 (
h5_file_t *const f, /*!< [in] Handle to open file */
const char *name, /*!< [in] Name of attribute to create */
h5_float32_t *buffer /*!< [out] Values of attribute */
) {
H5_API_ENTER (h5_err_t, "f=%p, name='%s', buffer=%p",
f, name, buffer);
H5_API_RETURN (h5_read_attrib (
f,
H5_ATTRIB_STEP,
name,
H5_FLOAT32_T,
(void*)buffer));
}
/*!
\ingroup h5hut_attrib
Read float64 values into a \c buffer from an attribute \c name
in the file root ("/").
\return \c H5_SUCCESS or error code
*/
h5_err_t
H5ReadFileAttribFloat64 (
h5_file_t *const f, /*!< [in] Handle to open file */
const char *name, /*!< [in] Name of attribute to create */
h5_float64_t *buffer /*!< [out] Values of attribute */
) {
H5_API_ENTER (h5_err_t,
"f=%p, name='%s', buffer=%p",
f, name, buffer);
H5_API_RETURN (h5_read_attrib (
f,
H5_ATTRIB_FILE,
name,
H5_FLOAT64_T,
(void*)buffer));
}
/*!
\ingroup h5hut_attrib
Read float64 values into a \c buffer from an attribute \c name
in the current time step.
\return \c H5_SUCCESS or error code
*/
h5_err_t
H5ReadStepAttribFloat64 (
h5_file_t *const f, /*!< [in] Handle to open file */
const char *name, /*!< [in] Name of attribute to create */
h5_float64_t *buffer /*!< [out] Values of attribute */
) {
H5_API_ENTER (h5_err_t, "f=%p, name='%s', buffer=%p",
f, name, buffer);
H5_API_RETURN (h5_read_attrib (
f,
H5_ATTRIB_STEP,
name,
H5_FLOAT64_T,
(void*)buffer));
}
/*** QUERY ***/
/*!
\ingroup h5hut_attrib
Gets the number of attributes in the file's root ("/").
\return Number of attributes or error code.
*/
h5_int64_t
H5GetNumFileAttribs (
h5_file_t *const f /*!< [in] Handle to open file */
) {
H5_API_ENTER (h5_int64_t, "f=%p", f);
H5_API_RETURN (h5_get_num_attribs (f, H5_ATTRIB_FILE));
}
/*!
\ingroup h5hut_attrib
Gets the number of attributes bound to the current step.
\h5_err_t h5err = Number of attributes or error code.
*/
h5_int64_t
H5GetNumStepAttribs (
h5_file_t *const f /*!< [in] Handle to open file */
) {
H5_API_ENTER (h5_int64_t, "f=%p", f);
H5_API_RETURN (h5_get_num_attribs (f, H5_ATTRIB_STEP));
}
/*!
\ingroup h5hut_attrib
Gets the name, type and number of elements of the file attribute
specified by its index.
This function can be used to retrieve all attributes bound to the
file \c f by looping from \c 0 to the number of attribute minus
one. The number of attributes bound to file \c f can be queried
by calling \ref H5GetNumFileAttribs.
\return \c H5_SUCCESS or error code
*/
h5_err_t
H5GetFileAttribInfo (
h5_file_t *const f, /*!< [in] Handle to open file */
const h5_size_t attrib_idx, /*!< [in] Index of attribute to get
infos about */
char *attrib_name, /*!< [out] Name of attribute */
const h5_size_t len_of_attrib_name,
/*!< [in] length of buffer \c name */
h5_int64_t *attrib_type, /*!< [out] Type of value. */
h5_size_t *attrib_nelem /*!< [out] Number of elements */
) {
H5_API_ENTER (h5_err_t,
"f=%p, "
"attrib_idx=%llu, attrib_name=%p, len_attrib_name=%llu, "
"attrib_type=%p, attrib_nelem=%p",
f,
(long long unsigned)attrib_idx,
attrib_name,
(long long unsigned)len_of_attrib_name,
attrib_type,
attrib_nelem);
H5_API_RETURN (h5_get_attrib_info (
f,
H5_ATTRIB_FILE,
attrib_idx,
attrib_name,
len_of_attrib_name,
attrib_type,
attrib_nelem));
}
/*!
\ingroup h5hut_attrib
Gets the name, type and number of elements of the step attribute
specified by its index.
This function can be used to retrieve all attributes bound to the
current time-step by looping from \c 0 to the number of attribute
minus one. The number of attributes bound to the current
time-step can be queried by calling \ref H5GetNumStepAttribs.
\return \c H5_SUCCESS or error code
*/
h5_err_t
H5GetStepAttribInfo (
h5_file_t *const f, /*!< [in] Handle to open file */
const h5_size_t attrib_idx, /*!< [in] Index of attribute to
get infos about */
char *attrib_name, /*!< [out] Name of attribute */
const h5_size_t len_of_attrib_name,
/*!< [in] length of buffer \c name */
h5_int64_t *attrib_type, /*!< [out] Type of value. */
h5_size_t *attrib_nelem /*!< [out] Number of elements */
) {
H5_API_ENTER (h5_err_t,
"f=%p, "
"attrib_idx=%llu, attrib_name=%p, len_attrib_name=%llu, "
"attrib_type=%p, attrib_nelem=%p",
f,
(unsigned long long)attrib_idx,
attrib_name,
(unsigned long long)len_of_attrib_name,
attrib_type,
attrib_nelem);
H5_API_RETURN (h5_get_attrib_info (
f,
H5_ATTRIB_STEP,
attrib_idx,
attrib_name,
len_of_attrib_name,
attrib_type,
attrib_nelem));
}
+23 -42
View File
@@ -1,47 +1,28 @@
# src/C level Makefile.am
OBJEXT=o
if ENABLE_C
include_HEADERS = \
$(top_srcdir)/src/include/H5Block_attribs.h \
$(top_srcdir)/src/include/H5Block_io.h \
$(top_srcdir)/src/include/H5Block_model.h \
$(top_srcdir)/src/include/H5Fed_adjacency.h \
$(top_srcdir)/src/include/H5Fed_model.h \
$(top_srcdir)/src/include/H5Fed_retrieve.h \
$(top_srcdir)/src/include/H5Fed_store.h \
$(top_srcdir)/src/include/H5Fed_tags.h \
$(top_srcdir)/src/include/H5Part_io.h \
$(top_srcdir)/src/include/H5Part_model.h \
$(top_srcdir)/src/include/H5_attachments.h \
$(top_srcdir)/src/include/H5_debug.h \
$(top_srcdir)/src/include/H5_error.h \
$(top_srcdir)/src/include/H5_file.h \
$(top_srcdir)/src/include/H5_file_attribs.h \
$(top_srcdir)/src/include/H5_log.h \
$(top_srcdir)/src/include/H5_model.h \
$(top_srcdir)/src/include/H5_step_attribs.h \
$(top_srcdir)/src/include/H5hut.h
INCLUDES = -I../include @INCLUDES@
# What to build... Will be determined by configure script.
lib_LTLIBRARIES = @LIB_C@
# Listing of all possible targets that I may build.
EXTRA_LTLIBRARIES = libH5hutC.la
# Header files that I wish to install in $(prefix)/include
include_HEADERS = \
../include/H5hut.h \
../include/H5.h \
../include/H5_attribs.h \
../include/H5_attachments.h \
../include/H5Part.h \
../include/H5Block.h \
../include/H5Block_readwrite.h \
../include/H5Fed.h \
../include/H5Fed_adjacency.h \
../include/H5Fed_inquiry.h \
../include/H5Fed_retrieve.h \
../include/H5Fed_store.h \
../include/H5Fed_tags.h
# Listing of all possible headers that I may include
EXTRA_HEADERS =
# Listing of sources
libH5hutC_la_SOURCES = \
H5.c \
H5_attribs.c \
H5_attachments.c \
H5Part.c \
H5Block.c \
H5Block_readwrite.c
libH5hutC_la_LDFLAGS = -version-info 2:0:0 -rpath '$(libdir)'
all-local:
$(INSTALL) -m644 .libs/libH5hutC.a ../lib
endif
clean-local:
$(RM) ../lib/libH5hutC.a
$(RM) *~
-580
View File
@@ -1,580 +0,0 @@
#!/usr/bin/python
c_head = """
#include "h5core/h5_core.h"
"""
h_head = """
#ifndef __H5BLOCK_READWRITE_H
#define __H5BLOCK_READWRITE_H
"""
h_tail = """
#endif
"""
fc_head = """
#include <stdlib.h>
#include "h5core/h5_core.h"
#include "Underscore.h"
#if defined(F77_SINGLE_UNDERSCORE)
#define F77NAME(a,b) a
#elif defined(F77_CRAY_UNDERSCORE)
#define F77NAME(a,b) b
#elif defined(F77_NO_UNDERSCORE)
#else
#error Error, no way to determine how to construct fortran bindings
#endif
"""
write_scalar_h = """
h5_err_t
H5Block#DIM#dWriteScalarField#TYPE_ABV# (
h5_file_t *const f,
const char *name,
const h5_#TYPE_H5P#_t *buffer
);
"""
read_scalar_h = """
h5_err_t
H5Block#DIM#dReadScalarField#TYPE_ABV# (
h5_file_t *const f,
const char *name,
h5_#TYPE_H5P#_t *buffer
);
"""
write_scalar_c = """
/*!
\\ingroup h5block_data
Write a 3-dimensional field \\c name from the buffer starting at \\c data
to the current time-step using the defined field layout. Values are
#TYPE_FULL#.
You must use the Fortran indexing scheme to access items in \\c data.
\\return \\c H5_SUCCESS or error code
*/
h5_err_t
H5Block#DIM#dWriteScalarField#TYPE_ABV# (
h5_file_t *const f, /*!< IN: file handle */
const char *name, /*!< IN: name of dataset to write */
const h5_#TYPE_H5P#_t *buffer /*!< IN: pointer to write buffer */
) {
H5_API_ENTER3 (h5_err_t, "f=0x%p, name=\\"%s\\", buffer=0x%p",
f, name, buffer);
H5_API_RETURN (h5b_write_scalar_data(f, name, (void*)buffer, #TYPE_HDF5# ));
}
"""
read_scalar_c = """
/*!
\\ingroup h5block_data
Read a 3-dimensional field \\c name into the buffer starting at \\c data from
the current time-step using the defined field layout. Values are
#TYPE_FULL#.
You must use the Fortran indexing scheme to access items in \\c data.
\\return \\c H5_SUCCESS or error code
*/
h5_err_t
H5Block#DIM#dReadScalarField#TYPE_ABV# (
h5_file_t *const f, /*!< IN: file handle */
const char *name, /*!< IN: name of dataset to read */
h5_#TYPE_H5P#_t *buffer /*!< OUT: pointer to read buffer */
) {
H5_API_ENTER3 (h5_err_t, "f=0x%p, name=\\"%s\\", buffer=0x%p",
f, name, buffer);
H5_API_RETURN (h5b_read_scalar_data(f, name, (void*)buffer, #TYPE_HDF5#));
}
"""
write_scalar_fi = """
!> \\ingroup h5block_data_f
!! See \\ref H5Block#DIM#dWriteScalarField#TYPE_ABV#
!! \\return 0 on success or error code
!<
INTEGER*8 FUNCTION h5bl_#DIM#d_write_scalar_field_#TYPE_F90_ABV# ( filehandle, name, buffer )
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open
CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the dataset
#TYPE_F90#, INTENT(IN) :: buffer(*) !< the array of data
END FUNCTION
"""
read_scalar_fi = """
!> \\ingroup h5block_data_f
!! See \\ref H5Block#DIM#dReadScalarField#TYPE_ABV#
!! \\return 0 on success or error code
!<
INTEGER*8 FUNCTION h5bl_#DIM#d_read_scalar_field_#TYPE_F90_ABV# ( filehandle, name, buffer )
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open
CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the dataset
#TYPE_F90#, INTENT(OUT) :: buffer(*) !< buffer to read the data into
END FUNCTION
"""
write_scalar_fc = """
#if ! defined(F77_NO_UNDERSCORE)
#define h5bl_#DIM#d_write_scalar_field_#TYPE_F90_ABV# F77NAME ( \\
h5bl_#DIM#d_write_scalar_field_#TYPE_F90_ABV#_, \\
H5BL_#DIM#D_WRITE_SCALAR_FIELD_#TYPE_F90_ABVC# )
#endif
h5_err_t
h5bl_#DIM#d_write_scalar_field_#TYPE_F90_ABV# (
h5_int64_t *const f,
const char *name,
const h5_#TYPE_H5P#_t *buffer,
const int l_name
) {
h5_file_t *fh = h5_filehandlefor2c(f);
H5_API_ENTER4 (h5_err_t, "f=0x%p, name=\\"%s\\", buffer=0x%p, l_name=%d",
fh, name, buffer, l_name);
char *name2 = h5_strdupfor2c ( name, l_name );
h5_err_t herr = h5b_write_scalar_data (
fh, name2, (void*)buffer, #TYPE_HDF5# );
free ( name2 );
H5_API_RETURN(herr);
}
"""
read_scalar_fc = """
#if ! defined(F77_NO_UNDERSCORE)
#define h5bl_3d_read_scalar_field_#TYPE_F90_ABV# F77NAME ( \\
h5bl_3d_read_scalar_field_#TYPE_F90_ABV#_, \\
H5BL_#DIM#D_READ_SCALAR_FIELD_#TYPE_F90_ABVC# )
#endif
h5_err_t
h5bl_#DIM#d_read_scalar_field_#TYPE_F90_ABV# (
h5_int64_t *const f,
const char *name,
h5_#TYPE_H5P#_t *buffer,
const int l_name
) {
h5_file_t *fh = h5_filehandlefor2c(f);
H5_API_ENTER4 (h5_err_t, "f=0x%p, name=\\"%s\\", buffer=0x%p, l_name=%d",
fh, name, buffer, l_name);
char *name2 = h5_strdupfor2c ( name, l_name );
h5_err_t herr = h5b_read_scalar_data (
fh, name2, buffer, #TYPE_HDF5# );
free ( name2 );
H5_API_RETURN(herr);
}
"""
write_vector_h = """
h5_err_t
H5Block#DIM#dWriteVector3dField#TYPE_ABV# (
h5_file_t *const f,
const char *name,
const h5_#TYPE_H5P#_t *x_buf,
const h5_#TYPE_H5P#_t *y_buf,
const h5_#TYPE_H5P#_t *z_buf
);
"""
read_vector_h = """
h5_err_t
H5Block#DIM#dReadVector3dField#TYPE_ABV# (
h5_file_t *const f,
const char *name,
h5_#TYPE_H5P#_t *x_buf,
h5_#TYPE_H5P#_t *y_buf,
h5_#TYPE_H5P#_t *z_buf
);
"""
write_vector_c = """
/*!
\\ingroup h5block_data
*/
/*!
Write a 3-dimensional field \\c name with 3-dimensional vectors as values
from the buffers starting at \\c x_buf, \\c y_buf and \\c z_buf to the
current time-step using the defined field layout. Values are 3-dimensional
vectors with #TYPE_FULL# values.
You must use the Fortran indexing scheme to access items in \\c x_buf.
\\return \\c H5_SUCCESS or error code
*/
h5_err_t
H5Block#DIM#dWriteVector3dField#TYPE_ABV# (
h5_file_t *const f, /*!< IN: file handle */
const char *name, /*!< IN: name of dataset to write */
const h5_#TYPE_H5P#_t *x_buf, /*!< IN: pointer to X axis buffer */
const h5_#TYPE_H5P#_t *y_buf, /*!< IN: pointer to Y axis buffer */
const h5_#TYPE_H5P#_t *z_buf /*!< IN: pointer to Z axis buffer */
) {
H5_API_ENTER5 (h5_err_t, "f=0x%p, name=\\"%s\\", x_buf=0x%p, y_buf=0x%p, z_buf=0x%p",
f, name, x_buf, y_buf, z_buf);
H5_API_RETURN(h5b_write_vector3d_data(f, name,
(void*)x_buf, (void*)y_buf, (void*)z_buf, #TYPE_HDF5#));
}
"""
read_vector_c = """
/*!
\\ingroup h5block_data
*/
/*!
Read a 3-dimensional field \\c name with 3-dimensional vectors as values
from the buffers starting at \\c x_buf, \\c y_buf and \\c z_buf to the
current time-step using the defined field layout. Values are 3-dimensional
vectors with #TYPE_FULL# values.
You must use the Fortran indexing scheme to access items in \\c data.
\\return \\c H5_SUCCESS or error code
*/
h5_err_t
H5Block#DIM#dReadVector3dField#TYPE_ABV# (
h5_file_t *const f, /*!< IN: file handle */
const char *name, /*!< IN: name of dataset to write */
const h5_#TYPE_H5P#_t *x_buf, /*!< OUT: pointer to X axis buffer */
const h5_#TYPE_H5P#_t *y_buf, /*!< OUT: pointer to Y axis buffer */
const h5_#TYPE_H5P#_t *z_buf /*!< OUT: pointer to Z axis buffer */
) {
H5_API_ENTER5 (h5_err_t, "f=0x%p, name=\\"%s\\", x_buf=0x%p, y_buf=0x%p, z_buf=0x%p",
f, name, x_buf, y_buf, z_buf);
H5_API_RETURN(h5b_read_vector3d_data(f, name,
(void*)x_buf, (void*)y_buf, (void*)z_buf, #TYPE_HDF5#));
}
"""
write_vector_fi = """
!> \\ingroup h5block_data_f
!! See \\ref H5Block#DIM#dWriteVector3dField#TYPE_ABV#
!! \\return 0 on success or error code
!<
INTEGER*8 FUNCTION h5bl_#DIM#d_write_vector3d_field_#TYPE_F90_ABV# ( filehandle, name, x, y, z )
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open
CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the dataset
#TYPE_F90#, INTENT(IN) :: x(*) !< the array of x data to write
#TYPE_F90#, INTENT(IN) :: y(*) !< the array of y data to write
#TYPE_F90#, INTENT(IN) :: z(*) !< the array of z data to write
END FUNCTION
"""
read_vector_fi = """
!> \\ingroup h5block_data_f
!! See \\ref H5Block#DIM#dReadVector3dField#TYPE_ABV#
!! \\return 0 on success or error code
!<
INTEGER*8 FUNCTION h5bl_#DIM#d_read_vector3d_field_#TYPE_F90_ABV# ( filehandle, name, x, y, z )
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open
CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the dataset
#TYPE_F90#, INTENT(OUT) :: x(*) !< buffer to read the x data into
#TYPE_F90#, INTENT(OUT) :: y(*) !< buffer to read the y data into
#TYPE_F90#, INTENT(OUT) :: z(*) !< buffer to read the z data into
END FUNCTION
"""
write_vector_fc = """
#if ! defined(F77_NO_UNDERSCORE)
#define h5bl_#DIM#d_write_vector3d_field_#TYPE_F90_ABV# F77NAME ( \\
h5bl_#DIM#d_write_vector3d_field_#TYPE_F90_ABV#_, \\
H5BL_#DIM#D_WRITE_VECTOR3D_FIELD_#TYPE_F90_ABVC# )
#endif
h5_err_t
h5bl_#DIM#d_write_vector3d_field_#TYPE_F90_ABV# (
h5_int64_t *const f,
const char *name,
const h5_#TYPE_H5P#_t *x_buf,
const h5_#TYPE_H5P#_t *y_buf,
const h5_#TYPE_H5P#_t *z_buf,
const int l_name
) {
h5_file_t *fh = h5_filehandlefor2c(f);
H5_API_ENTER6 (h5_err_t, "f=0x%p, name=\\"%s\\", x_buf=0x%p, y_buf=0x%p, z_buf=0x%p, l_name=%d",
fh, name, x_buf, y_buf, z_buf, l_name);
char *name2 = h5_strdupfor2c ( name, l_name );
h5_err_t herr = h5b_write_vector3d_data (
fh, name2,
(void*)x_buf, (void*)y_buf, (void*)z_buf, #TYPE_HDF5# );
free ( name2 );
H5_API_RETURN(herr);
}
"""
read_vector_fc = """
#if ! defined(F77_NO_UNDERSCORE)
#define h5bl_#DIM#d_read_vector3d_field_#TYPE_F90_ABV# F77NAME ( \\
h5bl_#DIM#d_read_vector3d_field_#TYPE_F90_ABV#_, \\
H5BL_#DIM#D_READ_VECTOR3D_FIELD_#TYPE_F90_ABVC# )
#endif
h5_err_t
h5bl_#DIM#d_read_vector3d_field_#TYPE_F90_ABV# (
h5_int64_t *const f,
const char *name,
h5_#TYPE_H5P#_t *x_buf,
h5_#TYPE_H5P#_t *y_buf,
h5_#TYPE_H5P#_t *z_buf,
const int l_name
) {
h5_file_t *fh = h5_filehandlefor2c(f);
H5_API_ENTER6 (h5_err_t, "f=0x%p, name=\\"%s\\", x_buf=0x%p, y_buf=0x%p, z_buf=0x%p, l_name=%d",
fh, name, x_buf, y_buf, z_buf, l_name);
char *name2 = h5_strdupfor2c ( name, l_name );
h5_err_t herr = h5b_read_vector3d_data (
fh, name2,
(void*)x_buf, (void*)y_buf, (void*)z_buf, #TYPE_HDF5# );
free ( name2 );
H5_API_RETURN(herr);
}
"""
write_attr_h = """
h5_err_t
H5BlockWriteFieldAttrib#TYPE_ABV# (
h5_file_t *const f,
const char *field_name,
const char *attrib_name,
const h5_#TYPE_H5P#_t *buffer,
const h5_size_t nelems
);
"""
write_attr_c = """
/*!
\\ingroup h5block_attrib
Write #TYPE_H5P# \\c values as attribute \\c attrib_name of field
\\c field_name.
\\return \\c H5_SUCCESS or error code
*/
h5_err_t
H5BlockWriteFieldAttrib#TYPE_ABV# (
h5_file_t *const f, /*!< IN: file handle */
const char *field_name, /*!< IN: field name */
const char *attrib_name, /*!< IN: attribute name */
const h5_#TYPE_H5P#_t *buffer, /*!< IN: attribute values */
const h5_size_t nelems /*!< IN: number of elements */
) {
H5_API_ENTER5 (h5_err_t, "f=0x%p, field_name=\\"%s\\", attrib_name=\\"%s\\", "
"buffer=0x%p, nelems=%lld",
f, field_name, attrib_name, buffer, (long long)nelems);
H5_API_RETURN(h5_write_field_attrib (
f,
field_name,
attrib_name,
#TYPE_HDF5#,
buffer,
nelems ));
}
"""
write_attr_fi = """
!> \\ingroup h5block_attrib_f
!! See \\ref H5BlockWriteFieldAttrib#TYPE_ABV#
!! \\return 0 on success or error code
!<
INTEGER*8 FUNCTION h5bl_writefieldattrib_#TYPE_F90_ABV# ( filehandle, field_name, attrib_name, attrib_value, attrib_nelem)
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open
CHARACTER(LEN=*), INTENT(IN) :: field_name !< the name of the field
CHARACTER(LEN=*), INTENT(IN) :: attrib_name !< the name of the attribute
#TYPE_F90#, INTENT(IN) :: buffer(*) !< the array of data to write into the attribute
INTEGER*8, INTENT(IN) :: nelems !< the number of elements in the array
END FUNCTION
"""
write_attr_fc = """
#if ! defined(F77_NO_UNDERSCORE)
#define h5bl_writefieldattrib_#TYPE_F90_ABV# F77NAME ( \\
h5bl_writefieldattrib_#TYPE_F90_ABV#_, \\
H5BL_WRITEFIELDATTRIB_#TYPE_F90_ABVC# )
#endif
h5_err_t
h5bl_writefieldattrib_#TYPE_F90_ABV# (
h5_int64_t *const f,
const char *field_name,
const char *attrib_name,
const h5_#TYPE_H5P#_t *buffer,
const h5_size_t *nelems,
const int l_field_name,
const int l_attrib_name
) {
h5_file_t *fh = h5_filehandlefor2c(f);
H5_API_ENTER7 (h5_err_t, "f=0x%p, field_name=\\"%s\\", attrib_name=\\"%s\\", "
"buffer=0x%p, nelems=%lld, l_field_name=%d, l_attrib_name=%d",
fh, field_name, attrib_name, buffer, (long long)*nelems,
l_field_name, l_attrib_name);
char *field_name2 = h5_strdupfor2c ( field_name, l_field_name );
char *attrib_name2 = h5_strdupfor2c ( attrib_name, l_attrib_name );
h5_err_t herr = h5_write_field_attrib (
fh, field_name2, attrib_name2,
#TYPE_HDF5#, buffer, *nelems );
free ( field_name2 );
free ( attrib_name2 );
H5_API_RETURN(herr);
}
"""
read_attr_h = """
h5_err_t
H5BlockReadFieldAttrib#TYPE_ABV# (
h5_file_t *const f,
const char *field_name,
const char *attrib_name,
h5_#TYPE_H5P#_t *buffer
);
"""
read_attr_c = """
/*!
\\ingroup h5block_attrib
Read #TYPE_H5P# values from attribute \\c attrib_name of field
\\c field_name into a \\c buffer.
\\return \\c H5_SUCCESS or error code
*/
h5_err_t
H5BlockReadFieldAttrib#TYPE_ABV# (
h5_file_t *const f, /*!< IN: file handle */
const char *field_name, /*!< IN: field name */
const char *attrib_name, /*!< IN: attribute name */
h5_#TYPE_H5P#_t *buffer /*!< OUT: attribute values */
) {
H5_API_ENTER4 (h5_err_t, "f=%p, field_name=\\\"%s\\", attrib_name=\\"%s\\", buffer=0x%p",
f, field_name, attrib_name, buffer);
H5_API_RETURN(h5_read_field_attrib (
f,
field_name,
attrib_name,
#TYPE_HDF5#,
(void*)buffer ));
}
"""
read_attr_fi = """
!> \\ingroup h5block_attrib_f
!! See \\ref H5BlockReadFieldAttrib#TYPE_ABV#
!! \\return 0 on success or error code
!<
INTEGER*8 FUNCTION h5bl_readfieldattrib_#TYPE_F90_ABV# ( filehandle, field_name, attrib_name, attrib_value, attrib_nelem)
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open
CHARACTER(LEN=*), INTENT(IN) :: field_name !< the name of the field
CHARACTER(LEN=*), INTENT(IN) :: attrib_name !< the name of the attribute
#TYPE_F90#, INTENT(IN) :: buffer(*) !< the buffer to read into
END FUNCTION
"""
read_attr_fc = """
#if ! defined(F77_NO_UNDERSCORE)
#define h5bl_readfieldattrib_#TYPE_F90_ABV# F77NAME ( \\
h5bl_readfieldattrib_#TYPE_F90_ABV#_, \\
H5BL_READFIELDATTRIB_#TYPE_F90_ABVC# )
#endif
h5_err_t
h5bl_readfieldattrib_#TYPE_F90_ABV# (
h5_int64_t *const f,
const char *field_name,
const char *attrib_name,
h5_#TYPE_H5P#_t *buffer,
const int l_field_name,
const int l_attrib_name
) {
h5_file_t *fh = h5_filehandlefor2c(f);
H5_API_ENTER6 (h5_err_t, "f=0x%p, field_name=\\"%s\\", attrib_name=\\"%s\\", "
"values=0x%p, l_field_name=%d, l_attrib_name=%d",
fh, field_name, attrib_name, buffer,
l_field_name, l_attrib_name);
char *field_name2 = h5_strdupfor2c ( field_name, l_field_name );
char *attrib_name2 = h5_strdupfor2c ( attrib_name, l_attrib_name );
h5_err_t herr = h5_read_field_attrib (
fh, field_name2, attrib_name2, #TYPE_HDF5#, buffer );
free ( field_name2 );
free ( attrib_name2 );
H5_API_RETURN(herr);
}
"""
dims = ["3"]
types = [
["floating points (64-bit)", "Float64", "float64", "H5T_NATIVE_DOUBLE", "REAL*8", "r8", "R8"],
["floating points (32-bit)", "Float32", "float32", "H5T_NATIVE_FLOAT", "REAL*4", "r4", "R4"],
["integers (64-bit)", "Int64", "int64", "H5T_NATIVE_INT64", "INTEGER*8", "i8", "I8"],
["integers (32-bit)", "Int32", "int32", "H5T_NATIVE_INT32", "INTEGER*4", "i4", "I4"]
]
def create_call(template, type, dim):
fcn = template
fcn = fcn.replace('#DIM#',dim)\
.replace('#TYPE_FULL#',type[0])\
.replace('#TYPE_ABV#',type[1])\
.replace('#TYPE_H5P#',type[2])\
.replace('#TYPE_HDF5#',type[3])\
.replace('#TYPE_F90#',type[4])\
.replace('#TYPE_F90_ABV#',type[5])\
.replace('#TYPE_F90_ABVC#',type[6])
return fcn
def write_calls():
cfile = file('H5Block_readwrite.c','w')
cfile.write(c_head)
hfile = file('../include/H5Block_readwrite.h','w')
hfile.write(h_head)
fcfile = file('../Fortran/H5Block_readwrite_F.c','w')
fcfile.write(fc_head)
fifile = file('../Fortran/H5Block_readwrite.f90','w')
for dim in dims:
for type in types:
cfile.write(create_call(write_scalar_c,type,dim));
cfile.write(create_call(read_scalar_c,type,dim));
hfile.write(create_call(write_scalar_h,type,dim));
hfile.write(create_call(read_scalar_h,type,dim));
fcfile.write(create_call(write_scalar_fc,type,dim));
fcfile.write(create_call(read_scalar_fc,type,dim));
fifile.write(create_call(write_scalar_fi,type,dim));
fifile.write(create_call(read_scalar_fi,type,dim));
cfile.write(create_call(write_vector_c,type,dim));
cfile.write(create_call(read_vector_c,type,dim));
hfile.write(create_call(write_vector_h,type,dim));
hfile.write(create_call(read_vector_h,type,dim));
fcfile.write(create_call(write_vector_fc,type,dim));
fcfile.write(create_call(read_vector_fc,type,dim));
fifile.write(create_call(write_vector_fi,type,dim));
fifile.write(create_call(read_vector_fi,type,dim));
for type in types:
cfile.write(create_call(write_attr_c,type,""));
hfile.write(create_call(write_attr_h,type,""));
fifile.write(create_call(write_attr_fi,type,""));
fcfile.write(create_call(write_attr_fc,type,""));
cfile.write(create_call(read_attr_c,type,""));
hfile.write(create_call(read_attr_h,type,""));
fifile.write(create_call(read_attr_fi,type,""));
fcfile.write(create_call(read_attr_fc,type,""));
cfile.close()
hfile.write(h_tail)
hfile.close()
fcfile.close()
fifile.close()
write_calls()
+276
View File
@@ -0,0 +1,276 @@
/*
Copyright (c) 2006-2015, The Regents of the University of California,
through Lawrence Berkeley National Laboratory (subject to receipt of any
required approvals from the U.S. Dept. of Energy) and the Paul Scherrer
Institut (Switzerland). All rights reserved.
License: see file COPYING in top level of source distribution.
*/
#include "h5_private.h"
#include "h5core/h5_init.h"
#include "h5core/h5_debug.h"
#include "h5core/h5_file.h"
#include <hdf5.h>
#define h5_createprop_file FC_MANGLING( \
h5_createprop_file, \
H5_CREATEPROP_FILE)
h5_int64_t
h5_createprop_file (
void
) {
H5_API_ENTER (h5_int64_t, "%s", "");
H5_API_RETURN ((h5_int64_t)h5_create_prop (H5_PROP_FILE));
}
#if defined(PARALLEL_IO)
#define h5_setprop_file_mpio FC_MANGLING( \
h5_setprop_file_mpio, \
H5_SETPROP_FILE_MPIO)
h5_int64_t
h5_setprop_file_mpio (
h5_int64_t* _prop,
MPI_Fint* _comm
) {
H5_API_ENTER (h5_int64_t,
"prop=%lld, comm=%lld",
(long long int)*_prop, (long long int)*_comm);
h5_prop_t prop = (h5_prop_t)*_prop;
MPI_Comm comm = MPI_Comm_f2c (*_comm);
H5_API_RETURN ((h5_int64_t)h5_set_prop_file_mpio_collective (prop, &comm));
}
#define h5_setprop_file_mpio_collective FC_MANGLING( \
h5_setprop_file_mpio_collective, \
H5_SETPROP_FILE_MPIO_COLLECTIVE)
h5_int64_t
h5_setprop_file_mpio_collective (
h5_int64_t* _prop,
MPI_Fint* _comm
) {
H5_API_ENTER (h5_int64_t,
"prop=%lld, comm=%lld",
(long long int)*_prop, (long long int)*_comm);
h5_prop_t prop = (h5_prop_t)*_prop;
MPI_Comm comm = MPI_Comm_f2c (*_comm);
H5_API_RETURN ((h5_int64_t)h5_set_prop_file_mpio_collective (prop, &comm));
}
#define h5_setprop_file_mpio_independent FC_MANGLING( \
h5_setprop_file_mpio_independent, \
H5_SETPROP_FILE_MPIO_INDEPENDENT)
h5_int64_t
h5_setprop_file_mpio_independent (
h5_int64_t* _prop,
MPI_Fint* _comm
) {
H5_API_ENTER (h5_int64_t,
"prop=%lld, comm=%lld",
(long long int)*_prop, (long long int)*_comm);
h5_prop_t prop = (h5_prop_t)*_prop;
MPI_Comm comm = MPI_Comm_f2c (*_comm);
H5_API_RETURN ((h5_int64_t)h5_set_prop_file_mpio_independent (prop, &comm));
}
#if H5_VERSION_LE(1,8,12)
#define h5_setprop_file_mpio_posix FC_MANGLING( \
h5_setprop_file_mpio_posix, \
H5_SETPROP_FILE_MPIO_POSIX)
h5_int64_t
h5_setprop_file_mpio_posix (
h5_int64_t* _prop,
MPI_Fint* _comm
) {
H5_API_ENTER (h5_int64_t,
"prop=%lld, comm=%lld",
(long long int)*_prop, (long long int)*_comm);
h5_prop_t prop = (h5_prop_t)*_prop;
MPI_Comm comm = MPI_Comm_f2c (*_comm);
H5_API_RETURN ((h5_int64_t)h5_set_prop_file_mpio_posix (prop, &comm));
}
#endif
#endif
#define h5_setprop_file_corevfd FC_MANGLING( \
h5_setprop_file_corevfd, \
H5_SETPROP_FILE_COREVFD)
h5_int64_t
h5_setprop_file_corevfd (
h5_int64_t* _prop,
h5_int64_t* increment
) {
H5_API_ENTER (h5_int64_t,
"prop=%lld, increment=%lld",
(long long int)*_prop, (long long int)*increment);
h5_prop_t prop = (h5_prop_t)*_prop;
H5_API_RETURN ((h5_int64_t)h5_set_prop_file_core_vfd (prop, *increment));
}
#define h5_setprop_file_align FC_MANGLING ( \
h5_setprop_file_align, \
H5_SETPROP_FILE_ALIGN)
h5_int64_t
h5_setprop_file_align (
h5_int64_t* _prop,
h5_int64_t* align
) {
H5_API_ENTER (h5_err_t,
"prop=%lld, align=%lld",
(long long int)*_prop, (long long int)*align);
h5_prop_t prop = (h5_prop_t)*_prop;
H5_API_RETURN (h5_set_prop_file_align (prop, *align));
}
#define h5_setprop_file_throttle FC_MANGLING ( \
h5_setprop_file_throttle, \
H5_SETPROP_FILE_THROTTLE)
h5_int64_t
h5_setprop_file_throttle (
h5_int64_t* _prop,
h5_int64_t* throttle
) {
H5_API_ENTER (
h5_err_t,
"prop=%lld, throttle=%lld",
(long long int)*_prop, (long long int)*throttle);
h5_prop_t prop = (h5_prop_t)*_prop;
H5_API_RETURN (h5_set_prop_file_throttle (prop, *throttle));
}
#define h5_closeprop FC_MANGLING ( \
h5_closeprop, \
H5_CLOSEPROP)
h5_int64_t
h5_closeprop (
h5_int64_t* _prop
) {
H5_API_ENTER (h5_err_t,
"prop=%lld",
(long long int)*_prop);
h5_prop_t prop = (h5_prop_t)*_prop;
H5_API_RETURN (h5_close_prop (prop));
}
#define h5_openfile FC_MANGLING( \
h5_openfile, \
H5_OPENFILE)
h5_int64_t
h5_openfile (
const char* _fname,
h5_int64_t* _mode,
h5_int64_t* _props,
const int _len_fname
) {
int len_fname = strlenf (_fname, _len_fname);
H5_API_ENTER (h5_int64_t,
"fname = %*s, mode=%lld, props=%lld",
len_fname, _fname, (long long int)*_mode, (long long int)*_props);
char* fname = h5_strdupfor2c (_fname, _len_fname);
h5_int64_t mode = *_mode;
h5_prop_t props = (h5_prop_t)*_props;
h5_file_t f = h5_open_file2 (fname, mode, props);
free (fname);
H5_API_RETURN ((h5_int64_t)f);
}
#define h5_closefile FC_MANGLING( \
h5_closefile, \
H5_CLOSEFILE)
h5_int64_t
h5_closefile (
const h5_int64_t *f
) {
h5_file_t fh = h5_filehandlefor2c(f);
H5_API_ENTER (h5_int64_t, "f=%p", (h5_file_p)fh);
H5_API_RETURN (h5_close_file (fh));
}
#define h5_checkfile FC_MANGLING( \
h5_checkfile, \
H5_CHECKFILE)
h5_int64_t
h5_checkfile (
const h5_int64_t *f
) {
h5_file_t fh = h5_filehandlefor2c(f);
H5_API_ENTER (h5_int64_t, "f=%p", (h5_file_p)fh);
H5_API_RETURN (h5_check_filehandle (fh));
}
#define h5_flushfile FC_MANGLING( \
h5_flushfile, \
H5_FLUSHFILE)
h5_int64_t
h5_flushfile (
const h5_int64_t* f
) {
h5_file_t fh = h5_filehandlefor2c(f);
H5_API_ENTER (h5_int64_t, "f=%p", (h5_file_p)fh);
H5_API_RETURN (h5_flush_file (fh));
}
#define h5_flushstep FC_MANGLING( \
h5_flushstep, \
H5_FLUSHSTEP)
h5_int64_t
h5_flushstep (
const h5_int64_t* f
) {
h5_file_t fh = h5_filehandlefor2c(f);
H5_API_ENTER (h5_int64_t, "f=%p", (h5_file_p)fh);
H5_API_RETURN (h5_flush_step (fh));
}
#define h5_finalize FC_MANGLING( \
h5_finalize, \
H5_FINALIZE)
h5_int64_t
h5_finalize (
void
) {
H5_API_ENTER (h5_int64_t, "%s", "");
H5_API_RETURN (h5_close_hdf5());
}
/* debug output */
#define h5_set_verbosity_level FC_MANGLING( \
h5_set_verbosity_level, \
H5_SET_VERBOSITY_LEVEL)
h5_int64_t
h5_set_verbosity_level (
const h5_int64_t *level
) {
H5_API_ENTER (h5_int64_t, "level=%lld", (long long)*level);
H5_API_RETURN(h5_set_debuglevel (*level));
}
#define h5_abort_on_error FC_MANGLING( \
h5_abort_on_error, \
H5_ABORT_ON_ERROR)
h5_int64_t
h5_abort_on_error (
void
) {
H5_API_ENTER (h5_int64_t, "%s", "");
h5_set_debuglevel (1);
H5_API_RETURN (h5_set_errorhandler (h5_abort_errorhandler));
}
#define h5_get_error_number FC_MANGLING( \
h5_get_error_number, \
H5_GET_ERROR_NUMBER)
h5_int64_t
h5_get_error_number (
void
) {
H5_API_ENTER (h5_int64_t, "%s", "");
H5_API_RETURN (h5_get_errno ());
}
-119
View File
@@ -1,119 +0,0 @@
!!!!!!!! File Opening and Closing !!!!!!!!
!> \ingroup h5hut_file_f
!! Opens a file for reading. See \ref H5OpenFile
!! \return 0 on success or error code
!<
INTEGER*8 FUNCTION h5_openr ( filename )
CHARACTER(LEN=*), INTENT(IN) :: filename !< the filename to open for reading
END FUNCTION
!> \ingroup h5hut_file_f
!! Opens a file for writing in truncate mode. See \ref H5OpenFile
!! \return 0 on success or error code
!<
INTEGER*8 FUNCTION h5_openw ( filename )
CHARACTER(LEN=*), INTENT(IN) :: filename !< the filename to open for writing
END FUNCTION
!> \ingroup h5hut_file_f
!! Opens a file for writing in append mode. See \ref H5OpenFile
!! \return 0 on success or error code
!<
INTEGER*8 FUNCTION h5_opena ( filename )
CHARACTER(LEN=*), INTENT(IN) :: filename !< the filename to open for appending
END FUNCTION
!> \ingroup h5hut_file_f
!! Opens a parallel file for reading.
!! See \ref H5OpenFile
!!
!! Flags are specified as a comma separated string that can include:
!!
!! - \c vfd_mpiposix - use the HDF5 MPI-POSIX virtual file driver
!! - \c vfd_indendent - use MPI-IO in indepedent mode
!!
!! \return 0 on success or error code
!<
INTEGER*8 FUNCTION h5_openr_par_align ( filename, mpi_communicator, align )
CHARACTER(LEN=*), INTENT(IN) :: filename !< the filename to open for reading
INTEGER, INTENT(IN) :: mpi_communicator !< the MPI_Communicator used by the program
CHARACTER(LEN=*), INTENT(IN) :: flags !< additional flags
END FUNCTION
!> \ingroup h5hut_file_f
!! Opens a parallel file for writing.
!! See \ref H5OpenFile
!!
!! Flags are specified as a comma separated string that can include:
!!
!! - \c vfd_mpiposix - use the HDF5 MPI-POSIX virtual file driver
!! - \c vfd_indendent - use MPI-IO in indepedent mode
!!
!! \return 0 on success or error code
!<
INTEGER*8 FUNCTION h5_openw_par_align ( filename, mpi_communicator, align, flags )
CHARACTER(LEN=*), INTENT(IN) :: filename !< the filename to open for writing
INTEGER, INTENT(IN) :: mpi_communicator !< the MPI_Communicator used by the program
CHARACTER(LEN=*), INTENT(IN) :: flags !< additional flags
END FUNCTION
!> \ingroup h5hut_file_f
!! Opens a parallel file for writing in append mode.
!! See \ref H5OpenFile
!!
!! Flags are specified as a comma separated string that can include:
!!
!! - \c vfd_mpiposix - use the HDF5 MPI-POSIX virtual file driver
!! - \c vfd_indendent - use MPI-IO in indepedent mode
!!
!! \return 0 on success or error code
!<
INTEGER*8 FUNCTION h5_opena_par_align ( filename, mpi_communicator, align, flags )
CHARACTER(LEN=*), INTENT(IN) :: filename !< the filename to open for appending
INTEGER, INTENT(IN) :: mpi_communicator !< the MPI_Communicator used by the program
CHARACTER(LEN=*), INTENT(IN) :: flags !< additional flags
END FUNCTION
!> \ingroup h5hut_file_f
!! Closes a file. See \ref H5CloseFile
!! \return 0 on success or error code
!<
INTEGER*8 FUNCTION h5_close ( filehandle )
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned during file open
END FUNCTION
!> \ingroup h5hut_file_f
!! Checks that a file is valid. See \ref H5CheckFile
!! \return 0 on success or error code
!<
INTEGER*8 FUNCTION h5_check ( filehandle )
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned during file open
END FUNCTION
!> \ingroup h5hut_file_f
!! See \ref H5SetVerbosityLevel
!! \return 0 on success or error code
!<
INTEGER*8 FUNCTION h5_set_verbosity_level ( level )
INTEGER*8, INTENT(IN) :: level !< the level from 0 (no output) to 5 (most detailed)
END FUNCTION
!> \ingroup h5hut_model_f
!! See \ref H5SetStep
!! \return 0 on success or error code
!<
INTEGER*8 FUNCTION h5_setstep (filehandle,step)
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned during file open
INTEGER*8, INTENT(IN) :: step !< a timestep value >= 1
END FUNCTION
!> \ingroup h5hut_model_f
!! See \ref H5GetNumSteps
!! \return the number of steps or error code
!<
INTEGER*8 FUNCTION h5_getnsteps (filehandle)
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned during file open
END FUNCTION
-131
View File
@@ -1,131 +0,0 @@
!!!!!!!! Setting up the Data Model !!!!!!!!
!> \ingroup h5block_model_f
!! See \ref H5Block3dSetView
!! \return 0 on success or error code
!<
INTEGER*8 FUNCTION h5bl_3d_setview ( filehandle, i_start, i_end, j_start, j_end, k_start, k_end )
INTEGER*8, INTENT(IN) :: filehandle
INTEGER*8, INTENT(IN) :: i_start
INTEGER*8, INTENT(IN) :: i_end
INTEGER*8, INTENT(IN) :: j_start
INTEGER*8, INTENT(IN) :: j_end
INTEGER*8, INTENT(IN) :: k_start
INTEGER*8, INTENT(IN) :: k_end
END FUNCTION
!> \ingroup h5block_model_f
!! See \ref H5Block3dGetView
!! \return 0 on success or error code
!<
INTEGER*8 FUNCTION h5bl_3d_getview ( filehandle, i_start, i_end, j_start, j_end, k_start, k_end )
INTEGER*8, INTENT(IN) :: filehandle
INTEGER*8, INTENT(OUT) :: i_start
INTEGER*8, INTENT(OUT) :: i_end
INTEGER*8, INTENT(OUT) :: j_start
INTEGER*8, INTENT(OUT) :: j_end
INTEGER*8, INTENT(OUT) :: k_start
INTEGER*8, INTENT(OUT) :: k_end
END FUNCTION
!> \ingroup h5block_model_f
!! See \ref H5Block3dSetChunk
!! \return 0 on success or error code
!<
INTEGER*8 FUNCTION h5bl_3d_setchunk ( filehandle, i, j, k )
INTEGER*8, INTENT(IN) :: filehandle
INTEGER*8, INTENT(IN) :: i
INTEGER*8, INTENT(IN) :: j
INTEGER*8, INTENT(IN) :: k
END FUNCTION
!> \ingroup h5block_model_f
!! See \ref H5Block3dGetReducedView
!! \return 0 on success or error code
!<
INTEGER*8 FUNCTION h5bl_3d_getreducedview ( filehandle, i_start, i_end, j_start, j_end, k_start, k_end )
INTEGER*8, INTENT(IN) :: filehandle
INTEGER*8, INTENT(OUT) :: i_start
INTEGER*8, INTENT(OUT) :: i_end
INTEGER*8, INTENT(OUT) :: j_start
INTEGER*8, INTENT(OUT) :: j_end
INTEGER*8, INTENT(OUT) :: k_start
INTEGER*8, INTENT(OUT) :: k_end
END FUNCTION
!> \ingroup h5block_model_f
!! See \ref H5Block3dHasView
!! \return rank of processor error code
!<
INTEGER*8 FUNCTION h5bl_3d_hasview ( filehandle )
INTEGER*8, INTENT(IN) :: filehandle
END FUNCTION
!> \ingroup h5block_model_f
!! See \ref H5BlockGetNumFields
!! \return number of fields or error code
!<
INTEGER*8 FUNCTION h5bl_getnumfields ( filehandle )
INTEGER*8, INTENT(IN) :: filehandle
END FUNCTION
!> \ingroup h5block_model_f
!! See \ref H5BlockGetFieldInfo
!! \return 0 on success or error code
!<
INTEGER*8 FUNCTION h5bl_getfieldinfo ( filehandle, idx, field_name, grid_rank, grid_dims, field_dims )
INTEGER*8, INTENT(IN) :: filehandle
INTEGER*8, INTENT(IN) :: idx
CHARACTER(LEN=*), INTENT(OUT) :: field_name
INTEGER*8, INTENT(OUT) :: grid_rank
INTEGER*8, INTENT(OUT) :: grid_dims(*)
INTEGER*8, INTENT(OUT) :: field_dims
INTEGER*8, INTENT(OUT) :: type
END FUNCTION
!!!!!!!! Reading and Writing Attributes !!!!!!!!
!> \ingroup h5block_attrib_f
!! See \ref H5BlockWriteFieldAttribString
!! \return 0 on success or error code
!<
INTEGER*8 FUNCTION h5bl_writefieldattrib_string ( filehandle, field_name, attrib_name, attrib_value )
INTEGER*8, INTENT(IN) :: filehandle
CHARACTER(LEN=*), INTENT(IN) :: field_name ! The name of the field
CHARACTER(LEN=*), INTENT(IN) :: attrib_name ! The name of the attribute
CHARACTER(LEN=*), INTENT(IN) :: attrib_value ! The array of data to write into the attribute
END FUNCTION
!> \ingroup h5block_attrib_f
!! See \ref H5BlockGetNumFieldAttribs
!! \return number of attributes or error code
!<
INTEGER*8 FUNCTION h5bl_getnfieldattribs ( filehandle, field_name )
INTEGER*8, INTENT(IN) :: filehandle
CHARACTER(LEN=*), INTENT(IN) :: field_name ! The name of the field
END FUNCTION
!> \ingroup h5block_attrib_f
!! See \ref H5BlockGetFieldAttribInfo
!! \return 0 on success or error code
!<
INTEGER*8 FUNCTION h5bl_getfieldattribinfo ( filehandle, field_name, idx, attrib_name, attrib_nelem)
INTEGER*8,INTENT(IN) :: filehandle
CHARACTER(LEN=*), INTENT(IN) :: field_name ! The name of the field
INTEGER*8,INTENT(IN) :: idx ! index of the attribute being queried
CHARACTER(LEN=*), INTENT(OUT):: attrib_name ! The name of the attribute
INTEGER*8,INTENT(OUT):: attrib_nelem ! Number of elements in the attrib array
END FUNCTION
!> \ingroup h5block_attrib_f
!! See \ref H5BlockReadFieldAttribString
!! \return 0 on success or error code
!<
INTEGER*8 FUNCTION h5bl_readfieldattrib_string ( filehandle, field_name, attrib_name, attrib_value )
INTEGER*8, INTENT(IN) :: filehandle
CHARACTER(LEN=*), INTENT(IN) :: field_name ! The name of the field
CHARACTER(LEN=*), INTENT(IN) :: attrib_name ! name of the attribute to read
CHARACTER(LEN=*), INTENT(IN) :: attrib_value ! The array of data to write into the attribute
END FUNCTION
-320
View File
@@ -1,320 +0,0 @@
#include <stdlib.h>
#include <string.h>
#include "h5core/h5_core.h"
#include "Underscore.h"
#if defined(F77_SINGLE_UNDERSCORE)
#define F77NAME(a,b) a
#elif defined(F77_CRAY_UNDERSCORE)
#define F77NAME(a,b) b
#elif defined(F77_NO_UNDERSCORE)
#else
#error Error, no way to determine how to construct fortran bindings
#endif
#if ! defined(F77_NO_UNDERSCORE)
#define h5bl_3d_setview F77NAME ( \
h5bl_3d_setview_, \
H5BL_3D_SETVIEW )
#define h5bl_3d_getview F77NAME ( \
h5bl_3d_getview_, \
H5BL_3D_GETVIEW )
#define h5bl_3d_setchunk F77NAME ( \
h5bl_3d_setchunk_, \
H5BL_3D_SETCHUNK )
#define h5bl_3d_getreducedview F77NAME ( \
h5bl_3d_getreducedview_,\
H5BL_3D_GETREDUCEDVIEW )
#define h5bl_3d_hasview F77NAME ( \
h5bl_hasview_, \
H5BL_HASVIEW )
#define h5bl_getnumfields F77NAME ( \
h5bl_getnumfields_, \
H5BL_GETNUMFIELDS )
#define h5bl_getfieldinfo F77NAME ( \
h5bl_getfieldinfo_, \
H5BL_GETFIELDINFO )
#define h5bl_writefieldattrib_string F77NAME ( \
h5bl_writefieldattrib_string_, \
H5BL_WRITEFIELDATTRIB_STRING )
#define h5bl_getnfieldattribs F77NAME ( \
h5bl_getnfieldattribs_, \
H5BL_GETNFIELDATTRIBS )
#define h5bl_getfieldattribinfo F77NAME ( \
h5bl_getfieldattribinfo_, \
h5bl_getfieldattribinfo )
#define h5bl_readfieldattrib_string F77NAME ( \
h5bl_readfieldattrib_string_, \
H5BL_READFIELDATTRIB_STRING )
#endif
h5_err_t
h5bl_3d_setview (
h5_int64_t *const f,
const h5_int64_t *i_start, /*!< start index of i */
const h5_int64_t *i_end, /*!< end index of i */
const h5_int64_t *j_start, /*!< start index of j */
const h5_int64_t *j_end, /*!< end index of j */
const h5_int64_t *k_start, /*!< start index of k */
const h5_int64_t *k_end /*!< end index of k */
) {
h5_file_t *fh = h5_filehandlefor2c(f);
H5_API_ENTER (h5_err_t,
"f=%p, "
"i_start=%lld, i_end=%lld, "
"j_start=%lld, j_end=%lld, "
"k_start=%lld, k_end=%lld",
fh,
(long long)i_start, (long long)i_end,
(long long)j_start, (long long)j_end,
(long long)k_start, (long long)k_end);
H5_API_RETURN(h5b_3d_set_view (
fh,
*i_start-1, *i_end-1,
*j_start-1, *j_end-1,
*k_start-1, *k_end-1 ));
}
h5_err_t
h5bl_3d_setchunk (
h5_int64_t *const f,
const h5_int64_t *i,
const h5_int64_t *j,
const h5_int64_t *k
) {
h5_file_t *fh = h5_filehandlefor2c(f);
H5_API_ENTER (h5_err_t,
"f=%p, i=%lld, j=%lld, k=%lld",
fh, (long long)i, (long long)j, (long long)k);
H5_API_RETURN(h5b_3d_set_chunk ( fh, *i, *j, *k ));
}
h5_err_t
h5bl_3d_getview (
h5_int64_t *const f,
h5_int64_t *const i_start,
h5_int64_t *const i_end,
h5_int64_t *const j_start,
h5_int64_t *const j_end,
h5_int64_t *const k_start,
h5_int64_t *const k_end
) {
h5_file_t *fh = h5_filehandlefor2c(f);
H5_API_ENTER (h5_err_t,
"f=%p, "
"i_start=%p, i_end=%p, "
"j_start=%p, j_end=%p, "
"k_start=%p, k_end=%p",
fh,
i_start, i_end,
j_start, j_end,
k_start, k_end);
H5_API_RETURN (h5b_3d_get_view (
fh,
i_start, i_end, j_start, j_end, k_start, k_end ));
}
h5_err_t
h5bl_3d_getreducedview (
h5_int64_t *const f,
h5_int64_t *const i_start,
h5_int64_t *const i_end,
h5_int64_t *const j_start,
h5_int64_t *const j_end,
h5_int64_t *const k_start,
h5_int64_t *const k_end
) {
h5_file_t *fh = h5_filehandlefor2c(f);
H5_API_ENTER (h5_err_t,
"f=%p, "
"i_start=%p, i_end=%p, "
"j_start=%p, j_end=%p, "
"k_start=%p, k_end=%p",
fh,
i_start, i_end,
j_start, j_end,
k_start, k_end);
H5_API_RETURN(h5b_3d_get_reduced_view (
fh,
i_start, i_end, j_start, j_end, k_start, k_end ));
}
h5_int64_t
h5bl_3d_hasview (
h5_int64_t *const f
) {
h5_file_t *fh = h5_filehandlefor2c(f);
H5_API_ENTER (h5_int64_t, "f=%p", fh);
H5_API_RETURN (h5b_3d_has_view ( fh ));
}
h5_err_t
h5bl_getnumfields (
h5_int64_t *const f
) {
h5_file_t *fh = h5_filehandlefor2c(f);
H5_API_ENTER (h5_int64_t, "f=%p", fh);
H5_API_RETURN (h5b_get_num_fields ( fh ));
}
h5_err_t
h5bl_getfieldinfo (
h5_int64_t *const f,
const h5_int64_t *idx,
char *name,
h5_size_t *field_rank,
h5_size_t *field_dims,
h5_size_t *elem_rank,
h5_int64_t *type,
const int l_name
) {
h5_file_t *fh = h5_filehandlefor2c(f);
H5_API_ENTER (h5_err_t,
"f=%p, idx=%lld, "
"name=%p,"
"field_rank=%p, field_dims=%p, elem_rank=%p, type=%p, l_name=%d",
fh, (long long)*idx, name,
field_rank, field_dims, elem_rank, type, l_name);
h5_err_t herr = h5b_get_field_info (
fh, *idx, name, (h5_size_t)l_name,
field_rank, field_dims, elem_rank, type );
h5_strc2for ( name, l_name );
H5_API_RETURN(herr);
}
h5_err_t
h5bl_writefieldattrib_string (
h5_int64_t *const f,
const char *field_name,
const char *attrib_name,
const char *buffer,
const int l_field_name,
const int l_attrib_name,
const int l_buffer
) {
h5_file_t *fh = h5_filehandlefor2c(f);
char *field_name2 = h5_strdupfor2c ( field_name, l_field_name );
char *attrib_name2 = h5_strdupfor2c ( attrib_name, l_attrib_name );
char *buffer2 = h5_strdupfor2c ( buffer, l_buffer );
H5_API_ENTER (h5_err_t,
"f=%p, "
"field_name='%s', "
"attrib_name='%s', "
"buffer='%s', "
"l_field_name=%d, "
"l_attrib_name=%d, "
"l_buffer=%d",
fh,
field_name2,
attrib_name2,
buffer2, l_field_name, l_attrib_name, l_buffer);
h5_err_t herr = h5_write_field_attrib (
fh, field_name2, attrib_name2,
H5_STRING_T, buffer2, strlen(buffer2)+1 );
free ( field_name2 );
free ( attrib_name2 );
free ( buffer2 );
H5_API_RETURN(herr);
}
h5_err_t
h5bl_getnfieldattribs (
h5_int64_t *const f,
const char *name,
const int l_name
) {
h5_file_t *fh = h5_filehandlefor2c(f);
char *name2 = h5_strdupfor2c ( name, l_name );
H5_API_ENTER (h5_err_t,
"f=%p, name='%s', l_name=%d", fh, name2, l_name);
h5_err_t herr = h5b_get_num_field_attribs ( fh, name2 );
free ( name2 );
H5_API_RETURN(herr);
}
h5_err_t
h5bl_getfieldattribinfo (
h5_int64_t *const f,
const char *field_name,
const h5_int64_t *attrib_idx,
char *attrib_name,
h5_size_t *attrib_nelem,
const int l_field_name,
const int l_attrib_name
) {
h5_file_t *fh = h5_filehandlefor2c(f);
char *field_name2 = h5_strdupfor2c ( field_name, l_field_name );
H5_API_ENTER (h5_err_t,
"f=%p field_name='%s', "
"attrib_idx=%lld, "
"attrib_name=%p, "
"attrib_nelem=%p, l_field_name=%d, l_attrib_name=%d",
fh,
field_name2,
(long long)*attrib_idx,
attrib_name, attrib_nelem, l_field_name, l_attrib_name);
h5_int64_t attrib_type;
h5_err_t herr = h5b_get_field_attrib_info (
fh, field_name2, *attrib_idx,
attrib_name, l_attrib_name,
&attrib_type,
attrib_nelem );
h5_strc2for ( attrib_name, l_attrib_name );
free ( field_name2 );
H5_API_RETURN(herr);
}
h5_err_t
h5bl_readfieldattrib_string (
h5_int64_t *const f,
const char *field_name,
const char *attrib_name,
char *buffer,
const int l_field_name,
const int l_attrib_name,
const int l_buffer
) {
h5_file_t *fh = h5_filehandlefor2c(f);
char *field_name2 = h5_strdupfor2c ( field_name, l_field_name );
char *attrib_name2 = h5_strdupfor2c ( attrib_name, l_attrib_name );
H5_API_ENTER (h5_err_t,
"f=%p, "
"field_name='%s', "
"attrib_name='%s', "
"buffer=%p, l_field_name=%d, l_attrib_name=%d, l_buffer=%d",
fh,
field_name,
attrib_name,
buffer, l_field_name, l_attrib_name, l_buffer);
h5_err_t herr = h5_read_field_attrib (
fh, field_name2, attrib_name2,
H5_STRING_T, buffer );
h5_strc2for ( buffer, l_buffer );
free ( field_name2 );
free ( attrib_name2 );
H5_API_RETURN(herr);
}
+789
View File
@@ -0,0 +1,789 @@
/*
Copyright (c) 2006-2015, The Regents of the University of California,
through Lawrence Berkeley National Laboratory (subject to receipt of any
required approvals from the U.S. Dept. of Energy) and the Paul Scherrer
Institut (Switzerland). All rights reserved.
License: see file COPYING in top level of source distribution.
*/
#include "h5_private.h"
#include "h5core/h5_debug.h"
#include "h5core/h5b_attribs.h"
#define H5_R8_T H5_FLOAT64_T
#define H5_R4_T H5_FLOAT32_T
#define H5_I8_T H5_INT64_T
#define H5_I4_T H5_INT32_T
/*
__ _ _ _ ___ _ __ _ _
/ _` | | | |/ _ \ '__| | | |
| (_| | |_| | __/ | | |_| |
\__, |\__,_|\___|_| \__, |
|_| |___/
*/
#define h5bl_getnfieldattribs FC_MANGLING ( \
h5bl_getnfieldattribs, \
H5BL_GETNFIELDATTRIBS)
h5_int64_t
h5bl_getnfieldattribs (
const h5_int64_t* const fh,
const char* const name,
const int l_name
) {
h5_file_t f = h5_filehandlefor2c (fh);
H5_API_ENTER (h5_int64_t,
"fh=%p, name='%*s'",
(h5_file_p)f, l_name, name);
char* name2 = h5_strdupfor2c ( name, l_name );
h5_int64_t herr = h5b_get_num_field_attribs (f, name2);
free (name2);
H5_API_RETURN (herr);
}
#define h5bl_getfieldattribinfo FC_MANGLING ( \
h5bl_getfieldattribinfo, \
h5bl_getfieldattribinfo)
h5_int64_t
h5bl_getfieldattribinfo (
const h5_int64_t* const fh,
const char* const field_name,
const h5_int64_t* const attrib_idx,
char* const attrib_name,
h5_int64_t* const attrib_nelem,
const int l_field_name,
const int l_attrib_name
) {
h5_file_t f = h5_filehandlefor2c (fh);
H5_API_ENTER (h5_err_t,
"fh=%p, field_name='%*s', attrib_idx=%lld, "
"attrib_name=%p, attrib_nelem=%p",
(h5_file_p)f,
l_field_name, field_name,
(long long)*attrib_idx,
attrib_name, attrib_nelem);
char *field_name2 = h5_strdupfor2c ( field_name, l_field_name );
h5_int64_t attrib_type;
h5_int64_t herr = h5b_get_field_attrib_info_by_idx (
f,
field_name2, *attrib_idx - 1,
attrib_name, l_attrib_name,
&attrib_type,
(h5_size_t*)attrib_nelem );
h5_strc2for ( attrib_name, l_attrib_name );
free (field_name2);
H5_API_RETURN (herr);
}
/*
_ __
(_) / /__
| | / / _ \
| |/ / (_) |
|_/_/ \___/
*/
static inline h5_int64_t
write_field_attrib (
const h5_file_t fh,
const char* field_name,
const int l_field_name,
const char* attrib_name,
const int l_attrib_name,
const h5_int64_t attrib_type,
const void* attrib_value,
const hsize_t attrib_nelems
) {
char *field_name2 = h5_strdupfor2c (field_name, l_field_name);
char *attrib_name2 = h5_strdupfor2c (attrib_name, l_attrib_name);
h5_int64_t h5err = h5b_write_field_attrib (
fh, field_name2,
attrib_name2, attrib_type,
attrib_value, attrib_nelems);
free (field_name2);
free (attrib_name2);
return h5err;
}
static inline h5_int64_t
read_field_attrib (
const h5_file_t fh,
const char* field_name,
const int l_field_name,
const char* attrib_name,
const int l_attrib_name,
const hid_t attrib_type,
void* attrib_value
) {
char *field_name2 = h5_strdupfor2c (field_name, l_field_name);
char *attrib_name2 = h5_strdupfor2c (attrib_name, l_attrib_name);
h5_int64_t h5err = h5b_read_field_attrib (
fh, field_name2,
attrib_name2, attrib_type, attrib_value);
free (field_name2);
free (attrib_name2);
return h5err;
}
/*
_ _
___| |_ _ __(_)_ __ __ _
/ __| __| '__| | '_ \ / _` |
\__ \ |_| | | | | | | (_| |
|___/\__|_| |_|_| |_|\__, |
|___/
*/
#define h5bl_writefieldattrib_string FC_MANGLING ( \
h5bl_writefieldattrib_string, \
H5BL_WRITEFIELDATTRIB_STRING)
h5_int64_t
h5bl_writefieldattrib_string (
const h5_int64_t* const fh,
const char* const field_name,
const char* const attrib_name,
const char* const attrib_value,
const int l_field_name,
const int l_attrib_name,
const int l_attrib_value
) {
h5_file_t f = h5_filehandlefor2c (fh);
H5_API_ENTER (h5_int64_t,
"fh=%p, field_name='%.*s', "
"attrib_name='%.*s' attrib_value='%.*s'",
(h5_file_p)f,
l_field_name, field_name,
l_attrib_name, attrib_name,
l_attrib_value, attrib_value);
char* attrib_value2 = h5_strdupfor2c (attrib_value, l_attrib_value);
h5_int64_t h5err = write_field_attrib (
f,
field_name, l_field_name,
attrib_name, l_attrib_name,
H5_STRING_T,
attrib_value2, strlen(attrib_value2)+1 );
free (attrib_value2);
H5_API_RETURN (h5err);
}
#define h5bl_readfieldattrib_string FC_MANGLING ( \
h5bl_readfieldattrib_string, \
H5BL_READFIELDATTRIB_STRING)
h5_err_t
h5bl_readfieldattrib_string (
const h5_int64_t* const fh,
const char* const field_name,
const char* const attrib_name,
char* const attrib_value,
const int l_field_name,
const int l_attrib_name,
const int l_attrib_value
) {
h5_file_t f = h5_filehandlefor2c (fh);
H5_API_ENTER (h5_int64_t,
"f=%p, field_name='%.*s', attrib_name='%.*s' attrib_value='%p'",
(h5_file_p)f,
l_field_name, field_name,
l_attrib_name, attrib_name,
attrib_value);
h5_int64_t h5err = read_field_attrib (
f,
field_name, l_field_name,
attrib_name, l_attrib_name,
H5_STRING_T, attrib_value);
h5_strc2for (attrib_value, l_attrib_value);
H5_API_RETURN (h5err);
}
/*
_
_ __ ___ __ _| |
| '__/ _ \/ _` | |
| | | __/ (_| | |
|_| \___|\__,_|_|
*/
#define h5bl_writefieldattrib_r8 FC_MANGLING ( \
h5bl_writefieldattrib_r8, \
H5BL_WRITEFIELDATTRIB_R8)
h5_int64_t
h5bl_writefieldattrib_r8 (
const h5_int64_t* const fh,
const char* const field_name,
const char* const attrib_name,
const h5_float64_t* const attrib_value,
const h5_int64_t* const attrib_nelems,
const int l_field_name,
const int l_attrib_name
) {
h5_file_t f = h5_filehandlefor2c (fh);
H5_API_ENTER (h5_int64_t,
"fh=%p, field_name='%.*s', attrib_name='%.*s', "
"attrib_value=%p, attrib_nelems=%lld",
(h5_file_p)f,
l_field_name, field_name,
l_attrib_name, attrib_name,
attrib_value, (long long)*attrib_nelems);
H5_API_RETURN (write_field_attrib (
f,
field_name, l_field_name,
attrib_name, l_attrib_name,
H5_R8_T,
attrib_value, *attrib_nelems));
}
#define h5bl_readfieldattrib_r8 FC_MANGLING ( \
h5bl_readfieldattrib_r8, \
H5BL_READFIELDATTRIB_R8)
h5_err_t
h5bl_readfieldattrib_r8 (
const h5_int64_t* const fh,
const char* const field_name,
const char* const attrib_name,
h5_float64_t* const attrib_value,
const int l_field_name,
const int l_attrib_name
) {
h5_file_t f = h5_filehandlefor2c (fh);
H5_API_ENTER (h5_int64_t,
"fh=%p, field_name='%.*s', attrib_name='%.*s', "
"attrib_value=%p",
(h5_file_p)f,
l_field_name, field_name,
l_attrib_name, attrib_name,
attrib_value);
H5_API_RETURN (read_field_attrib (
f,
field_name, l_field_name,
attrib_name, l_attrib_name,
H5_R8_T,
attrib_value));
}
#define h5bl_writefieldattrib_r4 FC_MANGLING ( \
h5bl_writefieldattrib_r4, \
H5BL_WRITEFIELDATTRIB_R4)
h5_int64_t
h5bl_writefieldattrib_r4 (
const h5_int64_t* const fh,
const char* const field_name,
const char* const attrib_name,
const h5_float32_t* const attrib_value,
const h5_int64_t* const attrib_nelems,
const int l_field_name,
const int l_attrib_name
) {
h5_file_t f = h5_filehandlefor2c (fh);
H5_API_ENTER (h5_int64_t,
"fh=%p, field_name='%.*s', attrib_name='%.*s', "
"attrib_value=%p, attrib_nelems=%lld",
(h5_file_p)f,
l_field_name, field_name,
l_attrib_name, attrib_name,
attrib_value, (long long)*attrib_nelems);
H5_API_RETURN (write_field_attrib (
f,
field_name, l_field_name,
attrib_name, l_attrib_name,
H5_R4_T,
attrib_value, *attrib_nelems));
}
#define h5bl_readfieldattrib_r4 FC_MANGLING ( \
h5bl_readfieldattrib_r4, \
H5BL_READFIELDATTRIB_R4)
h5_err_t
h5bl_readfieldattrib_r4 (
const h5_int64_t* const fh,
const char* const field_name,
const char* const attrib_name,
h5_float32_t* const attrib_value,
const int l_field_name,
const int l_attrib_name
) {
h5_file_t f = h5_filehandlefor2c (fh);
H5_API_ENTER (h5_int64_t,
"fh=%p, field_name='%.*s', attrib_name='%.*s', "
"attrib_value=%p",
(h5_file_p)f,
l_field_name, field_name,
l_attrib_name, attrib_name,
attrib_value);
H5_API_RETURN (read_field_attrib (
f,
field_name, l_field_name,
attrib_name, l_attrib_name,
H5_R4_T,
attrib_value));
}
/*
_ _
(_)_ __ | |_ ___ __ _ ___ _ __
| | '_ \| __/ _ \/ _` |/ _ \ '__|
| | | | | || __/ (_| | __/ |
|_|_| |_|\__\___|\__, |\___|_|
|___/
*/
#define h5bl_writefieldattrib_i8 FC_MANGLING ( \
h5bl_writefieldattrib_i8, \
H5BL_WRITEFIELDATTRIB_I8)
h5_int64_t
h5bl_writefieldattrib_i8 (
const h5_int64_t* const fh,
const char* const field_name,
const char* const attrib_name,
const h5_int64_t* const attrib_value,
const h5_int64_t* const attrib_nelems,
const int l_field_name,
const int l_attrib_name
) {
h5_file_t f = h5_filehandlefor2c (fh);
H5_API_ENTER (h5_int64_t,
"fh=%p, field_name='%.*s', attrib_name='%.*s', "
"attrib_value=%p, attrib_nelems=%lld",
(h5_file_p)f,
l_field_name, field_name,
l_attrib_name, attrib_name,
attrib_value, (long long)*attrib_nelems);
H5_API_RETURN (write_field_attrib (
f,
field_name, l_field_name,
attrib_name, l_attrib_name,
H5_I8_T,
attrib_value, *attrib_nelems));
}
#define h5bl_readfieldattrib_i8 FC_MANGLING ( \
h5bl_readfieldattrib_i8, \
H5BL_READFIELDATTRIB_I8)
h5_err_t
h5bl_readfieldattrib_i8 (
const h5_int64_t* const fh,
const char* const field_name,
const char* const attrib_name,
h5_int64_t* const attrib_value,
const int l_field_name,
const int l_attrib_name,
const int l_attrib_value
) {
h5_file_t f = h5_filehandlefor2c (fh);
H5_API_ENTER (h5_int64_t,
"fh=%p, field_name='%.*s', attrib_name='%.*s', "
"attrib_value=%p",
(h5_file_p)f,
l_field_name, field_name,
l_attrib_name, attrib_name,
attrib_value);
H5_API_RETURN (read_field_attrib (
f,
field_name, l_field_name,
attrib_name, l_attrib_name,
H5_I8_T,
attrib_value));
}
#define h5bl_writefieldattrib_i4 FC_MANGLING ( \
h5bl_writefieldattrib_i4, \
H5BL_WRITEFIELDATTRIB_I4 )
h5_int64_t
h5bl_writefieldattrib_i4 (
const h5_int64_t* const fh,
const char* const field_name,
const char* const attrib_name,
const h5_int32_t* const attrib_value,
const h5_int64_t* const attrib_nelems,
const int l_field_name,
const int l_attrib_name
) {
h5_file_t f = h5_filehandlefor2c (fh);
H5_API_ENTER (h5_int64_t,
"fh=%p, field_name='%.*s', attrib_name='%.*s', "
"attrib_value=%p, attrib_nelems=%lld",
(h5_file_p)f,
l_field_name, field_name,
l_attrib_name, attrib_name,
attrib_value, (long long)*attrib_nelems);
H5_API_RETURN (write_field_attrib (
f,
field_name, l_field_name,
attrib_name, l_attrib_name,
H5_I4_T,
attrib_value, *attrib_nelems));
}
#define h5bl_readfieldattrib_i4 FC_MANGLING ( \
h5bl_readfieldattrib_i4, \
H5BL_READFIELDATTRIB_I4)
h5_err_t
h5bl_readfieldattrib_i4 (
const h5_int64_t* const fh,
const char* const field_name,
const char* const attrib_name,
h5_int32_t* const attrib_value,
const int l_field_name,
const int l_attrib_name
) {
h5_file_t f = h5_filehandlefor2c (fh);
H5_API_ENTER (h5_int64_t,
"fh=%p, field_name='%.*s', attrib_name='%.*s', "
"attrib_value=%p",
(h5_file_p)f,
l_field_name, field_name,
l_attrib_name, attrib_name,
attrib_value);
H5_API_RETURN (read_field_attrib (
f,
field_name, l_field_name,
attrib_name, l_attrib_name,
H5_I4_T,
attrib_value));
}
#define h5bl_get_fieldorigin FC_MANGLING ( \
h5bl_get_fieldorigin, \
H5BL_GET_FIELDORIGIN)
h5_int64_t
h5bl_get_fieldorigin (
const h5_int64_t* const fh,
const char* const field_name,
h5_float64_t* const x_origin,
h5_float64_t* const y_origin,
h5_float64_t* const z_origin,
const int l_field_name
) {
h5_file_t f = h5_filehandlefor2c (fh);
H5_API_ENTER (h5_int64_t,
"fh=%p, field_name='%.*s'"
", x_origin=%p"
", y_origin=%p"
", z_origin=%p",
(h5_file_p)f,
l_field_name, field_name,
x_origin, y_origin, z_origin);
h5_float64_t origin[3];
TRY (read_field_attrib (
f,
field_name, l_field_name,
H5BLOCK_FIELD_ORIGIN_NAME, sizeof (H5BLOCK_FIELD_ORIGIN_NAME),
H5_R8_T,
origin));
*x_origin = origin[0];
*y_origin = origin[1];
*z_origin = origin[2];
H5_API_RETURN (H5_SUCCESS);
}
#define h5bl_set_fieldorigin FC_MANGLING ( \
h5bl_set_fieldorigin, \
H5BL_SET_FIELDORIGIN)
h5_int64_t
h5bl_set_fieldorigin (
const h5_int64_t* const fh,
const char* const field_name,
h5_float64_t* const x_origin,
h5_float64_t* const y_origin,
h5_float64_t* const z_origin,
const int l_field_name
) {
h5_file_t f = h5_filehandlefor2c (fh);
H5_API_ENTER (h5_int64_t,
"fh=%p, field_name='%.*s'"
", x_origin=%g"
", y_origin=%g"
", z_origin=%g",
(h5_file_p)f,
l_field_name, field_name,
*x_origin, *y_origin, *z_origin);
h5_float64_t origin[3] = { *x_origin, *y_origin, *z_origin };
TRY (write_field_attrib (
f,
field_name, l_field_name,
H5BLOCK_FIELD_ORIGIN_NAME, sizeof (H5BLOCK_FIELD_ORIGIN_NAME),
H5_R8_T,
origin, 3));
H5_API_RETURN (H5_SUCCESS);
}
#define h5bl_get_fieldspacing FC_MANGLING ( \
h5bl_get_fieldspacing, \
H5BL_GET_FIELDSPACING)
h5_int64_t
h5bl_get_fieldspacing (
const h5_int64_t* const fh,
const char* const field_name,
h5_float64_t* const x_spacing,
h5_float64_t* const y_spacing,
h5_float64_t* const z_spacing,
const int l_field_name
) {
h5_file_t f = h5_filehandlefor2c (fh);
H5_API_ENTER (h5_int64_t,
"fh=%p, field_name='%.*s'"
", x_spacing=%p"
", y_spacing=%p"
", z_spacing=%p",
(h5_file_p)f,
l_field_name, field_name,
x_spacing, y_spacing, z_spacing);
h5_float64_t spacing[3];
TRY (read_field_attrib (
f,
field_name, l_field_name,
H5BLOCK_FIELD_ORIGIN_NAME, sizeof (H5BLOCK_FIELD_ORIGIN_NAME),
H5_R8_T,
spacing));
*x_spacing = spacing[0];
*y_spacing = spacing[1];
*z_spacing = spacing[2];
H5_API_RETURN (H5_SUCCESS);
}
#define h5bl_set_fieldspacing FC_MANGLING ( \
h5bl_set_fieldspacing, \
H5BL_SET_FIELDSPACING)
h5_int64_t
h5bl_set_fieldspacing (
const h5_int64_t* const fh,
const char* const field_name,
h5_float64_t* const x_spacing,
h5_float64_t* const y_spacing,
h5_float64_t* const z_spacing,
const int l_field_name
) {
h5_file_t f = h5_filehandlefor2c (fh);
H5_API_ENTER (h5_int64_t,
"fh=%p, field_name='%.*s'"
", x_spacing=%g"
", y_spacing=%g"
", z_spacing=%g",
(h5_file_p)f,
l_field_name, field_name,
*x_spacing, *y_spacing, *z_spacing);
h5_float64_t spacing[3] = { *x_spacing, *y_spacing, *z_spacing };
TRY (read_field_attrib (
f,
field_name, l_field_name,
H5BLOCK_FIELD_ORIGIN_NAME, sizeof (H5BLOCK_FIELD_SPACING_NAME),
H5_R8_T,
spacing));
H5_API_RETURN (H5_SUCCESS);
}
static inline h5_int64_t
set_field_coords (
const h5_file_t f,
int rank,
const char* field_name,
const int l_field_name,
const char* attrib_name,
const int l_attrib_name,
const h5_float64_t* coords,
const h5_int64_t n_coords
) {
char *field_name2 = h5_strdupfor2c (field_name, l_field_name);
char *attrib_name2 = h5_strdupfor2c (attrib_name, l_attrib_name);
h5_int64_t h5err = h5b_set_3d_field_coords (
f, rank,
field_name2, attrib_name2,
coords, n_coords);
free (field_name2);
free (attrib_name2);
return (h5err);
}
static inline h5_int64_t
get_field_coords (
const h5_file_t f,
int rank,
const char* field_name,
const int l_field_name,
const char* attrib_name,
const int l_attrib_name,
h5_float64_t* const coords,
const h5_int64_t n_coords
) {
char *field_name2 = h5_strdupfor2c (field_name, l_field_name);
char *attrib_name2 = h5_strdupfor2c (attrib_name, l_attrib_name);
h5_int64_t h5err = h5b_get_3d_field_coords (
f, rank,
field_name2, attrib_name2,
coords, n_coords);
free (field_name2);
free (attrib_name2);
return (h5err);
}
#define h5bl_set_fieldxcoords FC_MANGLING ( \
h5bl_set_fieldxcoords, \
H5BL_SET_FIELDXCOORDS)
h5_int64_t
h5bl_set_fieldxcoords (
const h5_int64_t* const fh,
const char* const field_name,
h5_float64_t* const coords,
const h5_int64_t* n_coords,
const int l_field_name
) {
h5_file_t f = h5_filehandlefor2c (fh);
H5_API_ENTER (h5_err_t,
"fh=%p, field_name='%.*s'"
"coords=%p, n_coords=%llu",
(h5_file_p)f,
l_field_name, field_name,
coords, (long long unsigned)n_coords);
H5_API_RETURN (set_field_coords (
f, 0,
field_name, l_field_name,
H5BLOCK_FIELD_XCOORD_NAME, sizeof(H5BLOCK_FIELD_XCOORD_NAME),
coords, *n_coords));
}
#define h5bl_get_fieldxcoords FC_MANGLING ( \
h5bl_get_fieldxcoords, \
H5BL_GET_FIELDXCOORDS)
h5_int64_t
h5bl_get_fieldxcoords (
const h5_int64_t* const fh,
const char* const field_name,
h5_float64_t* const coords,
const h5_int64_t* n_coords,
const int l_field_name
) {
h5_file_t f = h5_filehandlefor2c (fh);
H5_API_ENTER (h5_err_t,
"fh=%p"
", field_name='%.*s'"
", coords=%p, n_coords=%llu",
(h5_file_p)f,
l_field_name, field_name,
coords, (long long unsigned)n_coords);
H5_API_RETURN (get_field_coords (
f, 0,
field_name, l_field_name,
H5BLOCK_FIELD_XCOORD_NAME, sizeof (H5BLOCK_FIELD_XCOORD_NAME),
coords, *n_coords));
}
#define h5bl_set_fieldycoords FC_MANGLING ( \
h5bl_set_fieldycoords, \
H5BL_SET_FIELDYCOORDS)
h5_int64_t
h5bl_set_fieldycoords (
const h5_int64_t* const fh,
const char* const field_name,
h5_float64_t* const coords,
const h5_int64_t* n_coords,
const int l_field_name
) {
h5_file_t f = h5_filehandlefor2c (fh);
H5_API_ENTER (h5_err_t,
"fh=%p"
", field_name='%.*s'"
", coords=%p, n_coords=%llu",
(h5_file_p)f,
l_field_name, field_name,
coords, (long long unsigned)n_coords);
H5_API_RETURN (set_field_coords (
f, 1,
field_name, l_field_name,
H5BLOCK_FIELD_YCOORD_NAME, sizeof (H5BLOCK_FIELD_YCOORD_NAME),
coords, *n_coords));
}
#define h5bl_get_fieldycoords FC_MANGLING ( \
h5bl_get_fieldycoords, \
H5BL_GET_FIELDyCOORDS)
h5_int64_t
h5bl_get_fieldycoords (
const h5_int64_t* const fh,
const char* const field_name,
h5_float64_t* const coords,
const h5_int64_t* n_coords,
const int l_field_name
) {
h5_file_t f = h5_filehandlefor2c (fh);
H5_API_ENTER (h5_err_t,
"fh=%p"
", field_name='%.*s'"
", coords=%p, n_coords=%llu",
(h5_file_p)f,
l_field_name, field_name,
coords, (long long unsigned)n_coords);
H5_API_RETURN (get_field_coords (
f, 1,
field_name, l_field_name,
H5BLOCK_FIELD_YCOORD_NAME, sizeof (H5BLOCK_FIELD_YCOORD_NAME),
coords, *n_coords));
}
#define h5bl_set_fieldzcoords FC_MANGLING ( \
h5bl_set_fieldzcoords, \
H5BL_SET_FIELDZCOORDS)
h5_int64_t
h5bl_set_fieldzcoords (
const h5_int64_t* const fh,
const char* const field_name,
h5_float64_t* const coords,
const h5_int64_t* n_coords,
const int l_field_name
) {
h5_file_t f = h5_filehandlefor2c (fh);
H5_API_ENTER (h5_err_t,
"fh=%p"
", field_name='%.*s'"
", coords=%p, n_coords=%llu",
(h5_file_p)f,
l_field_name, field_name,
coords, (long long unsigned)n_coords);
H5_API_RETURN (set_field_coords (
f, 2,
field_name, l_field_name,
H5BLOCK_FIELD_ZCOORD_NAME, sizeof (H5BLOCK_FIELD_ZCOORD_NAME),
coords, *n_coords));
}
#define h5bl_get_fieldzcoords FC_MANGLING ( \
h5bl_get_fieldzcoords, \
H5BL_GET_FIELDZCOORDS)
h5_int64_t
h5bl_get_fieldzcoords (
const h5_int64_t* const fh,
const char* const field_name,
h5_float64_t* const coords,
const h5_int64_t* n_coords,
const int l_field_name
) {
h5_file_t f = h5_filehandlefor2c (fh);
H5_API_ENTER (h5_err_t,
"fh=%p"
", field_name='%.*s'"
"coords=%p, n_coords=%llu",
(h5_file_p)f,
l_field_name, field_name,
coords, (long long unsigned)n_coords);
H5_API_RETURN (get_field_coords (
f, 2,
field_name, l_field_name,
H5BLOCK_FIELD_ZCOORD_NAME, sizeof (H5BLOCK_FIELD_ZCOORD_NAME),
coords, *n_coords));
}
+372
View File
@@ -0,0 +1,372 @@
/*
Copyright (c) 2006-2015, The Regents of the University of California,
through Lawrence Berkeley National Laboratory (subject to receipt of any
required approvals from the U.S. Dept. of Energy) and the Paul Scherrer
Institut (Switzerland). All rights reserved.
License: see file COPYING in top level of source distribution.
*/
#include "h5_private.h"
#include "h5core/h5_debug.h"
#include "h5core/h5b_io.h"
#define h5bl_3d_write_scalar_field_r8 FC_MANGLING ( \
h5bl_3d_write_scalar_field_r8, \
H5BL_3D_WRITE_SCALAR_FIELD_R8 )
h5_err_t
h5bl_3d_write_scalar_field_r8 (
const h5_int64_t* const fh,
const char* const name,
const h5_float64_t* const buffer,
const int l_name
) {
h5_file_t f = h5_filehandlefor2c (fh);
H5_API_ENTER (h5_err_t,
"fh=%p, name='%*s', buffer=%p",
(h5_file_p)f, l_name, name, buffer);
char *name2 = h5_strdupfor2c ( name, l_name );
h5_err_t herr = h5b_write_scalar_data (
f, name2, (void*)buffer, H5T_NATIVE_DOUBLE );
free ( name2 );
H5_API_RETURN(herr);
}
#define h5bl_3d_read_scalar_field_r8 FC_MANGLING ( \
h5bl_3d_read_scalar_field_r8, \
H5BL_3D_READ_SCALAR_FIELD_R8 )
h5_err_t
h5bl_3d_read_scalar_field_r8 (
const h5_int64_t* const fh,
const char* const name,
h5_float64_t* const buffer,
const int l_name
) {
h5_file_t f = h5_filehandlefor2c (fh);
H5_API_ENTER (h5_err_t,
"fh=%p, name='%s', buffer=%p, l_name=%d",
(h5_file_p)f, name, buffer, l_name);
char *name2 = h5_strdupfor2c ( name, l_name );
h5_err_t herr = h5b_read_scalar_data (
f, name2, buffer, H5T_NATIVE_DOUBLE );
free ( name2 );
H5_API_RETURN(herr);
}
#define h5bl_3d_write_vector3d_field_r8 FC_MANGLING ( \
h5bl_3d_write_vector3d_field_r8, \
H5BL_3D_WRITE_VECTOR3D_FIELD_R8 )
h5_err_t
h5bl_3d_write_vector3d_field_r8 (
const h5_int64_t* const fh,
const char* const name,
const h5_float64_t* const x_buf,
const h5_float64_t* const y_buf,
const h5_float64_t* const z_buf,
const int l_name
) {
h5_file_t f = h5_filehandlefor2c (fh);
H5_API_ENTER (h5_err_t,
"fh=%p, name='%s', x_buf=%p, y_buf=%p, z_buf=%p, l_name=%d",
(h5_file_p)f, name, x_buf, y_buf, z_buf, l_name);
char *name2 = h5_strdupfor2c ( name, l_name );
h5_err_t herr = h5b_write_vector3d_data (
f, name2,
(void*)x_buf, (void*)y_buf, (void*)z_buf, H5T_NATIVE_DOUBLE );
free ( name2 );
H5_API_RETURN(herr);
}
#define h5bl_3d_read_vector3d_field_r8 FC_MANGLING ( \
h5bl_3d_read_vector3d_field_r8, \
H5BL_3D_READ_VECTOR3D_FIELD_R8 )
h5_err_t
h5bl_3d_read_vector3d_field_r8 (
const h5_int64_t* const fh,
const char* const name,
h5_float64_t* const x_buf,
h5_float64_t* const y_buf,
h5_float64_t* const z_buf,
const int l_name
) {
h5_file_t f = h5_filehandlefor2c (fh);
H5_API_ENTER (h5_err_t,
"fh=%p, name='%s', x_buf=%p, y_buf=%p, z_buf=%p, l_name=%d",
(h5_file_p)f, name, x_buf, y_buf, z_buf, l_name);
char *name2 = h5_strdupfor2c ( name, l_name );
h5_err_t herr = h5b_read_vector3d_data (
f, name2,
(void*)x_buf, (void*)y_buf, (void*)z_buf, H5T_NATIVE_DOUBLE );
free ( name2 );
H5_API_RETURN(herr);
}
#define h5bl_3d_write_scalar_field_r4 FC_MANGLING ( \
h5bl_3d_write_scalar_field_r4, \
H5BL_3D_WRITE_SCALAR_FIELD_R4 )
h5_err_t
h5bl_3d_write_scalar_field_r4 (
const h5_int64_t*const fh,
const char* const name,
const h5_float32_t* const buffer,
const int l_name
) {
h5_file_t f = h5_filehandlefor2c (fh);
H5_API_ENTER (h5_err_t,
"fh=%p, name='%s', buffer=%p, l_name=%d",
(h5_file_p)f, name, buffer, l_name);
char *name2 = h5_strdupfor2c ( name, l_name );
h5_err_t herr = h5b_write_scalar_data (
f, name2, (void*)buffer, H5T_NATIVE_FLOAT );
free ( name2 );
H5_API_RETURN(herr);
}
#define h5bl_3d_read_scalar_field_r4 FC_MANGLING ( \
h5bl_3d_read_scalar_field_r4, \
H5BL_3D_READ_SCALAR_FIELD_R4 )
h5_err_t
h5bl_3d_read_scalar_field_r4 (
const h5_int64_t* const fh,
const char* const name,
h5_float32_t* const buffer,
const int l_name
) {
h5_file_t f = h5_filehandlefor2c (fh);
H5_API_ENTER (h5_err_t,
"fh=%p, name='%s', buffer=%p, l_name=%d",
(h5_file_p)f, name, buffer, l_name);
char *name2 = h5_strdupfor2c ( name, l_name );
h5_err_t herr = h5b_read_scalar_data (
f, name2, buffer, H5T_NATIVE_FLOAT );
free ( name2 );
H5_API_RETURN(herr);
}
#define h5bl_3d_write_vector3d_field_r4 FC_MANGLING ( \
h5bl_3d_write_vector3d_field_r4, \
H5BL_3D_WRITE_VECTOR3D_FIELD_R4 )
h5_err_t
h5bl_3d_write_vector3d_field_r4 (
const h5_int64_t* const fh,
const char* const name,
const h5_float32_t* const x_buf,
const h5_float32_t* const y_buf,
const h5_float32_t* const z_buf,
const int l_name
) {
h5_file_t f = h5_filehandlefor2c (fh);
H5_API_ENTER (h5_err_t,
"fh=%p, name='%s', x_buf=%p, y_buf=%p, z_buf=%p, l_name=%d",
(h5_file_p)f, name, x_buf, y_buf, z_buf, l_name);
char *name2 = h5_strdupfor2c ( name, l_name );
h5_err_t herr = h5b_write_vector3d_data (
f, name2,
(void*)x_buf, (void*)y_buf, (void*)z_buf, H5T_NATIVE_FLOAT );
free ( name2 );
H5_API_RETURN(herr);
}
#define h5bl_3d_read_vector3d_field_r4 FC_MANGLING ( \
h5bl_3d_read_vector3d_field_r4, \
H5BL_3D_READ_VECTOR3D_FIELD_R4 )
h5_err_t
h5bl_3d_read_vector3d_field_r4 (
const h5_int64_t* const fh,
const char* const name,
h5_float32_t* const x_buf,
h5_float32_t* const y_buf,
h5_float32_t* const z_buf,
const int l_name
) {
h5_file_t f = h5_filehandlefor2c (fh);
H5_API_ENTER (h5_err_t,
"fh=%p, name='%s', x_buf=%p, y_buf=%p, z_buf=%p, l_name=%d",
(h5_file_p)f, name, x_buf, y_buf, z_buf, l_name);
char *name2 = h5_strdupfor2c ( name, l_name );
h5_err_t herr = h5b_read_vector3d_data (
f, name2,
(void*)x_buf, (void*)y_buf, (void*)z_buf, H5T_NATIVE_FLOAT );
free ( name2 );
H5_API_RETURN (herr);
}
#define h5bl_3d_write_scalar_field_i8 FC_MANGLING ( \
h5bl_3d_write_scalar_field_i8, \
H5BL_3D_WRITE_SCALAR_FIELD_I8 )
h5_err_t
h5bl_3d_write_scalar_field_i8 (
const h5_int64_t* const fh,
const char* const name,
const h5_int64_t* const buffer,
const int l_name
) {
h5_file_t f = h5_filehandlefor2c (fh);
H5_API_ENTER (h5_err_t,
"fh=%p, name='%s', buffer=%p, l_name=%d",
(h5_file_p)f, name, buffer, l_name);
char *name2 = h5_strdupfor2c ( name, l_name );
h5_err_t herr = h5b_write_scalar_data (
f, name2, (void*)buffer, H5T_NATIVE_INT64 );
free ( name2 );
H5_API_RETURN (herr);
}
#define h5bl_3d_read_scalar_field_i8 FC_MANGLING ( \
h5bl_3d_read_scalar_field_i8, \
H5BL_3D_READ_SCALAR_FIELD_I8 )
h5_err_t
h5bl_3d_read_scalar_field_i8 (
const h5_int64_t* const fh,
const char* const name,
h5_int64_t* const buffer,
const int l_name
) {
h5_file_t f = h5_filehandlefor2c (fh);
H5_API_ENTER (h5_err_t,
"fh=%p, name='%s', buffer=%p, l_name=%d",
(h5_file_p)f, name, buffer, l_name);
char *name2 = h5_strdupfor2c ( name, l_name );
h5_err_t herr = h5b_read_scalar_data (
f, name2, buffer, H5T_NATIVE_INT64 );
free (name2);
H5_API_RETURN (herr);
}
#define h5bl_3d_write_vector3d_field_i8 FC_MANGLING ( \
h5bl_3d_write_vector3d_field_i8, \
H5BL_3D_WRITE_VECTOR3D_FIELD_I8 )
h5_err_t
h5bl_3d_write_vector3d_field_i8 (
const h5_int64_t* const fh,
const char* const name,
const h5_int64_t* const x_buf,
const h5_int64_t* const y_buf,
const h5_int64_t* const z_buf,
const int l_name
) {
h5_file_t f = h5_filehandlefor2c (fh);
H5_API_ENTER (h5_err_t,
"fh=%p, name='%s', x_buf=%p, y_buf=%p, z_buf=%p, l_name=%d",
(h5_file_p)f, name, x_buf, y_buf, z_buf, l_name);
char *name2 = h5_strdupfor2c ( name, l_name );
h5_err_t herr = h5b_write_vector3d_data (
f, name2,
(void*)x_buf, (void*)y_buf, (void*)z_buf, H5T_NATIVE_INT64 );
free ( name2 );
H5_API_RETURN(herr);
}
#define h5bl_3d_read_vector3d_field_i8 FC_MANGLING ( \
h5bl_3d_read_vector3d_field_i8, \
H5BL_3D_READ_VECTOR3D_FIELD_I8 )
h5_err_t
h5bl_3d_read_vector3d_field_i8 (
const h5_int64_t *const fh,
const char* const name,
h5_int64_t* const x_buf,
h5_int64_t* const y_buf,
h5_int64_t* const z_buf,
const int l_name
) {
h5_file_t f = h5_filehandlefor2c (fh);
H5_API_ENTER (h5_err_t,
"fh=%p, name='%s', x_buf=%p, y_buf=%p, z_buf=%p, l_name=%d",
(h5_file_p)f, name, x_buf, y_buf, z_buf, l_name);
char *name2 = h5_strdupfor2c ( name, l_name );
h5_err_t herr = h5b_read_vector3d_data (
f, name2,
(void*)x_buf, (void*)y_buf, (void*)z_buf, H5T_NATIVE_INT64 );
free ( name2 );
H5_API_RETURN(herr);
}
#define h5bl_3d_write_scalar_field_i4 FC_MANGLING ( \
h5bl_3d_write_scalar_field_i4, \
H5BL_3D_WRITE_SCALAR_FIELD_I4 )
h5_err_t
h5bl_3d_write_scalar_field_i4 (
const h5_int64_t* const fh,
const char* const name,
const h5_int32_t* const buffer,
const int l_name
) {
h5_file_t f = h5_filehandlefor2c (fh);
H5_API_ENTER (h5_err_t,
"fh=%p, name='%s', buffer=%p, l_name=%d",
(h5_file_p)f, name, buffer, l_name);
char *name2 = h5_strdupfor2c ( name, l_name );
h5_err_t herr = h5b_write_scalar_data (
f, name2, (void*)buffer, H5T_NATIVE_INT32 );
free ( name2 );
H5_API_RETURN(herr);
}
#define h5bl_3d_read_scalar_field_i4 FC_MANGLING ( \
h5bl_3d_read_scalar_field_i4, \
H5BL_3D_READ_SCALAR_FIELD_I4 )
h5_err_t
h5bl_3d_read_scalar_field_i4 (
const h5_int64_t* const fh,
const char* const name,
h5_int32_t* const buffer,
const int l_name
) {
h5_file_t f = h5_filehandlefor2c (fh);
H5_API_ENTER (h5_err_t,
"fh=%p, name='%s', buffer=%p, l_name=%d",
(h5_file_p)f, name, buffer, l_name);
char *name2 = h5_strdupfor2c ( name, l_name );
h5_err_t herr = h5b_read_scalar_data (
f, name2, buffer, H5T_NATIVE_INT32 );
free ( name2 );
H5_API_RETURN(herr);
}
#define h5bl_3d_write_vector3d_field_i4 FC_MANGLING ( \
h5bl_3d_write_vector3d_field_i4, \
H5BL_3D_WRITE_VECTOR3D_FIELD_I4 )
h5_err_t
h5bl_3d_write_vector3d_field_i4 (
const h5_int64_t* const fh,
const char* const name,
const h5_int32_t* const x_buf,
const h5_int32_t* const y_buf,
const h5_int32_t* const z_buf,
const int l_name
) {
h5_file_t f = h5_filehandlefor2c (fh);
H5_API_ENTER (h5_err_t,
"fh=%p, name='%s', x_buf=%p, y_buf=%p, z_buf=%p, l_name=%d",
(h5_file_p)f, name, x_buf, y_buf, z_buf, l_name);
char *name2 = h5_strdupfor2c ( name, l_name );
h5_err_t herr = h5b_write_vector3d_data (
f, name2,
(void*)x_buf, (void*)y_buf, (void*)z_buf, H5T_NATIVE_INT32 );
free ( name2 );
H5_API_RETURN(herr);
}
#define h5bl_3d_read_vector3d_field_i4 FC_MANGLING ( \
h5bl_3d_read_vector3d_field_i4, \
H5BL_3D_READ_VECTOR3D_FIELD_I4 )
h5_err_t
h5bl_3d_read_vector3d_field_i4 (
const h5_int64_t* const fh,
const char* const name,
h5_int32_t* const x_buf,
h5_int32_t* const y_buf,
h5_int32_t* const z_buf,
const int l_name
) {
h5_file_t f = h5_filehandlefor2c (fh);
H5_API_ENTER (h5_err_t,
"fh=%p, name='%s', x_buf=%p, y_buf=%p, z_buf=%p, l_name=%d",
(h5_file_p)f, name, x_buf, y_buf, z_buf, l_name);
char *name2 = h5_strdupfor2c ( name, l_name );
h5_err_t herr = h5b_read_vector3d_data (
f, name2,
(void*)x_buf, (void*)y_buf, (void*)z_buf, H5T_NATIVE_INT32 );
free ( name2 );
H5_API_RETURN(herr);
}
+331
View File
@@ -0,0 +1,331 @@
/*
Copyright (c) 2006-2015, The Regents of the University of California,
through Lawrence Berkeley National Laboratory (subject to receipt of any
required approvals from the U.S. Dept. of Energy) and the Paul Scherrer
Institut (Switzerland). All rights reserved.
License: see file COPYING in top level of source distribution.
*/
#include "h5_private.h"
#include "h5core/h5_debug.h"
#include "h5core/h5b_model.h"
#include "h5core/h5b_io.h"
#define h5bl_hasfielddata FC_MANGLING ( \
h5bl_hasfielddata, \
H5BL_HASFIELDDATA )
h5_int64_t
h5bl_hasfielddata (
const h5_int64_t* const fh
) {
h5_file_t f = h5_filehandlefor2c (fh);
H5_API_ENTER (h5_int64_t,
"fh=%p",
(h5_file_p)f);
H5_API_RETURN (h5b_has_field_data ( f ));
}
#define h5bl_3d_hasview FC_MANGLING ( \
h5bl_hasview, \
H5BL_HASVIEW )
h5_int64_t
h5bl_3d_hasview (
const h5_int64_t* const fh
) {
h5_file_t f = h5_filehandlefor2c (fh);
H5_API_ENTER (h5_int64_t,
"fh=%p",
(h5_file_p)f);
H5_API_RETURN (h5b_3d_has_view ( f ));
}
#define h5bl_3d_setview FC_MANGLING ( \
h5bl_3d_setview, \
H5BL_3D_SETVIEW )
h5_int64_t
h5bl_3d_setview (
const h5_int64_t* const fh,
const h5_int64_t* const i_start, /*!< start index of i */
const h5_int64_t* const i_end, /*!< end index of i */
const h5_int64_t* const j_start, /*!< start index of j */
const h5_int64_t* const j_end, /*!< end index of j */
const h5_int64_t* const k_start, /*!< start index of k */
const h5_int64_t* const k_end /*!< end index of k */
) {
h5_file_t f = h5_filehandlefor2c (fh);
H5_API_ENTER (h5_int64_t,
"fh=%p, "
"i_start=%lld, i_end=%lld, "
"j_start=%lld, j_end=%lld, "
"k_start=%lld, k_end=%lld",
(h5_file_p)f,
(long long)*i_start, (long long)*i_end,
(long long)*j_start, (long long)*j_end,
(long long)*k_start, (long long)*k_end);
H5_API_RETURN(h5b_3d_set_view (
f,
*i_start-1, *i_end-1,
*j_start-1, *j_end-1,
*k_start-1, *k_end-1 ));
}
#define h5bl_3d_getview FC_MANGLING ( \
h5bl_3d_getview, \
H5BL_3D_GETVIEW )
h5_int64_t
h5bl_3d_getview (
const h5_int64_t* const fh,
h5_int64_t* const i_start,
h5_int64_t* const i_end,
h5_int64_t* const j_start,
h5_int64_t* const j_end,
h5_int64_t* const k_start,
h5_int64_t* const k_end
) {
h5_file_t f = h5_filehandlefor2c (fh);
H5_API_ENTER (h5_int64_t,
"fh=%p, "
"i_start=%p, i_end=%p, "
"j_start=%p, j_end=%p, "
"k_start=%p, k_end=%p",
(h5_file_p)f,
i_start, i_end,
j_start, j_end,
k_start, k_end);
TRY (h5b_3d_get_view (
f,
(h5_size_t*)i_start, (h5_size_t*)i_end,
(h5_size_t*)j_start, (h5_size_t*)j_end,
(h5_size_t*)k_start, (h5_size_t*)k_end ));
*i_start += 1;
*i_end += 1;
*j_start += 1;
*j_end += 1;
*k_start += 1;
*k_end += 1;
H5_API_RETURN (H5_SUCCESS);
}
#define h5bl_3d_getreducedview FC_MANGLING ( \
h5bl_3d_getreducedview, \
H5BL_3D_GETREDUCEDVIEW )
h5_int64_t
h5bl_3d_getreducedview (
const h5_int64_t* const fh,
h5_int64_t* const i_start,
h5_int64_t* const i_end,
h5_int64_t* const j_start,
h5_int64_t* const j_end,
h5_int64_t* const k_start,
h5_int64_t* const k_end
) {
h5_file_t f = h5_filehandlefor2c (fh);
H5_API_ENTER (h5_int64_t,
"fh=%p, "
"i_start=%p, i_end=%p, "
"j_start=%p, j_end=%p, "
"k_start=%p, k_end=%p",
(h5_file_p)f,
i_start, i_end,
j_start, j_end,
k_start, k_end);
TRY (h5b_3d_get_reduced_view (
f,
(h5_size_t*)i_start, (h5_size_t*)i_end,
(h5_size_t*)j_start, (h5_size_t*)j_end,
(h5_size_t*)k_start, (h5_size_t*)k_end));
*i_start += 1;
*i_end += 1;
*j_start += 1;
*j_end += 1;
*k_start += 1;
*k_end += 1;
H5_API_RETURN (H5_SUCCESS);
}
#define h5bl_3d_setchunk FC_MANGLING ( \
h5bl_3d_setchunk, \
H5BL_3D_SETCHUNK )
h5_int64_t
h5bl_3d_setchunk (
const h5_int64_t* const fh,
const h5_int64_t* const i,
const h5_int64_t* const j,
const h5_int64_t* const k
) {
h5_file_t f = h5_filehandlefor2c (fh);
H5_API_ENTER (h5_int64_t,
"fh=%p, i=%lld, j=%lld, k=%lld",
(h5_file_p)f, (long long)*i, (long long)*j, (long long)*k);
H5_API_RETURN(h5b_3d_set_chunk (f, *i, *j, *k));
}
#define h5bl_3d_getchunk FC_MANGLING ( \
h5bl_3d_getchunk, \
H5BL_3D_GETCHUNK )
h5_int64_t
h5bl_3d_getchunk (
const h5_int64_t* const fh,
const char* const field_name,
h5_int64_t* const i,
h5_int64_t* const j,
h5_int64_t* const k,
const int l_field_name
) {
h5_file_t f = h5_filehandlefor2c (fh);
H5_API_ENTER (h5_int64_t,
"fh=%p, i=%p, j=%p, k=%p",
(h5_file_p)f, i, j, k);
char *field_name2 = h5_strdupfor2c (field_name, l_field_name);
h5_int64_t h5err = h5b_3d_get_chunk (f, field_name2, (h5_size_t*)i, (h5_size_t*)j, (h5_size_t*)k);
free (field_name2);
H5_API_RETURN (h5err);
}
#ifdef PARALLEL_IO
#define h5bl_3d_setgrid FC_MANGLING ( \
h5bl_3d_setgrid, \
h5bl_3d_setgrid)
h5_int64_t
h5bl_3d_setgrid (
const h5_int64_t* const fh,
const h5_int64_t* const i,
const h5_int64_t* const j,
const h5_int64_t* const k
) {
h5_file_t f = h5_filehandlefor2c (fh);
H5_API_ENTER (h5_int64_t,
"fh=%p, i=%lld, j=%lld, k=%lld",
(h5_file_p)f, (long long)*i, (long long)*j, (long long)*k);
H5_API_RETURN(h5b_3d_set_grid (f, *i, *j, *k));
}
#define h5bl_3d_getgrid FC_MANGLING ( \
h5bl_3d_getgrid, \
H5BL_3D_GETGRID)
h5_int64_t
h5bl_3d_getgrid (
const h5_int64_t* const fh,
const h5_int64_t* const proc,
h5_int64_t* const i,
h5_int64_t* const j,
h5_int64_t* const k
) {
h5_file_t f = h5_filehandlefor2c (fh);
H5_API_ENTER (h5_int64_t,
"fh=%p, proc=%lld, i=%p, j=%p, k=%p",
(h5_file_p)f, (long long)proc, i, j, k);
H5_API_RETURN(h5b_3d_get_grid_coords (f, (int)*proc, i, j, k));
}
#define h5bl_3d_setdims FC_MANGLING ( \
h5bl_3d_setdims, \
H5BL_3D_SETDIMS)
h5_int64_t
h5bl_3d_setdims (
const h5_int64_t* const fh,
const h5_int64_t* const i,
const h5_int64_t* const j,
const h5_int64_t* const k
) {
h5_file_t f = h5_filehandlefor2c (fh);
H5_API_ENTER (h5_int64_t,
"fh=%p, i=%lld, j=%lld, k=%lld",
(h5_file_p)f, (long long)*i, (long long)*j, (long long)*k);
H5_API_RETURN(h5b_3d_set_dims (f, *i, *j, *k));
}
#endif
#define h5bl_3d_sethalo FC_MANGLING ( \
h5bl_3d_sethalo, \
H5BL_3D_SETHALO)
h5_int64_t
h5bl_3d_sethalo (
const h5_int64_t* const fh,
const h5_int64_t* const i,
const h5_int64_t* const j,
const h5_int64_t* const k
) {
h5_file_t f = h5_filehandlefor2c (fh);
H5_API_ENTER (h5_int64_t,
"fh=%p, i=%lld, j=%lld, k=%lld",
(h5_file_p)f, (long long)*i, (long long)*j, (long long)*k);
H5_API_RETURN(h5b_3d_set_halo (f, *i, *j, *k));
}
#define h5bl_getnumfields FC_MANGLING ( \
h5bl_getnumfields, \
H5BL_GETNUMFIELDS )
h5_int64_t
h5bl_getnumfields (
const h5_int64_t* const fh
) {
h5_file_t f = h5_filehandlefor2c (fh);
H5_API_ENTER (h5_int64_t,
"fh=%p",
(h5_file_p)f);
H5_API_RETURN (h5b_get_num_fields (f));
}
#define h5bl_getfieldinfo FC_MANGLING ( \
h5bl_getfieldinfo, \
H5BL_GETFIELDINFO )
h5_int64_t
h5bl_getfieldinfo (
const h5_int64_t* const fh,
const h5_int64_t *idx,
char* const name,
h5_size_t* const field_rank,
h5_size_t* const field_dims,
h5_size_t* const elem_rank,
h5_int64_t* const type,
const int l_name
) {
h5_file_t f = h5_filehandlefor2c (fh);
H5_API_ENTER (h5_int64_t,
"fh=%p, idx=%lld, "
"name=%*s,"
"field_rank=%p, field_dims=%p, elem_rank=%p, type=%p",
(h5_file_p)f, (long long)*idx, l_name, name,
field_rank, field_dims, elem_rank, type);
h5_int64_t herr = h5b_get_field_info (
f, *idx - 1, name, (h5_size_t)l_name,
field_rank, field_dims, elem_rank, type );
h5_strc2for ( name, l_name );
H5_API_RETURN(herr);
}
#define h5bl_getfieldinfobyname FC_MANGLING ( \
h5bl_getfieldinfobyname, \
H5BL_GETFIELDINFOBYNAME)
h5_int64_t
h5bl_getfieldinfobyname (
const h5_int64_t* const fh,
const char* const field_name,
h5_size_t* const field_rank,
h5_size_t* const field_dims,
h5_size_t* const elem_rank,
h5_int64_t* const type,
const int l_field_name
) {
h5_file_t f = h5_filehandlefor2c (fh);
H5_API_ENTER (h5_int64_t,
"fh=%p"
", field_name=%*s,"
", field_rank=%p, field_dims=%p, elem_rank=%p, type=%p",
(h5_file_p)f, l_field_name, field_name,
field_rank, field_dims, elem_rank, type);
char *field_name2 = h5_strdupfor2c (field_name, l_field_name);
h5_int64_t herr = h5b_get_field_info_by_name (
f, field_name2,
field_rank, field_dims, elem_rank, type );
free (field_name2);
H5_API_RETURN(herr);
}
-268
View File
@@ -1,268 +0,0 @@
!> \ingroup h5block_data_f
!! See \ref H5Block3dWriteScalarFieldFloat64
!! \return 0 on success or error code
!<
INTEGER*8 FUNCTION h5bl_3d_write_scalar_field_r8 ( filehandle, name, buffer )
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open
CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the dataset
REAL*8, INTENT(IN) :: buffer(*) !< the array of data
END FUNCTION
!> \ingroup h5block_data_f
!! See \ref H5Block3dReadScalarFieldFloat64
!! \return 0 on success or error code
!<
INTEGER*8 FUNCTION h5bl_3d_read_scalar_field_r8 ( filehandle, name, buffer )
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open
CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the dataset
REAL*8, INTENT(OUT) :: buffer(*) !< buffer to read the data into
END FUNCTION
!> \ingroup h5block_data_f
!! See \ref H5Block3dWriteVector3dFieldFloat64
!! \return 0 on success or error code
!<
INTEGER*8 FUNCTION h5bl_3d_write_vector3d_field_r8 ( filehandle, name, x, y, z )
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open
CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the dataset
REAL*8, INTENT(IN) :: x(*) !< the array of x data to write
REAL*8, INTENT(IN) :: y(*) !< the array of y data to write
REAL*8, INTENT(IN) :: z(*) !< the array of z data to write
END FUNCTION
!> \ingroup h5block_data_f
!! See \ref H5Block3dReadVector3dFieldFloat64
!! \return 0 on success or error code
!<
INTEGER*8 FUNCTION h5bl_3d_read_vector3d_field_r8 ( filehandle, name, x, y, z )
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open
CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the dataset
REAL*8, INTENT(OUT) :: x(*) !< buffer to read the x data into
REAL*8, INTENT(OUT) :: y(*) !< buffer to read the y data into
REAL*8, INTENT(OUT) :: z(*) !< buffer to read the z data into
END FUNCTION
!> \ingroup h5block_data_f
!! See \ref H5Block3dWriteScalarFieldFloat32
!! \return 0 on success or error code
!<
INTEGER*8 FUNCTION h5bl_3d_write_scalar_field_r4 ( filehandle, name, buffer )
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open
CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the dataset
REAL*4, INTENT(IN) :: buffer(*) !< the array of data
END FUNCTION
!> \ingroup h5block_data_f
!! See \ref H5Block3dReadScalarFieldFloat32
!! \return 0 on success or error code
!<
INTEGER*8 FUNCTION h5bl_3d_read_scalar_field_r4 ( filehandle, name, buffer )
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open
CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the dataset
REAL*4, INTENT(OUT) :: buffer(*) !< buffer to read the data into
END FUNCTION
!> \ingroup h5block_data_f
!! See \ref H5Block3dWriteVector3dFieldFloat32
!! \return 0 on success or error code
!<
INTEGER*8 FUNCTION h5bl_3d_write_vector3d_field_r4 ( filehandle, name, x, y, z )
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open
CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the dataset
REAL*4, INTENT(IN) :: x(*) !< the array of x data to write
REAL*4, INTENT(IN) :: y(*) !< the array of y data to write
REAL*4, INTENT(IN) :: z(*) !< the array of z data to write
END FUNCTION
!> \ingroup h5block_data_f
!! See \ref H5Block3dReadVector3dFieldFloat32
!! \return 0 on success or error code
!<
INTEGER*8 FUNCTION h5bl_3d_read_vector3d_field_r4 ( filehandle, name, x, y, z )
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open
CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the dataset
REAL*4, INTENT(OUT) :: x(*) !< buffer to read the x data into
REAL*4, INTENT(OUT) :: y(*) !< buffer to read the y data into
REAL*4, INTENT(OUT) :: z(*) !< buffer to read the z data into
END FUNCTION
!> \ingroup h5block_data_f
!! See \ref H5Block3dWriteScalarFieldInt64
!! \return 0 on success or error code
!<
INTEGER*8 FUNCTION h5bl_3d_write_scalar_field_i8 ( filehandle, name, buffer )
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open
CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the dataset
INTEGER*8, INTENT(IN) :: buffer(*) !< the array of data
END FUNCTION
!> \ingroup h5block_data_f
!! See \ref H5Block3dReadScalarFieldInt64
!! \return 0 on success or error code
!<
INTEGER*8 FUNCTION h5bl_3d_read_scalar_field_i8 ( filehandle, name, buffer )
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open
CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the dataset
INTEGER*8, INTENT(OUT) :: buffer(*) !< buffer to read the data into
END FUNCTION
!> \ingroup h5block_data_f
!! See \ref H5Block3dWriteVector3dFieldInt64
!! \return 0 on success or error code
!<
INTEGER*8 FUNCTION h5bl_3d_write_vector3d_field_i8 ( filehandle, name, x, y, z )
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open
CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the dataset
INTEGER*8, INTENT(IN) :: x(*) !< the array of x data to write
INTEGER*8, INTENT(IN) :: y(*) !< the array of y data to write
INTEGER*8, INTENT(IN) :: z(*) !< the array of z data to write
END FUNCTION
!> \ingroup h5block_data_f
!! See \ref H5Block3dReadVector3dFieldInt64
!! \return 0 on success or error code
!<
INTEGER*8 FUNCTION h5bl_3d_read_vector3d_field_i8 ( filehandle, name, x, y, z )
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open
CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the dataset
INTEGER*8, INTENT(OUT) :: x(*) !< buffer to read the x data into
INTEGER*8, INTENT(OUT) :: y(*) !< buffer to read the y data into
INTEGER*8, INTENT(OUT) :: z(*) !< buffer to read the z data into
END FUNCTION
!> \ingroup h5block_data_f
!! See \ref H5Block3dWriteScalarFieldInt32
!! \return 0 on success or error code
!<
INTEGER*8 FUNCTION h5bl_3d_write_scalar_field_i4 ( filehandle, name, buffer )
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open
CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the dataset
INTEGER*4, INTENT(IN) :: buffer(*) !< the array of data
END FUNCTION
!> \ingroup h5block_data_f
!! See \ref H5Block3dReadScalarFieldInt32
!! \return 0 on success or error code
!<
INTEGER*8 FUNCTION h5bl_3d_read_scalar_field_i4 ( filehandle, name, buffer )
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open
CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the dataset
INTEGER*4, INTENT(OUT) :: buffer(*) !< buffer to read the data into
END FUNCTION
!> \ingroup h5block_data_f
!! See \ref H5Block3dWriteVector3dFieldInt32
!! \return 0 on success or error code
!<
INTEGER*8 FUNCTION h5bl_3d_write_vector3d_field_i4 ( filehandle, name, x, y, z )
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open
CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the dataset
INTEGER*4, INTENT(IN) :: x(*) !< the array of x data to write
INTEGER*4, INTENT(IN) :: y(*) !< the array of y data to write
INTEGER*4, INTENT(IN) :: z(*) !< the array of z data to write
END FUNCTION
!> \ingroup h5block_data_f
!! See \ref H5Block3dReadVector3dFieldInt32
!! \return 0 on success or error code
!<
INTEGER*8 FUNCTION h5bl_3d_read_vector3d_field_i4 ( filehandle, name, x, y, z )
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open
CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the dataset
INTEGER*4, INTENT(OUT) :: x(*) !< buffer to read the x data into
INTEGER*4, INTENT(OUT) :: y(*) !< buffer to read the y data into
INTEGER*4, INTENT(OUT) :: z(*) !< buffer to read the z data into
END FUNCTION
!> \ingroup h5block_attrib_f
!! See \ref H5BlockWriteFieldAttribFloat64
!! \return 0 on success or error code
!<
INTEGER*8 FUNCTION h5bl_writefieldattrib_r8 ( filehandle, field_name, attrib_name, attrib_value, attrib_nelem)
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open
CHARACTER(LEN=*), INTENT(IN) :: field_name !< the name of the field
CHARACTER(LEN=*), INTENT(IN) :: attrib_name !< the name of the attribute
REAL*8, INTENT(IN) :: buffer(*) !< the array of data to write into the attribute
INTEGER*8, INTENT(IN) :: nelems !< the number of elements in the array
END FUNCTION
!> \ingroup h5block_attrib_f
!! See \ref H5BlockReadFieldAttribFloat64
!! \return 0 on success or error code
!<
INTEGER*8 FUNCTION h5bl_readfieldattrib_r8 ( filehandle, field_name, attrib_name, attrib_value, attrib_nelem)
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open
CHARACTER(LEN=*), INTENT(IN) :: field_name !< the name of the field
CHARACTER(LEN=*), INTENT(IN) :: attrib_name !< the name of the attribute
REAL*8, INTENT(IN) :: buffer(*) !< the buffer to read into
END FUNCTION
!> \ingroup h5block_attrib_f
!! See \ref H5BlockWriteFieldAttribFloat32
!! \return 0 on success or error code
!<
INTEGER*8 FUNCTION h5bl_writefieldattrib_r4 ( filehandle, field_name, attrib_name, attrib_value, attrib_nelem)
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open
CHARACTER(LEN=*), INTENT(IN) :: field_name !< the name of the field
CHARACTER(LEN=*), INTENT(IN) :: attrib_name !< the name of the attribute
REAL*4, INTENT(IN) :: buffer(*) !< the array of data to write into the attribute
INTEGER*8, INTENT(IN) :: nelems !< the number of elements in the array
END FUNCTION
!> \ingroup h5block_attrib_f
!! See \ref H5BlockReadFieldAttribFloat32
!! \return 0 on success or error code
!<
INTEGER*8 FUNCTION h5bl_readfieldattrib_r4 ( filehandle, field_name, attrib_name, attrib_value, attrib_nelem)
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open
CHARACTER(LEN=*), INTENT(IN) :: field_name !< the name of the field
CHARACTER(LEN=*), INTENT(IN) :: attrib_name !< the name of the attribute
REAL*4, INTENT(IN) :: buffer(*) !< the buffer to read into
END FUNCTION
!> \ingroup h5block_attrib_f
!! See \ref H5BlockWriteFieldAttribInt64
!! \return 0 on success or error code
!<
INTEGER*8 FUNCTION h5bl_writefieldattrib_i8 ( filehandle, field_name, attrib_name, attrib_value, attrib_nelem)
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open
CHARACTER(LEN=*), INTENT(IN) :: field_name !< the name of the field
CHARACTER(LEN=*), INTENT(IN) :: attrib_name !< the name of the attribute
INTEGER*8, INTENT(IN) :: buffer(*) !< the array of data to write into the attribute
INTEGER*8, INTENT(IN) :: nelems !< the number of elements in the array
END FUNCTION
!> \ingroup h5block_attrib_f
!! See \ref H5BlockReadFieldAttribInt64
!! \return 0 on success or error code
!<
INTEGER*8 FUNCTION h5bl_readfieldattrib_i8 ( filehandle, field_name, attrib_name, attrib_value, attrib_nelem)
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open
CHARACTER(LEN=*), INTENT(IN) :: field_name !< the name of the field
CHARACTER(LEN=*), INTENT(IN) :: attrib_name !< the name of the attribute
INTEGER*8, INTENT(IN) :: buffer(*) !< the buffer to read into
END FUNCTION
!> \ingroup h5block_attrib_f
!! See \ref H5BlockWriteFieldAttribInt32
!! \return 0 on success or error code
!<
INTEGER*8 FUNCTION h5bl_writefieldattrib_i4 ( filehandle, field_name, attrib_name, attrib_value, attrib_nelem)
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open
CHARACTER(LEN=*), INTENT(IN) :: field_name !< the name of the field
CHARACTER(LEN=*), INTENT(IN) :: attrib_name !< the name of the attribute
INTEGER*4, INTENT(IN) :: buffer(*) !< the array of data to write into the attribute
INTEGER*8, INTENT(IN) :: nelems !< the number of elements in the array
END FUNCTION
!> \ingroup h5block_attrib_f
!! See \ref H5BlockReadFieldAttribInt32
!! \return 0 on success or error code
!<
INTEGER*8 FUNCTION h5bl_readfieldattrib_i4 ( filehandle, field_name, attrib_name, attrib_value, attrib_nelem)
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open
CHARACTER(LEN=*), INTENT(IN) :: field_name !< the name of the field
CHARACTER(LEN=*), INTENT(IN) :: attrib_name !< the name of the attribute
INTEGER*4, INTENT(IN) :: buffer(*) !< the buffer to read into
END FUNCTION
-677
View File
@@ -1,677 +0,0 @@
#include <stdlib.h>
#include "h5core/h5_core.h"
#include "Underscore.h"
#if defined(F77_SINGLE_UNDERSCORE)
#define F77NAME(a,b) a
#elif defined(F77_CRAY_UNDERSCORE)
#define F77NAME(a,b) b
#elif defined(F77_NO_UNDERSCORE)
#else
#error Error, no way to determine how to construct fortran bindings
#endif
#if ! defined(F77_NO_UNDERSCORE)
#define h5bl_3d_write_scalar_field_r8 F77NAME ( \
h5bl_3d_write_scalar_field_r8_, \
H5BL_3D_WRITE_SCALAR_FIELD_R8 )
#endif
h5_err_t
h5bl_3d_write_scalar_field_r8 (
h5_int64_t *const f,
const char *name,
const h5_float64_t *buffer,
const int l_name
) {
h5_file_t *fh = h5_filehandlefor2c(f);
H5_API_ENTER (h5_err_t,
"f=%p, name='%s', buffer=%p, l_name=%d",
fh, name, buffer, l_name);
char *name2 = h5_strdupfor2c ( name, l_name );
h5_err_t herr = h5b_write_scalar_data (
fh, name2, (void*)buffer, H5T_NATIVE_DOUBLE );
free ( name2 );
H5_API_RETURN(herr);
}
#if ! defined(F77_NO_UNDERSCORE)
#define h5bl_3d_read_scalar_field_r8 F77NAME ( \
h5bl_3d_read_scalar_field_r8_, \
H5BL_3D_READ_SCALAR_FIELD_R8 )
#endif
h5_err_t
h5bl_3d_read_scalar_field_r8 (
h5_int64_t *const f,
const char *name,
h5_float64_t *buffer,
const int l_name
) {
h5_file_t *fh = h5_filehandlefor2c(f);
H5_API_ENTER (h5_err_t,
"f=%p, name='%s', buffer=%p, l_name=%d",
fh, name, buffer, l_name);
char *name2 = h5_strdupfor2c ( name, l_name );
h5_err_t herr = h5b_read_scalar_data (
fh, name2, buffer, H5T_NATIVE_DOUBLE );
free ( name2 );
H5_API_RETURN(herr);
}
#if ! defined(F77_NO_UNDERSCORE)
#define h5bl_3d_write_vector3d_field_r8 F77NAME ( \
h5bl_3d_write_vector3d_field_r8_, \
H5BL_3D_WRITE_VECTOR3D_FIELD_R8 )
#endif
h5_err_t
h5bl_3d_write_vector3d_field_r8 (
h5_int64_t *const f,
const char *name,
const h5_float64_t *x_buf,
const h5_float64_t *y_buf,
const h5_float64_t *z_buf,
const int l_name
) {
h5_file_t *fh = h5_filehandlefor2c(f);
H5_API_ENTER (h5_err_t,
"f=%p, name='%s', x_buf=%p, y_buf=%p, z_buf=%p, l_name=%d",
fh, name, x_buf, y_buf, z_buf, l_name);
char *name2 = h5_strdupfor2c ( name, l_name );
h5_err_t herr = h5b_write_vector3d_data (
fh, name2,
(void*)x_buf, (void*)y_buf, (void*)z_buf, H5T_NATIVE_DOUBLE );
free ( name2 );
H5_API_RETURN(herr);
}
#if ! defined(F77_NO_UNDERSCORE)
#define h5bl_3d_read_vector3d_field_r8 F77NAME ( \
h5bl_3d_read_vector3d_field_r8_, \
H5BL_3D_READ_VECTOR3D_FIELD_R8 )
#endif
h5_err_t
h5bl_3d_read_vector3d_field_r8 (
h5_int64_t *const f,
const char *name,
h5_float64_t *x_buf,
h5_float64_t *y_buf,
h5_float64_t *z_buf,
const int l_name
) {
h5_file_t *fh = h5_filehandlefor2c(f);
H5_API_ENTER (h5_err_t,
"f=%p, name='%s', x_buf=%p, y_buf=%p, z_buf=%p, l_name=%d",
fh, name, x_buf, y_buf, z_buf, l_name);
char *name2 = h5_strdupfor2c ( name, l_name );
h5_err_t herr = h5b_read_vector3d_data (
fh, name2,
(void*)x_buf, (void*)y_buf, (void*)z_buf, H5T_NATIVE_DOUBLE );
free ( name2 );
H5_API_RETURN(herr);
}
#if ! defined(F77_NO_UNDERSCORE)
#define h5bl_3d_write_scalar_field_r4 F77NAME ( \
h5bl_3d_write_scalar_field_r4_, \
H5BL_3D_WRITE_SCALAR_FIELD_R4 )
#endif
h5_err_t
h5bl_3d_write_scalar_field_r4 (
h5_int64_t *const f,
const char *name,
const h5_float32_t *buffer,
const int l_name
) {
h5_file_t *fh = h5_filehandlefor2c(f);
H5_API_ENTER (h5_err_t,
"f=%p, name='%s', buffer=%p, l_name=%d",
fh, name, buffer, l_name);
char *name2 = h5_strdupfor2c ( name, l_name );
h5_err_t herr = h5b_write_scalar_data (
fh, name2, (void*)buffer, H5T_NATIVE_FLOAT );
free ( name2 );
H5_API_RETURN(herr);
}
#if ! defined(F77_NO_UNDERSCORE)
#define h5bl_3d_read_scalar_field_r4 F77NAME ( \
h5bl_3d_read_scalar_field_r4_, \
H5BL_3D_READ_SCALAR_FIELD_R4 )
#endif
h5_err_t
h5bl_3d_read_scalar_field_r4 (
h5_int64_t *const f,
const char *name,
h5_float32_t *buffer,
const int l_name
) {
h5_file_t *fh = h5_filehandlefor2c(f);
H5_API_ENTER (h5_err_t,
"f=%p, name='%s', buffer=%p, l_name=%d",
fh, name, buffer, l_name);
char *name2 = h5_strdupfor2c ( name, l_name );
h5_err_t herr = h5b_read_scalar_data (
fh, name2, buffer, H5T_NATIVE_FLOAT );
free ( name2 );
H5_API_RETURN(herr);
}
#if ! defined(F77_NO_UNDERSCORE)
#define h5bl_3d_write_vector3d_field_r4 F77NAME ( \
h5bl_3d_write_vector3d_field_r4_, \
H5BL_3D_WRITE_VECTOR3D_FIELD_R4 )
#endif
h5_err_t
h5bl_3d_write_vector3d_field_r4 (
h5_int64_t *const f,
const char *name,
const h5_float32_t *x_buf,
const h5_float32_t *y_buf,
const h5_float32_t *z_buf,
const int l_name
) {
h5_file_t *fh = h5_filehandlefor2c(f);
H5_API_ENTER (h5_err_t,
"f=%p, name='%s', x_buf=%p, y_buf=%p, z_buf=%p, l_name=%d",
fh, name, x_buf, y_buf, z_buf, l_name);
char *name2 = h5_strdupfor2c ( name, l_name );
h5_err_t herr = h5b_write_vector3d_data (
fh, name2,
(void*)x_buf, (void*)y_buf, (void*)z_buf, H5T_NATIVE_FLOAT );
free ( name2 );
H5_API_RETURN(herr);
}
#if ! defined(F77_NO_UNDERSCORE)
#define h5bl_3d_read_vector3d_field_r4 F77NAME ( \
h5bl_3d_read_vector3d_field_r4_, \
H5BL_3D_READ_VECTOR3D_FIELD_R4 )
#endif
h5_err_t
h5bl_3d_read_vector3d_field_r4 (
h5_int64_t *const f,
const char *name,
h5_float32_t *x_buf,
h5_float32_t *y_buf,
h5_float32_t *z_buf,
const int l_name
) {
h5_file_t *fh = h5_filehandlefor2c(f);
H5_API_ENTER (h5_err_t,
"f=%p, name='%s', x_buf=%p, y_buf=%p, z_buf=%p, l_name=%d",
fh, name, x_buf, y_buf, z_buf, l_name);
char *name2 = h5_strdupfor2c ( name, l_name );
h5_err_t herr = h5b_read_vector3d_data (
fh, name2,
(void*)x_buf, (void*)y_buf, (void*)z_buf, H5T_NATIVE_FLOAT );
free ( name2 );
H5_API_RETURN(herr);
}
#if ! defined(F77_NO_UNDERSCORE)
#define h5bl_3d_write_scalar_field_i8 F77NAME ( \
h5bl_3d_write_scalar_field_i8_, \
H5BL_3D_WRITE_SCALAR_FIELD_I8 )
#endif
h5_err_t
h5bl_3d_write_scalar_field_i8 (
h5_int64_t *const f,
const char *name,
const h5_int64_t *buffer,
const int l_name
) {
h5_file_t *fh = h5_filehandlefor2c(f);
H5_API_ENTER (h5_err_t,
"f=%p, name='%s', buffer=%p, l_name=%d",
fh, name, buffer, l_name);
char *name2 = h5_strdupfor2c ( name, l_name );
h5_err_t herr = h5b_write_scalar_data (
fh, name2, (void*)buffer, H5T_NATIVE_INT64 );
free ( name2 );
H5_API_RETURN(herr);
}
#if ! defined(F77_NO_UNDERSCORE)
#define h5bl_3d_read_scalar_field_i8 F77NAME ( \
h5bl_3d_read_scalar_field_i8_, \
H5BL_3D_READ_SCALAR_FIELD_I8 )
#endif
h5_err_t
h5bl_3d_read_scalar_field_i8 (
h5_int64_t *const f,
const char *name,
h5_int64_t *buffer,
const int l_name
) {
h5_file_t *fh = h5_filehandlefor2c(f);
H5_API_ENTER (h5_err_t,
"f=%p, name='%s', buffer=%p, l_name=%d",
fh, name, buffer, l_name);
char *name2 = h5_strdupfor2c ( name, l_name );
h5_err_t herr = h5b_read_scalar_data (
fh, name2, buffer, H5T_NATIVE_INT64 );
free ( name2 );
H5_API_RETURN(herr);
}
#if ! defined(F77_NO_UNDERSCORE)
#define h5bl_3d_write_vector3d_field_i8 F77NAME ( \
h5bl_3d_write_vector3d_field_i8_, \
H5BL_3D_WRITE_VECTOR3D_FIELD_I8 )
#endif
h5_err_t
h5bl_3d_write_vector3d_field_i8 (
h5_int64_t *const f,
const char *name,
const h5_int64_t *x_buf,
const h5_int64_t *y_buf,
const h5_int64_t *z_buf,
const int l_name
) {
h5_file_t *fh = h5_filehandlefor2c(f);
H5_API_ENTER (h5_err_t,
"f=%p, name='%s', x_buf=%p, y_buf=%p, z_buf=%p, l_name=%d",
fh, name, x_buf, y_buf, z_buf, l_name);
char *name2 = h5_strdupfor2c ( name, l_name );
h5_err_t herr = h5b_write_vector3d_data (
fh, name2,
(void*)x_buf, (void*)y_buf, (void*)z_buf, H5T_NATIVE_INT64 );
free ( name2 );
H5_API_RETURN(herr);
}
#if ! defined(F77_NO_UNDERSCORE)
#define h5bl_3d_read_vector3d_field_i8 F77NAME ( \
h5bl_3d_read_vector3d_field_i8_, \
H5BL_3D_READ_VECTOR3D_FIELD_I8 )
#endif
h5_err_t
h5bl_3d_read_vector3d_field_i8 (
h5_int64_t *const f,
const char *name,
h5_int64_t *x_buf,
h5_int64_t *y_buf,
h5_int64_t *z_buf,
const int l_name
) {
h5_file_t *fh = h5_filehandlefor2c(f);
H5_API_ENTER (h5_err_t,
"f=%p, name='%s', x_buf=%p, y_buf=%p, z_buf=%p, l_name=%d",
fh, name, x_buf, y_buf, z_buf, l_name);
char *name2 = h5_strdupfor2c ( name, l_name );
h5_err_t herr = h5b_read_vector3d_data (
fh, name2,
(void*)x_buf, (void*)y_buf, (void*)z_buf, H5T_NATIVE_INT64 );
free ( name2 );
H5_API_RETURN(herr);
}
#if ! defined(F77_NO_UNDERSCORE)
#define h5bl_3d_write_scalar_field_i4 F77NAME ( \
h5bl_3d_write_scalar_field_i4_, \
H5BL_3D_WRITE_SCALAR_FIELD_I4 )
#endif
h5_err_t
h5bl_3d_write_scalar_field_i4 (
h5_int64_t *const f,
const char *name,
const h5_int32_t *buffer,
const int l_name
) {
h5_file_t *fh = h5_filehandlefor2c(f);
H5_API_ENTER (h5_err_t,
"f=%p, name='%s', buffer=%p, l_name=%d",
fh, name, buffer, l_name);
char *name2 = h5_strdupfor2c ( name, l_name );
h5_err_t herr = h5b_write_scalar_data (
fh, name2, (void*)buffer, H5T_NATIVE_INT32 );
free ( name2 );
H5_API_RETURN(herr);
}
#if ! defined(F77_NO_UNDERSCORE)
#define h5bl_3d_read_scalar_field_i4 F77NAME ( \
h5bl_3d_read_scalar_field_i4_, \
H5BL_3D_READ_SCALAR_FIELD_I4 )
#endif
h5_err_t
h5bl_3d_read_scalar_field_i4 (
h5_int64_t *const f,
const char *name,
h5_int32_t *buffer,
const int l_name
) {
h5_file_t *fh = h5_filehandlefor2c(f);
H5_API_ENTER (h5_err_t,
"f=%p, name='%s', buffer=%p, l_name=%d",
fh, name, buffer, l_name);
char *name2 = h5_strdupfor2c ( name, l_name );
h5_err_t herr = h5b_read_scalar_data (
fh, name2, buffer, H5T_NATIVE_INT32 );
free ( name2 );
H5_API_RETURN(herr);
}
#if ! defined(F77_NO_UNDERSCORE)
#define h5bl_3d_write_vector3d_field_i4 F77NAME ( \
h5bl_3d_write_vector3d_field_i4_, \
H5BL_3D_WRITE_VECTOR3D_FIELD_I4 )
#endif
h5_err_t
h5bl_3d_write_vector3d_field_i4 (
h5_int64_t *const f,
const char *name,
const h5_int32_t *x_buf,
const h5_int32_t *y_buf,
const h5_int32_t *z_buf,
const int l_name
) {
h5_file_t *fh = h5_filehandlefor2c(f);
H5_API_ENTER (h5_err_t,
"f=%p, name='%s', x_buf=%p, y_buf=%p, z_buf=%p, l_name=%d",
fh, name, x_buf, y_buf, z_buf, l_name);
char *name2 = h5_strdupfor2c ( name, l_name );
h5_err_t herr = h5b_write_vector3d_data (
fh, name2,
(void*)x_buf, (void*)y_buf, (void*)z_buf, H5T_NATIVE_INT32 );
free ( name2 );
H5_API_RETURN(herr);
}
#if ! defined(F77_NO_UNDERSCORE)
#define h5bl_3d_read_vector3d_field_i4 F77NAME ( \
h5bl_3d_read_vector3d_field_i4_, \
H5BL_3D_READ_VECTOR3D_FIELD_I4 )
#endif
h5_err_t
h5bl_3d_read_vector3d_field_i4 (
h5_int64_t *const f,
const char *name,
h5_int32_t *x_buf,
h5_int32_t *y_buf,
h5_int32_t *z_buf,
const int l_name
) {
h5_file_t *fh = h5_filehandlefor2c(f);
H5_API_ENTER (h5_err_t,
"f=%p, name='%s', x_buf=%p, y_buf=%p, z_buf=%p, l_name=%d",
fh, name, x_buf, y_buf, z_buf, l_name);
char *name2 = h5_strdupfor2c ( name, l_name );
h5_err_t herr = h5b_read_vector3d_data (
fh, name2,
(void*)x_buf, (void*)y_buf, (void*)z_buf, H5T_NATIVE_INT32 );
free ( name2 );
H5_API_RETURN(herr);
}
#if ! defined(F77_NO_UNDERSCORE)
#define h5bl_writefieldattrib_r8 F77NAME ( \
h5bl_writefieldattrib_r8_, \
H5BL_WRITEFIELDATTRIB_R8 )
#endif
h5_err_t
h5bl_writefieldattrib_r8 (
h5_int64_t *const f,
const char *field_name,
const char *attrib_name,
const h5_float64_t *buffer,
const h5_size_t *nelems,
const int l_field_name,
const int l_attrib_name
) {
h5_file_t *fh = h5_filehandlefor2c(f);
H5_API_ENTER (h5_err_t,
"f=%p, field_name='%s', attrib_name='%s', "
"buffer=%p, nelems=%lld, l_field_name=%d, l_attrib_name=%d",
fh, field_name, attrib_name, buffer, (long long)*nelems,
l_field_name, l_attrib_name);
char *field_name2 = h5_strdupfor2c ( field_name, l_field_name );
char *attrib_name2 = h5_strdupfor2c ( attrib_name, l_attrib_name );
h5_err_t herr = h5_write_field_attrib (
fh, field_name2, attrib_name2,
H5T_NATIVE_DOUBLE, buffer, *nelems );
free ( field_name2 );
free ( attrib_name2 );
H5_API_RETURN(herr);
}
#if ! defined(F77_NO_UNDERSCORE)
#define h5bl_readfieldattrib_r8 F77NAME ( \
h5bl_readfieldattrib_r8_, \
H5BL_READFIELDATTRIB_R8 )
#endif
h5_err_t
h5bl_readfieldattrib_r8 (
h5_int64_t *const f,
const char *field_name,
const char *attrib_name,
h5_float64_t *buffer,
const int l_field_name,
const int l_attrib_name
) {
h5_file_t *fh = h5_filehandlefor2c(f);
H5_API_ENTER (h5_err_t,
"f=%p, field_name='%s', attrib_name='%s', "
"values=%p, l_field_name=%d, l_attrib_name=%d",
fh, field_name, attrib_name, buffer,
l_field_name, l_attrib_name);
char *field_name2 = h5_strdupfor2c ( field_name, l_field_name );
char *attrib_name2 = h5_strdupfor2c ( attrib_name, l_attrib_name );
h5_err_t herr = h5_read_field_attrib (
fh, field_name2, attrib_name2, H5T_NATIVE_DOUBLE, buffer );
free ( field_name2 );
free ( attrib_name2 );
H5_API_RETURN(herr);
}
#if ! defined(F77_NO_UNDERSCORE)
#define h5bl_writefieldattrib_r4 F77NAME ( \
h5bl_writefieldattrib_r4_, \
H5BL_WRITEFIELDATTRIB_R4 )
#endif
h5_err_t
h5bl_writefieldattrib_r4 (
h5_int64_t *const f,
const char *field_name,
const char *attrib_name,
const h5_float32_t *buffer,
const h5_size_t *nelems,
const int l_field_name,
const int l_attrib_name
) {
h5_file_t *fh = h5_filehandlefor2c(f);
H5_API_ENTER (h5_err_t,
"f=%p, field_name='%s', attrib_name='%s', "
"buffer=%p, nelems=%lld, l_field_name=%d, l_attrib_name=%d",
fh, field_name, attrib_name, buffer, (long long)*nelems,
l_field_name, l_attrib_name);
char *field_name2 = h5_strdupfor2c ( field_name, l_field_name );
char *attrib_name2 = h5_strdupfor2c ( attrib_name, l_attrib_name );
h5_err_t herr = h5_write_field_attrib (
fh, field_name2, attrib_name2,
H5T_NATIVE_FLOAT, buffer, *nelems );
free ( field_name2 );
free ( attrib_name2 );
H5_API_RETURN(herr);
}
#if ! defined(F77_NO_UNDERSCORE)
#define h5bl_readfieldattrib_r4 F77NAME ( \
h5bl_readfieldattrib_r4_, \
H5BL_READFIELDATTRIB_R4 )
#endif
h5_err_t
h5bl_readfieldattrib_r4 (
h5_int64_t *const f,
const char *field_name,
const char *attrib_name,
h5_float32_t *buffer,
const int l_field_name,
const int l_attrib_name
) {
h5_file_t *fh = h5_filehandlefor2c(f);
H5_API_ENTER (h5_err_t,
"f=%p, field_name='%s', attrib_name='%s', "
"values=%p, l_field_name=%d, l_attrib_name=%d",
fh, field_name, attrib_name, buffer,
l_field_name, l_attrib_name);
char *field_name2 = h5_strdupfor2c ( field_name, l_field_name );
char *attrib_name2 = h5_strdupfor2c ( attrib_name, l_attrib_name );
h5_err_t herr = h5_read_field_attrib (
fh, field_name2, attrib_name2, H5T_NATIVE_FLOAT, buffer );
free ( field_name2 );
free ( attrib_name2 );
H5_API_RETURN(herr);
}
#if ! defined(F77_NO_UNDERSCORE)
#define h5bl_writefieldattrib_i8 F77NAME ( \
h5bl_writefieldattrib_i8_, \
H5BL_WRITEFIELDATTRIB_I8 )
#endif
h5_err_t
h5bl_writefieldattrib_i8 (
h5_int64_t *const f,
const char *field_name,
const char *attrib_name,
const h5_int64_t *buffer,
const h5_size_t *nelems,
const int l_field_name,
const int l_attrib_name
) {
h5_file_t *fh = h5_filehandlefor2c(f);
H5_API_ENTER (h5_err_t,
"f=%p, field_name='%s', attrib_name='%s', "
"buffer=%p, nelems=%lld, l_field_name=%d, l_attrib_name=%d",
fh, field_name, attrib_name, buffer, (long long)*nelems,
l_field_name, l_attrib_name);
char *field_name2 = h5_strdupfor2c ( field_name, l_field_name );
char *attrib_name2 = h5_strdupfor2c ( attrib_name, l_attrib_name );
h5_err_t herr = h5_write_field_attrib (
fh, field_name2, attrib_name2,
H5T_NATIVE_INT64, buffer, *nelems );
free ( field_name2 );
free ( attrib_name2 );
H5_API_RETURN(herr);
}
#if ! defined(F77_NO_UNDERSCORE)
#define h5bl_readfieldattrib_i8 F77NAME ( \
h5bl_readfieldattrib_i8_, \
H5BL_READFIELDATTRIB_I8 )
#endif
h5_err_t
h5bl_readfieldattrib_i8 (
h5_int64_t *const f,
const char *field_name,
const char *attrib_name,
h5_int64_t *buffer,
const int l_field_name,
const int l_attrib_name
) {
h5_file_t *fh = h5_filehandlefor2c(f);
H5_API_ENTER (h5_err_t,
"f=%p, field_name='%s', attrib_name='%s', "
"values=%p, l_field_name=%d, l_attrib_name=%d",
fh, field_name, attrib_name, buffer,
l_field_name, l_attrib_name);
char *field_name2 = h5_strdupfor2c ( field_name, l_field_name );
char *attrib_name2 = h5_strdupfor2c ( attrib_name, l_attrib_name );
h5_err_t herr = h5_read_field_attrib (
fh, field_name2, attrib_name2, H5T_NATIVE_INT64, buffer );
free ( field_name2 );
free ( attrib_name2 );
H5_API_RETURN(herr);
}
#if ! defined(F77_NO_UNDERSCORE)
#define h5bl_writefieldattrib_i4 F77NAME ( \
h5bl_writefieldattrib_i4_, \
H5BL_WRITEFIELDATTRIB_I4 )
#endif
h5_err_t
h5bl_writefieldattrib_i4 (
h5_int64_t *const f,
const char *field_name,
const char *attrib_name,
const h5_int32_t *buffer,
const h5_size_t *nelems,
const int l_field_name,
const int l_attrib_name
) {
h5_file_t *fh = h5_filehandlefor2c(f);
H5_API_ENTER (h5_err_t,
"f=%p, field_name='%s', attrib_name='%s', "
"buffer=%p, nelems=%lld, l_field_name=%d, l_attrib_name=%d",
fh, field_name, attrib_name, buffer, (long long)*nelems,
l_field_name, l_attrib_name);
char *field_name2 = h5_strdupfor2c ( field_name, l_field_name );
char *attrib_name2 = h5_strdupfor2c ( attrib_name, l_attrib_name );
h5_err_t herr = h5_write_field_attrib (
fh, field_name2, attrib_name2,
H5T_NATIVE_INT32, buffer, *nelems );
free ( field_name2 );
free ( attrib_name2 );
H5_API_RETURN(herr);
}
#if ! defined(F77_NO_UNDERSCORE)
#define h5bl_readfieldattrib_i4 F77NAME ( \
h5bl_readfieldattrib_i4_, \
H5BL_READFIELDATTRIB_I4 )
#endif
h5_err_t
h5bl_readfieldattrib_i4 (
h5_int64_t *const f,
const char *field_name,
const char *attrib_name,
h5_int32_t *buffer,
const int l_field_name,
const int l_attrib_name
) {
h5_file_t *fh = h5_filehandlefor2c(f);
H5_API_ENTER (h5_err_t,
"f=%p, field_name='%s', attrib_name='%s', "
"values=%p, l_field_name=%d, l_attrib_name=%d",
fh, field_name, attrib_name, buffer,
l_field_name, l_attrib_name);
char *field_name2 = h5_strdupfor2c ( field_name, l_field_name );
char *attrib_name2 = h5_strdupfor2c ( attrib_name, l_attrib_name );
h5_err_t herr = h5_read_field_attrib (
fh, field_name2, attrib_name2, H5T_NATIVE_INT32, buffer );
free ( field_name2 );
free ( attrib_name2 );
H5_API_RETURN(herr);
}
-177
View File
@@ -1,177 +0,0 @@
!!!!!!!! Setting up the Data Model !!!!!!!!
!> \ingroup h5part_model_f
!! See \ref H5PartSetNumParticles
!! \return 0 on success or error code
!<
INTEGER*8 FUNCTION h5pt_setnpoints ( filehandle, npoints )
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned during file open
INTEGER*8, INTENT(IN) :: npoints !< the number of particles on *this* processor
END FUNCTION
!> \ingroup h5part_model_f
!! See \ref H5PartSetNumParticlesStrided
!! \return 0 on success or error code
!<
INTEGER*8 FUNCTION h5pt_setnpoints_strided ( filehandle, npoints, stride )
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned during file open
INTEGER*8, INTENT(IN) :: npoints !< the number of particles on *this* processor
INTEGER*8, INTENT(IN) :: stride !< the stride value (e.g. the number of fields in the particle data array)
END FUNCTION
!> \ingroup h5part_model_f
!! See \ref H5PartGetNumDatasets
!! \return the number of datasets or error code
!<
INTEGER*8 FUNCTION h5pt_getndatasets (filehandle)
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned during file open
END FUNCTION
!> \ingroup h5part_model_f
!! See \ref H5PartGetNumParticles
!! \return the number of particles or error code
!<
INTEGER*8 FUNCTION h5pt_getnpoints (filehandle)
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned during file open
END FUNCTION
!> \ingroup h5part_model_f
!! See \ref H5PartGetDatasetName
!! \return 0 on success or error code
!<
INTEGER*8 FUNCTION h5pt_getdatasetname (filehandle,index,name)
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned during file open
INTEGER*8, INTENT(IN) :: index !< index of dataset to query (starting from 0)
CHARACTER(LEN=*), INTENT(OUT) :: name !< buffer to read the dataset name into
END FUNCTION
!> \ingroup h5part_model_f
!! See \ref H5PartSetView
!! \return 0 on success or error code
!<
INTEGER*8 FUNCTION h5pt_setview (filehandle,start,end)
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned during file open
INTEGER*8, INTENT(IN) :: start !< offset of the first particle in the view
INTEGER*8, INTENT(IN) :: end !< offset of the last particle in the view (inclusive)
END FUNCTION
!> \ingroup h5part_model_f
!! See \ref H5PartSetViewIndices
!! \return 0 on success or error code
!<
INTEGER*8 FUNCTION h5pt_setview_indices (filehandle,indices,nelem)
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned during file open
INTEGER*8, INTENT(IN) :: indices(*) !< list of indicies to select in this view
INTEGER*8, INTENT(IN) :: nelem !< number of particles in the list
END FUNCTION
!> \ingroup h5part_model_f
!! See \ref H5PartResetView
!! \return 0 on success or error code
!<
INTEGER*8 FUNCTION h5pt_resetview (filehandle)
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned during file open
END FUNCTION
!> \ingroup h5part_model_f
!! See \ref H5PartResetView
!! \return 1 if true, 0 if false, or error code
!<
INTEGER*8 FUNCTION h5pt_hasview (filehandle)
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned during file open
END FUNCTION
!> \ingroup h5part_model_f
!! See \ref H5PartGetView
!! \return 0 on success or error code
!<
INTEGER*8 FUNCTION h5pt_getview (filehandle,start,end)
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned during file open
INTEGER*8, INTENT(OUT) :: start !< buffer to store the offset of the first particle in the view
INTEGER*8, INTENT(OUT) :: end !< buffer to store the offset of the last particle in the view (inclusive)
END FUNCTION
!!!!!!!! Reading and Writing Datasets !!!!!!!!
!> \ingroup h5part_data_f
!! See \ref H5PartWriteDataFloat64
!! \return 0 on success or error code
!<
INTEGER*8 FUNCTION h5pt_writedata_r8 ( filehandle, name, data )
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned during file open
CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the dataset
REAL*8, INTENT(IN) :: data(*) !< the array of float64 data to write
END FUNCTION
!> \ingroup h5part_data_f
!! See \ref H5PartWriteDataFloat32
!! \return 0 on success or error code
!<
INTEGER*8 FUNCTION h5pt_writedata_r4 ( filehandle, name, data )
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned during file open
CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the dataset
REAL, INTENT(IN) :: data(*) !< the array of float32 data to write
END FUNCTION
!> \ingroup h5part_data_f
!! See \ref H5PartWriteDataInt64
!! \return 0 on success or error code
!<
INTEGER*8 FUNCTION h5pt_writedata_i8 ( filehandle, name, data )
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned during file open
CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the dataset
INTEGER*8, INTENT(IN) :: data(*) !< the array of int64 data to write
END FUNCTION
!> \ingroup h5part_data_f
!! See \ref H5PartWriteDataInt32
!! \return 0 on success or error code
!<
INTEGER*8 FUNCTION h5pt_writedata_i4 ( filehandle, name, data )
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned during file open
CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the dataset
INTEGER, INTENT(IN) :: data(*) !< the array of int32 data to write
END FUNCTION
!> \ingroup h5part_data_f
!! See \ref H5PartReadDataFloat64
!! \return 0 on success or error code
!<
INTEGER*8 FUNCTION h5pt_readdata_r8 (filehandle,name,data)
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned during file open
CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the dataset
REAL*8, INTENT(OUT) :: data(*) !< array to read float64 data into
END FUNCTION
!> \ingroup h5part_data_f
!! See \ref H5PartReadDataFloat32
!! \return 0 on success or error code
!<
INTEGER*8 FUNCTION h5pt_readdata_r4 (filehandle,name,data)
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned during file open
CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the dataset
REAL, INTENT(OUT) :: data(*) !< array to read float32 data into
END FUNCTION
!> \ingroup h5part_data_f
!! See \ref H5PartReadDataInt64
!! \return 0 on success or error code
!<
INTEGER*8 FUNCTION h5pt_readdata_i8 (filehandle,name,data)
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned during file open
CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the dataset
INTEGER*8, INTENT(OUT) :: data(*) !< array to read int64 data into
END FUNCTION
!> \ingroup h5part_data_f
!! See \ref H5PartReadDataInt32
!! \return 0 on success or error code
!<
INTEGER*8 FUNCTION h5pt_readdata_i4 (filehandle,name,data)
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned during file open
CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the dataset
INTEGER, INTENT(OUT) :: data(*) !< array to read int32 data into
END FUNCTION
-345
View File
@@ -1,345 +0,0 @@
#include <stdlib.h>
#include "h5core/h5_core.h"
#include "Underscore.h"
#if defined(F77_SINGLE_UNDERSCORE)
#define F77NAME(a,b) a
#elif defined(F77_CRAY_UNDERSCORE)
#define F77NAME(a,b) b
#elif defined(F77_NO_UNDERSCORE)
#else
#error Error, no way to determine how to construct fortran bindings
#endif
#if ! defined(F77_NO_UNDERSCORE)
#define h5pt_setnpoints F77NAME ( \
h5pt_setnpoints_, \
H5PT_SETNPOINTS )
#define h5pt_setnpoints_strided F77NAME ( \
h5pt_setnpoints_strided_, \
H5PT_SETNPOINTS_STRIDED )
#define h5pt_getnsteps F77NAME ( \
h5pt_getnsteps_, \
H5PT_GETNSTEPS )
#define h5pt_getndatasets F77NAME ( \
h5pt_getndatasets_, \
H5PT_GETNDATASETS )
#define h5pt_getnpoints F77NAME ( \
h5pt_getnpoints_, \
H5PT_GETNPOINTS )
#define h5pt_getdatasetname F77NAME ( \
h5pt_getdatasetname_, \
H5PT_GETDATASETNAME )
#define h5pt_setview F77NAME ( \
h5pt_setview_, \
H5PT_SETVIEW )
#define h5pt_setview_indices F77NAME ( \
h5pt_setview_indices_, \
H5PT_SETVIEW_INDICES )
#define h5pt_resetview F77NAME ( \
h5pt_resetview_, \
H5PT_RESETVIEW )
#define h5pt_hasview F77NAME ( \
h5pt_hasview_, \
H5PT_HASVIEW )
#define h5pt_getview F77NAME ( \
h5pt_getview_, \
H5PT_GETVIEW )
#define h5pt_writedata_r8 F77NAME ( \
h5pt_writedata_r8_, \
H5PT_WRITEDATA_R8 )
#define h5pt_writedata_r4 F77NAME ( \
h5pt_writedata_r4_, \
H5PT_WRITEDATA_R4 )
#define h5pt_writedata_i8 F77NAME ( \
h5pt_writedata_i8_, \
H5PT_WRITEDATA_I8 )
#define h5pt_writedata_i4 F77NAME ( \
h5pt_writedata_i4_, \
H5PT_WRITEDATA_I4 )
#define h5pt_readdata_r8 F77NAME ( \
h5pt_readdata_r8_, \
H5PT_READDATA_R8 )
#define h5pt_readdata_r4 F77NAME ( \
h5pt_readdata_r4_, \
H5PT_READDATA_R4 )
#define h5pt_readdata_i8 F77NAME ( \
h5pt_readdata_i8_, \
H5PT_READDATA_I8 )
#define h5pt_readdata_i4 F77NAME ( \
h5pt_readdata_i4_, \
H5PT_READDATA_I4 )
#endif
h5_err_t
h5pt_setnpoints (
const h5_int64_t *f,
h5_int64_t *n
) {
h5_file_t *fh = h5_filehandlefor2c(f);
H5_API_ENTER (h5_err_t, "f=%p, n=%lld", fh, (long long)*n);
H5_API_RETURN(h5u_set_num_particles ( fh, *n, 1 ));
}
h5_err_t
h5pt_setnpoints_strided (
const h5_int64_t *f,
h5_int64_t *n,
h5_int64_t *stride
) {
h5_file_t *fh = h5_filehandlefor2c(f);
H5_API_ENTER (h5_err_t, "f=%p, n=%lld, stride=%lld",
fh, (long long)*n, (long long)*stride);
H5_API_RETURN(h5u_set_num_particles ( fh, *n, *stride ));
}
/*==============Reading Data Characteristics============*/
h5_int64_t
h5pt_getndatasets (
const h5_int64_t *f
) {
h5_file_t *fh = h5_filehandlefor2c(f);
H5_API_ENTER (h5_int64_t, "f=%p", fh);
H5_API_RETURN(h5u_get_num_datasets ( fh ));
}
h5_int64_t
h5pt_getnpoints (
const h5_int64_t *f
) {
h5_file_t *fh = h5_filehandlefor2c(f);
H5_API_ENTER (h5_int64_t, "f=%p", fh);
H5_API_RETURN(h5u_get_num_particles ( fh ));
}
h5_err_t
h5pt_getdatasetname (
const h5_int64_t *f,
const h5_int64_t *index,
char *name,
const int l_name
) {
h5_file_t *fh = h5_filehandlefor2c(f);
H5_API_ENTER (h5_err_t, "f=%p, index=%lld, name='%s', l_name=%d",
fh, (long long)*index, name, l_name);
h5_err_t herr = h5u_get_dataset_info (
fh, *index, name, l_name, NULL, NULL );
h5_strc2for ( name, l_name );
H5_API_RETURN(herr);
}
/*=============Setting and getting views================*/
h5_err_t
h5pt_setview (
const h5_int64_t *f,
const h5_int64_t *start,
const h5_int64_t *end
) {
h5_file_t *fh = h5_filehandlefor2c(f);
H5_API_ENTER (h5_err_t, "f=%p, start=%lld, end=%lld",
fh, (long long)*start, (long long)*end);
H5_API_RETURN(h5u_set_view ( fh, (*start)-1, (*end)-1 ));
}
h5_err_t
h5pt_setview_indices (
const h5_int64_t *f,
const h5_int64_t *indices,
const h5_int64_t *nelem
) {
h5_file_t *fh = h5_filehandlefor2c(f);
H5_API_ENTER (h5_err_t, "f=%p, indices=%p, nelem=%lld",
fh, indices, (long long)*nelem);
H5_API_RETURN(h5u_set_view_indices ( fh, indices, *nelem ));
}
h5_err_t
h5pt_resetview (
const h5_int64_t *f
) {
h5_file_t *fh = h5_filehandlefor2c(f);
H5_API_ENTER (h5_err_t, "f=%p", fh);
H5_API_RETURN(h5u_reset_view ( fh ));
}
h5_err_t
h5pt_hasview (
const h5_int64_t *f
) {
h5_file_t *fh = h5_filehandlefor2c(f);
H5_API_ENTER (h5_err_t, "f=%p", fh);
H5_API_RETURN(h5u_has_view ( fh ));
}
h5_err_t
h5pt_getview (
const h5_int64_t *f,
h5_int64_t *start,
h5_int64_t *end
) {
h5_file_t *fh = h5_filehandlefor2c(f);
H5_API_ENTER (h5_err_t, "f=%p, start=%p, end=%p",
fh, start, end);
H5_API_RETURN(h5u_get_view ( fh, start, end));
}
/*==================Writing data ============*/
h5_err_t
h5pt_writedata_r8 (
const h5_int64_t *f,
const char *name,
const h5_float64_t *data,
const int l_name ) {
h5_file_t *fh = h5_filehandlefor2c(f);
H5_API_ENTER (h5_err_t, "f=%p, name='%s', data=%p, l_name=%d",
fh, name, data, l_name);
char *name2 = h5_strdupfor2c ( name, l_name );
h5_err_t herr = h5u_write_data (
fh, name2, (void*)data, H5T_NATIVE_DOUBLE );
free ( name2 );
H5_API_RETURN(herr);
}
h5_err_t
h5pt_writedata_r4 (
const h5_int64_t *f,
const char *name,
const h5_float32_t *data,
const int l_name ) {
h5_file_t *fh = h5_filehandlefor2c(f);
H5_API_ENTER (h5_err_t, "f=%p, name='%s', data=%p, l_name=%d",
fh, name, data, l_name);
char *name2 = h5_strdupfor2c ( name, l_name );
h5_err_t herr = h5u_write_data (
fh, name2, (void*)data, H5T_NATIVE_FLOAT );
free ( name2 );
H5_API_RETURN(herr);
}
h5_err_t
h5pt_writedata_i8 (
const h5_int64_t *f,
const char *name,
const h5_int64_t *data,
const int l_name ) {
h5_file_t *fh = h5_filehandlefor2c(f);
H5_API_ENTER (h5_err_t, "f=%p, name='%s', data=%p, l_name=%d",
fh, name, data, l_name);
char *name2 = h5_strdupfor2c ( name, l_name );
h5_err_t herr = h5u_write_data (
fh, name2, (void*)data, H5T_NATIVE_INT64 );
free ( name2 );
H5_API_RETURN(herr);
}
h5_err_t
h5pt_writedata_i4 (
const h5_int64_t *f,
const char *name,
const h5_int32_t *data,
const int l_name ) {
h5_file_t *fh = h5_filehandlefor2c(f);
H5_API_ENTER (h5_err_t, "f=%p, name='%s', data=%p, l_name=%d",
fh, name, data, l_name);
char *name2 = h5_strdupfor2c ( name, l_name );
h5_err_t herr = h5u_write_data (
fh, name2, (void*)data, H5T_NATIVE_INT32 );
free ( name2 );
H5_API_RETURN(herr);
}
/*==================Reading data ============*/
h5_err_t
h5pt_readdata_r8 (
const h5_int64_t *f,
const char *name,
h5_float64_t *data,
const int l_name
) {
h5_file_t *fh = h5_filehandlefor2c(f);
H5_API_ENTER (h5_err_t, "f=%p, name='%s', data=%p, l_name=%d",
fh, name, data, l_name);
char *name2 = h5_strdupfor2c ( name, l_name );
h5_err_t herr = h5u_read_data (
fh, name2, data, H5T_NATIVE_DOUBLE );
free ( name2 );
H5_API_RETURN(herr);
}
h5_err_t
h5pt_readdata_r4 (
const h5_int64_t *f,
const char *name,
h5_float32_t *data,
const int l_name
) {
h5_file_t *fh = h5_filehandlefor2c(f);
H5_API_ENTER (h5_err_t, "f=%p, name='%s', data=%p, l_name=%d",
fh, name, data, l_name);
char *name2 = h5_strdupfor2c ( name, l_name );
h5_err_t herr = h5u_read_data (
fh, name2, data, H5T_NATIVE_FLOAT );
free ( name2 );
H5_API_RETURN(herr);
}
h5_err_t
h5pt_readdata_i8 (
const h5_int64_t *f,
const char *name,
h5_int64_t *data,
const int l_name
) {
h5_file_t *fh = h5_filehandlefor2c(f);
H5_API_ENTER (h5_err_t, "f=%p, name='%s', data=%p, l_name=%d",
fh, name, data, l_name);
char *name2 = h5_strdupfor2c ( name, l_name );
h5_err_t herr = h5u_read_data (
fh, name2, data, H5T_NATIVE_INT64 );
free ( name2 );
H5_API_RETURN(herr);
}
h5_err_t
h5pt_readdata_i4 (
const h5_int64_t *f,
const char *name,
h5_int32_t *data,
const int l_name
) {
h5_file_t *fh = h5_filehandlefor2c(f);
H5_API_ENTER (h5_err_t, "f=%p, name='%s', data=%p, l_name=%d",
fh, name, data, l_name);
char *name2 = h5_strdupfor2c ( name, l_name );
h5_err_t herr = h5u_read_data (
fh, name2, data, H5T_NATIVE_INT32 );
free ( name2 );
H5_API_RETURN(herr);
}
+185
View File
@@ -0,0 +1,185 @@
/*
Copyright (c) 2006-2015, The Regents of the University of California,
through Lawrence Berkeley National Laboratory (subject to receipt of any
required approvals from the U.S. Dept. of Energy) and the Paul Scherrer
Institut (Switzerland). All rights reserved.
License: see file COPYING in top level of source distribution.
*/
#include "h5_private.h"
#include "h5core/h5_debug.h"
#include "h5core/h5u_io.h"
/*==================Writing data ============*/
#define h5pt_writedata_r8 FC_MANGLING ( \
h5pt_writedata_r8, \
H5PT_WRITEDATA_R8 )
h5_int64_t
h5pt_writedata_r8 (
const h5_int64_t* const fh,
const char* const name,
const h5_float64_t* const data,
const int l_name
) {
h5_file_t f = h5_filehandlefor2c (fh);
H5_API_ENTER (h5_int64_t,
"fh=%p, name='%s', data=%p, l_name=%d",
(h5_file_p)f, name, data, l_name);
char *name2 = h5_strdupfor2c ( name, l_name );
h5_int64_t herr = h5u_write_data (
f, name2, (void*)data, H5T_NATIVE_DOUBLE );
free ( name2 );
H5_API_RETURN(herr);
}
#define h5pt_writedata_r4 FC_MANGLING ( \
h5pt_writedata_r4, \
H5PT_WRITEDATA_R4 )
h5_int64_t
h5pt_writedata_r4 (
const h5_int64_t* const fh,
const char* const name,
const h5_float32_t* const data,
const int l_name
) {
h5_file_t f = h5_filehandlefor2c (fh);
H5_API_ENTER (h5_int64_t,
"fh=%p, name='%s', data=%p, l_name=%d",
(h5_file_p)f, name, data, l_name);
char *name2 = h5_strdupfor2c ( name, l_name );
h5_int64_t herr = h5u_write_data (
f, name2, (void*)data, H5T_NATIVE_FLOAT );
free ( name2 );
H5_API_RETURN(herr);
}
#define h5pt_writedata_i8 FC_MANGLING ( \
h5pt_writedata_i8, \
H5PT_WRITEDATA_I8 )
h5_int64_t
h5pt_writedata_i8 (
const h5_int64_t* const fh,
const char* const name,
const h5_int64_t* const data,
const int l_name
) {
h5_file_t f = h5_filehandlefor2c (fh);
H5_API_ENTER (h5_int64_t,
"fh=%p, name='%s', data=%p, l_name=%d",
(h5_file_p)f, name, data, l_name);
char *name2 = h5_strdupfor2c ( name, l_name );
h5_int64_t herr = h5u_write_data (
f, name2, (void*)data, H5T_NATIVE_INT64 );
free ( name2 );
H5_API_RETURN(herr);
}
#define h5pt_writedata_i4 FC_MANGLING ( \
h5pt_writedata_i4, \
H5PT_WRITEDATA_I4 )
h5_int64_t
h5pt_writedata_i4 (
const h5_int64_t* const fh,
const char* const name,
const h5_int32_t* const data,
const int l_name
) {
h5_file_t f = h5_filehandlefor2c (fh);
H5_API_ENTER (h5_int64_t,
"fh=%p, name='%s', data=%p, l_name=%d",
(h5_file_p)f, name, data, l_name);
char *name2 = h5_strdupfor2c ( name, l_name );
h5_int64_t herr = h5u_write_data (
f, name2, (void*)data, H5T_NATIVE_INT32 );
free ( name2 );
H5_API_RETURN(herr);
}
/*==================Reading data ============*/
#define h5pt_readdata_r8 FC_MANGLING ( \
h5pt_readdata_r8, \
H5PT_READDATA_R8 )
h5_int64_t
h5pt_readdata_r8 (
const h5_int64_t* const fh,
const char* const name,
h5_float64_t* const data,
const int l_name
) {
h5_file_t f = h5_filehandlefor2c (fh);
H5_API_ENTER (h5_int64_t,
"fh=%p, name='%s', data=%p, l_name=%d",
(h5_file_p)f, name, data, l_name);
char *name2 = h5_strdupfor2c ( name, l_name );
h5_int64_t herr = h5u_read_data (
f, name2, data, H5T_NATIVE_DOUBLE );
free ( name2 );
H5_API_RETURN(herr);
}
#define h5pt_readdata_r4 FC_MANGLING ( \
h5pt_readdata_r4, \
H5PT_READDATA_R4 )
h5_int64_t
h5pt_readdata_r4 (
const h5_int64_t* const fh,
const char* const name,
h5_float32_t* const data,
const int l_name
) {
h5_file_t f = h5_filehandlefor2c (fh);
H5_API_ENTER (h5_int64_t,
"fh=%p, name='%s', data=%p, l_name=%d",
(h5_file_p)f, name, data, l_name);
char *name2 = h5_strdupfor2c ( name, l_name );
h5_int64_t herr = h5u_read_data (
f, name2, data, H5T_NATIVE_FLOAT );
free ( name2 );
H5_API_RETURN(herr);
}
#define h5pt_readdata_i8 FC_MANGLING ( \
h5pt_readdata_i8, \
H5PT_READDATA_I8 )
h5_int64_t
h5pt_readdata_i8 (
const h5_int64_t* const fh,
const char* const name,
h5_int64_t* const data,
const int l_name
) {
h5_file_t f = h5_filehandlefor2c (fh);
H5_API_ENTER (h5_int64_t,
"fh=%p, name='%s', data=%p, l_name=%d",
(h5_file_p)f, name, data, l_name);
char *name2 = h5_strdupfor2c ( name, l_name );
h5_int64_t herr = h5u_read_data (
f, name2, data, H5T_NATIVE_INT64 );
free ( name2 );
H5_API_RETURN(herr);
}
#define h5pt_readdata_i4 FC_MANGLING ( \
h5pt_readdata_i4, \
H5PT_READDATA_I4 )
h5_int64_t
h5pt_readdata_i4 (
const h5_int64_t* const fh,
const char* const name,
h5_int32_t* const data,
const int l_name
) {
h5_file_t f = h5_filehandlefor2c (fh);
H5_API_ENTER (h5_int64_t,
"hf=%p, name='%s', data=%p, l_name=%d",
(h5_file_p)f, name, data, l_name);
char *name2 = h5_strdupfor2c ( name, l_name );
h5_int64_t herr = h5u_read_data (
f, name2, data, H5T_NATIVE_INT32 );
free ( name2 );
H5_API_RETURN(herr);
}
+246
View File
@@ -0,0 +1,246 @@
/*
Copyright (c) 2006-2015, The Regents of the University of California,
through Lawrence Berkeley National Laboratory (subject to receipt of any
required approvals from the U.S. Dept. of Energy) and the Paul Scherrer
Institut (Switzerland). All rights reserved.
License: see file COPYING in top level of source distribution.
*/
#include "h5_private.h"
#include "h5core/h5_debug.h"
#include "h5core/h5u_model.h"
#include "h5core/h5u_io.h"
#include "h5core/h5_syscall.h"
/*=============Setting and getting views================*/
#define h5pt_setnpoints FC_MANGLING ( \
h5pt_setnpoints, \
H5PT_SETNPOINTS )
h5_int64_t
h5pt_setnpoints (
const h5_int64_t* const fh,
const h5_int64_t* const npoints
) {
h5_file_t f = h5_filehandlefor2c (fh);
H5_API_ENTER (h5_int64_t,
"fh=%p, npoints=%lld",
(h5_file_p)f, (long long)*npoints);
H5_API_RETURN (h5u_set_num_points (f, *npoints, 1));
}
#define h5pt_setnpoints_strided FC_MANGLING ( \
h5pt_setnpoints_strided, \
H5PT_SETNPOINTS_STRIDED )
h5_int64_t
h5pt_setnpoints_strided (
const h5_int64_t* const fh,
const h5_int64_t* const npoints,
const h5_int64_t* const stride
) {
h5_file_t f = h5_filehandlefor2c (fh);
H5_API_ENTER (h5_int64_t,
"fh=%p, npoints=%lld, stride=%lld",
(h5_file_p)f, (long long)*npoints, (long long)*stride);
H5_API_RETURN (h5u_set_num_points (f, *npoints, *stride));
}
#define h5pt_setview FC_MANGLING ( \
h5pt_setview, \
H5PT_SETVIEW )
h5_int64_t
h5pt_setview (
const h5_int64_t* const fh,
const h5_int64_t* const start,
const h5_int64_t* const end
) {
h5_file_t f = h5_filehandlefor2c (fh);
H5_API_ENTER (h5_int64_t,
"fh=%p, start=%lld, end=%lld",
(h5_file_p)f, (long long)*start, (long long)*end);
H5_API_RETURN (h5u_set_view (f, (*start)-1, (*end)-1));
}
#define h5pt_setview_indices FC_MANGLING( \
h5pt_setview_indices, \
H5PT_SETVIEW_INDICES )
h5_int64_t
h5pt_setview_indices (
const h5_int64_t* const fh,
const h5_int64_t* const indices,
const h5_int64_t* const nelem
) {
h5_file_t f = h5_filehandlefor2c (fh);
H5_API_ENTER (h5_int64_t,
"fh=%p, indices=%p, nelem=%lld",
(h5_file_p)f, indices, (long long)*nelem);
h5_size_t* findices;
TRY (findices = h5_calloc (*nelem, sizeof (*indices)));
for (size_t i = 0; i < *nelem; i++)
findices[i] = indices[i] - 1;
TRY (h5u_set_view_indices (f, findices, *nelem));
TRY (h5_free (findices));
H5_API_RETURN (H5_SUCCESS);
}
#define h5pt_setcanonicalview FC_MANGLING ( \
h5pt_setcanonicalview, \
H5PT_SETCANONICALVIEW)
h5_int64_t
h5pt_setcanonicalview (
const h5_int64_t* const fh
) {
h5_file_t f = h5_filehandlefor2c (fh);
H5_API_ENTER (h5_int64_t,
"fh=%p",
(h5_file_p)f);
H5_API_RETURN (h5u_set_canonical_view (f));
}
#define h5pt_resetview FC_MANGLING ( \
h5pt_resetview, \
H5PT_RESETVIEW )
h5_int64_t
h5pt_resetview (
const h5_int64_t* const fh
) {
h5_file_t f = h5_filehandlefor2c (fh);
H5_API_ENTER (h5_int64_t,
"fh=%p",
(h5_file_p)f);
H5_API_RETURN (h5u_reset_view (f));
}
#define h5pt_hasview FC_MANGLING ( \
h5pt_hasview, \
H5PT_HASVIEW )
h5_int64_t
h5pt_hasview (
const h5_int64_t* const fh
) {
h5_file_t f = h5_filehandlefor2c (fh);
H5_API_ENTER (h5_int64_t,
"fh=%p",
(h5_file_p)f);
H5_API_RETURN (h5u_has_view (f));
}
#define h5pt_getview FC_MANGLING ( \
h5pt_getview, \
H5PT_GETVIEW )
h5_int64_t
h5pt_getview (
const h5_int64_t* const fh,
h5_int64_t* const start,
h5_int64_t* const end
) {
h5_file_t f = h5_filehandlefor2c (fh);
H5_API_ENTER (h5_int64_t,
"fh=%p, start=%p, end=%p",
(h5_file_p)f, start, end);
TRY (h5u_get_view (f, start, end));
*start += 1;
*end += 1;
H5_API_RETURN (H5_SUCCESS);
}
/*==============Reading Data Characteristics============*/
#define h5pt_getndatasets FC_MANGLING ( \
h5pt_getndatasets, \
H5PT_GETNDATASETS )
h5_int64_t
h5pt_getndatasets (
const h5_int64_t* const fh
) {
h5_file_t f = h5_filehandlefor2c (fh);
H5_API_ENTER (h5_int64_t, "fh=%p", (h5_file_p)f);
H5_API_RETURN(h5u_get_num_datasets (f));
}
#define h5pt_getnpoints FC_MANGLING ( \
h5pt_getnpoints, \
H5PT_GETNPOINTS )
h5_int64_t
h5pt_getnpoints (
const h5_int64_t* const fh
) {
h5_file_t f = h5_filehandlefor2c (fh);
H5_API_ENTER (h5_int64_t, "fh=%p", (h5_file_p)f);
H5_API_RETURN (h5u_get_num_points (f));
}
#define h5pt_getdatasetname FC_MANGLING ( \
h5pt_getdatasetname, \
H5PT_GETDATASETNAME )
h5_int64_t
h5pt_getdatasetname (
const h5_int64_t* const fh,
const h5_int64_t* index,
char* name,
const int l_name
) {
h5_file_t f = h5_filehandlefor2c (fh);
H5_API_ENTER (h5_int64_t,
"fh=%p, index=%lld, name='%s', l_name=%d",
(h5_file_p)f, (long long)*index, name, l_name);
h5_int64_t herr = h5u_get_dataset_info (
f, *index - 1, name, l_name, NULL, NULL );
h5_strc2for (name, l_name);
H5_API_RETURN (herr);
}
#define h5pt_getdatasetinfo FC_MANGLING ( \
h5pt_getdatasetinfo, \
H5PT_GETDATASETINFO)
h5_int64_t
h5pt_getdatasetinfo (
const h5_int64_t* const fh,
const h5_int64_t* dataset_idx,
char* dataset_name,
h5_int64_t* dataset_type,
h5_int64_t* dataset_nelem,
const int l_dataset_name
) {
h5_file_t f = h5_filehandlefor2c (fh);
H5_API_ENTER (h5_int64_t,
"fh=%p, "
"dataset_idx=%lld, "
"dataset_name=%p, "
"dataset_type=%p, "
"dataset_nelem=%p",
(h5_file_p)f,
(long long)*dataset_idx,
dataset_name, dataset_type, dataset_nelem);
h5_int64_t h5err = h5u_get_dataset_info (
f,
*dataset_idx - 1,
dataset_name, l_dataset_name,
dataset_type,
(h5_size_t*)dataset_nelem);
h5_strc2for (dataset_name, l_dataset_name);
convert_type2for (dataset_type);
H5_API_RETURN (h5err);
}
/*===================== misc =====================*/
#define h5pt_setchunksize FC_MANGLING ( \
h5pt_setchunksize, \
H5PT_SETCHUNKSIZE )
h5_int64_t
h5pt_setchunksize (
const h5_int64_t* const fh,
const h5_int64_t* const size
) {
h5_file_t f = h5_filehandlefor2c (fh);
H5_API_ENTER (h5_int64_t,
"fh=%p, size=%lld",
(h5_file_p)f, (long long)*size);
H5_API_RETURN (h5u_set_chunk (f, *size));
}

Some files were not shown because too many files have changed in this diff Show More