Compare commits

..

278 Commits

Author SHA1 Message Date
gsell ad52833022 configure.ac
- set version to 2.0.0rc2
2016-09-23 13:05:59 +02:00
gsell 3425a30068 src/include/h5core/Makefile.am
- we have to use 'otherinclude_HEADER' instead of 'include_HEADERS'
2016-09-23 13:05:37 +02:00
gsell 9f3a677ea6 src/h5core/Makefile.am
- private/h5_const.h added to EXTRA_HEADERS
2016-09-23 13:04:16 +02:00
gsell 23807ff972 examples/H5/write_file_attribs.py
- added
2016-07-28 17:34:56 +02:00
gsell 93d4f60116 src/Python
- wrappers for reading/writing attributes
2016-07-28 17:34:22 +02:00
gsell 20cd5aae98 src/h5core/h5t_io.c
- adapted to changed 'h5priv_write_attrib()'
2016-07-28 17:32:13 +02:00
gsell cae3b00855 implement proper handling of append-only file mode for attributes 2016-07-28 17:31:06 +02:00
gsell 2a462733ca src/h5core/private/h5_file.h
- is_writable() is now static inline not a macro
- macro CHECK_READABLE_MODE() added
2016-07-28 17:29:13 +02:00
gsell 6fb8b77baa src/h5core/h5_attachements.c
- h5_add_attachment(): check file mode, return error if read-only
- adapted to new function 'h5priv_create_group()'
2016-07-28 17:27:05 +02:00
gsell c26d6a84e3 adapted to new/changed function:
h5priv_open_group(): open existing group
h5priv_create_group(): create or open existing group
h5priv_open_group_with_intermediates(): open existing group
h5priv_create_group_with_intermediates(): create or open existing group
2016-07-28 17:24:34 +02:00
gsell 54ccc3b576 src/inlcude/H5_step_attribs()
- H5GetStepAttribName() added
- use const types where applicable
2016-07-28 17:17:18 +02:00
gsell 8ffe944519 test/Makefile.am
- link static if debug is enabled
2016-07-28 17:15:39 +02:00
gsell 2bb3d688ae test/h5{b,u}_{read,write}.c
- fixes for serial version
- h5u_test_write4(): bugfix: we have to write new attributes since we are in append-only mode
2016-07-28 16:05:36 +02:00
gsell 647af5847e src/include/H5_file_attrib.h
- H5ReadFileAttribString(): bugdix in format of H5_API_ENTER(), print pointer value not string
2016-07-28 16:01:11 +02:00
gsell aa4f40ee3d src/h5core/private/h5_model.h
- h5priv_normalize_type(): bugfix: wrong type in H5_PRIV_API_ENTER() set
2016-07-28 15:59:35 +02:00
gsell f1daa56cb8 src/h5core/private/h5_model.c
- h5u_set_num_points(): set step to '0' if not already set
- h5u_set_chunk(): CHECK_TIMEGROUP(f) removed. The step must not be set before setting a chunk size
2016-07-28 15:57:34 +02:00
gsell 2ea8245bba src/h5core/h5b_io.c
- write_data():
  - bugfix: convert passed type is from H5hut to HDF5 type
  - parameter 'field_name' removed
- read_data():
  - bugfix: convert passed type is from H5hut to HDF5 type
  - compare type passed as parameter and type of dataset
- remove prefixing underscore from static functions
- adaptions to coding style
2016-07-28 15:54:52 +02:00
gsell 04fe7fdd9e configure.ac:
- do not ignore CC an CXX
2016-07-28 12:18:25 +02:00
gsell 075b2f39da src/Python/H5hut.i
- towards a more usable wrapper
2016-07-15 17:46:02 +02:00
gsell 7b05c32ad9 src/h5core/private/h5_attrib.h
- get_attrib_info(): wrong length was return for string attributes
2016-07-15 17:43:59 +02:00
gsell 825ee8ac5f examples/H5/Makefile.am
- build static executables if debug is enabled
2016-07-15 17:40:37 +02:00
gsell 9d70c07476 src/Python/H5hut.i
- some issues with inquiring file-attributes and datasets fixed
2016-07-08 17:13:18 +02:00
gsell 03986b00ac src/include/g5core/h5_{file.types}.h
- enum used for file modes instead of macros
2016-07-08 17:11:28 +02:00
gsell ad83c3841b C-API:
- declare more args as const
- H5GetFileAttribName() added
2016-07-08 17:09:16 +02:00
gsell 73fabd043b src/h5core/h5b_modules.c
- check file-handle and opened step
- h5b_3d_has_view(): debug output added
2016-07-08 17:07:18 +02:00
gsell 0aa44727c6 src/h5core/h5_file.c
- check file-handle and opened step
- h5_open_file2(): bugfix: move setting of step name format to the end of the function
- h5_flush_step(): bugfix: flush step data only, if a step is open
2016-07-08 17:06:07 +02:00
gsell babd19ddd4 core API:
- add checks for file-handle and opened step
2016-07-08 17:03:18 +02:00
gsell c80f6f5679 use new macro H5_RETURN_ERROR where possible 2016-07-01 17:59:12 +02:00
gsell 7b1079ae5f example/H5Fed/Makefile.am
- compile static if ENABLE_DEBUG is set. This makes life simpler if we build shared libs
2016-07-01 16:29:10 +02:00
gsell ecd2723419 examples/H5Fed/tetmesh_{adjacencies,read_tags}.c
- cleanup
2016-07-01 16:18:17 +02:00
gsell c9044d8e1b src/h5core/private/h5_init.{c,h}
- initialize MPI if not yet done
2016-07-01 16:10:37 +02:00
gsell 5b57bedade examples/H5Fed/dump_field_attributes.c:
- bugfix in printing string attributes
2016-07-01 16:07:02 +02:00
gsell 222789a1cf examples/H5Block:
- inline function changed to static inline (otherwise gcc >= 5.3 complains)
2016-07-01 15:36:30 +02:00
gsell 21dd57c9c6 Fortran-API:
- use enumeration for data-types
2016-07-01 15:34:31 +02:00
gsell fc29f7b6f0 src/h5core/private/h5_hdf5.h
- cleanup and minor changes
- more wrapper functions added
2016-07-01 15:33:53 +02:00
gsell e56872ce92 src/include/H5_err.h:
- remove debug output from H5AbortOnError()
2016-07-01 15:32:54 +02:00
gsell 85ecf4c387 core API/C-API: use enumeration for data-types 2016-07-01 15:31:55 +02:00
gsell 6979a358ae .gitignore:
- exclude all files matching *.h5
2016-06-24 16:40:43 +02:00
gsell 9fc3b233bc examples/H5Part:
- include of stdlib.h added
2016-06-24 16:37:59 +02:00
gsell f5eb26d2ec examples/H5Part/query.c:
- added examples to query dataset in steps
2016-06-24 16:36:54 +02:00
gsell 6af129b338 examples/H5Block/read_write_scalar_field.c:
- include stdlib.h added
2016-06-24 16:35:43 +02:00
gsell 215d1a7d79 examples/H5/read_step_attribs:
- include required stdlib.h
2016-06-24 15:55:20 +02:00
gsell 8bb22e4400 exampkes/H5/read_file_attribs.c
- use macros to define verbosity and debug mask
2016-06-24 15:54:40 +02:00
gsell caad81996a examples/H5/attache_file.c:
- use macros for verbosity level and debug mask
- open file rw in second part
2016-06-24 15:53:36 +02:00
gsell f97e3c8f2d core API:
- debugging macros simplified
- cleanup
- h5_delete_attachment(): check of file mode added
2016-06-24 15:51:39 +02:00
gsell fba78db1c0 test/h5u_read.c:
- h5u_test_read3(): bugfix
2016-06-24 15:45:26 +02:00
gsell 291328b997 src/h5core/private/h5_init.h
- cosmetic change
2016-06-22 16:15:03 +02:00
gsell 2c1bca01aa src/include/H5Block_model.h
- break down some longer lines
2016-06-22 16:14:18 +02:00
gsell a633b362a6 src/include/H5Part_model.h:
- break down some long lines
- H5PartGetDatasetName(): pass pointer to dataset name as const pointer
2016-06-22 16:13:16 +02:00
gsell a12908ed90 src/include/h5core/h5_err.h:
- declaration of h5_error() moved to this file
2016-06-22 16:10:20 +02:00
gsell b83d9cc8a7 src/include/h5core/h5_log.h
- hh5_{warn,info,debug} are not static inline any more
2016-06-22 16:08:46 +02:00
gsell 6ad9ae50e0 src/include/h5core/h5_types.h
- H5T_COMPOUND removed from enum h5_types_t
src/h5core/private/h5_init.c
- use H5T_COMPOUND in creation of compound types
2016-06-22 16:05:21 +02:00
gsell 9ac7e09423 src/include/h5core/h5_file_attribs.h
src/include/h5core/h5_step_attribs.h
src/include/h5core/h5b_attribs.h:
- use new H5hut enum type for attribute data-types
2016-06-22 16:01:46 +02:00
gsell 66452a274b src/include/h5core/h5b_io.h
src/include/h5core/h5u_io.h:
- pass data-type as H5hut enum
2016-06-22 15:40:32 +02:00
gsell d947f51c2d src/h5core/...:
- introduce/implement new H5hut types
2016-06-22 15:38:24 +02:00
gsell f5729f6f07 src/h5core/h5_model.c
src/h5core/h5b_attribs.c:
- cleanup/review header file we have to include
2016-06-22 15:24:05 +02:00
gsell a64f2ce03a src/h5core/h5_err.c
src/h5core/h5_log.c:
- define args as const where possible
- h5_verror() is now in h5_err.c
- h5priv_vprintf() is now in h5_log.c
2016-06-22 15:19:23 +02:00
gsell b880bd397f C-API:
- use new H5hut type enumeration, not HDF5 types
2016-06-22 14:52:02 +02:00
gsell cd2c9031b9 src/h5core/h5_attribs.c:
- define args as const where possible
2016-06-22 14:48:19 +02:00
gsell fb5e55990f src/h5core/h5file
src/h5core/h5b_io.h:
- define args as const where possible
2016-06-22 14:38:09 +02:00
gsell 25dff9257c src/h5core/Makefile.am
- h5_init.h is now in 'private'
2016-06-22 14:34:44 +02:00
gsell ac37d5fc2f Fortran API:
- use new enumeration of types for I/O. HDF5 types are not used any more in the high level API
2016-06-22 14:33:48 +02:00
gsell 983496104b src/h5core/h5_log.c
src/h5core/h5_init.h
src/h5core/h5_log.h:
- cleanup, minor changes
2016-06-22 14:24:54 +02:00
gsell aaeca8b6b7 examples/H5/read_file_attribs.c:
- call MPI_Init() before any H5hut functions
2016-06-22 13:47:53 +02:00
gsell 0182d60835 src/h5core/h5_init.c:
- moved to src/h5core/private
2016-06-22 13:46:40 +02:00
gsell f75ef09cf9 consolidation of log/debug message interface 2016-06-17 13:50:07 +02:00
gsell c831a90a2e src/h5core/h5_errorhandling.c:
- renamed to h5_err.c
2016-06-17 13:49:35 +02:00
gsell bdcc8f2089 this commits includes several changes which should have been done in
multiple steps:
- the functions for inquiring datasets and attributes do not return
  an HDF5 type any more but an enum of type h5_types_t. This change
  was required for the Python module.
- bugfix in reading attributes: See https://git.psi.ch/H5hut/src/issues/4
- several consts and macros have been moved from the public C-API to
  the core API
- more consitent file naming
- several 'private' function have been moved to their 'private' header
  files as 'static inline'.
