Compare commits
336 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 7e7a85f14f | |||
| fc1322432c | |||
| f5778e0197 | |||
| fb084fdff4 | |||
| be7cd1d471 | |||
| f7b7a45a28 | |||
| e41db835eb | |||
| 8140378213 | |||
| 6a4d711b99 | |||
| 2ae76250e6 | |||
| f1cb1c981e | |||
| 627d6673e1 | |||
| ed85fb32b7 | |||
| df2be38428 | |||
| d423367d4f | |||
| 1985a0a2e0 | |||
| 24533c4c2e | |||
| 72365540a3 | |||
| 4daf9b786c | |||
| 072a2781fc | |||
| 9c9bfda054 | |||
| 604dade2a1 | |||
| 2da69d1095 | |||
| 15317a9bb0 | |||
| c5f3b7fa02 | |||
| a81c79e5c4 | |||
| 664cee709b | |||
| ecc4618bd4 | |||
| 8bdebd0c55 | |||
| 5baed631b7 | |||
| 65109b73a9 | |||
| 792e86e01e | |||
| 11ab169164 | |||
| 7c899f99ce | |||
| 12ef028ed2 | |||
| 094117a631 | |||
| acc8b75ad9 | |||
| 078a51d60d | |||
| 06a941eb2c | |||
| 269c5efbde | |||
| e7a60fbe9f | |||
| 2ed8ad093c | |||
| 3a9e0e4153 | |||
| aa1f4eacc8 | |||
| c33ef6d390 | |||
| 9a32a0b7f1 | |||
| 22d6893770 | |||
| 6e0f0eeedd | |||
| 542daf7fc2 | |||
| f79c808e8d | |||
| b6e482f56a | |||
| 6d3014bad5 | |||
| 20424235e8 | |||
| 7d73439b10 | |||
| e447d536a3 | |||
| 74df1bc676 | |||
| 9e4c8bd5a4 | |||
| bb1cd9c860 | |||
| ad52833022 | |||
| 3425a30068 | |||
| 9f3a677ea6 | |||
| 23807ff972 | |||
| 93d4f60116 | |||
| 20cd5aae98 | |||
| cae3b00855 | |||
| 2a462733ca | |||
| 6fb8b77baa | |||
| c26d6a84e3 | |||
| 54ccc3b576 | |||
| 8ffe944519 | |||
| 2bb3d688ae | |||
| 647af5847e | |||
| aa4f40ee3d | |||
| f1daa56cb8 | |||
| 2ea8245bba | |||
| 04fe7fdd9e | |||
| 075b2f39da | |||
| 7b05c32ad9 | |||
| 825ee8ac5f | |||
| 9d70c07476 | |||
| 03986b00ac | |||
| ad83c3841b | |||
| 73fabd043b | |||
| 0aa44727c6 | |||
| babd19ddd4 | |||
| c80f6f5679 | |||
| 7b1079ae5f | |||
| ecd2723419 | |||
| c9044d8e1b | |||
| 5b57bedade | |||
| 222789a1cf | |||
| 21dd57c9c6 | |||
| fc29f7b6f0 | |||
| e56872ce92 | |||
| 85ecf4c387 | |||
| 6979a358ae | |||
| 9fc3b233bc | |||
| f5eb26d2ec | |||
| 6af129b338 | |||
| 215d1a7d79 | |||
| 8bb22e4400 | |||
| caad81996a | |||
| f97e3c8f2d | |||
| fba78db1c0 | |||
| 291328b997 | |||
| 2c1bca01aa | |||
| a633b362a6 | |||
| a12908ed90 | |||
| b83d9cc8a7 | |||
| 6ad9ae50e0 | |||
| 9ac7e09423 | |||
| 66452a274b | |||
| d947f51c2d | |||
| f5729f6f07 | |||
| a64f2ce03a | |||
| b880bd397f | |||
| cd2c9031b9 | |||
| fb5e55990f | |||
| 25dff9257c | |||
| ac37d5fc2f | |||
| 983496104b | |||
| aaeca8b6b7 | |||
| 0182d60835 | |||
| f75ef09cf9 | |||
| c831a90a2e | |||
| bdcc8f2089 | |||
| bbbaa6a21b | |||
| 4c5b16169d | |||
| cc46b433e1 | |||
| a8e209a7d3 | |||
| 80cf35e807 | |||
| d53c5b3171 | |||
| 8edb48aff8 | |||
| 24af2ae2a3 | |||
| 7fbd5c5de1 | |||
| 18611991a5 | |||
| 603366bcd6 | |||
| 17317bb261 | |||
| 52d44e3b3c | |||
| 3d6230629c | |||
| 44ffea4fd5 | |||
| 97516866c7 | |||
| 1dfcd9f876 | |||
| 2dd2c625b7 | |||
| 3137063d22 | |||
| 9a16fa090a | |||
| df0750df4c | |||
| b69aa9b92d | |||
| 99699d4bf7 | |||
| 9df1a57778 | |||
| 1ed4f3985b | |||
| 2c850612ab | |||
| bc528f27e6 | |||
| 5444b0e0ef | |||
| ae9e4cee01 | |||
| 7490eed535 | |||
| 84fa4a0b0a | |||
| 718ef785f8 | |||
| 7002b73e82 | |||
| 2a8a43af39 | |||
| f0c2f29091 | |||
| 5362498a95 | |||
| 851905361d | |||
| 3c8b11f9eb | |||
| 4dde2b61d2 | |||
| d980f4d2b9 | |||
| 3f7c84dbf5 | |||
| c5a05a1261 | |||
| 230f9a7b90 | |||
| 2cd718b7a1 | |||
| c73d10ffb7 | |||
| 6209bc6cf9 | |||
| a013d43075 | |||
| f151a24796 | |||
| 9d37783868 | |||
| a8444e041b | |||
| dc9723dfe2 | |||
| 91e7ed8c5b | |||
| b284ad9776 | |||
| f965ed4f18 | |||
| 91316f314d | |||
| 538c9cdd76 | |||
| 28fc118118 | |||
| 59fd8ea6c6 | |||
| 1273baf99e | |||
| befaccddaf | |||
| 5204cb532b | |||
| 9917f12d96 | |||
| 4b1d719d6c | |||
| 43bc72b7d0 | |||
| 64b4a3be09 | |||
| f4e7defffa | |||
| 320fd77398 | |||
| 5714c390ec | |||
| a07d4101a2 | |||
| 56787866fb | |||
| fb3b876f78 | |||
| e4ebb0f453 | |||
| 51f2210ff1 | |||
| 511fbb89de | |||
| 87fcc4930b | |||
| 49460b62c3 | |||
| 8ae12f7ee9 | |||
| ca7dd3b99c | |||
| 6efdfce033 | |||
| 55cc6bb7d0 | |||
| 4fcc1ed3b3 | |||
| 23bb1ced99 | |||
| 1f629ee7f8 | |||
| 3c825fc71d | |||
| 089dc3e1ba | |||
| 158fc17a2b | |||
| 149c144eee | |||
| 4e42972ebb | |||
| 73c07240c2 | |||
| e637522073 | |||
| ec9626a0e5 | |||
| 86755932d9 | |||
| 95e21118e4 | |||
| 3fe0cc74be | |||
| 40c2c7d498 | |||
| cf067f7c56 | |||
| 33129a4793 | |||
| 41f2e87fc7 | |||
| 347a447302 | |||
| 03531ab4af | |||
| 3d8ce28609 | |||
| cc719d116c | |||
| 748eb1b3ab | |||
| f430c71d06 | |||
| 4a1d4d2d10 | |||
| 937d3f9c0e | |||
| 4d9d3dc879 | |||
| 106be817d9 | |||
| ec3a29d7e4 | |||
| c5ce2f06ac | |||
| 992e8cf58e | |||
| a618acf686 | |||
| 47bee153ba | |||
| 390a4296b4 | |||
| 4f7c666b1f | |||
| a620715ccc | |||
| 37bf9b35a6 | |||
| 2a7628c1e2 | |||
| 5a588415d0 | |||
| d5fce5b2a0 | |||
| 7bf3985219 | |||
| d939354990 | |||
| 8fb9834d3b | |||
| 2fd5d52125 | |||
| a1226feafd | |||
| cc7c558065 | |||
| 51f90df374 | |||
| 62c2d53324 | |||
| 8e9e0d84f3 | |||
| d9daf9f0c7 | |||
| 559f2d8d9c | |||
| 403e535a50 | |||
| 14aa4fbd15 | |||
| 319d7b4324 | |||
| 4511fde9d1 | |||
| 707cafb2d8 | |||
| 877b611758 | |||
| 9fb11ca838 | |||
| 7c2a315760 | |||
| cc0135b4fc | |||
| f47fbbf075 | |||
| fd8c1e37b1 | |||
| 4d770f8c84 | |||
| 1f79b924df | |||
| b1f143a5d7 | |||
| d6718bb866 | |||
| 9deeacff51 | |||
| 5dbe8fb161 | |||
| c3add7dde4 | |||
| 9d49361c43 | |||
| 1a1878402c | |||
| 069f9b64fc | |||
| ca6b4cc52d | |||
| 60df95b10a | |||
| d508f9e591 | |||
| 36702c6207 | |||
| fa091cc2ab | |||
| 1121a22956 | |||
| d5b8a4c0c8 | |||
| 1cc3614c74 | |||
| ca5f4abc7c | |||
| 9d3c006409 | |||
| d79d0ddf1a | |||
| a1ad62bc74 | |||
| 950bcef057 | |||
| 468a5d6871 | |||
| cf09862f4b | |||
| 6b6f290ebb | |||
| c8eecb51ae | |||
| 23c2bdd189 | |||
| 3e69059afc | |||
| a6f81be2cd | |||
| 89b91d6b46 | |||
| 4975de7a74 | |||
| 3fe4c39e5e | |||
| 89bb9ef48c | |||
| d15993ecdc | |||
| da723dda5e | |||
| 0dcc666e5e | |||
| 61d17a352f | |||
| 006e1cda4a | |||
| 11e399b6c7 | |||
| e839226f2b | |||
| 2702f846cb | |||
| ee23c8cc4b | |||
| c3a74c8ed4 | |||
| 969acd3642 | |||
| ee07f01abd | |||
| 06f0a8b4e7 | |||
| 205a1a5c37 | |||
| 7174b36a20 | |||
| 273b1831d9 | |||
| 83c5a66814 | |||
| db81cb3d33 | |||
| 4a8eedd31e | |||
| 11a1cc7c1e | |||
| a509000711 | |||
| a65ee3bbb7 | |||
| f69ee003f6 | |||
| 0b18373f8c | |||
| 311cdad1c8 | |||
| 6f84edd791 | |||
| 1614f9519b | |||
| 65757c1974 | |||
| 80523c6df7 | |||
| f17f1d028c | |||
| 78078c322e | |||
| 1284d545e1 | |||
| 96af35450a | |||
| 5abb40125b |
+85
-75
@@ -8,6 +8,7 @@
|
||||
/autogen.sh -text
|
||||
/configure.ac -text
|
||||
doc/Doxyfile -text
|
||||
doc/DoxygenLayout.xml -text
|
||||
doc/Examples/meshexample.dxf -text
|
||||
doc/Examples/meshexample.txt -text
|
||||
doc/Examples/simple_tet.vtk -text
|
||||
@@ -28,10 +29,13 @@ doc/Examples/trimesh_level1.metis.part.2 -text
|
||||
doc/H5.dox -text
|
||||
doc/H5X_File_Format.txt -text
|
||||
doc/Makefile.am -text
|
||||
doc/TracFooter.html -text
|
||||
doc/TracHeader.html -text
|
||||
doc/doxyfooter -text
|
||||
doc/doxyheader -text
|
||||
doc/html2twiki -text
|
||||
doc/meshexample.dxf -text
|
||||
doc/postprocess.py -text
|
||||
doc/tetrahedron_refinements/1-edge/edge_01_refined/01.png -text
|
||||
doc/tetrahedron_refinements/1-edge/edge_01_refined/01.pvsm -text
|
||||
doc/tetrahedron_refinements/1-edge/edge_01_refined/01.txt -text
|
||||
@@ -359,38 +363,75 @@ doc/tetrahedron_refinements/6-edges/edge_01-12-20-23-30-31_refined/buildlatex.ba
|
||||
doc/tetrahedron_refinements/6-edges/edge_01-12-20-23-30-31_refined/output_file.jpg -text
|
||||
doc/tetrahedron_refinements/README -text
|
||||
doc/tetrahedron_refinements/text2vtk.py -text
|
||||
examples/H5/Makefile.am -text
|
||||
examples/H5/attach_file.c -text
|
||||
examples/H5/file_attribs.c -text
|
||||
examples/H5/openclose.c -text
|
||||
examples/H5Block/H5BlockExample.pbs -text
|
||||
examples/H5Block/H5BlockExampleF.f90 -text
|
||||
examples/H5Block/Makefile.am -text
|
||||
examples/H5Block/README -text
|
||||
examples/H5Block/fields.c -text
|
||||
examples/H5Block/read_write.c -text
|
||||
examples/H5Fed/Makefile.am -text
|
||||
examples/H5Fed/map_tet2globalid.c -text
|
||||
examples/H5Fed/map_triangle2globalid.c -text
|
||||
examples/H5Fed/tetmesh_adjacencies.c -text
|
||||
examples/H5Fed/tetmesh_read.c -text
|
||||
examples/H5Fed/tetmesh_read_tags.c -text
|
||||
examples/H5Fed/tetmesh_write.c -text
|
||||
examples/H5Fed/tetmesh_write1.c -text
|
||||
examples/H5Fed/tetmesh_write2.c -text
|
||||
examples/H5Fed/tetmesh_write_tags.c -text
|
||||
examples/H5Fed/trimesh_2gnuplot.c -text
|
||||
examples/H5Fed/trimesh_adjacencies.c -text
|
||||
examples/H5Fed/trimesh_read.c -text
|
||||
examples/H5Fed/trimesh_write.c -text
|
||||
examples/H5Fed/trimesh_write_dunetest.c -text
|
||||
examples/H5Fed/write_boundary.c -text
|
||||
examples/H5Part/Bench.c -text
|
||||
examples/H5Part/H5test.c -text
|
||||
examples/H5Part/H5testF.f90 -text
|
||||
examples/H5Part/Makefile.am -text
|
||||
examples/H5Part/core_vfd.c -text
|
||||
examples/H5Part/particles.c -text
|
||||
examples/H5Part/read_canonicalview.c -text
|
||||
examples/H5Part/simplef.f90 -text
|
||||
examples/H5Part/stridedf.f90 -text
|
||||
examples/H5Part/write_setnumparticles.c -text
|
||||
examples/H5Part/write_setview.c -text
|
||||
/license.txt -text
|
||||
src/C++/H5Fed.cc -text
|
||||
src/C++/H5Fed.hh -text
|
||||
src/C++/Makefile.am -text
|
||||
src/C/H5.c -text
|
||||
src/C/H5Block.c -text
|
||||
src/C/H5Block_readwrite.c -text
|
||||
src/C/H5Part.c -text
|
||||
src/C/H5_attachments.c -text
|
||||
src/C/H5_attribs.c -text
|
||||
src/C/Makefile.am -text
|
||||
src/C/generate-h5b-readwrite.py -text
|
||||
src/Fortran/H5.f90 -text
|
||||
src/Fortran/H5Block.f90 -text
|
||||
src/Fortran/H5.c -text
|
||||
src/Fortran/H5Block.c -text
|
||||
src/Fortran/H5BlockF.f90 -text
|
||||
src/Fortran/H5Block_F.c -text
|
||||
src/Fortran/H5Block_readwrite.f90 -text
|
||||
src/Fortran/H5Block_attribs.c -text
|
||||
src/Fortran/H5Block_attribsF.f90 -text
|
||||
src/Fortran/H5Block_io.c -text
|
||||
src/Fortran/H5Block_ioF.f90 -text
|
||||
src/Fortran/H5Block_readwrite_F.c -text
|
||||
src/Fortran/H5Part.f90 -text
|
||||
src/Fortran/H5F.f90 -text
|
||||
src/Fortran/H5Part.c -text
|
||||
src/Fortran/H5PartF.f90 -text
|
||||
src/Fortran/H5Part_F.c -text
|
||||
src/Fortran/H5Part_io.c -text
|
||||
src/Fortran/H5Part_ioF.f90 -text
|
||||
src/Fortran/H5_F.c -text
|
||||
src/Fortran/H5_attribs.f90 -text
|
||||
src/Fortran/H5_attribs.c -text
|
||||
src/Fortran/H5_attribsF.f90 -text
|
||||
src/Fortran/H5_attribs_F.c -text
|
||||
src/Fortran/H5_constF.f90 -text
|
||||
src/Fortran/Makefile.am -text
|
||||
src/Fortran/TestUnderscore.f -text
|
||||
src/Fortran/TestUnderscoreC.c -text
|
||||
src/Fortran/generate-h5-attribs-f.py -text
|
||||
src/Fortran/h5_private.h -text
|
||||
src/Makefile.am -text
|
||||
src/h5core/Makefile.am -text
|
||||
src/h5core/h5_attach.c -text
|
||||
src/h5core/h5_attribs.c -text
|
||||
src/h5core/h5_attribs_private.h -text
|
||||
src/h5core/h5_core_private.h -text
|
||||
src/h5core/h5_debug_private.h -text
|
||||
src/h5core/h5_errorhandling.c -text
|
||||
src/h5core/h5_errorhandling_private.h -text
|
||||
src/h5core/h5_fcmp.c -text
|
||||
@@ -399,14 +440,18 @@ src/h5core/h5_hdf5.c -text
|
||||
src/h5core/h5_hdf5_private.h -text
|
||||
src/h5core/h5_hsearch.c -text
|
||||
src/h5core/h5_hsearch_private.h -text
|
||||
src/h5core/h5_init.c -text
|
||||
src/h5core/h5_init_private.h -text
|
||||
src/h5core/h5_lustre.c -text
|
||||
src/h5core/h5_lustre_private.h -text
|
||||
src/h5core/h5_maps.c -text
|
||||
src/h5core/h5_maps_private.h -text
|
||||
src/h5core/h5_model.c -text
|
||||
src/h5core/h5_model_private.h -text
|
||||
src/h5core/h5_mpi.c -text
|
||||
src/h5core/h5_mpi_private.h -text
|
||||
src/h5core/h5_openclose.c -text
|
||||
src/h5core/h5_private.h -text
|
||||
src/h5core/h5_qsort.c -text
|
||||
src/h5core/h5_qsort_private.h -text
|
||||
src/h5core/h5_qsort_r.c -text
|
||||
@@ -417,10 +462,10 @@ src/h5core/h5_syscall_private.h -text
|
||||
src/h5core/h5_types_private.h -text
|
||||
src/h5core/h5_va_macros.h -text
|
||||
src/h5core/h5b_attribs.c -text
|
||||
src/h5core/h5b_errorhandling_private.h -text
|
||||
src/h5core/h5b_model.c -text
|
||||
src/h5core/h5b_model_private.h -text
|
||||
src/h5core/h5b_readwrite.c -text
|
||||
src/h5core/h5b_readwrite_private.h -text
|
||||
src/h5core/h5b_types_private.h -text
|
||||
src/h5core/h5t_access_private.h -text
|
||||
src/h5core/h5t_access_tetm.c -text
|
||||
@@ -429,17 +474,19 @@ src/h5core/h5t_adjacencies.c -text
|
||||
src/h5core/h5t_adjacencies_private.h -text
|
||||
src/h5core/h5t_adjacencies_tetm.c -text
|
||||
src/h5core/h5t_adjacencies_trim.c -text
|
||||
src/h5core/h5t_core.c -text
|
||||
src/h5core/h5t_core_private.h -text
|
||||
src/h5core/h5t_core_tetm.c -text
|
||||
src/h5core/h5t_core_trim.c -text
|
||||
src/h5core/h5t_errorhandling_private.h -text
|
||||
src/h5core/h5t_hsearch.c -text
|
||||
src/h5core/h5t_hsearch_private.h -text
|
||||
src/h5core/h5t_inquiry.c -text
|
||||
src/h5core/h5t_map.c -text
|
||||
src/h5core/h5t_map_private.h -text
|
||||
src/h5core/h5t_model.c -text
|
||||
src/h5core/h5t_model_private.h -text
|
||||
src/h5core/h5t_model_tetm.c -text
|
||||
src/h5core/h5t_model_trim.c -text
|
||||
src/h5core/h5t_octree.c -text
|
||||
src/h5core/h5t_octree_private.h -text
|
||||
src/h5core/h5t_readwrite.c -text
|
||||
src/h5core/h5t_readwrite_private.h -text
|
||||
src/h5core/h5t_readwrite_tetm.c -text
|
||||
@@ -454,89 +501,53 @@ src/h5core/h5t_store.c -text
|
||||
src/h5core/h5t_store_private.h -text
|
||||
src/h5core/h5t_store_tetm.c -text
|
||||
src/h5core/h5t_store_trim.c -text
|
||||
src/h5core/h5t_store_trim_private.h -text
|
||||
src/h5core/h5t_tags.c -text
|
||||
src/h5core/h5t_tags_private.h -text
|
||||
src/h5core/h5t_types_private.h -text
|
||||
src/h5core/h5u_errorhandling_private.h -text
|
||||
src/h5core/h5u_model.c -text
|
||||
src/h5core/h5u_readwrite.c -text
|
||||
src/h5core/h5u_readwrite_private.h -text
|
||||
src/h5core/h5u_types_private.h -text
|
||||
src/include/H5.h -text
|
||||
src/include/H5Block.h -text
|
||||
src/include/H5Block_readwrite.h -text
|
||||
src/include/H5Block_attribs.h -text
|
||||
src/include/H5Block_io.h -text
|
||||
src/include/H5Block_model.h -text
|
||||
src/include/H5Fed.h -text
|
||||
src/include/H5Fed_adjacency.h -text
|
||||
src/include/H5Fed_inquiry.h -text
|
||||
src/include/H5Fed_model.h -text
|
||||
src/include/H5Fed_retrieve.h -text
|
||||
src/include/H5Fed_store.h -text
|
||||
src/include/H5Fed_tags.h -text
|
||||
src/include/H5Part.h -text
|
||||
src/include/H5_attachments.h -text
|
||||
src/include/H5Part_io.h -text
|
||||
src/include/H5Part_model.h -text
|
||||
src/include/H5_attribs.h -text
|
||||
src/include/H5_model.h -text
|
||||
src/include/H5hut.h -text
|
||||
src/include/grephdr -text
|
||||
src/include/h5core/h5_attach.h -text
|
||||
src/include/Makefile.am -text
|
||||
src/include/h5core/Makefile.am -text
|
||||
src/include/h5core/h5.h -text
|
||||
src/include/h5core/h5_attribs.h -text
|
||||
src/include/h5core/h5_core.h -text
|
||||
src/include/h5core/h5_errno.h -text
|
||||
src/include/h5core/h5_debug.h -text
|
||||
src/include/h5core/h5_errorhandling.h -text
|
||||
src/include/h5core/h5_hdf5.h -text
|
||||
src/include/h5core/h5_maps.h -text
|
||||
src/include/h5core/h5_openclose.h -text
|
||||
src/include/h5core/h5_readwrite.h -text
|
||||
src/include/h5core/h5_model.h -text
|
||||
src/include/h5core/h5_syscall.h -text
|
||||
src/include/h5core/h5_types.h -text
|
||||
src/include/h5core/h5b_attribs.h -text
|
||||
src/include/h5core/h5b_io.h -text
|
||||
src/include/h5core/h5b_model.h -text
|
||||
src/include/h5core/h5b_readwrite.h -text
|
||||
src/include/h5core/h5t_adjacencies.h -text
|
||||
src/include/h5core/h5t_core.h -text
|
||||
src/include/h5core/h5t_inquiry.h -text
|
||||
src/include/h5core/h5t_map.h -text
|
||||
src/include/h5core/h5t_model.h -text
|
||||
src/include/h5core/h5t_readwrite.h -text
|
||||
src/include/h5core/h5t_ref_elements.h -text
|
||||
src/include/h5core/h5t_octree.h -text
|
||||
src/include/h5core/h5t_retrieve.h -text
|
||||
src/include/h5core/h5t_storemesh.h -text
|
||||
src/include/h5core/h5t_store.h -text
|
||||
src/include/h5core/h5t_tags.h -text
|
||||
src/include/h5core/h5u_io.h -text
|
||||
src/include/h5core/h5u_model.h -text
|
||||
src/include/h5core/h5u_readwrite.h -text
|
||||
test/H5Block/BlockTestSpecs.txt -text
|
||||
test/H5Block/H5BlockDissolveGhosts.c -text
|
||||
test/H5Block/H5BlockParTestScalarField.c -text
|
||||
test/H5Block/H5BlockParTestScalarField.pbs -text
|
||||
test/H5Block/H5BlockParTestScalarFieldF.f90 -text
|
||||
test/H5Block/H5BlockTestAttributes.c -text
|
||||
test/H5Block/H5BlockTestAttributesF.f90 -text
|
||||
test/H5Block/Makefile.am -text
|
||||
test/H5Fed/Makefile.am -text
|
||||
test/H5Fed/map_tet2globalid.c -text
|
||||
test/H5Fed/map_triangle2globalid.c -text
|
||||
test/H5Fed/tetmesh_adjacencies.c -text
|
||||
test/H5Fed/tetmesh_read.c -text
|
||||
test/H5Fed/tetmesh_read_tags.c -text
|
||||
test/H5Fed/tetmesh_write.c -text
|
||||
test/H5Fed/tetmesh_write1.c -text
|
||||
test/H5Fed/tetmesh_write2.c -text
|
||||
test/H5Fed/tetmesh_write_tags.c -text
|
||||
test/H5Fed/trimesh_2gnuplot.c -text
|
||||
test/H5Fed/trimesh_adjacencies.c -text
|
||||
test/H5Fed/trimesh_read.c -text
|
||||
test/H5Fed/trimesh_write.c -text
|
||||
test/H5Fed/trimesh_write_dunetest.c -text
|
||||
test/H5Fed/write_boundary.c -text
|
||||
test/H5Part/Bench.c -text
|
||||
test/H5Part/H5ParallelTest.cc -text
|
||||
test/H5Part/H5PartAndreasTest.cc -text
|
||||
test/H5Part/H5PartTest.cc -text
|
||||
test/H5Part/H5PartTestParallel.cc -text
|
||||
test/H5Part/H5test.cc -text
|
||||
test/H5Part/H5testF.f -text
|
||||
test/H5Part/H5testFpar.f90 -text
|
||||
test/H5Part/Makefile.am -text
|
||||
test/Makefile.am -text
|
||||
test/h5_attach_test.c -text
|
||||
test/h5b_read.c -text
|
||||
test/h5b_test.c -text
|
||||
test/h5b_write.c -text
|
||||
@@ -565,7 +576,6 @@ tools/h5PartSurfaceToVtk.cc -text
|
||||
tools/h5hutcc.in -text
|
||||
tools/h5pAttrib.cc -text
|
||||
tools/h5pToGNUplot.cc -text
|
||||
tools/homdynToH5p.cc -text
|
||||
tools/vtk2h5grid/Makefile.am -text
|
||||
tools/vtk2h5grid/vtk2h5grid.cc -text
|
||||
visit_plugins/databases/H5Part/.depend -text
|
||||
|
||||
+91
-78
@@ -1,82 +1,95 @@
|
||||
/H5hut
|
||||
/INSTALL
|
||||
/Makefile
|
||||
/Makefile.in
|
||||
/aclocal.m4
|
||||
/autom4te.cache
|
||||
/build
|
||||
/config.guess
|
||||
/config.h
|
||||
/config.h.in
|
||||
/config.log
|
||||
/config.status
|
||||
/config.sub
|
||||
/configure
|
||||
/depcomp
|
||||
doc/Makefile
|
||||
doc/Makefile.in
|
||||
/install-sh
|
||||
/libtool
|
||||
/ltmain.sh
|
||||
/m4
|
||||
/missing
|
||||
src/.deps
|
||||
src/C++/Makefile
|
||||
src/C++/Makefile.in
|
||||
src/C/.deps
|
||||
src/C/Makefile
|
||||
src/C/Makefile.in
|
||||
src/C/libH5hutC.a
|
||||
src/Fortran/.deps
|
||||
src/Fortran/Makefile
|
||||
src/Fortran/Makefile.in
|
||||
src/Makefile
|
||||
src/Makefile.in
|
||||
src/h5core/.deps
|
||||
src/h5core/Makefile
|
||||
src/h5core/Makefile.in
|
||||
src/h5core/libH5hut.a
|
||||
*.tar.gz
|
||||
*.[oa]
|
||||
*.la
|
||||
*.lo
|
||||
*.so
|
||||
*.dSYM
|
||||
*~
|
||||
*.h5
|
||||
.deps
|
||||
.dirstamp
|
||||
.libs
|
||||
CMakeFiles
|
||||
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/large_tet.h5
|
||||
test/H5Fed/simple_tet.h5
|
||||
test/H5Fed/simple_triangle.h5
|
||||
test/H5Fed/small_tet.h5
|
||||
test/H5Fed/tetmesh_adjacencies
|
||||
test/H5Fed/tetmesh_read
|
||||
test/H5Fed/tetmesh_read_tags
|
||||
test/H5Fed/tetmesh_write
|
||||
test/H5Fed/tetmesh_write2
|
||||
test/H5Fed/tetmesh_write_tags
|
||||
test/H5Fed/trimesh_adjacencies
|
||||
test/H5Fed/trimesh_read
|
||||
test/H5Fed/trimesh_write
|
||||
test/H5Fed/trimesh_write_dunetest
|
||||
test/H5Part/Bench
|
||||
test/H5Part/H5PartAndreasTest
|
||||
test/H5Part/H5PartTestP
|
||||
test/H5Part/H5test
|
||||
test/H5Part/Makefile
|
||||
test/H5Part/Makefile.in
|
||||
test/Makefile
|
||||
test/Makefile.in
|
||||
test/h5_attach.h5
|
||||
test/h5_attach_test
|
||||
stamp-h1
|
||||
test/h5b_test
|
||||
test/h5u_test
|
||||
tools/.deps
|
||||
tools/Makefile
|
||||
tools/Makefile.in
|
||||
tools/h5PartDcToVtk
|
||||
tools/h5PartSurfaceToVtk
|
||||
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
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
2018-09-14 Gsell Achim <achi.gsell@psi.ch>
|
||||
|
||||
* C-API
|
||||
- H5PartSetNumPoints() renamed to H5PartSetNumItems()
|
||||
- H5PartGetNumPoints() renamed to H5PartGetNumItems()
|
||||
- Dataset names longer then 64 bytes are handled as error.
|
||||
- Same for step/iteration names.
|
||||
* core API
|
||||
- we use the term 'iteration' instead of 'step'
|
||||
- we use the term 'item' instead of 'point'
|
||||
- re-factor function and variable names
|
||||
- in printing messages/debug output fixed
|
||||
- do not flush (sync to disk) after writing a dataset by default,
|
||||
can be controlled by a property
|
||||
|
||||
|
||||
+17
-9
@@ -1,13 +1,21 @@
|
||||
ACLOCAL_AMFLAGS = -I m4
|
||||
EXTRA_DIST = \
|
||||
autogen.sh \
|
||||
ax_pkg_swig.m4
|
||||
|
||||
SUBDIRS = \
|
||||
src \
|
||||
test \
|
||||
tools
|
||||
SUBDIRS = \
|
||||
src \
|
||||
test \
|
||||
tools \
|
||||
doc \
|
||||
examples/H5 \
|
||||
examples/H5Part \
|
||||
examples/H5Block \
|
||||
examples/H5Fed
|
||||
|
||||
MAINTAINERCLEANFILES = \
|
||||
config.h \
|
||||
config.log \
|
||||
config.status \
|
||||
stamp-h.in \
|
||||
MAINTAINERCLEANFILES = \
|
||||
config.h \
|
||||
config.log \
|
||||
config.status \
|
||||
stamp-h.in \
|
||||
stamp-h1
|
||||
|
||||
@@ -1,42 +1,36 @@
|
||||
#### H5PART 1.99.10 ###########################################################
|
||||
#### H5PART trunk ############################################################
|
||||
|
||||
Bugfixes in the malloc wrappers
|
||||
* h5_file_t is now uintptr_t
|
||||
* experimental version of parallel H5Fed
|
||||
* new API function for file open using properties (similiar to hdf5 properties)
|
||||
|
||||
Converter from vtk to H5hut added.
|
||||
#### H5PART 1.99.10 ############################################################
|
||||
|
||||
Bugfixes in the autotools files.
|
||||
|
||||
#### H5PART 1.99.9 ############################################################
|
||||
|
||||
Bugfix in option parsing in tools/h5PartDcToVtk and tools/h5PartSurfaceToVtk
|
||||
|
||||
tools/h5PartDcToVtk and tools/h5PartSurfaceToVtk removed from list of tools
|
||||
to be compiled. These tools should be moved to another repository anyway.
|
||||
|
||||
#### H5PART 1.99.8 ############################################################
|
||||
|
||||
Bugfixes
|
||||
|
||||
#### H5PART 1.99.7 ############################################################
|
||||
|
||||
Linking problem on Linux fixed
|
||||
|
||||
#### H5PART 1.99.6 ############################################################
|
||||
* C99 compiler required
|
||||
* C API with inline functions
|
||||
|
||||
|
||||
#### H5PART 1.99.5 ############################################################
|
||||
#### H5PART 1.99.4 ############################################################
|
||||
#### H5PART 1.99.3 ############################################################
|
||||
#### H5PART 1.99.2 ############################################################
|
||||
#### H5PART 1.99.1 ############################################################
|
||||
#### H5PART 1.99 ############################################################
|
||||
#### H5PART 1.99.0 ############################################################
|
||||
|
||||
Renamed type:
|
||||
rudimental implementation of a grid manager
|
||||
|
||||
Important changes from version 1.6 to 1.99.0
|
||||
|
||||
Renamed type:
|
||||
H5PartFile -> h5_file_t
|
||||
h5part_int64_t -> h5_int64_t
|
||||
h5part_float64_t -> h5_float_t
|
||||
|
||||
Renamed functions:
|
||||
|
||||
All function not related to a specific data model have been renamed from
|
||||
H5PartFunction() to H5Function().
|
||||
|
||||
Example:
|
||||
H5PartOpenFile() -> H5OpenFile()
|
||||
|
||||
Removed functions:
|
||||
To simplify the API, there is just one function to open a file. It's the
|
||||
same function for serial and parallel code.
|
||||
|
||||
#### H5PART 1.6.6 ############################################################
|
||||
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
#!/bin/sh
|
||||
# Run this to generate all the initial makefiles, etc.
|
||||
|
||||
ACLOCAL_FLAGS="-I m4 $ACLOCAL_FLAGS"
|
||||
ACLOCAL_FLAGS="-I m4 -I . $ACLOCAL_FLAGS"
|
||||
LIBTOOLIZE_FLAGS="--force $LIBTOOLIZE_FLAGS"
|
||||
AUTOMAKE_FLAGS="--add-missing --copy --foreign $AUTOMAKE_FLAGS"
|
||||
|
||||
|
||||
@@ -0,0 +1,982 @@
|
||||
# ===========================================================================
|
||||
# https://www.gnu.org/software/autoconf-archive/ax_cxx_compile_stdcxx.html
|
||||
# ===========================================================================
|
||||
#
|
||||
# SYNOPSIS
|
||||
#
|
||||
# AX_CXX_COMPILE_STDCXX(VERSION, [ext|noext], [mandatory|optional])
|
||||
#
|
||||
# DESCRIPTION
|
||||
#
|
||||
# Check for baseline language coverage in the compiler for the specified
|
||||
# version of the C++ standard. If necessary, add switches to CXX and
|
||||
# CXXCPP to enable support. VERSION may be '11' (for the C++11 standard)
|
||||
# or '14' (for the C++14 standard).
|
||||
#
|
||||
# The second argument, if specified, indicates whether you insist on an
|
||||
# extended mode (e.g. -std=gnu++11) or a strict conformance mode (e.g.
|
||||
# -std=c++11). If neither is specified, you get whatever works, with
|
||||
# preference for an extended mode.
|
||||
#
|
||||
# The third argument, if specified 'mandatory' or if left unspecified,
|
||||
# indicates that baseline support for the specified C++ standard is
|
||||
# required and that the macro should error out if no mode with that
|
||||
# support is found. If specified 'optional', then configuration proceeds
|
||||
# regardless, after defining HAVE_CXX${VERSION} if and only if a
|
||||
# supporting mode is found.
|
||||
#
|
||||
# LICENSE
|
||||
#
|
||||
# Copyright (c) 2008 Benjamin Kosnik <bkoz@redhat.com>
|
||||
# Copyright (c) 2012 Zack Weinberg <zackw@panix.com>
|
||||
# Copyright (c) 2013 Roy Stogner <roystgnr@ices.utexas.edu>
|
||||
# Copyright (c) 2014, 2015 Google Inc.; contributed by Alexey Sokolov <sokolov@google.com>
|
||||
# Copyright (c) 2015 Paul Norman <penorman@mac.com>
|
||||
# Copyright (c) 2015 Moritz Klammler <moritz@klammler.eu>
|
||||
# Copyright (c) 2016 Krzesimir Nowak <qdlacz@gmail.com>
|
||||
#
|
||||
# Copying and distribution of this file, with or without modification, are
|
||||
# permitted in any medium without royalty provided the copyright notice
|
||||
# and this notice are preserved. This file is offered as-is, without any
|
||||
# warranty.
|
||||
|
||||
#serial 7
|
||||
|
||||
dnl This macro is based on the code from the AX_CXX_COMPILE_STDCXX_11 macro
|
||||
dnl (serial version number 13).
|
||||
|
||||
AX_REQUIRE_DEFINED([AC_MSG_WARN])
|
||||
AC_DEFUN([AX_CXX_COMPILE_STDCXX], [dnl
|
||||
m4_if([$1], [11], [ax_cxx_compile_alternatives="11 0x"],
|
||||
[$1], [14], [ax_cxx_compile_alternatives="14 1y"],
|
||||
[$1], [17], [ax_cxx_compile_alternatives="17 1z"],
|
||||
[m4_fatal([invalid first argument `$1' to AX_CXX_COMPILE_STDCXX])])dnl
|
||||
m4_if([$2], [], [],
|
||||
[$2], [ext], [],
|
||||
[$2], [noext], [],
|
||||
[m4_fatal([invalid second argument `$2' to AX_CXX_COMPILE_STDCXX])])dnl
|
||||
m4_if([$3], [], [ax_cxx_compile_cxx$1_required=true],
|
||||
[$3], [mandatory], [ax_cxx_compile_cxx$1_required=true],
|
||||
[$3], [optional], [ax_cxx_compile_cxx$1_required=false],
|
||||
[m4_fatal([invalid third argument `$3' to AX_CXX_COMPILE_STDCXX])])
|
||||
AC_LANG_PUSH([C++])dnl
|
||||
ac_success=no
|
||||
AC_CACHE_CHECK(whether $CXX supports C++$1 features by default,
|
||||
ax_cv_cxx_compile_cxx$1,
|
||||
[AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_testbody_$1])],
|
||||
[ax_cv_cxx_compile_cxx$1=yes],
|
||||
[ax_cv_cxx_compile_cxx$1=no])])
|
||||
if test x$ax_cv_cxx_compile_cxx$1 = xyes; then
|
||||
ac_success=yes
|
||||
fi
|
||||
|
||||
m4_if([$2], [noext], [], [dnl
|
||||
if test x$ac_success = xno; then
|
||||
for alternative in ${ax_cxx_compile_alternatives}; do
|
||||
switch="-std=gnu++${alternative}"
|
||||
cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx$1_$switch])
|
||||
AC_CACHE_CHECK(whether $CXX supports C++$1 features with $switch,
|
||||
$cachevar,
|
||||
[ac_save_CXX="$CXX"
|
||||
CXX="$CXX $switch"
|
||||
AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_testbody_$1])],
|
||||
[eval $cachevar=yes],
|
||||
[eval $cachevar=no])
|
||||
CXX="$ac_save_CXX"])
|
||||
if eval test x\$$cachevar = xyes; then
|
||||
CXX="$CXX $switch"
|
||||
if test -n "$CXXCPP" ; then
|
||||
CXXCPP="$CXXCPP $switch"
|
||||
fi
|
||||
ac_success=yes
|
||||
break
|
||||
fi
|
||||
done
|
||||
fi])
|
||||
|
||||
m4_if([$2], [ext], [], [dnl
|
||||
if test x$ac_success = xno; then
|
||||
dnl HP's aCC needs +std=c++11 according to:
|
||||
dnl http://h21007.www2.hp.com/portal/download/files/unprot/aCxx/PDF_Release_Notes/769149-001.pdf
|
||||
dnl Cray's crayCC needs "-h std=c++11"
|
||||
for alternative in ${ax_cxx_compile_alternatives}; do
|
||||
for switch in -std=c++${alternative} +std=c++${alternative} "-h std=c++${alternative}"; do
|
||||
cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx$1_$switch])
|
||||
AC_CACHE_CHECK(whether $CXX supports C++$1 features with $switch,
|
||||
$cachevar,
|
||||
[ac_save_CXX="$CXX"
|
||||
CXX="$CXX $switch"
|
||||
AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_testbody_$1])],
|
||||
[eval $cachevar=yes],
|
||||
[eval $cachevar=no])
|
||||
CXX="$ac_save_CXX"])
|
||||
if eval test x\$$cachevar = xyes; then
|
||||
CXX="$CXX $switch"
|
||||
if test -n "$CXXCPP" ; then
|
||||
CXXCPP="$CXXCPP $switch"
|
||||
fi
|
||||
ac_success=yes
|
||||
break
|
||||
fi
|
||||
done
|
||||
if test x$ac_success = xyes; then
|
||||
break
|
||||
fi
|
||||
done
|
||||
fi])
|
||||
AC_LANG_POP([C++])
|
||||
if test x$ax_cxx_compile_cxx$1_required = xtrue; then
|
||||
if test x$ac_success = xno; then
|
||||
AC_MSG_ERROR([*** A compiler with support for C++$1 language features is required.])
|
||||
fi
|
||||
fi
|
||||
if test x$ac_success = xno; then
|
||||
HAVE_CXX$1=0
|
||||
AC_MSG_NOTICE([No compiler with C++$1 support was found])
|
||||
else
|
||||
HAVE_CXX$1=1
|
||||
AC_DEFINE(HAVE_CXX$1,1,
|
||||
[define if the compiler supports basic C++$1 syntax])
|
||||
fi
|
||||
AC_SUBST(HAVE_CXX$1)
|
||||
m4_if([$1], [17], [AC_MSG_WARN([C++17 is not yet standardized, so the checks may change in incompatible ways anytime])])
|
||||
])
|
||||
|
||||
|
||||
dnl Test body for checking C++11 support
|
||||
|
||||
m4_define([_AX_CXX_COMPILE_STDCXX_testbody_11],
|
||||
_AX_CXX_COMPILE_STDCXX_testbody_new_in_11
|
||||
)
|
||||
|
||||
|
||||
dnl Test body for checking C++14 support
|
||||
|
||||
m4_define([_AX_CXX_COMPILE_STDCXX_testbody_14],
|
||||
_AX_CXX_COMPILE_STDCXX_testbody_new_in_11
|
||||
_AX_CXX_COMPILE_STDCXX_testbody_new_in_14
|
||||
)
|
||||
|
||||
m4_define([_AX_CXX_COMPILE_STDCXX_testbody_17],
|
||||
_AX_CXX_COMPILE_STDCXX_testbody_new_in_11
|
||||
_AX_CXX_COMPILE_STDCXX_testbody_new_in_14
|
||||
_AX_CXX_COMPILE_STDCXX_testbody_new_in_17
|
||||
)
|
||||
|
||||
dnl Tests for new features in C++11
|
||||
|
||||
m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_11], [[
|
||||
|
||||
// If the compiler admits that it is not ready for C++11, why torture it?
|
||||
// Hopefully, this will speed up the test.
|
||||
|
||||
#ifndef __cplusplus
|
||||
|
||||
#error "This is not a C++ compiler"
|
||||
|
||||
#elif __cplusplus < 201103L
|
||||
|
||||
#error "This is not a C++11 compiler"
|
||||
|
||||
#else
|
||||
|
||||
namespace cxx11
|
||||
{
|
||||
|
||||
namespace test_static_assert
|
||||
{
|
||||
|
||||
template <typename T>
|
||||
struct check
|
||||
{
|
||||
static_assert(sizeof(int) <= sizeof(T), "not big enough");
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
namespace test_final_override
|
||||
{
|
||||
|
||||
struct Base
|
||||
{
|
||||
virtual void f() {}
|
||||
};
|
||||
|
||||
struct Derived : public Base
|
||||
{
|
||||
virtual void f() override {}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
namespace test_double_right_angle_brackets
|
||||
{
|
||||
|
||||
template < typename T >
|
||||
struct check {};
|
||||
|
||||
typedef check<void> single_type;
|
||||
typedef check<check<void>> double_type;
|
||||
typedef check<check<check<void>>> triple_type;
|
||||
typedef check<check<check<check<void>>>> quadruple_type;
|
||||
|
||||
}
|
||||
|
||||
namespace test_decltype
|
||||
{
|
||||
|
||||
int
|
||||
f()
|
||||
{
|
||||
int a = 1;
|
||||
decltype(a) b = 2;
|
||||
return a + b;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
namespace test_type_deduction
|
||||
{
|
||||
|
||||
template < typename T1, typename T2 >
|
||||
struct is_same
|
||||
{
|
||||
static const bool value = false;
|
||||
};
|
||||
|
||||
template < typename T >
|
||||
struct is_same<T, T>
|
||||
{
|
||||
static const bool value = true;
|
||||
};
|
||||
|
||||
template < typename T1, typename T2 >
|
||||
auto
|
||||
add(T1 a1, T2 a2) -> decltype(a1 + a2)
|
||||
{
|
||||
return a1 + a2;
|
||||
}
|
||||
|
||||
int
|
||||
test(const int c, volatile int v)
|
||||
{
|
||||
static_assert(is_same<int, decltype(0)>::value == true, "");
|
||||
static_assert(is_same<int, decltype(c)>::value == false, "");
|
||||
static_assert(is_same<int, decltype(v)>::value == false, "");
|
||||
auto ac = c;
|
||||
auto av = v;
|
||||
auto sumi = ac + av + 'x';
|
||||
auto sumf = ac + av + 1.0;
|
||||
static_assert(is_same<int, decltype(ac)>::value == true, "");
|
||||
static_assert(is_same<int, decltype(av)>::value == true, "");
|
||||
static_assert(is_same<int, decltype(sumi)>::value == true, "");
|
||||
static_assert(is_same<int, decltype(sumf)>::value == false, "");
|
||||
static_assert(is_same<int, decltype(add(c, v))>::value == true, "");
|
||||
return (sumf > 0.0) ? sumi : add(c, v);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
namespace test_noexcept
|
||||
{
|
||||
|
||||
int f() { return 0; }
|
||||
int g() noexcept { return 0; }
|
||||
|
||||
static_assert(noexcept(f()) == false, "");
|
||||
static_assert(noexcept(g()) == true, "");
|
||||
|
||||
}
|
||||
|
||||
namespace test_constexpr
|
||||
{
|
||||
|
||||
template < typename CharT >
|
||||
unsigned long constexpr
|
||||
strlen_c_r(const CharT *const s, const unsigned long acc) noexcept
|
||||
{
|
||||
return *s ? strlen_c_r(s + 1, acc + 1) : acc;
|
||||
}
|
||||
|
||||
template < typename CharT >
|
||||
unsigned long constexpr
|
||||
strlen_c(const CharT *const s) noexcept
|
||||
{
|
||||
return strlen_c_r(s, 0UL);
|
||||
}
|
||||
|
||||
static_assert(strlen_c("") == 0UL, "");
|
||||
static_assert(strlen_c("1") == 1UL, "");
|
||||
static_assert(strlen_c("example") == 7UL, "");
|
||||
static_assert(strlen_c("another\0example") == 7UL, "");
|
||||
|
||||
}
|
||||
|
||||
namespace test_rvalue_references
|
||||
{
|
||||
|
||||
template < int N >
|
||||
struct answer
|
||||
{
|
||||
static constexpr int value = N;
|
||||
};
|
||||
|
||||
answer<1> f(int&) { return answer<1>(); }
|
||||
answer<2> f(const int&) { return answer<2>(); }
|
||||
answer<3> f(int&&) { return answer<3>(); }
|
||||
|
||||
void
|
||||
test()
|
||||
{
|
||||
int i = 0;
|
||||
const int c = 0;
|
||||
static_assert(decltype(f(i))::value == 1, "");
|
||||
static_assert(decltype(f(c))::value == 2, "");
|
||||
static_assert(decltype(f(0))::value == 3, "");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
namespace test_uniform_initialization
|
||||
{
|
||||
|
||||
struct test
|
||||
{
|
||||
static const int zero {};
|
||||
static const int one {1};
|
||||
};
|
||||
|
||||
static_assert(test::zero == 0, "");
|
||||
static_assert(test::one == 1, "");
|
||||
|
||||
}
|
||||
|
||||
namespace test_lambdas
|
||||
{
|
||||
|
||||
void
|
||||
test1()
|
||||
{
|
||||
auto lambda1 = [](){};
|
||||
auto lambda2 = lambda1;
|
||||
lambda1();
|
||||
lambda2();
|
||||
}
|
||||
|
||||
int
|
||||
test2()
|
||||
{
|
||||
auto a = [](int i, int j){ return i + j; }(1, 2);
|
||||
auto b = []() -> int { return '0'; }();
|
||||
auto c = [=](){ return a + b; }();
|
||||
auto d = [&](){ return c; }();
|
||||
auto e = [a, &b](int x) mutable {
|
||||
const auto identity = [](int y){ return y; };
|
||||
for (auto i = 0; i < a; ++i)
|
||||
a += b--;
|
||||
return x + identity(a + b);
|
||||
}(0);
|
||||
return a + b + c + d + e;
|
||||
}
|
||||
|
||||
int
|
||||
test3()
|
||||
{
|
||||
const auto nullary = [](){ return 0; };
|
||||
const auto unary = [](int x){ return x; };
|
||||
using nullary_t = decltype(nullary);
|
||||
using unary_t = decltype(unary);
|
||||
const auto higher1st = [](nullary_t f){ return f(); };
|
||||
const auto higher2nd = [unary](nullary_t f1){
|
||||
return [unary, f1](unary_t f2){ return f2(unary(f1())); };
|
||||
};
|
||||
return higher1st(nullary) + higher2nd(nullary)(unary);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
namespace test_variadic_templates
|
||||
{
|
||||
|
||||
template <int...>
|
||||
struct sum;
|
||||
|
||||
template <int N0, int... N1toN>
|
||||
struct sum<N0, N1toN...>
|
||||
{
|
||||
static constexpr auto value = N0 + sum<N1toN...>::value;
|
||||
};
|
||||
|
||||
template <>
|
||||
struct sum<>
|
||||
{
|
||||
static constexpr auto value = 0;
|
||||
};
|
||||
|
||||
static_assert(sum<>::value == 0, "");
|
||||
static_assert(sum<1>::value == 1, "");
|
||||
static_assert(sum<23>::value == 23, "");
|
||||
static_assert(sum<1, 2>::value == 3, "");
|
||||
static_assert(sum<5, 5, 11>::value == 21, "");
|
||||
static_assert(sum<2, 3, 5, 7, 11, 13>::value == 41, "");
|
||||
|
||||
}
|
||||
|
||||
// http://stackoverflow.com/questions/13728184/template-aliases-and-sfinae
|
||||
// Clang 3.1 fails with headers of libstd++ 4.8.3 when using std::function
|
||||
// because of this.
|
||||
namespace test_template_alias_sfinae
|
||||
{
|
||||
|
||||
struct foo {};
|
||||
|
||||
template<typename T>
|
||||
using member = typename T::member_type;
|
||||
|
||||
template<typename T>
|
||||
void func(...) {}
|
||||
|
||||
template<typename T>
|
||||
void func(member<T>*) {}
|
||||
|
||||
void test();
|
||||
|
||||
void test() { func<foo>(0); }
|
||||
|
||||
}
|
||||
|
||||
} // namespace cxx11
|
||||
|
||||
#endif // __cplusplus >= 201103L
|
||||
|
||||
]])
|
||||
|
||||
|
||||
dnl Tests for new features in C++14
|
||||
|
||||
m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_14], [[
|
||||
|
||||
// If the compiler admits that it is not ready for C++14, why torture it?
|
||||
// Hopefully, this will speed up the test.
|
||||
|
||||
#ifndef __cplusplus
|
||||
|
||||
#error "This is not a C++ compiler"
|
||||
|
||||
#elif __cplusplus < 201402L
|
||||
|
||||
#error "This is not a C++14 compiler"
|
||||
|
||||
#else
|
||||
|
||||
namespace cxx14
|
||||
{
|
||||
|
||||
namespace test_polymorphic_lambdas
|
||||
{
|
||||
|
||||
int
|
||||
test()
|
||||
{
|
||||
const auto lambda = [](auto&&... args){
|
||||
const auto istiny = [](auto x){
|
||||
return (sizeof(x) == 1UL) ? 1 : 0;
|
||||
};
|
||||
const int aretiny[] = { istiny(args)... };
|
||||
return aretiny[0];
|
||||
};
|
||||
return lambda(1, 1L, 1.0f, '1');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
namespace test_binary_literals
|
||||
{
|
||||
|
||||
constexpr auto ivii = 0b0000000000101010;
|
||||
static_assert(ivii == 42, "wrong value");
|
||||
|
||||
}
|
||||
|
||||
namespace test_generalized_constexpr
|
||||
{
|
||||
|
||||
template < typename CharT >
|
||||
constexpr unsigned long
|
||||
strlen_c(const CharT *const s) noexcept
|
||||
{
|
||||
auto length = 0UL;
|
||||
for (auto p = s; *p; ++p)
|
||||
++length;
|
||||
return length;
|
||||
}
|
||||
|
||||
static_assert(strlen_c("") == 0UL, "");
|
||||
static_assert(strlen_c("x") == 1UL, "");
|
||||
static_assert(strlen_c("test") == 4UL, "");
|
||||
static_assert(strlen_c("another\0test") == 7UL, "");
|
||||
|
||||
}
|
||||
|
||||
namespace test_lambda_init_capture
|
||||
{
|
||||
|
||||
int
|
||||
test()
|
||||
{
|
||||
auto x = 0;
|
||||
const auto lambda1 = [a = x](int b){ return a + b; };
|
||||
const auto lambda2 = [a = lambda1(x)](){ return a; };
|
||||
return lambda2();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
namespace test_digit_separators
|
||||
{
|
||||
|
||||
constexpr auto ten_million = 100'000'000;
|
||||
static_assert(ten_million == 100000000, "");
|
||||
|
||||
}
|
||||
|
||||
namespace test_return_type_deduction
|
||||
{
|
||||
|
||||
auto f(int& x) { return x; }
|
||||
decltype(auto) g(int& x) { return x; }
|
||||
|
||||
template < typename T1, typename T2 >
|
||||
struct is_same
|
||||
{
|
||||
static constexpr auto value = false;
|
||||
};
|
||||
|
||||
template < typename T >
|
||||
struct is_same<T, T>
|
||||
{
|
||||
static constexpr auto value = true;
|
||||
};
|
||||
|
||||
int
|
||||
test()
|
||||
{
|
||||
auto x = 0;
|
||||
static_assert(is_same<int, decltype(f(x))>::value, "");
|
||||
static_assert(is_same<int&, decltype(g(x))>::value, "");
|
||||
return x;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} // namespace cxx14
|
||||
|
||||
#endif // __cplusplus >= 201402L
|
||||
|
||||
]])
|
||||
|
||||
|
||||
dnl Tests for new features in C++17
|
||||
|
||||
m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_17], [[
|
||||
|
||||
// If the compiler admits that it is not ready for C++17, why torture it?
|
||||
// Hopefully, this will speed up the test.
|
||||
|
||||
#ifndef __cplusplus
|
||||
|
||||
#error "This is not a C++ compiler"
|
||||
|
||||
#elif __cplusplus <= 201402L
|
||||
|
||||
#error "This is not a C++17 compiler"
|
||||
|
||||
#else
|
||||
|
||||
#if defined(__clang__)
|
||||
#define REALLY_CLANG
|
||||
#else
|
||||
#if defined(__GNUC__)
|
||||
#define REALLY_GCC
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include <initializer_list>
|
||||
#include <utility>
|
||||
#include <type_traits>
|
||||
|
||||
namespace cxx17
|
||||
{
|
||||
|
||||
#if !defined(REALLY_CLANG)
|
||||
namespace test_constexpr_lambdas
|
||||
{
|
||||
|
||||
// TODO: test it with clang++ from git
|
||||
|
||||
constexpr int foo = [](){return 42;}();
|
||||
|
||||
}
|
||||
#endif // !defined(REALLY_CLANG)
|
||||
|
||||
namespace test::nested_namespace::definitions
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
namespace test_fold_expression
|
||||
{
|
||||
|
||||
template<typename... Args>
|
||||
int multiply(Args... args)
|
||||
{
|
||||
return (args * ... * 1);
|
||||
}
|
||||
|
||||
template<typename... Args>
|
||||
bool all(Args... args)
|
||||
{
|
||||
return (args && ...);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
namespace test_extended_static_assert
|
||||
{
|
||||
|
||||
static_assert (true);
|
||||
|
||||
}
|
||||
|
||||
namespace test_auto_brace_init_list
|
||||
{
|
||||
|
||||
auto foo = {5};
|
||||
auto bar {5};
|
||||
|
||||
static_assert(std::is_same<std::initializer_list<int>, decltype(foo)>::value);
|
||||
static_assert(std::is_same<int, decltype(bar)>::value);
|
||||
}
|
||||
|
||||
namespace test_typename_in_template_template_parameter
|
||||
{
|
||||
|
||||
template<template<typename> typename X> struct D;
|
||||
|
||||
}
|
||||
|
||||
namespace test_fallthrough_nodiscard_maybe_unused_attributes
|
||||
{
|
||||
|
||||
int f1()
|
||||
{
|
||||
return 42;
|
||||
}
|
||||
|
||||
[[nodiscard]] int f2()
|
||||
{
|
||||
[[maybe_unused]] auto unused = f1();
|
||||
|
||||
switch (f1())
|
||||
{
|
||||
case 17:
|
||||
f1();
|
||||
[[fallthrough]];
|
||||
case 42:
|
||||
f1();
|
||||
}
|
||||
return f1();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
namespace test_extended_aggregate_initialization
|
||||
{
|
||||
|
||||
struct base1
|
||||
{
|
||||
int b1, b2 = 42;
|
||||
};
|
||||
|
||||
struct base2
|
||||
{
|
||||
base2() {
|
||||
b3 = 42;
|
||||
}
|
||||
int b3;
|
||||
};
|
||||
|
||||
struct derived : base1, base2
|
||||
{
|
||||
int d;
|
||||
};
|
||||
|
||||
derived d1 {{1, 2}, {}, 4}; // full initialization
|
||||
derived d2 {{}, {}, 4}; // value-initialized bases
|
||||
|
||||
}
|
||||
|
||||
namespace test_general_range_based_for_loop
|
||||
{
|
||||
|
||||
struct iter
|
||||
{
|
||||
int i;
|
||||
|
||||
int& operator* ()
|
||||
{
|
||||
return i;
|
||||
}
|
||||
|
||||
const int& operator* () const
|
||||
{
|
||||
return i;
|
||||
}
|
||||
|
||||
iter& operator++()
|
||||
{
|
||||
++i;
|
||||
return *this;
|
||||
}
|
||||
};
|
||||
|
||||
struct sentinel
|
||||
{
|
||||
int i;
|
||||
};
|
||||
|
||||
bool operator== (const iter& i, const sentinel& s)
|
||||
{
|
||||
return i.i == s.i;
|
||||
}
|
||||
|
||||
bool operator!= (const iter& i, const sentinel& s)
|
||||
{
|
||||
return !(i == s);
|
||||
}
|
||||
|
||||
struct range
|
||||
{
|
||||
iter begin() const
|
||||
{
|
||||
return {0};
|
||||
}
|
||||
|
||||
sentinel end() const
|
||||
{
|
||||
return {5};
|
||||
}
|
||||
};
|
||||
|
||||
void f()
|
||||
{
|
||||
range r {};
|
||||
|
||||
for (auto i : r)
|
||||
{
|
||||
[[maybe_unused]] auto v = i;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
namespace test_lambda_capture_asterisk_this_by_value
|
||||
{
|
||||
|
||||
struct t
|
||||
{
|
||||
int i;
|
||||
int foo()
|
||||
{
|
||||
return [*this]()
|
||||
{
|
||||
return i;
|
||||
}();
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
namespace test_enum_class_construction
|
||||
{
|
||||
|
||||
enum class byte : unsigned char
|
||||
{};
|
||||
|
||||
byte foo {42};
|
||||
|
||||
}
|
||||
|
||||
namespace test_constexpr_if
|
||||
{
|
||||
|
||||
template <bool cond>
|
||||
int f ()
|
||||
{
|
||||
if constexpr(cond)
|
||||
{
|
||||
return 13;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 42;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
namespace test_selection_statement_with_initializer
|
||||
{
|
||||
|
||||
int f()
|
||||
{
|
||||
return 13;
|
||||
}
|
||||
|
||||
int f2()
|
||||
{
|
||||
if (auto i = f(); i > 0)
|
||||
{
|
||||
return 3;
|
||||
}
|
||||
|
||||
switch (auto i = f(); i + 4)
|
||||
{
|
||||
case 17:
|
||||
return 2;
|
||||
|
||||
default:
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#if !defined(REALLY_CLANG)
|
||||
namespace test_template_argument_deduction_for_class_templates
|
||||
{
|
||||
|
||||
// TODO: test it with clang++ from git
|
||||
|
||||
template <typename T1, typename T2>
|
||||
struct pair
|
||||
{
|
||||
pair (T1 p1, T2 p2)
|
||||
: m1 {p1},
|
||||
m2 {p2}
|
||||
{}
|
||||
|
||||
T1 m1;
|
||||
T2 m2;
|
||||
};
|
||||
|
||||
void f()
|
||||
{
|
||||
[[maybe_unused]] auto p = pair{13, 42u};
|
||||
}
|
||||
|
||||
}
|
||||
#endif // !defined(REALLY_CLANG)
|
||||
|
||||
namespace test_non_type_auto_template_parameters
|
||||
{
|
||||
|
||||
template <auto n>
|
||||
struct B
|
||||
{};
|
||||
|
||||
B<5> b1;
|
||||
B<'a'> b2;
|
||||
|
||||
}
|
||||
|
||||
#if !defined(REALLY_CLANG)
|
||||
namespace test_structured_bindings
|
||||
{
|
||||
|
||||
// TODO: test it with clang++ from git
|
||||
|
||||
int arr[2] = { 1, 2 };
|
||||
std::pair<int, int> pr = { 1, 2 };
|
||||
|
||||
auto f1() -> int(&)[2]
|
||||
{
|
||||
return arr;
|
||||
}
|
||||
|
||||
auto f2() -> std::pair<int, int>&
|
||||
{
|
||||
return pr;
|
||||
}
|
||||
|
||||
struct S
|
||||
{
|
||||
int x1 : 2;
|
||||
volatile double y1;
|
||||
};
|
||||
|
||||
S f3()
|
||||
{
|
||||
return {};
|
||||
}
|
||||
|
||||
auto [ x1, y1 ] = f1();
|
||||
auto& [ xr1, yr1 ] = f1();
|
||||
auto [ x2, y2 ] = f2();
|
||||
auto& [ xr2, yr2 ] = f2();
|
||||
const auto [ x3, y3 ] = f3();
|
||||
|
||||
}
|
||||
#endif // !defined(REALLY_CLANG)
|
||||
|
||||
#if !defined(REALLY_CLANG)
|
||||
namespace test_exception_spec_type_system
|
||||
{
|
||||
|
||||
// TODO: test it with clang++ from git
|
||||
|
||||
struct Good {};
|
||||
struct Bad {};
|
||||
|
||||
void g1() noexcept;
|
||||
void g2();
|
||||
|
||||
template<typename T>
|
||||
Bad
|
||||
f(T*, T*);
|
||||
|
||||
template<typename T1, typename T2>
|
||||
Good
|
||||
f(T1*, T2*);
|
||||
|
||||
static_assert (std::is_same_v<Good, decltype(f(g1, g2))>);
|
||||
|
||||
}
|
||||
#endif // !defined(REALLY_CLANG)
|
||||
|
||||
namespace test_inline_variables
|
||||
{
|
||||
|
||||
template<class T> void f(T)
|
||||
{}
|
||||
|
||||
template<class T> inline T g(T)
|
||||
{
|
||||
return T{};
|
||||
}
|
||||
|
||||
template<> inline void f<>(int)
|
||||
{}
|
||||
|
||||
template<> int g<>(int)
|
||||
{
|
||||
return 5;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} // namespace cxx17
|
||||
|
||||
#endif // __cplusplus <= 201402L
|
||||
|
||||
]])
|
||||
@@ -0,0 +1,39 @@
|
||||
# =============================================================================
|
||||
# https://www.gnu.org/software/autoconf-archive/ax_cxx_compile_stdcxx_11.html
|
||||
# =============================================================================
|
||||
#
|
||||
# SYNOPSIS
|
||||
#
|
||||
# AX_CXX_COMPILE_STDCXX_11([ext|noext], [mandatory|optional])
|
||||
#
|
||||
# DESCRIPTION
|
||||
#
|
||||
# Check for baseline language coverage in the compiler for the C++11
|
||||
# standard; if necessary, add switches to CXX and CXXCPP to enable
|
||||
# support.
|
||||
#
|
||||
# This macro is a convenience alias for calling the AX_CXX_COMPILE_STDCXX
|
||||
# macro with the version set to C++11. The two optional arguments are
|
||||
# forwarded literally as the second and third argument respectively.
|
||||
# Please see the documentation for the AX_CXX_COMPILE_STDCXX macro for
|
||||
# more information. If you want to use this macro, you also need to
|
||||
# download the ax_cxx_compile_stdcxx.m4 file.
|
||||
#
|
||||
# LICENSE
|
||||
#
|
||||
# Copyright (c) 2008 Benjamin Kosnik <bkoz@redhat.com>
|
||||
# Copyright (c) 2012 Zack Weinberg <zackw@panix.com>
|
||||
# Copyright (c) 2013 Roy Stogner <roystgnr@ices.utexas.edu>
|
||||
# Copyright (c) 2014, 2015 Google Inc.; contributed by Alexey Sokolov <sokolov@google.com>
|
||||
# Copyright (c) 2015 Paul Norman <penorman@mac.com>
|
||||
# Copyright (c) 2015 Moritz Klammler <moritz@klammler.eu>
|
||||
#
|
||||
# Copying and distribution of this file, with or without modification, are
|
||||
# permitted in any medium without royalty provided the copyright notice
|
||||
# and this notice are preserved. This file is offered as-is, without any
|
||||
# warranty.
|
||||
|
||||
#serial 18
|
||||
|
||||
AX_REQUIRE_DEFINED([AX_CXX_COMPILE_STDCXX])
|
||||
AC_DEFUN([AX_CXX_COMPILE_STDCXX_11], [AX_CXX_COMPILE_STDCXX([11], [$1], [$2])])
|
||||
+135
@@ -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])
|
||||
])
|
||||
+359
-250
@@ -1,53 +1,71 @@
|
||||
# Every configure script must call AC_INIT before doing anything else.
|
||||
# AC_INIT (package, version, [bug-report], [tarname])
|
||||
AC_INIT([H5hut], [1.99.6], [h5part@lists.psi.ch], H5hut)
|
||||
|
||||
|
||||
# Ensure that a recent enough version of Autoconf is being used.
|
||||
# If the version of Autoconf being used to create configure is earlier than version,
|
||||
# print an error message to the standard error output and do not create configure.
|
||||
#
|
||||
# Copyright (c) 2006-2018, 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.0rc6], [h5part@lists.psi.ch], H5hut)
|
||||
AC_PREREQ(2.60)
|
||||
|
||||
# should be called right after AC_INIT.
|
||||
# configure scripts can create a C header file containing `#define' directives.
|
||||
# The AC_CONFIG_HEADERS macro selects this kind of output.
|
||||
AC_CONFIG_HEADERS(config.h)
|
||||
|
||||
AC_CONFIG_MACRO_DIR([m4])
|
||||
|
||||
# AM_INIT_AUTOMAKE is required to use autoconf with automake
|
||||
AM_INIT_AUTOMAKE
|
||||
|
||||
BUILD_LIBS='libH5hut'
|
||||
USE_C='yes'
|
||||
ENABLE_DEBUG='no'
|
||||
ENABLE_C='yes'
|
||||
ENABLE_FORTRAN='no'
|
||||
ENABLE_PARALLEL='no'
|
||||
ENABLE_PYTHON='no'
|
||||
|
||||
###############################################################################
|
||||
################# --enable-xxx and --with-xxx Argument ########################
|
||||
###############################################################################
|
||||
|
||||
# --enable-xxx and --with-xxx Arguments
|
||||
AC_ARG_ENABLE(
|
||||
[debug],
|
||||
[AC_HELP_STRING([--enable-debug],
|
||||
[Compile with debug flags [default=no]])],
|
||||
[USE_DEBUG=$enableval])
|
||||
[AS_HELP_STRING([--enable-debug], [Compile with debug flags [default=no]])],
|
||||
[ENABLE_DEBUG=$enableval])
|
||||
AM_CONDITIONAL([ENABLE_DEBUG], [test "$ENABLE_DEBUG" = "yes"])
|
||||
|
||||
AC_ARG_ENABLE(
|
||||
[c],
|
||||
[AC_HELP_STRING([--enable-c],
|
||||
[AS_HELP_STRING([--enable-c],
|
||||
[Compile the C interface [default=yes]])],
|
||||
[USE_C=$enableval])
|
||||
[ENABLE_C=$enableval])
|
||||
AM_CONDITIONAL([ENABLE_C], [test "$ENABLE_C" = "yes"])
|
||||
|
||||
AC_ARG_ENABLE(
|
||||
[fortran],
|
||||
[AC_HELP_STRING([--enable-fortran],
|
||||
[AS_HELP_STRING([--enable-fortran],
|
||||
[Compile the Fortran interface [default=no]])],
|
||||
[USE_FORTRAN=$enableval])
|
||||
[ENABLE_FORTRAN=$enableval])
|
||||
AM_CONDITIONAL([ENABLE_FORTRAN], [test "$ENABLE_FORTRAN" = "yes"])
|
||||
|
||||
AC_ARG_ENABLE(
|
||||
[python],
|
||||
[AS_HELP_STRING([--enable-python],
|
||||
[Compile the Python interface [default=no]])],
|
||||
[ENABLE_PYTHON=$enableval])
|
||||
AM_CONDITIONAL([ENABLE_PYTHON], [test "$ENABLE_PYTHON" = "yes"])
|
||||
|
||||
AC_ARG_ENABLE(
|
||||
[parallel],
|
||||
[AC_HELP_STRING([--enable-parallel],
|
||||
[AS_HELP_STRING([--enable-parallel],
|
||||
[Compile the MPI/IO interface [default=no]])],
|
||||
[USE_PARALLEL=$enableval])
|
||||
[ENABLE_PARALLEL=$enableval])
|
||||
AM_CONDITIONAL([ENABLE_PARALLEL], [test "$ENABLE_PARALLEL" = "yes"])
|
||||
|
||||
AC_ARG_ENABLE(
|
||||
[large-indices],
|
||||
[AC_HELP_STRING([--enable-large-indices],
|
||||
[Compile with 64bit local IDs and indices [default=no]])],
|
||||
[USE_LARGE_INDICES=$enableval])
|
||||
|
||||
AC_ARG_ENABLE(
|
||||
[experimental],
|
||||
[AS_HELP_STRING([--enable-experimental],
|
||||
[Compile experimental code [default=no]])],
|
||||
[ENABLE_EXPERIMENTAL=$enableval])
|
||||
AM_CONDITIONAL([ENABLE_EXPERIMENTAL], [test "$ENABLE_EXPERIMENTAL" = "yes"])
|
||||
|
||||
AC_ARG_ENABLE(
|
||||
[vtkconverter],
|
||||
@@ -56,29 +74,91 @@ AC_ARG_ENABLE(
|
||||
[ENABLE_VTKCONVERTER=$enableval])
|
||||
AM_CONDITIONAL([ENABLE_VTKCONVERTER], [test "$ENABLE_VTKCONVERTER" = "yes"])
|
||||
|
||||
AC_ARG_ENABLE(
|
||||
[examples],
|
||||
[AS_HELP_STRING([--enable-examples],
|
||||
[Compile the H5hut examples [default=no]])],
|
||||
[ENABLE_EXAMPLES=$enableval])
|
||||
AM_CONDITIONAL([ENABLE_EXAMPLES], [test "$ENABLE_EXAMPLES" = "yes"])
|
||||
|
||||
AC_ARG_WITH(
|
||||
[hdf5],
|
||||
[AC_HELP_STRING([--with-hdf5],
|
||||
[AS_HELP_STRING([--with-hdf5],
|
||||
[path to HDF5 installation [default=""]])],
|
||||
[HDF5PATH=$withval], [HDF5PATH=""])
|
||||
[HDF5_PREFIX=$withval], [])
|
||||
|
||||
AC_ARG_WITH(
|
||||
[mpi],
|
||||
[AC_HELP_STRING([--with-mpi],
|
||||
[AS_HELP_STRING([--with-mpi],
|
||||
[path to MPI installation [default=""]])],
|
||||
[MPIPATH=$withval;PATH=$MPIPATH/bin:$PATH], [MPIPATH=""])
|
||||
[PATH=$MPI_PREFIX/bin:$PATH])
|
||||
|
||||
AC_ARG_WITH(
|
||||
[lustre],
|
||||
[AC_HELP_STRING([--with-lustre],
|
||||
[AS_HELP_STRING([--with-lustre],
|
||||
[path to lustre user API [default=""]])],
|
||||
[LUSTREPATH=$withval], [LUSTREPATH=""])
|
||||
|
||||
AC_ARG_WITH(
|
||||
[parmetis],
|
||||
[AC_HELP_STRING([--with-parmetis],
|
||||
[path to ParMETIS API [default=""]])],
|
||||
[PARMETIS_PREFIX=$withval], [])
|
||||
|
||||
AC_ARG_WITH(
|
||||
[vtk],
|
||||
[AS_HELP_STRING([--with-vtk],
|
||||
[path to VTK installation [default=""]])],
|
||||
[VTK_PREFIX=$withval], [VTK_PREFIX=""])
|
||||
[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
|
||||
if test "x$MPIFC" != "x"; then
|
||||
FC=$MPIFC
|
||||
else
|
||||
FC=''
|
||||
F77=''
|
||||
F90=''
|
||||
fi
|
||||
c_compilers="mpicc cc"
|
||||
cxx_compilers="mpic++ CC"
|
||||
fc_compiler="mpif90 mpif77 mpifort"
|
||||
else
|
||||
c_compilers="pgcc pathcc icc gcc cc_r cc"
|
||||
cxx_compilers="pgcc pathcc icc g++ cc_r c++"
|
||||
fc_compiler="pgf90 ifort xlf_r pathf90 g95 g90 ftn gfortran"
|
||||
fi
|
||||
|
||||
AC_PROG_CC($c_compilers)
|
||||
if test "x$ac_cv_prog_cc_c89" = "xno"; then
|
||||
AC_MSG_ERROR([C compiler not found!])
|
||||
fi
|
||||
|
||||
AC_PROG_CXX($cxx_compilers)
|
||||
|
||||
if test "X$ENABLE_FORTRAN" = "Xyes"; then
|
||||
AC_PROG_FC($fc_compiler)
|
||||
if test "x$FC" = "x"; then
|
||||
AC_MSG_ERROR([Fortran compiler not found!])
|
||||
fi
|
||||
fi
|
||||
|
||||
CC=`which $CC`
|
||||
CXX=`which $CXX`
|
||||
FC=`which $FC`
|
||||
|
||||
AX_CXX_COMPILE_STDCXX_11
|
||||
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!])
|
||||
fi
|
||||
|
||||
|
||||
###############################################################################
|
||||
############### PATH SERACH FUNCTION - to be used later... ####################
|
||||
@@ -111,54 +191,31 @@ PATH_Search() {
|
||||
return
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
# MISC SETTINGS INCLUDING C & C++ COMPILER SETTING
|
||||
|
||||
###############################################################################
|
||||
############# MISC SETTINGS INCLUDING C & C++ COMPILER SETTING ################
|
||||
###############################################################################
|
||||
# Compute the canonical host-system type variable, host, and its three
|
||||
# individual parts host_cpu, host_vendor, and host_os.
|
||||
AC_CANONICAL_HOST
|
||||
|
||||
AC_PROG_MAKE_SET
|
||||
|
||||
CFLAGS="$CFLAGS -Wall"
|
||||
CXXFLAGS="$CFLAGS -Wall"
|
||||
FFLAGS="$FFLAGS -Wall"
|
||||
|
||||
# debug enabled?
|
||||
AC_MSG_CHECKING([if debug is enabled])
|
||||
|
||||
if test "X$USE_DEBUG" = "Xyes"; then
|
||||
AC_MSG_RESULT([yes])
|
||||
CFLAGS="$CFLAGS -g"
|
||||
FFLAGS="$FFLAGS -g"
|
||||
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])
|
||||
AC_MSG_RESULT([no])
|
||||
CFLAGS="$CFLAGS -O3"
|
||||
CXXFLAGS="$CFLAGS -O3"
|
||||
FFLAGS="$FFLAGS -O3"
|
||||
fi
|
||||
|
||||
# Determine a C/C++ compiler to use.
|
||||
# If CC is not already set in the environment, check for gcc and cc, then
|
||||
# for other C compilers.
|
||||
# Set output variable CC to the name of the compiler found.
|
||||
if test "x$USE_PARALLEL" = "xyes"; then
|
||||
CCOMPILERS="mpicc cc"
|
||||
CXXCOMPILERS="mpic++ c++"
|
||||
else
|
||||
CCOMPILERS="pgcc pathcc icc gcc cc_r cc"
|
||||
CXXCOMPILERS="pgcc pathcc icc g++ cc_r c++"
|
||||
fi
|
||||
|
||||
AC_PROG_CC($CCOMPILERS)
|
||||
CC=`which $CC`
|
||||
AC_PROG_CXX($CXXCOMPILERS)
|
||||
CXX=`which $CXX`
|
||||
|
||||
# Use macro to set C99 mode instead of checking for gcc, which breaks with
|
||||
# parallel builds.
|
||||
AC_PROG_CC_C99
|
||||
if test "x$ac_cv_prog_cc_c99" = "xno"; then
|
||||
AC_MSG_ERROR([Cannot set C compiler to use C99 standard!])
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Set output variable INSTALL to the path of a BSD-compatible install program,
|
||||
# if one is found in the current PATH.
|
||||
# Otherwise, set INSTALL to `dir/install-sh -c`
|
||||
AC_PROG_INSTALL
|
||||
AC_PROG_AWK
|
||||
|
||||
@@ -201,153 +258,37 @@ AC_DEFINE_UNQUOTED(MY_UNAME, "$uname", "")
|
||||
|
||||
|
||||
###############################################################################
|
||||
######################## CONFIGURE LINE OPTIONS ###############################
|
||||
###############################################################################
|
||||
|
||||
############################ fortran enabled ##################################
|
||||
AC_MSG_CHECKING([if C interface enabled])
|
||||
if test "X$USE_C" = "Xyes"; then
|
||||
AC_MSG_RESULT([yes])
|
||||
BINDINGS="$BINDINGS C"
|
||||
LIB_C="libH5hutC.la"
|
||||
BUILD_LIBS="$BUILD_LIBS libH5hutC"
|
||||
BUILD_TESTS="$BUILD_TESTS h5u_test h5b_test"
|
||||
BUILD_TOOLS="$BUILD_TOOLS h5hutcc"
|
||||
fi
|
||||
|
||||
############################ fortran enabled ##################################
|
||||
AC_MSG_CHECKING([if fortran interface enabled])
|
||||
if test "X$USE_FORTRAN" = "Xyes"; then
|
||||
AC_MSG_RESULT([yes])
|
||||
BINDINGS="$BINDINGS Fortran"
|
||||
LIB_FORTRAN="libH5hutF.la"
|
||||
BUILD_LIBS="$BUILD_LIBS libH5hutF"
|
||||
|
||||
if test "X$USE_PARALLEL" = "Xyes"; then
|
||||
AC_PROG_FC(mpif90 mpif77)
|
||||
else
|
||||
AC_PROG_FC(pgf90 ifort xlf_r pathf90 g95 g90 ftn gfortran)
|
||||
fi
|
||||
|
||||
if test -z "$FC" ; then
|
||||
AC_MSG_ERROR([Cannot find a Fortran compiler!])
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if test $FC = "g90"; then
|
||||
FFLAGS="${FFLAGS} -fno-second-underscore"
|
||||
fi
|
||||
|
||||
if test $FC = "g95"; then
|
||||
FFLAGS="${FFLAGS} -fno-second-underscore"
|
||||
fi
|
||||
|
||||
AC_MSG_CHECKING([symbol convention in object files])
|
||||
`cd src/Fortran && rm -f TestUnderscore.o TestUnderscoreC.o TestUnderscore`
|
||||
`cd src/Fortran && ${FC} ${FFLAGS} -c TestUnderscore.f`
|
||||
`cd src/Fortran && ${CC} ${CFLAGS} -c TestUnderscoreC.c`
|
||||
`cd src/Fortran && ${FC} ${FFLAGS} -o TestUnderscore TestUnderscore.o TestUnderscoreC.o`
|
||||
|
||||
if test -f src/Fortran/TestUnderscore ; then
|
||||
UNDERSCORE_H=Underscore.h
|
||||
`cd src/Fortran && ./TestUnderscore > Underscore.h`
|
||||
AC_MSG_RESULT([ok])
|
||||
else
|
||||
AC_MSG_RESULT([nok])
|
||||
AC_MSG_ERROR([Cannot determine the symbon convention for Fortran object files!])
|
||||
exit 1
|
||||
fi
|
||||
|
||||
else
|
||||
AC_MSG_RESULT([no])
|
||||
fi
|
||||
|
||||
|
||||
######################## parallel interface enabled ###########################
|
||||
AC_MSG_CHECKING([if parallel interface enabled])
|
||||
if test "X$USE_PARALLEL" = "Xyes"; then
|
||||
AC_MSG_RESULT([yes])
|
||||
|
||||
CFLAGS="${CFLAGS} -DPARALLEL_IO -DMPICH_IGNORE_CXX_SEEK"
|
||||
|
||||
AC_MSG_CHECKING([if we can compile MPI code without setting flags])
|
||||
AC_TRY_LINK([#include "mpi.h"], [
|
||||
MPI_Comm comm;
|
||||
int n;
|
||||
MPI_Comm_size( comm, &n ); ],
|
||||
[AC_MSG_RESULT([yes]); r='yes'], [AC_MSG_RESULT([no]); r='no'] )
|
||||
|
||||
if test "X$r" = "Xno"; then
|
||||
AC_MSG_ERROR([MPI wrapper can't compile or link MPI program! Please set the INCLUDE and LIBS variables manually.])
|
||||
exit 1
|
||||
fi
|
||||
|
||||
TPTARGET="${TPTARGET} H5PartTestP H5PartAndreasTest Bench"
|
||||
TBTARGET="${TBTARGET} H5BlockTestAttributes"
|
||||
TBTARGET="${TBTARGET} H5BlockParTestScalarField"
|
||||
|
||||
# parallel + fortran
|
||||
if test "X$USE_FORTRAN" = "Xyes"; then
|
||||
TPTARGET="${TPTARGET} H5testFpar"
|
||||
TBTARGET="${TBTARGET} H5BlockParTestScalarFieldF"
|
||||
fi
|
||||
|
||||
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
|
||||
# PROCESS ARGUMENTS
|
||||
|
||||
###############################################################################
|
||||
######################### PATH CHECKING & SETTING #############################
|
||||
###############################################################################
|
||||
# check libraries
|
||||
|
||||
AC_MSG_CHECKING([for HDF5 root ])
|
||||
AC_MSG_RESULT([])
|
||||
if test -n "${HDF5PATH}" ; then
|
||||
P=${HDF5PATH}
|
||||
elif test -n "${HDF5ROOT}"; then
|
||||
P=${HDF5ROOT}
|
||||
elif test -n "${HDF5HOME}" ; then
|
||||
P=${HDF5HOME}
|
||||
elif test -n "${HDF5_DIR}" ; then
|
||||
P=${HDF5_DIR}
|
||||
else
|
||||
P=''
|
||||
P="$P /usr"
|
||||
P="$P /usr/local"
|
||||
P="$P /usr/local/hdf5"
|
||||
P="$P /usr/local/packages/hdf5"
|
||||
P="$P /apps/hdf5"
|
||||
P="$P /opt/hdf5"
|
||||
fi
|
||||
PATH_Search HDF5ROOT "$P" include/hdf5.h
|
||||
if test -z "$HDF5ROOT"; then
|
||||
AC_MSG_ERROR([Cannot find an HDF5 library!])
|
||||
exit 1
|
||||
fi
|
||||
AC_CHECK_LIB([z], [compress2])
|
||||
|
||||
AM_CPPFLAGS="$AM_CPPFLAGS -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])
|
||||
# hdf5
|
||||
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([hdf5], [H5open])
|
||||
AS_IF([test "x$ac_cv_lib_hdf5_H5open" != xyes],
|
||||
[AC_MSG_ERROR([Cannot compile and link a HDF5 program])])
|
||||
AC_MSG_CHECKING([checking whether hdf5 lib supports parallel IO])
|
||||
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
|
||||
#include "hdf5.h"
|
||||
#ifndef H5_HAVE_PARALLEL
|
||||
# error macro not defined
|
||||
#endif
|
||||
]])], [H5_HAVE_PARALLEL="yes"], [H5_HAVE_PARALLEL="no"])
|
||||
AC_MSG_RESULT([$H5_HAVE_PARALLEL])
|
||||
|
||||
# lustre
|
||||
AC_MSG_CHECKING([for lustre API ])
|
||||
AC_MSG_RESULT([])
|
||||
if test -n "${LUSTREPATH}"; then
|
||||
@@ -370,84 +311,252 @@ 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"
|
||||
AM_CPPFLAGS=="$AM_CPPFLAGS -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"
|
||||
|
||||
|
||||
|
||||
############################ enabled bindings ###############################
|
||||
|
||||
# C enabled?
|
||||
AC_MSG_CHECKING([if C interface enabled])
|
||||
if test "X$ENABLE_C" = "Xyes"; then
|
||||
AC_MSG_RESULT([yes])
|
||||
else
|
||||
AC_MSG_RESULT([no])
|
||||
fi
|
||||
|
||||
# fortran enabled?
|
||||
AC_MSG_CHECKING([if fortran interface enabled])
|
||||
if test "X$ENABLE_FORTRAN" = "Xyes"; then
|
||||
AC_MSG_RESULT([yes])
|
||||
AC_LANG_PUSH(Fortran)
|
||||
|
||||
# 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$ENABLE_PARALLEL" = "Xyes"; then
|
||||
AC_MSG_RESULT([yes])
|
||||
|
||||
AS_IF([test "x$H5_HAVE_PARALLEL" = "xno"],
|
||||
[AC_MSG_ERROR([hdf5 does not support parallel IO!])])
|
||||
|
||||
if test "X$ENABLE_VTKCONVERTER" = "Xyes"; then
|
||||
AC_MSG_ERROR([VTK to H5hut grid converter cannot be compiled parallel!])
|
||||
fi
|
||||
CPPFLAGS="${CPPFLAGS} -DPARALLEL_IO -DMPICH_IGNORE_CXX_SEEK"
|
||||
|
||||
if test "X$ENABLE_EXPERIMENTAL" = "Xyes"; then
|
||||
CPPFLAGS="$CPPFLAGS -DWITH_PARALLEL_H5GRID"
|
||||
AC_MSG_CHECKING([for ParMETIS])
|
||||
if test "X$PARMETIS_PREFIX" != "X"; then
|
||||
CPPFLAGS="$CPPFLAGS -I$PARMETIS_PREFIX/include"
|
||||
LDFLAGS="$LDFLAGS -L$PARMETIS_PREFIX/lib"
|
||||
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])
|
||||
fi
|
||||
fi
|
||||
else # --enable-parallel=no
|
||||
AC_MSG_RESULT([no])
|
||||
AS_IF([test "x$H5_HAVE_PARALLEL" = "xyes"],
|
||||
[AC_MSG_ERROR([hdf5 with support for parallel IO cannot be used for non-parallel H5hut!])])
|
||||
fi
|
||||
|
||||
###############################################################################
|
||||
# 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
|
||||
if test -n "$VTK_PREFIX"; then
|
||||
SAVE_C_INCLUDE_PATH="$C_INCLUDE_PATH"
|
||||
SAVE_CPLUS_INCLUDE_PATH="$CPLUS_INCLUDE_PATH"
|
||||
SAVE_LIBRARY_PATH="$LIBRARY_PATH"
|
||||
C_INCLUDE_PATH="$C_INCLUDE_PATH $VTK_PREFIX/include"
|
||||
CPLUS_INCLUDE_PATH="$CPLUS_INCLUDE_PATH $VTK_PREFIX/include"
|
||||
LIBRARY_PATH="$LIBRARY_PATH $VTK_PREFIX/lib"
|
||||
fi
|
||||
AC_MSG_CHECKING([VTK inlcude files])
|
||||
VTK_INCLUDES=`cmake --find-package -DNAME=VTK -DCOMPILER_ID=GNU -DLANGUAGE=C -DMODE=COMPILE 2>/dev/null`
|
||||
if test "X$?" != "X0"; then
|
||||
AC_MSG_RESULT([no])
|
||||
AC_MSG_ERROR([Cannot compile VTK to H5hut converter])
|
||||
else
|
||||
AC_MSG_RESULT([yes])
|
||||
fi
|
||||
AC_MSG_CHECKING([VTK libraries])
|
||||
VTK_LIBS=`cmake --find-package -DNAME=VTK -DCOMPILER_ID=GNU -DLANGUAGE=C -DMODE=LINK 2>/dev/null`
|
||||
if test "X$?" != "X0"; then
|
||||
AC_MSG_RESULT([no])
|
||||
AC_MSG_ERROR([Cannot compile VTK to H5hut converter]);
|
||||
else
|
||||
AC_MSG_RESULT([yes])
|
||||
fi
|
||||
|
||||
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(HDF5ROOT)
|
||||
AC_SUBST(LUSTREROOT)
|
||||
# EXPORTING VARIABLES & CREATING OUTPUT FILES
|
||||
AM_CPPFLAGS=$CPPFLAGS
|
||||
AM_LDFLAGS=$LDFLAGS
|
||||
|
||||
AC_SUBST(HDF5_PREFIX)
|
||||
AC_SUBST(CFLAGS)
|
||||
AC_SUBST(FFLAGS)
|
||||
AC_SUBST(AM_CPPFLAGS)
|
||||
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)
|
||||
|
||||
# Make AC_OUTPUT create each `file' by copying an input file (by default `file.in'),
|
||||
# substituting the output variable values.
|
||||
AC_SUBST(AM_LDFLAGS)
|
||||
AC_SUBST(VTK_INCLUDES)
|
||||
AC_SUBST(VTK_LIBS)
|
||||
AC_CONFIG_FILES([
|
||||
Makefile
|
||||
src/Makefile
|
||||
src/C/Makefile
|
||||
src/h5core/Makefile
|
||||
src/include/Makefile
|
||||
src/include/h5core/Makefile
|
||||
src/C/Makefile
|
||||
src/Fortran/Makefile
|
||||
src/Python/Makefile
|
||||
test/Makefile
|
||||
test/H5Fed/Makefile
|
||||
doc/Makefile
|
||||
tools/Makefile
|
||||
tools/h5hutcc
|
||||
tools/vtk2h5grid/Makefile
|
||||
examples/H5/Makefile
|
||||
examples/H5Part/Makefile
|
||||
examples/H5Block/Makefile
|
||||
examples/H5Fed/Makefile
|
||||
])
|
||||
|
||||
AC_OUTPUT
|
||||
|
||||
###############################################################################
|
||||
########################## PRINTING SUMMARY ###################################
|
||||
###############################################################################
|
||||
# PRINTING SUMMARY
|
||||
AC_MSG_RESULT([ ])
|
||||
AC_MSG_RESULT([Summary:])
|
||||
AC_MSG_RESULT([ ])
|
||||
AC_MSG_RESULT([Host OS: $host_os])
|
||||
AC_MSG_RESULT([Host CPU: $host_cpu])
|
||||
AC_MSG_RESULT([Host vendor: $host_vendor])
|
||||
AC_MSG_RESULT([Build libraries: $BUILD_LIBS])
|
||||
AC_MSG_RESULT([Build test programs: $BUILD_TESTS])
|
||||
AC_MSG_RESULT([Build tools: $BUILD_TOOLS])
|
||||
AC_MSG_RESULT([CC = $CC])
|
||||
AC_MSG_RESULT([CXX = $CXX])
|
||||
AC_MSG_RESULT([FC = $FC])
|
||||
AC_MSG_RESULT([CFLAGS = $CFLAGS])
|
||||
AC_MSG_RESULT([FFLAGS = $FFLAGS])
|
||||
AC_MSG_RESULT([INCLUDES = $INCLUDES])
|
||||
AC_MSG_RESULT([LDFLAGS = $LDFLAGS])
|
||||
AC_MSG_RESULT([AM_CPPFLAGS = $AM_CPPFLAGS])
|
||||
AC_MSG_RESULT([AM_LDFLAGS = $AM_LDFLAGS])
|
||||
AC_MSG_RESULT([LIBS = $LIBS])
|
||||
AC_MSG_RESULT([HDF5ROOT = $HDF5ROOT])
|
||||
AC_MSG_RESULT([HDF5_PREFIX = $HDF5_PREFIX])
|
||||
AC_MSG_RESULT([LUSTREROOT = $LUSTREROOT])
|
||||
|
||||
if test "x$ENABLE_PYTHON" = "xyes"; then
|
||||
AC_MSG_RESULT([PYTHON = $PYTHON])
|
||||
AC_MSG_RESULT([SWIG = $SWIG])
|
||||
AC_MSG_RESULT([NUMPY_INCLUDE = $NUMPY_INCLUDE])
|
||||
if test "x$ENABLE_PARALLEL" = "xyes"; then
|
||||
AC_MSG_RESULT([MPI4PY_INCLUDE = $MPI4PY_INCLUDE])
|
||||
fi
|
||||
fi
|
||||
AC_MSG_RESULT([ ])
|
||||
|
||||
+2303
-143
File diff suppressed because it is too large
Load Diff
+136
-104
@@ -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
@@ -9,5 +9,6 @@ doc:
|
||||
doxydoc:
|
||||
doxygen
|
||||
|
||||
clean:
|
||||
${RM} -rf ReferencePages TWiki
|
||||
clean-local:
|
||||
$(RM) -r ReferencePages TWiki
|
||||
$(RM) *~
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
<style type="text/css">
|
||||
h1 { text-align: center; }
|
||||
</style>
|
||||
|
||||
Executable
+39
@@ -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))
|
||||
@@ -0,0 +1,63 @@
|
||||
#
|
||||
# Copyright (c) 2006-2015, The Regents of the University of California,
|
||||
# through Lawrence Berkeley National Laboratory (subject to receipt of any
|
||||
# required approvals from the U.S. Dept. of Energy) and the Paul Scherrer
|
||||
# Institut (Switzerland). All rights reserved.!
|
||||
#
|
||||
# License: see file COPYING in top level of source distribution.
|
||||
#
|
||||
|
||||
AM_CPPFLAGS += -I${abs_top_srcdir}/src/include
|
||||
AM_CPPFLAGS += -I${abs_top_srcdir}/examples/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
|
||||
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
|
||||
|
||||
all: ${noinst_PROGRAMS}
|
||||
|
||||
.f90.o:
|
||||
$(FC) $(FFLAGS) -c $<
|
||||
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
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
|
||||
|
||||
#include "examples.h"
|
||||
|
||||
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;
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
Copyright (c) 2006-2018, 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 "examples.h"
|
||||
|
||||
#if !defined(VERBOSITY)
|
||||
#define VERBOSITY H5_VERBOSE_ERROR
|
||||
#endif
|
||||
|
||||
/*
|
||||
Use H5_DEBUG_ALL to get full debug output
|
||||
*/
|
||||
#if !defined(DEBUGMASK)
|
||||
//#define DEBUGMASK H5_DEBUG_NONE
|
||||
#define DEBUGMASK H5_DEBUG_ALL
|
||||
#endif
|
||||
|
||||
int
|
||||
main (
|
||||
int argc,
|
||||
char** argv
|
||||
) {
|
||||
MPI_Comm comm = MPI_COMM_WORLD;
|
||||
|
||||
MPI_Init (&argc, &argv);
|
||||
H5SetVerbosityLevel (VERBOSITY);
|
||||
H5SetDebugMask (DEBUGMASK);
|
||||
h5_prop_t prop = H5CreateFileProp ();
|
||||
H5SetPropFileMPIOCollective (prop, &comm);
|
||||
h5_file_t f = H5OpenFile ("testfile.h5", H5_O_WRONLY, prop);
|
||||
H5CloseProp (prop);
|
||||
H5CloseFile (f);
|
||||
H5Finalize ();
|
||||
MPI_Finalize ();
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
!
|
||||
! Copyright (c) 2006-2015, The Regents of the University of California,
|
||||
! through Lawrence Berkeley National Laboratory (subject to receipt of any
|
||||
! required approvals from the U.S. Dept. of Energy) and the Paul Scherrer
|
||||
! Institut (Switzerland). All rights reserved.!
|
||||
!
|
||||
! License: see file COPYING in top level of source distribution.
|
||||
!
|
||||
include 'H5hut.f90'
|
||||
|
||||
program openclose
|
||||
|
||||
use H5hut
|
||||
|
||||
implicit none
|
||||
|
||||
#if defined(PARALLEL_IO)
|
||||
include 'mpif.h'
|
||||
#endif
|
||||
integer :: comm, rank
|
||||
integer*8 :: file_id, status
|
||||
integer*8 :: props
|
||||
|
||||
#if defined(PARALLEL_IO)
|
||||
integer :: ierr
|
||||
comm = MPI_COMM_WORLD
|
||||
call mpi_init(ierr)
|
||||
call mpi_comm_rank(comm, rank, ierr)
|
||||
#else
|
||||
comm = 0
|
||||
rank = 1
|
||||
#endif
|
||||
|
||||
props = h5_createprop_file ()
|
||||
#if defined(PARALLEL_IO)
|
||||
status = h5_setprop_file_mpio_collective (props, comm)
|
||||
#endif
|
||||
file_id = h5_openfile ("testfile.h5", H5_O_WRONLY, props)
|
||||
status = h5_closeprop (props)
|
||||
status = h5_closefile (file_id);
|
||||
|
||||
#if defined(PARALLEL_IO)
|
||||
call mpi_finalize(ierr)
|
||||
#endif
|
||||
|
||||
end program openclose
|
||||
@@ -0,0 +1,138 @@
|
||||
/*
|
||||
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 "examples.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;
|
||||
}
|
||||
@@ -0,0 +1,172 @@
|
||||
!
|
||||
! 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.
|
||||
!
|
||||
include 'H5hut.f90'
|
||||
|
||||
program query
|
||||
use H5hut
|
||||
implicit none
|
||||
#if defined(PARALLEL_IO)
|
||||
include 'mpif.h'
|
||||
#endif
|
||||
|
||||
! 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
|
||||
|
||||
#if defined(PARALLEL_IO)
|
||||
call mpi_init (ierr)
|
||||
#endif
|
||||
|
||||
! 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);
|
||||
|
||||
#if defined(PARALLEL_IO)
|
||||
call mpi_finalize(ierr)
|
||||
#endif
|
||||
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
|
||||
@@ -0,0 +1,89 @@
|
||||
/*
|
||||
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 "examples.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;
|
||||
}
|
||||
@@ -0,0 +1,119 @@
|
||||
!
|
||||
! 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
|
||||
#if defined(PARALLEL_IO)
|
||||
include 'mpif.h'
|
||||
#endif
|
||||
|
||||
! 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 (:)
|
||||
|
||||
! 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
|
||||
|
||||
#if defined(PARALLEL_IO)
|
||||
! used for mpi error return
|
||||
integer :: ierr
|
||||
|
||||
call mpi_init (ierr)
|
||||
#endif
|
||||
|
||||
! 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)
|
||||
#if defined(PARALLEL_IO)
|
||||
call mpi_finalize(ierr)
|
||||
#endif
|
||||
end program read_file_attribs
|
||||
@@ -0,0 +1,87 @@
|
||||
/*
|
||||
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 "examples.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;
|
||||
}
|
||||
@@ -0,0 +1,119 @@
|
||||
!
|
||||
! 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
|
||||
|
||||
#if defined(PARALLEL_IO)
|
||||
include 'mpif.h'
|
||||
#endif
|
||||
|
||||
! 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 (:)
|
||||
|
||||
! 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
|
||||
|
||||
#if defined(PARALLEL_IO)
|
||||
! used for mpi error return
|
||||
integer :: ierr
|
||||
|
||||
call mpi_init (ierr)
|
||||
#endif
|
||||
|
||||
! 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)
|
||||
#if defined(PARALLEL_IO)
|
||||
call mpi_finalize(ierr)
|
||||
#endif
|
||||
end program read_step_attribs
|
||||
@@ -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"
|
||||
#include "examples.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;
|
||||
}
|
||||
Executable
+29
@@ -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)
|
||||
@@ -0,0 +1,63 @@
|
||||
!
|
||||
! Copyright (c) 2006-2015, The Regents of the University of California,
|
||||
! through Lawrence Berkeley National Laboratory (subject to receipt of any
|
||||
! required approvals from the U.S. Dept. of Energy) and the Paul Scherrer
|
||||
! Institut (Switzerland). All rights reserved.!
|
||||
!
|
||||
! License: see file COPYING in top level of source distribution.
|
||||
!
|
||||
include 'H5hut.f90'
|
||||
|
||||
program write_file_attribs
|
||||
use H5hut
|
||||
implicit none
|
||||
|
||||
#if defined(PARALLEL_IO)
|
||||
include 'mpif.h'
|
||||
#endif
|
||||
|
||||
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*8 :: file_id, status
|
||||
|
||||
#if defined(PARALLEL_IO)
|
||||
integer :: ierr
|
||||
call mpi_init(ierr)
|
||||
#endif
|
||||
|
||||
! 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)
|
||||
|
||||
#if defined(PARALLEL_IO)
|
||||
call mpi_finalize(ierr)
|
||||
#endif
|
||||
end program write_file_attribs
|
||||
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
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 "examples.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;
|
||||
}
|
||||
@@ -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_step_attribs
|
||||
use H5hut
|
||||
implicit none
|
||||
|
||||
#if defined(PARALLEL_IO)
|
||||
include 'mpif.h'
|
||||
#endif
|
||||
|
||||
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*8 :: file_id, status
|
||||
|
||||
#if defined(PARALLEL_IO)
|
||||
integer :: ierr
|
||||
call mpi_init(ierr)
|
||||
#endif
|
||||
|
||||
! 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)
|
||||
|
||||
#if defined(PARALLEL_IO)
|
||||
call mpi_finalize(ierr)
|
||||
#endif
|
||||
end program write_step_attribs
|
||||
@@ -0,0 +1,3 @@
|
||||
h5hut.mod
|
||||
read_write_scalar_field
|
||||
read_write_scalar_fieldf
|
||||
@@ -0,0 +1,54 @@
|
||||
#
|
||||
# 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
|
||||
AM_CPPFLAGS += -I${abs_top_srcdir}/examples/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
|
||||
noinst_PROGRAMS += read_write_scalar_fieldf
|
||||
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,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.h"
|
||||
#include "examples.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);
|
||||
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;
|
||||
}
|
||||
@@ -0,0 +1,206 @@
|
||||
/*
|
||||
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.
|
||||
*/
|
||||
|
||||
#include "H5hut.h"
|
||||
#include "examples.h"
|
||||
|
||||
#include <inttypes.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: %" PRId64, attrib_data[0]);
|
||||
for (size_t i = 1; i < attrib_nelems; i++) {
|
||||
printf (", %" PRId64, 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 %" PRId64 " 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;
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
/*
|
||||
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.
|
||||
*/
|
||||
|
||||
#include <H5hut.h>
|
||||
#include "examples.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;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,85 @@
|
||||
/*
|
||||
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.
|
||||
*/
|
||||
|
||||
#include "H5hut.h"
|
||||
#include "examples.h"
|
||||
|
||||
#include <inttypes.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: %" PRId64 "\n", field_rank);
|
||||
printf ("dims of field: [%" PRId64 ", %" PRId64 ", %" PRId64"]\n",
|
||||
field_dims[0], field_dims[1], field_dims[2]);
|
||||
printf ("rank of field data: %" PRId64 "\n", elem_rank);
|
||||
printf ("type of field data: '%s'\n", stype);
|
||||
done:
|
||||
// done
|
||||
H5CloseFile(file);
|
||||
MPI_Finalize ();
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,555 @@
|
||||
/*
|
||||
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.
|
||||
*/
|
||||
|
||||
#include "H5hut.h"
|
||||
#include "examples.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,513 @@
|
||||
!
|
||||
! 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
|
||||
|
||||
#if defined(PARALLEL_IO)
|
||||
include 'mpif.h'
|
||||
|
||||
integer :: comm = 0
|
||||
integer :: mpi_err
|
||||
#endif
|
||||
|
||||
integer :: nargs = 0
|
||||
integer :: comm_rank = 0
|
||||
integer :: comm_size = 1
|
||||
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
|
||||
#if defined(PARALLEL_IO)
|
||||
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)
|
||||
#else
|
||||
comm_size = 1
|
||||
comm_rank = 0
|
||||
#endif
|
||||
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!"
|
||||
#if defined(PARALLEL_IO)
|
||||
call mpi_finalize
|
||||
#endif
|
||||
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
|
||||
#if defined(PARALLEL_IO)
|
||||
call mpi_finalize
|
||||
#endif
|
||||
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
|
||||
@@ -0,0 +1,97 @@
|
||||
/*
|
||||
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 "examples.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;
|
||||
}
|
||||
@@ -1,11 +1,23 @@
|
||||
# test level Makefile.am
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
OBJEXT = o
|
||||
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
|
||||
|
||||
AM_LDFLAGS = -L../../src/lib @LDFLAGS@
|
||||
LIBS = -lH5hutC -lH5hut @LIBS@
|
||||
AM_CPPFLAGS = -I../../src/include @AM_CPPFLAGS@
|
||||
LDADD =
|
||||
LDADD += -lH5hut
|
||||
|
||||
if ENABLE_EXAMPLES
|
||||
noinst_PROGRAMS = \
|
||||
tetmesh_write \
|
||||
tetmesh_write1 \
|
||||
@@ -37,11 +49,12 @@ EXTRA_DIST = \
|
||||
trimesh_write.c \
|
||||
trimesh_2gnuplot.c \
|
||||
trimesh_write_dunetest.c
|
||||
|
||||
# map_tet2globalid.c \
|
||||
# map_triangle2globalid.c \
|
||||
# $(bin_SCRIPTS)
|
||||
|
||||
clean: clean-am
|
||||
rm -f *.h5
|
||||
endif
|
||||
|
||||
clean-local:
|
||||
$(RM) *.h5 *~
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
#include "H5hut.h"
|
||||
|
||||
#ifndef PARALLEL_IO
|
||||
#ifndef H5_HAVE_PARALLEL
|
||||
#ifndef MPI_COMM_WORLD
|
||||
#define MPI_COMM_WORLD 0
|
||||
#endif
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
#include "H5hut.h"
|
||||
|
||||
#ifndef PARALLEL_IO
|
||||
#ifndef H5_HAVE_PARALLEL
|
||||
#ifndef MPI_COMM_WORLD
|
||||
#define MPI_COMM_WORLD 0
|
||||
#endif
|
||||
@@ -4,10 +4,6 @@
|
||||
|
||||
#include "H5hut.h"
|
||||
|
||||
#define PRINT_UPADJACENCIES 1
|
||||
#define PRINT_DOWNADJACENCIES 0
|
||||
|
||||
const h5_oid_t MESH_TYPE = H5_TETRAHEDRAL_MESH;
|
||||
const char* FNAME = "simple_tet.h5";
|
||||
|
||||
typedef struct timer {
|
||||
@@ -27,7 +23,7 @@ static Timer*
|
||||
new (
|
||||
void
|
||||
) {
|
||||
Timer* this = malloc (sizeof (Timer));
|
||||
Timer* this = (Timer*)malloc (sizeof (Timer));
|
||||
*this = Timer_;
|
||||
return this;
|
||||
}
|
||||
@@ -500,7 +496,7 @@ traverse_elems (
|
||||
static h5_err_t
|
||||
traverse_level (
|
||||
h5t_mesh_t* const m,
|
||||
const h5t_lvl_idx_t level_id,
|
||||
const h5_lvl_idx_t level_id,
|
||||
int dumpit,
|
||||
Timer* timer
|
||||
) {
|
||||
@@ -515,7 +511,7 @@ traverse_level (
|
||||
|
||||
static h5_err_t
|
||||
traverse_mesh (
|
||||
h5_file_t* const f,
|
||||
h5_file_t const f,
|
||||
const h5_id_t mesh_id
|
||||
) {
|
||||
h5t_mesh_t* mesh;
|
||||
@@ -523,13 +519,13 @@ traverse_mesh (
|
||||
Timer* timer = Timer_.new();
|
||||
|
||||
/* open mesh and get number of levels */
|
||||
printf (" Opening mesh with id %lld\n", mesh_id);
|
||||
printf (" Opening mesh with id %lld\n", (long long)mesh_id);
|
||||
H5FedOpenTetrahedralMeshByIndex (f, mesh_id, &mesh);
|
||||
h5_size_t num_levels = H5FedGetNumLevels (mesh);
|
||||
printf (" Number of levels in mesh: %lld\n", (long long)num_levels);
|
||||
|
||||
/* loop over all levels */
|
||||
h5t_lvl_idx_t level_id;
|
||||
h5_lvl_idx_t level_id;
|
||||
for (level_id = 0; level_id < num_levels; level_id++) {
|
||||
traverse_level (mesh, level_id, dumpit, timer);
|
||||
}
|
||||
@@ -547,10 +543,11 @@ main (
|
||||
|
||||
/* abort program on error, so we don't have to handle them */
|
||||
H5SetErrorHandler (H5AbortErrorhandler);
|
||||
H5SetVerbosityLevel (2);
|
||||
|
||||
//H5SetVerbosityLevel (H5_DEBUG_ALL);
|
||||
H5SetVerbosityLevel (0);
|
||||
|
||||
/* open file and get number of meshes */
|
||||
h5_file_t *f = H5OpenFile (FNAME, H5_O_RDONLY, 0);
|
||||
h5_file_t f = H5OpenFile (FNAME, H5_O_RDONLY, 0);
|
||||
h5_size_t num_meshes = H5FedGetNumTetrahedralMeshes (f);
|
||||
printf (" Number of meshes: %lld\n", (long long)num_meshes);
|
||||
|
||||
@@ -24,7 +24,7 @@ static Timer*
|
||||
new (
|
||||
void
|
||||
) {
|
||||
Timer* this = malloc (sizeof (Timer));
|
||||
Timer* this = (Timer*)malloc (sizeof (Timer));
|
||||
*this = Timer_;
|
||||
return this;
|
||||
}
|
||||
@@ -280,7 +280,7 @@ traverse_elems (
|
||||
static h5_err_t
|
||||
traverse_level (
|
||||
h5t_mesh_t* const m,
|
||||
const h5t_lvl_idx_t level_id,
|
||||
const h5_lvl_idx_t level_id,
|
||||
int dumpit,
|
||||
Timer* timer
|
||||
) {
|
||||
@@ -296,7 +296,7 @@ traverse_level (
|
||||
|
||||
static h5_err_t
|
||||
traverse_mesh (
|
||||
h5_file_t* const f,
|
||||
h5_file_t const f,
|
||||
const h5_id_t mesh_id,
|
||||
int dumpit
|
||||
) {
|
||||
@@ -305,7 +305,7 @@ traverse_mesh (
|
||||
|
||||
timer->start(timer);
|
||||
/* open mesh and get number of levels */
|
||||
printf (" Opening mesh with id %lld\n", mesh_id);
|
||||
printf (" Opening mesh with id %lld\n", (long long)mesh_id);
|
||||
H5FedOpenTetrahedralMeshByIndex (f, mesh_id, &mesh);
|
||||
timer->stop(timer);
|
||||
printf (" %fsec\n", timer->elapsed(timer));
|
||||
@@ -313,7 +313,7 @@ traverse_mesh (
|
||||
printf (" Number of levels in mesh: %lld\n", (long long)num_levels);
|
||||
|
||||
/* loop over all levels */
|
||||
h5t_lvl_idx_t level_id;
|
||||
h5_lvl_idx_t level_id;
|
||||
for (level_id = 0; level_id < num_levels; level_id++) {
|
||||
traverse_level (mesh, level_id, dumpit, timer);
|
||||
}
|
||||
@@ -328,12 +328,13 @@ main (
|
||||
int argc,
|
||||
char* argv[]
|
||||
) {
|
||||
|
||||
/* abort program on error, so we don't have to handle them */
|
||||
H5SetErrorHandler (H5AbortErrorhandler);
|
||||
H5SetVerbosityLevel (2);
|
||||
H5SetVerbosityLevel (0);
|
||||
|
||||
/* open file and get number of meshes */
|
||||
h5_file_t* f = H5OpenFile (FNAME, H5_O_RDONLY, 0);
|
||||
h5_file_t f = H5OpenFile (FNAME, H5_O_RDONLY, H5_PROP_DEFAULT);
|
||||
h5_size_t num_meshes = H5FedGetNumTetrahedralMeshes (f);
|
||||
printf (" Number of meshes: %lld\n", (long long)num_meshes);
|
||||
|
||||
@@ -4,13 +4,12 @@
|
||||
|
||||
#include "H5hut.h"
|
||||
|
||||
// name of input file
|
||||
const char* FNAME = "simple_tet.h5";
|
||||
|
||||
#ifndef PARALLEL_IO
|
||||
#ifndef MPI_COMM_WORLD
|
||||
#define MPI_COMM_WORLD 0
|
||||
#endif
|
||||
#endif
|
||||
// H5hut verbosity/debug level
|
||||
const h5_int64_t h5_verbosity = H5_VERBOSE_DEFAULT;
|
||||
const h5_int64_t h5_debugmsk = H5_DEBUG_ALL;
|
||||
|
||||
typedef struct timer {
|
||||
clock_t _start;
|
||||
@@ -27,7 +26,7 @@ static Timer*
|
||||
new (
|
||||
void
|
||||
) {
|
||||
Timer* self = malloc (sizeof (Timer));
|
||||
Timer* self = (Timer*)malloc (sizeof (Timer));
|
||||
*self = Timer_;
|
||||
return self;
|
||||
}
|
||||
@@ -111,7 +110,7 @@ traverse_vertices (
|
||||
}
|
||||
if (dumpit) {
|
||||
printf (" (%llx, %llx, %llx) |",
|
||||
tval[0], tval[1], tval[2]);
|
||||
(long long)tval[0], (long long)tval[1], (long long)tval[2]);
|
||||
}
|
||||
num_entities_tagged++;
|
||||
if (tval[0] != local_id ||
|
||||
@@ -172,7 +171,7 @@ traverse_edges (
|
||||
continue; // not tagged
|
||||
if (dumpit) {
|
||||
printf (" (%llx, %llx, %llx) |",
|
||||
tval[0], tval[1], tval[2]);
|
||||
(long long)tval[0], (long long)tval[1], (long long)tval[2]);
|
||||
}
|
||||
num_entities_tagged++;
|
||||
|
||||
@@ -236,7 +235,7 @@ traverse_triangles (
|
||||
continue; // not tagged
|
||||
if (dumpit) {
|
||||
printf (" (%llx, %llx, %llx) |",
|
||||
tval[0], tval[1], tval[2]);
|
||||
(long long)tval[0], (long long)tval[1], (long long)tval[2]);
|
||||
}
|
||||
num_entities_tagged++;
|
||||
|
||||
@@ -298,7 +297,7 @@ traverse_tets (
|
||||
continue; // not tagged
|
||||
if (dumpit) {
|
||||
printf (" (%llx, %llx, %llx) |",
|
||||
tval[0], tval[1], tval[2]);
|
||||
(long long)tval[0], (long long)tval[1], (long long)tval[2]);
|
||||
}
|
||||
num_entities_tagged++;
|
||||
|
||||
@@ -327,7 +326,7 @@ static h5_err_t
|
||||
traverse_level (
|
||||
h5t_mesh_t* const m,
|
||||
h5t_tagset_t* tagset,
|
||||
const h5t_lvl_idx_t level_id,
|
||||
const h5_lvl_idx_t level_id,
|
||||
int dumpit,
|
||||
Timer* timer
|
||||
) {
|
||||
@@ -342,7 +341,7 @@ traverse_level (
|
||||
|
||||
static h5_err_t
|
||||
traverse_mesh (
|
||||
h5_file_t* const f,
|
||||
const h5_file_t f,
|
||||
const h5_id_t mesh_id,
|
||||
int dumpit
|
||||
) {
|
||||
@@ -350,7 +349,7 @@ traverse_mesh (
|
||||
Timer* timer = Timer_.new();
|
||||
timer->start(timer);
|
||||
/* open mesh and get number of levels */
|
||||
printf (" Opening mesh with id %lld\n", mesh_id);
|
||||
printf (" Opening mesh with id %lld\n", (long long)mesh_id);
|
||||
H5FedOpenTetrahedralMeshByIndex (f, mesh_id, &mesh);
|
||||
timer->stop(timer);
|
||||
printf (" %fsec\n", timer->elapsed(timer));
|
||||
@@ -362,7 +361,7 @@ traverse_mesh (
|
||||
printf (" Number of levels in mesh: %lld\n", (long long)num_levels);
|
||||
|
||||
/* loop over all levels */
|
||||
h5t_lvl_idx_t level_id;
|
||||
h5_lvl_idx_t level_id;
|
||||
for (level_id = 0; level_id < num_levels; level_id++) {
|
||||
traverse_level (mesh, tagset, level_id, dumpit, timer);
|
||||
}
|
||||
@@ -378,12 +377,14 @@ main (
|
||||
int argc,
|
||||
char* argv[]
|
||||
) {
|
||||
|
||||
/* abort program on error, so we don't have to handle them */
|
||||
H5SetErrorHandler (H5AbortErrorhandler);
|
||||
H5SetVerbosityLevel (2);
|
||||
|
||||
H5SetVerbosityLevel (h5_verbosity);
|
||||
H5SetDebugMask (h5_debugmsk);
|
||||
|
||||
/* open file and get number of meshes */
|
||||
h5_file_t* f = H5OpenFile (FNAME, H5_O_RDONLY, 0);
|
||||
h5_file_t f = H5OpenFile (FNAME, H5_O_RDONLY, 0);
|
||||
h5_size_t num_meshes = H5FedGetNumTetrahedralMeshes (f);
|
||||
printf (" Number of meshes: %lld\n", (long long)num_meshes);
|
||||
|
||||
@@ -4,12 +4,6 @@
|
||||
|
||||
#include "H5hut.h"
|
||||
|
||||
#ifndef PARALLEL_IO
|
||||
#ifndef MPI_COMM_WORLD
|
||||
#define MPI_COMM_WORLD 0
|
||||
#endif
|
||||
#endif
|
||||
|
||||
const char* FNAME = "simple_tet.h5";
|
||||
|
||||
typedef struct vertex {
|
||||
@@ -41,12 +35,13 @@ main (
|
||||
int argc,
|
||||
char* argv[]
|
||||
) {
|
||||
|
||||
/* abort program on errors in library */
|
||||
H5SetErrorHandler (H5AbortErrorhandler);
|
||||
H5SetVerbosityLevel (5);
|
||||
|
||||
/* open file and add mesh */
|
||||
h5_file_t* const f = H5OpenFile (FNAME, H5_O_WRONLY, 0);
|
||||
h5_file_t const f = H5OpenFile (FNAME, H5_O_WRONLY, H5_PROP_DEFAULT);
|
||||
h5t_mesh_t* mesh;
|
||||
H5FedAddTetrahedralMesh (f, "0", &mesh);
|
||||
|
||||
@@ -66,13 +61,11 @@ main (
|
||||
H5FedEndStoreElements (mesh);
|
||||
|
||||
/* add 1. Level */
|
||||
H5FedAddLevel(mesh);
|
||||
H5FedBeginRefineElements (mesh);
|
||||
H5FedRefineElement (mesh, 0);
|
||||
H5FedEndRefineElements (mesh);
|
||||
|
||||
/* add 2. Level */
|
||||
H5FedAddLevel(mesh);
|
||||
H5FedBeginRefineElements (mesh);
|
||||
H5FedRefineElement (mesh, 2);
|
||||
H5FedEndRefineElements (mesh);
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
#include "H5hut.h"
|
||||
|
||||
#ifndef PARALLEL_IO
|
||||
#ifndef H5_HAVE_PARALLEL
|
||||
#ifndef MPI_COMM_WORLD
|
||||
#define MPI_COMM_WORLD 0
|
||||
#endif
|
||||
@@ -44,7 +44,7 @@ main (
|
||||
H5SetVerbosityLevel (H5_DEBUG_ALL);
|
||||
|
||||
/* open file and add mesh */
|
||||
h5_file_t* const f = H5OpenFile (FNAME, H5_O_WRONLY, 0);
|
||||
h5_file_t const f = H5OpenFile (FNAME, H5_O_WRONLY, 0);
|
||||
h5t_mesh_t* mesh;
|
||||
H5FedAddTetrahedralMesh (f, "0", &mesh);
|
||||
|
||||
@@ -64,7 +64,6 @@ main (
|
||||
H5FedEndStoreElements (mesh);
|
||||
|
||||
/* add 1. Level */
|
||||
H5FedAddLevel(mesh);
|
||||
H5FedBeginRefineElements (mesh);
|
||||
H5FedRefineElement (mesh, 0);
|
||||
H5FedEndRefineElements (mesh);
|
||||
@@ -61,7 +61,7 @@ main (
|
||||
// H5SetVerbosityLevel (H5_DEBUG_ALL);
|
||||
|
||||
/* open file and add mesh */
|
||||
h5_file_t* const f = H5OpenFile (FNAME, H5_O_WRONLY, 0);
|
||||
h5_file_t const f = H5OpenFile (FNAME, H5_O_WRONLY, 0);
|
||||
h5t_mesh_t* mesh;
|
||||
H5FedAddTetrahedralMesh (f, "0", &mesh);
|
||||
|
||||
@@ -81,7 +81,6 @@ main (
|
||||
H5FedEndStoreElements (mesh);
|
||||
|
||||
/* add 1. Level */
|
||||
H5FedAddLevel(mesh);
|
||||
H5FedBeginRefineElements (mesh);
|
||||
H5FedRefineElement (mesh, 0);
|
||||
H5FedEndRefineElements (mesh);
|
||||
@@ -92,7 +91,6 @@ main (
|
||||
for (level_id = 2; level_id < num_levels; level_id++) {
|
||||
|
||||
/* refine 4 to the power of level_id-1 elems */
|
||||
H5FedAddLevel(mesh);
|
||||
h5_int32_t num_elems2refine = power (4, level_id-1);
|
||||
H5FedBeginRefineElements (mesh);
|
||||
for (i = num_elems_last_level;
|
||||
@@ -5,7 +5,6 @@
|
||||
|
||||
#include "H5hut.h"
|
||||
|
||||
const h5_oid_t MESH_TYPE = H5_TETRAHEDRAL_MESH;
|
||||
const char* FNAME = "simple_tet.h5";
|
||||
|
||||
typedef struct timer {
|
||||
@@ -23,7 +22,7 @@ static Timer*
|
||||
new (
|
||||
void
|
||||
) {
|
||||
Timer* this = malloc (sizeof (Timer));
|
||||
Timer* this = (Timer*)malloc (sizeof (Timer));
|
||||
*this = Timer_;
|
||||
return this;
|
||||
}
|
||||
@@ -188,7 +187,7 @@ main (
|
||||
H5SetVerbosityLevel (3);
|
||||
|
||||
/* open file and get number of meshes */
|
||||
h5_file_t* f = H5OpenFile (FNAME, H5_O_RDWR, 0);
|
||||
h5_file_t f = H5OpenFile (FNAME, H5_O_RDWR, 0);
|
||||
h5t_mesh_t* mesh;
|
||||
Timer* timer = Timer_.new();
|
||||
timer->start(timer);
|
||||
@@ -197,7 +196,7 @@ main (
|
||||
h5_info (" Time to open mesh %fsec", timer->elapsed(timer));
|
||||
|
||||
/* open last level */
|
||||
h5_size_t num_levels = H5FedGetNumLevels (mesh);
|
||||
//h5_size_t num_levels = H5FedGetNumLevels (mesh);
|
||||
//H5FedSetLevel (mesh, num_levels-1);
|
||||
H5FedSetLevel (mesh, 0);
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "H5hut.h"
|
||||
#if defined (PARALLEL_IO)
|
||||
#if defined (H5_HAVE_PARALLEL)
|
||||
#include <mpi.h>
|
||||
#endif
|
||||
|
||||
@@ -57,12 +57,6 @@ main (
|
||||
char* argv[]
|
||||
) {
|
||||
|
||||
#if defined (PARALLEL_IO)
|
||||
MPI_Comm comm = MPI_COMM_WORLD;
|
||||
MPI_Init (&argc, &argv);
|
||||
#else
|
||||
MPI_Comm comm = 0;
|
||||
#endif
|
||||
if (argc < 2 || argc > 3) {
|
||||
fprintf (stderr, "Usage: %s FILE [LEVEL]\n", argv[0]);
|
||||
exit (42);
|
||||
@@ -73,7 +67,7 @@ main (
|
||||
H5SetVerbosityLevel (0);
|
||||
|
||||
/* open file and get number of meshes */
|
||||
h5_file_t* f = H5OpenFile (argv[1], H5_O_RDONLY, comm);
|
||||
h5_file_t f = H5OpenFile (argv[1], H5_O_RDONLY, H5_PROP_DEFAULT);
|
||||
h5t_mesh_t* m;
|
||||
H5FedOpenTriangleMeshByIndex (f, 0, &m);
|
||||
int num_levels = H5FedGetNumLevels (m);
|
||||
@@ -93,7 +87,7 @@ done:
|
||||
H5FedCloseMesh (m);
|
||||
H5CloseFile (f);
|
||||
|
||||
#if defined (PARALLEL_IO)
|
||||
#if defined (H5_HAVE_PARALLEL)
|
||||
MPI_Finalize ();
|
||||
#endif
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
#define PRINT_UPADJACENCIES 1
|
||||
#define PRINT_DOWNADJACENCIES 0
|
||||
|
||||
const h5_oid_t MESH_TYPE = H5_TRIANGLE_MESH;
|
||||
const char* FNAME = "simple_triangle.h5";
|
||||
|
||||
static h5_err_t
|
||||
@@ -244,7 +243,7 @@ traverse_elems (
|
||||
clock_t t_min = CLOCKS_PER_SEC;
|
||||
clock_t t_max = 0;
|
||||
clock_t t = 0;
|
||||
printf ("\nAdjacencies to tetrahedra\n");
|
||||
printf ("\nAdjacencies to triangles\n");
|
||||
h5t_iterator_t* iter = H5FedBeginTraverseEntities (m, 0);
|
||||
while ((local_id = H5FedTraverseEntities (iter)) >= 0) {
|
||||
print_adjacencies_of_elem (m, local_id, &t);
|
||||
@@ -267,7 +266,7 @@ traverse_elems (
|
||||
static h5_err_t
|
||||
traverse_level (
|
||||
h5t_mesh_t* const m,
|
||||
const h5t_lvl_idx_t level_id
|
||||
const h5_lvl_idx_t level_id
|
||||
) {
|
||||
printf (" Setting level to %d\n", level_id);
|
||||
H5FedSetLevel (m, level_id);
|
||||
@@ -279,18 +278,18 @@ traverse_level (
|
||||
|
||||
static h5_err_t
|
||||
traverse_mesh (
|
||||
h5_file_t* const f,
|
||||
const h5_file_t f,
|
||||
const h5_id_t mesh_id
|
||||
) {
|
||||
h5t_mesh_t* m;
|
||||
/* open mesh and get number of levels */
|
||||
printf (" Opening mesh with id %lld\n", mesh_id);
|
||||
printf (" Opening mesh with id %lld\n", (long long)mesh_id);
|
||||
H5FedOpenTriangleMeshByIndex (f, mesh_id, &m);
|
||||
h5_size_t num_levels = H5FedGetNumLevels (m);
|
||||
printf (" Number of levels in mesh: %lld\n", (long long)num_levels);
|
||||
|
||||
/* loop over all levels */
|
||||
h5t_lvl_idx_t level_id;
|
||||
h5_lvl_idx_t level_id;
|
||||
for (level_id = 0; level_id < num_levels; level_id++) {
|
||||
traverse_level (m, level_id);
|
||||
}
|
||||
@@ -310,7 +309,7 @@ main (
|
||||
H5SetVerbosityLevel (2);
|
||||
|
||||
/* open file and get number of meshes */
|
||||
h5_file_t *f = H5OpenFile (FNAME, H5_O_RDONLY, 0);
|
||||
h5_file_t f = H5OpenFile (FNAME, H5_O_RDONLY, 0);
|
||||
h5_size_t num_meshes = H5FedGetNumTriangleMeshes (f);
|
||||
printf (" Number of meshes: %lld\n", (long long)num_meshes);
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "H5hut.h"
|
||||
#if defined (PARALLEL_IO)
|
||||
#if defined (H5_HAVE_PARALLEL)
|
||||
#include <mpi.h>
|
||||
#endif
|
||||
|
||||
@@ -209,18 +209,18 @@ traverse_level (
|
||||
|
||||
static h5_err_t
|
||||
traverse_mesh (
|
||||
h5_file_t* const f,
|
||||
const h5_file_t f,
|
||||
const h5_id_t mesh_id
|
||||
) {
|
||||
h5t_mesh_t* m;
|
||||
/* open mesh and get number of levels */
|
||||
printf (" Opening mesh with id %lld\n", mesh_id);
|
||||
printf (" Opening mesh with id %lld\n", (long long)mesh_id);
|
||||
H5FedOpenTriangleMeshByIndex (f, mesh_id, &m);
|
||||
h5_size_t num_levels = H5FedGetNumLevels (m);
|
||||
printf (" Number of levels in mesh: %lld\n", (long long)num_levels);
|
||||
|
||||
/* loop over all levels */
|
||||
h5t_lvl_idx_t level_id;
|
||||
h5_lvl_idx_t level_id;
|
||||
for (level_id = 0; level_id < num_levels; level_id++) {
|
||||
traverse_level (m, level_id);
|
||||
}
|
||||
@@ -236,19 +236,12 @@ main (
|
||||
char* argv[]
|
||||
) {
|
||||
|
||||
#if defined (PARALLEL_IO)
|
||||
MPI_Comm comm = MPI_COMM_WORLD;
|
||||
MPI_Init (&argc, &argv);
|
||||
#else
|
||||
MPI_Comm comm = 0;
|
||||
#endif
|
||||
|
||||
/* abort program on error, so we don't have to handle them */
|
||||
H5SetErrorHandler (H5AbortErrorhandler);
|
||||
H5SetVerbosityLevel (0);
|
||||
H5SetVerbosityLevel (H5_DEBUG_ALL);
|
||||
|
||||
/* open file and get number of meshes */
|
||||
h5_file_t* f = H5OpenFile (FNAME, H5_O_RDONLY, comm);
|
||||
h5_file_t f = H5OpenFile (FNAME, H5_O_RDONLY, H5_PROP_DEFAULT);
|
||||
h5_size_t num_meshes = H5FedGetNumTriangleMeshes (f);
|
||||
printf (" Number of meshes: %lld\n", (long long)num_meshes);
|
||||
|
||||
@@ -260,7 +253,7 @@ main (
|
||||
|
||||
/* done */
|
||||
H5CloseFile (f);
|
||||
#if defined (PARALLEL_IO)
|
||||
#if defined (H5_HAVE_PARALLEL)
|
||||
MPI_Finalize ();
|
||||
#endif
|
||||
|
||||
@@ -38,7 +38,7 @@ main (
|
||||
H5SetVerbosityLevel (5);
|
||||
|
||||
/* open file and add mesh */
|
||||
h5_file_t* const f = H5OpenFile (FNAME, H5_O_WRONLY, 0);
|
||||
const h5_file_t f = H5OpenFile (FNAME, H5_O_WRONLY, 0);
|
||||
h5t_mesh_t* m;
|
||||
H5FedAddTriangleMesh (f, "0", &m);
|
||||
|
||||
@@ -58,7 +58,6 @@ main (
|
||||
H5FedEndStoreElements (m);
|
||||
|
||||
/* add 1. Level */
|
||||
H5FedAddLevel(m);
|
||||
H5FedBeginRefineElements (m);
|
||||
H5FedRefineElement (m, 0);
|
||||
H5FedEndRefineElements (m);
|
||||
@@ -45,7 +45,7 @@ main (
|
||||
H5SetVerbosityLevel (2);
|
||||
|
||||
/* open file and add mesh */
|
||||
h5_file_t* const f = H5OpenFile (FNAME, H5_O_WRONLY, 0);
|
||||
const h5_file_t f = H5OpenFile (FNAME, H5_O_WRONLY, 0);
|
||||
h5t_mesh_t* m;
|
||||
H5FedAddTriangleMesh (f, "0", &m);
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
#include "H5hut.h"
|
||||
|
||||
#ifndef PARALLEL_IO
|
||||
#ifndef H5_HAVE_PARALLEL
|
||||
#ifndef MPI_COMM_WORLD
|
||||
#define MPI_COMM_WORLD 0
|
||||
#endif
|
||||
@@ -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
|
||||
@@ -0,0 +1,78 @@
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
AM_CPPFLAGS += -I${abs_top_srcdir}/src/include
|
||||
AM_CPPFLAGS += -I${abs_top_srcdir}/examples/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
|
||||
noinst_PROGRAMS += \
|
||||
read_core_vfdf \
|
||||
read_canonicalviewf \
|
||||
read_setnparticlesf \
|
||||
read_setviewf \
|
||||
read_stridedf \
|
||||
write_core_vfdf \
|
||||
write_setnparticlesf \
|
||||
write_setviewf \
|
||||
write_stridedf
|
||||
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 *~
|
||||
|
||||
|
||||
@@ -0,0 +1,115 @@
|
||||
/*
|
||||
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 "examples.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;
|
||||
}
|
||||
@@ -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.h"
|
||||
#include "examples.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_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;
|
||||
}
|
||||
@@ -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_canonicalview
|
||||
use H5hut
|
||||
implicit none
|
||||
|
||||
#if defined(PARALLEL_IO)
|
||||
include 'mpif.h'
|
||||
#endif
|
||||
|
||||
! name of input file
|
||||
character (len=*), parameter :: fname = "example_setview.h5"
|
||||
|
||||
! H5hut verbosity level
|
||||
integer*8, parameter :: h5_verbosity = H5_VERBOSE_DEFAULT
|
||||
|
||||
integer :: comm_rank = 0
|
||||
integer*8 :: file, h5_ierror
|
||||
integer*8 :: num_particles
|
||||
integer*8 :: i
|
||||
integer*4, allocatable :: data(:)
|
||||
|
||||
! initialize MPI & H5hut
|
||||
#if defined(PARALLEL_IO)
|
||||
integer :: comm, mpi_ierror
|
||||
comm = MPI_COMM_WORLD
|
||||
call mpi_init (mpi_ierror)
|
||||
call mpi_comm_rank (comm, comm_rank, mpi_ierror)
|
||||
#endif
|
||||
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)
|
||||
|
||||
#if defined(PARALLEL_IO)
|
||||
call mpi_finalize (mpi_ierror)
|
||||
#endif
|
||||
|
||||
end program read_canonicalview
|
||||
@@ -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.
|
||||
*/
|
||||
|
||||
/*
|
||||
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 "examples.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_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;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
!
|
||||
! 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
|
||||
|
||||
#if defined(PARALLEL_IO)
|
||||
include 'mpif.h'
|
||||
#endif
|
||||
|
||||
! name of input file
|
||||
character (len=*), parameter :: fname = "example_core_vfd.h5"
|
||||
|
||||
! H5hut verbosity level
|
||||
integer*8, parameter :: h5_verbosity = H5_VERBOSE_DEFAULT
|
||||
|
||||
integer*8 :: file, h5_ierror
|
||||
integer*8 :: prop
|
||||
integer*8 :: num_particles
|
||||
integer*4 :: i
|
||||
integer*4, allocatable :: data(:)
|
||||
|
||||
! initialize MPI & H5hut
|
||||
integer :: comm_rank = 0
|
||||
#if defined(PARALLEL_IO)
|
||||
integer :: comm, mpi_ierror
|
||||
comm = MPI_COMM_WORLD
|
||||
call mpi_init (mpi_ierror)
|
||||
call mpi_comm_rank (comm, comm_rank, mpi_ierror)
|
||||
#endif
|
||||
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)
|
||||
|
||||
#if defined(PARALLEL_IO)
|
||||
call mpi_finalize (mpi_ierror)
|
||||
#endif
|
||||
|
||||
end program read_core_vfd
|
||||
@@ -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"
|
||||
#include "examples.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;
|
||||
}
|
||||
@@ -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.f90'
|
||||
|
||||
program read_setnparticles
|
||||
use H5hut
|
||||
implicit none
|
||||
|
||||
#if defined(PARALLEL_IO)
|
||||
include 'mpif.h'
|
||||
#endif
|
||||
|
||||
! name of input file
|
||||
character (len=*), parameter :: fname = "example_setnparticles.h5"
|
||||
|
||||
! H5hut verbosity level
|
||||
integer*8, parameter :: h5_verbosity = H5_VERBOSE_DEFAULT
|
||||
|
||||
integer :: comm_size = 1
|
||||
integer :: comm_rank = 0
|
||||
integer*8 :: file, h5_ierror
|
||||
integer*8 :: num_particles, num_particles_total
|
||||
integer*8 :: i
|
||||
integer*4, allocatable :: data(:)
|
||||
|
||||
! initialize MPI & H5hut
|
||||
#if defined(PARALLEL_IO)
|
||||
integer :: comm, mpi_ierror
|
||||
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)
|
||||
#endif
|
||||
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)
|
||||
|
||||
#if defined(PARALLEL_IO)
|
||||
call mpi_finalize (mpi_ierror)
|
||||
#endif
|
||||
|
||||
end program read_setnparticles
|
||||
@@ -0,0 +1,77 @@
|
||||
/*
|
||||
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 "examples.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;
|
||||
}
|
||||
@@ -0,0 +1,93 @@
|
||||
!
|
||||
! 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
|
||||
#if defined(PARALLEL_IO)
|
||||
include 'mpif.h'
|
||||
#endif
|
||||
|
||||
! name of input file
|
||||
character (len=*), parameter :: fname = "example_setview.h5"
|
||||
|
||||
! H5hut verbosity level
|
||||
integer*8, parameter :: h5_verbosity = H5_VERBOSE_DEFAULT
|
||||
|
||||
integer :: comm_size = 1
|
||||
integer :: comm_rank = 0
|
||||
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
|
||||
#if defined(PARALLEL_IO)
|
||||
integer :: comm, mpi_ierror
|
||||
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)
|
||||
#endif
|
||||
|
||||
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)
|
||||
|
||||
#if defined(PARALLEL_IO)
|
||||
call mpi_finalize (mpi_ierror)
|
||||
#endif
|
||||
|
||||
end program read_setviewf
|
||||
@@ -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"
|
||||
#include "examples.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;
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
!
|
||||
! Copyright (c) 2006-2015, The Regents of the University of California,
|
||||
! through Lawrence Berkeley National Laboratory (subject to receipt of any
|
||||
! required approvals from the U.S. Dept. of Energy) and the Paul Scherrer
|
||||
! Institut (Switzerland). All rights reserved.!
|
||||
!
|
||||
! License: see file COPYING in top level of source distribution.
|
||||
!
|
||||
include 'H5hut.f90'
|
||||
|
||||
program read_stridedf
|
||||
use H5hut
|
||||
implicit none
|
||||
#if defined(PARALLEL_IO)
|
||||
include 'mpif.h'
|
||||
#endif
|
||||
|
||||
! name of input file
|
||||
character (len=*), parameter :: fname = "example_strided.h5"
|
||||
|
||||
! H5hut verbosity level
|
||||
integer*8, parameter :: h5_verbosity = H5_VERBOSE_DEFAULT
|
||||
|
||||
integer*8 :: file, h5_ierror
|
||||
integer*8 :: num_particles, num_particles_total
|
||||
real*8, allocatable :: data(:)
|
||||
integer*8 :: i, start
|
||||
|
||||
! initialize MPI & H5hut
|
||||
#if defined(PARALLEL_IO)
|
||||
integer :: comm, comm_size, comm_rank, mpi_ierror
|
||||
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)
|
||||
#else
|
||||
integer :: comm_size = 1
|
||||
integer :: comm_rank = 0
|
||||
#endif
|
||||
|
||||
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)
|
||||
|
||||
#if defined(PARALLEL_IO)
|
||||
call mpi_finalize (mpi_ierror)
|
||||
#endif
|
||||
|
||||
end program read_stridedf
|
||||
@@ -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.
|
||||
*/
|
||||
|
||||
/*
|
||||
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 "examples.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_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;
|
||||
}
|
||||
|
||||
@@ -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_core_vfd
|
||||
use H5hut
|
||||
implicit none
|
||||
|
||||
#if defined(PARALLEL_IO)
|
||||
include 'mpif.h'
|
||||
#endif
|
||||
|
||||
! 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_rank = 0
|
||||
integer*8 :: file, h5_ierror
|
||||
integer*8 :: prop
|
||||
integer*4 :: i
|
||||
integer*4, allocatable :: data(:)
|
||||
|
||||
! initialize MPI & H5hut
|
||||
#if defined(PARALLEL_IO)
|
||||
integer :: comm, mpi_ierror
|
||||
comm = MPI_COMM_WORLD
|
||||
call mpi_init (mpi_ierror)
|
||||
call mpi_comm_rank (comm, comm_rank, mpi_ierror)
|
||||
#endif
|
||||
|
||||
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)
|
||||
|
||||
#if defined(PARALLEL_IO)
|
||||
call mpi_finalize (mpi_ierror)
|
||||
#endif
|
||||
|
||||
end program write_core_vfd
|
||||
@@ -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.h"
|
||||
#include "examples.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_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;
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
!
|
||||
! 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
|
||||
|
||||
#if defined(PARALLEL_IO)
|
||||
include 'mpif.h'
|
||||
#endif
|
||||
|
||||
! 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_rank = 0
|
||||
integer*8 :: file, h5_ierror
|
||||
integer*4 :: i
|
||||
integer*4, allocatable :: data(:)
|
||||
|
||||
! initialize MPI & H5hut
|
||||
#if defined(PARALLEL_IO)
|
||||
integer :: comm, mpi_ierror
|
||||
comm = MPI_COMM_WORLD
|
||||
call mpi_init (mpi_ierror)
|
||||
call mpi_comm_rank (comm, comm_rank, mpi_ierror)
|
||||
#endif
|
||||
|
||||
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)
|
||||
|
||||
#if defined(PARALLEL_IO)
|
||||
call mpi_finalize (mpi_ierror)
|
||||
#endif
|
||||
|
||||
end program write_setnparticles
|
||||
@@ -0,0 +1,119 @@
|
||||
/*
|
||||
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 <stdlib.h>
|
||||
|
||||
#include "H5hut.h"
|
||||
#include "examples.h"
|
||||
|
||||
// name of output file
|
||||
const char* fname = "example_setview.h5";
|
||||
|
||||
// H5hut verbosity level
|
||||
const h5_int64_t h5_verbosity = H5_VERBOSE_DEFAULT;
|
||||
const h5_int64_t h5_debug_mask = 0;
|
||||
|
||||
// we are going to write multiple consecutive blocks
|
||||
//const h5_int64_t num_blocks = 32;
|
||||
//const h5_int64_t num_particles_per_block = 1048576*8;
|
||||
|
||||
int
|
||||
main (
|
||||
int argc,
|
||||
char* argv[]
|
||||
){
|
||||
if (argc < 3) {
|
||||
fprintf (stderr, "Usage: %s <number_of_blocks> <sizeof_block>\n", argv[0]);
|
||||
exit (1);
|
||||
}
|
||||
|
||||
char* endptr = NULL;
|
||||
long long n = strtoll (argv[1], &endptr, 10);
|
||||
if (*endptr != 0) {
|
||||
fprintf (stderr, "first argument (number of blocks) is not a unsigned integer!\n");
|
||||
exit (1);
|
||||
}
|
||||
if (n < 1) {
|
||||
fprintf (stderr, "first argument (number of block) must be >= 1!\n");
|
||||
exit (1);
|
||||
}
|
||||
if (n == LLONG_MAX) {
|
||||
fprintf (stderr, "first argument (number of block) to large!\n");
|
||||
exit (1);
|
||||
}
|
||||
h5_int64_t num_blocks = (h5_int64_t)n;
|
||||
n = strtoll (argv[2], &endptr, 10);
|
||||
if (*endptr != 0) {
|
||||
fprintf (stderr, "second argument (sizeof blocks) is not a unsigned integer!\n");
|
||||
exit (1);
|
||||
}
|
||||
if (n < 1024) {
|
||||
fprintf (stderr, "second argument (sizeof block) must be >= 1024!\n");
|
||||
exit (1);
|
||||
}
|
||||
if (n == LLONG_MAX) {
|
||||
fprintf (stderr, "second argument (sizeof block) to large!\n");
|
||||
exit (1);
|
||||
}
|
||||
h5_int64_t num_particles_per_block = (h5_int64_t)n;
|
||||
|
||||
// initialize MPI & H5hut
|
||||
MPI_Init (&argc, &argv);
|
||||
MPI_Comm comm = MPI_COMM_WORLD;
|
||||
int comm_rank = 0;
|
||||
MPI_Comm_rank (comm, &comm_rank);
|
||||
H5AbortOnError ();
|
||||
H5SetVerbosityLevel (h5_verbosity);
|
||||
H5SetDebugMask (h5_debug_mask);
|
||||
|
||||
h5_prop_t prop = H5CreateFileProp ();
|
||||
H5SetPropFileAlign (prop, 1048576*8);
|
||||
H5SetPropFileMPIOIndependent (prop, &comm);
|
||||
//H5SetPropFileMPIOCollective (prop, &comm);
|
||||
|
||||
// open file and create first step
|
||||
h5_file_t file = H5OpenFile (fname, H5_O_WRONLY, prop);
|
||||
//H5PartSetChunkSize (file, 1048576*1);
|
||||
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];
|
||||
h5_int64_t *data;
|
||||
data = calloc (num_particles_per_block, sizeof(*data));
|
||||
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
|
||||
H5PartWriteDataInt64 (file, "data", data);
|
||||
}
|
||||
|
||||
// done
|
||||
H5CloseFile(file);
|
||||
MPI_Finalize();
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,120 @@
|
||||
/*
|
||||
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 <stdlib.h>
|
||||
#include <mpi.h>
|
||||
|
||||
#include "H5hut.h"
|
||||
#include "examples.h"
|
||||
|
||||
// name of output file
|
||||
const char* fname = "example_setview.h5";
|
||||
|
||||
// H5hut verbosity level
|
||||
const h5_int64_t h5_verbosity = H5_VERBOSE_DEFAULT;
|
||||
const h5_int64_t h5_debug_mask = 0;
|
||||
|
||||
// we are going to write multiple consecutive blocks
|
||||
//const h5_int64_t num_blocks = 32;
|
||||
//const h5_int64_t num_particles_per_block = 1048576*8;
|
||||
|
||||
int
|
||||
main (
|
||||
int argc,
|
||||
char* argv[]
|
||||
){
|
||||
if (argc < 3) {
|
||||
fprintf (stderr, "Usage: %s <number_of_blocks> <sizeof_block>\n", argv[0]);
|
||||
exit (1);
|
||||
}
|
||||
|
||||
char* endptr = NULL;
|
||||
long long n = strtoll (argv[1], &endptr, 10);
|
||||
if (*endptr != 0) {
|
||||
fprintf (stderr, "first argument (number of blocks) is not a unsigned integer!\n");
|
||||
exit (1);
|
||||
}
|
||||
if (n < 1) {
|
||||
fprintf (stderr, "first argument (number of block) must be >= 1!\n");
|
||||
exit (1);
|
||||
}
|
||||
if (n == LLONG_MAX) {
|
||||
fprintf (stderr, "first argument (number of block) to large!\n");
|
||||
exit (1);
|
||||
}
|
||||
h5_int64_t num_blocks = (h5_int64_t)n;
|
||||
n = strtoll (argv[2], &endptr, 10);
|
||||
if (*endptr != 0) {
|
||||
fprintf (stderr, "second argument (sizeof blocks) is not a unsigned integer!\n");
|
||||
exit (1);
|
||||
}
|
||||
if (n < 1024) {
|
||||
fprintf (stderr, "second argument (sizeof block) must be >= 1024!\n");
|
||||
exit (1);
|
||||
}
|
||||
if (n == LLONG_MAX) {
|
||||
fprintf (stderr, "second argument (sizeof block) to large!\n");
|
||||
exit (1);
|
||||
}
|
||||
h5_int64_t num_particles_per_block = (h5_int64_t)n;
|
||||
|
||||
// initialize MPI & H5hut
|
||||
MPI_Init (&argc, &argv);
|
||||
MPI_Comm comm = MPI_COMM_WORLD;
|
||||
int comm_rank = 0;
|
||||
MPI_Comm_rank (comm, &comm_rank);
|
||||
H5AbortOnError ();
|
||||
H5SetVerbosityLevel (h5_verbosity);
|
||||
H5SetDebugMask (h5_debug_mask);
|
||||
|
||||
h5_prop_t prop = H5CreateFileProp ();
|
||||
H5SetPropFileAlign (prop, 1048576*8);
|
||||
H5SetPropFileMPIOIndependent (prop, &comm);
|
||||
//H5SetPropFileMPIOCollective (prop, &comm);
|
||||
|
||||
// open file and create first step
|
||||
h5_file_t file = H5OpenFile (fname, H5_O_WRONLY, prop);
|
||||
//H5PartSetChunkSize (file, 1048576*1);
|
||||
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);
|
||||
dataset_id = H5PartCreateDataSet (file, "data");
|
||||
// write multiple consecutive blocks
|
||||
for (int i = 0; i < num_blocks; i++) {
|
||||
// create fake data
|
||||
//h5_int32_t data[num_particles_per_block];
|
||||
h5_int64_t *data;
|
||||
data = calloc (num_particles_per_block, sizeof(*data));
|
||||
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
|
||||
H5PartSetViewOnDataset (
|
||||
file,
|
||||
offset + i*num_particles_per_block,
|
||||
offset + (i+1)*num_particles_per_block - 1);
|
||||
// write data
|
||||
H5PartWriteDatasetInt64 (dataset_id, data);
|
||||
}
|
||||
H5CloseDataset (dataset_id);
|
||||
// done
|
||||
H5CloseFile(file);
|
||||
MPI_Finalize();
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
!
|
||||
! 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
|
||||
|
||||
#if defined(PARALLEL_IO)
|
||||
include 'mpif.h'
|
||||
#endif
|
||||
|
||||
! 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_rank = 0
|
||||
integer*8 :: file, h5_ierror
|
||||
integer*8 :: i, j, offset
|
||||
integer*4, allocatable :: data(:)
|
||||
|
||||
! initialize MPI & H5hut
|
||||
#if defined(PARALLEL_IO)
|
||||
integer :: comm, mpi_ierror
|
||||
comm = MPI_COMM_WORLD
|
||||
call mpi_init (mpi_ierror)
|
||||
call mpi_comm_rank (comm, comm_rank, mpi_ierror)
|
||||
#endif
|
||||
|
||||
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)
|
||||
|
||||
#if defined(PARALLEL_IO)
|
||||
call mpi_finalize (mpi_ierror)
|
||||
#endif
|
||||
|
||||
end program write_setview
|
||||
@@ -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 "examples.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_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;
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
!
|
||||
! 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
|
||||
|
||||
#if defined(PARALLEL_IO)
|
||||
include 'mpif.h'
|
||||
#endif
|
||||
|
||||
! the file name we want to read
|
||||
character (len=*), parameter :: FNAME = "example_strided.h5"
|
||||
integer*8, parameter :: NPOINTS = 99
|
||||
|
||||
integer :: rank = 0
|
||||
integer*8 :: file, status
|
||||
integer*4 :: i
|
||||
real*8, allocatable :: particles(:)
|
||||
integer*8, allocatable :: id(:)
|
||||
|
||||
! init MPI & H5hut
|
||||
#if defined(PARALLEL_IO)
|
||||
integer :: comm, ierr
|
||||
comm = MPI_COMM_WORLD
|
||||
call mpi_init(ierr)
|
||||
call mpi_comm_rank(comm, rank, ierr)
|
||||
#endif
|
||||
|
||||
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)
|
||||
|
||||
#if defined(PARALLEL_IO)
|
||||
call mpi_finalize(ierr)
|
||||
#endif
|
||||
|
||||
end program write_stridedf
|
||||
@@ -0,0 +1,3 @@
|
||||
#ifndef PARALLEL_IO
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,13 @@
|
||||
#ifndef __EXAMPLES_H
|
||||
#define __EXAMPLES_H
|
||||
|
||||
#if !defined (H5_HAVE_PARALLEL)
|
||||
|
||||
#define MPI_COMM_WORLD (0)
|
||||
#define MPI_Init(argc, argv)
|
||||
#define MPI_Comm_size(comm,nprocs) {comm = 0; *nprocs = 1;}
|
||||
#define MPI_Comm_rank(comm,rank) {comm = 0; (void)(comm); *rank = 0;}
|
||||
#define MPI_Finalize()
|
||||
|
||||
#endif
|
||||
#endif
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -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 */
|
||||
@@ -1,18 +0,0 @@
|
||||
# COMPILERS
|
||||
CC = @CC@
|
||||
CXX = @CXX@
|
||||
|
||||
LIBS = @LIBS@
|
||||
AM_CPPFLAGS = -I../include @AM_CPPFLAGS@
|
||||
|
||||
OBJEXT = o
|
||||
|
||||
lib_LIBRARIES = libH5XX.a
|
||||
include_HEADERS = H5Fed.hh
|
||||
libH5XX_a_SOURCES = H5Fed.cc
|
||||
|
||||
libH5XX.a: $(libH5XX_a_OBJECTS)
|
||||
${AR} rucs $@ $^
|
||||
|
||||
%.o : %.cc
|
||||
$(CXX) $(CFLAGS) $(INC) -c $<
|
||||
-379
@@ -1,379 +0,0 @@
|
||||
/*
|
||||
Copyright 2007-2008
|
||||
Paul Scherrer Institut, Villigen, Switzerland;
|
||||
Benedikt Oswald;
|
||||
Achim Gsell
|
||||
All rights reserved.
|
||||
|
||||
Authors
|
||||
Achim Gsell
|
||||
|
||||
Warning
|
||||
This code is under development.
|
||||
|
||||
*/
|
||||
|
||||
/*!
|
||||
Some conventions:
|
||||
Functions:
|
||||
Name:
|
||||
thisIsAFunction()
|
||||
Return values:
|
||||
negative value or NULL signals an error
|
||||
|
||||
|
||||
Macros:
|
||||
UPPERCASE_WITH_UNDERSCORE
|
||||
\note
|
||||
In function names we use the words \b get and \b store insteed of
|
||||
\b read and \b write, because no I/O is actually done in these
|
||||
functions.
|
||||
*/
|
||||
|
||||
#include "h5core/h5_core.h"
|
||||
#include "H5.h"
|
||||
|
||||
/****** General routines *****************************************************/
|
||||
|
||||
/*!
|
||||
\ingroup h5hut_file
|
||||
|
||||
Open file with name \c filbename. This function is available in the parallel
|
||||
and serial version. In the serial case \c comm may have any value.
|
||||
|
||||
File mode flags are:
|
||||
- H5_O_RDONLY: only reading allowed
|
||||
- H5_O_WRONLY: create new file, dataset must not exist
|
||||
- H5_O_APPEND: allows to append a new datasets to an existing file
|
||||
- H5_O_RDWR: dataset may exist
|
||||
|
||||
You can also select a "virtual file driver" in the HDF5 layer using:
|
||||
- H5_VFD_INDEPENDENT: MPI-IO in independent (asynchronous) mode
|
||||
- H5_VFD_MPIPOSIX: parallel I/O implemented directly by HDF5, bypassing MPI-IO
|
||||
|
||||
\return File handle.
|
||||
\return NULL on error.
|
||||
*/
|
||||
h5_file_p
|
||||
H5OpenFile (
|
||||
const char* filename, /*!< file name */
|
||||
h5_int32_t flags, /*!< file open flags */
|
||||
MPI_Comm comm /*!< MPI communicator */
|
||||
) {
|
||||
H5_API_ENTER (h5_file_p, "filename='%s', flags=%d, ...",filename,flags);
|
||||
H5_API_RETURN (h5_open_file (filename, flags, comm, 0));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5hut_file
|
||||
|
||||
Close file and free all memory associated with the file handle.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
H5CloseFile (
|
||||
h5_file_t* const f /*!< file handle */
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t, "f=%p", f);
|
||||
H5_API_RETURN (h5_close_file (f));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5hut_file
|
||||
|
||||
Verify that the file handle points to a valid H5hut file structure.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
H5CheckFile (
|
||||
h5_file_t* const f /*!< file handle */
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t, "f=%p", f);
|
||||
H5_API_RETURN (h5_check_filehandle (f));
|
||||
}
|
||||
|
||||
|
||||
h5_err_t
|
||||
H5FlushStep (
|
||||
h5_file_t* const f /*!< file handle */
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t, "f=%p", f);
|
||||
H5_API_RETURN (h5_flush_step (f));
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
H5FlushFile (
|
||||
h5_file_t* const f /*!< file handle */
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t, "f=%p", f);
|
||||
H5_API_RETURN (h5_flush_file (f));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5hut_model
|
||||
|
||||
Define format of the step names.
|
||||
|
||||
Example: ==H5SetStepNameFormat( f, "Step", 6 )== defines step names
|
||||
like ==Step#000042==.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
H5SetStepNameFormat (
|
||||
h5_file_t* const f, /*!< Handle to file */
|
||||
const char* name, /*!< Prefix */
|
||||
const h5_int64_t width /*!< Width of the number */
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, name='%s', width=%lld",
|
||||
f, name, (long long) width);
|
||||
H5_API_RETURN (h5_set_stepname_fmt (f, name, width));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5hut_model
|
||||
|
||||
Get format of the step names.
|
||||
|
||||
\return value \c >=0 on success
|
||||
\return -1 on error
|
||||
*/
|
||||
h5_err_t
|
||||
H5GetStepNameFormat (
|
||||
h5_file_t* const f, /*!< Handle to file */
|
||||
char* name, /*!< OUT: Prefix */
|
||||
const h5_size_t l_name, /*!< length of buffer name */
|
||||
int* width /*!< OUT: Width of the number */
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, name=%p, l_name=%llu, width=%p",
|
||||
f, name, (unsigned long long)l_name, width);
|
||||
H5_API_RETURN (h5_get_stepname_fmt (f, name, l_name, width));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5hut_model
|
||||
|
||||
Set the current step.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
H5SetStep (
|
||||
h5_file_t* const f, /*!< [in] Handle to open file */
|
||||
const h5_id_t step /*!< [in] Step to set. */
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t, "f=%p, step=%lld", f, (long long)step);
|
||||
H5_API_RETURN (h5_set_step (f, step));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5hut_model
|
||||
|
||||
Get current step.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_id_t
|
||||
H5GetStep (
|
||||
h5_file_t* const f /*!< Handle to open file */
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t, "f=%p", f);
|
||||
H5_API_RETURN (h5_get_step (f));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5hut_file
|
||||
|
||||
Get the number of processors.
|
||||
|
||||
\param[in] f File handle.
|
||||
|
||||
\return Number of processors.
|
||||
\return \c -1 on error.
|
||||
*/
|
||||
int
|
||||
H5GetNumProcs (
|
||||
h5_file_t* const f
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t, "f=%p", f);
|
||||
H5_API_RETURN (h5_get_num_procs(f));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5hut_model
|
||||
|
||||
Get the number of time-steps that are currently stored in the file
|
||||
\c f.
|
||||
|
||||
It works for both reading and writing of files, but is probably
|
||||
only typically used when you are reading.
|
||||
|
||||
\param[in] f File handle.
|
||||
|
||||
\return number of time-steps or error code
|
||||
*/
|
||||
h5_ssize_t
|
||||
H5GetNumSteps (
|
||||
h5_file_t* const f
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t, "f=%p", f);
|
||||
H5_API_RETURN (h5_get_num_steps(f));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5_inquiry
|
||||
|
||||
Query whether a particular step already exists in the file.
|
||||
|
||||
\param[in] f File handle.
|
||||
\param[in] stepno Step number to query for existence
|
||||
|
||||
\return true or false
|
||||
*/
|
||||
h5_err_t
|
||||
H5HasStep (
|
||||
h5_file_t* const f,
|
||||
h5_id_t stepno
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, stepno=%lld",
|
||||
f, (long long)stepno);
|
||||
H5_API_RETURN (h5_has_step (f, stepno));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5hut_model
|
||||
|
||||
Start traversing steps.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
H5StartTraverseSteps (
|
||||
h5_file_t* const f /*!< Handle to open file */
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t, "f=%p", f);
|
||||
H5_API_RETURN (h5_start_traverse_steps (f));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5hut_model
|
||||
|
||||
Traverse steps.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
H5TraverseSteps (
|
||||
h5_file_t* const f /*!< Handle to open file */
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t, "f=%p", f);
|
||||
H5_API_RETURN (h5_traverse_steps (f));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5hut_file
|
||||
|
||||
Set the `throttle` factor, which causes HDF5 write and read
|
||||
calls to be issued in that number of batches.
|
||||
|
||||
This can prevent large concurrency parallel applications that
|
||||
use independent writes from overwhelming the underlying
|
||||
parallel file system.
|
||||
|
||||
Throttling only works with the H5_VFD_MPIPOSIX or
|
||||
H5_VFD_INDEPENDENT drivers and is only available in
|
||||
the parallel library.
|
||||
|
||||
\return \c H5_SUCCESS
|
||||
*/
|
||||
#ifdef PARALLEL_IO
|
||||
h5_err_t
|
||||
H5SetThrottle (
|
||||
h5_file_t* f,
|
||||
int factor
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t, "f=%p, factor=%d", f, factor);
|
||||
H5_API_RETURN (h5_set_throttle(f, factor));
|
||||
}
|
||||
#endif // PARALLEL_IO
|
||||
|
||||
/*!
|
||||
\ingroup h5hut_error
|
||||
|
||||
Set verbosity level to \c level.
|
||||
|
||||
\return \c H5_SUCCESS
|
||||
*/
|
||||
h5_err_t
|
||||
H5SetVerbosityLevel (
|
||||
const h5_id_t level
|
||||
) {
|
||||
return h5_set_debuglevel (level);
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5hut_error
|
||||
|
||||
Set error handler to \c handler.
|
||||
|
||||
\return \c H5_SUCCESS
|
||||
*/
|
||||
h5_err_t
|
||||
H5SetErrorHandler (
|
||||
h5_errorhandler_t handler
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t, "handler=%p", handler);
|
||||
H5_API_RETURN (h5_set_errorhandler (handler));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5hut_error
|
||||
|
||||
Get current error handler.
|
||||
|
||||
\return Pointer to error handler.
|
||||
*/
|
||||
h5_errorhandler_t
|
||||
H5GetErrorHandler (
|
||||
void
|
||||
) {
|
||||
H5_API_ENTER (h5_errorhandler_t, "%s", "void");
|
||||
H5_API_RETURN (h5_get_errorhandler());
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
H5ReportErrorhandler (
|
||||
const char* fmt,
|
||||
va_list ap
|
||||
) {
|
||||
return h5_report_errorhandler (fmt, ap);
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
H5AbortErrorhandler (
|
||||
const char* fmt,
|
||||
va_list ap
|
||||
) {
|
||||
return h5_abort_errorhandler (fmt, ap);
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5hut_error
|
||||
|
||||
Get last error code.
|
||||
|
||||
\return error code
|
||||
*/
|
||||
h5_err_t
|
||||
H5GetErrno (
|
||||
void
|
||||
) {
|
||||
return h5_get_errno ();
|
||||
}
|
||||
|
||||
|
||||
-676
@@ -1,676 +0,0 @@
|
||||
/*!
|
||||
\defgroup h5block_c_api H5Block C API
|
||||
*/
|
||||
|
||||
/*!
|
||||
\internal
|
||||
|
||||
\defgroup h5block_kernel H5Block Kernel
|
||||
*/
|
||||
|
||||
/*!
|
||||
\internal
|
||||
|
||||
\defgroup h5block_private H5Block Private
|
||||
*/
|
||||
|
||||
/*!
|
||||
\ingroup h5block_c_api
|
||||
\defgroup h5block_model Setting up the Data Model
|
||||
*/
|
||||
/*!
|
||||
\ingroup h5block_c_api
|
||||
\defgroup h5block_data Reading and Writing Datasets
|
||||
*/
|
||||
/*!
|
||||
\ingroup h5block_c_api
|
||||
\defgroup h5block_attrib Reading and Writing Attributes
|
||||
*/
|
||||
|
||||
/*!
|
||||
\note
|
||||
Different field sizes are allowed in the same time-step.
|
||||
|
||||
\note
|
||||
The same layout can be used, if the size of the field matches the
|
||||
size of the layout. If the size of the layout doesn't match the
|
||||
size of the field, an error will be indicated.
|
||||
|
||||
\note
|
||||
In write mode partitions are shrinked to make them non-overlaping. This
|
||||
process may shrink the partitions more than required.
|
||||
|
||||
\note
|
||||
In read-mode partitions may not cross boundaries. This means, if the grid
|
||||
size is (X, Y, Z), all partitions must fit into this grid.
|
||||
|
||||
|
||||
\todo
|
||||
check whether layout is reasonable
|
||||
|
||||
API function names
|
||||
*/
|
||||
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "H5hut.h"
|
||||
#include "h5core/h5_core.h"
|
||||
|
||||
/********************** defining the layout **********************************/
|
||||
|
||||
/*!
|
||||
\ingroup h5block_model
|
||||
|
||||
Tests whether a view has been set, either directly with
|
||||
\ref H5Block3dSetView or indirectly with \ref H5Block3dSetGrid.
|
||||
|
||||
\return 0 on false, 1 on true
|
||||
*/
|
||||
h5_int64_t
|
||||
H5Block3dHasView (
|
||||
h5_file_t *const f /*!< IN: File handle */
|
||||
) {
|
||||
H5_API_ENTER (h5_int64_t, "f=%p", f);
|
||||
H5_API_RETURN (h5b_3d_has_view (f));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5block_model
|
||||
|
||||
Defines the partition of the field that this processor owns, using
|
||||
Fortran ordering: the fastest moving index is \c i.
|
||||
|
||||
This routine uses an MPI_Allgather, so at large concurrency it should
|
||||
be called as infrequently as possible. For instance, if several timesteps
|
||||
use the same field dimensions, set the layout only once before the
|
||||
first timestep.
|
||||
|
||||
\return \c H5_SUCCESS on success
|
||||
*/
|
||||
h5_err_t
|
||||
H5Block3dSetView (
|
||||
h5_file_t *const f, /*!< IN: File handle */
|
||||
const h5_int64_t i_start, /*!< IN: start index of \c i */
|
||||
const h5_int64_t i_end, /*!< IN: end index of \c i */
|
||||
const h5_int64_t j_start, /*!< IN: start index of \c j */
|
||||
const h5_int64_t j_end, /*!< IN: end index of \c j */
|
||||
const h5_int64_t k_start, /*!< IN: start index of \c k */
|
||||
const h5_int64_t k_end /*!< IN: end index of \c k */
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, "
|
||||
"i_start=%lld, i_end=%lld, "
|
||||
"j_start=%lld, j_end=%lld, "
|
||||
"k_start=%lld, k_end=%lld",
|
||||
f,
|
||||
(long long)i_start, (long long)i_end,
|
||||
(long long)j_start, (long long)j_end,
|
||||
(long long)k_start, (long long)k_end);
|
||||
H5_API_RETURN (h5b_3d_set_view(f, i_start, i_end, j_start, j_end, k_start, k_end));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5block_model
|
||||
|
||||
Return the view of this processor.
|
||||
|
||||
\return \c H5_SUCCESS on success
|
||||
*/
|
||||
h5_err_t
|
||||
H5Block3dGetView (
|
||||
h5_file_t *const f, /*!< IN: File handle */
|
||||
h5_size_t *i_start, /*!< OUT: start index of \c i */
|
||||
h5_size_t *i_end, /*!< OUT: end index of \c i */
|
||||
h5_size_t *j_start, /*!< OUT: start index of \c j */
|
||||
h5_size_t *j_end, /*!< OUT: end index of \c j */
|
||||
h5_size_t *k_start, /*!< OUT: start index of \c k */
|
||||
h5_size_t *k_end /*!< OUT: end index of \c k */
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, "
|
||||
"i_start=%p, i_end=%p, "
|
||||
"j_start=%p, j_end=%p, "
|
||||
"k_start=%p, k_end=%p",
|
||||
f,
|
||||
i_start, i_end,
|
||||
j_start, j_end,
|
||||
k_start, k_end);
|
||||
H5_API_RETURN (h5b_3d_get_view (f, i_start, i_end, j_start, j_end, k_start, k_end));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5block_model
|
||||
|
||||
Return the reduced (ghost-zone free) view of this processor.
|
||||
|
||||
\return \c H5_SUCCESS on success
|
||||
*/
|
||||
h5_err_t
|
||||
H5Block3dGetReducedView (
|
||||
h5_file_t *const f, /*!< IN: File handle */
|
||||
h5_size_t *const i_start, /*!< OUT: start index of \c i */
|
||||
h5_size_t *const i_end, /*!< OUT: end index of \c i */
|
||||
h5_size_t *const j_start, /*!< OUT: start index of \c j */
|
||||
h5_size_t *const j_end, /*!< OUT: end index of \c j */
|
||||
h5_size_t *const k_start, /*!< OUT: start index of \c j */
|
||||
h5_size_t *const k_end /*!< OUT: end index of \c j */
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, "
|
||||
"i_start=%p, i_end=%p, "
|
||||
"j_start=%p, j_end=%p, "
|
||||
"k_start=%p, k_end=%p",
|
||||
f,
|
||||
i_start, i_end,
|
||||
j_start, j_end,
|
||||
k_start, k_end);
|
||||
H5_API_RETURN (h5b_3d_get_reduced_view(f, i_start, i_end, j_start, j_end, k_start, k_end));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5block_model
|
||||
|
||||
Define the chunk dimensions and enable chunking in the underlying
|
||||
HDF5 dataset.
|
||||
|
||||
\return \c H5_SUCCESS on success
|
||||
*/
|
||||
h5_err_t
|
||||
H5Block3dSetChunk (
|
||||
h5_file_t *const f, /*!< IN: File handle */
|
||||
const h5_size_t i, /*!< IN: size of \c i */
|
||||
const h5_size_t j, /*!< IN: size of \c j */
|
||||
const h5_size_t k /*!< IN: size of \c k */
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, i=%llu, j=%llu, k=%llu",
|
||||
f,
|
||||
(long long unsigned)i,
|
||||
(long long unsigned)j,
|
||||
(long long unsigned)k);
|
||||
H5_API_RETURN (h5b_3d_set_chunk(f, i, j, k));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5block_model
|
||||
|
||||
Lookup the chunk dimensions of the underlying HDF5 dataset.
|
||||
|
||||
\return \c H5_SUCCESS on success
|
||||
*/
|
||||
h5_err_t
|
||||
H5Block3dGetChunk (
|
||||
h5_file_t *const f, /*!< IN: File handle */
|
||||
const char *field_name, /*!< IN: name of dataset */
|
||||
h5_size_t *const i, /*!< OUT: size of \c i */
|
||||
h5_size_t *const j, /*!< OUT: size of \c j */
|
||||
h5_size_t *const k /*!< OUT: size of \c k */
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, i=%p, j=%p, k=%p",
|
||||
f, i, j, k);
|
||||
H5_API_RETURN (h5b_3d_get_chunk(f, field_name, i, j, k));
|
||||
}
|
||||
|
||||
#ifdef PARALLEL_IO
|
||||
/*!
|
||||
\ingroup h5block_model
|
||||
|
||||
Define an underlying 3D Cartesian grid on the processors with dimensions
|
||||
(\c i,\c j,\c k). You can look up a processor's index into the grid
|
||||
using \ref H5Block3dGetGridCoords.
|
||||
|
||||
This function can be used in conjunction with \ref H5Block3dSetDims
|
||||
to setup the view for a regular grid.
|
||||
|
||||
The product of the dimensions must equal the size of the MPI communicator.
|
||||
|
||||
\return \c H5_SUCCESS on success
|
||||
*/
|
||||
h5_err_t
|
||||
H5Block3dSetGrid (
|
||||
h5_file_t *const f, /*!< IN: File handle */
|
||||
const h5_size_t i, /*!< IN: dimension in \c i */
|
||||
const h5_size_t j, /*!< IN: dimension in \c j */
|
||||
const h5_size_t k /*!< IN: dimension in \c k */
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, i=%llu, j=%llu, k=%llu",
|
||||
f,
|
||||
(long long unsigned)i,
|
||||
(long long unsigned)j,
|
||||
(long long unsigned)k);
|
||||
H5_API_RETURN (h5b_3d_set_grid(f, i, j, k));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5block_model
|
||||
|
||||
Look up the index (\c i, \c j, \c k) in the grid belonging to MPI processor
|
||||
\c proc.
|
||||
|
||||
\return \c H5_SUCCESS on success
|
||||
*/
|
||||
h5_err_t
|
||||
H5Block3dGetGridCoords (
|
||||
h5_file_t *const f, /*!< IN: File handle */
|
||||
const int proc, /*!< IN: MPI processor */
|
||||
h5_int64_t *i, /*!< OUT: index in \c i */
|
||||
h5_int64_t *j, /*!< OUT: index in \c j */
|
||||
h5_int64_t *k /*!< OUT: index in \c k */
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, proc=%d, i=%p, j=%p, k=%p",
|
||||
f, proc, i, j, k);
|
||||
H5_API_RETURN (h5b_3d_get_grid_coords(f, proc, i, j, k));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5block_model
|
||||
|
||||
Set the dimensions of each processor's block when the field is a regular
|
||||
grid.
|
||||
|
||||
A grid must be already set with \ref H5Block3dSetGrid, and all processors
|
||||
must specify the same dimensions.
|
||||
|
||||
\return \c H5_SUCCESS on success
|
||||
*/
|
||||
h5_err_t
|
||||
H5Block3dSetDims (
|
||||
h5_file_t *const f, /*!< IN: File handle */
|
||||
const h5_size_t i, /*!< IN: dimension in \c i */
|
||||
const h5_size_t j, /*!< IN: dimension in \c j */
|
||||
const h5_size_t k /*!< IN: dimension in \c k */
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, i=%llu, j=%llu, k=%llu",
|
||||
f,
|
||||
(long long unsigned)i,
|
||||
(long long unsigned)j,
|
||||
(long long unsigned)k);
|
||||
H5_API_RETURN (h5b_3d_set_dims(f, i, j, k));
|
||||
}
|
||||
#endif
|
||||
|
||||
/*!
|
||||
\ingroup h5block_model
|
||||
|
||||
Sets the additional cells (\c i, \c j, \c k) in each direction to use as
|
||||
the `halo` region (or `ghost zone`) that overlaps between neighboring
|
||||
processors on the grid.
|
||||
|
||||
A grid with dimensions must already be set with \ref H5Block3dSetGrid and
|
||||
\ref H5Block3dSetDims, and all processors must specify the same halo radii.
|
||||
|
||||
\return \c H5_SUCCESS on success
|
||||
*/
|
||||
h5_err_t
|
||||
H5Block3dSetHalo (
|
||||
h5_file_t *const f, /*!< IN: File handle */
|
||||
const h5_size_t i, /*!< IN: radius in \c i */
|
||||
const h5_size_t j, /*!< IN: radius in \c j */
|
||||
const h5_size_t k /*!< IN: radius in \c k */
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, i=%llu, j=%llu, k=%llu",
|
||||
f,
|
||||
(long long unsigned)i,
|
||||
(long long unsigned)j,
|
||||
(long long unsigned)k);
|
||||
H5_API_RETURN (h5b_3d_set_halo(f, i, j, k));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5block_model
|
||||
|
||||
Query number of fields in current time step.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_ssize_t
|
||||
H5BlockGetNumFields (
|
||||
h5_file_t *const f /*!< IN: file handle */
|
||||
) {
|
||||
H5_API_ENTER (h5_ssize_t, "f=%p", f);
|
||||
H5_API_RETURN (h5b_get_num_fields(f));
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
\ingroup h5block_model
|
||||
|
||||
Get the name, rank and dimensions of the field specified by the
|
||||
index \c idx.
|
||||
|
||||
\c elem_rank reports the rank of the elements in the field
|
||||
(e.g. scalar or vector).
|
||||
|
||||
This function can be used to retrieve all fields bound to the
|
||||
current time-step by looping from \c 0 to the number of fields
|
||||
minus one. The number of fields bound to the current time-step
|
||||
can be queried by calling the function \ref H5BlockGetNumFields.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
H5BlockGetFieldInfo (
|
||||
h5_file_t *const f, /*!< IN: file handle */
|
||||
const h5_size_t idx, /*!< IN: index of field */
|
||||
char *name, /*!< OUT: field name */
|
||||
const h5_size_t len_name, /*!< IN: buffer size */
|
||||
h5_size_t *field_rank, /*!< OUT: field rank */
|
||||
h5_size_t *field_dims, /*!< OUT: field dimensions */
|
||||
h5_size_t *elem_rank, /*!< OUT: element rank */
|
||||
h5_int64_t *type /*!< OUT: datatype */
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, idx=%llu, "
|
||||
"name=%p, len_name=%llu, "
|
||||
"field_rank=%p, field_dims=%p, elem_rank=%p, type=%p",
|
||||
f, (long long unsigned)idx,
|
||||
name, (long long unsigned)len_name,
|
||||
field_rank, field_dims, elem_rank,
|
||||
type);
|
||||
H5_API_RETURN (
|
||||
h5b_get_field_info (
|
||||
f,
|
||||
idx,
|
||||
name,
|
||||
len_name,
|
||||
field_rank,
|
||||
field_dims,
|
||||
elem_rank,
|
||||
type));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5block_model
|
||||
|
||||
Get the rank and dimensions of the field specified by its name.
|
||||
See \ref H5BlockGetFieldInfo.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
H5BlockGetFieldInfoByName (
|
||||
h5_file_t *const f, /*!< IN: file handle */
|
||||
const char *name, /*!< IN: field name */
|
||||
h5_size_t *field_rank, /*!< OUT: field rank */
|
||||
h5_size_t *field_dims, /*!< OUT: field dimensions */
|
||||
h5_size_t *elem_rank, /*!< OUT: element rank */
|
||||
h5_int64_t *type /*!< OUT: datatype */
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, name='%s', "
|
||||
"field_rank=%p, field_dims=%p, elem_rank=%p, type=%p",
|
||||
f, name, field_rank, field_dims, elem_rank, type);
|
||||
H5_API_RETURN (
|
||||
h5b_get_field_info_by_name (
|
||||
f,
|
||||
name,
|
||||
field_rank,
|
||||
field_dims,
|
||||
elem_rank,
|
||||
type));
|
||||
}
|
||||
|
||||
/********************** reading and writing attribute ************************/
|
||||
|
||||
/*!
|
||||
\ingroup h5block_attrib
|
||||
|
||||
Write the string \c value as attribute \c attrib_name of field
|
||||
\c field_name.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
H5BlockWriteFieldAttribString (
|
||||
h5_file_t *const f, /*!< IN: file handle */
|
||||
const char *field_name, /*!< IN: field name */
|
||||
const char *attrib_name, /*!< IN: attribute name */
|
||||
const char *buffer /*!< IN: attribute value */
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, "
|
||||
"field_name='%s', "
|
||||
"attrib_name='%s', "
|
||||
"buffer='%s'",
|
||||
f,
|
||||
field_name,
|
||||
attrib_name,
|
||||
buffer);
|
||||
H5_API_RETURN (
|
||||
h5_write_field_attrib (
|
||||
f,
|
||||
field_name,
|
||||
attrib_name,
|
||||
H5T_NATIVE_CHAR,
|
||||
buffer,
|
||||
strlen(buffer) + 1));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5block_attrib
|
||||
|
||||
Read the string value from attribute \c attrib_name of field
|
||||
\c field_name into a \c buffer.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
H5BlockReadFieldAttribString (
|
||||
h5_file_t *const f, /*!< IN: file handle */
|
||||
const char *field_name, /*!< IN: field name */
|
||||
const char *attrib_name, /*!< IN: attribute name */
|
||||
char *buffer /*!< OUT: attribute value */
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, "
|
||||
"field_name='%s', "
|
||||
"attrib_name='%s', "
|
||||
"buffer=%p",
|
||||
f,
|
||||
field_name,
|
||||
attrib_name,
|
||||
buffer);
|
||||
H5_API_RETURN (
|
||||
h5_read_field_attrib (
|
||||
f,
|
||||
field_name,
|
||||
attrib_name,
|
||||
H5_STRING_T,
|
||||
(void*)buffer));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5block_attrib
|
||||
|
||||
Query the number of attributes of field \c field_name.
|
||||
|
||||
\return number of attributes or error code
|
||||
*/
|
||||
h5_ssize_t
|
||||
H5BlockGetNumFieldAttribs (
|
||||
h5_file_t *const f, /*<! IN: file handle */
|
||||
const char *field_name /*<! IN: field name */
|
||||
) {
|
||||
H5_API_ENTER (h5_ssize_t, "f=%p, field_name='%s'", f, field_name);
|
||||
H5_API_RETURN (h5b_get_num_field_attribs (f, field_name));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5block_attrib
|
||||
|
||||
Gets the name, type and number of elements of the field attribute
|
||||
specified by its index.
|
||||
|
||||
This function can be used to retrieve all attributes bound to the
|
||||
specified field by looping from \c 0 to the number of attribute
|
||||
minus one. The number of attributes bound to the
|
||||
field can be queried by calling \ref H5BlockGetNumFieldAttribs.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
H5BlockGetFieldAttribInfo (
|
||||
h5_file_t *const f, /*<! IN: Handle to open file */
|
||||
const char *field_name, /*<! IN: field name */
|
||||
const h5_size_t attrib_idx, /*<! IN: Index of attribute to
|
||||
get infos about */
|
||||
char *attrib_name, /*<! OUT: Name of attribute */
|
||||
const h5_size_t len_attrib_name,
|
||||
/*<! IN: length of buffer \c name */
|
||||
h5_int64_t *attrib_type, /*<! OUT: Type of value. */
|
||||
h5_size_t *attrib_nelem /*<! OUT: Number of elements */
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p field_name='%s', "
|
||||
"attrib_idx=%llu, "
|
||||
"attrib_name=%p, len_attrib_name=%llu, "
|
||||
"attrib_type=%p, "
|
||||
"attrib_nelem=%p",
|
||||
f,
|
||||
field_name,
|
||||
(long long unsigned)attrib_idx,
|
||||
attrib_name, (long long unsigned)len_attrib_name,
|
||||
attrib_type,
|
||||
attrib_nelem);
|
||||
H5_API_RETURN (
|
||||
h5b_get_field_attrib_info (
|
||||
f,
|
||||
field_name,
|
||||
attrib_idx,
|
||||
attrib_name,
|
||||
len_attrib_name,
|
||||
attrib_type,
|
||||
attrib_nelem));
|
||||
}
|
||||
|
||||
#define H5BLOCK_FIELD_ORIGIN_NAME "__Origin__"
|
||||
#define H5BLOCK_FIELD_SPACING_NAME "__Spacing__"
|
||||
|
||||
/*!
|
||||
\ingroup h5block_c_api
|
||||
|
||||
Get field origin.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
H5Block3dGetFieldOrigin (
|
||||
h5_file_t *f, /*!< IN: file handle */
|
||||
const char *field_name, /*!< IN: field name */
|
||||
h5_float64_t *x_origin, /*!< OUT: X origin */
|
||||
h5_float64_t *y_origin, /*!< OUT: Y origin */
|
||||
h5_float64_t *z_origin /*!< OUT: Z origin */
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, field_name='%s', x_origin=%p, y_origin=%p, z_origin=%p",
|
||||
f, field_name, x_origin, y_origin, z_origin);
|
||||
h5_float64_t origin[3];
|
||||
|
||||
TRY (h5_read_field_attrib (
|
||||
f,
|
||||
field_name,
|
||||
H5BLOCK_FIELD_ORIGIN_NAME,
|
||||
H5_FLOAT64_T,
|
||||
origin));
|
||||
|
||||
*x_origin = origin[0];
|
||||
*y_origin = origin[1];
|
||||
*z_origin = origin[2];
|
||||
|
||||
H5_API_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5block_c_api
|
||||
|
||||
Set field origin.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
H5Block3dSetFieldOrigin (
|
||||
h5_file_t *f, /*!< IN: file handle */
|
||||
const char *field_name, /*!< IN: field name */
|
||||
const h5_float64_t x_origin, /*!< IN: X origin */
|
||||
const h5_float64_t y_origin, /*!< IN: Y origin */
|
||||
const h5_float64_t z_origin /*!< IN: Z origin */
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, field_name='%s', x_origin=%g, y_origin=%g, z_origin=%g",
|
||||
f, field_name, x_origin, y_origin, z_origin);
|
||||
h5_float64_t origin[3] = { x_origin, y_origin, z_origin };
|
||||
H5_API_RETURN (h5_write_field_attrib (
|
||||
f,
|
||||
field_name,
|
||||
H5BLOCK_FIELD_ORIGIN_NAME,
|
||||
(hid_t)H5_FLOAT64_T,
|
||||
origin,
|
||||
3));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5block_c_api
|
||||
|
||||
Get field spacing for field \c field_name in the current time step.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
H5Block3dGetFieldSpacing (
|
||||
h5_file_t *f, /*!< IN: file handle */
|
||||
const char *field_name, /*!< IN: field name */
|
||||
h5_float64_t *x_spacing, /*!< OUT: X spacing */
|
||||
h5_float64_t *y_spacing, /*!< OUT: Y spacing */
|
||||
h5_float64_t *z_spacing /*!< OUT: Z spacing */
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, field_name='%s', x_spacing=%p, y_spacing=%p, z_spacing=%p",
|
||||
f, field_name, x_spacing, y_spacing, z_spacing);
|
||||
h5_float64_t spacing[3];
|
||||
TRY (h5_read_field_attrib (
|
||||
f,
|
||||
field_name,
|
||||
H5BLOCK_FIELD_SPACING_NAME,
|
||||
H5_FLOAT64_T,
|
||||
spacing));
|
||||
*x_spacing = spacing[0];
|
||||
*y_spacing = spacing[1];
|
||||
*z_spacing = spacing[2];
|
||||
H5_API_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5block_c_api
|
||||
|
||||
Set field spacing for field \c field_name in the current time step.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
H5Block3dSetFieldSpacing (
|
||||
h5_file_t *f, /*!< IN: file handle */
|
||||
const char *field_name, /*!< IN: field name */
|
||||
const h5_float64_t x_spacing, /*!< IN: X spacing */
|
||||
const h5_float64_t y_spacing, /*!< IN: Y spacing */
|
||||
const h5_float64_t z_spacing /*!< IN: Z spacing */
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, field_name='%s', x_spacing=%g, y_spacing=%g, z_spacing=%g",
|
||||
f, field_name, x_spacing, y_spacing, z_spacing);
|
||||
h5_float64_t spacing[3] = { x_spacing, y_spacing, z_spacing };
|
||||
H5_API_RETURN (h5_write_field_attrib (
|
||||
f,
|
||||
field_name,
|
||||
H5BLOCK_FIELD_SPACING_NAME,
|
||||
(hid_t)H5_FLOAT64_T,
|
||||
spacing,
|
||||
3));
|
||||
}
|
||||
|
||||
@@ -1,625 +0,0 @@
|
||||
|
||||
#include "h5core/h5_core.h"
|
||||
#include "H5Block_readwrite.h"
|
||||
|
||||
/*!
|
||||
\ingroup h5block_data
|
||||
|
||||
Write a 3-dimensional field \c name from the buffer starting at \c data
|
||||
to the current time-step using the defined field layout. Values are
|
||||
floating points (64-bit).
|
||||
|
||||
You must use the Fortran indexing scheme to access items in \c data.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
H5Block3dWriteScalarFieldFloat64 (
|
||||
h5_file_t *const f, /*!< IN: file handle */
|
||||
const char *name, /*!< IN: name of dataset to write */
|
||||
const h5_float64_t *buffer /*!< IN: pointer to write buffer */
|
||||
) {
|
||||
|
||||
H5_API_ENTER (h5_err_t, "f=%p, name='%s', buffer=%p", f, name, buffer);
|
||||
H5_API_RETURN (h5b_write_scalar_data(f, name, (void*)buffer, H5T_NATIVE_DOUBLE ));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5block_data
|
||||
|
||||
Read a 3-dimensional field \c name into the buffer starting at \c data from
|
||||
the current time-step using the defined field layout. Values are
|
||||
floating points (64-bit).
|
||||
|
||||
You must use the Fortran indexing scheme to access items in \c data.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
H5Block3dReadScalarFieldFloat64 (
|
||||
h5_file_t *const f, /*!< IN: file handle */
|
||||
const char *name, /*!< IN: name of dataset to read */
|
||||
h5_float64_t *buffer /*!< OUT: pointer to read buffer */
|
||||
) {
|
||||
|
||||
H5_API_ENTER (h5_err_t, "f=%p, name='%s', buffer=%p", f, name, buffer);
|
||||
H5_API_RETURN (h5b_read_scalar_data(f, name, (void*)buffer, H5T_NATIVE_DOUBLE));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5block_data
|
||||
*/
|
||||
/*!
|
||||
Write a 3-dimensional field \c name with 3-dimensional vectors as values
|
||||
from the buffers starting at \c x_buf, \c y_buf and \c z_buf to the
|
||||
current time-step using the defined field layout. Values are 3-dimensional
|
||||
vectors with floating points (64-bit) values.
|
||||
|
||||
You must use the Fortran indexing scheme to access items in \c x_buf.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
H5Block3dWriteVector3dFieldFloat64 (
|
||||
h5_file_t *const f, /*!< IN: file handle */
|
||||
const char *name, /*!< IN: name of dataset to write */
|
||||
const h5_float64_t *x_buf, /*!< IN: pointer to X axis buffer */
|
||||
const h5_float64_t *y_buf, /*!< IN: pointer to Y axis buffer */
|
||||
const h5_float64_t *z_buf /*!< IN: pointer to Z axis buffer */
|
||||
) {
|
||||
|
||||
H5_API_ENTER (h5_err_t, "f=%p, name='%s', x_buf=%p, y_buf=%p, z_buf=%p",
|
||||
f, name, x_buf, y_buf, z_buf);
|
||||
H5_API_RETURN(h5b_write_vector3d_data(f, name,
|
||||
(void*)x_buf, (void*)y_buf, (void*)z_buf, H5T_NATIVE_DOUBLE));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5block_data
|
||||
*/
|
||||
/*!
|
||||
Read a 3-dimensional field \c name with 3-dimensional vectors as values
|
||||
from the buffers starting at \c x_buf, \c y_buf and \c z_buf to the
|
||||
current time-step using the defined field layout. Values are 3-dimensional
|
||||
vectors with floating points (64-bit) values.
|
||||
|
||||
You must use the Fortran indexing scheme to access items in \c data.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
H5Block3dReadVector3dFieldFloat64 (
|
||||
h5_file_t *const f, /*!< IN: file handle */
|
||||
const char *name, /*!< IN: name of dataset to write */
|
||||
h5_float64_t *const x_buf, /*!< OUT: pointer to X axis buffer */
|
||||
h5_float64_t *const y_buf, /*!< OUT: pointer to Y axis buffer */
|
||||
h5_float64_t *const z_buf /*!< OUT: pointer to Z axis buffer */
|
||||
) {
|
||||
|
||||
H5_API_ENTER (h5_err_t, "f=%p, name='%s', x_buf=%p, y_buf=%p, z_buf=%p",
|
||||
f, name, x_buf, y_buf, z_buf);
|
||||
H5_API_RETURN(h5b_read_vector3d_data(f, name,
|
||||
x_buf, y_buf, z_buf, H5T_NATIVE_DOUBLE));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5block_data
|
||||
|
||||
Write a 3-dimensional field \c name from the buffer starting at \c data
|
||||
to the current time-step using the defined field layout. Values are
|
||||
floating points (32-bit).
|
||||
|
||||
You must use the Fortran indexing scheme to access items in \c data.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
H5Block3dWriteScalarFieldFloat32 (
|
||||
h5_file_t *const f, /*!< IN: file handle */
|
||||
const char *name, /*!< IN: name of dataset to write */
|
||||
const h5_float32_t *buffer /*!< IN: pointer to write buffer */
|
||||
) {
|
||||
|
||||
H5_API_ENTER (h5_err_t, "f=%p, name='%s', buffer=%p", f, name, buffer);
|
||||
H5_API_RETURN (h5b_write_scalar_data(f, name, buffer, H5T_NATIVE_FLOAT ));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5block_data
|
||||
|
||||
Read a 3-dimensional field \c name into the buffer starting at \c data from
|
||||
the current time-step using the defined field layout. Values are
|
||||
floating points (32-bit).
|
||||
|
||||
You must use the Fortran indexing scheme to access items in \c data.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
H5Block3dReadScalarFieldFloat32 (
|
||||
h5_file_t *const f, /*!< IN: file handle */
|
||||
const char *name, /*!< IN: name of dataset to read */
|
||||
h5_float32_t *const buffer /*!< OUT: pointer to read buffer */
|
||||
) {
|
||||
|
||||
H5_API_ENTER (h5_err_t, "f=%p, name='%s', buffer=%p", f, name, buffer);
|
||||
H5_API_RETURN (h5b_read_scalar_data(f, name, buffer, H5T_NATIVE_FLOAT));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5block_data
|
||||
*/
|
||||
/*!
|
||||
Write a 3-dimensional field \c name with 3-dimensional vectors as values
|
||||
from the buffers starting at \c x_buf, \c y_buf and \c z_buf to the
|
||||
current time-step using the defined field layout. Values are 3-dimensional
|
||||
vectors with floating points (32-bit) values.
|
||||
|
||||
You must use the Fortran indexing scheme to access items in \c x_buf.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
H5Block3dWriteVector3dFieldFloat32 (
|
||||
h5_file_t *const f, /*!< IN: file handle */
|
||||
const char *name, /*!< IN: name of dataset to write */
|
||||
const h5_float32_t *x_buf, /*!< IN: pointer to X axis buffer */
|
||||
const h5_float32_t *y_buf, /*!< IN: pointer to Y axis buffer */
|
||||
const h5_float32_t *z_buf /*!< IN: pointer to Z axis buffer */
|
||||
) {
|
||||
|
||||
H5_API_ENTER (h5_err_t, "f=%p, name='%s', x_buf=%p, y_buf=%p, z_buf=%p",
|
||||
f, name, x_buf, y_buf, z_buf);
|
||||
H5_API_RETURN(h5b_write_vector3d_data(f, name,
|
||||
x_buf, y_buf, z_buf, H5T_NATIVE_FLOAT));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5block_data
|
||||
*/
|
||||
/*!
|
||||
Read a 3-dimensional field \c name with 3-dimensional vectors as values
|
||||
from the buffers starting at \c x_buf, \c y_buf and \c z_buf to the
|
||||
current time-step using the defined field layout. Values are 3-dimensional
|
||||
vectors with floating points (32-bit) values.
|
||||
|
||||
You must use the Fortran indexing scheme to access items in \c data.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
H5Block3dReadVector3dFieldFloat32 (
|
||||
h5_file_t *const f, /*!< IN: file handle */
|
||||
const char *name, /*!< IN: name of dataset to write */
|
||||
h5_float32_t *const x_buf, /*!< OUT: pointer to X axis buffer */
|
||||
h5_float32_t *const y_buf, /*!< OUT: pointer to Y axis buffer */
|
||||
h5_float32_t *const z_buf /*!< OUT: pointer to Z axis buffer */
|
||||
) {
|
||||
|
||||
H5_API_ENTER (h5_err_t, "f=%p, name='%s', x_buf=%p, y_buf=%p, z_buf=%p",
|
||||
f, name, x_buf, y_buf, z_buf);
|
||||
H5_API_RETURN(h5b_read_vector3d_data(f, name,
|
||||
x_buf, y_buf, z_buf, H5T_NATIVE_FLOAT));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5block_data
|
||||
|
||||
Write a 3-dimensional field \c name from the buffer starting at \c data
|
||||
to the current time-step using the defined field layout. Values are
|
||||
integers (64-bit).
|
||||
|
||||
You must use the Fortran indexing scheme to access items in \c data.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
H5Block3dWriteScalarFieldInt64 (
|
||||
h5_file_t *const f, /*!< IN: file handle */
|
||||
const char *name, /*!< IN: name of dataset to write */
|
||||
const h5_int64_t *buffer /*!< IN: pointer to write buffer */
|
||||
) {
|
||||
|
||||
H5_API_ENTER (h5_err_t, "f=%p, name='%s', buffer=%p", f, name, buffer);
|
||||
H5_API_RETURN (h5b_write_scalar_data(f, name, buffer, H5T_NATIVE_INT64 ));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5block_data
|
||||
|
||||
Read a 3-dimensional field \c name into the buffer starting at \c data from
|
||||
the current time-step using the defined field layout. Values are
|
||||
integers (64-bit).
|
||||
|
||||
You must use the Fortran indexing scheme to access items in \c data.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
H5Block3dReadScalarFieldInt64 (
|
||||
h5_file_t *const f, /*!< IN: file handle */
|
||||
const char *name, /*!< IN: name of dataset to read */
|
||||
h5_int64_t *const buffer /*!< OUT: pointer to read buffer */
|
||||
) {
|
||||
|
||||
H5_API_ENTER (h5_err_t, "f=%p, name='%s', buffer=%p", f, name, buffer);
|
||||
H5_API_RETURN (h5b_read_scalar_data(f, name, buffer, H5T_NATIVE_INT64));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5block_data
|
||||
*/
|
||||
/*!
|
||||
Write a 3-dimensional field \c name with 3-dimensional vectors as values
|
||||
from the buffers starting at \c x_buf, \c y_buf and \c z_buf to the
|
||||
current time-step using the defined field layout. Values are 3-dimensional
|
||||
vectors with integers (64-bit) values.
|
||||
|
||||
You must use the Fortran indexing scheme to access items in \c x_buf.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
H5Block3dWriteVector3dFieldInt64 (
|
||||
h5_file_t *const f, /*!< IN: file handle */
|
||||
const char *name, /*!< IN: name of dataset to write */
|
||||
const h5_int64_t *x_buf, /*!< IN: pointer to X axis buffer */
|
||||
const h5_int64_t *y_buf, /*!< IN: pointer to Y axis buffer */
|
||||
const h5_int64_t *z_buf /*!< IN: pointer to Z axis buffer */
|
||||
) {
|
||||
|
||||
H5_API_ENTER (h5_err_t, "f=%p, name='%s', x_buf=%p, y_buf=%p, z_buf=%p",
|
||||
f, name, x_buf, y_buf, z_buf);
|
||||
H5_API_RETURN (h5b_write_vector3d_data(f, name,
|
||||
x_buf, y_buf, z_buf, H5T_NATIVE_INT64));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5block_data
|
||||
*/
|
||||
/*!
|
||||
Read a 3-dimensional field \c name with 3-dimensional vectors as values
|
||||
from the buffers starting at \c x_buf, \c y_buf and \c z_buf to the
|
||||
current time-step using the defined field layout. Values are 3-dimensional
|
||||
vectors with integers (64-bit) values.
|
||||
|
||||
You must use the Fortran indexing scheme to access items in \c data.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
H5Block3dReadVector3dFieldInt64 (
|
||||
h5_file_t *const f, /*!< IN: file handle */
|
||||
const char *name, /*!< IN: name of dataset to write */
|
||||
h5_int64_t *const x_buf, /*!< OUT: pointer to X axis buffer */
|
||||
h5_int64_t *const y_buf, /*!< OUT: pointer to Y axis buffer */
|
||||
h5_int64_t *const z_buf /*!< OUT: pointer to Z axis buffer */
|
||||
) {
|
||||
|
||||
H5_API_ENTER (h5_err_t, "f=%p, name='%s', x_buf=%p, y_buf=%p, z_buf=%p",
|
||||
f, name, x_buf, y_buf, z_buf);
|
||||
H5_API_RETURN (h5b_read_vector3d_data(f, name,
|
||||
x_buf, y_buf, z_buf, H5T_NATIVE_INT64));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5block_data
|
||||
|
||||
Write a 3-dimensional field \c name from the buffer starting at \c data
|
||||
to the current time-step using the defined field layout. Values are
|
||||
integers (32-bit).
|
||||
|
||||
You must use the Fortran indexing scheme to access items in \c data.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
H5Block3dWriteScalarFieldInt32 (
|
||||
h5_file_t *const f, /*!< IN: file handle */
|
||||
const char *name, /*!< IN: name of dataset to write */
|
||||
const h5_int32_t *buffer /*!< IN: pointer to write buffer */
|
||||
) {
|
||||
|
||||
H5_API_ENTER (h5_err_t, "f=%p, name='%s', buffer=%p", f, name, buffer);
|
||||
H5_API_RETURN (h5b_write_scalar_data(f, name, buffer, H5T_NATIVE_INT32 ));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5block_data
|
||||
|
||||
Read a 3-dimensional field \c name into the buffer starting at \c data from
|
||||
the current time-step using the defined field layout. Values are
|
||||
integers (32-bit).
|
||||
|
||||
You must use the Fortran indexing scheme to access items in \c data.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
H5Block3dReadScalarFieldInt32 (
|
||||
h5_file_t *const f, /*!< IN: file handle */
|
||||
const char *name, /*!< IN: name of dataset to read */
|
||||
h5_int32_t *const buffer /*!< OUT: pointer to read buffer */
|
||||
) {
|
||||
|
||||
H5_API_ENTER (h5_err_t, "f=%p, name='%s', buffer=%p", f, name, buffer);
|
||||
H5_API_RETURN (h5b_read_scalar_data(f, name, buffer, H5T_NATIVE_INT32));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5block_data
|
||||
*/
|
||||
/*!
|
||||
Write a 3-dimensional field \c name with 3-dimensional vectors as values
|
||||
from the buffers starting at \c x_buf, \c y_buf and \c z_buf to the
|
||||
current time-step using the defined field layout. Values are 3-dimensional
|
||||
vectors with integers (32-bit) values.
|
||||
|
||||
You must use the Fortran indexing scheme to access items in \c x_buf.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
H5Block3dWriteVector3dFieldInt32 (
|
||||
h5_file_t *const f, /*!< IN: file handle */
|
||||
const char *name, /*!< IN: name of dataset to write */
|
||||
const h5_int32_t *x_buf, /*!< IN: pointer to X axis buffer */
|
||||
const h5_int32_t *y_buf, /*!< IN: pointer to Y axis buffer */
|
||||
const h5_int32_t *z_buf /*!< IN: pointer to Z axis buffer */
|
||||
) {
|
||||
|
||||
H5_API_ENTER (h5_err_t, "f=%p, name='%s', x_buf=%p, y_buf=%p, z_buf=%p",
|
||||
f, name, x_buf, y_buf, z_buf);
|
||||
H5_API_RETURN(h5b_write_vector3d_data(f, name,
|
||||
x_buf, y_buf, z_buf, H5T_NATIVE_INT32));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5block_data
|
||||
*/
|
||||
/*!
|
||||
Read a 3-dimensional field \c name with 3-dimensional vectors as values
|
||||
from the buffers starting at \c x_buf, \c y_buf and \c z_buf to the
|
||||
current time-step using the defined field layout. Values are 3-dimensional
|
||||
vectors with integers (32-bit) values.
|
||||
|
||||
You must use the Fortran indexing scheme to access items in \c data.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
H5Block3dReadVector3dFieldInt32 (
|
||||
h5_file_t *const f, /*!< IN: file handle */
|
||||
const char *name, /*!< IN: name of dataset to write */
|
||||
h5_int32_t *const x_buf, /*!< OUT: pointer to X axis buffer */
|
||||
h5_int32_t *const y_buf, /*!< OUT: pointer to Y axis buffer */
|
||||
h5_int32_t *const z_buf /*!< OUT: pointer to Z axis buffer */
|
||||
) {
|
||||
|
||||
H5_API_ENTER (h5_err_t, "f=%p, name='%s', x_buf=%p, y_buf=%p, z_buf=%p",
|
||||
f, name, x_buf, y_buf, z_buf);
|
||||
H5_API_RETURN(h5b_read_vector3d_data(f, name,
|
||||
x_buf, y_buf, z_buf, H5T_NATIVE_INT32));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5block_attrib
|
||||
|
||||
Write float64 \c values as attribute \c attrib_name of field
|
||||
\c field_name.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
H5BlockWriteFieldAttribFloat64 (
|
||||
h5_file_t *const f, /*!< IN: file handle */
|
||||
const char *field_name, /*!< IN: field name */
|
||||
const char *attrib_name, /*!< IN: attribute name */
|
||||
const h5_float64_t *buffer, /*!< IN: attribute values */
|
||||
const h5_size_t nelems /*!< IN: number of elements */
|
||||
) {
|
||||
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, field_name='%s', attrib_name='%s', "
|
||||
"buffer=%p, nelems=%lld",
|
||||
f, field_name, attrib_name, buffer, (long long)nelems);
|
||||
H5_API_RETURN (h5_write_field_attrib (
|
||||
f,
|
||||
field_name,
|
||||
attrib_name,
|
||||
H5T_NATIVE_DOUBLE,
|
||||
buffer,
|
||||
nelems ));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5block_attrib
|
||||
|
||||
Read float64 values from attribute \c attrib_name of field
|
||||
\c field_name into a \c buffer.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
H5BlockReadFieldAttribFloat64 (
|
||||
h5_file_t *const f, /*!< IN: file handle */
|
||||
const char *field_name, /*!< IN: field name */
|
||||
const char *attrib_name, /*!< IN: attribute name */
|
||||
h5_float64_t *buffer /*!< OUT: attribute values */
|
||||
) {
|
||||
|
||||
H5_API_ENTER (h5_err_t, "f=%p, field_name='%s', attrib_name='%s', buffer=%p",
|
||||
f, field_name, attrib_name, buffer);
|
||||
H5_API_RETURN (h5_read_field_attrib (
|
||||
f,
|
||||
field_name,
|
||||
attrib_name,
|
||||
H5T_NATIVE_DOUBLE,
|
||||
(void*)buffer ));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5block_attrib
|
||||
|
||||
Write float32 \c values as attribute \c attrib_name of field
|
||||
\c field_name.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
H5BlockWriteFieldAttribFloat32 (
|
||||
h5_file_t *const f, /*!< IN: file handle */
|
||||
const char *field_name, /*!< IN: field name */
|
||||
const char *attrib_name, /*!< IN: attribute name */
|
||||
const h5_float32_t *buffer, /*!< IN: attribute values */
|
||||
const h5_size_t nelems /*!< IN: number of elements */
|
||||
) {
|
||||
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, field_name='%s', attrib_name='%s', "
|
||||
"buffer=%p, nelems=%lld",
|
||||
f, field_name, attrib_name, buffer, (long long)nelems);
|
||||
H5_API_RETURN (h5_write_field_attrib (
|
||||
f,
|
||||
field_name,
|
||||
attrib_name,
|
||||
H5T_NATIVE_FLOAT,
|
||||
buffer,
|
||||
nelems ));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5block_attrib
|
||||
|
||||
Read float32 values from attribute \c attrib_name of field
|
||||
\c field_name into a \c buffer.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
H5BlockReadFieldAttribFloat32 (
|
||||
h5_file_t *const f, /*!< IN: file handle */
|
||||
const char *field_name, /*!< IN: field name */
|
||||
const char *attrib_name, /*!< IN: attribute name */
|
||||
h5_float32_t *const buffer /*!< OUT: attribute values */
|
||||
) {
|
||||
|
||||
H5_API_ENTER (h5_err_t, "f=%p, field_name='%s', attrib_name='%s', buffer=%p",
|
||||
f, field_name, attrib_name, buffer);
|
||||
H5_API_RETURN (h5_read_field_attrib (
|
||||
f,
|
||||
field_name,
|
||||
attrib_name,
|
||||
H5T_NATIVE_FLOAT,
|
||||
buffer ));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5block_attrib
|
||||
|
||||
Write int64 \c values as attribute \c attrib_name of field
|
||||
\c field_name.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
H5BlockWriteFieldAttribInt64 (
|
||||
h5_file_t *const f, /*!< IN: file handle */
|
||||
const char *field_name, /*!< IN: field name */
|
||||
const char *attrib_name, /*!< IN: attribute name */
|
||||
const h5_int64_t *buffer, /*!< IN: attribute values */
|
||||
const h5_size_t nelems /*!< IN: number of elements */
|
||||
) {
|
||||
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, field_name='%s', attrib_name='%s', buffer=%p, nelems=%lld",
|
||||
f, field_name, attrib_name, buffer, (long long)nelems);
|
||||
H5_API_RETURN (h5_write_field_attrib (
|
||||
f,
|
||||
field_name,
|
||||
attrib_name,
|
||||
H5T_NATIVE_INT64,
|
||||
buffer,
|
||||
nelems ));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5block_attrib
|
||||
|
||||
Read int64 values from attribute \c attrib_name of field
|
||||
\c field_name into a \c buffer.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
H5BlockReadFieldAttribInt64 (
|
||||
h5_file_t *const f, /*!< IN: file handle */
|
||||
const char *field_name, /*!< IN: field name */
|
||||
const char *attrib_name, /*!< IN: attribute name */
|
||||
h5_int64_t *const buffer /*!< OUT: attribute values */
|
||||
) {
|
||||
|
||||
H5_API_ENTER (h5_err_t, "f=%p, field_name='%s', attrib_name='%s', buffer=%p",
|
||||
f, field_name, attrib_name, buffer);
|
||||
H5_API_RETURN (h5_read_field_attrib (
|
||||
f,
|
||||
field_name,
|
||||
attrib_name,
|
||||
H5T_NATIVE_INT64,
|
||||
buffer ));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5block_attrib
|
||||
|
||||
Write int32 \c values as attribute \c attrib_name of field
|
||||
\c field_name.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
H5BlockWriteFieldAttribInt32 (
|
||||
h5_file_t *const f, /*!< IN: file handle */
|
||||
const char *field_name, /*!< IN: field name */
|
||||
const char *attrib_name, /*!< IN: attribute name */
|
||||
const h5_int32_t *buffer, /*!< IN: attribute values */
|
||||
const h5_size_t nelems /*!< IN: number of elements */
|
||||
) {
|
||||
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, field_name='%s', attrib_name='%s', "
|
||||
"buffer=%p, nelems=%lld",
|
||||
f, field_name, attrib_name, buffer, (long long)nelems);
|
||||
H5_API_RETURN (h5_write_field_attrib (
|
||||
f,
|
||||
field_name,
|
||||
attrib_name,
|
||||
H5T_NATIVE_INT32,
|
||||
buffer,
|
||||
nelems ));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5block_attrib
|
||||
|
||||
Read int32 values from attribute \c attrib_name of field
|
||||
\c field_name into a \c buffer.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
H5BlockReadFieldAttribInt32 (
|
||||
h5_file_t *const f, /*!< IN: file handle */
|
||||
const char *field_name, /*!< IN: field name */
|
||||
const char *attrib_name, /*!< IN: attribute name */
|
||||
h5_int32_t *buffer /*!< OUT: attribute values */
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t, "f=%p, field_name='%s', attrib_name='%s', buffer=%p",
|
||||
f, field_name, attrib_name, buffer);
|
||||
H5_API_RETURN (h5_read_field_attrib (
|
||||
f,
|
||||
field_name,
|
||||
attrib_name,
|
||||
H5T_NATIVE_INT32,
|
||||
(void*)buffer ));
|
||||
}
|
||||
-604
@@ -1,604 +0,0 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdarg.h> /* va_arg - System dependent ?! */
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <hdf5.h>
|
||||
|
||||
#ifndef WIN32
|
||||
#include <unistd.h>
|
||||
#else /* WIN32 */
|
||||
#include <io.h>
|
||||
#define open _open
|
||||
#define close _close
|
||||
#endif /* WIN32 */
|
||||
|
||||
#include "h5core/h5_core.h"
|
||||
#include "H5Part.h"
|
||||
|
||||
/*!
|
||||
\ingroup h5part_model
|
||||
|
||||
Set the number of particles for the current time-step.
|
||||
After you call this subroutine, all subsequent
|
||||
operations will assume this number of particles will be written.
|
||||
|
||||
For the parallel library, the \c nparticles value is the number of
|
||||
particles that the \e individual task will write. You can use
|
||||
a different value on different tasks.
|
||||
This function uses an \c MPI_Allgather
|
||||
call to aggregate each tasks number of particles and determine
|
||||
the appropiate offsets. Because of the use of this MPI collective,
|
||||
it is advisable to call this function as
|
||||
few times as possible when running at large concurrency.
|
||||
|
||||
This function assumes that your particles' data fields are in stored in
|
||||
contiguous 1D arrays.
|
||||
For instance, the fields \e x and \e y for your particles are stored
|
||||
in separate arrays \c x[] and \c y[].
|
||||
|
||||
If instead you store your particles as tuples, so that the values
|
||||
are arranged \f$ x_1,y_1,x_2,y_2\f$... than you need to setup striding
|
||||
(in this case with value 2) using \ref H5PartSetNumParticlesStrided.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
H5PartSetNumParticles (
|
||||
h5_file_t *f, /*!< [in] Handle to open file */
|
||||
h5_size_t nparticles /*!< [in] Number of particles */
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, nparticles=%llu",
|
||||
f, (long long unsigned)nparticles);
|
||||
h5_size_t stride = 1;
|
||||
H5_API_RETURN (h5u_set_num_particles(f, nparticles, stride));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5part_model
|
||||
|
||||
Set the number of particles for the current time-step.
|
||||
After you call this subroutine, all subsequent
|
||||
operations will assume this number of particles will be written.
|
||||
|
||||
For the parallel library, the \c nparticles value is the number of
|
||||
particles that the \e individual task will write. You can use
|
||||
a different value on different tasks.
|
||||
This function uses an \c MPI_Allgather
|
||||
call to aggregate each tasks number of particles and determine
|
||||
the appropiate offsets. Because of the use of this MPI collective,
|
||||
it is advisable to call this function as
|
||||
few times as possible when running at large concurrency.
|
||||
|
||||
This function assumes that your particles' data fields are
|
||||
stored tuples. For instance, the fields \e x and \e y of your
|
||||
particles are arranged \f$x_1,y_1,x_2,y_2\f$... in a single data
|
||||
array. In this example, the stride value would be 2.
|
||||
|
||||
If you instead have a separate array for each fields,
|
||||
such as \c x[] and \c y[],
|
||||
use \ref H5PartSetNumParticles.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
H5PartSetNumParticlesStrided (
|
||||
h5_file_t *f, /*!< [in] Handle to open file */
|
||||
h5_size_t nparticles, /*!< [in] Number of particles */
|
||||
h5_size_t stride /*!< [in] Stride value (e.g. number of fields in the particle array) */
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, nparticles=%llu, stride=%llu",
|
||||
f, (long long unsigned)nparticles,
|
||||
(long long unsigned)stride);
|
||||
H5_API_RETURN (h5u_set_num_particles (f, nparticles, stride));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5part_model
|
||||
|
||||
Define the chunk \c size and enables chunking in the underlying
|
||||
HDF5 layer.
|
||||
|
||||
Note that this policy wastes disk space, but can improve write
|
||||
bandwidth on parallel filesystems that are sensitive to write alignment
|
||||
(e.g. lustre). It is only recommended when using the MPI-POSIX or MPI-IO
|
||||
independent VFDs (see \ref H5OpenFile).
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
H5PartSetChunk (
|
||||
h5_file_t *f,
|
||||
h5_size_t size
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t, "f=%p, size=%llu", f, (long long unsigned)size);
|
||||
H5_API_RETURN (h5u_set_chunk (f, size));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5part_data
|
||||
|
||||
Write array of 64 bit floating point data to file.
|
||||
|
||||
After setting the number of particles with \c H5PartSetNumParticles() and
|
||||
the current timestep using \c H5SetStep(), you can start writing datasets
|
||||
into the file. Each dataset has a name associated with it (chosen by the
|
||||
user) in order to facilitate later retrieval. The name of the dataset is
|
||||
specified in the parameter \c name, which must be a null-terminated string.
|
||||
|
||||
There are no restrictions on naming of datasets, but it is useful to arrive
|
||||
at some common naming convention when sharing data with other groups.
|
||||
|
||||
The writing routines also implicitly store the datatype of the array so that
|
||||
the array can be reconstructed properly on other systems with incompatible
|
||||
type representations.
|
||||
|
||||
All data that is written after setting the timestep is associated with that
|
||||
timestep. While the number of particles can change for each timestep, you
|
||||
cannot change the number of particles in the middle of a given timestep.
|
||||
|
||||
The data is committed to disk before the routine returns.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
H5PartWriteDataFloat64 (
|
||||
h5_file_t *f, /*!< [in] Handle to open file */
|
||||
const char *name, /*!< [in] Name to associate array with */
|
||||
const h5_float64_t *data /*!< [in] Array to commit to disk */
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t, "f=%p, name='%s', date=%p", f,name,data);
|
||||
H5_API_RETURN (h5u_write_data (f, name, (void*)data, H5T_NATIVE_DOUBLE));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5part_data
|
||||
|
||||
Write array of 32 bit floating point data to file.
|
||||
|
||||
After setting the number of particles with \c H5PartSetNumParticles() and
|
||||
the current timestep using \c H5SetStep(), you can start writing datasets
|
||||
into the file. Each dataset has a name associated with it (chosen by the
|
||||
user) in order to facilitate later retrieval. The name of the dataset is
|
||||
specified in the parameter \c name, which must be a null-terminated string.
|
||||
|
||||
There are no restrictions on naming of datasets, but it is useful to arrive
|
||||
at some common naming convention when sharing data with other groups.
|
||||
|
||||
The writing routines also implicitly store the datatype of the array so that
|
||||
the array can be reconstructed properly on other systems with incompatible
|
||||
type representations.
|
||||
|
||||
All data that is written after setting the timestep is associated with that
|
||||
timestep. While the number of particles can change for each timestep, you
|
||||
cannot change the number of particles in the middle of a given timestep.
|
||||
|
||||
The data is committed to disk before the routine returns.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
H5PartWriteDataFloat32 (
|
||||
h5_file_t *f, /*!< [in] Handle to open file */
|
||||
const char *name, /*!< [in] Name to associate array with */
|
||||
const h5_float32_t *data /*!< [in] Array to commit to disk */
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t, "f=%p, name='%s', date=%p", f,name,data);
|
||||
h5_err_t h5err = h5u_write_data( f, name, (void*)data, H5T_NATIVE_FLOAT );
|
||||
H5_API_RETURN (h5err);
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5part_data
|
||||
|
||||
Write array of 64 bit integer data to file.
|
||||
|
||||
After setting the number of particles with \c H5PartSetNumParticles() and
|
||||
the current timestep using \c H5SetStep(), you can start writing datasets
|
||||
into the file. Each dataset has a name associated with it (chosen by the
|
||||
user) in order to facilitate later retrieval. The name of the dataset is
|
||||
specified in the parameter \c name, which must be a null-terminated string.
|
||||
|
||||
There are no restrictions on naming of datasets, but it is useful to arrive
|
||||
at some common naming convention when sharing data with other groups.
|
||||
|
||||
The writing routines also implicitly store the datatype of the array so that
|
||||
the array can be reconstructed properly on other systems with incompatible
|
||||
type representations.
|
||||
|
||||
All data that is written after setting the timestep is associated with that
|
||||
timestep. While the number of particles can change for each timestep, you
|
||||
cannot change the number of particles in the middle of a given timestep.
|
||||
|
||||
The data is committed to disk before the routine returns.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
H5PartWriteDataInt64 (
|
||||
h5_file_t *f, /*!< [in] Handle to open file */
|
||||
const char *name, /*!< [in] Name to associate array with */
|
||||
const h5_int64_t *data /*!< [in] Array to commit to disk */
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t, "f=%p, name='%s', date=%p", f,name,data);
|
||||
H5_API_RETURN (h5u_write_data (f, name, (void*)data, H5T_NATIVE_INT64));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5part_data
|
||||
|
||||
Write array of 32 bit integer data to file.
|
||||
|
||||
After setting the number of particles with \c H5PartSetNumParticles() and
|
||||
the current timestep using \c H5SetStep(), you can start writing datasets
|
||||
into the file. Each dataset has a name associated with it (chosen by the
|
||||
user) in order to facilitate later retrieval. The name of the dataset is
|
||||
specified in the parameter \c name, which must be a null-terminated string.
|
||||
|
||||
There are no restrictions on naming of datasets, but it is useful to arrive
|
||||
at some common naming convention when sharing data with other groups.
|
||||
|
||||
The writing routines also implicitly store the datatype of the array so that
|
||||
the array can be reconstructed properly on other systems with incompatible
|
||||
type representations.
|
||||
|
||||
All data that is written after setting the timestep is associated with that
|
||||
timestep. While the number of particles can change for each timestep, you
|
||||
cannot change the number of particles in the middle of a given timestep.
|
||||
|
||||
The data is committed to disk before the routine returns.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
H5PartWriteDataInt32 (
|
||||
h5_file_t *f, /*!< [in] Handle to open file */
|
||||
const char *name, /*!< [in] Name to associate array with */
|
||||
const h5_int32_t *data /*!< [in] Array to commit to disk */
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t, "f=%p, name='%s', date=%p", f,name,data);
|
||||
H5_API_RETURN (h5u_write_data (f, name, (void*)data, H5T_NATIVE_INT32));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5part_data
|
||||
|
||||
Read array of 64 bit floating point data from file.
|
||||
|
||||
When retrieving datasets from disk, you ask for them
|
||||
by name. There are no restrictions on naming of arrays,
|
||||
but it is useful to arrive at some common naming
|
||||
convention when sharing data with other groups.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
H5PartReadDataFloat64 (
|
||||
h5_file_t *f, /*!< [in] Handle to open file */
|
||||
const char *name, /*!< [in] Name to associate dataset with */
|
||||
h5_float64_t *data /*!< [out] Array of data */
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t, "f=%p, name='%s', date=%p", f,name,data);
|
||||
H5_API_RETURN (h5u_read_data (f, name, data, H5T_NATIVE_DOUBLE));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5part_data
|
||||
|
||||
Read array of 32 bit floating point data from file.
|
||||
|
||||
When retrieving datasets from disk, you ask for them
|
||||
by name. There are no restrictions on naming of arrays,
|
||||
but it is useful to arrive at some common naming
|
||||
convention when sharing data with other groups.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
H5PartReadDataFloat32 (
|
||||
h5_file_t *f, /*!< [in] Handle to open file */
|
||||
const char *name, /*!< [in] Name to associate dataset with */
|
||||
h5_float32_t *data /*!< [out] Array of data */
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t, "f=%p, name='%s', date=%p", f,name,data);
|
||||
H5_API_RETURN (h5u_read_data (f, name, data, H5T_NATIVE_FLOAT));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5part_data
|
||||
|
||||
Read array of 64 bit integer data from file.
|
||||
|
||||
When retrieving datasets from disk, you ask for them
|
||||
by name. There are no restrictions on naming of arrays,
|
||||
but it is useful to arrive at some common naming
|
||||
convention when sharing data with other groups.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
H5PartReadDataInt64 (
|
||||
h5_file_t *f, /*!< [in] Handle to open file */
|
||||
const char *name, /*!< [in] Name to associate dataset with */
|
||||
h5_int64_t *data /*!< [out] Array of data */
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t, "f=%p, name='%s', date=%p", f,name,data);
|
||||
H5_API_RETURN (h5u_read_data (f, name, data, H5T_NATIVE_INT64));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5part_data
|
||||
|
||||
Read array of 32 bit integer data from file.
|
||||
|
||||
When retrieving datasets from disk, you ask for them
|
||||
by name. There are no restrictions on naming of arrays,
|
||||
but it is useful to arrive at some common naming
|
||||
convention when sharing data with other groups.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
H5PartReadDataInt32 (
|
||||
h5_file_t *f, /*!< [in] Handle to open file */
|
||||
const char *name, /*!< [in] Name to associate dataset with */
|
||||
h5_int32_t *data /*!< [out] Array of data */
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t, "f=%p, name='%s', date=%p", f,name,data);
|
||||
H5_API_RETURN (h5u_read_data (f, name, data, H5T_NATIVE_INT32));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5part_model
|
||||
|
||||
Get the number of datasets that are stored at the current time-step.
|
||||
|
||||
\return number of datasets in current timestep or error code
|
||||
*/
|
||||
|
||||
h5_ssize_t
|
||||
H5PartGetNumDatasets (
|
||||
h5_file_t *f /*!< [in] Handle to open file */
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t, "f=%p", f);
|
||||
H5_API_RETURN (h5u_get_num_datasets(f));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5part_model
|
||||
|
||||
This reads the name of a dataset specified by it's index in the current
|
||||
time-step.
|
||||
|
||||
If the number of datasets is \c n, the range of \c _index is \c 0 to \c n-1.
|
||||
|
||||
\result \c H5_SUCCESS
|
||||
*/
|
||||
h5_err_t
|
||||
H5PartGetDatasetName (
|
||||
h5_file_t *f, /*!< [in] Handle to open file */
|
||||
const h5_id_t idx, /*!< [in] Index of the dataset */
|
||||
char *name, /*!< [out] Name of dataset */
|
||||
const h5_size_t len /*!< [in] Size of buffer \c name */
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, "
|
||||
"idx=%lld, "
|
||||
"name='%p', len=%llu, ",
|
||||
f,
|
||||
(long long)idx,
|
||||
name, (unsigned long long)len);
|
||||
H5_API_RETURN (h5u_get_dataset_info(f, idx, name, len, NULL, NULL));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5part_model
|
||||
|
||||
Gets the name, type and number of elements of a dataset based on its
|
||||
index in the current timestep.
|
||||
|
||||
Type is one of the following values:
|
||||
|
||||
- \c H5_FLOAT64_T (for \c h5_float64_t)
|
||||
- \c H5_FLOAT32_T (for \c h5_float32_t)
|
||||
- \c H5_INT64_T (for \c h5_int64_t)
|
||||
- \c H5_INT32_T (for \c h5_int32_t)
|
||||
|
||||
\return \c H5_SUCCESS
|
||||
*/
|
||||
h5_err_t
|
||||
H5PartGetDatasetInfo (
|
||||
h5_file_t *f, /*!< [in] Handle to open file */
|
||||
const h5_id_t idx, /*!< [in] Index of the dataset */
|
||||
char *dataset_name, /*!< [out] Name of dataset */
|
||||
const h5_size_t len_dataset_name,
|
||||
/*!< [in] Size of buffer \c dataset_name */
|
||||
h5_int64_t *type, /*!< [out] Type of data in dataset */
|
||||
h5_size_t *nelem /*!< [out] Number of elements. */
|
||||
) {
|
||||
H5_API_ENTER (h5_int64_t,
|
||||
"f=%p, "
|
||||
"idx=%lld, "
|
||||
"dataset_name='%p', len_dataset_name=%llu, "
|
||||
"type=%p, nelem=%p",
|
||||
f,
|
||||
(long long)idx,
|
||||
dataset_name, (long long unsigned)len_dataset_name,
|
||||
type, nelem);
|
||||
H5_API_RETURN (h5u_get_dataset_info (
|
||||
f, idx, dataset_name, len_dataset_name, type, nelem));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5part_model
|
||||
|
||||
This function returns the number of particles in this processor's view,
|
||||
if a view has been set.
|
||||
|
||||
If not, it returns the total number of particles across all processors
|
||||
from the last \ref H5PartSetNumParticles call.
|
||||
|
||||
If you have neither set the number of particles
|
||||
nor set a view, then this returns the total number of
|
||||
particles in the first data set of the current time step.
|
||||
Note that H5Part assumes that all data sets within a given time step
|
||||
have the same number of particles (although the number particles can
|
||||
vary across time steps).
|
||||
|
||||
If none of these conditions are met, an error is thrown.
|
||||
|
||||
\return number of particles in current timestep or an error
|
||||
code.
|
||||
*/
|
||||
h5_ssize_t
|
||||
H5PartGetNumParticles (
|
||||
h5_file_t *f /*!< [in] Handle to open file */
|
||||
) {
|
||||
H5_API_ENTER (h5_ssize_t, "f=%p", f);
|
||||
CHECK_FILEHANDLE( f );
|
||||
H5_API_RETURN (h5u_get_num_particles (f));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5part_model
|
||||
|
||||
Reset the view.
|
||||
|
||||
\return \c H5_SUCCESS
|
||||
*/
|
||||
h5_err_t
|
||||
H5PartResetView (
|
||||
h5_file_t *f /*!< [in] Handle to open file */
|
||||
) {
|
||||
H5_API_ENTER (h5_ssize_t, "f=%p", f);
|
||||
H5_API_RETURN (h5u_reset_view (f));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5part_model
|
||||
|
||||
Check whether a view has been set, either automatically with
|
||||
\ref H5PartSetNumParticles or manually with \ref H5PartSetView
|
||||
or \ref H5PartSetViewIndices.
|
||||
|
||||
\return 0 for false or 1 for true
|
||||
*/
|
||||
h5_err_t
|
||||
H5PartHasView (
|
||||
h5_file_t *f /*!< [in] Handle to open file */
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t, "f=%p", f);
|
||||
H5_API_RETURN (h5u_has_view (f));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5part_model
|
||||
|
||||
For parallel I/O or for subsetting operations on the datafile,
|
||||
this function allows you to define a subset of the total
|
||||
particle dataset to operate on.
|
||||
The concept of "view" works for both serial
|
||||
and for parallel I/O. The "view" will remain in effect until a new view
|
||||
is set, or the number of particles in a dataset changes, or the view is
|
||||
"unset" by calling \c H5PartSetView(file,-1,-1);
|
||||
|
||||
Before you set a view, \ref H5PartGetNumParticles will return the
|
||||
total number of particles in the current time-step (even for the parallel
|
||||
reads). However, after you set a view, it will return the number of
|
||||
particles contained in the view.
|
||||
|
||||
The range is \e inclusive: the end value is the last index of the
|
||||
data.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
H5PartSetView (
|
||||
h5_file_t *f, /*!< [in] Handle to open file */
|
||||
h5_int64_t start, /*!< [in] Start particle */
|
||||
h5_int64_t end /*!< [in] End particle */
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, start=%lld, end=%lld",
|
||||
f, (long long)start, (long long)end);
|
||||
H5_API_RETURN (h5u_set_view (f, start, end));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5part_model
|
||||
|
||||
For parallel I/O or for subsetting operations on the datafile,
|
||||
this function allows you to define a subset of the total
|
||||
dataset to operate on by specifying a list of indices.
|
||||
The concept of "view" works for both serial
|
||||
and for parallel I/O. The "view" will remain in effect until a new view
|
||||
is set, or the number of particles in a dataset changes, or the view is
|
||||
"unset" by calling \c H5PartSetViewIndices(NULL,0);
|
||||
|
||||
When you perform a read or write on a view consisting of indices, it
|
||||
is assumed that your buffer is \b unpacked, meaning that there is room
|
||||
for all the intermediate values (which will not be touched by the read
|
||||
or write).
|
||||
|
||||
Before you set a view, the \c H5PartGetNumParticles() will return the
|
||||
total number of particles in the current time-step (even for the parallel
|
||||
reads). However, after you set a view, it will return the number of
|
||||
particles contained in the view.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
H5PartSetViewIndices (
|
||||
h5_file_t *f, /*!< [in] Handle to open file */
|
||||
const h5_size_t *indices, /*!< [in] List of indices */
|
||||
h5_size_t nelems /*!< [in] Size of list */
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, indices=%p, nelems=%llu",
|
||||
f, indices, (long long unsigned)nelems);
|
||||
H5_API_RETURN (h5u_set_view_indices (f, indices, nelems));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5part_model
|
||||
|
||||
Allows you to query the current view. Start and End
|
||||
will be \c -1 if there is no current view established.
|
||||
Use \c H5PartHasView() to see if the view is smaller than the
|
||||
total dataset.
|
||||
|
||||
\return number of elements in the view or error code
|
||||
*/
|
||||
h5_err_t
|
||||
H5PartGetView (
|
||||
h5_file_t *f, /*!< [in] Handle to open file */
|
||||
h5_int64_t *start, /*!< [out] Start particle */
|
||||
h5_int64_t *end /*!< [out] End particle */
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, start=%p, end=%p",
|
||||
f, start, end);
|
||||
H5_API_RETURN (h5u_get_view (f, start, end));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5part_model
|
||||
|
||||
If it is too tedious to manually set the start and end coordinates
|
||||
for a view, the \c H5SetCanonicalView() will automatically select an
|
||||
appropriate domain decomposition of the data arrays for the degree
|
||||
of parallelism and set the "view" accordingly.
|
||||
|
||||
\return H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
H5PartSetCanonicalView (
|
||||
h5_file_t *f /*!< [in] Handle to open file */
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t, "f=%p", f);
|
||||
H5_API_RETURN (h5u_set_canonical_view (f));
|
||||
}
|
||||
|
||||
@@ -1,65 +0,0 @@
|
||||
#include "h5core/h5_core.h"
|
||||
#include "H5hut.h"
|
||||
|
||||
h5_ssize_t
|
||||
H5GetNumAttachments (
|
||||
h5_file_t* const f /*!< [in] Handle to open file */
|
||||
) {
|
||||
H5_API_ENTER (h5_ssize_t, "f=%p", f);
|
||||
H5_API_RETURN (h5_get_num_attachments (f));
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
H5GetAttachmentInfoByIdx (
|
||||
h5_file_t* const f,
|
||||
const h5_size_t idx, // IN
|
||||
char* const fname, // OUT
|
||||
h5_size_t len_fname, // IN
|
||||
h5_size_t* const fsize // OUT
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"idx=%llu, fname=%p, len_fname=%llu, fsize=%p",
|
||||
(long long unsigned)idx,
|
||||
fname, (long long unsigned)len_fname,
|
||||
fsize);
|
||||
H5_API_RETURN (h5_get_attachment_info_by_idx (
|
||||
f, idx, fname, len_fname, fsize));
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
H5GetAttachmentInfoByName (
|
||||
h5_file_t* const f,
|
||||
char* const fname, // OUT
|
||||
h5_size_t* const fsize // OUT
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t, "fname='%s', fsize=%p", fname, fsize);
|
||||
H5_API_RETURN (h5_get_attachment_info_by_name (
|
||||
f, fname, fsize));
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
H5AddAttachment (
|
||||
h5_file_t* const f, /*!< [in] Handle to open file */
|
||||
const char* fname /*!< [in] Name of file to attach */
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t, "fname='%s'", fname);
|
||||
H5_API_RETURN (h5_add_attachment (f, fname));
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
H5GetAttachment (
|
||||
h5_file_t* const f, /*!< [in] Handle to open file */
|
||||
const char* fname /*!< [in] Name of attachment */
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t, "fname='%s'", fname);
|
||||
H5_API_RETURN (h5_get_attachment (f, fname));
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
H5DeleteAttachment (
|
||||
h5_file_t* const f,
|
||||
const char* const fname
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t, "fname='%s'", fname);
|
||||
H5_API_RETURN (h5_delete_attachment (f, fname));
|
||||
}
|
||||
@@ -1,629 +0,0 @@
|
||||
#include <string.h>
|
||||
|
||||
#include "h5core/h5_core.h"
|
||||
#include "H5hut.h"
|
||||
|
||||
|
||||
/*** WRITE ***/
|
||||
|
||||
/*!
|
||||
\ingroup h5hut_attrib
|
||||
|
||||
Write an attribute \c name with the string \c value to
|
||||
the file root ("/").
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
H5WriteFileAttribString (
|
||||
h5_file_t *const f, /*!< [in] Handle to open file */
|
||||
const char *name, /*!< [in] Name of attribute to create */
|
||||
const char *value /*!< [in] Value of attribute */
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t, "f=%p, name='%s', value='%s'", f, name, value);
|
||||
H5_API_RETURN (h5_write_attrib (
|
||||
f,
|
||||
H5_ATTRIB_FILE,
|
||||
name,
|
||||
H5T_NATIVE_CHAR,
|
||||
value,
|
||||
strlen(value) + 1 ));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5hut_attrib
|
||||
|
||||
Write an attribute \c name with the string \c value to
|
||||
the current timestep.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
H5WriteStepAttribString (
|
||||
h5_file_t *const f, /*!< [in] Handle to open file */
|
||||
const char *name, /*!< [in] Name of attribute to create */
|
||||
const char *value /*!< [in] Value of attribute */
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t, "f=%p, name='%s', value='%s'", f, name, value);
|
||||
H5_API_RETURN (h5_write_attrib (
|
||||
f,
|
||||
H5_ATTRIB_STEP,
|
||||
name,
|
||||
H5T_NATIVE_CHAR,
|
||||
value,
|
||||
strlen(value) + 1 ));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5hut_attrib
|
||||
|
||||
Write an attribute \c name with float32 \c values to
|
||||
the file root ("/").
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
H5WriteFileAttribFloat32 (
|
||||
h5_file_t *const f, /*!< [in] Handle to open file */
|
||||
const char *name, /*!< [in] Name of attribute to create */
|
||||
const h5_float32_t *values, /*!< [in] Values of attribute */
|
||||
const h5_size_t nelems /*!< [in] Number of values */
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t, "f=%p, name='%s', values=%p, nelems=%llu",
|
||||
f, name, values, (long long unsigned)nelems);
|
||||
H5_API_RETURN (h5_write_attrib (
|
||||
f,
|
||||
H5_ATTRIB_FILE,
|
||||
name,
|
||||
H5T_NATIVE_FLOAT,
|
||||
values,
|
||||
nelems ));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5hut_attrib
|
||||
|
||||
Write an attribute \c name with float32 \c values to
|
||||
the current time step.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
H5WriteStepAttribFloat32 (
|
||||
h5_file_t *const f, /*!< [in] Handle to open file */
|
||||
const char *name, /*!< [in] Name of attribute to create */
|
||||
const h5_float32_t *values, /*!< [in] Values of attribute */
|
||||
const h5_size_t nelems /*!< [in] Number of values */
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t, "f=%p, name='%s', values=%p, nelems=%llu",
|
||||
f, name, values, (long long unsigned)nelems);
|
||||
H5_API_RETURN (h5_write_attrib (
|
||||
f,
|
||||
H5_ATTRIB_STEP,
|
||||
name,
|
||||
H5T_NATIVE_FLOAT,
|
||||
values,
|
||||
nelems ));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5hut_attrib
|
||||
|
||||
Write an attribute \c name with float64 \c values to
|
||||
the file root ("/").
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
H5WriteFileAttribFloat64 (
|
||||
h5_file_t *const f, /*!< [in] Handle to open file */
|
||||
const char *name, /*!< [in] Name of attribute to create */
|
||||
const h5_float64_t *values, /*!< [in] Values of attribute */
|
||||
const h5_size_t nelems /*!< [in] Number of values */
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t, "f=%p, name='%s', values=%p, nelems=%llu",
|
||||
f, name, values, (long long unsigned)nelems);
|
||||
H5_API_RETURN (h5_write_attrib (
|
||||
f,
|
||||
H5_ATTRIB_FILE,
|
||||
name,
|
||||
H5T_NATIVE_DOUBLE,
|
||||
values,
|
||||
nelems));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5hut_attrib
|
||||
|
||||
Write an attribute \c name with float64 \c values to
|
||||
the current time step.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
H5WriteStepAttribFloat64 (
|
||||
h5_file_t *const f, /*!< [in] Handle to open file */
|
||||
const char *name, /*!< [in] Name of attribute to create */
|
||||
const h5_float64_t *values, /*!< [in] Values of attribute */
|
||||
const h5_size_t nelems /*!< [in] Number of values */
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t, "f=%p, name='%s', values=%p, nelems=%llu",
|
||||
f, name, values, (long long unsigned)nelems);
|
||||
H5_API_RETURN (h5_write_attrib (
|
||||
f,
|
||||
H5_ATTRIB_STEP,
|
||||
name,
|
||||
H5T_NATIVE_DOUBLE,
|
||||
values,
|
||||
nelems));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5hut_attrib
|
||||
|
||||
Write an attribute \c name with int32 \c values to
|
||||
the file root ("/").
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
H5WriteFileAttribInt32 (
|
||||
h5_file_t *const f, /*!< [in] Handle to open file */
|
||||
const char *name, /*!< [in] Name of attribute to create */
|
||||
const h5_int32_t *values, /*!< [in] Values of attribute */
|
||||
const h5_size_t nelems /*!< [in] Number of values */
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t, "f=%p, name='%s', values=%p, nelems=%llu",
|
||||
f, name, values, (long long unsigned)nelems);
|
||||
H5_API_RETURN (h5_write_attrib (
|
||||
f,
|
||||
H5_ATTRIB_FILE,
|
||||
name,
|
||||
H5T_NATIVE_INT32,
|
||||
values,
|
||||
nelems));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5hut_attrib
|
||||
|
||||
Write an attribute \c name with int32 \c values to
|
||||
the current time step.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
H5WriteStepAttribInt32 (
|
||||
h5_file_t *const f, /*!< [in] Handle to open file */
|
||||
const char *name, /*!< [in] Name of attribute to create */
|
||||
const h5_int32_t *values, /*!< [in] Values of attribute */
|
||||
const h5_size_t nelems /*!< [in] Number of values */
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t, "f=%p, name='%s', values=%p, nelems=%llu",
|
||||
f, name, values, (long long unsigned)nelems);
|
||||
H5_API_RETURN (h5_write_attrib (
|
||||
f,
|
||||
H5_ATTRIB_STEP,
|
||||
name,
|
||||
H5T_NATIVE_INT32,
|
||||
values,
|
||||
nelems));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5hut_attrib
|
||||
|
||||
Write an attribute \c name with int64 \c values to
|
||||
the file root ("/").
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
H5WriteFileAttribInt64 (
|
||||
h5_file_t *const f, /*!< [in] Handle to open file */
|
||||
const char *name, /*!< [in] Name of attribute to create */
|
||||
const h5_int64_t *values, /*!< [in] Values of attribute */
|
||||
const h5_size_t nelems /*!< [in] Number of values */
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t, "f=%p, name='%s', values=%p, nelems=%llu",
|
||||
f, name, values, (long long unsigned)nelems);
|
||||
H5_API_RETURN (h5_write_attrib (
|
||||
f,
|
||||
H5_ATTRIB_FILE,
|
||||
name,
|
||||
H5T_NATIVE_INT64,
|
||||
values,
|
||||
nelems));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5hut_attrib
|
||||
|
||||
Write an attribute \c name with int64 \c values to
|
||||
the current time step.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
H5WriteStepAttribInt64 (
|
||||
h5_file_t *const f, /*!< [in] Handle to open file */
|
||||
const char *name, /*!< [in] Name of attribute to create */
|
||||
const h5_int64_t *values, /*!< [in] Values of attribute */
|
||||
const h5_size_t nelems /*!< [in] Number of values */
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t, "f=%p, name='%s', values=%p, nelems=%llu",
|
||||
f, name, values, (long long unsigned)nelems);
|
||||
H5_API_RETURN (h5_write_attrib (
|
||||
f,
|
||||
H5_ATTRIB_STEP,
|
||||
name,
|
||||
H5T_NATIVE_INT64,
|
||||
values,
|
||||
nelems));
|
||||
}
|
||||
|
||||
/*** READ ***/
|
||||
|
||||
/*!
|
||||
\ingroup h5hut_attrib
|
||||
|
||||
Read a string into a \c buffer from an attribute \c name
|
||||
in the file root ("/").
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
H5ReadFileAttribString (
|
||||
h5_file_t *const f, /*!< [in] Handle to open file */
|
||||
const char *name, /*!< [in] Name of attribute to create */
|
||||
char *buffer /*!< [out] Value of attribute */
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t, "f=%p, name='%s', value='%s'", f, name, buffer);
|
||||
H5_API_RETURN (h5_read_attrib (
|
||||
f,
|
||||
H5_ATTRIB_FILE,
|
||||
name,
|
||||
H5_STRING_T,
|
||||
(void*)buffer));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5hut_attrib
|
||||
|
||||
Read a string into a \c buffer from an attribute \c name
|
||||
in the current timestep.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
H5ReadStepAttribString (
|
||||
h5_file_t *const f, /*!< [in] Handle to open file */
|
||||
const char *name, /*!< [in] Name of attribute to create */
|
||||
char *buffer /*!< [out] Value of attribute */
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t, "f=%p, name='%s', value='%s'",
|
||||
f, name, buffer);
|
||||
H5_API_RETURN (h5_read_attrib (
|
||||
f,
|
||||
H5_ATTRIB_STEP,
|
||||
name,
|
||||
H5_STRING_T,
|
||||
(void*)buffer));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5hut_attrib
|
||||
|
||||
Read int32 values into a \c buffer from an attribute \c name
|
||||
in the file root ("/").
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
H5ReadFileAttribInt32 (
|
||||
h5_file_t *const f, /*!< [in] Handle to open file */
|
||||
const char *name, /*!< [in] Name of attribute to create */
|
||||
h5_int32_t *buffer /*!< [out] Values of attribute */
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t, "f=%p, name='%s', buffer=%p",
|
||||
f, name, buffer);
|
||||
H5_API_RETURN (h5_read_attrib (
|
||||
f,
|
||||
H5_ATTRIB_FILE,
|
||||
name,
|
||||
H5_INT32_T,
|
||||
(void*)buffer));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5hut_attrib
|
||||
|
||||
Read int32 values into a \c buffer from an attribute \c name
|
||||
in the current time step.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
H5ReadStepAttribInt32 (
|
||||
h5_file_t *const f, /*!< [in] Handle to open file */
|
||||
const char *name, /*!< [in] Name of attribute to create */
|
||||
h5_int32_t *buffer /*!< [out] Values of attribute */
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t, "f=%p, name='%s', buffer=%p",
|
||||
f, name, buffer);
|
||||
H5_API_RETURN (h5_read_attrib (
|
||||
f,
|
||||
H5_ATTRIB_STEP,
|
||||
name,
|
||||
H5_INT32_T,
|
||||
(void*)buffer));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5hut_attrib
|
||||
|
||||
Read int64 values into a \c buffer from an attribute \c name
|
||||
in the file root ("/").
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
H5ReadFileAttribInt64 (
|
||||
h5_file_t *const f, /*!< [in] Handle to open file */
|
||||
const char *name, /*!< [in] Name of attribute to create */
|
||||
h5_int64_t *buffer /*!< [out] Values of attribute */
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t, "f=%p, name='%s', buffer=%p",
|
||||
f, name, buffer);
|
||||
H5_API_RETURN (h5_read_attrib (
|
||||
f,
|
||||
H5_ATTRIB_FILE,
|
||||
name,
|
||||
H5_INT64_T,
|
||||
(void*)buffer));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5hut_attrib
|
||||
|
||||
Read int64 values into a \c buffer from an attribute \c name
|
||||
in the current time step.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
H5ReadStepAttribInt64 (
|
||||
h5_file_t *const f, /*!< [in] Handle to open file */
|
||||
const char *name, /*!< [in] Name of attribute to create */
|
||||
h5_int64_t *buffer /*!< [out] Values of attribute */
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t, "f=%p, name='%s', buffer=%p",
|
||||
f, name, buffer);
|
||||
h5_err_t h5err = h5_read_attrib (
|
||||
f,
|
||||
H5_ATTRIB_STEP,
|
||||
name,
|
||||
H5_INT64_T,
|
||||
(void*)buffer);
|
||||
H5_API_RETURN (h5err);
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5hut_attrib
|
||||
|
||||
Read float32 values into a \c buffer from an attribute \c name
|
||||
in the file root ("/").
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
H5ReadFileAttribFloat32 (
|
||||
h5_file_t *const f, /*!< [in] Handle to open file */
|
||||
const char *name, /*!< [in] Name of attribute to create */
|
||||
h5_float32_t *buffer /*!< [out] Values of attribute */
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t, "f=%p, name='%s', buffer=%p",
|
||||
f, name, buffer);
|
||||
H5_API_RETURN (h5_read_attrib (
|
||||
f,
|
||||
H5_ATTRIB_FILE,
|
||||
name,
|
||||
H5_FLOAT32_T,
|
||||
(void*)buffer));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5hut_attrib
|
||||
|
||||
Read float32 values into a \c buffer from an attribute \c name
|
||||
in the current time step.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
H5ReadStepAttribFloat32 (
|
||||
h5_file_t *const f, /*!< [in] Handle to open file */
|
||||
const char *name, /*!< [in] Name of attribute to create */
|
||||
h5_float32_t *buffer /*!< [out] Values of attribute */
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t, "f=%p, name='%s', buffer=%p",
|
||||
f, name, buffer);
|
||||
H5_API_RETURN (h5_read_attrib (
|
||||
f,
|
||||
H5_ATTRIB_STEP,
|
||||
name,
|
||||
H5_FLOAT32_T,
|
||||
(void*)buffer));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5hut_attrib
|
||||
|
||||
Read float64 values into a \c buffer from an attribute \c name
|
||||
in the file root ("/").
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
H5ReadFileAttribFloat64 (
|
||||
h5_file_t *const f, /*!< [in] Handle to open file */
|
||||
const char *name, /*!< [in] Name of attribute to create */
|
||||
h5_float64_t *buffer /*!< [out] Values of attribute */
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, name='%s', buffer=%p",
|
||||
f, name, buffer);
|
||||
H5_API_RETURN (h5_read_attrib (
|
||||
f,
|
||||
H5_ATTRIB_FILE,
|
||||
name,
|
||||
H5_FLOAT64_T,
|
||||
(void*)buffer));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5hut_attrib
|
||||
|
||||
Read float64 values into a \c buffer from an attribute \c name
|
||||
in the current time step.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
H5ReadStepAttribFloat64 (
|
||||
h5_file_t *const f, /*!< [in] Handle to open file */
|
||||
const char *name, /*!< [in] Name of attribute to create */
|
||||
h5_float64_t *buffer /*!< [out] Values of attribute */
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t, "f=%p, name='%s', buffer=%p",
|
||||
f, name, buffer);
|
||||
H5_API_RETURN (h5_read_attrib (
|
||||
f,
|
||||
H5_ATTRIB_STEP,
|
||||
name,
|
||||
H5_FLOAT64_T,
|
||||
(void*)buffer));
|
||||
}
|
||||
|
||||
/*** QUERY ***/
|
||||
|
||||
/*!
|
||||
\ingroup h5hut_attrib
|
||||
|
||||
Gets the number of attributes in the file's root ("/").
|
||||
|
||||
\return Number of attributes or error code.
|
||||
*/
|
||||
h5_int64_t
|
||||
H5GetNumFileAttribs (
|
||||
h5_file_t *const f /*!< [in] Handle to open file */
|
||||
) {
|
||||
H5_API_ENTER (h5_int64_t, "f=%p", f);
|
||||
H5_API_RETURN (h5_get_num_attribs (f, H5_ATTRIB_FILE));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5hut_attrib
|
||||
|
||||
Gets the number of attributes bound to the current step.
|
||||
|
||||
\h5_err_t h5err = Number of attributes or error code.
|
||||
*/
|
||||
h5_int64_t
|
||||
H5GetNumStepAttribs (
|
||||
h5_file_t *const f /*!< [in] Handle to open file */
|
||||
) {
|
||||
H5_API_ENTER (h5_int64_t, "f=%p", f);
|
||||
H5_API_RETURN (h5_get_num_attribs (f, H5_ATTRIB_STEP));
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
\ingroup h5hut_attrib
|
||||
|
||||
Gets the name, type and number of elements of the file attribute
|
||||
specified by its index.
|
||||
|
||||
This function can be used to retrieve all attributes bound to the
|
||||
file \c f by looping from \c 0 to the number of attribute minus
|
||||
one. The number of attributes bound to file \c f can be queried
|
||||
by calling \ref H5GetNumFileAttribs.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
|
||||
h5_err_t
|
||||
H5GetFileAttribInfo (
|
||||
h5_file_t *const f, /*!< [in] Handle to open file */
|
||||
const h5_size_t attrib_idx, /*!< [in] Index of attribute to get
|
||||
infos about */
|
||||
char *attrib_name, /*!< [out] Name of attribute */
|
||||
const h5_size_t len_of_attrib_name,
|
||||
/*!< [in] length of buffer \c name */
|
||||
h5_int64_t *attrib_type, /*!< [out] Type of value. */
|
||||
h5_size_t *attrib_nelem /*!< [out] Number of elements */
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, "
|
||||
"attrib_idx=%llu, attrib_name=%p, len_attrib_name=%llu, "
|
||||
"attrib_type=%p, attrib_nelem=%p",
|
||||
f,
|
||||
(long long unsigned)attrib_idx,
|
||||
attrib_name,
|
||||
(long long unsigned)len_of_attrib_name,
|
||||
attrib_type,
|
||||
attrib_nelem);
|
||||
H5_API_RETURN (h5_get_attrib_info (
|
||||
f,
|
||||
H5_ATTRIB_FILE,
|
||||
attrib_idx,
|
||||
attrib_name,
|
||||
len_of_attrib_name,
|
||||
attrib_type,
|
||||
attrib_nelem));
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5hut_attrib
|
||||
|
||||
Gets the name, type and number of elements of the step attribute
|
||||
specified by its index.
|
||||
|
||||
This function can be used to retrieve all attributes bound to the
|
||||
current time-step by looping from \c 0 to the number of attribute
|
||||
minus one. The number of attributes bound to the current
|
||||
time-step can be queried by calling \ref H5GetNumStepAttribs.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
H5GetStepAttribInfo (
|
||||
h5_file_t *const f, /*!< [in] Handle to open file */
|
||||
const h5_size_t attrib_idx, /*!< [in] Index of attribute to
|
||||
get infos about */
|
||||
char *attrib_name, /*!< [out] Name of attribute */
|
||||
const h5_size_t len_of_attrib_name,
|
||||
/*!< [in] length of buffer \c name */
|
||||
h5_int64_t *attrib_type, /*!< [out] Type of value. */
|
||||
h5_size_t *attrib_nelem /*!< [out] Number of elements */
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, "
|
||||
"attrib_idx=%llu, attrib_name=%p, len_attrib_name=%llu, "
|
||||
"attrib_type=%p, attrib_nelem=%p",
|
||||
f,
|
||||
(unsigned long long)attrib_idx,
|
||||
attrib_name,
|
||||
(unsigned long long)len_of_attrib_name,
|
||||
attrib_type,
|
||||
attrib_nelem);
|
||||
H5_API_RETURN (h5_get_attrib_info (
|
||||
f,
|
||||
H5_ATTRIB_STEP,
|
||||
attrib_idx,
|
||||
attrib_name,
|
||||
len_of_attrib_name,
|
||||
attrib_type,
|
||||
attrib_nelem));
|
||||
}
|
||||
|
||||
+22
-42
@@ -1,47 +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
|
||||
|
||||
AM_CPPFLAGS = -I../include @AM_CPPFLAGS@
|
||||
|
||||
# What to build... Will be determined by configure script.
|
||||
lib_LTLIBRARIES = @LIB_C@
|
||||
|
||||
# Listing of all possible targets that I may build.
|
||||
EXTRA_LTLIBRARIES = libH5hutC.la
|
||||
|
||||
# Header files that I wish to install in $(prefix)/include
|
||||
include_HEADERS = \
|
||||
../include/H5hut.h \
|
||||
../include/H5.h \
|
||||
../include/H5_attribs.h \
|
||||
../include/H5_attachments.h \
|
||||
../include/H5Part.h \
|
||||
../include/H5Block.h \
|
||||
../include/H5Block_readwrite.h \
|
||||
../include/H5Fed.h \
|
||||
../include/H5Fed_adjacency.h \
|
||||
../include/H5Fed_inquiry.h \
|
||||
../include/H5Fed_retrieve.h \
|
||||
../include/H5Fed_store.h \
|
||||
../include/H5Fed_tags.h
|
||||
|
||||
# Listing of all possible headers that I may include
|
||||
EXTRA_HEADERS =
|
||||
|
||||
# Listing of sources
|
||||
libH5hutC_la_SOURCES = \
|
||||
H5.c \
|
||||
H5_attribs.c \
|
||||
H5_attachments.c \
|
||||
H5Part.c \
|
||||
H5Block.c \
|
||||
H5Block_readwrite.c
|
||||
|
||||
libH5hutC_la_LDFLAGS = -version-info 2:0:0 -rpath '$(libdir)'
|
||||
|
||||
all-local:
|
||||
$(INSTALL) -m644 .libs/libH5hutC.a ../lib
|
||||
endif
|
||||
|
||||
clean-local:
|
||||
$(RM) ../lib/libH5hutC.a
|
||||
$(RM) *~
|
||||
|
||||
@@ -1,580 +0,0 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
c_head = """
|
||||
#include "h5core/h5_core.h"
|
||||
"""
|
||||
|
||||
h_head = """
|
||||
#ifndef __H5BLOCK_READWRITE_H
|
||||
#define __H5BLOCK_READWRITE_H
|
||||
"""
|
||||
|
||||
h_tail = """
|
||||
#endif
|
||||
"""
|
||||
|
||||
fc_head = """
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "h5core/h5_core.h"
|
||||
#include "Underscore.h"
|
||||
|
||||
#if defined(F77_SINGLE_UNDERSCORE)
|
||||
#define F77NAME(a,b) a
|
||||
#elif defined(F77_CRAY_UNDERSCORE)
|
||||
#define F77NAME(a,b) b
|
||||
#elif defined(F77_NO_UNDERSCORE)
|
||||
#else
|
||||
#error Error, no way to determine how to construct fortran bindings
|
||||
#endif
|
||||
"""
|
||||
|
||||
write_scalar_h = """
|
||||
h5_err_t
|
||||
H5Block#DIM#dWriteScalarField#TYPE_ABV# (
|
||||
h5_file_t *const f,
|
||||
const char *name,
|
||||
const h5_#TYPE_H5P#_t *buffer
|
||||
);
|
||||
"""
|
||||
|
||||
read_scalar_h = """
|
||||
h5_err_t
|
||||
H5Block#DIM#dReadScalarField#TYPE_ABV# (
|
||||
h5_file_t *const f,
|
||||
const char *name,
|
||||
h5_#TYPE_H5P#_t *buffer
|
||||
);
|
||||
"""
|
||||
|
||||
write_scalar_c = """
|
||||
/*!
|
||||
\\ingroup h5block_data
|
||||
|
||||
Write a 3-dimensional field \\c name from the buffer starting at \\c data
|
||||
to the current time-step using the defined field layout. Values are
|
||||
#TYPE_FULL#.
|
||||
|
||||
You must use the Fortran indexing scheme to access items in \\c data.
|
||||
|
||||
\\return \\c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
H5Block#DIM#dWriteScalarField#TYPE_ABV# (
|
||||
h5_file_t *const f, /*!< IN: file handle */
|
||||
const char *name, /*!< IN: name of dataset to write */
|
||||
const h5_#TYPE_H5P#_t *buffer /*!< IN: pointer to write buffer */
|
||||
) {
|
||||
|
||||
H5_API_ENTER3 (h5_err_t, "f=0x%p, name=\\"%s\\", buffer=0x%p",
|
||||
f, name, buffer);
|
||||
H5_API_RETURN (h5b_write_scalar_data(f, name, (void*)buffer, #TYPE_HDF5# ));
|
||||
}
|
||||
"""
|
||||
|
||||
read_scalar_c = """
|
||||
/*!
|
||||
\\ingroup h5block_data
|
||||
|
||||
Read a 3-dimensional field \\c name into the buffer starting at \\c data from
|
||||
the current time-step using the defined field layout. Values are
|
||||
#TYPE_FULL#.
|
||||
|
||||
You must use the Fortran indexing scheme to access items in \\c data.
|
||||
|
||||
\\return \\c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
H5Block#DIM#dReadScalarField#TYPE_ABV# (
|
||||
h5_file_t *const f, /*!< IN: file handle */
|
||||
const char *name, /*!< IN: name of dataset to read */
|
||||
h5_#TYPE_H5P#_t *buffer /*!< OUT: pointer to read buffer */
|
||||
) {
|
||||
|
||||
H5_API_ENTER3 (h5_err_t, "f=0x%p, name=\\"%s\\", buffer=0x%p",
|
||||
f, name, buffer);
|
||||
H5_API_RETURN (h5b_read_scalar_data(f, name, (void*)buffer, #TYPE_HDF5#));
|
||||
}
|
||||
"""
|
||||
|
||||
write_scalar_fi = """
|
||||
!> \\ingroup h5block_data_f
|
||||
!! See \\ref H5Block#DIM#dWriteScalarField#TYPE_ABV#
|
||||
!! \\return 0 on success or error code
|
||||
!<
|
||||
INTEGER*8 FUNCTION h5bl_#DIM#d_write_scalar_field_#TYPE_F90_ABV# ( filehandle, name, buffer )
|
||||
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open
|
||||
CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the dataset
|
||||
#TYPE_F90#, INTENT(IN) :: buffer(*) !< the array of data
|
||||
END FUNCTION
|
||||
"""
|
||||
|
||||
read_scalar_fi = """
|
||||
!> \\ingroup h5block_data_f
|
||||
!! See \\ref H5Block#DIM#dReadScalarField#TYPE_ABV#
|
||||
!! \\return 0 on success or error code
|
||||
!<
|
||||
INTEGER*8 FUNCTION h5bl_#DIM#d_read_scalar_field_#TYPE_F90_ABV# ( filehandle, name, buffer )
|
||||
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open
|
||||
CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the dataset
|
||||
#TYPE_F90#, INTENT(OUT) :: buffer(*) !< buffer to read the data into
|
||||
END FUNCTION
|
||||
"""
|
||||
|
||||
write_scalar_fc = """
|
||||
#if ! defined(F77_NO_UNDERSCORE)
|
||||
#define h5bl_#DIM#d_write_scalar_field_#TYPE_F90_ABV# F77NAME ( \\
|
||||
h5bl_#DIM#d_write_scalar_field_#TYPE_F90_ABV#_, \\
|
||||
H5BL_#DIM#D_WRITE_SCALAR_FIELD_#TYPE_F90_ABVC# )
|
||||
#endif
|
||||
|
||||
h5_err_t
|
||||
h5bl_#DIM#d_write_scalar_field_#TYPE_F90_ABV# (
|
||||
h5_int64_t *const f,
|
||||
const char *name,
|
||||
const h5_#TYPE_H5P#_t *buffer,
|
||||
const int l_name
|
||||
) {
|
||||
|
||||
h5_file_t *fh = h5_filehandlefor2c(f);
|
||||
H5_API_ENTER4 (h5_err_t, "f=0x%p, name=\\"%s\\", buffer=0x%p, l_name=%d",
|
||||
fh, name, buffer, l_name);
|
||||
char *name2 = h5_strdupfor2c ( name, l_name );
|
||||
h5_err_t herr = h5b_write_scalar_data (
|
||||
fh, name2, (void*)buffer, #TYPE_HDF5# );
|
||||
free ( name2 );
|
||||
H5_API_RETURN(herr);
|
||||
}
|
||||
"""
|
||||
|
||||
read_scalar_fc = """
|
||||
#if ! defined(F77_NO_UNDERSCORE)
|
||||
#define h5bl_3d_read_scalar_field_#TYPE_F90_ABV# F77NAME ( \\
|
||||
h5bl_3d_read_scalar_field_#TYPE_F90_ABV#_, \\
|
||||
H5BL_#DIM#D_READ_SCALAR_FIELD_#TYPE_F90_ABVC# )
|
||||
#endif
|
||||
|
||||
h5_err_t
|
||||
h5bl_#DIM#d_read_scalar_field_#TYPE_F90_ABV# (
|
||||
h5_int64_t *const f,
|
||||
const char *name,
|
||||
h5_#TYPE_H5P#_t *buffer,
|
||||
const int l_name
|
||||
) {
|
||||
|
||||
h5_file_t *fh = h5_filehandlefor2c(f);
|
||||
H5_API_ENTER4 (h5_err_t, "f=0x%p, name=\\"%s\\", buffer=0x%p, l_name=%d",
|
||||
fh, name, buffer, l_name);
|
||||
char *name2 = h5_strdupfor2c ( name, l_name );
|
||||
h5_err_t herr = h5b_read_scalar_data (
|
||||
fh, name2, buffer, #TYPE_HDF5# );
|
||||
free ( name2 );
|
||||
H5_API_RETURN(herr);
|
||||
}
|
||||
"""
|
||||
|
||||
write_vector_h = """
|
||||
h5_err_t
|
||||
H5Block#DIM#dWriteVector3dField#TYPE_ABV# (
|
||||
h5_file_t *const f,
|
||||
const char *name,
|
||||
const h5_#TYPE_H5P#_t *x_buf,
|
||||
const h5_#TYPE_H5P#_t *y_buf,
|
||||
const h5_#TYPE_H5P#_t *z_buf
|
||||
);
|
||||
"""
|
||||
|
||||
read_vector_h = """
|
||||
h5_err_t
|
||||
H5Block#DIM#dReadVector3dField#TYPE_ABV# (
|
||||
h5_file_t *const f,
|
||||
const char *name,
|
||||
h5_#TYPE_H5P#_t *x_buf,
|
||||
h5_#TYPE_H5P#_t *y_buf,
|
||||
h5_#TYPE_H5P#_t *z_buf
|
||||
);
|
||||
"""
|
||||
|
||||
write_vector_c = """
|
||||
/*!
|
||||
\\ingroup h5block_data
|
||||
*/
|
||||
/*!
|
||||
Write a 3-dimensional field \\c name with 3-dimensional vectors as values
|
||||
from the buffers starting at \\c x_buf, \\c y_buf and \\c z_buf to the
|
||||
current time-step using the defined field layout. Values are 3-dimensional
|
||||
vectors with #TYPE_FULL# values.
|
||||
|
||||
You must use the Fortran indexing scheme to access items in \\c x_buf.
|
||||
|
||||
\\return \\c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
H5Block#DIM#dWriteVector3dField#TYPE_ABV# (
|
||||
h5_file_t *const f, /*!< IN: file handle */
|
||||
const char *name, /*!< IN: name of dataset to write */
|
||||
const h5_#TYPE_H5P#_t *x_buf, /*!< IN: pointer to X axis buffer */
|
||||
const h5_#TYPE_H5P#_t *y_buf, /*!< IN: pointer to Y axis buffer */
|
||||
const h5_#TYPE_H5P#_t *z_buf /*!< IN: pointer to Z axis buffer */
|
||||
) {
|
||||
|
||||
H5_API_ENTER5 (h5_err_t, "f=0x%p, name=\\"%s\\", x_buf=0x%p, y_buf=0x%p, z_buf=0x%p",
|
||||
f, name, x_buf, y_buf, z_buf);
|
||||
H5_API_RETURN(h5b_write_vector3d_data(f, name,
|
||||
(void*)x_buf, (void*)y_buf, (void*)z_buf, #TYPE_HDF5#));
|
||||
}
|
||||
"""
|
||||
|
||||
read_vector_c = """
|
||||
/*!
|
||||
\\ingroup h5block_data
|
||||
*/
|
||||
/*!
|
||||
Read a 3-dimensional field \\c name with 3-dimensional vectors as values
|
||||
from the buffers starting at \\c x_buf, \\c y_buf and \\c z_buf to the
|
||||
current time-step using the defined field layout. Values are 3-dimensional
|
||||
vectors with #TYPE_FULL# values.
|
||||
|
||||
You must use the Fortran indexing scheme to access items in \\c data.
|
||||
|
||||
\\return \\c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
H5Block#DIM#dReadVector3dField#TYPE_ABV# (
|
||||
h5_file_t *const f, /*!< IN: file handle */
|
||||
const char *name, /*!< IN: name of dataset to write */
|
||||
const h5_#TYPE_H5P#_t *x_buf, /*!< OUT: pointer to X axis buffer */
|
||||
const h5_#TYPE_H5P#_t *y_buf, /*!< OUT: pointer to Y axis buffer */
|
||||
const h5_#TYPE_H5P#_t *z_buf /*!< OUT: pointer to Z axis buffer */
|
||||
) {
|
||||
|
||||
H5_API_ENTER5 (h5_err_t, "f=0x%p, name=\\"%s\\", x_buf=0x%p, y_buf=0x%p, z_buf=0x%p",
|
||||
f, name, x_buf, y_buf, z_buf);
|
||||
H5_API_RETURN(h5b_read_vector3d_data(f, name,
|
||||
(void*)x_buf, (void*)y_buf, (void*)z_buf, #TYPE_HDF5#));
|
||||
}
|
||||
"""
|
||||
|
||||
write_vector_fi = """
|
||||
!> \\ingroup h5block_data_f
|
||||
!! See \\ref H5Block#DIM#dWriteVector3dField#TYPE_ABV#
|
||||
!! \\return 0 on success or error code
|
||||
!<
|
||||
INTEGER*8 FUNCTION h5bl_#DIM#d_write_vector3d_field_#TYPE_F90_ABV# ( filehandle, name, x, y, z )
|
||||
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open
|
||||
CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the dataset
|
||||
#TYPE_F90#, INTENT(IN) :: x(*) !< the array of x data to write
|
||||
#TYPE_F90#, INTENT(IN) :: y(*) !< the array of y data to write
|
||||
#TYPE_F90#, INTENT(IN) :: z(*) !< the array of z data to write
|
||||
END FUNCTION
|
||||
"""
|
||||
|
||||
read_vector_fi = """
|
||||
!> \\ingroup h5block_data_f
|
||||
!! See \\ref H5Block#DIM#dReadVector3dField#TYPE_ABV#
|
||||
!! \\return 0 on success or error code
|
||||
!<
|
||||
INTEGER*8 FUNCTION h5bl_#DIM#d_read_vector3d_field_#TYPE_F90_ABV# ( filehandle, name, x, y, z )
|
||||
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open
|
||||
CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the dataset
|
||||
#TYPE_F90#, INTENT(OUT) :: x(*) !< buffer to read the x data into
|
||||
#TYPE_F90#, INTENT(OUT) :: y(*) !< buffer to read the y data into
|
||||
#TYPE_F90#, INTENT(OUT) :: z(*) !< buffer to read the z data into
|
||||
END FUNCTION
|
||||
"""
|
||||
|
||||
write_vector_fc = """
|
||||
#if ! defined(F77_NO_UNDERSCORE)
|
||||
#define h5bl_#DIM#d_write_vector3d_field_#TYPE_F90_ABV# F77NAME ( \\
|
||||
h5bl_#DIM#d_write_vector3d_field_#TYPE_F90_ABV#_, \\
|
||||
H5BL_#DIM#D_WRITE_VECTOR3D_FIELD_#TYPE_F90_ABVC# )
|
||||
#endif
|
||||
|
||||
h5_err_t
|
||||
h5bl_#DIM#d_write_vector3d_field_#TYPE_F90_ABV# (
|
||||
h5_int64_t *const f,
|
||||
const char *name,
|
||||
const h5_#TYPE_H5P#_t *x_buf,
|
||||
const h5_#TYPE_H5P#_t *y_buf,
|
||||
const h5_#TYPE_H5P#_t *z_buf,
|
||||
const int l_name
|
||||
) {
|
||||
|
||||
h5_file_t *fh = h5_filehandlefor2c(f);
|
||||
H5_API_ENTER6 (h5_err_t, "f=0x%p, name=\\"%s\\", x_buf=0x%p, y_buf=0x%p, z_buf=0x%p, l_name=%d",
|
||||
fh, name, x_buf, y_buf, z_buf, l_name);
|
||||
char *name2 = h5_strdupfor2c ( name, l_name );
|
||||
h5_err_t herr = h5b_write_vector3d_data (
|
||||
fh, name2,
|
||||
(void*)x_buf, (void*)y_buf, (void*)z_buf, #TYPE_HDF5# );
|
||||
free ( name2 );
|
||||
H5_API_RETURN(herr);
|
||||
}
|
||||
"""
|
||||
|
||||
read_vector_fc = """
|
||||
#if ! defined(F77_NO_UNDERSCORE)
|
||||
#define h5bl_#DIM#d_read_vector3d_field_#TYPE_F90_ABV# F77NAME ( \\
|
||||
h5bl_#DIM#d_read_vector3d_field_#TYPE_F90_ABV#_, \\
|
||||
H5BL_#DIM#D_READ_VECTOR3D_FIELD_#TYPE_F90_ABVC# )
|
||||
#endif
|
||||
|
||||
h5_err_t
|
||||
h5bl_#DIM#d_read_vector3d_field_#TYPE_F90_ABV# (
|
||||
h5_int64_t *const f,
|
||||
const char *name,
|
||||
h5_#TYPE_H5P#_t *x_buf,
|
||||
h5_#TYPE_H5P#_t *y_buf,
|
||||
h5_#TYPE_H5P#_t *z_buf,
|
||||
const int l_name
|
||||
) {
|
||||
|
||||
h5_file_t *fh = h5_filehandlefor2c(f);
|
||||
H5_API_ENTER6 (h5_err_t, "f=0x%p, name=\\"%s\\", x_buf=0x%p, y_buf=0x%p, z_buf=0x%p, l_name=%d",
|
||||
fh, name, x_buf, y_buf, z_buf, l_name);
|
||||
char *name2 = h5_strdupfor2c ( name, l_name );
|
||||
h5_err_t herr = h5b_read_vector3d_data (
|
||||
fh, name2,
|
||||
(void*)x_buf, (void*)y_buf, (void*)z_buf, #TYPE_HDF5# );
|
||||
free ( name2 );
|
||||
H5_API_RETURN(herr);
|
||||
}
|
||||
"""
|
||||
|
||||
write_attr_h = """
|
||||
h5_err_t
|
||||
H5BlockWriteFieldAttrib#TYPE_ABV# (
|
||||
h5_file_t *const f,
|
||||
const char *field_name,
|
||||
const char *attrib_name,
|
||||
const h5_#TYPE_H5P#_t *buffer,
|
||||
const h5_size_t nelems
|
||||
);
|
||||
"""
|
||||
|
||||
write_attr_c = """
|
||||
/*!
|
||||
\\ingroup h5block_attrib
|
||||
|
||||
Write #TYPE_H5P# \\c values as attribute \\c attrib_name of field
|
||||
\\c field_name.
|
||||
|
||||
\\return \\c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
H5BlockWriteFieldAttrib#TYPE_ABV# (
|
||||
h5_file_t *const f, /*!< IN: file handle */
|
||||
const char *field_name, /*!< IN: field name */
|
||||
const char *attrib_name, /*!< IN: attribute name */
|
||||
const h5_#TYPE_H5P#_t *buffer, /*!< IN: attribute values */
|
||||
const h5_size_t nelems /*!< IN: number of elements */
|
||||
) {
|
||||
|
||||
H5_API_ENTER5 (h5_err_t, "f=0x%p, field_name=\\"%s\\", attrib_name=\\"%s\\", "
|
||||
"buffer=0x%p, nelems=%lld",
|
||||
f, field_name, attrib_name, buffer, (long long)nelems);
|
||||
H5_API_RETURN(h5_write_field_attrib (
|
||||
f,
|
||||
field_name,
|
||||
attrib_name,
|
||||
#TYPE_HDF5#,
|
||||
buffer,
|
||||
nelems ));
|
||||
}
|
||||
"""
|
||||
|
||||
write_attr_fi = """
|
||||
!> \\ingroup h5block_attrib_f
|
||||
!! See \\ref H5BlockWriteFieldAttrib#TYPE_ABV#
|
||||
!! \\return 0 on success or error code
|
||||
!<
|
||||
INTEGER*8 FUNCTION h5bl_writefieldattrib_#TYPE_F90_ABV# ( filehandle, field_name, attrib_name, attrib_value, attrib_nelem)
|
||||
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open
|
||||
CHARACTER(LEN=*), INTENT(IN) :: field_name !< the name of the field
|
||||
CHARACTER(LEN=*), INTENT(IN) :: attrib_name !< the name of the attribute
|
||||
#TYPE_F90#, INTENT(IN) :: buffer(*) !< the array of data to write into the attribute
|
||||
INTEGER*8, INTENT(IN) :: nelems !< the number of elements in the array
|
||||
END FUNCTION
|
||||
"""
|
||||
|
||||
write_attr_fc = """
|
||||
#if ! defined(F77_NO_UNDERSCORE)
|
||||
#define h5bl_writefieldattrib_#TYPE_F90_ABV# F77NAME ( \\
|
||||
h5bl_writefieldattrib_#TYPE_F90_ABV#_, \\
|
||||
H5BL_WRITEFIELDATTRIB_#TYPE_F90_ABVC# )
|
||||
#endif
|
||||
|
||||
h5_err_t
|
||||
h5bl_writefieldattrib_#TYPE_F90_ABV# (
|
||||
h5_int64_t *const f,
|
||||
const char *field_name,
|
||||
const char *attrib_name,
|
||||
const h5_#TYPE_H5P#_t *buffer,
|
||||
const h5_size_t *nelems,
|
||||
const int l_field_name,
|
||||
const int l_attrib_name
|
||||
) {
|
||||
|
||||
h5_file_t *fh = h5_filehandlefor2c(f);
|
||||
H5_API_ENTER7 (h5_err_t, "f=0x%p, field_name=\\"%s\\", attrib_name=\\"%s\\", "
|
||||
"buffer=0x%p, nelems=%lld, l_field_name=%d, l_attrib_name=%d",
|
||||
fh, field_name, attrib_name, buffer, (long long)*nelems,
|
||||
l_field_name, l_attrib_name);
|
||||
char *field_name2 = h5_strdupfor2c ( field_name, l_field_name );
|
||||
char *attrib_name2 = h5_strdupfor2c ( attrib_name, l_attrib_name );
|
||||
h5_err_t herr = h5_write_field_attrib (
|
||||
fh, field_name2, attrib_name2,
|
||||
#TYPE_HDF5#, buffer, *nelems );
|
||||
free ( field_name2 );
|
||||
free ( attrib_name2 );
|
||||
H5_API_RETURN(herr);
|
||||
}
|
||||
"""
|
||||
|
||||
read_attr_h = """
|
||||
h5_err_t
|
||||
H5BlockReadFieldAttrib#TYPE_ABV# (
|
||||
h5_file_t *const f,
|
||||
const char *field_name,
|
||||
const char *attrib_name,
|
||||
h5_#TYPE_H5P#_t *buffer
|
||||
);
|
||||
"""
|
||||
|
||||
read_attr_c = """
|
||||
/*!
|
||||
\\ingroup h5block_attrib
|
||||
|
||||
Read #TYPE_H5P# values from attribute \\c attrib_name of field
|
||||
\\c field_name into a \\c buffer.
|
||||
|
||||
\\return \\c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
H5BlockReadFieldAttrib#TYPE_ABV# (
|
||||
h5_file_t *const f, /*!< IN: file handle */
|
||||
const char *field_name, /*!< IN: field name */
|
||||
const char *attrib_name, /*!< IN: attribute name */
|
||||
h5_#TYPE_H5P#_t *buffer /*!< OUT: attribute values */
|
||||
) {
|
||||
|
||||
H5_API_ENTER4 (h5_err_t, "f=%p, field_name=\\\"%s\\", attrib_name=\\"%s\\", buffer=0x%p",
|
||||
f, field_name, attrib_name, buffer);
|
||||
H5_API_RETURN(h5_read_field_attrib (
|
||||
f,
|
||||
field_name,
|
||||
attrib_name,
|
||||
#TYPE_HDF5#,
|
||||
(void*)buffer ));
|
||||
}
|
||||
"""
|
||||
|
||||
read_attr_fi = """
|
||||
!> \\ingroup h5block_attrib_f
|
||||
!! See \\ref H5BlockReadFieldAttrib#TYPE_ABV#
|
||||
!! \\return 0 on success or error code
|
||||
!<
|
||||
INTEGER*8 FUNCTION h5bl_readfieldattrib_#TYPE_F90_ABV# ( filehandle, field_name, attrib_name, attrib_value, attrib_nelem)
|
||||
INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open
|
||||
CHARACTER(LEN=*), INTENT(IN) :: field_name !< the name of the field
|
||||
CHARACTER(LEN=*), INTENT(IN) :: attrib_name !< the name of the attribute
|
||||
#TYPE_F90#, INTENT(IN) :: buffer(*) !< the buffer to read into
|
||||
END FUNCTION
|
||||
"""
|
||||
|
||||
read_attr_fc = """
|
||||
#if ! defined(F77_NO_UNDERSCORE)
|
||||
#define h5bl_readfieldattrib_#TYPE_F90_ABV# F77NAME ( \\
|
||||
h5bl_readfieldattrib_#TYPE_F90_ABV#_, \\
|
||||
H5BL_READFIELDATTRIB_#TYPE_F90_ABVC# )
|
||||
#endif
|
||||
|
||||
h5_err_t
|
||||
h5bl_readfieldattrib_#TYPE_F90_ABV# (
|
||||
h5_int64_t *const f,
|
||||
const char *field_name,
|
||||
const char *attrib_name,
|
||||
h5_#TYPE_H5P#_t *buffer,
|
||||
const int l_field_name,
|
||||
const int l_attrib_name
|
||||
) {
|
||||
|
||||
h5_file_t *fh = h5_filehandlefor2c(f);
|
||||
H5_API_ENTER6 (h5_err_t, "f=0x%p, field_name=\\"%s\\", attrib_name=\\"%s\\", "
|
||||
"values=0x%p, l_field_name=%d, l_attrib_name=%d",
|
||||
fh, field_name, attrib_name, buffer,
|
||||
l_field_name, l_attrib_name);
|
||||
char *field_name2 = h5_strdupfor2c ( field_name, l_field_name );
|
||||
char *attrib_name2 = h5_strdupfor2c ( attrib_name, l_attrib_name );
|
||||
h5_err_t herr = h5_read_field_attrib (
|
||||
fh, field_name2, attrib_name2, #TYPE_HDF5#, buffer );
|
||||
free ( field_name2 );
|
||||
free ( attrib_name2 );
|
||||
H5_API_RETURN(herr);
|
||||
}
|
||||
"""
|
||||
|
||||
|
||||
dims = ["3"]
|
||||
types = [
|
||||
["floating points (64-bit)", "Float64", "float64", "H5T_NATIVE_DOUBLE", "REAL*8", "r8", "R8"],
|
||||
["floating points (32-bit)", "Float32", "float32", "H5T_NATIVE_FLOAT", "REAL*4", "r4", "R4"],
|
||||
["integers (64-bit)", "Int64", "int64", "H5T_NATIVE_INT64", "INTEGER*8", "i8", "I8"],
|
||||
["integers (32-bit)", "Int32", "int32", "H5T_NATIVE_INT32", "INTEGER*4", "i4", "I4"]
|
||||
]
|
||||
|
||||
def create_call(template, type, dim):
|
||||
fcn = template
|
||||
fcn = fcn.replace('#DIM#',dim)\
|
||||
.replace('#TYPE_FULL#',type[0])\
|
||||
.replace('#TYPE_ABV#',type[1])\
|
||||
.replace('#TYPE_H5P#',type[2])\
|
||||
.replace('#TYPE_HDF5#',type[3])\
|
||||
.replace('#TYPE_F90#',type[4])\
|
||||
.replace('#TYPE_F90_ABV#',type[5])\
|
||||
.replace('#TYPE_F90_ABVC#',type[6])
|
||||
return fcn
|
||||
|
||||
def write_calls():
|
||||
cfile = file('H5Block_readwrite.c','w')
|
||||
cfile.write(c_head)
|
||||
hfile = file('../include/H5Block_readwrite.h','w')
|
||||
hfile.write(h_head)
|
||||
fcfile = file('../Fortran/H5Block_readwrite_F.c','w')
|
||||
fcfile.write(fc_head)
|
||||
fifile = file('../Fortran/H5Block_readwrite.f90','w')
|
||||
for dim in dims:
|
||||
for type in types:
|
||||
cfile.write(create_call(write_scalar_c,type,dim));
|
||||
cfile.write(create_call(read_scalar_c,type,dim));
|
||||
hfile.write(create_call(write_scalar_h,type,dim));
|
||||
hfile.write(create_call(read_scalar_h,type,dim));
|
||||
fcfile.write(create_call(write_scalar_fc,type,dim));
|
||||
fcfile.write(create_call(read_scalar_fc,type,dim));
|
||||
fifile.write(create_call(write_scalar_fi,type,dim));
|
||||
fifile.write(create_call(read_scalar_fi,type,dim));
|
||||
cfile.write(create_call(write_vector_c,type,dim));
|
||||
cfile.write(create_call(read_vector_c,type,dim));
|
||||
hfile.write(create_call(write_vector_h,type,dim));
|
||||
hfile.write(create_call(read_vector_h,type,dim));
|
||||
fcfile.write(create_call(write_vector_fc,type,dim));
|
||||
fcfile.write(create_call(read_vector_fc,type,dim));
|
||||
fifile.write(create_call(write_vector_fi,type,dim));
|
||||
fifile.write(create_call(read_vector_fi,type,dim));
|
||||
for type in types:
|
||||
cfile.write(create_call(write_attr_c,type,""));
|
||||
hfile.write(create_call(write_attr_h,type,""));
|
||||
fifile.write(create_call(write_attr_fi,type,""));
|
||||
fcfile.write(create_call(write_attr_fc,type,""));
|
||||
cfile.write(create_call(read_attr_c,type,""));
|
||||
hfile.write(create_call(read_attr_h,type,""));
|
||||
fifile.write(create_call(read_attr_fi,type,""));
|
||||
fcfile.write(create_call(read_attr_fc,type,""));
|
||||
cfile.close()
|
||||
hfile.write(h_tail)
|
||||
hfile.close()
|
||||
fcfile.close()
|
||||
fifile.close()
|
||||
|
||||
write_calls()
|
||||
|
||||
@@ -0,0 +1,274 @@
|
||||
/*
|
||||
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(H5_HAVE_PARALLEL)
|
||||
#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
|
||||
) {
|
||||
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_iteration (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_h5hut ());
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* 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 ());
|
||||
}
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -1,324 +0,0 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "h5core/h5_core.h"
|
||||
#include "Underscore.h"
|
||||
|
||||
#if defined(F77_SINGLE_UNDERSCORE)
|
||||
#define F77NAME(a,b) a
|
||||
#elif defined(F77_CRAY_UNDERSCORE)
|
||||
#define F77NAME(a,b) b
|
||||
#elif defined(F77_NO_UNDERSCORE)
|
||||
#else
|
||||
#error Error, no way to determine how to construct fortran bindings
|
||||
#endif
|
||||
|
||||
#if ! defined(F77_NO_UNDERSCORE)
|
||||
|
||||
#define h5bl_3d_setview F77NAME ( \
|
||||
h5bl_3d_setview_, \
|
||||
H5BL_3D_SETVIEW )
|
||||
#define h5bl_3d_getview F77NAME ( \
|
||||
h5bl_3d_getview_, \
|
||||
H5BL_3D_GETVIEW )
|
||||
#define h5bl_3d_setchunk F77NAME ( \
|
||||
h5bl_3d_setchunk_, \
|
||||
H5BL_3D_SETCHUNK )
|
||||
#define h5bl_3d_getreducedview F77NAME ( \
|
||||
h5bl_3d_getreducedview_,\
|
||||
H5BL_3D_GETREDUCEDVIEW )
|
||||
#define h5bl_3d_hasview F77NAME ( \
|
||||
h5bl_hasview_, \
|
||||
H5BL_HASVIEW )
|
||||
#define h5bl_getnumfields F77NAME ( \
|
||||
h5bl_getnumfields_, \
|
||||
H5BL_GETNUMFIELDS )
|
||||
#define h5bl_getfieldinfo F77NAME ( \
|
||||
h5bl_getfieldinfo_, \
|
||||
H5BL_GETFIELDINFO )
|
||||
#define h5bl_writefieldattrib_string F77NAME ( \
|
||||
h5bl_writefieldattrib_string_, \
|
||||
H5BL_WRITEFIELDATTRIB_STRING )
|
||||
#define h5bl_getnfieldattribs F77NAME ( \
|
||||
h5bl_getnfieldattribs_, \
|
||||
H5BL_GETNFIELDATTRIBS )
|
||||
#define h5bl_getfieldattribinfo F77NAME ( \
|
||||
h5bl_getfieldattribinfo_, \
|
||||
h5bl_getfieldattribinfo )
|
||||
#define h5bl_readfieldattrib_string F77NAME ( \
|
||||
h5bl_readfieldattrib_string_, \
|
||||
H5BL_READFIELDATTRIB_STRING )
|
||||
#endif
|
||||
|
||||
h5_err_t
|
||||
h5bl_3d_setview (
|
||||
h5_int64_t *const f,
|
||||
const h5_int64_t *i_start, /*!< start index of i */
|
||||
const h5_int64_t *i_end, /*!< end index of i */
|
||||
const h5_int64_t *j_start, /*!< start index of j */
|
||||
const h5_int64_t *j_end, /*!< end index of j */
|
||||
const h5_int64_t *k_start, /*!< start index of k */
|
||||
const h5_int64_t *k_end /*!< end index of k */
|
||||
) {
|
||||
|
||||
h5_file_t *fh = h5_filehandlefor2c(f);
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, "
|
||||
"i_start=%lld, i_end=%lld, "
|
||||
"j_start=%lld, j_end=%lld, "
|
||||
"k_start=%lld, k_end=%lld",
|
||||
fh,
|
||||
(long long)i_start, (long long)i_end,
|
||||
(long long)j_start, (long long)j_end,
|
||||
(long long)k_start, (long long)k_end);
|
||||
H5_API_RETURN(h5b_3d_set_view (
|
||||
fh,
|
||||
*i_start-1, *i_end-1,
|
||||
*j_start-1, *j_end-1,
|
||||
*k_start-1, *k_end-1 ));
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
h5bl_3d_setchunk (
|
||||
h5_int64_t *const f,
|
||||
const h5_int64_t *i,
|
||||
const h5_int64_t *j,
|
||||
const h5_int64_t *k
|
||||
) {
|
||||
|
||||
h5_file_t *fh = h5_filehandlefor2c(f);
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, i=%lld, j=%lld, k=%lld",
|
||||
fh, (long long)i, (long long)j, (long long)k);
|
||||
H5_API_RETURN(h5b_3d_set_chunk ( fh, *i, *j, *k ));
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
h5bl_3d_getview (
|
||||
h5_int64_t *const f,
|
||||
h5_int64_t *const i_start,
|
||||
h5_int64_t *const i_end,
|
||||
h5_int64_t *const j_start,
|
||||
h5_int64_t *const j_end,
|
||||
h5_int64_t *const k_start,
|
||||
h5_int64_t *const k_end
|
||||
) {
|
||||
|
||||
h5_file_t *fh = h5_filehandlefor2c(f);
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, "
|
||||
"i_start=%p, i_end=%p, "
|
||||
"j_start=%p, j_end=%p, "
|
||||
"k_start=%p, k_end=%p",
|
||||
fh,
|
||||
i_start, i_end,
|
||||
j_start, j_end,
|
||||
k_start, k_end);
|
||||
H5_API_RETURN (h5b_3d_get_view (
|
||||
fh,
|
||||
(h5_size_t*)i_start, (h5_size_t*)i_end,
|
||||
(h5_size_t*)j_start, (h5_size_t*)j_end,
|
||||
(h5_size_t*)k_start, (h5_size_t*)k_end ));
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
h5bl_3d_getreducedview (
|
||||
h5_int64_t *const f,
|
||||
h5_int64_t *const i_start,
|
||||
h5_int64_t *const i_end,
|
||||
h5_int64_t *const j_start,
|
||||
h5_int64_t *const j_end,
|
||||
h5_int64_t *const k_start,
|
||||
h5_int64_t *const k_end
|
||||
) {
|
||||
|
||||
h5_file_t *fh = h5_filehandlefor2c(f);
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, "
|
||||
"i_start=%p, i_end=%p, "
|
||||
"j_start=%p, j_end=%p, "
|
||||
"k_start=%p, k_end=%p",
|
||||
fh,
|
||||
i_start, i_end,
|
||||
j_start, j_end,
|
||||
k_start, k_end);
|
||||
H5_API_RETURN(h5b_3d_get_reduced_view (
|
||||
fh,
|
||||
(h5_size_t*)i_start, (h5_size_t*)i_end,
|
||||
(h5_size_t*)j_start, (h5_size_t*)j_end,
|
||||
(h5_size_t*)k_start, (h5_size_t*)k_end ));
|
||||
}
|
||||
|
||||
h5_int64_t
|
||||
h5bl_3d_hasview (
|
||||
h5_int64_t *const f
|
||||
) {
|
||||
|
||||
h5_file_t *fh = h5_filehandlefor2c(f);
|
||||
H5_API_ENTER (h5_int64_t, "f=%p", fh);
|
||||
H5_API_RETURN (h5b_3d_has_view ( fh ));
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
h5bl_getnumfields (
|
||||
h5_int64_t *const f
|
||||
) {
|
||||
|
||||
h5_file_t *fh = h5_filehandlefor2c(f);
|
||||
H5_API_ENTER (h5_int64_t, "f=%p", fh);
|
||||
H5_API_RETURN (h5b_get_num_fields ( fh ));
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
h5bl_getfieldinfo (
|
||||
h5_int64_t *const f,
|
||||
const h5_int64_t *idx,
|
||||
char *name,
|
||||
h5_size_t *field_rank,
|
||||
h5_size_t *field_dims,
|
||||
h5_size_t *elem_rank,
|
||||
h5_int64_t *type,
|
||||
const int l_name
|
||||
) {
|
||||
|
||||
h5_file_t *fh = h5_filehandlefor2c(f);
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, idx=%lld, "
|
||||
"name=%p,"
|
||||
"field_rank=%p, field_dims=%p, elem_rank=%p, type=%p, l_name=%d",
|
||||
fh, (long long)*idx, name,
|
||||
field_rank, field_dims, elem_rank, type, l_name);
|
||||
h5_err_t herr = h5b_get_field_info (
|
||||
fh, *idx, name, (h5_size_t)l_name,
|
||||
field_rank, field_dims, elem_rank, type );
|
||||
h5_strc2for ( name, l_name );
|
||||
H5_API_RETURN(herr);
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
h5bl_writefieldattrib_string (
|
||||
h5_int64_t *const f,
|
||||
const char *field_name,
|
||||
const char *attrib_name,
|
||||
const char *buffer,
|
||||
const int l_field_name,
|
||||
const int l_attrib_name,
|
||||
const int l_buffer
|
||||
) {
|
||||
|
||||
h5_file_t *fh = h5_filehandlefor2c(f);
|
||||
char *field_name2 = h5_strdupfor2c ( field_name, l_field_name );
|
||||
char *attrib_name2 = h5_strdupfor2c ( attrib_name, l_attrib_name );
|
||||
char *buffer2 = h5_strdupfor2c ( buffer, l_buffer );
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, "
|
||||
"field_name='%s', "
|
||||
"attrib_name='%s', "
|
||||
"buffer='%s', "
|
||||
"l_field_name=%d, "
|
||||
"l_attrib_name=%d, "
|
||||
"l_buffer=%d",
|
||||
fh,
|
||||
field_name2,
|
||||
attrib_name2,
|
||||
buffer2, l_field_name, l_attrib_name, l_buffer);
|
||||
h5_err_t herr = h5_write_field_attrib (
|
||||
fh, field_name2, attrib_name2,
|
||||
H5_STRING_T, buffer2, strlen(buffer2)+1 );
|
||||
|
||||
free ( field_name2 );
|
||||
free ( attrib_name2 );
|
||||
free ( buffer2 );
|
||||
H5_API_RETURN(herr);
|
||||
}
|
||||
|
||||
|
||||
h5_err_t
|
||||
h5bl_getnfieldattribs (
|
||||
h5_int64_t *const f,
|
||||
const char *name,
|
||||
const int l_name
|
||||
) {
|
||||
|
||||
h5_file_t *fh = h5_filehandlefor2c(f);
|
||||
char *name2 = h5_strdupfor2c ( name, l_name );
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, name='%s', l_name=%d", fh, name2, l_name);
|
||||
h5_err_t herr = h5b_get_num_field_attribs ( fh, name2 );
|
||||
free ( name2 );
|
||||
H5_API_RETURN(herr);
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
h5bl_getfieldattribinfo (
|
||||
h5_int64_t *const f,
|
||||
const char *field_name,
|
||||
const h5_int64_t *attrib_idx,
|
||||
char *attrib_name,
|
||||
h5_size_t *attrib_nelem,
|
||||
const int l_field_name,
|
||||
const int l_attrib_name
|
||||
) {
|
||||
|
||||
h5_file_t *fh = h5_filehandlefor2c(f);
|
||||
char *field_name2 = h5_strdupfor2c ( field_name, l_field_name );
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p field_name='%s', "
|
||||
"attrib_idx=%lld, "
|
||||
"attrib_name=%p, "
|
||||
"attrib_nelem=%p, l_field_name=%d, l_attrib_name=%d",
|
||||
fh,
|
||||
field_name2,
|
||||
(long long)*attrib_idx,
|
||||
attrib_name, attrib_nelem, l_field_name, l_attrib_name);
|
||||
|
||||
h5_int64_t attrib_type;
|
||||
h5_err_t herr = h5b_get_field_attrib_info (
|
||||
fh, field_name2, *attrib_idx,
|
||||
attrib_name, l_attrib_name,
|
||||
&attrib_type,
|
||||
attrib_nelem );
|
||||
|
||||
h5_strc2for ( attrib_name, l_attrib_name );
|
||||
|
||||
free ( field_name2 );
|
||||
H5_API_RETURN(herr);
|
||||
}
|
||||
|
||||
|
||||
h5_err_t
|
||||
h5bl_readfieldattrib_string (
|
||||
h5_int64_t *const f,
|
||||
const char *field_name,
|
||||
const char *attrib_name,
|
||||
char *buffer,
|
||||
const int l_field_name,
|
||||
const int l_attrib_name,
|
||||
const int l_buffer
|
||||
) {
|
||||
|
||||
h5_file_t *fh = h5_filehandlefor2c(f);
|
||||
char *field_name2 = h5_strdupfor2c ( field_name, l_field_name );
|
||||
char *attrib_name2 = h5_strdupfor2c ( attrib_name, l_attrib_name );
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, "
|
||||
"field_name='%s', "
|
||||
"attrib_name='%s', "
|
||||
"buffer=%p, l_field_name=%d, l_attrib_name=%d, l_buffer=%d",
|
||||
fh,
|
||||
field_name,
|
||||
attrib_name,
|
||||
buffer, l_field_name, l_attrib_name, l_buffer);
|
||||
|
||||
h5_err_t herr = h5_read_field_attrib (
|
||||
fh, field_name2, attrib_name2,
|
||||
H5_STRING_T, buffer );
|
||||
|
||||
h5_strc2for ( buffer, l_buffer );
|
||||
|
||||
free ( field_name2 );
|
||||
free ( attrib_name2 );
|
||||
|
||||
H5_API_RETURN(herr);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,784 @@
|
||||
/*
|
||||
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/h5b_attribs.h"
|
||||
|
||||
/*
|
||||
__ _ _ _ ___ _ __ _ _
|
||||
/ _` | | | |/ _ \ '__| | | |
|
||||
| (_| | |_| | __/ | | |_| |
|
||||
\__, |\__,_|\___|_| \__, |
|
||||
|_| |___/
|
||||
*/
|
||||
|
||||
#define h5bl_getnfieldattribs FC_MANGLING ( \
|
||||
h5bl_getnfieldattribs, \
|
||||
H5BL_GETNFIELDATTRIBS)
|
||||
h5_int64_t
|
||||
h5bl_getnfieldattribs (
|
||||
const h5_int64_t* const fh,
|
||||
const char* const name,
|
||||
const int l_name
|
||||
) {
|
||||
h5_file_t f = h5_filehandlefor2c (fh);
|
||||
H5_API_ENTER (h5_int64_t,
|
||||
"fh=%p, name='%*s'",
|
||||
(h5_file_p)f, l_name, name);
|
||||
char* name2 = h5_strdupfor2c ( name, l_name );
|
||||
h5_int64_t herr = h5b_get_num_field_attribs (f, name2);
|
||||
free (name2);
|
||||
H5_API_RETURN (herr);
|
||||
}
|
||||
|
||||
#define h5bl_getfieldattribinfo FC_MANGLING ( \
|
||||
h5bl_getfieldattribinfo, \
|
||||
h5bl_getfieldattribinfo)
|
||||
h5_int64_t
|
||||
h5bl_getfieldattribinfo (
|
||||
const h5_int64_t* const fh,
|
||||
const char* const field_name,
|
||||
const h5_int64_t* const attrib_idx,
|
||||
char* const attrib_name,
|
||||
h5_int64_t* const attrib_nelem,
|
||||
const int l_field_name,
|
||||
const int l_attrib_name
|
||||
) {
|
||||
h5_file_t f = h5_filehandlefor2c (fh);
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"fh=%p, field_name='%*s', attrib_idx=%lld, "
|
||||
"attrib_name=%p, attrib_nelem=%p",
|
||||
(h5_file_p)f,
|
||||
l_field_name, field_name,
|
||||
(long long)*attrib_idx,
|
||||
attrib_name, attrib_nelem);
|
||||
|
||||
char *field_name2 = h5_strdupfor2c ( field_name, l_field_name );
|
||||
h5_int64_t attrib_type;
|
||||
h5_int64_t herr = h5b_get_field_attrib_info_by_idx (
|
||||
f,
|
||||
field_name2, *attrib_idx - 1,
|
||||
attrib_name, l_attrib_name,
|
||||
&attrib_type,
|
||||
(h5_size_t*)attrib_nelem );
|
||||
|
||||
h5_strc2for ( attrib_name, l_attrib_name );
|
||||
|
||||
free (field_name2);
|
||||
H5_API_RETURN (herr);
|
||||
}
|
||||
|
||||
/*
|
||||
_ __
|
||||
(_) / /__
|
||||
| | / / _ \
|
||||
| |/ / (_) |
|
||||
|_/_/ \___/
|
||||
*/
|
||||
static inline h5_int64_t
|
||||
write_field_attrib (
|
||||
const h5_file_t fh,
|
||||
const char* field_name,
|
||||
const int l_field_name,
|
||||
const char* attrib_name,
|
||||
const int l_attrib_name,
|
||||
const h5_int64_t attrib_type,
|
||||
const void* attrib_value,
|
||||
const hsize_t attrib_nelems
|
||||
) {
|
||||
char *field_name2 = h5_strdupfor2c (field_name, l_field_name);
|
||||
char *attrib_name2 = h5_strdupfor2c (attrib_name, l_attrib_name);
|
||||
h5_int64_t h5err = h5b_write_field_attrib (
|
||||
fh, field_name2,
|
||||
attrib_name2, attrib_type,
|
||||
attrib_value, attrib_nelems);
|
||||
free (field_name2);
|
||||
free (attrib_name2);
|
||||
return h5err;
|
||||
}
|
||||
|
||||
static inline h5_int64_t
|
||||
read_field_attrib (
|
||||
const h5_file_t fh,
|
||||
const char* field_name,
|
||||
const int l_field_name,
|
||||
const char* attrib_name,
|
||||
const int l_attrib_name,
|
||||
const hid_t attrib_type,
|
||||
void* attrib_value
|
||||
) {
|
||||
char *field_name2 = h5_strdupfor2c (field_name, l_field_name);
|
||||
char *attrib_name2 = h5_strdupfor2c (attrib_name, l_attrib_name);
|
||||
h5_int64_t h5err = h5b_read_field_attrib (
|
||||
fh, field_name2,
|
||||
attrib_name2, attrib_type, attrib_value);
|
||||
free (field_name2);
|
||||
free (attrib_name2);
|
||||
return h5err;
|
||||
}
|
||||
|
||||
/*
|
||||
_ _
|
||||
___| |_ _ __(_)_ __ __ _
|
||||
/ __| __| '__| | '_ \ / _` |
|
||||
\__ \ |_| | | | | | | (_| |
|
||||
|___/\__|_| |_|_| |_|\__, |
|
||||
|___/
|
||||
*/
|
||||
#define h5bl_writefieldattrib_string FC_MANGLING ( \
|
||||
h5bl_writefieldattrib_string, \
|
||||
H5BL_WRITEFIELDATTRIB_STRING)
|
||||
h5_int64_t
|
||||
h5bl_writefieldattrib_string (
|
||||
const h5_int64_t* const fh,
|
||||
const char* const field_name,
|
||||
const char* const attrib_name,
|
||||
const char* const attrib_value,
|
||||
const int l_field_name,
|
||||
const int l_attrib_name,
|
||||
const int l_attrib_value
|
||||
) {
|
||||
h5_file_t f = h5_filehandlefor2c (fh);
|
||||
H5_API_ENTER (h5_int64_t,
|
||||
"fh=%p, field_name='%.*s', "
|
||||
"attrib_name='%.*s' attrib_value='%.*s'",
|
||||
(h5_file_p)f,
|
||||
l_field_name, field_name,
|
||||
l_attrib_name, attrib_name,
|
||||
l_attrib_value, attrib_value);
|
||||
char* attrib_value2 = h5_strdupfor2c (attrib_value, l_attrib_value);
|
||||
h5_int64_t h5err = write_field_attrib (
|
||||
f,
|
||||
field_name, l_field_name,
|
||||
attrib_name, l_attrib_name,
|
||||
H5_STRING_T,
|
||||
attrib_value2, strlen(attrib_value2)+1 );
|
||||
free (attrib_value2);
|
||||
H5_API_RETURN (h5err);
|
||||
}
|
||||
|
||||
#define h5bl_readfieldattrib_string FC_MANGLING ( \
|
||||
h5bl_readfieldattrib_string, \
|
||||
H5BL_READFIELDATTRIB_STRING)
|
||||
h5_err_t
|
||||
h5bl_readfieldattrib_string (
|
||||
const h5_int64_t* const fh,
|
||||
const char* const field_name,
|
||||
const char* const attrib_name,
|
||||
char* const attrib_value,
|
||||
const int l_field_name,
|
||||
const int l_attrib_name,
|
||||
const int l_attrib_value
|
||||
) {
|
||||
h5_file_t f = h5_filehandlefor2c (fh);
|
||||
H5_API_ENTER (h5_int64_t,
|
||||
"f=%p, field_name='%.*s', attrib_name='%.*s' attrib_value='%p'",
|
||||
(h5_file_p)f,
|
||||
l_field_name, field_name,
|
||||
l_attrib_name, attrib_name,
|
||||
attrib_value);
|
||||
h5_int64_t h5err = read_field_attrib (
|
||||
f,
|
||||
field_name, l_field_name,
|
||||
attrib_name, l_attrib_name,
|
||||
H5_STRING_T, attrib_value);
|
||||
|
||||
h5_strc2for (attrib_value, l_attrib_value);
|
||||
H5_API_RETURN (h5err);
|
||||
}
|
||||
|
||||
/*
|
||||
_
|
||||
_ __ ___ __ _| |
|
||||
| '__/ _ \/ _` | |
|
||||
| | | __/ (_| | |
|
||||
|_| \___|\__,_|_|
|
||||
*/
|
||||
#define h5bl_writefieldattrib_r8 FC_MANGLING ( \
|
||||
h5bl_writefieldattrib_r8, \
|
||||
H5BL_WRITEFIELDATTRIB_R8)
|
||||
h5_int64_t
|
||||
h5bl_writefieldattrib_r8 (
|
||||
const h5_int64_t* const fh,
|
||||
const char* const field_name,
|
||||
const char* const attrib_name,
|
||||
const h5_float64_t* const attrib_value,
|
||||
const h5_int64_t* const attrib_nelems,
|
||||
const int l_field_name,
|
||||
const int l_attrib_name
|
||||
) {
|
||||
h5_file_t f = h5_filehandlefor2c (fh);
|
||||
H5_API_ENTER (h5_int64_t,
|
||||
"fh=%p, field_name='%.*s', attrib_name='%.*s', "
|
||||
"attrib_value=%p, attrib_nelems=%lld",
|
||||
(h5_file_p)f,
|
||||
l_field_name, field_name,
|
||||
l_attrib_name, attrib_name,
|
||||
attrib_value, (long long)*attrib_nelems);
|
||||
H5_API_RETURN (write_field_attrib (
|
||||
f,
|
||||
field_name, l_field_name,
|
||||
attrib_name, l_attrib_name,
|
||||
H5_FLOAT64_T,
|
||||
attrib_value, *attrib_nelems));
|
||||
}
|
||||
|
||||
#define h5bl_readfieldattrib_r8 FC_MANGLING ( \
|
||||
h5bl_readfieldattrib_r8, \
|
||||
H5BL_READFIELDATTRIB_R8)
|
||||
h5_err_t
|
||||
h5bl_readfieldattrib_r8 (
|
||||
const h5_int64_t* const fh,
|
||||
const char* const field_name,
|
||||
const char* const attrib_name,
|
||||
h5_float64_t* const attrib_value,
|
||||
const int l_field_name,
|
||||
const int l_attrib_name
|
||||
) {
|
||||
h5_file_t f = h5_filehandlefor2c (fh);
|
||||
H5_API_ENTER (h5_int64_t,
|
||||
"fh=%p, field_name='%.*s', attrib_name='%.*s', "
|
||||
"attrib_value=%p",
|
||||
(h5_file_p)f,
|
||||
l_field_name, field_name,
|
||||
l_attrib_name, attrib_name,
|
||||
attrib_value);
|
||||
H5_API_RETURN (read_field_attrib (
|
||||
f,
|
||||
field_name, l_field_name,
|
||||
attrib_name, l_attrib_name,
|
||||
H5_FLOAT64_T,
|
||||
attrib_value));
|
||||
}
|
||||
|
||||
#define h5bl_writefieldattrib_r4 FC_MANGLING ( \
|
||||
h5bl_writefieldattrib_r4, \
|
||||
H5BL_WRITEFIELDATTRIB_R4)
|
||||
h5_int64_t
|
||||
h5bl_writefieldattrib_r4 (
|
||||
const h5_int64_t* const fh,
|
||||
const char* const field_name,
|
||||
const char* const attrib_name,
|
||||
const h5_float32_t* const attrib_value,
|
||||
const h5_int64_t* const attrib_nelems,
|
||||
const int l_field_name,
|
||||
const int l_attrib_name
|
||||
) {
|
||||
h5_file_t f = h5_filehandlefor2c (fh);
|
||||
H5_API_ENTER (h5_int64_t,
|
||||
"fh=%p, field_name='%.*s', attrib_name='%.*s', "
|
||||
"attrib_value=%p, attrib_nelems=%lld",
|
||||
(h5_file_p)f,
|
||||
l_field_name, field_name,
|
||||
l_attrib_name, attrib_name,
|
||||
attrib_value, (long long)*attrib_nelems);
|
||||
H5_API_RETURN (write_field_attrib (
|
||||
f,
|
||||
field_name, l_field_name,
|
||||
attrib_name, l_attrib_name,
|
||||
H5_FLOAT32_T,
|
||||
attrib_value, *attrib_nelems));
|
||||
}
|
||||
|
||||
#define h5bl_readfieldattrib_r4 FC_MANGLING ( \
|
||||
h5bl_readfieldattrib_r4, \
|
||||
H5BL_READFIELDATTRIB_R4)
|
||||
h5_err_t
|
||||
h5bl_readfieldattrib_r4 (
|
||||
const h5_int64_t* const fh,
|
||||
const char* const field_name,
|
||||
const char* const attrib_name,
|
||||
h5_float32_t* const attrib_value,
|
||||
const int l_field_name,
|
||||
const int l_attrib_name
|
||||
) {
|
||||
h5_file_t f = h5_filehandlefor2c (fh);
|
||||
H5_API_ENTER (h5_int64_t,
|
||||
"fh=%p, field_name='%.*s', attrib_name='%.*s', "
|
||||
"attrib_value=%p",
|
||||
(h5_file_p)f,
|
||||
l_field_name, field_name,
|
||||
l_attrib_name, attrib_name,
|
||||
attrib_value);
|
||||
H5_API_RETURN (read_field_attrib (
|
||||
f,
|
||||
field_name, l_field_name,
|
||||
attrib_name, l_attrib_name,
|
||||
H5_FLOAT32_T,
|
||||
attrib_value));
|
||||
}
|
||||
|
||||
/*
|
||||
_ _
|
||||
(_)_ __ | |_ ___ __ _ ___ _ __
|
||||
| | '_ \| __/ _ \/ _` |/ _ \ '__|
|
||||
| | | | | || __/ (_| | __/ |
|
||||
|_|_| |_|\__\___|\__, |\___|_|
|
||||
|___/
|
||||
*/
|
||||
#define h5bl_writefieldattrib_i8 FC_MANGLING ( \
|
||||
h5bl_writefieldattrib_i8, \
|
||||
H5BL_WRITEFIELDATTRIB_I8)
|
||||
h5_int64_t
|
||||
h5bl_writefieldattrib_i8 (
|
||||
const h5_int64_t* const fh,
|
||||
const char* const field_name,
|
||||
const char* const attrib_name,
|
||||
const h5_int64_t* const attrib_value,
|
||||
const h5_int64_t* const attrib_nelems,
|
||||
const int l_field_name,
|
||||
const int l_attrib_name
|
||||
) {
|
||||
h5_file_t f = h5_filehandlefor2c (fh);
|
||||
H5_API_ENTER (h5_int64_t,
|
||||
"fh=%p, field_name='%.*s', attrib_name='%.*s', "
|
||||
"attrib_value=%p, attrib_nelems=%lld",
|
||||
(h5_file_p)f,
|
||||
l_field_name, field_name,
|
||||
l_attrib_name, attrib_name,
|
||||
attrib_value, (long long)*attrib_nelems);
|
||||
H5_API_RETURN (write_field_attrib (
|
||||
f,
|
||||
field_name, l_field_name,
|
||||
attrib_name, l_attrib_name,
|
||||
H5_INT64_T,
|
||||
attrib_value, *attrib_nelems));
|
||||
}
|
||||
|
||||
#define h5bl_readfieldattrib_i8 FC_MANGLING ( \
|
||||
h5bl_readfieldattrib_i8, \
|
||||
H5BL_READFIELDATTRIB_I8)
|
||||
h5_err_t
|
||||
h5bl_readfieldattrib_i8 (
|
||||
const h5_int64_t* const fh,
|
||||
const char* const field_name,
|
||||
const char* const attrib_name,
|
||||
h5_int64_t* const attrib_value,
|
||||
const int l_field_name,
|
||||
const int l_attrib_name,
|
||||
const int l_attrib_value
|
||||
) {
|
||||
h5_file_t f = h5_filehandlefor2c (fh);
|
||||
H5_API_ENTER (h5_int64_t,
|
||||
"fh=%p, field_name='%.*s', attrib_name='%.*s', "
|
||||
"attrib_value=%p",
|
||||
(h5_file_p)f,
|
||||
l_field_name, field_name,
|
||||
l_attrib_name, attrib_name,
|
||||
attrib_value);
|
||||
H5_API_RETURN (read_field_attrib (
|
||||
f,
|
||||
field_name, l_field_name,
|
||||
attrib_name, l_attrib_name,
|
||||
H5_INT64_T,
|
||||
attrib_value));
|
||||
}
|
||||
|
||||
#define h5bl_writefieldattrib_i4 FC_MANGLING ( \
|
||||
h5bl_writefieldattrib_i4, \
|
||||
H5BL_WRITEFIELDATTRIB_I4 )
|
||||
h5_int64_t
|
||||
h5bl_writefieldattrib_i4 (
|
||||
const h5_int64_t* const fh,
|
||||
const char* const field_name,
|
||||
const char* const attrib_name,
|
||||
const h5_int32_t* const attrib_value,
|
||||
const h5_int64_t* const attrib_nelems,
|
||||
const int l_field_name,
|
||||
const int l_attrib_name
|
||||
) {
|
||||
h5_file_t f = h5_filehandlefor2c (fh);
|
||||
H5_API_ENTER (h5_int64_t,
|
||||
"fh=%p, field_name='%.*s', attrib_name='%.*s', "
|
||||
"attrib_value=%p, attrib_nelems=%lld",
|
||||
(h5_file_p)f,
|
||||
l_field_name, field_name,
|
||||
l_attrib_name, attrib_name,
|
||||
attrib_value, (long long)*attrib_nelems);
|
||||
H5_API_RETURN (write_field_attrib (
|
||||
f,
|
||||
field_name, l_field_name,
|
||||
attrib_name, l_attrib_name,
|
||||
H5_INT32_T,
|
||||
attrib_value, *attrib_nelems));
|
||||
}
|
||||
|
||||
#define h5bl_readfieldattrib_i4 FC_MANGLING ( \
|
||||
h5bl_readfieldattrib_i4, \
|
||||
H5BL_READFIELDATTRIB_I4)
|
||||
h5_err_t
|
||||
h5bl_readfieldattrib_i4 (
|
||||
const h5_int64_t* const fh,
|
||||
const char* const field_name,
|
||||
const char* const attrib_name,
|
||||
h5_int32_t* const attrib_value,
|
||||
const int l_field_name,
|
||||
const int l_attrib_name
|
||||
) {
|
||||
h5_file_t f = h5_filehandlefor2c (fh);
|
||||
H5_API_ENTER (h5_int64_t,
|
||||
"fh=%p, field_name='%.*s', attrib_name='%.*s', "
|
||||
"attrib_value=%p",
|
||||
(h5_file_p)f,
|
||||
l_field_name, field_name,
|
||||
l_attrib_name, attrib_name,
|
||||
attrib_value);
|
||||
H5_API_RETURN (read_field_attrib (
|
||||
f,
|
||||
field_name, l_field_name,
|
||||
attrib_name, l_attrib_name,
|
||||
H5_INT32_T,
|
||||
attrib_value));
|
||||
}
|
||||
|
||||
#define h5bl_get_fieldorigin FC_MANGLING ( \
|
||||
h5bl_get_fieldorigin, \
|
||||
H5BL_GET_FIELDORIGIN)
|
||||
|
||||
h5_int64_t
|
||||
h5bl_get_fieldorigin (
|
||||
const h5_int64_t* const fh,
|
||||
const char* const field_name,
|
||||
h5_float64_t* const x_origin,
|
||||
h5_float64_t* const y_origin,
|
||||
h5_float64_t* const z_origin,
|
||||
const int l_field_name
|
||||
) {
|
||||
h5_file_t f = h5_filehandlefor2c (fh);
|
||||
H5_API_ENTER (h5_int64_t,
|
||||
"fh=%p, field_name='%.*s'"
|
||||
", x_origin=%p"
|
||||
", y_origin=%p"
|
||||
", z_origin=%p",
|
||||
(h5_file_p)f,
|
||||
l_field_name, field_name,
|
||||
x_origin, y_origin, z_origin);
|
||||
h5_float64_t origin[3];
|
||||
TRY (read_field_attrib (
|
||||
f,
|
||||
field_name, l_field_name,
|
||||
H5BLOCK_FIELD_ORIGIN_NAME, sizeof (H5BLOCK_FIELD_ORIGIN_NAME),
|
||||
H5_FLOAT64_T,
|
||||
origin));
|
||||
*x_origin = origin[0];
|
||||
*y_origin = origin[1];
|
||||
*z_origin = origin[2];
|
||||
|
||||
H5_API_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
#define h5bl_set_fieldorigin FC_MANGLING ( \
|
||||
h5bl_set_fieldorigin, \
|
||||
H5BL_SET_FIELDORIGIN)
|
||||
|
||||
h5_int64_t
|
||||
h5bl_set_fieldorigin (
|
||||
const h5_int64_t* const fh,
|
||||
const char* const field_name,
|
||||
h5_float64_t* const x_origin,
|
||||
h5_float64_t* const y_origin,
|
||||
h5_float64_t* const z_origin,
|
||||
const int l_field_name
|
||||
) {
|
||||
h5_file_t f = h5_filehandlefor2c (fh);
|
||||
H5_API_ENTER (h5_int64_t,
|
||||
"fh=%p, field_name='%.*s'"
|
||||
", x_origin=%g"
|
||||
", y_origin=%g"
|
||||
", z_origin=%g",
|
||||
(h5_file_p)f,
|
||||
l_field_name, field_name,
|
||||
*x_origin, *y_origin, *z_origin);
|
||||
h5_float64_t origin[3] = { *x_origin, *y_origin, *z_origin };
|
||||
TRY (write_field_attrib (
|
||||
f,
|
||||
field_name, l_field_name,
|
||||
H5BLOCK_FIELD_ORIGIN_NAME, sizeof (H5BLOCK_FIELD_ORIGIN_NAME),
|
||||
H5_FLOAT64_T,
|
||||
origin, 3));
|
||||
|
||||
H5_API_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
#define h5bl_get_fieldspacing FC_MANGLING ( \
|
||||
h5bl_get_fieldspacing, \
|
||||
H5BL_GET_FIELDSPACING)
|
||||
|
||||
h5_int64_t
|
||||
h5bl_get_fieldspacing (
|
||||
const h5_int64_t* const fh,
|
||||
const char* const field_name,
|
||||
h5_float64_t* const x_spacing,
|
||||
h5_float64_t* const y_spacing,
|
||||
h5_float64_t* const z_spacing,
|
||||
const int l_field_name
|
||||
) {
|
||||
h5_file_t f = h5_filehandlefor2c (fh);
|
||||
H5_API_ENTER (h5_int64_t,
|
||||
"fh=%p, field_name='%.*s'"
|
||||
", x_spacing=%p"
|
||||
", y_spacing=%p"
|
||||
", z_spacing=%p",
|
||||
(h5_file_p)f,
|
||||
l_field_name, field_name,
|
||||
x_spacing, y_spacing, z_spacing);
|
||||
h5_float64_t spacing[3];
|
||||
TRY (read_field_attrib (
|
||||
f,
|
||||
field_name, l_field_name,
|
||||
H5BLOCK_FIELD_ORIGIN_NAME, sizeof (H5BLOCK_FIELD_ORIGIN_NAME),
|
||||
H5_FLOAT64_T,
|
||||
spacing));
|
||||
*x_spacing = spacing[0];
|
||||
*y_spacing = spacing[1];
|
||||
*z_spacing = spacing[2];
|
||||
|
||||
H5_API_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
#define h5bl_set_fieldspacing FC_MANGLING ( \
|
||||
h5bl_set_fieldspacing, \
|
||||
H5BL_SET_FIELDSPACING)
|
||||
|
||||
h5_int64_t
|
||||
h5bl_set_fieldspacing (
|
||||
const h5_int64_t* const fh,
|
||||
const char* const field_name,
|
||||
h5_float64_t* const x_spacing,
|
||||
h5_float64_t* const y_spacing,
|
||||
h5_float64_t* const z_spacing,
|
||||
const int l_field_name
|
||||
) {
|
||||
h5_file_t f = h5_filehandlefor2c (fh);
|
||||
H5_API_ENTER (h5_int64_t,
|
||||
"fh=%p, field_name='%.*s'"
|
||||
", x_spacing=%g"
|
||||
", y_spacing=%g"
|
||||
", z_spacing=%g",
|
||||
(h5_file_p)f,
|
||||
l_field_name, field_name,
|
||||
*x_spacing, *y_spacing, *z_spacing);
|
||||
h5_float64_t spacing[3] = { *x_spacing, *y_spacing, *z_spacing };
|
||||
TRY (read_field_attrib (
|
||||
f,
|
||||
field_name, l_field_name,
|
||||
H5BLOCK_FIELD_ORIGIN_NAME, sizeof (H5BLOCK_FIELD_SPACING_NAME),
|
||||
H5_FLOAT64_T,
|
||||
spacing));
|
||||
|
||||
H5_API_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
|
||||
static inline h5_int64_t
|
||||
set_field_coords (
|
||||
const h5_file_t f,
|
||||
int rank,
|
||||
const char* field_name,
|
||||
const int l_field_name,
|
||||
const char* attrib_name,
|
||||
const int l_attrib_name,
|
||||
const h5_float64_t* coords,
|
||||
const h5_int64_t n_coords
|
||||
) {
|
||||
char *field_name2 = h5_strdupfor2c (field_name, l_field_name);
|
||||
char *attrib_name2 = h5_strdupfor2c (attrib_name, l_attrib_name);
|
||||
|
||||
h5_int64_t h5err = h5b_set_3d_field_coords (
|
||||
f, rank,
|
||||
field_name2, attrib_name2,
|
||||
coords, n_coords);
|
||||
|
||||
free (field_name2);
|
||||
free (attrib_name2);
|
||||
|
||||
return (h5err);
|
||||
}
|
||||
|
||||
static inline h5_int64_t
|
||||
get_field_coords (
|
||||
const h5_file_t f,
|
||||
int rank,
|
||||
const char* field_name,
|
||||
const int l_field_name,
|
||||
const char* attrib_name,
|
||||
const int l_attrib_name,
|
||||
h5_float64_t* const coords,
|
||||
const h5_int64_t n_coords
|
||||
) {
|
||||
char *field_name2 = h5_strdupfor2c (field_name, l_field_name);
|
||||
char *attrib_name2 = h5_strdupfor2c (attrib_name, l_attrib_name);
|
||||
|
||||
h5_int64_t h5err = h5b_get_3d_field_coords (
|
||||
f, rank,
|
||||
field_name2, attrib_name2,
|
||||
coords, n_coords);
|
||||
|
||||
free (field_name2);
|
||||
free (attrib_name2);
|
||||
|
||||
return (h5err);
|
||||
}
|
||||
|
||||
#define h5bl_set_fieldxcoords FC_MANGLING ( \
|
||||
h5bl_set_fieldxcoords, \
|
||||
H5BL_SET_FIELDXCOORDS)
|
||||
h5_int64_t
|
||||
h5bl_set_fieldxcoords (
|
||||
const h5_int64_t* const fh,
|
||||
const char* const field_name,
|
||||
h5_float64_t* const coords,
|
||||
const h5_int64_t* n_coords,
|
||||
const int l_field_name
|
||||
) {
|
||||
h5_file_t f = h5_filehandlefor2c (fh);
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"fh=%p, field_name='%.*s'"
|
||||
"coords=%p, n_coords=%llu",
|
||||
(h5_file_p)f,
|
||||
l_field_name, field_name,
|
||||
coords, (long long unsigned)n_coords);
|
||||
H5_API_RETURN (set_field_coords (
|
||||
f, 0,
|
||||
field_name, l_field_name,
|
||||
H5BLOCK_FIELD_XCOORD_NAME, sizeof(H5BLOCK_FIELD_XCOORD_NAME),
|
||||
coords, *n_coords));
|
||||
}
|
||||
|
||||
#define h5bl_get_fieldxcoords FC_MANGLING ( \
|
||||
h5bl_get_fieldxcoords, \
|
||||
H5BL_GET_FIELDXCOORDS)
|
||||
h5_int64_t
|
||||
h5bl_get_fieldxcoords (
|
||||
const h5_int64_t* const fh,
|
||||
const char* const field_name,
|
||||
h5_float64_t* const coords,
|
||||
const h5_int64_t* n_coords,
|
||||
const int l_field_name
|
||||
) {
|
||||
h5_file_t f = h5_filehandlefor2c (fh);
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"fh=%p"
|
||||
", field_name='%.*s'"
|
||||
", coords=%p, n_coords=%llu",
|
||||
(h5_file_p)f,
|
||||
l_field_name, field_name,
|
||||
coords, (long long unsigned)n_coords);
|
||||
H5_API_RETURN (get_field_coords (
|
||||
f, 0,
|
||||
field_name, l_field_name,
|
||||
H5BLOCK_FIELD_XCOORD_NAME, sizeof (H5BLOCK_FIELD_XCOORD_NAME),
|
||||
coords, *n_coords));
|
||||
}
|
||||
|
||||
#define h5bl_set_fieldycoords FC_MANGLING ( \
|
||||
h5bl_set_fieldycoords, \
|
||||
H5BL_SET_FIELDYCOORDS)
|
||||
h5_int64_t
|
||||
h5bl_set_fieldycoords (
|
||||
const h5_int64_t* const fh,
|
||||
const char* const field_name,
|
||||
h5_float64_t* const coords,
|
||||
const h5_int64_t* n_coords,
|
||||
const int l_field_name
|
||||
) {
|
||||
h5_file_t f = h5_filehandlefor2c (fh);
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"fh=%p"
|
||||
", field_name='%.*s'"
|
||||
", coords=%p, n_coords=%llu",
|
||||
(h5_file_p)f,
|
||||
l_field_name, field_name,
|
||||
coords, (long long unsigned)n_coords);
|
||||
H5_API_RETURN (set_field_coords (
|
||||
f, 1,
|
||||
field_name, l_field_name,
|
||||
H5BLOCK_FIELD_YCOORD_NAME, sizeof (H5BLOCK_FIELD_YCOORD_NAME),
|
||||
coords, *n_coords));
|
||||
}
|
||||
|
||||
#define h5bl_get_fieldycoords FC_MANGLING ( \
|
||||
h5bl_get_fieldycoords, \
|
||||
H5BL_GET_FIELDyCOORDS)
|
||||
h5_int64_t
|
||||
h5bl_get_fieldycoords (
|
||||
const h5_int64_t* const fh,
|
||||
const char* const field_name,
|
||||
h5_float64_t* const coords,
|
||||
const h5_int64_t* n_coords,
|
||||
const int l_field_name
|
||||
) {
|
||||
h5_file_t f = h5_filehandlefor2c (fh);
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"fh=%p"
|
||||
", field_name='%.*s'"
|
||||
", coords=%p, n_coords=%llu",
|
||||
(h5_file_p)f,
|
||||
l_field_name, field_name,
|
||||
coords, (long long unsigned)n_coords);
|
||||
H5_API_RETURN (get_field_coords (
|
||||
f, 1,
|
||||
field_name, l_field_name,
|
||||
H5BLOCK_FIELD_YCOORD_NAME, sizeof (H5BLOCK_FIELD_YCOORD_NAME),
|
||||
coords, *n_coords));
|
||||
}
|
||||
|
||||
|
||||
#define h5bl_set_fieldzcoords FC_MANGLING ( \
|
||||
h5bl_set_fieldzcoords, \
|
||||
H5BL_SET_FIELDZCOORDS)
|
||||
h5_int64_t
|
||||
h5bl_set_fieldzcoords (
|
||||
const h5_int64_t* const fh,
|
||||
const char* const field_name,
|
||||
h5_float64_t* const coords,
|
||||
const h5_int64_t* n_coords,
|
||||
const int l_field_name
|
||||
) {
|
||||
h5_file_t f = h5_filehandlefor2c (fh);
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"fh=%p"
|
||||
", field_name='%.*s'"
|
||||
", coords=%p, n_coords=%llu",
|
||||
(h5_file_p)f,
|
||||
l_field_name, field_name,
|
||||
coords, (long long unsigned)n_coords);
|
||||
H5_API_RETURN (set_field_coords (
|
||||
f, 2,
|
||||
field_name, l_field_name,
|
||||
H5BLOCK_FIELD_ZCOORD_NAME, sizeof (H5BLOCK_FIELD_ZCOORD_NAME),
|
||||
coords, *n_coords));
|
||||
}
|
||||
|
||||
#define h5bl_get_fieldzcoords FC_MANGLING ( \
|
||||
h5bl_get_fieldzcoords, \
|
||||
H5BL_GET_FIELDZCOORDS)
|
||||
h5_int64_t
|
||||
h5bl_get_fieldzcoords (
|
||||
const h5_int64_t* const fh,
|
||||
const char* const field_name,
|
||||
h5_float64_t* const coords,
|
||||
const h5_int64_t* n_coords,
|
||||
const int l_field_name
|
||||
) {
|
||||
h5_file_t f = h5_filehandlefor2c (fh);
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"fh=%p"
|
||||
", field_name='%.*s'"
|
||||
"coords=%p, n_coords=%llu",
|
||||
(h5_file_p)f,
|
||||
l_field_name, field_name,
|
||||
coords, (long long unsigned)n_coords);
|
||||
H5_API_RETURN (get_field_coords (
|
||||
f, 2,
|
||||
field_name, l_field_name,
|
||||
H5BLOCK_FIELD_ZCOORD_NAME, sizeof (H5BLOCK_FIELD_ZCOORD_NAME),
|
||||
coords, *n_coords));
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user