Compare commits

..

282 Commits

Author SHA1 Message Date
gsell e447d536a3 configure.ac:
- set version to 2.0.0rc3
2017-03-18 09:27:11 +01:00
gsell 74df1bc676 src/h5core/h5_attribs.c: bugfixes 2016-09-23 17:03:20 +02:00
gsell 9e4c8bd5a4 src/h5core/h5u_io.h
- conditional flushing step data removed, for the time being we flush anyway
2016-09-23 16:45:20 +02:00
gsell bb1cd9c860 src/h5core/h5_file.c
- prototype of a 'h5_set_prop_file_flush_step()' function added
2016-09-23 16:44:30 +02:00
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
395 changed files with 55694 additions and 39498 deletions
+95 -86
View File
@@ -2,13 +2,13 @@
/AUTHORS -text
/COPYING -text
/ChangeLog -text
/GNUmakefile.orig -text
/Makefile.am -text
/NEWS -text
/README -text
/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
@@ -29,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
@@ -360,44 +363,75 @@ doc/tetrahedron_refinements/6-edges/edge_01-12-20-23-30-31_refined/buildlatex.ba
doc/tetrahedron_refinements/6-edges/edge_01-12-20-23-30-31_refined/output_file.jpg -text
doc/tetrahedron_refinements/README -text
doc/tetrahedron_refinements/text2vtk.py -text
examples/H5/Makefile.am -text
examples/H5/attach_file.c -text
examples/H5/file_attribs.c -text
examples/H5/openclose.c -text
examples/H5Block/H5BlockExample.pbs -text
examples/H5Block/H5BlockExampleF.f90 -text
examples/H5Block/Makefile.am -text
examples/H5Block/README -text
examples/H5Block/fields.c -text
examples/H5Block/read_write.c -text
examples/H5Fed/Makefile.am -text
examples/H5Fed/map_tet2globalid.c -text
examples/H5Fed/map_triangle2globalid.c -text
examples/H5Fed/tetmesh_adjacencies.c -text
examples/H5Fed/tetmesh_read.c -text
examples/H5Fed/tetmesh_read_tags.c -text
examples/H5Fed/tetmesh_write.c -text
examples/H5Fed/tetmesh_write1.c -text
examples/H5Fed/tetmesh_write2.c -text
examples/H5Fed/tetmesh_write_tags.c -text
examples/H5Fed/trimesh_2gnuplot.c -text
examples/H5Fed/trimesh_adjacencies.c -text
examples/H5Fed/trimesh_read.c -text
examples/H5Fed/trimesh_write.c -text
examples/H5Fed/trimesh_write_dunetest.c -text
examples/H5Fed/write_boundary.c -text
examples/H5Part/Bench.c -text
examples/H5Part/H5test.c -text
examples/H5Part/H5testF.f90 -text
examples/H5Part/Makefile.am -text
examples/H5Part/core_vfd.c -text
examples/H5Part/particles.c -text
examples/H5Part/read_canonicalview.c -text
examples/H5Part/simplef.f90 -text
examples/H5Part/stridedf.f90 -text
examples/H5Part/write_setnumparticles.c -text
examples/H5Part/write_setview.c -text
/license.txt -text
/rules.make -text
src/C++/H5Fed.cc -text
src/C++/H5Fed.hh -text
src/C++/Makefile.am -text
src/C/H5.c -text
src/C/H5Block.c -text
src/C/H5Block_readwrite.c -text
src/C/H5Fed.c -text
src/C/H5Fed_adjacency.c -text
src/C/H5Fed_inquiry.c -text
src/C/H5Fed_retrieve.c -text
src/C/H5Fed_store.c -text
src/C/H5Fed_tags.c -text
src/C/H5Part.c -text
src/C/H5_attachments.c -text
src/C/H5_attribs.c -text
src/C/Makefile.am -text
src/C/generate-h5b-readwrite.py -text
src/Fortran/H5.f90 -text
src/Fortran/H5Block.f90 -text
src/Fortran/H5.c -text
src/Fortran/H5Block.c -text
src/Fortran/H5BlockF.f90 -text
src/Fortran/H5Block_F.c -text
src/Fortran/H5Block_readwrite.f90 -text
src/Fortran/H5Block_attribs.c -text
src/Fortran/H5Block_attribsF.f90 -text
src/Fortran/H5Block_io.c -text
src/Fortran/H5Block_ioF.f90 -text
src/Fortran/H5Block_readwrite_F.c -text
src/Fortran/H5Part.f90 -text
src/Fortran/H5F.f90 -text
src/Fortran/H5Part.c -text
src/Fortran/H5PartF.f90 -text
src/Fortran/H5Part_F.c -text
src/Fortran/H5Part_io.c -text
src/Fortran/H5Part_ioF.f90 -text
src/Fortran/H5_F.c -text
src/Fortran/H5_attribs.f90 -text
src/Fortran/H5_attribs.c -text
src/Fortran/H5_attribsF.f90 -text
src/Fortran/H5_attribs_F.c -text
src/Fortran/H5_constF.f90 -text
src/Fortran/Makefile.am -text
src/Fortran/TestUnderscore.f -text
src/Fortran/TestUnderscoreC.c -text
src/Fortran/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
@@ -406,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
@@ -422,11 +460,12 @@ src/h5core/h5_readwrite_private.h -text
src/h5core/h5_syscall.c -text
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
@@ -435,18 +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_consts.c -text
src/h5core/h5t_consts_private.h -text
src/h5core/h5t_core.c -text
src/h5core/h5t_core_private.h -text
src/h5core/h5t_errorhandling.c -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_openclose.c -text
src/h5core/h5t_openclose_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
@@ -461,85 +501,52 @@ src/h5core/h5t_store.c -text
src/h5core/h5t_store_private.h -text
src/h5core/h5t_store_tetm.c -text
src/h5core/h5t_store_trim.c -text
src/h5core/h5t_store_trim_private.h -text
src/h5core/h5t_tags.c -text
src/h5core/h5t_tags_private.h -text
src/h5core/h5t_types_private.h -text
src/h5core/h5u_errorhandling_private.h -text
src/h5core/h5u_model.c -text
src/h5core/h5u_readwrite.c -text
src/h5core/h5u_readwrite_private.h -text
src/h5core/h5u_types_private.h -text
src/include/H5.h -text
src/include/H5Block.h -text
src/include/H5Block_readwrite.h -text
src/include/H5Block_attribs.h -text
src/include/H5Block_io.h -text
src/include/H5Block_model.h -text
src/include/H5Fed.h -text
src/include/H5Fed_adjacency.h -text
src/include/H5Fed_inquiry.h -text
src/include/H5Fed_model.h -text
src/include/H5Fed_retrieve.h -text
src/include/H5Fed_store.h -text
src/include/H5Fed_tags.h -text
src/include/H5Part.h -text
src/include/H5_attachments.h -text
src/include/H5Part_io.h -text
src/include/H5Part_model.h -text
src/include/H5_attribs.h -text
src/include/H5_model.h -text
src/include/H5hut.h -text
src/include/grephdr -text
src/include/h5core/h5_attach.h -text
src/include/Makefile.am -text
src/include/h5core/Makefile.am -text
src/include/h5core/h5.h -text
src/include/h5core/h5_attribs.h -text
src/include/h5core/h5_core.h -text
src/include/h5core/h5_errno.h -text
src/include/h5core/h5_debug.h -text
src/include/h5core/h5_errorhandling.h -text
src/include/h5core/h5_hdf5.h -text
src/include/h5core/h5_maps.h -text
src/include/h5core/h5_openclose.h -text
src/include/h5core/h5_readwrite.h -text
src/include/h5core/h5_model.h -text
src/include/h5core/h5_syscall.h -text
src/include/h5core/h5_types.h -text
src/include/h5core/h5b_attribs.h -text
src/include/h5core/h5b_io.h -text
src/include/h5core/h5b_model.h -text
src/include/h5core/h5b_readwrite.h -text
src/include/h5core/h5t_adjacencies.h -text
src/include/h5core/h5t_core.h -text
src/include/h5core/h5t_inquiry.h -text
src/include/h5core/h5t_map.h -text
src/include/h5core/h5t_openclose.h -text
src/include/h5core/h5t_readwrite.h -text
src/include/h5core/h5t_ref_elements.h -text
src/include/h5core/h5t_model.h -text
src/include/h5core/h5t_octree.h -text
src/include/h5core/h5t_retrieve.h -text
src/include/h5core/h5t_storemesh.h -text
src/include/h5core/h5t_store.h -text
src/include/h5core/h5t_tags.h -text
src/include/h5core/h5u_io.h -text
src/include/h5core/h5u_model.h -text
src/include/h5core/h5u_readwrite.h -text
test/H5Block/BlockTestSpecs.txt -text
test/H5Block/H5BlockDissolveGhosts.c -text
test/H5Block/H5BlockParTestScalarField.c -text
test/H5Block/H5BlockParTestScalarField.pbs -text
test/H5Block/H5BlockParTestScalarFieldF.f90 -text
test/H5Block/H5BlockTestAttributes.c -text
test/H5Block/H5BlockTestAttributesF.f90 -text
test/H5Block/Makefile.am -text
test/H5Fed/Makefile.am -text
test/H5Fed/map_tet2globalid.c -text
test/H5Fed/map_triangle2globalid.c -text
test/H5Fed/tetmesh_adjacencies.c -text
test/H5Fed/tetmesh_read.c -text
test/H5Fed/tetmesh_read_tags.c -text
test/H5Fed/tetmesh_write.c -text
test/H5Fed/tetmesh_write2.c -text
test/H5Fed/tetmesh_write_tags.c -text
test/H5Fed/trimesh_adjacencies.c -text
test/H5Fed/trimesh_read.c -text
test/H5Fed/trimesh_write.c -text
test/H5Fed/trimesh_write_dunetest.c -text
test/H5Fed/write_boundary.c -text
test/H5Part/Bench.c -text
test/H5Part/H5ParallelTest.cc -text
test/H5Part/H5PartAndreasTest.cc -text
test/H5Part/H5PartTest.cc -text
test/H5Part/H5PartTestParallel.cc -text
test/H5Part/H5test.cc -text
test/H5Part/H5testF.f -text
test/H5Part/H5testFpar.f90 -text
test/H5Part/Makefile.am -text
test/Makefile.am -text
test/h5b_read.c -text
test/h5b_test.c -text
@@ -557,7 +564,6 @@ tools/H5PartMerge/INSTALL -text
tools/H5PartMerge/NEWS -text
tools/H5PartMerge/README -text
tools/H5PartMerge/autogen.sh -text
tools/H5PartMerge/configure -text
tools/H5PartMerge/configure.ac -text
tools/H5PartMerge/makefile.am -text
tools/H5PartMerge/src/H5merge.cpp -text
@@ -565,10 +571,13 @@ tools/H5PartMerge/src/optparse.cpp -text
tools/H5PartMerge/src/optparse.hh -text
tools/Makefile.am -text
tools/README -text
tools/h5PartDcToVtk.cc -text
tools/h5PartSurfaceToVtk.cc -text
tools/h5hutcc.in -text
tools/h5pAttrib.cc -text
tools/h5pToGNUplot.cc -text
tools/homdynToH5p.cc -text
tools/vtk2h5grid/Makefile.am -text
tools/vtk2h5grid/vtk2h5grid.cc -text
visit_plugins/databases/H5Part/.depend -text
visit_plugins/databases/H5Part/Makefile -text
visit_plugins/databases/H5Part/README.txt -text
+90 -65
View File
@@ -1,69 +1,94 @@
/INSTALL
/Makefile
/Makefile.in
/aclocal.m4
/autom4te.cache
/config.guess
/config.h
/config.h.in
/config.log
/config.status
/config.sub
/configure
/depcomp
doc/Makefile
doc/Makefile.in
/install-sh
/missing
src/.deps
src/C++/Makefile
src/C++/Makefile.in
src/C/.deps
src/C/Makefile
src/C/Makefile.in
src/C/libH5hutC.a
src/Fortran/.deps
src/Fortran/Makefile
src/Fortran/Makefile.in
src/Makefile
src/Makefile.in
src/h5core/.deps
src/h5core/Makefile
src/h5core/Makefile.in
src/h5core/libH5hut.a
*.tar.gz
*.[oa]
*.la
*.lo
*.so
*.dSYM
*~
*.h5
.deps
.dirstamp
.libs
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
src/lib
/stamp-h1
/svn-prop.tmp
test/.deps
test/H5Block/H5BlockParTestScalarField
test/H5Block/H5BlockTestAttributes
test/H5Block/Makefile
test/H5Block/Makefile.in
test/H5Fed/.deps
test/H5Fed/Makefile
test/H5Fed/Makefile.in
test/H5Fed/simple_tet.h5
test/H5Fed/simple_triangle.h5
test/H5Fed/tetmesh_adjacencies
test/H5Fed/tetmesh_read
test/H5Fed/tetmesh_read_tags
test/H5Fed/tetmesh_write
test/H5Fed/tetmesh_write2
test/H5Fed/tetmesh_write_tags
test/H5Fed/trimesh_read
test/H5Fed/trimesh_write
test/H5Part/Bench
test/H5Part/H5PartAndreasTest
test/H5Part/H5PartTestP
test/H5Part/H5test
test/H5Part/Makefile
test/H5Part/Makefile.in
test/Makefile
test/Makefile.in
stamp-h1
test/h5b_test
test/h5u_test
tools/.deps
tools/Makefile
tools/Makefile.in
test/h5_attach_test
tools/h5hutcc
tetmesh_adjacencies
tetmesh_read
tetmesh_read_tags
tetmesh_write
tetmesh_write1
examples/H5Fed/tetmesh_write2
examples/H5Fed/trimesh_2gnuplot
examples/H5Fed/trimesh_adjacencies
examples/H5Fed/trimesh_read
examples/H5Fed/trimesh_write
examples/H5Fed/trimesh_write_dunetest
tetmesh_write_tags
write_field
*.gch
ReferencePages
vtk2h5grid
+1 -1
View File
@@ -7,4 +7,4 @@ Wes Bethel (NERSC/LBNL)
John Shalf (NERSC/LBNL)
Cristina Siegerist (NERSC/LBNL)
Please use h5part@lists.psi.ch for communicaion.
Please use h5part@lists.psi.ch for communication.
+2 -2
View File
@@ -1,6 +1,6 @@
*** Copyright Notice ***
H5hut Copyright (c) 2006-2010, The Regents of the University of California,
H5hut Copyright (c) 2006-2016, The Regents of the University of California,
through Lawrence Berkeley National Laboratory (subject to receipt of any
required approvals from the U.S. Dept. of Energy) and the Paul Scherrer
Institut (Switzerland). All rights reserved.
@@ -25,7 +25,7 @@ and to permit others to do so.
*** License agreement ***
H5Part Copyright (c) 2006-2009, The Regents of the University of California,
H5hut Copyright (c) 2006-2016, The Regents of the University of California,
through Lawrence Berkeley National Laboratory (subject to receipt of any
required approvals from the U.S. Dept. of Energy) and the Paul Scherrer
Institut (Switzerland). All rights reserved.
-133
View File
@@ -1,133 +0,0 @@
UNAME := $(shell uname | perl -pe 's/(sn\d\d\d\d|jsimpson)/UNICOS\/mk/')
# for host specific options
HOST := $(shell hostname)
# for processor-specific options
ifeq ($(UNAME), Linux)
PROC := $(shell uname -p)
endif
CXX = c++
CC = cc
H5HOME = /usr/local/hdf5
CFLAGS = -g -I$(H5HOME)/include
LDFLAGS = -L$(H5HOME)/lib -lhdf5 -lz -lm
# MacOS-X Serial
ifeq ($(UNAME), Darwin)
ifeq ($(PARALLEL), yes)
CXX = g++
CC = mpicc
H5HOME = /usr/local
CFLAGS = -O -g -I$(H5HOME)/include -DPARALLEL_IO
LDFLAGS = -L$(H5HOME)/lib -lmpich -lpmpich -lhdf5 -lz -lm
else
CXX = c++
CC = cc
F90 = xlf
H5HOME = /usr/local
CFLAGS = -O -g -I$(H5HOME)/include
LDFLAGS = -L$(H5HOME)/lib -lhdf5 -lz -lm
endif
endif
# SGI MIPS/Irix
ifeq ($(UNAME), IRIX64)
CXX = CC
CC = cc
F90 = f90
ifeq ($(PARALLEL), yes)
H5HOME = $(HDF5_DIR)
CFLAGS = -64 -O3 -I$(H5HOME)/include -DPARALLEL_IO
LDFLAGS = -64 -O3 -L$(H5HOME)/lib -lhdf5 -lz -lmpi -lm
else
H5HOME = /usr/local
CFLAGS = -O3 -I$(H5HOME)/include
LDFLAGS = -L$(H5HOME)/lib -lhdf5 -lz -lm
endif
endif
# AIX/SP-2 Parallel/serial : Seaborg
ifeq ($(UNAME), AIX)
ifeq ($(PARALLEL), yes) # parallel
CXX = mpCC_r
CC = mpxlc_r
# H5HOME = /usr/common/usg/hdf5_64/1.4.5-post2/parallel
H5HOME = /usr/common/usg/hdf5_64/1.6.1/parallel
# /usr/common/usg/hdf5/1.4.4/parallel
H4HOME = /usr/common/usg/hdf/default
OPT = -qarch=auto -qtune=auto-qcache=auto -O3 -qhot
CFLAGS = -q64 -I$(H5HOME)/include
LDFLAGS = -L$(H5HOME)/lib -lhdf5 -L$(H4HOME)/lib -lz -lsz -lm
else # serial
CXX = xlC
CC = xlc
H5HOME = /usr/common/usg/hdf5/1.4.4/serial
H4HOME = /usr/common/usg/hdf/default
OPT = -qarch=auto -qtune=auto-qcache=auto -O3 -qhot
CFLAGS = -g -bmaxdata:800000000 -bmaxstack:256000000 -I$(H5HOME)/include
LDFLAGS = -L$(H5HOME)/lib -lhdf5 -L$(H4HOME)/lib -lz -lm
endif
endif
# Linux
ifeq ($(UNAME), Linux)
# if this machine is NERSC/Davinci Altix system
ifeq ($(PROC), ia64)
CC = icc
CXX = icc
ifeq ($(PARALLEL), yes)
# IA64 Linux Parallel
ifeq ($(HOST), davinci)
H5HOME = $(HDF5_PAR)
MPILIB = -lmpi
else
H5HOME = /usr/local
HDF5_PAR_LIB = -L$(H5HOME)/lib -lhdf5 -lz -lm
HDF5_PAR_INCLUDE = -I$(H5HOME)/include
MPIHOME = /usr/local
MPILIB = -lmpich
endif # HOST
CFLAGS = -O3 -DPARALLEL_IO -DH5_HAVE_PARALLEL $(HDF5_PAR_INCLUDE)
LDFLAGS = $(HDF5_PAR_LIB) $(MPILIB)
else # IA64 Linux Serial
CFLAGS = -O3 $(HDF5_INCLUDE)
LDFLAGS = $(HDF5_LIB) -lm
endif # PARALLEL
# else this is standard IA32 linux
else
ifeq ($(PARALLEL), yes)
# Linux Parallel
CC = gcc
CXX = g++
H5HOME = /usr/local
MPIHOME = /usr/local
CFLAGS = -O -g -DPARALLEL_IO -DH5_HAVE_PARALLEL -I$(H5HOME)/include
LDFLAGS = -L$(H5HOME)/lib -lhdf5 -lmpich -lrt -lz -lm
else # Linux Serial
CXX = g++
CC = gcc
CFLAGS = -O -g -I$(H5HOME)/include
LDFLAGS = -L$(H5HOME)/lib -lhdf5 -lz -lm
endif # !PARALLEL
endif # PROC!ia64
endif # !Linux
ifeq ($(PARALLEL), yes) #parallel
ifdef F90
all: H5PartTest H5PartTest.o H5Part.o H5PartTestParallel H5PartAndreasTest H5PartF.o
else
all: H5PartTest H5PartTest.o H5Part.o H5PartTestParallel H5PartAndreasTest
endif
else
ifdef F90
all: H5PartTest H5PartTest.o H5Part.o H5PartF.o
else
all: H5PartTest H5PartTest.o H5Part.o
endif
endif
include rules.make
+17 -9
View File
@@ -1,11 +1,19 @@
SUBDIRS = \
src \
test \
tools
ACLOCAL_AMFLAGS = -I m4
EXTRA_DIST = autogen.sh
MAINTAINERCLEANFILES = \
config.h \
config.log \
config.status \
stamp-h.in \
SUBDIRS = \
src \
test \
tools \
doc \
examples/H5 \
examples/H5Part \
examples/H5Block \
examples/H5Fed
MAINTAINERCLEANFILES = \
config.h \
config.log \
config.status \
stamp-h.in \
stamp-h1
+401
View File
@@ -0,0 +1,401 @@
#### H5PART trunk ############################################################
* h5_file_t is now uintptr_t
* experimental version of parallel H5Fed
* new API function for file open using properties (similiar to hdf5 properties)
#### H5PART 1.99.10 ############################################################
* C99 compiler required
* C API with inline functions
#### H5PART 1.99.0 ############################################################
rudimental implementation of a grid manager
Important changes from version 1.6 to 1.99.0
Renamed type:
H5PartFile -> h5_file_t
h5part_int64_t -> h5_int64_t
h5part_float64_t -> h5_float_t
Renamed functions:
All function not related to a specific data model have been renamed from
H5PartFunction() to H5Function().
Example:
H5PartOpenFile() -> H5OpenFile()
Removed functions:
To simplify the API, there is just one function to open a file. It's the
same function for serial and parallel code.
#### H5PART 1.6.6 ############################################################
Fixed typo (Write instead of Read) in the h5bl_3d_read_scalar_field* Fortran
interface.
Added missing type normalization for int32 type.
Rewrite of h5pAttrib tool.
#### H5PART 1.6.5 ############################################################
Fixed several build errors reported by Iuri Prilepov on Ubuntu 11.04.
#### H5PART 1.6.4 ############################################################
Fixed bug where H5PartSetViewIndices was not setting an empty view when the
number of elements is 0.
Set a threshold on the HDF5 alignment parameter so that small metadata writes
are not aligned, which causes large gaps in the file.
#### H5PART 1.6.3 ############################################################
New build system uses libtool and can build shared libraries.
Fixed a bug that incorrectly identifies the number of selected points in a view
when using H5PartSetViewIndices.
Fixed bug in Fortran test reported by several people, as well as several
incorrect views set in the C test that were causing segfaults.
Fixed name mismatches in the Fortran interface, and an off-by-one indexing
problem.
#### H5PART 1.6.2 ############################################################
Removed H5PartSetViewEmpty
--------------------------
An empty view can now be selected with:
H5PartSetNumParticles(file, 0);
Bug Fixes to Attribute Calls in Fortran API
-------------------------------------------
Fixed a problem where attribute values were reverting to zero.
#### H5PART 1.6.1 ############################################################
Chunking in the H5Part API
--------------------------
There is now an H5Part equivalent H5PartSetChunkSize to the existing
H5BlockDefine3DChunkDims call. Both of these calls enable the chunking
mechanism in the underlying HDF5 layer. Chunking is used in combination
with the aligned open calls to pad datasets to alignment multiples
on disk.
All Steps Available on Write
----------------------------
Previously, existing steps in a file were only accessible in read-only mode.
Now, all steps are available in all modes, including write-truncate and
write-append. Thus, it is now possible to overwrite existing data in write
mode. To help alert the user to this possibility, a warning is issued every
time an existing dataset is written to. Warnings can be printed by setting
the verbosity to H5PART_VERB_WARN or higher.
New Throttling Routine
----------------------
Previously, a throttle factor of N meant that for P processors, the total
number of P writes were divided into N batches of P/N writes.
To better accommodate round-robin lustre striping, the new policy is to
execute P/N batches of N writes. Thus, matching N to the number of stripes
results in the desirable 1-1 matching of writers to stripes.
Other Fixes
-----------
* The configure script should correctly detect PGI compilers now.
* There was a small memory leak in the Fortran file open calls.
* There was a compile error with HDF5 1.6.x due to a missing assignment.
#### H5PART 1.6 ##############################################################
Updated Documentation
---------------------
The Fortran API has been added to the doxygen documentation. Most entries have
a reference to their respective C API call.
Regression Test Suite
---------------------
The test subdirectory has been reorganized to include a systematic series
of regression tests of common use cases for the API. The goal is to have both
complete coverage of the API (every call is exercised) and testing of some
unlikely or unsuspected values and cases.
Currently, the C test covers the entire H5Part API and the Fortran test is
still in development.
Benchmark Utilities
-------------------
Two benchmarking utilities, H5PartBench and H5BlockBench, have been added to
the tools collection. Both require the parallel library and have functionality
and syntax similar to the IOR benchmark:
http://sourceforge.net/projects/ior-sio/
File Mode Flags
---------------
Previously, the only flags used were H5PART_READ, H5PART_WRITE, and
H5PART_APPEND, and these were mutually exclusive. Additional flags have been
added to select the underlying virtual file driver (VFD) that HDF5 uses in
parallel mode and to accommodate the lustre filesystem:
H5PART_VFD_MPIPOSIX (use the MPI-POSIX driver, which bypasses MPI-IO)
H5PART_VFD_MPIIO_IND (use MPI-IO in independent mode)
H5PART_FS_LUSTRE (activate H5P tunings for the lustre stripe size)
These flags can be specified using the typical bitwise OR method, e.g.
char flag = H5PART_WRITE | H5PART_VFD_MPIPOSIX | H5PART_FS_LUSTRE;
will select write mode with these two additional options.
The parallel library now defaults to using the MPI-IO collective mode driver
(previously it used independent mode). The collective buffering algorithm in
the Cray XT4/5 environment has been substantially improved in the last year,
and defaulting to collective mode allows us to take advantage of these
improvements automatically.
There are also new open calls H5PartOpenAlign and H5PartOpenParallelAlign that
take an additional 'alignment' value. This value is passed to HDF5 and used to
pad out objects so that they align to filesystem boundaries. For instance, it
would make sense to use the stripe size as the alignment value when writing to
a lustre filesystem.
Unified 'View' Model
--------------------
Views are now supported in both read and write mode (previously only supported
in read mode). It is possible to specify non-sensical views: you could for
instance specify a read view that is larger than the dataset on disk. Or you
could create a write view that is larger than the data in memory. In those
cases, you will encounter an error when you try to perform a read or write
operation on a dataset.
There are two new methods for selecting views. H5PartSetNumParticlesStrided
selects a view with $n$ particles per processor, but such that the data in
memory is expected to have a 'stride' factor. For instance, if you have
particle data with fields $x$ and $y$ and a single array with entries
$x1,y1,x2,y2...$, then the stride factor is 2. Striding works for both reads
and writes and only affects the view of memory: individual fields are still
stored as individual arrays on disk.
The second new method is H5PartSetViewIndices, which allows for point
selections of datasets. You can pass a list of indices for the points you
want to select. This is useful, for instance, when interfacing with FastBit
to perform queries that select a small subset of non-contiguous particles.
Because views are now supported on write, it is possible to write a dataset
using multiple 'passes' or to leave some values unwritten.
Also, all views are now *inclusive*, so that a view of (0,9) corresponds
to the 10 items 0, 1, 2, ... 9.
Internal Handling of Dataspaces
-------------------------------
H5PartSetNumParticles and H5PartSetNumParticlesStrided now share the same
HDF5 dataspace state in the H5PartFile struct with the calls that modify
the view (H5PartSetView etc.). Previously, the memory and disk dataspaces
were regenerated from the view on every read access, which was unnecessary.
Autogeneration of API Calls
---------------------------
Python scripts have been added to automatically generate read/write call
variants for different data types.
Renamed Fortran Include
-----------------------
The automake system no longer greps the *F90.inc files to generate an include
called 'H5Part.inc'. Instead, the *F90.inc files have been renamed to *.f90,
and awk is used to generate an 'H5PartF.h' file (the same naming convention
as in MPI's 'mpif.h').
The change to *.f90 was necessary to facilitate integration of the Fortran
API into doxygen. Note that the *.f90 files will not compile, nor can they
be included directly. Simply use
include 'H5PartF.h'
in your Fortran code to include all the definitions for Fortran H5Part/H5Block
calls.
64 Char Limit on Dataset Names
------------------------------
Previously, a user could overrun internal buffers for dataset names. Now, a
fixed limit of 64 chars is imposed. Dataset names that are longer than this are
truncated and a warning is printed. We expect that most users are using
short canonical names like x, px, id, etc.
Changes to Existing API
-----------------------
The H5BlockGetFieldInfo and H5BlockGetFieldInfoByName calls now both include
a parameter for the 'type' of the field.
#### H5PART 1.4 ##############################################################
Error Handling
--------------
Now all functions, in which an error could occure, are returning a
value. This value is either a 64bit integer or a pointer.
A negative 64bit integer as result indicates an error. Values >= 0
indicates successfull execution. This is similiar to the convention
used in UNIX system calls, but we do not return -1 but the error
number (which is always negative).
For functions returning a pointer the NULL-pointer is used to indicate
an error. You can call the function H5PartGetErrno() to get the error
number. For the time being there is no strerror(3) or perror(3)
equivalent.
API Changes
-----------
There are several changes in the API of H5Part. The biggest change is
a side-effect of the implementation of strict error handling. The
impact to the existing C/C++ code is very small. But now you *can*
and *should* implement some kind of error handling. The simplest
error handling is to set an error handler which aborts the program as
soon as an error occured.
The next "biggest" change is the use of H5Part types instead of "long
long" and "double". The replacement of "long long" is "h5part_int64_t"
and for "double" "h5part_float64_t". This change has now effect in
Fortran.
In some functions the argument type changed from "int" to
"h5part_int64_t". Since on most systems "int" is a 32bit integer,
calls to these functions must be adapted to the new API. In C/C++ the
compiler will complain about it. But in Fortran you will *not* get an
error message.So, you must check your Fortran code carefully.
Changes in detail (not listed are functions where only the return
type changed from any to "h5part_int64_t"):
New API Changes to old API
h5part_int64_t void
H5PartSetNumParticles (
H5PartFile *f,
h5part_int64_t nparticles long long
);
h5part_int64_t int
H5PartWriteDataFloat64 (
H5PartFile *f,
char *name,
h5part_float64_t *dta double
);
h5part_int64_t int
H5PartWriteDataInt64 (
H5PartFile *f,
char *name,
h5part_int64_t *dta long long
);
h5part_int64_t void
H5PartSetStep (
H5PartFile *f,
h5part_int64_t step int
);
h5part_int64_t void
H5PartSetView (
H5PartFile *f,
h5part_int64_t start, long long
h5part_int64_t end long long
);
h5part_int64_t int
H5PartGetView (
H5PartFile *f,
h5part_int64_t *start, long long
h5part_int64_t *end long long
);
h5part_int64_t int
H5PartReadDataFloat64 (
H5PartFile *f,
char *name,
h5part_float64_t *dta double
);
h5part_int64_t int
H5PartReadDataInt64 (
H5PartFile *f,
char *name,
h5part_int64_t *dta long long
);
h5part_int64_t void
H5PartReadParticleStep (
H5PartFile *f,
h5part_int64_t step, int
h5part_float64_t *x, double
h5part_float64_t *y, double
h5part_float64_t *z, double
h5part_float64_t *px, double
h5part_float64_t *py, double
h5part_float64_t *pz, double
h5part_int64_t *id long long
);
New functions:
h5part_int64_t
H5PartSetVerbosityLevel (
unsigned int
);
h5part_int64_t
H5PartSetErrorHandler (
h5part_error_handler handler
);
h5part_int64_t
H5PartGetErrno (
void
);
h5part_int64_t
H5PartDefaultErrorHandler (
const char *funcname,
const h5part_int64_t eno,
const char *fmt,
...
);
h5part_int64_t
H5PartAbortErrorHandler (
const char *funcname,
const h5part_int64_t eno,
const char *fmt,
...
);
Removed functions:
int
H5PartFileIsValid (
H5PartFile *f
);
+26 -24
View File
@@ -1,46 +1,48 @@
#!/bin/sh
# Run this to generate all the initial makefiles, etc.
ACLOCAL_FLAGS="-I m4 -I . $ACLOCAL_FLAGS"
LIBTOOLIZE_FLAGS="--force $LIBTOOLIZE_FLAGS"
AUTOMAKE_FLAGS="--add-missing --copy --foreign $AUTOMAKE_FLAGS"
LIBTOOLIZE=`which libtoolize`
if [ "$LIBTOOLIZE" = "" ]; then
LIBTOOLIZE=`which glibtoolize`
fi
if [ "$LIBTOOLIZE" = "" ]; then
echo "libtoolize not found" 1>&2
exit 1
fi
echo "+ making misc files ..."
touch NEWS README AUTHORS ChangeLog
echo
echo
$LIBTOOLIZE $LIBTOOLIZE_FLAGS || {
echo "libtoolize failed"
exit 1
}
echo
echo "+ running aclocal ..."
aclocal $ACLOCAL_FLAGS || {
echo
echo "aclocal failed - check that all needed development files are present on system"
exit 1
echo "aclocal failed - check that all needed development files are present on system"
exit 1
}
echo
echo
echo
echo
echo "+ running autoheader ... "
autoheader || {
echo
echo "autoheader failed"
exit 1
echo "autoheader failed"
exit 1
}
echo
echo
echo
echo "+ running autoconf ... "
autoconf || {
echo
echo "autoconf failed"
exit 1
echo "autoconf failed"
exit 1
}
echo
echo
echo
echo "+ running automake ... "
automake -a -c --foreign || {
echo
echo "automake failed"
exit 1
automake $AUTOMAKE_FLAGS || {
echo "automake failed"
exit 1
}
echo
echo
echo
+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])
])
+332 -373
View File
@@ -1,84 +1,143 @@
# Every configure script must call AC_INIT before doing anything else.
# AC_INIT (package, version, [bug-report], [tarname])
AC_INIT([H5hut], [1.99.1], [h5part@lists.psi.ch], H5hut)
#
# Copyright (c) 2006-2017, 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.0rc3], [h5part@lists.psi.ch], H5hut)
AC_PREREQ(2.60)
AC_CONFIG_HEADERS(config.h)
AC_CONFIG_MACRO_DIR([m4])
AM_INIT_AUTOMAKE
# Ensure that a recent enough version of Autoconf is being used.
# If the version of Autoconf being used to create configure is earlier than version,
# print an error message to the standard error output and do not create configure.
AC_PREREQ(2.59)
# should be called right after AC_INIT.
# configure scripts can create a C header file containing `#define' directives.
# The AC_CONFIG_HEADERS macro selects this kind of output.
AC_CONFIG_HEADER(config.h)
BUILD_LIBS='libH5hut.a'
USE_C='yes'
ENABLE_DEBUG='no'
ENABLE_C='yes'
ENABLE_FORTRAN='no'
ENABLE_PARALLEL='no'
ENABLE_PYTHON='no'
###############################################################################
################# --enable-xxx and --with-xxx Argument ########################
###############################################################################
# --enable-xxx and --with-xxx Arguments
AC_ARG_ENABLE(
[debug],
[AC_HELP_STRING([--enable-debug],
[Compile with debug flags [default=no]])],
[USE_DEBUG=$enableval])
AC_ARG_ENABLE(
[64],
[AC_HELP_STRING([--enable-64],
[Compile using 64-bit flags [default=no]])],
[USE_64=$enableval])
[AS_HELP_STRING([--enable-debug], [Compile with debug flags [default=no]])],
[ENABLE_DEBUG=$enableval])
AM_CONDITIONAL([ENABLE_DEBUG], [test "$ENABLE_DEBUG" = "yes"])
AC_ARG_ENABLE(
[c],
[AC_HELP_STRING([--enable-c],
[AS_HELP_STRING([--enable-c],
[Compile the C interface [default=yes]])],
[USE_C=$enableval])
[ENABLE_C=$enableval])
AM_CONDITIONAL([ENABLE_C], [test "$ENABLE_C" = "yes"])
AC_ARG_ENABLE(
[fortran],
[AC_HELP_STRING([--enable-fortran],
[AS_HELP_STRING([--enable-fortran],
[Compile the Fortran interface [default=no]])],
[USE_FORTRAN=$enableval])
[ENABLE_FORTRAN=$enableval])
AM_CONDITIONAL([ENABLE_FORTRAN], [test "$ENABLE_FORTRAN" = "yes"])
AC_ARG_ENABLE(
[python],
[AS_HELP_STRING([--enable-python],
[Compile the Python interface [default=no]])],
[ENABLE_PYTHON=$enableval])
AM_CONDITIONAL([ENABLE_PYTHON], [test "$ENABLE_PYTHON" = "yes"])
AC_ARG_ENABLE(
[parallel],
[AC_HELP_STRING([--enable-parallel],
[AS_HELP_STRING([--enable-parallel],
[Compile the MPI/IO interface [default=no]])],
[USE_PARALLEL=$enableval])
[ENABLE_PARALLEL=$enableval])
AM_CONDITIONAL([ENABLE_PARALLEL], [test "$ENABLE_PARALLEL" = "yes"])
AC_ARG_WITH(
[mpi],
[AC_HELP_STRING([--with-mpi],
[path to MPI installation [default=""]])],
[MPIPATH=$withval], [MPIPATH=""])
AC_ARG_ENABLE(
[large-indices],
[AC_HELP_STRING([--enable-large-indices],
[Compile with 64bit local IDs and indices [default=no]])],
[USE_LARGE_INDICES=$enableval])
AC_ARG_ENABLE(
[experimental],
[AS_HELP_STRING([--enable-experimental],
[Compile experimental code [default=no]])],
[ENABLE_EXPERIMENTAL=$enableval])
AM_CONDITIONAL([ENABLE_EXPERIMENTAL], [test "$ENABLE_EXPERIMENTAL" = "yes"])
AC_ARG_ENABLE(
[vtkconverter],
[AS_HELP_STRING([--enable-vtkconverter],
[Compile the vtk to H5hut converter for grids [default=no]])],
[ENABLE_VTKCONVERTER=$enableval])
AM_CONDITIONAL([ENABLE_VTKCONVERTER], [test "$ENABLE_VTKCONVERTER" = "yes"])
AC_ARG_ENABLE(
[examples],
[AS_HELP_STRING([--enable-examples],
[Compile the H5hut examples [default=no]])],
[ENABLE_EXAMPLES=$enableval])
AM_CONDITIONAL([ENABLE_EXAMPLES], [test "$ENABLE_EXAMPLES" = "yes"])
AC_ARG_WITH(
[hdf5],
[AC_HELP_STRING([--with-hdf5],
[AS_HELP_STRING([--with-hdf5],
[path to HDF5 installation [default=""]])],
[HDF5PATH=$withval], [HDF5PATH=""])
[HDF5_PREFIX=$withval], [])
AC_ARG_WITH(
[mpi],
[AS_HELP_STRING([--with-mpi],
[path to MPI installation [default=""]])],
[PATH=$MPI_PREFIX/bin:$PATH])
AC_ARG_WITH(
[lustre],
[AC_HELP_STRING([--with-lustre],
[AS_HELP_STRING([--with-lustre],
[path to lustre user API [default=""]])],
[LUSTREPATH=$withval], [LUSTREPATH=""])
###############################################################################
################# A SIMPLE WORK AROUND TO USE ENV. VARS #######################
###############################################################################
AC_ARG_WITH(
[parmetis],
[AC_HELP_STRING([--with-parmetis],
[path to ParMETIS API [default=""]])],
[PARMETIS_PREFIX=$withval], [])
AC_ARG_WITH(
[vtk],
[AC_HELP_STRING([--with-vtk],
[VTK installation path [default=""]])],
[VTK_PREFIX=$withval], [])
# Determine a C/C++ compiler to use.
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
SAVE_CC=$CC
SAVE_CXX=$CXX
SAVE_MPICC=$MPICC
SAVE_MPICXX=$MPICXX
SAVE_MPIROOT=$MPIROOT
SAVE_HDF5ROOT=$HDF5ROOT
###############################################################################
############### PATH SERACH FUNCTION - to be used later... ####################
@@ -111,60 +170,61 @@ PATH_Search() {
return
}
###############################################################################
# MISC SETTINGS INCLUDING C & C++ COMPILER SETTING
###############################################################################
############# MISC SETTINGS INCLUDING C & C++ COMPILER SETTING ################
###############################################################################
# Compute the canonical host-system type variable, host, and its three
# individual parts host_cpu, host_vendor, and host_os.
AC_CANONICAL_HOST
AC_PROG_MAKE_SET
CFLAGS="$CFLAGS -Wall"
CXXFLAGS="$CFLAGS -Wall"
FFLAGS="$FFLAGS -Wall"
uname=`uname -s`
if test "x$uname" = "xAIX"; then
AC_MSG_CHECKING([if system is AIX])
AC_MSG_RESULT([OK])
# If on AIX, define _ALL_SOURCE. Allows the use of some BSD functions.
# Should be called before any macros that run the C compiler.
AC_AIX
# debug enabled?
AC_MSG_CHECKING([if debug is enabled])
if test "X$ENABLE_DEBUG" = "Xyes"; then
AC_MSG_RESULT([yes])
CFLAGS="$CFLAGS -g3 -O0"
CXXFLAGS="$CFLAGS -g3 -O0"
FFLAGS="$FFLAGS -g3 -O0"
else
AC_MSG_RESULT([no])
CFLAGS="$CFLAGS -O3"
CXXFLAGS="$CFLAGS -O3"
FFLAGS="$FFLAGS -O3"
fi
# Determine a C compiler to use.
# If CC is not already set in the environment, check for gcc and cc, then
# for other C compilers.
# Set output variable CC to the name of the compiler found.
AC_PROG_CC(pgcc pathcc icc cc_r gcc cc)
# Determine a C++ compiler to use.
# Check if the environment variable CXX or CCC (in that order) is set;
# if so, then set output variable CXX to its value.
# Otherwise, if the macro is invoked without an argument,
# then search for a C++ compiler under the likely names (first g++ and c++
# then other names).
# If none of those checks succeed, then as a last resort set CXX to g++.
AC_PROG_CXX(pgCC pathCC icc cc_r g++ gcc cc)
# Set output variable INSTALL to the path of a BSD-compatible install program,
# if one is found in the current PATH.
# Otherwise, set INSTALL to `dir/install-sh -c`
AC_PROG_INSTALL
AC_PROG_AWK
if test "x$CC" = "xgcc"; then
CFLAGS="$CFLAGS -std=c99"
fi
# AM_INIT_AUTOMAKE is required to use autoconf with automake
AM_INIT_AUTOMAKE()
AC_PROG_RANLIB
# Disable shared libraries by default: can be enabled with --enable-shared
LT_INIT([disable-shared])
AC_PROG_LIBTOOL
# Default prefix for bindir, etc... (eg >> ./build/bin)
AC_PREFIX_DEFAULT(`pwd`/build)
# Checks for header files.
AC_CHECK_HEADERS([fcntl.h limits.h stdint.h stdlib.h string.h sys/ioctl.h unistd.h])
# Checks for typedefs, structures, and compiler characteristics.
AC_HEADER_STDBOOL
AC_C_INLINE
AC_TYPE_INT16_T
AC_TYPE_INT32_T
AC_TYPE_INT64_T
AC_TYPE_SIZE_T
AC_TYPE_SSIZE_T
AC_TYPE_UINT16_T
AC_TYPE_UINT32_T
AC_TYPE_UINT64_T
AC_CHECK_TYPES([ptrdiff_t])
# Checks for library functions.
AC_FUNC_MALLOC
AC_FUNC_REALLOC
AC_CHECK_FUNCS([memmove memset pow strchr strdup strerror strstr])
# AC_DEFINE_UNQUOTED (variable, value, [description])
# Define the C preprocessor variable variable to value
@@ -177,241 +237,169 @@ AC_DEFINE_UNQUOTED(MY_UNAME, "$uname", "")
###############################################################################
######################## CONFIGURE LINE OPTIONS ###############################
###############################################################################
# PROCESS ARGUMENTS
AC_MSG_CHECKING([if debug is enabled])
if test "X$USE_DEBUG" = "Xyes"; then
AC_MSG_RESULT([yes])
CFLAGS="$CFLAGS -g"
else
AC_MSG_RESULT([no])
fi
############################ fortran enabled ##################################
# C enabled?
AC_MSG_CHECKING([if C interface enabled])
if test "X$USE_C" = "Xyes"; then
if test "X$ENABLE_C" = "Xyes"; then
AC_MSG_RESULT([yes])
BINDINGS="$BINDINGS C"
LIB_C="libH5hutC.a"
BUILD_LIBS="$BUILD_LIBS $LIB_C"
BUILD_TESTS="$BUILD_TESTS h5u_test h5b_test"
BUILD_TOOLS="$BUILD_TOOLS h5hutcc"
else
AC_MSG_RESULT([no])
fi
############################ fortran enabled ##################################
# fortran enabled?
AC_MSG_CHECKING([if fortran interface enabled])
if test "X$USE_FORTRAN" = "Xyes"; then
if test "X$ENABLE_FORTRAN" = "Xyes"; then
AC_MSG_RESULT([yes])
BINDINGS="$BINDINGS Fortran"
LIB_FORTRAN="libH5hutF.a"
BUILD_LIBS="$BUILD_LIBS $LIB_FORTRAN"
AC_PROG_FC(pgf90 ifort xlf_r pathf90 g95 g90 ftn gfortran)
if test -z "$FC" ; then
AC_MSG_ERROR([Cannot find a fortran compiler!!!])
exit 1
fi
if test ! $uname = "AIX"; then
FFLAGS="${FFLAGS} -fPIC"
fi
if test $FC = "g90"; then
FFLAGS="${FFLAGS} -fno-second-underscore"
fi
if test $FC = "g95"; then
FFLAGS="${FFLAGS} -fno-second-underscore"
fi
AC_MSG_CHECKING([symbol convention in object files])
`cd src/Fortran && rm -f TestUnderscore.o TestUnderscoreC.o TestUnderscore`
`cd src/Fortran && ${FC} ${FFLAGS} -c TestUnderscore.f`
`cd src/Fortran && ${CC} ${CFLAGS} -c TestUnderscoreC.c`
`cd src/Fortran && ${FC} ${FFLAGS} -o TestUnderscore TestUnderscore.o TestUnderscoreC.o`
if test -f src/Fortran/TestUnderscore ; then
UNDERSCORE_H=Underscore.h
`cd src/Fortran && ./TestUnderscore > Underscore.h`
AC_MSG_RESULT([ok])
AC_LANG_PUSH(Fortran)
FC=''
F77=''
F90=''
if test "X$ENABLE_PARALLEL" = "Xyes"; then
AC_PROG_FC(mpif90 mpif77)
else
AC_MSG_RESULT([nok])
AC_MSG_ERROR([Cannot build fortran executables!!!])
exit 1
AC_PROG_FC(pgf90 ifort xlf_r pathf90 g95 g90 ftn gfortran)
fi
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
AC_LANG_POP(Fortran)
else
AC_MSG_RESULT([no])
fi
# python enabled?
if test "X$ENABLE_PYTHON" = "Xyes"; then
AM_PATH_PYTHON([2.5])
AX_PKG_SWIG([1.3], [], [ AC_MSG_ERROR([SWIG is required to build..]) ])
#SWIG_ENABLE_CXX
#SWIG_PYTHON
PYTHON_PREFIX=`python-config --prefix`
PYTHON_EXEC_PREFIX=`python-config --exec-prefix`
# make sure numpy is available..
AC_MSG_CHECKING([for numpy support])
NUMPY_INCLUDE=`${PYTHON} -c 'import numpy; print numpy.get_include()'`
if test "X$?" = "X0" ; then
AC_MSG_RESULT([$NUMPY_INCLUDE])
else
AC_MSG_RESULT([no])
exit 1
fi
AC_SUBST([NUMPY_INCLUDE])
#check for parallel support
if test "X$ENABLE_PARALLEL" = "Xyes"; then
AC_MSG_CHECKING([for mpi4py support])
MPI4PY_INCLUDE=`${PYTHON} -c 'import mpi4py; print mpi4py.get_include()'`
if test "X$?" = "X0" ; then
AC_MSG_RESULT([$MPI4PY_INCLUDE])
else
AC_MSG_RESULT([no])
exit 1
fi
AC_SUBST([MPI4PY_INCLUDE])
fi
AC_MSG_RESULT([ok])
else
AC_MSG_CHECKING([if python interface is enabled])
AC_MSG_RESULT([no])
fi
######################## large indices enabled ###########################
AC_MSG_CHECKING([if large indices are enabled])
if test "X$USE_LARGE_INDICES" = "Xyes"; then
AC_MSG_RESULT([yes])
CFLAGS="${CFLAGS} -DUSE_LARGE_INDICES"
else
AC_MSG_RESULT([no])
fi
######################## parallel interface enabled ###########################
AC_MSG_CHECKING([if parallel interface enabled])
if test "X$USE_PARALLEL" = "Xyes"; then
if test "X$ENABLE_PARALLEL" = "Xyes"; then
AC_MSG_RESULT([yes])
CPPFLAGS="${CPPFLAGS} -DPARALLEL_IO -DMPICH_IGNORE_CXX_SEEK"
CFLAGS="${CFLAGS} -DPARALLEL_IO -DMPICH_IGNORE_CXX_SEEK"
if test "X$ENABLE_EXPERIMENTAL" = "Xyes"; then
CPPFLAGS="$CPPFLAGS -DWITH_PARALLEL_H5GRID"
AC_MSG_CHECKING([for ParMETIS])
if test "X$PARMETIS_PREFIX" != "X"; then
CPPFLAGS="$CPPFLAGS -I$PARMETIS_PREFIX/include"
LDFLAGS="$LDFLAGS -L$PARMETIS_PREFIX/lib"
fi
AC_MSG_CHECKING([if we can compile MPI code without setting flags])
AC_TRY_LINK([#include "mpi.h"], [
MPI_Comm comm;
int n;
MPI_Comm_size( comm, &n ); ],
[AC_MSG_RESULT([yes]); r='yes'], [AC_MSG_RESULT([no]); r='no'] )
if test "X$r" = "Xno"; then
AC_PATH_PROGS([MPICC], [mpicc mpcc_r], [], [$PATH])
AC_PATH_PROGS([MPICXX], [mpicxx mpcc_r], [], [$PATH])
if test -z "$MPICC" -o -z "$MPICXX"; then
AC_MSG_CHECKING([for MPI root ])
AC_MSG_RESULT([])
if test -n "$MPIROOT"; then
P=${MPIROOT}
elif test -n "$MPIHOME"; then
P=${MPIHOME}
elif test -n "$MPIPATH"; then
P=${MPIPATH}
else
P=''
P="$P /usr"
P="$P /usr/local"
P="$P /usr/local/mpi"
P="$P /usr/local/packages/mpi"
P="$P /usr/local/mpich2"
P="$P /usr/local/mpich"
P="$P /opt/xt-mpt/default/mpich2-64/P2"
fi
PATH_Search MPIROOT "$P" include/mpi.h
if test ! -n "$MPIROOT"; then
AC_MSG_ERROR([Cannot determine MPI root!!!])
exit 1
fi
if test -e "${MPIROOT}/bin/mpicc"; then
MPICC=${MPIROOT}/bin/mpicc
fi
if test -e "${MPIROOT}/bin/mpicxx"; then
MPICXX=${MPIROOT}/bin/mpicxx
fi
fi
if test -z "$MPICC" -o -z "$MPICXX"; then
INCLUDES="${INCLUDES} -I${MPIROOT}/include"
AC_MSG_CHECKING([for name of MPI lib ])
if test -e ${MPIROOT}/lib/libmpi.a; then
MPILIB="-L${MPIROOT}/lib -lmpi"
elif test -e ${MPIROOT}/lib/libmpi.so; then
MPILIB="-L${MPIROOT}/lib -lmpi"
elif test -e ${MPIROOT}/lib/libmpich.a; then
MPILIB="-L${MPIROOT}/lib -lmpich"
elif test -e ${MPIROOT}/lib/libmpich.so; then
MPILIB="-L${MPIROOT}/lib -lmpich"
else
AC_MSG_RESULT([not found])
exit 1
fi
AC_MSG_RESULT([${MPILIB}])
fi
if test -n "$MPICC"; then
CC=${MPICC}
fi
if test -n "$MPICXX"; then
CXX=${MPICXX}
fi
fi
TPTARGET="${TPTARGET} H5PartTestP H5PartAndreasTest Bench"
TBTARGET="${TBTARGET} H5BlockTestAttributes"
TBTARGET="${TBTARGET} H5BlockParTestScalarField"
# parallel + fortran
if test "X$USE_FORTRAN" = "Xyes"; then
AC_PATH_PROGS([MPIFC], [mpxlf_r mpif90], [], [$PATH])
if test -z "${MPIFC}" ; then
if test -e "${MPIROOT}/bin/mpif90"; then
MPIFC=${MPIROOT}/bin/mpif90
fi
fi
# if MPIFC empty
if test ! -n "$MPIFC"; then
AC_MSG_CHECKING([ No MPIFC detected. Setting MPIFC to FC.])
MPIFC=$FC
AC_MSG_RESULT([MPIFC = $MPIFC])
fi
if test -n "$MPIFC"; then
FC=${MPIFC}
fi
TPTARGET="${TPTARGET} H5testFpar"
TBTARGET="${TBTARGET} H5BlockParTestScalarFieldF"
fi
LIBS="$LIBS -lparmetis -lmetis"
AC_TRY_LINK([#include <parmetis.h>], [
ParMETIS_V3_PartGeom (NULL, NULL, NULL, NULL, NULL);],
[AC_MSG_RESULT([yes]); r='yes'], [AC_MSG_RESULT([no]); r='no'] )
if test "X$r" = "Xno"; then
AC_MSG_ERROR([ParMETIS])
exit 1
fi
fi
else # --enable-parallel=no
AC_MSG_RESULT([no])
TPTARGET="${TPTARGET} H5test"
TBTARGET="${TBTARGET} H5BlockTestAttributes"
if test "X$USE_FORTRAN" = "Xyes"; then
TPTARGET="${TPTARGET} H5testF"
TBTARGET="${TBTARGET} H5BlockTestAttributesF"
fi
fi
###############################################################################
######################### PATH CHECKING & SETTING #############################
###############################################################################
AC_MSG_CHECKING([for HDF5 root ])
AC_MSG_RESULT([])
if test -n "${HDF5ROOT}"; then
P=${HDF5ROOT}
elif test -n "${HDF5HOME}" ; then
P=${HDF5HOME}
elif test -n "${HDF5PATH}" ; then
P=${HDF5PATH}
else
P=''
P="$P /usr"
P="$P /usr/local"
P="$P /usr/local/hdf5"
P="$P /usr/local/packages/hdf5"
P="$P /apps/hdf5"
P="$P /opt/hdf5"
fi
PATH_Search HDF5ROOT "$P" include/hdf5.h
if test -z "$HDF5ROOT"; then
AC_MSG_ERROR([Cannot determine HDF5 root!!!])
exit 1
fi
INCLUDES="$INCLUDES -I$HDF5ROOT/include"
LDFLAGS="$LDFLAGS -L$HDF5ROOT/lib"
LIBS="$LIBS -lhdf5"
AC_MSG_CHECKING([if we need to link to libsz ])
if test -n "$HDF5ROOT"; then
if test -f $HDF5ROOT/lib/libsz.a; then
AC_MSG_RESULT([yes])
LDFLAGS="$LDFLAGS -L$HDF5ROOT/lib"
LIBS="$LIBS -lsz"
else
AC_MSG_RESULT([no])
# LIBRARY PATHS
if test -z "${HDF5_PREFIX}"; then
# alternatives to HDF5_PREFIX
if test -n "${HDF5_DIR}"; then
HDF5_PREFIX=${HDF5_DIR}
fi
fi
if test -n "${HDF5_PREFIX}"; then
CPPFLAGS="$CPPFLAGS -I$HDF5_PREFIX/include"
LDFLAGS="$LDFLAGS -L$HDF5_PREFIX/lib"
fi
AC_CHECK_LIB([z], [compress2])
AC_CHECK_LIB([hdf5], [H5open])
AS_IF([test "x$ac_cv_lib_hdf5_H5open" != xyes],
[AC_MSG_ERROR([Cannot compile and link a HDF5 program]);
exit 1])
AC_MSG_CHECKING([for lustre API ])
AC_MSG_RESULT([])
if test -n "${LUSTREPATH}"; then
P=${LUSTREPATH}
elif test -n "${LUSTREROOT}" ; then
P=${LUSTREROOT}
elif test -n "${LUSTREHOME}" ; then
P=${LUSTREHOME}
elif test -n "${LUSTRE_DIR}" ; then
P=${LUSTRE_DIR}
else
@@ -426,119 +414,90 @@ if test -z "$LUSTREROOT"; then
AC_MSG_WARN([Couldn't locate the lustre API... building without support for lustre striping!])
else
CFLAGS="$CFLAGS -DH5_USE_LUSTRE"
INCLUDES="$INCLUDES -I$LUSTREROOT/usr/include"
CPPFLAGS="$CPPFLAGS -I$LUSTREROOT/usr/include"
LDFLAGS="$LDFLAGS -L$LUSTREROOT/usr/lib"
LIBS="$LIBS -llustreapi"
fi
LIBS="$LIBS -lz -lm"
LIBS="$LIBS -lm"
###############################################################################
################# A SIMPLE WORK AROUND TO USE ENV. VARS #######################
###############################################################################
#if there was an external input for the variable...
if test -n "$SAVE_CC"; then
CC="$SAVE_CC"
fi
if test -n "$SAVE_CXX"; then
CXX="$SAVE_CXX"
fi
if test -n "$SAVE_MPICC"; then
MPICC="$SAVE_MPICC"
fi
if test -n "$SAVE_MPICXX"; then
MPICXX="$SAVE_MPICXX"
fi
if test -n "$SAVE_MPIFC"; then
MPIFC="$SAVE_MPIFC"
fi
if test -n "$SAVE_MPIROOT"; then
MPIROOT="$SAVE_MPIROOT"
fi
if test -n "$SAVE_HDF5ROOT"; then
HDF5ROOT="$SAVE_HDF5ROOT"
# TOOLS
AC_MSG_CHECKING([if we have to compile the VTK to H5hut grid converter])
if test "X$ENABLE_VTKCONVERTER" = "Xyes"; then
AC_MSG_RESULT([yes])
# :TODO: add test whether we can compile/link a prog with vtk
else
AC_MSG_RESULT([no])
fi
###############################################################################
############## EXPORTING VARIABLES & CREATING OUTPUT FILES ####################
# 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
###############################################################################
# AC_SUBST (variable, [value])
# Create an output variable from a shell variable. Make AC_OUTPUT substitute
# the variable variable into output files (typically one or more `Makefile's).
# This means that AC_OUTPUT will replace instances of `@variable@' in input
# files with the value that the shell variable variable has when AC_OUTPUT is
# called. This value of variable should not contain literal newlines. If
# value is given, in addition assign it to variable.
AC_SUBST(MPIROOT)
AC_SUBST(HDF5ROOT)
AC_SUBST(LUSTREROOT)
AC_SUBST(MPICC)
AC_SUBST(MPICXX)
AC_SUBST(MPIFC)
AC_SUBST(TPTARGET)
AC_SUBST(TBTARGET)
AC_SUBST(TFTARGET)
# EXPORTING VARIABLES & CREATING OUTPUT FILES
AM_CPPFLAGS=$CPPFLAGS
AM_LDFLAGS=$LDFLAGS
AC_SUBST(HDF5_PREFIX)
AC_SUBST(CFLAGS)
AC_SUBST(FFLAGS)
AC_SUBST(INCLUDES)
AC_SUBST(LDFLAGS)
AC_SUBST(LIBS)
AC_SUBST(UNDERSCORE_H)
AC_SUBST(LIB_C)
AC_SUBST(LIB_FORTRAN)
AC_SUBST(BINDINGS)
AC_SUBST(BUILD_TESTS)
AC_SUBST(BUILD_TOOLS)
AC_SUBST(AM_CPPFLAGS)
AC_SUBST(AM_LDFLAGS)
# Make AC_OUTPUT create each `file' by copying an input file (by default `file.in'),
# substituting the output variable values.
AC_CONFIG_FILES([
Makefile
src/Makefile
src/C/Makefile
src/h5core/Makefile
src/include/Makefile
src/include/h5core/Makefile
src/C/Makefile
src/Fortran/Makefile
src/Python/Makefile
test/Makefile
test/H5Fed/Makefile
test/H5Part/Makefile
doc/Makefile
tools/Makefile
tools/h5hutcc
tools/vtk2h5grid/Makefile
examples/H5/Makefile
examples/H5Part/Makefile
examples/H5Block/Makefile
examples/H5Fed/Makefile
])
AC_OUTPUT
###############################################################################
########################## PRINTING SUMMARY ###################################
###############################################################################
# PRINTING SUMMARY
AC_MSG_RESULT([ ])
AC_MSG_RESULT([Summary:])
AC_MSG_RESULT([ ])
AC_MSG_RESULT([Host OS: $host_os])
AC_MSG_RESULT([Host CPU: $host_cpu])
AC_MSG_RESULT([Host vendor: $host_vendor])
AC_MSG_RESULT([Build libraries: $BUILD_LIBS])
AC_MSG_RESULT([Build test programs: $TTARGET])
AC_MSG_RESULT([Build tools: $BUILD_TOOLS])
AC_MSG_RESULT([CC = $CC])
AC_MSG_RESULT([CXX = $CXX])
AC_MSG_RESULT([FC = $FC])
AC_MSG_RESULT([MPICC = $MPICC])
AC_MSG_RESULT([MPICXX = $MPICXX])
AC_MSG_RESULT([MPIFC = $MPIFC])
AC_MSG_RESULT([CFLAGS = $CFLAGS])
AC_MSG_RESULT([FFLAGS = $FFLAGS])
AC_MSG_RESULT([INCLUDES = $INCLUDES])
AC_MSG_RESULT([LDFLAGS = $LDFLAGS])
AC_MSG_RESULT([AM_CPPFLAGS = $AM_CPPFLAGS])
AC_MSG_RESULT([AM_LDFLAGS = $AM_LDFLAGS])
AC_MSG_RESULT([LIBS = $LIBS])
AC_MSG_RESULT([MPIROOT = $MPIROOT])
AC_MSG_RESULT([HDF5ROOT = $HDF5ROOT])
AC_MSG_RESULT([HDF5_PREFIX = $HDF5_PREFIX])
AC_MSG_RESULT([LUSTREROOT = $LUSTREROOT])
if test "x$ENABLE_PYTHON" = "xyes"; then
AC_MSG_RESULT([PYTHON = $PYTHON])
AC_MSG_RESULT([SWIG = $SWIG])
AC_MSG_RESULT([NUMPY_INCLUDE = $NUMPY_INCLUDE])
if test "x$ENABLE_PARALLEL" = "xyes"; then
AC_MSG_RESULT([MPI4PY_INCLUDE = $MPI4PY_INCLUDE])
fi
fi
AC_MSG_RESULT([ ])
+2303 -143
View File
File diff suppressed because it is too large Load Diff
+136 -104
View File
@@ -16,7 +16,6 @@ Developers:
<UL>
<LI> Andreas Adelmann (PSI) </LI>
<LI> Achim Gsell (PSI) </LI>
<LI> Benedikt Oswald (PSI) </LI>
<LI> Mark Howison (NERSC/LBNL) </LI>
<LI> Prabhat (NERSC/LBNL) </LI>
<LI> Wes Bethel (NERSC/LBNL) </LI>
@@ -25,115 +24,148 @@ Developers:
Previous developers:
<UL>
<LI> John Shalf (NERSC/LBNL)</LI>
<LI> Benedikt Oswald (PSI) </LI>
<LI> Cristina Siegerist (NERSC/LBNL)</LI>
<LI> John Shalf (NERSC/LBNL)</LI>
</UL>
For more information, please contact the <a href="mailto:h5part@lists.psi.ch">h5part</a> mailing list.
For more information, please contact the
<a href="mailto:h5part@lists.psi.ch">h5part</a> mailing list.
\defgroup c_api C API
@{
\note The C API is implemented with '\c static \c inline' functions to minimize overhead.
\defgroup h5_c_api H5
@{
\defgroup h5_file File interface
In this section we document the interface for accessing H5hut files.
\defgroup h5_model Setting up the data model
The fundamental data model of H5hut is pretty simple. There
are (time-)steps to group data, that's it. In this section we
document the interface to these (time-)steps.
\defgroup h5_file_attribs File attributes interface
File attributes are small datasets that can be used to
describe specific properties of a file. The H5hut API provides
functions to attach (write), read and inquire file attributes.
\defgroup h5_step_attribs Step attributes interface
Step attributes are similar to file attributes but are
attached to (time-)steps. They can be used to describe
specific properties of a specific step. The H5hut API provides
functions to attach (write), read and inquire step attributes.
\defgroup h5_attach Attaching files
Sometimes it is required (or at least useful) to attach
additional information to H5hut files. H5hut provides
functions to attach other files to H5hut files. The attached
files can be of any type.
\defgroup h5_log Controlling verbosity level
Controlling the verbosity level of H5hut. By default only
error messages are printed. For debugging it might be helpful
to increase the verbosity level.
\defgroup h5_debug Controlling debug output
Debug output mainly intended for developers.
\defgroup h5_error Error handling interface
H5hut comes with two error handler. The default error handler
prints an error message (which can be suppressed by setting
the verbosity level to \c 0), sets an internal error number
and returns to the calling program with the value \c
H5_FAILURE. It is up to the programmer to handle the error
properly. In certain use-cases it make sense just to abort the
program, so no additional error handling is needed. H5hut
provides an abort error-handler for this use-cases-
@}
\defgroup h5part_c_api H5Part
@{
\defgroup h5part_model Setting up the data model
The H5Part data model interface provides functions to set and
inquire (per core) views on datasets.
\defgroup h5part_io Dataset interface
The dataset interface provides functions to read and write
datasets. The following data types are supported:
- 64-bit floating point numbers (\c h5_float64_t)
- 32-bit floating point numbers (\c h5_float32_t)
- 64-bit integers (\c h5_int64_t)
- 32-bit integers (\c h5_int32_t)
\note Before you can write or read a dataset, you have to
define a "view" on the dataset for each core.
@}
\defgroup h5block_c_api H5Block
@{
\defgroup h5block_model Setting up the data model
The H5Block data model interface provides functions to set and
inquire (per core) views on fields.
\defgroup h5block_io Interface to block structured data
H5Block provides functions to store and retrieve
- 3-dimensional fields with scalar values
- 3-dimensional fields with 3-dimensional vectors as values
The following datatypes are supported:
- 64-bit floating point numbers (\c h5_float64_t)
- 32-bit floating point numbers (\c h5_float32_t)
- 64-bit integers (\c h5_int64_t)
- 32-bit integers (\c h5_int32_t)
\defgroup h5block_attrib Attaching attributes to field data
Field attributes are small datasets that can be used to
describe specific properties of a field like origin, spacing
or coordinates. The H5hut API provides functions to attach
(write), read and inquire file attributes.
@}
@}
*/
/*!
\defgroup h5hut_c_api H5hut C API
*/
/*!
\ingroup h5hut_c_api
\defgroup h5hut_file File Handling
*/
/*!
\ingroup h5hut_c_api
\defgroup h5hut_error Error Handling
*/
/*!
\ingroup h5hut_c_api
\defgroup h5hut_model Setting up the Data Model
*/
/*!
\ingroup h5hut_c_api
\defgroup h5hut_attrib Reading and Writing Attributes
*/
/*!
\defgroup h5part_c_api H5Part C API
*/
/*!
\ingroup h5part_c_api
\defgroup h5part_model Setting up the Data Model
*/
/*!
\ingroup h5part_c_api
\defgroup h5part_data Reading and Writing Datasets
*/
/*!
\defgroup h5block_c_api H5Block C API
*/
*/!
\ingroup h5block_c_api
\defgroup h5block_model Setting up the Data Model
*/
\ingroup h5block_c_api
\defgroup h5block_data Reading and Writing Datasets
*/
\ingroup h5block_c_api
\defgroup h5block_attrib Reading and Writing Attributes
*/
/*!
\defgroup h5fed_c_api H5Fed C API
*/
/*!
\defgroup h5hut_f90_api H5hut F90 API
*/
/*!
\ingroup h5hut_f90_api
\defgroup h5hut_file_f File Handling
*/
/*!
\ingroup h5hut_f90_api
\defgroup h5hut_model_f Setting up the Data Model
*/
/*!
\ingroup h5hut_f90_api
\defgroup h5hut_attrib_f Reading and Writing Attributes
!<
/*!
\defgroup h5part_f90_api H5Part F90 API
*/
/*!
\ingroup h5part_f90_api
\defgroup h5part_model_f Setting up the Data Model
*/
/*!
\ingroup h5part_f90_api
\defgroup h5part_data_f Reading and Writing Datasets
*/
/*!
\defgroup h5block_f90_api H5Block F90 API
*/
/*!
\ingroup h5block_f90_api
\defgroup h5block_model_f Setting up the Data Model
*/
/*!
\ingroup h5block_f90_api
\defgroup h5block_data_f Reading and Writing Datasets
*/
/*!
\ingroup h5block_f90_api
\defgroup h5block_attrib_f Reading and Writing Attributes
\defgroup f90_api Fortran90 API
@{
\defgroup h5_f90_api H5
@{
\defgroup h5_file_f file interface
\defgroup h5_model_f setting up the data model
\defgroup h5_file_attribs_f reading and writing file attributes
\defgroup h5_step_attribs_f reading and writing step attributes
\defgroup h5_log_f control verbosity level
\defgroup h5_debug_f control debug output
\defgroup h5_error_f error handling interface
@}
\defgroup h5part_f90_api H5Part
@{
\defgroup h5part_model_f setting up the data model
\defgroup h5part_io_f reading and writing datasets
@}
\defgroup h5block_f90_api H5Block
@{
\defgroup h5block_model_f setting up the data model
\defgroup h5block_io_f reading and writing datasets
\defgroup h5block_attrib_f reading and writing attributes
@}
@}
*/
+3 -2
View File
@@ -9,5 +9,6 @@ doc:
doxydoc:
doxygen
clean:
${RM} -rf ReferencePages TWiki
clean-local:
$(RM) -r ReferencePages TWiki
$(RM) *~
+2
View File
@@ -0,0 +1,2 @@
+4
View File
@@ -0,0 +1,4 @@
<style type="text/css">
h1 { text-align: center; }
</style>
+39
View File
@@ -0,0 +1,39 @@
#!/usr/bin/env python
from lxml import etree
from lxml.html import builder as E
import os
import re
tree = etree.parse('tagfile')
tags = tree.xpath ('//member[@kind="function"]')
tags_per_files = {}
for tag in tags:
name = tag.find("name").text
anchor = tag.find("anchor").text
anchorfile = tag.find("anchorfile").text
if anchorfile in tags_per_files:
tags_per_files[anchorfile].append([name, anchor])
else:
tags_per_files[anchorfile] = [[name, anchor]]
prefix = None
for line in open("Doxyfile", "r"):
if re.search ("^OUTPUT_DIRECTORY", line):
prefix = line.split("=")[-1].strip()
if not prefix:
prefix = "."
parser = etree.HTMLParser()
for filename,anchors in tags_per_files.items():
print "Processing file: %s/%s" % (prefix, filename)
tree = etree.parse ("%s/%s" % (prefix, filename), parser)
for name,id in anchors:
anchor = tree.xpath ('//a[@id="%s"]' % id)
el = E.A(id="%s" % name)
anchor[0].addnext (el)
f = open ("%s/%s" % (prefix, filename), "w")
f.write (etree.tostring (tree))
+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
+55
View File
@@ -0,0 +1,55 @@
#
# Copyright (c) 2006-2015, The Regents of the University of California,
# through Lawrence Berkeley National Laboratory (subject to receipt of any
# required approvals from the U.S. Dept. of Energy) and the Paul Scherrer
# Institut (Switzerland). All rights reserved.!
#
# License: see file COPYING in top level of source distribution.
#
AM_CPPFLAGS += -I${abs_top_srcdir}/src/include
FFLAGS += -cpp $(AM_CPPFLAGS)
AM_LDFLAGS += -L${abs_top_builddir}/src/h5core/.libs
LDADD =
if ENABLE_EXAMPLES
if ENABLE_FORTRAN
LDADD += -lH5hutF
AM_LDFLAGS += -L${abs_top_builddir}/src/Fortran/.libs
endif
LDADD += -lH5hut
noinst_PROGRAMS =
if ENABLE_C
noinst_PROGRAMS += \
attach_field_attributes \
dump_field_attributes \
fields \
has_field \
read_write_scalar_field \
write_field
endif
if ENABLE_FORTRAN
if ENABLE_PARALLEL
noinst_PROGRAMS += read_write_scalar_fieldf
endif
endif
attach_field_attributes_SOURCES = attach_field_attributes.c
dump_field_attributes_SOURCES = dump_field_attributes.c
fields_SOURCES = fields.c
has_field_SOURCES = has_field.c
read_write_scalar_field_SOURCES = read_write_scalar_field.c
read_write_scalar_fieldf_SOURCES = read_write_scalar_fieldf.f90
write_field_SOURCES = write_field.c
endif
%.o : %.f90
$(FC) $(FFLAGS) -c $<
clean-local:
$(RM) *~
@@ -0,0 +1,66 @@
/*
Copyright (c) 2006-2015, The Regents of the University of California,
through Lawrence Berkeley National Laboratory (subject to receipt of any
required approvals from the U.S. Dept. of Energy) and the Paul Scherrer
Institut (Switzerland). All rights reserved.
License: see file COPYING in top level of source distribution.
*/
#include "H5hut.h"
// name of output file
const char* fname = "example_field.h5";
// H5hut verbosity level
const h5_int64_t h5_verbosity = H5_VERBOSE_DEFAULT;
int
main (
int argc,
char* argv[]
){
// initialize MPI & H5hut
MPI_Init (&argc, &argv);
MPI_Comm comm = MPI_COMM_WORLD;
int comm_size = 1;
MPI_Comm_size (comm, &comm_size);
int comm_rank = 0;
MPI_Comm_rank (comm, &comm_rank);
H5AbortOnError ();
H5SetVerbosityLevel (h5_verbosity);
//H5SetDebugMask (-1);
// open file and create first step
h5_file_t file = H5OpenFile (fname, H5_O_RDWR, H5_PROP_DEFAULT);
H5SetStep (file, 0);
if (!H5BlockHasField (file, "data")) {
printf ("Doesn't have field data with name 'data' in step#0\n");
goto done;
}
h5_int32_t attrib[1] = { 42 };
H5BlockWriteFieldAttribInt32 (
file,
"data",
"The answer",
attrib,
sizeof (attrib) / sizeof (*attrib));
h5_float64_t origin[3] = { 0.0, 0.0, 1.0 };
H5Block3dSetFieldOrigin (
file,
"data",
origin[0], origin[1], origin[2]);
h5_float64_t spacing[3] = { 1.0, 2.0, 3.0 };
H5Block3dSetFieldSpacing (
file,
"data",
spacing[0], spacing[1], spacing[2]);
done:
// done
H5CloseFile(file);
MPI_Finalize ();
return 0;
}
+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;
}
+60
View File
@@ -0,0 +1,60 @@
#
# 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_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 \
tetmesh_write2 \
tetmesh_read \
tetmesh_adjacencies \
tetmesh_write_tags \
tetmesh_read_tags \
trimesh_read \
trimesh_write \
trimesh_2gnuplot \
trimesh_adjacencies \
trimesh_write_dunetest
# map_tet2globalid \
# map_triangle2globalid
# Extra files that I wish to include in the dist tar ball.
EXTRA_DIST = \
tetmesh_adjacencies.c \
tetmesh_read.c \
tetmesh_read_tags.c \
tetmesh_write.c \
tetmesh_write1.c \
tetmesh_write2.c \
tetmesh_write_tags.c \
trimesh_adjacencies.c \
trimesh_read.c \
trimesh_write.c \
trimesh_2gnuplot.c \
trimesh_write_dunetest.c
# map_tet2globalid.c \
# map_triangle2globalid.c \
# $(bin_SCRIPTS)
endif
clean-local:
$(RM) *.h5 *~
+563
View File
@@ -0,0 +1,563 @@
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include "H5hut.h"
const char* FNAME = "simple_tet.h5";
typedef struct timer {
clock_t _start;
clock_t _end;
clock_t _elapsed;
struct timer* (*new)(void);
void (*delete)(struct timer*);
void (*start)(struct timer*);
void (*stop)(struct timer*);
void (*reset)(struct timer*);
double (*elapsed)(struct timer*);
} Timer;
extern Timer Timer_;
static Timer*
new (
void
) {
Timer* this = (Timer*)malloc (sizeof (Timer));
*this = Timer_;
return this;
}
static void
delete (Timer* this) {
free (this);
}
static void
start (Timer* this) {
this->_start = clock();
}
static void
stop (Timer* this) {
this->_end = clock();
this->_elapsed += this->_end - this->_start;
this->_start = this->_end;
}
static void
reset (Timer* this) {
this->_start = this->_end = this->_elapsed = 0;
}
static double
elapsed (Timer* this) {
return (double)(this->_elapsed)/CLOCKS_PER_SEC;
}
Timer Timer_ = {
0,
0,
0,
new,
delete,
start,
stop,
reset,
elapsed
};
static h5_err_t
print_adjacencies_of_vertex (
h5t_mesh_t* const m,
h5_loc_id_t local_id,
int dumpit,
Timer* timer
) {
h5_loc_idlist_t* uadj_edges;
h5_loc_idlist_t* uadj_triangles;
h5_loc_idlist_t* uadj_tets;
timer->reset(timer);
timer->start(timer);
H5FedGetAdjacencies (m, local_id, 1, &uadj_edges);
H5FedGetAdjacencies (m, local_id, 2, &uadj_triangles);
H5FedGetAdjacencies (m, local_id, 3, &uadj_tets);
timer->stop(timer);
int n = uadj_tets->num_items;
if (uadj_triangles->num_items > n) n = uadj_triangles->num_items;
if (uadj_edges->num_items > n) n = uadj_edges->num_items;
if (dumpit) {
for (int i = 0; i < n; i++) {
char v[256];
char k[256];
char d[256];
char t[256];
h5_loc_id_t local_vids[4];
if (i == 0) {
H5FedGetVertexIndicesOfEntity (
m, local_id, local_vids);
snprintf (v, sizeof(v), "=[%lld]=",
(long long)local_vids[0]);
} else {
*v = '\0';
}
if (i < uadj_edges->num_items) {
H5FedGetVertexIndicesOfEntity (
m, uadj_edges->items[i], local_vids);
snprintf (k, sizeof(k), "=[%lld,%lld]=",
(long long)local_vids[0],
(long long)local_vids[1]);
} else {
*k = '\0';
}
if (i < uadj_triangles->num_items) {
H5FedGetVertexIndicesOfEntity (
m, uadj_triangles->items[i], local_vids);
snprintf (d, sizeof(d), "=[%lld,%lld,%lld]=",
(long long)local_vids[0],
(long long)local_vids[1],
(long long)local_vids[2]);
} else {
*d = '\0';
}
if (i < uadj_tets->num_items) {
H5FedGetVertexIndicesOfEntity (
m, uadj_tets->items[i], local_vids);
snprintf (t, sizeof(t), "=[%lld,%lld,%lld,%lld]=",
(long long)local_vids[0],
(long long)local_vids[1],
(long long)local_vids[2],
(long long)local_vids[3]);
} else {
*t = '\0';
}
printf ("| %-18s | %-18s | %-18s | %-18s |\n", v, k, d, t);
}
}
H5FedReleaseListOfAdjacencies (m, &uadj_edges);
H5FedReleaseListOfAdjacencies (m, &uadj_triangles);
H5FedReleaseListOfAdjacencies (m, &uadj_tets);
return H5_SUCCESS;
}
static h5_err_t
print_adjacencies_of_edge (
h5t_mesh_t* const m,
h5_loc_id_t local_id,
int dumpit,
Timer* timer
) {
h5_loc_idlist_t* dadj_vertices;
h5_loc_idlist_t* uadj_triangles;
h5_loc_idlist_t* uadj_tets;
timer->reset(timer);
timer->start(timer);
H5FedGetAdjacencies (m, local_id, 0, &dadj_vertices);
H5FedGetAdjacencies (m, local_id, 2, &uadj_triangles);
H5FedGetAdjacencies (m, local_id, 3, &uadj_tets);
timer->stop(timer);
int n = dadj_vertices->num_items;
if (uadj_triangles->num_items > n) n = uadj_triangles->num_items;
if (uadj_tets->num_items > n) n = uadj_tets->num_items;
if (dumpit) {
for (int i = 0; i < n; i++) {
char v[256];
char k[256];
char d[256];
char t[256];
h5_loc_id_t local_vids[4];
if (i < dadj_vertices->num_items) {
H5FedGetVertexIndicesOfEntity (
m, dadj_vertices->items[i], local_vids);
snprintf (v, sizeof(v), "=[%lld]=",
(long long)local_vids[0]);
} else {
*v = '\0';
}
if (i == 0) {
H5FedGetVertexIndicesOfEntity (
m, local_id, local_vids);
snprintf (k, sizeof(k), "=[%lld,%lld]=",
(long long)local_vids[0],
(long long)local_vids[1]);
} else {
*k = '\0';
}
if (i < uadj_triangles->num_items) {
H5FedGetVertexIndicesOfEntity (
m, uadj_triangles->items[i], local_vids);
snprintf (d, sizeof(d), "=[%lld,%lld,%lld]=",
(long long)local_vids[0],
(long long)local_vids[1],
(long long)local_vids[2]);
} else {
*d = '\0';
}
if (i < uadj_tets->num_items) {
H5FedGetVertexIndicesOfEntity (
m, uadj_tets->items[i], local_vids);
snprintf (t, sizeof(t), "=[%lld,%lld,%lld,%lld]=",
(long long)local_vids[0],
(long long)local_vids[1],
(long long)local_vids[2],
(long long)local_vids[3]);
} else {
*t = '\0';
}
printf ("| %-18s | %-18s | %-18s | %-18s |\n", v, k, d, t);
}
}
H5FedReleaseListOfAdjacencies (m, &dadj_vertices);
H5FedReleaseListOfAdjacencies (m, &uadj_triangles);
H5FedReleaseListOfAdjacencies (m, &uadj_tets);
return H5_SUCCESS;
}
static h5_err_t
print_adjacencies_of_triangle (
h5t_mesh_t* const m,
h5_loc_id_t local_id,
int dumpit,
Timer* timer
) {
h5_loc_idlist_t* dadj_vertices;
h5_loc_idlist_t* dadj_edges;
h5_loc_idlist_t* uadj_tets;
timer->reset(timer);
timer->start(timer);
H5FedGetAdjacencies (m, local_id, 0, &dadj_vertices);
H5FedGetAdjacencies (m, local_id, 1, &dadj_edges);
H5FedGetAdjacencies (m, local_id, 3, &uadj_tets);
timer->stop(timer);
int n = dadj_vertices->num_items;
if (dadj_edges->num_items > n) n = dadj_edges->num_items;
if (uadj_tets->num_items > n) n = uadj_tets->num_items;
if (dumpit) {
for (int i = 0; i < n; i++) {
char v[256];
char k[256];
char d[256];
char t[256];
h5_loc_id_t local_vids[4];
if (i < dadj_vertices->num_items) {
H5FedGetVertexIndicesOfEntity (
m, dadj_vertices->items[i], local_vids);
snprintf (v, sizeof(v), "=[%lld]=",
(long long)local_vids[0]);
} else {
*v = '\0';
}
if (i < dadj_edges->num_items) {
H5FedGetVertexIndicesOfEntity (
m, dadj_edges->items[i], local_vids);
snprintf (k, sizeof(k), "=[%lld,%lld]=",
(long long)local_vids[0],
(long long)local_vids[1]);
} else {
*k = '\0';
}
if (i == 0) {
H5FedGetVertexIndicesOfEntity (
m, local_id, local_vids);
snprintf (d, sizeof(k), "=[%lld,%lld,%lld]=",
(long long)local_vids[0],
(long long)local_vids[1],
(long long)local_vids[2]);
} else {
*d = '\0';
}
if (i < uadj_tets->num_items) {
H5FedGetVertexIndicesOfEntity (
m, uadj_tets->items[i], local_vids);
snprintf (t, sizeof(t), "=[%lld,%lld,%lld,%lld]=",
(long long)local_vids[0],
(long long)local_vids[1],
(long long)local_vids[2],
(long long)local_vids[3]);
} else {
*t = '\0';
}
printf ( "| %-18s | %-18s | %-18s | %-18s |\n", v, k, d, t );
}
}
H5FedReleaseListOfAdjacencies (m, &dadj_vertices);
H5FedReleaseListOfAdjacencies (m, &dadj_edges);
H5FedReleaseListOfAdjacencies (m, &uadj_tets);
return H5_SUCCESS;
}
static h5_err_t
print_adjacencies_of_tet (
h5t_mesh_t* const m,
h5_loc_id_t local_id,
int dumpit,
Timer* timer
) {
h5_loc_idlist_t* dadj_vertices;
h5_loc_idlist_t* dadj_edges;
h5_loc_idlist_t* dadj_triangles;
timer->reset(timer);
timer->start(timer);
H5FedGetAdjacencies (m, local_id, 0, &dadj_vertices);
H5FedGetAdjacencies (m, local_id, 1, &dadj_edges);
H5FedGetAdjacencies (m, local_id, 2, &dadj_triangles);
timer->stop(timer);
int n = dadj_vertices->num_items;
if (dadj_edges->num_items > n) n = dadj_edges->num_items;
if (dadj_triangles->num_items > n) n = dadj_triangles->num_items;
if (dumpit) {
for (int i = 0; i < n; i++) {
char v[256];
char k[256];
char d[256];
char t[256];
h5_loc_id_t local_vids[4];
if (i < dadj_vertices->num_items) {
H5FedGetVertexIndicesOfEntity (
m, dadj_vertices->items[i], local_vids);
snprintf (v, sizeof(v), "=[%lld]=",
(long long)local_vids[0]);
} else {
*v = '\0';
}
if (i < dadj_edges->num_items) {
H5FedGetVertexIndicesOfEntity (
m, dadj_edges->items[i], local_vids);
snprintf (k, sizeof(k), "=[%lld,%lld]=",
(long long)local_vids[0],
(long long)local_vids[1]);
} else {
*k = '\0';
}
if (i < dadj_triangles->num_items) {
H5FedGetVertexIndicesOfEntity (
m, dadj_triangles->items[i], local_vids);
snprintf (d, sizeof(d), "=[%lld,%lld,%lld]=",
(long long)local_vids[0],
(long long)local_vids[1],
(long long)local_vids[2]);
} else {
*d = '\0';
}
if (i == 0) {
H5FedGetVertexIndicesOfEntity (
m, local_id, local_vids);
snprintf (d, sizeof(k), "=[%lld,%lld,%lld,%lld]=",
(long long)local_vids[0],
(long long)local_vids[1],
(long long)local_vids[2],
(long long)local_vids[2]);
} else {
*t = '\0';
}
printf ("| %-18s | %-18s | %-18s | %-18s |\n", v, k, d, t);
}
}
H5FedReleaseListOfAdjacencies (m, &dadj_vertices);
H5FedReleaseListOfAdjacencies (m, &dadj_edges);
H5FedReleaseListOfAdjacencies (m, &dadj_triangles);
return H5_SUCCESS;
}
static h5_err_t
traverse_vertices (
h5t_mesh_t* const m,
int dumpit,
Timer* timer
) {
h5_loc_id_t local_id;
h5_loc_idx_t num = 0;
double t_total = 0.0;
double t_min = CLOCKS_PER_SEC;
double t_max = 0.0;
double t = 0.0;
printf ("\nAdjacencies to vertices\n");
h5t_iterator_t* iter = H5FedBeginTraverseEntities (m, 3);
while ((local_id = H5FedTraverseEntities (iter)) >= 0) {
print_adjacencies_of_vertex (m, local_id, dumpit, timer);
num++;
t = timer->elapsed(timer);
t_total += t;
if (t < t_min) t_min = t;
if (t > t_max) t_max = t;
}
fprintf (
stderr,
"%lld\ttotal: %f\tmin: %f\tavg: %f\tmax: %f\n",
(long long)num,
t_total,
t_min,
t_total / (double)num,
t_max);
return H5FedEndTraverseEntities (iter);
}
static h5_err_t
traverse_edges (
h5t_mesh_t* const m,
int dumpit,
Timer* timer
) {
h5_loc_id_t local_id;
h5_loc_idx_t num = 0;
double t_total = 0.0;
double t_min = CLOCKS_PER_SEC;
double t_max = 0.0;
double t = 0.0;
printf ("\nAdjacencies to edges\n");
h5t_iterator_t* iter = H5FedBeginTraverseEntities (m, 2);
while ((local_id = H5FedTraverseEntities (iter)) >= 0) {
print_adjacencies_of_edge (m, local_id, dumpit, timer);
num++;
t = timer->elapsed(timer);
t_total += t;
if (t < t_min) t_min = t;
if (t > t_max) t_max = t;
}
fprintf (
stderr,
"%lld\ttotal: %f\tmin: %f\tavg: %f\tmax: %f\n",
(long long)num,
t_total,
t_min,
t_total / (double)num,
t_max);
return H5FedEndTraverseEntities (iter);
}
static h5_err_t
traverse_triangles (
h5t_mesh_t* const m,
int dumpit,
Timer* timer
) {
h5_loc_id_t local_id;
h5_loc_idx_t num = 0;
double t_min = CLOCKS_PER_SEC;
double t_max = 0.0;
double t_total = 0.0;
double t = 0.0;
printf ("\nAdjacencies to triangle\n");
h5t_iterator_t* iter = H5FedBeginTraverseEntities (m, 1);
while ((local_id = H5FedTraverseEntities (iter)) >= 0) {
print_adjacencies_of_triangle (m, local_id, dumpit, timer);
num++;
t = timer->elapsed(timer);
t_total += t;
if (t < t_min) t_min = t;
if (t > t_max) t_max = t;
}
fprintf (
stderr,
"%lld\ttotal: %f\tmin: %f\tavg: %f\tmax: %f\n",
(long long)num,
t_total,
t_min,
t_total / (double)num,
t_max);
return H5FedEndTraverseEntities (iter);
}
static h5_err_t
traverse_elems (
h5t_mesh_t* const m,
int dumpit,
Timer* timer
) {
h5_loc_id_t local_id;
h5_loc_idx_t num = 0;
double t_total = 0.0;
double t_min = CLOCKS_PER_SEC;
double t_max = 0.0;
double t = 0.0;
printf ("\nAdjacencies to tetrahedra\n");
h5t_iterator_t* iter = H5FedBeginTraverseEntities (m, 0);
while ((local_id = H5FedTraverseEntities (iter)) >= 0) {
print_adjacencies_of_tet (m, local_id, dumpit, timer);
num++;
t = timer->elapsed(timer);
t_total += t;
if (t < t_min) t_min = t;
if (t > t_max) t_max = t;
}
fprintf (
stderr,
"%lld\ttotal: %f\tmin: %f\tavg: %f\tmax: %f\n",
(long long)num,
t_total,
t_min,
t_total / (double)num,
t_max);
return H5FedEndTraverseEntities (iter);
}
static h5_err_t
traverse_level (
h5t_mesh_t* const m,
const h5_lvl_idx_t level_id,
int dumpit,
Timer* timer
) {
printf (" Setting level to %d\n", level_id);
H5FedSetLevel (m, level_id);
traverse_vertices (m, dumpit, timer);
traverse_edges (m, dumpit, timer);
traverse_triangles (m, dumpit, timer);
traverse_elems (m, dumpit, timer);
return H5_SUCCESS;
}
static h5_err_t
traverse_mesh (
h5_file_t const f,
const h5_id_t mesh_id
) {
h5t_mesh_t* mesh;
int dumpit = 0;
Timer* timer = Timer_.new();
/* open mesh and get number of levels */
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 */
h5_lvl_idx_t level_id;
for (level_id = 0; level_id < num_levels; level_id++) {
traverse_level (mesh, level_id, dumpit, timer);
}
/* done */
H5FedCloseMesh (mesh);
timer->delete(timer);
return H5_SUCCESS;
}
int
main (
int argc,
char* argv[]
) {
/* abort program on error, so we don't have to handle them */
H5SetErrorHandler (H5AbortErrorhandler);
//H5SetVerbosityLevel (H5_DEBUG_ALL);
H5SetVerbosityLevel (0);
/* open file and get number of meshes */
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);
/* loop over all meshes */
h5_id_t mesh_id;
for (mesh_id = 0; mesh_id < num_meshes; mesh_id++) {
traverse_mesh (f, mesh_id);
}
/* done */
H5CloseFile (f);
return 0;
}
+351
View File
@@ -0,0 +1,351 @@
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <strings.h>
#include "H5hut.h"
const char* FNAME = "simple_tet.h5";
typedef struct timer {
clock_t _start;
clock_t _end;
struct timer* (*new)(void);
void (*delete)(struct timer*);
void (*start)(struct timer*);
void (*stop)(struct timer*);
double (*elapsed)(struct timer*);
} Timer;
extern Timer Timer_;
static Timer*
new (
void
) {
Timer* this = (Timer*)malloc (sizeof (Timer));
*this = Timer_;
return this;
}
static void
delete (Timer* this) {
free (this);
}
static void
start (Timer* this) {
this->_start = clock();
}
static void
stop (Timer* this) {
this->_end = clock();
}
static double
elapsed (Timer* this) {
return (double)(this->_end - this->_start)/CLOCKS_PER_SEC;
}
Timer Timer_ = {
0,
0,
new,
delete,
start,
stop,
elapsed
};
static h5_err_t
traverse_vertices (
h5t_mesh_t* const m,
int dumpit,
Timer* timer
) {
printf ( " %-32s", "Traversing vertices: ");
/* get number of vertices we have to expect */
h5_size_t num_vertices_expect = H5FedGetNumVerticesTotal (m);
/* get iterator for co-dim 3 entities, i.e vertices */
h5t_iterator_t* iter = H5FedBeginTraverseEntities (m, 3);
/* iterate */
h5_loc_id_t local_id;
h5_size_t num_vertices = 0;
timer->start(timer);
while ((local_id = H5FedTraverseEntities (iter)) >= 0) {
if (dumpit) {
printf ("\n");
h5_float64_t P[3];
H5FedGetVertexCoordsByID (m, local_id, P);
char v[256];
snprintf (v, sizeof(v), "=%llx=", (long long)local_id);
printf ("| %-18s | (%f, %f, %f) |\n",
v, P[0], P[1], P[2]);
}
num_vertices++;
}
/* done */
H5FedEndTraverseEntities (iter);
timer->stop(timer);
/* report error if we got a different number then expected */
if (num_vertices != num_vertices_expect) {
fprintf (stderr, "!!! Got %lud vertices, but expected %lud.\n",
(unsigned long)num_vertices,
(unsigned long)num_vertices_expect);
}
printf (" %fsec, number of vertices: %lu\n",
timer->elapsed(timer),
(unsigned long)num_vertices);
return H5_SUCCESS;
}
static h5_err_t
traverse_edges (
h5t_mesh_t* const m,
int dumpit,
Timer* timer
) {
printf ( " %-32s", "Traversing edges: ");
timer->start(timer);
/* get iterator for co-dim 2 entities, i.e. edges */
h5t_iterator_t* iter = H5FedBeginTraverseEntities (m, 2);
/* iterate */
h5_loc_id_t local_id;
h5_size_t num_edges = 0;
while ((local_id = H5FedTraverseEntities (iter)) >= 0) {
if (dumpit) {
printf ("\n");
char v[256];
char k[256];
h5_loc_id_t local_vids[4];
snprintf ( k, sizeof(k), "=%llx=", (long long)local_id );
H5FedGetVertexIndicesOfEntity ( m, local_id, local_vids );
snprintf ( v, sizeof(v), "=[%lld,%lld]=",
(long long)local_vids[0], (long long)local_vids[1] );
printf ( "| %-18s | %-18s |\n", k, v );
}
num_edges++;
}
/* done */
H5FedEndTraverseEntities (iter);
timer->stop(timer);
printf (" %fsec, number of edges: %lu\n",
timer->elapsed(timer),
(unsigned long)num_edges);
return H5_SUCCESS;
}
static h5_err_t
traverse_triangles (
h5t_mesh_t* const m,
int dumpit,
Timer* timer
) {
printf ( " %-32s", "Traversing triangles: ");
timer->start (timer);
/* get iterator for co-dim 1 entities, i.e. triangles */
h5t_iterator_t* iter = H5FedBeginTraverseEntities (m, 1);
/* iterate */
h5_loc_id_t local_id;
h5_size_t num_triangles = 0;
while ((local_id = H5FedTraverseEntities (iter)) >= 0) {
if (dumpit) {
printf ("\n");
char v[256];
char d[256];
h5_loc_id_t local_vids[4];
snprintf ( d, sizeof(d), "=%llx=", (long long)local_id );
H5FedGetVertexIndicesOfEntity ( m, local_id, local_vids );
snprintf ( v, sizeof(v), "=[%lld,%lld,%lld]=",
(long long)local_vids[0],
(long long)local_vids[1],
(long long)local_vids[2] );
printf ( "| %-18s | %-18s |\n", d, v );
}
num_triangles++;
}
/* done */
H5FedEndTraverseEntities (iter);
timer->stop(timer);
printf (" %fsec, number of triangles: %lu\n",
timer->elapsed(timer),
(unsigned long)num_triangles);
return H5_SUCCESS;
}
static h5_err_t
traverse_boundary_triangles (
h5t_mesh_t* const m,
int dumpit,
Timer* timer
) {
printf ( " %-32s", "Traversing boundary triangles: ");
timer->start(timer);
/* get iterator for co-dim 1 entities, i.e. triangles */
h5t_iterator_t* iter = H5FedBeginTraverseBoundaryFaces (m, 1);
/* iterate */
h5_loc_id_t local_id;
h5_size_t num_triangles = 0;
while ((local_id = H5FedTraverseEntities (iter)) >= 0) {
if (dumpit) {
printf ("\n");
char v[256];
char d[256];
h5_loc_id_t local_vids[4];
snprintf ( d, sizeof(d), "=%llx=", (long long)local_id );
H5FedGetVertexIndicesOfEntity ( m, local_id, local_vids );
snprintf ( v, sizeof(v), "=[%lld,%lld,%lld]=",
(long long)local_vids[0],
(long long)local_vids[1],
(long long)local_vids[2] );
printf ( "| %-18s | %-18s |\n", d, v );
}
num_triangles++;
}
/* done */
H5FedEndTraverseEntities (iter);
timer->stop(timer);
printf (" %fsec, number of boundary triangles: %lu\n",
timer->elapsed(timer),
(unsigned long)num_triangles);
return H5_SUCCESS;
}
static h5_err_t
traverse_elems (
h5t_mesh_t* const m,
int dumpit,
Timer* timer
) {
printf ( " %-32s", "Traversing elements: ");
timer->start(timer);
/* get number of elements we have to expect */
h5_size_t num_elems_expect = H5FedGetNumElementsTotal (m);
/* get iterator for co-dim 0 */
h5t_iterator_t* iter = H5FedBeginTraverseEntities (m, 0);
/* iterate over all co-dim 0 entities, i.e. elements */
h5_loc_id_t local_id;
h5_size_t num_elems = 0;
while ((local_id = H5FedTraverseEntities (iter)) >= 0) {
if (dumpit) {
printf ("\n");
char v[256];
char t[256];
h5_loc_id_t local_vids[4];
snprintf ( t, sizeof(t), "=%llx=", (long long)local_id );
H5FedGetVertexIndicesOfEntity (m, local_id, local_vids);
snprintf ( v, sizeof(v), "=[%lld,%lld,%lld,%lld]=",
(long long)local_vids[0], (long long)local_vids[1],
(long long)local_vids[2], (long long)local_vids[3] );
printf ( "| %-18s | %-18s |\n", t, v );
}
num_elems++;
}
/* done */
H5FedEndTraverseEntities (iter);
timer->stop(timer);
/* report error if we got a different number then expected */
if (num_elems != num_elems_expect) {
fprintf (stderr, "!!! Got %lld elements, but expected %lld.\n",
(long long)num_elems, (long long)num_elems_expect);
exit(1);
}
printf (" %fsec, number of elements: %lld\n",
timer->elapsed(timer),
(long long)num_elems);
return H5_SUCCESS;
}
static h5_err_t
traverse_level (
h5t_mesh_t* const m,
const h5_lvl_idx_t level_id,
int dumpit,
Timer* timer
) {
printf ("Setting level to %d\n", level_id);
H5FedSetLevel (m, level_id);
traverse_vertices (m, dumpit, timer);
traverse_edges (m, dumpit, timer);
traverse_triangles (m, dumpit, timer);
traverse_boundary_triangles (m, dumpit, timer);
traverse_elems (m, dumpit, timer);
return H5_SUCCESS;
}
static h5_err_t
traverse_mesh (
h5_file_t const f,
const h5_id_t mesh_id,
int dumpit
) {
h5t_mesh_t* mesh;
Timer* timer = Timer_.new();
timer->start(timer);
/* open mesh and get number of levels */
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));
h5_size_t num_levels = H5FedGetNumLevels (mesh);
printf (" Number of levels in mesh: %lld\n", (long long)num_levels);
/* loop over all levels */
h5_lvl_idx_t level_id;
for (level_id = 0; level_id < num_levels; level_id++) {
traverse_level (mesh, level_id, dumpit, timer);
}
/* done */
H5FedCloseMesh (mesh);
timer->delete(timer);
return H5_SUCCESS;
}
int
main (
int argc,
char* argv[]
) {
/* abort program on error, so we don't have to handle them */
H5SetErrorHandler (H5AbortErrorhandler);
H5SetVerbosityLevel (0);
/* open file and get number of meshes */
h5_file_t f = H5OpenFile (FNAME, H5_O_RDONLY, H5_PROP_DEFAULT);
h5_size_t num_meshes = H5FedGetNumTetrahedralMeshes (f);
printf (" Number of meshes: %lld\n", (long long)num_meshes);
/* loop over all meshes */
h5_id_t mesh_id;
int dumpit = 0;
for (mesh_id = 0; mesh_id < num_meshes; mesh_id++) {
traverse_mesh (f, mesh_id, dumpit);
}
/* done */
H5CloseFile (f);
return 0;
}
+401
View File
@@ -0,0 +1,401 @@
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include "H5hut.h"
// name of input file
const char* FNAME = "simple_tet.h5";
// 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;
clock_t _end;
struct timer* (*new)(void);
void (*delete)(struct timer*);
void (*start)(struct timer*);
void (*stop)(struct timer*);
double (*elapsed)(struct timer*);
} Timer;
extern Timer Timer_;
static Timer*
new (
void
) {
Timer* self = (Timer*)malloc (sizeof (Timer));
*self = Timer_;
return self;
}
static void
delete (Timer* self) {
free (self);
}
static void
start (Timer* self) {
self->_start = clock();
}
static void
stop (Timer* self) {
self->_end = clock();
}
static double
elapsed (Timer* self) {
return (double)(self->_end - self->_start)/CLOCKS_PER_SEC;
}
Timer Timer_ = {
0,
0,
new,
delete,
start,
stop,
elapsed
};
struct vertex {
h5_float64_t P[3];
};
typedef struct vertex vertex_t;
struct tet {
h5_glb_id_t global_id;
h5_glb_id_t parent_id;
h5_glb_id_t vids[4];
};
typedef struct tet tet_t;
static h5_err_t
traverse_vertices (
h5t_mesh_t* const m,
h5t_tagset_t* tagset,
int dumpit,
Timer* timer
) {
printf ( " %-32s", "Traversing vertices: ");
/* get iterator for co-dim 3 entities, i.e vertices */
h5t_iterator_t* iter = H5FedBeginTraverseEntities (m, 3);
/* iterate */
h5_loc_id_t local_id;
h5_size_t num_entities = 0;
h5_size_t num_entities_tagged = 0;
timer->start(timer);
while ((local_id = H5FedTraverseEntities (iter)) >= 0) {
num_entities++;
if (dumpit) {
printf ("\n");
h5_float64_t P[3];
H5FedGetVertexCoordsByID (m, local_id, P);
char v[256];
snprintf (v, sizeof(v), "=%llx=", (long long)local_id);
printf ("| %-18s | (%f, %f, %f) |",
v, P[0], P[1], P[2]);
}
h5_size_t size = 3;
h5_int64_t tval[3];
if ((local_id = H5FedGetTag (tagset, local_id, &size, tval)) < 0) {
continue; // not tagged
}
if (dumpit) {
printf (" (%llx, %llx, %llx) |",
(long long)tval[0], (long long)tval[1], (long long)tval[2]);
}
num_entities_tagged++;
if (tval[0] != local_id ||
tval[1] != local_id+1 ||
tval[2] != local_id+2) {
fprintf (stderr,
"!!! Wrong tag values for entity %lld\n",
(long long)local_id);
exit (1);
}
}
/* done */
H5FedEndTraverseEntities (iter);
timer->stop(timer);
if (dumpit) {
printf ("\n\nTime elapsed:");
}
printf (" %fsec, total number of entities: %lu; tagged: %lu\n",
timer->elapsed(timer),
(unsigned long)num_entities, (unsigned long)num_entities_tagged);
return H5_SUCCESS;
}
static h5_err_t
traverse_edges (
h5t_mesh_t* const m,
h5t_tagset_t* tagset,
int dumpit,
Timer* timer
) {
printf ( " %-32s", "Traversing edges: ");
timer->start(timer);
/* get iterator for co-dim 2 entities, i.e. edges */
h5t_iterator_t* iter = H5FedBeginTraverseEntities (m, 2);
/* iterate */
h5_loc_id_t local_id;
h5_size_t num_entities = 0;
h5_size_t num_entities_tagged = 0;
while ((local_id = H5FedTraverseEntities (iter)) >= 0) {
num_entities++;
if (dumpit) {
printf ("\n");
char v[256];
char k[256];
h5_loc_id_t local_vids[4];
snprintf ( k, sizeof(k), "=%llx=", (long long)local_id );
H5FedGetVertexIndicesOfEntity ( m, local_id, local_vids );
snprintf ( v, sizeof(v), "=[%lld,%lld]=",
(long long)local_vids[0], (long long)local_vids[1] );
printf ( "| %-18s | %-18s |", k, v );
}
h5_size_t size = 3;
h5_int64_t tval[3];
if ((local_id = H5FedGetTag (tagset, local_id, &size, tval)) < 0)
continue; // not tagged
if (dumpit) {
printf (" (%llx, %llx, %llx) |",
(long long)tval[0], (long long)tval[1], (long long)tval[2]);
}
num_entities_tagged++;
if (tval[0] != local_id ||
tval[1] != local_id+1 ||
tval[2] != local_id+2) {
fprintf (stderr,
"!!! Wrong tag values for entity %lld\n",
(long long)local_id);
exit (1);
}
}
/* done */
H5FedEndTraverseEntities (iter);
timer->stop(timer);
if (dumpit) {
printf ("\n\nTime elapsed:");
}
printf (" %fsec, total number of entities: %lu; tagged: %lu\n",
timer->elapsed(timer),
(unsigned long)num_entities, (unsigned long)num_entities_tagged);
return H5_SUCCESS;
}
static h5_err_t
traverse_triangles (
h5t_mesh_t* const m,
h5t_tagset_t* tagset,
int dumpit,
Timer* timer
) {
printf ( " %-32s", "Traversing triangles: ");
timer->start(timer);
/* get iterator for co-dim 1 entities, i.e. triangles */
h5t_iterator_t* iter = H5FedBeginTraverseEntities (m, 1);
/* iterate */
h5_loc_id_t local_id;
h5_size_t num_entities = 0;
h5_size_t num_entities_tagged = 0;
while ((local_id = H5FedTraverseEntities (iter)) >= 0) {
num_entities++;
if (dumpit) {
printf ("\n");
char v[256];
char k[256];
h5_loc_id_t local_vids[4];
snprintf ( k, sizeof(k), "=%llx=", (long long)local_id );
H5FedGetVertexIndicesOfEntity ( m, local_id, local_vids );
snprintf ( v, sizeof(v), "=[%lld,%lld,%lld]=",
(long long)local_vids[0],
(long long)local_vids[1],
(long long)local_vids[2] );
printf ( "| %-18s | %-18s |", k, v );
}
h5_size_t size = 3;
h5_int64_t tval[3];
if ((local_id = H5FedGetTag (tagset, local_id, &size, tval)) < 0)
continue; // not tagged
if (dumpit) {
printf (" (%llx, %llx, %llx) |",
(long long)tval[0], (long long)tval[1], (long long)tval[2]);
}
num_entities_tagged++;
if (tval[0] != local_id || tval[1] != local_id+1 || tval[2] != local_id+2) {
fprintf (stderr,
"!!! Wrong tag values for entity %lld\n",
(long long)local_id);
exit (1);
}
}
/* done */
H5FedEndTraverseEntities (iter);
timer->stop(timer);
if (dumpit) {
printf ("\n\nTime elapsed:");
}
printf (" %fsec, total number of entities: %lu; tagged: %lu\n",
timer->elapsed(timer),
(unsigned long)num_entities, (unsigned long)num_entities_tagged);
return H5_SUCCESS;
}
static h5_err_t
traverse_tets (
h5t_mesh_t* const m,
h5t_tagset_t* tagset,
int dumpit,
Timer* timer
) {
printf ( " %-32s", "Traversing tetrahedra: ");
timer->start(timer);
/* get iterator for co-dim 0 entities, i.e. tetrahedra */
h5t_iterator_t* iter = H5FedBeginTraverseEntities (m, 0);
/* iterate */
h5_loc_id_t local_id;
h5_size_t num_entities = 0;
h5_size_t num_entities_tagged = 0;
while ((local_id = H5FedTraverseEntities (iter)) >= 0) {
num_entities++;
if (dumpit) {
printf ("\n");
char v[256];
char k[256];
h5_loc_id_t local_vids[4];
snprintf ( k, sizeof(k), "=%llx=", (long long)local_id );
H5FedGetVertexIndicesOfEntity ( m, local_id, local_vids );
snprintf ( v, sizeof(v), "=[%lld,%lld,%lld,%lld]=",
(long long)local_vids[0],
(long long)local_vids[1],
(long long)local_vids[2],
(long long)local_vids[3] );
printf ( "| %-18s | %-18s |", k, v );
}
h5_size_t size = 3;
h5_int64_t tval[3];
if ((local_id = H5FedGetTag (tagset, local_id, &size, tval)) < 0)
continue; // not tagged
if (dumpit) {
printf (" (%llx, %llx, %llx) |",
(long long)tval[0], (long long)tval[1], (long long)tval[2]);
}
num_entities_tagged++;
if (tval[0] != local_id || tval[1] != local_id+1 || tval[2] != local_id+2) {
fprintf (stderr,
"!!! Wrong tag values for entity %lld\n",
(long long)local_id);
exit (1);
}
}
/* done */
H5FedEndTraverseEntities (iter);
timer->stop(timer);
if (dumpit) {
printf ("\n\nTime elapsed:");
}
printf (" %fsec, total number of entities: %lu; tagged: %lu\n",
timer->elapsed(timer),
(unsigned long)num_entities, (unsigned long)num_entities_tagged);
return H5_SUCCESS;
}
static h5_err_t
traverse_level (
h5t_mesh_t* const m,
h5t_tagset_t* tagset,
const h5_lvl_idx_t level_id,
int dumpit,
Timer* timer
) {
printf ("Setting level to %d\n", level_id);
H5FedSetLevel (m, level_id);
traverse_vertices (m, tagset, dumpit, timer);
traverse_edges (m, tagset, dumpit, timer);
traverse_triangles (m, tagset, dumpit, timer);
traverse_tets (m, tagset, dumpit, timer);
return H5_SUCCESS;
}
static h5_err_t
traverse_mesh (
const h5_file_t f,
const h5_id_t mesh_id,
int dumpit
) {
h5t_mesh_t* mesh;
Timer* timer = Timer_.new();
timer->start(timer);
/* open mesh and get number of levels */
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));
h5t_tagset_t* tagset;
H5FedOpenMTagset (mesh, "testtag", &tagset);
h5_size_t num_levels = H5FedGetNumLevels (mesh);
printf (" Number of levels in mesh: %lld\n", (long long)num_levels);
/* loop over all levels */
h5_lvl_idx_t level_id;
for (level_id = 0; level_id < num_levels; level_id++) {
traverse_level (mesh, tagset, level_id, dumpit, timer);
}
/* done */
H5FedCloseMTagset (tagset);
H5FedCloseMesh (mesh);
timer->delete(timer);
return H5_SUCCESS;
}
int
main (
int argc,
char* argv[]
) {
/* abort program on error, so we don't have to handle them */
H5SetErrorHandler (H5AbortErrorhandler);
H5SetVerbosityLevel (h5_verbosity);
H5SetDebugMask (h5_debugmsk);
/* open file and get number of meshes */
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);
/* loop over all meshes */
h5_id_t mesh_id;
int dumpit = 1;
for (mesh_id = 0; mesh_id < num_meshes; mesh_id++) {
traverse_mesh (f, mesh_id, dumpit);
}
/* done */
H5CloseFile (f);
return 0;
}
@@ -4,13 +4,6 @@
#include "H5hut.h"
#ifndef PARALLEL_IO
#ifndef MPI_COMM_WORLD
#define MPI_COMM_WORLD 0
#endif
#endif
const h5_oid_t MESH_TYPE = H5_TETRAHEDRAL_MESH;
const char* FNAME = "simple_tet.h5";
typedef struct vertex {
@@ -42,42 +35,42 @@ 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);
H5FedAddMesh (f, MESH_TYPE);
h5_file_t const f = H5OpenFile (FNAME, H5_O_WRONLY, H5_PROP_DEFAULT);
h5t_mesh_t* mesh;
H5FedAddTetrahedralMesh (f, "0", &mesh);
/* store vertices */
H5FedBeginStoreVertices (f, num_vertices);
H5FedBeginStoreVertices (mesh, num_vertices);
int i;
for (i = 0; i < num_vertices; i++) {
H5FedStoreVertex (f, -1, Vertices[i].P);
H5FedStoreVertex (mesh, -1, Vertices[i].P);
}
H5FedEndStoreVertices (f);
H5FedEndStoreVertices (mesh);
/* store elements */
H5FedBeginStoreElements (f, num_elems);
H5FedBeginStoreElements (mesh, num_elems);
for (i = 0; i < num_elems; i++) {
H5FedStoreElement (f, Elems[i].vids);
H5FedStoreElement (mesh, Elems[i].vids);
}
H5FedEndStoreElements (f);
H5FedEndStoreElements (mesh);
/* add 1. Level */
H5FedAddLevel(f);
H5FedBeginRefineElements (f);
H5FedRefineElement (f, 0);
H5FedEndRefineElements (f);
H5FedBeginRefineElements (mesh);
H5FedRefineElement (mesh, 0);
H5FedEndRefineElements (mesh);
/* add 2. Level */
H5FedAddLevel(f);
H5FedBeginRefineElements (f);
H5FedRefineElement (f, 2);
H5FedEndRefineElements (f);
H5FedBeginRefineElements (mesh);
H5FedRefineElement (mesh, 2);
H5FedEndRefineElements (mesh);
H5FedCloseMesh (f);
H5FedCloseMesh (mesh);
H5CloseFile (f);
return 0;
}
+74
View File
@@ -0,0 +1,74 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "H5hut.h"
#ifndef PARALLEL_IO
#ifndef MPI_COMM_WORLD
#define MPI_COMM_WORLD 0
#endif
#endif
const char* FNAME = "simple_tet1.h5";
typedef struct vertex {
h5_float64_t P[3];
} vertex_t;
typedef struct elem {
h5_loc_idx_t vids[4];
} elem_t;
vertex_t Vertices[] = {
{{-1.0, 0.0, 0.0}},
{{ 0.0, 0.0, 1.0}},
{{ 0.0, 1.0, 0.0}},
{{ 1.0, 0.0, 0.0}},
};
elem_t Elems[] = {
{{ 0, 1, 2, 3 }},
};
const int num_vertices = sizeof (Vertices) / sizeof (Vertices[0]);
const int num_elems = sizeof (Elems) / sizeof (Elems[0]);
int
main (
int argc,
char* argv[]
) {
/* abort program on errors in library */
H5SetErrorHandler (H5AbortErrorhandler);
H5SetVerbosityLevel (H5_DEBUG_ALL);
/* open file and add mesh */
h5_file_t const f = H5OpenFile (FNAME, H5_O_WRONLY, 0);
h5t_mesh_t* mesh;
H5FedAddTetrahedralMesh (f, "0", &mesh);
/* store vertices */
H5FedBeginStoreVertices (mesh, num_vertices);
int i;
for (i = 0; i < num_vertices; i++) {
H5FedStoreVertex (mesh, -1, Vertices[i].P);
}
H5FedEndStoreVertices (mesh);
/* store elements */
H5FedBeginStoreElements (mesh, num_elems);
for (i = 0; i < num_elems; i++) {
H5FedStoreElement (mesh, Elems[i].vids);
}
H5FedEndStoreElements (mesh);
/* add 1. Level */
H5FedBeginRefineElements (mesh);
H5FedRefineElement (mesh, 0);
H5FedEndRefineElements (mesh);
H5FedCloseMesh (mesh);
H5CloseFile (f);
return 0;
}
@@ -4,7 +4,6 @@
#include "H5hut.h"
const h5_oid_t MESH_TYPE = H5_TETRAHEDRAL_MESH;
const char* FNAME = "large_tet.h5";
const h5_int32_t num_levels = 11;
@@ -59,31 +58,32 @@ main (
/* abort program on errors in library */
H5SetErrorHandler (H5AbortErrorhandler);
H5SetVerbosityLevel (2);
// H5SetVerbosityLevel (H5_DEBUG_ALL);
/* open file and add mesh */
h5_file_t* const f = H5OpenFile (FNAME, H5_O_WRONLY, 0);
H5FedAddMesh (f, MESH_TYPE);
h5_file_t const f = H5OpenFile (FNAME, H5_O_WRONLY, 0);
h5t_mesh_t* mesh;
H5FedAddTetrahedralMesh (f, "0", &mesh);
/* store vertices */
H5FedBeginStoreVertices (f, num_vertices);
H5FedBeginStoreVertices (mesh, num_vertices);
int i;
for (i = 0; i < num_vertices; i++) {
H5FedStoreVertex (f, -1, Vertices[i].P);
H5FedStoreVertex (mesh, -1, Vertices[i].P);
}
H5FedEndStoreVertices (f);
H5FedEndStoreVertices (mesh);
/* store elements */
H5FedBeginStoreElements (f, num_elems);
H5FedBeginStoreElements (mesh, num_elems);
for (i = 0; i < num_elems; i++) {
H5FedStoreElement (f, Elems[i].vids);
H5FedStoreElement (mesh, Elems[i].vids);
}
H5FedEndStoreElements (f);
H5FedEndStoreElements (mesh);
/* add 1. Level */
H5FedAddLevel(f);
H5FedBeginRefineElements (f);
H5FedRefineElement (f, 0);
H5FedEndRefineElements (f);
H5FedBeginRefineElements (mesh);
H5FedRefineElement (mesh, 0);
H5FedEndRefineElements (mesh);
/* add levels 2 to num_levels-1 */
h5_int32_t num_elems_last_level = 1;
@@ -91,18 +91,17 @@ main (
for (level_id = 2; level_id < num_levels; level_id++) {
/* refine 4 to the power of level_id-1 elems */
H5FedAddLevel(f);
h5_int32_t num_elems2refine = power (4, level_id-1);
H5FedBeginRefineElements (f);
H5FedBeginRefineElements (mesh);
for (i = num_elems_last_level;
i < num_elems_last_level+num_elems2refine;
i++) {
H5FedRefineElement (f, i);
H5FedRefineElement (mesh, i);
}
H5FedEndRefineElements (f);
H5FedEndRefineElements (mesh);
num_elems_last_level += 2 * num_elems2refine;
}
H5FedCloseMesh (f);
H5FedCloseMesh (mesh);
H5CloseFile (f);
return 0;
}
+229
View File
@@ -0,0 +1,229 @@
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <string.h>
#include "H5hut.h"
const char* FNAME = "simple_tet.h5";
typedef struct timer {
clock_t _start;
clock_t _end;
struct timer* (*new)(void);
void (*delete)(struct timer*);
void (*start)(struct timer*);
void (*stop)(struct timer*);
double (*elapsed)(struct timer*);
} Timer;
extern Timer Timer_;
static Timer*
new (
void
) {
Timer* this = (Timer*)malloc (sizeof (Timer));
*this = Timer_;
return this;
}
static void
delete (Timer* this) {
free (this);
}
static void
start (Timer* this) {
this->_start = clock();
}
static void
stop (Timer* this) {
this->_end = clock();
}
static double
elapsed (Timer* this) {
return (double)(this->_end - this->_start)/CLOCKS_PER_SEC;
}
Timer Timer_ = {
0,
0,
new,
delete,
start,
stop,
elapsed
};
static h5_err_t
set_vertex_tags (
h5t_mesh_t* m,
h5t_tagset_t* const tagset,
int verify,
Timer* timer
) {
h5_loc_id_t local_id;
h5_int64_t val[3];
h5_info ("Tagging all vertices ...");
timer->start(timer);
h5t_iterator_t* iter = H5FedBeginTraverseEntities (m, 3);
while ((local_id = H5FedTraverseEntities (iter)) >= 0) {
val[0] = local_id;
val[1] = local_id+1;
val[2] = local_id+2;
H5FedSetTag (tagset, local_id, 3, val);
if (verify) {
h5_int64_t retval[3];
h5_size_t dim = 3;
H5FedGetTag (tagset, local_id, &dim, retval);
if (memcmp (val, retval, sizeof(val))) {
h5_warn ("Oops on entity %llx!", (long long)local_id);
}
}
h5_debug ("Tagging %llx", (long long)local_id);
}
timer->stop(timer);
h5_info (" Time to tag to all vertices: %fsec", timer->elapsed(timer));
return H5FedEndTraverseEntities (iter);
}
static h5_err_t
set_edge_tags (
h5t_mesh_t* const m,
h5t_tagset_t* tagset,
int dumpit,
Timer* timer
) {
h5_loc_id_t local_id;
h5_int64_t val[3];
h5_info ("Tagging all edges ...");
timer->start(timer);
h5t_iterator_t* iter = H5FedBeginTraverseEntities (m, 2);
while ((local_id = H5FedTraverseEntities (iter)) >= 0) {
val[0] = local_id;
val[1] = local_id+1;
val[2] = local_id+2;
H5FedSetTag (tagset, local_id, 3, val);
h5_int64_t retval[3];
h5_size_t dims;
H5FedGetTag (tagset, local_id, &dims, retval);
if (memcmp ( val, retval, sizeof(val))) {
h5_warn ("Oops on entity %llx!", (long long)local_id);
}
}
timer->stop(timer);
h5_info (" Time to tag all edges: %fsec", timer->elapsed(timer));
return H5FedEndTraverseEntities (iter);
}
static h5_err_t
set_tri_tags (
h5t_mesh_t* const m,
h5t_tagset_t* tagset,
int dumpit,
Timer* timer
) {
h5_loc_id_t local_id;
h5_int64_t val[3];
h5_info ("Tagging all triangles ...");
timer->start(timer);
h5t_iterator_t* iter = H5FedBeginTraverseEntities (m, 1);
while ((local_id = H5FedTraverseEntities (iter)) >= 0) {
val[0] = local_id;
val[1] = local_id+1;
val[2] = local_id+2;
H5FedSetTag (tagset, local_id, 3, val);
h5_int64_t retval[3];
h5_size_t dims;
H5FedGetTag (tagset, local_id, &dims, retval);
if (memcmp (val, retval, sizeof(val))) {
h5_warn ("Oops on entity %llx!", (long long)local_id);
}
}
timer->stop(timer);
h5_info (" Time to tag all triangles: %fsec", timer->elapsed(timer));
return H5FedEndTraverseEntities (iter);
}
static h5_err_t
set_tet_tags (
h5t_mesh_t* const m,
h5t_tagset_t* tagset,
int dumpit,
Timer* timer
) {
h5_loc_id_t local_id;
h5_int64_t val[3];
h5_info ("Tagging all tetrahedra ...");
timer->start(timer);
h5t_iterator_t* iter = H5FedBeginTraverseEntities (m, 0);
while ((local_id = H5FedTraverseEntities (iter)) >= 0) {
val[0] = local_id;
val[1] = local_id+1;
val[2] = local_id+2;
H5FedSetTag (tagset, local_id, 3, val);
h5_int64_t retval[3];
h5_size_t dims;
H5FedGetTag (tagset, local_id, &dims, retval);
if (memcmp (val, retval, sizeof(val))) {
h5_warn ("Oops on entity %llx!", (long long)local_id);
}
}
timer->stop(timer);
h5_info (" Time to tag to all tetrahedra: %fsec", timer->elapsed(timer));
return H5FedEndTraverseEntities (iter);
}
int
main (
int argc,
char* argv[]
) {
int verify = 1;
/* abort program on error, so we don't have to handle them */
H5SetErrorHandler (H5AbortErrorhandler);
H5SetVerbosityLevel (3);
/* open file and get number of meshes */
h5_file_t f = H5OpenFile (FNAME, H5_O_RDWR, 0);
h5t_mesh_t* mesh;
Timer* timer = Timer_.new();
timer->start(timer);
H5FedOpenTetrahedralMesh (f, "0", &mesh);
timer->stop(timer);
h5_info (" Time to open mesh %fsec", timer->elapsed(timer));
/* open last level */
//h5_size_t num_levels = H5FedGetNumLevels (mesh);
//H5FedSetLevel (mesh, num_levels-1);
H5FedSetLevel (mesh, 0);
/* add new tagset and write some data to it */
h5t_tagset_t* tagset = NULL;
H5FedAddMTagset (mesh, "testtag", H5_INT64_T, &tagset);
set_vertex_tags (mesh, tagset, verify, timer);
set_edge_tags (mesh, tagset, verify, timer);
set_tri_tags (mesh, tagset, verify, timer);
set_tet_tags (mesh, tagset, verify, timer);
// close tagset
timer->start(timer);
H5FedCloseMTagset (tagset);
timer->stop(timer);
h5_info (" Time to write tagset to disk %fsec", timer->elapsed(timer));
// close mesh
timer->start(timer);
H5FedCloseMesh (mesh);
timer->stop(timer);
h5_info (" Time to close mesh %fsec", timer->elapsed(timer));
// close file
timer->start(timer);
H5CloseFile (f);
timer->stop(timer);
h5_info (" Time to close file %fsec", timer->elapsed(timer));
return 0;
}
+95
View File
@@ -0,0 +1,95 @@
#include <stdio.h>
#include <stdlib.h>
#include "H5hut.h"
#if defined (PARALLEL_IO)
#include <mpi.h>
#endif
#define H5FedGetNumLeafElementsTotal H5FedGetNumElementsTotal
/*
Traverse elements and output coordinates
*/
static h5_err_t
traverse_elems (
h5t_mesh_t* const m
) {
/* get number of elements we have to expect */
h5_size_t num_elems_expect = H5FedGetNumLeafElementsTotal (m);
/* get iterator for co-dim 0 */
h5t_iterator_t* iter = H5FedBeginTraverseEntities (m, 0);
/* iterate over all co-dim 0 entities, i.e. elements */
h5_loc_id_t local_id;
h5_size_t num_elems = 0;
while ((local_id = H5FedTraverseEntities (iter)) >= 0) {
h5_loc_id_t local_vids[4];
H5FedGetVertexIndicesOfEntity (m, local_id, local_vids);
printf ("# cell %llx\n", (long long unsigned)local_id );
h5_float64_t P[3];
for (int i = 0; i < 3; i++) {
H5FedGetVertexCoordsByIndex (m, local_vids[i], P);
printf (" %8.6f %8.6f\n", P[0], P[1]);
}
H5FedGetVertexCoordsByIndex (m, local_vids[0], P);
printf (" %8.6f %8.6f\n", P[0], P[1]);
printf ("\n");
num_elems++;
}
/* done */
H5FedEndTraverseEntities (iter);
/* report error if we got a different number then expected */
if (num_elems != num_elems_expect) {
fprintf (stderr, "!!! Got %lld elements, but expected %lld.\n",
(long long)num_elems, (long long)num_elems_expect);
exit(1);
}
return H5_SUCCESS;
}
int
main (
int argc,
char* argv[]
) {
if (argc < 2 || argc > 3) {
fprintf (stderr, "Usage: %s FILE [LEVEL]\n", argv[0]);
exit (42);
}
/* abort program on error, so we don't have to handle them */
H5SetErrorHandler (H5AbortErrorhandler);
H5SetVerbosityLevel (0);
/* open file and get number of meshes */
h5_file_t f = H5OpenFile (argv[1], H5_O_RDONLY, H5_PROP_DEFAULT);
h5t_mesh_t* m;
H5FedOpenTriangleMeshByIndex (f, 0, &m);
int num_levels = H5FedGetNumLevels (m);
int level = num_levels-1;
if (argc >= 3) {
level = atoi (argv[2]);
}
if (level >= num_levels || level < 0) {
fprintf (stderr, "level %d out of range\n", level);
goto done;
}
H5FedSetLevel (m, level);
traverse_elems (m);
done:
H5FedCloseMesh (m);
H5CloseFile (f);
#if defined (PARALLEL_IO)
MPI_Finalize ();
#endif
return 0;
}
@@ -7,20 +7,19 @@
#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
print_adjacencies_of_vertex (
h5_file_t* const f,
h5t_mesh_t* const m,
h5_loc_id_t local_id,
clock_t* time_used
) {
h5_loc_idlist_t* uadj_edges;
h5_loc_idlist_t* uadj_triangles;
clock_t time_used_before = clock();
H5FedGetAdjacencies (f, local_id, 1, &uadj_edges);
H5FedGetAdjacencies (f, local_id, 2, &uadj_triangles);
H5FedGetAdjacencies (m, local_id, 1, &uadj_edges);
H5FedGetAdjacencies (m, local_id, 2, &uadj_triangles);
*time_used = clock() - time_used_before;
int n = 0;
if (uadj_triangles->num_items > n) n = uadj_triangles->num_items;
@@ -33,7 +32,7 @@ print_adjacencies_of_vertex (
h5_loc_id_t local_vids[4];
if (i == 0) {
H5FedGetVertexIndicesOfEntity (
f, local_id, local_vids);
m, local_id, local_vids);
snprintf (v, sizeof(v), "=[%lld]=",
(long long)local_vids[0]);
} else {
@@ -41,7 +40,7 @@ print_adjacencies_of_vertex (
}
if (i < uadj_edges->num_items) {
H5FedGetVertexIndicesOfEntity (
f, uadj_edges->items[i], local_vids);
m, uadj_edges->items[i], local_vids);
snprintf (k, sizeof(k), "=[%lld,%lld]=",
(long long)local_vids[0],
(long long)local_vids[1]);
@@ -50,7 +49,7 @@ print_adjacencies_of_vertex (
}
if (i < uadj_triangles->num_items) {
H5FedGetVertexIndicesOfEntity (
f, uadj_triangles->items[i], local_vids);
m, uadj_triangles->items[i], local_vids);
snprintf (d, sizeof(d), "=[%lld,%lld,%lld]=",
(long long)local_vids[0],
(long long)local_vids[1],
@@ -60,22 +59,22 @@ print_adjacencies_of_vertex (
}
printf ("| %-18s | %-18s | %-18s |\n", v, k, d);
}
H5FedReleaseListOfAdjacencies (f, &uadj_edges);
H5FedReleaseListOfAdjacencies (f, &uadj_triangles);
H5FedReleaseListOfAdjacencies (m, &uadj_edges);
H5FedReleaseListOfAdjacencies (m, &uadj_triangles);
return H5_SUCCESS;
}
static h5_err_t
print_adjacencies_of_edge (
h5_file_t* const f,
h5t_mesh_t* const m,
h5_loc_id_t local_id,
clock_t* time_used
) {
h5_loc_idlist_t* dadj_vertices;
h5_loc_idlist_t* uadj_triangles;
clock_t time_used_before = clock();
H5FedGetAdjacencies (f, local_id, 0, &dadj_vertices);
H5FedGetAdjacencies (f, local_id, 2, &uadj_triangles);
H5FedGetAdjacencies (m, local_id, 0, &dadj_vertices);
H5FedGetAdjacencies (m, local_id, 2, &uadj_triangles);
*time_used = clock() - time_used_before;
int n = dadj_vertices->num_items;
if (uadj_triangles->num_items > n) n = uadj_triangles->num_items;
@@ -88,7 +87,7 @@ print_adjacencies_of_edge (
h5_loc_id_t local_vids[4];
if (i < dadj_vertices->num_items) {
H5FedGetVertexIndicesOfEntity (
f, dadj_vertices->items[i], local_vids);
m, dadj_vertices->items[i], local_vids);
snprintf (v, sizeof(v), "=[%lld]=",
(long long)local_vids[0]);
} else {
@@ -96,7 +95,7 @@ print_adjacencies_of_edge (
}
if (i == 0) {
H5FedGetVertexIndicesOfEntity (
f, local_id, local_vids);
m, local_id, local_vids);
snprintf (k, sizeof(k), "=[%lld,%lld]=",
(long long)local_vids[0],
(long long)local_vids[1]);
@@ -105,7 +104,7 @@ print_adjacencies_of_edge (
}
if (i < uadj_triangles->num_items) {
H5FedGetVertexIndicesOfEntity (
f, uadj_triangles->items[i], local_vids);
m, uadj_triangles->items[i], local_vids);
snprintf (d, sizeof(d), "=[%lld,%lld,%lld]=",
(long long)local_vids[0],
(long long)local_vids[1],
@@ -115,22 +114,22 @@ print_adjacencies_of_edge (
}
printf ("| %-18s | %-18s | %-18s |\n", v, k, d);
}
H5FedReleaseListOfAdjacencies (f, &dadj_vertices);
H5FedReleaseListOfAdjacencies (f, &uadj_triangles);
H5FedReleaseListOfAdjacencies (m, &dadj_vertices);
H5FedReleaseListOfAdjacencies (m, &uadj_triangles);
return H5_SUCCESS;
}
static h5_err_t
print_adjacencies_of_elem (
h5_file_t* const f,
h5t_mesh_t* const m,
h5_loc_id_t local_id,
clock_t* time_used
) {
h5_loc_idlist_t* dadj_vertices;
h5_loc_idlist_t* dadj_edges;
clock_t time_used_before = clock();
H5FedGetAdjacencies (f, local_id, 0, &dadj_vertices);
H5FedGetAdjacencies (f, local_id, 1, &dadj_edges);
H5FedGetAdjacencies (m, local_id, 0, &dadj_vertices);
H5FedGetAdjacencies (m, local_id, 1, &dadj_edges);
*time_used = clock() - time_used_before;
int n = dadj_vertices->num_items;
if (dadj_edges->num_items > n) n = dadj_edges->num_items;
@@ -142,7 +141,7 @@ print_adjacencies_of_elem (
h5_loc_id_t local_vids[4];
if (i < dadj_vertices->num_items) {
H5FedGetVertexIndicesOfEntity (
f, dadj_vertices->items[i], local_vids);
m, dadj_vertices->items[i], local_vids);
snprintf (v, sizeof(v), "=[%lld]=",
(long long)local_vids[0]);
} else {
@@ -150,7 +149,7 @@ print_adjacencies_of_elem (
}
if (i < dadj_edges->num_items) {
H5FedGetVertexIndicesOfEntity (
f, dadj_edges->items[i], local_vids);
m, dadj_edges->items[i], local_vids);
snprintf (k, sizeof(k), "=[%lld,%lld]=",
(long long)local_vids[0],
(long long)local_vids[1]);
@@ -159,7 +158,7 @@ print_adjacencies_of_elem (
}
if (i == 0) {
H5FedGetVertexIndicesOfEntity (
f, local_id, local_vids);
m, local_id, local_vids);
snprintf (d, sizeof(k), "=[%lld,%lld,%lld]=",
(long long)local_vids[0],
(long long)local_vids[1],
@@ -169,14 +168,14 @@ print_adjacencies_of_elem (
}
printf ( "| %-18s | %-18s | %-18s |\n", v, k, d );
}
H5FedReleaseListOfAdjacencies (f, &dadj_vertices);
H5FedReleaseListOfAdjacencies (f, &dadj_edges);
H5FedReleaseListOfAdjacencies (m, &dadj_vertices);
H5FedReleaseListOfAdjacencies (m, &dadj_edges);
return H5_SUCCESS;
}
static h5_err_t
traverse_vertices (
h5_file_t* const f
h5t_mesh_t* const m
) {
h5_loc_id_t local_id;
h5_loc_idx_t num = 0;
@@ -185,9 +184,9 @@ traverse_vertices (
clock_t t_max = 0;
clock_t t = 0;
printf ("\nAdjacencies to vertices\n");
h5t_iterator_t* iter = H5FedBeginTraverseEntities (f, 2);
while ((local_id = H5FedTraverseEntities (f, iter)) >= 0) {
print_adjacencies_of_vertex (f, local_id, &t);
h5t_iterator_t* iter = H5FedBeginTraverseEntities (m, 2);
while ((local_id = H5FedTraverseEntities (iter)) >= 0) {
print_adjacencies_of_vertex (m, local_id, &t);
num++;
t_total += t;
if (t < t_min) t_min = t;
@@ -201,12 +200,12 @@ traverse_vertices (
(double)t_min / (double)CLOCKS_PER_SEC,
(double)t_total / (double)CLOCKS_PER_SEC / (double)num,
(double)t_max / (double)CLOCKS_PER_SEC );
return H5FedEndTraverseEntities (f, iter);
return H5FedEndTraverseEntities (iter);
}
static h5_err_t
traverse_edges (
h5_file_t* const f
h5t_mesh_t* const m
) {
h5_loc_id_t local_id;
h5_loc_idx_t num = 0;
@@ -215,9 +214,9 @@ traverse_edges (
clock_t t_max = 0;
clock_t t = 0;
printf ("\nAdjacencies to edges\n");
h5t_iterator_t* iter = H5FedBeginTraverseEntities (f, 1);
while ((local_id = H5FedTraverseEntities (f, iter)) >= 0) {
print_adjacencies_of_edge (f, local_id, &t);
h5t_iterator_t* iter = H5FedBeginTraverseEntities (m, 1);
while ((local_id = H5FedTraverseEntities (iter)) >= 0) {
print_adjacencies_of_edge (m, local_id, &t);
num++;
t_total += t;
if (t < t_min) t_min = t;
@@ -231,12 +230,12 @@ traverse_edges (
(double)t_min / (double)CLOCKS_PER_SEC,
(double)t_total / (double)CLOCKS_PER_SEC / (double)num,
(double)t_max / (double)CLOCKS_PER_SEC );
return H5FedEndTraverseEntities (f, iter);
return H5FedEndTraverseEntities (iter);
}
static h5_err_t
traverse_elems (
h5_file_t* const f
h5t_mesh_t* const m
) {
h5_loc_id_t local_id;
h5_loc_idx_t num = 0;
@@ -244,10 +243,10 @@ traverse_elems (
clock_t t_min = CLOCKS_PER_SEC;
clock_t t_max = 0;
clock_t t = 0;
printf ("\nAdjacencies to tetrahedra\n");
h5t_iterator_t* iter = H5FedBeginTraverseEntities (f, 0);
while ((local_id = H5FedTraverseEntities (f, iter)) >= 0) {
print_adjacencies_of_elem (f, local_id, &t);
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);
num++;
t_total += t;
if (t < t_min) t_min = t;
@@ -261,41 +260,41 @@ traverse_elems (
(double)t_min / (double)CLOCKS_PER_SEC,
(double)t_total / (double)CLOCKS_PER_SEC / (double)num,
(double)t_max / (double)CLOCKS_PER_SEC);
return H5FedEndTraverseEntities (f, iter);
return H5FedEndTraverseEntities (iter);
}
static h5_err_t
traverse_level (
h5_file_t* const f,
const h5t_lvl_idx_t level_id
h5t_mesh_t* const m,
const h5_lvl_idx_t level_id
) {
printf (" Setting level to %d\n", level_id);
H5FedSetLevel (f, level_id);
traverse_vertices (f);
traverse_edges (f);
traverse_elems (f);
H5FedSetLevel (m, level_id);
traverse_vertices (m);
traverse_edges (m);
traverse_elems (m);
return H5_SUCCESS;
}
static h5_err_t
traverse_mesh (
h5_file_t* const f,
const h5_id_t mesh_id,
const h5_oid_t mesh_type
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);
H5FedOpenMesh (f, mesh_id, mesh_type);
h5_size_t num_levels = H5FedGetNumLevels (f);
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 (f, level_id);
traverse_level (m, level_id);
}
/* done */
H5FedCloseMesh (f);
H5FedCloseMesh (m);
return H5_SUCCESS;
}
@@ -310,14 +309,14 @@ main (
H5SetVerbosityLevel (2);
/* open file and get number of meshes */
h5_file_t *f = H5OpenFile (FNAME, H5_O_RDONLY, 0);
h5_size_t num_meshes = H5FedGetNumMeshes (f, MESH_TYPE);
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);
/* loop over all meshes */
h5_id_t mesh_id;
for (mesh_id = 0; mesh_id < num_meshes; mesh_id++) {
traverse_mesh (f, mesh_id, MESH_TYPE);
traverse_mesh (f, mesh_id);
}
/* done */
@@ -2,26 +2,28 @@
#include <stdlib.h>
#include "H5hut.h"
#if defined (PARALLEL_IO)
#include <mpi.h>
#endif
const h5_oid_t MESH_TYPE = H5_TRIANGLE_MESH;
const char* FNAME = "simple_triangle.h5";
static h5_err_t
traverse_vertices (
h5_file_t* const f
h5t_mesh_t* const m
) {
/* get number of vertices we have to expect */
h5_size_t num_vertices_expect = H5FedGetNumVerticesTotal (f);
h5_size_t num_vertices_expect = H5FedGetNumVerticesTotal (m);
/* get iterator for co-dim 2 entities, i.e. vertices */
h5t_iterator_t* iter = H5FedBeginTraverseEntities (f, 2);
h5t_iterator_t* iter = H5FedBeginTraverseEntities (m, 2);
/* iterate */
h5_loc_id_t local_id;
h5_size_t num_vertices = 0;
while ((local_id = H5FedTraverseEntities ( f, iter )) >= 0) {
while ((local_id = H5FedTraverseEntities (iter)) >= 0) {
h5_float64_t P[3];
H5FedGetVertexCoordsByID (f, local_id, P);
H5FedGetVertexCoordsByID (m, local_id, P);
char v[256];
snprintf (v, sizeof(v), "=%llx=", (long long)local_id);
printf ("| %-18s | (%f, %f, %f) |\n",
@@ -30,7 +32,7 @@ traverse_vertices (
}
/* done */
H5FedEndTraverseEntities (f, iter);
H5FedEndTraverseEntities (iter);
/* report error if we got a different number then expected */
if (num_vertices != num_vertices_expect) {
@@ -45,22 +47,22 @@ traverse_vertices (
static h5_err_t
traverse_edges (
h5_file_t* const f
h5t_mesh_t* const m
) {
printf ( "Travering edges on level %lld:\n", (long long)H5FedGetLevel(f) );
printf ( "Travering edges on level %lld:\n", (long long)H5FedGetLevel(m) );
/* get iterator for co-dim 1 entities, i.e. edges */
h5t_iterator_t* iter = H5FedBeginTraverseEntities (f, 1);
h5t_iterator_t* iter = H5FedBeginTraverseEntities (m, 1);
/* iterate */
h5_loc_id_t local_id;
h5_size_t num_edges = 0;
while ((local_id = H5FedTraverseEntities (f, iter)) >= 0) {
while ((local_id = H5FedTraverseEntities (iter)) >= 0) {
char v[256];
char k[256];
h5_loc_id_t local_vids[4];
snprintf ( k, sizeof(k), "=%llx=", (long long)local_id );
H5FedGetVertexIndicesOfEntity ( f, local_id, local_vids );
H5FedGetVertexIndicesOfEntity ( m, local_id, local_vids );
snprintf ( v, sizeof(v), "=[%lld,%lld]=",
(long long)local_vids[0], (long long)local_vids[1] );
printf ( "| %-18s | %-18s |\n", k, v );
@@ -68,7 +70,7 @@ traverse_edges (
}
/* done */
H5FedEndTraverseEntities ( f, iter );
H5FedEndTraverseEntities (iter);
printf (" Number of edges: %lld\n", (long long)num_edges);
return H5_SUCCESS;
@@ -76,22 +78,22 @@ traverse_edges (
static h5_err_t
traverse_boundary_edges (
h5_file_t* const f
h5t_mesh_t* const m
) {
printf ( "Travering boundary edges on level %lld:\n", (long long)H5FedGetLevel(f) );
printf ("Travering boundary edges on level %lld:\n", (long long)H5FedGetLevel(m));
/* get iterator for co-dim 1 entities, i.e. edges */
h5t_iterator_t* iter = H5FedBeginTraverseBoundaryFaces (f, 1);
h5t_iterator_t* iter = H5FedBeginTraverseBoundaryFaces (m, 1);
/* iterate */
h5_loc_id_t local_id;
h5_size_t num_edges = 0;
while ((local_id = H5FedTraverseEntities (f, iter)) >= 0) {
while ((local_id = H5FedTraverseEntities (iter)) >= 0) {
char v[256];
char k[256];
h5_loc_id_t local_vids[4];
snprintf ( k, sizeof(k), "=%llx=", (long long)local_id );
H5FedGetVertexIndicesOfEntity ( f, local_id, local_vids );
snprintf ( k, sizeof(k), "=%llx=", (long long)local_id);
H5FedGetVertexIndicesOfEntity (m, local_id, local_vids);
snprintf ( v, sizeof(v), "=[%lld,%lld]=",
(long long)local_vids[0], (long long)local_vids[1] );
printf ( "| %-18s | %-18s |\n", k, v );
@@ -99,7 +101,7 @@ traverse_boundary_edges (
}
/* done */
H5FedEndTraverseEntities ( f, iter );
H5FedEndTraverseEntities (iter);
printf (" Number of edges: %lld\n", (long long)num_edges);
return H5_SUCCESS;
@@ -107,23 +109,23 @@ traverse_boundary_edges (
static h5_err_t
traverse_elems (
h5_file_t* const f
h5t_mesh_t* const m
) {
/* get number of elements we have to expect */
h5_size_t num_elems_expect = H5FedGetNumElementsTotal (f);
h5_size_t num_elems_expect = H5FedGetNumElementsTotal (m);
/* get iterator for co-dim 0 */
h5t_iterator_t* iter = H5FedBeginTraverseEntities (f, 0);
h5t_iterator_t* iter = H5FedBeginTraverseEntities (m, 0);
/* iterate over all co-dim 0 entities, i.e. elements */
h5_loc_id_t local_id;
h5_size_t num_elems = 0;
while ((local_id = H5FedTraverseEntities (f, iter)) >= 0) {
while ((local_id = H5FedTraverseEntities (iter)) >= 0) {
char v[256];
char t[256];
h5_loc_id_t local_vids[4];
snprintf (t, sizeof(t), "=%llx=", (long long)local_id);
H5FedGetVertexIndicesOfEntity (f, local_id, local_vids);
H5FedGetVertexIndicesOfEntity (m, local_id, local_vids);
snprintf (v, sizeof(v), "=[%lld,%lld,%lld]=",
(long long)local_vids[0],
(long long)local_vids[1],
@@ -133,7 +135,7 @@ traverse_elems (
}
/* done */
H5FedEndTraverseEntities (f, iter);
H5FedEndTraverseEntities (iter);
/* report error if we got a different number then expected */
if (num_elems != num_elems_expect) {
@@ -148,39 +150,82 @@ traverse_elems (
return H5_SUCCESS;
}
/*
Traverse elements and output coordinates
*/
static h5_err_t
traverse_elems2 (
h5t_mesh_t* const m
) {
/* get number of elements we have to expect */
h5_size_t num_elems_expect = H5FedGetNumElementsTotal (m);
/* get iterator for co-dim 0 */
h5t_iterator_t* iter = H5FedBeginTraverseEntities (m, 0);
/* iterate over all co-dim 0 entities, i.e. elements */
h5_loc_id_t local_id;
h5_size_t num_elems = 0;
while ((local_id = H5FedTraverseEntities (iter)) >= 0) {
printf ("%05llu", (unsigned long long)num_elems);
h5_loc_id_t local_vids[4];
H5FedGetVertexIndicesOfEntity (m, local_id, local_vids);
int i;
for (i = 0; i < 3; i++) {
h5_float64_t P[3];
H5FedGetVertexCoordsByIndex (m, local_vids[i], P);
printf (" %8.6f %8.6f %8.6f", P[0], P[1], P[2]);
}
printf ("\n");
num_elems++;
}
/* done */
H5FedEndTraverseEntities (iter);
/* report error if we got a different number then expected */
if (num_elems != num_elems_expect) {
fprintf (stderr, "!!! Got %lld elements, but expected %lld.\n",
(long long)num_elems, (long long)num_elems_expect);
exit(1);
}
return H5_SUCCESS;
}
static h5_err_t
traverse_level (
h5_file_t* const f,
h5t_mesh_t* const m,
const h5_loc_id_t level_id
) {
printf (" Setting level to %d\n", level_id);
H5FedSetLevel (f, level_id);
traverse_vertices (f);
traverse_edges (f);
traverse_boundary_edges (f);
traverse_elems (f);
H5FedSetLevel (m, level_id);
traverse_vertices (m);
traverse_edges (m);
traverse_boundary_edges (m);
traverse_elems (m);
traverse_elems2 (m);
return H5_SUCCESS;
}
static h5_err_t
traverse_mesh (
h5_file_t* const f,
const h5_id_t mesh_id,
const h5_oid_t mesh_type
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);
H5FedOpenMesh (f, mesh_id, mesh_type);
h5_size_t num_levels = H5FedGetNumLevels (f);
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 (f, level_id);
traverse_level (m, level_id);
}
/* done */
H5FedCloseMesh (f);
H5FedCloseMesh (m);
return H5_SUCCESS;
}
@@ -193,20 +238,24 @@ main (
/* abort program on error, so we don't have to handle them */
H5SetErrorHandler (H5AbortErrorhandler);
H5SetVerbosityLevel (3);
H5SetVerbosityLevel (H5_DEBUG_ALL);
/* open file and get number of meshes */
h5_file_t* f = H5OpenFile (FNAME, H5_O_RDONLY, 0);
h5_size_t num_meshes = H5FedGetNumMeshes (f, MESH_TYPE);
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);
/* loop over all meshes */
h5_id_t mesh_id;
for (mesh_id = 0; mesh_id < num_meshes; mesh_id++) {
traverse_mesh (f, mesh_id, MESH_TYPE);
traverse_mesh (f, mesh_id);
}
/* done */
H5CloseFile (f);
#if defined (PARALLEL_IO)
MPI_Finalize ();
#endif
return 0;
}
@@ -3,7 +3,6 @@
#include "H5hut.h"
const h5_oid_t MESH_TYPE = H5_TRIANGLE_MESH;
const char* FNAME = "simple_triangle.h5";
typedef struct vertex {
@@ -39,31 +38,31 @@ main (
H5SetVerbosityLevel (5);
/* open file and add mesh */
h5_file_t* const f = H5OpenFile (FNAME, H5_O_WRONLY, 0);
H5FedAddMesh (f, MESH_TYPE);
const h5_file_t f = H5OpenFile (FNAME, H5_O_WRONLY, 0);
h5t_mesh_t* m;
H5FedAddTriangleMesh (f, "0", &m);
/* store vertices */
H5FedBeginStoreVertices (f, num_vertices);
H5FedBeginStoreVertices (m, num_vertices);
int i;
for (i = 0; i < num_vertices; i++) {
H5FedStoreVertex (f, -1, Vertices[i].P);
H5FedStoreVertex (m, -1, Vertices[i].P);
}
H5FedEndStoreVertices (f);
H5FedEndStoreVertices (m);
/* store elements */
H5FedBeginStoreElements (f, num_elems);
H5FedBeginStoreElements (m, num_elems);
for (i = 0; i < num_elems; i++) {
H5FedStoreElement (f, Elems[i].vids);
H5FedStoreElement (m, Elems[i].vids);
}
H5FedEndStoreElements (f);
H5FedEndStoreElements (m);
/* add 1. Level */
H5FedAddLevel(f);
H5FedBeginRefineElements (f);
H5FedRefineElement (f, 0);
H5FedEndRefineElements (f);
H5FedBeginRefineElements (m);
H5FedRefineElement (m, 0);
H5FedEndRefineElements (m);
H5FedCloseMesh (f);
H5FedCloseMesh (m);
H5CloseFile (f);
return 0;
}
@@ -3,7 +3,6 @@
#include "H5hut.h"
const h5_oid_t MESH_TYPE = H5_TRIANGLE_MESH;
const char* FNAME = "simple_dunetest.h5";
typedef struct vertex {
@@ -46,25 +45,26 @@ main (
H5SetVerbosityLevel (2);
/* open file and add mesh */
h5_file_t* const f = H5OpenFile (FNAME, H5_O_WRONLY, 0);
H5FedAddMesh (f, MESH_TYPE);
const h5_file_t f = H5OpenFile (FNAME, H5_O_WRONLY, 0);
h5t_mesh_t* m;
H5FedAddTriangleMesh (f, "0", &m);
/* store vertices */
H5FedBeginStoreVertices (f, num_vertices);
H5FedBeginStoreVertices (m, num_vertices);
int i;
for (i = 0; i < num_vertices; i++) {
H5FedStoreVertex (f, -1, Vertices[i].P);
H5FedStoreVertex (m, -1, Vertices[i].P);
}
H5FedEndStoreVertices (f);
H5FedEndStoreVertices (m);
/* store elements */
H5FedBeginStoreElements (f, num_elems);
H5FedBeginStoreElements (m, num_elems);
for (i = 0; i < num_elems; i++) {
H5FedStoreElement (f, Elems[i].vids);
H5FedStoreElement (m, Elems[i].vids);
}
H5FedEndStoreElements (f);
H5FedEndStoreElements (m);
H5FedCloseMesh (f);
H5FedCloseMesh (m);
H5CloseFile (f);
return 0;
}
+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
+79
View File
@@ -0,0 +1,79 @@
#
# Copyright (c) 2006-2015, The Regents of the University of California,
# through Lawrence Berkeley National Laboratory (subject to receipt of any
# required approvals from the U.S. Dept. of Energy) and the Paul Scherrer
# Institut (Switzerland). All rights reserved.!
#
# License: see file COPYING in top level of source distribution.
#
AM_CPPFLAGS += -I${abs_top_srcdir}/src/include
FFLAGS += -cpp $(AM_CPPFLAGS)
AM_LDFLAGS += -L${abs_top_builddir}/src/h5core/.libs
LDADD =
if ENABLE_EXAMPLES
if ENABLE_C
LDADD +=
endif
if ENABLE_FORTRAN
LDADD += -lH5hutF
AM_LDFLAGS += -L${abs_top_builddir}/src/Fortran/.libs
endif
LDADD += -lH5hut
noinst_PROGRAMS =
if ENABLE_C
noinst_PROGRAMS += \
query \
read_core_vfd \
read_canonicalview \
read_setnparticles \
read_setview \
read_strided \
write_core_vfd \
write_setnparticles \
write_setview \
write_strided
endif
if ENABLE_FORTRAN
if ENABLE_PARALLEL
noinst_PROGRAMS += \
read_core_vfdf \
read_canonicalviewf \
read_setnparticlesf \
read_setviewf \
read_stridedf \
write_core_vfdf \
write_setnparticlesf \
write_setviewf \
write_stridedf
endif
endif
EXTRA_PROGRAMS =
read_core_vfdf_SOURCES = read_core_vfdf.f90
read_canonicalviewf_SOURCES = read_canonicalviewf.f90
read_setnparticlesf_SOURCES = read_setnparticlesf.f90
read_setviewf_SOURCES = read_setviewf.f90
read_stridedf_SOURCES = read_stridedf.f90
write_core_vfdf_SOURCES = write_core_vfdf.f90
write_setnparticlesf_SOURCES = write_setnparticlesf.f90
write_setviewf_SOURCES = write_setviewf.f90
write_stridedf_SOURCES = write_stridedf.f90
endif
%.o : %.f90
$(FC) $(FFLAGS) -c $<
clean-local:
$(RM) -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
-52
View File
@@ -1,52 +0,0 @@
# Makefile Rules (used by both GNUMakefile and Makefile)
# now "all" rule is defined in the main makefile
# all: H5PartTest H5PartTest.o H5Part.o
vtkhdf.o: vtkhdf.cc
$(CXX) $(CFLAGS) -c vtkhdf.cc
H5PartTest: H5PartTest.o H5Part.o
$(CXX) -o H5PartTest H5Part.o H5PartTest.o $(LDFLAGS)
Bench: Bench.c H5Part.o
$(CC) $(CFLAGS) -o Bench Bench.c H5Part.o $(LDFLAGS)
H5PartTest.o: H5PartTest.cc H5Part.hh
$(CXX) $(CFLAGS) -DREGRESSIONTEST -c H5PartTest.cc
H5PartTestParallel.o: H5PartTestParallel.cc H5Part.hh
$(CXX) $(CFLAGS) -c H5PartTestParallel.cc
H5PartTestParallel: H5PartTestParallel.o H5Part.o
$(CXX) -o H5PartTestParallel H5Part.o H5PartTestParallel.o $(LDFLAGS)
H5PartAndreasTest.o: H5PartAndreasTest.cc H5Part.hh
$(CXX) $(CFLAGS) -c H5PartAndreasTest.cc
H5PartAndreasTest: H5PartAndreasTest.o H5Part.o
$(CXX) -o H5PartAndreasTest H5Part.o H5PartAndreasTest.o $(LDFLAGS)
H5Part.o: H5Part.c H5Part.h
$(CC) $(CFLAGS) -c H5Part.c
H5PartF.o: H5PartF.c Underscore.h H5Part.h
$(CC) $(CFLAGS) -w -c H5PartF.c
H5testF.o: H5testF.f H5Part.inc
$(F90) $(CFLAGS) -c H5testF.f
H5testF: H5testF.o H5Part.o H5PartF.o
$(F90) $(CFLAGS) -o H5testF H5testF.o H5PartF.o H5Part.o $(LDFLAGS) -lC
vtkxml.o: vtkxml.cc
$(CXX) $(CFLAGS) -c vtkxml.cc
Underscore.h: TestUnderscore.f TestUnderscoreC.c
rm -f TestUnderscore.o TestUnderscoreC.o TestUnderscore
$(CC) -c TestUnderscoreC.c
$(F90) -c TestUnderscore.f
$(F90) -o TestUnderscore TestUnderscore.o TestUnderscoreC.o -lC
./TestUnderscore >& Underscore.h
clean:
rm -rf *~ *.o H5PartTest
-193
View File
@@ -1,193 +0,0 @@
/*
Implementation file for implementing the H5Fed application programming
interface (API) in the C++ language.
Copyright 2006-2007
Paul Scherrer Institut, Villigen, Switzerland;
Benedikt Oswald;
Achim Gsell
All rights reserved.
Authors
Benedikt Oswald, Achim Gsell
Warning
This code is under development.
*/
/*!
Some conventions:
Functions:
Name:
ThisIsAFunction()
Return values:
-1 or NULL signals an error
\note
In function names we use the words \b get and \b store insteed of
\b read and \b write, because no I/O is actually done in these
functions.
*/
/** include proprietary header files */
#include "H5Fed.hh"
/** \brief make the C API functions available so that
* we can used them in the implementation of the H5Fed class
* member functions implementations.
*/
//extern "C"
//{
// #include "../../H5Fed.h"
//}
/** activate namespaces */
using namespace std;
namespace H5Fed
{
/*!
\defgroup h5fed_cpp_api H5Fed CPP API
*/
/** \brief implement constructor without arguments */
H5Fed::H5Fed()
{
/** initialize internal variables */
filename_.erase();
}
/** \brief implement constructor without arguments */
H5Fed::H5Fed(std::string filename)
{
/** initialize internal variables */
filename_.erase();
filename_.append(filename);
}
/** \brief implement constructor */
H5Fed::~H5Fed()
{
/** initialize internal variables */
filename_.erase();
}
/** \brief Set name of H5Fed file to be accessed */
H5FED_RETURN_CODE H5Fed::filename(std::string filename)
{
/** initialize internal variables */
filename_.erase();
filename_.append(filename);
return(OKCODE);
}
/** \brief retrieve name of H5Fed file to be accessed */
std::string H5Fed::filename()
{
return(filename_);
}
/*!
\ingroup h5fed_cpp_api
Open file. This function is available in the paralell
and serial version. In the serial case \c comm may have any value.
\return
\return
\note
File is always opened in read/writer mode!
\note
Implement as wrapper of \c H5_open_file()!
*/
H5FED_RETURN_CODE H5Fed::open_file()
{
return(OKCODE);
}
/*!
\ingroup h5fed_cpp_api
Close file. This function is available in the paralell
and serial version. In the serial case \c comm may have
any value.
\return
\return
\note
File is always opened in read/writer mode!
\note
Implement as wrapper of \c H5_open_file()!
*/
H5FED_RETURN_CODE H5Fed::closeFile()
{
return(OKCODE);
}
/****** STORE routines*****************************************************/
/*!
\ingroup h5fed_c_api
Stores the the coordinates of a specific vertex at level \c level
with id \c vertex_id of the tetrahedral mesh.
\return value \c >=0 on success
\return \c -1 on error
*/
H5FED_RETURN_CODE H5Fed::storeVertexCoordinate(
unsigned int level, /*!< mesh level */
unsigned int vertex_id, /*!< global vertex id */
std::vector<double> /*!< 3-tuple of coordinates */
)
{
return(OKCODE);
}
/*!
\ingroup h5fed_c_api
Stores the 4-tuple, that contains the specific indices describing
a tetrahedron with id \c tet_id at level \c level of the tetrahedral
mesh.
\return value \c >=0 on success
\return \c -1 on error
*/
H5FED_RETURN_CODE H5Fed::H5FedStoreTetrahedron (
const unsigned int level, /*!< mesh level */
const unsigned int tet_id, /*!< global tetrahedron id */
const unsigned int parent_id, /*!< parent id if level \c >0 else \x -1 */
const std::vector<unsigned int> tet /*!< 4-tuple with vertex id's */
)
{
return(OKCODE);
}
}
-165
View File
@@ -1,165 +0,0 @@
/*
Header file for declaring the H5Fed application programming
interface (API) in the C++ language. The header files follows
the declaration of the C application programming interface.
Copyright 2006-2007
Paul Scherrer Institut, Villigen, Switzerland;
Benedikt Oswald;
Achim Gsell
All rights reserved.
Authors
Benedikt Oswald, Achim Gsell
Warning
This code is under development.
*/
/*!
Some conventions:
Functions:
Name:
ThisIsAFunction()
Return values:
-1 or NULL signals an error
\note
In function names we use the words \b get and \b store insteed of
\b read and \b write, because no I/O is actually done in these
functions.
*/
/** include standard header files */
#include <iostream>
#include <ostream>
#include <iterator>
#include <fstream>
#include <vector>
#include <iomanip>
#include <string>
#include <complex>
/** include fundamental HDF5 header files */
#include <hdf5.h>
#ifndef H5FED_HH
#define H5FED_HH
namespace H5Fed
{
/** \brief Define return codes */
enum H5FED_RETURN_CODE{OKCODE=0,ERROR=-1};
class H5Fed
{
public:
/** \brief infrastructure routines */
H5Fed(); /** \brief Constructor without argument */
H5Fed(std::string filename); /** \brief Constructor without argument */
~H5Fed(); /** \brief Class destructor */
H5FED_RETURN_CODE filename(std::string filename); /** \brief Set name of H5Fed file to be accessed */
std::string filename(); /** \brief retrieve name of H5Fed file to be accessed */
/****** General routines *****************************************************/
H5FED_RETURN_CODE open_file(); /** \brief open the file */
H5FED_RETURN_CODE closeFile(); /** \brief close the file */
/****** INQUIRY routines *****************************************************/
/****** STORE routines*****************************************************/
/*!
\ingroup h5fed_c_api
Stores the the coordinates of a specific vertex at level \c level
with id \c vertex_id of the tetrahedral mesh.
\return value \c >=0 on success
\return \c -1 on error
*/
H5FED_RETURN_CODE storeVertexCoordinate(
unsigned int level, /*!< mesh level */
unsigned int vertex_id, /*!< global vertex id */
std::vector<double> /*!< 3-tuple of coordinates */
);
/*!
\ingroup h5fed_c_api
Stores the 4-tuple, that contains the specific indices describing
a tetrahedron with id \c tet_id at level \c level of the tetrahedral
mesh.
\return value \c >=0 on success
\return \c -1 on error
*/
H5FED_RETURN_CODE H5FedStoreTetrahedron (
const unsigned int level, /*!< mesh level */
const unsigned int tet_id, /*!< global tetrahedron id */
const unsigned int parent_id, /*!< parent id if level \c >0 else \x -1 */
const std::vector<unsigned int> tet /*!< 4-tuple with vertex id's */
);
/****** UPWARD ADJACENCY routines *********************************************/
/****** DOWNWARD ADJACENCY routines *********************************************/
/****** routines for accessing degrees of freedom DoF *************************/
protected:
private:
/** book keeping */
std::string filename_; /** \brief Name of H5Fed file to be accessed */
};
}
#endif /** H5FED_HH */
-18
View File
@@ -1,18 +0,0 @@
# COMPILERS
CC = @CC@
CXX = @CXX@
LIBS = @LIBS@
INCLUDES = -I../include @INCLUDES@
OBJEXT = o
lib_LIBRARIES = libH5XX.a
include_HEADERS = H5Fed.hh
libH5XX_a_SOURCES = H5Fed.cc
libH5XX.a: $(libH5XX_a_OBJECTS)
${AR} rucs $@ $^
%.o : %.cc
$(CXX) $(CFLAGS) $(INC) -c $<
-348
View File
@@ -1,348 +0,0 @@
/*
Copyright 2007-2008
Paul Scherrer Institut, Villigen, Switzerland;
Benedikt Oswald;
Achim Gsell
All rights reserved.
Authors
Achim Gsell
Warning
This code is under development.
*/
/*!
Some conventions:
Functions:
Name:
thisIsAFunction()
Return values:
negative value or NULL signals an error
Macros:
UPPERCASE_WITH_UNDERSCORE
\note
In function names we use the words \b get and \b store insteed of
\b read and \b write, because no I/O is actually done in these
functions.
*/
#include "h5core/h5_core.h"
#include "H5.h"
/****** General routines *****************************************************/
/*!
\ingroup h5hut_file
Open file with name \c filbename. This function is available in the parallel
and serial version. In the serial case \c comm may have any value.
\return File handle.
\return NULL on error.
*/
h5_file_p
H5OpenFile (
const char* filename, /*!< file name */
h5_int32_t flags, /*!< file open flags */
MPI_Comm comm /*!< MPI communicator */
) {
H5_API_ENTER (h5_file_p);
H5_API_RETURN (h5_open_file (filename, flags, comm));
}
/*!
\ingroup h5hut_file
Close file.
\return \c H5_SUCCESS or error code
*/
h5_err_t
H5CloseFile (
h5_file_t* const f /*!< file handle */
) {
H5_API_ENTER (h5_err_t);
H5_API_RETURN (h5_close_file (f));
}
/*!
\ingroup h5hut_file
Close file.
\return \c H5_SUCCESS or error code
*/
h5_err_t
H5CheckFile (
h5_file_t* const f /*!< file handle */
) {
H5_API_ENTER (h5_err_t);
H5_API_RETURN (h5_check_filehandle (f));
}
/*!
\ingroup h5hut_model
Define format of the step names.
Example: ==H5SetStepNameFormat( f, "Step", 6 )== defines step names
like ==Step#000042==.
\return \c H5_SUCCESS or error code
*/
h5_err_t
H5SetStepNameFormat (
h5_file_t* const f, /*!< Handle to file */
const char* name, /*!< Prefix */
const h5_int64_t width /*!< Width of the number */
) {
H5_API_ENTER (h5_err_t);
H5_API_RETURN (h5_set_stepname_fmt (f, name, width));
}
/*!
\ingroup h5hut_model
Get format of the step names.
\return value \c >=0 on success
\return -1 on error
*/
h5_err_t
H5GetStepNameFormat (
h5_file_t* const f, /*!< Handle to file */
char* name, /*!< OUT: Prefix */
const h5_size_t l_name, /*!< length of buffer name */
int* width /*!< OUT: Width of the number */
) {
H5_API_ENTER (h5_err_t);
H5_API_RETURN (h5_get_stepname_fmt (f, name, l_name, width));
}
/*!
\ingroup h5hut_model
Set the current step.
\return \c H5_SUCCESS or error code
*/
h5_err_t
H5SetStep (
h5_file_t* const f, /*!< [in] Handle to open file */
const h5_id_t step /*!< [in] Step to set. */
) {
H5_API_ENTER (h5_err_t);
H5_API_RETURN (h5_set_step (f, step));
}
/*!
\ingroup h5hut_model
Get current step.
\return \c H5_SUCCESS or error code
*/
h5_id_t
H5GetStep (
h5_file_t* const f /*!< Handle to open file */
) {
H5_API_ENTER (h5_id_t);
H5_API_RETURN (h5_get_step (f));
}
/*!
\ingroup h5hut_file
Get the number of processors.
\param[in] f File handle.
\return Number of processors.
\return \c -1 on error.
*/
int
H5GetNumProcs (
h5_file_t* const f
) {
H5_API_ENTER (int);
H5_API_RETURN (h5_get_num_procs(f));
}
/*!
\ingroup h5hut_model
Get the number of time-steps that are currently stored in the file
\c f.
It works for both reading and writing of files, but is probably
only typically used when you are reading.
\param[in] f File handle.
\return number of time-steps or error code
*/
h5_ssize_t
H5GetNumSteps (
h5_file_t* const f
) {
H5_API_ENTER (h5_ssize_t);
H5_API_RETURN (h5_get_num_steps(f));
}
/*!
\ingroup h5_inquiry
Query whether a particular step already exists in the file.
\param[in] f File handle.
\param[in] stepno Step number to query for existence
\return true or false
*/
h5_err_t
H5HasStep (
h5_file_t* const f,
h5_id_t stepno
) {
H5_API_ENTER (h5_err_t);
H5_API_RETURN (h5_has_step (f, stepno));
}
/*!
\ingroup h5hut_model
Start traversing steps.
\return \c H5_SUCCESS or error code
*/
h5_err_t
H5StartTraverseSteps (
h5_file_t* const f /*!< Handle to open file */
) {
H5_API_ENTER (h5_err_t);
H5_API_RETURN (h5_start_traverse_steps (f));
}
/*!
\ingroup h5hut_model
Traverse steps.
\return \c H5_SUCCESS or error code
*/
h5_err_t
H5TraverseSteps (
h5_file_t* const f /*!< Handle to open file */
) {
H5_API_ENTER (h5_err_t);
H5_API_RETURN (h5_traverse_steps (f));
}
/*!
\ingroup h5hut_file
Set the `throttle` factor, which causes HDF5 write and read
calls to be issued in that number of batches.
This can prevent large concurrency parallel applications that
use independent writes from overwhelming the underlying
parallel file system.
Throttling only works with the H5_VFD_MPIPOSIX or
H5_VFD_INDEPENDENT drivers and is only available in
the parallel library.
\return \c H5_SUCCESS
*/
#ifdef PARALLEL_IO
h5_err_t
H5SetThrottle (
h5_file_t* f,
int factor
) {
H5_API_ENTER (h5_err_t);
H5_API_RETURN (h5_set_throttle(f, factor));
}
#endif // PARALLEL_IO
/*!
\ingroup h5hut_error
Set verbosity level to \c level.
\return \c H5_SUCCESS
*/
h5_err_t
H5SetVerbosityLevel (
const h5_id_t level
) {
H5_API_ENTER (h5_err_t);
H5_API_RETURN (h5_set_debuglevel (level));
}
/*!
\ingroup h5hut_error
Set error handler to \c handler.
\return \c H5_SUCCESS
*/
h5_err_t
H5SetErrorHandler (
h5_errorhandler_t handler
) {
H5_API_ENTER (h5_err_t);
H5_API_RETURN (h5_set_errorhandler (handler));
}
/*!
\ingroup h5hut_error
Get current error handler.
\return Pointer to error handler.
*/
h5_errorhandler_t
H5GetErrorHandler (
void
) {
H5_API_ENTER (h5_errorhandler_t);
H5_API_RETURN (h5_get_errorhandler());
}
h5_err_t
H5ReportErrorhandler (
const char* fmt,
va_list ap
) {
return h5_report_errorhandler (fmt, ap);
}
h5_err_t
H5AbortErrorhandler (
const char* fmt,
va_list ap
) {
return h5_abort_errorhandler (fmt, ap);
}
/*!
\ingroup h5hut_error
Get last error code.
\return error code
*/
h5_err_t
H5GetErrno (
void
) {
return h5_get_errno ();
}
-583
View File
@@ -1,583 +0,0 @@
/*!
\defgroup h5block_c_api H5Block C API
*/
/*!
\internal
\defgroup h5block_kernel H5Block Kernel
*/
/*!
\internal
\defgroup h5block_private H5Block Private
*/
/*!
\ingroup h5block_c_api
\defgroup h5block_model Setting up the Data Model
*/
/*!
\ingroup h5block_c_api
\defgroup h5block_data Reading and Writing Datasets
*/
/*!
\ingroup h5block_c_api
\defgroup h5block_attrib Reading and Writing Attributes
*/
/*!
\note
Different field sizes are allowed in the same time-step.
\note
The same layout can be used, if the size of the field matches the
size of the layout. If the size of the layout doesn't match the
size of the field, an error will be indicated.
\note
In write mode partitions are shrinked to make them non-overlaping. This
process may shrink the partitions more than required.
\note
In read-mode partitions may not cross boundaries. This means, if the grid
size is (X, Y, Z), all partitions must fit into this grid.
\todo
check whether layout is reasonable
API function names
*/
#include <stdlib.h>
#include <string.h>
#include "H5hut.h"
#include "h5core/h5_core.h"
/********************** defining the layout **********************************/
/*!
\ingroup h5block_model
Tests whether a view has been set, either directly with
\ref H5Block3dSetView or indirectly with \ref H5Block3dSetGrid.
\return 0 on false, 1 on true
*/
h5_int64_t
H5Block3dHasView (
h5_file_t *const f /*!< IN: File handle */
) {
H5_API_ENTER (h5_int64_t);
H5_API_RETURN (h5b_3d_has_view (f));
}
/*!
\ingroup h5block_model
Defines the partition of the field that this processor owns, using
Fortran ordering: the fastest moving index is \c i.
This routine uses an MPI_Allgather, so at large concurrency it should
be called as infrequently as possible. For instance, if several timesteps
use the same field dimensions, set the layout only once before the
first timestep.
\return \c H5_SUCCESS on success
*/
h5_err_t
H5Block3dSetView (
h5_file_t *const f, /*!< IN: File handle */
const h5_int64_t i_start, /*!< IN: start index of \c i */
const h5_int64_t i_end, /*!< IN: end index of \c i */
const h5_int64_t j_start, /*!< IN: start index of \c j */
const h5_int64_t j_end, /*!< IN: end index of \c j */
const h5_int64_t k_start, /*!< IN: start index of \c k */
const h5_int64_t k_end /*!< IN: end index of \c k */
) {
H5_API_ENTER (h5_err_t);
H5_API_RETURN (h5b_3d_set_view(f, i_start, i_end, j_start, j_end, k_start, k_end));
}
/*!
\ingroup h5block_model
Return the view of this processor.
\return \c H5_SUCCESS on success
*/
h5_err_t
H5Block3dGetView (
h5_file_t *const f, /*!< IN: File handle */
h5_size_t *i_start, /*!< OUT: start index of \c i */
h5_size_t *i_end, /*!< OUT: end index of \c i */
h5_size_t *j_start, /*!< OUT: start index of \c j */
h5_size_t *j_end, /*!< OUT: end index of \c j */
h5_size_t *k_start, /*!< OUT: start index of \c k */
h5_size_t *k_end /*!< OUT: end index of \c k */
) {
H5_API_ENTER (h5_err_t);
H5_API_RETURN (h5b_3d_get_view (f, i_start, i_end, j_start, j_end, k_start, k_end));
}
/*!
\ingroup h5block_model
Return the reduced (ghost-zone free) view of this processor.
\return \c H5_SUCCESS on success
*/
h5_err_t
H5Block3dGetReducedView (
h5_file_t *const f, /*!< IN: File handle */
h5_size_t *const i_start, /*!< OUT: start index of \c i */
h5_size_t *const i_end, /*!< OUT: end index of \c i */
h5_size_t *const j_start, /*!< OUT: start index of \c j */
h5_size_t *const j_end, /*!< OUT: end index of \c j */
h5_size_t *const k_start, /*!< OUT: start index of \c j */
h5_size_t *const k_end /*!< OUT: end index of \c j */
) {
H5_API_ENTER (h5_err_t);
H5_API_RETURN (h5b_3d_get_reduced_view(f, i_start, i_end, j_start, j_end, k_start, k_end));
}
/*!
\ingroup h5block_model
Define the chunk dimensions and enable chunking in the underlying
HDF5 dataset.
\return \c H5_SUCCESS on success
*/
h5_err_t
H5Block3dSetChunk (
h5_file_t *const f, /*!< IN: File handle */
const h5_size_t i, /*!< IN: size of \c i */
const h5_size_t j, /*!< IN: size of \c j */
const h5_size_t k /*!< IN: size of \c k */
) {
H5_API_ENTER (h5_err_t);
H5_API_RETURN (h5b_3d_set_chunk(f, i, j, k));
}
/*!
\ingroup h5block_model
Lookup the chunk dimensions of the underlying HDF5 dataset.
\return \c H5_SUCCESS on success
*/
h5_err_t
H5Block3dGetChunk (
h5_file_t *const f, /*!< IN: File handle */
const char *field_name, /*!< IN: name of dataset */
h5_size_t *const i, /*!< OUT: size of \c i */
h5_size_t *const j, /*!< OUT: size of \c j */
h5_size_t *const k /*!< OUT: size of \c k */
) {
H5_API_ENTER (h5_err_t);
H5_API_RETURN (h5b_3d_get_chunk(f, field_name, i, j, k));
}
#ifdef PARALLEL_IO
/*!
\ingroup h5block_model
Define an underlying 3D Cartesian grid on the processors with dimensions
(\c i,\c j,\c k). You can look up a processor's index into the grid
using \ref H5Block3dGetGridCoords.
This function can be used in conjunction with \ref H5Block3dSetDims
to setup the view for a regular grid.
The product of the dimensions must equal the size of the MPI communicator.
\return \c H5_SUCCESS on success
*/
h5_err_t
H5Block3dSetGrid (
h5_file_t *const f, /*!< IN: File handle */
const h5_size_t i, /*!< IN: dimension in \c i */
const h5_size_t j, /*!< IN: dimension in \c j */
const h5_size_t k /*!< IN: dimension in \c k */
) {
H5_API_ENTER (h5_err_t);
H5_API_RETURN (h5b_3d_set_grid(f, i, j, k));
}
/*!
\ingroup h5block_model
Look up the index (\c i, \c j, \c k) in the grid belonging to MPI processor
\c proc.
\return \c H5_SUCCESS on success
*/
h5_err_t
H5Block3dGetGridCoords (
h5_file_t *const f, /*!< IN: File handle */
const int proc, /*!< IN: MPI processor */
h5_int64_t *i, /*!< OUT: index in \c i */
h5_int64_t *j, /*!< OUT: index in \c j */
h5_int64_t *k /*!< OUT: index in \c k */
) {
H5_API_ENTER (h5_err_t);
H5_API_RETURN (h5b_3d_get_grid_coords(f, proc, i, j, k));
}
/*!
\ingroup h5block_model
Set the dimensions of each processor's block when the field is a regular
grid.
A grid must be already set with \ref H5Block3dSetGrid, and all processors
must specify the same dimensions.
\return \c H5_SUCCESS on success
*/
h5_err_t
H5Block3dSetDims (
h5_file_t *const f, /*!< IN: File handle */
const h5_size_t i, /*!< IN: dimension in \c i */
const h5_size_t j, /*!< IN: dimension in \c j */
const h5_size_t k /*!< IN: dimension in \c k */
) {
H5_API_ENTER (h5_err_t);
H5_API_RETURN (h5b_3d_set_dims(f, i, j, k));
}
#endif
/*!
\ingroup h5block_model
Sets the additional cells (\c i, \c j, \c k) in each direction to use as
the `halo` region (or `ghost zone`) that overlaps between neighboring
processors on the grid.
A grid with dimensions must already be set with \ref H5Block3dSetGrid and
\ref H5Block3dSetDims, and all processors must specify the same halo radii.
\return \c H5_SUCCESS on success
*/
h5_err_t
H5Block3dSetHalo (
h5_file_t *const f, /*!< IN: File handle */
const h5_size_t i, /*!< IN: radius in \c i */
const h5_size_t j, /*!< IN: radius in \c j */
const h5_size_t k /*!< IN: radius in \c k */
) {
H5_API_ENTER (h5_err_t);
H5_API_RETURN (h5b_3d_set_halo(f, i, j, k));
}
/*!
\ingroup h5block_model
Query number of fields in current time step.
\return \c H5_SUCCESS or error code
*/
h5_size_t
H5BlockGetNumFields (
h5_file_t *const f /*!< IN: file handle */
) {
H5_API_ENTER (h5_err_t);
H5_API_RETURN (h5b_get_num_fields(f));
}
/*!
\ingroup h5block_model
Get the name, rank and dimensions of the field specified by the
index \c idx.
\c elem_rank reports the rank of the elements in the field
(e.g. scalar or vector).
This function can be used to retrieve all fields bound to the
current time-step by looping from \c 0 to the number of fields
minus one. The number of fields bound to the current time-step
can be queried by calling the function \ref H5BlockGetNumFields.
\return \c H5_SUCCESS or error code
*/
h5_err_t
H5BlockGetFieldInfo (
h5_file_t *const f, /*!< IN: file handle */
const h5_size_t idx, /*!< IN: index of field */
char *name, /*!< OUT: field name */
const h5_size_t len_name, /*!< IN: buffer size */
h5_size_t *field_rank, /*!< OUT: field rank */
h5_size_t *field_dims, /*!< OUT: field dimensions */
h5_size_t *elem_rank, /*!< OUT: element rank */
h5_int64_t *type /*!< OUT: datatype */
) {
H5_API_ENTER (h5_err_t);
H5_API_RETURN (
h5b_get_field_info (
f,
idx,
name,
len_name,
field_rank,
field_dims,
elem_rank,
type));
}
/*!
\ingroup h5block_model
Get the rank and dimensions of the field specified by its name.
See \ref H5BlockGetFieldInfo.
\return \c H5_SUCCESS or error code
*/
h5_err_t
H5BlockGetFieldInfoByName (
h5_file_t *const f, /*!< IN: file handle */
const char *name, /*!< IN: field name */
h5_size_t *field_rank, /*!< OUT: field rank */
h5_size_t *field_dims, /*!< OUT: field dimensions */
h5_size_t *elem_rank, /*!< OUT: element rank */
h5_int64_t *type /*!< OUT: datatype */
) {
H5_API_ENTER (h5_err_t);
H5_API_RETURN (
h5b_get_field_info_by_name (
f,
name,
field_rank,
field_dims,
elem_rank,
type));
}
/********************** reading and writing attribute ************************/
/*!
\ingroup h5block_attrib
Write the string \c value as attribute \c attrib_name of field
\c field_name.
\return \c H5_SUCCESS or error code
*/
h5_err_t
H5BlockWriteFieldAttribString (
h5_file_t *const f, /*!< IN: file handle */
const char *field_name, /*!< IN: field name */
const char *attrib_name, /*!< IN: attribute name */
const char *value /*!< IN: attribute value */
) {
H5_API_ENTER (h5_err_t);
H5_API_RETURN (
h5_write_field_attrib (
f,
field_name,
attrib_name,
H5T_NATIVE_CHAR,
value,
strlen(value) + 1));
}
/*!
\ingroup h5block_attrib
Read the string value from attribute \c attrib_name of field
\c field_name into a \c buffer.
\return \c H5_SUCCESS or error code
*/
h5_err_t
H5BlockReadFieldAttribString (
h5_file_t *const f, /*!< IN: file handle */
const char *field_name, /*!< IN: field name */
const char *attrib_name, /*!< IN: attribute name */
char *buffer /*!< OUT: attribute value */
) {
H5_API_ENTER (h5_err_t);
H5_API_RETURN (
h5_read_field_attrib (
f,
field_name,
attrib_name,
H5_STRING_T,
(void*)buffer));
}
/*!
\ingroup h5block_attrib
Query the number of attributes of field \c field_name.
\return number of attributes or error code
*/
h5_ssize_t
H5BlockGetNumFieldAttribs (
h5_file_t *const f, /*<! IN: file handle */
const char *field_name /*<! IN: field name */
) {
H5_API_ENTER (h5_ssize_t);
H5_API_RETURN (h5b_get_num_field_attribs (f, field_name));
}
/*!
\ingroup h5block_attrib
Gets the name, type and number of elements of the field attribute
specified by its index.
This function can be used to retrieve all attributes bound to the
specified field by looping from \c 0 to the number of attribute
minus one. The number of attributes bound to the
field can be queried by calling \ref H5BlockGetNumFieldAttribs.
\return \c H5_SUCCESS or error code
*/
h5_err_t
H5BlockGetFieldAttribInfo (
h5_file_t *const f, /*<! IN: Handle to open file */
const char *field_name, /*<! IN: field name */
const h5_size_t attrib_idx, /*<! IN: Index of attribute to
get infos about */
char *attrib_name, /*<! OUT: Name of attribute */
const h5_size_t len_of_attrib_name,
/*<! IN: length of buffer \c name */
h5_int64_t *attrib_type, /*<! OUT: Type of value. */
h5_size_t *attrib_nelem /*<! OUT: Number of elements */
) {
H5_API_ENTER (h5_err_t);
H5_API_RETURN (
h5b_get_field_attrib_info (
f,
field_name,
attrib_idx,
attrib_name,
len_of_attrib_name,
attrib_type,
attrib_nelem));
}
#define H5BLOCK_FIELD_ORIGIN_NAME "__Origin__"
#define H5BLOCK_FIELD_SPACING_NAME "__Spacing__"
/*!
\ingroup h5block_c_api
Get field origin.
\return \c H5_SUCCESS or error code
*/
h5_err_t
H5Block3dGetFieldOrigin (
h5_file_t *f, /*!< IN: file handle */
const char *field_name, /*!< IN: field name */
h5_float64_t *x_origin, /*!< OUT: X origin */
h5_float64_t *y_origin, /*!< OUT: Y origin */
h5_float64_t *z_origin /*!< OUT: Z origin */
) {
H5_API_ENTER (h5_err_t);
h5_float64_t origin[3];
TRY (h5_read_field_attrib (
f,
field_name,
H5BLOCK_FIELD_ORIGIN_NAME,
H5_FLOAT64_T,
origin));
*x_origin = origin[0];
*y_origin = origin[1];
*z_origin = origin[2];
H5_API_RETURN (H5_SUCCESS);
}
/*!
\ingroup h5block_c_api
Set field origin.
\return \c H5_SUCCESS or error code
*/
h5_err_t
H5Block3dSetFieldOrigin (
h5_file_t *f, /*!< IN: file handle */
const char *field_name, /*!< IN: field name */
const h5_float64_t x_origin, /*!< IN: X origin */
const h5_float64_t y_origin, /*!< IN: Y origin */
const h5_float64_t z_origin /*!< IN: Z origin */
) {
H5_API_ENTER (h5_err_t);
h5_float64_t origin[3] = { x_origin, y_origin, z_origin };
H5_API_RETURN (h5_write_field_attrib (
f,
field_name,
H5BLOCK_FIELD_ORIGIN_NAME,
(hid_t)H5_FLOAT64_T,
origin,
3));
}
/*!
\ingroup h5block_c_api
Get field spacing for field \c field_name in the current time step.
\return \c H5_SUCCESS or error code
*/
h5_err_t
H5Block3dGetFieldSpacing (
h5_file_t *f, /*!< IN: file handle */
const char *field_name, /*!< IN: field name */
h5_float64_t *x_spacing, /*!< OUT: X spacing */
h5_float64_t *y_spacing, /*!< OUT: Y spacing */
h5_float64_t *z_spacing /*!< OUT: Z spacing */
) {
H5_API_ENTER (h5_err_t);
h5_float64_t spacing[3];
TRY (h5_read_field_attrib (
f,
field_name,
H5BLOCK_FIELD_SPACING_NAME,
H5_FLOAT64_T,
spacing));
*x_spacing = spacing[0];
*y_spacing = spacing[1];
*z_spacing = spacing[2];
H5_API_RETURN (H5_SUCCESS);
}
/*!
\ingroup h5block_c_api
Set field spacing for field \c field_name in the current time step.
\return \c H5_SUCCESS or error code
*/
h5_err_t
H5Block3dSetFieldSpacing (
h5_file_t *f, /*!< IN: file handle */
const char *field_name, /*!< IN: field name */
const h5_float64_t x_spacing, /*!< IN: X spacing */
const h5_float64_t y_spacing, /*!< IN: Y spacing */
const h5_float64_t z_spacing /*!< IN: Z spacing */
) {
H5_API_ENTER (h5_err_t);
h5_float64_t spacing[3] = { x_spacing, y_spacing, z_spacing };
H5_API_RETURN (h5_write_field_attrib (
f,
field_name,
H5BLOCK_FIELD_SPACING_NAME,
(hid_t)H5_FLOAT64_T,
spacing,
3));
}
-643
View File
@@ -1,643 +0,0 @@
#include "H5hut.h"
#include "h5core/h5_core.h"
/*!
\ingroup h5block_data
Write a 3-dimensional field \c name from the buffer starting at \c data
to the current time-step using the defined field layout. Values are
floating points (64-bit).
You must use the Fortran indexing scheme to access items in \c data.
\return \c H5_SUCCESS or error code
*/
h5_err_t
H5Block3dWriteScalarFieldFloat64 (
h5_file_t *f, /*!< IN: file handle */
const char *name, /*!< IN: name of dataset to write */
const h5_float64_t *data /*!< IN: scalar data to write */
) {
H5_API_ENTER (h5_err_t);
H5_API_RETURN (
h5b_write_scalar_data (
f, name,
(void*)data,
H5T_NATIVE_DOUBLE));
}
/*!
\ingroup h5block_data
Read a 3-dimensional field \c name into the buffer starting at \c data from
the current time-step using the defined field layout. Values are
floating points (64-bit).
You must use the Fortran indexing scheme to access items in \c data.
\return \c H5_SUCCESS or error code
*/
h5_err_t
H5Block3dReadScalarFieldFloat64 (
h5_file_t *f, /*!< IN: file handle */
const char *name, /*!< IN: name of dataset to read */
h5_float64_t *data /*!< OUT: ptr to read buffer */
) {
H5_API_ENTER (h5_err_t);
H5_API_RETURN (
h5b_read_scalar_data (
f, name,
(void*)data,
H5T_NATIVE_DOUBLE));
}
/*!
\ingroup h5block_data
*/
/*!
Write a 3-dimensional field \c name with 3-dimensional vectors as values
from the buffers starting at \c x_data, \c y_data and \c z_data to the
current time-step using the defined field layout. Values are 3-dimensional
vectors with floating points (64-bit) values.
You must use the Fortran indexing scheme to access items in \c data.
\return \c H5_SUCCESS or error code
*/
h5_err_t
H5Block3dWriteVector3dFieldFloat64 (
h5_file_t *f, /*!< IN: file handle */
const char *name, /*!< IN: name of dataset to write */
const h5_float64_t *x_data, /*!< IN: X axis data */
const h5_float64_t *y_data, /*!< IN: Y axis data */
const h5_float64_t *z_data /*!< IN: Z axis data */
) {
H5_API_ENTER (h5_err_t);
H5_API_RETURN (
h5b_write_vector3d_data(
f, name,
(void*)x_data, (void*)y_data, (void*)z_data,
H5T_NATIVE_DOUBLE));
}
/*!
\ingroup h5block_data
*/
/*!
Read a 3-dimensional field \c name with 3-dimensional vectors as values
from the buffers starting at \c x_data, \c y_data and \c z_data to the
current time-step using the defined field layout. Values are 3-dimensional
vectors with floating points (64-bit) values.
You must use the Fortran indexing scheme to access items in \c data.
\return \c H5_SUCCESS or error code
*/
h5_err_t
H5Block3dReadVector3dFieldFloat64 (
h5_file_t *f, /*!< IN: file handle */
const char *name, /*!< IN: name of dataset to write */
h5_float64_t *x_data, /*!< OUT: X axis data */
h5_float64_t *y_data, /*!< OUT: Y axis data */
h5_float64_t *z_data /*!< OUT: Z axis data */
) {
H5_API_ENTER (h5_err_t);
H5_API_RETURN (
h5b_read_vector3d_data(
f, name,
(void*)x_data, (void*)y_data, (void*)z_data,
H5T_NATIVE_DOUBLE));
}
/*!
\ingroup h5block_data
Write a 3-dimensional field \c name from the buffer starting at \c data
to the current time-step using the defined field layout. Values are
floating points (32-bit).
You must use the Fortran indexing scheme to access items in \c data.
\return \c H5_SUCCESS or error code
*/
h5_err_t
H5Block3dWriteScalarFieldFloat32 (
h5_file_t *f, /*!< IN: file handle */
const char *name, /*!< IN: name of dataset to write */
const h5_float32_t *data /*!< IN: scalar data to write */
) {
H5_API_ENTER (h5_err_t);
H5_API_RETURN (
h5b_write_scalar_data(
f, name,
(void*)data,
H5T_NATIVE_FLOAT));
}
/*!
\ingroup h5block_data
Read a 3-dimensional field \c name into the buffer starting at \c data from
the current time-step using the defined field layout. Values are
floating points (32-bit).
You must use the Fortran indexing scheme to access items in \c data.
\return \c H5_SUCCESS or error code
*/
h5_err_t
H5Block3dReadScalarFieldFloat32 (
h5_file_t *f, /*!< IN: file handle */
const char *name, /*!< IN: name of dataset to read */
h5_float32_t *data /*!< OUT: ptr to read buffer */
) {
H5_API_ENTER (h5_err_t);
H5_API_RETURN (
h5b_read_scalar_data(
f, name,
(void*)data,
H5T_NATIVE_FLOAT));
}
/*!
\ingroup h5block_data
*/
/*!
Write a 3-dimensional field \c name with 3-dimensional vectors as values
from the buffers starting at \c x_data, \c y_data and \c z_data to the
current time-step using the defined field layout. Values are 3-dimensional
vectors with floating points (32-bit) values.
You must use the Fortran indexing scheme to access items in \c data.
\return \c H5_SUCCESS or error code
*/
h5_err_t
H5Block3dWriteVector3dFieldFloat32 (
h5_file_t *f, /*!< IN: file handle */
const char *name, /*!< IN: name of dataset to write */
const h5_float32_t *x_data, /*!< IN: X axis data */
const h5_float32_t *y_data, /*!< IN: Y axis data */
const h5_float32_t *z_data /*!< IN: Z axis data */
) {
H5_API_ENTER (h5_err_t);
H5_API_RETURN (
h5b_write_vector3d_data(
f, name,
(void*)x_data, (void*)y_data, (void*)z_data,
H5T_NATIVE_FLOAT));
}
/*!
\ingroup h5block_data
*/
/*!
Read a 3-dimensional field \c name with 3-dimensional vectors as values
from the buffers starting at \c x_data, \c y_data and \c z_data to the
current time-step using the defined field layout. Values are 3-dimensional
vectors with floating points (32-bit) values.
You must use the Fortran indexing scheme to access items in \c data.
\return \c H5_SUCCESS or error code
*/
h5_err_t
H5Block3dReadVector3dFieldFloat32 (
h5_file_t *f, /*!< IN: file handle */
const char *name, /*!< IN: name of dataset to write */
h5_float32_t *x_data, /*!< OUT: X axis data */
h5_float32_t *y_data, /*!< OUT: Y axis data */
h5_float32_t *z_data /*!< OUT: Z axis data */
) {
H5_API_ENTER (h5_err_t);
H5_API_RETURN (
h5b_read_vector3d_data(
f, name,
(void*)x_data, (void*)y_data, (void*)z_data,
H5T_NATIVE_FLOAT));
}
/*!
\ingroup h5block_data
Write a 3-dimensional field \c name from the buffer starting at \c data
to the current time-step using the defined field layout. Values are
integers (64-bit).
You must use the Fortran indexing scheme to access items in \c data.
\return \c H5_SUCCESS or error code
*/
h5_err_t
H5Block3dWriteScalarFieldInt64 (
h5_file_t *f, /*!< IN: file handle */
const char *name, /*!< IN: name of dataset to write */
const h5_int64_t *data /*!< IN: scalar data to write */
) {
H5_API_ENTER (h5_err_t);
H5_API_RETURN (
h5b_write_scalar_data (
f, name,
(void*)data,
H5T_NATIVE_INT64));
}
/*!
\ingroup h5block_data
Read a 3-dimensional field \c name into the buffer starting at \c data from
the current time-step using the defined field layout. Values are
integers (64-bit).
You must use the Fortran indexing scheme to access items in \c data.
\return \c H5_SUCCESS or error code
*/
h5_err_t
H5Block3dReadScalarFieldInt64 (
h5_file_t *f, /*!< IN: file handle */
const char *name, /*!< IN: name of dataset to read */
h5_int64_t *data /*!< OUT: ptr to read buffer */
) {
H5_API_ENTER (h5_err_t);
H5_API_RETURN (
h5b_read_scalar_data(
f, name,
(void*)data,
H5T_NATIVE_INT64));
}
/*!
\ingroup h5block_data
*/
/*!
Write a 3-dimensional field \c name with 3-dimensional vectors as values
from the buffers starting at \c x_data, \c y_data and \c z_data to the
current time-step using the defined field layout. Values are 3-dimensional
vectors with integers (64-bit) values.
You must use the Fortran indexing scheme to access items in \c data.
\return \c H5_SUCCESS or error code
*/
h5_err_t
H5Block3dWriteVector3dFieldInt64 (
h5_file_t *f, /*!< IN: file handle */
const char *name, /*!< IN: name of dataset to write */
const h5_int64_t *x_data, /*!< IN: X axis data */
const h5_int64_t *y_data, /*!< IN: Y axis data */
const h5_int64_t *z_data /*!< IN: Z axis data */
) {
H5_API_ENTER (h5_err_t);
H5_API_RETURN (
h5b_write_vector3d_data(
f, name,
(void*)x_data, (void*)y_data, (void*)z_data,
H5T_NATIVE_INT64));
}
/*!
\ingroup h5block_data
*/
/*!
Read a 3-dimensional field \c name with 3-dimensional vectors as values
from the buffers starting at \c x_data, \c y_data and \c z_data to the
current time-step using the defined field layout. Values are 3-dimensional
vectors with integers (64-bit) values.
You must use the Fortran indexing scheme to access items in \c data.
\return \c H5_SUCCESS or error code
*/
h5_err_t
H5Block3dReadVector3dFieldInt64 (
h5_file_t *f, /*!< IN: file handle */
const char *name, /*!< IN: name of dataset to write */
h5_int64_t *x_data, /*!< OUT: X axis data */
h5_int64_t *y_data, /*!< OUT: Y axis data */
h5_int64_t *z_data /*!< OUT: Z axis data */
) {
H5_API_ENTER (h5_err_t);
H5_API_RETURN (
h5b_read_vector3d_data(
f, name,
(void*)x_data, (void*)y_data, (void*)z_data,
H5T_NATIVE_INT64));
}
/*!
\ingroup h5block_data
Write a 3-dimensional field \c name from the buffer starting at \c data
to the current time-step using the defined field layout. Values are
integers (32-bit).
You must use the Fortran indexing scheme to access items in \c data.
\return \c H5_SUCCESS or error code
*/
h5_err_t
H5Block3dWriteScalarFieldInt32 (
h5_file_t *f, /*!< IN: file handle */
const char *name, /*!< IN: name of dataset to write */
const h5_int32_t *data /*!< IN: scalar data to write */
) {
H5_API_ENTER (h5_err_t);
H5_API_RETURN (
h5b_write_scalar_data(
f, name,
(void*)data,
H5T_NATIVE_INT32));
}
/*!
\ingroup h5block_data
Read a 3-dimensional field \c name into the buffer starting at \c data from
the current time-step using the defined field layout. Values are
integers (32-bit).
You must use the Fortran indexing scheme to access items in \c data.
\return \c H5_SUCCESS or error code
*/
h5_err_t
H5Block3dReadScalarFieldInt32 (
h5_file_t *f, /*!< IN: file handle */
const char *name, /*!< IN: name of dataset to read */
h5_int32_t *data /*!< OUT: ptr to read buffer */
) {
H5_API_ENTER (h5_err_t);
H5_API_RETURN (
h5b_read_scalar_data(
f, name,
(void*)data,
H5T_NATIVE_INT32));
}
/*!
\ingroup h5block_data
*/
/*!
Write a 3-dimensional field \c name with 3-dimensional vectors as values
from the buffers starting at \c x_data, \c y_data and \c z_data to the
current time-step using the defined field layout. Values are 3-dimensional
vectors with integers (32-bit) values.
You must use the Fortran indexing scheme to access items in \c data.
\return \c H5_SUCCESS or error code
*/
h5_err_t
H5Block3dWriteVector3dFieldInt32 (
h5_file_t *f, /*!< IN: file handle */
const char *name, /*!< IN: name of dataset to write */
const h5_int32_t *x_data, /*!< IN: X axis data */
const h5_int32_t *y_data, /*!< IN: Y axis data */
const h5_int32_t *z_data /*!< IN: Z axis data */
) {
H5_API_ENTER (h5_err_t);
H5_API_RETURN (
h5b_write_vector3d_data(
f, name,
(void*)x_data, (void*)y_data, (void*)z_data,
H5T_NATIVE_INT32));
}
/*!
\ingroup h5block_data
*/
/*!
Read a 3-dimensional field \c name with 3-dimensional vectors as values
from the buffers starting at \c x_data, \c y_data and \c z_data to the
current time-step using the defined field layout. Values are 3-dimensional
vectors with integers (32-bit) values.
You must use the Fortran indexing scheme to access items in \c data.
\return \c H5_SUCCESS or error code
*/
h5_err_t
H5Block3dReadVector3dFieldInt32 (
h5_file_t *f, /*!< IN: file handle */
const char *name, /*!< IN: name of dataset to write */
h5_int32_t *x_data, /*!< OUT: X axis data */
h5_int32_t *y_data, /*!< OUT: Y axis data */
h5_int32_t *z_data /*!< OUT: Z axis data */
) {
H5_API_ENTER (h5_err_t);
H5_API_RETURN (
h5b_read_vector3d_data(
f, name,
(void*)x_data, (void*)y_data, (void*)z_data,
H5T_NATIVE_INT32));
}
/*!
\ingroup h5block_attrib
Write float64 \c values as attribute \c attrib_name of field
\c field_name.
\return \c H5_SUCCESS or error code
*/
h5_err_t
H5BlockWriteFieldAttribFloat64 (
h5_file_t *f, /*!< IN: file handle */
const char *field_name, /*!< IN: field name */
const char *attrib_name, /*!< IN: attribute name */
const h5_float64_t *values, /*!< IN: attribute values */
const h5_size_t nvalues /*!< IN: number of elements */
) {
H5_API_ENTER (h5_err_t);
H5_API_RETURN (
h5_write_field_attrib (
f,
field_name,
attrib_name,
H5T_NATIVE_DOUBLE,
values,
nvalues));
}
/*!
\ingroup h5block_attrib
Read float64 values from attribute \c attrib_name of field
\c field_name into a \c buffer.
\return \c H5_SUCCESS or error code
*/
h5_err_t
H5BlockReadFieldAttribFloat64 (
h5_file_t *f, /*!< IN: file handle */
const char *field_name, /*!< IN: field name */
const char *attrib_name, /*!< IN: attribute name */
h5_float64_t *buffer /*!< OUT: attribute values */
) {
H5_API_ENTER (h5_err_t);
h5_err_t h5err = h5_read_field_attrib (
f,
field_name,
attrib_name,
H5T_NATIVE_DOUBLE,
(void*)buffer);
H5_API_RETURN (h5err);
}
/*!
\ingroup h5block_attrib
Write float32 \c values as attribute \c attrib_name of field
\c field_name.
\return \c H5_SUCCESS or error code
*/
h5_err_t
H5BlockWriteFieldAttribFloat32 (
h5_file_t *f, /*!< IN: file handle */
const char *field_name, /*!< IN: field name */
const char *attrib_name, /*!< IN: attribute name */
const h5_float32_t *values, /*!< IN: attribute values */
const h5_size_t nvalues /*!< IN: number of elements */
) {
H5_API_ENTER (h5_err_t);
H5_API_RETURN (
h5_write_field_attrib (
f,
field_name,
attrib_name,
H5T_NATIVE_FLOAT,
values,
nvalues));
}
/*!
\ingroup h5block_attrib
Read float32 values from attribute \c attrib_name of field
\c field_name into a \c buffer.
\return \c H5_SUCCESS or error code
*/
h5_err_t
H5BlockReadFieldAttribFloat32 (
h5_file_t *f, /*!< IN: file handle */
const char *field_name, /*!< IN: field name */
const char *attrib_name, /*!< IN: attribute name */
h5_float32_t *buffer /*!< OUT: attribute values */
) {
H5_API_ENTER (h5_err_t);
H5_API_RETURN (
h5_read_field_attrib (
f,
field_name,
attrib_name,
H5T_NATIVE_FLOAT,
(void*)buffer));
}
/*!
\ingroup h5block_attrib
Write int64 \c values as attribute \c attrib_name of field
\c field_name.
\return \c H5_SUCCESS or error code
*/
h5_err_t
H5BlockWriteFieldAttribInt64 (
h5_file_t *f, /*!< IN: file handle */
const char *field_name, /*!< IN: field name */
const char *attrib_name, /*!< IN: attribute name */
const h5_int64_t *values, /*!< IN: attribute values */
const h5_size_t nvalues /*!< IN: number of elements */
) {
H5_API_ENTER (h5_err_t);
H5_API_RETURN (
h5_write_field_attrib (
f,
field_name,
attrib_name,
H5T_NATIVE_INT64,
values,
nvalues));
}
/*!
\ingroup h5block_attrib
Read int64 values from attribute \c attrib_name of field
\c field_name into a \c buffer.
\return \c H5_SUCCESS or error code
*/
h5_err_t
H5BlockReadFieldAttribInt64 (
h5_file_t *f, /*!< IN: file handle */
const char *field_name, /*!< IN: field name */
const char *attrib_name, /*!< IN: attribute name */
h5_int64_t *buffer /*!< OUT: attribute values */
) {
H5_API_ENTER (h5_err_t);
H5_API_RETURN (
h5_read_field_attrib (
f,
field_name,
attrib_name,
H5T_NATIVE_INT64,
(void*)buffer));
}
/*!
\ingroup h5block_attrib
Write int32 \c values as attribute \c attrib_name of field
\c field_name.
\return \c H5_SUCCESS or error code
*/
h5_err_t
H5BlockWriteFieldAttribInt32 (
h5_file_t *f, /*!< IN: file handle */
const char *field_name, /*!< IN: field name */
const char *attrib_name, /*!< IN: attribute name */
const h5_int32_t *values, /*!< IN: attribute values */
const h5_size_t nvalues /*!< IN: number of elements */
) {
H5_API_ENTER (h5_err_t);
H5_API_RETURN (
h5_write_field_attrib (
f,
field_name,
attrib_name,
H5T_NATIVE_INT32,
values,
nvalues));
}
/*!
\ingroup h5block_attrib
Read int32 values from attribute \c attrib_name of field
\c field_name into a \c buffer.
\return \c H5_SUCCESS or error code
*/
h5_err_t
H5BlockReadFieldAttribInt32 (
h5_file_t *f, /*!< IN: file handle */
const char *field_name, /*!< IN: field name */
const char *attrib_name, /*!< IN: attribute name */
h5_int32_t *buffer /*!< OUT: attribute values */
) {
H5_API_ENTER (h5_err_t);
H5_API_RETURN (
h5_read_field_attrib (
f,
field_name,
attrib_name,
H5T_NATIVE_INT32,
(void*)buffer));
}
-54
View File
@@ -1,54 +0,0 @@
/*
Copyright 2007-2009
Paul Scherrer Institut, Villigen, Switzerland;
Benedikt Oswald;
Achim Gsell
All rights reserved.
Authors
Achim Gsell
Warning
This code is under development.
*/
#include "h5core/h5_core.h"
#include "H5Fed.h"
h5_err_t
H5FedOpenMesh (
h5_file_t* const f,
const h5_id_t mesh_id,
const h5_oid_t mesh_type_id
) {
H5_API_ENTER (h5_err_t);
H5_API_RETURN (h5t_open_mesh (f, mesh_id, mesh_type_id));
}
h5_err_t
H5FedCloseMesh (
h5_file_t* const f
) {
H5_API_ENTER (h5_err_t);
H5_API_RETURN (h5t_close_mesh (f));
}
h5_err_t
H5FedSetLevel (
h5_file_t* const f,
const h5t_lvl_idx_t level_id
) {
H5_API_ENTER (h5_err_t);
H5_API_RETURN (h5t_set_level (f, level_id));
}
h5_err_t
H5FedLinkMeshToStep (
h5_file_t* const f,
const h5_id_t mesh_id
) {
UNUSED_ARGUMENT (f);
UNUSED_ARGUMENT (mesh_id);
H5_API_ENTER (h5_err_t);
H5_API_RETURN (h5_error_not_implemented ());
}
-42
View File
@@ -1,42 +0,0 @@
/*
Copyright 2006-2010
Paul Scherrer Institut, Villigen, Switzerland;
Benedikt Oswald;
Achim Gsell
All rights reserved.
Authors
Achim Gsell
Warning
This code is under development.
*/
#include "h5core/h5_core.h"
#include "H5Fed.h"
/****** UPWARD ADJACENCY routines *********************************************/
/*!
\return number of upward adjacent edges
*/
h5_err_t
H5FedGetAdjacencies (
h5_file_t* const f,
const h5_loc_id_t entity_id,
const h5_int32_t dim,
h5_loc_idlist_t** list
) {
H5_API_ENTER (h5_err_t);
H5_API_RETURN (h5t_get_adjacencies (f, entity_id, dim, list));
}
h5_err_t
H5FedReleaseListOfAdjacencies (
h5_file_t* const f,
h5_loc_idlist_t** list
) {
H5_API_ENTER (h5_err_t);
H5_API_RETURN (h5t_release_list_of_adjacencies (f, list));
}
-169
View File
@@ -1,169 +0,0 @@
/*
Copyright 2007-2008
Paul Scherrer Institut, Villigen, Switzerland;
Benedikt Oswald;
Achim Gsell
All rights reserved.
Authors
Achim Gsell
Warning
This code is under development.
*/
/*!
\ingroup h5fed_c_api
\defgroup h5fed_mesh_inquiry
*/
#include "h5core/h5_core.h"
#include "H5Fed.h"
/*!
Get number of meshes of given type.
\param[in] f File handle
\param[in] type_id Type of mesh we want the number of.
\return Number of meshes of type \c type_id or error code.
*/
h5_ssize_t
H5FedGetNumMeshes (
h5_file_t* const f,
const h5_oid_t type_id
) {
H5_API_ENTER (h5_ssize_t);
H5_API_RETURN (h5t_get_num_meshes (f, type_id));
}
/*!
Get the number of hierarchical mesh levels.
\param[in] f File handle
\return Number of hierarchical mesh levels or error code.
*/
h5_ssize_t
H5FedGetNumLevels (
h5_file_t* const f
) {
H5_API_ENTER (h5_ssize_t);
H5_API_RETURN (h5t_get_num_leaf_levels (f));
}
/*!
Get current mesh levels.
\param[in] f File handle
\return ID of current mesh levels or error code.
*/
h5t_lvl_idx_t
H5FedGetLevel (
h5_file_t* const f
) {
H5_API_ENTER (h5t_lvl_idx_t);
H5_API_RETURN (h5t_get_level (f));
}
/*!
Returns the number of vertices used for defining the (sub-)mesh
at current level on this compute node.
\param[in] f file handle
\return Number of vertices or error code.
*/
h5_ssize_t
H5FedGetNumVertices (
h5_file_t* const f /*!< file handle */
) {
H5_API_ENTER (h5_ssize_t);
H5_API_RETURN (h5t_get_num_vertices (f, -1));
}
/*!
Returns the number of vertices used for defining the (sub-)mesh
at current level on compute node \c cnode.
\param[in] f file handle
\param[in] cnode compute node
\return Number of vertices or error code.
*/
h5_ssize_t
H5FedGetNumVerticesCnode (
h5_file_t* const f,
const h5_id_t cnode
) {
H5_API_ENTER (h5_ssize_t);
H5_API_RETURN (h5t_get_num_vertices (f, cnode));
}
/*!
Returns the number of vertices used for defining the (sub-)mesh
at current level overl all compute nodes.
\param[in] f file handle
\return Total number of vertices or error code.
*/
h5_ssize_t
H5FedGetNumVerticesTotal (
h5_file_t* const f
) {
H5_API_ENTER (h5_ssize_t);
H5_API_RETURN (h5t_get_num_vertices (f, -1));
}
/*!
Returns the number of elements present in the (sub-)mesh
at current level on this compute node.
\param[in] f file handle
\return Number of elements or error code.
*/
h5_ssize_t
H5FedGetNumElements (
h5_file_t* const f
) {
H5_API_ENTER (h5_ssize_t);
// MLH: can't use field from opaque h5_file_t!
//h5_ssize_t num = h5t_get_num_elems (f, f->myproc);
H5_API_RETURN (h5t_get_num_elems (f, -1));
}
/*!
Returns the number of elements present in the (sub-)mesh
at current level on compute node \c cnode.
\param[in] f file handle
\param[in] cnode Compute node
\return Number of elements or error code.
*/
h5_ssize_t
H5FedGetNumElementsCnode (
h5_file_t* const f,
const h5_id_t cnode
) {
H5_API_ENTER (h5_ssize_t);
H5_API_RETURN (h5t_get_num_elems (f, cnode));
}
/*!
Returns the number of elements present in the mesh
at current level over all compute nodes.
\param[in] f File handle.
\return Number of elements or error code.
*/
h5_ssize_t
H5FedGetNumElementsTotal (
h5_file_t* const f
) {
H5_API_ENTER (h5_ssize_t);
H5_API_RETURN (h5t_get_num_elems (f, -1));
}
-164
View File
@@ -1,164 +0,0 @@
/****** RETRIEVAL routines **************************************************/
/*
Copyright 2007-2008
Paul Scherrer Institut, Villigen, Switzerland;
Benedikt Oswald;
Achim Gsell
All rights reserved.
Authors
Achim Gsell
Warning
This code is under development.
*/
#include "h5core/h5_core.h"
#include "H5Fed.h"
/*!
Begin traverse over all entities on this compute node.
Initialize internal data structures.
\remark
Entities might be on processor boundaries! Therefore the same entity might be
processed on several compute nodes.
\param[in] f file handle
\param[in] codim co-dimension of entity to traverse
\return H5_SUCCESS or error code
*/
h5t_iterator_p
H5FedBeginTraverseEntities (
h5_file_t* const f,
const int codim
) {
H5_API_ENTER (h5t_iterator_p);
h5t_iterator_p iter;
TRY2 (iter = h5_calloc (1, sizeof (*iter)));
TRY2 (h5t_init_leaf_iterator (f, iter, codim));
H5_API_RETURN (iter);
}
h5t_iterator_p
H5FedBeginTraverseBoundaryFaces (
h5_file_t* const f,
const int codim
) {
H5_API_ENTER (h5t_iterator_p);
h5t_iterator_p iter;
TRY2 (iter = h5_calloc (1, sizeof (*iter)));
TRY2 (h5t_init_boundary_face_iterator (f, iter, codim));
H5_API_RETURN (iter);
}
/*!
Get next local entity ID.
\param[in] f file handle
\param[in/out] iter iterator
\return Local entity ID
\return -1, if done
\return error code on error
*/
h5_loc_id_t
H5FedTraverseEntities (
h5_file_t* const f,
h5t_iterator_t* iter
) {
H5_API_ENTER (h5_loc_id_t);
H5_API_RETURN (h5t_iterate_entities (f, iter));
}
/*!
End of traversing. Release internal data structures.
\param[in] f File handle
\return H5_SUCCESS or error code
*/
h5_err_t
H5FedEndTraverseEntities (
h5_file_t* const f,
h5t_iterator_t* iter
) {
H5_API_ENTER (h5_err_t);
H5_API_RETURN (h5t_release_entity_iterator (f, iter));
}
/*!
Get coordinates of vertex given by local index
\param[in] f file handle
\param[in] vertex_idx local index of vertex
\param[out] P 3-dimensional coordinates
\return H5_SUCCESS or error code
*/
h5_err_t
H5FedGetVertexCoordsByIndex (
h5_file_t* const f,
h5_loc_idx_t vertex_index,
h5_float64_t P[3]
) {
H5_API_ENTER (h5_err_t);
H5_API_RETURN (h5t_get_vertex_coords_by_index (f, vertex_index, P));
}
h5_err_t
H5FedGetVertexCoordsByID (
h5_file_t* const f,
h5_loc_id_t vertex_id,
h5_float64_t P[3]
) {
H5_API_ENTER (h5_err_t);
H5_API_RETURN (h5t_get_vertex_coords_by_id (f, vertex_id, P));
}
h5_err_t
H5FedGetVertexIndicesOfEdge (
h5_file_t* const f,
h5_loc_id_t entity_id,
h5_loc_idx_t* vertex_indices
) {
H5_API_ENTER (h5_err_t);
H5_API_RETURN (h5t_get_vertex_indices_of_edge (f, entity_id, vertex_indices));
}
h5_err_t
H5FedGetVertexIndicesOfTriangle (
h5_file_t* const f,
h5_loc_id_t entity_id,
h5_loc_idx_t* vertex_indices
) {
H5_API_ENTER (h5_err_t);
H5_API_RETURN (h5t_get_vertex_indices_of_triangle (f, entity_id, vertex_indices));
}
h5_err_t
H5FedGetVertexIndicesOfTet (
h5_file_t* const f,
h5_loc_id_t entity_id,
h5_loc_idx_t* vertex_indices
) {
H5_API_ENTER (h5_err_t);
H5_API_RETURN (h5t_get_vertex_indices_of_tet (f, entity_id, vertex_indices));
}
h5_err_t
H5FedGetVertexIndicesOfEntity (
h5_file_t* const f,
h5_loc_id_t entity_id,
h5_loc_idx_t* vertex_indices
) {
H5_API_ENTER (h5_err_t);
H5_API_RETURN (h5t_get_vertex_indices_of_entity (f, entity_id, vertex_indices));
}
-168
View File
@@ -1,168 +0,0 @@
/*
Copyright 2007-2008
Paul Scherrer Institut, Villigen, Switzerland;
Benedikt Oswald;
Achim Gsell
All rights reserved.
Authors
Achim Gsell
Warning
This code is under development.
*/
#include "h5core/h5_core.h"
#include "H5Fed.h"
h5_id_t
H5FedAddMesh (
h5_file_t* const f,
const h5_oid_t mesh_type_id
) {
H5_API_ENTER (h5_id_t);
H5_API_RETURN (h5t_add_mesh (f, mesh_type_id));
}
/*!
\ingroup h5fed_c_api
Add a new level with \c num_elems elements. The number of elements must be the
real number of elements to add the level. If you want to refine \c n tetrahedra
\c n*8 elements must be added.
\param[in] f File handle.
\param[in] num_elems_to_refine Number of elements which will be refined.
\return ID of new level.
\note
values for f->t.num_levels:
\c -1 unknown: after opening the file. This is equivalent to
"topological data has not been initialized".
\c 0 no levels: HDF5 group for meshes may already exist but must not!
\c > 0 number of mesh levels
*/
h5t_lvl_idx_t
H5FedAddLevel (
h5_file_t* const f
) {
H5_API_ENTER (h5t_lvl_idx_t);
H5_API_RETURN (h5t_add_level (f));
}
h5_err_t
H5FedBeginStoreVertices (
h5_file_t* const f,
const h5_size_t num
) {
H5_API_ENTER (h5_err_t);
H5_API_RETURN (h5t_begin_store_vertices (f, num));
}
/*!
\ingroup h5fed_c_api
Stores the the coordinates of a specific vertex at level \c level
with id \c vertex_id of the tetrahedral mesh.
\return local vertex id on success
\return errno on error
*/
h5_loc_idx_t
H5FedStoreVertex (
h5_file_t* const f, /*!< file handle */
const h5_glb_id_t vertex_id, /*!< id from mesher or -1 */
const h5_float64_t P[3] /*!< coordinates */
) {
H5_API_ENTER (h5_loc_idx_t);
if (h5t_get_level (f) != 0) {
H5_API_LEAVE (
h5_error (
H5_ERR_INVAL,
"Vertices can be added to level 0 only!"));
}
H5_API_RETURN (h5t_store_vertex (f, vertex_id, P));
}
h5_err_t
H5FedEndStoreVertices (
h5_file_t* const f
) {
H5_API_ENTER (h5_err_t);
H5_API_RETURN (h5t_end_store_vertices (f));
}
h5_err_t
H5FedBeginStoreElements (
h5_file_t* const f,
const h5_size_t num
) {
H5_API_ENTER (h5_err_t);
H5_API_RETURN (h5t_begin_store_elems (f, num));
}
/*!
\ingroup h5fed_c_api
Stores the 4-tuple, that contains the specific indices describing
a tetrahedron with id \c tet_id at level \c level of the tetrahedral
mesh.
Errors:
* current level not yet defined
* to many tets stored on level
\return local tetrahedron id
\return \c errno on error
*/
h5_loc_idx_t
H5FedStoreElement (
h5_file_t* const f, /*!< file handle */
const h5_loc_idx_t local_vids[] /*!< tuple with vertex id's */
) {
H5_API_ENTER (h5_loc_idx_t);
if (h5t_get_level (f) != 0) {
H5_API_LEAVE (
h5_error (
H5_ERR_INVAL,
"Elements can be added to level 0 only!"));
}
H5_API_RETURN (h5t_store_elem (f, -1, local_vids));
}
h5_err_t
H5FedEndStoreElements (
h5_file_t* const f
) {
H5_API_ENTER (h5_err_t);
H5_API_RETURN (h5t_end_store_elems (f));
}
h5_err_t
H5FedBeginRefineElements (
h5_file_t* const f
) {
H5_API_ENTER (h5_err_t);
H5_API_RETURN (h5t_begin_refine_elems (f));
}
h5_loc_idx_t
H5FedRefineElement (
h5_file_t* const f, /*!< file handle */
const h5_loc_id_t local_eid /*!< local element id */
) {
H5_API_ENTER (h5_loc_idx_t);
H5_API_RETURN (h5t_mark_entity (f, local_eid));
}
h5_err_t
H5FedEndRefineElements (
h5_file_t* const f
) {
H5_API_ENTER (h5_err_t);
H5_API_RETURN (h5t_end_refine_elems (f));
}
-148
View File
@@ -1,148 +0,0 @@
/*
Copyright 2007-2011
Paul Scherrer Institut, Villigen, Switzerland;
Achim Gsell
All rights reserved.
Authors
Achim Gsell
Warning
This code is under development.
*/
#include "h5core/h5_core.h"
#include "H5Fed.h"
/*!
Add a tagset to the current mesh.
\param[in] f file handle
\param[in] name name of tagset
\param[in] type data type of tagset
\return H5_SUCCESS or error code
*/
h5_err_t
H5FedAddMTagset (
h5_file_t* const f,
char* name,
h5_id_t type
) {
H5_API_ENTER (h5_err_t);
H5_API_RETURN (h5t_add_mtagset (f, name, type));
}
/*!
Remove a tagset from the current mesh.
\param[in] f file handle
\param[in] name name of tagset to remove
\return H5_SUCCESS or error code
*/
h5_err_t
H5FedRemoveMTagset (
h5_file_t* const f,
char name[]
) {
H5_API_ENTER (h5_err_t);
H5_API_RETURN (h5t_remove_mtagset (f, name));
}
/*!
Get available tagsets in current mesh.
\param[in] f file handle
\param[out] names names of available tagsets
\return Number of tagsets or error code
*/
h5_ssize_t
H5FedGetMTagsets (
h5_file_t* const f,
char** names[]
) {
H5_API_ENTER (h5_ssize_t);
H5_API_RETURN (h5t_get_mtagsets (f, names));
}
/*!
Get type of tagset in current mesh.
\param[in] f file handle
\param[in] name name of tagset
\return H5_SUCCESS or error code
*/
h5_id_t
H5FedGetTypeOfMTagset (
h5_file_t* const f,
char name[]
) {
H5_API_ENTER (h5_id_t);
H5_API_RETURN (h5t_get_mtagset_type_by_name (f, name));
}
/*!
Set tag for entity in current mesh.
\param[in] f file handle
\param[in] name names of tagset
\param[in] id id of entity
\param[in] dim dimension of value
\param[in] val tag value
\return H5_SUCCESS or error code
*/
h5_err_t
H5FedSetMTag (
h5_file_t* const f,
char name[],
h5_loc_id_t id,
const size_t dims,
void* val
) {
H5_API_ENTER (h5_err_t);
H5_API_RETURN (h5t_set_mtag_by_name (f, name, id, dims, val));
}
/*!
Set tag for entity in current mesh.
\param[in] f file handle
\param[in] name names of tagset
\param[in] id id of entity
\param[out] dim dimension of value
\param[out] val tag value
\return H5_SUCCESS or error code
*/
h5_err_t
H5FedGetMTag (
h5_file_t* const f,
const char name[],
const h5_loc_id_t id,
size_t* dim,
void* vals
) {
H5_API_ENTER (h5_err_t);
H5_API_RETURN (h5t_get_mtag_by_name (f, name, id, dim, vals));
}
/*!
Remove tag for entity in current mesh.
\param[in] f file handle
\param[in] name names of tagset
\param[in] id id of entity
*/
h5_err_t
H5FedRemoveMTag (
h5_file_t* const f,
const char name[],
const h5_loc_id_t id
) {
H5_API_ENTER (h5_err_t);
H5_API_RETURN (h5t_remove_mtag_by_name (f, name, id));
}
-573
View File
@@ -1,573 +0,0 @@
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h> /* va_arg - System dependent ?! */
#include <string.h>
#include <errno.h>
#include <fcntl.h>
#include <hdf5.h>
#ifndef WIN32
#include <unistd.h>
#else /* WIN32 */
#include <io.h>
#define open _open
#define close _close
#endif /* WIN32 */
#include "h5core/h5_core.h"
#include "H5Part.h"
/*!
\ingroup h5part_model
Set the number of particles for the current time-step.
After you call this subroutine, all subsequent
operations will assume this number of particles will be written.
For the parallel library, the \c nparticles value is the number of
particles that the \e individual task will write. You can use
a different value on different tasks.
This function uses an \c MPI_Allgather
call to aggregate each tasks number of particles and determine
the appropiate offsets. Because of the use of this MPI collective,
it is advisable to call this function as
few times as possible when running at large concurrency.
This function assumes that your particles' data fields are in stored in
contiguous 1D arrays.
For instance, the fields \e x and \e y for your particles are stored
in separate arrays \c x[] and \c y[].
If instead you store your particles as tuples, so that the values
are arranged \f$ x_1,y_1,x_2,y_2\f$... than you need to setup striding
(in this case with value 2) using \ref H5PartSetNumParticlesStrided.
\return \c H5_SUCCESS or error code
*/
h5_err_t
H5PartSetNumParticles (
h5_file_t *f, /*!< [in] Handle to open file */
h5_size_t nparticles /*!< [in] Number of particles */
) {
H5_API_ENTER (h5_err_t);
h5_size_t stride = 1;
H5_API_RETURN (h5u_set_num_particles(f, nparticles, stride));
}
/*!
\ingroup h5part_model
Set the number of particles for the current time-step.
After you call this subroutine, all subsequent
operations will assume this number of particles will be written.
For the parallel library, the \c nparticles value is the number of
particles that the \e individual task will write. You can use
a different value on different tasks.
This function uses an \c MPI_Allgather
call to aggregate each tasks number of particles and determine
the appropiate offsets. Because of the use of this MPI collective,
it is advisable to call this function as
few times as possible when running at large concurrency.
This function assumes that your particles' data fields are
stored tuples. For instance, the fields \e x and \e y of your
particles are arranged \f$x_1,y_1,x_2,y_2\f$... in a single data
array. In this example, the stride value would be 2.
If you instead have a separate array for each fields,
such as \c x[] and \c y[],
use \ref H5PartSetNumParticles.
\return \c H5_SUCCESS or error code
*/
h5_err_t
H5PartSetNumParticlesStrided (
h5_file_t *f, /*!< [in] Handle to open file */
h5_size_t nparticles, /*!< [in] Number of particles */
h5_size_t stride /*!< [in] Stride value (e.g. number of fields in the particle array) */
) {
H5_API_ENTER (h5_err_t);
H5_API_RETURN (h5u_set_num_particles (f, nparticles, stride));
}
/*!
\ingroup h5part_model
Define the chunk \c size and enables chunking in the underlying
HDF5 layer.
Note that this policy wastes disk space, but can improve write
bandwidth on parallel filesystems that are sensitive to write alignment
(e.g. lustre). It is only recommended when using the MPI-POSIX or MPI-IO
independent VFDs (see \ref H5OpenFile).
\return \c H5_SUCCESS or error code
*/
h5_err_t
H5PartSetChunk (
h5_file_t *f,
h5_size_t size
) {
H5_API_ENTER (h5_err_t);
H5_API_RETURN (h5u_set_chunk (f, size));
}
/*!
\ingroup h5part_data
Write array of 64 bit floating point data to file.
After setting the number of particles with \c H5PartSetNumParticles() and
the current timestep using \c H5SetStep(), you can start writing datasets
into the file. Each dataset has a name associated with it (chosen by the
user) in order to facilitate later retrieval. The name of the dataset is
specified in the parameter \c name, which must be a null-terminated string.
There are no restrictions on naming of datasets, but it is useful to arrive
at some common naming convention when sharing data with other groups.
The writing routines also implicitly store the datatype of the array so that
the array can be reconstructed properly on other systems with incompatible
type representations.
All data that is written after setting the timestep is associated with that
timestep. While the number of particles can change for each timestep, you
cannot change the number of particles in the middle of a given timestep.
The data is committed to disk before the routine returns.
\return \c H5_SUCCESS or error code
*/
h5_err_t
H5PartWriteDataFloat64 (
h5_file_t *f, /*!< [in] Handle to open file */
const char *name, /*!< [in] Name to associate array with */
const h5_float64_t *data /*!< [in] Array to commit to disk */
) {
H5_API_ENTER (h5_err_t);
H5_API_RETURN (h5u_write_data (f, name, (void*)data, H5T_NATIVE_DOUBLE));
}
/*!
\ingroup h5part_data
Write array of 32 bit floating point data to file.
After setting the number of particles with \c H5PartSetNumParticles() and
the current timestep using \c H5SetStep(), you can start writing datasets
into the file. Each dataset has a name associated with it (chosen by the
user) in order to facilitate later retrieval. The name of the dataset is
specified in the parameter \c name, which must be a null-terminated string.
There are no restrictions on naming of datasets, but it is useful to arrive
at some common naming convention when sharing data with other groups.
The writing routines also implicitly store the datatype of the array so that
the array can be reconstructed properly on other systems with incompatible
type representations.
All data that is written after setting the timestep is associated with that
timestep. While the number of particles can change for each timestep, you
cannot change the number of particles in the middle of a given timestep.
The data is committed to disk before the routine returns.
\return \c H5_SUCCESS or error code
*/
h5_err_t
H5PartWriteDataFloat32 (
h5_file_t *f, /*!< [in] Handle to open file */
const char *name, /*!< [in] Name to associate array with */
const h5_float32_t *data /*!< [in] Array to commit to disk */
) {
H5_API_ENTER (h5_err_t);
h5_err_t h5err = h5u_write_data( f, name, (void*)data, H5T_NATIVE_FLOAT );
H5_API_RETURN (h5err);
}
/*!
\ingroup h5part_data
Write array of 64 bit integer data to file.
After setting the number of particles with \c H5PartSetNumParticles() and
the current timestep using \c H5SetStep(), you can start writing datasets
into the file. Each dataset has a name associated with it (chosen by the
user) in order to facilitate later retrieval. The name of the dataset is
specified in the parameter \c name, which must be a null-terminated string.
There are no restrictions on naming of datasets, but it is useful to arrive
at some common naming convention when sharing data with other groups.
The writing routines also implicitly store the datatype of the array so that
the array can be reconstructed properly on other systems with incompatible
type representations.
All data that is written after setting the timestep is associated with that
timestep. While the number of particles can change for each timestep, you
cannot change the number of particles in the middle of a given timestep.
The data is committed to disk before the routine returns.
\return \c H5_SUCCESS or error code
*/
h5_err_t
H5PartWriteDataInt64 (
h5_file_t *f, /*!< [in] Handle to open file */
const char *name, /*!< [in] Name to associate array with */
const h5_int64_t *data /*!< [in] Array to commit to disk */
) {
H5_API_ENTER (h5_err_t);
H5_API_RETURN (h5u_write_data (f, name, (void*)data, H5T_NATIVE_INT64));
}
/*!
\ingroup h5part_data
Write array of 32 bit integer data to file.
After setting the number of particles with \c H5PartSetNumParticles() and
the current timestep using \c H5SetStep(), you can start writing datasets
into the file. Each dataset has a name associated with it (chosen by the
user) in order to facilitate later retrieval. The name of the dataset is
specified in the parameter \c name, which must be a null-terminated string.
There are no restrictions on naming of datasets, but it is useful to arrive
at some common naming convention when sharing data with other groups.
The writing routines also implicitly store the datatype of the array so that
the array can be reconstructed properly on other systems with incompatible
type representations.
All data that is written after setting the timestep is associated with that
timestep. While the number of particles can change for each timestep, you
cannot change the number of particles in the middle of a given timestep.
The data is committed to disk before the routine returns.
\return \c H5_SUCCESS or error code
*/
h5_err_t
H5PartWriteDataInt32 (
h5_file_t *f, /*!< [in] Handle to open file */
const char *name, /*!< [in] Name to associate array with */
const h5_int32_t *data /*!< [in] Array to commit to disk */
) {
H5_API_ENTER (h5_err_t);
H5_API_RETURN (h5u_write_data (f, name, (void*)data, H5T_NATIVE_INT32));
}
/*!
\ingroup h5part_data
Read array of 64 bit floating point data from file.
When retrieving datasets from disk, you ask for them
by name. There are no restrictions on naming of arrays,
but it is useful to arrive at some common naming
convention when sharing data with other groups.
\return \c H5_SUCCESS or error code
*/
h5_err_t
H5PartReadDataFloat64 (
h5_file_t *f, /*!< [in] Handle to open file */
const char *name, /*!< [in] Name to associate dataset with */
h5_float64_t *data /*!< [out] Array of data */
) {
H5_API_ENTER (h5_err_t);
H5_API_RETURN (h5u_read_data (f, name, data, H5T_NATIVE_DOUBLE));
}
/*!
\ingroup h5part_data
Read array of 32 bit floating point data from file.
When retrieving datasets from disk, you ask for them
by name. There are no restrictions on naming of arrays,
but it is useful to arrive at some common naming
convention when sharing data with other groups.
\return \c H5_SUCCESS or error code
*/
h5_err_t
H5PartReadDataFloat32 (
h5_file_t *f, /*!< [in] Handle to open file */
const char *name, /*!< [in] Name to associate dataset with */
h5_float32_t *data /*!< [out] Array of data */
) {
H5_API_ENTER (h5_err_t);
H5_API_RETURN (h5u_read_data (f, name, data, H5T_NATIVE_FLOAT));
}
/*!
\ingroup h5part_data
Read array of 64 bit integer data from file.
When retrieving datasets from disk, you ask for them
by name. There are no restrictions on naming of arrays,
but it is useful to arrive at some common naming
convention when sharing data with other groups.
\return \c H5_SUCCESS or error code
*/
h5_err_t
H5PartReadDataInt64 (
h5_file_t *f, /*!< [in] Handle to open file */
const char *name, /*!< [in] Name to associate dataset with */
h5_int64_t *data /*!< [out] Array of data */
) {
H5_API_ENTER (h5_err_t);
H5_API_RETURN (h5u_read_data (f, name, data, H5T_NATIVE_INT64));
}
/*!
\ingroup h5part_data
Read array of 32 bit integer data from file.
When retrieving datasets from disk, you ask for them
by name. There are no restrictions on naming of arrays,
but it is useful to arrive at some common naming
convention when sharing data with other groups.
\return \c H5_SUCCESS or error code
*/
h5_err_t
H5PartReadDataInt32 (
h5_file_t *f, /*!< [in] Handle to open file */
const char *name, /*!< [in] Name to associate dataset with */
h5_int32_t *data /*!< [out] Array of data */
) {
H5_API_ENTER (h5_err_t);
H5_API_RETURN (h5u_read_data (f, name, data, H5T_NATIVE_INT32));
}
/*!
\ingroup h5part_model
Get the number of datasets that are stored at the current time-step.
\return number of datasets in current timestep or error code
*/
h5_ssize_t
H5PartGetNumDatasets (
h5_file_t *f /*!< [in] Handle to open file */
) {
H5_API_ENTER (h5_err_t);
H5_API_RETURN (h5u_get_num_datasets(f));
}
/*!
\ingroup h5part_model
This reads the name of a dataset specified by it's index in the current
time-step.
If the number of datasets is \c n, the range of \c _index is \c 0 to \c n-1.
\result \c H5_SUCCESS
*/
h5_err_t
H5PartGetDatasetName (
h5_file_t *f, /*!< [in] Handle to open file */
const h5_id_t idx, /*!< [in] Index of the dataset */
char *name, /*!< [out] Name of dataset */
const h5_size_t len /*!< [in] Size of buffer \c name */
) {
H5_API_ENTER (h5_err_t);
H5_API_RETURN (h5u_get_dataset_info(f, idx, name, len, NULL, NULL));
}
/*!
\ingroup h5part_model
Gets the name, type and number of elements of a dataset based on its
index in the current timestep.
Type is one of the following values:
- \c H5_FLOAT64_T (for \c h5_float64_t)
- \c H5_FLOAT32_T (for \c h5_float32_t)
- \c H5_INT64_T (for \c h5_int64_t)
- \c H5_INT32_T (for \c h5_int32_t)
\return \c H5_SUCCESS
*/
h5_err_t
H5PartGetDatasetInfo (
h5_file_t *f, /*!< [in] Handle to open file */
const h5_id_t idx, /*!< [in] Index of the dataset */
char *dataset_name, /*!< [out] Name of dataset */
const h5_size_t len_dataset_name,
/*!< [in] Size of buffer \c dataset_name */
h5_int64_t *type, /*!< [out] Type of data in dataset */
h5_size_t *nelem /*!< [out] Number of elements. */
) {
H5_API_ENTER (h5_err_t);
H5_API_RETURN (h5u_get_dataset_info(f, idx, dataset_name, len_dataset_name, type, nelem));
}
/*!
\ingroup h5part_model
This function returns the number of particles in this processor's view,
if a view has been set.
If not, it returns the total number of particles across all processors
from the last \ref H5PartSetNumParticles call.
If you have neither set the number of particles
nor set a view, then this returns the total number of
particles in the first data set of the current time step.
Note that H5Part assumes that all data sets within a given time step
have the same number of particles (although the number particles can
vary across time steps).
If none of these conditions are met, an error is thrown.
\return number of particles in current timestep or an error
code.
*/
h5_ssize_t
H5PartGetNumParticles (
h5_file_t *f /*!< [in] Handle to open file */
) {
H5_API_ENTER (h5_ssize_t);
CHECK_FILEHANDLE( f );
H5_API_RETURN (h5u_get_num_particles (f));
}
/*!
\ingroup h5part_model
Reset the view.
\return \c H5_SUCCESS
*/
h5_err_t
H5PartResetView (
h5_file_t *f /*!< [in] Handle to open file */
) {
H5_API_ENTER (h5_err_t);
H5_API_RETURN (h5u_reset_view (f));
}
/*!
\ingroup h5part_model
Check whether a view has been set, either automatically with
\ref H5PartSetNumParticles or manually with \ref H5PartSetView
or \ref H5PartSetViewIndices.
\return 0 for false or 1 for true
*/
h5_err_t
H5PartHasView (
h5_file_t *f /*!< [in] Handle to open file */
) {
H5_API_ENTER (h5_err_t);
H5_API_RETURN (h5u_has_view (f));
}
/*!
\ingroup h5part_model
For parallel I/O or for subsetting operations on the datafile,
this function allows you to define a subset of the total
particle dataset to operate on.
The concept of "view" works for both serial
and for parallel I/O. The "view" will remain in effect until a new view
is set, or the number of particles in a dataset changes, or the view is
"unset" by calling \c H5PartSetView(file,-1,-1);
Before you set a view, \ref H5PartGetNumParticles will return the
total number of particles in the current time-step (even for the parallel
reads). However, after you set a view, it will return the number of
particles contained in the view.
The range is \e inclusive: the end value is the last index of the
data.
\return \c H5_SUCCESS or error code
*/
h5_err_t
H5PartSetView (
h5_file_t *f, /*!< [in] Handle to open file */
h5_int64_t start, /*!< [in] Start particle */
h5_int64_t end /*!< [in] End particle */
) {
H5_API_ENTER (h5_err_t);
H5_API_RETURN (h5u_set_view (f, start, end));
}
/*!
\ingroup h5part_model
For parallel I/O or for subsetting operations on the datafile,
this function allows you to define a subset of the total
dataset to operate on by specifying a list of indices.
The concept of "view" works for both serial
and for parallel I/O. The "view" will remain in effect until a new view
is set, or the number of particles in a dataset changes, or the view is
"unset" by calling \c H5PartSetViewIndices(NULL,0);
Before you set a view, the \c H5PartGetNumParticles() will return the
total number of particles in the current time-step (even for the parallel
reads). However, after you set a view, it will return the number of
particles contained in the view.
\return \c H5_SUCCESS or error code
*/
h5_err_t
H5PartSetViewIndices (
h5_file_t *f, /*!< [in] Handle to open file */
const h5_id_t *indices, /*!< [in] List of indices */
h5_size_t nelems /*!< [in] Size of list */
) {
H5_API_ENTER (h5_err_t);
H5_API_RETURN (h5u_set_view_indices (f, indices, nelems));
}
/*!
\ingroup h5part_model
Allows you to query the current view. Start and End
will be \c -1 if there is no current view established.
Use \c H5PartHasView() to see if the view is smaller than the
total dataset.
\return number of elements in the view or error code
*/
h5_err_t
H5PartGetView (
h5_file_t *f, /*!< [in] Handle to open file */
h5_int64_t *start, /*!< [out] Start particle */
h5_int64_t *end /*!< [out] End particle */
) {
H5_API_ENTER (h5_err_t);
H5_API_RETURN (h5u_get_view (f, start, end));
}
/*!
\ingroup h5part_model
If it is too tedious to manually set the start and end coordinates
for a view, the \c H5SetCanonicalView() will automatically select an
appropriate domain decomposition of the data arrays for the degree
of parallelism and set the "view" accordingly.
\return H5_SUCCESS or error code
*/
h5_err_t
H5PartSetCanonicalView (
h5_file_t *f /*!< [in] Handle to open file */
) {
H5_API_ENTER (h5_err_t);
H5_API_RETURN (h5u_set_canonical_view (f));
}
-65
View File
@@ -1,65 +0,0 @@
#include "h5core/h5_core.h"
#include "H5hut.h"
h5_ssize_t
H5GetNumAttachments (
h5_file_t* const f /*!< [in] Handle to open file */
) {
H5_API_ENTER (h5_ssize_t);
H5_API_RETURN (h5_get_num_attachments (f));
}
h5_err_t
H5GetAttachmentInfoByIdx (
h5_file_t* const f,
const h5_size_t idx, // IN
char* const fname, // OUT
h5_size_t len_fname, // IN
h5_size_t* const fsize // OUT
) {
H5_API_ENTER4 (h5_err_t,
"idx=%llu, fname=0x%p, len_fname=%llu, fsize=0x%p",
(long long unsigned)idx,
fname, (long long unsigned)len_fname,
fsize);
H5_API_RETURN (h5_get_attachment_info_by_idx (
f, idx, fname, len_fname, fsize));
}
h5_err_t
H5GetAttachmentInfoByName (
h5_file_t* const f,
char* const fname, // OUT
h5_size_t* const fsize // OUT
) {
H5_API_ENTER2 (h5_err_t, "fname=\"%s\", fsize=0x%p", fname, fsize);
H5_API_RETURN (h5_get_attachment_info_by_name (
f, fname, fsize));
}
h5_err_t
H5AddAttachment (
h5_file_t* const f, /*!< [in] Handle to open file */
const char* fname /*!< [in] Name of file to attach */
) {
H5_API_ENTER1 (h5_err_t, "fname=\"%s\"", fname);
H5_API_RETURN (h5_add_attachment (f, fname));
}
h5_err_t
H5GetAttachment (
h5_file_t* const f, /*!< [in] Handle to open file */
const char* fname /*!< [in] Name of attachment */
) {
H5_API_ENTER1 (h5_err_t, "fname=\"%s\"", fname);
H5_API_RETURN (h5_get_attachment (f, fname));
}
h5_err_t
H5DeleteAttachment (
h5_file_t* const f,
const char* const fname
) {
H5_API_ENTER1 (h5_err_t, "fname=\"%s\"", fname);
H5_API_RETURN (h5_delete_attachment (f, fname));
}
-593
View File
@@ -1,593 +0,0 @@
#include <string.h>
#include "h5core/h5_core.h"
#include "H5hut.h"
/*** WRITE ***/
/*!
\ingroup h5hut_attrib
Write an attribute \c name with the string \c value to
the file root ("/").
\return \c H5_SUCCESS or error code
*/
h5_err_t
H5WriteFileAttribString (
h5_file_t *const f, /*!< [in] Handle to open file */
const char *name, /*!< [in] Name of attribute to create */
const char *value /*!< [in] Value of attribute */
) {
H5_API_ENTER (h5_err_t);
H5_API_RETURN (h5_write_attrib (
f,
H5_ATTRIB_FILE,
name,
H5T_NATIVE_CHAR,
value,
strlen(value) + 1 ));
}
/*!
\ingroup h5hut_attrib
Write an attribute \c name with the string \c value to
the current timestep.
\return \c H5_SUCCESS or error code
*/
h5_err_t
H5WriteStepAttribString (
h5_file_t *const f, /*!< [in] Handle to open file */
const char *name, /*!< [in] Name of attribute to create */
const char *value /*!< [in] Value of attribute */
) {
H5_API_ENTER (h5_err_t);
H5_API_RETURN (h5_write_attrib (
f,
H5_ATTRIB_STEP,
name,
H5T_NATIVE_CHAR,
value,
strlen(value) + 1 ));
}
/*!
\ingroup h5hut_attrib
Write an attribute \c name with float32 \c values to
the file root ("/").
\return \c H5_SUCCESS or error code
*/
h5_err_t
H5WriteFileAttribFloat32 (
h5_file_t *const f, /*!< [in] Handle to open file */
const char *name, /*!< [in] Name of attribute to create */
const h5_float32_t *values, /*!< [in] Values of attribute */
const h5_size_t nelems /*!< [in] Number of values */
) {
H5_API_ENTER (h5_err_t);
H5_API_RETURN (h5_write_attrib (
f,
H5_ATTRIB_FILE,
name,
H5T_NATIVE_FLOAT,
values,
nelems ));
}
/*!
\ingroup h5hut_attrib
Write an attribute \c name with float32 \c values to
the current time step.
\return \c H5_SUCCESS or error code
*/
h5_err_t
H5WriteStepAttribFloat32 (
h5_file_t *const f, /*!< [in] Handle to open file */
const char *name, /*!< [in] Name of attribute to create */
const h5_float32_t *values, /*!< [in] Values of attribute */
const h5_size_t nelems /*!< [in] Number of values */
) {
H5_API_ENTER (h5_err_t);
H5_API_RETURN (h5_write_attrib (
f,
H5_ATTRIB_STEP,
name,
H5T_NATIVE_FLOAT,
values,
nelems ));
}
/*!
\ingroup h5hut_attrib
Write an attribute \c name with float64 \c values to
the file root ("/").
\return \c H5_SUCCESS or error code
*/
h5_err_t
H5WriteFileAttribFloat64 (
h5_file_t *const f, /*!< [in] Handle to open file */
const char *name, /*!< [in] Name of attribute to create */
const h5_float64_t *values, /*!< [in] Values of attribute */
const h5_size_t nelems /*!< [in] Number of values */
) {
H5_API_ENTER (h5_err_t);
H5_API_RETURN (h5_write_attrib (
f,
H5_ATTRIB_FILE,
name,
H5T_NATIVE_DOUBLE,
values,
nelems));
}
/*!
\ingroup h5hut_attrib
Write an attribute \c name with float64 \c values to
the current time step.
\return \c H5_SUCCESS or error code
*/
h5_err_t
H5WriteStepAttribFloat64 (
h5_file_t *const f, /*!< [in] Handle to open file */
const char *name, /*!< [in] Name of attribute to create */
const h5_float64_t *values, /*!< [in] Values of attribute */
const h5_size_t nelems /*!< [in] Number of values */
) {
H5_API_ENTER (h5_err_t);
H5_API_RETURN (h5_write_attrib (
f,
H5_ATTRIB_STEP,
name,
H5T_NATIVE_DOUBLE,
values,
nelems));
}
/*!
\ingroup h5hut_attrib
Write an attribute \c name with int32 \c values to
the file root ("/").
\return \c H5_SUCCESS or error code
*/
h5_err_t
H5WriteFileAttribInt32 (
h5_file_t *const f, /*!< [in] Handle to open file */
const char *name, /*!< [in] Name of attribute to create */
const h5_int32_t *values, /*!< [in] Values of attribute */
const h5_size_t nelems /*!< [in] Number of values */
) {
H5_API_ENTER (h5_err_t);
H5_API_RETURN (h5_write_attrib (
f,
H5_ATTRIB_FILE,
name,
H5T_NATIVE_INT32,
values,
nelems));
}
/*!
\ingroup h5hut_attrib
Write an attribute \c name with int32 \c values to
the current time step.
\return \c H5_SUCCESS or error code
*/
h5_err_t
H5WriteStepAttribInt32 (
h5_file_t *const f, /*!< [in] Handle to open file */
const char *name, /*!< [in] Name of attribute to create */
const h5_int32_t *values, /*!< [in] Values of attribute */
const h5_size_t nelems /*!< [in] Number of values */
) {
H5_API_ENTER (h5_err_t);
H5_API_RETURN (h5_write_attrib (
f,
H5_ATTRIB_STEP,
name,
H5T_NATIVE_INT32,
values,
nelems));
}
/*!
\ingroup h5hut_attrib
Write an attribute \c name with int64 \c values to
the file root ("/").
\return \c H5_SUCCESS or error code
*/
h5_err_t
H5WriteFileAttribInt64 (
h5_file_t *const f, /*!< [in] Handle to open file */
const char *name, /*!< [in] Name of attribute to create */
const h5_int64_t *values, /*!< [in] Values of attribute */
const h5_size_t nelems /*!< [in] Number of values */
) {
H5_API_ENTER (h5_err_t);
H5_API_RETURN (h5_write_attrib (
f,
H5_ATTRIB_FILE,
name,
H5T_NATIVE_INT64,
values,
nelems));
}
/*!
\ingroup h5hut_attrib
Write an attribute \c name with int64 \c values to
the current time step.
\return \c H5_SUCCESS or error code
*/
h5_err_t
H5WriteStepAttribInt64 (
h5_file_t *const f, /*!< [in] Handle to open file */
const char *name, /*!< [in] Name of attribute to create */
const h5_int64_t *values, /*!< [in] Values of attribute */
const h5_size_t nelems /*!< [in] Number of values */
) {
H5_API_ENTER (h5_err_t);
H5_API_RETURN (h5_write_attrib (
f,
H5_ATTRIB_STEP,
name,
H5T_NATIVE_INT64,
values,
nelems));
}
/*** READ ***/
/*!
\ingroup h5hut_attrib
Read a string into a \c buffer from an attribute \c name
in the file root ("/").
\return \c H5_SUCCESS or error code
*/
h5_err_t
H5ReadFileAttribString (
h5_file_t *const f, /*!< [in] Handle to open file */
const char *name, /*!< [in] Name of attribute to create */
char *buffer /*!< [out] Value of attribute */
) {
H5_API_ENTER (h5_err_t);
H5_API_RETURN (h5_read_attrib (
f,
H5_ATTRIB_FILE,
name,
H5_STRING_T,
(void*)buffer));
}
/*!
\ingroup h5hut_attrib
Read a string into a \c buffer from an attribute \c name
in the current timestep.
\return \c H5_SUCCESS or error code
*/
h5_err_t
H5ReadStepAttribString (
h5_file_t *const f, /*!< [in] Handle to open file */
const char *name, /*!< [in] Name of attribute to create */
char *buffer /*!< [out] Value of attribute */
) {
H5_API_ENTER (h5_err_t);
H5_API_RETURN (h5_read_attrib (
f,
H5_ATTRIB_STEP,
name,
H5_STRING_T,
(void*)buffer));
}
/*!
\ingroup h5hut_attrib
Read int32 values into a \c buffer from an attribute \c name
in the file root ("/").
\return \c H5_SUCCESS or error code
*/
h5_err_t
H5ReadFileAttribInt32 (
h5_file_t *const f, /*!< [in] Handle to open file */
const char *name, /*!< [in] Name of attribute to create */
h5_int32_t *buffer /*!< [out] Values of attribute */
) {
H5_API_ENTER (h5_err_t);
H5_API_RETURN (h5_read_attrib (
f,
H5_ATTRIB_FILE,
name,
H5_INT32_T,
(void*)buffer));
}
/*!
\ingroup h5hut_attrib
Read int32 values into a \c buffer from an attribute \c name
in the current time step.
\return \c H5_SUCCESS or error code
*/
h5_err_t
H5ReadStepAttribInt32 (
h5_file_t *const f, /*!< [in] Handle to open file */
const char *name, /*!< [in] Name of attribute to create */
h5_int32_t *buffer /*!< [out] Values of attribute */
) {
H5_API_ENTER (h5_err_t);
H5_API_RETURN (h5_read_attrib (
f,
H5_ATTRIB_STEP,
name,
H5_INT32_T,
(void*)buffer));
}
/*!
\ingroup h5hut_attrib
Read int64 values into a \c buffer from an attribute \c name
in the file root ("/").
\return \c H5_SUCCESS or error code
*/
h5_err_t
H5ReadFileAttribInt64 (
h5_file_t *const f, /*!< [in] Handle to open file */
const char *name, /*!< [in] Name of attribute to create */
h5_int64_t *buffer /*!< [out] Values of attribute */
) {
H5_API_ENTER (h5_err_t);
H5_API_RETURN (h5_read_attrib (
f,
H5_ATTRIB_FILE,
name,
H5_INT64_T,
(void*)buffer));
}
/*!
\ingroup h5hut_attrib
Read int64 values into a \c buffer from an attribute \c name
in the current time step.
\return \c H5_SUCCESS or error code
*/
h5_err_t
H5ReadStepAttribInt64 (
h5_file_t *const f, /*!< [in] Handle to open file */
const char *name, /*!< [in] Name of attribute to create */
h5_int64_t *buffer /*!< [out] Values of attribute */
) {
H5_API_ENTER (h5_err_t);
h5_err_t h5err = h5_read_attrib (
f,
H5_ATTRIB_STEP,
name,
H5_INT64_T,
(void*)buffer);
H5_API_RETURN (h5err);
}
/*!
\ingroup h5hut_attrib
Read float32 values into a \c buffer from an attribute \c name
in the file root ("/").
\return \c H5_SUCCESS or error code
*/
h5_err_t
H5ReadFileAttribFloat32 (
h5_file_t *const f, /*!< [in] Handle to open file */
const char *name, /*!< [in] Name of attribute to create */
h5_float32_t *buffer /*!< [out] Values of attribute */
) {
H5_API_ENTER (h5_err_t);
H5_API_RETURN (h5_read_attrib (
f,
H5_ATTRIB_FILE,
name,
H5_FLOAT32_T,
(void*)buffer));
}
/*!
\ingroup h5hut_attrib
Read float32 values into a \c buffer from an attribute \c name
in the current time step.
\return \c H5_SUCCESS or error code
*/
h5_err_t
H5ReadStepAttribFloat32 (
h5_file_t *const f, /*!< [in] Handle to open file */
const char *name, /*!< [in] Name of attribute to create */
h5_float32_t *buffer /*!< [out] Values of attribute */
) {
H5_API_ENTER (h5_err_t);
H5_API_RETURN (h5_read_attrib (
f,
H5_ATTRIB_STEP,
name,
H5_FLOAT32_T,
(void*)buffer));
}
/*!
\ingroup h5hut_attrib
Read float64 values into a \c buffer from an attribute \c name
in the file root ("/").
\return \c H5_SUCCESS or error code
*/
h5_err_t
H5ReadFileAttribFloat64 (
h5_file_t *const f, /*!< [in] Handle to open file */
const char *name, /*!< [in] Name of attribute to create */
h5_float64_t *buffer /*!< [out] Values of attribute */
) {
H5_API_ENTER (h5_err_t);
H5_API_RETURN (h5_read_attrib (
f,
H5_ATTRIB_FILE,
name,
H5_FLOAT64_T,
(void*)buffer));
}
/*!
\ingroup h5hut_attrib
Read float64 values into a \c buffer from an attribute \c name
in the current time step.
\return \c H5_SUCCESS or error code
*/
h5_err_t
H5ReadStepAttribFloat64 (
h5_file_t *const f, /*!< [in] Handle to open file */
const char *name, /*!< [in] Name of attribute to create */
h5_float64_t *buffer /*!< [out] Values of attribute */
) {
H5_API_ENTER (h5_err_t);
H5_API_RETURN (h5_read_attrib (
f,
H5_ATTRIB_STEP,
name,
H5_FLOAT64_T,
(void*)buffer));
}
/*** QUERY ***/
/*!
\ingroup h5hut_attrib
Gets the number of attributes in the file's root ("/").
\return Number of attributes or error code.
*/
h5_int64_t
H5GetNumFileAttribs (
h5_file_t *const f /*!< [in] Handle to open file */
) {
H5_API_ENTER (h5_int64_t);
H5_API_RETURN (h5_get_num_attribs (f, H5_ATTRIB_FILE));
}
/*!
\ingroup h5hut_attrib
Gets the number of attributes bound to the current step.
\h5_err_t h5err = Number of attributes or error code.
*/
h5_int64_t
H5GetNumStepAttribs (
h5_file_t *const f /*!< [in] Handle to open file */
) {
H5_API_ENTER (h5_int64_t);
H5_API_RETURN (h5_get_num_attribs (f, H5_ATTRIB_STEP));
}
/*!
\ingroup h5hut_attrib
Gets the name, type and number of elements of the file attribute
specified by its index.
This function can be used to retrieve all attributes bound to the
file \c f by looping from \c 0 to the number of attribute minus
one. The number of attributes bound to file \c f can be queried
by calling \ref H5GetNumFileAttribs.
\return \c H5_SUCCESS or error code
*/
h5_err_t
H5GetFileAttribInfo (
h5_file_t *const f, /*!< [in] Handle to open file */
const h5_size_t attrib_idx, /*!< [in] Index of attribute to get
infos about */
char *attrib_name, /*!< [out] Name of attribute */
const h5_size_t len_of_attrib_name,
/*!< [in] length of buffer \c name */
h5_int64_t *attrib_type, /*!< [out] Type of value. */
h5_size_t *attrib_nelem /*!< [out] Number of elements */
) {
H5_API_ENTER (h5_int64_t);
H5_API_RETURN (h5_get_attrib_info (
f,
H5_ATTRIB_FILE,
attrib_idx,
attrib_name,
len_of_attrib_name,
attrib_type,
attrib_nelem));
}
/*!
\ingroup h5hut_attrib
Gets the name, type and number of elements of the step attribute
specified by its index.
This function can be used to retrieve all attributes bound to the
current time-step by looping from \c 0 to the number of attribute
minus one. The number of attributes bound to the current
time-step can be queried by calling \ref H5GetNumStepAttribs.
\return \c H5_SUCCESS or error code
*/
h5_err_t
H5GetStepAttribInfo (
h5_file_t *const f, /*!< [in] Handle to open file */
const h5_size_t attrib_idx, /*!< [in] Index of attribute to
get infos about */
char *attrib_name, /*!< [out] Name of attribute */
const h5_size_t len_of_attrib_name,
/*!< [in] length of buffer \c name */
h5_int64_t *attrib_type, /*!< [out] Type of value. */
h5_size_t *attrib_nelem /*!< [out] Number of elements */
) {
H5_API_ENTER (h5_err_t);
H5_API_RETURN (h5_get_attrib_info (
f,
H5_ATTRIB_STEP,
attrib_idx,
attrib_name,
len_of_attrib_name,
attrib_type,
attrib_nelem));
}
+23 -50
View File
@@ -1,54 +1,27 @@
# src/C level Makefile.am
OBJEXT=o
if ENABLE_C
include_HEADERS = \
$(top_srcdir)/src/include/H5Block_attribs.h \
$(top_srcdir)/src/include/H5Block_io.h \
$(top_srcdir)/src/include/H5Block_model.h \
$(top_srcdir)/src/include/H5Fed_adjacency.h \
$(top_srcdir)/src/include/H5Fed_model.h \
$(top_srcdir)/src/include/H5Fed_retrieve.h \
$(top_srcdir)/src/include/H5Fed_store.h \
$(top_srcdir)/src/include/H5Fed_tags.h \
$(top_srcdir)/src/include/H5Part_io.h \
$(top_srcdir)/src/include/H5Part_model.h \
$(top_srcdir)/src/include/H5_attachments.h \
$(top_srcdir)/src/include/H5_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
LIBS = @LIBS@
INCLUDES = -I../include @INCLUDES@
# What to build... Will be determined by configure script.
lib_LIBRARIES = @LIB_C@
# Listing of all possible targets that I may build.
EXTRA_LIBRARIES = libH5hutC.a
# Header files that I wish to install in $(prefix)/include
include_HEADERS = \
../include/H5hut.h \
../include/H5.h \
../include/H5_attribs.h \
../include/H5_attachments.h \
../include/H5Part.h \
../include/H5Block.h \
../include/H5Block_readwrite.h \
../include/H5Fed.h \
../include/H5Fed_adjacency.h \
../include/H5Fed_inquiry.h \
../include/H5Fed_retrieve.h \
../include/H5Fed_store.h \
../include/H5Fed_tags.h
# Listing of all possible headers that I may include
EXTRA_HEADERS =
endif
# Listing of sources
libH5hutC_a_SOURCES = \
H5.c \
H5_attribs.c \
H5_attachments.c \
H5Part.c \
H5Block.c \
H5Block_readwrite.c \
H5Fed.c \
H5Fed_adjacency.c \
H5Fed_inquiry.c \
H5Fed_retrieve.c \
H5Fed_store.c \
H5Fed_tags.c
all: all-am install-libs-local
install-libs-local:
-cp ${lib_LIBRARIES} ../lib
clean: clean-am
clean-local:
$(RM) *~
-569
View File
@@ -1,569 +0,0 @@
#!/usr/bin/python
c_head = """
#include "h5core/h5_core.h"
"""
h_head = """
#ifndef __H5BLOCK_READWRITE_H
#define __H5BLOCK_READWRITE_H
"""
h_tail = """
#endif
"""
fc_head = """
#include <stdlib.h>
#include "h5core/h5_core.h"
#include "Underscore.h"
#if defined(F77_SINGLE_UNDERSCORE)
#define F77NAME(a,b) a
#elif defined(F77_CRAY_UNDERSCORE)
#define F77NAME(a,b) b
#elif defined(F77_NO_UNDERSCORE)
#else
#error Error, no way to determine how to construct fortran bindings
#endif
"""
write_scalar_h = """
h5_err_t
H5Block#DIM#dWriteScalarField#TYPE_ABV# (
h5_file_t *f,
const char *name,
const h5_#TYPE_H5P#_t *data
);
"""
read_scalar_h = """
h5_err_t
H5Block#DIM#dReadScalarField#TYPE_ABV# (
h5_file_t *f,
const char *name,
h5_#TYPE_H5P#_t *data
);
"""
write_scalar_c = """
/*!
\\ingroup h5block_data
Write a 3-dimensional field \\c name from the buffer starting at \\c data
to the current time-step using the defined field layout. Values are
#TYPE_FULL#.
You must use the Fortran indexing scheme to access items in \\c data.
\\return \\c H5_SUCCESS or error code
*/
h5_err_t
H5Block#DIM#dWriteScalarField#TYPE_ABV# (
h5_file_t *f, /*!< IN: file handle */
const char *name, /*!< IN: name of dataset to write */
const h5_#TYPE_H5P#_t *data /*!< IN: scalar data to write */
) {
SET_FNAME( f, __func__ );
return h5b_write_scalar_data(f, name, (void*)data, #TYPE_HDF5# );
}
"""
read_scalar_c = """
/*!
\\ingroup h5block_data
Read a 3-dimensional field \\c name into the buffer starting at \\c data from
the current time-step using the defined field layout. Values are
#TYPE_FULL#.
You must use the Fortran indexing scheme to access items in \\c data.
\\return \\c H5_SUCCESS or error code
*/
h5_err_t
H5Block#DIM#dReadScalarField#TYPE_ABV# (
h5_file_t *f, /*!< IN: file handle */
const char *name, /*!< IN: name of dataset to read */
h5_#TYPE_H5P#_t *data /*!< OUT: ptr to read buffer */
) {
SET_FNAME( f, __func__ );
return h5b_read_scalar_data(f, name, (void*)data, #TYPE_HDF5#);
}
"""
write_scalar_fi = """
!> \\ingroup h5block_data_f
!! See \\ref H5Block#DIM#dWriteScalarField#TYPE_ABV#
!! \\return 0 on success or error code
!<
INTEGER*8 FUNCTION h5bl_#DIM#d_write_scalar_field_#TYPE_F90_ABV# ( filehandle, name, data )
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open
CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the dataset
#TYPE_F90#, INTENT(IN) :: data(*) !< the array of data
END FUNCTION
"""
read_scalar_fi = """
!> \\ingroup h5block_data_f
!! See \\ref H5Block#DIM#dReadScalarField#TYPE_ABV#
!! \\return 0 on success or error code
!<
INTEGER*8 FUNCTION h5bl_#DIM#d_read_scalar_field_#TYPE_F90_ABV# ( filehandle, name, data )
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open
CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the dataset
#TYPE_F90#, INTENT(OUT) :: data(*) !< buffer to read the data into
END FUNCTION
"""
write_scalar_fc = """
#if ! defined(F77_NO_UNDERSCORE)
#define h5bl_#DIM#d_write_scalar_field_#TYPE_F90_ABV# F77NAME ( \\
h5bl_#DIM#d_write_scalar_field_#TYPE_F90_ABV#_, \\
H5BL_#DIM#D_WRITE_SCALAR_FIELD_#TYPE_F90_ABVC# )
#endif
h5_err_t
h5bl_#DIM#d_write_scalar_field_#TYPE_F90_ABV# (
h5_int64_t *f,
const char *field_name,
const h5_#TYPE_H5P#_t *data,
const int l_field_name
) {
h5_file_t *filehandle = (h5_file_t*)(size_t)*f;
h5_set_funcname( filehandle, __func__ );
char *field_name2 = h5_strdupfor2c ( field_name, l_field_name );
h5_err_t herr = h5b_write_scalar_data (
filehandle, field_name2, (void*)data, #TYPE_HDF5# );
free ( field_name2 );
return herr;
}
"""
read_scalar_fc = """
#if ! defined(F77_NO_UNDERSCORE)
#define h5bl_3d_read_scalar_field_#TYPE_F90_ABV# F77NAME ( \\
h5bl_3d_read_scalar_field_#TYPE_F90_ABV#_, \\
H5BL_#DIM#D_READ_SCALAR_FIELD_#TYPE_F90_ABVC# )
#endif
h5_err_t
h5bl_#DIM#d_read_scalar_field_#TYPE_F90_ABV# (
h5_int64_t *f,
const char *field_name,
h5_#TYPE_H5P#_t *data,
const int l_field_name
) {
h5_file_t *filehandle = (h5_file_t*)(size_t)*f;
h5_set_funcname( filehandle, __func__ );
char *field_name2 = h5_strdupfor2c ( field_name, l_field_name );
h5_err_t herr = h5b_read_scalar_data (
filehandle, field_name2, data, #TYPE_HDF5# );
free ( field_name2 );
return herr;
}
"""
write_vector_h = """
h5_err_t
H5Block#DIM#dWriteVector3dField#TYPE_ABV# (
h5_file_t *f,
const char *name,
const h5_#TYPE_H5P#_t *x_data,
const h5_#TYPE_H5P#_t *y_data,
const h5_#TYPE_H5P#_t *z_data
);
"""
read_vector_h = """
h5_err_t
H5Block#DIM#dReadVector3dField#TYPE_ABV# (
h5_file_t *f,
const char *name,
h5_#TYPE_H5P#_t *x_data,
h5_#TYPE_H5P#_t *y_data,
h5_#TYPE_H5P#_t *z_data
);
"""
write_vector_c = """
/*!
\\ingroup h5block_data
*/
/*!
Write a 3-dimensional field \\c name with 3-dimensional vectors as values
from the buffers starting at \\c x_data, \\c y_data and \\c z_data to the
current time-step using the defined field layout. Values are 3-dimensional
vectors with #TYPE_FULL# values.
You must use the Fortran indexing scheme to access items in \\c data.
\\return \\c H5_SUCCESS or error code
*/
h5_err_t
H5Block#DIM#dWriteVector3dField#TYPE_ABV# (
h5_file_t *f, /*!< IN: file handle */
const char *name, /*!< IN: name of dataset to write */
const h5_#TYPE_H5P#_t *x_data, /*!< IN: X axis data */
const h5_#TYPE_H5P#_t *y_data, /*!< IN: Y axis data */
const h5_#TYPE_H5P#_t *z_data /*!< IN: Z axis data */
) {
SET_FNAME( f, __func__ );
return h5b_write_vector3d_data(f, name,
(void*)x_data, (void*)y_data, (void*)z_data, #TYPE_HDF5#);
}
"""
read_vector_c = """
/*!
\\ingroup h5block_data
*/
/*!
Read a 3-dimensional field \\c name with 3-dimensional vectors as values
from the buffers starting at \\c x_data, \\c y_data and \\c z_data to the
current time-step using the defined field layout. Values are 3-dimensional
vectors with #TYPE_FULL# values.
You must use the Fortran indexing scheme to access items in \\c data.
\\return \\c H5_SUCCESS or error code
*/
h5_err_t
H5Block#DIM#dReadVector3dField#TYPE_ABV# (
h5_file_t *f, /*!< IN: file handle */
const char *name, /*!< IN: name of dataset to write */
h5_#TYPE_H5P#_t *x_data, /*!< OUT: X axis data */
h5_#TYPE_H5P#_t *y_data, /*!< OUT: Y axis data */
h5_#TYPE_H5P#_t *z_data /*!< OUT: Z axis data */
) {
SET_FNAME( f, __func__ );
return h5b_read_vector3d_data(f, name,
(void*)x_data, (void*)y_data, (void*)z_data, #TYPE_HDF5#);
}
"""
write_vector_fi = """
!> \\ingroup h5block_data_f
!! See \\ref H5Block#DIM#dWriteVector3dField#TYPE_ABV#
!! \\return 0 on success or error code
!<
INTEGER*8 FUNCTION h5bl_#DIM#d_write_vector3d_field_#TYPE_F90_ABV# ( filehandle, name, x, y, z )
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open
CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the dataset
#TYPE_F90#, INTENT(IN) :: x(*) !< the array of x data to write
#TYPE_F90#, INTENT(IN) :: y(*) !< the array of y data to write
#TYPE_F90#, INTENT(IN) :: z(*) !< the array of z data to write
END FUNCTION
"""
read_vector_fi = """
!> \\ingroup h5block_data_f
!! See \\ref H5Block#DIM#dReadVector3dField#TYPE_ABV#
!! \\return 0 on success or error code
!<
INTEGER*8 FUNCTION h5bl_#DIM#d_read_vector3d_field_#TYPE_F90_ABV# ( filehandle, name, x, y, z )
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open
CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the dataset
#TYPE_F90#, INTENT(OUT) :: x(*) !< buffer to read the x data into
#TYPE_F90#, INTENT(OUT) :: y(*) !< buffer to read the y data into
#TYPE_F90#, INTENT(OUT) :: z(*) !< buffer to read the z data into
END FUNCTION
"""
write_vector_fc = """
#if ! defined(F77_NO_UNDERSCORE)
#define h5bl_#DIM#d_write_vector3d_field_#TYPE_F90_ABV# F77NAME ( \\
h5bl_#DIM#d_write_vector3d_field_#TYPE_F90_ABV#_, \\
H5BL_#DIM#D_WRITE_VECTOR3D_FIELD_#TYPE_F90_ABVC# )
#endif
h5_err_t
h5bl_#DIM#d_write_vector3d_field_#TYPE_F90_ABV# (
h5_int64_t *f, /*!< file handle */
const char *field_name, /*!< name of the data set */
const h5_#TYPE_H5P#_t *xval, /*!< array of x component data */
const h5_#TYPE_H5P#_t *yval, /*!< array of y component data */
const h5_#TYPE_H5P#_t *zval, /*!< array of z component data */
const int l_field_name
) {
h5_file_t *filehandle = (h5_file_t*)(size_t)*f;
h5_set_funcname( filehandle, __func__ );
char *field_name2 = h5_strdupfor2c ( field_name, l_field_name );
h5_err_t herr = h5b_write_vector3d_data (
filehandle, field_name2,
(void*)xval, (void*)yval, (void*)zval, #TYPE_HDF5# );
free ( field_name2 );
return herr;
}
"""
read_vector_fc = """
#if ! defined(F77_NO_UNDERSCORE)
#define h5bl_#DIM#d_read_vector3d_field_#TYPE_F90_ABV# F77NAME ( \\
h5bl_#DIM#d_read_vector3d_field_#TYPE_F90_ABV#_, \\
H5BL_#DIM#D_READ_VECTOR3D_FIELD_#TYPE_F90_ABVC# )
#endif
h5_err_t
h5bl_#DIM#d_read_vector3d_field_#TYPE_F90_ABV# (
h5_int64_t *f, /*!< file handle */
const char *field_name, /*!< name of the data set */
h5_#TYPE_H5P#_t *xval, /*!< array of x component data */
h5_#TYPE_H5P#_t *yval, /*!< array of y component data */
h5_#TYPE_H5P#_t *zval, /*!< array of z component data */
const int l_field_name
) {
h5_file_t *filehandle = (h5_file_t*)(size_t)*f;
h5_set_funcname( filehandle, __func__ );
char *field_name2 = h5_strdupfor2c ( field_name, l_field_name );
h5_err_t herr = h5b_read_vector3d_data (
filehandle, field_name2,
(void*)xval, (void*)yval, (void*)zval, #TYPE_HDF5# );
free ( field_name2 );
return herr;
}
"""
write_attr_h = """
h5_err_t
H5BlockWriteFieldAttrib#TYPE_ABV# (
h5_file_t *f,
const char *field_name,
const char *attrib_name,
const h5_#TYPE_H5P#_t *values,
const h5_size_t nvalues
);
"""
write_attr_c = """
/*!
\\ingroup h5block_attrib
Write #TYPE_H5P# \\c values as attribute \\c attrib_name of field
\\c field_name.
\\return \\c H5_SUCCESS or error code
*/
h5_err_t
H5BlockWriteFieldAttrib#TYPE_ABV# (
h5_file_t *f, /*!< IN: file handle */
const char *field_name, /*!< IN: field name */
const char *attrib_name, /*!< IN: attribute name */
const h5_#TYPE_H5P#_t *values, /*!< IN: attribute values */
const h5_size_t nvalues /*!< IN: number of elements */
) {
SET_FNAME( f, __func__ );
return h5_write_field_attrib (
f,
field_name,
attrib_name,
#TYPE_HDF5#,
values,
nvalues );
}
"""
write_attr_fi = """
!> \\ingroup h5block_attrib_f
!! See \\ref H5BlockWriteFieldAttrib#TYPE_ABV#
!! \\return 0 on success or error code
!<
INTEGER*8 FUNCTION h5bl_writefieldattrib_#TYPE_F90_ABV# ( filehandle, field_name, attrib_name, attrib_value, attrib_nelem)
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open
CHARACTER(LEN=*), INTENT(IN) :: field_name !< the name of the field
CHARACTER(LEN=*), INTENT(IN) :: attrib_name !< the name of the attribute
#TYPE_F90#, INTENT(IN) :: values(*) !< the array of data to write into the attribute
INTEGER*8, INTENT(IN) :: nvalues !< the number of elements in the array
END FUNCTION
"""
write_attr_fc = """
#if ! defined(F77_NO_UNDERSCORE)
#define h5bl_writefieldattrib_#TYPE_F90_ABV# F77NAME ( \\
h5bl_writefieldattrib_#TYPE_F90_ABV#_, \\
H5BL_WRITEFIELDATTRIB_#TYPE_F90_ABVC# )
#endif
h5_err_t
h5bl_writefieldattrib_#TYPE_F90_ABV# (
h5_int64_t *f,
const char *field_name,
const char *attrib_name,
const h5_#TYPE_H5P#_t *values,
const h5_size_t *nvalues,
const int l_field_name,
const int l_attrib_name
) {
h5_file_t *filehandle = (h5_file_t*)(size_t)*f;
h5_set_funcname( filehandle, __func__ );
char *field_name2 = h5_strdupfor2c ( field_name, l_field_name );
char *attrib_name2 = h5_strdupfor2c ( attrib_name, l_attrib_name );
h5_err_t herr = h5_write_field_attrib (
filehandle, field_name2, attrib_name2,
#TYPE_HDF5#, values, *nvalues );
free ( field_name2 );
free ( attrib_name2 );
return herr;
}
"""
read_attr_h = """
h5_err_t
H5BlockReadFieldAttrib#TYPE_ABV# (
h5_file_t *f,
const char *field_name,
const char *attrib_name,
h5_#TYPE_H5P#_t *buffer
);
"""
read_attr_c = """
/*!
\\ingroup h5block_attrib
Read #TYPE_H5P# values from attribute \\c attrib_name of field
\\c field_name into a \\c buffer.
\\return \\c H5_SUCCESS or error code
*/
h5_err_t
H5BlockReadFieldAttrib#TYPE_ABV# (
h5_file_t *f, /*!< IN: file handle */
const char *field_name, /*!< IN: field name */
const char *attrib_name, /*!< IN: attribute name */
h5_#TYPE_H5P#_t *buffer /*!< OUT: attribute values */
) {
SET_FNAME( f, __func__ );
return h5_read_field_attrib (
f,
field_name,
attrib_name,
#TYPE_HDF5#,
(void*)buffer);
}
"""
read_attr_fi = """
!> \\ingroup h5block_attrib_f
!! See \\ref H5BlockReadFieldAttrib#TYPE_ABV#
!! \\return 0 on success or error code
!<
INTEGER*8 FUNCTION h5bl_readfieldattrib_#TYPE_F90_ABV# ( filehandle, field_name, attrib_name, attrib_value, attrib_nelem)
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open
CHARACTER(LEN=*), INTENT(IN) :: field_name !< the name of the field
CHARACTER(LEN=*), INTENT(IN) :: attrib_name !< the name of the attribute
#TYPE_F90#, INTENT(IN) :: values(*) !< the buffer to read into
END FUNCTION
"""
read_attr_fc = """
#if ! defined(F77_NO_UNDERSCORE)
#define h5bl_readfieldattrib_#TYPE_F90_ABV# F77NAME ( \\
h5bl_readfieldattrib_#TYPE_F90_ABV#_, \\
H5BL_READFIELDATTRIB_#TYPE_F90_ABVC# )
#endif
h5_err_t
h5bl_readfieldattrib_#TYPE_F90_ABV# (
h5_int64_t *f,
const char *field_name,
const char *attrib_name,
h5_#TYPE_H5P#_t *values,
const int l_field_name,
const int l_attrib_name
) {
h5_file_t *filehandle = (h5_file_t*)(size_t)*f;
h5_set_funcname( filehandle, __func__ );
char *field_name2 = h5_strdupfor2c ( field_name, l_field_name );
char *attrib_name2 = h5_strdupfor2c ( attrib_name, l_attrib_name );
h5_err_t herr = h5_read_field_attrib (
filehandle, field_name2, attrib_name2, #TYPE_HDF5#, values );
free ( field_name2 );
free ( attrib_name2 );
return herr;
}
"""
dims = ["3"]
types = [
["floating points (64-bit)", "Float64", "float64", "H5T_NATIVE_DOUBLE", "REAL*8", "r8", "R8"],
["floating points (32-bit)", "Float32", "float32", "H5T_NATIVE_FLOAT", "REAL*4", "r4", "R4"],
["integers (64-bit)", "Int64", "int64", "H5T_NATIVE_INT64", "INTEGER*8", "i8", "I8"],
["integers (32-bit)", "Int32", "int32", "H5T_NATIVE_INT32", "INTEGER*4", "i4", "I4"]
]
def create_call(template, type, dim):
fcn = template
fcn = fcn.replace('#DIM#',dim)\
.replace('#TYPE_FULL#',type[0])\
.replace('#TYPE_ABV#',type[1])\
.replace('#TYPE_H5P#',type[2])\
.replace('#TYPE_HDF5#',type[3])\
.replace('#TYPE_F90#',type[4])\
.replace('#TYPE_F90_ABV#',type[5])\
.replace('#TYPE_F90_ABVC#',type[6])
return fcn
def write_calls():
cfile = file('H5Block_readwrite.c','w')
cfile.write(c_head)
hfile = file('../include/H5Block_readwrite.h','w')
hfile.write(h_head)
fcfile = file('../Fortran/H5Block_readwrite_F.c','w')
fcfile.write(fc_head)
fifile = file('../Fortran/H5Block_readwrite.f90','w')
for dim in dims:
for type in types:
cfile.write(create_call(write_scalar_c,type,dim));
cfile.write(create_call(read_scalar_c,type,dim));
hfile.write(create_call(write_scalar_h,type,dim));
hfile.write(create_call(read_scalar_h,type,dim));
fcfile.write(create_call(write_scalar_fc,type,dim));
fcfile.write(create_call(read_scalar_fc,type,dim));
fifile.write(create_call(write_scalar_fi,type,dim));
fifile.write(create_call(read_scalar_fi,type,dim));
cfile.write(create_call(write_vector_c,type,dim));
cfile.write(create_call(read_vector_c,type,dim));
hfile.write(create_call(write_vector_h,type,dim));
hfile.write(create_call(read_vector_h,type,dim));
fcfile.write(create_call(write_vector_fc,type,dim));
fcfile.write(create_call(read_vector_fc,type,dim));
fifile.write(create_call(write_vector_fi,type,dim));
fifile.write(create_call(read_vector_fi,type,dim));
for type in types:
cfile.write(create_call(write_attr_c,type,""));
hfile.write(create_call(write_attr_h,type,""));
fifile.write(create_call(write_attr_fi,type,""));
fcfile.write(create_call(write_attr_fc,type,""));
cfile.write(create_call(read_attr_c,type,""));
hfile.write(create_call(read_attr_h,type,""));
fifile.write(create_call(read_attr_fi,type,""));
fcfile.write(create_call(read_attr_fc,type,""));
cfile.close()
hfile.write(h_tail)
hfile.close()
fcfile.close()
fifile.close()
write_calls()
+275
View File
@@ -0,0 +1,275 @@
/*
Copyright (c) 2006-2015, The Regents of the University of California,
through Lawrence Berkeley National Laboratory (subject to receipt of any
required approvals from the U.S. Dept. of Energy) and the Paul Scherrer
Institut (Switzerland). All rights reserved.
License: see file COPYING in top level of source distribution.
*/
#include "h5_private.h"
#include "h5core/h5_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
) {
H5_API_ENTER (h5_int64_t, "%s", "");
H5_API_RETURN ((h5_int64_t)h5_create_prop (H5_PROP_FILE));
}
#if defined(PARALLEL_IO)
#define h5_setprop_file_mpio FC_MANGLING( \
h5_setprop_file_mpio, \
H5_SETPROP_FILE_MPIO)
h5_int64_t
h5_setprop_file_mpio (
h5_int64_t* _prop,
MPI_Fint* _comm
) {
H5_API_ENTER (h5_int64_t,
"prop=%lld, comm=%lld",
(long long int)*_prop, (long long int)*_comm);
h5_prop_t prop = (h5_prop_t)*_prop;
MPI_Comm comm = MPI_Comm_f2c (*_comm);
H5_API_RETURN ((h5_int64_t)h5_set_prop_file_mpio_collective (prop, &comm));
}
#define h5_setprop_file_mpio_collective FC_MANGLING( \
h5_setprop_file_mpio_collective, \
H5_SETPROP_FILE_MPIO_COLLECTIVE)
h5_int64_t
h5_setprop_file_mpio_collective (
h5_int64_t* _prop,
MPI_Fint* _comm
) {
H5_API_ENTER (h5_int64_t,
"prop=%lld, comm=%lld",
(long long int)*_prop, (long long int)*_comm);
h5_prop_t prop = (h5_prop_t)*_prop;
MPI_Comm comm = MPI_Comm_f2c (*_comm);
H5_API_RETURN ((h5_int64_t)h5_set_prop_file_mpio_collective (prop, &comm));
}
#define h5_setprop_file_mpio_independent FC_MANGLING( \
h5_setprop_file_mpio_independent, \
H5_SETPROP_FILE_MPIO_INDEPENDENT)
h5_int64_t
h5_setprop_file_mpio_independent (
h5_int64_t* _prop,
MPI_Fint* _comm
) {
H5_API_ENTER (h5_int64_t,
"prop=%lld, comm=%lld",
(long long int)*_prop, (long long int)*_comm);
h5_prop_t prop = (h5_prop_t)*_prop;
MPI_Comm comm = MPI_Comm_f2c (*_comm);
H5_API_RETURN ((h5_int64_t)h5_set_prop_file_mpio_independent (prop, &comm));
}
#if H5_VERSION_LE(1,8,12)
#define h5_setprop_file_mpio_posix FC_MANGLING( \
h5_setprop_file_mpio_posix, \
H5_SETPROP_FILE_MPIO_POSIX)
h5_int64_t
h5_setprop_file_mpio_posix (
h5_int64_t* _prop,
MPI_Fint* _comm
) {
H5_API_ENTER (h5_int64_t,
"prop=%lld, comm=%lld",
(long long int)*_prop, (long long int)*_comm);
h5_prop_t prop = (h5_prop_t)*_prop;
MPI_Comm comm = MPI_Comm_f2c (*_comm);
H5_API_RETURN ((h5_int64_t)h5_set_prop_file_mpio_posix (prop, &comm));
}
#endif
#endif
#define h5_setprop_file_corevfd FC_MANGLING( \
h5_setprop_file_corevfd, \
H5_SETPROP_FILE_COREVFD)
h5_int64_t
h5_setprop_file_corevfd (
h5_int64_t* _prop,
h5_int64_t* increment
) {
H5_API_ENTER (h5_int64_t,
"prop=%lld, increment=%lld",
(long long int)*_prop, (long long int)*increment);
h5_prop_t prop = (h5_prop_t)*_prop;
H5_API_RETURN ((h5_int64_t)h5_set_prop_file_core_vfd (prop, *increment));
}
#define h5_setprop_file_align FC_MANGLING ( \
h5_setprop_file_align, \
H5_SETPROP_FILE_ALIGN)
h5_int64_t
h5_setprop_file_align (
h5_int64_t* _prop,
h5_int64_t* align
) {
H5_API_ENTER (h5_err_t,
"prop=%lld, align=%lld",
(long long int)*_prop, (long long int)*align);
h5_prop_t prop = (h5_prop_t)*_prop;
H5_API_RETURN (h5_set_prop_file_align (prop, *align));
}
#define h5_setprop_file_throttle FC_MANGLING ( \
h5_setprop_file_throttle, \
H5_SETPROP_FILE_THROTTLE)
h5_int64_t
h5_setprop_file_throttle (
h5_int64_t* _prop,
h5_int64_t* throttle
) {
H5_API_ENTER (
h5_err_t,
"prop=%lld, throttle=%lld",
(long long int)*_prop, (long long int)*throttle);
h5_prop_t prop = (h5_prop_t)*_prop;
H5_API_RETURN (h5_set_prop_file_throttle (prop, *throttle));
}
#define h5_closeprop FC_MANGLING ( \
h5_closeprop, \
H5_CLOSEPROP)
h5_int64_t
h5_closeprop (
h5_int64_t* _prop
) {
H5_API_ENTER (h5_err_t,
"prop=%lld",
(long long int)*_prop);
h5_prop_t prop = (h5_prop_t)*_prop;
H5_API_RETURN (h5_close_prop (prop));
}
#define h5_openfile FC_MANGLING( \
h5_openfile, \
H5_OPENFILE)
h5_int64_t
h5_openfile (
const char* _fname,
h5_int64_t* _mode,
h5_int64_t* _props,
const int _len_fname
) {
int len_fname = strlenf (_fname, _len_fname);
H5_API_ENTER (h5_int64_t,
"fname = %*s, mode=%lld, props=%lld",
len_fname, _fname, (long long int)*_mode, (long long int)*_props);
char* fname = h5_strdupfor2c (_fname, _len_fname);
h5_int64_t mode = *_mode;
h5_prop_t props = (h5_prop_t)*_props;
h5_file_t f = h5_open_file2 (fname, mode, props);
free (fname);
H5_API_RETURN ((h5_int64_t)f);
}
#define h5_closefile FC_MANGLING( \
h5_closefile, \
H5_CLOSEFILE)
h5_int64_t
h5_closefile (
const h5_int64_t *f
) {
h5_file_t fh = h5_filehandlefor2c(f);
H5_API_ENTER (h5_int64_t, "f=%p", (h5_file_p)fh);
H5_API_RETURN (h5_close_file (fh));
}
#define h5_checkfile FC_MANGLING( \
h5_checkfile, \
H5_CHECKFILE)
h5_int64_t
h5_checkfile (
const h5_int64_t *f
) {
h5_file_t fh = h5_filehandlefor2c(f);
H5_API_ENTER (h5_int64_t, "f=%p", (h5_file_p)fh);
H5_API_RETURN (h5_check_filehandle (fh));
}
#define h5_flushfile FC_MANGLING( \
h5_flushfile, \
H5_FLUSHFILE)
h5_int64_t
h5_flushfile (
const h5_int64_t* f
) {
h5_file_t fh = h5_filehandlefor2c(f);
H5_API_ENTER (h5_int64_t, "f=%p", (h5_file_p)fh);
H5_API_RETURN (h5_flush_file (fh));
}
#define h5_flushstep FC_MANGLING( \
h5_flushstep, \
H5_FLUSHSTEP)
h5_int64_t
h5_flushstep (
const h5_int64_t* f
) {
h5_file_t fh = h5_filehandlefor2c(f);
H5_API_ENTER (h5_int64_t, "f=%p", (h5_file_p)fh);
H5_API_RETURN (h5_flush_step (fh));
}
#define h5_finalize FC_MANGLING( \
h5_finalize, \
H5_FINALIZE)
h5_int64_t
h5_finalize (
void
) {
H5_API_ENTER (h5_int64_t, "%s", "");
H5_API_RETURN (h5_close_hdf5());
}
/* debug output */
#define h5_set_verbosity_level FC_MANGLING( \
h5_set_verbosity_level, \
H5_SET_VERBOSITY_LEVEL)
h5_int64_t
h5_set_verbosity_level (
const h5_int64_t *level
) {
H5_API_ENTER (h5_int64_t, "level=%lld", (long long)*level);
H5_API_RETURN(h5_set_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

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