- minor formatting changes
2016-06-17 10:44:25 +02:00
gsell bbbaa6a21b src/h5core/h5t_octree.c:
- definition of 'h5_oct_dta_types' moved from header file to this file
2016-06-03 17:25:48 +02:00
gsell 4c5b16169d src/Fortran/Makefile.am:
- bugfix: H5Block_attribs.f90 were listed twice
2016-06-03 17:24:36 +02:00
gsell cc46b433e1 .gitignore: some files added 2016-06-03 17:23:43 +02:00
gsell a8e209a7d3 src/Python:
- file and step attributes added
- all attribute i/o function have exactly 3 arguments now
- string attributes are handled the same way as attributes of other type
2016-06-03 17:23:15 +02:00
gsell 80cf35e807 src/Python: ignore file added 2016-06-03 17:18:00 +02:00
gsell d53c5b3171 tools/vtk2h5grid/Makefile.am: use AM_LDFLAGS not LDFLAGS 2016-05-20 18:12:00 +02:00
gsell 8edb48aff8 src/Python/Makefile.am: use same name for serial and parallel version 2016-05-20 18:10:30 +02:00
gsell 24af2ae2a3 src/Makefile.am: Python sub-dir added 2016-05-20 18:09:28 +02:00
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
369 changed files with 47929 additions and 29807 deletions
+48 -46
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,14 +363,16 @@ 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/H5Block/BlockTestSpecs.txt -text
examples/H5Block/H5BlockDissolveGhosts.c -text
examples/H5Block/H5BlockParTestScalarField.c -text
examples/H5Block/H5BlockParTestScalarField.pbs -text
examples/H5Block/H5BlockParTestScalarFieldF.f90 -text
examples/H5Block/H5BlockTestAttributes.c -text
examples/H5Block/H5BlockTestAttributesF.f90 -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
@@ -384,52 +390,48 @@ 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/H5ParallelTest.cc -text
examples/H5Part/H5PartAndreasTest.cc -text
examples/H5Part/H5PartTest.cc -text
examples/H5Part/H5PartTestParallel.cc -text
examples/H5Part/H5test.cc -text
examples/H5Part/H5testF.f -text
examples/H5Part/H5testFpar.f90 -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/Makefile.am -text
src/Fortran/H5.c -text
src/Fortran/H5.f90 -text
src/Fortran/H5Block.c -text
src/Fortran/H5Block.f90 -text
src/Fortran/H5BlockF.f90 -text
src/Fortran/H5Block_F.c -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.f90 -text
src/Fortran/H5Block_readwrite_F.c -text
src/Fortran/H5F.f90 -text
src/Fortran/H5Part.c -text
src/Fortran/H5Part.f90 -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.c -text
src/Fortran/H5_attribs.f90 -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
@@ -438,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
@@ -456,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
@@ -468,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
@@ -493,58 +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/Makefile.am -text
src/include/grephdr -text
src/include/h5core/Makefile.am -text
src/include/h5core/h5_attach.h -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/Makefile.am -text
test/h5_attach_test.c -text
test/h5b_read.c -text
test/h5b_test.c -text
test/h5b_write.c -text
@@ -573,7 +576,6 @@ 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
+84 -92
View File
@@ -1,102 +1,94 @@
*.o
*.lo
*.tar.gz
*.[oa]
*.la
*.lo
*.so
*.dSYM
*~
*.h5
*.vtk
.deps
.dirstamp
.libs
/H5hut
/INSTALL
/Makefile
/Makefile.in
/aclocal.m4
/autom4te.cache
/build
/compile
/config.guess
/config.h
/config.h.in
/config.log
/config.status
/config.sub
/configure
/depcomp
doc/Makefile
doc/Makefile.in
examples/H5Block/H5BlockParTestScalarField
examples/H5Block/H5BlockTestAttributes
examples/H5Block/Makefile
examples/H5Block/Makefile.in
examples/H5Fed/.deps
examples/H5Fed/Makefile
examples/H5Fed/Makefile.in
examples/H5Fed/large_tet.h5
examples/H5Fed/simple_tet.h5
examples/H5Fed/simple_triangle.h5
examples/H5Fed/small_tet.h5
examples/H5Fed/tetmesh_adjacencies
examples/H5Fed/tetmesh_read
examples/H5Fed/tetmesh_read_tags
examples/H5Fed/tetmesh_write
INSTALL
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
py-compile
examples/H5/attach_file
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/fields
examples/H5Block/read_write
examples/H5Part/Bench
examples/H5Part/H5test
examples/H5Part/H5testF
examples/H5Part/core_vfd
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
stamp-h1
test/h5b_test
test/h5u_test
test/h5_attach_test
tools/h5hutcc
tetmesh_adjacencies
tetmesh_read
tetmesh_read_tags
tetmesh_write
tetmesh_write1
examples/H5Fed/tetmesh_write2
examples/H5Fed/tetmesh_write_tags
examples/H5Fed/trimesh_2gnuplot
examples/H5Fed/trimesh_adjacencies
examples/H5Fed/trimesh_read
examples/H5Fed/trimesh_write
examples/H5Fed/trimesh_write_dunetest
examples/H5Part/Bench
examples/H5Part/H5PartAndreasTest
examples/H5Part/H5PartTestP
examples/H5Part/H5test
examples/H5Part/Makefile
examples/H5Part/Makefile.in
/install-sh
/libtool
/ltmain.sh
/m4
/missing
src/.deps
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/Fortran/TestUnderscore
src/Fortran/Underscore.h
src/Makefile
src/Makefile.in
src/h5core/.deps
src/h5core/Makefile
src/h5core/Makefile.in
src/h5core/libH5hut.a
src/include/H5hutF.h
src/include/Makefile
src/include/Makefile.in
src/include/h5core/Makefile
src/include/h5core/Makefile.in
src/lib
/stamp-h1
/svn-prop.tmp
/test-driver
test/.deps
test/Makefile
test/Makefile.in
test/h5_attach.h5
test/h5_attach_test
test/h5b_test
test/h5u_test
tools/.deps
tools/Makefile
tools/Makefile.in
tools/h5PartDcToVtk
tools/h5PartSurfaceToVtk
tools/h5hutcc
tools/vtk2h5grid/.deps
tools/vtk2h5grid/Makefile
tools/vtk2h5grid/Makefile.in
tools/vtk2h5grid/cgun_full.h5
tools/vtk2h5grid/cgun_full.vtk
tools/vtk2h5grid/vtk2h5grid
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.
+14 -10
View File
@@ -1,15 +1,19 @@
ACLOCAL_AMFLAGS = -I m4
EXTRA_DIST = autogen.sh
SUBDIRS = \
src \
test \
tools \
doc
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
+23 -29
View File
@@ -1,42 +1,36 @@
#### H5PART 1.99.10 ###########################################################
#### H5PART trunk ############################################################
Bugfixes in the malloc wrappers
* h5_file_t is now uintptr_t
* experimental version of parallel H5Fed
* new API function for file open using properties (similiar to hdf5 properties)
Converter from vtk to H5hut added.
#### H5PART 1.99.10 ############################################################
Bugfixes in the autotools files.
#### H5PART 1.99.9 ############################################################
Bugfix in option parsing in tools/h5PartDcToVtk and tools/h5PartSurfaceToVtk
tools/h5PartDcToVtk and tools/h5PartSurfaceToVtk removed from list of tools
to be compiled. These tools should be moved to another repository anyway.
#### H5PART 1.99.8 ############################################################
Bugfixes
#### H5PART 1.99.7 ############################################################
Linking problem on Linux fixed
#### H5PART 1.99.6 ############################################################
* C99 compiler required
* C API with inline functions
#### H5PART 1.99.5 ############################################################
#### H5PART 1.99.4 ############################################################
#### H5PART 1.99.3 ############################################################
#### H5PART 1.99.2 ############################################################
#### H5PART 1.99.1 ############################################################
#### H5PART 1.99 ############################################################
#### H5PART 1.99.0 ############################################################
Renamed type:
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 ############################################################
+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])
])
+172 -58
View File
@@ -1,4 +1,12 @@
AC_INIT([H5hut], [1.99.13], [h5part@lists.psi.ch], 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.
#
# License: see file COPYING in top level of source distribution.
#
AC_INIT([H5hut], [2.0.0rc2], [h5part@lists.psi.ch], H5hut)
AC_PREREQ(2.60)
AC_CONFIG_HEADERS(config.h)
AC_CONFIG_MACRO_DIR([m4])
@@ -8,6 +16,7 @@ ENABLE_DEBUG='no'
ENABLE_C='yes'
ENABLE_FORTRAN='no'
ENABLE_PARALLEL='no'
ENABLE_PYTHON='no'
###############################################################################
# --enable-xxx and --with-xxx Arguments
@@ -31,6 +40,13 @@ AC_ARG_ENABLE(
[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],
[AS_HELP_STRING([--enable-parallel],
@@ -58,6 +74,13 @@ AC_ARG_ENABLE(
[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],
[AS_HELP_STRING([--with-hdf5],
@@ -80,7 +103,40 @@ AC_ARG_WITH(
[parmetis],
[AC_HELP_STRING([--with-parmetis],
[path to ParMETIS API [default=""]])],
[PARMETISPATH=$withval], [PARMETISPATH=""])
[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.
if test "x$ENABLE_PARALLEL" = "xyes"; then
if test "x$MPICC" != "x"; then
CC=$MPICC
fi
if test "x$MPICXX" != "x"; then
CXX=$MPICXX
fi
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
###############################################################################
@@ -119,37 +175,25 @@ PATH_Search() {
AC_CANONICAL_HOST
AC_PROG_MAKE_SET
CFLAGS="$CFLAGS -Wall"
CXXFLAGS="$CFLAGS -Wall"
FFLAGS="$FFLAGS -Wall"
# debug enabled?
AC_MSG_CHECKING([if debug is enabled])
if test "X$ENABLE_DEBUG" = "Xyes"; then
AC_MSG_RESULT([yes])
CFLAGS="$CFLAGS -g -Wall"
CXXFLAGS="$CFLAGS -g -Wall"
FFLAGS="$FFLAGS -g"
AC_MSG_RESULT([yes])
CFLAGS="$CFLAGS -g3 -O0"
CXXFLAGS="$CFLAGS -g3 -O0"
FFLAGS="$FFLAGS -g3 -O0"
else
AC_MSG_RESULT([no])
AC_MSG_RESULT([no])
CFLAGS="$CFLAGS -O3"
CXXFLAGS="$CFLAGS -O3"
FFLAGS="$FFLAGS -O3"
fi
# Determine a C/C++ compiler to use.
if test "x$ENABLE_PARALLEL" = "xyes"; then
CCOMPILERS="mpicc"
CXXCOMPILERS="mpic++"
else
CCOMPILERS="pgcc pathcc icc gcc cc_r cc"
CXXCOMPILERS="pgcc pathcc icc g++ cc_r c++"
fi
AC_PROG_CC($CCOMPILERS)
CC=`which $CC`
AC_PROG_CXX($CXXCOMPILERS)
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
AC_PROG_INSTALL
AC_PROG_AWK
@@ -207,45 +251,91 @@ fi
AC_MSG_CHECKING([if fortran interface enabled])
if test "X$ENABLE_FORTRAN" = "Xyes"; then
AC_MSG_RESULT([yes])
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
FC=`which $FC`
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
`cd src/Fortran && ./TestUnderscore > Underscore.h`
AC_MSG_RESULT([ok])
else
AC_MSG_RESULT([nok])
AC_MSG_ERROR([Cannot determine the symbol 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
@@ -262,10 +352,11 @@ if test "X$ENABLE_PARALLEL" = "Xyes"; then
CPPFLAGS="${CPPFLAGS} -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$PARMETISPATH" != "X"; then
CPPFLAGS="$CPPFLAGS -I$PARMETISPATH/include"
LDFLAGS="$LDFLAGS -L$PARMETISPATH/lib"
if test "X$PARMETIS_PREFIX" != "X"; then
CPPFLAGS="$CPPFLAGS -I$PARMETIS_PREFIX/include"
LDFLAGS="$LDFLAGS -L$PARMETIS_PREFIX/lib"
fi
LIBS="$LIBS -lparmetis -lmetis"
@@ -340,6 +431,15 @@ else
AC_MSG_RESULT([no])
fi
###############################################################################
# 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
@@ -359,11 +459,16 @@ AC_CONFIG_FILES([
src/include/h5core/Makefile
src/C/Makefile
src/Fortran/Makefile
src/Python/Makefile
test/Makefile
doc/Makefile
tools/Makefile
tools/h5hutcc
tools/vtk2h5grid/Makefile
examples/H5/Makefile
examples/H5Part/Makefile
examples/H5Block/Makefile
examples/H5Fed/Makefile
])
AC_OUTPUT
@@ -386,4 +491,13 @@ AC_MSG_RESULT([AM_LDFLAGS = $AM_LDFLAGS])
AC_MSG_RESULT([LIBS = $LIBS])
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
@}
@}
*/
+6 -6
View File
@@ -1,7 +1,6 @@
EXTRA_DIST = \
Doxyfile \
H5.dox \
Makefile.in
EXTRA_DIST = \
Doxyfile \
H5.dox
all:
@@ -10,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))
+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.
#
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
if ENABLE_DEBUG
AM_LDFLAGS += -static
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 $<
+51
View File
@@ -0,0 +1,51 @@
/*
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"
#define VERBOSITY H5_VERBOSE_ERROR
#define DEBUG_MSK H5_DEBUG_ALL
int
main (
int argc,
char* argv[]
) {
MPI_Init (&argc, &argv);
H5SetErrorHandler (H5AbortErrorhandler);
H5SetVerbosityLevel (VERBOSITY);
H5SetDebugMask (DEBUG_MSK);
h5_file_t f = H5OpenFile (FNAME, H5_O_WRONLY, H5_PROP_DEFAULT);
H5AddAttachment (f, ATTACHMENT);
H5CloseFile (f);
f = H5OpenFile (FNAME, H5_O_RDWR, 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
+88
View File
@@ -0,0 +1,88 @@
/*
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.
*/
#include "H5hut.h"
#include <stdlib.h>
#define FNAME "example_file_attribs.h5"
#define VERBOSITY H5_VERBOSE_ERROR
#define DEBUG_MSK 0
#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
) {
MPI_Init (&argc, &argv);
H5AbortOnError ();
H5SetVerbosityLevel (VERBOSITY);
H5SetDebugMask (DEBUG_MSK);
// 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
+86
View File
@@ -0,0 +1,86 @@
/*
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 <stdlib.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;
}
+29
View File
@@ -0,0 +1,29 @@
#!/usr/bin/env python
from H5hut import *
import numpy as np
FNAME = "example_file_attribs.h5"
ATTR_STRING = "FileAttrString"
ATTR_INT32 = "FileAttrInt32"
ATTR_INT64 = "FileAttrInt64"
ATTR_FLOAT32 = "FileAttrFloat32"
ATTR_FLOAT64 = "FileAttrFloat64"
string_value = "This is a string attribute attached to the file."
int32_value = np.array ([0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144], dtype='int32')
int64_value = np.array ([42, 43, 44, 45], dtype='int64')
float32_value = np.array ([2.71828, ], dtype='float32')
float64_value = np.array ([3.14159265358979323846264338327950288419716939937510,],
dtype='float64')
f = H5OpenFile (FNAME, H5_O_WRONLY, H5_PROP_DEFAULT)
H5WriteFileAttrib (f, ATTR_STRING, string_value)
H5WriteFileAttrib (f, ATTR_INT32, int32_value)
H5WriteFileAttrib (f, ATTR_INT64, int64_value)
H5WriteFileAttrib (f, ATTR_FLOAT32, float32_value)
H5WriteFileAttrib (f, ATTR_FLOAT64, float64_value)
H5CloseFile (f)
+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
-716
View File
@@ -1,716 +0,0 @@
#include <stdio.h>
#include <stdlib.h>
#include <hdf5.h>
#include "H5Part.h"
#include "H5Block.h"
#include "H5BlockTypes.h"
static int _debug = 4;
void
_H5Part_vprint_error (
const char *fmt,
va_list ap
) {
if ( _debug < 1 ) return;
vfprintf ( stderr, fmt, ap );
fprintf ( stderr, "\n" );
}
void
_H5Part_print_error (
const char *fmt,
...
) {
va_list ap;
va_start ( ap, fmt );
_H5Part_vprint_error ( fmt, ap );
va_end ( ap );
}
void
_H5Part_vprint_warn (
const char *fmt,
va_list ap
) {
if ( _debug < 2 ) return;
vfprintf ( stderr, fmt, ap );
fprintf ( stderr, "\n" );
}
void
_H5Part_print_warn (
const char *fmt,
...
) {
va_list ap;
va_start ( ap, fmt );
_H5Part_vprint_warn ( fmt, ap );
va_end ( ap );
}
void
_H5Part_vprint_info (
const char *fmt,
va_list ap
) {
if ( _debug < 3 ) return;
vfprintf ( stdout, fmt, ap );
fprintf ( stdout, "\n" );
}
void
_H5Part_print_info (
const char *fmt,
...
) {
va_list ap;
va_start ( ap, fmt );
_H5Part_vprint_info ( fmt, ap );
va_end ( ap );
}
void
_H5Part_vprint_debug (
const char *fmt,
va_list ap
) {
if ( _debug < 4 ) return;
vfprintf ( stdout, fmt, ap );
fprintf ( stdout, "\n" );
}
void
_H5Part_print_debug (
const char *fmt,
...
) {
va_list ap;
va_start ( ap, fmt );
_H5Part_vprint_debug ( fmt, ap );
va_end ( ap );
}
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 _NO_GHOSTZONE(p,q) ( (p->i_end < q->i_start) \
|| (p->j_end < q->j_start) \
|| (p->k_end < q->k_start) )
/*
#define _HAVE_GHOSTZONE(p,q) ( (p->i_end >= q->i_start) \
&& (p->j_end >= q->j_start) \
&& (p->k_end >= q->k_start) \
&& (q->i_end >= p->i_start) \
&& (q->j_end >= p->j_start) \
&& (q->k_end >= p->k_start) )
*/
static int
_have_ghostzone (
const struct H5BlockPartition *p,
const struct H5BlockPartition *q
) {
return ( ! ( _NO_GHOSTZONE ( p, q ) || _NO_GHOSTZONE ( q, p ) ) );
}
static h5part_int64_t
_volume_of_partition (
const struct H5BlockPartition *p
) {
return (p->i_end - p->i_start)
* (p->j_end - p->j_start)
* (p->k_end - p->k_start);
}
#define MIN( x, y ) ( (x) <= (y) ? (x) : (y) )
#define MAX( x, y ) ( (x) >= (y) ? (x) : (y) )
static h5part_int64_t
_volume_of_ghostzone (
const struct H5BlockPartition *p,
const struct H5BlockPartition *q
) {
h5part_int64_t dx = MIN ( p->i_end, q->i_end )
- MAX ( p->i_start, q->i_start ) + 1;
h5part_int64_t dy = MIN ( p->j_end, q->j_end )
- MAX ( p->j_start, q->j_start ) + 1;
h5part_int64_t dz = MIN ( p->k_end, q->k_end )
- MAX ( p->k_start, q->k_start ) + 1;
return dx * dy * dz;
}
static h5part_int64_t
_dissolve_X_ghostzone (
struct H5BlockPartition *p,
struct H5BlockPartition *q
) {
if ( p->i_start > q->i_start )
return _dissolve_X_ghostzone( q, p );
if ( q->i_end <= p->i_end ) /* no dissolving */
return -1;
p->i_end = ( p->i_end + q->i_start ) >> 1;
q->i_start = p->i_end + 1;
return 0;
}
static h5part_int64_t
_dissolve_Y_ghostzone (
struct H5BlockPartition *p,
struct H5BlockPartition *q
) {
if ( p->j_start > q->j_start )
return _dissolve_Y_ghostzone( q, p );
if ( q->j_end <= p->j_end ) /* no dissolving */
return -1;
p->j_end = ( p->j_end + q->j_start ) >> 1;
q->j_start = p->j_end + 1;
return 0;
}
static h5part_int64_t
_dissolve_Z_ghostzone (
struct H5BlockPartition *p,
struct H5BlockPartition *q
) {
if ( p->k_start > q->k_start )
return _dissolve_Z_ghostzone( q, p );
if ( q->k_end <= p->k_end ) /* no dissolving */
return -1;
p->k_end = ( p->k_end + q->k_start ) >> 1;
q->k_start = p->k_end + 1;
return 0;
}
#if 0
static h5part_int64_t
_dissolve_ghostzone_max_volume_of_dissolved_partitions (
struct H5BlockPartition *p,
struct H5BlockPartition *q
) {
struct H5BlockPartition p_;
struct H5BlockPartition q_;
struct H5BlockPartition p_best;
struct H5BlockPartition q_best;
h5part_int64_t vol;
h5part_int64_t max_vol = 0;
p_ = *p;
q_ = *q;
if ( _dissolve_X_ghostzone ( &p_, &q_ ) == 0 ) {
vol = _volume_of_partition ( &p_ ) + _volume_of_partition ( &q_ );
if ( vol > max_vol ) {
max_vol = vol;
p_best = p_;
q_best = q_;
}
}
p_ = *p;
q_ = *q;
if ( _dissolve_Y_ghostzone ( &p_, &q_ ) == 0 ) {
vol = _volume_of_partition ( &p_ ) + _volume_of_partition ( &q_ );
if ( vol > max_vol ) {
max_vol = vol;
p_best = p_;
q_best = q_;
}
}
p_ = *p;
q_ = *q;
if ( _dissolve_Z_ghostzone ( &p_, &q_ ) == 0 ) {
vol = _volume_of_partition ( &p_ ) + _volume_of_partition ( &q_ );
if ( vol > max_vol ) {
max_vol = vol;
p_best = p_;
q_best = q_;
}
}
if ( max_vol <= 0 ) {
return H5PART_ERR_LAYOUT;
}
*p = p_best;
*q = q_best;
return H5PART_SUCCESS;
}
static h5part_int64_t
_dissolve_ghostzones_max_volume_of_dissolved_partitions (
H5PartFile *f
) {
h5part_int64_t herr;
struct H5BlockStruct *b = f->block;
struct H5BlockPartition *part1;
struct H5BlockPartition *part2;
int proc1, proc2;
memcpy ( b->write_layout, b->user_layout,
f->nprocs * sizeof (*f->block->user_layout) );
for ( proc1 = 0, part1 = b->write_layout;
proc1 < f->nprocs-1;
proc1++, part1++ ) {
for ( proc2 = proc1+1, part2 = &b->write_layout[proc2];
proc2 < f->nprocs;
proc2++, part2++ ) {
if ( ! _have_ghostzone ( part1, part2 ) )
continue;
herr = _dissolve_ghostzone_max_volume_of_dissolved_partitions (
part1, part2 );
if ( herr < 0 ) return herr;
}
}
_H5Part_print_debug ("Layout after dissolving ghost-zones:");
for ( proc1 = 0, part1 = b->write_layout;
proc1 < f->nprocs;
proc1++, part1++ ) {
_H5Part_print_debug (
"PROC[%d]: proc[%d]: %lld:%lld, %lld:%lld, %lld:%lld ",
f->myproc, proc1,
(long long)part1->i_start,
(long long)part1->i_end,
(long long)part1->j_start,
(long long)part1->j_end,
(long long)part1->k_start,
(long long)part1->k_end );
}
return H5PART_SUCCESS;
}
#endif
static h5part_int64_t
_dissolve_ghostzone (
struct H5BlockPartition *p,
struct H5BlockPartition *q
) {
struct H5BlockPartition p_;
struct H5BlockPartition q_;
struct H5BlockPartition p_best;
struct H5BlockPartition q_best;
h5part_int64_t vol;
h5part_int64_t max_vol = 0;
p_ = *p;
q_ = *q;
if ( _dissolve_X_ghostzone ( &p_, &q_ ) == 0 ) {
vol = _volume_of_partition ( &p_ ) + _volume_of_partition ( &q_ );
if ( vol > max_vol ) {
max_vol = vol;
p_best = p_;
q_best = q_;
}
}
p_ = *p;
q_ = *q;
if ( _dissolve_Y_ghostzone ( &p_, &q_ ) == 0 ) {
vol = _volume_of_partition ( &p_ ) + _volume_of_partition ( &q_ );
if ( vol > max_vol ) {
max_vol = vol;
p_best = p_;
q_best = q_;
}
}
p_ = *p;
q_ = *q;
if ( _dissolve_Z_ghostzone ( &p_, &q_ ) == 0 ) {
vol = _volume_of_partition ( &p_ ) + _volume_of_partition ( &q_ );
if ( vol > max_vol ) {
max_vol = vol;
p_best = p_;
q_best = q_;
}
}
if ( max_vol <= 0 ) {
return H5PART_ERR_LAYOUT;
}
*p = p_best;
*q = q_best;
return H5PART_SUCCESS;
}
#if 0
static h5part_int64_t
_dissolve_ghostzones (
H5PartFile *f
) {
struct H5BlockStruct *b = f->block;
struct H5BlockPartition *p, *max_p;
struct H5BlockPartition *q, *max_q;
int proc_p, proc_q;
h5part_int64_t vol, max_vol;
int max_proc_p, max_proc_q;
memcpy ( b->write_layout, b->user_layout,
f->nprocs * sizeof (*f->block->user_layout) );
while ( 1 ) {
max_vol = 0;
for ( proc_p = 0, p = b->write_layout;
proc_p < f->nprocs-1;
proc_p++, p++ ) {
for ( proc_q = proc_p+1, q = &b->write_layout[proc_q];
proc_q < f->nprocs;
proc_q++, q++ ) {
if ( ! _have_ghostzone ( p, q ) )
continue;
vol = _volume_of_ghostzone ( p, q );
if ( vol > max_vol ) {
max_vol = vol;
max_proc_p = proc_p;
max_proc_q = proc_q;
max_p = p;
max_q = q;
}
}
}
if ( max_vol == 0 )
break;
_dissolve_ghostzone ( max_p, max_q );
}
_H5Part_print_debug ("Layout after dissolving ghost-zones:");
for ( proc_p = 0, p = b->write_layout;
proc_p < f->nprocs;
proc_p++, p++ ) {
_H5Part_print_debug (
"PROC[%d]: proc[%d]: %lld:%lld, %lld:%lld, %lld:%lld ",
f->myproc, proc_p,
(long long)p->i_start,
(long long)p->i_end,
(long long)p->j_start,
(long long)p->j_end,
(long long)p->k_start,
(long long)p->k_end );
}
return H5PART_SUCCESS;
}
#endif
static h5part_int64_t
_dissolve_ghostzones (
H5PartFile *f
) {
struct H5BlockStruct *b = f->block;
struct H5BlockPartition *p;
struct H5BlockPartition *q;
int proc_p, proc_q;
struct list {
struct list *prev;
struct list *next;
struct H5BlockPartition *p;
struct H5BlockPartition *q;
h5part_int64_t vol;
} *p_begin, *p_el, *p_max, *p_end, *p_save;
memcpy ( b->write_layout, b->user_layout,
f->nprocs * sizeof (*f->block->user_layout) );
/*
build a list of all ghost-zones, save procs and volume remember max volume
while list not empty
take element with max volume from list and dissolve ghost-zones for this
recalculate volumes for remaining list elements remember max volume
remove list element if volume is zero
*/
p_begin = p_max = p_end = malloc ( sizeof ( *p_begin ) );
memset ( p_begin, 0, sizeof ( *p_begin ) );
for ( proc_p = 0, p = b->write_layout;
proc_p < f->nprocs-1;
proc_p++, p++ ) {
for ( proc_q = proc_p+1, q = &b->write_layout[proc_q];
proc_q < f->nprocs;
proc_q++, q++ ) {
if ( _have_ghostzone ( p, q ) ) {
p_el = malloc ( sizeof ( *p_el ) );
p_el->p = p;
p_el->q = q;
p_el->vol = _volume_of_ghostzone ( p, q );
p_el->prev = p_end;
p_el->next = NULL;
if ( p_el->vol > p_max->vol )
p_max = p_el;
p_end->next = p_el;
p_end = p_el;
}
}
}
while ( p_begin->next ) {
if ( p_max->next ) p_max->next->prev = p_max->prev;
p_max->prev->next = p_max->next;
_dissolve_ghostzone ( p_max->p, p_max->q );
free ( p_max );
p_el = p_max = p_begin->next;
while ( p_el ) {
if ( _have_ghostzone ( p_el->p, p_el->q ) ) {
p_el->vol = _volume_of_ghostzone ( p_el->p, p_el->q );
if ( p_el->vol > p_max->vol )
p_max = p_el;
p_el = p_el->next;
} else {
if ( p_el->next )
p_el->next->prev = p_el->prev;
p_el->prev->next = p_el->next;
p_save = p_el->next;
free ( p_el );
p_el = p_save;
}
}
}
free ( p_begin );
_H5Part_print_debug ("Layout after dissolving ghost-zones:");
for ( proc_p = 0, p = b->write_layout;
proc_p < f->nprocs;
proc_p++, p++ ) {
_H5Part_print_debug (
"PROC[%d]: proc[%d]: %lld:%lld, %lld:%lld, %lld:%lld ",
f->myproc, proc_p,
(long long)p->i_start,
(long long)p->i_end,
(long long)p->j_start,
(long long)p->j_end,
(long long)p->k_start,
(long long)p->k_end );
}
return H5PART_SUCCESS;
}
static H5PartFile*
_init (
void
) {
H5PartFile *f;
struct H5BlockStruct *b;
f = (H5PartFile*) malloc( sizeof (H5PartFile) );
if( f == NULL ) {
return NULL;
}
memset (f, 0, sizeof (H5PartFile));
f->nprocs = 32;
f->block = malloc( sizeof (*f->block) );
if ( f->block == NULL ) {
return NULL;
}
b = f->block;
memset ( b, 0, sizeof (*b) );
b->user_layout = malloc ( f->nprocs * sizeof (b->user_layout[0]) );
if ( b->user_layout == NULL ) {
return NULL;
}
b->write_layout = malloc ( f->nprocs * sizeof (b->write_layout[0]) );
if ( b->write_layout == NULL ) {
return NULL;
}
b->timestep = -1;
b->blockgroup = -1;
b->shape = -1;
b->diskshape = -1;
b->memshape = -1;
b->field_group_id = -1;
return f;
}
int
main (
int argc,
char *argv[]
) {
H5PartFile *f = _init ();
memcpy ( f->block->user_layout, Layout32G,
f->nprocs * sizeof (*f->block->user_layout) );
_dissolve_ghostzones ( f );
return 0;
}
@@ -1,472 +0,0 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <hdf5.h>
#include "H5Part.h"
#include "H5Block.h"
#define NPROCS 8
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}
};
#if 0
static h5_int64_t
_calc_index_KJI (
int myproc,
h5_int64_t i,
h5_int64_t i_dims,
h5_int64_t j,
h5_int64_t j_dims,
h5_int64_t k,
h5_int64_t k_dims
) {
return i + j*i_dims + k*i_dims*j_dims;
}
#endif
#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 *layout
) {
h5_int64_t i, j, k, idx;
h5_int64_t herr;
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 ( "Writing Step #%lld\n", (long long)f->step_idx );
data = malloc ( i_dims * j_dims * k_dims * sizeof ( *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 );
*(data + idx) = k
+ 1000*j
+ 100000*i
+ 10000000*myproc;
}
}
}
herr = H5BlockDefine3DFieldLayout (
f,
layout->i_start, layout->i_end,
layout->j_start, layout->j_end,
layout->k_start, layout->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_file (
const char *fname,
const int myproc,
MPI_Comm comm,
struct H5BlockPartition *layout
) {
h5_file_t *f;
h5_int64_t timestep = 0;
h5_int64_t herr;
printf ("PROC[%d]: Open file \"%s\" for writing ...\n",
myproc, fname );
f = H5PartOpenFileParallel ( fname, H5PART_WRITE, comm );
if ( f == NULL ) return -1;
herr = H5PartSetStep ( f, timestep );
if ( herr < 0 ) return herr;
if ( _write_data ( f, myproc, layout ) < 0 ) {
printf ("Failed to write file \"%s\"\n", fname );
return 2;
}
herr = H5PartCloseFile ( f );
if ( herr < 0 ) return -1;
return 0;
}
static h5_int64_t
_read_data (
h5_file_t *f,
int myproc,
struct H5BlockPartition *layout
) {
h5_int64_t i, j, k, idx;
h5_int64_t herr;
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)f->step_idx );
data = malloc ( i_dims * j_dims * k_dims * sizeof ( *data ) );
herr = H5BlockDefine3DFieldLayout (
f,
layout->i_start, layout->i_end,
layout->j_start, layout->j_end,
layout->k_start, layout->k_end );
if ( herr < 0 ) return herr;
herr = H5Block3dReadScalarFieldFloat64 ( f, "TestField", data );
if ( herr < 0 ) return herr;
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 );
/*
what do I need to calculate the value?
proc which has the item written
i, j, k relative to proc
*/
h5_int64_t ri = i + layout->i_start;
h5_int64_t rj = j + layout->j_start;
h5_int64_t rk = k + layout->k_start;
int proc = (int) H5Block3dGetProcOf ( f, ri, rj, rk );
h5_size_t i_start, i_end;
h5_size_t j_start, j_end;
h5_size_t k_start, k_end;
H5Block3dGetPartitionOfProc (
f,
proc,
&i_start, &i_end,
&j_start, &j_end,
&k_start, &k_end );
ri -= i_start;
rj -= j_start;
rk -= k_start;
h5_float64_t value = rk
+ 1000*rj
+ 100000*ri
+ 10000000*proc;
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 );
printf (
"PROC[%d]: "
"My partition is: "
"%lld:%lld, %lld:%lld, %lld:%lld\n",
myproc,
(long long)layout->i_start, (long long)layout->i_end,
(long long)layout->j_start, (long long)layout->j_end,
(long long)layout->k_start, (long long)layout->k_end );
printf (
"PROC[%d]: "
"Value has been written by proc %d\n",
myproc, proc );
printf (
"PROC[%d]: "
"The partition for this proc was: "
"%lld:%lld, %lld:%lld, %lld:%lld\n",
myproc,
(long long)i_start, (long long)i_end,
(long long)j_start, (long long)j_end,
(long long)k_start, (long long)k_end );
return -1;
}
}
}
}
free ( data );
return 0;
}
static h5_int64_t
_read_file (
const char *fname,
const int myproc,
MPI_Comm comm,
struct H5BlockPartition *layout
) {
h5_file_t *f;
h5_int64_t timestep = 0;
h5_int64_t herr;
printf ("PROC[%d]: Open file \"%s\" for reading ...\n",
myproc, fname );
f = H5PartOpenFileParallel ( fname, H5PART_READ, comm );
if ( f == NULL ) return -1;
herr = H5PartSetStep ( f, timestep );
if ( herr < 0 ) return herr;
if ( _read_data ( f, myproc, layout ) < 0 ) {
printf ("Failed to read file \"%s\"\n", fname );
return 2;
}
herr = H5PartCloseFile ( f );
if ( herr < 0 ) return -1;
return 0;
}
int
main (
int argc,
char **argv
) {
char *fname;
int myproc;
int nprocs;
int opt_with_ghosts = 0;
int opt_read = 0;
int opt_write = 0;
struct H5BlockPartition *layout;
MPI_Comm comm = MPI_COMM_WORLD;
MPI_Init( &argc, &argv );
MPI_Comm_size ( comm, &nprocs );
MPI_Comm_rank( comm, &myproc );
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;
}
}
switch ( nprocs ) {
case 1:
fname = "blockfile1.h5";
layout = &Layout1[myproc];
break;
case 8:
if ( opt_with_ghosts ) {
fname = "blockfile8G.h5";
layout = &Layout8G[myproc];
} else {
fname = "blockfile8.h5";
layout = &Layout8[myproc];
}
break;
case 16:
if ( opt_with_ghosts ) {
fname = "blockfile16G.h5";
layout = &Layout16G[myproc];
} else {
fname = "blockfile16.h5";
layout = &Layout16[myproc];
}
break;
case 32:
if ( opt_with_ghosts ) {
fname = "blockfile32G.h5";
layout = &Layout32G[myproc];
} else {
fname = "blockfile32.h5";
layout = &Layout32[myproc];
}
break;
default:
printf ( "Run this test on %d processor(s)!\n", NPROCS );
return 1;
}
H5SetVerbosityLevel ( 4 );
if ( opt_write ) {
if ( _write_file ( fname, myproc, comm, layout ) < 0 ) {
printf ("Failed to write file \"%s\"\n", fname );
}
} else if ( opt_read ) {
if ( _read_file ( fname, myproc, comm, layout ) < 0 ) {
printf ("Failed to read file \"%s\"\n", fname );
}
}
MPI_Finalize();
return 0;
}
@@ -1,462 +0,0 @@
PROGRAM H5BlockParTestScalarFieldF
IMPLICIT NONE
INCLUDE 'mpif.h'
INCLUDE 'H5PartF90.inc'
INCLUDE 'H5BlockF90.inc'
INTERFACE
INTEGER FUNCTION IARGC ()
END FUNCTION IARGC
END INTERFACE
INTEGER :: myproc = 0
INTEGER :: nprocs = 1
INTEGER :: comm = MPI_COMM_WORLD
INTEGER :: mpi_err
INTEGER*8 :: h5pt_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 /
CALL MPI_Init ( mpi_err )
comm = MPI_COMM_WORLD
CALL MPI_Comm_rank ( comm, myproc, mpi_err)
CALL MPI_Comm_size ( comm, nprocs, mpi_err)
DO i = 1, IARGC ()
CALL GETARG ( i, arg_str )
PRINT *, arg_str
IF ( arg_str == "-r" ) THEN
PRINT *, "Reading file"
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: H5BlockTestAttributesF -w | -r [-g]"
END IF
END DO
SELECTCASE ( nprocs )
CASE ( 1 )
fname = "Fblockfile1.h5"
layout = layout1 ( :, myproc+1 )
CASE ( 8 )
IF ( opt_with_ghosts == 1 ) THEN
fname = "Fblockfile8G.h5"
layout = layout8g ( :, myproc+1 )
ELSE
fname = "Fblockfile8.h5"
layout = layout8 ( :, myproc+1 )
END IF
CASE ( 16 )
IF ( opt_with_ghosts == 1 ) THEN
fname = "Fblockfile16G.h5"
layout = layout16g ( :, myproc+1 )
ELSE
fname = "Fblockfile16.h5"
layout = layout16 ( :, myproc+1 )
END IF
CASE ( 32 )
IF ( opt_with_ghosts == 1 ) THEN
fname = "Fblockfile32G.h5"
layout = layout32g ( :, myproc+1 )
ELSE
fname = "Fblockfile32.h5"
layout = layout32 ( :, myproc+1 )
END IF
CASE DEFAULT
print *, "Run this test with 1, 8, 16 or 32 procs!"
END SELECT
h5pt_err = h5pt_set_verbosity_level ( 4_8 )
IF ( opt_write == 1 ) THEN
h5pt_err = write_file ( fname, myproc, comm, layout )
IF ( h5pt_err < 0 ) THEN
PRINT *, "Faild to write file ", fname, "!"
END IF
ELSE IF ( opt_read == 1 ) THEN
h5pt_err = read_file ( fname, myproc, comm, layout )
IF ( h5pt_err < 0 ) THEN
PRINT *, "Faild to write file ", fname, "!"
END IF
ENDIF
CALL MPI_Finalize
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!
CONTAINS
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!
INTEGER*8 FUNCTION write_file ( fname, myproc, comm, layout )
IMPLICIT NONE
CHARACTER(LEN=*), INTENT(IN) :: fname
INTEGER, INTENT(IN) :: myproc
INTEGER, INTENT(IN) :: comm
INTEGER*8, INTENT(IN) :: layout(6)
INTEGER*8 :: file
INTEGER*8 :: timestep = 1
PRINT "('PROC[',I,']: Open file ',A,' for writing ...')", myproc, fname
file = h5pt_openw_par ( fname, comm )
if ( file == 0 ) THEN
write_file = -1
RETURN
ENDIF
PRINT *, "file: ", file
h5pt_err = h5pt_setstep ( file, timestep )
IF ( h5pt_err < 0 ) THEN
write_file = h5pt_err
RETURN
ENDIF
h5pt_err = write_field ( file, myproc, layout )
IF ( h5pt_err < 0 ) THEN
write_file = h5pt_err
RETURN
ENDIF
h5pt_err = h5pt_close ( file )
IF ( h5pt_err < 0 ) THEN
write_file = h5pt_err
RETURN
ENDIF
write_file = 0
END FUNCTION write_file
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!
INTEGER*8 FUNCTION write_field ( file, myproc, layout )
IMPLICIT NONE
INTEGER*8, INTENT(IN) :: file
INTEGER, INTENT(IN) :: myproc
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
PRINT *, "Reading field ..."
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
PRINT "('dims: (',I2,I2,I2,')')", i_dims, j_dims, k_dims
ALLOCATE ( data (i_dims,j_dims, k_dims) )
PRINT *, "Defining Layout ..."
h5pt_err = h5bl_define3dlayout ( file, i_start, i_end, j_start, j_end, k_start, k_end )
IF ( h5pt_err < 0 ) THEN
write_field = h5pt_err
RETURN
END IF
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*myproc
data(i,j,k) = value
END DO
END DO
END DO
PRINT *, "Writing field ..."
h5pt_err = h5bl_3d_write_scalar_field ( file, "TestField", data )
IF ( h5pt_err < 0 ) THEN
write_field = h5pt_err
RETURN
END IF
write_field = 0
END FUNCTION write_field
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!
INTEGER*8 FUNCTION read_file ( fname, myproc, comm, layout )
IMPLICIT NONE
CHARACTER(LEN=*), INTENT(IN) :: fname
INTEGER, INTENT(IN) :: myproc
INTEGER, INTENT(IN) :: comm
INTEGER*8, INTENT(IN) :: layout(6)
INTEGER*8 :: file
INTEGER*8 :: timestep = 1
PRINT *, "PROC[",myproc,"]: Open file ",fname," for reading ..."
file = h5pt_openr_par ( fname, comm )
if ( file == 0 ) THEN
read_file = -1
RETURN
ENDIF
h5pt_err = h5pt_setstep ( file, timestep )
IF ( h5pt_err < 0 ) THEN
read_file = -1
RETURN
ENDIF
h5pt_err = read_field ( file, myproc, layout )
IF ( h5pt_err < 0 ) THEN
read_file = -1
RETURN
ENDIF
h5pt_err = h5pt_close ( file )
IF ( h5pt_err < 0 ) THEN
read_file = -1
RETURN
ENDIF
read_file = 0
END FUNCTION read_file
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!
INTEGER*8 FUNCTION read_field ( file, myproc, layout )
IMPLICIT NONE
INTEGER*8, INTENT(IN) :: file
INTEGER, INTENT(IN) :: myproc
INTEGER*8, INTENT(IN) :: layout(6)
INTEGER*8 :: i, j, k
INTEGER*8 :: i_start, i_start2
INTEGER*8 :: i_end, i_end2
INTEGER*8 :: j_start, j_start2
INTEGER*8 :: j_end, j_end2
INTEGER*8 :: k_start, k_start2
INTEGER*8 :: k_end, k_end2
INTEGER*8 :: i_dims
INTEGER*8 :: j_dims
INTEGER*8 :: k_dims
INTEGER*8 :: ri, rj, rk, proc
REAL*8 :: value
REAL*8, DIMENSION(:,:,:), ALLOCATABLE :: data
PRINT *, "Reading field ..."
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
PRINT "('dims: (',I3,',',I3,',',I3,')')", i_dims, j_dims, k_dims
ALLOCATE ( data (i_dims,j_dims, k_dims) )
PRINT *, "Defining Layout ..."
h5pt_err = h5bl_define3dlayout ( file, i_start, i_end, j_start, j_end, k_start, k_end )
IF ( h5pt_err < 0 ) THEN
read_field = -1
RETURN
END IF
PRINT *, "Reading field ..."
h5pt_err = h5bl_3d_read_scalar_field ( file, "TestField", data )
IF ( h5pt_err < 0 ) THEN
read_field = -1
RETURN
END IF
DO i = 1, i_dims
DO j = 1, j_dims
DO k = 1, k_dims
ri = i + i_start - 1
rj = j + j_start - 1
rk = k + k_start - 1
proc = h5bl_get_proc_of ( file, ri, rj, rk )
h5pt_err = h5bl_get_partition_of_proc ( file, proc, i_start2, i_end2, j_start2, j_end2, k_start2, k_end2 )
ri = ri - i_start2
rj = rj - j_start2
rk = rk - k_start2
value = rk + 1000*rj + 100000*ri + 10000000*proc
if ( data(i,j,k) /= value ) THEN
PRINT "('data(',I3,',',I3,',',I3,') = ',F,' /= ',F)", i, j, k, data(i,j,k), value
PRINT "('proc: ', I2)", proc
PRINT "('i_start: ', I3, ' i_end: ', I3)", i_start, i_end
PRINT "('j_start: ', I3, ' j_end: ', I3)", j_start, j_end
PRINT "('k_start: ', I3, ' k_end: ', I3)", k_start, k_end
END IF
END DO
END DO
END DO
read_field = 0
END FUNCTION read_field
END PROGRAM
-480
View File
@@ -1,480 +0,0 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "H5Part.h"
#include "H5Block.h"
#ifndef PARALLEL_IO
#ifndef MPI_COMM_WORLD
#define MPI_COMM_WORLD 0
#endif
#endif
struct h5b_partition {
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;
};
typedef struct h5b_partition h5b_partition_t;
h5b_partition_t Layout1[1] = {
{ 0, 63, 0, 63, 0, 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,
h5b_partition_t *layout
) {
h5_int64_t i, j, k, idx;
h5_int64_t herr;
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 ( "Writing Step #%lld\n", (long long)f->step_idx );
data = malloc ( i_dims * j_dims * k_dims * sizeof ( *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 );
*(data + idx) = k
+ 1000*j
+ 100000*i
+ 10000000*myproc;
}
}
}
herr = H5BlockDefine3DFieldLayout (
f,
layout->i_start, layout->i_end,
layout->j_start, layout->j_end,
layout->k_start, layout->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
) {
h5_int64_t herr = H5BlockWriteFieldAttribString (
f,
"TestField",
"TestString",
"42" );
if ( herr < 0 ) return -1;
h5_int64_t ival[1] = { 42 };
h5_float64_t rval[1] = { 42.0 };
herr = H5BlockWriteFieldAttrib (
f,
"TestField",
"TestInt64",
H5_INT64_T,
ival, 1 );
if ( herr < 0 ) return -1;
herr = H5BlockWriteFieldAttrib (
f,
"TestField",
"TestFloat64",
H5_FLOAT64_T,
rval, 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,
h5b_partition_t *layout
) {
h5_file_t *f;
h5_int64_t timestep = 0;
h5_int64_t herr;
printf ("PROC[%d]: Open file \"%s\" for writing ...\n",
myproc, fname );
#ifdef PARALLEL_IO
f = H5OpenFile (
fname,
H5_O_WRONLY,
comm
);
#else
f = H5OpenFile (
fname,
H5_O_WRONLY,
0
);
#endif
if ( f == NULL ) return -1;
herr = H5SetStep ( f, timestep );
if ( herr < 0 ) return herr;
if ( _write_data ( f, myproc, layout ) < 0 ) {
printf ("Failed to write file \"%s\"\n", fname );
return 2;
}
if ( _write_attributes ( f, myproc ) < 0 ) {
printf ("Failed to write attributes \"%s\"\n", fname );
return 2;
}
herr = H5PartCloseFile ( f );
if ( herr < 0 ) return -1;
return 0;
}
static h5_int64_t
_read_data (
h5_file_t *f,
int myproc,
h5b_partition_t *layout
) {
h5_int64_t i, j, k, idx;
h5_int64_t herr;
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)f->step_idx );
data = malloc ( i_dims * j_dims * k_dims * sizeof ( *data ) );
herr = H5BlockDefine3DFieldLayout (
f,
layout->i_start, layout->i_end,
layout->j_start, layout->j_end,
layout->k_start, layout->k_end );
if ( herr < 0 ) return herr;
herr = H5Block3dReadScalarFieldFloat64 ( f, "TestField", data );
if ( herr < 0 ) return herr;
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 );
/*
what do I need to calculate the value?
proc which has the item written
i, j, k relative to proc
*/
h5_int64_t ri = i + layout->i_start;
h5_int64_t rj = j + layout->j_start;
h5_int64_t rk = k + layout->k_start;
int proc = (int) H5Block3dGetProcOf ( f, ri, rj, rk );
h5_size_t i_start, i_end;
h5_size_t j_start, j_end;
h5_size_t k_start, k_end;
H5Block3dGetPartitionOfProc (
f,
proc,
&i_start, &i_end,
&j_start, &j_end,
&k_start, &k_end );
ri -= i_start;
rj -= j_start;
rk -= k_start;
h5_float64_t value = rk
+ 1000*rj
+ 100000*ri
+ 10000000*proc;
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 );
printf (
"PROC[%d]: "
"My partition is: "
"%lld:%lld, %lld:%lld, %lld:%lld\n",
myproc,
(long long)layout->i_start, (long long)layout->i_end,
(long long)layout->j_start, (long long)layout->j_end,
(long long)layout->k_start, (long long)layout->k_end );
printf (
"PROC[%d]: "
"Value has been written by proc %d\n",
myproc, proc );
printf (
"PROC[%d]: "
"The partition for this proc was: "
"%lld:%lld, %lld:%lld, %lld:%lld\n",
myproc,
(long long)i_start, (long long)i_end,
(long long)j_start, (long long)j_end,
(long long)k_start, (long long)k_end );
return -1;
}
}
}
}
free ( data );
return 0;
}
static h5_int64_t
_read_file (
const char *fname,
const int myproc,
MPI_Comm comm,
h5b_partition_t *layout
) {
h5_file_t *f;
h5_int64_t timestep = 0;
h5_int64_t herr;
printf ("PROC[%d]: Open file \"%s\" for reading ...\n",
myproc, fname );
#ifdef PARALLEL_IO
f = H5PartOpenFileParallel (
fname,
H5_O_RDONLY,
comm
);
#else
f = H5PartOpenFile (
fname,
H5_O_RDONLY
);
#endif
if ( f == NULL ) return -1;
herr = H5PartSetStep ( f, timestep );
if ( herr < 0 ) return herr;
if ( _read_data ( f, myproc, layout ) < 0 ) {
printf ("Failed to read file \"%s\"\n", fname );
return 2;
}
herr = H5PartCloseFile ( f );
if ( herr < 0 ) return -1;
return 0;
}
static h5_int64_t
_read_attributes (
const char *fname,
const int myproc,
MPI_Comm comm
) {
h5_int64_t timestep = 0;
printf ("PROC[%d]: Open file \"%s\" for reading ...\n",
myproc, fname );
#ifdef PARALLEL_IO
h5_file_t *f = H5PartOpenFileParallel (
fname,
H5_O_RDONLY,
comm
);
#else
h5_file_t *f = H5PartOpenFile (
fname,
H5_O_RDONLY
);
#endif
if ( f == NULL ) return -1;
h5_int64_t herr = H5PartSetStep ( f, timestep );
if ( herr < 0 ) return herr;
char sval[16];
herr = H5BlockReadFieldAttrib (
f,
"TestField",
"TestString",
sval );
if ( herr < 0 ) return -1;
if ( strcmp ( sval, "42" ) != 0 ) {
printf ( "Error reading string attribute: "
"Value is \"%s\" and should be \"42\"\n", sval );
}
h5_int64_t ival[1];
h5_float64_t rval[1];
herr = H5BlockReadFieldAttrib (
f,
"TestField",
"TestInt64",
ival );
if ( herr < 0 ) return -1;
if ( ival[0] != 42 ) {
printf ( "Error reading int64 attribute: "
"Value is %lld and should be 42\n",
(long long) ival[0] );
}
herr = H5BlockReadFieldAttrib (
f,
"TestField",
"TestFloat64",
rval );
if ( herr < 0 ) return -1;
if ( rval[0] != 42.0 ) {
printf ( "Error reading float64 attribute: "
"Value is %f and should be 42.0\n",
rval[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;
herr = H5Block3dGetFieldOrigin (
f, "TestField",
&x_origin,
&y_origin,
&z_origin );
if ( herr < 0 ) return -1;
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 );
}
herr = H5Block3dGetFieldSpacing (
f, "TestField",
&x_spacing,
&y_spacing,
&z_spacing );
if ( herr < 0 ) return -1;
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 );
}
herr = H5PartCloseFile ( f );
if ( herr < 0 ) return -1;
return 0;
}
int
main (
int argc,
char **argv
) {
char *fname = "blockfile0.h5";
int myproc =0;
int opt_read = 0;
int opt_write = 0;
int ex = 0;
MPI_Comm comm = MPI_COMM_WORLD;
#ifdef PARALLEL_IO
int nprocs;
MPI_Init( &argc, &argv );
MPI_Comm_size ( comm, &nprocs );
MPI_Comm_rank( comm, &myproc );
#endif
while ( --argc ) {
if ( strcmp ( argv[argc], "-r" ) == 0 )
opt_read = 1;
else if ( strcmp ( argv[argc], "-w" ) == 0 )
opt_write = 1;
else {
fprintf ( stderr,
"Illegal option %s\n\n"
"Usage: %s -w -r\n",
argv[argc], argv[0] );
return 1;
}
}
H5SetVerbosityLevel ( 4 );
if ( opt_write ) {
if ( _write_file ( fname, myproc, comm, Layout1 ) < 0 ) {
printf ("Failed to write file \"%s\"\n", fname );
ex = 1;
goto cleanup;
}
} else if ( opt_read ) {
if ( _read_file ( fname, myproc, comm, Layout1 ) < 0 ) {
printf ("Failed to read file \"%s\"\n", fname );
ex = 1;
goto cleanup;
}
if ( _read_attributes ( fname, myproc, comm ) < 0 ) {
printf ("Failed to read attributes \"%s\"\n", fname );
ex = 1;
goto cleanup;
}
}
cleanup:
#ifdef PARALLEL_IO
MPI_Finalize();
#endif
return ex;
}
-341
View File
@@ -1,341 +0,0 @@
PROGRAM H5BlockTestAttributesF
IMPLICIT NONE
INCLUDE 'H5PartF90.inc'
INCLUDE 'H5BlockF90.inc'
INTEGER :: myproc = 0
INTEGER :: nprocs = 1
INTEGER*8 :: h5pt_err
INTEGER :: i
CHARACTER(LEN=32) :: arg_str
INTEGER :: opt_read = 0
INTEGER :: opt_write = 0
INTEGER*8 :: layout(6)
DATA layout / 1, 64, 1, 64, 1, 512 /
DO i = 1, IARGC ()
CALL GETARG ( i, arg_str )
PRINT *, arg_str
IF ( arg_str == "-r" ) THEN
PRINT *, "Reading file"
opt_read = 1
ELSE IF ( arg_str == "-w" ) THEN
opt_write = 1
ELSE
PRINT *, "Illegal option ", arg_str, "\n"
PRINT *, "Usage: H5BlockTestAttributesF -w | -r"
END IF
END DO
h5pt_err = h5pt_set_verbosity_level ( 4_8 )
IF ( opt_write == 1 ) THEN
h5pt_err = write_file ( "blockfile0.h5", myproc, layout )
ELSE IF ( opt_read == 1 ) THEN
PRINT *, "Calling read_file"
h5pt_err = read_file ( "blockfile0.h5", myproc, layout )
ENDIF
CONTAINS
INTEGER*8 FUNCTION write_file ( fname, myproc, layout )
CHARACTER(LEN=*), INTENT(IN) :: fname
INTEGER, INTENT(IN) :: myproc
INTEGER*8, INTENT(IN) :: layout(6)
INTEGER*8 :: file
INTEGER*8 :: timestep = 1
PRINT *, "PROC[",myproc,"]: Open file ",fname," for writing ..."
file = h5pt_openw ( fname )
if ( file == 0 ) THEN
write_file = -1
RETURN
ENDIF
PRINT *, "file: ", file
h5pt_err = h5pt_setstep ( file, timestep )
IF ( h5pt_err < 0 ) THEN
write_file = h5pt_err
RETURN
ENDIF
h5pt_err = write_field ( file, myproc, layout )
IF ( h5pt_err < 0 ) THEN
write_file = h5pt_err
RETURN
ENDIF
h5pt_err = write_attributes ( file )
h5pt_err = h5pt_close ( file )
IF ( h5pt_err < 0 ) THEN
write_file = h5pt_err
RETURN
ENDIF
write_file = 0
END FUNCTION write_file
INTEGER*8 FUNCTION write_field ( file, myproc, layout )
INTEGER*8, INTENT(IN) :: file
INTEGER, INTENT(IN) :: myproc
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
PRINT *, "Reading field ..."
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
PRINT *, "dims: (", i_dims, j_dims, k_dims, ")"
ALLOCATE ( data (i_dims,j_dims, k_dims) )
PRINT *, "Defining Layout ..."
h5pt_err = h5bl_define3dlayout ( file, i_start, i_end, j_start, j_end, k_start, k_end )
IF ( h5pt_err < 0 ) THEN
write_field = h5pt_err
RETURN
END IF
DO i = 1, i_dims
DO j = 1, j_dims
DO k = 1, k_dims
value = (k-1) + 1000*(j-1) + 100000*(i-1)
data(i,j,k) = value
END DO
END DO
END DO
PRINT *, "Writing field ..."
h5pt_err = h5bl_3d_write_scalar_field ( file, "TestField", data )
IF ( h5pt_err < 0 ) THEN
write_field = h5pt_err
RETURN
END IF
write_field = 0
END FUNCTION write_field
INTEGER*8 FUNCTION write_attributes ( file )
INTEGER*8, INTENT(IN) :: file
INTEGER*8 :: h5pt_err = 0
CHARACTER(LEN=128) :: s_val
INTEGER*8 :: i_val(1)
REAL*8 :: r_val(1)
s_val = "42"
h5pt_err = h5bl_writefieldattrib_string ( file, "TestField", "TestString", s_val )
IF ( h5pt_err < 0 ) THEN
write_attributes = h5pt_err
RETURN
END IF
i_val(1) = 42
h5pt_err = h5bl_writefieldattrib_i8 ( file, "TestField", "TestInt64", i_val, 1_8 )
IF ( h5pt_err < 0 ) THEN
write_attributes = h5pt_err
RETURN
END IF
r_val(1) = 42.0
h5pt_err = h5bl_writefieldattrib_r8 ( file, "TestField", "TestFloat64", r_val,1_8 )
IF ( h5pt_err < 0 ) THEN
write_attributes = h5pt_err
RETURN
END IF
END FUNCTION write_attributes
INTEGER*8 FUNCTION read_file ( fname, myproc, layout )
CHARACTER(LEN=*), INTENT(IN) :: fname
INTEGER, INTENT(IN) :: myproc
INTEGER*8, INTENT(IN) :: layout(6)
INTEGER*8 :: file
INTEGER*8 :: timestep = 1
PRINT *, "PROC[",myproc,"]: Open file ",fname," for reading ..."
file = h5pt_openr ( fname )
if ( file == 0 ) THEN
read_file = -1
RETURN
ENDIF
PRINT *, "file: ", file
h5pt_err = h5pt_setstep ( file, timestep )
IF ( h5pt_err < 0 ) THEN
read_file = -1
RETURN
ENDIF
h5pt_err = read_field ( file, myproc, layout )
IF ( h5pt_err < 0 ) THEN
read_file = -1
RETURN
ENDIF
h5pt_err = h5pt_close ( file )
IF ( h5pt_err < 0 ) THEN
read_file = -1
RETURN
ENDIF
PRINT *, "PROC[",myproc,"]: Open file ",fname," for reading ..."
file = h5pt_openr ( fname )
if ( file == 0 ) THEN
read_file = -1
RETURN
ENDIF
PRINT *, "file: ", file
h5pt_err = h5pt_setstep ( file, timestep )
IF ( h5pt_err < 0 ) THEN
read_file = -1
RETURN
ENDIF
h5pt_err = read_attributes ( file )
h5pt_err = h5pt_close ( file )
IF ( h5pt_err < 0 ) THEN
read_file = -1
RETURN
ENDIF
read_file = 0
END FUNCTION read_file
INTEGER*8 FUNCTION read_field ( file, myproc, layout )
INTEGER*8, INTENT(IN) :: file
INTEGER, INTENT(IN) :: myproc
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
PRINT *, "Reading field ..."
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
PRINT *, "dims: (", i_dims, j_dims, k_dims, ")"
ALLOCATE ( data (i_dims,j_dims, k_dims) )
PRINT *, "Defining Layout ..."
h5pt_err = h5bl_define3dlayout ( file, i_start, i_end, j_start, j_end, k_start, k_end )
IF ( h5pt_err < 0 ) THEN
read_field = -1
RETURN
END IF
PRINT *, "Reading field ..."
h5pt_err = h5bl_3d_read_scalar_field ( file, "TestField", data )
IF ( h5pt_err < 0 ) THEN
read_field = -1
RETURN
END IF
DO i = 1, i_dims
DO j = 1, j_dims
DO k = 1, k_dims
value = (k-1) + 1000*(j-1) + 100000*(i-1)
if ( data(i,j,k) /= value ) THEN
PRINT *, "data(",i,",",j,",",k,") = ",data(i,j,k), " /= ",value
END IF
END DO
END DO
END DO
read_field = 0
END FUNCTION read_field
INTEGER*8 FUNCTION read_attributes ( file )
INTEGER*8, INTENT(IN) :: file
INTEGER*8 :: h5pt_err = 0
CHARACTER(LEN=128) :: s_val
INTEGER*8 :: i_val(1)
REAL*8 :: r_val(1)
h5pt_err = h5bl_readfieldattrib_string ( file, "TestField", "TestString", s_val )
IF ( h5pt_err < 0 ) THEN
read_attributes = h5pt_err
RETURN
END IF
IF ( s_val /= "42" ) THEN
PRINT *, "Error reading string attribute: Value is ", s_val, " and should be 42"
END IF
h5pt_err = h5bl_readfieldattrib_i8 ( file, "TestField", "TestInt64", i_val )
IF ( h5pt_err < 0 ) THEN
read_attributes = h5pt_err
RETURN
END IF
IF ( i_val(1) /= 42 ) THEN
PRINT *, "Error reading int64 attribute: Value is ", i_val(1), " and should be 42"
END IF
h5pt_err = h5bl_readfieldattrib_r8 ( file, "TestField", "TestFloat64", r_val )
IF ( h5pt_err < 0 ) THEN
read_attributes = h5pt_err
RETURN
END IF
IF ( r_val(1) /= 42.0 ) THEN
PRINT *, "Error reading float64 attribute: Value is ", r_val(1), " and should be 42.0"
END IF
END FUNCTION read_attributes
END PROGRAM H5BlockTestAttributesF
+44 -86
View File
@@ -1,97 +1,55 @@
# 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.
#
# PATH SETTING
HDF5ROOT = @HDF5ROOT@
AM_CPPFLAGS += -I${abs_top_srcdir}/src/include
FFLAGS += -cpp $(AM_CPPFLAGS)
AM_LDFLAGS += -L${abs_top_builddir}/src/h5core/.libs
# COMPILER SETTING
CXX = @CXX@
FC = @FC@
MPIFC = @MPIFC@
MPICXX = @MPICXX@
MPICC = @MPICC@
LDADD =
# COMPILER FLAG SETTING
CFLAGS = @CFLAGS@
FFLAGS = @FFLAGS@ @MPIINC@
if ENABLE_EXAMPLES
if ENABLE_FORTRAN
LDADD += -lH5hutF
AM_LDFLAGS += -L${abs_top_builddir}/src/Fortran/.libs
endif
# LIBRARIES
SZLIB = @SZLIB@
HDFLIB = -L$(HDF5ROOT)/lib -lhdf5 -lz $(SZLIB) @LDFLAGS@
MPILIB = @MPILIB@
H5LIB = -L${abs_top_builddir}/src/lib -lH5Core -lH5
LDADD += -lH5hut
LIBS = ${H5LIB} $(HDFLIB) $(MPILIB) -lm @STDCXX@
noinst_PROGRAMS =
# H5Part compiled library location
# H5PLIB = -L@prefix@/lib
if ENABLE_C
noinst_PROGRAMS += \
attach_field_attributes \
dump_field_attributes \
fields \
has_field \
read_write_scalar_field \
write_field
endif
# INCLUDES
HDFINC = -I$(HDF5ROOT)/include
MPIINC = @MPIINC@
H5INC = -I${abs_top_builddir}/src/include
if ENABLE_FORTRAN
if ENABLE_PARALLEL
noinst_PROGRAMS += read_write_scalar_fieldf
endif
endif
INC = $(HDFINC) $(MPIINC) $(H5INC)
# What to build... make install will place these files in the $(prefix)/bin directory.
bin_PROGRAMS = @TBTARGET@
# Some useful scripts that I wish to place in the $(prefix)/bin directory.
bin_SCRIPTS =
#bin_SCRIPTS = JAC_H5PartTestP_script.scr JAC_H5testFpar_script.scr JAC_RUN_ALL_script.scr
# Listing of all programs that maybe built. (Has to know statically...)
EXTRA_PROGRAMS =
# Extra files that I wish to include in the dist tar ball.
EXTRA_DIST = \
H5BlockParTestScalarField.c H5BlockParTestScalarFieldF.f90 \
H5BlockTestAttributes.c H5BlockTestAttributesF.f90 \
$(bin_SCRIPTS)
# Specific building instruction (What compilers to use...)
# ------------ Build Tests ------------
###############################################################################
% : %.o
$(CC) -o $@ $< $(H5LIB) $(LIBS)
%.o : %.c
$(CC) $(CFLAGS) $(INC) -g -c $<
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 $(H5INC) $<
H5BlockTestAttributes.o: H5BlockTestAttributes.c
H5BlockTestAttributes: H5BlockTestAttributes.o
H5BlockTestAttributesF.o: H5BlockTestAttributesF.f90
H5BlockTestAttributesF: H5BlockTestAttributesF.o
$(FC) -o $@ $< $(H5LIB) -lH5PartF -lH5Part $(LIBS)
H5BlockParTestScalarField.o: H5BlockParTestScalarField.c
H5BlockParTestScalarField: H5BlockParTestScalarField.o
H5BlockParTestScalarFieldF.o: H5BlockParTestScalarFieldF.f90
H5BlockParTestScalarFieldF: H5BlockParTestScalarFieldF.o
$(FC) -o $@ $< $(H5LIB) -lH5PartF -lH5Part $(LIBS)
H5BlockDissolveGhosts.o: H5BlockDissolveGhosts.c
H5BlockDissolveGhosts: H5BlockDissolveGhosts.o
###############################################################################
clean:
${RM} -f *~ *.o ${bin_PROGRAMS}
distclean: clean
${RM} -rf .deps
${RM} -rf .libs
${RM} -f parttest.h5
${RM} -rf config.status config.log config.h Makefile
$(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;
}
+203
View File
@@ -0,0 +1,203 @@
/*
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");
}
static inline void
dump_string_attrib (
h5_file_t file,
const char* const field_name,
const char* const attrib_name,
h5_size_t attrib_nelems
) {
char attrib_data[attrib_nelems];
H5BlockReadFieldAttribString (
file,
field_name,
attrib_name,
attrib_data);
printf ("Attribute: '%s'\n", attrib_name);
printf (" Type: H5_STRING_T\n");
printf (" Data: %s", attrib_data);
}
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;
}
+554
View File
@@ -0,0 +1,554 @@
/*
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 <stdlib.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;
static 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;
}
+22 -6
View File
@@ -1,8 +1,23 @@
#
# 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.
#
AM_LDFLAGS = -L../../src/lib @LDFLAGS@
LIBS = -lH5hutC -lH5hut @LIBS@
AM_CPPFLAGS += -I$(top_srcdir)/src/include
AM_CPPFLAGS += -I${abs_top_srcdir}/src/include
FFLAGS += -cpp $(AM_CPPFLAGS)
AM_LDFLAGS += -L${abs_top_builddir}/src/h5core/.libs
if ENABLE_DEBUG
AM_LDFLAGS += -static
endif
LDADD =
LDADD += -lH5hut
if ENABLE_EXAMPLES
noinst_PROGRAMS = \
tetmesh_write \
tetmesh_write1 \
@@ -34,11 +49,12 @@ EXTRA_DIST = \
trimesh_write.c \
trimesh_2gnuplot.c \
trimesh_write_dunetest.c
# map_tet2globalid.c \
# map_triangle2globalid.c \
# $(bin_SCRIPTS)
clean: clean-am
rm -f *.h5
endif
clean-local:
$(RM) *.h5 *~
+9 -12
View File
@@ -4,10 +4,6 @@
#include "H5hut.h"
#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 +23,7 @@ static Timer*
new (
void
) {
Timer* this = malloc (sizeof (Timer));
Timer* this = (Timer*)malloc (sizeof (Timer));
*this = Timer_;
return this;
}
@@ -500,7 +496,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 +511,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 +519,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 +543,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);
+8 -7
View File
@@ -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);
+18 -17
View File
@@ -4,13 +4,12 @@
#include "H5hut.h"
// name of input file
const char* FNAME = "simple_tet.h5";
#ifndef PARALLEL_IO
#ifndef MPI_COMM_WORLD
#define MPI_COMM_WORLD 0
#endif
#endif
// H5hut verbosity/debug level
const h5_int64_t h5_verbosity = H5_VERBOSE_DEFAULT;
const h5_int64_t h5_debugmsk = H5_DEBUG_ALL;
typedef struct timer {
clock_t _start;
@@ -27,7 +26,7 @@ static Timer*
new (
void
) {
Timer* self = malloc (sizeof (Timer));
Timer* self = (Timer*)malloc (sizeof (Timer));
*self = Timer_;
return self;
}
@@ -111,7 +110,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 +171,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 +235,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 +297,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 +326,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 +341,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 +349,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 +361,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);
}
@@ -378,12 +377,14 @@ main (
int argc,
char* argv[]
) {
/* abort program on error, so we don't have to handle them */
H5SetErrorHandler (H5AbortErrorhandler);
H5SetVerbosityLevel (2);
H5SetVerbosityLevel (h5_verbosity);
H5SetDebugMask (h5_debugmsk);
/* 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);
+2 -9
View File
@@ -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);
+1 -2
View File
@@ -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);
+1 -3
View File
@@ -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;
+3 -4
View File
@@ -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);
+1 -7
View File
@@ -57,12 +57,6 @@ main (
char* argv[]
) {
#if defined (PARALLEL_IO)
MPI_Comm comm = MPI_COMM_WORLD;
MPI_Init (&argc, &argv);
#else
MPI_Comm comm = 0;
#endif
if (argc < 2 || argc > 3) {
fprintf (stderr, "Usage: %s FILE [LEVEL]\n", argv[0]);
exit (42);
@@ -73,7 +67,7 @@ main (
H5SetVerbosityLevel (0);
/* open file and get number of meshes */
h5_file_t* f = H5OpenFile (argv[1], H5_O_RDONLY, comm);
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);
+6 -7
View File
@@ -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);
+5 -12
View File
@@ -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);
+1 -2
View File
@@ -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);
+1 -1
View File
@@ -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);
+10
View File
@@ -0,0 +1,10 @@
query
read_core_vfd
read_core_vfdf
read_canonicalviewf
read_setnparticlesf
read_setviewf
read_stridedf
write_core_vfdf
write_setnparticlesf
write_stridedf
-263
View File
@@ -1,263 +0,0 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <mpi.h>
/* #include <mpio.h> */
#include <unistd.h>
#include <sys/types.h>
#ifndef PARALLEL_IO
#define PARALLEL_IO
#endif
#ifndef DISABLE_H5PART
#include "H5hut.h"
#endif
#define FILENAME "testio"
/* normally 64 steps for real benchmark */
/* #define NSTEPS 5 */
/* normally 51e6 for real benchmark */
#define NPARTICLES 51e4
#define NTRIALS 3
/*
bench <nParticles> <nSteps>
*/
int main(int argc,char *argv[]){
if (argc < 3) {
printf("Usage: bench <nParticles> <nSteps> \n");
exit(-1);
}
else {
printf("nparticles: %d, nsteps: %d \n", atoi(argv[1]), atoi(argv[2]));
}
MPI_Info info;
int nprocs,rank;
int trial;
int i,j,n; /* iteration variables */
double starttime,curtime, endtime;
int nparticles = atoi(argv[1]);
int nsteps = atoi(argv[2]);
double *x,*y,*z,*px,*py,*pz;
typedef double *ddouble;
ddouble data[6];
MPI_Datatype chunktype;
int offset;
int localnp;
char filename[128]; /*= FILENAME; */
#ifndef DISABLE_H5PART
h5_file_t *f;
#endif
char newfilename[128];
FILE *fd;
MPI_File file;
MPI_Offset foffset;
MPI_Comm dcomm = MPI_COMM_WORLD;
MPI_Init(&argc,&argv);
MPI_Comm_rank(dcomm,&rank);
MPI_Comm_size(dcomm,&nprocs);
localnp=nparticles/(int64_t)nprocs;
for(offset=0,i=0;i<rank;i++){
offset+=localnp;
}
data[0]=x=(double*)malloc(sizeof(double)*(size_t)localnp);
data[1]=y=(double*)malloc(sizeof(double)*(size_t)localnp);
data[2]=z=(double*)malloc(sizeof(double)*(size_t)localnp);
data[3]=px=(double*)malloc(sizeof(double)*(size_t)localnp);
data[4]=py=(double*)malloc(sizeof(double)*(size_t)localnp);
data[5]=pz=(double*)malloc(sizeof(double)*(size_t)localnp);
/* printf("about to call create subarray with nparticles=%u localnp=%u offset=%u\n",
nparticles,localnp,offset); */
MPI_Type_create_subarray(1, /* rank */
&nparticles, /* size of the global array */
&localnp, /* size of my local chunk */
&offset, /* offset of this chunk in global */
MPI_ORDER_FORTRAN, /* fortran storage order */
MPI_DOUBLE,
&chunktype);
MPI_Type_commit(&chunktype);
MPI_Info_create(&info);
MPI_Info_set(info, "IBM_largeblock_io", "true" );
if(rank==0) printf("Nprocs=%u Particles=%u*6attribs*sizeof(double) Particles/proc=%u Nsteps=%u Ntrials=%u\n",
nprocs,nparticles,localnp,nsteps,NTRIALS);
for(trial=0;trial<NTRIALS;trial++){
if(rank==0) printf("---------------------- Trial %u of %u ---------------------\n",trial+1,NTRIALS);
MPI_Barrier(MPI_COMM_WORLD); /* to prevent unlink from interfering with file open */
sprintf(filename,"%s.%u.mpio.dat",FILENAME,nprocs);
if(rank==0) unlink(filename);
MPI_Barrier(MPI_COMM_WORLD); /* to prevent unlink from interfering with file open */
MPI_File_open(MPI_COMM_WORLD,filename,
MPI_MODE_CREATE | MPI_MODE_RDWR,
info,&file);
MPI_File_set_view(file,0,MPI_DOUBLE,chunktype,"native",info);
/* now a barrier to get the start timers roughly synced*/
MPI_Barrier(MPI_COMM_WORLD);
curtime = starttime = MPI_Wtime();
endtime = starttime+5.0*60.0; /* end in 5 minutes */
MPI_Bcast(&endtime,1,MPI_DOUBLE,0,MPI_COMM_WORLD);
/* must touch the entire array after each write */
/* ensures cache-invalidation */
foffset=0;
i=0;
curtime=starttime;
for(i=0;i<nsteps;i++){
int n;
MPI_Status status;
for(j=0;j<6;j++){
/* touch data */
for(n=0;n<localnp;n++)
(data[j])[n]=(double)rank;
/* write to that file */
/* MPI_File_set_view(file,foffset,MPI_DOUBLE,chunktype,"native",info);*/
#ifdef COLLECTIVE_IO
MPI_File_write_at_all(file,
foffset,
data[j],
localnp,
MPI_DOUBLE,&status);
#else
MPI_File_write_at(file,
foffset,
data[j],
localnp,
MPI_DOUBLE,&status);
#endif
foffset+=nparticles/nprocs;
}
curtime=MPI_Wtime(); /* ensure no race condition by broadcasting time */
MPI_Bcast(&curtime,1,MPI_DOUBLE,0,MPI_COMM_WORLD);
}
MPI_File_close(&file);
MPI_Barrier(MPI_COMM_WORLD);
endtime=MPI_Wtime();
/* foffset*=nprocs; if we want total megabytes written */
if(rank==0){
puts("*");
unlink(filename);
puts("======================================================");
printf("Raw MPI-IO Total Duration %lf seconds, iterations=%u %lf Megabytes written per processor Nprocs= %u \n",
(endtime-starttime),i,((double)foffset)/(1024.0*1024.0),nprocs);
printf("Raw MPI-IO Effective Data Rate = %lf Megabytes/sec global and %lf Megabytes/sec per task Nprocs= %u \n",
(double)(nprocs*localnp*sizeof(double))*((double)nsteps)*6.0/((endtime-starttime)*1024.0*1024.0),
(double)(localnp*sizeof(double))*((double)nsteps)*6.0/((endtime-starttime)*1024.0*1024.0),nprocs);
puts("======================================================");
}
MPI_Barrier(MPI_COMM_WORLD); /* to prevent unlink from interfering with file open */
/* OK, now we do this using POSIX IO */
sprintf(newfilename,"testio%u.%u.dat",rank,nprocs);
unlink(newfilename);
MPI_Barrier(MPI_COMM_WORLD); /* to prevent unlink from interfering with file open */
fd = fopen(newfilename,"w");
/* start the timer */
starttime=endtime=MPI_Wtime();
for(i=0;i<nsteps;i++){
for(j=0;j<6;j++){
/* touch data */
for(n=0;n<localnp;n++)
(data[j])[n]=(double)rank;
fwrite(data[j],sizeof(double),localnp,fd);
}
curtime=MPI_Wtime(); /* ensure no race condition by broadcasting time */
MPI_Bcast(&curtime,1,MPI_DOUBLE,0,MPI_COMM_WORLD);
}
fclose(fd);
MPI_Barrier(MPI_COMM_WORLD);
endtime=MPI_Wtime();
if(rank==0) puts("*");
MPI_Barrier(MPI_COMM_WORLD); /* to prevent unlink from interfering with file open */
unlink(newfilename);
MPI_Barrier(MPI_COMM_WORLD);
if(rank==0){
puts("======================================================");
printf("Raw 1-file-per-proc Total Duration %lf seconds, iterations=%u %lf Megabytes written Nprocs= %u \n",
(endtime-starttime),nsteps,((double)foffset)/(1024.0*1024.0),nprocs);
printf("Raw 1-file-per-proc Effective Data Rate = %lf Megabytes/sec global and %lf Megabytes/sec per task Nprocs= %u \n",
(double)(nprocs*localnp*sizeof(double))*((double)nsteps)*6.0/((endtime-starttime)*1024.0*1024.0),
(double)(localnp*sizeof(double))*((double)nsteps)*6.0/((endtime-starttime)*1024.0*1024.0),nprocs);
puts("======================================================");
}
#ifndef DISABLE_H5PART
MPI_Barrier(MPI_COMM_WORLD); /* to prevent unlink from interfering with file open */
/* OK, now we do this using H5Part */
sprintf(filename,"%s.%u.h5.dat",FILENAME,nprocs);
if(rank==0) unlink(filename);
MPI_Barrier(MPI_COMM_WORLD); /* to prevent unlink from interfering with file open */
f = H5OpenFile(filename,H5_O_WRONLY,MPI_COMM_WORLD);
MPI_Barrier(MPI_COMM_WORLD); /* to prevent unlink from interfering with file open */
/* start the timer */
starttime=endtime=MPI_Wtime();
H5PartSetNumParticles(f,localnp);
for(i=0;i<nsteps;i++){
for(j=0;j<6;j++){
/* touch data */
for(n=0;n<localnp;n++)
(data[j])[n]=(double)rank;
}
H5SetStep(f,i);
H5PartWriteDataFloat64(f,"x",x);
H5PartWriteDataFloat64(f,"y",y);
H5PartWriteDataFloat64(f,"z",z);
H5PartWriteDataFloat64(f,"px",px);
H5PartWriteDataFloat64(f,"py",py);
H5PartWriteDataFloat64(f,"pz",pz);
curtime=MPI_Wtime(); /* ensure no race condition by broadcasting time */
MPI_Bcast(&curtime,1,MPI_DOUBLE,0,MPI_COMM_WORLD);
}
H5CloseFile(f);
MPI_Barrier(MPI_COMM_WORLD);
endtime=MPI_Wtime();
if(rank==0){
puts("*");
unlink(filename);
puts("======================================================");
printf("H5Part Total Duration %lf seconds, iterations=%u %lf Megabytes written Nprocs= %u \n",
(endtime-starttime),nsteps,((double)foffset)/(1024.0*1024.0),nprocs);
printf("H5Part Effective Data Rate = %lf Megabytes/sec global and %lf Megabytes/sec per task Nprocs= %u \n",
(double)(nprocs*localnp*sizeof(double))*((double)nsteps)*6.0/((endtime-starttime)*1024.0*1024.0),
(double)(localnp*sizeof(double))*((double)nsteps)*6.0/((endtime-starttime)*1024.0*1024.0),nprocs);
puts("======================================================");
}
MPI_Barrier(MPI_COMM_WORLD);
#endif
} /* trials */
MPI_Finalize();
return 0;
}
-111
View File
@@ -1,111 +0,0 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <hdf5.h>
#include "H5Part.hh"
#ifdef READTEST
#endif
#ifdef REGRESSIONTEST
/*
A simple regression test that shows how you use this API
to write and read multi-timestep files of particle data.
*/
#ifdef PARALLEL_IO
int main(int argc,char *argv[]){
int sz=5;
double *x,*y,*z;
h5part_int64_t *id;
char name[64];
H5PartFile *file;
int i,t,nt,nds;
int nprocs,myproc;
hid_t gid;
MPI_Comm comm=MPI_COMM_WORLD;
MPI_Init(&argc,&argv);
MPI_Comm_size(comm,&nprocs);
MPI_Comm_rank(comm,&myproc);
x=(double*)malloc(sz*nprocs*sizeof(double));
y=(double*)malloc(sz*nprocs*sizeof(double));
z=(double*)malloc(sz*nprocs*sizeof(double));
id=(h5part_int64_t*)malloc(sz*nprocs*sizeof(h5part_int64_t));
/* parallel file creation */
file=H5PartOpenFileParallel("parttest.h5",H5PART_WRITE,comm);
if(!file) {
perror("File open failed: exiting!");
exit(0);
}
for(t=0;t<5;t++){
MPI_Barrier(comm);
for(i=0;i<sz;i++) {
x[i]=(double)(i+t)+10.0*(double)myproc;
y[i]=0.1 + (double)(i+t);
z[i]=0.2 + (double)(i+t*10);
id[i]=i+sz*myproc;
}
printf("Proc[%u] Writing timestep %u file=%u\n",myproc,t,file->file);
H5PartSetStep(file,t); /* must set the current timestep in file */
H5PartSetNumParticles(file,sz); /* then set number of particles to store */
/* now write different tuples of data into this timestep of the file */
H5PartWriteDataFloat64(file,"x",x);
H5PartWriteDataFloat64(file,"y",y);
H5PartWriteDataFloat64(file,"z",z);
H5PartWriteDataFloat64(file,"px",x);
H5PartWriteDataFloat64(file,"py",y);
H5PartWriteDataFloat64(file,"pz",z);
H5PartWriteDataInt64(file,"id",id);
}
unsigned int idStart = 0+sz*myproc;
unsigned int idEnd = (sz-1)+sz*myproc;
printf("AllDone p[%u]\n",myproc);
H5PartCloseFile(file);
MPI_Barrier(comm);
printf("p[%u:%u] : OK, close file and reopen for reading idStart %u idEnd %u \n",myproc,nprocs,idStart,idEnd);
file=H5PartOpenFileParallel("parttest.h5",H5PART_READ,comm);
H5PartSetStep(file,0);
unsigned int np = 0;
// unsigned int np = (int)H5PartGetNumParticles(file);
// nt=H5PartGetNumSteps(file); /* get number of steps in file */
//nds=H5PartGetNumDatasets(file); /* get number of datasets in timestep 0 */
MPI_Barrier(comm);
// H5PartSetView(file,idStart,idEnd);
printf("steps= %u datasets= %u particles= %u\n",nt,nds,np);
if(x)
free(x);
if(y)
free(y);
if(z)
free(z);
if(id)
free(id);
H5PartCloseFile(file);
MPI_Barrier(comm);
fprintf(stderr,"proc[%u]: done\n",myproc);
return MPI_Finalize();
}
#else
#endif
#endif
-119
View File
@@ -1,119 +0,0 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <hdf5.h>
#include "H5Part.h"
/*
A simple regression test that shows how you use this API
to write and read multi-timestep files of particle data.
*/
#ifdef PARALLEL_IO
int main(int argc,char *argv[]){
int N = 10;
int sz=0;
double *x,*y,*z;
h5_int64_t *id;
h5_file_t *file;
int i,t,nt,nds;
int nprocs,myproc;
unsigned int np = 0;
MPI_Comm comm=MPI_COMM_WORLD;
MPI_Init(&argc,&argv);
MPI_Comm_size(comm,&nprocs);
MPI_Comm_rank(comm,&myproc);
/* parallel file creation */
file=H5PartOpenFileParallel("parttest.h5",H5PART_WRITE,comm);
if(!file) {
perror("File open failed: exiting!");
exit(0);
}
for(t=0;t<5;t++){
MPI_Barrier(comm);
sz = myproc*N;
// proc[0] sz = 10, (next step N=10), sz=10
// proc[1] sz = 20, (next step N=20), sz=40
fprintf(stderr,"proc[%u] sz=%u\n",myproc,(unsigned)sz);
x =(double*)malloc(1+sz*sizeof(double));
y =(double*)malloc(1+sz*sizeof(double));
z =(double*)malloc(1+sz*sizeof(double));
id=(h5_int64_t*)malloc(1+sz*sizeof(h5_int64_t));
for(i=0;i<sz;i++) {
x[i]=(double)(i+t)+10.0*(double)myproc;
y[i]=0.1 + (double)(i+t);
z[i]=0.2 + (double)(i+t*10);
id[i]=i+sz*myproc;
}
fprintf(stderr,"Proc[%u] Writing timestep %u Np=%u\n",myproc,t,sz);
H5PartSetStep(file,t); /* must set the current timestep in file */
fprintf(stderr,"Proc[%u]: setNumParticles start\n",myproc);
H5PartSetNumParticles(file,sz); /* then set number of particles to store */
fprintf(stderr,"Proc[%u]: setNumParticles done\n",myproc);
/* now write different tuples of data into this timestep of the file */
fprintf(stderr,"Proc[%u]: WriteX start\n",myproc);
H5PartWriteDataFloat64(file,"x",x);
fprintf(stderr,"Proc[%u]: WriteX done\n",myproc);
H5PartWriteDataFloat64(file,"y",y);
H5PartWriteDataFloat64(file,"z",z);
H5PartWriteDataFloat64(file,"px",x);
H5PartWriteDataFloat64(file,"py",y);
H5PartWriteDataFloat64(file,"pz",z);
H5PartWriteDataInt64(file,"id",id);
if(x)
free(x);
if(y)
free(y);
if(z)
free(z);
if(id)
free(id);
// remove the next line and everything is ok
N = 1 + sz;
}
printf("AllDone p[%u]\n",myproc);
H5PartCloseFile(file);
MPI_Barrier(comm);
unsigned int idStart = 0;
unsigned int idEnd = myproc*10;
printf("p[%u:%u] : OK, close file and reopen for reading idStart %u idEnd %u \n",myproc,nprocs,idStart,idEnd);
file=H5PartOpenFileParallel("parttest.h5",H5PART_READ,comm);
H5PartSetStep(file,0);
nt = H5GetNumSteps(file); /* get number of steps in file */
nds=H5PartGetNumDatasets(file); /* get number of datasets in timestep 0 */
MPI_Barrier(comm);
H5PartSetView(file,idStart,idEnd);
np = H5PartGetNumParticles(file);
printf("steps= %u datasets= %u particles= %u\n",nt,nds,np);
H5PartCloseFile(file);
MPI_Barrier(comm);
fprintf(stderr,"proc[%u]: done\n",myproc);
return MPI_Finalize();
}
#endif
-296
View File
@@ -1,296 +0,0 @@
#include <stdlib.h>
#include "H5hut.h"
/*
A simple regression test that shows how you use this API
to write and read multi-timestep files of particle data.
*/
#ifdef PARALLEL_IO
int main(int argc,char *argv[]){
int sz=5;
double *x,*y,*z;
h5_int64_t *id;
h5_file_t *file;
int i,t,nt,nds;
int nprocs,myproc;
MPI_Comm comm=MPI_COMM_WORLD;
MPI_Init(&argc,&argv);
MPI_Comm_size(comm,&nprocs);
MPI_Comm_rank(comm,&myproc);
x=(double*)malloc(sz*nprocs*sizeof(double));
y=(double*)malloc(sz*nprocs*sizeof(double));
z=(double*)malloc(sz*nprocs*sizeof(double));
id=(h5_int64_t*)malloc(sz*nprocs*sizeof(h5_int64_t));
/* parallel file creation */
file=H5OpenFile ("parttest.h5",H5_O_WRONLY,comm);
if(!file) {
perror("File open failed: exiting!");
exit(0);
}
for(t=0;t<5;t++){
MPI_Barrier(comm);
for(i=0;i<sz;i++) {
x[i]=(double)(i+t)+10.0*(double)myproc;
y[i]=0.1 + (double)(i+t);
z[i]=0.2 + (double)(i+t*10);
id[i]=i+sz*myproc;
}
printf("Proc[%u] Writing timestep %u \n",myproc,t);
H5SetStep(file,t); /* must set the current timestep in file */
H5PartSetNumParticles(file,sz); /* then set number of particles to store */
/* now write different tuples of data into this timestep of the file */
H5PartWriteDataFloat64(file,"x",x);
H5PartWriteDataFloat64(file,"y",y);
H5PartWriteDataFloat64(file,"z",z);
H5PartWriteDataFloat64(file,"px",x);
H5PartWriteDataFloat64(file,"py",y);
H5PartWriteDataFloat64(file,"pz",z);
H5PartWriteDataInt64(file,"id",id);
}
unsigned int idStart = 0+sz*myproc;
unsigned int idEnd = (sz-1)+sz*myproc;
printf("AllDone p[%u]\n",myproc);
H5CloseFile(file);
fprintf(stderr,"Closed files p[%u]\n",myproc);
MPI_Barrier(comm);
fprintf(stderr,"p[%u:%u] : OK, close file and reopen for reading idStart %u idEnd %u \n",myproc,nprocs,idStart,idEnd);
file=H5OpenFile("parttest.h5",H5_O_RDONLY,comm);
H5SetStep(file,0);
// unsigned int np = 0;
unsigned int np = (int)H5PartGetNumParticles(file);
nt=H5GetNumSteps(file); /* get number of steps in file */
nds=H5PartGetNumDatasets(file); /* get number of datasets in timestep 0 */
MPI_Barrier(comm);
H5PartSetView(file,idStart,idEnd);
np = (int)H5PartGetNumParticles(file);
printf("After SetView(%d,%d): steps= %u datasets= %u particles= %u\n",
(int)idStart,(int)idEnd,
nt,nds,np);
if(x)
free(x);
if(y)
free(y);
if(z)
free(z);
if(id)
free(id);
H5CloseFile(file);
MPI_Barrier(comm);
fprintf(stderr,"proc[%u]: done\n",myproc);
return MPI_Finalize();
}
#else
int main(int argc,char *argv[]){
int sz=10;
double *x,*y,*z;
h5_int64_t *id;
h5_file_t *file;
int i,t,nt,nds,np;
h5_int64_t idStart = 0;
h5_int64_t idEnd = 0;
x=(double*)malloc(sz*sizeof(double));
y=(double*)malloc(sz*sizeof(double));
z=(double*)malloc(sz*sizeof(double));
id=(h5_int64_t*)malloc(sz*sizeof(h5_int64_t));
/* parallel file creation */
file=H5PartOpenFile("parttest.h5",H5_O_WRONLY);
if(!file) {
perror("File open failed: exiting!");
exit(0);
}
H5PartWriteFileAttribString(file,"File Description", "This file is created by H5PartTest.cc. Simple H5Part file for testing purpose...");
char* FileAttrib = "Created by H5PartTest.cc";
H5PartWriteFileAttrib(file, "Origin", H5T_NATIVE_CHAR, FileAttrib ,strlen(FileAttrib));
for(t=0;t<5;t++){
fprintf(stdout,"Writing timestep %u\n",t);
for(i=0;i<sz;i++) {
x[i]=(double)(i+t);
y[i]=0.1 + (double)(i+t);
z[i]=0.2 + (double)(i+t*10);
id[i]=i;
fprintf(stdout,"\tp[%u] x=%f y=%f z=%f id=%d\n",
i,x[i],y[i],z[i],(int)id[i]);
}
H5PartSetStep(file,t); /* must set the current timestep in file */
H5PartSetNumParticles(file,sz); /* then set number of particles to store */
/* now write different tuples of data into this timestep of the file */
H5PartWriteDataFloat64(file,"x",x);
H5PartWriteDataFloat64(file,"y",y);
H5PartWriteDataFloat64(file,"z",z);
H5PartWriteDataFloat64(file,"px",x);
H5PartWriteDataFloat64(file,"py",y);
H5PartWriteDataFloat64(file,"pz",z);
H5PartWriteDataInt64(file,"id",id);
H5PartWriteStepAttribString(file,"Step Description", "STEP STEP STEP");
char* StepAttrib = "STEP";
H5PartWriteStepAttrib(file, "Step", H5T_NATIVE_CHAR, StepAttrib ,strlen(StepAttrib));
}
printf("AllDone writing\n");
H5PartCloseFile(file);
/*+++++++++++++ Reopen File for Reading +++H5PartSetStep(h5partFile,0)++++++++*/
file=H5PartOpenFile("parttest.h5",H5_O_RDONLY);
/********************************************/
H5PartSetStep(file,0);
nt=H5GetNumSteps(file); /* get number of steps in file */
nds=H5PartGetNumDatasets(file); /* get number of datasets in timestep 0 */
np=H5PartGetNumParticles(file);
fprintf(stdout,"OK, close file and reopen for reading\n");
fprintf(stdout,"steps= %u\tdatasets=%u\tparticles= %u\n",
nt,nds,np);
// clear the particles
for(i=0;i<np;i++){
x[i]=y[i]=z[i]=0.0;
id[i]=0;
}
H5PartReadDataFloat64(file,"x",x);
H5PartReadDataFloat64(file,"y",y);
H5PartReadDataFloat64(file,"z",z);
H5PartReadDataInt64(file,"id",id);
for(i=0;i<np;i++){
fprintf(stdout,
"\tp[%3u] x=%lf y=%lf z=%lf id=%lld\n",
i,x[i],y[i],z[i],(long long)(id[i]));
}
/************************ std::cout << "nParticles: " << nParticles << std::endl;
********************/
printf("Set to last step and reload data\n");
H5PartSetStep(file,nt-1);
H5PartReadDataFloat64(file,"x",x);
H5PartReadDataFloat64(file,"y",y);
H5PartReadDataFloat64(file,"z",z);
H5PartReadDataInt64(file,"id",id);
for(i=0;i<np;i++){
fprintf(stdout,"\tp[%3u] x=%lf y=%lf z=%lf id=%lld\n",
i,x[i],y[i],z[i],(long long) (id[i]));
}
/********************************************/
idEnd=np;
printf("Old View is %d:%d\n",(int)idStart,(int)idEnd);
H5PartSetView(file,idStart,idEnd>>1);
printf("Set new view = %d:%d\n",(int)idStart,(int)(idEnd>>1));
H5PartGetView(file,&idStart,&idEnd);
np=H5PartGetNumParticles(file);
printf("steps= %u datasets= %u particles= %d with view %d:%d\n",
nt,nds,(int)np,(int)idStart,(int)idEnd);
H5PartSetStep(file,nt-1); // set to last step
printf("Setting to last step = %u\n",nt-1);
for(i=0;i<10;i++){ x[i]=y[i]=z[i]=0.0; id[i]=0; } /* clear the arrays */
H5PartReadDataFloat64(file,"x",x);
H5PartReadDataFloat64(file,"y",y);
H5PartReadDataFloat64(file,"z",z);
H5PartReadDataInt64(file,"id",id);
for(i=0;i<np;i++){
fprintf(stdout,
"\tp[%3u] x=%lf y=%lf z=%lf id=%lld\n",
i,x[i],y[i],z[i],(long long)id[i]);
}
/********************************************/
printf("Now set the view to the latter half of the data in step #%u\n",nt-1);
H5PartResetView(file);
H5PartGetView(file,&idStart,&idEnd);
printf("Reset view = %d:%d\nSetting to %u:%u\n",
(int)idStart,(int)idEnd,
(int)idEnd>>1,(int)idEnd);
H5PartSetView(file,(idEnd>>1),idEnd);
np=H5PartGetNumParticles(file);
printf("Now particles in selection are %d\n",np);
printf("doubleCheck=%lld\n", (long long)H5PartGetView(file,0,0));
for(i=0;i<10;i++){ x[i]=y[i]=z[i]=0.0; id[i]=0; } /* clear the arrays */
H5PartReadDataFloat64(file,"x",x);
H5PartReadDataFloat64(file,"y",y);
H5PartReadDataFloat64(file,"z",z);
H5PartReadDataInt64(file,"id",id);
for(i=0;i<np;i++){
fprintf(stdout,
"\tp[%3u] x=%lf y=%lf z=%lf id=%lld\n",
i,x[i],y[i],z[i],(long long)id[i]);
}
// read dataset names
h5_int64_t status = H5_SUCCESS;
const h5_int64_t lenName = 64;
char datasetName[lenName];
h5_int64_t datasetType;
h5_int64_t datasetNElems;
H5PartSetStep(file,0);
for (h5_int64_t i=0; i < nds; i++) {
status = H5PartGetDatasetInfo(file, i, datasetName, lenName,
&datasetType, &datasetNElems);
if (status != H5_SUCCESS) {
perror("Could not retrieve dataset names!");
}
else {
printf("datasetName: %s, type: %lld, nElements: %lld ",
datasetName, datasetType, datasetNElems);
if (datasetType == H5_INT64_T) {
printf("H5PPART_INT64 \n");
}
else {
printf("H5PPART_FLOAT64 \n");
}
}
}
if(x)
free(x);
if(y)
free(y);
if(z)
free(z);
if(id)
free(id);
H5PartCloseFile(file);
fprintf(stderr,"done\n");
}
#endif
-120
View File
@@ -1,120 +0,0 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <hdf5.h>
#include "H5Part.h"
#ifdef PARALLEL_IO
/*
This regression test is used to ensure parallel I/O is
working correctly and that Views are working for
parallel reads.
*/
int main(int argc,char *argv[]){
const int sz=5000;
double *x,*y,*z;
h5part_int64_t *id;
char name[64];
H5PartFile *file;
int i,t,nt,nds;
int nprocs,myproc;
hid_t gid;
MPI_Comm comm=MPI_COMM_WORLD;
MPI_Init(&argc,&argv);
MPI_Comm_size(comm,&nprocs);
MPI_Comm_rank(comm,&myproc);
x=(double*)malloc(sz*nprocs*sizeof(double));
y=(double*)malloc(sz*nprocs*sizeof(double));
z=(double*)malloc(sz*nprocs*sizeof(double));
id=(h5part_int64_t*)malloc(sz*nprocs*sizeof(h5part_int64_t));
/* parallel file creation */
file=H5PartOpenFileParallel("parttest.h5",H5PART_WRITE,comm);
if(!file) {
perror("File open failed: exiting!");
exit(0);
}
for(t=0;t<5;t++){
MPI_Barrier(comm);
for(i=0;i<sz;i++) {
x[i]=(double)(i+t)+10.0*(double)myproc;
y[i]=0.1 + (double)(i+t);
z[i]=0.2 + (double)(i+t*10);
id[i]=i+sz*myproc;
}
printf("Proc[%u] Writing timestep %u\n",myproc,t);
if(t==0){
printf("Proc[%u]: data values x[first,last]=%f:%f y[%u:%u]=%f:%f z[:]=%f:%f id[:]=%f:%f\n",
myproc,x[0],x[sz-1],0,sz-1,y[0],y[sz-1],z[0],z[sz-1],(int)id[0],(int)id[sz-1]);
}
H5PartSetStep(file,t); /* must set the current timestep in file */
H5PartSetNumParticles(file,sz); /* then set number of particles to store */
/* now write different tuples of data into this timestep of the file */
H5PartWriteDataFloat64(file,"x",x);
H5PartWriteDataFloat64(file,"y",y);
H5PartWriteDataFloat64(file,"z",z);
H5PartWriteDataFloat64(file,"px",x);
H5PartWriteDataFloat64(file,"py",y);
H5PartWriteDataFloat64(file,"pz",z);
H5PartWriteDataInt64(file,"id",id);
}
printf("AllDone p[%u]\n",myproc);
H5PartCloseFile(file);
MPI_Barrier(comm);
printf("p[%u:%u] : OK, close file and reopen for reading\n",myproc,nprocs);
file=H5PartOpenFileParallel("parttest.h5",H5PART_READ,comm);
H5PartSetStep(file,0);
unsigned int np,total_np = (int)H5PartGetNumParticles(file);
nt=H5PartGetNumSteps(file); /* get number of steps in file */
nds = H5PartGetNumDatasets(file);
if(myproc==0){
fprintf(stdout,"steps= %u\tdatasets=%u\tparticles= %u\n",
nt,nds,total_np);
}
MPI_Barrier(comm);
/* now lets compute the appropriate idStart and idEnd
for this particular processor */
h5part_int64_t idStart = sz*myproc;
h5part_int64_t idEnd = (sz-1)+sz*myproc;
H5PartSetView(file,idStart,idEnd);
np=H5PartGetNumParticles(file);
printf("Proc[%u]: View=%u:%u : particles= %u\n",
myproc,(int)idStart,(int)idEnd,H5PartGetNumParticles(file));
/* now lets read them and print some out */
H5PartReadDataFloat64(file,"x",x);
H5PartReadDataFloat64(file,"y",y);
H5PartReadDataFloat64(file,"z",z);
H5PartReadDataInt64(file,"id",id);
printf("Proc[%u]: data values x[first,last]=%f:%f y[%u:%u]=%f:%f z[:]=%f:%f id[:]=%f:%f\n",
myproc,x[0],x[sz-1],(int)idStart,(int)idEnd,y[0],y[sz-1],z[0],z[sz-1],(int)id[0],(int)id[sz-1]);
/* H5PartCloseFile(file); MPI_Finalize(); exit(0); */
if(x)
free(x);
if(y)
free(y);
if(z)
free(z);
if(id)
free(id);
H5PartCloseFile(file);
MPI_Barrier(comm);
fprintf(stderr,"proc[%u]: done\n",myproc);
return MPI_Finalize();
}
#else
#error This file only works when PARALLEL_IO is enabled.
#endif
-147
View File
@@ -1,147 +0,0 @@
#include <stdio.h>
#include <stdlib.h>
#include <hdf5.h>
#include "H5Part.h"
#include <fstream>
#include <iomanip>
#include <iostream>
#include <string>
using namespace std;
/*
A simple regression test that shows how you use this API
to write and read multi-timestep files of particle data.
*/
int ReadFile(const string fn){
char name[64];
h5_file_t *file;
int i,nt,nds;
cout << "Open " << fn << endl;
file= H5PartOpenFile(fn.c_str(),H5_O_RDONLY);
nt=H5GetNumSteps(file);
H5PartSetStep(file,0);
nds=H5PartGetNumDatasets(file);
cout << "Timesteps = " << nt << " dataSets per timestep = " << nds << endl;
cout << endl << endl << "===============================" << endl;
for(i=0;i<nds;i++){
H5PartGetDatasetName(file,i,name,64);
printf("\tDataset[%u] name=[%s]\n",
i,name);
}
cout << "===============================" << endl << endl;;
for (int steps=0; steps<nt; steps++) {
H5PartSetStep(file,steps);
h5_int64_t n = H5PartGetNumParticles(file);
cout << "number of particles this step =" << n << endl;
double *x=new double[n];
double *y=new double[n];
double *z=new double[n];
double *px=new double[n];
double *py=new double[n];
double *pz=new double[n];
h5_int64_t *id=new h5_int64_t[n];
H5PartReadParticleStep(file,steps,x,y,z,px,py,pz,id);
double sumx = 0.0;
double sumpz = 0.0;
for (h5_int64_t i=0; i<n; i++) {
sumx += x[i];
sumpz += pz[i];
}
cout << "\tstep= " << steps << " sum(x)= " << sumx << " sum(pz)= " << sumpz << endl;
cout << "\tfirst x is " << x[0] << "\tlast x is " << x[n-1] << endl;
cout << "\tFor fake data, expect sumx to be =" << x[0]*((double)n)<<endl;
delete x;
delete y;
delete z;
delete px;
delete py;
delete pz;
delete id;
}
H5PartCloseFile(file);
return 1;
}
int WriteFile(const string fn){
h5_file_t *file;
int i,t;
h5_int64_t n;
const int nt = 5;
const h5_int64_t np = 1024*1024;
cout << "Open " << fn << endl;
file= H5PartOpenFile(fn.c_str(),H5_O_WRONLY);
double *x=new double[np];
double *y=new double[np];
double *z=new double[np];
double *px=new double[np];
double *py=new double[np];
double *pz=new double[np];
h5_int64_t *id=new h5_int64_t[np];
H5PartSetNumParticles(file,np); // sets number of particles in simulation
for(n=0;n<np;n++) {
id[n]=i;
x[n]=1.0;
y[n]=2.0;
z[n]=3.0;
px[n]=1.0*((double)i)*((double)(i%10));
py[n]=2.0*((double)i)*((double)(i%10));
pz[n]=3.0*((double)i)*((double)(i%10));
}
for(t=0;t<nt;t++){
// setup the step number
H5PartSetStep(file,t);
printf("Write Step %u\n",t);
// write fake data
H5PartWriteDataFloat64(file,"x",x);
H5PartWriteDataFloat64(file,"y",y);
H5PartWriteDataFloat64(file,"z",z);
H5PartWriteDataFloat64(file,"px",px);
H5PartWriteDataFloat64(file,"py",py);
H5PartWriteDataFloat64(file,"pz",pz);
H5PartWriteDataInt64(file,"id",id);
}
H5PartCloseFile(file);
return 1;
}
int main(int argc,char **argv){
char *str;
char dstr[]="testfile.h5";
if(argc>1) str=argv[1];
else str=dstr;
const string fn = string(str);
/* f=fopen(fn.c_str(),"r");
if(f!=NULL) { a poor-man's stat()
fclose(f);
*/
if(!WriteFile(fn)){
cerr << "Failed to write file " << fn << endl;
exit(0);
}
/*
}
else {
cout << "File " << fn << " already exists, so we will proceed to reading" << endl;
} */
if(!ReadFile(fn)){
cerr << "Failed to read file " << fn << endl;
}
}
-107
View File
@@ -1,107 +0,0 @@
c ==============
c
c Sample Fortran program that uses HDF5 bindings
c
c ==============
program H5testF
implicit none
include 'H5Part.inc'
INTEGER*8 file
INTEGER*8 nstep,ndata
INTEGER*8 npoints
INTEGER*8 step
INTEGER*8 err
INTEGER*8 I,J
REAL*8,ALLOCATABLE:: X(:),Y(:),Z(:),PX(:),PY(:),PZ(:)
INTEGER*8,ALLOCATABLE:: ID(:)
REAL*8 REALTIME
file = h5pt_openw("testfilef.h5")
print *,"Opened file testfilef.h5 for writing"
npoints = 1024
nstep = 10
ALLOCATE(X(npoints),Y(npoints),Z(npoints))
ALLOCATE(PX(npoints),PY(npoints),PZ(npoints))
ALLOCATE(ID(npoints))
print *," Npoints=",npoints," nsteps=",nstep
print *," writing X,Y,Z,PX,PY,PZ,ID"
print *," ... initialize the data arrays"
do I=1,npoints
X(I)=0.0
Y(I)=1.0+I
Z(I)=100.0+I*2.0
ID(I)=I
enddo
print *,"Tell h5pt how many particles are stored in the file"
c set the number of points
err = h5pt_setnpoints(file,npoints)
print *,"write an attribute string"
c write an annotation to the file
err=h5pt_writefileattrib_string(file,"Annotation","Testing 1 2 3")
print *,"and now write the steps"
do I=1,nstep
c Set the step number
print *,"Write Step ",I
err = h5pt_setstep(file,I)
c Now start writing the data arrays for this step
err = h5pt_writedata_r8(file,"x",X)
err = h5pt_writedata_r8(file,"y",Y)
err = h5pt_writedata_r8(file,"z",Z)
err = h5pt_writedata_r8(file,"px",PX)
err = h5pt_writedata_r8(file,"py",PY)
err = h5pt_writedata_r8(file,"pz",PZ)
err = h5pt_writedata_i8(file,"id",ID)
do J=1,npoints
ID(J)=ID(J)+10
enddo
c And write a simple floatingpoint attribute associated with this timestep
REALTIME = I*0.1
err=h5pt_writestepattrib_r8(file,"RealTime",REALTIME,1)
enddo
print *,"Done writing, now close the file"
err = h5pt_close(file)
c **************** Clean out some variables ***************
nstep=0
c npoints=0
do I=1,npoints
X(I)=-1.0
Y(I)=-1.0
Z(I)=-1.0
ID(I)=0
enddo
c *****************Now Reopen for Reading ******************
print *,"Open file for reading"
file = h5pt_openr("testfilef.h5")
print *," Opened testfilef.h5"
nstep = h5pt_getnsteps(file)
print *," Nsteps = ",nstep
err = h5pt_setstep(file,1_8)
print *,"now get the number of datasets"
ndata = h5pt_getndatasets(file)
print *," Ndata=",ndata
npoints = h5pt_getnpoints(file)
print *," NP=",npoints
do step=1,nstep
print *,"Read step ",step
c set the current step
err = h5pt_setstep(file,step)
err=h5pt_readdata_i8(file,"id",ID)
c read the Z data from the current step
c err = h5prt_readdata(file,step,X,Y,Z,PX,PY,PZ,ID)
do J=1,10
print *," ID(",J,")==",ID(J)
enddo
enddo
err = h5pt_close(file)
print *,"done"
end
-171
View File
@@ -1,171 +0,0 @@
! ==============
!
! Sample Fortran program that uses HDF5 bindings
!
! ==============
program H5testFpar
implicit none
include 'mpif.h'
include 'H5PartF90.inc'
INTEGER*8 file
INTEGER*8 nstep
INTEGER*8 ndata
INTEGER*8 npoints,pointoffset
INTEGER*8 I,J,K,step
REAL*8,ALLOCATABLE:: X(:),Y(:),Z(:),PX(:),PY(:),PZ(:)
INTEGER*8,ALLOCATABLE:: ID(:)
REAL*8 REALTIME(1)
INTEGER myproc,nprocs
INTEGER ierr
INTEGER*8 rc
INTEGER:: comm
INTEGER*8:: offset
INTEGER*8, allocatable, dimension(:,:) :: Localnum1
INTEGER*8, allocatable, dimension(:,:,:) :: Localnum
INTEGER nprocrow, nproccol
call MPI_Init(ierr)
comm = MPI_COMM_WORLD
call MPI_Comm_rank(comm,myproc,ierr)
call MPI_Comm_size(comm,nprocs,ierr)
file = h5pt_openw_par("testfilef.h5",comm)
print *,"Opened file testfilef.h5 for writing"
npoints = 1024
nstep = 10
ALLOCATE(X(npoints),Y(npoints),Z(npoints))
ALLOCATE(PX(npoints),PY(npoints),PZ(npoints))
ALLOCATE(ID(npoints))
print *," Npoints=",npoints," nsteps=",nstep
print *," writing X,Y,Z,PX,PY,PZ,ID"
print *," ... initialize the data arrays"
do I=1,npoints
X(INT(I))=0.0
Y(I)=1.0+REAL(I)
Z(I)=100.0+REAL(I)*2.0
ID(I)=I
enddo
print *,"Tell h5pt how many particles are stored in the file"
! set the number of points
rc = h5pt_setnpoints(file,npoints)
print *,"write an attribute string"
! write an annotation to the file
rc=h5pt_writefileattrib_string(file,"Annotation","Testing 1 2 3")
print *,"and now write the steps"
do step=1,nstep
! Set the step number
print *,"Write Step ",step
rc = h5pt_setstep(file,step)
! Now start writing the data arrays for this step
rc = h5pt_writedata_r8(file,"x",X)
rc = h5pt_writedata_r8(file,"y",Y)
rc = h5pt_writedata_r8(file,"z",Z)
rc = h5pt_writedata_r8(file,"px",PX)
rc = h5pt_writedata_r8(file,"py",PY)
rc = h5pt_writedata_r8(file,"pz",PZ)
rc = h5pt_writedata_i8(file,"id",ID)
do J=1,npoints
ID(J)=ID(J)+10
enddo
! And write a simple floatingpoint attribute associated with this timestep
REALTIME(1) = REAL(I)*0.1
rc = h5pt_writestepattrib_r8(file,"RealTime",REALTIME,1_8)
print*,'Write REALTIME ',REALTIME
!
! Test file arrtibutes
!
nprocrow=2
nproccol=2
print*,'Write localnum ',Localnum
allocate(Localnum1(1,nprocrow*nproccol))
allocate(Localnum(2,0:nprocrow-1,0:nproccol-1))
!
! init testdata
!
do k = 0, 1
do i = 0,(nprocrow-1)
do j = 0,(nproccol-1)
Localnum(k,i,j) = k+i+j
enddo
enddo
enddo
!
offset=0
do i = 0, (nprocrow-1)
do j = 0,(nproccol-1)
Localnum1(offset) = Localnum(1,i,j)
offset = offset + 1
enddo
enddo
rc = h5pt_writestepattrib_i8(file,"Localnum1",Localnum1(:),offset)
print*,'rc (Localnum1)= ',rc
enddo
print *,"Done writing, now close the file"
rc = h5pt_close(file)
! **************** Clean out some variables ***************
nstep=0
! npoints=0
do I=1,npoints
X(I)=-1.0
Y(I)=-1.0
Z(I)=-1.0
ID(I)=0
enddo
do k = 0, 1
do i = 0,(nprocrow-1)
do j = 0,(nproccol-1)
Localnum(k,i,j) = 0
enddo
enddo
enddo
REALTIME(1) = 0.0
! *****************Now Reopen for Reading ******************
print *,"Open file for reading"
file = h5pt_openr_par("testfilef.h5",comm)
print *," Opened testfilef.h5"
nstep = h5pt_getnsteps(file)
print *," Nsteps = ",nstep
rc = h5pt_setstep(file,1_8)
print *,"now get the number of datasets"
ndata = h5pt_getndatasets(file)
print *," Ndata=",ndata
npoints = h5pt_getnpoints(file)
print *," Total NP=",npoints
npoints = npoints/nprocs
pointoffset = npoints*myproc;
rc = h5pt_setview(file,pointoffset,pointoffset+npoints)
print *," Pointoffset=",pointoffset," Local NP=",npoints
! Now we need to set our view to read correct points
do step=1,nstep
print *,"Read step ",step
! set the current step
rc = h5pt_setstep(file,step)
rc = h5pt_readdata_i8(file,"id",ID)
rc = h5pt_readstepattrib_r8(file,"RealTime",REALTIME)
print*,'Read REALTIME ',REALTIME
rc = h5pt_readstepattrib_i8(file,"Localnum1",Localnum1)
print*,'Read Localnum ',Localnum1
! read the Z data from the current step
! rc = h5prt_readdata(file,step,X,Y,Z,PX,PY,PZ,ID)
! do J=1,10
! print *," ID(",J,")==",ID(J)
! enddo
enddo
rc = h5pt_close(file)
print *,"done"
call MPI_Finalize(ierr)
end
+63 -123
View File
@@ -1,139 +1,79 @@
# 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.
#
# PATH SETTING
HDF5ROOT = @HDF5ROOT@
AM_CPPFLAGS += -I${abs_top_srcdir}/src/include
FFLAGS += -cpp $(AM_CPPFLAGS)
AM_LDFLAGS += -L${abs_top_builddir}/src/h5core/.libs
# COMPILER SETTING
CXX = @CXX@
FC = @FC@
MPIFC = @MPIFC@
MPICXX = @MPICXX@
MPICC = @MPICC@
LDADD =
# COMPILER FLAG SETTING
CFLAGS = @CFLAGS@
FFLAGS = @FFLAGS@ @MPIINC@
if ENABLE_EXAMPLES
if ENABLE_C
LDADD +=
endif
# LIBRARIES
SZLIB = @SZLIB@
HDFLIB = -L$(HDF5ROOT)/lib -lhdf5 -lz $(SZLIB) @LDFLAGS@
MPILIB = @MPILIB@
H5LIB = -L${abs_top_builddir}/src/lib -lH5Core -lH5
if ENABLE_FORTRAN
LDADD += -lH5hutF
AM_LDFLAGS += -L${abs_top_builddir}/src/Fortran/.libs
endif
LIBS = ${H5LIB} $(HDFLIB) $(MPILIB) -lm @STDCXX@
LDADD += -lH5hut
# H5Part compiled library location
# H5PLIB = -L@prefix@/lib
noinst_PROGRAMS =
# INCLUDES
HDFINC = -I$(HDF5ROOT)/include
MPIINC = @MPIINC@
H5INC = -I${abs_top_builddir}/src/include
if ENABLE_C
noinst_PROGRAMS += \
query \
read_core_vfd \
read_canonicalview \
read_setnparticles \
read_setview \
read_strided \
write_core_vfd \
write_setnparticles \
write_setview \
write_strided
endif
INC = $(HDFINC) $(MPIINC) $(H5INC)
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 =
# What to build... make install will place these files in the $(prefix)/bin directory.
bin_PROGRAMS = @TPTARGET@
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
# Some useful scripts that I wish to place in the $(prefix)/bin directory.
bin_SCRIPTS =
#bin_SCRIPTS = JAC_H5PartTestP_script.scr JAC_H5testFpar_script.scr JAC_RUN_ALL_script.scr
# Listing of all programs that maybe built. (Has to know statically...)
EXTRA_PROGRAMS =
# Extra files that I wish to include in the dist tar ball.
EXTRA_DIST = Bench.c \
H5ParallelTest.cc \
H5PartTest.cc H5PartTestParallel.cc \
H5PartAndreasTest.cc \
H5test.cc H5testF.f \
H5testFpar.f90 \
$(bin_SCRIPTS)
# Specific building instruction (What compilers to use...)
# ------------ Build Tests ------------
Bench: Bench.c
$(CC) $(CFLAGS) $(INC) -o $@ $< $(H5PLIB) $(LIBS)
###############################################################################
H5PartTest: H5PartTest.o
$(CXX) -o $@ $< $(H5PLIB) $(LIBS)
H5PartTest.o: H5PartTest.cc
$(CXX) $(CFLAGS) $(INC) -DREGRESSIONTEST -g -c $<
###############################################################################
H5PartTestP: H5PartTestP.o
$(CXX) $(INC) -o $@ $< $(H5LIB) $(LIBS)
H5PartTestP.o: H5PartTest.cc
$(CXX) $(CFLAGS) $(INC) -DREGRESSIONTEST -c $< -o $@
###############################################################################
H5PartTestParallel: H5PartTestParallel.o
$(CXX) -o $@ $< $(H5LIB) $(LIBS)
H5PartTestParallel.o: H5PartTestParallel.cc
$(CXX) $(CFLAGS) $(INC) -c $<
###############################################################################
H5PartAndreasTest: H5PartAndreasTest.o
$(CXX) -o $@ $< $(H5LIB) $(LIBS)
H5PartAndreasTest.o: H5PartAndreasTest.cc
$(CXX) $(CFLAGS) $(INC) -c $<
###############################################################################
H5testF: H5testF.o
$(FC) -o $@ $< $(H5LIB) -lH5PartF $(LIBS)
H5testF.o: H5testF.f
$(FC) $(FFLAGS) -c $(H5INC) $<
###############################################################################
H5testFpar: H5testFpar.o
$(MPIFC) -o $@ $< $(H5LIB) -lpH5PartF $(LIBS)
H5testFpar.o: H5testFpar.f90
$(MPIFC) $(FFLAGS) -c $(H5INC) $<
###############################################################################
H5test: H5test.o
$(CXX) -o $@ $< $(H5LIB) -lstdc++ $(LIBS)
H5test.o: H5test.cc
$(CXX) $(CFLAGS) $(INC) -DREGRESSIONTEST -g -c $<
###############################################################################
% : %.o
$(CC) -o $@ $< $(H5LIB) $(LIBS)
%.o : %.c
$(CC) $(CFLAGS) $(INC) -g -c $<
endif
%.o : %.f90
${FC} $(FFLAGS) -c $(H5INC) $<
###############################################################################
clean:
${RM} -f *~ *.o ${bin_PROGRAMS}
distclean: clean
${RM} -rf .deps
${RM} -rf .libs
${RM} -f parttest.h5
${RM} -rf config.status config.log config.h Makefile
$(FC) $(FFLAGS) -c $<
clean-local:
$(RM) -f *~
+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.h"
#define FNAME "example_setview.h5"
#define VERBOSITY H5_VERBOSE_ERROR
#define DEBUG_MSK 0
/*
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_step_datasets (
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 = H5PartGetNumDatasets (f);
printf ("\tNumber of datasets in step %lld: %lld\n", (long long)step, (long long)n);
// output name and type of all datasets
print_header (n);
for (h5_int64_t i = 0; i < n; i++) {
H5PartGetDatasetInfo (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 # 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_datasets (f, i);
}
H5CloseFile (f);
}
int
main (
int argc,
char** argv
) {
MPI_Init (&argc, &argv);
H5AbortOnError ();
H5SetVerbosityLevel (VERBOSITY);
H5SetDebugMask (H5_DEBUG_ALL);
query_file (FNAME);
MPI_Finalize ();
return 0;
}
+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"
#include <stdlib.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
+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"
#include <stdlib.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
+65
View File
@@ -0,0 +1,65 @@
/*
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 <stdlib.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
+76
View File
@@ -0,0 +1,76 @@
/*
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 <stdlib.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
+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.h"
#include <stdlib.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
+19 -19
View File
@@ -1,27 +1,27 @@
if ENABLE_C
# 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
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_err.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
# Listing of all possible headers that I may include
EXTRA_HEADERS =
endif
EXTRA_DIST = Makefile.in
clean-local:
$(RM) *~
+219 -339
View File
@@ -1,5 +1,5 @@
/*
Copyright (c) 2006-2013, The Regents of the University of California,
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.
@@ -8,310 +8,225 @@
*/
#include "h5_private.h"
//#include "h5core/h5_model.h"
/* file handling interface */
static inline h5_int64_t
open_file (
const char *name,
const int l_name,
h5_int32_t flags,
MPI_Comm ccomm,
h5_size_t align
#include "h5core/h5_log.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
) {
char *name2 = h5_strdupfor2c ( name, l_name );
h5_file_t* f = h5_open_file ( name2, flags, ccomm, align );
free ( name2 );
return (h5_int64_t)f;
H5_API_ENTER (h5_int64_t, "%s", "");
H5_API_RETURN ((h5_int64_t)h5_create_prop (H5_PROP_FILE));
}
#define h5_openr F77_NAME( \
h5_openr, \
h5_openr_, \
H5_OPENR)
#if defined(PARALLEL_IO)
#define h5_setprop_file_mpio FC_MANGLING( \
h5_setprop_file_mpio, \
H5_SETPROP_FILE_MPIO)
h5_int64_t
h5_openr (
const char *file_name,
const int l_file_name
) {
H5_API_ENTER (h5_int64_t, "file_name='%s'",
file_name);
H5_API_RETURN (open_file (file_name, l_file_name, H5_O_RDONLY, 0, 0));
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_openw F77_NAME( \
h5_openw, \
h5_openw_, \
H5_OPENW)
#define h5_setprop_file_mpio_collective FC_MANGLING( \
h5_setprop_file_mpio_collective, \
H5_SETPROP_FILE_MPIO_COLLECTIVE)
h5_int64_t
h5_openw (
const char *file_name,
const int l_file_name
) {
H5_API_ENTER (h5_int64_t, "file_name='%s'",
file_name);
H5_API_RETURN (open_file (file_name, l_file_name, H5_O_WRONLY, 0, 0));
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_opena F77_NAME( \
h5_opena, \
h5_opena_, \
H5_OPENA)
#define h5_setprop_file_mpio_independent FC_MANGLING( \
h5_setprop_file_mpio_independent, \
H5_SETPROP_FILE_MPIO_INDEPENDENT)
h5_int64_t
h5_opena (
const char *file_name,
const int l_file_name
) {
H5_API_ENTER (h5_int64_t, "file_name='%s'",
file_name);
H5_API_RETURN (open_file (file_name, l_file_name, H5_O_APPEND, 0, 0));
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));
}
#define h5_openr_align F77_NAME( \
h5_openr_align, \
h5_openr_align_, \
H5_OPENR_ALIGN)
#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_openr_align (
const char *file_name,
const h5_int64_t *align,
const int l_file_name
) {
H5_API_ENTER (h5_int64_t, "file_name='%s', align=%llu",
file_name, (long long unsigned)align);
H5_API_RETURN (open_file (file_name, l_file_name, H5_O_RDONLY, 0, *align));
}
#define h5_openw_align F77_NAME( \
h5_openw_align, \
h5_openw_align_, \
H5_OPENW_ALIGN)
h5_int64_t
h5_openw_align (
const char *file_name,
const h5_int64_t *align,
const int l_file_name
) {
H5_API_ENTER (h5_int64_t, "file_name='%s', align=%llu",
file_name, (long long unsigned)align);
H5_API_RETURN (open_file (file_name, l_file_name, H5_O_WRONLY, 0, *align));
}
#define h5_opena_align F77_NAME( \
h5_opena_align, \
h5_opena_align_, \
H5_OPENA_ALIGN)
h5_int64_t
h5_opena_align (
const char *file_name,
const h5_int64_t *align,
const int l_file_name
) {
H5_API_ENTER (h5_int64_t, "file_name='%s', align=%llu",
file_name, (long long unsigned)align);
H5_API_RETURN (open_file (file_name, l_file_name, H5_O_APPEND, 0, *align));
}
#ifdef PARALLEL_IO
h5_int32_t
flagsfor2c (
const char* flags,
const int l_flags
) {
if (flags == NULL)
return 0;
h5_int32_t fbits = 0;
char* flags2 = h5_strdupfor2c (flags, l_flags);
flags2 = strtok (flags2, ",");
while (flags != NULL) {
if (strcmp (flags2, "vfd_mpiposix") == 0)
fbits |= H5_VFD_MPIPOSIX;
else if (strcmp (flags2, "vfd_core") == 0)
fbits |= H5_VFD_CORE;
else if (strcmp (flags2, "vfd_mpio_ind") == 0)
fbits |= H5_VFD_MPIIO_IND;
else if (strcmp (flags2, "fs_lustre") == 0)
fbits |= H5_FS_LUSTRE;
else {
// :FIXME: ignore unknown strings!?
}
flags2 = strtok (NULL, ",");
}
free (flags2);
return fbits;
}
static inline h5_int64_t
open_file_par (
const char* file_name,
const int l_file_name,
MPI_Fint* fcomm,
const h5_int32_t mode,
const char* flags,
const int l_flags,
h5_int64_t align
) {
return open_file (
file_name, l_file_name,
mode | flagsfor2c (flags, l_flags),
MPI_Comm_f2c (*fcomm),
align);
}
#define h5_openr_par F77_NAME( \
h5_openr_par, \
h5_openr_par_, \
H5_OPENR_PAR)
h5_int64_t
h5_openr_par (
const char *file_name,
MPI_Fint *fcomm,
const int l_file_name
) {
H5_API_ENTER (h5_int64_t, "file_name='%*s', fcomm=%d",
l_file_name, file_name, *fcomm);
H5_API_RETURN (
open_file_par (
file_name, l_file_name,
fcomm,
H5_O_RDONLY,
NULL, 0,
0));
}
#define h5_openw_par F77_NAME( \
h5_openw_par, \
h5_openw_par_, \
H5_OPENW_PAR)
h5_int64_t
h5_openw_par (
const char* file_name,
MPI_Fint* fcomm,
const int l_file_name
) {
H5_API_ENTER (h5_int64_t, "file_name='%*s', fcomm=%d",
l_file_name, file_name, *fcomm);
H5_API_RETURN (
open_file_par (
file_name, l_file_name,
fcomm,
H5_O_WRONLY,
NULL, 0,
0));
}
#define h5_opena_par F77_NAME( \
h5_opena_par, \
h5_opena_par_, \
H5_OPENA_PAR)
h5_int64_t
h5_opena_par (
const char* file_name,
MPI_Fint* fcomm,
const int l_file_name
) {
H5_API_ENTER (h5_int64_t, "file_name='%*s', fcomm=%d",
l_file_name, file_name, *fcomm);
H5_API_RETURN (
open_file_par (
file_name, l_file_name,
fcomm,
H5_O_APPEND,
NULL, 0,
0));
}
#define h5_openr_par_align F77_NAME( \
h5_openr_par_align, \
h5_openr_par_align_, \
H5_OPENR_PAR_ALIGN)
h5_int64_t
h5_openr_par_align (
const char *file_name,
MPI_Fint *fcomm,
const h5_int64_t *align,
const char *flags,
const int l_file_name,
const int l_flags
) {
H5_API_ENTER (h5_int64_t, "file_name='%*s', fcomm=%d, flags=%s, align=%lld",
l_file_name, file_name, *fcomm, flags, (long long)align);
H5_API_RETURN (
open_file_par (
file_name, l_file_name,
fcomm,
H5_O_RDONLY,
flags, l_flags,
*align));
}
#define h5_openw_par_align F77_NAME( \
h5_openw_par_align, \
h5_openw_par_align_, \
H5_OPENW_PAR_ALIGN)
h5_int64_t
h5_openw_par_align (
const char *file_name,
MPI_Fint *fcomm,
const h5_int64_t *align,
const char *flags,
const int l_file_name,
const int l_flags
) {
H5_API_ENTER (h5_int64_t, "file_name='%*s', fcomm=%d, flags=%s, align=%lld",
l_file_name, file_name, *fcomm, flags, (long long)align);
H5_API_RETURN (
open_file_par (
file_name, l_file_name,
fcomm,
H5_O_WRONLY,
flags, l_flags,
*align));
}
#define h5_opena_par_align F77_NAME( \
h5_opena_par_align, \
h5_opena_par_align_, \
H5_OPENA_PAR_ALIGN)
h5_int64_t
h5_opena_par_align (
const char *file_name,
MPI_Fint *fcomm,
const h5_int64_t *align,
const char *flags,
const int l_file_name,
const int l_flags
) {
H5_API_ENTER (h5_int64_t, "file_name='%*s', fcomm=%d, flags=%s, align=%lld",
l_file_name, file_name, *fcomm, flags, (long long)align);
H5_API_RETURN (
open_file_par (
file_name, l_file_name,
fcomm,
H5_O_APPEND,
flags, l_flags,
*align));
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
#define h5_close F77_NAME( \
h5_close, \
h5_close_, \
H5_CLOSE)
#endif
#define h5_setprop_file_corevfd FC_MANGLING( \
h5_setprop_file_corevfd, \
H5_SETPROP_FILE_COREVFD)
h5_int64_t
h5_close (
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_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_finalize F77_NAME( \
#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_FINALIZE)
h5_int64_t
h5_finalize (
@@ -321,68 +236,11 @@ h5_finalize (
H5_API_RETURN (h5_close_hdf5());
}
#define h5_check F77_NAME( \
h5_check, \
h5_check_, \
H5_CHECK)
h5_int64_t
h5_check (
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));
}
/* H5hut data model */
#define h5_setstep F77_NAME(  \
h5_setstep, \
h5_setstep_, \
H5_SETSTEP)
h5_int64_t
h5_setstep (
const h5_int64_t *f,
h5_int64_t *step ) {
h5_file_t* fh = h5_filehandlefor2c(f);
H5_API_ENTER (h5_int64_t, "f=%p, step=%lld", (h5_file_p)fh, (long long)*step);
H5_API_RETURN (h5_set_step (fh, (*step)-1));
}
#define h5_getstep F77_NAME( \
h5_getstep, \
h5_getstep_, \
H5_GETSTEP)
h5_int64_t
h5_getstep (
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_get_step (fh) + 1);
}
#define h5_getnsteps F77_NAME( \
h5_getnsteps, \
h5_getnsteps_, \
H5_GETNSTEPS)
h5_int64_t
h5_getnsteps (
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_get_num_steps (fh));
}
/* debug output */
#define h5_set_verbosity_level F77_NAME( \
#define h5_set_verbosity_level FC_MANGLING( \
h5_set_verbosity_level, \
h5_set_verbosity_level_, \
H5_SET_VERBOSITY_LEVEL)
h5_int64_t
h5_set_verbosity_level (
@@ -390,6 +248,28 @@ h5_set_verbosity_level (
) {
H5_API_ENTER (h5_int64_t, "level=%lld", (long long)*level);
H5_API_RETURN(h5_set_debuglevel (*level));
H5_API_RETURN(h5_set_loglevel (*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_loglevel (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
-97
View File
@@ -1,97 +0,0 @@
! _ _ _ _
! __| | __ _| |_ __ _ _ __ ___ ___ __| | ___| |
! / _` |/ _` | __/ _` | | '_ ` _ \ / _ \ / _` |/ _ \ |
! | (_| | (_| | || (_| | | | | | | | (_) | (_| | __/ |
! \__,_|\__,_|\__\__,_| |_| |_| |_|\___/ \__,_|\___|_|
!>
!! \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 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 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 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
-324
View File
@@ -1,324 +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,
(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 ));
}
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,
(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 ));
}
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);
}
+388 -59
View File
@@ -1,5 +1,5 @@
/*
Copyright (c) 2006-2012, The Regents of the University of California,
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.
@@ -8,13 +8,9 @@
*/
#include "h5_private.h"
#include "h5core/h5_log.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
/*
__ _ _ _ ___ _ __ _ _
/ _` | | | |/ _ \ '__| | | |
@@ -23,9 +19,8 @@
|_| |___/
*/
#define h5bl_getnfieldattribs F77_NAME ( \
#define h5bl_getnfieldattribs FC_MANGLING ( \
h5bl_getnfieldattribs, \
h5bl_getnfieldattribs_, \
H5BL_GETNFIELDATTRIBS)
h5_int64_t
h5bl_getnfieldattribs (
@@ -33,7 +28,7 @@ h5bl_getnfieldattribs (
const char* const name,
const int l_name
) {
h5_file_t* f = h5_filehandlefor2c (fh);
h5_file_t f = h5_filehandlefor2c (fh);
H5_API_ENTER (h5_int64_t,
"fh=%p, name='%*s'",
(h5_file_p)f, l_name, name);
@@ -43,9 +38,8 @@ h5bl_getnfieldattribs (
H5_API_RETURN (herr);
}
#define h5bl_getfieldattribinfo F77_NAME ( \
#define h5bl_getfieldattribinfo FC_MANGLING ( \
h5bl_getfieldattribinfo, \
h5bl_getfieldattribinfo_, \
h5bl_getfieldattribinfo)
h5_int64_t
h5bl_getfieldattribinfo (
@@ -57,7 +51,7 @@ h5bl_getfieldattribinfo (
const int l_field_name,
const int l_attrib_name
) {
h5_file_t* f = h5_filehandlefor2c (fh);
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",
@@ -68,7 +62,7 @@ h5bl_getfieldattribinfo (
char *field_name2 = h5_strdupfor2c ( field_name, l_field_name );
h5_int64_t attrib_type;
h5_int64_t herr = h5b_get_field_attrib_info (
h5_int64_t herr = h5b_get_field_attrib_info_by_idx (
f,
field_name2, *attrib_idx - 1,
attrib_name, l_attrib_name,
@@ -90,7 +84,7 @@ h5bl_getfieldattribinfo (
*/
static inline h5_int64_t
write_field_attrib (
h5_file_t* const fh,
const h5_file_t fh,
const char* field_name,
const int l_field_name,
const char* attrib_name,
@@ -101,7 +95,7 @@ write_field_attrib (
) {
char *field_name2 = h5_strdupfor2c (field_name, l_field_name);
char *attrib_name2 = h5_strdupfor2c (attrib_name, l_attrib_name);
h5_int64_t h5err = h5_write_field_attrib (
h5_int64_t h5err = h5b_write_field_attrib (
fh, field_name2,
attrib_name2, attrib_type,
attrib_value, attrib_nelems);
@@ -112,7 +106,7 @@ write_field_attrib (
static inline h5_int64_t
read_field_attrib (
h5_file_t* const fh,
const h5_file_t fh,
const char* field_name,
const int l_field_name,
const char* attrib_name,
@@ -122,7 +116,7 @@ read_field_attrib (
) {
char *field_name2 = h5_strdupfor2c (field_name, l_field_name);
char *attrib_name2 = h5_strdupfor2c (attrib_name, l_attrib_name);
h5_int64_t h5err = h5_read_field_attrib (
h5_int64_t h5err = h5b_read_field_attrib (
fh, field_name2,
attrib_name2, attrib_type, attrib_value);
free (field_name2);
@@ -138,9 +132,8 @@ read_field_attrib (
|___/\__|_| |_|_| |_|\__, |
|___/
*/
#define h5bl_writefieldattrib_string F77_NAME ( \
#define h5bl_writefieldattrib_string FC_MANGLING ( \
h5bl_writefieldattrib_string, \
h5bl_writefieldattrib_string_, \
H5BL_WRITEFIELDATTRIB_STRING)
h5_int64_t
h5bl_writefieldattrib_string (
@@ -152,7 +145,7 @@ h5bl_writefieldattrib_string (
const int l_attrib_name,
const int l_attrib_value
) {
h5_file_t* f = h5_filehandlefor2c (fh);
h5_file_t f = h5_filehandlefor2c (fh);
H5_API_ENTER (h5_int64_t,
"fh=%p, field_name='%.*s', "
"attrib_name='%.*s' attrib_value='%.*s'",
@@ -171,9 +164,8 @@ h5bl_writefieldattrib_string (
H5_API_RETURN (h5err);
}
#define h5bl_readfieldattrib_string F77_NAME ( \
#define h5bl_readfieldattrib_string FC_MANGLING ( \
h5bl_readfieldattrib_string, \
h5bl_readfieldattrib_string_, \
H5BL_READFIELDATTRIB_STRING)
h5_err_t
h5bl_readfieldattrib_string (
@@ -185,7 +177,7 @@ h5bl_readfieldattrib_string (
const int l_attrib_name,
const int l_attrib_value
) {
h5_file_t* f = h5_filehandlefor2c (fh);
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,
@@ -209,9 +201,8 @@ h5bl_readfieldattrib_string (
| | | __/ (_| | |
|_| \___|\__,_|_|
*/
#define h5bl_writefieldattrib_r8 F77_NAME ( \
#define h5bl_writefieldattrib_r8 FC_MANGLING ( \
h5bl_writefieldattrib_r8, \
h5bl_writefieldattrib_r8_, \
H5BL_WRITEFIELDATTRIB_R8)
h5_int64_t
h5bl_writefieldattrib_r8 (
@@ -223,25 +214,24 @@ h5bl_writefieldattrib_r8 (
const int l_field_name,
const int l_attrib_name
) {
h5_file_t* f = h5_filehandlefor2c (fh);
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, *attrib_nelems);
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,
H5_FLOAT64_T,
attrib_value, *attrib_nelems));
}
#define h5bl_readfieldattrib_r8 F77_NAME ( \
#define h5bl_readfieldattrib_r8 FC_MANGLING ( \
h5bl_readfieldattrib_r8, \
h5bl_readfieldattrib_r8_, \
H5BL_READFIELDATTRIB_R8)
h5_err_t
h5bl_readfieldattrib_r8 (
@@ -252,7 +242,7 @@ h5bl_readfieldattrib_r8 (
const int l_field_name,
const int l_attrib_name
) {
h5_file_t* f = h5_filehandlefor2c (fh);
h5_file_t f = h5_filehandlefor2c (fh);
H5_API_ENTER (h5_int64_t,
"fh=%p, field_name='%.*s', attrib_name='%.*s', "
"attrib_value=%p",
@@ -264,13 +254,12 @@ h5bl_readfieldattrib_r8 (
f,
field_name, l_field_name,
attrib_name, l_attrib_name,
H5_R8_T,
H5_FLOAT64_T,
attrib_value));
}
#define h5bl_writefieldattrib_r4 F77_NAME ( \
#define h5bl_writefieldattrib_r4 FC_MANGLING ( \
h5bl_writefieldattrib_r4, \
h5bl_writefieldattrib_r4_, \
H5BL_WRITEFIELDATTRIB_R4)
h5_int64_t
h5bl_writefieldattrib_r4 (
@@ -282,25 +271,24 @@ h5bl_writefieldattrib_r4 (
const int l_field_name,
const int l_attrib_name
) {
h5_file_t* f = h5_filehandlefor2c (fh);
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, *attrib_nelems);
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,
H5_FLOAT32_T,
attrib_value, *attrib_nelems));
}
#define h5bl_readfieldattrib_r4 F77_NAME ( \
#define h5bl_readfieldattrib_r4 FC_MANGLING ( \
h5bl_readfieldattrib_r4, \
h5bl_readfieldattrib_r4_, \
H5BL_READFIELDATTRIB_R4)
h5_err_t
h5bl_readfieldattrib_r4 (
@@ -311,7 +299,7 @@ h5bl_readfieldattrib_r4 (
const int l_field_name,
const int l_attrib_name
) {
h5_file_t* f = h5_filehandlefor2c (fh);
h5_file_t f = h5_filehandlefor2c (fh);
H5_API_ENTER (h5_int64_t,
"fh=%p, field_name='%.*s', attrib_name='%.*s', "
"attrib_value=%p",
@@ -323,7 +311,7 @@ h5bl_readfieldattrib_r4 (
f,
field_name, l_field_name,
attrib_name, l_attrib_name,
H5_R4_T,
H5_FLOAT32_T,
attrib_value));
}
@@ -335,9 +323,8 @@ h5bl_readfieldattrib_r4 (
|_|_| |_|\__\___|\__, |\___|_|
|___/
*/
#define h5bl_writefieldattrib_i8 F77_NAME ( \
#define h5bl_writefieldattrib_i8 FC_MANGLING ( \
h5bl_writefieldattrib_i8, \
h5bl_writefieldattrib_i8_, \
H5BL_WRITEFIELDATTRIB_I8)
h5_int64_t
h5bl_writefieldattrib_i8 (
@@ -349,25 +336,24 @@ h5bl_writefieldattrib_i8 (
const int l_field_name,
const int l_attrib_name
) {
h5_file_t* f = h5_filehandlefor2c (fh);
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, *attrib_nelems);
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,
H5_INT64_T,
attrib_value, *attrib_nelems));
}
#define h5bl_readfieldattrib_i8 F77_NAME ( \
#define h5bl_readfieldattrib_i8 FC_MANGLING ( \
h5bl_readfieldattrib_i8, \
h5bl_readfieldattrib_i8_, \
H5BL_READFIELDATTRIB_I8)
h5_err_t
h5bl_readfieldattrib_i8 (
@@ -379,7 +365,7 @@ h5bl_readfieldattrib_i8 (
const int l_attrib_name,
const int l_attrib_value
) {
h5_file_t* f = h5_filehandlefor2c (fh);
h5_file_t f = h5_filehandlefor2c (fh);
H5_API_ENTER (h5_int64_t,
"fh=%p, field_name='%.*s', attrib_name='%.*s', "
"attrib_value=%p",
@@ -391,13 +377,12 @@ h5bl_readfieldattrib_i8 (
f,
field_name, l_field_name,
attrib_name, l_attrib_name,
H5_I8_T,
H5_INT64_T,
attrib_value));
}
#define h5bl_writefieldattrib_i4 F77_NAME ( \
#define h5bl_writefieldattrib_i4 FC_MANGLING ( \
h5bl_writefieldattrib_i4, \
h5bl_writefieldattrib_i4_, \
H5BL_WRITEFIELDATTRIB_I4 )
h5_int64_t
h5bl_writefieldattrib_i4 (
@@ -409,25 +394,24 @@ h5bl_writefieldattrib_i4 (
const int l_field_name,
const int l_attrib_name
) {
h5_file_t* f = h5_filehandlefor2c (fh);
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, *attrib_nelems);
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,
H5_INT32_T,
attrib_value, *attrib_nelems));
}
#define h5bl_readfieldattrib_i4 F77_NAME ( \
#define h5bl_readfieldattrib_i4 FC_MANGLING ( \
h5bl_readfieldattrib_i4, \
h5bl_readfieldattrib_i4_, \
H5BL_READFIELDATTRIB_I4)
h5_err_t
h5bl_readfieldattrib_i4 (
@@ -438,7 +422,7 @@ h5bl_readfieldattrib_i4 (
const int l_field_name,
const int l_attrib_name
) {
h5_file_t* f = h5_filehandlefor2c (fh);
h5_file_t f = h5_filehandlefor2c (fh);
H5_API_ENTER (h5_int64_t,
"fh=%p, field_name='%.*s', attrib_name='%.*s', "
"attrib_value=%p",
@@ -450,6 +434,351 @@ h5bl_readfieldattrib_i4 (
f,
field_name, l_field_name,
attrib_name, l_attrib_name,
H5_I4_T,
H5_INT32_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_FLOAT64_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_FLOAT64_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_FLOAT64_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_FLOAT64_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));
}
-249
View File
@@ -1,249 +0,0 @@
! __ _ _ _ _ _ _ _ _
! / _(_) ___| | __| | __ _| |_| |_ _ __(_) |__ _ _| |_ ___ ___
! | |_| |/ _ \ |/ _` | / _` | __| __| '__| | '_ \| | | | __/ _ \/ __|
! | _| | __/ | (_| | | (_| | |_| |_| | | | |_) | |_| | || __/\__ \
! |_| |_|\___|_|\__,_| \__,_|\__|\__|_| |_|_.__/ \__,_|\__\___||___/
!
! __ _ _ _ ___ _ __ _ _
! / _` | | | |/ _ \ '__| | | |
! | (_| | |_| | __/ | | |_| |
! \__, |\__,_|\___|_| \__, |
! |_| |___/
!>
!! \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 !< file handle
CHARACTER(LEN=*), INTENT(IN) :: field_name !< name of 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_nelems)
INTEGER*8,INTENT(IN) :: filehandle !< file handle
CHARACTER(LEN=*), INTENT(IN) :: field_name !< name of field
INTEGER*8,INTENT(IN) :: idx !< index of attribute being queried
CHARACTER(LEN=*), INTENT(OUT):: attrib_name !< name of attribute
INTEGER*8,INTENT(OUT):: attrib_nelems !< number of elements in the attrib array
END FUNCTION
! _ __ _ _
! (_) / /__ ___| |_ _ __(_)_ __ __ _
! | | / / _ \ / __| __| '__| | '_ \ / _` |
! | |/ / (_) | \__ \ |_| | | | | | | (_| |
! |_/_/ \___/ |___/\__|_| |_|_| |_|\__, |
! |___/
!>
!! \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, attrib_nelems)
INTEGER*8, INTENT(IN) :: filehandle !< file handle
CHARACTER(LEN=*), INTENT(IN) :: field_name !< name of field
CHARACTER(LEN=*), INTENT(IN) :: attrib_name !< name of attribute
CHARACTER(LEN=*), INTENT(IN) :: attrib_value!< attribute data to be written
INTEGER*8, INTENT(IN) :: attrib_nelems !< number of elements in data array
END FUNCTION
!>
!! \ingroup h5block_attrib_f
!! \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 !< file handle
CHARACTER(LEN=*), INTENT(IN) :: field_name !< name of field
CHARACTER(LEN=*), INTENT(IN) :: attrib_name !< name of attribute
CHARACTER(LEN=*), INTENT(IN) :: attrib_value!< attribute data will be read into this array
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_nelems)
INTEGER*8,INTENT(IN) :: filehandle !< file handle
CHARACTER(LEN=*), INTENT(IN) :: field_name !< name of field
CHARACTER(LEN=*), INTENT(IN) :: attrib_name !< name of attribute to write
REAL*8, INTENT(OUT):: attrib_value(*) !< attribute data to be written
INTEGER*8, INTENT(IN) :: attrib_nelems !< number of elements in data 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 )
INTEGER*8,INTENT(IN) :: filehandle !< file handle
CHARACTER(LEN=*), INTENT(IN) :: field_name !< name of field
CHARACTER(LEN=*), INTENT(IN) :: attrib_name !< name of attribute to read
REAL*8, INTENT(OUT):: attrib_value(*) !< attribute data will be read into this array
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_nelems)
INTEGER*8,INTENT(IN) :: filehandle !< file handle
CHARACTER(LEN=*), INTENT(IN) :: field_name !< name of field
CHARACTER(LEN=*), INTENT(IN) :: attrib_name !< name of attribute to write
REAL*4, INTENT(OUT):: attrib_value(*) !< attribute datato be written
INTEGER*8, INTENT(IN) :: attrib_nelems !< number of elements in data 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)
INTEGER*8,INTENT(IN) :: filehandle !< file handle
CHARACTER(LEN=*), INTENT(IN) :: field_name !< name of field
CHARACTER(LEN=*), INTENT(IN) :: attrib_name !< name of attribute to read
REAL*4, INTENT(OUT):: attrib_value(*) !< attribute data will be read into this array
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_nelems)
INTEGER*8,INTENT(IN) :: filehandle !< file handle
CHARACTER(LEN=*), INTENT(IN) :: field_name !< name of field
CHARACTER(LEN=*), INTENT(IN) :: attrib_name !< name of attribute to write
INTEGER*8,INTENT(OUT):: attrib_value(*) !< attribute data to be written
INTEGER*8, INTENT(IN) :: attrib_nelems !< number of elements in data 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)
INTEGER*8,INTENT(IN) :: filehandle !< file handle
CHARACTER(LEN=*), INTENT(IN) :: field_name !< name of field
CHARACTER(LEN=*), INTENT(IN) :: attrib_name !< name of attribute to read
INTEGER*8,INTENT(OUT):: attrib_value(*) !< attribute data will be read into this array
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_nelems)
INTEGER*8,INTENT(IN) :: filehandle !< file handle
CHARACTER(LEN=*), INTENT(IN) :: field_name !< name of field
CHARACTER(LEN=*), INTENT(IN) :: attrib_name !< name of attribute to write
INTEGER*4,INTENT(OUT):: attrib_value(*) !< attribute data to be written
INTEGER*8, INTENT(IN) :: attrib_nelems !< number of elements in data 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)
INTEGER*8,INTENT(IN) :: filehandle !< file handle
CHARACTER(LEN=*), INTENT(IN) :: field_name !< name of field
CHARACTER(LEN=*), INTENT(IN) :: attrib_name !< name of attribute to read
INTEGER*4,INTENT(OUT):: attrib_value(*) !< attribute data will be read into this array
END FUNCTION
! __ _ _ _ _
! / _(_) ___| | __| | ___ _ __ __ _ ___(_)_ __ __ _
! | |_| |/ _ \ |/ _` | / __| '_ \ / _` |/ __| | '_ \ / _` |
! | _| | __/ | (_| | \__ \ |_) | (_| | (__| | | | | (_| |
! |_| |_|\___|_|\__,_| |___/ .__/ \__,_|\___|_|_| |_|\__, |
! |_| |___/
!>
!! \ingroup h5block_attrib_f
!! See \ref H5Block3dGetFieldSpacing
!! \return 0 on success or error code
!<
INTEGER*8 FUNCTION h5bl_3d_get_field_spacing (filehandle, name, x, y, z)
INTEGER*8, INTENT(IN) :: filehandle
CHARACTER(LEN=*), INTENT(IN) :: name
REAL*8, INTENT(OUT) :: x
REAL*8, INTENT(OUT) :: y
REAL*8, INTENT(OUT) :: z
END FUNCTION
!>
!! \ingroup h5block_attrib_f
!! See \ref H5Block3dSetFieldSpacing
!! \return 0 on success or error code
!<
INTEGER*8 FUNCTION h5bl_3d_set_field_spacing (filehandle, name, x, y, z)
INTEGER*8, INTENT(IN) :: filehandle
CHARACTER(LEN=*), INTENT(IN) :: name
REAL*8, INTENT(IN) :: x
REAL*8, INTENT(IN) :: y
REAL*8, INTENT(IN) :: z
END FUNCTION
! __ _ _ _ _ _
! / _(_) ___| | __| | ___ _ __(_) __ _(_)_ __
! | |_| |/ _ \ |/ _` | / _ \| '__| |/ _` | | '_ \
! | _| | __/ | (_| | | (_) | | | | (_| | | | | |
! |_| |_|\___|_|\__,_| \___/|_| |_|\__, |_|_| |_|
! |___/
!>
!! \ingroup h5block_attrib_f
!! See \ref H5Block3dGetFieldOrigin
!! \return 0 on success or error code
!<
INTEGER*8 FUNCTION h5bl_3d_get_field_origin (filehandle, name, x, y, z)
INTEGER*8, INTENT(IN) :: filehandle
CHARACTER(LEN=*), INTENT(IN) :: name
REAL*8, INTENT(OUT) :: x
REAL*8, INTENT(OUT) :: y
REAL*8, INTENT(OUT) :: z
END FUNCTION
!>
!! \ingroup h5block_attrib_f
!! See \ref H5Block3dSetFieldOrigin
!! \return 0 on success or error code
!<
INTEGER*8 FUNCTION h5bl_3d_set_field_origin (filehandle, name, x, y, z)
INTEGER*8, INTENT(IN) :: filehandle
CHARACTER(LEN=*), INTENT(IN) :: name
REAL*8, INTENT(IN) :: x
REAL*8, INTENT(IN) :: y
REAL*8, INTENT(IN) :: z
END FUNCTION
!> @}
+58 -73
View File
@@ -1,5 +1,5 @@
/*
Copyright (c) 2006-2012, The Regents of the University of California,
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.
@@ -8,11 +8,11 @@
*/
#include "h5_private.h"
//#include "h5core/h5b_io.h"
#include "h5core/h5_log.h"
#include "h5core/h5b_io.h"
#define h5bl_3d_write_scalar_field_r8 F77_NAME ( \
h5bl_3d_write_scalar_field_r8, \
h5bl_3d_write_scalar_field_r8_, \
#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 (
@@ -21,20 +21,19 @@ h5bl_3d_write_scalar_field_r8 (
const h5_float64_t* const buffer,
const int l_name
) {
h5_file_t* f = h5_filehandlefor2c (fh);
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 );
f, name2, (void*)buffer, H5_FLOAT64_T );
free ( name2 );
H5_API_RETURN(herr);
}
#define h5bl_3d_read_scalar_field_r8 F77_NAME ( \
h5bl_3d_read_scalar_field_r8, \
h5bl_3d_read_scalar_field_r8_, \
#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 (
@@ -43,20 +42,19 @@ h5bl_3d_read_scalar_field_r8 (
h5_float64_t* const buffer,
const int l_name
) {
h5_file_t* f = h5_filehandlefor2c (fh);
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 );
f, name2, buffer, H5_FLOAT64_T );
free ( name2 );
H5_API_RETURN(herr);
}
#define h5bl_3d_write_vector3d_field_r8 F77_NAME ( \
#define h5bl_3d_write_vector3d_field_r8 FC_MANGLING ( \
h5bl_3d_write_vector3d_field_r8, \
h5bl_3d_write_vector3d_field_r8_, \
H5BL_3D_WRITE_VECTOR3D_FIELD_R8 )
h5_err_t
h5bl_3d_write_vector3d_field_r8 (
@@ -67,21 +65,20 @@ h5bl_3d_write_vector3d_field_r8 (
const h5_float64_t* const z_buf,
const int l_name
) {
h5_file_t* f = h5_filehandlefor2c (fh);
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 );
(void*)x_buf, (void*)y_buf, (void*)z_buf, H5_FLOAT64_T );
free ( name2 );
H5_API_RETURN(herr);
}
#define h5bl_3d_read_vector3d_field_r8 F77_NAME ( \
h5bl_3d_read_vector3d_field_r8, \
h5bl_3d_read_vector3d_field_r8_, \
#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 (
@@ -92,21 +89,20 @@ h5bl_3d_read_vector3d_field_r8 (
h5_float64_t* const z_buf,
const int l_name
) {
h5_file_t* f = h5_filehandlefor2c (fh);
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 );
(void*)x_buf, (void*)y_buf, (void*)z_buf, H5_FLOAT64_T );
free ( name2 );
H5_API_RETURN(herr);
}
#define h5bl_3d_write_scalar_field_r4 F77_NAME ( \
h5bl_3d_write_scalar_field_r4, \
h5bl_3d_write_scalar_field_r4_, \
#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 (
@@ -115,20 +111,19 @@ h5bl_3d_write_scalar_field_r4 (
const h5_float32_t* const buffer,
const int l_name
) {
h5_file_t* f = h5_filehandlefor2c (fh);
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 );
f, name2, (void*)buffer, H5_FLOAT32_T );
free ( name2 );
H5_API_RETURN(herr);
}
#define h5bl_3d_read_scalar_field_r4 F77_NAME ( \
h5bl_3d_read_scalar_field_r4, \
h5bl_3d_read_scalar_field_r4_, \
#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 (
@@ -137,20 +132,19 @@ h5bl_3d_read_scalar_field_r4 (
h5_float32_t* const buffer,
const int l_name
) {
h5_file_t* f = h5_filehandlefor2c (fh);
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 );
f, name2, buffer, H5_FLOAT32_T );
free ( name2 );
H5_API_RETURN(herr);
}
#define h5bl_3d_write_vector3d_field_r4 F77_NAME ( \
#define h5bl_3d_write_vector3d_field_r4 FC_MANGLING ( \
h5bl_3d_write_vector3d_field_r4, \
h5bl_3d_write_vector3d_field_r4_, \
H5BL_3D_WRITE_VECTOR3D_FIELD_R4 )
h5_err_t
h5bl_3d_write_vector3d_field_r4 (
@@ -161,21 +155,20 @@ h5bl_3d_write_vector3d_field_r4 (
const h5_float32_t* const z_buf,
const int l_name
) {
h5_file_t* f = h5_filehandlefor2c (fh);
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 );
(void*)x_buf, (void*)y_buf, (void*)z_buf, H5_FLOAT32_T );
free ( name2 );
H5_API_RETURN(herr);
}
#define h5bl_3d_read_vector3d_field_r4 F77_NAME ( \
#define h5bl_3d_read_vector3d_field_r4 FC_MANGLING ( \
h5bl_3d_read_vector3d_field_r4, \
h5bl_3d_read_vector3d_field_r4_, \
H5BL_3D_READ_VECTOR3D_FIELD_R4 )
h5_err_t
h5bl_3d_read_vector3d_field_r4 (
@@ -186,21 +179,20 @@ h5bl_3d_read_vector3d_field_r4 (
h5_float32_t* const z_buf,
const int l_name
) {
h5_file_t* f = h5_filehandlefor2c (fh);
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 );
(void*)x_buf, (void*)y_buf, (void*)z_buf, H5_FLOAT32_T );
free ( name2 );
H5_API_RETURN (herr);
}
#define h5bl_3d_write_scalar_field_i8 F77_NAME ( \
#define h5bl_3d_write_scalar_field_i8 FC_MANGLING ( \
h5bl_3d_write_scalar_field_i8, \
h5bl_3d_write_scalar_field_i8_, \
H5BL_3D_WRITE_SCALAR_FIELD_I8 )
h5_err_t
h5bl_3d_write_scalar_field_i8 (
@@ -209,20 +201,19 @@ h5bl_3d_write_scalar_field_i8 (
const h5_int64_t* const buffer,
const int l_name
) {
h5_file_t* f = h5_filehandlefor2c (fh);
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 );
f, name2, (void*)buffer, H5_INT64_T );
free ( name2 );
H5_API_RETURN (herr);
}
#define h5bl_3d_read_scalar_field_i8 F77_NAME ( \
h5bl_3d_read_scalar_field_i8, \
h5bl_3d_read_scalar_field_i8_, \
#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 (
@@ -231,20 +222,19 @@ h5bl_3d_read_scalar_field_i8 (
h5_int64_t* const buffer,
const int l_name
) {
h5_file_t* f = h5_filehandlefor2c (fh);
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 );
f, name2, buffer, H5_INT64_T );
free (name2);
H5_API_RETURN (herr);
}
#define h5bl_3d_write_vector3d_field_i8 F77_NAME ( \
#define h5bl_3d_write_vector3d_field_i8 FC_MANGLING ( \
h5bl_3d_write_vector3d_field_i8, \
h5bl_3d_write_vector3d_field_i8_, \
H5BL_3D_WRITE_VECTOR3D_FIELD_I8 )
h5_err_t
h5bl_3d_write_vector3d_field_i8 (
@@ -255,21 +245,20 @@ h5bl_3d_write_vector3d_field_i8 (
const h5_int64_t* const z_buf,
const int l_name
) {
h5_file_t* f = h5_filehandlefor2c (fh);
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 );
(void*)x_buf, (void*)y_buf, (void*)z_buf, H5_INT64_T );
free ( name2 );
H5_API_RETURN(herr);
}
#define h5bl_3d_read_vector3d_field_i8 F77_NAME ( \
#define h5bl_3d_read_vector3d_field_i8 FC_MANGLING ( \
h5bl_3d_read_vector3d_field_i8, \
h5bl_3d_read_vector3d_field_i8_, \
H5BL_3D_READ_VECTOR3D_FIELD_I8 )
h5_err_t
h5bl_3d_read_vector3d_field_i8 (
@@ -280,21 +269,20 @@ h5bl_3d_read_vector3d_field_i8 (
h5_int64_t* const z_buf,
const int l_name
) {
h5_file_t* f = h5_filehandlefor2c (fh);
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 );
(void*)x_buf, (void*)y_buf, (void*)z_buf, H5_INT64_T );
free ( name2 );
H5_API_RETURN(herr);
}
#define h5bl_3d_write_scalar_field_i4 F77_NAME ( \
#define h5bl_3d_write_scalar_field_i4 FC_MANGLING ( \
h5bl_3d_write_scalar_field_i4, \
h5bl_3d_write_scalar_field_i4_, \
H5BL_3D_WRITE_SCALAR_FIELD_I4 )
h5_err_t
h5bl_3d_write_scalar_field_i4 (
@@ -303,20 +291,19 @@ h5bl_3d_write_scalar_field_i4 (
const h5_int32_t* const buffer,
const int l_name
) {
h5_file_t* f = h5_filehandlefor2c (fh);
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 );
f, name2, (void*)buffer, H5_INT32_T );
free ( name2 );
H5_API_RETURN(herr);
}
#define h5bl_3d_read_scalar_field_i4 F77_NAME ( \
h5bl_3d_read_scalar_field_i4, \
h5bl_3d_read_scalar_field_i4_, \
#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 (
@@ -325,20 +312,19 @@ h5bl_3d_read_scalar_field_i4 (
h5_int32_t* const buffer,
const int l_name
) {
h5_file_t* f = h5_filehandlefor2c (fh);
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 );
f, name2, buffer, H5_INT32_T );
free ( name2 );
H5_API_RETURN(herr);
}
#define h5bl_3d_write_vector3d_field_i4 F77_NAME ( \
#define h5bl_3d_write_vector3d_field_i4 FC_MANGLING ( \
h5bl_3d_write_vector3d_field_i4, \
h5bl_3d_write_vector3d_field_i4_, \
H5BL_3D_WRITE_VECTOR3D_FIELD_I4 )
h5_err_t
h5bl_3d_write_vector3d_field_i4 (
@@ -349,21 +335,20 @@ h5bl_3d_write_vector3d_field_i4 (
const h5_int32_t* const z_buf,
const int l_name
) {
h5_file_t* f = h5_filehandlefor2c (fh);
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 );
(void*)x_buf, (void*)y_buf, (void*)z_buf, H5_INT32_T );
free ( name2 );
H5_API_RETURN(herr);
}
#define h5bl_3d_read_vector3d_field_i4 F77_NAME ( \
#define h5bl_3d_read_vector3d_field_i4 FC_MANGLING ( \
h5bl_3d_read_vector3d_field_i4, \
h5bl_3d_read_vector3d_field_i4_, \
H5BL_3D_READ_VECTOR3D_FIELD_I4 )
h5_err_t
h5bl_3d_read_vector3d_field_i4 (
@@ -374,14 +359,14 @@ h5bl_3d_read_vector3d_field_i4 (
h5_int32_t* const z_buf,
const int l_name
) {
h5_file_t* f = h5_filehandlefor2c (fh);
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 );
(void*)x_buf, (void*)y_buf, (void*)z_buf, H5_INT32_T );
free ( name2 );
H5_API_RETURN(herr);
}
-181
View File
@@ -1,181 +0,0 @@
!> \ingroup h5hut_f90_api
!! \addtogroup 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
!>
!! 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
!>
!! 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
!>
!! 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
!>
!! 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
!>
!! 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
!>
!! 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
!>
!! 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
!>
!! 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
!>
!! 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
!>
!! 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
!>
!! 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
!>
!! 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
!>
!! 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
!>
!! 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
!>
!! 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
!> @}
@@ -1,5 +1,5 @@
/*
Copyright (c) 2006-2012, The Regents of the University of California,
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.
@@ -8,11 +8,42 @@
*/
#include "h5_private.h"
#include "h5core/h5_log.h"
#include "h5core/h5b_model.h"
#include "h5core/h5b_io.h"
#define h5bl_3d_setview F77_NAME ( \
#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_, \
H5BL_3D_SETVIEW )
h5_int64_t
h5bl_3d_setview (
@@ -24,16 +55,16 @@ h5bl_3d_setview (
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_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,
*i_start, (long long)i_end,
(long long)j_start, (long long)j_end,
(long long)k_start, (long long)k_end);
(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,
@@ -41,9 +72,8 @@ h5bl_3d_setview (
*k_start-1, *k_end-1 ));
}
#define h5bl_3d_getview F77_NAME ( \
#define h5bl_3d_getview FC_MANGLING ( \
h5bl_3d_getview, \
h5bl_3d_getview_, \
H5BL_3D_GETVIEW )
h5_int64_t
h5bl_3d_getview (
@@ -55,7 +85,7 @@ h5bl_3d_getview (
h5_int64_t* const k_start,
h5_int64_t* const k_end
) {
h5_file_t* f = h5_filehandlefor2c (fh);
h5_file_t f = h5_filehandlefor2c (fh);
H5_API_ENTER (h5_int64_t,
"fh=%p, "
"i_start=%p, i_end=%p, "
@@ -81,9 +111,8 @@ h5bl_3d_getview (
#define h5bl_3d_getreducedview F77_NAME ( \
#define h5bl_3d_getreducedview FC_MANGLING ( \
h5bl_3d_getreducedview, \
h5bl_3d_getreducedview_, \
H5BL_3D_GETREDUCEDVIEW )
h5_int64_t
h5bl_3d_getreducedview (
@@ -95,7 +124,7 @@ h5bl_3d_getreducedview (
h5_int64_t* const k_start,
h5_int64_t* const k_end
) {
h5_file_t* f = h5_filehandlefor2c (fh);
h5_file_t f = h5_filehandlefor2c (fh);
H5_API_ENTER (h5_int64_t,
"fh=%p, "
"i_start=%p, i_end=%p, "
@@ -119,24 +148,8 @@ h5bl_3d_getreducedview (
H5_API_RETURN (H5_SUCCESS);
}
#define h5bl_3d_hasview F77_NAME ( \
h5bl_hasview, \
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_setchunk F77_NAME ( \
#define h5bl_3d_setchunk FC_MANGLING ( \
h5bl_3d_setchunk, \
h5bl_3d_setchunk_, \
H5BL_3D_SETCHUNK )
h5_int64_t
h5bl_3d_setchunk (
@@ -145,32 +158,124 @@ h5bl_3d_setchunk (
const h5_int64_t* const j,
const h5_int64_t* const k
) {
h5_file_t* f = h5_filehandlefor2c (fh);
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 ));
(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_getnumfields F77_NAME ( \
#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_, \
H5BL_GETNUMFIELDS )
h5_int64_t
h5bl_getnumfields (
const h5_int64_t* const fh
) {
h5_file_t* f = h5_filehandlefor2c (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 F77_NAME ( \
#define h5bl_getfieldinfo FC_MANGLING ( \
h5bl_getfieldinfo, \
h5bl_getfieldinfo_, \
H5BL_GETFIELDINFO )
h5_int64_t
h5bl_getfieldinfo (
@@ -183,7 +288,7 @@ h5bl_getfieldinfo (
h5_int64_t* const type,
const int l_name
) {
h5_file_t* f = h5_filehandlefor2c (fh);
h5_file_t f = h5_filehandlefor2c (fh);
H5_API_ENTER (h5_int64_t,
"fh=%p, idx=%lld, "
"name=%*s,"
@@ -197,3 +302,30 @@ h5bl_getfieldinfo (
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

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