Compare commits
34 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| aacd90c1cc | |||
| 060f4b0029 | |||
| c3f6a51426 | |||
| 5a31c58c41 | |||
| 63bfd8a516 | |||
| 826ec5491c | |||
| b1e8e15b90 | |||
| 8862acd04f | |||
| 2b3a3fdafb | |||
| a29d3c894a | |||
| f9710938f2 | |||
| 33f3e8a24d | |||
| 95903d2711 | |||
| e23aeea0ef | |||
| 7dc3981621 | |||
| 2954499875 | |||
| 339c86404c | |||
| d2a55f9a90 | |||
| 92d0cc5ae5 | |||
| 329a72fa82 | |||
| 2921aa87d5 | |||
| be103949eb | |||
| df552265bc | |||
| ffe7b30b02 | |||
| 154c03bbbe | |||
| 259e4b1ff0 | |||
| a4f95fa4db | |||
| d8c84a3bff | |||
| 30cf451716 | |||
| c1eadeb678 | |||
| 8030a7246b | |||
| 81f7f7716f | |||
| 7baf635bef | |||
| 87eae5c238 |
+2
-8
@@ -2,7 +2,6 @@
|
|||||||
/AUTHORS -text
|
/AUTHORS -text
|
||||||
/COPYING -text
|
/COPYING -text
|
||||||
/ChangeLog -text
|
/ChangeLog -text
|
||||||
/GNUmakefile.orig -text
|
|
||||||
/Makefile.am -text
|
/Makefile.am -text
|
||||||
/NEWS -text
|
/NEWS -text
|
||||||
/README -text
|
/README -text
|
||||||
@@ -368,12 +367,6 @@ src/C++/Makefile.am -text
|
|||||||
src/C/H5.c -text
|
src/C/H5.c -text
|
||||||
src/C/H5Block.c -text
|
src/C/H5Block.c -text
|
||||||
src/C/H5Block_readwrite.c -text
|
src/C/H5Block_readwrite.c -text
|
||||||
src/C/H5Fed.c -text
|
|
||||||
src/C/H5Fed_adjacency.c -text
|
|
||||||
src/C/H5Fed_inquiry.c -text
|
|
||||||
src/C/H5Fed_retrieve.c -text
|
|
||||||
src/C/H5Fed_store.c -text
|
|
||||||
src/C/H5Fed_tags.c -text
|
|
||||||
src/C/H5Part.c -text
|
src/C/H5Part.c -text
|
||||||
src/C/H5_attachments.c -text
|
src/C/H5_attachments.c -text
|
||||||
src/C/H5_attribs.c -text
|
src/C/H5_attribs.c -text
|
||||||
@@ -558,7 +551,6 @@ tools/H5PartMerge/INSTALL -text
|
|||||||
tools/H5PartMerge/NEWS -text
|
tools/H5PartMerge/NEWS -text
|
||||||
tools/H5PartMerge/README -text
|
tools/H5PartMerge/README -text
|
||||||
tools/H5PartMerge/autogen.sh -text
|
tools/H5PartMerge/autogen.sh -text
|
||||||
tools/H5PartMerge/configure -text
|
|
||||||
tools/H5PartMerge/configure.ac -text
|
tools/H5PartMerge/configure.ac -text
|
||||||
tools/H5PartMerge/makefile.am -text
|
tools/H5PartMerge/makefile.am -text
|
||||||
tools/H5PartMerge/src/H5merge.cpp -text
|
tools/H5PartMerge/src/H5merge.cpp -text
|
||||||
@@ -566,6 +558,8 @@ tools/H5PartMerge/src/optparse.cpp -text
|
|||||||
tools/H5PartMerge/src/optparse.hh -text
|
tools/H5PartMerge/src/optparse.hh -text
|
||||||
tools/Makefile.am -text
|
tools/Makefile.am -text
|
||||||
tools/README -text
|
tools/README -text
|
||||||
|
tools/h5PartDcToVtk.cc -text
|
||||||
|
tools/h5PartSurfaceToVtk.cc -text
|
||||||
tools/h5hutcc.in -text
|
tools/h5hutcc.in -text
|
||||||
tools/h5pAttrib.cc -text
|
tools/h5pAttrib.cc -text
|
||||||
tools/h5pToGNUplot.cc -text
|
tools/h5pToGNUplot.cc -text
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
|
/H5hut
|
||||||
/INSTALL
|
/INSTALL
|
||||||
/Makefile
|
/Makefile
|
||||||
/Makefile.in
|
/Makefile.in
|
||||||
/aclocal.m4
|
/aclocal.m4
|
||||||
/autom4te.cache
|
/autom4te.cache
|
||||||
|
/build
|
||||||
/config.guess
|
/config.guess
|
||||||
/config.h
|
/config.h
|
||||||
/config.h.in
|
/config.h.in
|
||||||
@@ -14,6 +16,9 @@
|
|||||||
doc/Makefile
|
doc/Makefile
|
||||||
doc/Makefile.in
|
doc/Makefile.in
|
||||||
/install-sh
|
/install-sh
|
||||||
|
/libtool
|
||||||
|
/ltmain.sh
|
||||||
|
/m4
|
||||||
/missing
|
/missing
|
||||||
src/.deps
|
src/.deps
|
||||||
src/C++/Makefile
|
src/C++/Makefile
|
||||||
|
|||||||
@@ -1,133 +0,0 @@
|
|||||||
UNAME := $(shell uname | perl -pe 's/(sn\d\d\d\d|jsimpson)/UNICOS\/mk/')
|
|
||||||
# for host specific options
|
|
||||||
HOST := $(shell hostname)
|
|
||||||
|
|
||||||
# for processor-specific options
|
|
||||||
ifeq ($(UNAME), Linux)
|
|
||||||
PROC := $(shell uname -p)
|
|
||||||
endif
|
|
||||||
|
|
||||||
CXX = c++
|
|
||||||
CC = cc
|
|
||||||
H5HOME = /usr/local/hdf5
|
|
||||||
CFLAGS = -g -I$(H5HOME)/include
|
|
||||||
LDFLAGS = -L$(H5HOME)/lib -lhdf5 -lz -lm
|
|
||||||
|
|
||||||
# MacOS-X Serial
|
|
||||||
ifeq ($(UNAME), Darwin)
|
|
||||||
ifeq ($(PARALLEL), yes)
|
|
||||||
CXX = g++
|
|
||||||
CC = mpicc
|
|
||||||
H5HOME = /usr/local
|
|
||||||
CFLAGS = -O -g -I$(H5HOME)/include -DPARALLEL_IO
|
|
||||||
LDFLAGS = -L$(H5HOME)/lib -lmpich -lpmpich -lhdf5 -lz -lm
|
|
||||||
else
|
|
||||||
CXX = c++
|
|
||||||
CC = cc
|
|
||||||
F90 = xlf
|
|
||||||
H5HOME = /usr/local
|
|
||||||
CFLAGS = -O -g -I$(H5HOME)/include
|
|
||||||
LDFLAGS = -L$(H5HOME)/lib -lhdf5 -lz -lm
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
# SGI MIPS/Irix
|
|
||||||
ifeq ($(UNAME), IRIX64)
|
|
||||||
CXX = CC
|
|
||||||
CC = cc
|
|
||||||
F90 = f90
|
|
||||||
ifeq ($(PARALLEL), yes)
|
|
||||||
H5HOME = $(HDF5_DIR)
|
|
||||||
CFLAGS = -64 -O3 -I$(H5HOME)/include -DPARALLEL_IO
|
|
||||||
LDFLAGS = -64 -O3 -L$(H5HOME)/lib -lhdf5 -lz -lmpi -lm
|
|
||||||
else
|
|
||||||
H5HOME = /usr/local
|
|
||||||
CFLAGS = -O3 -I$(H5HOME)/include
|
|
||||||
LDFLAGS = -L$(H5HOME)/lib -lhdf5 -lz -lm
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
# AIX/SP-2 Parallel/serial : Seaborg
|
|
||||||
ifeq ($(UNAME), AIX)
|
|
||||||
ifeq ($(PARALLEL), yes) # parallel
|
|
||||||
CXX = mpCC_r
|
|
||||||
CC = mpxlc_r
|
|
||||||
# H5HOME = /usr/common/usg/hdf5_64/1.4.5-post2/parallel
|
|
||||||
H5HOME = /usr/common/usg/hdf5_64/1.6.1/parallel
|
|
||||||
# /usr/common/usg/hdf5/1.4.4/parallel
|
|
||||||
H4HOME = /usr/common/usg/hdf/default
|
|
||||||
OPT = -qarch=auto -qtune=auto-qcache=auto -O3 -qhot
|
|
||||||
CFLAGS = -q64 -I$(H5HOME)/include
|
|
||||||
LDFLAGS = -L$(H5HOME)/lib -lhdf5 -L$(H4HOME)/lib -lz -lsz -lm
|
|
||||||
else # serial
|
|
||||||
CXX = xlC
|
|
||||||
CC = xlc
|
|
||||||
H5HOME = /usr/common/usg/hdf5/1.4.4/serial
|
|
||||||
H4HOME = /usr/common/usg/hdf/default
|
|
||||||
OPT = -qarch=auto -qtune=auto-qcache=auto -O3 -qhot
|
|
||||||
CFLAGS = -g -bmaxdata:800000000 -bmaxstack:256000000 -I$(H5HOME)/include
|
|
||||||
LDFLAGS = -L$(H5HOME)/lib -lhdf5 -L$(H4HOME)/lib -lz -lm
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
# Linux
|
|
||||||
ifeq ($(UNAME), Linux)
|
|
||||||
# if this machine is NERSC/Davinci Altix system
|
|
||||||
ifeq ($(PROC), ia64)
|
|
||||||
CC = icc
|
|
||||||
CXX = icc
|
|
||||||
|
|
||||||
ifeq ($(PARALLEL), yes)
|
|
||||||
# IA64 Linux Parallel
|
|
||||||
ifeq ($(HOST), davinci)
|
|
||||||
H5HOME = $(HDF5_PAR)
|
|
||||||
MPILIB = -lmpi
|
|
||||||
else
|
|
||||||
H5HOME = /usr/local
|
|
||||||
HDF5_PAR_LIB = -L$(H5HOME)/lib -lhdf5 -lz -lm
|
|
||||||
HDF5_PAR_INCLUDE = -I$(H5HOME)/include
|
|
||||||
MPIHOME = /usr/local
|
|
||||||
MPILIB = -lmpich
|
|
||||||
endif # HOST
|
|
||||||
CFLAGS = -O3 -DPARALLEL_IO -DH5_HAVE_PARALLEL $(HDF5_PAR_INCLUDE)
|
|
||||||
LDFLAGS = $(HDF5_PAR_LIB) $(MPILIB)
|
|
||||||
else # IA64 Linux Serial
|
|
||||||
CFLAGS = -O3 $(HDF5_INCLUDE)
|
|
||||||
LDFLAGS = $(HDF5_LIB) -lm
|
|
||||||
endif # PARALLEL
|
|
||||||
|
|
||||||
# else this is standard IA32 linux
|
|
||||||
else
|
|
||||||
ifeq ($(PARALLEL), yes)
|
|
||||||
# Linux Parallel
|
|
||||||
CC = gcc
|
|
||||||
CXX = g++
|
|
||||||
H5HOME = /usr/local
|
|
||||||
MPIHOME = /usr/local
|
|
||||||
CFLAGS = -O -g -DPARALLEL_IO -DH5_HAVE_PARALLEL -I$(H5HOME)/include
|
|
||||||
LDFLAGS = -L$(H5HOME)/lib -lhdf5 -lmpich -lrt -lz -lm
|
|
||||||
else # Linux Serial
|
|
||||||
CXX = g++
|
|
||||||
CC = gcc
|
|
||||||
CFLAGS = -O -g -I$(H5HOME)/include
|
|
||||||
LDFLAGS = -L$(H5HOME)/lib -lhdf5 -lz -lm
|
|
||||||
endif # !PARALLEL
|
|
||||||
endif # PROC!ia64
|
|
||||||
|
|
||||||
endif # !Linux
|
|
||||||
|
|
||||||
ifeq ($(PARALLEL), yes) #parallel
|
|
||||||
ifdef F90
|
|
||||||
all: H5PartTest H5PartTest.o H5Part.o H5PartTestParallel H5PartAndreasTest H5PartF.o
|
|
||||||
else
|
|
||||||
all: H5PartTest H5PartTest.o H5Part.o H5PartTestParallel H5PartAndreasTest
|
|
||||||
endif
|
|
||||||
else
|
|
||||||
ifdef F90
|
|
||||||
all: H5PartTest H5PartTest.o H5Part.o H5PartF.o
|
|
||||||
else
|
|
||||||
all: H5PartTest H5PartTest.o H5Part.o
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
include rules.make
|
|
||||||
@@ -1,3 +1,5 @@
|
|||||||
|
ACLOCAL_AMFLAGS = -I m4
|
||||||
|
|
||||||
SUBDIRS = \
|
SUBDIRS = \
|
||||||
src \
|
src \
|
||||||
test \
|
test \
|
||||||
|
|||||||
+26
-24
@@ -1,46 +1,48 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
# Run this to generate all the initial makefiles, etc.
|
# Run this to generate all the initial makefiles, etc.
|
||||||
|
|
||||||
|
ACLOCAL_FLAGS="-I m4 $ACLOCAL_FLAGS"
|
||||||
|
LIBTOOLIZE_FLAGS="--force $LIBTOOLIZE_FLAGS"
|
||||||
|
AUTOMAKE_FLAGS="--add-missing --copy --foreign $AUTOMAKE_FLAGS"
|
||||||
|
|
||||||
|
LIBTOOLIZE=`which libtoolize`
|
||||||
|
if [ "$LIBTOOLIZE" = "" ]; then
|
||||||
|
LIBTOOLIZE=`which glibtoolize`
|
||||||
|
fi
|
||||||
|
if [ "$LIBTOOLIZE" = "" ]; then
|
||||||
|
echo "libtoolize not found" 1>&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
echo "+ making misc files ..."
|
echo "+ making misc files ..."
|
||||||
touch NEWS README AUTHORS ChangeLog
|
touch NEWS README AUTHORS ChangeLog
|
||||||
echo
|
echo
|
||||||
echo
|
$LIBTOOLIZE $LIBTOOLIZE_FLAGS || {
|
||||||
|
echo "libtoolize failed"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
echo
|
echo
|
||||||
echo "+ running aclocal ..."
|
echo "+ running aclocal ..."
|
||||||
aclocal $ACLOCAL_FLAGS || {
|
aclocal $ACLOCAL_FLAGS || {
|
||||||
echo
|
echo "aclocal failed - check that all needed development files are present on system"
|
||||||
echo "aclocal failed - check that all needed development files are present on system"
|
exit 1
|
||||||
exit 1
|
|
||||||
}
|
}
|
||||||
echo
|
echo
|
||||||
echo
|
|
||||||
echo
|
|
||||||
echo
|
|
||||||
echo "+ running autoheader ... "
|
echo "+ running autoheader ... "
|
||||||
autoheader || {
|
autoheader || {
|
||||||
echo
|
echo "autoheader failed"
|
||||||
echo "autoheader failed"
|
exit 1
|
||||||
exit 1
|
|
||||||
}
|
}
|
||||||
echo
|
echo
|
||||||
echo
|
|
||||||
echo
|
|
||||||
echo "+ running autoconf ... "
|
echo "+ running autoconf ... "
|
||||||
autoconf || {
|
autoconf || {
|
||||||
echo
|
echo "autoconf failed"
|
||||||
echo "autoconf failed"
|
exit 1
|
||||||
exit 1
|
|
||||||
}
|
}
|
||||||
echo
|
echo
|
||||||
echo
|
|
||||||
echo
|
|
||||||
echo "+ running automake ... "
|
echo "+ running automake ... "
|
||||||
automake -a -c --foreign || {
|
automake $AUTOMAKE_FLAGS || {
|
||||||
echo
|
echo "automake failed"
|
||||||
echo "automake failed"
|
exit 1
|
||||||
exit 1
|
|
||||||
}
|
}
|
||||||
echo
|
|
||||||
echo
|
|
||||||
echo
|
|
||||||
|
|
||||||
|
|||||||
+76
-198
@@ -8,13 +8,17 @@ AC_INIT([H5hut], [1.99.1], [h5part@lists.psi.ch], H5hut)
|
|||||||
# print an error message to the standard error output and do not create configure.
|
# print an error message to the standard error output and do not create configure.
|
||||||
AC_PREREQ(2.59)
|
AC_PREREQ(2.59)
|
||||||
|
|
||||||
|
|
||||||
# should be called right after AC_INIT.
|
# should be called right after AC_INIT.
|
||||||
# configure scripts can create a C header file containing `#define' directives.
|
# configure scripts can create a C header file containing `#define' directives.
|
||||||
# The AC_CONFIG_HEADERS macro selects this kind of output.
|
# The AC_CONFIG_HEADERS macro selects this kind of output.
|
||||||
AC_CONFIG_HEADER(config.h)
|
AC_CONFIG_HEADERS(config.h)
|
||||||
|
|
||||||
BUILD_LIBS='libH5hut.a'
|
AC_CONFIG_MACRO_DIR([m4])
|
||||||
|
|
||||||
|
# AM_INIT_AUTOMAKE is required to use autoconf with automake
|
||||||
|
AM_INIT_AUTOMAKE
|
||||||
|
|
||||||
|
BUILD_LIBS='libH5hut'
|
||||||
USE_C='yes'
|
USE_C='yes'
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
@@ -27,12 +31,6 @@ AC_ARG_ENABLE(
|
|||||||
[Compile with debug flags [default=no]])],
|
[Compile with debug flags [default=no]])],
|
||||||
[USE_DEBUG=$enableval])
|
[USE_DEBUG=$enableval])
|
||||||
|
|
||||||
AC_ARG_ENABLE(
|
|
||||||
[64],
|
|
||||||
[AC_HELP_STRING([--enable-64],
|
|
||||||
[Compile using 64-bit flags [default=no]])],
|
|
||||||
[USE_64=$enableval])
|
|
||||||
|
|
||||||
AC_ARG_ENABLE(
|
AC_ARG_ENABLE(
|
||||||
[c],
|
[c],
|
||||||
[AC_HELP_STRING([--enable-c],
|
[AC_HELP_STRING([--enable-c],
|
||||||
@@ -51,12 +49,6 @@ AC_ARG_ENABLE(
|
|||||||
[Compile the MPI/IO interface [default=no]])],
|
[Compile the MPI/IO interface [default=no]])],
|
||||||
[USE_PARALLEL=$enableval])
|
[USE_PARALLEL=$enableval])
|
||||||
|
|
||||||
AC_ARG_WITH(
|
|
||||||
[mpi],
|
|
||||||
[AC_HELP_STRING([--with-mpi],
|
|
||||||
[path to MPI installation [default=""]])],
|
|
||||||
[MPIPATH=$withval], [MPIPATH=""])
|
|
||||||
|
|
||||||
AC_ARG_WITH(
|
AC_ARG_WITH(
|
||||||
[hdf5],
|
[hdf5],
|
||||||
[AC_HELP_STRING([--with-hdf5],
|
[AC_HELP_STRING([--with-hdf5],
|
||||||
@@ -69,17 +61,6 @@ AC_ARG_WITH(
|
|||||||
[path to lustre user API [default=""]])],
|
[path to lustre user API [default=""]])],
|
||||||
[LUSTREPATH=$withval], [LUSTREPATH=""])
|
[LUSTREPATH=$withval], [LUSTREPATH=""])
|
||||||
|
|
||||||
###############################################################################
|
|
||||||
################# A SIMPLE WORK AROUND TO USE ENV. VARS #######################
|
|
||||||
###############################################################################
|
|
||||||
|
|
||||||
SAVE_CC=$CC
|
|
||||||
SAVE_CXX=$CXX
|
|
||||||
SAVE_MPICC=$MPICC
|
|
||||||
SAVE_MPICXX=$MPICXX
|
|
||||||
SAVE_MPIROOT=$MPIROOT
|
|
||||||
SAVE_HDF5ROOT=$HDF5ROOT
|
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
############### PATH SERACH FUNCTION - to be used later... ####################
|
############### PATH SERACH FUNCTION - to be used later... ####################
|
||||||
###############################################################################
|
###############################################################################
|
||||||
@@ -119,35 +100,31 @@ PATH_Search() {
|
|||||||
# individual parts host_cpu, host_vendor, and host_os.
|
# individual parts host_cpu, host_vendor, and host_os.
|
||||||
AC_CANONICAL_HOST
|
AC_CANONICAL_HOST
|
||||||
|
|
||||||
|
AC_PROG_MAKE_SET
|
||||||
uname=`uname -s`
|
|
||||||
if test "x$uname" = "xAIX"; then
|
|
||||||
AC_MSG_CHECKING([if system is AIX])
|
|
||||||
AC_MSG_RESULT([OK])
|
|
||||||
|
|
||||||
# If on AIX, define _ALL_SOURCE. Allows the use of some BSD functions.
|
|
||||||
# Should be called before any macros that run the C compiler.
|
|
||||||
AC_AIX
|
|
||||||
fi
|
|
||||||
|
|
||||||
#if test -n "$MPIPATH"; then
|
|
||||||
# PATH="$MPIPATH/bin:$PATH"
|
|
||||||
#fi
|
|
||||||
|
|
||||||
# Determine a C/C++ compiler to use.
|
# Determine a C/C++ compiler to use.
|
||||||
# If CC is not already set in the environment, check for gcc and cc, then
|
# If CC is not already set in the environment, check for gcc and cc, then
|
||||||
# for other C compilers.
|
# for other C compilers.
|
||||||
# Set output variable CC to the name of the compiler found.
|
# Set output variable CC to the name of the compiler found.
|
||||||
if test "x$USE_PARALLEL" = "xyes"; then
|
if test "x$USE_PARALLEL" = "xyes"; then
|
||||||
AC_PROG_CC(mpicc)
|
CCOMPILERS="mpicc cc"
|
||||||
AC_PROG_CXX(mpicxx)
|
|
||||||
CC=`which $CC`
|
|
||||||
CXX=`which $CXX`
|
|
||||||
else
|
else
|
||||||
AC_PROG_CC(pgcc pathcc icc cc_r gcc cc)
|
CCOMPILERS="pgcc pathcc icc gcc cc_r cc"
|
||||||
AC_PROG_CXX(pgCC pathCC icc cc_r g++ gcc cc)
|
fi
|
||||||
CC=`which $CC`
|
|
||||||
CXX=`which $CXX`
|
AC_PROG_CC($CCOMPILERS)
|
||||||
|
AC_PROG_CXX
|
||||||
|
|
||||||
|
# Use macro to set C99 mode instead of checking for gcc, which breaks with
|
||||||
|
# parallel builds.
|
||||||
|
AC_PROG_CC_C99
|
||||||
|
#if test "x$CC" = "xgcc"; then
|
||||||
|
# CFLAGS="$CFLAGS -std=c99"
|
||||||
|
#fi
|
||||||
|
|
||||||
|
if test "x$ac_cv_prog_cc_c99" = "xno"; then
|
||||||
|
AC_MSG_ERROR([Cannot set C compiler to use C99 standard!])
|
||||||
|
exit 1
|
||||||
fi
|
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,
|
||||||
@@ -155,18 +132,35 @@ fi
|
|||||||
# Otherwise, set INSTALL to `dir/install-sh -c`
|
# Otherwise, set INSTALL to `dir/install-sh -c`
|
||||||
AC_PROG_INSTALL
|
AC_PROG_INSTALL
|
||||||
|
|
||||||
if test "x$CC" = "xgcc"; then
|
AC_PROG_AWK
|
||||||
CFLAGS="$CFLAGS -std=c99"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# AM_INIT_AUTOMAKE is required to use autoconf with automake
|
# Disable shared libraries by default: can be enabled with --enable-shared
|
||||||
AM_INIT_AUTOMAKE()
|
LT_INIT([disable-shared])
|
||||||
|
AC_PROG_LIBTOOL
|
||||||
AC_PROG_RANLIB
|
|
||||||
|
|
||||||
# Default prefix for bindir, etc... (eg >> ./build/bin)
|
# Default prefix for bindir, etc... (eg >> ./build/bin)
|
||||||
AC_PREFIX_DEFAULT(`pwd`/build)
|
AC_PREFIX_DEFAULT(`pwd`/build)
|
||||||
|
|
||||||
|
# Checks for header files.
|
||||||
|
AC_CHECK_HEADERS([fcntl.h limits.h stdint.h stdlib.h string.h sys/ioctl.h unistd.h])
|
||||||
|
|
||||||
|
# Checks for typedefs, structures, and compiler characteristics.
|
||||||
|
AC_HEADER_STDBOOL
|
||||||
|
AC_C_INLINE
|
||||||
|
AC_TYPE_INT16_T
|
||||||
|
AC_TYPE_INT32_T
|
||||||
|
AC_TYPE_INT64_T
|
||||||
|
AC_TYPE_SIZE_T
|
||||||
|
AC_TYPE_SSIZE_T
|
||||||
|
AC_TYPE_UINT16_T
|
||||||
|
AC_TYPE_UINT32_T
|
||||||
|
AC_TYPE_UINT64_T
|
||||||
|
AC_CHECK_TYPES([ptrdiff_t])
|
||||||
|
|
||||||
|
# Checks for library functions.
|
||||||
|
AC_FUNC_MALLOC
|
||||||
|
AC_FUNC_REALLOC
|
||||||
|
AC_CHECK_FUNCS([memmove memset pow strchr strdup strerror strstr])
|
||||||
|
|
||||||
# AC_DEFINE_UNQUOTED (variable, value, [description])
|
# AC_DEFINE_UNQUOTED (variable, value, [description])
|
||||||
# Define the C preprocessor variable variable to value
|
# Define the C preprocessor variable variable to value
|
||||||
@@ -187,6 +181,7 @@ AC_MSG_CHECKING([if debug is enabled])
|
|||||||
if test "X$USE_DEBUG" = "Xyes"; then
|
if test "X$USE_DEBUG" = "Xyes"; then
|
||||||
AC_MSG_RESULT([yes])
|
AC_MSG_RESULT([yes])
|
||||||
CFLAGS="$CFLAGS -g"
|
CFLAGS="$CFLAGS -g"
|
||||||
|
FFLAGS="$FFLAGS -g"
|
||||||
else
|
else
|
||||||
AC_MSG_RESULT([no])
|
AC_MSG_RESULT([no])
|
||||||
fi
|
fi
|
||||||
@@ -196,10 +191,10 @@ AC_MSG_CHECKING([if C interface enabled])
|
|||||||
if test "X$USE_C" = "Xyes"; then
|
if test "X$USE_C" = "Xyes"; then
|
||||||
AC_MSG_RESULT([yes])
|
AC_MSG_RESULT([yes])
|
||||||
BINDINGS="$BINDINGS C"
|
BINDINGS="$BINDINGS C"
|
||||||
LIB_C="../lib/libH5hutC.a"
|
LIB_C="libH5hutC.la"
|
||||||
BUILD_LIBS="$BUILD_LIBS libH5hutC.a"
|
BUILD_LIBS="$BUILD_LIBS libH5hutC"
|
||||||
BUILD_TESTS="$BUILD_TESTS h5u_test h5b_test"
|
BUILD_TESTS="$BUILD_TESTS h5u_test h5b_test"
|
||||||
BUILD_TOOLS="$BUILD_TOOLS h5hutcc"
|
BUILD_TOOLS="$BUILD_TOOLS h5hutcc h5PartDcToVtk h5PartSurfaceToVtk"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
############################ fortran enabled ##################################
|
############################ fortran enabled ##################################
|
||||||
@@ -207,17 +202,18 @@ 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])
|
||||||
BINDINGS="$BINDINGS Fortran"
|
BINDINGS="$BINDINGS Fortran"
|
||||||
LIB_FORTRAN="../lib/libH5hutF.a"
|
LIB_FORTRAN="libH5hutF.la"
|
||||||
BUILD_LIBS="$BUILD_LIBS libH5hutF.a"
|
BUILD_LIBS="$BUILD_LIBS libH5hutF"
|
||||||
|
|
||||||
AC_PROG_FC(pgf90 ifort xlf_r pathf90 g95 g90 ftn gfortran)
|
if test "X$USE_PARALLEL" = "Xyes"; then
|
||||||
if test -z "$FC" ; then
|
AC_PROG_FC(mpif90 mpif77)
|
||||||
AC_MSG_ERROR([Cannot find a fortran compiler!!!])
|
else
|
||||||
exit 1
|
AC_PROG_FC(pgf90 ifort xlf_r pathf90 g95 g90 ftn gfortran)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test ! $uname = "AIX"; then
|
if test -z "$FC" ; then
|
||||||
FFLAGS="${FFLAGS} -fPIC"
|
AC_MSG_ERROR([Cannot find a Fortran compiler!])
|
||||||
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test $FC = "g90"; then
|
if test $FC = "g90"; then
|
||||||
@@ -240,7 +236,7 @@ if test "X$USE_FORTRAN" = "Xyes"; then
|
|||||||
AC_MSG_RESULT([ok])
|
AC_MSG_RESULT([ok])
|
||||||
else
|
else
|
||||||
AC_MSG_RESULT([nok])
|
AC_MSG_RESULT([nok])
|
||||||
AC_MSG_ERROR([Cannot build fortran executables!!!])
|
AC_MSG_ERROR([Cannot determine the symbon convention for Fortran object files!])
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -264,67 +260,8 @@ if test "X$USE_PARALLEL" = "Xyes"; then
|
|||||||
[AC_MSG_RESULT([yes]); r='yes'], [AC_MSG_RESULT([no]); r='no'] )
|
[AC_MSG_RESULT([yes]); r='yes'], [AC_MSG_RESULT([no]); r='no'] )
|
||||||
|
|
||||||
if test "X$r" = "Xno"; then
|
if test "X$r" = "Xno"; then
|
||||||
AC_PATH_PROGS([MPICC], [mpicc mpcc_r], [], [$PATH])
|
AC_MSG_ERROR([MPI wrapper can't compile or link MPI program! Please set the INCLUDE and LIBS variables manually.])
|
||||||
AC_PATH_PROGS([MPICXX], [mpicxx mpcc_r], [], [$PATH])
|
exit 1
|
||||||
if test -z "$MPICC" -o -z "$MPICXX"; then
|
|
||||||
AC_MSG_CHECKING([for MPI root ])
|
|
||||||
AC_MSG_RESULT([])
|
|
||||||
if test -n "$MPIROOT"; then
|
|
||||||
P=${MPIROOT}
|
|
||||||
elif test -n "$MPIHOME"; then
|
|
||||||
P=${MPIHOME}
|
|
||||||
elif test -n "$MPIPATH"; then
|
|
||||||
P=${MPIPATH}
|
|
||||||
else
|
|
||||||
P=''
|
|
||||||
P="$P /usr"
|
|
||||||
P="$P /usr/local"
|
|
||||||
P="$P /usr/local/mpi"
|
|
||||||
P="$P /usr/local/packages/mpi"
|
|
||||||
P="$P /usr/local/mpich2"
|
|
||||||
P="$P /usr/local/mpich"
|
|
||||||
P="$P /opt/xt-mpt/default/mpich2-64/P2"
|
|
||||||
fi
|
|
||||||
PATH_Search MPIROOT "$P" include/mpi.h
|
|
||||||
if test ! -n "$MPIROOT"; then
|
|
||||||
AC_MSG_ERROR([Cannot determine MPI root!!!])
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if test -e "${MPIROOT}/bin/mpicc"; then
|
|
||||||
MPICC=${MPIROOT}/bin/mpicc
|
|
||||||
fi
|
|
||||||
|
|
||||||
if test -e "${MPIROOT}/bin/mpicxx"; then
|
|
||||||
MPICXX=${MPIROOT}/bin/mpicxx
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
if test -z "$MPICC" -o -z "$MPICXX"; then
|
|
||||||
INCLUDES="${INCLUDES} -I${MPIROOT}/include"
|
|
||||||
AC_MSG_CHECKING([for name of MPI lib ])
|
|
||||||
if test -e ${MPIROOT}/lib/libmpi.a; then
|
|
||||||
MPILIB="-L${MPIROOT}/lib -lmpi"
|
|
||||||
elif test -e ${MPIROOT}/lib/libmpi.so; then
|
|
||||||
MPILIB="-L${MPIROOT}/lib -lmpi"
|
|
||||||
elif test -e ${MPIROOT}/lib/libmpich.a; then
|
|
||||||
MPILIB="-L${MPIROOT}/lib -lmpich"
|
|
||||||
elif test -e ${MPIROOT}/lib/libmpich.so; then
|
|
||||||
MPILIB="-L${MPIROOT}/lib -lmpich"
|
|
||||||
else
|
|
||||||
AC_MSG_RESULT([not found])
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
AC_MSG_RESULT([${MPILIB}])
|
|
||||||
fi
|
|
||||||
|
|
||||||
if test -n "$MPICC"; then
|
|
||||||
CC=${MPICC}
|
|
||||||
fi
|
|
||||||
|
|
||||||
if test -n "$MPICXX"; then
|
|
||||||
CXX=${MPICXX}
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
TPTARGET="${TPTARGET} H5PartTestP H5PartAndreasTest Bench"
|
TPTARGET="${TPTARGET} H5PartTestP H5PartAndreasTest Bench"
|
||||||
@@ -333,25 +270,6 @@ if test "X$USE_PARALLEL" = "Xyes"; then
|
|||||||
|
|
||||||
# parallel + fortran
|
# parallel + fortran
|
||||||
if test "X$USE_FORTRAN" = "Xyes"; then
|
if test "X$USE_FORTRAN" = "Xyes"; then
|
||||||
AC_PATH_PROGS([MPIFC], [mpxlf_r mpif90], [], [$PATH])
|
|
||||||
|
|
||||||
if test -z "${MPIFC}" ; then
|
|
||||||
if test -e "${MPIROOT}/bin/mpif90"; then
|
|
||||||
MPIFC=${MPIROOT}/bin/mpif90
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
# if MPIFC empty
|
|
||||||
if test ! -n "$MPIFC"; then
|
|
||||||
AC_MSG_CHECKING([ No MPIFC detected. Setting MPIFC to FC.])
|
|
||||||
MPIFC=$FC
|
|
||||||
AC_MSG_RESULT([MPIFC = $MPIFC])
|
|
||||||
fi
|
|
||||||
|
|
||||||
if test -n "$MPIFC"; then
|
|
||||||
FC=${MPIFC}
|
|
||||||
fi
|
|
||||||
|
|
||||||
TPTARGET="${TPTARGET} H5testFpar"
|
TPTARGET="${TPTARGET} H5testFpar"
|
||||||
TBTARGET="${TBTARGET} H5BlockParTestScalarFieldF"
|
TBTARGET="${TBTARGET} H5BlockParTestScalarFieldF"
|
||||||
fi
|
fi
|
||||||
@@ -374,12 +292,14 @@ 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 "${HDF5PATH}" ; then
|
||||||
|
P=${HDF5PATH}
|
||||||
|
elif 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 "${HDF5_DIR}" ; then
|
||||||
P=${HDF5PATH}
|
P=${HDF5_DIR}
|
||||||
else
|
else
|
||||||
P=''
|
P=''
|
||||||
P="$P /usr"
|
P="$P /usr"
|
||||||
@@ -391,7 +311,7 @@ else
|
|||||||
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 find an HDF5 library!])
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -414,6 +334,10 @@ AC_MSG_CHECKING([for lustre API ])
|
|||||||
AC_MSG_RESULT([])
|
AC_MSG_RESULT([])
|
||||||
if test -n "${LUSTREPATH}"; then
|
if test -n "${LUSTREPATH}"; then
|
||||||
P=${LUSTREPATH}
|
P=${LUSTREPATH}
|
||||||
|
elif test -n "${LUSTREROOT}" ; then
|
||||||
|
P=${LUSTREROOT}
|
||||||
|
elif test -n "${LUSTREHOME}" ; then
|
||||||
|
P=${LUSTREHOME}
|
||||||
elif test -n "${LUSTRE_DIR}" ; then
|
elif test -n "${LUSTRE_DIR}" ; then
|
||||||
P=${LUSTRE_DIR}
|
P=${LUSTRE_DIR}
|
||||||
else
|
else
|
||||||
@@ -435,40 +359,6 @@ fi
|
|||||||
|
|
||||||
LIBS="$LIBS -lz -lm"
|
LIBS="$LIBS -lz -lm"
|
||||||
|
|
||||||
|
|
||||||
###############################################################################
|
|
||||||
################# A SIMPLE WORK AROUND TO USE ENV. VARS #######################
|
|
||||||
###############################################################################
|
|
||||||
|
|
||||||
#if there was an external input for the variable...
|
|
||||||
if test -n "$SAVE_CC"; then
|
|
||||||
CC="$SAVE_CC"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if test -n "$SAVE_CXX"; then
|
|
||||||
CXX="$SAVE_CXX"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if test -n "$SAVE_MPICC"; then
|
|
||||||
MPICC="$SAVE_MPICC"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if test -n "$SAVE_MPICXX"; then
|
|
||||||
MPICXX="$SAVE_MPICXX"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if test -n "$SAVE_MPIFC"; then
|
|
||||||
MPIFC="$SAVE_MPIFC"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if test -n "$SAVE_MPIROOT"; then
|
|
||||||
MPIROOT="$SAVE_MPIROOT"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if test -n "$SAVE_HDF5ROOT"; then
|
|
||||||
HDF5ROOT="$SAVE_HDF5ROOT"
|
|
||||||
fi
|
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
############## EXPORTING VARIABLES & CREATING OUTPUT FILES ####################
|
############## EXPORTING VARIABLES & CREATING OUTPUT FILES ####################
|
||||||
###############################################################################
|
###############################################################################
|
||||||
@@ -479,15 +369,8 @@ fi
|
|||||||
# files with the value that the shell variable variable has when AC_OUTPUT is
|
# files with the value that the shell variable variable has when AC_OUTPUT is
|
||||||
# called. This value of variable should not contain literal newlines. If
|
# called. This value of variable should not contain literal newlines. If
|
||||||
# value is given, in addition assign it to variable.
|
# value is given, in addition assign it to variable.
|
||||||
AC_SUBST(MPIROOT)
|
|
||||||
AC_SUBST(HDF5ROOT)
|
AC_SUBST(HDF5ROOT)
|
||||||
AC_SUBST(LUSTREROOT)
|
AC_SUBST(LUSTREROOT)
|
||||||
AC_SUBST(MPICC)
|
|
||||||
AC_SUBST(MPICXX)
|
|
||||||
AC_SUBST(MPIFC)
|
|
||||||
AC_SUBST(TPTARGET)
|
|
||||||
AC_SUBST(TBTARGET)
|
|
||||||
AC_SUBST(TFTARGET)
|
|
||||||
AC_SUBST(CFLAGS)
|
AC_SUBST(CFLAGS)
|
||||||
AC_SUBST(FFLAGS)
|
AC_SUBST(FFLAGS)
|
||||||
AC_SUBST(INCLUDES)
|
AC_SUBST(INCLUDES)
|
||||||
@@ -526,20 +409,15 @@ AC_MSG_RESULT([Host OS: $host_os])
|
|||||||
AC_MSG_RESULT([Host CPU: $host_cpu])
|
AC_MSG_RESULT([Host CPU: $host_cpu])
|
||||||
AC_MSG_RESULT([Host vendor: $host_vendor])
|
AC_MSG_RESULT([Host vendor: $host_vendor])
|
||||||
AC_MSG_RESULT([Build libraries: $BUILD_LIBS])
|
AC_MSG_RESULT([Build libraries: $BUILD_LIBS])
|
||||||
AC_MSG_RESULT([Build test programs: $TTARGET])
|
AC_MSG_RESULT([Build test programs: $BUILD_TESTS])
|
||||||
AC_MSG_RESULT([Build tools: $BUILD_TOOLS])
|
AC_MSG_RESULT([Build tools: $BUILD_TOOLS])
|
||||||
AC_MSG_RESULT([CC = $CC])
|
AC_MSG_RESULT([CC = $CC])
|
||||||
AC_MSG_RESULT([CXX = $CXX])
|
|
||||||
AC_MSG_RESULT([FC = $FC])
|
AC_MSG_RESULT([FC = $FC])
|
||||||
AC_MSG_RESULT([MPICC = $MPICC])
|
|
||||||
AC_MSG_RESULT([MPICXX = $MPICXX])
|
|
||||||
AC_MSG_RESULT([MPIFC = $MPIFC])
|
|
||||||
AC_MSG_RESULT([CFLAGS = $CFLAGS])
|
AC_MSG_RESULT([CFLAGS = $CFLAGS])
|
||||||
AC_MSG_RESULT([FFLAGS = $FFLAGS])
|
AC_MSG_RESULT([FFLAGS = $FFLAGS])
|
||||||
AC_MSG_RESULT([INCLUDES = $INCLUDES])
|
AC_MSG_RESULT([INCLUDES = $INCLUDES])
|
||||||
AC_MSG_RESULT([LDFLAGS = $LDFLAGS])
|
AC_MSG_RESULT([LDFLAGS = $LDFLAGS])
|
||||||
AC_MSG_RESULT([LIBS = $LIBS])
|
AC_MSG_RESULT([LIBS = $LIBS])
|
||||||
AC_MSG_RESULT([MPIROOT = $MPIROOT])
|
|
||||||
AC_MSG_RESULT([HDF5ROOT = $HDF5ROOT])
|
AC_MSG_RESULT([HDF5ROOT = $HDF5ROOT])
|
||||||
AC_MSG_RESULT([LUSTREROOT = $LUSTREROOT])
|
AC_MSG_RESULT([LUSTREROOT = $LUSTREROOT])
|
||||||
AC_MSG_RESULT([ ])
|
AC_MSG_RESULT([ ])
|
||||||
|
|||||||
+30
-13
@@ -77,7 +77,7 @@ h5_err_t
|
|||||||
H5CloseFile (
|
H5CloseFile (
|
||||||
h5_file_t* const f /*!< file handle */
|
h5_file_t* const f /*!< file handle */
|
||||||
) {
|
) {
|
||||||
H5_API_ENTER1 (h5_err_t, "f=0x%p", f);
|
H5_API_ENTER1 (h5_err_t, "f=%p", f);
|
||||||
H5_API_RETURN (h5_close_file (f));
|
H5_API_RETURN (h5_close_file (f));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -92,10 +92,27 @@ h5_err_t
|
|||||||
H5CheckFile (
|
H5CheckFile (
|
||||||
h5_file_t* const f /*!< file handle */
|
h5_file_t* const f /*!< file handle */
|
||||||
) {
|
) {
|
||||||
H5_API_ENTER1 (h5_err_t, "f=0x%p", f);
|
H5_API_ENTER1 (h5_err_t, "f=%p", f);
|
||||||
H5_API_RETURN (h5_check_filehandle (f));
|
H5_API_RETURN (h5_check_filehandle (f));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
h5_err_t
|
||||||
|
H5FlushStep (
|
||||||
|
h5_file_t* const f /*!< file handle */
|
||||||
|
) {
|
||||||
|
H5_API_ENTER1 (h5_err_t, "f=%p", f);
|
||||||
|
H5_API_RETURN (h5_flush_step (f));
|
||||||
|
}
|
||||||
|
|
||||||
|
h5_err_t
|
||||||
|
H5FlushFile (
|
||||||
|
h5_file_t* const f /*!< file handle */
|
||||||
|
) {
|
||||||
|
H5_API_ENTER1 (h5_err_t, "f=%p", f);
|
||||||
|
H5_API_RETURN (h5_flush_file (f));
|
||||||
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\ingroup h5hut_model
|
\ingroup h5hut_model
|
||||||
|
|
||||||
@@ -113,7 +130,7 @@ H5SetStepNameFormat (
|
|||||||
const h5_int64_t width /*!< Width of the number */
|
const h5_int64_t width /*!< Width of the number */
|
||||||
) {
|
) {
|
||||||
H5_API_ENTER3 (h5_err_t,
|
H5_API_ENTER3 (h5_err_t,
|
||||||
"f=0x%p, name=\"%s\", width=%lld",
|
"f=%p, name=\"%s\", width=%lld",
|
||||||
f, name, (long long) width);
|
f, name, (long long) width);
|
||||||
H5_API_RETURN (h5_set_stepname_fmt (f, name, width));
|
H5_API_RETURN (h5_set_stepname_fmt (f, name, width));
|
||||||
}
|
}
|
||||||
@@ -134,7 +151,7 @@ H5GetStepNameFormat (
|
|||||||
int* width /*!< OUT: Width of the number */
|
int* width /*!< OUT: Width of the number */
|
||||||
) {
|
) {
|
||||||
H5_API_ENTER4 (h5_err_t,
|
H5_API_ENTER4 (h5_err_t,
|
||||||
"f=0x%p, name=0x%p, l_name=%llu, width=0x%p",
|
"f=%p, name=%p, l_name=%llu, width=%p",
|
||||||
f, name, (unsigned long long)l_name, width);
|
f, name, (unsigned long long)l_name, width);
|
||||||
H5_API_RETURN (h5_get_stepname_fmt (f, name, l_name, width));
|
H5_API_RETURN (h5_get_stepname_fmt (f, name, l_name, width));
|
||||||
}
|
}
|
||||||
@@ -151,7 +168,7 @@ H5SetStep (
|
|||||||
h5_file_t* const f, /*!< [in] Handle to open file */
|
h5_file_t* const f, /*!< [in] Handle to open file */
|
||||||
const h5_id_t step /*!< [in] Step to set. */
|
const h5_id_t step /*!< [in] Step to set. */
|
||||||
) {
|
) {
|
||||||
H5_API_ENTER2 (h5_err_t, "f=0x%p, step=%lld", f, (long long)step);
|
H5_API_ENTER2 (h5_err_t, "f=%p, step=%lld", f, (long long)step);
|
||||||
H5_API_RETURN (h5_set_step (f, step));
|
H5_API_RETURN (h5_set_step (f, step));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -166,7 +183,7 @@ h5_id_t
|
|||||||
H5GetStep (
|
H5GetStep (
|
||||||
h5_file_t* const f /*!< Handle to open file */
|
h5_file_t* const f /*!< Handle to open file */
|
||||||
) {
|
) {
|
||||||
H5_API_ENTER1 (h5_err_t, "f=0x%p", f);
|
H5_API_ENTER1 (h5_err_t, "f=%p", f);
|
||||||
H5_API_RETURN (h5_get_step (f));
|
H5_API_RETURN (h5_get_step (f));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -184,7 +201,7 @@ int
|
|||||||
H5GetNumProcs (
|
H5GetNumProcs (
|
||||||
h5_file_t* const f
|
h5_file_t* const f
|
||||||
) {
|
) {
|
||||||
H5_API_ENTER1 (h5_err_t, "f=0x%p", f);
|
H5_API_ENTER1 (h5_err_t, "f=%p", f);
|
||||||
H5_API_RETURN (h5_get_num_procs(f));
|
H5_API_RETURN (h5_get_num_procs(f));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -205,7 +222,7 @@ h5_ssize_t
|
|||||||
H5GetNumSteps (
|
H5GetNumSteps (
|
||||||
h5_file_t* const f
|
h5_file_t* const f
|
||||||
) {
|
) {
|
||||||
H5_API_ENTER1 (h5_err_t, "f=0x%p", f);
|
H5_API_ENTER1 (h5_err_t, "f=%p", f);
|
||||||
H5_API_RETURN (h5_get_num_steps(f));
|
H5_API_RETURN (h5_get_num_steps(f));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -225,7 +242,7 @@ H5HasStep (
|
|||||||
h5_id_t stepno
|
h5_id_t stepno
|
||||||
) {
|
) {
|
||||||
H5_API_ENTER2 (h5_err_t,
|
H5_API_ENTER2 (h5_err_t,
|
||||||
"f=0x%p, stepno=%lld",
|
"f=%p, stepno=%lld",
|
||||||
f,
|
f,
|
||||||
(long long)stepno);
|
(long long)stepno);
|
||||||
H5_API_RETURN (h5_has_step (f, stepno));
|
H5_API_RETURN (h5_has_step (f, stepno));
|
||||||
@@ -242,7 +259,7 @@ h5_err_t
|
|||||||
H5StartTraverseSteps (
|
H5StartTraverseSteps (
|
||||||
h5_file_t* const f /*!< Handle to open file */
|
h5_file_t* const f /*!< Handle to open file */
|
||||||
) {
|
) {
|
||||||
H5_API_ENTER1 (h5_err_t, "f=0x%p", f);
|
H5_API_ENTER1 (h5_err_t, "f=%p", f);
|
||||||
H5_API_RETURN (h5_start_traverse_steps (f));
|
H5_API_RETURN (h5_start_traverse_steps (f));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -257,7 +274,7 @@ h5_err_t
|
|||||||
H5TraverseSteps (
|
H5TraverseSteps (
|
||||||
h5_file_t* const f /*!< Handle to open file */
|
h5_file_t* const f /*!< Handle to open file */
|
||||||
) {
|
) {
|
||||||
H5_API_ENTER1 (h5_err_t, "f=0x%p", f);
|
H5_API_ENTER1 (h5_err_t, "f=%p", f);
|
||||||
H5_API_RETURN (h5_traverse_steps (f));
|
H5_API_RETURN (h5_traverse_steps (f));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -283,7 +300,7 @@ H5SetThrottle (
|
|||||||
h5_file_t* f,
|
h5_file_t* f,
|
||||||
int factor
|
int factor
|
||||||
) {
|
) {
|
||||||
H5_API_ENTER2 (h5_err_t, "f=0x%p, factor=%d", f, factor);
|
H5_API_ENTER2 (h5_err_t, "f=%p, factor=%d", f, factor);
|
||||||
H5_API_RETURN (h5_set_throttle(f, factor));
|
H5_API_RETURN (h5_set_throttle(f, factor));
|
||||||
}
|
}
|
||||||
#endif // PARALLEL_IO
|
#endif // PARALLEL_IO
|
||||||
@@ -314,7 +331,7 @@ h5_err_t
|
|||||||
H5SetErrorHandler (
|
H5SetErrorHandler (
|
||||||
h5_errorhandler_t handler
|
h5_errorhandler_t handler
|
||||||
) {
|
) {
|
||||||
H5_API_ENTER1 (h5_err_t, "handler=0x%p", handler);
|
H5_API_ENTER1 (h5_err_t, "handler=%p", handler);
|
||||||
H5_API_RETURN (h5_set_errorhandler (handler));
|
H5_API_RETURN (h5_set_errorhandler (handler));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,43 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright 2007-2009
|
|
||||||
Paul Scherrer Institut, Villigen, Switzerland;
|
|
||||||
Benedikt Oswald;
|
|
||||||
Achim Gsell
|
|
||||||
All rights reserved.
|
|
||||||
|
|
||||||
Authors
|
|
||||||
Achim Gsell
|
|
||||||
|
|
||||||
Warning
|
|
||||||
This code is under development.
|
|
||||||
|
|
||||||
*/
|
|
||||||
#include "h5core/h5_core.h"
|
|
||||||
#include "H5Fed.h"
|
|
||||||
|
|
||||||
|
|
||||||
h5_err_t
|
|
||||||
H5FedCloseMesh (
|
|
||||||
h5_file_t* const f
|
|
||||||
) {
|
|
||||||
H5_API_ENTER1 (h5_err_t, "f=0x%p", f);
|
|
||||||
H5_API_RETURN (h5t_close_mesh (f));
|
|
||||||
}
|
|
||||||
|
|
||||||
h5_err_t
|
|
||||||
H5FedSetLevel (
|
|
||||||
h5_file_t* const f,
|
|
||||||
const h5t_lvl_idx_t level_id
|
|
||||||
) {
|
|
||||||
H5_API_ENTER2 (h5_err_t, "f=0x%p, level_id=%d", f, level_id);
|
|
||||||
H5_API_RETURN (h5t_set_level (f, level_id));
|
|
||||||
}
|
|
||||||
|
|
||||||
h5_err_t
|
|
||||||
H5FedLinkMeshToStep (
|
|
||||||
h5_file_t* const f,
|
|
||||||
const h5_id_t mesh_id
|
|
||||||
) {
|
|
||||||
H5_API_ENTER2 (h5_err_t, "f=0x%p, mesh_id=%lld", f, (long long)mesh_id);
|
|
||||||
H5_API_RETURN (h5_error_not_implemented ());
|
|
||||||
}
|
|
||||||
@@ -1,46 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright 2006-2010
|
|
||||||
Paul Scherrer Institut, Villigen, Switzerland;
|
|
||||||
Benedikt Oswald;
|
|
||||||
Achim Gsell
|
|
||||||
All rights reserved.
|
|
||||||
|
|
||||||
Authors
|
|
||||||
Achim Gsell
|
|
||||||
|
|
||||||
Warning
|
|
||||||
This code is under development.
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "h5core/h5_core.h"
|
|
||||||
#include "H5Fed.h"
|
|
||||||
|
|
||||||
/****** UPWARD ADJACENCY routines *********************************************/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\return number of upward adjacent edges
|
|
||||||
*/
|
|
||||||
h5_err_t
|
|
||||||
H5FedGetAdjacencies (
|
|
||||||
h5_file_t* const f,
|
|
||||||
const h5_loc_id_t entity_id,
|
|
||||||
const h5_int32_t dim,
|
|
||||||
h5_loc_idlist_t** list
|
|
||||||
) {
|
|
||||||
H5_API_ENTER4 (h5_err_t,
|
|
||||||
"f=0x%p, entity_id=%lld, dim=%d, list=0x%p",
|
|
||||||
f, (long long)entity_id, dim, list);
|
|
||||||
H5_API_RETURN (h5t_get_adjacencies (f, entity_id, dim, list));
|
|
||||||
}
|
|
||||||
|
|
||||||
h5_err_t
|
|
||||||
H5FedReleaseListOfAdjacencies (
|
|
||||||
h5_file_t* const f,
|
|
||||||
h5_loc_idlist_t** list
|
|
||||||
) {
|
|
||||||
H5_API_ENTER2 (h5_err_t,
|
|
||||||
"f=0x%p, list=0x%p",
|
|
||||||
f, list);
|
|
||||||
H5_API_RETURN (h5t_release_list_of_adjacencies (f, list));
|
|
||||||
}
|
|
||||||
@@ -1,154 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright 2007-2008
|
|
||||||
Paul Scherrer Institut, Villigen, Switzerland;
|
|
||||||
Benedikt Oswald;
|
|
||||||
Achim Gsell
|
|
||||||
All rights reserved.
|
|
||||||
|
|
||||||
Authors
|
|
||||||
Achim Gsell
|
|
||||||
|
|
||||||
Warning
|
|
||||||
This code is under development.
|
|
||||||
|
|
||||||
*/
|
|
||||||
/*!
|
|
||||||
\ingroup h5fed_c_api
|
|
||||||
\defgroup h5fed_mesh_inquiry
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "h5core/h5_core.h"
|
|
||||||
#include "H5Fed.h"
|
|
||||||
|
|
||||||
|
|
||||||
/*!
|
|
||||||
Get the number of hierarchical mesh levels.
|
|
||||||
|
|
||||||
\param[in] f File handle
|
|
||||||
|
|
||||||
\return Number of hierarchical mesh levels or error code.
|
|
||||||
*/
|
|
||||||
h5_ssize_t
|
|
||||||
H5FedGetNumLevels (
|
|
||||||
h5_file_t* const f
|
|
||||||
) {
|
|
||||||
H5_API_ENTER1 (h5_ssize_t, "f=0x%p", f);
|
|
||||||
H5_API_RETURN (h5t_get_num_leaf_levels (f));
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
|
||||||
Get current mesh levels.
|
|
||||||
|
|
||||||
\param[in] f File handle
|
|
||||||
|
|
||||||
\return ID of current mesh levels or error code.
|
|
||||||
*/
|
|
||||||
h5t_lvl_idx_t
|
|
||||||
H5FedGetLevel (
|
|
||||||
h5_file_t* const f
|
|
||||||
) {
|
|
||||||
H5_API_ENTER1 (h5t_lvl_idx_t, "f=0x%p", f);
|
|
||||||
H5_API_RETURN (h5t_get_level (f));
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
|
||||||
Returns the number of vertices used for defining the (sub-)mesh
|
|
||||||
at current level on this compute node.
|
|
||||||
|
|
||||||
\param[in] f file handle
|
|
||||||
|
|
||||||
\return Number of vertices or error code.
|
|
||||||
*/
|
|
||||||
h5_ssize_t
|
|
||||||
H5FedGetNumVertices (
|
|
||||||
h5_file_t* const f /*!< file handle */
|
|
||||||
) {
|
|
||||||
H5_API_ENTER1 (h5_ssize_t, "f=0x%p", f);
|
|
||||||
H5_API_RETURN (h5t_get_num_vertices (f, -1));
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
|
||||||
Returns the number of vertices used for defining the (sub-)mesh
|
|
||||||
at current level on compute node \c cnode.
|
|
||||||
|
|
||||||
\param[in] f file handle
|
|
||||||
\param[in] cnode compute node
|
|
||||||
|
|
||||||
\return Number of vertices or error code.
|
|
||||||
*/
|
|
||||||
h5_ssize_t
|
|
||||||
H5FedGetNumVerticesCnode (
|
|
||||||
h5_file_t* const f,
|
|
||||||
const int cnode
|
|
||||||
) {
|
|
||||||
H5_API_ENTER2 (h5_ssize_t, "f=0x%p, cnode=%d", f, cnode);
|
|
||||||
H5_API_RETURN (h5t_get_num_vertices (f, cnode));
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
|
||||||
Returns the number of vertices used for defining the (sub-)mesh
|
|
||||||
at current level overl all compute nodes.
|
|
||||||
|
|
||||||
\param[in] f file handle
|
|
||||||
|
|
||||||
\return Total number of vertices or error code.
|
|
||||||
*/
|
|
||||||
h5_ssize_t
|
|
||||||
H5FedGetNumVerticesTotal (
|
|
||||||
h5_file_t* const f
|
|
||||||
) {
|
|
||||||
H5_API_ENTER1 (h5_ssize_t, "f=0x%p", f);
|
|
||||||
H5_API_RETURN (h5t_get_num_vertices (f, -1));
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
|
||||||
Returns the number of elements present in the (sub-)mesh
|
|
||||||
at current level on this compute node.
|
|
||||||
|
|
||||||
\param[in] f file handle
|
|
||||||
|
|
||||||
\return Number of elements or error code.
|
|
||||||
*/
|
|
||||||
h5_ssize_t
|
|
||||||
H5FedGetNumElements (
|
|
||||||
h5_file_t* const f
|
|
||||||
) {
|
|
||||||
H5_API_ENTER1 (h5_ssize_t, "f=0x%p", f);
|
|
||||||
// MLH: can't use field from opaque h5_file_t!
|
|
||||||
//h5_ssize_t num = h5t_get_num_elems (f, f->myproc);
|
|
||||||
H5_API_RETURN (h5t_get_num_elems (f, -1));
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
|
||||||
Returns the number of elements present in the (sub-)mesh
|
|
||||||
at current level on compute node \c cnode.
|
|
||||||
|
|
||||||
\param[in] f file handle
|
|
||||||
\param[in] cnode Compute node
|
|
||||||
|
|
||||||
\return Number of elements or error code.
|
|
||||||
*/
|
|
||||||
h5_ssize_t
|
|
||||||
H5FedGetNumElementsCnode (
|
|
||||||
h5_file_t* const f,
|
|
||||||
const int cnode
|
|
||||||
) {
|
|
||||||
H5_API_ENTER2 (h5_ssize_t, "f=0x%p, cnode=%d", f, cnode);
|
|
||||||
H5_API_RETURN (h5t_get_num_elems (f, cnode));
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
|
||||||
Returns the number of elements present in the mesh
|
|
||||||
at current level over all compute nodes.
|
|
||||||
|
|
||||||
\param[in] f File handle.
|
|
||||||
|
|
||||||
\return Number of elements or error code.
|
|
||||||
*/
|
|
||||||
h5_ssize_t
|
|
||||||
H5FedGetNumElementsTotal (
|
|
||||||
h5_file_t* const f
|
|
||||||
) {
|
|
||||||
H5_API_ENTER1 (h5_ssize_t, "f=0x%p", f);
|
|
||||||
H5_API_RETURN (h5t_get_num_elems (f, -1));
|
|
||||||
}
|
|
||||||
@@ -1,176 +0,0 @@
|
|||||||
/****** RETRIEVAL routines **************************************************/
|
|
||||||
/*
|
|
||||||
Copyright 2007-2008
|
|
||||||
Paul Scherrer Institut, Villigen, Switzerland;
|
|
||||||
Benedikt Oswald;
|
|
||||||
Achim Gsell
|
|
||||||
All rights reserved.
|
|
||||||
|
|
||||||
Authors
|
|
||||||
Achim Gsell
|
|
||||||
|
|
||||||
Warning
|
|
||||||
This code is under development.
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "h5core/h5_core.h"
|
|
||||||
#include "H5Fed.h"
|
|
||||||
|
|
||||||
/*!
|
|
||||||
Begin traverse over all entities on this compute node.
|
|
||||||
Initialize internal data structures.
|
|
||||||
|
|
||||||
\remark
|
|
||||||
Entities might be on processor boundaries! Therefore the same entity might be
|
|
||||||
processed on several compute nodes.
|
|
||||||
|
|
||||||
\param[in] f file handle
|
|
||||||
\param[in] codim co-dimension of entity to traverse
|
|
||||||
|
|
||||||
\return H5_SUCCESS or error code
|
|
||||||
*/
|
|
||||||
|
|
||||||
h5t_iterator_p
|
|
||||||
H5FedBeginTraverseEntities (
|
|
||||||
h5_file_t* const f,
|
|
||||||
const int codim
|
|
||||||
) {
|
|
||||||
H5_API_ENTER2 (h5t_iterator_p, "f=0x%p, codim=%d", f, codim);
|
|
||||||
h5t_iterator_p iter;
|
|
||||||
TRY2 (iter = h5_calloc (1, sizeof (*iter)));
|
|
||||||
TRY2 (h5t_init_leaf_iterator (f, iter, codim));
|
|
||||||
H5_API_RETURN (iter);
|
|
||||||
}
|
|
||||||
|
|
||||||
h5t_iterator_p
|
|
||||||
H5FedBeginTraverseBoundaryFaces (
|
|
||||||
h5_file_t* const f,
|
|
||||||
const int codim
|
|
||||||
) {
|
|
||||||
H5_API_ENTER2 (h5t_iterator_p, "f=0x%p, codim=%d", f, codim);
|
|
||||||
h5t_iterator_p iter;
|
|
||||||
TRY2 (iter = h5_calloc (1, sizeof (*iter)));
|
|
||||||
TRY2 (h5t_init_boundary_face_iterator (f, iter, codim));
|
|
||||||
H5_API_RETURN (iter);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
|
||||||
Get next local entity ID.
|
|
||||||
|
|
||||||
\param[in] f file handle
|
|
||||||
\param[in/out] iter iterator
|
|
||||||
|
|
||||||
\return Local entity ID
|
|
||||||
\return -1, if done
|
|
||||||
\return error code on error
|
|
||||||
*/
|
|
||||||
h5_loc_id_t
|
|
||||||
H5FedTraverseEntities (
|
|
||||||
h5_file_t* const f,
|
|
||||||
h5t_iterator_t* iter
|
|
||||||
) {
|
|
||||||
H5_API_ENTER2 (h5_loc_id_t, "f=0x%p, iter=0x%p", f, iter);
|
|
||||||
H5_API_RETURN (h5t_iterate_entities (f, iter));
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
|
||||||
End of traversing. Release internal data structures.
|
|
||||||
|
|
||||||
\param[in] f File handle
|
|
||||||
|
|
||||||
\return H5_SUCCESS or error code
|
|
||||||
|
|
||||||
*/
|
|
||||||
h5_err_t
|
|
||||||
H5FedEndTraverseEntities (
|
|
||||||
h5_file_t* const f,
|
|
||||||
h5t_iterator_t* iter
|
|
||||||
) {
|
|
||||||
H5_API_ENTER2 (h5_err_t, "f=0x%p, iter=0x%p", f, iter);
|
|
||||||
H5_API_RETURN (h5t_release_entity_iterator (f, iter));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*!
|
|
||||||
Get coordinates of vertex given by local index
|
|
||||||
|
|
||||||
\param[in] f file handle
|
|
||||||
\param[in] vertex_idx local index of vertex
|
|
||||||
\param[out] P 3-dimensional coordinates
|
|
||||||
|
|
||||||
\return H5_SUCCESS or error code
|
|
||||||
*/
|
|
||||||
h5_err_t
|
|
||||||
H5FedGetVertexCoordsByIndex (
|
|
||||||
h5_file_t* const f,
|
|
||||||
h5_loc_idx_t vertex_index,
|
|
||||||
h5_float64_t P[3]
|
|
||||||
) {
|
|
||||||
H5_API_ENTER3 (h5_err_t,
|
|
||||||
"f=0x%p, vertex_index=%lld, P=0x%p",
|
|
||||||
f, (long long)vertex_index, P);
|
|
||||||
H5_API_RETURN (h5t_get_vertex_coords_by_index (f, vertex_index, P));
|
|
||||||
}
|
|
||||||
|
|
||||||
h5_err_t
|
|
||||||
H5FedGetVertexCoordsByID (
|
|
||||||
h5_file_t* const f,
|
|
||||||
h5_loc_id_t vertex_id,
|
|
||||||
h5_float64_t P[3]
|
|
||||||
) {
|
|
||||||
H5_API_ENTER3 (h5_err_t,
|
|
||||||
"f=0x%p, vertex_id=%lld, P=0x%p",
|
|
||||||
f, (long long)vertex_id, P);
|
|
||||||
H5_API_RETURN (h5t_get_vertex_coords_by_id (f, vertex_id, P));
|
|
||||||
}
|
|
||||||
|
|
||||||
h5_err_t
|
|
||||||
H5FedGetVertexIndicesOfEdge (
|
|
||||||
h5_file_t* const f,
|
|
||||||
h5_loc_id_t entity_id,
|
|
||||||
h5_loc_idx_t* vertex_indices
|
|
||||||
) {
|
|
||||||
H5_API_ENTER3 (h5_err_t,
|
|
||||||
"f=0x%p, entity_id=%lld, vertex_indices=0x%p",
|
|
||||||
f, (long long)entity_id, vertex_indices);
|
|
||||||
H5_API_RETURN (h5t_get_vertex_indices_of_edge (f, entity_id, vertex_indices));
|
|
||||||
}
|
|
||||||
|
|
||||||
h5_err_t
|
|
||||||
H5FedGetVertexIndicesOfTriangle (
|
|
||||||
h5_file_t* const f,
|
|
||||||
h5_loc_id_t entity_id,
|
|
||||||
h5_loc_idx_t* vertex_indices
|
|
||||||
) {
|
|
||||||
H5_API_ENTER3 (h5_err_t,
|
|
||||||
"f=0x%p, entity_id=%lld, vertex_indices=0x%p",
|
|
||||||
f, (long long)entity_id, vertex_indices);
|
|
||||||
H5_API_RETURN (h5t_get_vertex_indices_of_triangle (f, entity_id, vertex_indices));
|
|
||||||
}
|
|
||||||
|
|
||||||
h5_err_t
|
|
||||||
H5FedGetVertexIndicesOfTet (
|
|
||||||
h5_file_t* const f,
|
|
||||||
h5_loc_id_t entity_id,
|
|
||||||
h5_loc_idx_t* vertex_indices
|
|
||||||
) {
|
|
||||||
H5_API_ENTER3 (h5_err_t,
|
|
||||||
"f=0x%p, entity_id=%lld, vertex_indices=0x%p",
|
|
||||||
f, (long long)entity_id, vertex_indices);
|
|
||||||
H5_API_RETURN (h5t_get_vertex_indices_of_tet (f, entity_id, vertex_indices));
|
|
||||||
}
|
|
||||||
|
|
||||||
h5_err_t
|
|
||||||
H5FedGetVertexIndicesOfEntity (
|
|
||||||
h5_file_t* const f,
|
|
||||||
h5_loc_id_t entity_id,
|
|
||||||
h5_loc_idx_t* vertex_indices
|
|
||||||
) {
|
|
||||||
H5_API_ENTER3 (h5_err_t,
|
|
||||||
"f=0x%p, entity_id=%lld, vertex_indices=0x%p",
|
|
||||||
f, (long long)entity_id, vertex_indices);
|
|
||||||
H5_API_RETURN (h5t_get_vertex_indices_of_entity (f, entity_id, vertex_indices));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,168 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright 2007-2008
|
|
||||||
Paul Scherrer Institut, Villigen, Switzerland;
|
|
||||||
Benedikt Oswald;
|
|
||||||
Achim Gsell
|
|
||||||
All rights reserved.
|
|
||||||
|
|
||||||
Authors
|
|
||||||
Achim Gsell
|
|
||||||
|
|
||||||
Warning
|
|
||||||
This code is under development.
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "h5core/h5_core.h"
|
|
||||||
#include "H5Fed.h"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\ingroup h5fed_c_api
|
|
||||||
|
|
||||||
Add a new level with \c num_elems elements. The number of elements must be the
|
|
||||||
real number of elements to add the level. If you want to refine \c n tetrahedra
|
|
||||||
\c n*8 elements must be added.
|
|
||||||
|
|
||||||
\param[in] f File handle.
|
|
||||||
\param[in] num_elems_to_refine Number of elements which will be refined.
|
|
||||||
|
|
||||||
\return ID of new level.
|
|
||||||
|
|
||||||
\note
|
|
||||||
values for f->t.num_levels:
|
|
||||||
\c -1 unknown: after opening the file. This is equivalent to
|
|
||||||
"topological data has not been initialized".
|
|
||||||
\c 0 no levels: HDF5 group for meshes may already exist but must not!
|
|
||||||
\c > 0 number of mesh levels
|
|
||||||
|
|
||||||
*/
|
|
||||||
h5t_lvl_idx_t
|
|
||||||
H5FedAddLevel (
|
|
||||||
h5_file_t* const f
|
|
||||||
) {
|
|
||||||
H5_API_ENTER1 (h5t_lvl_idx_t, "f=0x%p", f);
|
|
||||||
H5_API_RETURN (h5t_add_level (f));
|
|
||||||
}
|
|
||||||
|
|
||||||
h5_err_t
|
|
||||||
H5FedBeginStoreVertices (
|
|
||||||
h5_file_t* const f,
|
|
||||||
const h5_size_t num
|
|
||||||
) {
|
|
||||||
H5_API_ENTER2 (h5_err_t,
|
|
||||||
"f=0x%p, num=%llu",
|
|
||||||
f, (long long unsigned)num);
|
|
||||||
H5_API_RETURN (h5t_begin_store_vertices (f, num));
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\ingroup h5fed_c_api
|
|
||||||
|
|
||||||
Stores the the coordinates of a specific vertex at level \c level
|
|
||||||
with id \c vertex_id of the tetrahedral mesh.
|
|
||||||
|
|
||||||
\return local vertex id on success
|
|
||||||
\return errno on error
|
|
||||||
*/
|
|
||||||
h5_loc_idx_t
|
|
||||||
H5FedStoreVertex (
|
|
||||||
h5_file_t* const f, /*!< file handle */
|
|
||||||
const h5_glb_id_t vertex_id, /*!< id from mesher or -1 */
|
|
||||||
const h5_float64_t P[3] /*!< coordinates */
|
|
||||||
) {
|
|
||||||
H5_API_ENTER3 (h5_loc_idx_t,
|
|
||||||
"f=0x%p, vertex_id=%lld, P=0x%p",
|
|
||||||
f, (long long)vertex_id, P);
|
|
||||||
if (h5t_get_level (f) != 0) {
|
|
||||||
H5_API_LEAVE (
|
|
||||||
h5_error (
|
|
||||||
H5_ERR_INVAL,
|
|
||||||
"Vertices can be added to level 0 only!"));
|
|
||||||
}
|
|
||||||
H5_API_RETURN (h5t_store_vertex (f, vertex_id, P));
|
|
||||||
}
|
|
||||||
|
|
||||||
h5_err_t
|
|
||||||
H5FedEndStoreVertices (
|
|
||||||
h5_file_t* const f
|
|
||||||
) {
|
|
||||||
H5_API_ENTER1 (h5_err_t, "f=0x%p", f);
|
|
||||||
H5_API_RETURN (h5t_end_store_vertices (f));
|
|
||||||
}
|
|
||||||
|
|
||||||
h5_err_t
|
|
||||||
H5FedBeginStoreElements (
|
|
||||||
h5_file_t* const f,
|
|
||||||
const h5_size_t num
|
|
||||||
) {
|
|
||||||
H5_API_ENTER2 (h5_err_t,
|
|
||||||
"f=0x%p, num=%llu",
|
|
||||||
f, (long long unsigned)num);
|
|
||||||
H5_API_RETURN (h5t_begin_store_elems (f, num));
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\ingroup h5fed_c_api
|
|
||||||
|
|
||||||
Stores the 4-tuple, that contains the specific indices describing
|
|
||||||
a tetrahedron with id \c tet_id at level \c level of the tetrahedral
|
|
||||||
mesh.
|
|
||||||
|
|
||||||
Errors:
|
|
||||||
* current level not yet defined
|
|
||||||
* to many tets stored on level
|
|
||||||
|
|
||||||
\return local tetrahedron id
|
|
||||||
\return \c errno on error
|
|
||||||
*/
|
|
||||||
h5_loc_idx_t
|
|
||||||
H5FedStoreElement (
|
|
||||||
h5_file_t* const f, /*!< file handle */
|
|
||||||
const h5_loc_idx_t local_vids[] /*!< tuple with vertex id's */
|
|
||||||
) {
|
|
||||||
H5_API_ENTER2 (h5_loc_idx_t, "f=0x%p, local_vids=0x%p", f, local_vids);
|
|
||||||
if (h5t_get_level (f) != 0) {
|
|
||||||
H5_API_LEAVE (
|
|
||||||
h5_error (
|
|
||||||
H5_ERR_INVAL,
|
|
||||||
"Elements can be added to level 0 only!"));
|
|
||||||
}
|
|
||||||
H5_API_RETURN (h5t_store_elem (f, -1, local_vids));
|
|
||||||
}
|
|
||||||
|
|
||||||
h5_err_t
|
|
||||||
H5FedEndStoreElements (
|
|
||||||
h5_file_t* const f
|
|
||||||
) {
|
|
||||||
H5_API_ENTER1 (h5_err_t, "f=0x%p", f);
|
|
||||||
H5_API_RETURN (h5t_end_store_elems (f));
|
|
||||||
}
|
|
||||||
|
|
||||||
h5_err_t
|
|
||||||
H5FedBeginRefineElements (
|
|
||||||
h5_file_t* const f
|
|
||||||
) {
|
|
||||||
H5_API_ENTER1 (h5_err_t, "f=0x%p", f);
|
|
||||||
H5_API_RETURN (h5t_begin_refine_elems (f));
|
|
||||||
}
|
|
||||||
|
|
||||||
h5_loc_idx_t
|
|
||||||
H5FedRefineElement (
|
|
||||||
h5_file_t* const f, /*!< file handle */
|
|
||||||
const h5_loc_id_t local_eid /*!< local element id */
|
|
||||||
) {
|
|
||||||
H5_API_ENTER2 (h5_loc_idx_t,
|
|
||||||
"f=0x%p, local_eid=%lld",
|
|
||||||
f, (long long)local_eid);
|
|
||||||
H5_API_RETURN (h5t_mark_entity (f, local_eid));
|
|
||||||
}
|
|
||||||
|
|
||||||
h5_err_t
|
|
||||||
H5FedEndRefineElements (
|
|
||||||
h5_file_t* const f
|
|
||||||
) {
|
|
||||||
H5_API_ENTER1 (h5_err_t, "f=0x%p", f);
|
|
||||||
H5_API_RETURN (h5t_end_refine_elems (f));
|
|
||||||
}
|
|
||||||
@@ -1,154 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright 2007-2011
|
|
||||||
Paul Scherrer Institut, Villigen, Switzerland;
|
|
||||||
Achim Gsell
|
|
||||||
All rights reserved.
|
|
||||||
|
|
||||||
Authors
|
|
||||||
Achim Gsell
|
|
||||||
|
|
||||||
Warning
|
|
||||||
This code is under development.
|
|
||||||
|
|
||||||
*/
|
|
||||||
#include "h5core/h5_core.h"
|
|
||||||
#include "H5Fed.h"
|
|
||||||
|
|
||||||
/*!
|
|
||||||
Add a tagset to the current mesh.
|
|
||||||
|
|
||||||
\param[in] f file handle
|
|
||||||
\param[in] name name of tagset
|
|
||||||
\param[in] type data type of tagset
|
|
||||||
|
|
||||||
\return H5_SUCCESS or error code
|
|
||||||
*/
|
|
||||||
h5_err_t
|
|
||||||
H5FedAddMTagset (
|
|
||||||
h5_file_t* const f,
|
|
||||||
char* name,
|
|
||||||
h5_id_t type
|
|
||||||
) {
|
|
||||||
H5_API_ENTER3 (h5_err_t, "f=0x%p, name=\"%s\", type=%lld",
|
|
||||||
f, name, (long long)type);
|
|
||||||
H5_API_RETURN (h5t_add_mtagset (f, name, type));
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
|
||||||
Remove a tagset from the current mesh.
|
|
||||||
|
|
||||||
\param[in] f file handle
|
|
||||||
\param[in] name name of tagset to remove
|
|
||||||
|
|
||||||
\return H5_SUCCESS or error code
|
|
||||||
*/
|
|
||||||
h5_err_t
|
|
||||||
H5FedRemoveMTagset (
|
|
||||||
h5_file_t* const f,
|
|
||||||
char name[]
|
|
||||||
) {
|
|
||||||
H5_API_ENTER2 (h5_err_t, "f=0x%p, name=\"%s\"", f, name);
|
|
||||||
H5_API_RETURN (h5t_remove_mtagset (f, name));
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
|
||||||
Get available tagsets in current mesh.
|
|
||||||
|
|
||||||
\param[in] f file handle
|
|
||||||
\param[out] names names of available tagsets
|
|
||||||
|
|
||||||
\return Number of tagsets or error code
|
|
||||||
*/
|
|
||||||
h5_ssize_t
|
|
||||||
H5FedGetMTagsets (
|
|
||||||
h5_file_t* const f,
|
|
||||||
char** names[]
|
|
||||||
) {
|
|
||||||
H5_API_ENTER2 (h5_ssize_t, "f=0x%p, names=0x%p", f, names);
|
|
||||||
H5_API_RETURN (h5t_get_mtagsets (f, names));
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
|
||||||
Get type of tagset in current mesh.
|
|
||||||
|
|
||||||
\param[in] f file handle
|
|
||||||
\param[in] name name of tagset
|
|
||||||
|
|
||||||
\return H5_SUCCESS or error code
|
|
||||||
*/
|
|
||||||
h5_id_t
|
|
||||||
H5FedGetTypeOfMTagset (
|
|
||||||
h5_file_t* const f,
|
|
||||||
char name[]
|
|
||||||
) {
|
|
||||||
H5_API_ENTER2 (h5_err_t, "f=0x%p, name=\"%s\"", f, name);
|
|
||||||
H5_API_RETURN (h5t_get_mtagset_type_by_name (f, name));
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
|
||||||
Set tag for entity in current mesh.
|
|
||||||
|
|
||||||
\param[in] f file handle
|
|
||||||
\param[in] name names of tagset
|
|
||||||
\param[in] id id of entity
|
|
||||||
\param[in] dim dimension of value
|
|
||||||
\param[in] val tag value
|
|
||||||
|
|
||||||
\return H5_SUCCESS or error code
|
|
||||||
*/
|
|
||||||
h5_err_t
|
|
||||||
H5FedSetMTag (
|
|
||||||
h5_file_t* const f,
|
|
||||||
char name[],
|
|
||||||
h5_loc_id_t id,
|
|
||||||
const size_t dim,
|
|
||||||
void* buffer
|
|
||||||
) {
|
|
||||||
H5_API_ENTER5 (h5_err_t,
|
|
||||||
"f=0x%p, name=\"%s\", id=%lld, dim=%lld, val=0x%p",
|
|
||||||
f, name, (long long)id, (long long)dim, buffer);
|
|
||||||
H5_API_RETURN (h5t_set_mtag_by_name (f, name, id, dim, buffer));
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
|
||||||
Set tag for entity in current mesh.
|
|
||||||
|
|
||||||
\param[in] f file handle
|
|
||||||
\param[in] name names of tagset
|
|
||||||
\param[in] id id of entity
|
|
||||||
\param[out] dim dimension of value
|
|
||||||
\param[out] val tag value
|
|
||||||
|
|
||||||
\return H5_SUCCESS or error code
|
|
||||||
*/
|
|
||||||
h5_err_t
|
|
||||||
H5FedGetMTag (
|
|
||||||
h5_file_t* const f,
|
|
||||||
const char name[],
|
|
||||||
const h5_loc_id_t id,
|
|
||||||
size_t* dim,
|
|
||||||
void* buffer
|
|
||||||
) {
|
|
||||||
H5_API_ENTER5 (h5_err_t,
|
|
||||||
"f=0x%p, name=\"%s\", id=%lld, dim=0x%p, val=0x%p",
|
|
||||||
f, name, (long long)id, dim, buffer);
|
|
||||||
H5_API_RETURN (h5t_get_mtag_by_name (f, name, id, dim, buffer));
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
|
||||||
Remove tag for entity in current mesh.
|
|
||||||
|
|
||||||
\param[in] f file handle
|
|
||||||
\param[in] name names of tagset
|
|
||||||
\param[in] id id of entity
|
|
||||||
*/
|
|
||||||
h5_err_t
|
|
||||||
H5FedRemoveMTag (
|
|
||||||
h5_file_t* const f,
|
|
||||||
const char name[],
|
|
||||||
const h5_loc_id_t id
|
|
||||||
) {
|
|
||||||
H5_API_ENTER3 (h5_err_t, "f=0x%p, name=\"%s\", id=%lld",
|
|
||||||
f, name, (long long)id);
|
|
||||||
H5_API_RETURN (h5t_remove_mtag_by_name (f, name, id));
|
|
||||||
}
|
|
||||||
+7
-13
@@ -2,14 +2,13 @@
|
|||||||
|
|
||||||
OBJEXT=o
|
OBJEXT=o
|
||||||
|
|
||||||
LIBS = @LIBS@
|
|
||||||
INCLUDES = -I../include @INCLUDES@
|
INCLUDES = -I../include @INCLUDES@
|
||||||
|
|
||||||
# What to build... Will be determined by configure script.
|
# What to build... Will be determined by configure script.
|
||||||
lib_LIBRARIES = @LIB_C@
|
lib_LTLIBRARIES = @LIB_C@
|
||||||
|
|
||||||
# Listing of all possible targets that I may build.
|
# Listing of all possible targets that I may build.
|
||||||
EXTRA_LIBRARIES = ../lib/libH5hutC.a
|
EXTRA_LTLIBRARIES = libH5hutC.la
|
||||||
|
|
||||||
# Header files that I wish to install in $(prefix)/include
|
# Header files that I wish to install in $(prefix)/include
|
||||||
include_HEADERS = \
|
include_HEADERS = \
|
||||||
@@ -31,21 +30,16 @@ include_HEADERS = \
|
|||||||
EXTRA_HEADERS =
|
EXTRA_HEADERS =
|
||||||
|
|
||||||
# Listing of sources
|
# Listing of sources
|
||||||
___lib_libH5hutC_a_SOURCES = \
|
libH5hutC_la_SOURCES = \
|
||||||
H5.c \
|
H5.c \
|
||||||
H5_attribs.c \
|
H5_attribs.c \
|
||||||
H5_attachments.c \
|
H5_attachments.c \
|
||||||
H5Part.c \
|
H5Part.c \
|
||||||
H5Block.c \
|
H5Block.c \
|
||||||
H5Block_readwrite.c \
|
H5Block_readwrite.c
|
||||||
H5Fed.c \
|
|
||||||
H5Fed_adjacency.c \
|
|
||||||
H5Fed_inquiry.c \
|
|
||||||
H5Fed_retrieve.c \
|
|
||||||
H5Fed_store.c \
|
|
||||||
H5Fed_tags.c
|
|
||||||
|
|
||||||
all: all-am
|
libH5hutC_la_LDFLAGS = -version-info 2:0:0 -rpath '$(libdir)'
|
||||||
|
|
||||||
clean: clean-am
|
all-local:
|
||||||
|
$(INSTALL) -m644 .libs/libH5hutC.a ../lib
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
OBJEXT=o
|
OBJEXT=o
|
||||||
|
|
||||||
LIBS = @LIBS@
|
|
||||||
INCLUDES = -I../include @INCLUDES@
|
INCLUDES = -I../include @INCLUDES@
|
||||||
|
|
||||||
F90_FILES = H5.f90 \
|
F90_FILES = H5.f90 \
|
||||||
@@ -23,19 +22,21 @@ EXTRA_DIST = TestUnderscoreC.c \
|
|||||||
nodist_include_HEADERS = ../include/H5hutF.h
|
nodist_include_HEADERS = ../include/H5hutF.h
|
||||||
|
|
||||||
# What to build... Will be determined by configure script.
|
# What to build... Will be determined by configure script.
|
||||||
lib_LIBRARIES = @LIB_FORTRAN@
|
lib_LTLIBRARIES = @LIB_FORTRAN@
|
||||||
|
|
||||||
# Listing of all possible targets that I may build.
|
# Listing of all possible targets that I may build.
|
||||||
EXTRA_LIBRARIES = ../lib/libH5hutF.a
|
EXTRA_LTLIBRARIES = libH5hutF.la
|
||||||
|
|
||||||
___lib_libH5hutF_a_SOURCES = \
|
libH5hutF_la_SOURCES = \
|
||||||
H5_F.c \
|
H5_F.c \
|
||||||
H5_attribs_F.c \
|
H5_attribs_F.c \
|
||||||
H5Part_F.c \
|
H5Part_F.c \
|
||||||
H5Block_F.c \
|
H5Block_F.c \
|
||||||
H5Block_readwrite_F.c
|
H5Block_readwrite_F.c
|
||||||
|
|
||||||
___lib_libH5hutF_a_DEPENDENCIES = ../include/H5hutF.h
|
libH5hutF_la_DEPENDENCIES = ../include/H5hutF.h
|
||||||
|
|
||||||
|
libH5hutF_la_LDFLAGS = -version-info 2:0:0 -rpath '$(libdir)'
|
||||||
|
|
||||||
../include/H5hutF.h: $(F90_FILES)
|
../include/H5hutF.h: $(F90_FILES)
|
||||||
awk '/INTEGER\*8 FUNCTION/{print "\t" $$1 " " $$3}' $^ >$@
|
awk '/INTEGER\*8 FUNCTION/{print "\t" $$1 " " $$3}' $^ >$@
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
OBJEXT=o
|
OBJEXT=o
|
||||||
|
|
||||||
LIBS = @LIBS@
|
|
||||||
INCLUDES = -I../include @INCLUDES@
|
INCLUDES = -I../include @INCLUDES@
|
||||||
|
|
||||||
EXTRA_HEADERS = \
|
EXTRA_HEADERS = \
|
||||||
@@ -69,13 +68,10 @@ EXTRA_HEADERS = \
|
|||||||
EXTRA_DIST = $(EXTRA_HEADERS)
|
EXTRA_DIST = $(EXTRA_HEADERS)
|
||||||
|
|
||||||
# What to build... Will be determined by configure script.
|
# What to build... Will be determined by configure script.
|
||||||
lib_LIBRARIES = ../lib/libH5hut.a
|
lib_LTLIBRARIES = libH5hut.la
|
||||||
|
|
||||||
# Listing of all possible targets that I may build.
|
|
||||||
EXTRA_LIBRARIES = ../lib/libH5hut.a
|
|
||||||
|
|
||||||
# Listing of sources
|
# Listing of sources
|
||||||
___lib_libH5hut_a_SOURCES = \
|
libH5hut_la_SOURCES = \
|
||||||
h5_attach.c \
|
h5_attach.c \
|
||||||
h5_attribs.c \
|
h5_attribs.c \
|
||||||
h5_errorhandling.c \
|
h5_errorhandling.c \
|
||||||
@@ -118,13 +114,17 @@ ___lib_libH5hut_a_SOURCES = \
|
|||||||
h5t_store_trim.c \
|
h5t_store_trim.c \
|
||||||
h5t_tags.c
|
h5t_tags.c
|
||||||
|
|
||||||
___lib_libH5hut_a_DEPENDENCIES = $(EXTRA_HEADERS)
|
libH5hut_la_DEPENDENCIES = $(EXTRA_HEADERS)
|
||||||
|
|
||||||
all: all-am
|
libH5hut_la_LDFLAGS = -version-info 2:0:0
|
||||||
|
|
||||||
|
all-local:
|
||||||
|
$(INSTALL) -m644 .libs/libH5hut.a ../lib
|
||||||
|
|
||||||
install-exec-local:
|
install-exec-local:
|
||||||
@$(INSTALL) -d $(DESTDIR)$(includedir)/h5core
|
@$(INSTALL) -d $(DESTDIR)$(includedir)/h5core
|
||||||
@$(INSTALL) -m644 ../include/h5core/*.h $(DESTDIR)$(includedir)/h5core/
|
@$(INSTALL) -m644 ../include/h5core/*.h $(DESTDIR)$(includedir)/h5core/
|
||||||
|
|
||||||
clean: clean-am
|
clean-local:
|
||||||
|
$(RM) -f ../lib/libH5hut.*
|
||||||
|
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ h5_read_attrib (
|
|||||||
|
|
||||||
if (mode != H5_ATTRIB_FILE) CHECK_TIMEGROUP( f );
|
if (mode != H5_ATTRIB_FILE) CHECK_TIMEGROUP( f );
|
||||||
|
|
||||||
hid_t id;
|
hid_t id = 0;
|
||||||
TRY (get_hdf5_obj_id(f, mode, &id));
|
TRY (get_hdf5_obj_id(f, mode, &id));
|
||||||
TRY (h5priv_read_attrib (id, attrib_name, attrib_type, attrib_value));
|
TRY (h5priv_read_attrib (id, attrib_name, attrib_type, attrib_value));
|
||||||
H5_CORE_API_RETURN (H5_SUCCESS);
|
H5_CORE_API_RETURN (H5_SUCCESS);
|
||||||
@@ -161,7 +161,7 @@ h5_write_attrib (
|
|||||||
if (mode != H5_ATTRIB_FILE) CHECK_TIMEGROUP( f );
|
if (mode != H5_ATTRIB_FILE) CHECK_TIMEGROUP( f );
|
||||||
CHECK_WRITABLE_MODE( f );
|
CHECK_WRITABLE_MODE( f );
|
||||||
|
|
||||||
hid_t id;
|
hid_t id = 0;
|
||||||
TRY (get_hdf5_obj_id(f, mode, &id));
|
TRY (get_hdf5_obj_id(f, mode, &id));
|
||||||
TRY (h5priv_write_attrib (id, attrib_name, attrib_type,
|
TRY (h5priv_write_attrib (id, attrib_name, attrib_type,
|
||||||
attrib_value, attrib_nelem));
|
attrib_value, attrib_nelem));
|
||||||
@@ -245,7 +245,7 @@ h5_get_attrib_info (
|
|||||||
|
|
||||||
if (mode != H5_ATTRIB_FILE) CHECK_TIMEGROUP( f );
|
if (mode != H5_ATTRIB_FILE) CHECK_TIMEGROUP( f );
|
||||||
|
|
||||||
hid_t id;
|
hid_t id = 0;
|
||||||
TRY (get_hdf5_obj_id(f, mode, &id));
|
TRY (get_hdf5_obj_id(f, mode, &id));
|
||||||
TRY (h5priv_get_attrib_info (id, attrib_idx, attrib_name, len_attrib_name,
|
TRY (h5priv_get_attrib_info (id, attrib_idx, attrib_name, len_attrib_name,
|
||||||
attrib_type, attrib_nelem));
|
attrib_type, attrib_nelem));
|
||||||
@@ -267,7 +267,7 @@ h5_get_num_attribs (
|
|||||||
H5_CORE_API_ENTER2 (h5_ssize_t,
|
H5_CORE_API_ENTER2 (h5_ssize_t,
|
||||||
"f=%p, mode=%d", f, mode);
|
"f=%p, mode=%d", f, mode);
|
||||||
if (mode != H5_ATTRIB_FILE) CHECK_TIMEGROUP( f );
|
if (mode != H5_ATTRIB_FILE) CHECK_TIMEGROUP( f );
|
||||||
hid_t id;
|
hid_t id = 0;
|
||||||
TRY (get_hdf5_obj_id(f, mode, &id));
|
TRY (get_hdf5_obj_id(f, mode, &id));
|
||||||
H5_CORE_API_RETURN (hdf5_get_num_attribute (id));
|
H5_CORE_API_RETURN (hdf5_get_num_attribute (id));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -81,6 +81,22 @@
|
|||||||
#define MALLOC_WRAPPER_LEAVE(value) __FUNC_LEAVE(value)
|
#define MALLOC_WRAPPER_LEAVE(value) __FUNC_LEAVE(value)
|
||||||
#define MALLOC_WRAPPER_RETURN(value) __FUNC_RETURN(value, H5_DEBUG_MALLOC)
|
#define MALLOC_WRAPPER_RETURN(value) __FUNC_RETURN(value, H5_DEBUG_MALLOC)
|
||||||
|
|
||||||
|
#define MPI_WRAPPER_ENTER(type) __FUNC_ENTER(type)
|
||||||
|
#define MPI_WRAPPER_ENTER0(type) \
|
||||||
|
__FUNC_ENTER0(type, H5_DEBUG_MPI)
|
||||||
|
#define MPI_WRAPPER_ENTER1(type, fmt, a1) \
|
||||||
|
__FUNC_ENTER1(type, fmt, a1, H5_DEBUG_MPI)
|
||||||
|
#define MPI_WRAPPER_ENTER2(type, fmt, a1, a2) \
|
||||||
|
__FUNC_ENTER2(type, fmt, a1, a2, H5_DEBUG_MPI)
|
||||||
|
#define MPI_WRAPPER_ENTER3(type, fmt, a1, a2, a3) \
|
||||||
|
__FUNC_ENTER3(type, fmt, a1, a2, a3, H5_DEBUG_MPI)
|
||||||
|
#define MPI_WRAPPER_ENTER4(type, fmt, a1, a2, a3, a4) \
|
||||||
|
__FUNC_ENTER4(type, fmt, a1, a2, a3, a4, H5_DEBUG_MPI)
|
||||||
|
#define MPI_WRAPPER_ENTER5(type, fmt, a1, a2, a3, a4, a5) \
|
||||||
|
__FUNC_ENTER5(type, fmt, a1, a2, a3, a4, a5, H5_DEBUG_MPI)
|
||||||
|
#define MPI_WRAPPER_LEAVE(value) __FUNC_LEAVE(value)
|
||||||
|
#define MPI_WRAPPER_RETURN(value) __FUNC_RETURN(value, H5_DEBUG_MPI)
|
||||||
|
|
||||||
/* WARNING! Changing these values will alter the data model and introduce
|
/* WARNING! Changing these values will alter the data model and introduce
|
||||||
* file incompatibilities with previous versions. */
|
* file incompatibilities with previous versions. */
|
||||||
#define H5_DATANAME_LEN 64
|
#define H5_DATANAME_LEN 64
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
+1163
-191
File diff suppressed because it is too large
Load Diff
@@ -105,18 +105,18 @@ h5priv_find_idlist (
|
|||||||
if (!list) {
|
if (!list) {
|
||||||
H5_PRIV_API_LEAVE (-1);
|
H5_PRIV_API_LEAVE (-1);
|
||||||
}
|
}
|
||||||
register h5_loc_idx_t low = 0;
|
register size_t low = 0;
|
||||||
register h5_loc_idx_t high = list->num_items - 1;
|
register size_t mid;
|
||||||
register h5_loc_id_t diff;
|
register size_t high = list->num_items - 1;
|
||||||
register h5_loc_id_t mid;
|
register h5_loc_idx_t diff;
|
||||||
const h5_loc_id_t face_idx = h5tpriv_get_face_idx(item);
|
const h5_loc_id_t face_id = h5tpriv_get_face_id(item);
|
||||||
const h5_loc_id_t elem_idx = h5tpriv_get_elem_idx(item);
|
const h5_loc_idx_t elem_idx = h5tpriv_get_elem_idx(item);
|
||||||
while (low <= high) {
|
while (low <= high) {
|
||||||
mid = (low + high) / 2;
|
mid = (low + high) / 2;
|
||||||
diff = h5tpriv_get_elem_idx(list->items[mid]) - elem_idx;
|
diff = h5tpriv_get_elem_idx(list->items[mid]) - elem_idx;
|
||||||
// if element indices are equal, we decide on the face indices
|
// if element indices are equal, we decide on the face indices
|
||||||
if (diff == 0) {
|
if (diff == 0) {
|
||||||
diff = h5tpriv_get_face_idx(list->items[mid]) - face_idx;
|
diff = h5tpriv_get_face_id (list->items[mid]) - face_id;
|
||||||
}
|
}
|
||||||
if ( diff > 0 )
|
if ( diff > 0 )
|
||||||
high = mid - 1;
|
high = mid - 1;
|
||||||
|
|||||||
+53
-25
@@ -12,6 +12,9 @@ h5priv_mpi_recv(
|
|||||||
const int tag,
|
const int tag,
|
||||||
const MPI_Comm comm
|
const MPI_Comm comm
|
||||||
) {
|
) {
|
||||||
|
MPI_WRAPPER_ENTER4 (h5_err_t,
|
||||||
|
"buf=0x%p, count=%d, type=?, from=%d, tag=%d, comm=?",
|
||||||
|
buf, count, from, tag);
|
||||||
int err = MPI_Recv(
|
int err = MPI_Recv(
|
||||||
buf,
|
buf,
|
||||||
count,
|
count,
|
||||||
@@ -22,8 +25,8 @@ h5priv_mpi_recv(
|
|||||||
MPI_STATUS_IGNORE
|
MPI_STATUS_IGNORE
|
||||||
);
|
);
|
||||||
if (err != MPI_SUCCESS)
|
if (err != MPI_SUCCESS)
|
||||||
return h5_error (H5_ERR_MPI, "Cannot receive data");
|
MPI_WRAPPER_LEAVE (h5_error (H5_ERR_MPI, "Cannot receive data"));
|
||||||
return H5_SUCCESS;
|
MPI_WRAPPER_RETURN (H5_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
h5_err_t
|
h5_err_t
|
||||||
@@ -35,6 +38,9 @@ h5priv_mpi_send(
|
|||||||
const int tag,
|
const int tag,
|
||||||
const MPI_Comm comm
|
const MPI_Comm comm
|
||||||
) {
|
) {
|
||||||
|
MPI_WRAPPER_ENTER4 (h5_err_t,
|
||||||
|
"buf=0x%p, count=%d, type=?, to=%d, tag=%d, comm=?",
|
||||||
|
buf, count, to, tag);
|
||||||
int err = MPI_Send(
|
int err = MPI_Send(
|
||||||
buf,
|
buf,
|
||||||
count,
|
count,
|
||||||
@@ -44,8 +50,8 @@ h5priv_mpi_send(
|
|||||||
comm
|
comm
|
||||||
);
|
);
|
||||||
if (err != MPI_SUCCESS)
|
if (err != MPI_SUCCESS)
|
||||||
return h5_error (H5_ERR_MPI, "Cannot send data");
|
MPI_WRAPPER_LEAVE (h5_error (H5_ERR_MPI, "Cannot send data"));
|
||||||
return H5_SUCCESS;
|
MPI_WRAPPER_RETURN (H5_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
h5_err_t
|
h5_err_t
|
||||||
@@ -56,6 +62,9 @@ h5priv_mpi_bcast (
|
|||||||
const int root,
|
const int root,
|
||||||
const MPI_Comm comm
|
const MPI_Comm comm
|
||||||
) {
|
) {
|
||||||
|
MPI_WRAPPER_ENTER3 (h5_err_t,
|
||||||
|
"buf=0x%p, count=%d, type=?, root=%d, comm=?",
|
||||||
|
buf, count, root);
|
||||||
int err = MPI_Bcast(
|
int err = MPI_Bcast(
|
||||||
buf,
|
buf,
|
||||||
count,
|
count,
|
||||||
@@ -64,8 +73,8 @@ h5priv_mpi_bcast (
|
|||||||
comm
|
comm
|
||||||
);
|
);
|
||||||
if (err != MPI_SUCCESS)
|
if (err != MPI_SUCCESS)
|
||||||
return h5_error (H5_ERR_MPI, "Cannot perform broadcast");
|
MPI_WRAPPER_LEAVE (h5_error (H5_ERR_MPI, "Cannot perform broadcast"));
|
||||||
return H5_SUCCESS;
|
MPI_WRAPPER_RETURN (H5_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -78,6 +87,9 @@ h5priv_mpi_sum (
|
|||||||
const MPI_Datatype type,
|
const MPI_Datatype type,
|
||||||
const MPI_Comm comm
|
const MPI_Comm comm
|
||||||
) {
|
) {
|
||||||
|
MPI_WRAPPER_ENTER3 (h5_err_t,
|
||||||
|
"sendbuf=0x%p, recvbuf=0x%p, count=%d, type=?, comm=?",
|
||||||
|
sendbuf, recvbuf, count);
|
||||||
int err = MPI_Allreduce(
|
int err = MPI_Allreduce(
|
||||||
sendbuf,
|
sendbuf,
|
||||||
recvbuf,
|
recvbuf,
|
||||||
@@ -87,8 +99,8 @@ h5priv_mpi_sum (
|
|||||||
comm
|
comm
|
||||||
);
|
);
|
||||||
if (err != MPI_SUCCESS)
|
if (err != MPI_SUCCESS)
|
||||||
return h5_error (H5_ERR_MPI, "Cannot perform sum reduction");
|
MPI_WRAPPER_LEAVE (h5_error (H5_ERR_MPI, "Cannot perform sum reduction"));
|
||||||
return H5_SUCCESS;
|
MPI_WRAPPER_RETURN (H5_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
h5_err_t
|
h5_err_t
|
||||||
@@ -99,6 +111,9 @@ h5priv_mpi_prefix_sum (
|
|||||||
const MPI_Datatype type,
|
const MPI_Datatype type,
|
||||||
const MPI_Comm comm
|
const MPI_Comm comm
|
||||||
) {
|
) {
|
||||||
|
MPI_WRAPPER_ENTER3 (h5_err_t,
|
||||||
|
"sendbuf=0x%p, recvbuf=0x%p, count=%d, type=?, comm=?",
|
||||||
|
sendbuf, recvbuf, count);
|
||||||
int err = MPI_Scan(
|
int err = MPI_Scan(
|
||||||
sendbuf,
|
sendbuf,
|
||||||
recvbuf,
|
recvbuf,
|
||||||
@@ -108,8 +123,8 @@ h5priv_mpi_prefix_sum (
|
|||||||
comm
|
comm
|
||||||
);
|
);
|
||||||
if (err != MPI_SUCCESS)
|
if (err != MPI_SUCCESS)
|
||||||
return h5_error (H5_ERR_MPI, "Cannot perform prefix sum");
|
MPI_WRAPPER_LEAVE (h5_error (H5_ERR_MPI, "Cannot perform prefix sum"));
|
||||||
return H5_SUCCESS;
|
MPI_WRAPPER_RETURN (H5_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
h5_err_t
|
h5_err_t
|
||||||
@@ -122,6 +137,9 @@ h5priv_mpi_allgather (
|
|||||||
const MPI_Datatype recvtype,
|
const MPI_Datatype recvtype,
|
||||||
const MPI_Comm comm
|
const MPI_Comm comm
|
||||||
) {
|
) {
|
||||||
|
MPI_WRAPPER_ENTER4 (h5_err_t,
|
||||||
|
"sendbuf=0x%p, sendcount=%d, sendtype=?, recvbuf=0x%p, recvcount=%d, recvtype=?, comm=?",
|
||||||
|
sendbuf, sendcount, recvbuf, recvcount);
|
||||||
int err = MPI_Allgather (
|
int err = MPI_Allgather (
|
||||||
sendbuf,
|
sendbuf,
|
||||||
sendcount,
|
sendcount,
|
||||||
@@ -131,8 +149,8 @@ h5priv_mpi_allgather (
|
|||||||
recvtype,
|
recvtype,
|
||||||
comm);
|
comm);
|
||||||
if (err != MPI_SUCCESS)
|
if (err != MPI_SUCCESS)
|
||||||
return h5_error (H5_ERR_MPI, "Cannot gather data");
|
MPI_WRAPPER_LEAVE (h5_error (H5_ERR_MPI, "Cannot gather data"));
|
||||||
return H5_SUCCESS;
|
MPI_WRAPPER_RETURN (H5_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
h5_err_t
|
h5_err_t
|
||||||
@@ -140,10 +158,12 @@ h5priv_mpi_comm_size (
|
|||||||
MPI_Comm comm,
|
MPI_Comm comm,
|
||||||
int* size
|
int* size
|
||||||
) {
|
) {
|
||||||
|
MPI_WRAPPER_ENTER1 (h5_err_t,
|
||||||
|
"comm=?, size=0x%p", size);
|
||||||
int err = MPI_Comm_size (comm, size);
|
int err = MPI_Comm_size (comm, size);
|
||||||
if (err != MPI_SUCCESS)
|
if (err != MPI_SUCCESS)
|
||||||
return h5_error (H5_ERR_MPI, "Cannot get communicator size");
|
MPI_WRAPPER_LEAVE (h5_error (H5_ERR_MPI, "Cannot get communicator size"));
|
||||||
return H5_SUCCESS;
|
MPI_WRAPPER_RETURN (H5_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -152,10 +172,12 @@ h5priv_mpi_comm_rank (
|
|||||||
MPI_Comm comm,
|
MPI_Comm comm,
|
||||||
int* rank
|
int* rank
|
||||||
) {
|
) {
|
||||||
|
MPI_WRAPPER_ENTER1 (h5_err_t,
|
||||||
|
"comm=?, rank=0x%p", rank);
|
||||||
int err = MPI_Comm_rank (comm, rank);
|
int err = MPI_Comm_rank (comm, rank);
|
||||||
if (err != MPI_SUCCESS)
|
if (err != MPI_SUCCESS)
|
||||||
return h5_error (H5_ERR_MPI, "Cannot get this task's rank");
|
MPI_WRAPPER_LEAVE (h5_error (H5_ERR_MPI, "Cannot get this task's rank"));
|
||||||
return H5_SUCCESS;
|
MPI_WRAPPER_RETURN (H5_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
h5_err_t
|
h5_err_t
|
||||||
@@ -164,24 +186,26 @@ h5priv_mpi_type_contiguous (
|
|||||||
const MPI_Datatype oldtype,
|
const MPI_Datatype oldtype,
|
||||||
MPI_Datatype *const newtype
|
MPI_Datatype *const newtype
|
||||||
) {
|
) {
|
||||||
|
MPI_WRAPPER_ENTER1 (h5_err_t, "nelems=%lu, oldtype=?, newtype=?", (long unsigned)nelems);
|
||||||
int err;
|
int err;
|
||||||
err = MPI_Type_contiguous ( nelems, oldtype, newtype );
|
err = MPI_Type_contiguous ( nelems, oldtype, newtype );
|
||||||
if (err != MPI_SUCCESS)
|
if (err != MPI_SUCCESS)
|
||||||
return h5_error (H5_ERR_MPI, "Cannot create new MPI type");
|
MPI_WRAPPER_LEAVE (h5_error (H5_ERR_MPI, "Cannot create new MPI type"));
|
||||||
err = MPI_Type_commit ( newtype );
|
err = MPI_Type_commit ( newtype );
|
||||||
if (err != MPI_SUCCESS)
|
if (err != MPI_SUCCESS)
|
||||||
return h5_error (H5_ERR_MPI, "Cannot commit new MPI type");
|
MPI_WRAPPER_LEAVE (h5_error (H5_ERR_MPI, "Cannot commit new MPI type"));
|
||||||
return H5_SUCCESS;
|
MPI_WRAPPER_RETURN (H5_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
h5_err_t
|
h5_err_t
|
||||||
h5priv_mpi_type_free (
|
h5priv_mpi_type_free (
|
||||||
MPI_Datatype *type
|
MPI_Datatype *type
|
||||||
) {
|
) {
|
||||||
|
MPI_WRAPPER_ENTER1 (h5_err_t, "type=0x%p", type);
|
||||||
int err = MPI_Type_free( type );
|
int err = MPI_Type_free( type );
|
||||||
if (err != MPI_SUCCESS)
|
if (err != MPI_SUCCESS)
|
||||||
return h5_error(H5_ERR_MPI, "Cannot free MPI type");
|
MPI_WRAPPER_LEAVE (h5_error(H5_ERR_MPI, "Cannot free MPI type"));
|
||||||
return H5_SUCCESS;
|
MPI_WRAPPER_RETURN (H5_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
h5_err_t
|
h5_err_t
|
||||||
@@ -193,11 +217,13 @@ h5priv_mpi_cart_create (
|
|||||||
int reorder,
|
int reorder,
|
||||||
MPI_Comm *new_comm
|
MPI_Comm *new_comm
|
||||||
) {
|
) {
|
||||||
|
MPI_WRAPPER_ENTER5 (h5_err_t, "old_comm=?, ndims=%d, dims=0x%p, period=0x%p, reorder=%d, new_comm=0x%p",
|
||||||
|
ndims, dims, period, reorder, new_comm);
|
||||||
int err = MPI_Cart_create(
|
int err = MPI_Cart_create(
|
||||||
old_comm, ndims, dims, period, reorder, new_comm);
|
old_comm, ndims, dims, period, reorder, new_comm);
|
||||||
if (err != MPI_SUCCESS)
|
if (err != MPI_SUCCESS)
|
||||||
return h5_error(H5_ERR_MPI, "Cannot create cartesian grid");
|
MPI_WRAPPER_LEAVE (h5_error(H5_ERR_MPI, "Cannot create cartesian grid"));
|
||||||
return H5_SUCCESS;
|
MPI_WRAPPER_RETURN (H5_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
h5_err_t
|
h5_err_t
|
||||||
@@ -207,10 +233,12 @@ h5priv_mpi_cart_coords (
|
|||||||
int maxdim,
|
int maxdim,
|
||||||
int *coords
|
int *coords
|
||||||
) {
|
) {
|
||||||
|
MPI_WRAPPER_ENTER3 (h5_err_t, "comm=?, rank=%d, maxdim=%d, coords=0x%p",
|
||||||
|
rank, maxdim, coords);
|
||||||
int err = MPI_Cart_coords( comm, rank, maxdim, coords );
|
int err = MPI_Cart_coords( comm, rank, maxdim, coords );
|
||||||
if (err != MPI_SUCCESS)
|
if (err != MPI_SUCCESS)
|
||||||
return h5_error(H5_ERR_MPI, "Cannot create cartesian grid");
|
MPI_WRAPPER_LEAVE (h5_error(H5_ERR_MPI, "Cannot create cartesian grid"));
|
||||||
return H5_SUCCESS;
|
MPI_WRAPPER_RETURN (H5_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // PARALLEL_IO
|
#endif // PARALLEL_IO
|
||||||
|
|||||||
@@ -325,6 +325,23 @@ h5_close_file (
|
|||||||
H5_CORE_API_RETURN (H5_SUCCESS);
|
H5_CORE_API_RETURN (H5_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
h5_err_t
|
||||||
|
h5_flush_step (
|
||||||
|
h5_file_t * const f
|
||||||
|
) {
|
||||||
|
H5_CORE_API_ENTER1 (h5_err_t, "f=0x%p", f);
|
||||||
|
H5_CORE_API_RETURN (hdf5_flush (f->step_gid, H5F_SCOPE_LOCAL));
|
||||||
|
}
|
||||||
|
|
||||||
|
h5_err_t
|
||||||
|
h5_flush_file (
|
||||||
|
h5_file_t * const f
|
||||||
|
) {
|
||||||
|
H5_CORE_API_ENTER1 (h5_err_t, "f=0x%p", f);
|
||||||
|
H5_CORE_API_RETURN (hdf5_flush (f->file, H5F_SCOPE_GLOBAL));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\ingroup h5_core_filehandling
|
\ingroup h5_core_filehandling
|
||||||
|
|
||||||
|
|||||||
@@ -582,13 +582,13 @@ update_internal_structs (
|
|||||||
clock_t t1 = clock();
|
clock_t t1 = clock();
|
||||||
TRY( compute_elems_of_vertices (f, from_lvl) );
|
TRY( compute_elems_of_vertices (f, from_lvl) );
|
||||||
clock_t t2 = clock();
|
clock_t t2 = clock();
|
||||||
fprintf (stderr, "compute_elems_of_vertices(): %f\n",
|
// fprintf (stderr, "compute_elems_of_vertices(): %f\n",
|
||||||
(float)(t2-t1)/CLOCKS_PER_SEC);
|
// (float)(t2-t1)/CLOCKS_PER_SEC);
|
||||||
t1 = clock();
|
t1 = clock();
|
||||||
TRY( compute_elems_of_edges (f, from_lvl ) );
|
TRY( compute_elems_of_edges (f, from_lvl ) );
|
||||||
t2 = clock();
|
t2 = clock();
|
||||||
fprintf (stderr, "compute_elems_of_edge(): %f\n",
|
// fprintf (stderr, "compute_elems_of_edge(): %f\n",
|
||||||
(float)(t2-t1)/CLOCKS_PER_SEC);
|
// (float)(t2-t1)/CLOCKS_PER_SEC);
|
||||||
h5_debug ("%s (%lld): done", __func__, (long long)from_lvl);
|
h5_debug ("%s (%lld): done", __func__, (long long)from_lvl);
|
||||||
H5_PRIV_FUNC_RETURN (H5_SUCCESS);
|
H5_PRIV_FUNC_RETURN (H5_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -57,19 +57,22 @@
|
|||||||
#define H5T_FACE_MASK (0x0f)
|
#define H5T_FACE_MASK (0x0f)
|
||||||
#define H5T_TYPE_MASK (0x70)
|
#define H5T_TYPE_MASK (0x70)
|
||||||
|
|
||||||
#define h5tpriv_set_entity_type( type, elem_idx ) \
|
#if 0
|
||||||
(((type) << (BITS_OF(elem_idx)-4)) | (elem_idx))
|
enum elem_types {
|
||||||
|
vertex = 1, // 1 vertex
|
||||||
#define h5tpriv_get_entity_type( entity_id ) \
|
edge, // 2 vertices
|
||||||
((entity_id >> (BITS_OF(entity_id)-8)) & H5T_TYPE_MASK)
|
triangle, // 3 vertices
|
||||||
|
quadrangle, // 4 vertices
|
||||||
|
tetrahedron, // 4 vertices
|
||||||
|
pyramid, // 5 vertices
|
||||||
|
prism, // 6 vertices
|
||||||
|
hexahedron // 8 vertices
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
#define h5tpriv_build_entity_id( type, face_idx, elem_idx ) \
|
#define h5tpriv_build_entity_id( type, face_idx, elem_idx ) \
|
||||||
(((type) | (face_idx)) << (BITS_OF(elem_idx)-8) | (elem_idx))
|
(((type) | (face_idx)) << (BITS_OF(elem_idx)-8) | (elem_idx))
|
||||||
|
|
||||||
#define h5tpriv_build_entity_id2( face_id, elem_idx ) \
|
|
||||||
(((face_id) << (BITS_OF(elem_idx)-8)) | \
|
|
||||||
(elem_idx))
|
|
||||||
|
|
||||||
#define h5tpriv_build_vertex_id( face_idx, elem_idx ) \
|
#define h5tpriv_build_vertex_id( face_idx, elem_idx ) \
|
||||||
(h5tpriv_build_entity_id (H5T_TYPE_VERTEX, face_idx, elem_idx))
|
(h5tpriv_build_entity_id (H5T_TYPE_VERTEX, face_idx, elem_idx))
|
||||||
|
|
||||||
@@ -82,6 +85,9 @@
|
|||||||
#define h5tpriv_build_tet_id( face_idx, elem_idx ) \
|
#define h5tpriv_build_tet_id( face_idx, elem_idx ) \
|
||||||
(h5tpriv_build_entity_id (H5T_TYPE_TET, face_idx, elem_idx))
|
(h5tpriv_build_entity_id (H5T_TYPE_TET, face_idx, elem_idx))
|
||||||
|
|
||||||
|
#define h5tpriv_get_entity_type( entity_id ) \
|
||||||
|
((entity_id >> (BITS_OF(entity_id)-8)) & H5T_TYPE_MASK)
|
||||||
|
|
||||||
#define h5tpriv_get_face_idx( entity_id ) \
|
#define h5tpriv_get_face_idx( entity_id ) \
|
||||||
(((entity_id) >> (BITS_OF(entity_id)-8)) & H5T_FACE_MASK)
|
(((entity_id) >> (BITS_OF(entity_id)-8)) & H5T_FACE_MASK)
|
||||||
|
|
||||||
|
|||||||
@@ -72,15 +72,19 @@ h5t_open_tetrahedral_mesh (
|
|||||||
t->dsinfo_elems.type_id = t->dtypes.h5_tet_t;
|
t->dsinfo_elems.type_id = t->dtypes.h5_tet_t;
|
||||||
t->methods = tet_funcs;
|
t->methods = tet_funcs;
|
||||||
t->ref_elem = &h5t_tet_ref_elem;
|
t->ref_elem = &h5t_tet_ref_elem;
|
||||||
TRY (open_tetmesh_group (f, id));
|
|
||||||
|
|
||||||
if (id == -1) { // append new
|
if (id == -1) { // add new
|
||||||
id = t->num_meshes;
|
id = 0;
|
||||||
t->num_meshes++;
|
t->num_meshes = 1;
|
||||||
t->mesh_changed = id;
|
t->cur_mesh = 0;
|
||||||
|
t->mesh_changed = 0;
|
||||||
|
t->leaf_level = 0;
|
||||||
t->num_leaf_levels = 0;
|
t->num_leaf_levels = 0;
|
||||||
|
TRY (open_tetmesh_group (f, id));
|
||||||
} else { // read existing
|
} else { // read existing
|
||||||
|
TRY (open_tetmesh_group (f, id));
|
||||||
TRY (h5tpriv_read_mesh (f));
|
TRY (h5tpriv_read_mesh (f));
|
||||||
|
t->leaf_level = 0;
|
||||||
}
|
}
|
||||||
H5_CORE_API_RETURN (H5_SUCCESS);
|
H5_CORE_API_RETURN (H5_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,9 @@ static struct h5t_methods tri_funcs = {
|
|||||||
&h5tpriv_trim_adjacency_methods
|
&h5tpriv_trim_adjacency_methods
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
Open container of triangle meshes
|
||||||
|
*/
|
||||||
static inline h5_err_t
|
static inline h5_err_t
|
||||||
open_trimeshes_group (
|
open_trimeshes_group (
|
||||||
h5_file_t* const f
|
h5_file_t* const f
|
||||||
@@ -30,7 +32,7 @@ open_trimeshes_group (
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
open HDF5 group with data of specific mesh.
|
Open container of triangle mesh with \c id
|
||||||
*/
|
*/
|
||||||
static inline h5_err_t
|
static inline h5_err_t
|
||||||
open_trimesh_group (
|
open_trimesh_group (
|
||||||
@@ -73,15 +75,19 @@ h5t_open_triangle_mesh (
|
|||||||
t->dsinfo_elems.type_id = t->dtypes.h5_triangle_t;
|
t->dsinfo_elems.type_id = t->dtypes.h5_triangle_t;
|
||||||
t->methods = tri_funcs;
|
t->methods = tri_funcs;
|
||||||
t->ref_elem = &h5t_tri_ref_elem;
|
t->ref_elem = &h5t_tri_ref_elem;
|
||||||
TRY (open_trimesh_group (f, id));
|
|
||||||
|
|
||||||
if (id == -1) { // add new
|
if (id == -1) { // add new
|
||||||
id = t->num_meshes;
|
id = 0;
|
||||||
t->num_meshes++;
|
t->num_meshes = 1;
|
||||||
t->mesh_changed = id;
|
t->cur_mesh = 0;
|
||||||
|
t->mesh_changed = 0;
|
||||||
|
t->leaf_level = 0;
|
||||||
t->num_leaf_levels = 0;
|
t->num_leaf_levels = 0;
|
||||||
|
TRY (open_trimesh_group (f, 0));
|
||||||
} else { // read existing
|
} else { // read existing
|
||||||
|
TRY (open_trimesh_group (f, 0));
|
||||||
TRY (h5tpriv_read_mesh (f));
|
TRY (h5tpriv_read_mesh (f));
|
||||||
|
t->leaf_level = 0;
|
||||||
}
|
}
|
||||||
H5_CORE_API_RETURN (H5_SUCCESS);
|
H5_CORE_API_RETURN (H5_SUCCESS);
|
||||||
}
|
}
|
||||||
@@ -124,8 +130,6 @@ h5t_open_triangle_mesh_by_name (
|
|||||||
|
|
||||||
TRY (h5t_close_mesh (f));
|
TRY (h5t_close_mesh (f));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
t->dsinfo_elems.type_id = t->dtypes.h5_triangle_t;
|
t->dsinfo_elems.type_id = t->dtypes.h5_triangle_t;
|
||||||
t->methods = tri_funcs;
|
t->methods = tri_funcs;
|
||||||
t->ref_elem = &h5t_tri_ref_elem;
|
t->ref_elem = &h5t_tri_ref_elem;
|
||||||
|
|||||||
@@ -861,8 +861,8 @@ write_tagset (
|
|||||||
for (ti_idx = 0; eleminfo && ti_idx < eleminfo->num_tags; ti_idx++) {
|
for (ti_idx = 0; eleminfo && ti_idx < eleminfo->num_tags; ti_idx++) {
|
||||||
h5t_taginfo_t* ti = eleminfo->ti+ti_idx;
|
h5t_taginfo_t* ti = eleminfo->ti+ti_idx;
|
||||||
h5_glb_idx_t glb_elem_idx = h5tpriv_get_loc_elem_glb_idx (f, elem_idx);
|
h5_glb_idx_t glb_elem_idx = h5tpriv_get_loc_elem_glb_idx (f, elem_idx);
|
||||||
entity->eid = h5tpriv_build_entity_id2 (
|
entity->eid = h5tpriv_build_entity_id (
|
||||||
(h5_glb_id_t)ti->face_id, glb_elem_idx);
|
0, (h5_glb_id_t)ti->face_id, glb_elem_idx);
|
||||||
entity->idx = val_idx;
|
entity->idx = val_idx;
|
||||||
|
|
||||||
// copy values
|
// copy values
|
||||||
|
|||||||
+33
-32
@@ -6,11 +6,10 @@ h5u_get_num_particles (
|
|||||||
h5_file_t *const f /*!< [in] Handle to open file */
|
h5_file_t *const f /*!< [in] Handle to open file */
|
||||||
) {
|
) {
|
||||||
H5_CORE_API_ENTER1 (h5_ssize_t, "f=0x%p", f);
|
H5_CORE_API_ENTER1 (h5_ssize_t, "f=0x%p", f);
|
||||||
h5_int64_t nparticles;
|
h5_ssize_t nparticles;
|
||||||
|
|
||||||
/* if a view exists, use its size as the number of particles */
|
/* if a view exists, use its size as the number of particles */
|
||||||
if ( h5u_has_view ( f ) )
|
if (h5u_has_view (f)) {
|
||||||
{
|
|
||||||
TRY (nparticles = hdf5_get_selected_npoints_of_dataspace(
|
TRY (nparticles = hdf5_get_selected_npoints_of_dataspace(
|
||||||
f->u->diskshape));
|
f->u->diskshape));
|
||||||
h5_debug(
|
h5_debug(
|
||||||
@@ -22,8 +21,7 @@ h5u_get_num_particles (
|
|||||||
h5_debug(
|
h5_debug(
|
||||||
"Found %lld particles from previous H5PartSetNumParticles call.",
|
"Found %lld particles from previous H5PartSetNumParticles call.",
|
||||||
(long long)nparticles );
|
(long long)nparticles );
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
/* otherwise, report all particles on disk in the first dataset
|
/* otherwise, report all particles on disk in the first dataset
|
||||||
* for this timestep */
|
* for this timestep */
|
||||||
char dataset_name[H5_DATANAME_LEN];
|
char dataset_name[H5_DATANAME_LEN];
|
||||||
@@ -33,20 +31,20 @@ h5u_get_num_particles (
|
|||||||
0,
|
0,
|
||||||
dataset_name,
|
dataset_name,
|
||||||
H5_DATANAME_LEN);
|
H5_DATANAME_LEN);
|
||||||
if ( exists < 0 )
|
if (exists < 0)
|
||||||
H5_CORE_API_LEAVE (
|
H5_CORE_API_LEAVE (
|
||||||
h5_error(
|
h5_error (
|
||||||
H5_ERR_INVAL,
|
H5_ERR_INVAL,
|
||||||
"Cannot determine the number of particles: "
|
"Cannot determine the number of particles: "
|
||||||
"H5PartSetNumParticles has not been called, "
|
"H5PartSetNumParticles has not been called, "
|
||||||
"no view has been set, and there are no "
|
"no view has been set, and there are no "
|
||||||
"data sets for this time step!"));
|
"data sets for this time step!"));
|
||||||
TRY( nparticles = hdf5_get_npoints_of_dataset_by_name(
|
TRY (nparticles = hdf5_get_npoints_of_dataset_by_name(
|
||||||
f->step_gid,
|
f->step_gid,
|
||||||
dataset_name) );
|
dataset_name) );
|
||||||
h5_debug(
|
h5_debug (
|
||||||
"Found %lld particles in the first data set of this time step.",
|
"Found %lld particles in the first data set of this time step.",
|
||||||
(long long)nparticles );
|
(long long)nparticles);
|
||||||
}
|
}
|
||||||
|
|
||||||
H5_CORE_API_RETURN (nparticles);
|
H5_CORE_API_RETURN (nparticles);
|
||||||
@@ -63,21 +61,19 @@ h5u_set_num_particles (
|
|||||||
f, (long long unsigned)nparticles,
|
f, (long long unsigned)nparticles,
|
||||||
(long long unsigned)stride);
|
(long long unsigned)stride);
|
||||||
struct h5u_fdata *u = f->u;
|
struct h5u_fdata *u = f->u;
|
||||||
hsize_t hstride;
|
|
||||||
hsize_t count;
|
|
||||||
hsize_t start;
|
hsize_t start;
|
||||||
hsize_t total;
|
hsize_t total;
|
||||||
hsize_t dmax = H5S_UNLIMITED;
|
hsize_t dmax = H5S_UNLIMITED;
|
||||||
|
|
||||||
if ( nparticles <= 0 )
|
if (nparticles < 0)
|
||||||
H5_CORE_API_LEAVE (
|
H5_CORE_API_LEAVE (
|
||||||
h5_error(
|
h5_error(
|
||||||
H5_ERR_INVAL,
|
H5_ERR_INVAL,
|
||||||
"Invalid number particles: %lld!\n",
|
"Invalid number particles: %lld!\n",
|
||||||
(long long)nparticles));
|
(long long)nparticles));
|
||||||
|
|
||||||
hstride = (hsize_t)stride;
|
hsize_t hstride = (hsize_t)stride;
|
||||||
if ( hstride > 1 )
|
if (hstride > 1)
|
||||||
h5_debug ("Striding by %lld elements.", (long long)hstride);
|
h5_debug ("Striding by %lld elements.", (long long)hstride);
|
||||||
|
|
||||||
#ifndef PARALLEL_IO
|
#ifndef PARALLEL_IO
|
||||||
@@ -100,14 +96,13 @@ h5u_set_num_particles (
|
|||||||
u->nparticles = (hsize_t)nparticles;
|
u->nparticles = (hsize_t)nparticles;
|
||||||
|
|
||||||
/* declare local memory datasize with striding */
|
/* declare local memory datasize with striding */
|
||||||
count = u->nparticles * stride;
|
hsize_t count = u->nparticles * stride;
|
||||||
TRY (u->memshape = hdf5_create_dataspace (1, &count, &dmax));
|
TRY (u->memshape = hdf5_create_dataspace (1, &count, &dmax));
|
||||||
|
|
||||||
/* we need a hyperslab selection if there is striding
|
/* we need a hyperslab selection if there is striding
|
||||||
* (otherwise, the default H5S_ALL selection is ok)
|
* (otherwise, the default H5S_ALL selection is ok)
|
||||||
*/
|
*/
|
||||||
if ( hstride > 1 )
|
if (hstride > 1) {
|
||||||
{
|
|
||||||
start = 0;
|
start = 0;
|
||||||
count = u->nparticles;
|
count = u->nparticles;
|
||||||
TRY (hdf5_select_hyperslab_of_dataspace(
|
TRY (hdf5_select_hyperslab_of_dataspace(
|
||||||
@@ -159,11 +154,15 @@ h5u_set_num_particles (
|
|||||||
|
|
||||||
count = nparticles;
|
count = nparticles;
|
||||||
hstride = 1;
|
hstride = 1;
|
||||||
TRY( hdf5_select_hyperslab_of_dataspace(
|
if (count > 0) {
|
||||||
u->diskshape,
|
TRY( hdf5_select_hyperslab_of_dataspace(
|
||||||
H5S_SELECT_SET,
|
u->diskshape,
|
||||||
&start, &hstride, &count,
|
H5S_SELECT_SET,
|
||||||
NULL) );
|
&start, &hstride, &count,
|
||||||
|
NULL) );
|
||||||
|
} else {
|
||||||
|
TRY (hdf5_select_none (u->diskshape));
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
H5_CORE_API_RETURN (H5_SUCCESS);
|
H5_CORE_API_RETURN (H5_SUCCESS);
|
||||||
}
|
}
|
||||||
@@ -205,7 +204,6 @@ h5u_set_view (
|
|||||||
f, (long long)start, (long long)end);
|
f, (long long)start, (long long)end);
|
||||||
hsize_t total;
|
hsize_t total;
|
||||||
hsize_t stride = 1;
|
hsize_t stride = 1;
|
||||||
hsize_t hstart;
|
|
||||||
hsize_t dmax = H5S_UNLIMITED;
|
hsize_t dmax = H5S_UNLIMITED;
|
||||||
struct h5u_fdata *u = f->u;
|
struct h5u_fdata *u = f->u;
|
||||||
|
|
||||||
@@ -260,7 +258,7 @@ h5u_set_view (
|
|||||||
TRY (u->diskshape = hdf5_create_dataspace ( 1, &total, NULL ));
|
TRY (u->diskshape = hdf5_create_dataspace ( 1, &total, NULL ));
|
||||||
|
|
||||||
total = (hsize_t)u->nparticles;
|
total = (hsize_t)u->nparticles;
|
||||||
hstart = (size_t)start;
|
hsize_t hstart = (hsize_t)start;
|
||||||
|
|
||||||
TRY (hdf5_select_hyperslab_of_dataspace (
|
TRY (hdf5_select_hyperslab_of_dataspace (
|
||||||
u->diskshape,
|
u->diskshape,
|
||||||
@@ -319,11 +317,14 @@ h5u_set_view_indices (
|
|||||||
/* declare local memory datasize */
|
/* declare local memory datasize */
|
||||||
total = u->nparticles;
|
total = u->nparticles;
|
||||||
TRY (u->memshape = hdf5_create_dataspace (1, &total, &dmax));
|
TRY (u->memshape = hdf5_create_dataspace (1, &total, &dmax));
|
||||||
TRY (hdf5_select_elements_of_dataspace (
|
if (nelems > 0) {
|
||||||
u->diskshape,
|
TRY (hdf5_select_elements_of_dataspace (
|
||||||
H5S_SELECT_SET,
|
u->diskshape,
|
||||||
(hsize_t)nelems, (hsize_t*)indices ) );
|
H5S_SELECT_SET,
|
||||||
|
(hsize_t)nelems, (hsize_t*)indices ) );
|
||||||
|
} else {
|
||||||
|
TRY (hdf5_select_none (u->diskshape));
|
||||||
|
}
|
||||||
u->viewindexed = 1;
|
u->viewindexed = 1;
|
||||||
|
|
||||||
H5_CORE_API_RETURN (H5_SUCCESS);
|
H5_CORE_API_RETURN (H5_SUCCESS);
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ h5u_read_data (
|
|||||||
TRY (ndisk = hdf5_get_npoints_of_dataspace (space_id));
|
TRY (ndisk = hdf5_get_npoints_of_dataspace (space_id));
|
||||||
|
|
||||||
if (u->diskshape != H5S_ALL) {
|
if (u->diskshape != H5S_ALL) {
|
||||||
TRY (nread = hdf5_get_npoints_of_dataspace(u->diskshape));
|
TRY (nread = hdf5_get_selected_npoints_of_dataspace (u->diskshape));
|
||||||
|
|
||||||
/* make sure the disk space selected by the view doesn't
|
/* make sure the disk space selected by the view doesn't
|
||||||
* exceed the size of the dataset */
|
* exceed the size of the dataset */
|
||||||
@@ -155,6 +155,9 @@ h5u_write_data (
|
|||||||
#ifdef PARALLEL_IO
|
#ifdef PARALLEL_IO
|
||||||
TRY (h5_end_throttle (f));
|
TRY (h5_end_throttle (f));
|
||||||
#endif
|
#endif
|
||||||
|
if (f->mode & H5_O_FLUSHSTEP)
|
||||||
|
TRY (hdf5_flush (f->step_gid, H5F_SCOPE_LOCAL));
|
||||||
|
|
||||||
TRY (hdf5_close_dataset (dset_id));
|
TRY (hdf5_close_dataset (dset_id));
|
||||||
|
|
||||||
f->empty = 0;
|
f->empty = 0;
|
||||||
|
|||||||
+18
-9
@@ -49,22 +49,31 @@ H5FedOpenTriangleMesh (
|
|||||||
H5_API_RETURN (h5t_open_triangle_mesh (f, mesh_id));
|
H5_API_RETURN (h5t_open_triangle_mesh (f, mesh_id));
|
||||||
}
|
}
|
||||||
|
|
||||||
h5_err_t
|
static inline h5_err_t
|
||||||
H5FedCloseMesh (
|
H5FedCloseMesh (
|
||||||
h5_file_t * const f
|
h5_file_t* const f
|
||||||
);
|
) {
|
||||||
|
H5_API_ENTER1 (h5_err_t, "f=0x%p", f);
|
||||||
|
H5_API_RETURN (h5t_close_mesh (f));
|
||||||
|
}
|
||||||
|
|
||||||
h5_err_t
|
static inline h5_err_t
|
||||||
H5FedSetLevel (
|
H5FedSetLevel (
|
||||||
h5_file_t * f,
|
h5_file_t* const f,
|
||||||
const h5t_lvl_idx_t level_id
|
const h5t_lvl_idx_t level_id
|
||||||
);
|
) {
|
||||||
|
H5_API_ENTER2 (h5_err_t, "f=0x%p, level_id=%d", f, level_id);
|
||||||
|
H5_API_RETURN (h5t_set_level (f, level_id));
|
||||||
|
}
|
||||||
|
|
||||||
h5_err_t
|
static inline h5_err_t
|
||||||
H5FedLinkMeshToStep (
|
H5FedLinkMeshToStep (
|
||||||
h5_file_t * f,
|
h5_file_t* const f,
|
||||||
const h5_id_t mesh_id
|
const h5_id_t mesh_id
|
||||||
);
|
) {
|
||||||
|
H5_API_ENTER2 (h5_err_t, "f=0x%p, mesh_id=%lld", f, (long long)mesh_id);
|
||||||
|
H5_API_RETURN (h5_error_not_implemented ());
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,19 +5,29 @@
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
h5_err_t
|
static inline h5_err_t
|
||||||
H5FedGetAdjacencies (
|
H5FedGetAdjacencies (
|
||||||
h5_file_t* const f,
|
h5_file_t* const f,
|
||||||
const h5_loc_id_t entity_id,
|
const h5_loc_id_t entity_id,
|
||||||
const h5_int32_t dim,
|
const h5_int32_t dim,
|
||||||
h5_loc_idlist_t** list
|
h5_loc_idlist_t** list
|
||||||
);
|
) {
|
||||||
|
H5_API_ENTER4 (h5_err_t,
|
||||||
|
"f=0x%p, entity_id=%lld, dim=%d, list=0x%p",
|
||||||
|
f, (long long)entity_id, dim, list);
|
||||||
|
H5_API_RETURN (h5t_get_adjacencies (f, entity_id, dim, list));
|
||||||
|
}
|
||||||
|
|
||||||
h5_err_t
|
static inline h5_err_t
|
||||||
H5FedReleaseListOfAdjacencies (
|
H5FedReleaseListOfAdjacencies (
|
||||||
h5_file_t * const f,
|
h5_file_t* const f,
|
||||||
h5_loc_idlist_t **list
|
h5_loc_idlist_t** list
|
||||||
);
|
) {
|
||||||
|
H5_API_ENTER2 (h5_err_t,
|
||||||
|
"f=0x%p, list=0x%p",
|
||||||
|
f, list);
|
||||||
|
H5_API_RETURN (h5t_release_list_of_adjacencies (f, list));
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|||||||
+131
-8
@@ -46,14 +46,137 @@ H5FedGetNumTriangleMeshes (
|
|||||||
H5_API_RETURN (h5t_get_num_trimeshes (f));
|
H5_API_RETURN (h5t_get_num_trimeshes (f));
|
||||||
}
|
}
|
||||||
|
|
||||||
h5_ssize_t H5FedGetNumLevels ( h5_file_t * const f );
|
/*!
|
||||||
h5t_lvl_idx_t H5FedGetLevel ( h5_file_t * const f );
|
Get the number of hierarchical mesh levels.
|
||||||
h5_ssize_t H5FedGetNumVertices ( h5_file_t * const f );
|
|
||||||
h5_ssize_t H5FedGetNumVerticesCnode ( h5_file_t * const f, const int cnode );
|
\param[in] f File handle
|
||||||
h5_ssize_t H5FedGetNumVerticesTotal ( h5_file_t * const f );
|
|
||||||
h5_ssize_t H5FedGetNumElements ( h5_file_t * const f );
|
\return Number of hierarchical mesh levels or error code.
|
||||||
h5_ssize_t H5FedGetNumElementsCnode ( h5_file_t * const f, const int cnode );
|
*/
|
||||||
h5_ssize_t H5FedGetNumElementsTotal ( h5_file_t * const f );
|
static inline h5_ssize_t
|
||||||
|
H5FedGetNumLevels (
|
||||||
|
h5_file_t* const f
|
||||||
|
) {
|
||||||
|
H5_API_ENTER1 (h5_ssize_t, "f=0x%p", f);
|
||||||
|
H5_API_RETURN (h5t_get_num_leaf_levels (f));
|
||||||
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
Get current mesh levels.
|
||||||
|
|
||||||
|
\param[in] f File handle
|
||||||
|
|
||||||
|
\return ID of current mesh levels or error code.
|
||||||
|
*/
|
||||||
|
static inline h5t_lvl_idx_t
|
||||||
|
H5FedGetLevel (
|
||||||
|
h5_file_t* const f
|
||||||
|
) {
|
||||||
|
H5_API_ENTER1 (h5t_lvl_idx_t, "f=0x%p", f);
|
||||||
|
H5_API_RETURN (h5t_get_level (f));
|
||||||
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
Returns the number of vertices used for defining the (sub-)mesh
|
||||||
|
at current level on this compute node.
|
||||||
|
|
||||||
|
\param[in] f file handle
|
||||||
|
|
||||||
|
\return Number of vertices or error code.
|
||||||
|
*/
|
||||||
|
static inline h5_ssize_t
|
||||||
|
H5FedGetNumVertices (
|
||||||
|
h5_file_t* const f /*!< file handle */
|
||||||
|
) {
|
||||||
|
H5_API_ENTER1 (h5_ssize_t, "f=0x%p", f);
|
||||||
|
H5_API_RETURN (h5t_get_num_vertices (f, -1));
|
||||||
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
Returns the number of vertices used for defining the (sub-)mesh
|
||||||
|
at current level on compute node \c cnode.
|
||||||
|
|
||||||
|
\param[in] f file handle
|
||||||
|
\param[in] cnode compute node
|
||||||
|
|
||||||
|
\return Number of vertices or error code.
|
||||||
|
*/
|
||||||
|
static inline h5_ssize_t
|
||||||
|
H5FedGetNumVerticesCnode (
|
||||||
|
h5_file_t* const f,
|
||||||
|
const int cnode
|
||||||
|
) {
|
||||||
|
H5_API_ENTER2 (h5_ssize_t, "f=0x%p, cnode=%d", f, cnode);
|
||||||
|
H5_API_RETURN (h5t_get_num_vertices (f, cnode));
|
||||||
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
Returns the number of vertices used for defining the (sub-)mesh
|
||||||
|
at current level overl all compute nodes.
|
||||||
|
|
||||||
|
\param[in] f file handle
|
||||||
|
|
||||||
|
\return Total number of vertices or error code.
|
||||||
|
*/
|
||||||
|
static inline h5_ssize_t
|
||||||
|
H5FedGetNumVerticesTotal (
|
||||||
|
h5_file_t* const f
|
||||||
|
) {
|
||||||
|
H5_API_ENTER1 (h5_ssize_t, "f=0x%p", f);
|
||||||
|
H5_API_RETURN (h5t_get_num_vertices (f, -1));
|
||||||
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
Returns the number of elements present in the (sub-)mesh
|
||||||
|
at current level on this compute node.
|
||||||
|
|
||||||
|
\param[in] f file handle
|
||||||
|
|
||||||
|
\return Number of elements or error code.
|
||||||
|
*/
|
||||||
|
static inline h5_ssize_t
|
||||||
|
H5FedGetNumElements (
|
||||||
|
h5_file_t* const f
|
||||||
|
) {
|
||||||
|
H5_API_ENTER1 (h5_ssize_t, "f=0x%p", f);
|
||||||
|
// MLH: can't use field from opaque h5_file_t!
|
||||||
|
//h5_ssize_t num = h5t_get_num_elems (f, f->myproc);
|
||||||
|
H5_API_RETURN (h5t_get_num_elems (f, -1));
|
||||||
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
Returns the number of elements present in the (sub-)mesh
|
||||||
|
at current level on compute node \c cnode.
|
||||||
|
|
||||||
|
\param[in] f file handle
|
||||||
|
\param[in] cnode Compute node
|
||||||
|
|
||||||
|
\return Number of elements or error code.
|
||||||
|
*/
|
||||||
|
static inline h5_ssize_t
|
||||||
|
H5FedGetNumElementsCnode (
|
||||||
|
h5_file_t* const f,
|
||||||
|
const int cnode
|
||||||
|
) {
|
||||||
|
H5_API_ENTER2 (h5_ssize_t, "f=0x%p, cnode=%d", f, cnode);
|
||||||
|
H5_API_RETURN (h5t_get_num_elems (f, cnode));
|
||||||
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
Returns the number of elements present in the mesh
|
||||||
|
at current level over all compute nodes.
|
||||||
|
|
||||||
|
\param[in] f File handle.
|
||||||
|
|
||||||
|
\return Number of elements or error code.
|
||||||
|
*/
|
||||||
|
static inline h5_ssize_t
|
||||||
|
H5FedGetNumElementsTotal (
|
||||||
|
h5_file_t* const f
|
||||||
|
) {
|
||||||
|
H5_API_ENTER1 (h5_ssize_t, "f=0x%p", f);
|
||||||
|
H5_API_RETURN (h5t_get_num_elems (f, -1));
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|||||||
+122
-33
@@ -19,73 +19,162 @@
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
h5t_iterator_t*
|
|
||||||
|
/*!
|
||||||
|
Begin traverse over all entities on this compute node.
|
||||||
|
Initialize internal data structures.
|
||||||
|
|
||||||
|
\remark
|
||||||
|
Entities might be on processor boundaries! Therefore the same entity might be
|
||||||
|
processed on several compute nodes.
|
||||||
|
|
||||||
|
\param[in] f file handle
|
||||||
|
\param[in] codim co-dimension of entity to traverse
|
||||||
|
|
||||||
|
\return H5_SUCCESS or error code
|
||||||
|
*/
|
||||||
|
|
||||||
|
static inline h5t_iterator_p
|
||||||
H5FedBeginTraverseEntities (
|
H5FedBeginTraverseEntities (
|
||||||
h5_file_t* const f,
|
h5_file_t* const f,
|
||||||
int codim
|
const int codim
|
||||||
);
|
) {
|
||||||
h5t_iterator_t*
|
H5_API_ENTER2 (h5t_iterator_p, "f=0x%p, codim=%d", f, codim);
|
||||||
|
h5t_iterator_p iter;
|
||||||
|
TRY3 (h5t_iterator_p, iter = (h5t_iterator_p)h5_calloc (1, sizeof (*iter)));
|
||||||
|
TRY3 (h5t_iterator_p, h5t_init_leaf_iterator (f, iter, codim));
|
||||||
|
H5_API_RETURN (iter);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline h5t_iterator_p
|
||||||
H5FedBeginTraverseBoundaryFaces (
|
H5FedBeginTraverseBoundaryFaces (
|
||||||
h5_file_t* const f,
|
h5_file_t* const f,
|
||||||
int codim
|
const int codim
|
||||||
);
|
) {
|
||||||
h5_loc_id_t
|
H5_API_ENTER2 (h5t_iterator_p, "f=0x%p, codim=%d", f, codim);
|
||||||
|
h5t_iterator_p iter;
|
||||||
|
TRY3 (h5t_iterator_p, iter = (h5t_iterator_p)h5_calloc (1, sizeof (*iter)));
|
||||||
|
TRY3 (h5t_iterator_p, h5t_init_boundary_face_iterator (f, iter, codim));
|
||||||
|
H5_API_RETURN (iter);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
Get next local entity ID.
|
||||||
|
|
||||||
|
\param[in] f file handle
|
||||||
|
\param[in/out] iter iterator
|
||||||
|
|
||||||
|
\return Local entity ID
|
||||||
|
\return -1, if done
|
||||||
|
\return error code on error
|
||||||
|
*/
|
||||||
|
static inline h5_loc_id_t
|
||||||
H5FedTraverseEntities (
|
H5FedTraverseEntities (
|
||||||
h5_file_t* const f,
|
h5_file_t* const f,
|
||||||
h5t_iterator_t* iter
|
h5t_iterator_t* iter
|
||||||
);
|
) {
|
||||||
h5_err_t
|
H5_API_ENTER2 (h5_loc_id_t, "f=0x%p, iter=0x%p", f, iter);
|
||||||
|
H5_API_RETURN (h5t_iterate_entities (f, iter));
|
||||||
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
End of traversing. Release internal data structures.
|
||||||
|
|
||||||
|
\param[in] f File handle
|
||||||
|
|
||||||
|
\return H5_SUCCESS or error code
|
||||||
|
|
||||||
|
*/
|
||||||
|
static inline h5_err_t
|
||||||
H5FedEndTraverseEntities (
|
H5FedEndTraverseEntities (
|
||||||
h5_file_t* const f,
|
h5_file_t* const f,
|
||||||
h5t_iterator_t* iter
|
h5t_iterator_t* iter
|
||||||
);
|
) {
|
||||||
h5_err_t
|
H5_API_ENTER2 (h5_err_t, "f=0x%p, iter=0x%p", f, iter);
|
||||||
|
H5_API_RETURN (h5t_release_entity_iterator (f, iter));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
Get coordinates of vertex given by local index
|
||||||
|
|
||||||
|
\param[in] f file handle
|
||||||
|
\param[in] vertex_idx local index of vertex
|
||||||
|
\param[out] P 3-dimensional coordinates
|
||||||
|
|
||||||
|
\return H5_SUCCESS or error code
|
||||||
|
*/
|
||||||
|
static inline h5_err_t
|
||||||
H5FedGetVertexCoordsByIndex (
|
H5FedGetVertexCoordsByIndex (
|
||||||
h5_file_t* const f,
|
h5_file_t* const f,
|
||||||
h5_loc_idx_t vertex_index,
|
h5_loc_idx_t vertex_index,
|
||||||
h5_float64_t P[3]
|
h5_float64_t P[3]
|
||||||
);
|
) {
|
||||||
h5_err_t
|
H5_API_ENTER3 (h5_err_t,
|
||||||
|
"f=0x%p, vertex_index=%lld, P=0x%p",
|
||||||
|
f, (long long)vertex_index, P);
|
||||||
|
H5_API_RETURN (h5t_get_vertex_coords_by_index (f, vertex_index, P));
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline h5_err_t
|
||||||
H5FedGetVertexCoordsByID (
|
H5FedGetVertexCoordsByID (
|
||||||
h5_file_t* const f,
|
h5_file_t* const f,
|
||||||
h5_loc_id_t vertex_id,
|
h5_loc_id_t vertex_id,
|
||||||
h5_float64_t P[3]
|
h5_float64_t P[3]
|
||||||
);
|
) {
|
||||||
|
H5_API_ENTER3 (h5_err_t,
|
||||||
|
"f=0x%p, vertex_id=%lld, P=0x%p",
|
||||||
|
f, (long long)vertex_id, P);
|
||||||
|
H5_API_RETURN (h5t_get_vertex_coords_by_id (f, vertex_id, P));
|
||||||
|
}
|
||||||
|
|
||||||
h5_err_t
|
static inline h5_err_t
|
||||||
H5FedGetVertexIndicesOfEdge (
|
H5FedGetVertexIndicesOfEdge (
|
||||||
h5_file_t* const f,
|
h5_file_t* const f,
|
||||||
h5_loc_id_t entity_id,
|
h5_loc_id_t entity_id,
|
||||||
h5_loc_idx_t* const vertex_indices
|
h5_loc_idx_t* vertex_indices
|
||||||
);
|
) {
|
||||||
|
H5_API_ENTER3 (h5_err_t,
|
||||||
|
"f=0x%p, entity_id=%lld, vertex_indices=0x%p",
|
||||||
|
f, (long long)entity_id, vertex_indices);
|
||||||
|
H5_API_RETURN (h5t_get_vertex_indices_of_edge (f, entity_id, vertex_indices));
|
||||||
|
}
|
||||||
|
|
||||||
h5_err_t
|
static inline h5_err_t
|
||||||
H5FedGetVertexIndicesOfTriangle (
|
H5FedGetVertexIndicesOfTriangle (
|
||||||
h5_file_t* const f,
|
h5_file_t* const f,
|
||||||
h5_loc_id_t entity_id,
|
h5_loc_id_t entity_id,
|
||||||
h5_loc_idx_t* const vertex_indices
|
h5_loc_idx_t* vertex_indices
|
||||||
);
|
) {
|
||||||
|
H5_API_ENTER3 (h5_err_t,
|
||||||
|
"f=0x%p, entity_id=%lld, vertex_indices=0x%p",
|
||||||
|
f, (long long)entity_id, vertex_indices);
|
||||||
|
H5_API_RETURN (h5t_get_vertex_indices_of_triangle (f, entity_id, vertex_indices));
|
||||||
|
}
|
||||||
|
|
||||||
h5_err_t
|
static inline h5_err_t
|
||||||
H5FedGetVertexIndicesOfTriangleCClockwise (
|
|
||||||
h5_file_t* const f,
|
|
||||||
h5_loc_id_t entity_id,
|
|
||||||
h5_loc_idx_t* const vertex_indices
|
|
||||||
);
|
|
||||||
|
|
||||||
h5_err_t
|
|
||||||
H5FedGetVertexIndicesOfTet (
|
H5FedGetVertexIndicesOfTet (
|
||||||
h5_file_t* const f,
|
h5_file_t* const f,
|
||||||
h5_loc_id_t entity_id,
|
h5_loc_id_t entity_id,
|
||||||
h5_loc_idx_t* const vertex_indices
|
h5_loc_idx_t* vertex_indices
|
||||||
);
|
) {
|
||||||
|
H5_API_ENTER3 (h5_err_t,
|
||||||
|
"f=0x%p, entity_id=%lld, vertex_indices=0x%p",
|
||||||
|
f, (long long)entity_id, vertex_indices);
|
||||||
|
H5_API_RETURN (h5t_get_vertex_indices_of_tet (f, entity_id, vertex_indices));
|
||||||
|
}
|
||||||
|
|
||||||
h5_err_t
|
static inline h5_err_t
|
||||||
H5FedGetVertexIndicesOfEntity (
|
H5FedGetVertexIndicesOfEntity (
|
||||||
h5_file_t* const f,
|
h5_file_t* const f,
|
||||||
h5_loc_id_t entity_id,
|
h5_loc_id_t entity_id,
|
||||||
h5_loc_idx_t* const vertex_indices
|
h5_loc_idx_t* vertex_indices
|
||||||
);
|
) {
|
||||||
|
H5_API_ENTER3 (h5_err_t,
|
||||||
|
"f=0x%p, entity_id=%lld, vertex_indices=0x%p",
|
||||||
|
f, (long long)entity_id, vertex_indices);
|
||||||
|
H5_API_RETURN (h5t_get_vertex_indices_of_entity (f, entity_id, vertex_indices));
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|||||||
+136
-44
@@ -39,62 +39,154 @@ H5FedAddTriangleMesh (
|
|||||||
H5_API_RETURN (h5t_add_triangle_mesh (f));
|
H5_API_RETURN (h5t_add_triangle_mesh (f));
|
||||||
}
|
}
|
||||||
|
|
||||||
h5t_lvl_idx_t
|
/*!
|
||||||
|
\ingroup h5fed_c_api
|
||||||
|
|
||||||
|
Add a new level with \c num_elems elements. The number of elements must be the
|
||||||
|
real number of elements to add the level. If you want to refine \c n tetrahedra
|
||||||
|
\c n*8 elements must be added.
|
||||||
|
|
||||||
|
\param[in] f File handle.
|
||||||
|
\param[in] num_elems_to_refine Number of elements which will be refined.
|
||||||
|
|
||||||
|
\return ID of new level.
|
||||||
|
|
||||||
|
\note
|
||||||
|
values for f->t.num_levels:
|
||||||
|
\c -1 unknown: after opening the file. This is equivalent to
|
||||||
|
"topological data has not been initialized".
|
||||||
|
\c 0 no levels: HDF5 group for meshes may already exist but must not!
|
||||||
|
\c > 0 number of mesh levels
|
||||||
|
|
||||||
|
*/
|
||||||
|
static inline h5t_lvl_idx_t
|
||||||
H5FedAddLevel (
|
H5FedAddLevel (
|
||||||
h5_file_t * const f
|
h5_file_t* const f
|
||||||
);
|
) {
|
||||||
|
H5_API_ENTER1 (h5t_lvl_idx_t, "f=0x%p", f);
|
||||||
|
H5_API_RETURN (h5t_add_level (f));
|
||||||
|
}
|
||||||
|
|
||||||
h5_err_t
|
static inline h5_err_t
|
||||||
H5FedBeginStoreVertices (
|
H5FedBeginStoreVertices (
|
||||||
h5_file_t * const f,
|
|
||||||
const h5_size_t num
|
|
||||||
);
|
|
||||||
|
|
||||||
h5_loc_idx_t
|
|
||||||
H5FedStoreVertex (
|
|
||||||
h5_file_t * const f,
|
|
||||||
const h5_glb_idx_t id,
|
|
||||||
const h5_float64_t P[3]
|
|
||||||
);
|
|
||||||
|
|
||||||
h5_err_t
|
|
||||||
H5FedEndStoreVertices (
|
|
||||||
h5_file_t * const f
|
|
||||||
);
|
|
||||||
|
|
||||||
h5_err_t
|
|
||||||
H5FedBeginStoreElements (
|
|
||||||
h5_file_t * const f,
|
|
||||||
const h5_size_t num
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
h5_loc_idx_t
|
|
||||||
H5FedStoreElement (
|
|
||||||
h5_file_t* const f,
|
h5_file_t* const f,
|
||||||
const h5_loc_idx_t local_vids[]
|
const h5_size_t num
|
||||||
);
|
) {
|
||||||
|
H5_API_ENTER2 (h5_err_t,
|
||||||
|
"f=0x%p, num=%llu",
|
||||||
|
f, (long long unsigned)num);
|
||||||
|
H5_API_RETURN (h5t_begin_store_vertices (f, num));
|
||||||
|
}
|
||||||
|
|
||||||
h5_err_t
|
/*!
|
||||||
|
\ingroup h5fed_c_api
|
||||||
|
|
||||||
|
Stores the the coordinates of a specific vertex at level \c level
|
||||||
|
with id \c vertex_id of the tetrahedral mesh.
|
||||||
|
|
||||||
|
\return local vertex id on success
|
||||||
|
\return errno on error
|
||||||
|
*/
|
||||||
|
static inline h5_loc_idx_t
|
||||||
|
H5FedStoreVertex (
|
||||||
|
h5_file_t* const f, /*!< file handle */
|
||||||
|
const h5_glb_id_t vertex_id, /*!< id from mesher or -1 */
|
||||||
|
const h5_float64_t P[3] /*!< coordinates */
|
||||||
|
) {
|
||||||
|
H5_API_ENTER3 (h5_loc_idx_t,
|
||||||
|
"f=0x%p, vertex_id=%lld, P=0x%p",
|
||||||
|
f, (long long)vertex_id, P);
|
||||||
|
if (h5t_get_level (f) != 0) {
|
||||||
|
H5_API_LEAVE (
|
||||||
|
h5_error (
|
||||||
|
H5_ERR_INVAL,
|
||||||
|
"Vertices can be added to level 0 only!"));
|
||||||
|
}
|
||||||
|
H5_API_RETURN (h5t_store_vertex (f, vertex_id, P));
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline h5_err_t
|
||||||
|
H5FedEndStoreVertices (
|
||||||
|
h5_file_t* const f
|
||||||
|
) {
|
||||||
|
H5_API_ENTER1 (h5_err_t, "f=0x%p", f);
|
||||||
|
H5_API_RETURN (h5t_end_store_vertices (f));
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline h5_err_t
|
||||||
|
H5FedBeginStoreElements (
|
||||||
|
h5_file_t* const f,
|
||||||
|
const h5_size_t num
|
||||||
|
) {
|
||||||
|
H5_API_ENTER2 (h5_err_t,
|
||||||
|
"f=0x%p, num=%llu",
|
||||||
|
f, (long long unsigned)num);
|
||||||
|
H5_API_RETURN (h5t_begin_store_elems (f, num));
|
||||||
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\ingroup h5fed_c_api
|
||||||
|
|
||||||
|
Stores the 4-tuple, that contains the specific indices describing
|
||||||
|
a tetrahedron with id \c tet_id at level \c level of the tetrahedral
|
||||||
|
mesh.
|
||||||
|
|
||||||
|
Errors:
|
||||||
|
* current level not yet defined
|
||||||
|
* to many tets stored on level
|
||||||
|
|
||||||
|
\return local tetrahedron id
|
||||||
|
\return \c errno on error
|
||||||
|
*/
|
||||||
|
static inline h5_loc_idx_t
|
||||||
|
H5FedStoreElement (
|
||||||
|
h5_file_t* const f, /*!< file handle */
|
||||||
|
const h5_loc_idx_t local_vids[] /*!< tuple with vertex id's */
|
||||||
|
) {
|
||||||
|
H5_API_ENTER2 (h5_loc_idx_t, "f=0x%p, local_vids=0x%p", f, local_vids);
|
||||||
|
if (h5t_get_level (f) != 0) {
|
||||||
|
H5_API_LEAVE (
|
||||||
|
h5_error (
|
||||||
|
H5_ERR_INVAL,
|
||||||
|
"Elements can be added to level 0 only!"));
|
||||||
|
}
|
||||||
|
H5_API_RETURN (h5t_store_elem (f, -1, local_vids));
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline h5_err_t
|
||||||
H5FedEndStoreElements (
|
H5FedEndStoreElements (
|
||||||
h5_file_t * const f
|
h5_file_t* const f
|
||||||
);
|
) {
|
||||||
|
H5_API_ENTER1 (h5_err_t, "f=0x%p", f);
|
||||||
|
H5_API_RETURN (h5t_end_store_elems (f));
|
||||||
|
}
|
||||||
|
|
||||||
h5_err_t
|
static inline h5_err_t
|
||||||
H5FedBeginRefineElements (
|
H5FedBeginRefineElements (
|
||||||
h5_file_t * const f
|
h5_file_t* const f
|
||||||
);
|
) {
|
||||||
|
H5_API_ENTER1 (h5_err_t, "f=0x%p", f);
|
||||||
|
H5_API_RETURN (h5t_begin_refine_elems (f));
|
||||||
|
}
|
||||||
|
|
||||||
h5_loc_idx_t
|
static inline h5_loc_idx_t
|
||||||
H5FedRefineElement (
|
H5FedRefineElement (
|
||||||
h5_file_t * const f,
|
h5_file_t* const f, /*!< file handle */
|
||||||
const h5_loc_idx_t elem_idx
|
const h5_loc_id_t local_eid /*!< local element id */
|
||||||
);
|
) {
|
||||||
|
H5_API_ENTER2 (h5_loc_idx_t,
|
||||||
|
"f=0x%p, local_eid=%lld",
|
||||||
|
f, (long long)local_eid);
|
||||||
|
H5_API_RETURN (h5t_mark_entity (f, local_eid));
|
||||||
|
}
|
||||||
|
|
||||||
h5_err_t
|
static inline h5_err_t
|
||||||
H5FedEndRefineElements (
|
H5FedEndRefineElements (
|
||||||
h5_file_t * const f
|
h5_file_t* const f
|
||||||
);
|
) {
|
||||||
|
H5_API_ENTER1 (h5_err_t, "f=0x%p", f);
|
||||||
|
H5_API_RETURN (h5t_end_refine_elems (f));
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|||||||
+114
-19
@@ -5,49 +5,144 @@
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
h5_err_t
|
/*!
|
||||||
|
Add a tagset to the current mesh.
|
||||||
|
|
||||||
|
\param[in] f file handle
|
||||||
|
\param[in] name name of tagset
|
||||||
|
\param[in] type data type of tagset
|
||||||
|
|
||||||
|
\return H5_SUCCESS or error code
|
||||||
|
*/
|
||||||
|
static inline h5_err_t
|
||||||
H5FedAddMTagset (
|
H5FedAddMTagset (
|
||||||
h5_file_t* const f,
|
h5_file_t* const f,
|
||||||
char* name,
|
char* name,
|
||||||
h5_id_t type
|
h5_id_t type
|
||||||
);
|
) {
|
||||||
h5_err_t
|
H5_API_ENTER3 (h5_err_t, "f=0x%p, name=\"%s\", type=%lld",
|
||||||
|
f, name, (long long)type);
|
||||||
|
H5_API_RETURN (h5t_add_mtagset (f, name, type));
|
||||||
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
Remove a tagset from the current mesh.
|
||||||
|
|
||||||
|
\param[in] f file handle
|
||||||
|
\param[in] name name of tagset to remove
|
||||||
|
|
||||||
|
\return H5_SUCCESS or error code
|
||||||
|
*/
|
||||||
|
static inline h5_err_t
|
||||||
H5FedRemoveMTagset (
|
H5FedRemoveMTagset (
|
||||||
h5_file_t* const f,
|
h5_file_t* const f,
|
||||||
char name[]
|
char name[]
|
||||||
);
|
) {
|
||||||
h5_ssize_t
|
H5_API_ENTER2 (h5_err_t, "f=0x%p, name=\"%s\"", f, name);
|
||||||
|
H5_API_RETURN (h5t_remove_mtagset (f, name));
|
||||||
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
Get available tagsets in current mesh.
|
||||||
|
|
||||||
|
\param[in] f file handle
|
||||||
|
\param[out] names names of available tagsets
|
||||||
|
|
||||||
|
\return Number of tagsets or error code
|
||||||
|
*/
|
||||||
|
static inline h5_ssize_t
|
||||||
H5FedGetMTagsets (
|
H5FedGetMTagsets (
|
||||||
h5_file_t* const f,
|
h5_file_t* const f,
|
||||||
char** names[]
|
char** names[]
|
||||||
);
|
) {
|
||||||
h5_id_t
|
H5_API_ENTER2 (h5_ssize_t, "f=0x%p, names=0x%p", f, names);
|
||||||
|
H5_API_RETURN (h5t_get_mtagsets (f, names));
|
||||||
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
Get type of tagset in current mesh.
|
||||||
|
|
||||||
|
\param[in] f file handle
|
||||||
|
\param[in] name name of tagset
|
||||||
|
|
||||||
|
\return H5_SUCCESS or error code
|
||||||
|
*/
|
||||||
|
static inline h5_id_t
|
||||||
H5FedGetTypeOfMTagset (
|
H5FedGetTypeOfMTagset (
|
||||||
h5_file_t* const f,
|
h5_file_t* const f,
|
||||||
char name[]
|
char name[]
|
||||||
);
|
) {
|
||||||
h5_err_t
|
H5_API_ENTER2 (h5_err_t, "f=0x%p, name=\"%s\"", f, name);
|
||||||
|
H5_API_RETURN (h5t_get_mtagset_type_by_name (f, name));
|
||||||
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
Set tag for entity in current mesh.
|
||||||
|
|
||||||
|
\param[in] f file handle
|
||||||
|
\param[in] name names of tagset
|
||||||
|
\param[in] id id of entity
|
||||||
|
\param[in] dim dimension of value
|
||||||
|
\param[in] val tag value
|
||||||
|
|
||||||
|
\return H5_SUCCESS or error code
|
||||||
|
*/
|
||||||
|
static inline h5_err_t
|
||||||
H5FedSetMTag (
|
H5FedSetMTag (
|
||||||
h5_file_t* const f,
|
h5_file_t* const f,
|
||||||
char name[],
|
char name[],
|
||||||
h5_loc_id_t entity_id,
|
h5_loc_id_t id,
|
||||||
const size_t dims,
|
const size_t dim,
|
||||||
void* val
|
void* buffer
|
||||||
);
|
) {
|
||||||
h5_err_t
|
H5_API_ENTER5 (h5_err_t,
|
||||||
|
"f=0x%p, name=\"%s\", id=%lld, dim=%lld, val=0x%p",
|
||||||
|
f, name, (long long)id, (long long)dim, buffer);
|
||||||
|
H5_API_RETURN (h5t_set_mtag_by_name (f, name, id, dim, buffer));
|
||||||
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
Set tag for entity in current mesh.
|
||||||
|
|
||||||
|
\param[in] f file handle
|
||||||
|
\param[in] name names of tagset
|
||||||
|
\param[in] id id of entity
|
||||||
|
\param[out] dim dimension of value
|
||||||
|
\param[out] val tag value
|
||||||
|
|
||||||
|
\return H5_SUCCESS or error code
|
||||||
|
*/
|
||||||
|
static inline h5_err_t
|
||||||
H5FedGetMTag (
|
H5FedGetMTag (
|
||||||
h5_file_t* const f,
|
h5_file_t* const f,
|
||||||
const char name[],
|
const char name[],
|
||||||
const h5_loc_id_t id,
|
const h5_loc_id_t id,
|
||||||
size_t* dims,
|
size_t* dim,
|
||||||
void* val
|
void* buffer
|
||||||
);
|
) {
|
||||||
h5_err_t
|
H5_API_ENTER5 (h5_err_t,
|
||||||
|
"f=0x%p, name=\"%s\", id=%lld, dim=0x%p, val=0x%p",
|
||||||
|
f, name, (long long)id, dim, buffer);
|
||||||
|
H5_API_RETURN (h5t_get_mtag_by_name (f, name, id, dim, buffer));
|
||||||
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
Remove tag for entity in current mesh.
|
||||||
|
|
||||||
|
\param[in] f file handle
|
||||||
|
\param[in] name names of tagset
|
||||||
|
\param[in] id id of entity
|
||||||
|
*/
|
||||||
|
static inline h5_err_t
|
||||||
H5FedRemoveMTag (
|
H5FedRemoveMTag (
|
||||||
h5_file_t* const f,
|
h5_file_t* const f,
|
||||||
const char name[],
|
const char name[],
|
||||||
const h5_loc_id_t id
|
const h5_loc_id_t id
|
||||||
);
|
) {
|
||||||
|
H5_API_ENTER3 (h5_err_t, "f=0x%p, name=\"%s\", id=%lld",
|
||||||
|
f, name, (long long)id);
|
||||||
|
H5_API_RETURN (h5t_remove_mtag_by_name (f, name, id));
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,15 +13,32 @@ extern "C" {
|
|||||||
#define H5_DEBUG_PRIV_API (1<<5)
|
#define H5_DEBUG_PRIV_API (1<<5)
|
||||||
#define H5_DEBUG_PRIV_FUNC (1<<6)
|
#define H5_DEBUG_PRIV_FUNC (1<<6)
|
||||||
#define H5_DEBUG_HDF5 (1<<7)
|
#define H5_DEBUG_HDF5 (1<<7)
|
||||||
#define H5_DEBUG_MALLOC (1<<8)
|
#define H5_DEBUG_MPI (1<<8)
|
||||||
#define H5_DEBUG_CLIB (1<<9)
|
#define H5_DEBUG_MALLOC (1<<9)
|
||||||
|
#define H5_DEBUG_CLIB (1<<10)
|
||||||
|
|
||||||
#define H5_DEBUG_ALL (-1)
|
#define H5_DEBUG_ALL (-1)
|
||||||
|
|
||||||
extern char* h5_rfmts[];
|
extern char* h5_rfmts[];
|
||||||
|
|
||||||
#define __FUNC_ENTER(type) \
|
#define __FUNC_ENTER(type) \
|
||||||
h5_call_stack_push (__func__,e_##type); \
|
h5_call_stack_push (__func__,e_##type); \
|
||||||
type ret_value = (type)H5_ERR;
|
type ret_value = (type)H5_ERR;
|
||||||
|
|
||||||
|
#if defined(NDEBUG)
|
||||||
|
|
||||||
|
#define __FUNC_ARGS0(mask)
|
||||||
|
#define __FUNC_ARGS1(fmt, a1, mask)
|
||||||
|
#define __FUNC_ARGS2(fmt, a1, a2, mask)
|
||||||
|
#define __FUNC_ARGS3(fmt, a1, a2, a3, mask)
|
||||||
|
#define __FUNC_ARGS4(fmt, a1, a2, a3, a4, mask)
|
||||||
|
#define __FUNC_ARGS5(fmt, a1, a2, a3, a4, a5, mask)
|
||||||
|
#define __FUNC_ARGS6(fmt, a1, a2, a3, a4, a5, a6, mask)
|
||||||
|
#define __FUNC_ARGS7(fmt, a1, a2, a3, a4, a5, a6, a7, mask)
|
||||||
|
#define __FUNC_ARGS8(fmt, a1, a2, a3, a4, a5, a6, a7, a8, mask)
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
#define __FUNC_ARGS0(mask) \
|
#define __FUNC_ARGS0(mask) \
|
||||||
if (h5_debug_level & mask ) { \
|
if (h5_debug_level & mask ) { \
|
||||||
h5_debug ("(void)"); \
|
h5_debug ("(void)"); \
|
||||||
@@ -66,6 +83,7 @@ extern char* h5_rfmts[];
|
|||||||
if (h5_debug_level & mask ) { \
|
if (h5_debug_level & mask ) { \
|
||||||
h5_debug ("(" fmt ")", a1, a2, a3, a4, a5, a6, a7, a8); \
|
h5_debug ("(" fmt ")", a1, a2, a3, a4, a5, a6, a7, a8); \
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#define __FUNC_ENTER0(type, mask) \
|
#define __FUNC_ENTER0(type, mask) \
|
||||||
__FUNC_ENTER(type); \
|
__FUNC_ENTER(type); \
|
||||||
@@ -108,6 +126,17 @@ extern char* h5_rfmts[];
|
|||||||
goto done; \
|
goto done; \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(NDEBUG)
|
||||||
|
|
||||||
|
#define __FUNC_RETURN(expr, mask) \
|
||||||
|
ret_value = expr; \
|
||||||
|
goto done; \
|
||||||
|
done: \
|
||||||
|
h5_call_stack_pop(); \
|
||||||
|
return ret_value;
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
#define __FUNC_RETURN(expr, mask) \
|
#define __FUNC_RETURN(expr, mask) \
|
||||||
ret_value = expr; \
|
ret_value = expr; \
|
||||||
goto done; \
|
goto done; \
|
||||||
@@ -121,6 +150,7 @@ done: \
|
|||||||
h5_call_stack_pop(); \
|
h5_call_stack_pop(); \
|
||||||
return ret_value;
|
return ret_value;
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
#define H5_API_ENTER_(type) \
|
#define H5_API_ENTER_(type) \
|
||||||
if (!h5_initialized) { \
|
if (!h5_initialized) { \
|
||||||
@@ -180,12 +210,11 @@ done: \
|
|||||||
goto done; \
|
goto done; \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define TRY3( expr, ret_val ) \
|
#define TRY3( type, expr ) \
|
||||||
if ((int64_t)(ptrdiff_t)(expr) <= (int64_t)H5_ERR) { \
|
if ((int64_t)(ptrdiff_t)(expr) <= (int64_t)H5_ERR) { \
|
||||||
ret_value = ret_val; \
|
ret_value = (type) H5_ERR; \
|
||||||
goto done; \
|
goto done; \
|
||||||
}
|
}
|
||||||
#define ON_ERROR
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,17 +12,27 @@ h5_open_file (
|
|||||||
MPI_Comm comm
|
MPI_Comm comm
|
||||||
);
|
);
|
||||||
|
|
||||||
h5_int64_t
|
h5_err_t
|
||||||
h5_check_filehandle (
|
h5_check_filehandle (
|
||||||
h5_file_t * const f
|
h5_file_t * const f
|
||||||
);
|
);
|
||||||
|
|
||||||
h5_int64_t
|
h5_err_t
|
||||||
h5_close_file (
|
h5_close_file (
|
||||||
h5_file_t * const f
|
h5_file_t * const f
|
||||||
);
|
);
|
||||||
|
|
||||||
h5_int64_t
|
h5_err_t
|
||||||
|
h5_flush_step (
|
||||||
|
h5_file_t * const f
|
||||||
|
);
|
||||||
|
|
||||||
|
h5_err_t
|
||||||
|
h5_flush_file (
|
||||||
|
h5_file_t * const f
|
||||||
|
);
|
||||||
|
|
||||||
|
h5_err_t
|
||||||
h5_set_stepname_fmt (
|
h5_set_stepname_fmt (
|
||||||
h5_file_t * const f,
|
h5_file_t * const f,
|
||||||
const char *name,
|
const char *name,
|
||||||
|
|||||||
@@ -24,6 +24,8 @@ extern "C" {
|
|||||||
#define H5_VFD_MPIPOSIX 0x10
|
#define H5_VFD_MPIPOSIX 0x10
|
||||||
#define H5_VFD_INDEPENDENT 0x20
|
#define H5_VFD_INDEPENDENT 0x20
|
||||||
|
|
||||||
|
#define H5_O_FLUSHSTEP 0x40
|
||||||
|
|
||||||
#define H5_ID_T H5T_NATIVE_INT64
|
#define H5_ID_T H5T_NATIVE_INT64
|
||||||
#define H5_FLOAT64_T H5T_NATIVE_DOUBLE
|
#define H5_FLOAT64_T H5T_NATIVE_DOUBLE
|
||||||
#define H5_FLOAT32_T H5T_NATIVE_FLOAT
|
#define H5_FLOAT32_T H5T_NATIVE_FLOAT
|
||||||
|
|||||||
+10
-9
@@ -5,9 +5,6 @@ SUBDIRS = H5Fed
|
|||||||
|
|
||||||
OBJEXT=o
|
OBJEXT=o
|
||||||
|
|
||||||
AM_LDFLAGS = -L../src/lib @LDFLAGS@
|
|
||||||
LIBS = -lH5hutC -lH5hut @LIBS@
|
|
||||||
|
|
||||||
INCLUDES = -I../src/include @INCLUDES@
|
INCLUDES = -I../src/include @INCLUDES@
|
||||||
|
|
||||||
noinst_PROGRAMS = @BUILD_TESTS@
|
noinst_PROGRAMS = @BUILD_TESTS@
|
||||||
@@ -25,6 +22,10 @@ h5u_test_SOURCES = \
|
|||||||
testframe.h \
|
testframe.h \
|
||||||
params.h
|
params.h
|
||||||
|
|
||||||
|
h5u_test_LDADD = \
|
||||||
|
../src/h5core/libH5hut.la \
|
||||||
|
../src/C/libH5hutC.la
|
||||||
|
|
||||||
h5b_test_SOURCES = \
|
h5b_test_SOURCES = \
|
||||||
h5b_test.c \
|
h5b_test.c \
|
||||||
h5b_write.c \
|
h5b_write.c \
|
||||||
@@ -33,16 +34,16 @@ h5b_test_SOURCES = \
|
|||||||
testframe.h \
|
testframe.h \
|
||||||
params.h
|
params.h
|
||||||
|
|
||||||
h5b_test_DEPENDENCIES = \
|
h5b_test_LDADD = \
|
||||||
../src/lib/libH5hut.a \
|
../src/h5core/libH5hut.la \
|
||||||
../src/lib/libH5hutC.a
|
../src/C/libH5hutC.la
|
||||||
|
|
||||||
h5_attach_test_SOURCES = \
|
h5_attach_test_SOURCES = \
|
||||||
h5_attach_test.c
|
h5_attach_test.c
|
||||||
|
|
||||||
h5_attach_test_DEPENDENCIES = \
|
h5_attach_test_LDADD = \
|
||||||
../src/h5core/libH5hut.a \
|
../src/h5core/libH5hut.la \
|
||||||
../src/C/libH5hutC.a
|
../src/C/libH5hutC.la
|
||||||
|
|
||||||
clean: clean-am
|
clean: clean-am
|
||||||
rm -f *.h5
|
rm -f *.h5
|
||||||
|
|||||||
+7
-8
@@ -175,10 +175,6 @@ test_read_data64(h5_file_t *file, int nparticles, int step)
|
|||||||
status = H5PartSetView(file, start, end);
|
status = H5PartSetView(file, start, end);
|
||||||
RETURN(status, H5_SUCCESS, "H5PartSetView");
|
RETURN(status, H5_SUCCESS, "H5PartSetView");
|
||||||
|
|
||||||
status = H5PartReadDataFloat64(file, "x", x);
|
|
||||||
RETURN(status, H5_SUCCESS, "H5PartReadDataFloat64");
|
|
||||||
FVALUE(x[rank], (double)(start+rank+nparticles*t), "x data");
|
|
||||||
|
|
||||||
val = H5PartGetView(file, &start, &end);
|
val = H5PartGetView(file, &start, &end);
|
||||||
IVALUE(val, nprocs*nparticles-start, "particle count");
|
IVALUE(val, nprocs*nparticles-start, "particle count");
|
||||||
IVALUE(start, rank, "view start");
|
IVALUE(start, rank, "view start");
|
||||||
@@ -212,10 +208,13 @@ test_read_data64(h5_file_t *file, int nparticles, int step)
|
|||||||
val = H5PartGetNumParticles(file);
|
val = H5PartGetNumParticles(file);
|
||||||
IVALUE(val, 4, "particle count");
|
IVALUE(val, 4, "particle count");
|
||||||
|
|
||||||
x[3] = 0;
|
double x2[4];
|
||||||
status = H5PartReadDataFloat64(file, "x", x);
|
status = H5PartReadDataFloat64(file, "x", x2);
|
||||||
RETURN(status, H5_SUCCESS, "H5PartReadDataFloat64");
|
RETURN(status, H5_SUCCESS, "H5PartReadDataFloat64");
|
||||||
FVALUE(x[3], (double)(rank*2+3+nparticles*t), "x data");
|
FVALUE(x2[0], (double)(2*rank+0+nparticles*t), "x data");
|
||||||
|
FVALUE(x2[1], (double)(2*rank+3+nparticles*t), "x data");
|
||||||
|
FVALUE(x2[2], (double)(2*rank+9+nparticles*t), "x data");
|
||||||
|
FVALUE(x2[3], (double)(2*rank+7+nparticles*t), "x data");
|
||||||
|
|
||||||
val = H5PartGetNumParticles(file);
|
val = H5PartGetNumParticles(file);
|
||||||
IVALUE(val, 4, "particle count");
|
IVALUE(val, 4, "particle count");
|
||||||
@@ -347,7 +346,7 @@ test_read_data32(h5_file_t *file, int nparticles, int step)
|
|||||||
RETURN(status, H5_SUCCESS, "H5PartSetCanonicalView");
|
RETURN(status, H5_SUCCESS, "H5PartSetCanonicalView");
|
||||||
|
|
||||||
test_read_step_attribs(file, t);
|
test_read_step_attribs(file, t);
|
||||||
|
return;
|
||||||
status = H5PartReadDataFloat32(file, "x", x);
|
status = H5PartReadDataFloat32(file, "x", x);
|
||||||
RETURN(status, H5_SUCCESS, "H5PartReadDataFloat32");
|
RETURN(status, H5_SUCCESS, "H5PartReadDataFloat32");
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,5 @@
|
|||||||
aclocal
|
aclocal
|
||||||
autoconf
|
autoconf
|
||||||
automake -a -c
|
automake -a -c
|
||||||
./configure --prefix=$HOME --with-h5part=$HOME --enable-boost
|
|
||||||
make
|
|
||||||
#make install
|
|
||||||
|
|
||||||
|
|||||||
Vendored
-6704
File diff suppressed because it is too large
Load Diff
@@ -69,32 +69,40 @@ AC_LANG_PUSH(C)
|
|||||||
[AC_MSG_ERROR(hdf5 library not found!)]
|
[AC_MSG_ERROR(hdf5 library not found!)]
|
||||||
)
|
)
|
||||||
|
|
||||||
H5PART_PREFIX=""
|
H5HUT_PREFIX=""
|
||||||
H5PART_INCL_PATH=""
|
H5HUT_INCL_PATH=""
|
||||||
H5PART_LIB_PATH=""
|
H5HUT_LIB_PATH=""
|
||||||
AC_ARG_WITH(
|
AC_ARG_WITH(
|
||||||
[h5part],
|
[h5hut],
|
||||||
AC_HELP_STRING([--with-h5part=PREFIX],
|
AC_HELP_STRING([--with-h5hut=PREFIX],
|
||||||
[prefix, parent directory, where the serial(!) h5part library and header files can be found]),
|
[prefix, parent directory, where the serial(!) h5hut library and header files can be found]),
|
||||||
[H5PART_PREFIX=$withval
|
[H5HUT_PREFIX=$withval
|
||||||
H5PART_INCL_PATH=${H5PART_PREFIX}"/include "
|
H5HUT_INCL_PATH=${H5HUT_PREFIX}"/include "
|
||||||
H5PART_LIB_PATH=${H5PART_PREFIX}"/lib "]
|
H5HUT_LIB_PATH=${H5HUT_PREFIX}"/lib "]
|
||||||
)
|
)
|
||||||
if test "${H5PART_PREFIX}" != ""; then
|
if test "${H5HUT_PREFIX}" != ""; then
|
||||||
CPPFLAGS=${CPPFLAGS}" -I"${H5PART_INCL_PATH};
|
CPPFLAGS=${CPPFLAGS}" -I"${H5HUT_INCL_PATH};
|
||||||
LDFLAGS=${LDFLAGS}" -L"${H5PART_LIB_PATH};
|
LDFLAGS=${LDFLAGS}" -L"${H5HUT_LIB_PATH};
|
||||||
fi
|
fi
|
||||||
AC_CHECK_HEADERS(
|
AC_CHECK_HEADERS(
|
||||||
[H5Part.h],
|
[H5hut.h],
|
||||||
[],
|
[],
|
||||||
[AC_MSG_ERROR(H5Part.h not found!)]
|
[AC_MSG_ERROR(H5hut.h not found!)]
|
||||||
)
|
)
|
||||||
AC_CHECK_LIB(
|
AC_CHECK_LIB(
|
||||||
[H5Part],
|
[H5hut],
|
||||||
[main],
|
[main],
|
||||||
[],
|
[],
|
||||||
[AC_MSG_ERROR(H5Part library not found!)]
|
[AC_MSG_ERROR(H5hut library not found!)]
|
||||||
)
|
)
|
||||||
|
AC_CHECK_LIB(
|
||||||
|
[H5hutC],
|
||||||
|
[main],
|
||||||
|
[],
|
||||||
|
[AC_MSG_ERROR(H5hut library not found!)]
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
AC_LANG_POP
|
AC_LANG_POP
|
||||||
AC_LANG(C++)
|
AC_LANG(C++)
|
||||||
|
|
||||||
@@ -139,7 +147,7 @@ AC_C_CONST
|
|||||||
AC_TYPE_SIZE_T
|
AC_TYPE_SIZE_T
|
||||||
|
|
||||||
# Checks for library functions.
|
# Checks for library functions.
|
||||||
AC_FUNC_MALLOC
|
#AC_FUNC_MALLOC
|
||||||
|
|
||||||
CPPFLAGS=$CPPFLAGS" -m64 -mtune=k8"
|
CPPFLAGS=$CPPFLAGS" -m64 -mtune=k8"
|
||||||
LDFLAGS=$LDFLAGS" -lm"
|
LDFLAGS=$LDFLAGS" -lm"
|
||||||
|
|||||||
+745
-924
File diff suppressed because it is too large
Load Diff
+8
-3
@@ -2,13 +2,14 @@
|
|||||||
|
|
||||||
OBJEXT=o
|
OBJEXT=o
|
||||||
|
|
||||||
AM_LDFLAGS = -L../src/lib @LFLAGS@
|
AM_LDFLAGS = -L../src/lib @LDFLAGS@
|
||||||
LIBS = -lH5hutC -lH5hut @LIBS@
|
LIBS = -lH5hutC -lH5hut @LIBS@
|
||||||
|
|
||||||
INCLUDES = -I../src/include @INCLUDES@
|
INCLUDES = -I../src/include @INCLUDES@
|
||||||
|
|
||||||
# What to build... make install will place these files in the $(prefix)/bin directory.
|
# What to build... make install will place these files in the $(prefix)/bin directory.
|
||||||
bin_SCRIPTS = @BUILD_TOOLS@
|
bin_PROGRAMS = @BUILD_TOOLS@
|
||||||
|
EXTRA_PROGRAMS = h5pAttrib h5PartDcToVtk h5PartSurfaceToVtk
|
||||||
|
|
||||||
# Listing of all programs that maybe built. (Has to know statically...)
|
# Listing of all programs that maybe built. (Has to know statically...)
|
||||||
EXTRA_SCRIPTS = h5hutcc
|
EXTRA_SCRIPTS = h5hutcc
|
||||||
@@ -17,11 +18,15 @@ EXTRA_SCRIPTS = h5hutcc
|
|||||||
#EXTRA_DIST = h5pAttrib.cc h5pToGNUplot.cc## TO BE TAILORED LATER...
|
#EXTRA_DIST = h5pAttrib.cc h5pToGNUplot.cc## TO BE TAILORED LATER...
|
||||||
|
|
||||||
# Listing of sources
|
# Listing of sources
|
||||||
#h5pAttrib_SOURCES = h5pAttrib.cc
|
h5pAttrib_SOURCES = h5pAttrib.cc
|
||||||
|
|
||||||
#h5pToGNUplot_SOURCES = h5pToGNUplot.cc
|
#h5pToGNUplot_SOURCES = h5pToGNUplot.cc
|
||||||
|
|
||||||
#homdynToH5p_SOURCES = homdynToH5p.cc
|
#homdynToH5p_SOURCES = homdynToH5p.cc
|
||||||
|
|
||||||
|
h5PartDcToVtk_SOURCES = h5PartDcToVtk.cc
|
||||||
|
|
||||||
|
h5PartSurfaceToVtk_SOURCES = h5PartSurfaceToVtk.cc
|
||||||
|
|
||||||
clean: clean-am
|
clean: clean-am
|
||||||
|
|
||||||
|
|||||||
Executable
+653
@@ -0,0 +1,653 @@
|
|||||||
|
/* h5ToVtk.cc
|
||||||
|
Andreas Adelmann
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <hdf5.h>
|
||||||
|
#include "H5hut.h"
|
||||||
|
|
||||||
|
#include <cmath>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <cctype>
|
||||||
|
#include <string.h>
|
||||||
|
#include <set>
|
||||||
|
#include <iostream>
|
||||||
|
#include <fstream>
|
||||||
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
|
#include <sstream>
|
||||||
|
#include <iomanip>
|
||||||
|
#include <cassert>
|
||||||
|
//#include <string>
|
||||||
|
//#include <cstdlib>
|
||||||
|
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[])
|
||||||
|
{
|
||||||
|
|
||||||
|
h5_file_t *h5file = NULL;
|
||||||
|
|
||||||
|
std::ofstream of, ofalive, ofenergy, ofpnum;
|
||||||
|
|
||||||
|
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 = H5OpenFile(ifn.c_str(), H5_O_WRONLY, NULL);
|
||||||
|
|
||||||
|
if( h5file == NULL ) {
|
||||||
|
fprintf(stdout, "unable to open file %s\n", input_name);
|
||||||
|
print_help();
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
ntime_step = H5GetNumSteps(h5file);
|
||||||
|
|
||||||
|
string ffenergy = string(output_name) + string("energy") + string(".dat");//new
|
||||||
|
ofenergy.open(ffenergy.c_str());//new
|
||||||
|
assert(ofenergy.is_open());//new
|
||||||
|
ofenergy << setprecision(10)//new
|
||||||
|
<< "# Energy" << endl;//new
|
||||||
|
string ffpnum = string(output_name) + string("pnum") + string(".dat");//new
|
||||||
|
ofpnum.open(ffpnum.c_str());//new
|
||||||
|
assert(ofpnum.is_open());//new
|
||||||
|
ofpnum << setprecision(10)//new
|
||||||
|
<< "# time" <<" partNum"<< endl;//new
|
||||||
|
|
||||||
|
if (flg_alive) {
|
||||||
|
|
||||||
|
set<h5_int64_t> idSet;
|
||||||
|
|
||||||
|
|
||||||
|
H5SetStep(h5file, ntime_step-1);
|
||||||
|
num_dataset = H5PartGetNumDatasets(h5file);
|
||||||
|
h5_int64_t nparticles = H5PartGetNumParticles(h5file);
|
||||||
|
|
||||||
|
h5_int64_t* larray = (h5_int64_t*)malloc(sizeof(h5_int64_t)*nparticles);
|
||||||
|
H5PartReadDataInt64(h5file, "id", larray);
|
||||||
|
|
||||||
|
h5_float64_t* z = (h5_float64_t*)malloc(sizeof(h5_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 ++) {
|
||||||
|
|
||||||
|
H5SetStep(h5file,j);
|
||||||
|
// char s_name[64]="ENERGY";//new
|
||||||
|
//h5_float64_t Etmp=0.0;//new
|
||||||
|
//int var_readE=H5PartReadStepAttrib(h5file,s_name,&Etmp);//new
|
||||||
|
//num_dataset = H5PartGetNumDatasets(h5file);//new
|
||||||
|
//Etmp = (Etmp - 0.51099906)*1000000.0;//new eV
|
||||||
|
h5_int64_t nparticles = H5PartGetNumParticles(h5file);
|
||||||
|
//ofenergy<<Etmp<<" "<<nparticles<<endl;//new
|
||||||
|
//cout<<"Read mean energy in step: "<<j<<" Energy: "<<Etmp<<endl;//new
|
||||||
|
|
||||||
|
h5_int64_t* larray = (h5_int64_t*)malloc(sizeof(h5_int64_t)*nparticles);
|
||||||
|
H5PartReadDataInt64(h5file, "id", larray);
|
||||||
|
|
||||||
|
h5_float64_t* x = (h5_float64_t*)malloc(sizeof(h5_float64_t)*nparticles);
|
||||||
|
H5PartReadDataFloat64(h5file, "x", x);
|
||||||
|
vector<h5_float64_t> x_alive;
|
||||||
|
|
||||||
|
h5_float64_t* y = (h5_float64_t*)malloc(sizeof(h5_float64_t)*nparticles);
|
||||||
|
H5PartReadDataFloat64(h5file, "y", y);
|
||||||
|
vector<h5_float64_t> y_alive;
|
||||||
|
|
||||||
|
h5_float64_t* z = (h5_float64_t*)malloc(sizeof(h5_float64_t)*nparticles);
|
||||||
|
H5PartReadDataFloat64(h5file, "z", z);
|
||||||
|
vector<h5_float64_t> z_alive;
|
||||||
|
|
||||||
|
h5_int64_t* ptype = (h5_int64_t*)malloc(sizeof(h5_int64_t)*nparticles);
|
||||||
|
H5PartReadDataInt64(h5file, "ptype", ptype);
|
||||||
|
vector<h5_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]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
cout<<" ptype_alive size = "<< ptype_alive.size()<<endl;
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
ofalive << ptype_alive[i] << 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 {
|
||||||
|
vector<double>Esmall;//smaller than 28eV
|
||||||
|
vector<double>Emultip;//Energy zone of SEY>1.
|
||||||
|
vector<double>Elarge;//larger than 2100eV
|
||||||
|
double sey_num;//sey total number
|
||||||
|
int remained_num;//
|
||||||
|
for (size_t j=0; j<ntime_step; j++) {
|
||||||
|
set<h5_int64_t> idSet;
|
||||||
|
H5SetStep(h5file,j);
|
||||||
|
// char s_name[64]="ENERGY";//new
|
||||||
|
//h5_float64_t Etmp=0.0;//new
|
||||||
|
//int var_readE=H5PartReadStepAttrib(h5file,s_name,&Etmp);//new
|
||||||
|
//num_dataset = H5PartGetNumDatasets(h5file);//new
|
||||||
|
num_dataset = H5PartGetNumDatasets(h5file);
|
||||||
|
h5_int64_t nparticles = H5PartGetNumParticles(h5file);
|
||||||
|
//Etmp = (Etmp - 0.51099906)*1000000.0;//new eV
|
||||||
|
//ofenergy<<Etmp<<" "<<nparticles<<endl;//new
|
||||||
|
//cout<<"Read mean energy in step: "<<j<<" Energy: "<<Etmp<<endl;//new
|
||||||
|
|
||||||
|
cout << "Working on timestep " << j << " expecting " << nparticles << " particles " << endl;
|
||||||
|
ofpnum << j <<" "<<nparticles<<endl;//new
|
||||||
|
|
||||||
|
|
||||||
|
h5_float64_t* x = (h5_float64_t*)malloc(sizeof(h5_float64_t)*nparticles);
|
||||||
|
H5PartReadDataFloat64(h5file, "x", x);
|
||||||
|
|
||||||
|
h5_float64_t* y = (h5_float64_t*)malloc(sizeof(h5_float64_t)*nparticles);
|
||||||
|
H5PartReadDataFloat64(h5file, "y", y);
|
||||||
|
|
||||||
|
h5_float64_t* z = (h5_float64_t*)malloc(sizeof(h5_float64_t)*nparticles);
|
||||||
|
H5PartReadDataFloat64(h5file, "z", z);
|
||||||
|
|
||||||
|
h5_int64_t* ptype = (h5_int64_t*)malloc(sizeof(h5_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;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
cout<< "Step " <<j<<" error occurs while determine particle type integer ptype should be >=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();
|
||||||
|
|
||||||
|
h5_int64_t* larray = (h5_int64_t*)malloc(sizeof(h5_int64_t)*nparticles);
|
||||||
|
H5PartReadDataInt64(h5file, "id", larray);
|
||||||
|
|
||||||
|
h5_float64_t* larrayPx = (h5_float64_t*)malloc(sizeof(h5_float64_t)*nparticles);
|
||||||
|
H5PartReadDataFloat64(h5file, "px", larrayPx);
|
||||||
|
|
||||||
|
h5_float64_t* larrayPy = (h5_float64_t*)malloc(sizeof(h5_float64_t)*nparticles);
|
||||||
|
H5PartReadDataFloat64(h5file, "py", larrayPy);
|
||||||
|
|
||||||
|
h5_float64_t* larrayPz = (h5_float64_t*)malloc(sizeof(h5_float64_t)*nparticles);
|
||||||
|
H5PartReadDataFloat64(h5file, "pz", larrayPz);
|
||||||
|
if(j!=(ntime_step-1)) {
|
||||||
|
H5SetStep(h5file,j+1);
|
||||||
|
int num_dataset_temp = H5PartGetNumDatasets(h5file);
|
||||||
|
h5_int64_t nparticles_temp = H5PartGetNumParticles(h5file);
|
||||||
|
|
||||||
|
h5_int64_t* larray_temp = (h5_int64_t*)malloc(sizeof(h5_int64_t)*nparticles_temp);
|
||||||
|
H5PartReadDataInt64(h5file, "id", larray_temp);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
for (size_t i = 0; i < nparticles_temp ; i ++) {
|
||||||
|
idSet.insert(larray_temp[i]);
|
||||||
|
}
|
||||||
|
for (size_t i = 0; i < nparticles ; i ++) {
|
||||||
|
|
||||||
|
if(idSet.find(larray[i])==idSet.end()) {
|
||||||
|
double Etemp=0.51099906*1000000.0*(sqrt(1.0+larrayPx[i]*larrayPx[i]+larrayPy[i]*larrayPy[i]+larrayPz[i]*larrayPz[i])-1);
|
||||||
|
|
||||||
|
double sey_temp=2.469*exp(-0.0004644*Etemp)-1.9*exp(-0.01054*Etemp);
|
||||||
|
sey_num+=sey_temp;
|
||||||
|
if ( std::isinf(Etemp)){
|
||||||
|
|
||||||
|
cout<<"Etemp in time step: "<<j<<" is infinity "<<Etemp<<endl;
|
||||||
|
if ( std::isinf(larrayPx[i])){
|
||||||
|
|
||||||
|
cout<<"Px in time step: "<<j<<" is infinity "<<Etemp<<endl;
|
||||||
|
}else if ( std::isinf(larrayPy[i])){
|
||||||
|
|
||||||
|
cout<<"Py in time step: "<<j<<" is infinity "<<Etemp<<endl;
|
||||||
|
}else if ( std::isinf(larrayPz[i])){
|
||||||
|
|
||||||
|
cout<<"Pz in time step: "<<j<<" is infinity "<<Etemp<<endl;
|
||||||
|
}else {
|
||||||
|
cout<<"Px,Py,Pz in time step: "<<j<<" are "<<larrayPx[i]<<" "<<larrayPy[i]<<" "<<larrayPz[i]<<endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ofenergy<<Etemp<<endl;
|
||||||
|
if(Etemp<28.0) {
|
||||||
|
Esmall.push_back(Etemp);
|
||||||
|
}else if (Etemp<2100) {
|
||||||
|
Emultip.push_back(Etemp);
|
||||||
|
}else {
|
||||||
|
Elarge.push_back(Etemp);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
free(larray_temp);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//cout <<"ptype size = "<< sizeof(ptype) << endl;
|
||||||
|
free(x);
|
||||||
|
free(y);
|
||||||
|
free(z);
|
||||||
|
free(ptype);
|
||||||
|
free(larrayPx);
|
||||||
|
free(larrayPy);
|
||||||
|
free(larrayPz);
|
||||||
|
free(larray);
|
||||||
|
if(j==(ntime_step-1)) {
|
||||||
|
remained_num = nparticles;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ofenergy<<Esmall.size()<<endl;//new
|
||||||
|
ofenergy<<Emultip.size()<<endl;//new
|
||||||
|
ofenergy<<Elarge.size()<<endl;//new
|
||||||
|
ofenergy<<sey_num<<endl;
|
||||||
|
ofenergy<<sey_num-int(Esmall.size()+Emultip.size()+Elarge.size())+1000<<endl;
|
||||||
|
ofenergy<<remained_num<<endl;
|
||||||
|
ofpnum.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
H5CloseFile(h5file);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
@@ -0,0 +1,528 @@
|
|||||||
|
/* h5PartSurfaceToVtk.cc
|
||||||
|
Andreas Adelmann & Chuan Wang
|
||||||
|
2010-2011
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <hdf5.h>
|
||||||
|
#include "H5hut.h"
|
||||||
|
|
||||||
|
#include <cmath>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <cctype>
|
||||||
|
#include <string.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* mytemp = NULL;
|
||||||
|
static char* geo_name = NULL;
|
||||||
|
static char* output_name = NULL;
|
||||||
|
|
||||||
|
static bool flg_alive = false;
|
||||||
|
static double z_pos = 0.0;
|
||||||
|
static int print_all = 0;
|
||||||
|
static int step_ini = 1;
|
||||||
|
static int dump_freq = 1;
|
||||||
|
|
||||||
|
|
||||||
|
/* `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:g:o:f:d:";
|
||||||
|
|
||||||
|
/* 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
|
||||||
|
{ "geometry", require_arg, 'g' }, // Takes input geometry file name
|
||||||
|
{ "output", require_arg, 'o' }, // Takes output file name (without this flag, the program will print to stdout)
|
||||||
|
{ "first", require_arg, 'f' }, // first step
|
||||||
|
{ "dumpfreq", require_arg, 'd' }, // dump frequency of the
|
||||||
|
{ 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 'g': //
|
||||||
|
{ geo_name = strdup(opt_arg);
|
||||||
|
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'f': //
|
||||||
|
{
|
||||||
|
mytemp = strdup(opt_arg);
|
||||||
|
step_ini = (int)strtod(mytemp,NULL);
|
||||||
|
fprintf(stdout,"string=%s, %s \n",opt_arg, mytemp);
|
||||||
|
fprintf(stdout,"step_ini=%i \n",step_ini);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'd': //
|
||||||
|
{
|
||||||
|
fprintf(stdout,"string=%s \n",opt_arg);
|
||||||
|
mytemp = strdup(opt_arg);
|
||||||
|
dump_freq = (int)strtod(mytemp,NULL);
|
||||||
|
fprintf(stdout,"string=%s \n",opt_arg);
|
||||||
|
fprintf(stdout,"dump_freq=%i \n",dump_freq);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
print_help();
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* For printing help page */
|
||||||
|
static void print_help()
|
||||||
|
{
|
||||||
|
fflush(stdout);
|
||||||
|
fprintf(stdout, "\nusage: h5PartSurfaceToVtk -i INPUTFILE -g GEOMETRYFILE -o OUTPUTFILE\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, " -g file, --input geometry 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, "\n");
|
||||||
|
fprintf(stdout, " Examples first dump step 100 and dump frequency 100:\n");
|
||||||
|
fprintf(stdout, "\n");
|
||||||
|
fprintf(stdout, " /h5SurfaceVtk -i Cavity_Mag_Surface -g ../10 -o p- -f 100 -d 100 \n");
|
||||||
|
fprintf(stdout, "\n");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int main(int argc, const char *argv[])
|
||||||
|
{
|
||||||
|
h5_file_t *h5file = NULL;
|
||||||
|
|
||||||
|
std::ofstream of, ofalive, ofenergy, ofpnum;
|
||||||
|
|
||||||
|
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 = H5OpenFile(ifn.c_str(), H5_O_WRONLY, NULL);
|
||||||
|
|
||||||
|
if( h5file == NULL ) {
|
||||||
|
fprintf(stdout, "unable to open file %s\n", input_name);
|
||||||
|
print_help();
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
string gfn = string(geo_name) + string(".h5");
|
||||||
|
hid_t plist_id = H5Pcreate(H5P_FILE_ACCESS); //Property list identifier
|
||||||
|
// H5Pset_fapl_mpio(plist_id, MPI_COMM_WORLD, MPI_INFO_NULL);
|
||||||
|
// Create a new file collectively and release property list identifier.
|
||||||
|
hid_t file_id = H5Fopen(gfn.c_str(), H5F_ACC_RDONLY, plist_id);
|
||||||
|
assert(file_id >= 0);
|
||||||
|
H5Pclose(plist_id);
|
||||||
|
int numbfaces_global_m;
|
||||||
|
/////////////////////////////////////////////
|
||||||
|
// Read dataset "surface" from .h5 file
|
||||||
|
////////////////////////////////////////////
|
||||||
|
|
||||||
|
hsize_t dimsf[2];//dataset dimensions
|
||||||
|
herr_t status;
|
||||||
|
|
||||||
|
hid_t dset_id = H5Dopen(file_id, "/surface",H5P_DEFAULT);
|
||||||
|
assert(dset_id >= 0);
|
||||||
|
// Create the dataspace for the dataset.
|
||||||
|
hid_t x = H5Dget_space(dset_id);
|
||||||
|
H5Sget_simple_extent_dims(x, dimsf, NULL);
|
||||||
|
hid_t filespace = H5Screate_simple(2, dimsf, NULL);
|
||||||
|
|
||||||
|
numbfaces_global_m = dimsf[0];
|
||||||
|
int *allbfaces_m = (int*)malloc(numbfaces_global_m * 4*sizeof(int));
|
||||||
|
|
||||||
|
int *bfaces_idx_m = (int*)malloc(numbfaces_global_m*sizeof(int));
|
||||||
|
|
||||||
|
//Tribarycent_m = new Vector_t[numbfaces_global_m];
|
||||||
|
// Create property list for collective dataset write.
|
||||||
|
hid_t plist_id2 = H5Pcreate(H5P_DATASET_XFER);
|
||||||
|
//H5Pset_dxpl_mpio(plist_id2, H5FD_MPIO_COLLECTIVE);
|
||||||
|
status = H5Dread(dset_id, H5T_NATIVE_INT, H5S_ALL, filespace, plist_id2, allbfaces_m);
|
||||||
|
assert(status >= 0);
|
||||||
|
// Store local boundary faces, discard others
|
||||||
|
int nof_sym_m = 0; // Count number of symmetry planes.
|
||||||
|
int const nogeosym_flag = 0; // heronion outputs a index, case 0 indicates no symmetry plane, 1 for (x,y) sym, 2 for (y,z), 3 for (z,x),none 0 means the current triangle is not on a real surface of geometry but on a symmetry plane.
|
||||||
|
|
||||||
|
|
||||||
|
for(int i = 0; i < numbfaces_global_m; i ++) {
|
||||||
|
bfaces_idx_m[i] = i;
|
||||||
|
if(allbfaces_m[4 * i] > nogeosym_flag) {
|
||||||
|
nof_sym_m += 1;
|
||||||
|
if(i < numbfaces_global_m - 1) {
|
||||||
|
for(int j = 0; j < numbfaces_global_m - i; j ++) {
|
||||||
|
allbfaces_m[4*(i+j)] = allbfaces_m[4*(i+j+1)];
|
||||||
|
allbfaces_m[4*(i+j)+1] = allbfaces_m[4*(i+j+1)+1];
|
||||||
|
allbfaces_m[4*(i+j)+2] = allbfaces_m[4*(i+j+1)+2];
|
||||||
|
allbfaces_m[4*(i+j)+3] = allbfaces_m[4*(i+j+1)+3];
|
||||||
|
}
|
||||||
|
} else
|
||||||
|
numbfaces_global_m = numbfaces_global_m - 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
H5Dclose(dset_id);
|
||||||
|
H5Sclose(filespace);
|
||||||
|
////////////////////////////////
|
||||||
|
// Also read dataset "coords"
|
||||||
|
////////////////////////////////
|
||||||
|
hsize_t dimsf_c[2];
|
||||||
|
herr_t status_c;
|
||||||
|
hid_t dset_id_c = H5Dopen(file_id, "/coords",H5P_DEFAULT);
|
||||||
|
assert(dset_id_c >= 0);
|
||||||
|
|
||||||
|
// Create the dataspace for the dataset.
|
||||||
|
hid_t cp_space = H5Dget_space(dset_id_c);
|
||||||
|
H5Sget_simple_extent_dims(cp_space, dimsf_c, NULL);
|
||||||
|
hid_t filespace_c = H5Screate_simple(2, dimsf_c, NULL);
|
||||||
|
|
||||||
|
int numpoints_global_m = dimsf_c[0];
|
||||||
|
double *point_coords = (double*)malloc(3 * numpoints_global_m*sizeof(double));
|
||||||
|
hid_t plist_id3 = H5Pcreate(H5P_DATASET_XFER);
|
||||||
|
//H5Pset_dxpl_mpio(plist_id3, H5FD_MPIO_COLLECTIVE);
|
||||||
|
status_c = H5Dread(dset_id_c, H5T_NATIVE_DOUBLE, H5S_ALL, filespace_c, plist_id3, point_coords);
|
||||||
|
assert(status_c >= 0);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
double **geo3Dcoords_m;//= malloc(sizeof(double)*numpoints_global_m*3);
|
||||||
|
geo3Dcoords_m = (double**)malloc(sizeof(double)*numpoints_global_m);
|
||||||
|
for (int i=0;i<numpoints_global_m;i++) {
|
||||||
|
geo3Dcoords_m[i] = (double*)malloc(sizeof(double)*3);
|
||||||
|
}
|
||||||
|
|
||||||
|
for(int i = 0; i < numpoints_global_m; i++) {
|
||||||
|
geo3Dcoords_m[i][0] = point_coords[3*i];
|
||||||
|
geo3Dcoords_m[i][1] = point_coords[3*i+1];
|
||||||
|
geo3Dcoords_m[i][2] = point_coords[3*i+2];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Close HDF5 stuff
|
||||||
|
H5Dclose(dset_id_c);
|
||||||
|
H5Sclose(filespace_c);
|
||||||
|
|
||||||
|
|
||||||
|
ntime_step = H5GetNumSteps(h5file);
|
||||||
|
cout<<"step number: "<<ntime_step<<endl;
|
||||||
|
double sey_num;//sey total number
|
||||||
|
int remained_num;//
|
||||||
|
for (size_t j=1; j<=ntime_step; j++) {
|
||||||
|
set<h5_int64_t> idSet;
|
||||||
|
size_t step_local = step_ini + (j-1)*dump_freq;
|
||||||
|
H5SetStep(h5file,step_local);
|
||||||
|
num_dataset = H5PartGetNumDatasets(h5file);
|
||||||
|
h5_int64_t triNum = H5PartGetNumParticles(h5file);
|
||||||
|
double qi = 0.0;
|
||||||
|
H5ReadStepAttribFloat64(h5file,"qi",&qi);
|
||||||
|
cout << "Working on timestep " << step_local << endl;
|
||||||
|
|
||||||
|
h5_float64_t* PrimaryLoss = (h5_float64_t*)malloc(sizeof(h5_float64_t)*triNum);
|
||||||
|
H5PartReadDataFloat64(h5file, "PrimaryLoss", PrimaryLoss);
|
||||||
|
|
||||||
|
h5_float64_t* SecondaryLoss = (h5_float64_t*)malloc(sizeof(h5_float64_t)*triNum);
|
||||||
|
H5PartReadDataFloat64(h5file, "SecondaryLoss", SecondaryLoss);
|
||||||
|
|
||||||
|
h5_float64_t* FNEmissionLoss = (h5_float64_t*)malloc(sizeof(h5_float64_t)*triNum);
|
||||||
|
H5PartReadDataFloat64(h5file, "FNEmissionLoss", FNEmissionLoss);
|
||||||
|
|
||||||
|
h5_int64_t* TriID = (h5_int64_t*)malloc(sizeof(h5_int64_t)*triNum);
|
||||||
|
H5PartReadDataInt64(h5file, "TriangleID", TriID);
|
||||||
|
|
||||||
|
string ffn = string("vtk/") + string(output_name) + string("Surface-") + convert2Int(j) + string(".vtk");
|
||||||
|
|
||||||
|
of.open(ffn.c_str());
|
||||||
|
assert(of.is_open());
|
||||||
|
of.precision(6);
|
||||||
|
of << "# vtk DataFile Version 2.0" << endl; // first line of a vtk file
|
||||||
|
of << "generated using DataSink::writeGeoToVtk" << endl; // header
|
||||||
|
of << "ASCII" << endl << endl; // file format
|
||||||
|
of << "DATASET UNSTRUCTURED_GRID" << endl; // dataset structrue
|
||||||
|
of << "POINTS " << numpoints_global_m << " float" << endl; // data num and type
|
||||||
|
for(int i = 0; i < numpoints_global_m ; i ++)
|
||||||
|
of << geo3Dcoords_m[i][0] << " " << geo3Dcoords_m[i][1] << " " << geo3Dcoords_m[i][2] << endl;
|
||||||
|
of << endl;
|
||||||
|
|
||||||
|
of << "CELLS " << numbfaces_global_m << " " << 4 * numbfaces_global_m << endl;
|
||||||
|
for(int i = 0; i < numbfaces_global_m ; i ++)
|
||||||
|
of << "3 " << allbfaces_m[4*i+1] << " " << allbfaces_m[4*i+2] << " " << allbfaces_m[4*i+3] << endl;
|
||||||
|
of << "CELL_TYPES " << numbfaces_global_m << endl;
|
||||||
|
for(int i = 0; i < numbfaces_global_m ; i ++)
|
||||||
|
of << "5" << endl;
|
||||||
|
of << "CELL_DATA " << numbfaces_global_m << endl;
|
||||||
|
of << "SCALARS " << "PrimaryLoss" << " float " << "1" << endl;
|
||||||
|
of << "LOOKUP_TABLE " << "default" << endl ;
|
||||||
|
for(int i = 0; i < numbfaces_global_m ; i ++)
|
||||||
|
of << fabs(PrimaryLoss[i]/qi) << endl;
|
||||||
|
of << "SCALARS " << "SecondaryLoss" << " float " << "1" << endl;
|
||||||
|
of << "LOOKUP_TABLE " << "default" << endl ;
|
||||||
|
for(int i = 0; i < numbfaces_global_m ; i ++)
|
||||||
|
of << fabs(SecondaryLoss[i]/qi) << endl;
|
||||||
|
of << "SCALARS " << "FNEmissionLoss" << " float " << "1" << endl;
|
||||||
|
of << "LOOKUP_TABLE " << "default" << endl ;
|
||||||
|
for(int i = 0; i < numbfaces_global_m ; i ++)
|
||||||
|
of << fabs(FNEmissionLoss[i]/qi) << endl;
|
||||||
|
of << "SCALARS " << "TotalLoss" << " float " << "1" << endl;
|
||||||
|
of << "LOOKUP_TABLE " << "default" << endl ;
|
||||||
|
for(int i = 0; i < numbfaces_global_m ; i ++)
|
||||||
|
of << fabs((FNEmissionLoss[i]+SecondaryLoss[i]+PrimaryLoss[i])/qi) << endl;
|
||||||
|
of << endl;
|
||||||
|
|
||||||
|
of.close();
|
||||||
|
|
||||||
|
//cout <<"ptype size = "<< sizeof(ptype) << endl;
|
||||||
|
|
||||||
|
free(PrimaryLoss);
|
||||||
|
free(SecondaryLoss);
|
||||||
|
free(FNEmissionLoss);
|
||||||
|
free(TriID);
|
||||||
|
}
|
||||||
|
free(point_coords);
|
||||||
|
for (int i=0;i<numpoints_global_m;i++) {
|
||||||
|
free(geo3Dcoords_m[i]);
|
||||||
|
}
|
||||||
|
free(geo3Dcoords_m);
|
||||||
|
free(allbfaces_m);
|
||||||
|
free(bfaces_idx_m);
|
||||||
|
|
||||||
|
H5CloseFile(h5file);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user