Compare commits

..

27 Commits

Author SHA1 Message Date
gsell 172ceff05a doc/Downloading.html
- update H5Part download instructions
2007-04-19 15:17:57 +00:00
gsell 030985c9a4 test 2007-04-19 10:39:00 +00:00
gsell 359b699464 test 2007-04-19 10:31:09 +00:00
gsell 6e1ce25417 - testfile removed 2007-04-19 10:25:20 +00:00
gsell 4144c2b696 src/H5Part.c
* H5PartOpenFileParallel()
		- MPI hints removed, they are useless
		- delegate real work to new function "_H5Part_open_file()"
	* H5PartOpenFile()
		- delegate real work to new function "_H5Part_open_file()"
	* _H5Part_open_file()
		- new function perfoming the real work
		- set step name and number format in file structure
	* H5PartDefineStepName()
		- new function to define step name and format of step number
	* _H5Part_set_step()
	* H5PartGetNumDatasets()
	* H5PartGetDatasetName()
	* H5PartGetDatasetInfo()
	* _H5Part_get_num_particles()
		- use step name und step number format defined in file struct
2007-04-19 10:15:34 +00:00
gsell bad33a75d2 src/H5Part.h
- function declaration "H5PartDefineStepName()" added
2007-04-19 09:26:54 +00:00
gsell 7240f26378 - typdef for MPI_Comm add in non-parallel case
- "struct H5PartFile" extended:
	* new member for step name
	* new member to specify the format of the step number
	* new member to flag whether the file is still empty
2007-04-19 09:17:34 +00:00
gsell b9d82c2fda - build of "homdynToH5p" removed 2007-04-19 09:06:27 +00:00
gsell 1bdd5268ed - "homdynToH5p" from tools build list removed 2007-04-19 09:00:23 +00:00
adelmann 92e057e4cf Add MPI IO hints according to the Benchmark.c program by R. Geus given to me by Valerie 2007-02-13 04:30:55 +00:00
gsell aa72af797b testtest 2007-02-12 21:26:45 +00:00
gsell 9974b6b44c srv/H5Part.c
_H5Part_get_attrib_info():
		- code optimization
2007-01-25 13:09:42 +00:00
Christina Siegerist 82c594c17d Made the new api changes again. They were probably lost in overlapping
commits.
2006-12-07 18:48:41 +00:00
gsell c96b859f88 configure.ac
- forgot to check MPIPATH
2006-12-07 16:48:40 +00:00
gsell d580292235 configure.ac
- check in this order: MPIROOT, MPIHOME, --with-mpipath, other paths
- same for HDF5ROOT
2006-12-07 16:46:51 +00:00
gsell 4dd379ff2f src/H5Part.c
_H5Part_iteration_operator():
		- call H5Gget_objinfo() only if type != H5G_UNKNOWN
	H5PartGetNumSteps():
		- count all objects beginning with H5PART_GROUPNAME_STEP
		  not only groups
2006-12-06 10:50:26 +00:00
gsell e13c4e8d8d configure.ac
- more cosmetic changes (--enable-xxx and --with-xxx definitiona
  are now at the very top, so you see all available options all together)
