Compare commits
27 Commits
H5Part-1.4
...
1.4
| Author | SHA1 | Date | |
|---|---|---|---|
| f40c99b10c | |||
| f816f1d9ff | |||
| ccdaca55c5 | |||
| 35db555dce | |||
| 5333ff810f | |||
| 4e988bd0d6 | |||
| 72ebca84e0 | |||
| 02eae3a724 | |||
| 6fc16f9e3e | |||
| 9b0c18cd40 | |||
| 9d299def98 | |||
| 491c0a0fb1 | |||
| d0e6cc3a63 | |||
| ed4d8af66e | |||
| e3f2584c8c | |||
| 6633dace44 | |||
| 11bc7db824 | |||
| 34eea1e11a | |||
| e72d5f351f | |||
| 72fe466514 | |||
| da4a5e9080 | |||
| 06da58b100 | |||
| d41a59f991 | |||
| a927ae4d67 | |||
| 249117c89e | |||
| 463ef08da9 | |||
| 607d1e86ab |
+3
-2
@@ -1,15 +1,15 @@
|
|||||||
* text=auto !eol
|
* text=auto !eol
|
||||||
/AUTHORS -text
|
/AUTHORS -text
|
||||||
/COPYRIGHT -text
|
/COPYING -text
|
||||||
/ChangeLog -text
|
/ChangeLog -text
|
||||||
/GNUmakefile.orig -text
|
/GNUmakefile.orig -text
|
||||||
|
/INSTALL -text
|
||||||
/Makefile.am -text
|
/Makefile.am -text
|
||||||
/Makefile.orig -text
|
/Makefile.orig -text
|
||||||
/NEWS -text
|
/NEWS -text
|
||||||
/README -text
|
/README -text
|
||||||
/autogen.sh -text
|
/autogen.sh -text
|
||||||
/config.guess -text
|
/config.guess -text
|
||||||
/config.h.in -text
|
|
||||||
/config.sub -text
|
/config.sub -text
|
||||||
/configure.ac -text
|
/configure.ac -text
|
||||||
/depcomp -text
|
/depcomp -text
|
||||||
@@ -56,6 +56,7 @@ test/H5testFpar.f90 -text
|
|||||||
test/Makefile.am -text
|
test/Makefile.am -text
|
||||||
tools/Makefile.am -text
|
tools/Makefile.am -text
|
||||||
tools/README -text
|
tools/README -text
|
||||||
|
tools/h5ToVtk.cc -text
|
||||||
tools/h5pAttrib.cc -text
|
tools/h5pAttrib.cc -text
|
||||||
tools/h5pToGNUplot.cc -text
|
tools/h5pToGNUplot.cc -text
|
||||||
tools/homdynToH5p.cc -text
|
tools/homdynToH5p.cc -text
|
||||||
|
|||||||
@@ -6,5 +6,6 @@ Benedikt Oswald (PSI)
|
|||||||
Wes Bethel (NERSC/LBNL)
|
Wes Bethel (NERSC/LBNL)
|
||||||
John Shalf (NERSC/LBNL)
|
John Shalf (NERSC/LBNL)
|
||||||
Cristina Siegerist (NERSC/LBNL)
|
Cristina Siegerist (NERSC/LBNL)
|
||||||
|
Mark Howison (NERSC/LBNL)
|
||||||
|
|
||||||
Please use h5part@lists.psi.ch for communicaion.
|
Please use h5part@lists.psi.ch for communicaion.
|
||||||
|
|||||||
@@ -0,0 +1,71 @@
|
|||||||
|
*** Copyright Notice ***
|
||||||
|
|
||||||
|
H5Part Copyright (c) 2006-2009, 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.
|
||||||
|
|
||||||
|
If you have questions about your rights to use or distribute this
|
||||||
|
software, please contact Berkeley Lab's Technology Transfer Department
|
||||||
|
at TTD@lbl.gov referring to "H5Part (LBNL Ref CR-2255)"
|
||||||
|
|
||||||
|
NOTICE. This software was developed under partial funding from the U.S.
|
||||||
|
Department of Energy. As such, the U.S. Government has been granted for
|
||||||
|
itself and others acting on its behalf a paid-up, nonexclusive,
|
||||||
|
irrevocable, worldwide license in the Software to reproduce, prepare
|
||||||
|
derivative works, and perform publicly and display publicly. Beginning
|
||||||
|
five (5) years after the date permission to assert copyright is obtained
|
||||||
|
from the U.S. Department of Energy, and subject to any subsequent five
|
||||||
|
(5) year renewals, the U.S. Government is granted for itself and others
|
||||||
|
acting on its behalf a paid-up, nonexclusive, irrevocable, worldwide
|
||||||
|
license in the Software to reproduce, prepare derivative works,
|
||||||
|
distribute copies to the public, perform publicly and display publicly,
|
||||||
|
and to permit others to do so.
|
||||||
|
|
||||||
|
|
||||||
|
*** License agreement ***
|
||||||
|
|
||||||
|
H5Part Copyright (c) 2006-2009, 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.
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
modification, are permitted provided that the following conditions are met:
|
||||||
|
|
||||||
|
(1) Redistributions of source code must retain the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimer.
|
||||||
|
|
||||||
|
(2) Redistributions in binary form must reproduce the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimer in the
|
||||||
|
documentation and/or other materials provided with the distribution.
|
||||||
|
|
||||||
|
(3) Neither the name of the University of California, Lawrence Berkeley
|
||||||
|
National Laboratory, U.S. Dept. of Energy, Paul Scherrer Institut
|
||||||
|
(Switzerland) nor the names of its contributors may be used to endorse
|
||||||
|
or promote products derived from this software without specific prior
|
||||||
|
written permission.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
|
||||||
|
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||||
|
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||||
|
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
|
||||||
|
OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
|
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||||
|
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||||
|
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
|
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
You are under no obligation whatsoever to provide any bug fixes,
|
||||||
|
patches, or upgrades to the features, functionality or performance of
|
||||||
|
the source code ("Enhancements") to anyone; however, if you choose to
|
||||||
|
make your Enhancements available either publicly, or directly to
|
||||||
|
Lawrence Berkeley National Laboratory, without imposing a separate
|
||||||
|
written license agreement for such Enhancements, then you hereby grant
|
||||||
|
the following license: a non-exclusive, royalty-free perpetual license
|
||||||
|
to install, use, modify, prepare derivative works, incorporate into
|
||||||
|
other computer software, distribute, and sublicense such enhancements or
|
||||||
|
derivative works thereof, in binary and source code form.
|
||||||
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
*** Copyright Notice ***
|
|
||||||
|
|
||||||
H5Part Copyright (c) 2006, 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.
|
|
||||||
|
|
||||||
If you have questions about your rights to use or distribute this software, please contact Berkeley Lab's Technology Transfer Department at TTD@lbl.gov referring to "H5Part (LBNL Ref CR-2255)"
|
|
||||||
|
|
||||||
NOTICE. This software was developed under partial funding from the U.S. Department of Energy. As such, the U.S. Government has been granted for itself and others acting on its behalf a paid-up, nonexclusive, irrevocable, worldwide license in the Software to reproduce, prepare derivative works, and perform publicly and display publicly. Beginning five (5) years after the date permission to assert copyright is obtained from the U.S. Department of Energy, and subject to any subsequent five (5) year renewals, the U.S. Government is granted for itself and others acting on its behalf a paid-up, nonexclusive, irrevocable, worldwide license in the Software to reproduce, prepare derivative works, distribute copies to the public, perform publicly and display publicly, and to permit others to do so.
|
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
2008-12-19 Mark Howison <mhowison@lbl.gov>
|
||||||
|
|
||||||
|
* Added support for HDF 1.8.1.
|
||||||
|
|
||||||
|
* Added float32 and int64 versions of the H5Block scalar field
|
||||||
|
read/write functions, using a new naming convention:
|
||||||
|
|
||||||
|
H5Block3dWriteScalarFieldFloat64() (was H5Block3dWriteScalarField())
|
||||||
|
H5Block3dWriteScalarFieldFloat32() (new)
|
||||||
|
H5Block3dWriteScalarFieldInt64() (new)
|
||||||
|
|
||||||
|
* Modified _write_data() in H5Block to write arbitrary data types.
|
||||||
|
|
||||||
|
* Fixed a bug in the configure script which was preventing
|
||||||
|
compilation of the FORTRAN library on Cray XT4 architectures.
|
||||||
|
|
||||||
|
* Added the "--with-mpiposix" option to the configure script to enable
|
||||||
|
the MPI-POSIX VFD in the HDF5 layer.
|
||||||
|
|
||||||
|
2008-11-20 Andreas Adelmann <andreas.adelmann@psi.ch>
|
||||||
|
|
||||||
|
* Fixed a bug in ./test/H5BlockTestAttributes.c
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,437 @@
|
|||||||
|
==============================================================================
|
||||||
|
README file for H5Part configure
|
||||||
|
==============================================================================
|
||||||
|
|
||||||
|
+ 0. HDF5 library
|
||||||
|
-----------------
|
||||||
|
|
||||||
|
Make sure you have a working version of the HDF5 library installed. If you plan
|
||||||
|
to use parallel I/O you need to use a parallel HDF5 version. Source files and
|
||||||
|
installation instructions are available from the HDF5 website:
|
||||||
|
|
||||||
|
http://www.hdfgroup.org/HDF5/
|
||||||
|
|
||||||
|
|
||||||
|
+ 1. Quick start (If you feel lucky...)
|
||||||
|
----------------------------------------
|
||||||
|
|
||||||
|
For many platforms, where compilers are installed in the "default" location
|
||||||
|
and all the environment variables are set correctly, it should be sufficient
|
||||||
|
to type:
|
||||||
|
|
||||||
|
./configure [OPTIONS] && make [install]
|
||||||
|
|
||||||
|
to have the libraries and test program compiled.
|
||||||
|
|
||||||
|
|
||||||
|
+ 2. Configure line options
|
||||||
|
----------------------------
|
||||||
|
|
||||||
|
To view a full list of configure option, use:
|
||||||
|
|
||||||
|
./configure --help
|
||||||
|
|
||||||
|
(1) Enable options
|
||||||
|
--enable-fortran
|
||||||
|
--enable-parallel
|
||||||
|
--enable-tools
|
||||||
|
--enable-python
|
||||||
|
--enable-64 (only for AIX and Irix)
|
||||||
|
|
||||||
|
(2) Setting compilers related variables manually
|
||||||
|
To assign environment variables (e.g., CC, CFLAGS...), specify them as
|
||||||
|
VAR=VALUE before running configure. For example, if you are using the bash
|
||||||
|
shell, you might type:
|
||||||
|
|
||||||
|
export CC=gcc
|
||||||
|
|
||||||
|
to set the default C compiler. See below for descriptions of some useful
|
||||||
|
variables.
|
||||||
|
|
||||||
|
Compiler environment variables:
|
||||||
|
CC C compiler command
|
||||||
|
CXX C++ compiler command
|
||||||
|
FC Fortran compiler command
|
||||||
|
MPICC MPI-enabled C compiler command
|
||||||
|
MPICXX MPI-enabled C++ compiler command
|
||||||
|
MPIFC MPI-enabled Fortran compiler command
|
||||||
|
CFLAGS flags to append when invoking the C compiler
|
||||||
|
|
||||||
|
Library environment variables:
|
||||||
|
LDFLAGS flags to append when invoking the linker
|
||||||
|
|
||||||
|
(3) Setting prefix for installation manually (by default, the package will
|
||||||
|
install itself in the 'build' subdirectory of your source directory)
|
||||||
|
--prefix=PREFIX install files in PREFIX
|
||||||
|
|
||||||
|
|
||||||
|
+ 3. Platform specific settings for compiling libraries & test programs
|
||||||
|
------------------------------------------------------------------------
|
||||||
|
|
||||||
|
Building
|
||||||
|
make : builds the libraries and test programs
|
||||||
|
make install: builds and installs
|
||||||
|
make clean : removes extraneous object files
|
||||||
|
make distclean : returns configuration to unconfigured state
|
||||||
|
|
||||||
|
As tested on hosts:
|
||||||
|
|
||||||
|
(0) Franklin <franklin.nersc.gov> (CNL - Cray XT4)
|
||||||
|
--------------------------------------------------
|
||||||
|
|
||||||
|
module add hdf5_par
|
||||||
|
module add zlib
|
||||||
|
module add szip
|
||||||
|
export CC=cc CXX=CC FC=ftn MPICC=cc MPICXX=CC MPIFC=ftn
|
||||||
|
export LDFLAGS=$HDF5
|
||||||
|
./configure --enable-fortran --enable-parallel --with-hdf5path=$HDF5_PAR_DIR --with-mpiposix
|
||||||
|
make install
|
||||||
|
|
||||||
|
|
||||||
|
(1) Davinci <davinci.nersc.gov> (Linux"SUSE"-ia64)
|
||||||
|
---------------------------------------------------
|
||||||
|
FIRST THING FIRST!! Type:
|
||||||
|
|
||||||
|
module load intel
|
||||||
|
to have the proper compilers set up for use.
|
||||||
|
|
||||||
|
module load hdf5_par
|
||||||
|
|
||||||
|
[NOTE: module load hdf5 does not work at this moment.
|
||||||
|
Possible installation error of HDF5 on Davinci.]
|
||||||
|
|
||||||
|
|
||||||
|
Brief profile:
|
||||||
|
CC = icc
|
||||||
|
CXX = icc
|
||||||
|
FC = ifort
|
||||||
|
MPICC = icc
|
||||||
|
MPICXX = icc
|
||||||
|
MPIFC = ifort
|
||||||
|
|
||||||
|
If default doesn't work, try:
|
||||||
|
|
||||||
|
For C shell:
|
||||||
|
env CC=icc CXX=icc FC=ifort MPICC=icc MPICXX=icc MPIFC=ifort ./configure && make install
|
||||||
|
|
||||||
|
For Korn or Bourne shell:
|
||||||
|
CC=icc CXX=icc FC=ifort MPICC=icc MPICXX=icc MPIFC=ifort ./configure && make install
|
||||||
|
|
||||||
|
And, of course, you should add configure options, such as --enable-fortran --enable-parallel.
|
||||||
|
|
||||||
|
|
||||||
|
On this host, executing:
|
||||||
|
|
||||||
|
For C shell:
|
||||||
|
env CC=icc CXX=icc FC=ifort MPICC=icc MPICXX=icc MPIFC=ifort ./configure --enable-fortran --enable-parallel && make install
|
||||||
|
|
||||||
|
For Korn or Bourne shell:
|
||||||
|
CC=icc CXX=icc FC=ifort MPICC=icc MPICXX=icc MPIFC=ifort ./configure --enable-fortran --enable-parallel && make install
|
||||||
|
|
||||||
|
has functioned correctly.
|
||||||
|
|
||||||
|
|
||||||
|
To run test program, go to test directory:
|
||||||
|
|
||||||
|
(i) Serial test
|
||||||
|
run:
|
||||||
|
./H5testF
|
||||||
|
./H5PartTest
|
||||||
|
|
||||||
|
(ii) Parallel test
|
||||||
|
run:
|
||||||
|
mpirun 2 H5testFpar
|
||||||
|
mpirun 2 H5PartTestP
|
||||||
|
|
||||||
|
NOTE: Number 2 above is a arbitrary number that indicates the number of processes.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
(2) Jacquard <jacquard.nersc.gov> (Linux"SUSE"-x86_64)
|
||||||
|
-------------------------------------------------------
|
||||||
|
Brief profile:
|
||||||
|
CC = pathcc
|
||||||
|
CXX = pathCC
|
||||||
|
FC = pathf90
|
||||||
|
MPICC = mpicc
|
||||||
|
MPICXX = mpicxx
|
||||||
|
MPIFC = mpif90
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
If default doesn't work, try:
|
||||||
|
|
||||||
|
For C shell:
|
||||||
|
env CC=pathcc CXX=pathCC FC=pathf90 MPICC=mpicc MPICXX=mpicxx MPIFC=mpif90 ./configure && make install
|
||||||
|
|
||||||
|
For Korn or Bourne shell:
|
||||||
|
CC=pathcc CXX=pathCC FC=pathf90 MPICC=mpicc MPICXX=mpicxx MPIFC=mpif90 ./configure && make install
|
||||||
|
|
||||||
|
And, of course, you should add configure options, such as --enable-fortran --enable-parallel.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
On this host, executing:
|
||||||
|
|
||||||
|
For C shell:
|
||||||
|
env CC=pathcc CXX=pathCC FC=pathf90 MPICC=mpicc MPICXX=mpicxx MPIFC=mpif90 ./configure --enable-fortran --enable-parallel && make install
|
||||||
|
|
||||||
|
For Korn or Bourne shell:
|
||||||
|
CC=pathcc CXX=pathCC FC=pathf90 MPICC=mpicc MPICXX=mpicxx MPIFC=mpif90 ./configure --enable-fortran --enable-parallel && make install
|
||||||
|
|
||||||
|
has functioned correctly.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
To run test program, go to test directory:
|
||||||
|
|
||||||
|
(i) Serial test
|
||||||
|
run:
|
||||||
|
./H5testF
|
||||||
|
./H5PartTest
|
||||||
|
|
||||||
|
(ii) Parallel test
|
||||||
|
In Jacquard, we need a script to run parallel programs, since Jacquard does not support interactive parallel processing. Instead, we need to submit the task to a queue. A sample script (run_H5testFpar.scr) may look like below:
|
||||||
|
|
||||||
|
+++++++++++++++++++++++++++++++++++++++
|
||||||
|
#!/bin/csh
|
||||||
|
#PBS -l nodes=1:ppn=2,walltime=00:05:00
|
||||||
|
#PBS -N H5testFpar
|
||||||
|
#PBS -o H5testFpar.out
|
||||||
|
#PBS -e H5testFpar.err
|
||||||
|
#PBS -q debug
|
||||||
|
#PBS -A mpccc
|
||||||
|
#PBS -V
|
||||||
|
|
||||||
|
setenv PBS_OWORKDIR /home/H5Part/test
|
||||||
|
|
||||||
|
cd $PBS_O_WORKDIR
|
||||||
|
mpirun -np 2 ./H5testFpar
|
||||||
|
+++++++++++++++++++++++++++++++++++++++
|
||||||
|
|
||||||
|
Then, we need to submit the task to a queue by running:
|
||||||
|
|
||||||
|
qsub run_H5testFpar.scr
|
||||||
|
|
||||||
|
After processed, the result will appear in H5testFpar.out, and error messages will appear in H5testFpar.err.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
(3) Bassi <bassi.nersc.ogv> (AIX5.3.0.0-Power 3)
|
||||||
|
-------------------------------------------------
|
||||||
|
FIRST THING FIRST!! Type:
|
||||||
|
|
||||||
|
module load gcc
|
||||||
|
|
||||||
|
to have the proper compilers set up for use.
|
||||||
|
|
||||||
|
Brief profile:
|
||||||
|
CC = cc_r
|
||||||
|
CXX = cc_r
|
||||||
|
FC = xlf_r
|
||||||
|
MPICC = mpcc_r
|
||||||
|
MPICXX = mpcc_r
|
||||||
|
MPIFC = mpxlf_r
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
If default doesn't work, try:
|
||||||
|
|
||||||
|
For C shell:
|
||||||
|
env CC=cc_r CXX=cc_r FC=xlf_r MPICC=mpcc_r MPICXX=mpcc_r MPIFC=mpxlf_r ./configure && make install
|
||||||
|
|
||||||
|
For Korn or Bourne shell:
|
||||||
|
CC=cc_r CXX=cc_r FC=xlf_r MPICC=mpcc_r MPICXX=mpcc_r MPIFC=mpxlf_r ./configure && make install
|
||||||
|
|
||||||
|
And, of course, you should add configure options, such as --enable-fortran --enable-parallel.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
On this host, executing:
|
||||||
|
|
||||||
|
For C shell:
|
||||||
|
env CC=cc_r CXX=cc_r FC=xlf_r MPICC=mpcc_r MPICXX=mpcc_r MPIFC=mpxlf_r ./configure --enable-fortran --enable-parallel && make install
|
||||||
|
|
||||||
|
For Korn or Bourne shell:
|
||||||
|
CC=cc_r CXX=cc_r FC=xlf_r MPICC=mpcc_r MPICXX=mpcc_r MPIFC=mpxlf_r ./configure --enable-fortran --enable-parallel && make install
|
||||||
|
|
||||||
|
has functioned correctly.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
To run test program, go to test directory:
|
||||||
|
|
||||||
|
(i) Serial test
|
||||||
|
run:
|
||||||
|
./H5testF
|
||||||
|
./H5PartTest
|
||||||
|
|
||||||
|
(ii) Parallel test
|
||||||
|
run:
|
||||||
|
unsetenv MP_SINGLE_THREAD
|
||||||
|
poe ./H5PartTestP -procs 2 -nodes 1
|
||||||
|
poe ./H5testFpar -procs 2 -nodes 1
|
||||||
|
|
||||||
|
For more details on how to run parallel programs on Bassi, go to:
|
||||||
|
|
||||||
|
http://www.nersc.gov/nusers/resources/bassi/running_jobs/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
(4) Starsky <starsky.lbl.gov> (Darwin8.5.0-PowerPC)
|
||||||
|
----------------------------------------------------
|
||||||
|
FIRST THING FIRST!! Set environment variables: (in tcsh)
|
||||||
|
|
||||||
|
setenv LD_LIBRARY_PATH /usr/local/g95/lib/gcc-lib/powerpc-apple-darwin8.5.0/4.0.3/
|
||||||
|
setenv PATH ${PATH}:/usr/local/g95/bin
|
||||||
|
|
||||||
|
NOTE: This environment variable setting is specifit to Starsky. It is to make configure find the fortran compiler.
|
||||||
|
|
||||||
|
Brief profile:
|
||||||
|
CC = gcc
|
||||||
|
CXX = g++
|
||||||
|
FC = g95
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
If default doesn't work, try:
|
||||||
|
|
||||||
|
For C shell:
|
||||||
|
env CC=gcc CXX=g++ FC=g95 ./configure && make install
|
||||||
|
|
||||||
|
For Korn or Bourne shell:
|
||||||
|
CC=gcc CXX=g++ FC=g95 ./configure && make install
|
||||||
|
|
||||||
|
And, of course, you should add configure options, such as --enable-fortran --enable-parallel.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
On this host, executing:
|
||||||
|
|
||||||
|
For C shell:
|
||||||
|
env CC=gcc CXX=g++ FC=g95 ./configure --enable-fortran && make install
|
||||||
|
|
||||||
|
For Korn or Bourne shell:
|
||||||
|
CC=gcc CXX=g++ FC=g95 ./configure --enable-fortran && make install
|
||||||
|
|
||||||
|
has functioned correctly.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
To run test program, go to test directory:
|
||||||
|
|
||||||
|
(i) Serial test
|
||||||
|
run:
|
||||||
|
./H5testF
|
||||||
|
./H5PartTest
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
(5) Linux AMD64 Visualization group workstations (Linux"SUSE"-x86_64)
|
||||||
|
---------------------------------------------------------
|
||||||
|
Brief profile:
|
||||||
|
CC = gcc
|
||||||
|
CXX = g++
|
||||||
|
FC = g95
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
If default doesn't work, try:
|
||||||
|
|
||||||
|
For C shell:
|
||||||
|
env CC=gcc CXX=g++ FC=g95 ./configure && make install
|
||||||
|
|
||||||
|
For Korn or Bourne shell:
|
||||||
|
CC=gcc CXX=g++ FC=g95 ./configure && make install
|
||||||
|
|
||||||
|
And, of course, you should add configure options, such as --enable-fortran --enable-parallel.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
On this host, executing:
|
||||||
|
|
||||||
|
For C shell:
|
||||||
|
env CC=gcc CXX=g++ FC=g95 ./configure --enable-fortran && make install
|
||||||
|
|
||||||
|
For Korn or Bourne shell:
|
||||||
|
CC=gcc CXX=g++ FC=g95 ./configure --enable-fortran && make install
|
||||||
|
|
||||||
|
has functioned correctly.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
To run test program, go to test directory:
|
||||||
|
|
||||||
|
(i) Serial test
|
||||||
|
run:
|
||||||
|
./H5testF
|
||||||
|
./H5PartTest
|
||||||
|
|
||||||
|
|
||||||
|
(6) Cray XT3 @ CSCS gele
|
||||||
|
|
||||||
|
1) modules/3.1.6 9) PrgEnv-pgi/1.4.26 17) xt-lustre-ss/1.4.26
|
||||||
|
2) MySQL/4.0.26 10) xt-pbs/5.3.4 18) Base-opts/1.4.26
|
||||||
|
3) acml/3.0 11) xt-service/1.4.26 19) subversion/1.3.2
|
||||||
|
4) pgi/6.1.4 12) xt-libc/1.4.26 20) zlib/1.2.3
|
||||||
|
5) totalview/7.2.0 13) xt-os/1.4.26 21) szip/2.0
|
||||||
|
6) xt-libsci/1.4.26 14) xt-catamount/1.4.26 22) hdf5/1.6.5
|
||||||
|
7) xt-mpt/1.4.26 15) xt-boot/1.4.26
|
||||||
|
8) xt-pe/1.4.26 16) xt-crms/1.4.26
|
||||||
|
|
||||||
|
|
||||||
|
CFLAGS="-I$H5HOME/include -DF77_SINGLE_UNDERSCORE" LDFLAGS="-L$H5HOME/lib -L$ZHOME/lib" ./configure --enable-parallel --enable-fortran
|
||||||
|
|
||||||
|
|
||||||
|
(7) merlin00 / merlin3
|
||||||
|
|
||||||
|
Currently Loaded Modulefiles:
|
||||||
|
1) hdf5/hdf5-1.6.5 2) root/root-5.10.00 3) mpi/mpich2-1.0.3-pgi-6.1 4) pgi/pgi_64-6.1
|
||||||
|
|
||||||
|
FC=mpif90 ./configure --enable-parallel --enable-fortran
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
==============================================================================
|
||||||
|
|
||||||
|
|
||||||
|
+ 4. Trouble shooting (Things to check for...)
|
||||||
|
--------------------------------------------
|
||||||
|
(0) Have you set the LD_LIBRARY_PATH?
|
||||||
|
---Some systems require the user to manually set the environment variable, LD_LIBRARY_PATH. To do so:
|
||||||
|
|
||||||
|
set the environment variable HDF5ROOT or PHDF5ROOT to point to your installation of HDF5 (serial and/or parallel respectively).
|
||||||
|
|
||||||
|
For Korn or Bourne shell:
|
||||||
|
LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${HDF5ROOT}/lib;export LD_LIBRARY_PATH
|
||||||
|
LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:{PHDF5ROOT}/lib;export LD_LIBRARY_PATH
|
||||||
|
|
||||||
|
For C shell:
|
||||||
|
setenv LD_LIBRARY_PATH ${LD_LIBRARY_PATH}:${HDF5ROOT}/lib
|
||||||
|
setenv LD_LIBRARY_PATH ${LD_LIBRARY_PATH}:${PHDF5ROOT}/lib
|
||||||
|
|
||||||
|
Note that the values of HDF5ROOT & PHDF5ROOT will be in the "summary" section when you run configure.
|
||||||
|
|
||||||
|
Not properly set LD_LIBRARY_PATH value may result in a runtime error:
|
||||||
|
|
||||||
|
./H5PartTest: error while loading shared libraries: libhdf5.so.0: cannot open shared object file: No such file or directory
|
||||||
|
|
||||||
|
(1) Are the compilers set correctly?
|
||||||
|
---Check with: which COMPILER
|
||||||
|
|
||||||
|
(2) Have you installed HDF5?
|
||||||
|
---You can get it at: http://vis.lbl.gov/Research/AcceleratorSAPP/index.html
|
||||||
|
|
||||||
|
(3) Have you loaded the proper modules?
|
||||||
|
---It is necessary in Davinci & Bassi, and configure && make install may not work without it.
|
||||||
|
|
||||||
|
|
||||||
@@ -1,3 +1,21 @@
|
|||||||
|
VERSION 1.4.1
|
||||||
|
*************
|
||||||
|
|
||||||
|
* Added support for HDF 1.8.1.
|
||||||
|
|
||||||
|
* Added float32 and int64 versions of the H5Block scalar field
|
||||||
|
read/write functions, using a new naming convention:
|
||||||
|
|
||||||
|
H5Block3dWriteScalarFieldFloat64() (was H5Block3dWriteScalarField())
|
||||||
|
H5Block3dWriteScalarFieldFloat32() (new)
|
||||||
|
H5Block3dWriteScalarFieldInt64() (new)
|
||||||
|
|
||||||
|
The old functions still exist, but may be removed in the future.
|
||||||
|
|
||||||
|
|
||||||
|
VERSION 1.4.0
|
||||||
|
*************
|
||||||
|
|
||||||
Error Handling
|
Error Handling
|
||||||
--------------
|
--------------
|
||||||
Now all functions, in which an error could occure, are returning a
|
Now all functions, in which an error could occure, are returning a
|
||||||
|
|||||||
@@ -1,418 +1,57 @@
|
|||||||
==============================================================================
|
For more information on using the H5Part API, see the H5Part website:
|
||||||
README file for H5Part configure
|
|
||||||
==============================================================================
|
http://www-vis.lbl.gov/Research/AcceleratorSAPP/
|
||||||
|
|
||||||
+ 0. HDF5 library
|
|
||||||
-----------------
|
Motivation
|
||||||
|
----------
|
||||||
Make sure you have a working version of the HDF5 library in your computer. If you plan
|
|
||||||
to use parallel I/O you need to use a parallel HDF5 version. If you don't have the
|
Particle based simulations of accelerator beam-lines, especially in six
|
||||||
library download the sources from http://hdf.ncsa.uiuc.edu/HDF5/
|
dimensional phase space, generate vast amounts of data. Even though a subset
|
||||||
|
of statistical information regarding phase space or analysis needs to be
|
||||||
+ 1. Quick start (If you feel lucky...)
|
preserved, reading and writing such enormous restart files on massively
|
||||||
----------------------------------------
|
parallel supercomputing systems remains challenging.
|
||||||
|
|
||||||
For many platforms, where compilers are installed in the "default" location
|
H5Part is a very simple data storage schema and provides an API that
|
||||||
and all the environment variables are set correctly, it should be sufficient
|
simplifies the reading/writing of the data to the HDF5 file format. An
|
||||||
to type:
|
important foundation for a stable visualization and data analysis environment
|
||||||
|
is a stable and portable file storage format and its associated APIs. The
|
||||||
./configure [OPTIONS] && make [install]
|
presence of a "common file storage format," including associated APIs, will
|
||||||
|
help foster a fundamental level of interoperability across the project's
|
||||||
to have the libraries and test program compiled.
|
software infrastructure. It will also help ensure that key data analysis
|
||||||
|
capabilities are present during the earliest phases of the software development
|
||||||
|
effort.
|
||||||
==============================================================================
|
|
||||||
|
H5Part is built on top of the HDF5 (Hierarchical Data Format) library. HDF5
|
||||||
|
offers a self-describing machine-independent binary file format that supports
|
||||||
+ 2. configure line options
|
scalable parallel I/O performance for MPI codes on a variety of supercomputing
|
||||||
----------------------------
|
systems, and works equally well on laptop computers. The API is available for
|
||||||
|
C, C++, and Fortran codes. The H5Part file format and APIs enable disparate
|
||||||
(1) Enable options
|
research groups with different simulation implementations to transparently
|
||||||
--enable-fortran
|
share datasets and data analysis tools. For instance, the common file format
|
||||||
--enable-parallel
|
will enable groups that depend on completely different simulation
|
||||||
--enable-tools
|
implementations to share data analysis tools.
|
||||||
--enable-python
|
|
||||||
--enable-64 (only for AIX and Irix)
|
|
||||||
|
File Organization and API
|
||||||
(2) Setting compilers related variables manually
|
-------------------------
|
||||||
To assign environment variables (e.g., CC, CFLAGS...), specify them as
|
|
||||||
VAR=VALUE. See below for descriptions of some of the useful variables.
|
The proposed file storage format uses HDF5 for the lowlevel file storage and a
|
||||||
|
simple API to provide a high-level interface to that file format. A programmer
|
||||||
Compiler environment variables:
|
can either use the H5Part API to access the data files or write directly to the
|
||||||
CC C compiler command
|
file format using some simple conventions for organizing and naming the objects
|
||||||
CXX C++ compiler command
|
stored in the file.
|
||||||
FC Fortran compiler command
|
|
||||||
|
In order to store Particle Data in the HDF5 file format, we have formalized the
|
||||||
(3) Setting prefix for installation manually
|
hierarchical arrangement of the datasets and naming conventions for the groups
|
||||||
--prefix=PREFIX install files in PREFIX
|
and associated datasets. The sample H5Part API formally encodes these
|
||||||
|
conventions in order to provide a simple and uniform way to access these files
|
||||||
|
from C, C++, and Fortran codes. The API makes it easier to write very portable
|
||||||
For more information, type:
|
data adaptors for visualization tools in order to expand the number of tools
|
||||||
|
available to access the data. Even so, anyone can use the HDF5 h5ls utility to
|
||||||
./configure --help
|
examine the organization of the H5Part files and even write their own
|
||||||
|
HDF5-based interface for reading and writing the file format. The standards
|
||||||
|
offered by the sample API are completely independent of the standard for
|
||||||
==============================================================================
|
organizing data within the file.The file format supports the storage of
|
||||||
|
multiple timesteps of datasets that contain multiple fields.
|
||||||
|
|
||||||
+ 3. Platform specific settings for compiling libraries & test programs
|
|
||||||
------------------------------------------------------------------------
|
|
||||||
|
|
||||||
Building
|
|
||||||
make : builds the libraries and test programs
|
|
||||||
make install: builds and installs
|
|
||||||
make clean : removes extraneous object files
|
|
||||||
make distclean : returns configuration to unconfigured state
|
|
||||||
|
|
||||||
As tested on hosts:
|
|
||||||
|
|
||||||
(1) Davinci <davinci.nersc.gov> (Linux"SUSE"-ia64)
|
|
||||||
---------------------------------------------------
|
|
||||||
FIRST THING FIRST!! Type:
|
|
||||||
|
|
||||||
module load intel
|
|
||||||
to have the proper compilers set up for use.
|
|
||||||
|
|
||||||
module load hdf5_par
|
|
||||||
|
|
||||||
[NOTE: module load hdf5 does not work at this moment.
|
|
||||||
Possible installation error of HDF5 on Davinci.]
|
|
||||||
|
|
||||||
|
|
||||||
Brief profile:
|
|
||||||
CC = icc
|
|
||||||
CXX = icc
|
|
||||||
FC = ifort
|
|
||||||
MPICC = icc
|
|
||||||
MPICXX = icc
|
|
||||||
MPIFC = ifort
|
|
||||||
|
|
||||||
If default doesn't work, try:
|
|
||||||
|
|
||||||
For C shell:
|
|
||||||
env CC=icc CXX=icc FC=ifort MPICC=icc MPICXX=icc MPIFC=ifort ./configure && make install
|
|
||||||
|
|
||||||
For Korn or Bourne shell:
|
|
||||||
CC=icc CXX=icc FC=ifort MPICC=icc MPICXX=icc MPIFC=ifort ./configure && make install
|
|
||||||
|
|
||||||
And, of course, you should add configure options, such as --enable-fortran --enable-parallel.
|
|
||||||
|
|
||||||
|
|
||||||
On this host, executing:
|
|
||||||
|
|
||||||
For C shell:
|
|
||||||
env CC=icc CXX=icc FC=ifort MPICC=icc MPICXX=icc MPIFC=ifort ./configure --enable-fortran --enable-parallel && make install
|
|
||||||
|
|
||||||
For Korn or Bourne shell:
|
|
||||||
CC=icc CXX=icc FC=ifort MPICC=icc MPICXX=icc MPIFC=ifort ./configure --enable-fortran --enable-parallel && make install
|
|
||||||
|
|
||||||
has functioned correctly.
|
|
||||||
|
|
||||||
|
|
||||||
To run test program, go to test directory:
|
|
||||||
|
|
||||||
(i) Serial test
|
|
||||||
run:
|
|
||||||
./H5testF
|
|
||||||
./H5PartTest
|
|
||||||
|
|
||||||
(ii) Parallel test
|
|
||||||
run:
|
|
||||||
mpirun 2 H5testFpar
|
|
||||||
mpirun 2 H5PartTestP
|
|
||||||
|
|
||||||
NOTE: Number 2 above is a arbitrary number that indicates the number of processes.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
(2) Jacquard <jacquard.nersc.gov> (Linux"SUSE"-x86_64)
|
|
||||||
-------------------------------------------------------
|
|
||||||
Brief profile:
|
|
||||||
CC = pathcc
|
|
||||||
CXX = pathCC
|
|
||||||
FC = pathf90
|
|
||||||
MPICC = mpicc
|
|
||||||
MPICXX = mpicxx
|
|
||||||
MPIFC = mpif90
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
If default doesn't work, try:
|
|
||||||
|
|
||||||
For C shell:
|
|
||||||
env CC=pathcc CXX=pathCC FC=pathf90 MPICC=mpicc MPICXX=mpicxx MPIFC=mpif90 ./configure && make install
|
|
||||||
|
|
||||||
For Korn or Bourne shell:
|
|
||||||
CC=pathcc CXX=pathCC FC=pathf90 MPICC=mpicc MPICXX=mpicxx MPIFC=mpif90 ./configure && make install
|
|
||||||
|
|
||||||
And, of course, you should add configure options, such as --enable-fortran --enable-parallel.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
On this host, executing:
|
|
||||||
|
|
||||||
For C shell:
|
|
||||||
env CC=pathcc CXX=pathCC FC=pathf90 MPICC=mpicc MPICXX=mpicxx MPIFC=mpif90 ./configure --enable-fortran --enable-parallel && make install
|
|
||||||
|
|
||||||
For Korn or Bourne shell:
|
|
||||||
CC=pathcc CXX=pathCC FC=pathf90 MPICC=mpicc MPICXX=mpicxx MPIFC=mpif90 ./configure --enable-fortran --enable-parallel && make install
|
|
||||||
|
|
||||||
has functioned correctly.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
To run test program, go to test directory:
|
|
||||||
|
|
||||||
(i) Serial test
|
|
||||||
run:
|
|
||||||
./H5testF
|
|
||||||
./H5PartTest
|
|
||||||
|
|
||||||
(ii) Parallel test
|
|
||||||
In Jacquard, we need a script to run parallel programs, since Jacquard does not support interactive parallel processing. Instead, we need to submit the task to a queue. A sample script (run_H5testFpar.scr) may look like below:
|
|
||||||
|
|
||||||
+++++++++++++++++++++++++++++++++++++++
|
|
||||||
#!/bin/csh
|
|
||||||
#PBS -l nodes=1:ppn=2,walltime=00:05:00
|
|
||||||
#PBS -N H5testFpar
|
|
||||||
#PBS -o H5testFpar.out
|
|
||||||
#PBS -e H5testFpar.err
|
|
||||||
#PBS -q debug
|
|
||||||
#PBS -A mpccc
|
|
||||||
#PBS -V
|
|
||||||
|
|
||||||
setenv PBS_OWORKDIR /home/H5Part/test
|
|
||||||
|
|
||||||
cd $PBS_O_WORKDIR
|
|
||||||
mpirun -np 2 ./H5testFpar
|
|
||||||
+++++++++++++++++++++++++++++++++++++++
|
|
||||||
|
|
||||||
Then, we need to submit the task to a queue by running:
|
|
||||||
|
|
||||||
qsub run_H5testFpar.scr
|
|
||||||
|
|
||||||
After processed, the result will appear in H5testFpar.out, and error messages will appear in H5testFpar.err.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
(3) Bassi <bassi.nersc.ogv> (AIX5.3.0.0-Power 3)
|
|
||||||
-------------------------------------------------
|
|
||||||
FIRST THING FIRST!! Type:
|
|
||||||
|
|
||||||
module load gcc
|
|
||||||
|
|
||||||
to have the proper compilers set up for use.
|
|
||||||
|
|
||||||
Brief profile:
|
|
||||||
CC = cc_r
|
|
||||||
CXX = cc_r
|
|
||||||
FC = xlf_r
|
|
||||||
MPICC = mpcc_r
|
|
||||||
MPICXX = mpcc_r
|
|
||||||
MPIFC = mpxlf_r
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
If default doesn't work, try:
|
|
||||||
|
|
||||||
For C shell:
|
|
||||||
env CC=cc_r CXX=cc_r FC=xlf_r MPICC=mpcc_r MPICXX=mpcc_r MPIFC=mpxlf_r ./configure && make install
|
|
||||||
|
|
||||||
For Korn or Bourne shell:
|
|
||||||
CC=cc_r CXX=cc_r FC=xlf_r MPICC=mpcc_r MPICXX=mpcc_r MPIFC=mpxlf_r ./configure && make install
|
|
||||||
|
|
||||||
And, of course, you should add configure options, such as --enable-fortran --enable-parallel.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
On this host, executing:
|
|
||||||
|
|
||||||
For C shell:
|
|
||||||
env CC=cc_r CXX=cc_r FC=xlf_r MPICC=mpcc_r MPICXX=mpcc_r MPIFC=mpxlf_r ./configure --enable-fortran --enable-parallel && make install
|
|
||||||
|
|
||||||
For Korn or Bourne shell:
|
|
||||||
CC=cc_r CXX=cc_r FC=xlf_r MPICC=mpcc_r MPICXX=mpcc_r MPIFC=mpxlf_r ./configure --enable-fortran --enable-parallel && make install
|
|
||||||
|
|
||||||
has functioned correctly.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
To run test program, go to test directory:
|
|
||||||
|
|
||||||
(i) Serial test
|
|
||||||
run:
|
|
||||||
./H5testF
|
|
||||||
./H5PartTest
|
|
||||||
|
|
||||||
(ii) Parallel test
|
|
||||||
run:
|
|
||||||
unsetenv MP_SINGLE_THREAD
|
|
||||||
poe ./H5PartTestP -procs 2 -nodes 1
|
|
||||||
poe ./H5testFpar -procs 2 -nodes 1
|
|
||||||
|
|
||||||
For more details on how to run parallel programs on Bassi, go to:
|
|
||||||
|
|
||||||
http://www.nersc.gov/nusers/resources/bassi/running_jobs/
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
(4) Starsky <starsky.lbl.gov> (Darwin8.5.0-PowerPC)
|
|
||||||
----------------------------------------------------
|
|
||||||
FIRST THING FIRST!! Set environment variables: (in tcsh)
|
|
||||||
|
|
||||||
setenv LD_LIBRARY_PATH /usr/local/g95/lib/gcc-lib/powerpc-apple-darwin8.5.0/4.0.3/
|
|
||||||
setenv PATH ${PATH}:/usr/local/g95/bin
|
|
||||||
|
|
||||||
NOTE: This environment variable setting is specifit to Starsky. It is to make configure find the fortran compiler.
|
|
||||||
|
|
||||||
Brief profile:
|
|
||||||
CC = gcc
|
|
||||||
CXX = g++
|
|
||||||
FC = g95
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
If default doesn't work, try:
|
|
||||||
|
|
||||||
For C shell:
|
|
||||||
env CC=gcc CXX=g++ FC=g95 ./configure && make install
|
|
||||||
|
|
||||||
For Korn or Bourne shell:
|
|
||||||
CC=gcc CXX=g++ FC=g95 ./configure && make install
|
|
||||||
|
|
||||||
And, of course, you should add configure options, such as --enable-fortran --enable-parallel.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
On this host, executing:
|
|
||||||
|
|
||||||
For C shell:
|
|
||||||
env CC=gcc CXX=g++ FC=g95 ./configure --enable-fortran && make install
|
|
||||||
|
|
||||||
For Korn or Bourne shell:
|
|
||||||
CC=gcc CXX=g++ FC=g95 ./configure --enable-fortran && make install
|
|
||||||
|
|
||||||
has functioned correctly.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
To run test program, go to test directory:
|
|
||||||
|
|
||||||
(i) Serial test
|
|
||||||
run:
|
|
||||||
./H5testF
|
|
||||||
./H5PartTest
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
(5) Linux AMD64 Visualization group workstations (Linux"SUSE"-x86_64)
|
|
||||||
---------------------------------------------------------
|
|
||||||
Brief profile:
|
|
||||||
CC = gcc
|
|
||||||
CXX = g++
|
|
||||||
FC = g95
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
If default doesn't work, try:
|
|
||||||
|
|
||||||
For C shell:
|
|
||||||
env CC=gcc CXX=g++ FC=g95 ./configure && make install
|
|
||||||
|
|
||||||
For Korn or Bourne shell:
|
|
||||||
CC=gcc CXX=g++ FC=g95 ./configure && make install
|
|
||||||
|
|
||||||
And, of course, you should add configure options, such as --enable-fortran --enable-parallel.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
On this host, executing:
|
|
||||||
|
|
||||||
For C shell:
|
|
||||||
env CC=gcc CXX=g++ FC=g95 ./configure --enable-fortran && make install
|
|
||||||
|
|
||||||
For Korn or Bourne shell:
|
|
||||||
CC=gcc CXX=g++ FC=g95 ./configure --enable-fortran && make install
|
|
||||||
|
|
||||||
has functioned correctly.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
To run test program, go to test directory:
|
|
||||||
|
|
||||||
(i) Serial test
|
|
||||||
run:
|
|
||||||
./H5testF
|
|
||||||
./H5PartTest
|
|
||||||
|
|
||||||
|
|
||||||
(6) Cray XT3 @ CSCS gele
|
|
||||||
|
|
||||||
1) modules/3.1.6 9) PrgEnv-pgi/1.4.26 17) xt-lustre-ss/1.4.26
|
|
||||||
2) MySQL/4.0.26 10) xt-pbs/5.3.4 18) Base-opts/1.4.26
|
|
||||||
3) acml/3.0 11) xt-service/1.4.26 19) subversion/1.3.2
|
|
||||||
4) pgi/6.1.4 12) xt-libc/1.4.26 20) zlib/1.2.3
|
|
||||||
5) totalview/7.2.0 13) xt-os/1.4.26 21) szip/2.0
|
|
||||||
6) xt-libsci/1.4.26 14) xt-catamount/1.4.26 22) hdf5/1.6.5
|
|
||||||
7) xt-mpt/1.4.26 15) xt-boot/1.4.26
|
|
||||||
8) xt-pe/1.4.26 16) xt-crms/1.4.26
|
|
||||||
|
|
||||||
|
|
||||||
CFLAGS="-I$H5HOME/include -DF77_SINGLE_UNDERSCORE" LDFLAGS="-L$H5HOME/lib -L$ZHOME/lib" ./configure --enable-parallel --enable-fortran
|
|
||||||
|
|
||||||
|
|
||||||
(7) merlin00 / merlin3
|
|
||||||
|
|
||||||
Currently Loaded Modulefiles:
|
|
||||||
1) hdf5/hdf5-1.6.5 2) root/root-5.10.00 3) mpi/mpich2-1.0.3-pgi-6.1 4) pgi/pgi_64-6.1
|
|
||||||
|
|
||||||
FC=mpif90 ./configure --enable-parallel --enable-fortran
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
==============================================================================
|
|
||||||
|
|
||||||
|
|
||||||
+ 4. Trouble shooting (Things to check for...)
|
|
||||||
--------------------------------------------
|
|
||||||
(0) Have you set the LD_LIBRARY_PATH?
|
|
||||||
---Some systems require the user to manually set the environment variable, LD_LIBRARY_PATH. To do so:
|
|
||||||
|
|
||||||
set the environment variable HDF5ROOT or PHDF5ROOT to point to your installation of HDF5 (serial and/or parallel respectively).
|
|
||||||
|
|
||||||
For Korn or Bourne shell:
|
|
||||||
LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${HDF5ROOT}/lib;export LD_LIBRARY_PATH
|
|
||||||
LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:{PHDF5ROOT}/lib;export LD_LIBRARY_PATH
|
|
||||||
|
|
||||||
For C shell:
|
|
||||||
setenv LD_LIBRARY_PATH ${LD_LIBRARY_PATH}:${HDF5ROOT}/lib
|
|
||||||
setenv LD_LIBRARY_PATH ${LD_LIBRARY_PATH}:${PHDF5ROOT}/lib
|
|
||||||
|
|
||||||
Note that the values of HDF5ROOT & PHDF5ROOT will be in the "summary" section when you run configure.
|
|
||||||
|
|
||||||
Not properly set LD_LIBRARY_PATH value may result in a runtime error:
|
|
||||||
|
|
||||||
./H5PartTest: error while loading shared libraries: libhdf5.so.0: cannot open shared object file: No such file or directory
|
|
||||||
|
|
||||||
(1) Are the compilers set correctly?
|
|
||||||
---Check with: which COMPILER
|
|
||||||
|
|
||||||
(2) Have you installed HDF5?
|
|
||||||
---You can get it at: http://vis.lbl.gov/Research/AcceleratorSAPP/index.html
|
|
||||||
|
|
||||||
(3) Have you loaded the proper modules?
|
|
||||||
---It is necessary in Davinci & Bassi, and configure && make install may not work without it.
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
-44
@@ -1,44 +0,0 @@
|
|||||||
/* config.h.in. Generated from configure.ac by autoheader. */
|
|
||||||
|
|
||||||
/* "" */
|
|
||||||
#undef MY_BUILD_CPU
|
|
||||||
|
|
||||||
/* "" */
|
|
||||||
#undef MY_BUILD_OS
|
|
||||||
|
|
||||||
/* "" */
|
|
||||||
#undef MY_BUILD_VENDOR
|
|
||||||
|
|
||||||
/* "" */
|
|
||||||
#undef MY_GNUNAME
|
|
||||||
|
|
||||||
/* "" */
|
|
||||||
#undef MY_UNAME
|
|
||||||
|
|
||||||
/* Name of package */
|
|
||||||
#undef PACKAGE
|
|
||||||
|
|
||||||
/* Define to the address where bug reports for this package should be sent. */
|
|
||||||
#undef PACKAGE_BUGREPORT
|
|
||||||
|
|
||||||
/* Define to the full name of this package. */
|
|
||||||
#undef PACKAGE_NAME
|
|
||||||
|
|
||||||
/* Define to the full name and version of this package. */
|
|
||||||
#undef PACKAGE_STRING
|
|
||||||
|
|
||||||
/* Define to the one symbol short name of this package. */
|
|
||||||
#undef PACKAGE_TARNAME
|
|
||||||
|
|
||||||
/* Define to the version of this package. */
|
|
||||||
#undef PACKAGE_VERSION
|
|
||||||
|
|
||||||
/* Version number of package */
|
|
||||||
#undef VERSION
|
|
||||||
|
|
||||||
/* Define to 1 if on AIX 3.
|
|
||||||
System headers sometimes define this.
|
|
||||||
We just want to avoid a redefinition error message. */
|
|
||||||
#ifndef _ALL_SOURCE
|
|
||||||
# undef _ALL_SOURCE
|
|
||||||
#endif
|
|
||||||
+281
-281
@@ -1,6 +1,6 @@
|
|||||||
# Every configure script must call AC_INIT before doing anything else.
|
# Every configure script must call AC_INIT before doing anything else.
|
||||||
# AC_INIT (package, version, [bug-report], [tarname])
|
# AC_INIT (package, version, [bug-report], [tarname])
|
||||||
AC_INIT([H5Part], [1.3.3], [h5part@lists.psi.ch], H5Part)
|
AC_INIT([H5Part], [1.4.1], [h5part@lists.psi.ch], H5Part)
|
||||||
|
|
||||||
|
|
||||||
# Ensure that a recent enough version of Autoconf is being used.
|
# Ensure that a recent enough version of Autoconf is being used.
|
||||||
@@ -26,27 +26,27 @@ AC_ARG_ENABLE(
|
|||||||
|
|
||||||
AC_ARG_ENABLE(
|
AC_ARG_ENABLE(
|
||||||
[fortran],
|
[fortran],
|
||||||
[AC_HELP_STRING([--enable-fortran],
|
[AC_HELP_STRING([--enable-fortran],
|
||||||
[Compile the Fortran interface [default=no]])],
|
[Compile the Fortran interface [default=no]])],
|
||||||
[USE_FORTRAN=$enableval])
|
[USE_FORTRAN=$enableval])
|
||||||
|
|
||||||
AC_ARG_ENABLE(
|
AC_ARG_ENABLE(
|
||||||
[parallel],
|
[parallel],
|
||||||
[AC_HELP_STRING([--enable-parallel],
|
[AC_HELP_STRING([--enable-parallel],
|
||||||
[Compile the MPI/IO interface [default=no]])],
|
[Compile the MPI/IO interface [default=no]])],
|
||||||
[USE_PARALLEL=$enableval])
|
[USE_PARALLEL=$enableval])
|
||||||
|
|
||||||
AC_ARG_ENABLE(
|
AC_ARG_ENABLE(
|
||||||
[tools],
|
[tools],
|
||||||
[AC_HELP_STRING([--enable-tools],
|
[AC_HELP_STRING([--enable-tools],
|
||||||
[Compile h5part tools [default=no]])],
|
[Compile h5part tools [default=no]])],
|
||||||
[USE_TOOLS=$enableval])
|
[USE_TOOLS=$enableval])
|
||||||
|
|
||||||
AC_ARG_WITH(
|
AC_ARG_WITH(
|
||||||
[mpipath],
|
[mpipath],
|
||||||
[AC_HELP_STRING([--with-mpipath],
|
[AC_HELP_STRING([--with-mpipath],
|
||||||
[path to MPI installation [default=""]])],
|
[path to MPI installation [default=""]])],
|
||||||
[MPIPATH=$withval], [MPIPATH=""])
|
[MPIPATH=$withval], [MPIPATH=""])
|
||||||
|
|
||||||
AC_ARG_WITH(
|
AC_ARG_WITH(
|
||||||
[hdf5path],
|
[hdf5path],
|
||||||
@@ -54,6 +54,13 @@ AC_ARG_WITH(
|
|||||||
[path to HDF5 installation [default=""]])],
|
[path to HDF5 installation [default=""]])],
|
||||||
[HDF5PATH=$withval], [HDF5PATH=""])
|
[HDF5PATH=$withval], [HDF5PATH=""])
|
||||||
|
|
||||||
|
AC_ARG_WITH(
|
||||||
|
[mpiposix],
|
||||||
|
[AC_HELP_STRING([--with-mpiposix],
|
||||||
|
[enable MPI-POSIX VFD in HDF5 [default=no]])],
|
||||||
|
[USE_MPIPOSIX=$enableval])
|
||||||
|
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
################# A SIMPLE WORK AROUND TO USE ENV. VARS #######################
|
################# A SIMPLE WORK AROUND TO USE ENV. VARS #######################
|
||||||
###############################################################################
|
###############################################################################
|
||||||
@@ -85,35 +92,26 @@ SAVE_LDFLAGS=$LDFLAGS
|
|||||||
# @enddesc
|
# @enddesc
|
||||||
#@@*/
|
#@@*/
|
||||||
|
|
||||||
PATH_Search()
|
PATH_Search() {
|
||||||
{
|
eval $1=""
|
||||||
eval $1=""
|
if test $# -lt 4 ; then
|
||||||
if test $# -lt 4 ; then
|
h5part_basedir=""
|
||||||
h5part_basedir=""
|
else
|
||||||
else
|
h5part_basedir="$4/"
|
||||||
h5part_basedir="$4/"
|
fi
|
||||||
fi
|
for h5part_place in $2; do
|
||||||
for h5part_place in $2
|
AC_MSG_CHECKING([looking in $h5part_place ... ])
|
||||||
do
|
if test -r "$h5part_basedir$h5part_place/$3" ; then
|
||||||
echo -n "looking in $h5part_place ... $ac_c" #1>&6
|
AC_MSG_RESULT([found])
|
||||||
if test -r "$h5part_basedir$h5part_place/$3" ; then
|
eval $1="$h5part_place"
|
||||||
echo "$ac_t"" found" #1>&6
|
break
|
||||||
eval $1="$h5part_place"
|
fi
|
||||||
break
|
AC_MSG_RESULT([no])
|
||||||
fi
|
done
|
||||||
if test -d "$h5part_basedir$h5part_place/$3" ; then
|
return
|
||||||
echo "$ac_t"" found" #1>&6
|
|
||||||
eval $1="$h5part_place"
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
echo "$ac_t"" no" #1>&6
|
|
||||||
done
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
############# MISC SETTINGS INCLUDING C & C++ COMPILER SETTING ################
|
############# MISC SETTINGS INCLUDING C & C++ COMPILER SETTING ################
|
||||||
###############################################################################
|
###############################################################################
|
||||||
@@ -124,32 +122,12 @@ AC_CANONICAL_HOST
|
|||||||
|
|
||||||
uname=`uname -s`
|
uname=`uname -s`
|
||||||
if test $uname = "AIX"; then
|
if test $uname = "AIX"; then
|
||||||
AC_MSG_CHECKING([if system is AIX])
|
AC_MSG_CHECKING([if system is AIX])
|
||||||
AC_MSG_RESULT([OK])
|
AC_MSG_RESULT([OK])
|
||||||
|
|
||||||
# If on AIX, define _ALL_SOURCE. Allows the use of some BSD functions.
|
# If on AIX, define _ALL_SOURCE. Allows the use of some BSD functions.
|
||||||
# Should be called before any macros that run the C compiler.
|
# Should be called before any macros that run the C compiler.
|
||||||
AC_AIX
|
AC_AIX
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
# DAVINCI SPECIFIC!!!
|
|
||||||
if test `uname -n` = "davinci"; then
|
|
||||||
echo "DAVINCI SPECIFIC TESTING FOR STDC++ LIBRARY!"
|
|
||||||
PATH_Search STDCXX_CHECK '/usr/lib64 /usr/lib' libstdc++.a
|
|
||||||
|
|
||||||
# if STDCXX_CHECK is set...
|
|
||||||
if test "$STDCXX_CHECK" = "/usr/lib64"; then
|
|
||||||
echo "STDCXX setting ..."
|
|
||||||
echo "STDCXX_CHECK = $STDCXX_CHECK ..."
|
|
||||||
STDCXX="-L/usr/lib64 -lstdc++"
|
|
||||||
echo "STDCXX = $STDCXX ..."
|
|
||||||
elif test "$STDCXX_CHECK" = "/usr/lib"; then
|
|
||||||
echo "STDCXX setting ..."
|
|
||||||
echo "STDCXX_CHECK = $STDCXX_CHECK ..."
|
|
||||||
STDCXX="-L/usr/lib -lstdc++"
|
|
||||||
echo "STDCXX = $STDCXX ..."
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
@@ -165,9 +143,9 @@ AC_PATH_PROGS([BAS_CC], [cc_r], [], [$PATH])
|
|||||||
|
|
||||||
# if BAS_CC not empty
|
# if BAS_CC not empty
|
||||||
if test -n "$BAS_CC"; then
|
if test -n "$BAS_CC"; then
|
||||||
echo "CC setting for Bassi ..."
|
AC_MSG_CHECKING([CC setting for Bassi])
|
||||||
CC=$BAS_CC
|
CC=$BAS_CC
|
||||||
echo "CC = $CC ..."
|
AC_MSG_RESULT([CC = $CC])
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
@@ -181,6 +159,16 @@ fi
|
|||||||
AC_PROG_CXX(pathCC icc cc_r g++ gcc cc)
|
AC_PROG_CXX(pathCC icc cc_r g++ gcc cc)
|
||||||
|
|
||||||
|
|
||||||
|
# DAVINCI SPECIFIC!!!
|
||||||
|
AC_MSG_CHECKING([for icc linker -lstdc++ flag])
|
||||||
|
if test ${CXX} = "icc"; then
|
||||||
|
AC_MSG_RESULT([yes])
|
||||||
|
STDCXX="-lstdc++"
|
||||||
|
else
|
||||||
|
AC_MSG_RESULT([no])
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
# Set output variable INSTALL to the path of a BSD-compatible install program,
|
# Set output variable INSTALL to the path of a BSD-compatible install program,
|
||||||
# if one is found in the current PATH.
|
# if one is found in the current PATH.
|
||||||
# Otherwise, set INSTALL to `dir/install-sh -c`
|
# Otherwise, set INSTALL to `dir/install-sh -c`
|
||||||
@@ -218,186 +206,199 @@ AC_MSG_CHECKING([if 64-bit compilation is enabled])
|
|||||||
|
|
||||||
# If --enable-64 is set in the configure line
|
# If --enable-64 is set in the configure line
|
||||||
if test "X$USE_64" = "Xyes"; then
|
if test "X$USE_64" = "Xyes"; then
|
||||||
AC_MSG_RESULT([yes])
|
AC_MSG_RESULT([yes])
|
||||||
if test $uname = "AIX"; then
|
if test $uname = "AIX"; then
|
||||||
CFLAGS="$CFLAGS -q64"
|
CFLAGS="$CFLAGS -q64"
|
||||||
FFLAGS="$FFLAGS -q64"
|
FFLAGS="$FFLAGS -q64"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test $uname = "IRIX64"; then
|
if test $uname = "IRIX64"; then
|
||||||
CFLAGS="$CFLAGS -64"
|
CFLAGS="$CFLAGS -64"
|
||||||
FFLAGS="$FFLAGS -64 -fPIC -fno-second-underscore"
|
FFLAGS="$FFLAGS -64 -fPIC -fno-second-underscore"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
AC_MSG_RESULT([no])
|
AC_MSG_RESULT([no])
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
############################ fortran enabled ##################################
|
############################ fortran enabled ##################################
|
||||||
AC_MSG_CHECKING([if fortran interface enabled])
|
AC_MSG_CHECKING([if fortran interface enabled])
|
||||||
if test "X$USE_FORTRAN" = "Xyes"; then
|
if test "X$USE_FORTRAN" = "Xyes"; then
|
||||||
AC_MSG_RESULT([yes])
|
AC_MSG_RESULT([yes])
|
||||||
|
|
||||||
AC_PROG_FC(ifort xlf_r pathf90 g95 g90 ftn gfortran)
|
AC_PROG_FC(ifort xlf_r pathf90 g95 g90 ftn gfortran)
|
||||||
if test -z "$FC" ; then
|
if test -z "$FC" ; then
|
||||||
AC_MSG_ERROR([Cannot find a fortran compiler!!!])
|
AC_MSG_ERROR([Cannot find a fortran compiler!!!])
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test ! $uname = "AIX"; then
|
if test ! $uname = "AIX"; then
|
||||||
FFLAGS="${FFLAGS} -fPIC -fno-second-underscore"
|
FFLAGS="${FFLAGS} -fPIC"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
AC_MSG_CHECKING([symbol convention in object files])
|
if test $FC = "g90"; then
|
||||||
`cd src && rm -f TestUnderscore.o TestUnderscoreC.o TestUnderscore`
|
FFLAGS="${FFLAGS} -fno-second-underscore"
|
||||||
`cd src && ${FC} ${FFLAGS} -c TestUnderscore.f`
|
fi
|
||||||
`cd src && ${CC} ${CFLAGS} -c TestUnderscoreC.c`
|
|
||||||
`cd src && ${FC} ${FFLAGS} -o TestUnderscore TestUnderscore.o TestUnderscoreC.o -lc`
|
|
||||||
|
|
||||||
if test -f src/TestUnderscore ; then
|
if test $FC = "g95"; then
|
||||||
UNDERSCORE_H=Underscore.h
|
FFLAGS="${FFLAGS} -fno-second-underscore"
|
||||||
`cd src && ./TestUnderscore > Underscore.h`
|
fi
|
||||||
AC_MSG_RESULT([ok])
|
|
||||||
else
|
AC_MSG_CHECKING([symbol convention in object files])
|
||||||
AC_MSG_RESULT([nok])
|
`cd src && rm -f TestUnderscore.o TestUnderscoreC.o TestUnderscore`
|
||||||
AC_MSG_ERROR([Cannot build fortran executables!!!])
|
`cd src && ${FC} ${FFLAGS} -c TestUnderscore.f`
|
||||||
exit 1
|
`cd src && ${CC} ${CFLAGS} -c TestUnderscoreC.c`
|
||||||
fi
|
# `cd src && ${FC} ${FFLAGS} -o TestUnderscore TestUnderscore.o TestUnderscoreC.o -lc`
|
||||||
|
`cd src && ${FC} ${FFLAGS} -o TestUnderscore TestUnderscore.o TestUnderscoreC.o`
|
||||||
|
|
||||||
|
if test -f src/TestUnderscore ; then
|
||||||
|
UNDERSCORE_H=Underscore.h
|
||||||
|
`cd src && ./TestUnderscore > Underscore.h`
|
||||||
|
AC_MSG_RESULT([ok])
|
||||||
|
else
|
||||||
|
AC_MSG_RESULT([nok])
|
||||||
|
AC_MSG_ERROR([Cannot build fortran executables!!!])
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
AC_MSG_RESULT([no])
|
AC_MSG_RESULT([no])
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
######################## parallel interface enabled ###########################
|
######################## parallel interface enabled ###########################
|
||||||
AC_MSG_CHECKING([if parallel interface enabled])
|
AC_MSG_CHECKING([if parallel interface enabled])
|
||||||
if test "X$USE_PARALLEL" = "Xyes"; then
|
if test "X$USE_PARALLEL" = "Xyes"; then
|
||||||
AC_MSG_RESULT([yes])
|
AC_MSG_RESULT([yes])
|
||||||
|
|
||||||
CFLAGS="${CFLAGS} -DPARALLEL_IO -DH5_HAVE_PARALLEL -DMPICH_IGNORE_CXX_SEEK"
|
CFLAGS="${CFLAGS} -DPARALLEL_IO -DH5_HAVE_PARALLEL -DMPICH_IGNORE_CXX_SEEK"
|
||||||
|
|
||||||
AC_MSG_CHECKING([if we can compile MPI code without setting flags])
|
AC_MSG_CHECKING([if we can compile MPI code without setting flags])
|
||||||
AC_TRY_LINK([#include "mpi.h"], [
|
AC_TRY_LINK([#include "mpi.h"], [
|
||||||
MPI_Comm comm;
|
MPI_Comm comm;
|
||||||
int n;
|
int n;
|
||||||
MPI_Comm_size( comm, &n ); ],
|
MPI_Comm_size( comm, &n ); ],
|
||||||
[echo 'yes'; r='yes'], [echo "no"; r='no'] )
|
[AC_MSG_RESULT([yes]); r='yes'], [AC_MSG_RESULT([no]); r='no'] )
|
||||||
|
|
||||||
if test "X$r" = "Xno"; then
|
if test "X$USE_MPIPOSIX" = "Xyes"; then
|
||||||
AC_PATH_PROGS([MPICC], [mpicc mpcc_r], [], [$PATH])
|
CFLAGS="${CFLAGS} -DH5PART_MPIPOSIX"
|
||||||
AC_PATH_PROGS([MPICXX], [mpicxx mpcc_r], [], [$PATH])
|
|
||||||
if test -z "$MPICC" -o -z "$MPICXX"; then
|
|
||||||
AC_MSG_CHECKING([for MPI root ])
|
|
||||||
AC_MSG_RESULT([])
|
|
||||||
if test -n "$MPIROOT"; then
|
|
||||||
P=${MPIROOT}
|
|
||||||
elif test -n "$MPIHOME"; then
|
|
||||||
P=${MPIHOME}
|
|
||||||
elif test -n "$MPIPATH"; then
|
|
||||||
P=${MPIPATH}
|
|
||||||
else
|
|
||||||
P=''
|
|
||||||
P="$P /usr"
|
|
||||||
P="$P /usr/local"
|
|
||||||
P="$P /usr/local/mpi"
|
|
||||||
P="$P /usr/local/packages/mpi"
|
|
||||||
P="$P /usr/local/mpich2"
|
|
||||||
P="$P /usr/local/mpich"
|
|
||||||
P="$P /opt/xt-mpt/default/mpich2-64/P2"
|
|
||||||
fi
|
|
||||||
PATH_Search MPIROOT "$P" include/mpi.h
|
|
||||||
if test ! -n "$MPIROOT"; then
|
|
||||||
AC_MSG_ERROR([Cannot determine MPI root!!!])
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if test -e "${MPIROOT}/bin/mpicc"; then
|
|
||||||
MPICC=${MPIROOT}/bin/mpicc
|
|
||||||
fi
|
|
||||||
|
|
||||||
if test -e "${MPIROOT}/bin/mpicxx"; then
|
|
||||||
MPICXX=${MPIROOT}/bin/mpicxx
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test -z "$MPICC" -o -z "$MPICXX"; then
|
if test "X$r" = "Xno"; then
|
||||||
MPIINC="${MPIINC} -I${MPIROOT}/include"
|
AC_PATH_PROGS([MPICC], [mpicc mpcc_r], [], [$PATH])
|
||||||
FFLAGS="${FFLAGS} -I${MPIROOT}/include"
|
AC_PATH_PROGS([MPICXX], [mpicxx mpcc_r], [], [$PATH])
|
||||||
AC_MSG_CHECKING([for name of MPI lib ])
|
if test -z "$MPICC" -o -z "$MPICXX"; then
|
||||||
if test -e ${MPIROOT}/lib/libmpi.a; then
|
AC_MSG_CHECKING([for MPI root ])
|
||||||
MPILIB="-L${MPIROOT}/lib -lmpi"
|
AC_MSG_RESULT([])
|
||||||
elif test -e ${MPIROOT}/lib/libmpi.so; then
|
if test -n "$MPIROOT"; then
|
||||||
MPILIB="-L${MPIROOT}/lib -lmpi"
|
P=${MPIROOT}
|
||||||
elif test -e ${MPIROOT}/lib/libmpich.a; then
|
elif test -n "$MPIHOME"; then
|
||||||
MPILIB="-L${MPIROOT}/lib -lmpich"
|
P=${MPIHOME}
|
||||||
elif test -e ${MPIROOT}/lib/libmpich.so; then
|
elif test -n "$MPIPATH"; then
|
||||||
MPILIB="-L${MPIROOT}/lib -lmpich"
|
P=${MPIPATH}
|
||||||
else
|
else
|
||||||
AC_MSG_RESULT([not found])
|
P=''
|
||||||
exit 1
|
P="$P /usr"
|
||||||
fi
|
P="$P /usr/local"
|
||||||
AC_MSG_RESULT([${MPILIB}])
|
P="$P /usr/local/mpi"
|
||||||
|
P="$P /usr/local/packages/mpi"
|
||||||
|
P="$P /usr/local/mpich2"
|
||||||
|
P="$P /usr/local/mpich"
|
||||||
|
P="$P /opt/xt-mpt/default/mpich2-64/P2"
|
||||||
|
fi
|
||||||
|
PATH_Search MPIROOT "$P" include/mpi.h
|
||||||
|
if test ! -n "$MPIROOT"; then
|
||||||
|
AC_MSG_ERROR([Cannot determine MPI root!!!])
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if test -e "${MPIROOT}/bin/mpicc"; then
|
||||||
|
MPICC=${MPIROOT}/bin/mpicc
|
||||||
|
fi
|
||||||
|
|
||||||
|
if test -e "${MPIROOT}/bin/mpicxx"; then
|
||||||
|
MPICXX=${MPIROOT}/bin/mpicxx
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if test -z "$MPICC" -o -z "$MPICXX"; then
|
||||||
|
MPIINC="${MPIINC} -I${MPIROOT}/include"
|
||||||
|
FFLAGS="${FFLAGS} -I${MPIROOT}/include"
|
||||||
|
AC_MSG_CHECKING([for name of MPI lib ])
|
||||||
|
if test -e ${MPIROOT}/lib/libmpi.a; then
|
||||||
|
MPILIB="-L${MPIROOT}/lib -lmpi"
|
||||||
|
elif test -e ${MPIROOT}/lib/libmpi.so; then
|
||||||
|
MPILIB="-L${MPIROOT}/lib -lmpi"
|
||||||
|
elif test -e ${MPIROOT}/lib/libmpich.a; then
|
||||||
|
MPILIB="-L${MPIROOT}/lib -lmpich"
|
||||||
|
elif test -e ${MPIROOT}/lib/libmpich.so; then
|
||||||
|
MPILIB="-L${MPIROOT}/lib -lmpich"
|
||||||
|
else
|
||||||
|
AC_MSG_RESULT([not found])
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
AC_MSG_RESULT([${MPILIB}])
|
||||||
|
fi
|
||||||
|
|
||||||
|
if test -n "$MPICC"; then
|
||||||
|
CC=${MPICC}
|
||||||
|
fi
|
||||||
|
|
||||||
|
if test -n "$MPICXX"; then
|
||||||
|
CXX=${MPICXX}
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test -n "$MPICC"; then
|
MTARGET="libpH5Part.a"
|
||||||
CC=${MPICC}
|
TTARGET="H5PartTestP H5PartAndreasTest Bench"
|
||||||
fi
|
TTARGET="${TTARGET} H5BlockTestAttributes"
|
||||||
|
TTARGET="${TTARGET} H5BlockParTestScalarField"
|
||||||
|
|
||||||
if test -n "$MPICXX"; then
|
# parallel + fortran
|
||||||
CXX=${MPICXX}
|
if test "X$USE_FORTRAN" = "Xyes"; then
|
||||||
fi
|
AC_PATH_PROGS([MPIFC], [mpxlf_r mpif90], [], [$PATH])
|
||||||
fi
|
|
||||||
|
|
||||||
MTARGET="libpH5Part.a"
|
if test -z "${MPIFC}" ; then
|
||||||
TTARGET="H5PartTestP H5PartAndreasTest Bench"
|
if test -e "${MPIROOT}/bin/mpif90"; then
|
||||||
TTARGET="${TTARGET} H5BlockTestAttributes"
|
MPIFC=${MPIROOT}/bin/mpif90
|
||||||
TTARGET="${TTARGET} H5BlockParTestScalarField"
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
# parallel + fortran
|
# if MPIFC empty
|
||||||
if test "X$USE_FORTRAN" = "Xyes"; then
|
if test ! -n "$MPIFC"; then
|
||||||
AC_PATH_PROGS([MPIFC], [mpxlf_r mpif90], [], [$PATH])
|
AC_MSG_CHECKING([ No MPIFC detected. Setting MPIFC to FC.])
|
||||||
|
MPIFC=$FC
|
||||||
|
AC_MSG_RESULT([MPIFC = $MPIFC])
|
||||||
|
fi
|
||||||
|
|
||||||
if test -z "${MPIFC}" ; then
|
if test -n "$MPIFC"; then
|
||||||
if test -e "${MPIROOT}/bin/mpif90"; then
|
FC=${MPIFC}
|
||||||
MPIFC=${MPIROOT}/bin/mpif90
|
fi
|
||||||
fi
|
|
||||||
|
MTARGET="${MTARGET} libpH5PartF.a"
|
||||||
|
TTARGET="${TTARGET} H5testFpar"
|
||||||
|
TTARGET="${TTARGET} H5BlockParTestScalarFieldF"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# if MPIFC empty
|
|
||||||
if test ! -n "$MPIFC"; then
|
|
||||||
AC_MSG_CHECKING([ No MPIFC detected. Setting MPIFC to FC.])
|
|
||||||
MPIFC=$FC
|
|
||||||
echo "MPIFC = $MPIFC ..."
|
|
||||||
fi
|
|
||||||
|
|
||||||
if test -n "$MPIFC"; then
|
|
||||||
FC=${MPIFC}
|
|
||||||
fi
|
|
||||||
|
|
||||||
MTARGET="${MTARGET} libpH5PartF.a"
|
|
||||||
TTARGET="${TTARGET} H5testFpar"
|
|
||||||
TTARGET="${TTARGET} H5BlockParTestScalarFieldF"
|
|
||||||
fi
|
|
||||||
|
|
||||||
else # --enable-parallel=no
|
else # --enable-parallel=no
|
||||||
AC_MSG_RESULT([no])
|
AC_MSG_RESULT([no])
|
||||||
|
|
||||||
MTARGET="libH5Part.a"
|
MTARGET="libH5Part.a"
|
||||||
TTARGET="H5PartTest H5test"
|
TTARGET="H5PartTest H5test"
|
||||||
TTARGET="${TTARGET} H5BlockTestAttributes"
|
TTARGET="${TTARGET} H5BlockTestAttributes"
|
||||||
|
|
||||||
if test "X$USE_FORTRAN" = "Xyes"; then
|
if test "X$USE_FORTRAN" = "Xyes"; then
|
||||||
MTARGET="${MTARGET} libH5PartF.a"
|
MTARGET="${MTARGET} libH5PartF.a"
|
||||||
TTARGET="${TTARGET} H5testF"
|
TTARGET="${TTARGET} H5testF"
|
||||||
TTARGET="${TTARGET} H5BlockTestAttributesF"
|
TTARGET="${TTARGET} H5BlockTestAttributesF"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
AC_MSG_CHECKING([wheter tools are enabled])
|
AC_MSG_CHECKING([wheter tools are enabled])
|
||||||
if test "X$USE_TOOLS" = "Xyes"; then
|
if test "X$USE_TOOLS" = "Xyes"; then
|
||||||
AC_MSG_RESULT([yes])
|
AC_MSG_RESULT([yes])
|
||||||
BUILD_TOOLS="h5pAttrib h5pToGNUplot # homdynToH5p"
|
BUILD_TOOLS="h5pAttrib h5pToGNUplot h5ToVtk# homdynToH5p"
|
||||||
else
|
else
|
||||||
AC_MSG_RESULT([no])
|
AC_MSG_RESULT([no])
|
||||||
fi
|
fi
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
@@ -407,58 +408,58 @@ fi
|
|||||||
AC_MSG_CHECKING([for HDF5 root ])
|
AC_MSG_CHECKING([for HDF5 root ])
|
||||||
AC_MSG_RESULT([])
|
AC_MSG_RESULT([])
|
||||||
if test -n "${HDF5ROOT}"; then
|
if test -n "${HDF5ROOT}"; then
|
||||||
P=${HDF5ROOT}
|
P=${HDF5ROOT}
|
||||||
elif test -n "${HDF5HOME}" ; then
|
elif test -n "${HDF5HOME}" ; then
|
||||||
P=${HDF5HOME}
|
P=${HDF5HOME}
|
||||||
elif test -n "${HDF5PATH}" ; then
|
elif test -n "${HDF5PATH}" ; then
|
||||||
P=${HDF5PATH}
|
P=${HDF5PATH}
|
||||||
else
|
else
|
||||||
P=''
|
P=''
|
||||||
P="$P /usr"
|
P="$P /usr"
|
||||||
P="$P /usr/local"
|
P="$P /usr/local"
|
||||||
P="$P /usr/local/hdf5"
|
P="$P /usr/local/hdf5"
|
||||||
P="$P /usr/local/packages/hdf5"
|
P="$P /usr/local/packages/hdf5"
|
||||||
P="$P /apps/hdf5"
|
P="$P /apps/hdf5"
|
||||||
|
|
||||||
if test "X$USE_PARALLEL" = "Xyes"; then
|
if test "X$USE_PARALLEL" = "Xyes"; then
|
||||||
P="$P /usr/local/phdf5"
|
P="$P /usr/local/phdf5"
|
||||||
P="$P /usr/local/hdf5/hdf5_par"
|
P="$P /usr/local/hdf5/hdf5_par"
|
||||||
if test "X$USE_64" = "Xyes"; then
|
if test "X$USE_64" = "Xyes"; then
|
||||||
P="$P /usr/common/usg/hdf5/64/default/parallel"
|
P="$P /usr/common/usg/hdf5/64/default/parallel"
|
||||||
else
|
else
|
||||||
P="$P /usr/common/usg/hdf5/32/default/parallel"
|
P="$P /usr/common/usg/hdf5/32/default/parallel"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
P="$P /usr/local/hdf5/hdf5_serial"
|
P="$P /usr/local/hdf5/hdf5_serial"
|
||||||
if test "X$USE_64" = "Xyes"; then
|
if test "X$USE_64" = "Xyes"; then
|
||||||
P="$P /usr/common/usg/hdf5/64/default/serial"
|
P="$P /usr/common/usg/hdf5/64/default/serial"
|
||||||
else
|
else
|
||||||
P="$P /usr/common/usg/hdf5/32/default/serial"
|
P="$P /usr/common/usg/hdf5/32/default/serial"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
PATH_Search HDF5ROOT "$P" include/hdf5.h
|
PATH_Search HDF5ROOT "$P" include/hdf5.h
|
||||||
if test -z "$HDF5ROOT"; then
|
if test -z "$HDF5ROOT"; then
|
||||||
AC_MSG_ERROR([Cannot determine HDF5 root!!!])
|
AC_MSG_ERROR([Cannot determine HDF5 root!!!])
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
AC_MSG_CHECKING([if we need to link to libsz ])
|
AC_MSG_CHECKING([if we need to link to libsz ])
|
||||||
if test -n "$HDF5ROOT"; then
|
if test -n "$HDF5ROOT"; then
|
||||||
if test -f $HDF5ROOT/lib/libsz.a; then
|
if test -f $HDF5ROOT/lib/libsz.a; then
|
||||||
AC_MSG_RESULT([yes])
|
AC_MSG_RESULT([yes])
|
||||||
SZLIB="-L$HDF5ROOT/lib/ -lsz"
|
SZLIB="-L$HDF5ROOT/lib/ -lsz"
|
||||||
else
|
else
|
||||||
AC_MSG_RESULT([no])
|
AC_MSG_RESULT([no])
|
||||||
SZLIB=""
|
SZLIB=""
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
AC_MSG_CHECKING([for static zlib root ])
|
AC_MSG_CHECKING([for static zlib root ])
|
||||||
echo
|
AC_MSG_RESULT([ ])
|
||||||
PATH_Search ZLIBROOT '/apps/zlib' lib/libz.a
|
PATH_Search ZLIBROOT '/apps/zlib' lib/libz.a
|
||||||
if test -n "$ZLIBROOT"; then
|
if test -n "$ZLIBROOT"; then
|
||||||
LDFLAGS="$LDFLAGS -L$ZLIBROOT/lib"
|
LDFLAGS="$LDFLAGS -L$ZLIBROOT/lib"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
@@ -474,65 +475,65 @@ H5P_LIB_LOC=`pwd`/src
|
|||||||
|
|
||||||
#if there was an external input for the variable...
|
#if there was an external input for the variable...
|
||||||
if test -n "$SAVE_CC"; then
|
if test -n "$SAVE_CC"; then
|
||||||
CC=$SAVE_CC
|
CC=$SAVE_CC
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test -n "$SAVE_CXX"; then
|
if test -n "$SAVE_CXX"; then
|
||||||
CXX=$SAVE_CXX
|
CXX=$SAVE_CXX
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test -n "$SAVE_FC"; then
|
if test -n "$SAVE_FC"; then
|
||||||
FC=$SAVE_FC
|
FC=$SAVE_FC
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test -n "$SAVE_MPICC"; then
|
if test -n "$SAVE_MPICC"; then
|
||||||
MPICC=$SAVE_MPICC
|
MPICC=$SAVE_MPICC
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test -n "$SAVE_MPICXX"; then
|
if test -n "$SAVE_MPICXX"; then
|
||||||
MPICXX=$SAVE_MPICXX
|
MPICXX=$SAVE_MPICXX
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test -n "$SAVE_MPIFC"; then
|
if test -n "$SAVE_MPIFC"; then
|
||||||
MPIFC=$SAVE_MPIFC
|
MPIFC=$SAVE_MPIFC
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test -n "$SAVE_MPILIB"; then
|
if test -n "$SAVE_MPILIB"; then
|
||||||
MPILIB=$SAVE_MPILIB
|
MPILIB=$SAVE_MPILIB
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test -n "$SAVE_MPIINC"; then
|
if test -n "$SAVE_MPIINC"; then
|
||||||
MPIINC=$SAVE_MPIINC
|
MPIINC=$SAVE_MPIINC
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test -n "$SAVE_CFLAGS"; then
|
if test -n "$SAVE_CFLAGS"; then
|
||||||
CFLAGS="$SAVE_CFLAGS ${CFLAGS}"
|
CFLAGS="$SAVE_CFLAGS ${CFLAGS}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test -n "$SAVE_FFLAGS"; then
|
if test -n "$SAVE_FFLAGS"; then
|
||||||
FFLAGS=$SAVE_FFLAGS
|
FFLAGS=$SAVE_FFLAGS
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test -n "$SAVE_MPIROOT"; then
|
if test -n "$SAVE_MPIROOT"; then
|
||||||
MPIROOT=$SAVE_MPIROOT
|
MPIROOT=$SAVE_MPIROOT
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test -n "$SAVE_HDF5ROOT"; then
|
if test -n "$SAVE_HDF5ROOT"; then
|
||||||
HDF5ROOT=$SAVE_HDF5ROOT
|
HDF5ROOT=$SAVE_HDF5ROOT
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test -n "$SAVE_LDFLAGS"; then
|
if test -n "$SAVE_LDFLAGS"; then
|
||||||
LDFLAGS=$SAVE_LDFLAGS
|
LDFLAGS=$SAVE_LDFLAGS
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test -n "$MPICXX"; then
|
if test -n "$MPICXX"; then
|
||||||
TOOLS_CXX=$MPICXX
|
TOOLS_CXX=$MPICXX
|
||||||
TOOLS_H5PART_LIB="-lpH5Part"
|
TOOLS_H5PART_LIB="-lpH5Part"
|
||||||
TOOLS_HDFLIB="-L$HDF5ROOT/lib -lhdf5"
|
TOOLS_HDFLIB="-L$HDF5ROOT/lib -lhdf5"
|
||||||
else
|
else
|
||||||
TOOLS_CXX=$CXX
|
TOOLS_CXX=$CXX
|
||||||
TOOLS_H5PART_LIB="-lH5Part"
|
TOOLS_H5PART_LIB="-lH5Part"
|
||||||
TOOLS_HDFLIB="-L$HDF5ROOT/lib -lhdf5"
|
TOOLS_HDFLIB="-L$HDF5ROOT/lib -lhdf5"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
@@ -581,27 +582,26 @@ AC_OUTPUT
|
|||||||
###############################################################################
|
###############################################################################
|
||||||
########################## PRINTING SUMMARY ###################################
|
########################## PRINTING SUMMARY ###################################
|
||||||
###############################################################################
|
###############################################################################
|
||||||
echo
|
AC_MSG_RESULT([ ])
|
||||||
echo
|
AC_MSG_RESULT([Summary:])
|
||||||
echo "Summary for `(hostname || uname -n) 2>/dev/null | sed 1q`:"
|
AC_MSG_RESULT([ ])
|
||||||
echo
|
AC_MSG_RESULT([Host OS: $host_os])
|
||||||
echo "Host OS: $host_os"
|
AC_MSG_RESULT([Host CPU: $host_cpu])
|
||||||
echo "Host CPU: $host_cpu"
|
AC_MSG_RESULT([Host vendor: $host_vendor])
|
||||||
echo "Host vendor: $host_vendor"
|
AC_MSG_RESULT([Build libraries: $MTARGET])
|
||||||
echo "Build libraries: $MTARGET"
|
AC_MSG_RESULT([Build test programs: $TTARGET])
|
||||||
echo "Build test programs: $TTARGET"
|
AC_MSG_RESULT([Build tools: $BUILD_TOOLS])
|
||||||
echo "Build tools: $BUILD_TOOLS"
|
AC_MSG_RESULT([CC = $CC])
|
||||||
echo "CC = $CC"
|
AC_MSG_RESULT([CXX = $CXX])
|
||||||
echo "CXX = $CXX"
|
AC_MSG_RESULT([FC = $FC])
|
||||||
echo "FC = $FC"
|
AC_MSG_RESULT([MPICC = $MPICC])
|
||||||
echo "MPICC = $MPICC"
|
AC_MSG_RESULT([MPICXX = $MPICXX])
|
||||||
echo "MPICXX = $MPICXX"
|
AC_MSG_RESULT([MPIFC = $MPIFC])
|
||||||
echo "MPIFC = $MPIFC"
|
AC_MSG_RESULT([CFLAGS = $CFLAGS])
|
||||||
echo "CFLAGS = $CFLAGS"
|
AC_MSG_RESULT([FFLAGS = $FFLAGS])
|
||||||
echo "FFLAGS = $FFLAGS"
|
AC_MSG_RESULT([MPILIB = $MPILIB])
|
||||||
echo "MPILIB = $MPILIB"
|
AC_MSG_RESULT([MPIINC = $MPIINC])
|
||||||
echo "MPIINC = $MPIINC"
|
AC_MSG_RESULT([MPIROOT = $MPIROOT])
|
||||||
echo "MPIROOT = $MPIROOT"
|
AC_MSG_RESULT([HDF5ROOT = $HDF5ROOT])
|
||||||
echo "HDF5ROOT = $HDF5ROOT"
|
AC_MSG_RESULT([LDFLAGS = $LDFLAGS])
|
||||||
echo "LDFLAGS = $LDFLAGS"
|
AC_MSG_RESULT([ ])
|
||||||
echo
|
|
||||||
+319
-64
@@ -142,6 +142,9 @@ _init (
|
|||||||
b->memshape = -1;
|
b->memshape = -1;
|
||||||
b->field_group_id = -1;
|
b->field_group_id = -1;
|
||||||
b->have_layout = 0;
|
b->have_layout = 0;
|
||||||
|
b->chunk[0] = 0;
|
||||||
|
b->chunk[1] = 0;
|
||||||
|
b->chunk[2] = 0;
|
||||||
|
|
||||||
f->close_block = _close;
|
f->close_block = _close;
|
||||||
|
|
||||||
@@ -260,7 +263,7 @@ _allgather (
|
|||||||
size_t n = sizeof (struct H5BlockPartition) / sizeof (h5part_int64_t);
|
size_t n = sizeof (struct H5BlockPartition) / sizeof (h5part_int64_t);
|
||||||
|
|
||||||
MPI_Type_contiguous ( n, MPI_LONG_LONG, &partition_m );
|
MPI_Type_contiguous ( n, MPI_LONG_LONG, &partition_m );
|
||||||
MPI_Type_commit ( &partition_m );
|
MPI_Type_commit ( &partition_m );
|
||||||
|
|
||||||
MPI_Allgather ( partition, 1, partition_m, layout, 1, partition_m,
|
MPI_Allgather ( partition, 1, partition_m, layout, 1, partition_m,
|
||||||
f->comm );
|
f->comm );
|
||||||
@@ -305,8 +308,8 @@ _get_dimension_sizes (
|
|||||||
}
|
}
|
||||||
|
|
||||||
#define _NO_GHOSTZONE(p,q) ( (p->i_end < q->i_start) \
|
#define _NO_GHOSTZONE(p,q) ( (p->i_end < q->i_start) \
|
||||||
|| (p->j_end < q->j_start) \
|
|| (p->j_end < q->j_start) \
|
||||||
|| (p->k_end < q->k_start) )
|
|| (p->k_end < q->k_start) )
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@@ -577,11 +580,11 @@ _dissolve_ghostzones (
|
|||||||
memset ( p_begin, 0, sizeof ( *p_begin ) );
|
memset ( p_begin, 0, sizeof ( *p_begin ) );
|
||||||
|
|
||||||
for ( proc_p = 0, p = b->write_layout;
|
for ( proc_p = 0, p = b->write_layout;
|
||||||
proc_p < f->nprocs-1;
|
proc_p < f->nprocs-1;
|
||||||
proc_p++, p++ ) {
|
proc_p++, p++ ) {
|
||||||
for ( proc_q = proc_p+1, q = &b->write_layout[proc_q];
|
for ( proc_q = proc_p+1, q = &b->write_layout[proc_q];
|
||||||
proc_q < f->nprocs;
|
proc_q < f->nprocs;
|
||||||
proc_q++, q++ ) {
|
proc_q++, q++ ) {
|
||||||
|
|
||||||
if ( _have_ghostzone ( p, q ) ) {
|
if ( _have_ghostzone ( p, q ) ) {
|
||||||
p_el = (struct list*) malloc ( sizeof ( *p_el ) );
|
p_el = (struct list*) malloc ( sizeof ( *p_el ) );
|
||||||
@@ -632,8 +635,8 @@ _dissolve_ghostzones (
|
|||||||
|
|
||||||
_H5Part_print_debug ("Layout defined by user:");
|
_H5Part_print_debug ("Layout defined by user:");
|
||||||
for ( proc_p = 0, p = b->user_layout;
|
for ( proc_p = 0, p = b->user_layout;
|
||||||
proc_p < f->nprocs;
|
proc_p < f->nprocs;
|
||||||
proc_p++, p++ ) {
|
proc_p++, p++ ) {
|
||||||
_H5Part_print_debug (
|
_H5Part_print_debug (
|
||||||
"PROC[%d]: proc[%d]: %lld:%lld, %lld:%lld, %lld:%lld ",
|
"PROC[%d]: proc[%d]: %lld:%lld, %lld:%lld, %lld:%lld ",
|
||||||
f->myproc, proc_p,
|
f->myproc, proc_p,
|
||||||
@@ -644,8 +647,8 @@ _dissolve_ghostzones (
|
|||||||
|
|
||||||
_H5Part_print_debug ("Layout after dissolving ghost-zones:");
|
_H5Part_print_debug ("Layout after dissolving ghost-zones:");
|
||||||
for ( proc_p = 0, p = b->write_layout;
|
for ( proc_p = 0, p = b->write_layout;
|
||||||
proc_p < f->nprocs;
|
proc_p < f->nprocs;
|
||||||
proc_p++, p++ ) {
|
proc_p++, p++ ) {
|
||||||
_H5Part_print_debug (
|
_H5Part_print_debug (
|
||||||
"PROC[%d]: proc[%d]: %lld:%lld, %lld:%lld, %lld:%lld ",
|
"PROC[%d]: proc[%d]: %lld:%lld, %lld:%lld, %lld:%lld ",
|
||||||
f->myproc, proc_p,
|
f->myproc, proc_p,
|
||||||
@@ -692,9 +695,11 @@ _release_hyperslab (
|
|||||||
Define the field layout given the dense index space at the actual
|
Define the field layout given the dense index space at the actual
|
||||||
time step.
|
time step.
|
||||||
|
|
||||||
\return \c H5PART_SUCCESS on success<br>
|
\par Errors
|
||||||
\c H5PART_ERR_MPI<br>
|
\c H5PART_ERR_MPI on MPI errors
|
||||||
\c H5PART_ERR_HDF5
|
\c H5PART_ERR_HDF5 on HDF5 errors
|
||||||
|
|
||||||
|
\return \c H5PART_SUCCESS on success or error code
|
||||||
*/
|
*/
|
||||||
h5part_int64_t
|
h5part_int64_t
|
||||||
H5BlockDefine3DFieldLayout(
|
H5BlockDefine3DFieldLayout(
|
||||||
@@ -737,14 +742,43 @@ H5BlockDefine3DFieldLayout(
|
|||||||
return H5PART_SUCCESS;
|
return H5PART_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\ingroup h5block_c_api
|
||||||
|
|
||||||
|
Define the chunk dimensions and enable chunking in the underlying
|
||||||
|
HDF5 dataset.
|
||||||
|
|
||||||
|
\return \c H5PART_SUCCESS
|
||||||
|
*/
|
||||||
|
h5part_int64_t
|
||||||
|
H5BlockDefine3DChunk(
|
||||||
|
H5PartFile *f, /*!< IN: File handle */
|
||||||
|
const h5part_int64_t *dims /*!< IN: array containing
|
||||||
|
the chunk dimensions */
|
||||||
|
) {
|
||||||
|
|
||||||
|
SET_FNAME ( "H5BlockDefine3DChunk" );
|
||||||
|
INIT( f );
|
||||||
|
|
||||||
|
struct H5BlockStruct *b = f->block;
|
||||||
|
|
||||||
|
b->chunk[0] = (hsize_t)dims[2];
|
||||||
|
b->chunk[1] = (hsize_t)dims[1];
|
||||||
|
b->chunk[2] = (hsize_t)dims[0];
|
||||||
|
|
||||||
|
return H5PART_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\ingroup h5block_c_api
|
\ingroup h5block_c_api
|
||||||
|
|
||||||
Return partition of processor \c proc as specified with
|
Return partition of processor \c proc as specified with
|
||||||
\c H5BlockDefine3dLayout().
|
\c H5BlockDefine3dLayout().
|
||||||
|
|
||||||
\return \c H5PART_SUCCESS on success.<br>
|
\par Errors
|
||||||
\c H5PART_ERR_INVAL if proc is invalid.
|
\c H5PART_ERR_INVAL if proc is invalid.
|
||||||
|
|
||||||
|
\return \c H5PART_SUCCESS on success or error code
|
||||||
*/
|
*/
|
||||||
h5part_int64_t
|
h5part_int64_t
|
||||||
H5Block3dGetPartitionOfProc (
|
H5Block3dGetPartitionOfProc (
|
||||||
@@ -783,8 +817,11 @@ H5Block3dGetPartitionOfProc (
|
|||||||
Return reduced (ghost-zone free) partition of processor \c proc
|
Return reduced (ghost-zone free) partition of processor \c proc
|
||||||
as specified with \c H5BlockDefine3dLayout().
|
as specified with \c H5BlockDefine3dLayout().
|
||||||
|
|
||||||
\return \c H5PART_SUCCESS on success.<br>
|
\par Errors
|
||||||
\c H5PART_ERR_INVAL if proc is invalid.
|
\c H5PART_ERR_LAYOUT if no partitioning defined
|
||||||
|
\c H5PART_ERR_INVAL if proc is invalid.
|
||||||
|
|
||||||
|
\return \c H5PART_SUCCESS on success or error code
|
||||||
*/
|
*/
|
||||||
h5part_int64_t
|
h5part_int64_t
|
||||||
H5Block3dGetReducedPartitionOfProc (
|
H5Block3dGetReducedPartitionOfProc (
|
||||||
@@ -824,7 +861,11 @@ H5Block3dGetReducedPartitionOfProc (
|
|||||||
Returns the processor computing the reduced (ghostzone-free)
|
Returns the processor computing the reduced (ghostzone-free)
|
||||||
partition given by the coordinates \c i, \c j and \c k.
|
partition given by the coordinates \c i, \c j and \c k.
|
||||||
|
|
||||||
\return \c H5PART_SUCCESS or error code
|
\par Errors
|
||||||
|
\c H5PART_ERR_LAYOUT if no partitioning defined.
|
||||||
|
\c H5PART_ERR_INVAL if given point is not in a partition.
|
||||||
|
|
||||||
|
\return \c processor id or error code
|
||||||
*/
|
*/
|
||||||
h5part_int64_t
|
h5part_int64_t
|
||||||
H5Block3dGetProcOf (
|
H5Block3dGetProcOf (
|
||||||
@@ -848,7 +889,7 @@ H5Block3dGetProcOf (
|
|||||||
return (h5part_int64_t)proc;
|
return (h5part_int64_t)proc;
|
||||||
}
|
}
|
||||||
|
|
||||||
return -1;
|
return H5PART_ERR_INVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/********************** helper functions for reading and writing *************/
|
/********************** helper functions for reading and writing *************/
|
||||||
@@ -874,7 +915,14 @@ _open_block_group (
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ( b->blockgroup < 0 ) {
|
if ( b->blockgroup < 0 ) {
|
||||||
|
#if H5_VERS_MAJOR == 1 && H5_VERS_MINOR == 8
|
||||||
|
hid_t herr = H5Gopen2 (
|
||||||
|
f->timegroup,
|
||||||
|
H5BLOCK_GROUPNAME_BLOCK,
|
||||||
|
H5P_DEFAULT );
|
||||||
|
#else
|
||||||
hid_t herr = H5Gopen ( f->timegroup, H5BLOCK_GROUPNAME_BLOCK );
|
hid_t herr = H5Gopen ( f->timegroup, H5BLOCK_GROUPNAME_BLOCK );
|
||||||
|
#endif
|
||||||
if ( herr < 0 ) return HANDLE_H5G_OPEN_ERR ( H5BLOCK_GROUPNAME_BLOCK );
|
if ( herr < 0 ) return HANDLE_H5G_OPEN_ERR ( H5BLOCK_GROUPNAME_BLOCK );
|
||||||
b->blockgroup = herr;
|
b->blockgroup = herr;
|
||||||
}
|
}
|
||||||
@@ -920,7 +968,11 @@ _open_field_group (
|
|||||||
if ( ! _have_object ( b->blockgroup, name ) )
|
if ( ! _have_object ( b->blockgroup, name ) )
|
||||||
return HANDLE_H5PART_NOENT_ERR ( name );
|
return HANDLE_H5PART_NOENT_ERR ( name );
|
||||||
|
|
||||||
|
#if H5_VERS_MAJOR == 1 && H5_VERS_MINOR == 8
|
||||||
|
herr_t herr = H5Gopen2 ( b->blockgroup, name, H5P_DEFAULT );
|
||||||
|
#else
|
||||||
herr_t herr = H5Gopen ( b->blockgroup, name );
|
herr_t herr = H5Gopen ( b->blockgroup, name );
|
||||||
|
#endif
|
||||||
if ( herr < 0 ) return HANDLE_H5G_OPEN_ERR ( name );
|
if ( herr < 0 ) return HANDLE_H5G_OPEN_ERR ( name );
|
||||||
|
|
||||||
b->field_group_id = herr;
|
b->field_group_id = herr;
|
||||||
@@ -1045,12 +1097,17 @@ h5part_int64_t
|
|||||||
_read_data (
|
_read_data (
|
||||||
H5PartFile *f, /*!< IN: file handle */
|
H5PartFile *f, /*!< IN: file handle */
|
||||||
const char *name, /*!< IN: name of dataset to read */
|
const char *name, /*!< IN: name of dataset to read */
|
||||||
h5part_float64_t *data /*!< OUT: ptr to read buffer */
|
void *data, /*!< OUT: ptr to read buffer */
|
||||||
|
hid_t type /*!< IN: data type */
|
||||||
) {
|
) {
|
||||||
|
|
||||||
struct H5BlockStruct *b = f->block;
|
struct H5BlockStruct *b = f->block;
|
||||||
|
|
||||||
|
#if H5_VERS_MAJOR == 1 && H5_VERS_MINOR == 8
|
||||||
|
hid_t dataset_id = H5Dopen2 ( b->field_group_id, name, H5P_DEFAULT );
|
||||||
|
#else
|
||||||
hid_t dataset_id = H5Dopen ( b->field_group_id, name );
|
hid_t dataset_id = H5Dopen ( b->field_group_id, name );
|
||||||
|
#endif
|
||||||
if ( dataset_id < 0 ) return HANDLE_H5D_OPEN_ERR ( name );
|
if ( dataset_id < 0 ) return HANDLE_H5D_OPEN_ERR ( name );
|
||||||
|
|
||||||
h5part_int64_t herr = _select_hyperslab_for_reading ( f, dataset_id );
|
h5part_int64_t herr = _select_hyperslab_for_reading ( f, dataset_id );
|
||||||
@@ -1058,7 +1115,7 @@ _read_data (
|
|||||||
|
|
||||||
herr = H5Dread (
|
herr = H5Dread (
|
||||||
dataset_id,
|
dataset_id,
|
||||||
H5T_NATIVE_DOUBLE,
|
type,
|
||||||
f->block->memshape,
|
f->block->memshape,
|
||||||
f->block->diskshape,
|
f->block->diskshape,
|
||||||
H5P_DEFAULT,
|
H5P_DEFAULT,
|
||||||
@@ -1071,18 +1128,101 @@ _read_data (
|
|||||||
return H5PART_SUCCESS;
|
return H5PART_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
h5part_int64_t
|
||||||
|
h5b_read_scalar_field (
|
||||||
|
H5PartFile *f, /*!< IN: file handle */
|
||||||
|
const char *field_name, /*!< IN: field name */
|
||||||
|
const char *dataset_name, /*!< IN: name of dataset to write */
|
||||||
|
void *data, /*!< OUT: ptr to read buffer */
|
||||||
|
const hid_t type /*!< IN: data type */
|
||||||
|
) {
|
||||||
|
INIT ( f );
|
||||||
|
CHECK_TIMEGROUP ( f );
|
||||||
|
CHECK_LAYOUT ( f );
|
||||||
|
|
||||||
|
h5part_int64_t herr = _open_field_group ( f, field_name );
|
||||||
|
if ( herr < 0 ) return herr;
|
||||||
|
|
||||||
|
herr = _read_data ( f, dataset_name, data, type );
|
||||||
|
if ( herr < 0 ) return herr;
|
||||||
|
|
||||||
|
herr = _close_field_group ( f );
|
||||||
|
if ( herr < 0 ) return herr;
|
||||||
|
|
||||||
|
return H5PART_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\ingroup h5block_c_api
|
\ingroup h5block_c_api
|
||||||
|
|
||||||
Read a 3-dimensional field \c name into the buffer starting at \c data from
|
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 real valued
|
the current time-step using the defined field layout. Values are real valued
|
||||||
scalars.
|
scalars (64-bit).
|
||||||
|
|
||||||
You must use the FORTRAN indexing scheme to access items in \c data.
|
You must use the FORTRAN indexing scheme to access items in \c data.
|
||||||
|
|
||||||
\return \c H5PART_SUCCESS or error code
|
\return \c H5PART_SUCCESS or error code
|
||||||
*/
|
*/
|
||||||
h5part_int64_t
|
h5part_int64_t
|
||||||
|
H5Block3dReadScalarFieldFloat64 (
|
||||||
|
H5PartFile *f, /*!< IN: file handle */
|
||||||
|
const char *name, /*!< IN: name of dataset to read */
|
||||||
|
h5part_float64_t *data /*!< OUT: ptr to read buffer */
|
||||||
|
) {
|
||||||
|
SET_FNAME ( __func__ );
|
||||||
|
return h5b_read_scalar_field ( f, name, "0", data, H5T_NATIVE_DOUBLE );
|
||||||
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\ingroup h5block_c_api
|
||||||
|
|
||||||
|
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 real valued
|
||||||
|
scalars (32-bit).
|
||||||
|
|
||||||
|
You must use the FORTRAN indexing scheme to access items in \c data.
|
||||||
|
|
||||||
|
\return \c H5PART_SUCCESS or error code
|
||||||
|
*/
|
||||||
|
h5part_int64_t
|
||||||
|
H5Block3dReadScalarFieldFloat32 (
|
||||||
|
H5PartFile *f, /*!< IN: file handle */
|
||||||
|
const char *name, /*!< IN: name of dataset to read */
|
||||||
|
h5part_float32_t *data /*!< OUT: ptr to read buffer */
|
||||||
|
) {
|
||||||
|
|
||||||
|
SET_FNAME ( __func__ );
|
||||||
|
return h5b_read_scalar_field ( f, name, "0", data, H5T_NATIVE_FLOAT );
|
||||||
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\ingroup h5block_c_api
|
||||||
|
|
||||||
|
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 integer
|
||||||
|
valued scalars (64-bit).
|
||||||
|
|
||||||
|
You must use the FORTRAN indexing scheme to access items in \c data.
|
||||||
|
|
||||||
|
\return \c H5PART_SUCCESS or error code
|
||||||
|
*/
|
||||||
|
h5part_int64_t
|
||||||
|
H5Block3dReadScalarFieldInt64 (
|
||||||
|
H5PartFile *f, /*!< IN: file handle */
|
||||||
|
const char *name, /*!< IN: name of dataset to read */
|
||||||
|
h5part_int64_t *data /*!< OUT: ptr to read buffer */
|
||||||
|
) {
|
||||||
|
|
||||||
|
SET_FNAME ( __func__ );
|
||||||
|
return h5b_read_scalar_field ( f, name, "0", data, H5T_NATIVE_INT64 );
|
||||||
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\ingroup h5block_c_api
|
||||||
|
|
||||||
|
This funciton is deprecated in favor of \c H5BlockReadFieldFloat64.
|
||||||
|
*/
|
||||||
|
h5part_int64_t
|
||||||
H5Block3dReadScalarField (
|
H5Block3dReadScalarField (
|
||||||
H5PartFile *f, /*!< IN: file handle */
|
H5PartFile *f, /*!< IN: file handle */
|
||||||
const char *name, /*!< IN: name of dataset to read */
|
const char *name, /*!< IN: name of dataset to read */
|
||||||
@@ -1090,20 +1230,7 @@ H5Block3dReadScalarField (
|
|||||||
) {
|
) {
|
||||||
|
|
||||||
SET_FNAME ( "H5Block3dReadScalarField" );
|
SET_FNAME ( "H5Block3dReadScalarField" );
|
||||||
INIT ( f );
|
return h5b_read_scalar_field ( f, name, "0", data, H5T_NATIVE_DOUBLE );
|
||||||
CHECK_TIMEGROUP ( f );
|
|
||||||
CHECK_LAYOUT ( f );
|
|
||||||
|
|
||||||
h5part_int64_t herr = _open_field_group ( f, name );
|
|
||||||
if ( herr < 0 ) return herr;
|
|
||||||
|
|
||||||
herr = _read_data ( f, "0", data );
|
|
||||||
if ( herr < 0 ) return herr;
|
|
||||||
|
|
||||||
herr = _close_field_group ( f );
|
|
||||||
if ( herr < 0 ) return herr;
|
|
||||||
|
|
||||||
return H5PART_SUCCESS;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@@ -1135,11 +1262,11 @@ H5Block3dRead3dVectorField (
|
|||||||
h5part_int64_t herr = _open_field_group ( f, name );
|
h5part_int64_t herr = _open_field_group ( f, name );
|
||||||
if ( herr < 0 ) return herr;
|
if ( herr < 0 ) return herr;
|
||||||
|
|
||||||
herr = _read_data ( f, "0", x_data );
|
herr = _read_data ( f, "0", x_data, H5T_NATIVE_DOUBLE );
|
||||||
if ( herr < 0 ) return herr;
|
if ( herr < 0 ) return herr;
|
||||||
herr = _read_data ( f, "1", y_data );
|
herr = _read_data ( f, "1", y_data, H5T_NATIVE_DOUBLE );
|
||||||
if ( herr < 0 ) return herr;
|
if ( herr < 0 ) return herr;
|
||||||
herr = _read_data ( f, "2", z_data );
|
herr = _read_data ( f, "2", z_data, H5T_NATIVE_DOUBLE );
|
||||||
if ( herr < 0 ) return herr;
|
if ( herr < 0 ) return herr;
|
||||||
|
|
||||||
herr = _close_field_group ( f );
|
herr = _close_field_group ( f );
|
||||||
@@ -1287,7 +1414,16 @@ _create_block_group (
|
|||||||
f->block->blockgroup = -1;
|
f->block->blockgroup = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if H5_VERS_MAJOR == 1 && H5_VERS_MINOR == 8
|
||||||
|
herr = H5Gcreate2 (
|
||||||
|
f->timegroup,
|
||||||
|
H5BLOCK_GROUPNAME_BLOCK,
|
||||||
|
H5P_DEFAULT,
|
||||||
|
H5P_DEFAULT,
|
||||||
|
H5P_DEFAULT );
|
||||||
|
#else
|
||||||
herr = H5Gcreate ( f->timegroup, H5BLOCK_GROUPNAME_BLOCK, 0 );
|
herr = H5Gcreate ( f->timegroup, H5BLOCK_GROUPNAME_BLOCK, 0 );
|
||||||
|
#endif
|
||||||
if ( herr < 0 ) return HANDLE_H5G_CREATE_ERR ( H5BLOCK_GROUPNAME_BLOCK );
|
if ( herr < 0 ) return HANDLE_H5G_CREATE_ERR ( H5BLOCK_GROUPNAME_BLOCK );
|
||||||
|
|
||||||
f->block->blockgroup = herr;
|
f->block->blockgroup = herr;
|
||||||
@@ -1324,7 +1460,16 @@ _create_field_group (
|
|||||||
if ( _have_object ( b->blockgroup, name ) )
|
if ( _have_object ( b->blockgroup, name ) )
|
||||||
return HANDLE_H5PART_GROUP_EXISTS_ERR ( name );
|
return HANDLE_H5PART_GROUP_EXISTS_ERR ( name );
|
||||||
|
|
||||||
|
#if H5_VERS_MAJOR == 1 && H5_VERS_MINOR == 8
|
||||||
|
herr_t herr = H5Gcreate2 (
|
||||||
|
b->blockgroup,
|
||||||
|
name,
|
||||||
|
H5P_DEFAULT,
|
||||||
|
H5P_DEFAULT,
|
||||||
|
H5P_DEFAULT );
|
||||||
|
#else
|
||||||
herr_t herr = H5Gcreate ( b->blockgroup, name, 0 );
|
herr_t herr = H5Gcreate ( b->blockgroup, name, 0 );
|
||||||
|
#endif
|
||||||
if ( herr < 0 ) return HANDLE_H5G_CREATE_ERR ( name );
|
if ( herr < 0 ) return HANDLE_H5G_CREATE_ERR ( name );
|
||||||
b->field_group_id = herr;
|
b->field_group_id = herr;
|
||||||
|
|
||||||
@@ -1342,24 +1487,47 @@ h5part_int64_t
|
|||||||
_write_data (
|
_write_data (
|
||||||
H5PartFile *f, /*!< IN: file handle */
|
H5PartFile *f, /*!< IN: file handle */
|
||||||
const char *name, /*!< IN: name of dataset to write */
|
const char *name, /*!< IN: name of dataset to write */
|
||||||
const h5part_float64_t *data /*!< IN: data to write */
|
const void *data, /*!< IN: data to write */
|
||||||
|
const hid_t type /*!< IN: data type */
|
||||||
) {
|
) {
|
||||||
|
|
||||||
herr_t herr;
|
herr_t herr;
|
||||||
hid_t dataset;
|
hid_t dataset;
|
||||||
|
hid_t create_prop = H5P_DEFAULT;
|
||||||
struct H5BlockStruct *b = f->block;
|
struct H5BlockStruct *b = f->block;
|
||||||
|
|
||||||
|
if ( b->chunk[0] > 0 &&
|
||||||
|
b->chunk[1] > 0 &&
|
||||||
|
b->chunk[2] > 0)
|
||||||
|
{
|
||||||
|
create_prop = H5Pcreate( H5P_DATASET_CREATE );
|
||||||
|
herr = H5Pset_chunk ( create_prop, 3, b->chunk );
|
||||||
|
if ( herr < 0 ) return HANDLE_H5P_SET_CHUNK_ERR;
|
||||||
|
}
|
||||||
|
|
||||||
|
#if H5_VERS_MAJOR == 1 && H5_VERS_MINOR == 8
|
||||||
|
dataset = H5Dcreate2 (
|
||||||
|
b->field_group_id,
|
||||||
|
name,
|
||||||
|
type,
|
||||||
|
b->shape,
|
||||||
|
H5P_DEFAULT,
|
||||||
|
create_prop,
|
||||||
|
H5P_DEFAULT );
|
||||||
|
#else
|
||||||
dataset = H5Dcreate (
|
dataset = H5Dcreate (
|
||||||
b->field_group_id,
|
b->field_group_id,
|
||||||
name,
|
name,
|
||||||
H5T_NATIVE_DOUBLE,
|
type,
|
||||||
b->shape,
|
b->shape,
|
||||||
H5P_DEFAULT );
|
create_prop );
|
||||||
|
#endif
|
||||||
|
|
||||||
if ( dataset < 0 ) return HANDLE_H5D_CREATE_ERR ( name, f->timestep );
|
if ( dataset < 0 ) return HANDLE_H5D_CREATE_ERR ( name, f->timestep );
|
||||||
|
|
||||||
herr = H5Dwrite (
|
herr = H5Dwrite (
|
||||||
dataset,
|
dataset,
|
||||||
H5T_NATIVE_DOUBLE,
|
type,
|
||||||
b->memshape,
|
b->memshape,
|
||||||
b->diskshape,
|
b->diskshape,
|
||||||
H5P_DEFAULT,
|
H5P_DEFAULT,
|
||||||
@@ -1369,6 +1537,36 @@ _write_data (
|
|||||||
herr = H5Dclose ( dataset );
|
herr = H5Dclose ( dataset );
|
||||||
if ( herr < 0 ) return HANDLE_H5D_CLOSE_ERR;
|
if ( herr < 0 ) return HANDLE_H5D_CLOSE_ERR;
|
||||||
|
|
||||||
|
if ( create_prop != H5P_DEFAULT ) {
|
||||||
|
herr = H5Pclose ( create_prop );
|
||||||
|
if ( herr < 0 ) return HANDLE_H5P_CLOSE_ERR ( "create_prop" );
|
||||||
|
}
|
||||||
|
|
||||||
|
return H5PART_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
h5part_int64_t
|
||||||
|
h5b_write_scalar_field (
|
||||||
|
H5PartFile *f, /*!< IN: file handle */
|
||||||
|
const char *field_name, /*!< IN: field name */
|
||||||
|
const char *dataset_name, /*!< IN: name of dataset to write */
|
||||||
|
const void *data, /*!< IN: scalar data to write */
|
||||||
|
const hid_t type /*!< IN: data type */
|
||||||
|
) {
|
||||||
|
INIT ( f );
|
||||||
|
CHECK_WRITABLE_MODE ( f );
|
||||||
|
CHECK_TIMEGROUP ( f );
|
||||||
|
CHECK_LAYOUT ( f );
|
||||||
|
|
||||||
|
h5part_int64_t herr = _create_field_group ( f, field_name );
|
||||||
|
if ( herr < 0 ) return herr;
|
||||||
|
|
||||||
|
herr = _write_data ( f, dataset_name, data, type );
|
||||||
|
if ( herr < 0 ) return herr;
|
||||||
|
|
||||||
|
herr = _close_field_group ( f );
|
||||||
|
if ( herr < 0 ) return herr;
|
||||||
|
|
||||||
return H5PART_SUCCESS;
|
return H5PART_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1377,35 +1575,81 @@ _write_data (
|
|||||||
|
|
||||||
Write a 3-dimensional field \c name from the buffer starting at \c 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 real
|
to the current time-step using the defined field layout. Values are real
|
||||||
valued scalars.
|
valued scalars (64-bit).
|
||||||
|
|
||||||
You must use the FORTRAN indexing scheme to access items in \c data.
|
You must use the FORTRAN indexing scheme to access items in \c data.
|
||||||
|
|
||||||
\return \c H5PART_SUCCESS or error code
|
\return \c H5PART_SUCCESS or error code
|
||||||
*/
|
*/
|
||||||
h5part_int64_t
|
h5part_int64_t
|
||||||
|
H5Block3dWriteScalarFieldFloat64 (
|
||||||
|
H5PartFile *f, /*!< IN: file handle */
|
||||||
|
const char *name, /*!< IN: name of dataset to write */
|
||||||
|
const h5part_float64_t *data /*!< IN: scalar data to write */
|
||||||
|
) {
|
||||||
|
|
||||||
|
SET_FNAME ( __func__ );
|
||||||
|
return h5b_write_scalar_field ( f, name, "0", data, H5T_NATIVE_DOUBLE );
|
||||||
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\ingroup h5block_c_api
|
||||||
|
|
||||||
|
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 real
|
||||||
|
valued scalars (32-bit).
|
||||||
|
|
||||||
|
You must use the FORTRAN indexing scheme to access items in \c data.
|
||||||
|
|
||||||
|
\return \c H5PART_SUCCESS or error code
|
||||||
|
*/
|
||||||
|
h5part_int64_t
|
||||||
|
H5Block3dWriteScalarFieldFloat32 (
|
||||||
|
H5PartFile *f, /*!< IN: file handle */
|
||||||
|
const char *name, /*!< IN: name of dataset to write */
|
||||||
|
const h5part_float32_t *data /*!< IN: scalar data to write */
|
||||||
|
) {
|
||||||
|
|
||||||
|
SET_FNAME ( __func__ );
|
||||||
|
return h5b_write_scalar_field ( f, name, "0", data, H5T_NATIVE_FLOAT );
|
||||||
|
}
|
||||||
|
/*!
|
||||||
|
\ingroup h5block_c_api
|
||||||
|
|
||||||
|
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 integer
|
||||||
|
valued scalars (64-bit).
|
||||||
|
|
||||||
|
You must use the FORTRAN indexing scheme to access items in \c data.
|
||||||
|
|
||||||
|
\return \c H5PART_SUCCESS or error code
|
||||||
|
*/
|
||||||
|
h5part_int64_t
|
||||||
|
H5Block3dWriteScalarFieldInt64 (
|
||||||
|
H5PartFile *f, /*!< IN: file handle */
|
||||||
|
const char *name, /*!< IN: name of dataset to write */
|
||||||
|
const h5part_int64_t *data /*!< IN: scalar data to write */
|
||||||
|
) {
|
||||||
|
|
||||||
|
SET_FNAME ( __func__ );
|
||||||
|
return h5b_write_scalar_field ( f, name, "0", data, H5T_NATIVE_INT64 );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\ingroup h5block_c_api
|
||||||
|
|
||||||
|
This function is deprecated in favor of \c H5BlockWriteFieldFloat64.
|
||||||
|
*/
|
||||||
|
h5part_int64_t
|
||||||
H5Block3dWriteScalarField (
|
H5Block3dWriteScalarField (
|
||||||
H5PartFile *f, /*!< IN: file handle */
|
H5PartFile *f, /*!< IN: file handle */
|
||||||
const char *name, /*!< IN: name of dataset to write */
|
const char *name, /*!< IN: name of dataset to write */
|
||||||
const h5part_float64_t *data /*!< IN: scalar data to write */
|
const h5part_float64_t *data /*!< IN: scalar data to write */
|
||||||
) {
|
) {
|
||||||
|
|
||||||
SET_FNAME ( "H5Block3dWriteScalarField" );
|
SET_FNAME ( __func__ );
|
||||||
INIT ( f );
|
return h5b_write_scalar_field ( f, name, "0", data, H5T_NATIVE_DOUBLE );
|
||||||
CHECK_WRITABLE_MODE ( f );
|
|
||||||
CHECK_TIMEGROUP ( f );
|
|
||||||
CHECK_LAYOUT ( f );
|
|
||||||
|
|
||||||
h5part_int64_t herr = _create_field_group ( f, name );
|
|
||||||
if ( herr < 0 ) return herr;
|
|
||||||
|
|
||||||
herr = _write_data ( f, "0", data );
|
|
||||||
if ( herr < 0 ) return herr;
|
|
||||||
|
|
||||||
herr = _close_field_group ( f );
|
|
||||||
if ( herr < 0 ) return herr;
|
|
||||||
|
|
||||||
return H5PART_SUCCESS;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@@ -1439,11 +1683,11 @@ H5Block3dWrite3dVectorField (
|
|||||||
h5part_int64_t herr = _create_field_group ( f, name );
|
h5part_int64_t herr = _create_field_group ( f, name );
|
||||||
if ( herr < 0 ) return herr;
|
if ( herr < 0 ) return herr;
|
||||||
|
|
||||||
herr = _write_data ( f, "0", x_data );
|
herr = _write_data ( f, "0", x_data, H5T_NATIVE_DOUBLE );
|
||||||
if ( herr < 0 ) return herr;
|
if ( herr < 0 ) return herr;
|
||||||
herr = _write_data ( f, "1", y_data );
|
herr = _write_data ( f, "1", y_data, H5T_NATIVE_DOUBLE );
|
||||||
if ( herr < 0 ) return herr;
|
if ( herr < 0 ) return herr;
|
||||||
herr = _write_data ( f, "2", z_data );
|
herr = _write_data ( f, "2", z_data, H5T_NATIVE_DOUBLE );
|
||||||
if ( herr < 0 ) return herr;
|
if ( herr < 0 ) return herr;
|
||||||
|
|
||||||
herr = _close_field_group ( f );
|
herr = _close_field_group ( f );
|
||||||
@@ -1498,10 +1742,21 @@ _get_field_info (
|
|||||||
h5part_int64_t herr = _open_block_group ( f );
|
h5part_int64_t herr = _open_block_group ( f );
|
||||||
if ( herr < 0 ) return herr;
|
if ( herr < 0 ) return herr;
|
||||||
|
|
||||||
|
#if H5_VERS_MAJOR == 1 && H5_VERS_MINOR == 8
|
||||||
|
hid_t group_id = H5Gopen2 (
|
||||||
|
f->block->blockgroup,
|
||||||
|
field_name,
|
||||||
|
H5P_DEFAULT );
|
||||||
|
#else
|
||||||
hid_t group_id = H5Gopen ( f->block->blockgroup, field_name );
|
hid_t group_id = H5Gopen ( f->block->blockgroup, field_name );
|
||||||
|
#endif
|
||||||
if ( group_id < 0 ) return HANDLE_H5G_OPEN_ERR ( field_name );
|
if ( group_id < 0 ) return HANDLE_H5G_OPEN_ERR ( field_name );
|
||||||
|
|
||||||
|
#if H5_VERS_MAJOR == 1 && H5_VERS_MINOR == 8
|
||||||
|
hid_t dataset_id = H5Dopen2 ( group_id, "0", H5P_DEFAULT );
|
||||||
|
#else
|
||||||
hid_t dataset_id = H5Dopen ( group_id, "0" );
|
hid_t dataset_id = H5Dopen ( group_id, "0" );
|
||||||
|
#endif
|
||||||
if ( dataset_id < 0 ) return HANDLE_H5D_OPEN_ERR ( "0" );
|
if ( dataset_id < 0 ) return HANDLE_H5D_OPEN_ERR ( "0" );
|
||||||
|
|
||||||
hid_t dataspace_id = H5Dget_space ( dataset_id );
|
hid_t dataspace_id = H5Dget_space ( dataset_id );
|
||||||
|
|||||||
@@ -53,6 +53,27 @@ H5Block3dGetProcOf (
|
|||||||
h5part_int64_t k
|
h5part_int64_t k
|
||||||
);
|
);
|
||||||
|
|
||||||
|
h5part_int64_t
|
||||||
|
H5Block3dWriteScalarFieldFloat64 (
|
||||||
|
H5PartFile *f,
|
||||||
|
const char *name,
|
||||||
|
const h5part_float64_t *data
|
||||||
|
);
|
||||||
|
|
||||||
|
h5part_int64_t
|
||||||
|
H5Block3dWriteScalarFieldFloat32 (
|
||||||
|
H5PartFile *f,
|
||||||
|
const char *name,
|
||||||
|
const h5part_float32_t *data
|
||||||
|
);
|
||||||
|
|
||||||
|
h5part_int64_t
|
||||||
|
H5Block3dWriteScalarFieldInt64 (
|
||||||
|
H5PartFile *f,
|
||||||
|
const char *name,
|
||||||
|
const h5part_int64_t *data
|
||||||
|
);
|
||||||
|
|
||||||
h5part_int64_t
|
h5part_int64_t
|
||||||
H5Block3dWriteScalarField (
|
H5Block3dWriteScalarField (
|
||||||
H5PartFile *f,
|
H5PartFile *f,
|
||||||
@@ -60,6 +81,27 @@ H5Block3dWriteScalarField (
|
|||||||
const h5part_float64_t *data
|
const h5part_float64_t *data
|
||||||
);
|
);
|
||||||
|
|
||||||
|
h5part_int64_t
|
||||||
|
H5Block3dReadScalarFieldFloat64 (
|
||||||
|
H5PartFile *f,
|
||||||
|
const char *name,
|
||||||
|
h5part_float64_t *data
|
||||||
|
);
|
||||||
|
|
||||||
|
h5part_int64_t
|
||||||
|
H5Block3dReadScalarFieldFloat32 (
|
||||||
|
H5PartFile *f,
|
||||||
|
const char *name,
|
||||||
|
h5part_float32_t *data
|
||||||
|
);
|
||||||
|
|
||||||
|
h5part_int64_t
|
||||||
|
H5Block3dReadSclarFieldInt64 (
|
||||||
|
H5PartFile *f,
|
||||||
|
const char *name,
|
||||||
|
h5part_int64_t *data
|
||||||
|
);
|
||||||
|
|
||||||
h5part_int64_t
|
h5part_int64_t
|
||||||
H5Block3dReadScalarField (
|
H5Block3dReadScalarField (
|
||||||
H5PartFile *f,
|
H5PartFile *f,
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ struct H5BlockStruct {
|
|||||||
struct H5BlockPartition *user_layout;
|
struct H5BlockPartition *user_layout;
|
||||||
struct H5BlockPartition *write_layout;
|
struct H5BlockPartition *write_layout;
|
||||||
int have_layout;
|
int have_layout;
|
||||||
|
hsize_t chunk[3];
|
||||||
|
|
||||||
hid_t shape;
|
hid_t shape;
|
||||||
hid_t memshape;
|
hid_t memshape;
|
||||||
|
|||||||
+177
-6
@@ -119,6 +119,9 @@ _file_is_valid (
|
|||||||
*/
|
*/
|
||||||
static herr_t
|
static herr_t
|
||||||
_h5_error_handler (
|
_h5_error_handler (
|
||||||
|
#if H5_VERS_MAJOR == 1 && H5_VERS_MINOR == 8
|
||||||
|
hid_t,
|
||||||
|
#endif
|
||||||
void *
|
void *
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -185,8 +188,17 @@ _H5Part_open_file (
|
|||||||
goto error_cleanup;
|
goto error_cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (f->myproc == 0) {
|
||||||
|
#ifdef H5PART_MPIPOSIX
|
||||||
|
_H5Part_print_info ( "Activating MPI-POSIX VFD" );
|
||||||
|
}
|
||||||
|
if (H5Pset_fapl_mpiposix (f->access_prop, comm, 0) < 0) {
|
||||||
|
#else
|
||||||
|
_H5Part_print_info ( "Activating MPI-IO VFD" );
|
||||||
|
}
|
||||||
if (H5Pset_fapl_mpio (f->access_prop, comm, info) < 0) {
|
if (H5Pset_fapl_mpio (f->access_prop, comm, info) < 0) {
|
||||||
HANDLE_H5P_SET_FAPL_MPIO_ERR;
|
#endif
|
||||||
|
HANDLE_H5P_SET_FAPL_ERR;
|
||||||
goto error_cleanup;
|
goto error_cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -565,7 +577,7 @@ H5PartSetNumParticles (
|
|||||||
start[0] += f->pnparticles[i];
|
start[0] += f->pnparticles[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
/* compute total nparticles */
|
/* compute total nparticles */
|
||||||
total = 0;
|
total = 0;
|
||||||
for (i=0; i < f->nprocs; i++) {
|
for (i=0; i < f->nprocs; i++) {
|
||||||
total += f->pnparticles[i];
|
total += f->pnparticles[i];
|
||||||
@@ -617,12 +629,23 @@ _write_data (
|
|||||||
"timestep %lld",
|
"timestep %lld",
|
||||||
name, (long long)f->timestep );
|
name, (long long)f->timestep );
|
||||||
|
|
||||||
|
#if H5_VERS_MAJOR == 1 && H5_VERS_MINOR == 8
|
||||||
|
dataset_id = H5Dcreate2 (
|
||||||
|
f->timegroup,
|
||||||
|
name,
|
||||||
|
type,
|
||||||
|
f->shape,
|
||||||
|
H5P_DEFAULT,
|
||||||
|
H5P_DEFAULT,
|
||||||
|
H5P_DEFAULT );
|
||||||
|
#else
|
||||||
dataset_id = H5Dcreate (
|
dataset_id = H5Dcreate (
|
||||||
f->timegroup,
|
f->timegroup,
|
||||||
name,
|
name,
|
||||||
type,
|
type,
|
||||||
f->shape,
|
f->shape,
|
||||||
H5P_DEFAULT );
|
H5P_DEFAULT );
|
||||||
|
#endif
|
||||||
if ( dataset_id < 0 )
|
if ( dataset_id < 0 )
|
||||||
return HANDLE_H5D_CREATE_ERR ( name, f->timestep );
|
return HANDLE_H5D_CREATE_ERR ( name, f->timestep );
|
||||||
|
|
||||||
@@ -700,6 +723,52 @@ H5PartWriteDataFloat64 (
|
|||||||
return H5PART_SUCCESS;
|
return H5PART_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\ingroup h5part_write
|
||||||
|
|
||||||
|
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 H5PartSetStep(), 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 H5PART_SUCCESS or error code
|
||||||
|
*/
|
||||||
|
h5part_int64_t
|
||||||
|
H5PartWriteDataFloat32 (
|
||||||
|
H5PartFile *f, /*!< [in] Handle to open file */
|
||||||
|
const char *name, /*!< [in] Name to associate array with */
|
||||||
|
const h5part_float32_t *array /*!< [in] Array to commit to disk */
|
||||||
|
) {
|
||||||
|
|
||||||
|
SET_FNAME ( "H5PartWriteDataFloat32" );
|
||||||
|
h5part_int64_t herr;
|
||||||
|
|
||||||
|
CHECK_FILEHANDLE ( f );
|
||||||
|
CHECK_WRITABLE_MODE( f );
|
||||||
|
CHECK_TIMEGROUP( f );
|
||||||
|
|
||||||
|
herr = _write_data ( f, name, (void*)array, H5T_NATIVE_FLOAT );
|
||||||
|
if ( herr < 0 ) return herr;
|
||||||
|
|
||||||
|
return H5PART_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\ingroup h5part_write
|
\ingroup h5part_write
|
||||||
|
|
||||||
@@ -799,7 +868,11 @@ _H5Part_read_attrib (
|
|||||||
hid_t mytype;
|
hid_t mytype;
|
||||||
hsize_t nelem;
|
hsize_t nelem;
|
||||||
|
|
||||||
|
#if H5_VERS_MAJOR == 1 && H5_VERS_MINOR == 8
|
||||||
|
attrib_id = H5Aopen ( id, attrib_name, H5P_DEFAULT );
|
||||||
|
#else
|
||||||
attrib_id = H5Aopen_name ( id, attrib_name );
|
attrib_id = H5Aopen_name ( id, attrib_name );
|
||||||
|
#endif
|
||||||
if ( attrib_id <= 0 ) return HANDLE_H5A_OPEN_NAME_ERR( attrib_name );
|
if ( attrib_id <= 0 ) return HANDLE_H5A_OPEN_NAME_ERR( attrib_name );
|
||||||
|
|
||||||
mytype = H5Aget_type ( attrib_id );
|
mytype = H5Aget_type ( attrib_id );
|
||||||
@@ -845,12 +918,22 @@ _H5Part_write_attrib (
|
|||||||
if ( space_id < 0 )
|
if ( space_id < 0 )
|
||||||
return HANDLE_H5S_CREATE_SIMPLE_ERR ( attrib_nelem );
|
return HANDLE_H5S_CREATE_SIMPLE_ERR ( attrib_nelem );
|
||||||
|
|
||||||
|
#if H5_VERS_MAJOR == 1 && H5_VERS_MINOR == 8
|
||||||
|
attrib_id = H5Acreate2 (
|
||||||
|
id,
|
||||||
|
attrib_name,
|
||||||
|
attrib_type,
|
||||||
|
space_id,
|
||||||
|
H5P_DEFAULT,
|
||||||
|
H5P_DEFAULT );
|
||||||
|
#else
|
||||||
attrib_id = H5Acreate (
|
attrib_id = H5Acreate (
|
||||||
id,
|
id,
|
||||||
attrib_name,
|
attrib_name,
|
||||||
attrib_type,
|
attrib_type,
|
||||||
space_id,
|
space_id,
|
||||||
H5P_DEFAULT );
|
H5P_DEFAULT );
|
||||||
|
#endif
|
||||||
if ( attrib_id < 0 ) return HANDLE_H5A_CREATE_ERR ( attrib_name );
|
if ( attrib_id < 0 ) return HANDLE_H5A_CREATE_ERR ( attrib_name );
|
||||||
|
|
||||||
herr = H5Awrite ( attrib_id, attrib_type, attrib_value);
|
herr = H5Awrite ( attrib_id, attrib_type, attrib_value);
|
||||||
@@ -944,7 +1027,11 @@ H5PartWriteFileAttribString (
|
|||||||
CHECK_FILEHANDLE ( f );
|
CHECK_FILEHANDLE ( f );
|
||||||
CHECK_WRITABLE_MODE( f );
|
CHECK_WRITABLE_MODE( f );
|
||||||
|
|
||||||
|
#if H5_VERS_MAJOR == 1 && H5_VERS_MINOR == 8
|
||||||
|
hid_t group_id = H5Gopen2(f->file,"/",H5P_DEFAULT);
|
||||||
|
#else
|
||||||
hid_t group_id = H5Gopen(f->file,"/");
|
hid_t group_id = H5Gopen(f->file,"/");
|
||||||
|
#endif
|
||||||
if ( group_id < 0 ) return HANDLE_H5G_OPEN_ERR( "/" );
|
if ( group_id < 0 ) return HANDLE_H5G_OPEN_ERR( "/" );
|
||||||
|
|
||||||
h5part_int64_t herr = _H5Part_write_attrib (
|
h5part_int64_t herr = _H5Part_write_attrib (
|
||||||
@@ -1083,7 +1170,11 @@ H5PartWriteFileAttrib (
|
|||||||
CHECK_FILEHANDLE ( f );
|
CHECK_FILEHANDLE ( f );
|
||||||
CHECK_WRITABLE_MODE ( f );
|
CHECK_WRITABLE_MODE ( f );
|
||||||
|
|
||||||
|
#if H5_VERS_MAJOR == 1 && H5_VERS_MINOR == 8
|
||||||
|
group_id = H5Gopen2(f->file,"/",H5P_DEFAULT);
|
||||||
|
#else
|
||||||
group_id = H5Gopen(f->file,"/");
|
group_id = H5Gopen(f->file,"/");
|
||||||
|
#endif
|
||||||
if ( group_id < 0 ) return HANDLE_H5G_OPEN_ERR( "/" );
|
if ( group_id < 0 ) return HANDLE_H5G_OPEN_ERR( "/" );
|
||||||
|
|
||||||
herr = _H5Part_write_attrib (
|
herr = _H5Part_write_attrib (
|
||||||
@@ -1141,7 +1232,11 @@ H5PartGetNumFileAttribs (
|
|||||||
|
|
||||||
CHECK_FILEHANDLE ( f );
|
CHECK_FILEHANDLE ( f );
|
||||||
|
|
||||||
|
#if H5_VERS_MAJOR == 1 && H5_VERS_MINOR == 8
|
||||||
|
hid_t group_id = H5Gopen2 ( f->file, "/", H5P_DEFAULT );
|
||||||
|
#else
|
||||||
hid_t group_id = H5Gopen ( f->file, "/" );
|
hid_t group_id = H5Gopen ( f->file, "/" );
|
||||||
|
#endif
|
||||||
if ( group_id < 0 ) HANDLE_H5G_OPEN_ERR ( "/" );
|
if ( group_id < 0 ) HANDLE_H5G_OPEN_ERR ( "/" );
|
||||||
|
|
||||||
nattribs = H5Aget_num_attrs ( group_id );
|
nattribs = H5Aget_num_attrs ( group_id );
|
||||||
@@ -1170,7 +1265,7 @@ h5part_int64_t
|
|||||||
H5PartGetStepAttribInfo (
|
H5PartGetStepAttribInfo (
|
||||||
H5PartFile *f, /*!< [in] Handle to open file */
|
H5PartFile *f, /*!< [in] Handle to open file */
|
||||||
const h5part_int64_t attrib_idx,/*!< [in] Index of attribute to
|
const h5part_int64_t attrib_idx,/*!< [in] Index of attribute to
|
||||||
get infos about */
|
get infos about */
|
||||||
char *attrib_name, /*!< [out] Name of attribute */
|
char *attrib_name, /*!< [out] Name of attribute */
|
||||||
const h5part_int64_t len_of_attrib_name,
|
const h5part_int64_t len_of_attrib_name,
|
||||||
/*!< [in] length of buffer \c name */
|
/*!< [in] length of buffer \c name */
|
||||||
@@ -1213,7 +1308,7 @@ h5part_int64_t
|
|||||||
H5PartGetFileAttribInfo (
|
H5PartGetFileAttribInfo (
|
||||||
H5PartFile *f, /*!< [in] Handle to open file */
|
H5PartFile *f, /*!< [in] Handle to open file */
|
||||||
const h5part_int64_t attrib_idx,/*!< [in] Index of attribute to get
|
const h5part_int64_t attrib_idx,/*!< [in] Index of attribute to get
|
||||||
infos about */
|
infos about */
|
||||||
char *attrib_name, /*!< [out] Name of attribute */
|
char *attrib_name, /*!< [out] Name of attribute */
|
||||||
const h5part_int64_t len_of_attrib_name,
|
const h5part_int64_t len_of_attrib_name,
|
||||||
/*!< [in] length of buffer \c name */
|
/*!< [in] length of buffer \c name */
|
||||||
@@ -1227,7 +1322,11 @@ H5PartGetFileAttribInfo (
|
|||||||
|
|
||||||
CHECK_FILEHANDLE( f );
|
CHECK_FILEHANDLE( f );
|
||||||
|
|
||||||
|
#if H5_VERS_MAJOR == 1 && H5_VERS_MINOR == 8
|
||||||
|
group_id = H5Gopen2(f->file,"/",H5P_DEFAULT);
|
||||||
|
#else
|
||||||
group_id = H5Gopen(f->file,"/");
|
group_id = H5Gopen(f->file,"/");
|
||||||
|
#endif
|
||||||
if ( group_id < 0 ) return HANDLE_H5G_OPEN_ERR( "/" );
|
if ( group_id < 0 ) return HANDLE_H5G_OPEN_ERR( "/" );
|
||||||
|
|
||||||
herr = _H5Part_get_attrib_info (
|
herr = _H5Part_get_attrib_info (
|
||||||
@@ -1292,7 +1391,11 @@ H5PartReadFileAttrib (
|
|||||||
|
|
||||||
CHECK_FILEHANDLE( f );
|
CHECK_FILEHANDLE( f );
|
||||||
|
|
||||||
|
#if H5_VERS_MAJOR == 1 && H5_VERS_MINOR == 8
|
||||||
|
group_id = H5Gopen2(f->file,"/",H5P_DEFAULT);
|
||||||
|
#else
|
||||||
group_id = H5Gopen(f->file,"/");
|
group_id = H5Gopen(f->file,"/");
|
||||||
|
#endif
|
||||||
if ( group_id < 0 ) return HANDLE_H5G_OPEN_ERR( "/" );
|
if ( group_id < 0 ) return HANDLE_H5G_OPEN_ERR( "/" );
|
||||||
|
|
||||||
herr = _H5Part_read_attrib ( group_id, attrib_name, attrib_value );
|
herr = _H5Part_read_attrib ( group_id, attrib_name, attrib_value );
|
||||||
@@ -1348,7 +1451,11 @@ _H5Part_set_step (
|
|||||||
(long long)step,
|
(long long)step,
|
||||||
(long long)(size_t) f );
|
(long long)(size_t) f );
|
||||||
|
|
||||||
|
#if H5_VERS_MAJOR == 1 && H5_VERS_MINOR == 8
|
||||||
|
f->timegroup = H5Gopen2 ( f->file, name, H5P_DEFAULT );
|
||||||
|
#else
|
||||||
f->timegroup = H5Gopen ( f->file, name );
|
f->timegroup = H5Gopen ( f->file, name );
|
||||||
|
#endif
|
||||||
if ( f->timegroup < 0 ) return HANDLE_H5G_OPEN_ERR( name );
|
if ( f->timegroup < 0 ) return HANDLE_H5G_OPEN_ERR( name );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -1358,7 +1465,16 @@ _H5Part_set_step (
|
|||||||
(long long)step,
|
(long long)step,
|
||||||
(long long)(size_t) f );
|
(long long)(size_t) f );
|
||||||
|
|
||||||
|
#if H5_VERS_MAJOR == 1 && H5_VERS_MINOR == 8
|
||||||
|
f->timegroup = H5Gcreate2 (
|
||||||
|
f->file,
|
||||||
|
name,
|
||||||
|
0,
|
||||||
|
H5P_DEFAULT,
|
||||||
|
H5P_DEFAULT );
|
||||||
|
#else
|
||||||
f->timegroup = H5Gcreate ( f->file, name, 0 );
|
f->timegroup = H5Gcreate ( f->file, name, 0 );
|
||||||
|
#endif
|
||||||
if ( f->timegroup < 0 ) return HANDLE_H5G_CREATE_ERR ( name );
|
if ( f->timegroup < 0 ) return HANDLE_H5G_CREATE_ERR ( name );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1689,7 +1805,11 @@ H5PartGetDatasetInfo (
|
|||||||
*nelem = _H5Part_get_num_particles ( f );
|
*nelem = _H5Part_get_num_particles ( f );
|
||||||
if ( *nelem < 0 ) return *nelem;
|
if ( *nelem < 0 ) return *nelem;
|
||||||
|
|
||||||
|
#if H5_VERS_MAJOR == 1 && H5_VERS_MINOR == 8
|
||||||
|
dataset_id = H5Dopen2 ( f->timegroup, dataset_name, H5P_DEFAULT );
|
||||||
|
#else
|
||||||
dataset_id = H5Dopen ( f->timegroup, dataset_name );
|
dataset_id = H5Dopen ( f->timegroup, dataset_name );
|
||||||
|
#endif
|
||||||
if ( dataset_id < 0 ) HANDLE_H5D_OPEN_ERR ( dataset_name );
|
if ( dataset_id < 0 ) HANDLE_H5D_OPEN_ERR ( dataset_name );
|
||||||
|
|
||||||
mytype = H5Dget_type ( dataset_id );
|
mytype = H5Dget_type ( dataset_id );
|
||||||
@@ -1801,7 +1921,11 @@ _H5Part_get_num_particles (
|
|||||||
dataset_name, sizeof (dataset_name) );
|
dataset_name, sizeof (dataset_name) );
|
||||||
if ( herr < 0 ) return herr;
|
if ( herr < 0 ) return herr;
|
||||||
|
|
||||||
|
#if H5_VERS_MAJOR == 1 && H5_VERS_MINOR == 8
|
||||||
|
dataset_id = H5Dopen2 ( f->timegroup, dataset_name, H5P_DEFAULT );
|
||||||
|
#else
|
||||||
dataset_id = H5Dopen ( f->timegroup, dataset_name );
|
dataset_id = H5Dopen ( f->timegroup, dataset_name );
|
||||||
|
#endif
|
||||||
if ( dataset_id < 0 )
|
if ( dataset_id < 0 )
|
||||||
return HANDLE_H5D_OPEN_ERR ( dataset_name );
|
return HANDLE_H5D_OPEN_ERR ( dataset_name );
|
||||||
|
|
||||||
@@ -2166,7 +2290,11 @@ _read_data (
|
|||||||
h5part_int64_t h5err = _H5Part_set_step ( f, f->timestep );
|
h5part_int64_t h5err = _H5Part_set_step ( f, f->timestep );
|
||||||
if ( h5err < 0 ) return h5err;
|
if ( h5err < 0 ) return h5err;
|
||||||
}
|
}
|
||||||
|
#if H5_VERS_MAJOR == 1 && H5_VERS_MINOR == 8
|
||||||
|
dataset_id = H5Dopen2 ( f->timegroup, name, H5P_DEFAULT );
|
||||||
|
#else
|
||||||
dataset_id = H5Dopen ( f->timegroup, name );
|
dataset_id = H5Dopen ( f->timegroup, name );
|
||||||
|
#endif
|
||||||
if ( dataset_id < 0 ) return HANDLE_H5D_OPEN_ERR ( name );
|
if ( dataset_id < 0 ) return HANDLE_H5D_OPEN_ERR ( name );
|
||||||
|
|
||||||
space_id = _get_diskshape_for_reading ( f, dataset_id );
|
space_id = _get_diskshape_for_reading ( f, dataset_id );
|
||||||
@@ -2245,6 +2373,37 @@ H5PartReadDataFloat64 (
|
|||||||
return H5PART_SUCCESS;
|
return H5PART_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\ingroup h5part_read
|
||||||
|
|
||||||
|
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 H5PART_SUCCESS or error code
|
||||||
|
*/
|
||||||
|
h5part_int64_t
|
||||||
|
H5PartReadDataFloat32 (
|
||||||
|
H5PartFile *f, /*!< [in] Handle to open file */
|
||||||
|
const char *name, /*!< [in] Name to associate dataset with */
|
||||||
|
h5part_float32_t *array /*!< [out] Array of data */
|
||||||
|
) {
|
||||||
|
|
||||||
|
SET_FNAME ( "H5PartReadDataFloat32" );
|
||||||
|
|
||||||
|
h5part_int64_t herr;
|
||||||
|
|
||||||
|
CHECK_FILEHANDLE( f );
|
||||||
|
|
||||||
|
herr = _read_data ( f, name, array, H5T_NATIVE_FLOAT );
|
||||||
|
if ( herr < 0 ) return herr;
|
||||||
|
|
||||||
|
return H5PART_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\ingroup h5part_read
|
\ingroup h5part_read
|
||||||
|
|
||||||
@@ -2456,7 +2615,11 @@ _init ( void ) {
|
|||||||
|
|
||||||
herr_t r5;
|
herr_t r5;
|
||||||
if ( ! __init ) {
|
if ( ! __init ) {
|
||||||
|
#if H5_VERS_MAJOR == 1 && H5_VERS_MINOR == 8
|
||||||
|
r5 = H5Eset_auto2 ( H5E_DEFAULT, _h5_error_handler, NULL );
|
||||||
|
#else
|
||||||
r5 = H5Eset_auto ( _h5_error_handler, NULL );
|
r5 = H5Eset_auto ( _h5_error_handler, NULL );
|
||||||
|
#endif
|
||||||
if ( r5 < 0 ) return H5PART_ERR_INIT;
|
if ( r5 < 0 ) return H5PART_ERR_INIT;
|
||||||
}
|
}
|
||||||
__init = 1;
|
__init = 1;
|
||||||
@@ -2465,10 +2628,18 @@ _init ( void ) {
|
|||||||
/*! @} */
|
/*! @} */
|
||||||
|
|
||||||
static herr_t
|
static herr_t
|
||||||
|
#if H5_VERS_MAJOR == 1 && H5_VERS_MINOR == 8
|
||||||
|
_h5_error_handler ( hid_t estack, void* unused ) {
|
||||||
|
#else
|
||||||
_h5_error_handler ( void* unused ) {
|
_h5_error_handler ( void* unused ) {
|
||||||
|
#endif
|
||||||
|
|
||||||
if ( _debug >= 5 ) {
|
if ( _debug >= 5 ) {
|
||||||
|
#if H5_VERS_MAJOR == 1 && H5_VERS_MINOR == 8
|
||||||
|
H5Eprint2 (H5E_DEFAULT,stderr);
|
||||||
|
#else
|
||||||
H5Eprint (stderr);
|
H5Eprint (stderr);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -2577,9 +2748,9 @@ _H5Part_print_debug (
|
|||||||
|
|
||||||
void
|
void
|
||||||
_H5Part_set_funcname (
|
_H5Part_set_funcname (
|
||||||
char * const fname
|
const char * const fname
|
||||||
) {
|
) {
|
||||||
__funcname = fname;
|
__funcname = (char* const) fname;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *
|
const char *
|
||||||
|
|||||||
@@ -82,6 +82,14 @@ H5PartWriteDataFloat64 (
|
|||||||
const h5part_float64_t *array
|
const h5part_float64_t *array
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
h5part_int64_t
|
||||||
|
H5PartWriteDataFloat32 (
|
||||||
|
H5PartFile *f,
|
||||||
|
const char *name,
|
||||||
|
const h5part_float32_t *array
|
||||||
|
);
|
||||||
|
|
||||||
h5part_int64_t
|
h5part_int64_t
|
||||||
H5PartWriteDataInt64 (
|
H5PartWriteDataInt64 (
|
||||||
H5PartFile *f,
|
H5PartFile *f,
|
||||||
@@ -172,6 +180,13 @@ H5PartReadDataFloat64(
|
|||||||
h5part_float64_t *array
|
h5part_float64_t *array
|
||||||
);
|
);
|
||||||
|
|
||||||
|
h5part_int64_t
|
||||||
|
H5PartReadDataFloat32(
|
||||||
|
H5PartFile *f,
|
||||||
|
const char *name,
|
||||||
|
h5part_float32_t *array
|
||||||
|
);
|
||||||
|
|
||||||
h5part_int64_t
|
h5part_int64_t
|
||||||
H5PartReadDataInt64 (
|
H5PartReadDataInt64 (
|
||||||
H5PartFile *f,
|
H5PartFile *f,
|
||||||
|
|||||||
+8
-2
@@ -38,7 +38,7 @@
|
|||||||
"Called with bad filehandle." );
|
"Called with bad filehandle." );
|
||||||
|
|
||||||
#define HANDLE_H5PART_INIT_ERR \
|
#define HANDLE_H5PART_INIT_ERR \
|
||||||
(*_err_handler) ( \
|
(*_err_handler) ( \
|
||||||
_H5Part_get_funcname(), \
|
_H5Part_get_funcname(), \
|
||||||
H5PART_ERR_INIT, \
|
H5PART_ERR_INIT, \
|
||||||
"Cannot initialize H5Part." );
|
"Cannot initialize H5Part." );
|
||||||
@@ -258,13 +258,19 @@
|
|||||||
"MPI: Cannot set data transfer mode." );
|
"MPI: Cannot set data transfer mode." );
|
||||||
|
|
||||||
|
|
||||||
#define HANDLE_H5P_SET_FAPL_MPIO_ERR \
|
#define HANDLE_H5P_SET_FAPL_ERR \
|
||||||
(*_err_handler) ( \
|
(*_err_handler) ( \
|
||||||
_H5Part_get_funcname(), \
|
_H5Part_get_funcname(), \
|
||||||
H5PART_ERR_HDF5, \
|
H5PART_ERR_HDF5, \
|
||||||
"Cannot store IO communicator information to the " \
|
"Cannot store IO communicator information to the " \
|
||||||
"file access property list.");
|
"file access property list.");
|
||||||
|
|
||||||
|
#define HANDLE_H5P_SET_CHUNK_ERR \
|
||||||
|
(*_err_handler) ( \
|
||||||
|
_H5Part_get_funcname(), \
|
||||||
|
H5PART_ERR_HDF5, \
|
||||||
|
"Cannot set chunk dimensions." );
|
||||||
|
|
||||||
/* H5S: dataspace */
|
/* H5S: dataspace */
|
||||||
#define HANDLE_H5S_CREATE_SIMPLE_ERR( n ) \
|
#define HANDLE_H5S_CREATE_SIMPLE_ERR( n ) \
|
||||||
(*_err_handler) ( \
|
(*_err_handler) ( \
|
||||||
|
|||||||
+1
-1
@@ -42,7 +42,7 @@ _H5Part_iteration_operator (
|
|||||||
|
|
||||||
void
|
void
|
||||||
_H5Part_set_funcname (
|
_H5Part_set_funcname (
|
||||||
char * const fname
|
const char * const fname
|
||||||
);
|
);
|
||||||
|
|
||||||
const char *
|
const char *
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ typedef __int64 int64_t;
|
|||||||
|
|
||||||
typedef int64_t h5part_int64_t;
|
typedef int64_t h5part_int64_t;
|
||||||
typedef double h5part_float64_t;
|
typedef double h5part_float64_t;
|
||||||
|
typedef float h5part_float32_t;
|
||||||
typedef h5part_int64_t (*h5part_error_handler)( const char*, const h5part_int64_t, const char*,...)
|
typedef h5part_int64_t (*h5part_error_handler)( const char*, const h5part_int64_t, const char*,...)
|
||||||
#ifdef __GNUC__
|
#ifdef __GNUC__
|
||||||
__attribute__ ((format (printf, 3, 4)))
|
__attribute__ ((format (printf, 3, 4)))
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ _write_data (
|
|||||||
|
|
||||||
printf ( "Writing Step #%lld\n", (long long)f->timestep );
|
printf ( "Writing Step #%lld\n", (long long)f->timestep );
|
||||||
|
|
||||||
data = malloc ( i_dims * j_dims * k_dims * sizeof ( *data ) );
|
data = (h5part_float64_t *) malloc ( i_dims * j_dims * k_dims * sizeof ( *data ) );
|
||||||
for ( i = 0; i < i_dims; i++ ) {
|
for ( i = 0; i < i_dims; i++ ) {
|
||||||
for ( j = 0; j < j_dims; j++ ) {
|
for ( j = 0; j < j_dims; j++ ) {
|
||||||
for ( k = 0; k < k_dims; k++ ) {
|
for ( k = 0; k < k_dims; k++ ) {
|
||||||
@@ -170,7 +170,7 @@ _read_data (
|
|||||||
|
|
||||||
printf ( "Reading Step #%lld\n", (long long)f->timestep );
|
printf ( "Reading Step #%lld\n", (long long)f->timestep );
|
||||||
|
|
||||||
data = malloc ( i_dims * j_dims * k_dims * sizeof ( *data ) );
|
data = (h5part_float64_t *) malloc ( i_dims * j_dims * k_dims * sizeof ( *data ) );
|
||||||
|
|
||||||
herr = H5BlockDefine3DFieldLayout (
|
herr = H5BlockDefine3DFieldLayout (
|
||||||
f,
|
f,
|
||||||
@@ -179,7 +179,7 @@ _read_data (
|
|||||||
layout->k_start, layout->k_end );
|
layout->k_start, layout->k_end );
|
||||||
if ( herr < 0 ) return herr;
|
if ( herr < 0 ) return herr;
|
||||||
|
|
||||||
herr = H5Block3dReadScalarField ( f, "TestField", data );
|
herr = H5Block3dReadScalarField ( f, "TestField", data );
|
||||||
if ( herr < 0 ) return herr;
|
if ( herr < 0 ) return herr;
|
||||||
|
|
||||||
for ( i = 0; i < i_dims; i++ ) {
|
for ( i = 0; i < i_dims; i++ ) {
|
||||||
|
|||||||
+233
-280
@@ -10,289 +10,242 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
int main(int argc,char *argv[]){
|
||||||
|
int sz=5;
|
||||||
|
double *x,*y,*z;
|
||||||
|
h5part_int64_t *id;
|
||||||
|
H5PartFile *file;
|
||||||
|
int i,t,nt,nds, np;
|
||||||
|
int nprocs = 1;
|
||||||
|
int myproc = 0;
|
||||||
|
|
||||||
#ifdef PARALLEL_IO
|
#ifdef PARALLEL_IO
|
||||||
|
MPI_Comm comm=MPI_COMM_WORLD;
|
||||||
|
|
||||||
int main(int argc,char *argv[]){
|
MPI_Init(&argc,&argv);
|
||||||
int sz=5;
|
MPI_Comm_size(comm,&nprocs);
|
||||||
double *x,*y,*z;
|
MPI_Comm_rank(comm,&myproc);
|
||||||
h5part_int64_t *id;
|
|
||||||
H5PartFile *file;
|
|
||||||
int i,t,nt,nds;
|
|
||||||
int nprocs,myproc;
|
|
||||||
MPI_Comm comm=MPI_COMM_WORLD;
|
|
||||||
|
|
||||||
MPI_Init(&argc,&argv);
|
|
||||||
MPI_Comm_size(comm,&nprocs);
|
|
||||||
MPI_Comm_rank(comm,&myproc);
|
|
||||||
|
|
||||||
x=(double*)malloc(sz*nprocs*sizeof(double));
|
|
||||||
y=(double*)malloc(sz*nprocs*sizeof(double));
|
|
||||||
z=(double*)malloc(sz*nprocs*sizeof(double));
|
|
||||||
id=(h5part_int64_t*)malloc(sz*nprocs*sizeof(h5part_int64_t));
|
|
||||||
/* parallel file creation */
|
|
||||||
file=H5PartOpenFileParallel("parttest.h5",H5PART_WRITE,comm);
|
|
||||||
if(!file) {
|
|
||||||
perror("File open failed: exiting!");
|
|
||||||
exit(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
for(t=0;t<5;t++){
|
|
||||||
MPI_Barrier(comm);
|
|
||||||
for(i=0;i<sz;i++) {
|
|
||||||
x[i]=(double)(i+t)+10.0*(double)myproc;
|
|
||||||
y[i]=0.1 + (double)(i+t);
|
|
||||||
z[i]=0.2 + (double)(i+t*10);
|
|
||||||
id[i]=i+sz*myproc;
|
|
||||||
}
|
|
||||||
printf("Proc[%u] Writing timestep %u file=%u\n",myproc,t,file->file);
|
|
||||||
H5PartSetStep(file,t); /* must set the current timestep in file */
|
|
||||||
H5PartSetNumParticles(file,sz); /* then set number of particles to store */
|
|
||||||
/* now write different tuples of data into this timestep of the file */
|
|
||||||
H5PartWriteDataFloat64(file,"x",x);
|
|
||||||
H5PartWriteDataFloat64(file,"y",y);
|
|
||||||
H5PartWriteDataFloat64(file,"z",z);
|
|
||||||
|
|
||||||
H5PartWriteDataFloat64(file,"px",x);
|
|
||||||
H5PartWriteDataFloat64(file,"py",y);
|
|
||||||
H5PartWriteDataFloat64(file,"pz",z);
|
|
||||||
|
|
||||||
H5PartWriteDataInt64(file,"id",id);
|
|
||||||
}
|
|
||||||
|
|
||||||
unsigned int idStart = 0+sz*myproc;
|
|
||||||
unsigned int idEnd = (sz-1)+sz*myproc;
|
|
||||||
|
|
||||||
printf("AllDone p[%u]\n",myproc);
|
|
||||||
H5PartCloseFile(file);
|
|
||||||
fprintf(stderr,"Closed files p[%u]\n",myproc);
|
|
||||||
MPI_Barrier(comm);
|
|
||||||
|
|
||||||
fprintf(stderr,"p[%u:%u] : OK, close file and reopen for reading idStart %u idEnd %u \n",myproc,nprocs,idStart,idEnd);
|
|
||||||
|
|
||||||
file=H5PartOpenFileParallel("parttest.h5",H5PART_READ,comm);
|
|
||||||
H5PartSetStep(file,0);
|
|
||||||
// unsigned int np = 0;
|
|
||||||
unsigned int np = (int)H5PartGetNumParticles(file);
|
|
||||||
nt=H5PartGetNumSteps(file); /* get number of steps in file */
|
|
||||||
nds=H5PartGetNumDatasets(file); /* get number of datasets in timestep 0 */
|
|
||||||
|
|
||||||
MPI_Barrier(comm);
|
|
||||||
|
|
||||||
H5PartSetView(file,idStart,idEnd);
|
|
||||||
|
|
||||||
np = (int)H5PartGetNumParticles(file);
|
|
||||||
printf("After SetView(%d,%d): steps= %u datasets= %u particles= %u\n",
|
|
||||||
(int)idStart,(int)idEnd,
|
|
||||||
nt,nds,np);
|
|
||||||
|
|
||||||
if(x)
|
|
||||||
free(x);
|
|
||||||
if(y)
|
|
||||||
free(y);
|
|
||||||
if(z)
|
|
||||||
free(z);
|
|
||||||
if(id)
|
|
||||||
free(id);
|
|
||||||
|
|
||||||
H5PartCloseFile(file);
|
|
||||||
MPI_Barrier(comm);
|
|
||||||
fprintf(stderr,"proc[%u]: done\n",myproc);
|
|
||||||
return MPI_Finalize();
|
|
||||||
}
|
|
||||||
|
|
||||||
#else
|
|
||||||
int main(int argc,char *argv[]){
|
|
||||||
int sz=10;
|
|
||||||
double *x,*y,*z;
|
|
||||||
h5part_int64_t *id;
|
|
||||||
H5PartFile *file;
|
|
||||||
int i,t,nt,nds,np;
|
|
||||||
h5part_int64_t idStart = 0;
|
|
||||||
h5part_int64_t idEnd = 0;
|
|
||||||
|
|
||||||
|
|
||||||
x=(double*)malloc(sz*sizeof(double));
|
|
||||||
y=(double*)malloc(sz*sizeof(double));
|
|
||||||
z=(double*)malloc(sz*sizeof(double));
|
|
||||||
id=(h5part_int64_t*)malloc(sz*sizeof(h5part_int64_t));
|
|
||||||
/* parallel file creation */
|
|
||||||
file=H5PartOpenFile("parttest.h5",H5PART_WRITE);
|
|
||||||
if(!file) {
|
|
||||||
perror("File open failed: exiting!");
|
|
||||||
exit(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
H5PartWriteFileAttribString(file,"File Description", "This file is created by H5PartTest.cc. Simple H5Part file for testing purpose...");
|
|
||||||
char* FileAttrib = "Created by H5PartTest.cc";
|
|
||||||
H5PartWriteFileAttrib(file, "Origin", H5T_NATIVE_CHAR, FileAttrib ,strlen(FileAttrib));
|
|
||||||
|
|
||||||
for(t=0;t<5;t++){
|
|
||||||
fprintf(stdout,"Writing timestep %u\n",t);
|
|
||||||
for(i=0;i<sz;i++) {
|
|
||||||
x[i]=(double)(i+t);
|
|
||||||
y[i]=0.1 + (double)(i+t);
|
|
||||||
z[i]=0.2 + (double)(i+t*10);
|
|
||||||
id[i]=i;
|
|
||||||
fprintf(stdout,"\tp[%u] x=%f y=%f z=%f id=%d\n",
|
|
||||||
i,x[i],y[i],z[i],(int)id[i]);
|
|
||||||
}
|
|
||||||
H5PartSetStep(file,t); /* must set the current timestep in file */
|
|
||||||
|
|
||||||
H5PartSetNumParticles(file,sz); /* then set number of particles to store */
|
|
||||||
/* now write different tuples of data into this timestep of the file */
|
|
||||||
H5PartWriteDataFloat64(file,"x",x);
|
|
||||||
H5PartWriteDataFloat64(file,"y",y);
|
|
||||||
H5PartWriteDataFloat64(file,"z",z);
|
|
||||||
|
|
||||||
H5PartWriteDataFloat64(file,"px",x);
|
|
||||||
H5PartWriteDataFloat64(file,"py",y);
|
|
||||||
H5PartWriteDataFloat64(file,"pz",z);
|
|
||||||
|
|
||||||
H5PartWriteDataInt64(file,"id",id);
|
|
||||||
|
|
||||||
H5PartWriteStepAttribString(file,"Step Description", "STEP STEP STEP");
|
|
||||||
char* StepAttrib = "STEP";
|
|
||||||
H5PartWriteStepAttrib(file, "Step", H5T_NATIVE_CHAR, StepAttrib ,strlen(StepAttrib));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
printf("AllDone writing\n");
|
|
||||||
H5PartCloseFile(file);
|
|
||||||
|
|
||||||
|
|
||||||
/*+++++++++++++ Reopen File for Reading +++H5PartSetStep(h5partFile,0)++++++++*/
|
|
||||||
file=H5PartOpenFile("parttest.h5",H5PART_READ);
|
|
||||||
|
|
||||||
|
|
||||||
/********************************************/
|
|
||||||
H5PartSetStep(file,0);
|
|
||||||
nt=H5PartGetNumSteps(file); /* get number of steps in file */
|
|
||||||
nds=H5PartGetNumDatasets(file); /* get number of datasets in timestep 0 */
|
|
||||||
np=H5PartGetNumParticles(file);
|
|
||||||
|
|
||||||
|
|
||||||
fprintf(stdout,"OK, close file and reopen for reading\n");
|
|
||||||
fprintf(stdout,"steps= %u\tdatasets=%u\tparticles= %u\n",
|
|
||||||
nt,nds,np);
|
|
||||||
|
|
||||||
// clear the particles
|
|
||||||
for(i=0;i<np;i++){
|
|
||||||
x[i]=y[i]=z[i]=0.0;
|
|
||||||
id[i]=0;
|
|
||||||
}
|
|
||||||
|
|
||||||
H5PartReadDataFloat64(file,"x",x);
|
|
||||||
H5PartReadDataFloat64(file,"y",y);
|
|
||||||
H5PartReadDataFloat64(file,"z",z);
|
|
||||||
H5PartReadDataInt64(file,"id",id);
|
|
||||||
|
|
||||||
for(i=0;i<np;i++){
|
|
||||||
fprintf(stdout,
|
|
||||||
"\tp[%3u] x=%lf y=%lf z=%lf id=%lld\n",
|
|
||||||
i,x[i],y[i],z[i],(long long)(id[i]));
|
|
||||||
}
|
|
||||||
/************************ std::cout << "nParticles: " << nParticles << std::endl;
|
|
||||||
********************/
|
|
||||||
printf("Set to last step and reload data\n");
|
|
||||||
H5PartSetStep(file,nt-1);
|
|
||||||
H5PartReadDataFloat64(file,"x",x);
|
|
||||||
H5PartReadDataFloat64(file,"y",y);
|
|
||||||
H5PartReadDataFloat64(file,"z",z);
|
|
||||||
H5PartReadDataInt64(file,"id",id);
|
|
||||||
for(i=0;i<np;i++){
|
|
||||||
fprintf(stdout,"\tp[%3u] x=%lf y=%lf z=%lf id=%lld\n",
|
|
||||||
i,x[i],y[i],z[i],(long long) (id[i]));
|
|
||||||
}
|
|
||||||
|
|
||||||
/********************************************/
|
|
||||||
idEnd=np;
|
|
||||||
printf("Old View is %d:%d\n",(int)idStart,(int)idEnd);
|
|
||||||
H5PartSetView(file,idStart,idEnd>>1);
|
|
||||||
printf("Set new view = %d:%d\n",(int)idStart,(int)(idEnd>>1));
|
|
||||||
H5PartGetView(file,&idStart,&idEnd);
|
|
||||||
np=H5PartGetNumParticles(file);
|
|
||||||
printf("steps= %u datasets= %u particles= %d with view %d:%d\n",
|
|
||||||
nt,nds,(int)np,(int)idStart,(int)idEnd);
|
|
||||||
H5PartSetStep(file,nt-1); // set to last step
|
|
||||||
printf("Setting to last step = %u\n",nt-1);
|
|
||||||
for(i=0;i<10;i++){ x[i]=y[i]=z[i]=0.0; id[i]=0; } /* clear the arrays */
|
|
||||||
H5PartReadDataFloat64(file,"x",x);
|
|
||||||
H5PartReadDataFloat64(file,"y",y);
|
|
||||||
H5PartReadDataFloat64(file,"z",z);
|
|
||||||
H5PartReadDataInt64(file,"id",id);
|
|
||||||
|
|
||||||
for(i=0;i<np;i++){
|
|
||||||
fprintf(stdout,
|
|
||||||
"\tp[%3u] x=%lf y=%lf z=%lf id=%lld\n",
|
|
||||||
i,x[i],y[i],z[i],(long long)id[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
/********************************************/
|
|
||||||
printf("Now set the view to the latter half of the data in step #%u\n",nt-1);
|
|
||||||
H5PartResetView(file);
|
|
||||||
H5PartGetView(file,&idStart,&idEnd);
|
|
||||||
printf("Reset view = %d:%d\nSetting to %u:%u\n",
|
|
||||||
(int)idStart,(int)idEnd,
|
|
||||||
(int)idEnd>>1,(int)idEnd);
|
|
||||||
H5PartSetView(file,(idEnd>>1),idEnd);
|
|
||||||
np=H5PartGetNumParticles(file);
|
|
||||||
printf("Now particles in selection are %d\n",np);
|
|
||||||
printf("doubleCheck=%lld\n", (long long)H5PartGetView(file,0,0));
|
|
||||||
|
|
||||||
for(i=0;i<10;i++){ x[i]=y[i]=z[i]=0.0; id[i]=0; } /* clear the arrays */
|
|
||||||
|
|
||||||
H5PartReadDataFloat64(file,"x",x);
|
|
||||||
H5PartReadDataFloat64(file,"y",y);
|
|
||||||
H5PartReadDataFloat64(file,"z",z);
|
|
||||||
H5PartReadDataInt64(file,"id",id);
|
|
||||||
for(i=0;i<np;i++){
|
|
||||||
fprintf(stdout,
|
|
||||||
"\tp[%3u] x=%lf y=%lf z=%lf id=%lld\n",
|
|
||||||
i,x[i],y[i],z[i],(long long)id[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
// read dataset names
|
|
||||||
h5part_int64_t status = H5PART_SUCCESS;
|
|
||||||
const h5part_int64_t lenName = 64;
|
|
||||||
char datasetName[lenName];
|
|
||||||
h5part_int64_t datasetType;
|
|
||||||
h5part_int64_t datasetNElems;
|
|
||||||
|
|
||||||
H5PartSetStep(file,0);
|
|
||||||
for (h5part_int64_t i=0; i < nds; i++) {
|
|
||||||
status = H5PartGetDatasetInfo(file, i, datasetName, lenName,
|
|
||||||
&datasetType, &datasetNElems);
|
|
||||||
|
|
||||||
if (status != H5PART_SUCCESS) {
|
|
||||||
perror("Could not retrieve dataset names!");
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
printf("datasetName: %s, type: %d, nElements: %d ",
|
|
||||||
datasetName, datasetType, datasetNElems);
|
|
||||||
if (datasetType == H5PART_INT64) {
|
|
||||||
printf("H5PPART_INT64 \n");
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
printf("H5PPART_FLOAT64 \n");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(x)
|
|
||||||
free(x);
|
|
||||||
if(y)
|
|
||||||
free(y);
|
|
||||||
if(z)
|
|
||||||
free(z);
|
|
||||||
if(id)
|
|
||||||
free(id);
|
|
||||||
|
|
||||||
H5PartCloseFile(file);
|
|
||||||
|
|
||||||
fprintf(stderr,"done\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
x=(double*)malloc(sz*nprocs*sizeof(double));
|
||||||
|
y=(double*)malloc(sz*nprocs*sizeof(double));
|
||||||
|
z=(double*)malloc(sz*nprocs*sizeof(double));
|
||||||
|
id=(h5part_int64_t*)malloc(sz*nprocs*sizeof(h5part_int64_t));
|
||||||
|
|
||||||
|
#ifdef PARALLEL_IO
|
||||||
|
file=H5PartOpenFileParallel("parttest.h5",H5PART_WRITE,comm);
|
||||||
|
#else
|
||||||
|
file=H5PartOpenFile("parttest.h5",H5PART_WRITE);
|
||||||
|
#endif
|
||||||
|
if(!file) {
|
||||||
|
perror("File open failed: exiting!");
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( myproc == 0 ) {
|
||||||
|
H5PartWriteFileAttribString (
|
||||||
|
file,
|
||||||
|
"File Description",
|
||||||
|
"Simple H5Part file for testing purpose...");
|
||||||
|
char* FileAttrib = "Created by H5PartTest.cc";
|
||||||
|
H5PartWriteFileAttrib (
|
||||||
|
file,
|
||||||
|
"Origin",
|
||||||
|
H5T_NATIVE_CHAR,
|
||||||
|
FileAttrib,
|
||||||
|
strlen(FileAttrib));
|
||||||
|
}
|
||||||
|
for(t=0;t<5;t++){
|
||||||
|
#ifdef PARALLEL_IO
|
||||||
|
MPI_Barrier(comm);
|
||||||
|
#endif
|
||||||
|
fprintf(stdout,"Writing timestep %u\n",t);
|
||||||
|
|
||||||
|
for(i=0;i<sz;i++) {
|
||||||
|
x[i]=(double)(i+t)+10.0*(double)myproc;
|
||||||
|
y[i]=0.1 + (double)(i+t);
|
||||||
|
z[i]=0.2 + (double)(i+t*10);
|
||||||
|
id[i]=i+sz*myproc;
|
||||||
|
}
|
||||||
|
printf("Proc[%u] Writing timestep %u file=%u\n",myproc,t,file->file);
|
||||||
|
H5PartSetStep(file,t); /* must set the current timestep in file */
|
||||||
|
H5PartSetNumParticles(file,sz); /* then set number of particles to store */
|
||||||
|
/* now write different tuples of data into this timestep of the file */
|
||||||
|
H5PartWriteDataFloat64(file,"x",x);
|
||||||
|
H5PartWriteDataFloat64(file,"y",y);
|
||||||
|
H5PartWriteDataFloat64(file,"z",z);
|
||||||
|
|
||||||
|
H5PartWriteDataFloat64(file,"px",x);
|
||||||
|
H5PartWriteDataFloat64(file,"py",y);
|
||||||
|
H5PartWriteDataFloat64(file,"pz",z);
|
||||||
|
|
||||||
|
H5PartWriteDataInt64(file,"id",id);
|
||||||
|
if ( myproc == 0 ) {
|
||||||
|
H5PartWriteStepAttribString (
|
||||||
|
file,
|
||||||
|
"Step Description",
|
||||||
|
"STEP STEP STEP"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
h5part_int64_t idStart = 0+sz*myproc;
|
||||||
|
h5part_int64_t idEnd = (sz-1)+sz*myproc;
|
||||||
|
|
||||||
|
printf("AllDone p[%u]\n",myproc);
|
||||||
|
H5PartCloseFile(file);
|
||||||
|
fprintf(stderr,"Closed files p[%u]\n",myproc);
|
||||||
|
#ifdef PARALLEL_IO
|
||||||
|
MPI_Barrier(comm);
|
||||||
|
#endif
|
||||||
|
fprintf (
|
||||||
|
stderr,
|
||||||
|
"p[%u:%u] : OK, close file and reopen for reading idStart %lld idEnd %lld \n",
|
||||||
|
myproc, nprocs, (long long)idStart,
|
||||||
|
(long long)idEnd );
|
||||||
|
|
||||||
|
#ifdef PARALLEL_IO
|
||||||
|
file = H5PartOpenFileParallel ( "parttest.h5", H5PART_READ, comm );
|
||||||
|
#else
|
||||||
|
file = H5PartOpenFile ( "parttest.h5", H5PART_READ );
|
||||||
|
#endif
|
||||||
|
H5PartSetStep(file,0);
|
||||||
|
nt = H5PartGetNumSteps(file); /* get number of steps in file */
|
||||||
|
nds = H5PartGetNumDatasets(file); /* get number of datasets in timestep 0 */
|
||||||
|
np = H5PartGetNumParticles(file);
|
||||||
|
|
||||||
|
H5PartSetView(file,idStart,idEnd);
|
||||||
|
|
||||||
|
np = (int)H5PartGetNumParticles(file);
|
||||||
|
printf("After SetView(%d,%d): steps= %u datasets= %u particles= %u\n",
|
||||||
|
(int)idStart,(int)idEnd,
|
||||||
|
nt,nds,np);
|
||||||
|
|
||||||
|
#ifdef PARALLEL_IO
|
||||||
|
MPI_Barrier(comm);
|
||||||
|
#endif
|
||||||
|
// clear the particles
|
||||||
|
for(i=0;i<np;i++){
|
||||||
|
x[i]=y[i]=z[i]=0.0;
|
||||||
|
id[i]=0;
|
||||||
|
}
|
||||||
|
|
||||||
|
H5PartReadDataFloat64(file,"x",x);
|
||||||
|
H5PartReadDataFloat64(file,"y",y);
|
||||||
|
H5PartReadDataFloat64(file,"z",z);
|
||||||
|
H5PartReadDataInt64(file,"id",id);
|
||||||
|
|
||||||
|
for(i=0;i<np;i++){
|
||||||
|
fprintf(stdout,
|
||||||
|
"\tp[%3u] x=%lf y=%lf z=%lf id=%lld\n",
|
||||||
|
i,x[i],y[i],z[i],(long long)(id[i]));
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("Set to last step and reload data\n");
|
||||||
|
H5PartSetStep(file,nt-1);
|
||||||
|
H5PartReadDataFloat64(file,"x",x);
|
||||||
|
H5PartReadDataFloat64(file,"y",y);
|
||||||
|
H5PartReadDataFloat64(file,"z",z);
|
||||||
|
H5PartReadDataInt64(file,"id",id);
|
||||||
|
for(i=0;i<np;i++){
|
||||||
|
fprintf(stdout,"\tp[%3u] x=%lf y=%lf z=%lf id=%lld\n",
|
||||||
|
i,x[i],y[i],z[i],(long long) (id[i]));
|
||||||
|
}
|
||||||
|
|
||||||
|
/********************************************/
|
||||||
|
idEnd=np;
|
||||||
|
printf("Old View is %d:%d\n",(int)idStart,(int)idEnd);
|
||||||
|
H5PartSetView(file,idStart,idEnd>>1);
|
||||||
|
printf("Set new view = %d:%d\n",(int)idStart,(int)(idEnd>>1));
|
||||||
|
H5PartGetView(file,&idStart,&idEnd);
|
||||||
|
np=H5PartGetNumParticles(file);
|
||||||
|
printf("steps= %u datasets= %u particles= %d with view %d:%d\n",
|
||||||
|
nt,nds,(int)np,(int)idStart,(int)idEnd);
|
||||||
|
H5PartSetStep(file,nt-1); // set to last step
|
||||||
|
printf("Setting to last step = %u\n",nt-1);
|
||||||
|
for(i=0;i<10;i++){ x[i]=y[i]=z[i]=0.0; id[i]=0; } /* clear the arrays */
|
||||||
|
H5PartReadDataFloat64(file,"x",x);
|
||||||
|
H5PartReadDataFloat64(file,"y",y);
|
||||||
|
H5PartReadDataFloat64(file,"z",z);
|
||||||
|
H5PartReadDataInt64(file,"id",id);
|
||||||
|
|
||||||
|
for(i=0;i<np;i++){
|
||||||
|
fprintf(stdout,
|
||||||
|
"\tp[%3u] x=%lf y=%lf z=%lf id=%lld\n",
|
||||||
|
i,x[i],y[i],z[i],(long long)id[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/********************************************/
|
||||||
|
printf("Now set the view to the latter half of the data in step #%u\n",nt-1);
|
||||||
|
H5PartResetView(file);
|
||||||
|
H5PartGetView(file,&idStart,&idEnd);
|
||||||
|
printf("Reset view = %d:%d\nSetting to %u:%u\n",
|
||||||
|
(int)idStart,(int)idEnd,
|
||||||
|
(int)idEnd>>1,(int)idEnd);
|
||||||
|
H5PartSetView(file,(idEnd>>1),idEnd);
|
||||||
|
np=H5PartGetNumParticles(file);
|
||||||
|
printf("Now particles in selection are %d\n",np);
|
||||||
|
printf("doubleCheck=%lld\n", (long long)H5PartGetView(file,0,0));
|
||||||
|
|
||||||
|
for(i=0;i<10;i++){ x[i]=y[i]=z[i]=0.0; id[i]=0; } /* clear the arrays */
|
||||||
|
|
||||||
|
H5PartReadDataFloat64(file,"x",x);
|
||||||
|
H5PartReadDataFloat64(file,"y",y);
|
||||||
|
H5PartReadDataFloat64(file,"z",z);
|
||||||
|
H5PartReadDataInt64(file,"id",id);
|
||||||
|
for(i=0;i<np;i++){
|
||||||
|
fprintf(stdout,
|
||||||
|
"\tp[%3u] x=%lf y=%lf z=%lf id=%lld\n",
|
||||||
|
i,x[i],y[i],z[i],(long long)id[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// read dataset names
|
||||||
|
h5part_int64_t status = H5PART_SUCCESS;
|
||||||
|
|
||||||
|
H5PartSetStep ( file, 0 );
|
||||||
|
for (h5part_int64_t i=0; i < nds; i++) {
|
||||||
|
const h5part_int64_t lenName = 64;
|
||||||
|
char datasetName[lenName];
|
||||||
|
h5part_int64_t datasetType;
|
||||||
|
h5part_int64_t datasetNElems;
|
||||||
|
|
||||||
|
status = H5PartGetDatasetInfo(file, i, datasetName, lenName,
|
||||||
|
&datasetType, &datasetNElems);
|
||||||
|
|
||||||
|
if (status != H5PART_SUCCESS) {
|
||||||
|
perror("Could not retrieve dataset names!");
|
||||||
|
} else {
|
||||||
|
printf("datasetName: %s, type: %lld, nElements: %lld ",
|
||||||
|
datasetName, datasetType, datasetNElems);
|
||||||
|
if (datasetType == H5PART_INT64) {
|
||||||
|
printf("H5PPART_INT64 \n");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
printf("H5PPART_FLOAT64 \n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(x)
|
||||||
|
free(x);
|
||||||
|
if(y)
|
||||||
|
free(y);
|
||||||
|
if(z)
|
||||||
|
free(z);
|
||||||
|
if(id)
|
||||||
|
free(id);
|
||||||
|
|
||||||
|
H5PartCloseFile(file);
|
||||||
|
fprintf(stderr,"proc[%u]: done\n",myproc);
|
||||||
|
|
||||||
|
#ifdef PARALLEL_IO
|
||||||
|
MPI_Barrier(comm);
|
||||||
|
return MPI_Finalize();
|
||||||
|
#else
|
||||||
|
return 0;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -48,6 +48,13 @@ h5pToGNUplot_SOURCES = h5pToGNUplot.cc
|
|||||||
# Specific building instruction (What compilers to use...)
|
# Specific building instruction (What compilers to use...)
|
||||||
# ------------ Build Tools ------------
|
# ------------ Build Tools ------------
|
||||||
|
|
||||||
|
|
||||||
|
h5ToVtk.o: h5ToVtk.cc
|
||||||
|
$(TOOLS_CXX) $(CFLAGS) $(INC) -g -c h5ToVtk.cc
|
||||||
|
|
||||||
|
h5ToVtk: h5ToVtk.o
|
||||||
|
$(TOOLS_CXX) -o h5ToVtk h5ToVtk.o $(H5PLIB) $(LIBS)
|
||||||
|
|
||||||
h5pAttrib: h5pAttrib.o
|
h5pAttrib: h5pAttrib.o
|
||||||
$(TOOLS_CXX) -o h5pAttrib h5pAttrib.o $(H5PLIB) $(LIBS)
|
$(TOOLS_CXX) -o h5pAttrib h5pAttrib.o $(H5PLIB) $(LIBS)
|
||||||
|
|
||||||
|
|||||||
Executable
+532
@@ -0,0 +1,532 @@
|
|||||||
|
/* h5ToVtk.cc
|
||||||
|
Andreas Adelmann
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <cctype>
|
||||||
|
#include <string.h>
|
||||||
|
#include <hdf5.h>
|
||||||
|
#include "H5Part.h"
|
||||||
|
#include <set>
|
||||||
|
#include <iostream>
|
||||||
|
#include <fstream>
|
||||||
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
|
#include <sstream>
|
||||||
|
#include <iomanip>
|
||||||
|
#include <cassert>
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
#define MAX_LEN 100
|
||||||
|
|
||||||
|
/* Function headers */
|
||||||
|
int get_option(int argc, const char **argv, const char *opts, const struct long_options *l_opts);
|
||||||
|
static void print_help();
|
||||||
|
static void variable_assign(int argc, const char *argv[]);
|
||||||
|
|
||||||
|
/* Global variables */
|
||||||
|
static char* input_name = NULL;
|
||||||
|
static char* output_name = NULL;
|
||||||
|
static bool flg_alive = false;
|
||||||
|
static double z_pos = 0.0;
|
||||||
|
static int print_all = 0;
|
||||||
|
|
||||||
|
/* `get_option' variables */
|
||||||
|
int opt_err = 1; /*get_option prints errors if this is on */
|
||||||
|
int opt_ind = 1; /*token pointer */
|
||||||
|
const char *opt_arg = NULL; /*flag argument (or value) */
|
||||||
|
|
||||||
|
/* indication whether the flag (option) requires an argument or not */
|
||||||
|
enum {
|
||||||
|
no_arg = 0, /* doesn't take an argument */
|
||||||
|
require_arg, /* requires an argument */
|
||||||
|
};
|
||||||
|
|
||||||
|
/* struct for flags (options) */
|
||||||
|
typedef struct long_options
|
||||||
|
{
|
||||||
|
const char *name; /* name of the long option */
|
||||||
|
int has_arg; /* whether we should look for an arg */
|
||||||
|
char shortval; /* the shortname equivalent of long arg
|
||||||
|
* this gets returned from get_option */
|
||||||
|
} long_options;
|
||||||
|
|
||||||
|
/* List of options in single characters */
|
||||||
|
static const char *s_opts = "h1:2:i:o:a:";
|
||||||
|
|
||||||
|
/* List of options in full words */
|
||||||
|
static struct long_options l_opts[] =
|
||||||
|
{
|
||||||
|
{ "help", no_arg, 'h' }, // Print help page
|
||||||
|
{ "input", require_arg, 'i' }, // Takes input file name
|
||||||
|
{ "output", require_arg, 'o' }, // Takes output file name (without this flag, the program will print to stdout)
|
||||||
|
{ "alive ", no_arg , 'a' }, // also generate the alive dark current to display the dark current source
|
||||||
|
{ NULL, 0, '\0' }
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/************************************************************************************
|
||||||
|
*********************************** FUNCTIONS *************************************
|
||||||
|
*************************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
string convert2Int(int number) {
|
||||||
|
stringstream ss;
|
||||||
|
ss << setw(5) << setfill('0') << number;
|
||||||
|
return ss.str();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* get_option is the parsing function that was majorly ported from h5dump utility */
|
||||||
|
int get_option(int argc, const char **argv, const char *opts, const struct long_options *l_opts) {
|
||||||
|
static int sp = 1; /* character index in current token */
|
||||||
|
int opt_opt = '?'; /* option character passed back to user */
|
||||||
|
|
||||||
|
if (sp == 1)
|
||||||
|
{
|
||||||
|
/* check for more flag-like tokens */
|
||||||
|
if (opt_ind >= argc || argv[opt_ind][0] != '-' || argv[opt_ind][1] == '\0')
|
||||||
|
{
|
||||||
|
return EOF;
|
||||||
|
}
|
||||||
|
else if (strcmp(argv[opt_ind], "--") == 0)
|
||||||
|
{
|
||||||
|
opt_ind++;
|
||||||
|
return EOF;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sp == 1 && argv[opt_ind][0] == '-' && argv[opt_ind][1] == '-')
|
||||||
|
{
|
||||||
|
/* long command line option */
|
||||||
|
const char *arg = &argv[opt_ind][2];
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = 0; l_opts && l_opts[i].name; i++)
|
||||||
|
{
|
||||||
|
size_t len = strlen(l_opts[i].name);
|
||||||
|
|
||||||
|
if (strncmp(arg, l_opts[i].name, len) == 0)
|
||||||
|
{
|
||||||
|
/* we've found a matching long command line flag */
|
||||||
|
opt_opt = l_opts[i].shortval;
|
||||||
|
|
||||||
|
if (l_opts[i].has_arg != no_arg)
|
||||||
|
{
|
||||||
|
if (arg[len] == '=')
|
||||||
|
{
|
||||||
|
opt_arg = &arg[len + 1];
|
||||||
|
}
|
||||||
|
else if (opt_ind < (argc - 1) && argv[opt_ind + 1][0] != '-')
|
||||||
|
{
|
||||||
|
opt_arg = argv[++opt_ind];
|
||||||
|
}
|
||||||
|
else if (l_opts[i].has_arg == require_arg)
|
||||||
|
{
|
||||||
|
if (opt_err)
|
||||||
|
fprintf(stderr, "%s: option required for \"--%s\" flag\n", argv[0], arg);
|
||||||
|
|
||||||
|
opt_opt = '?';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (arg[len] == '=')
|
||||||
|
{
|
||||||
|
if (opt_err)
|
||||||
|
fprintf(stderr, "%s: no option required for \"%s\" flag\n", argv[0], arg);
|
||||||
|
|
||||||
|
opt_opt = '?';
|
||||||
|
}
|
||||||
|
|
||||||
|
opt_arg = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (l_opts[i].name == NULL)
|
||||||
|
{
|
||||||
|
/* exhausted all of the l_opts we have and still didn't match */
|
||||||
|
if (opt_err)
|
||||||
|
fprintf(stderr, "%s: unknown option \"%s\"\n", argv[0], arg);
|
||||||
|
|
||||||
|
opt_opt = '?';
|
||||||
|
}
|
||||||
|
|
||||||
|
opt_ind++;
|
||||||
|
sp = 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
register char *cp; /* pointer into current token */
|
||||||
|
|
||||||
|
/* short command line option */
|
||||||
|
opt_opt = argv[opt_ind][sp];
|
||||||
|
|
||||||
|
if (opt_opt == ':' || (cp = strchr(opts, opt_opt)) == 0)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (opt_err)
|
||||||
|
fprintf(stderr, "%s: unknown option \"%c\"\n", argv[0], opt_opt);
|
||||||
|
/* if no chars left in this token, move to next token */
|
||||||
|
if (argv[opt_ind][++sp] == '\0')
|
||||||
|
{
|
||||||
|
opt_ind++;
|
||||||
|
sp = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return '?';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (*++cp == ':')
|
||||||
|
{
|
||||||
|
|
||||||
|
/* if a value is expected, get it */
|
||||||
|
if (argv[opt_ind][sp + 1] != '\0')
|
||||||
|
{
|
||||||
|
/* flag value is rest of current token */
|
||||||
|
opt_arg = &argv[opt_ind++][sp + 1];
|
||||||
|
}
|
||||||
|
else if (++opt_ind >= argc)
|
||||||
|
{
|
||||||
|
if (opt_err)
|
||||||
|
{
|
||||||
|
fprintf(stderr, "%s: value expected for option \"%c\"\n", argv[0], opt_opt);
|
||||||
|
}
|
||||||
|
opt_opt = '?';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* flag value is next token */
|
||||||
|
opt_arg = argv[opt_ind++];
|
||||||
|
}
|
||||||
|
|
||||||
|
sp = 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* set up to look at next char in token, next time */
|
||||||
|
if (argv[opt_ind][++sp] == '\0')
|
||||||
|
{
|
||||||
|
/* no more in current token, so setup next token */
|
||||||
|
opt_ind++;
|
||||||
|
sp = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
opt_arg = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* return the current flag character found */
|
||||||
|
return opt_opt;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Assigns functions according to the parsed result */
|
||||||
|
static void variable_assign(int argc, const char *argv[])
|
||||||
|
{
|
||||||
|
int option;
|
||||||
|
|
||||||
|
/* set options according to the command line */
|
||||||
|
while ((option = get_option(argc, argv, s_opts, l_opts)) != EOF)
|
||||||
|
{
|
||||||
|
switch ((char)option)
|
||||||
|
{
|
||||||
|
case 'h': // Print help page
|
||||||
|
print_help();
|
||||||
|
exit(1);
|
||||||
|
case 'o': // Print number of steps
|
||||||
|
output_name = strdup(opt_arg);
|
||||||
|
break;
|
||||||
|
case 'i': // Print shorter version without the values
|
||||||
|
input_name = strdup(opt_arg);
|
||||||
|
break;
|
||||||
|
case 'a': //
|
||||||
|
{ flg_alive = true;
|
||||||
|
z_pos = atof(strdup(opt_arg));
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
print_help();
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* For printing help page */
|
||||||
|
static void print_help()
|
||||||
|
{
|
||||||
|
fflush(stdout);
|
||||||
|
fprintf(stdout, "\nusage: h5ToVtk -i INPUTFILE -o OUTPUTFILE [OPTIONAL_FLAGS] -a ZVALUE\n");
|
||||||
|
fprintf(stdout, "\n");
|
||||||
|
fprintf(stdout, " FLAGS\n");
|
||||||
|
fprintf(stdout, " -h, --help Print help page\n");
|
||||||
|
fprintf(stdout, " -i file, --input file (REQUIRED) Takes input base file name to \"file\" (extension h5 is assumed \n");
|
||||||
|
fprintf(stdout, " -o file, --output file (REQUIRED) Takes output base file name to \"file\" (extension vtk is added)\n");
|
||||||
|
fprintf(stdout, " -a zvalue Only display particles which have servived and reached z value \n");
|
||||||
|
|
||||||
|
fprintf(stdout, "\n");
|
||||||
|
fprintf(stdout, " Examples:\n");
|
||||||
|
fprintf(stdout, "\n");
|
||||||
|
fprintf(stdout, " /h5ToVtk -i ctf3-injector-darkcurrent-1 -o ctf3-injector-darkcurrent-1- \n");
|
||||||
|
fprintf(stdout, "\n");
|
||||||
|
fprintf(stdout, " /h5ToVtk -i ctf3-injector-darkcurrent-1 -o ctf3-injector-darkcurrent-1- -a 0.19 \n");
|
||||||
|
fprintf(stdout, "\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int main(int argc, const char *argv[])
|
||||||
|
{
|
||||||
|
H5PartFile *h5file = NULL;
|
||||||
|
|
||||||
|
std::ofstream of, ofalive;
|
||||||
|
|
||||||
|
int j;
|
||||||
|
|
||||||
|
int num_dataset;
|
||||||
|
|
||||||
|
int ntime_step = 0;
|
||||||
|
|
||||||
|
variable_assign(argc, argv);
|
||||||
|
|
||||||
|
if(input_name == NULL) {
|
||||||
|
fprintf(stdout, "missing input file name\n");
|
||||||
|
print_help();
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(output_name == NULL) {
|
||||||
|
fprintf(stdout, "missing output file name\n");
|
||||||
|
print_help();
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
string ifn = string(input_name) + string(".h5");
|
||||||
|
|
||||||
|
h5file = H5PartOpenFile(ifn.c_str(), H5PART_READ);
|
||||||
|
|
||||||
|
if( h5file == NULL ) {
|
||||||
|
fprintf(stdout, "unable to open file %s\n", input_name);
|
||||||
|
print_help();
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
ntime_step = H5PartGetNumSteps(h5file);
|
||||||
|
|
||||||
|
if (flg_alive) {
|
||||||
|
|
||||||
|
set<h5part_int64_t> idSet;
|
||||||
|
|
||||||
|
H5PartSetStep(h5file, ntime_step-1);
|
||||||
|
num_dataset = H5PartGetNumDatasets(h5file);
|
||||||
|
h5part_int64_t nparticles = H5PartGetNumParticles(h5file);
|
||||||
|
|
||||||
|
h5part_int64_t* larray = (h5part_int64_t*)malloc(sizeof(h5part_int64_t)*nparticles);
|
||||||
|
H5PartReadDataInt64(h5file, "id", larray);
|
||||||
|
|
||||||
|
h5part_float64_t* z = (h5part_float64_t*)malloc(sizeof(h5part_float64_t)*nparticles);
|
||||||
|
H5PartReadDataFloat64(h5file, "z", z);
|
||||||
|
|
||||||
|
for(unsigned long int n = 0; n < nparticles; ++n) {
|
||||||
|
if (z[n] >= z_pos)
|
||||||
|
idSet.insert(larray[n]);
|
||||||
|
}
|
||||||
|
|
||||||
|
cout << "Last timestep contains " << nparticles << " particles" << endl;
|
||||||
|
|
||||||
|
for (size_t j = 0; j<ntime_step ; j ++) {
|
||||||
|
|
||||||
|
H5PartSetStep(h5file,j);
|
||||||
|
|
||||||
|
num_dataset = H5PartGetNumDatasets(h5file);
|
||||||
|
|
||||||
|
h5part_int64_t nparticles = H5PartGetNumParticles(h5file);
|
||||||
|
h5part_int64_t* larray = (h5part_int64_t*)malloc(sizeof(h5part_int64_t)*nparticles);
|
||||||
|
H5PartReadDataInt64(h5file, "id", larray);
|
||||||
|
|
||||||
|
h5part_float64_t* x = (h5part_float64_t*)malloc(sizeof(h5part_float64_t)*nparticles);
|
||||||
|
H5PartReadDataFloat64(h5file, "x", x);
|
||||||
|
vector<h5part_float64_t> x_alive;
|
||||||
|
|
||||||
|
h5part_float64_t* y = (h5part_float64_t*)malloc(sizeof(h5part_float64_t)*nparticles);
|
||||||
|
H5PartReadDataFloat64(h5file, "y", y);
|
||||||
|
vector<h5part_float64_t> y_alive;
|
||||||
|
|
||||||
|
h5part_float64_t* z = (h5part_float64_t*)malloc(sizeof(h5part_float64_t)*nparticles);
|
||||||
|
H5PartReadDataFloat64(h5file, "z", z);
|
||||||
|
vector<h5part_float64_t> z_alive;
|
||||||
|
|
||||||
|
h5part_int64_t* ptype = (h5part_int64_t*)malloc(sizeof(h5part_int64_t)*nparticles);
|
||||||
|
H5PartReadDataInt64(h5file, "ptype", ptype);
|
||||||
|
vector<h5part_int64_t> ptype_alive;
|
||||||
|
|
||||||
|
for (size_t i = 0; i < nparticles ; i ++) {
|
||||||
|
if ( idSet.find(larray[i]) != idSet.end() ) {
|
||||||
|
x_alive.push_back(x[i]);
|
||||||
|
y_alive.push_back(y[i]);
|
||||||
|
z_alive.push_back(z[i]);
|
||||||
|
ptype_alive.push_back(ptype[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
string ffnlive = string("vtk/") + string(output_name) + string("-alive-") + convert2Int(j) + string(".vtk");
|
||||||
|
ofalive.open(ffnlive.c_str());
|
||||||
|
assert(ofalive.is_open());
|
||||||
|
ofalive.precision(6);
|
||||||
|
|
||||||
|
size_t alive_num = x_alive.size();
|
||||||
|
|
||||||
|
ofalive << setprecision(5)
|
||||||
|
<< "# vtk DataFile Version 2.0" << endl
|
||||||
|
<< "unstructured grid and vector field on the nodes" << endl
|
||||||
|
<< "ASCII" << endl
|
||||||
|
<< "DATASET UNSTRUCTURED_GRID" << endl
|
||||||
|
<< "POINTS " << alive_num << " float" << endl;
|
||||||
|
|
||||||
|
// Particle positions
|
||||||
|
|
||||||
|
|
||||||
|
for(size_t i = 0; i < alive_num; i++)
|
||||||
|
ofalive << x_alive[i] << " " << y_alive[i] << " " << z_alive[i] << endl;
|
||||||
|
|
||||||
|
ofalive << endl; // defining VTK_poly_vertex
|
||||||
|
|
||||||
|
ofalive << "CELLS " << alive_num << " " << 2 * alive_num << endl;
|
||||||
|
|
||||||
|
for(size_t i = 0; i < alive_num; i++)
|
||||||
|
ofalive << "1 " << i << endl;
|
||||||
|
ofalive << endl;
|
||||||
|
|
||||||
|
// defining Cell_types
|
||||||
|
ofalive << "CELL_TYPES " << alive_num << endl;
|
||||||
|
for(size_t i = 0; i < alive_num; i++)
|
||||||
|
ofalive << "2" << endl;
|
||||||
|
|
||||||
|
// defining Cell_types
|
||||||
|
ofalive << "POINT_DATA " << alive_num << endl;
|
||||||
|
ofalive << "SCALARS " << "Pointtype" << " float " << "1" << endl;
|
||||||
|
ofalive << "LOOKUP_TABLE " << "mytable" << endl ;
|
||||||
|
for(size_t i = 0; i < alive_num ; i ++) {
|
||||||
|
if (ptype_alive[i] == 0) {
|
||||||
|
ofalive << 0.0 << endl;
|
||||||
|
}
|
||||||
|
else if (ptype_alive[i] == 1) {
|
||||||
|
ofalive << 0.5 << endl;
|
||||||
|
}
|
||||||
|
else if (ptype_alive[i] == 2) {
|
||||||
|
ofalive << 1.0 << endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ofalive << "LOOKUP_TABLE " << "mytable " << 3 << endl ;
|
||||||
|
ofalive << 1.0 <<" "<< 0.0 <<" "<< 0.0 <<" "<< 1.0 << endl;
|
||||||
|
ofalive << 0.0 <<" "<< 1.0 <<" "<< 0.0 <<" "<< 1.0 << endl;
|
||||||
|
ofalive << 0.0 <<" "<< 0.0 <<" "<< 1.0 <<" "<< 1.0 << endl;
|
||||||
|
ofalive << endl;
|
||||||
|
ofalive.close();
|
||||||
|
|
||||||
|
free(x);
|
||||||
|
free(y);
|
||||||
|
free(z);
|
||||||
|
free(ptype);
|
||||||
|
|
||||||
|
x_alive.clear();
|
||||||
|
y_alive.clear();
|
||||||
|
z_alive.clear();
|
||||||
|
ptype_alive.clear();
|
||||||
|
|
||||||
|
cout <<"Done time step "<< j << endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
else {
|
||||||
|
|
||||||
|
for (size_t j=0; j<ntime_step; j++) {
|
||||||
|
|
||||||
|
H5PartSetStep(h5file,j);
|
||||||
|
|
||||||
|
num_dataset = H5PartGetNumDatasets(h5file);
|
||||||
|
h5part_int64_t nparticles = H5PartGetNumParticles(h5file);
|
||||||
|
|
||||||
|
cout << "Working on timestep " << j << " expecting " << nparticles << " particles " << endl;
|
||||||
|
|
||||||
|
h5part_float64_t* x = (h5part_float64_t*)malloc(sizeof(h5part_float64_t)*nparticles);
|
||||||
|
H5PartReadDataFloat64(h5file, "x", x);
|
||||||
|
|
||||||
|
h5part_float64_t* y = (h5part_float64_t*)malloc(sizeof(h5part_float64_t)*nparticles);
|
||||||
|
H5PartReadDataFloat64(h5file, "y", y);
|
||||||
|
|
||||||
|
h5part_float64_t* z = (h5part_float64_t*)malloc(sizeof(h5part_float64_t)*nparticles);
|
||||||
|
H5PartReadDataFloat64(h5file, "z", z);
|
||||||
|
|
||||||
|
h5part_int64_t* ptype = (h5part_int64_t*)malloc(sizeof(h5part_int64_t)*nparticles);
|
||||||
|
H5PartReadDataInt64(h5file, "ptype", ptype);
|
||||||
|
|
||||||
|
string ffn = string("vtk/") + string(output_name) + convert2Int(j) + string(".vtk");
|
||||||
|
|
||||||
|
of.open(ffn.c_str());
|
||||||
|
assert(of.is_open());
|
||||||
|
of.precision(6);
|
||||||
|
|
||||||
|
of << setprecision(5)
|
||||||
|
<< "# vtk DataFile Version 2.0" << endl
|
||||||
|
<< "unstructured grid and vector field on the nodes" << endl
|
||||||
|
<< "ASCII" << endl
|
||||||
|
<< "DATASET UNSTRUCTURED_GRID" << endl
|
||||||
|
<< "POINTS " << nparticles << " float" << endl;
|
||||||
|
|
||||||
|
// Particle positions
|
||||||
|
for(size_t i = 0; i < nparticles; i++)
|
||||||
|
of << x[i] << " " << y[i] << " " << z[i] << endl;
|
||||||
|
|
||||||
|
of << endl; // defining VTK_poly_vertex
|
||||||
|
|
||||||
|
of << "CELLS " << nparticles << " " << 2 * nparticles << endl;
|
||||||
|
|
||||||
|
for(size_t i = 0; i < nparticles; i++)
|
||||||
|
of << "1 " << i << endl;
|
||||||
|
of << endl;
|
||||||
|
|
||||||
|
// defining Cell_types
|
||||||
|
of << "CELL_TYPES " << nparticles << endl;
|
||||||
|
for(size_t i = 0; i < nparticles; i++)
|
||||||
|
of << "2" << endl;
|
||||||
|
|
||||||
|
// defining Cell_types
|
||||||
|
of << "POINT_DATA " << nparticles << endl;
|
||||||
|
of << "SCALARS " << "Pointtype" << " float " << "1" << endl;
|
||||||
|
of << "LOOKUP_TABLE " << "mytable" << endl ;
|
||||||
|
for(size_t i = 0; i < nparticles ; i ++) {
|
||||||
|
if (ptype[i] == 0) {
|
||||||
|
of << 0.0 << endl;
|
||||||
|
}
|
||||||
|
else if (ptype[i] == 1) {
|
||||||
|
of << 0.5 << endl;
|
||||||
|
}
|
||||||
|
else if (ptype[i] == 2) {
|
||||||
|
of << 1.0 << endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
of << "LOOKUP_TABLE " << "mytable " << 3 << endl ;
|
||||||
|
of << 1.0 <<" "<< 0.0 <<" "<< 0.0 <<" "<< 1.0 << endl;
|
||||||
|
of << 0.0 <<" "<< 1.0 <<" "<< 0.0 <<" "<< 1.0 << endl;
|
||||||
|
of << 0.0 <<" "<< 0.0 <<" "<< 1.0 <<" "<< 1.0 << endl;
|
||||||
|
of << endl;
|
||||||
|
of.close();
|
||||||
|
free(x);
|
||||||
|
free(y);
|
||||||
|
free(z);
|
||||||
|
free(ptype);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
H5PartCloseFile(h5file);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user