2006-12-02 22:35:19 +00:00
gsell 4d0ffd58df configure.ac
- configure aborts, if HDF5 cannot be found
- ADDFLAFS merged into FFLAGS
- several cosmetic changes
2006-12-02 17:55:41 +00:00
gsell b105b19d4d src/H5Part.c
- _set_view(): "end" is now inclusive
2006-12-02 17:53:32 +00:00
gsell f0d51def4e test/Makefile.am
- ADDFLAGS removed: content of ADDFLAGS is now in FFLAGS
2006-12-02 17:51:46 +00:00
gsell 5325a7a24f Test 2006-12-01 13:02:39 +00:00
gsell 9c6d4e48a3 Test 2006-12-01 13:01:13 +00:00
gsell 150f623c03 Test 2006-12-01 12:56:37 +00:00
gsell 14536c6d84 Test 2006-12-01 12:56:26 +00:00
gsell 94779f185f Test 2006-12-01 09:46:39 +00:00
gsell 07ff9e52ef test bla 2006-12-01 09:43:03 +00:00
adelmann 4de6c55220 Add unit attributes and fix units 2006-11-28 09:22:27 +00:00
10 changed files with 504 additions and 400 deletions
+151 -165
View File
@@ -1,6 +1,6 @@
# Every configure script must call AC_INIT before doing anything else.
# AC_INIT (package, version, [bug-report], [tarname])
AC_INIT([H5Part], [1.3.1], [vis@hpcrdm.lbl.gov])
AC_INIT([H5Part], [1.3.2], [vis@hpcrdm.lbl.gov], H5Part)
# Ensure that a recent enough version of Autoconf is being used.
@@ -14,6 +14,45 @@ AC_INIT([H5Part], [1.3.1], [vis@hpcrdm.lbl.gov])
# The AC_CONFIG_HEADERS macro selects this kind of output.
AC_CONFIG_HEADER(config.h)
###############################################################################
################# --enable-xxx and --with-xxx Argument ########################
###############################################################################
AC_ARG_ENABLE(
[64],
[AC_HELP_STRING([--enable-64],
[Compile using 64-bit flags [default=no]])],
[USE_64=$enableval])
AC_ARG_ENABLE(
[fortran],
[AC_HELP_STRING([--enable-fortran],
[Compile the Fortran interface [default=no]])],
[USE_FORTRAN=$enableval])
AC_ARG_ENABLE(
[parallel],
[AC_HELP_STRING([--enable-parallel],
[Compile the MPI/IO interface [default=no]])],
[USE_PARALLEL=$enableval])
AC_ARG_ENABLE(
[tools],
[AC_HELP_STRING([--enable-tools],
[Compile h5part tools [default=no]])],
[USE_TOOLS=$enableval])
AC_ARG_WITH(
[mpipath],
[AC_HELP_STRING([--with-mpipath],
[path to MPI installation [default=""]])],
[MPIPATH=$withval], [MPIPATH=""])
AC_ARG_WITH(
[hdf5path],
[AC_HELP_STRING([--with-hdf5path],
[path to HDF5 installation [default=""]])],
[HDF5PATH=$withval], [HDF5PATH=""])
###############################################################################
################# A SIMPLE WORK AROUND TO USE ENV. VARS #######################
@@ -56,18 +95,18 @@ PATH_Search()
fi
for h5part_place in $2
do
echo -n "Looking in $h5part_place ... $ac_c" #1>&6
echo -n "looking in $h5part_place ... $ac_c" #1>&6
if test -r "$h5part_basedir$h5part_place/$3" ; then
echo "$ac_t"" Found" #1>&6
echo "$ac_t"" found" #1>&6
eval $1="$h5part_place"
break
fi
if test -d "$h5part_basedir$h5part_place/$3" ; then
echo "$ac_t"" Found" #1>&6
echo "$ac_t"" found" #1>&6
eval $1="$h5part_place"
break
fi
echo "$ac_t"" No" #1>&6
echo "$ac_t"" no" #1>&6
done
return
@@ -176,85 +215,63 @@ AC_DEFINE_UNQUOTED(MY_UNAME, "$uname", "")
###################### 64-bit compilation enabled #############################
AC_MSG_CHECKING([if 64-bit compilation is enabled])
AC_ARG_ENABLE([64],
[AC_HELP_STRING([--enable-64],
[Compile using 64-bit flags [default=no]])],
[USE_64=$enableval])
# If --enable-64 is set in the configure line
if test "X$USE_64" = "Xyes"; then
echo "YES, 64-BIT ENABLED"
if test $uname = "AIX"; then
CFLAGS="$CFLAGS -q64"
FFLAGS="$FFLAGS -q64"
fi
AC_MSG_RESULT([yes])
if test $uname = "AIX"; then
CFLAGS="$CFLAGS -q64"
FFLAGS="$FFLAGS -q64"
fi
if test $uname = "IRIX64"; then
CFLAGS="$CFLAGS -64"
FFLAGS="$FFLAGS -64 -fPIC -fno-second-underscore"
fi
if test $uname = "IRIX64"; then
CFLAGS="$CFLAGS -64"
FFLAGS="$FFLAGS -64 -fPIC -fno-second-underscore"
fi
else
echo "NO, 64-BIT NOT ENABLED"
AC_MSG_RESULT([no])
fi
############################ fortran enabled ##################################
AC_MSG_CHECKING([if fortran interface enabled])
AC_MSG_RESULT([])
AC_ARG_ENABLE([fortran],
[AC_HELP_STRING([--enable-fortran],
[Compile the Fortran interface [default=no]])],
[USE_FORTRAN=$enableval])
if test "X$USE_FORTRAN" = "Xyes"; then
echo "YES, FORTRAN ENABLED"
AC_MSG_RESULT([yes])
# Start looking for ifort first
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
AC_MSG_ERROR([Cannot find a fortran compiler!!!])
exit 1
fi
if test -n "$FC" ; then
if test "X$FC" = "Xg95"; then
FFLAGS="${FFLAGS} -fno-second-underscore"
fi
AC_MSG_CHECKING([Test Number of FC Underscores])
AC_MSG_RESULT([OK])
`cd src && rm -f TestUnderscore.o TestUnderscoreC.o TestUnderscore`
`cd src && ${FC} ${FFLAGS} -c TestUnderscore.f`
`cd src && ${CC} ${CFLAGS} -c TestUnderscoreC.c`
`cd src && ${FC} ${FFLAGS} -o TestUnderscore TestUnderscore.o TestUnderscoreC.o -lc`
if test ! $uname = "AIX"; then
FFLAGS="${FFLAGS} -fPIC -fno-second-underscore"
fi
if test -f src/TestUnderscore ; then
UNDERSCORE_H=Underscore.h
`cd src && cat COPYRIGHT > Underscore.h`
`cd src && ./TestUnderscore >> Underscore.h`
echo "==== Underscore.h contains ============="
cat src/Underscore.h
echo "========================================"
else
AC_MSG_ERROR(could not build fortran executable)
USE_FORTRAN = "no"
fi
else
AC_MSG_ERROR(could not find a fortran compiler)
USE_FORTRAN = "no"
exit 1
fi
AC_MSG_CHECKING([symbol convention in object files])
`cd src && rm -f TestUnderscore.o TestUnderscoreC.o TestUnderscore`
`cd src && ${FC} ${FFLAGS} -c TestUnderscore.f`
`cd src && ${CC} ${CFLAGS} -c TestUnderscoreC.c`
`cd src && ${FC} ${FFLAGS} -o TestUnderscore TestUnderscore.o TestUnderscoreC.o -lc`
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
echo "NO, FORTRAN NOT ENABLED"
AC_MSG_RESULT([no])
fi
######################## parallel interface enabled ###########################
AC_MSG_CHECKING([if parallel interface enabled])
AC_ARG_ENABLE([parallel],
[AC_HELP_STRING([--enable-parallel],
[Compile the MPI/IO interface [default=no]])],
[USE_PARALLEL=$enableval])
if test "X$USE_PARALLEL" = "Xyes"; then
AC_MSG_RESULT([YES, PARALLEL ENABLED])
AC_MSG_RESULT([yes])
CFLAGS="${CFLAGS} -DPARALLEL_IO -DH5_HAVE_PARALLEL -DMPICH_IGNORE_CXX_SEEK"
@@ -269,13 +286,15 @@ if test "X$USE_PARALLEL" = "Xyes"; then
AC_PATH_PROGS([MPICC], [mpicc mpcc_r], [], [$PATH])
AC_PATH_PROGS([MPICXX], [mpicxx mpcc_r], [], [$PATH])
if test -z "$MPICC" -o -z "$MPICXX"; then
AC_ARG_WITH([mpipath],
[AC_HELP_STRING([--with-mpipath],
[path to MPI installation [default=""]])],
[MPIROOT=$withval], [MPIROOT=""])
if test -z "$MPIROOT"; then
AC_MSG_CHECKING([for MPI root ])
echo
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"
@@ -284,10 +303,10 @@ if test "X$USE_PARALLEL" = "Xyes"; then
P="$P /usr/local/mpich2"
P="$P /usr/local/mpich"
P="$P /opt/xt-mpt/default/mpich2-64/P2"
PATH_Search MPIROOT "$P" include/mpi.h
fi
PATH_Search MPIROOT "$P" include/mpi.h
if test ! -n "$MPIROOT"; then
AC_MSG_RESULT([Cannot determine MPIROOT])
AC_MSG_ERROR([Cannot determine MPI root!!!])
exit 1
fi
@@ -335,8 +354,6 @@ if test "X$USE_PARALLEL" = "Xyes"; then
# parallel + fortran
if test "X$USE_FORTRAN" = "Xyes"; then
echo "PARALLEL ENABLED WITH FORTRAN"
AC_PATH_PROGS([MPIFC], [mpxlf_r mpif90], [], [$PATH])
if test -z "${MPIFC}" ; then
@@ -359,97 +376,78 @@ if test "X$USE_PARALLEL" = "Xyes"; then
MTARGET="${MTARGET} libpH5PartF.a"
TTARGET="${TTARGET} H5testFpar"
TTARGET="${TTARGET} H5BlockParTestScalarFieldF"
else
echo "PARALLEL ENABLED WITHOUT FORTRAN"
fi
else
echo "NO, PARALLEL NOT ENABLED"
else # --enable-parallel=no
AC_MSG_RESULT([no])
MTARGET="libH5Part.a"
TTARGET="H5PartTest H5test"
TTARGET="${TTARGET} H5BlockTestAttributes"
if test "X$USE_FORTRAN" = "Xyes"; then
echo "PARALLEL NOT ENABLED WITH FORTRAN ENABLED"
MTARGET="${MTARGET} libH5PartF.a"
TTARGET="${TTARGET} H5testF"
TTARGET="${TTARGET} H5BlockTestAttributesF"
else
echo "BOTH PARALLEL & FORTRAN NOT ENABLED"
fi
fi
AC_MSG_CHECKING([for h5pTools file: ])
AC_MSG_RESULT([OK])
AC_ARG_ENABLE([tools],
[AC_HELP_STRING([--enable-tools], [Compile h5part tools [default=no]])],
[USE_TOOLS=$enableval])
AC_MSG_CHECKING([wheter tools are enabled])
if test "X$USE_TOOLS" = "Xyes"; then
BUILD_TOOLS="h5pAttrib h5pToGNUplot homdynToH5p"
AC_MSG_RESULT([yes])
BUILD_TOOLS="h5pAttrib h5pToGNUplot # homdynToH5p"
else
AC_MSG_RESULT([no])
fi
###############################################################################
######################### PATH CHECKING & SETTING #############################
###############################################################################
AC_ARG_WITH([hdf5path],
[AC_HELP_STRING([--with-hdf5path],
[path to HDF5 installation [default=""]])],
[XROOT=$withval], [XROOT=""])
AC_MSG_CHECKING([for HDF5 root ])
AC_MSG_RESULT([])
if test -n "${HDF5ROOT}"; then
P=${HDF5ROOT}
elif test -n "${HDF5HOME}" ; then
P=${HDF5HOME}
elif test -n "${HDF5PATH}" ; then
P=${HDF5PATH}
else
P=''
P="$P /usr"
P="$P /usr/local"
P="$P /usr/local/hdf5"
P="$P /usr/local/packages/hdf5"
P="$P /apps/hdf5"
HDF5ROOT=$XROOT
if test "X$USE_PARALLEL" = "Xyes"; then
if test -z "$HDF5ROOT"; then
AC_MSG_CHECKING([for Parallel HDF5 root ])
AC_MSG_RESULT([])
P=''
P="$P /usr"
P="$P /usr/local"
if test "X$USE_PARALLEL" = "Xyes"; then
P="$P /usr/local/phdf5"
P="$P /usr/local/hdf5"
P="$P /usr/local/packages/hdf5"
P="$P /usr/local/hdf5/hdf5_par"
P="$P /apps/hdf5"
if test "X$USE_64" = "Xyes"; then
P="$P /usr/common/usg/hdf5/64/default/parallel"
else
P="$P /usr/common/usg/hdf5/32/default/parallel"
fi
PATH_Search HDF5ROOT "$P" include/hdf5.h
XROOT=$HDF5ROOT
fi
else
if test -z "$HDF5ROOT"; then
AC_MSG_CHECKING([for HDF5 library location ])
AC_MSG_RESULT([])
P=''
P="$P /usr"
P="$P /usr/local"
P="$P /usr/local/hdf5"
P="$P /usr/local/packages/hdf5"
else
P="$P /usr/local/hdf5/hdf5_serial"
P="$P /apps/hdf5"
if test "X$USE_64" = "Xyes"; then
P="$P /usr/common/usg/hdf5/64/default/serial"
else
P="$P /usr/common/usg/hdf5/32/default/serial"
fi
PATH_Search HDF5ROOT "$P" include/hdf5.h
XROOT=$HDF5ROOT
fi
fi
PATH_Search HDF5ROOT "$P" include/hdf5.h
if test -z "$HDF5ROOT"; then
AC_MSG_ERROR([Cannot determine HDF5 root!!!])
exit 1
fi
AC_MSG_CHECKING([if we need to link to libsz ])
if test -n "$XROOT"; then
if test -f $XROOT/lib/libsz.a; then
if test -n "$HDF5ROOT"; then
if test -f $HDF5ROOT/lib/libsz.a; then
AC_MSG_RESULT([yes])
SZLIB="-L$XROOT/lib/ -lsz"
SZLIB="-L$HDF5ROOT/lib/ -lsz"
else
AC_MSG_RESULT([no])
SZLIB=""
@@ -468,14 +466,6 @@ fi
#################### MISC SETTINGS - path, flags, etc #########################
###############################################################################
# if not AIX
if test ! $uname = "AIX"; then
# Additional flags
echo "SETTING ADDITIONAL FLAGS"
ADDFLAGS="-fPIC -fno-second-underscore"
fi
H5P_LIB_LOC=`pwd`/src
###############################################################################
@@ -545,36 +535,6 @@ TOOLS_H5PART_LIB="-lH5Part"
TOOLS_HDFLIB="-L$HDF5ROOT/lib -lhdf5"
fi
###############################################################################
########################## PRINTING SUMMARY ###################################
###############################################################################
echo "+++++++++++++++++++++++++++++++"
echo "+++++++++ SUMMARY for `(hostname || uname -n) 2>/dev/null | sed 1q` +++++++++"
echo "CC = $CC"
echo "CXX = $CXX"
echo "FC = $FC"
echo "MPICC = $MPICC"
echo "MPICXX = $MPICXX"
echo "MPIFC = $MPIFC"
echo "CFLAGS = $CFLAGS"
echo "FFLAGS = $FFLAGS"
echo "MPILIB = $MPILIB"
echo "MPIINC = $MPIINC"
echo "MPIROOT = $MPIROOT"
echo "HDF5ROOT = $HDF5ROOT"
echo "LDFLAGS = $LDFLAGS"
echo "host_os = $host_os"
echo "host_cpu = $host_cpu"
echo "host_vendor = $host_vendor"
echo "Will Be Building Libraries ... : $MTARGET"
echo "Will Be Building Test Programs ... : $TTARGET"
echo "TOOLS_CXX = $TOOLS_CXX"
echo "TOOLS_H5PART_LIB = $TOOLS_H5PART_LIB"
echo "TOOLS_HDFLIB = $TOOLS_HDFLIB"
echo "BUILD_TOOLS = $BUILD_TOOLS"
echo "+++++++++++++++++++++++++++++++"
###############################################################################
############## EXPORTING VARIABLES & CREATING OUTPUT FILES ####################
###############################################################################
@@ -597,7 +557,6 @@ AC_SUBST(TTARGET)
AC_SUBST(SZLIB)
AC_SUBST(CFLAGS)
AC_SUBST(FFLAGS)
AC_SUBST(ADDFLAGS)
AC_SUBST(STDCXX)
AC_SUBST(H5P_LIB_LOC)
AC_SUBST(UNDERSCORE_H)
@@ -617,5 +576,32 @@ test/Makefile
tools/Makefile
])
AC_OUTPUT
###############################################################################
########################## PRINTING SUMMARY ###################################
###############################################################################
echo
echo
echo "Summary for `(hostname || uname -n) 2>/dev/null | sed 1q`:"
echo
echo "Host OS: $host_os"
echo "Host CPU: $host_cpu"
echo "Host vendor: $host_vendor"
echo "Build libraries: $MTARGET"
echo "Build test programs: $TTARGET"
echo "Build tools: $BUILD_TOOLS"
echo "CC = $CC"
echo "CXX = $CXX"
echo "FC = $FC"
echo "MPICC = $MPICC"
echo "MPICXX = $MPICXX"
echo "MPIFC = $MPIFC"
echo "CFLAGS = $CFLAGS"
echo "FFLAGS = $FFLAGS"
echo "MPILIB = $MPILIB"
echo "MPIINC = $MPIINC"
echo "MPIROOT = $MPIROOT"
echo "HDF5ROOT = $HDF5ROOT"
echo "LDFLAGS = $LDFLAGS"
echo
+43 -8
View File
@@ -6,8 +6,6 @@
<meta name="keywords" content="scientific visualization">
<meta name="sitemap" content="put a brief descriptive phrase here that will show up in the site map:foo">
<!--#include virtual="/include/topIncludes.html"-->
<div id="maincenter">
<head>
<title>Downloading HDF5 and H5Part</title>
@@ -39,12 +37,49 @@
ls
get zlib-1.2.1.tar.gz (get the current version, this as the one on April 20th, 2006)
</pre>
Note: you might already have libz in your system and you will not need libsz unless you build hdf5 with support for it.
<a name="hpart">
<h2>Downloading H5Part</h2></a>
Please contact <address><a href="mailto:andreas.adelmann@psi.ch">Andreas Adelmann</a></address>.
<P>
Note: you might already have libz in your system and you will not need libsz unless you build hdf5 with support for it.
</P>
<h4>Building Parallel HDF5</h4>
<P>
When you build HDF5, you will need to build an version with parallel I/O
enabled. Here is a set of configure options that worked for us on a
Linux workstation running SuSE 10.1 with MPICH installed in /usr/local/mpich.
</p>
<pre>
./configure --prefix=/usr/local/hdf5-mpich --enable-parallel CC=mpicc CXX=mpicxx --disable-shared --enable-static --enable-stream-vfd
</pre>
<UL>
<li> --prefix=/usr/local/hdf5-mpich : the location where the HDF5 libs and
binaries will be installed.</LI>
<li> --enable-parallel : contrary to the HDF5 documentation, which says that
"--enable-parallel" is optional for building the parallel version of
HDF5, you <b>must</b> have --enable-parallel to get the parallel-enabled
build. See <a href="ftp://ftp.hdfgroup.org/HDF5/current/src/unpacked/release_docs/INSTALL_parallel">these notes from HDF5</a> where they claim that
--enable-parallel is optional.</LI>
<li> CC=mpicc CXX=mpicxx : contrary to the output from configure --help, the
configure script seems to ignore the CC and CXX environment variables.
We tried setting these environment variables to mpicc and mpicxx,
respectively, and then ran configure with --enable-parallel. The configure
script would faile with this error message:
<pre>
checking whether a simple MPI-IO program can be linked... no
configure: error: unable to link a simple MPI-IO application
</pre>
</LI>
<LI> --disable-shared and --enable-static: the HDF5 build failed for us
w/o these options when attempting to read symbols from libmpich.a. The
result of these options is that your parallel-enabled HDF5 libaries
will be static rather than dynamic.
</UL>
<h2 id="h5part">Downloading H5Part</h2>
H5Part is available for download from Berkeley Labs Codeforge system <a href="https://codeforge.lbl.gov/projects/h5part/">https://codeforge.lbl.gov/projects/h5part</a>.
</div>
<!--#include virtual="/include/dateFooter.html"-->
+165 -179
View File
@@ -93,36 +93,13 @@ _h5_error_handler (
/*========== File Opening/Closing ===============*/
/*!
\ingroup h5part_openclose
Opens file with specified filename.
If you open with flag \c H5PART_WRITE, it will truncate any
file with the specified filename and start writing to it. If
you open with \c H5PART_APPEND, then you can append new timesteps.
If you open with \c H5PART_READ, then it will open the file
readonly.
The typical extension for these files is \c .h5.
H5PartFile should be treated as an essentially opaque
datastructure. It acts as the file handle, but internally
it maintains several key state variables associated with
the file.
\return File handle or \c NULL
*/
H5PartFile*
H5PartOpenFileParallel (
static H5PartFile*
_H5Part_open_file (
const char *filename, /*!< [in] The name of the data file to open. */
unsigned flags /*!< [in] The access mode for the file. */
#ifdef PARALLEL_IO
,MPI_Comm comm /*!< [in] MPI communicator */
#endif
) {
SET_FNAME ( "H5PartOpenFileParallel" );
unsigned flags, /*!< [in] The access mode for the file. */
MPI_Comm comm, /*!< [in] MPI communicator */
int f_parallel /*!< [in] 0 for serial io otherwise parallel */
) {
if ( _init() < 0 ) {
HANDLE_H5PART_INIT_ERR;
return NULL;
@@ -136,57 +113,71 @@ H5PartOpenFileParallel (
goto error_cleanup;
}
memset (f, 0, sizeof (H5PartFile));
f->xfer_prop = f->create_prop = f->access_prop = H5P_DEFAULT;
#ifdef PARALLEL_IO
/* for the SP2... perhaps different for linux */
MPI_Info info = MPI_INFO_NULL;
if (MPI_Comm_size (comm, &f->nprocs) != MPI_SUCCESS) {
HANDLE_MPI_COMM_SIZE_ERR;
goto error_cleanup;
}
if (MPI_Comm_rank (comm, &f->myproc) != MPI_SUCCESS) {
HANDLE_MPI_COMM_RANK_ERR;
goto error_cleanup;
}
f->pnparticles = malloc (f->nprocs * sizeof (h5part_int64_t));
if (f->pnparticles == NULL) {
f->groupname_step = strdup ( H5PART_GROUPNAME_STEP );
if( f->groupname_step == NULL ) {
HANDLE_H5PART_NOMEM_ERR;
goto error_cleanup;
}
f->stepno_width = 0;
f->xfer_prop = f->create_prop = f->access_prop = H5P_DEFAULT;
#ifdef PARALLEL_IO
if ( f_parallel ) {
/* for the SP2... perhaps different for linux */
MPI_Info info = MPI_INFO_NULL;
if (MPI_Comm_size (comm, &f->nprocs) != MPI_SUCCESS) {
HANDLE_MPI_COMM_SIZE_ERR;
goto error_cleanup;
}
if (MPI_Comm_rank (comm, &f->myproc) != MPI_SUCCESS) {
HANDLE_MPI_COMM_RANK_ERR;
goto error_cleanup;
}
f->pnparticles = malloc (f->nprocs * sizeof (h5part_int64_t));
if (f->pnparticles == NULL) {
HANDLE_H5PART_NOMEM_ERR;
goto error_cleanup;
}
f->access_prop = H5Pcreate (H5P_FILE_ACCESS);
if (f->access_prop < 0) {
HANDLE_H5P_CREATE_ERR;
goto error_cleanup;
}
f->access_prop = H5Pcreate (H5P_FILE_ACCESS);
if (f->access_prop < 0) {
HANDLE_H5P_CREATE_ERR;
goto error_cleanup;
}
if (H5Pset_fapl_mpio (f->access_prop, comm, info) < 0) {
HANDLE_H5P_SET_FAPL_MPIO_ERR;
goto error_cleanup;
}
if (H5Pset_fapl_mpio (f->access_prop, comm, info) < 0) {
HANDLE_H5P_SET_FAPL_MPIO_ERR;
goto error_cleanup;
}
/* create_prop: tunable parameters like blocksize and btree sizes */
/* f->create_prop = H5Pcreate(H5P_FILE_CREATE); */
f->create_prop = H5P_DEFAULT;
/* f->create_prop = H5Pcreate(H5P_FILE_CREATE); */
f->create_prop = H5P_DEFAULT;
/* currently create_prop is empty */
/* xfer_prop: also used for parallel I/O, during actual writes
rather than the access_prop which is for file creation. */
f->xfer_prop = H5Pcreate (H5P_DATASET_XFER);
if (f->xfer_prop < 0) {
HANDLE_H5P_CREATE_ERR;
goto error_cleanup;
/* currently create_prop is empty */
/* xfer_prop: also used for parallel I/O, during actual writes
rather than the access_prop which is for file creation. */
f->xfer_prop = H5Pcreate (H5P_DATASET_XFER);
if (f->xfer_prop < 0) {
HANDLE_H5P_CREATE_ERR;
goto error_cleanup;
}
if (H5Pset_dxpl_mpio (f->xfer_prop,H5FD_MPIO_COLLECTIVE) < 0) {
HANDLE_H5P_SET_DXPL_MPIO_ERR;
goto error_cleanup;
}
f->comm = comm;
} else {
f->pnparticles = 0;
f->comm = MPI_COMM_WORLD;
f->nprocs = 1;
f->myproc = 0;
}
if (H5Pset_dxpl_mpio (f->xfer_prop, H5FD_MPIO_COLLECTIVE) < 0) {
HANDLE_H5P_SET_DXPL_MPIO_ERR;
goto error_cleanup;
}
f->comm = comm;
#endif
if ( flags == H5PART_READ ) {
f->file = H5Fopen (filename, H5F_ACC_RDONLY, f->access_prop);
@@ -194,12 +185,14 @@ H5PartOpenFileParallel (
else if ( flags == H5PART_WRITE ){
f->file = H5Fcreate (filename, H5F_ACC_TRUNC, f->create_prop,
f->access_prop);
f->empty = 1;
}
else if ( flags == H5PART_APPEND ) {
int fd = open (filename, O_RDONLY, 0);
if ( (fd == -1) && (errno == ENOENT) ) {
f->file = H5Fcreate(filename, H5F_ACC_TRUNC,
f->create_prop, f->access_prop);
f->empty = 1;
}
else if (fd != -1) {
close (fd);
@@ -210,7 +203,7 @@ H5PartOpenFileParallel (
if f->file < 0. But we can safely ignore this.
*/
f->timestep = _H5Part_get_num_objects_matching_pattern(
f->file, "/", H5G_GROUP, H5PART_GROUPNAME_STEP );
f->file, "/", H5G_GROUP, f->groupname_step );
if ( f->timestep < 0 ) goto error_cleanup;
}
}
@@ -241,6 +234,9 @@ H5PartOpenFileParallel (
error_cleanup:
if (f != NULL ) {
if (f->groupname_step) {
free (f->groupname_step);
}
if (f->pnparticles != NULL) {
free (f->pnparticles);
}
@@ -249,6 +245,39 @@ H5PartOpenFileParallel (
return NULL;
}
#ifdef PARALLEL_IO
/*!
\ingroup h5part_openclose
Opens file with specified filename.
If you open with flag \c H5PART_WRITE, it will truncate any
file with the specified filename and start writing to it. If
you open with \c H5PART_APPEND, then you can append new timesteps.
If you open with \c H5PART_READ, then it will open the file
readonly.
The typical extension for these files is \c .h5.
H5PartFile should be treated as an essentially opaque
datastructure. It acts as the file handle, but internally
it maintains several key state variables associated with
the file.
\return File handle or \c NULL
*/
H5PartFile*
H5PartOpenFileParallel (
const char *filename, /*!< [in] The name of the data file to open. */
unsigned flags, /*!< [in] The access mode for the file. */
MPI_Comm comm /*!< [in] MPI communicator */
) {
int f_parallel = 1; /* parallel i/o */
return _H5Part_open_file ( filename, flags, comm, f_parallel );
}
#endif
/*!
\ingroup h5part_openclose
@@ -277,87 +306,11 @@ H5PartOpenFile (
) {
SET_FNAME ( "H5PartOpenFile" );
if ( _init() < 0 ) {
HANDLE_H5PART_INIT_ERR;
return NULL;
}
_errno = H5PART_SUCCESS;
H5PartFile *f = NULL;
MPI_Comm comm = 0; /* dummy */
int f_parallel = 0; /* serial open */
f = (H5PartFile*) malloc( sizeof (H5PartFile) );
if( f == NULL ) {
HANDLE_H5PART_NOMEM_ERR;
goto error_cleanup;
}
memset (f, 0, sizeof (H5PartFile));
f->xfer_prop = f->create_prop = f->access_prop = H5P_DEFAULT;
#ifdef PARALLEL_IO
f->pnparticles = 0;
f->comm = MPI_COMM_WORLD;
f->nprocs = 1;
f->myproc = 0;
#endif
if (flags == H5PART_READ) {
f->file = H5Fopen (filename, H5F_ACC_RDONLY, f->access_prop);
}
else if (flags == H5PART_WRITE){
f->file = H5Fcreate (filename, H5F_ACC_TRUNC, f->create_prop,
f->access_prop);
}
else if (flags == H5PART_APPEND) {
int fd = open (filename, O_RDONLY, 0);
if ( (fd == -1) && (errno == ENOENT) ) {
f->file = H5Fcreate(filename, H5F_ACC_TRUNC,
f->create_prop, f->access_prop);
}
else if (fd != -1) {
close (fd);
f->file = H5Fopen (filename, H5F_ACC_RDWR,
f->access_prop);
/*
The following function call returns an error,
if f->file < 0. But we can safely ignore it
*/
f->timestep = _H5Part_get_num_objects_matching_pattern(
f->file, "/", H5G_GROUP, H5PART_GROUPNAME_STEP );
if ( f->timestep < 0 ) goto error_cleanup;
}
}
else {
HANDLE_H5PART_FILE_ACCESS_TYPE_ERR ( flags );
goto error_cleanup;
}
if (f->file < 0) {
HANDLE_H5F_OPEN_ERR ( filename, flags );
goto error_cleanup;
}
f->mode = flags;
f->timegroup = -1;
f->shape = 0;
f->diskshape = H5S_ALL;
f->memshape = H5S_ALL;
f->viewstart = -1;
f->viewend = -1;
_H5Part_print_debug (
"Opened file \"%s\" val=%lld",
filename,
(long long)(size_t)f );
return f;
error_cleanup:
if (f != NULL ) {
if (f->pnparticles != NULL) {
free (f->pnparticles);
}
free (f);
}
return NULL;
return _H5Part_open_file ( filename, flags, comm, f_parallel );
}
/*!
@@ -437,6 +390,9 @@ H5PartCloseFile (
if ( r < 0 ) HANDLE_H5F_CLOSE_ERR;
f->file = 0;
}
if (f->groupname_step) {
free (f->groupname_step);
}
if( f->pnparticles ) {
free( f->pnparticles );
}
@@ -447,6 +403,21 @@ H5PartCloseFile (
/*============== File Writing Functions ==================== */
h5part_int64_t
H5PartDefineStepName (
H5PartFile *f,
const char *name,
const h5part_int64_t width
) {
f->groupname_step = strdup ( name );
if( f->groupname_step == NULL ) {
return HANDLE_H5PART_NOMEM_ERR;
}
f->stepno_width = width;
return H5PART_SUCCESS;
}
/*!
\ingroup h5part_write
@@ -629,6 +600,8 @@ _write_data (
herr = H5Dclose ( dataset_id );
if ( herr < 0 ) return HANDLE_H5D_CLOSE_ERR;
f->empty = 0;
return H5PART_SUCCESS;
}
@@ -861,16 +834,16 @@ _H5Part_get_attrib_info (
attrib_id = H5Aopen_idx ( id, attrib_idx );
if ( attrib_id < 0 ) return HANDLE_H5A_OPEN_IDX_ERR ( attrib_idx );
mytype = H5Aget_type ( attrib_id );
if ( attrib_id < 0 ) return HANDLE_H5A_GET_TYPE_ERR;
space_id = H5Aget_space ( attrib_id );
if ( attrib_id < 0 ) return HANDLE_H5A_GET_SPACE_ERR;
if ( attrib_nelem ) {
space_id = H5Aget_space ( attrib_id );
if ( space_id < 0 ) return HANDLE_H5A_GET_SPACE_ERR;
*attrib_nelem = H5Sget_simple_extent_npoints ( space_id );
if ( *attrib_nelem < 0 )
return HANDLE_H5S_GET_SIMPLE_EXTENT_NPOINTS_ERR;
herr = H5Sclose ( space_id );
if ( herr < 0 ) return HANDLE_H5S_CLOSE_ERR;
}
if ( attrib_name ) {
herr = H5Aget_name (
@@ -880,14 +853,14 @@ _H5Part_get_attrib_info (
if ( herr < 0 ) return HANDLE_H5A_GET_NAME_ERR;
}
if ( attrib_type ) {
mytype = H5Aget_type ( attrib_id );
if ( mytype < 0 ) return HANDLE_H5A_GET_TYPE_ERR;
*attrib_type = _H5Part_normalize_h5_type ( mytype );
herr = H5Tclose ( mytype );
if ( herr < 0 ) return HANDLE_H5T_CLOSE_ERR;
}
herr = H5Sclose ( space_id );
if ( herr < 0 ) return HANDLE_H5S_CLOSE_ERR;
herr = H5Tclose ( mytype );
if ( herr < 0 ) return HANDLE_H5T_CLOSE_ERR;
herr = H5Aclose ( attrib_id);
if ( herr < 0 ) return HANDLE_H5A_CLOSE_ERR;
@@ -1303,7 +1276,10 @@ _H5Part_set_step (
char name[128];
sprintf ( name, "%s#%lld", H5PART_GROUPNAME_STEP, (long long) step );
sprintf (
name,
"%s#%0*lld",
f->groupname_step, f->stepno_width, (long long) step );
herr_t herr = H5Gget_objinfo( f->file, name, 1, NULL );
if ( (f->mode != H5PART_READ) && ( herr >= 0 ) ) {
return HANDLE_H5PART_STEP_EXISTS_ERR ( step );
@@ -1387,11 +1363,13 @@ _H5Part_iteration_operator (
herr_t herr;
H5G_stat_t objinfo;
herr = H5Gget_objinfo ( group_id, member_name, 1, &objinfo );
if ( herr < 0 ) return HANDLE_H5G_GET_OBJINFO_ERR ( member_name );
if ( data->type != H5G_UNKNOWN ) {
herr = H5Gget_objinfo ( group_id, member_name, 1, &objinfo );
if ( herr < 0 ) return HANDLE_H5G_GET_OBJINFO_ERR ( member_name );
if ( objinfo.type != data->type )
return 0; /* don't count, continue iteration */
if ( objinfo.type != data->type )
return 0;/* don't count, continue iteration */
}
if ( data->name && (data->stop_idx == data->count) ) {
memset ( data->name, 0, data->len );
@@ -1516,8 +1494,8 @@ H5PartGetNumSteps (
return _H5Part_get_num_objects_matching_pattern (
f->file,
"/",
H5G_GROUP,
H5PART_GROUPNAME_STEP );
H5G_UNKNOWN,
f->groupname_step );
}
/*!
@@ -1539,8 +1517,10 @@ H5PartGetNumDatasets (
CHECK_FILEHANDLE( f );
sprintf ( stepname, "%s#%lld",
H5PART_GROUPNAME_STEP, (long long) f->timestep );
sprintf (
stepname,
"%s#%0*lld",
f->groupname_step, f->stepno_width, (long long) f->timestep );
return _H5Part_get_num_objects ( f->file, stepname, H5G_DATASET );
}
@@ -1570,8 +1550,10 @@ H5PartGetDatasetName (
CHECK_FILEHANDLE ( f );
CHECK_TIMEGROUP ( f );
sprintf ( stepname, "%s#%lld",
H5PART_GROUPNAME_STEP, (long long)f->timestep);
sprintf (
stepname,
"%s#%0*lld",
f->groupname_step, f->stepno_width, (long long) f->timestep );
return _H5Part_get_object_name (
f->file,
@@ -1613,8 +1595,10 @@ H5PartGetDatasetInfo (
CHECK_FILEHANDLE ( f );
CHECK_TIMEGROUP ( f );
sprintf ( step_name, "%s#%lld",
H5PART_GROUPNAME_STEP, (long long)f->timestep);
sprintf (
step_name,
"%s#%0*lld",
f->groupname_step, f->stepno_width, (long long) f->timestep );
herr = _H5Part_get_object_name (
f->timegroup,
@@ -1734,8 +1718,10 @@ _H5Part_get_num_particles (
/* Get first dataset in current time-step */
sprintf (
step_name, "%s#%lld",
H5PART_GROUPNAME_STEP, (long long) f->timestep );
step_name,
"%s#%0*lld",
f->groupname_step, f->stepno_width, (long long) f->timestep );
herr = _H5Part_get_object_name (
f->file,
step_name,
@@ -1903,7 +1889,7 @@ _set_view (
/* setting up the new view */
f->viewstart = start;
f->viewend = end;
f->nparticles = end - start;
f->nparticles = end - start + 1;
/* declare overall datasize */
f->shape = H5Screate_simple ( 1, &total, &total );
+7
View File
@@ -61,6 +61,13 @@ H5PartCloseFile (
/*============== File Writing Functions ==================== */
h5part_int64_t
H5PartDefineStepName (
H5PartFile *f,
const char *name,
const h5part_int64_t width
);
h5part_int64_t
H5PartSetNumParticles (
H5PartFile *f,
+11 -3
View File
@@ -14,6 +14,10 @@ __attribute__ ((format (printf, 3, 4)))
#endif
;
#ifndef PARALLEL_IO
typedef unsigned long MPI_Comm;
#endif
struct H5BlockFile;
/**
@@ -25,7 +29,11 @@ struct H5BlockFile;
H5PartCloseFile().
*/
struct H5PartFile {
hid_t file;
hid_t file;
char *groupname_step;
int stepno_width;
int empty;
h5part_int64_t timestep;
hsize_t nparticles;
@@ -60,12 +68,12 @@ struct H5PartFile {
The index of the processor this process is running on.
*/
int myproc;
#ifdef PARALLEL_IO
/**
MPI comnunicator
*/
MPI_Comm comm;
#endif
struct H5BlockStruct *block;
h5part_int64_t (*close_block)(struct H5PartFile *f);
};
+1 -2
View File
@@ -12,8 +12,7 @@ MPICC = @MPICC@
# COMPILER FLAG SETTING
CFLAGS = @CFLAGS@
ADDFLAGS = @ADDFLAGS@
FFLAGS = @FFLAGS@ @MPIINC@ $(ADDFLAGS)
FFLAGS = @FFLAGS@ @MPIINC@
# LIBRARIES
SZLIB = @SZLIB@
+2 -2
View File
@@ -33,7 +33,7 @@ H5PINC = -I@H5P_LIB_LOC@
bin_PROGRAMS = @BUILD_TOOLS@
# Listing of all programs that maybe built. (Has to know statically...)
EXTRA_PROGRAMS = h5pAttrib h5pToGNUplot homdynToH5p
EXTRA_PROGRAMS = h5pAttrib h5pToGNUplot # homdynToH5p
# Extra files that I wish to include in the dist tar ball.
EXTRA_DIST = h5pAttrib.cc h5pToGNUplot.cc## TO BE TAILORED LATER...
@@ -43,7 +43,7 @@ h5pAttrib_SOURCES = h5pAttrib.cc
h5pToGNUplot_SOURCES = h5pToGNUplot.cc
homdynToH5p_SOURCES = homdynToH5p.cc
#homdynToH5p_SOURCES = homdynToH5p.cc
# Specific building instruction (What compilers to use...)
# ------------ Build Tools ------------
+89 -6
View File
@@ -31,6 +31,7 @@ int main(int argc,char *argv[]){
double data[nCol][10000];
string headers[nCol];
string units[nCol];
string fnStr("HBUNCH.OUT");
@@ -75,15 +76,97 @@ int main(int argc,char *argv[]){
}
H5PartWriteFileAttribString(file,"File Description", "This file contains HOMDYN HBUNCH.OUT data");
H5PartWriteFileAttribString(file,"tUnit","s");
H5PartWriteFileAttribString(file,"xUnit","m");
H5PartWriteFileAttribString(file,"yUnit","m");
H5PartWriteFileAttribString(file,"zUnit","m");
H5PartWriteFileAttribString(file,"pxUnit","#beta#gamma");
H5PartWriteFileAttribString(file,"pyUnit","#beta#gamma");
H5PartWriteFileAttribString(file,"pzUnit","#beta#gamma");
H5PartWriteFileAttribString(file,"idUnit","1");
H5PartWriteFileAttribString(file,"SPOSUnit","m");
H5PartWriteFileAttribString(file,"TIMEUnit","s");
H5PartWriteFileAttribString(file,"#gammaUnit","1");
H5PartWriteFileAttribString(file,"ENERGYUnit","MeV");
H5PartWriteFileAttribString(file,"#varepsilonUnit","m rad");
H5PartWriteFileAttribString(file,"#varepsilonrUnit","m rad");
H5PartWriteFileAttribString(file,"#varepsilonr-geomUnit","m rad");
H5PartWriteFileAttribString(file,"RMSXUnit","m");
H5PartWriteFileAttribString(file,"RMSRUnit","m");
H5PartWriteFileAttribString(file,"RMSPUnit","#beta#gamma");
H5PartWriteFileAttribString(file,"maxdEUnit","MeV");
H5PartWriteFileAttribString(file,"max#phiUnit","deg");
H5PartWriteFileAttribString(file,"phizUnit","deg");
H5PartWriteFileAttribString(file,"enezUnit","keV");
for (int c=0;c<nCol;c++)
int rc = H5PartWriteFileAttribString(file,(headers[c]+string("Unit")).c_str(), " "); ;
/*
1 Z_[m]
2 sigma_r_[mm]
3 sigma_z_[mm]
4 I_[A]
5 sigma_x_[mm]
6 enx_[um]
7 sigma_y_[mm]
8 eny_[um]
9 T_[MeV]
10 dg/g_[%]
11 DE_[MeV]
12 elz_[KeVmm]
13 Ez_[MV/m]
14 Bz_[T] Bx_[G] By_[G]
15 Qgrad_[T/m]
16 ByWig
17 BHOR_[T]
18 Time_[nsec]
19 beta
20 R/gL
21 Lplas_[m]
22 Zeq_[m]
23 EWsteady
*/
for (int t=0;t<nLines;t++) {
H5PartSetStep(file,t); /* must set the current timestep in file */
for (int c=0;c<nCol;c++) {
int rc = H5PartWriteStepAttrib(file,headers[c].c_str(), H5T_NATIVE_DOUBLE,&data[c][t],1);
}
H5PartSetStep(file,t); /* must set the current timestep in file */
double d3[3];
double dummy = 0.0;
int rc;
rc = H5PartWriteStepAttrib(file,"SPOS", H5T_NATIVE_DOUBLE,&data[0][t],1);
dummy = data[1][t]/1000.0;
rc = H5PartWriteStepAttrib(file,"RMSR", H5T_NATIVE_DOUBLE,&dummy,1);
rc = H5PartWriteStepAttrib(file,"TIME", H5T_NATIVE_DOUBLE,&data[17][t],1);
rc = H5PartWriteStepAttrib(file,"ENERGY", H5T_NATIVE_DOUBLE,&data[8][t],1);
d3[0] = data[4][t]/1000.0;
d3[1] = data[6][t]/1000.0;
d3[2] = 0.0;
rc = H5PartWriteStepAttrib(file,"RMSX", H5T_NATIVE_DOUBLE,&d3,3);
d3[0] = data[5][t]/1000000.0;
d3[1] = data[7][t]/1000000.0;
d3[2] = 0.0;
rc = H5PartWriteStepAttrib(file,"#varepsilon", H5T_NATIVE_DOUBLE,&d3,3);
d3[0] = 0.0;
d3[1] = 0.0;
d3[2] = 0.0;
rc = H5PartWriteStepAttrib(file,"#gamma", H5T_NATIVE_DOUBLE,&dummy,1);
rc = H5PartWriteStepAttrib(file,"#varepsilonr", H5T_NATIVE_DOUBLE,&d3,3);
rc = H5PartWriteStepAttrib(file,"#varepsilonr-geom", H5T_NATIVE_DOUBLE,&d3,3);
rc = H5PartWriteStepAttrib(file,"RMSP", H5T_NATIVE_DOUBLE,&d3,3);
rc = H5PartWriteStepAttrib(file,"maxdE", H5T_NATIVE_DOUBLE,&dummy,1);
rc = H5PartWriteStepAttrib(file,"max#phi", H5T_NATIVE_DOUBLE,&dummy,1);
rc = H5PartWriteStepAttrib(file,"phiz", H5T_NATIVE_DOUBLE,&dummy,1);
rc = H5PartWriteStepAttrib(file,"enez", H5T_NATIVE_DOUBLE,&dummy,1);
}
H5PartCloseFile(file);
}
@@ -24,7 +24,6 @@
//h5part specific
#include <H5Part.h>
#include <stdio.h>
#include <stdlib.h>
@@ -82,11 +81,11 @@ avth5partFileFormat::avth5partFileFormat(const char *filename)
pointvarnames.resize(npointvars);
cout << "constructor: nvariables: " << npointvars << "\n";
char name[64];
int status;
char name[128];
h5part_int64_t status;
for (j=0; j < npointvars; j++){
status = H5PartGetDatasetName(file,j, name,64);
if (status != 1){
status = H5PartGetDatasetName(file,j, name,128);
if (status != H5PART_SUCCESS){
EXCEPTION1(VisItException, "could not read a variable name");
}
pointvarnames[j] = name;
@@ -110,13 +109,13 @@ avth5partFileFormat::avth5partFileFormat(const char *filename)
int
avth5partFileFormat::GetNTimesteps(void)
{
int nt;
h5part_int64_t nt;
H5PartFile *file;
file = H5PartOpenFile(fname.c_str(),H5PART_READ);
H5PartSetStep(file,0);
nt=H5PartGetNumSteps(file); /* get number of steps in file */
H5PartCloseFile(file);
return nt;
return (int) nt;
}
@@ -333,14 +332,15 @@ avth5partFileFormat::GetMesh(int timestate, int domain, const char *meshname)
#ifdef PARALLEL_IO
nprocs = PAR_Size();
#endif
H5PartSetStep(file,timestate);
//points
tnpoints= (int) H5PartGetNumParticles(file);
unsigned long long idStart = ((int)(tnpoints/nprocs))*domain;
unsigned long long idEnd;
h5part_int64_t idStart = (( h5part_int64_t)(tnpoints/nprocs))*domain;
h5part_int64_t idEnd;
if (domain < nprocs-1)
idEnd = ((unsigned long int)(tnpoints/nprocs))*(domain+1);
idEnd = ((h5part_int64_t)(tnpoints/nprocs))*(domain+1);
else if (domain == nprocs - 1)
idEnd = tnpoints;
@@ -358,21 +358,21 @@ avth5partFileFormat::GetMesh(int timestate, int domain, const char *meshname)
EXCEPTION1(VisItException, "npoints is zero");
points.resize(npoints*nspace);
double *x, *y, *z;
x = (double *) malloc(sizeof(double)*npoints);
y = (double *) malloc(sizeof(double)*npoints);
z = (double *) malloc(sizeof(double)*npoints);
h5part_float64_t *x, *y, *z;
x = (h5part_float64_t *) malloc(sizeof(h5part_float64_t)*npoints);
y = (h5part_float64_t *) malloc(sizeof(h5part_float64_t)*npoints);
z = (h5part_float64_t *) malloc(sizeof(h5part_float64_t)*npoints);
int status = 0;
h5part_int64_t status = H5PART_SUCCESS;
status = H5PartReadDataFloat64(file, "x", x);
if (status != 1)
if (status != H5PART_SUCCESS)
EXCEPTION1(VisItException, "Could not read x coordinates");
status = H5PartReadDataFloat64(file, "y", y);
if (status != 1)
if (status != H5PART_SUCCESS)
EXCEPTION1(VisItException, "Could not read y coordinates");
status = H5PartReadDataFloat64(file, "z", z);
if (status != 1)
if (status != H5PART_SUCCESS)
EXCEPTION1(VisItException, "Could not read z coordinates");
for (long int i = 0; i < npoints; i++){
points[nspace*i] = (float) x[i];
@@ -464,8 +464,8 @@ avth5partFileFormat::GetVar(int timestate, int domain, const char *varname)
if (!file)
EXCEPTION1(InvalidFilesException, fname.c_str());
int status;
long int tnpoints, npoints;
h5part_int64_t status;
h5part_int64_t tnpoints, npoints;
int npointvars;
int nspace = 3;
int nprocs = 1;
@@ -475,44 +475,44 @@ avth5partFileFormat::GetVar(int timestate, int domain, const char *varname)
H5PartSetStep(file,timestate);
//points
tnpoints= (long int) H5PartGetNumParticles(file);
tnpoints= H5PartGetNumParticles(file);
//point vars
char name[64];
long long *idvar;
h5part_int64_t *idvar;
double *data;
unsigned long long idStart = ((int)(tnpoints/nprocs))*domain;
unsigned long long idEnd;
h5part_int64_t idStart = ((h5part_int64_t)(tnpoints/nprocs))*domain;
h5part_int64_t idEnd;
if (domain < nprocs-1)
idEnd = ((unsigned long int)(tnpoints/nprocs))*(domain+1);
idEnd = ((h5part_int64_t)(tnpoints/nprocs))*(domain+1);
else if (domain == nprocs - 1)
idEnd = tnpoints;
idEnd = (h5part_int64_t)tnpoints;
H5PartSetView(file,idStart,idEnd);
npoints= (int) H5PartGetNumParticles(file);
npoints= H5PartGetNumParticles(file);
cout << "GetVar: npoints for domain " << domain << ": " << npoints << "\n";
for (int j=0; j < pointvarnames.size(); j++){
for (size_t j=0; j < (size_t)(pointvarnames.size()); j++){
status = H5PartGetDatasetName(file,j, name,64);
if (pointvarnames[j] == name) {
if (strstr(name, "id") != NULL){
idvar = (long long *) malloc(sizeof(long long)*npoints);
idvar = (h5part_int64_t *) malloc(sizeof(h5part_int64_t)*npoints);
status = H5PartReadDataInt64(file, name, idvar);
if (status != 1)
if (status != H5PART_SUCCESS)
EXCEPTION1(VisItException, "Could not read dataset");
pointvars[j].resize(npoints);
for (long int i=0; i < npoints; i++){
for (size_t i=0; i < (size_t) npoints; i++){
pointvars[j][i] = (float) idvar[i];
}
if (idvar != NULL)
free(idvar);
} else {
data = (double *) malloc(sizeof(double)*npoints);
data = (h5part_float64_t *) malloc(sizeof(h5part_float64_t)*npoints);
status = H5PartReadDataFloat64(file, name, data);
if (status != 1)
if (status != H5PART_SUCCESS)
EXCEPTION1(VisItException, "Could not read dataset");
pointvars[j].resize(npoints);
for (long int i=0; i < npoints; i++){
for (size_t i=0; i < (size_t)(npoints); i++){
pointvars[j][i] = (float) data[i];
}
if (data != NULL)
@@ -6,7 +6,7 @@
#define AVT_h5part_FILE_FORMAT_H
#include <avtMTMDFileFormat.h>
#include <H5Part.hh>
#include <H5Part.h>
#include <vector>
#include <string>