Compare commits
126 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 6a4d711b99 | |||
| 2ae76250e6 | |||
| f1cb1c981e | |||
| 627d6673e1 | |||
| ed85fb32b7 | |||
| df2be38428 | |||
| d423367d4f | |||
| 1985a0a2e0 | |||
| 24533c4c2e | |||
| 72365540a3 | |||
| 4daf9b786c | |||
| 072a2781fc | |||
| 9c9bfda054 | |||
| 604dade2a1 | |||
| 2da69d1095 | |||
| 15317a9bb0 | |||
| c5f3b7fa02 | |||
| a81c79e5c4 | |||
| 664cee709b | |||
| ecc4618bd4 | |||
| 8bdebd0c55 | |||
| 5baed631b7 | |||
| 65109b73a9 | |||
| 792e86e01e | |||
| 11ab169164 | |||
| 7c899f99ce | |||
| 12ef028ed2 | |||
| 094117a631 | |||
| acc8b75ad9 | |||
| 078a51d60d | |||
| 06a941eb2c | |||
| 269c5efbde | |||
| e7a60fbe9f | |||
| 2ed8ad093c | |||
| 3a9e0e4153 | |||
| aa1f4eacc8 | |||
| c33ef6d390 | |||
| 9a32a0b7f1 | |||
| 22d6893770 | |||
| 6e0f0eeedd | |||
| 542daf7fc2 | |||
| f79c808e8d | |||
| b6e482f56a | |||
| 6d3014bad5 | |||
| 20424235e8 | |||
| 7d73439b10 | |||
| e447d536a3 | |||
| 74df1bc676 | |||
| 9e4c8bd5a4 | |||
| bb1cd9c860 | |||
| ad52833022 | |||
| 3425a30068 | |||
| 9f3a677ea6 | |||
| 23807ff972 | |||
| 93d4f60116 | |||
| 20cd5aae98 | |||
| cae3b00855 | |||
| 2a462733ca | |||
| 6fb8b77baa | |||
| c26d6a84e3 | |||
| 54ccc3b576 | |||
| 8ffe944519 | |||
| 2bb3d688ae | |||
| 647af5847e | |||
| aa4f40ee3d | |||
| f1daa56cb8 | |||
| 2ea8245bba | |||
| 04fe7fdd9e | |||
| 075b2f39da | |||
| 7b05c32ad9 | |||
| 825ee8ac5f | |||
| 9d70c07476 | |||
| 03986b00ac | |||
| ad83c3841b | |||
| 73fabd043b | |||
| 0aa44727c6 | |||
| babd19ddd4 | |||
| c80f6f5679 | |||
| 7b1079ae5f | |||
| ecd2723419 | |||
| c9044d8e1b | |||
| 5b57bedade | |||
| 222789a1cf | |||
| 21dd57c9c6 | |||
| fc29f7b6f0 | |||
| e56872ce92 | |||
| 85ecf4c387 | |||
| 6979a358ae | |||
| 9fc3b233bc | |||
| f5eb26d2ec | |||
| 6af129b338 | |||
| 215d1a7d79 | |||
| 8bb22e4400 | |||
| caad81996a | |||
| f97e3c8f2d | |||
| fba78db1c0 | |||
| 291328b997 | |||
| 2c1bca01aa | |||
| a633b362a6 | |||
| a12908ed90 | |||
| b83d9cc8a7 | |||
| 6ad9ae50e0 | |||
| 9ac7e09423 | |||
| 66452a274b | |||
| d947f51c2d | |||
| f5729f6f07 | |||
| a64f2ce03a | |||
| b880bd397f | |||
| cd2c9031b9 | |||
| fb5e55990f | |||
| 25dff9257c | |||
| ac37d5fc2f | |||
| 983496104b | |||
| aaeca8b6b7 | |||
| 0182d60835 | |||
| f75ef09cf9 | |||
| c831a90a2e | |||
| bdcc8f2089 | |||
| bbbaa6a21b | |||
| 4c5b16169d | |||
| cc46b433e1 | |||
| a8e209a7d3 | |||
| 80cf35e807 | |||
| d53c5b3171 | |||
| 8edb48aff8 | |||
| 24af2ae2a3 |
+4
-8
@@ -5,9 +5,12 @@
|
||||
*.so
|
||||
*.dSYM
|
||||
*~
|
||||
*.h5
|
||||
.deps
|
||||
.dirstamp
|
||||
.libs
|
||||
CMakeFiles
|
||||
INSTALL
|
||||
Makefile
|
||||
Makefile.in
|
||||
aclocal.m4
|
||||
@@ -23,9 +26,8 @@ config.status
|
||||
config.sub
|
||||
configure
|
||||
depcomp
|
||||
py-compile
|
||||
examples/H5/attach_file
|
||||
examples/H5/example_file_attribs.h5
|
||||
examples/H5/example_step_attribs.h5
|
||||
examples/H5/examples.h
|
||||
examples/H5/h5hut.mod
|
||||
examples/H5/openclose
|
||||
@@ -41,14 +43,12 @@ examples/H5/write_file_attribsf
|
||||
examples/H5/write_step_attribs
|
||||
examples/H5/write_step_attribsf
|
||||
examples/H5Block/H5BlockExampleF
|
||||
examples/H5Block/*.h5
|
||||
examples/H5Block/fields
|
||||
examples/H5Block/read_write
|
||||
examples/H5Part/Bench
|
||||
examples/H5Part/H5test
|
||||
examples/H5Part/H5testF
|
||||
examples/H5Part/core_vfd
|
||||
examples/H5Part/*.h5
|
||||
examples/H5Part/examples.h
|
||||
examples/H5Part/h5hut.mod
|
||||
examples/H5Part/particles
|
||||
@@ -76,11 +76,7 @@ stamp-h1
|
||||
test/h5b_test
|
||||
test/h5u_test
|
||||
test/h5_attach_test
|
||||
test/test.h5
|
||||
tools/h5hutcc
|
||||
large_tet.h5
|
||||
simple_tet.h5
|
||||
simple_triangle.h5
|
||||
tetmesh_adjacencies
|
||||
tetmesh_read
|
||||
tetmesh_read_tags
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
2018-09-14 Gsell Achim <achi.gsell@psi.ch>
|
||||
|
||||
* C-API
|
||||
- H5PartSetNumPoints() renamed to H5PartSetNumItems()
|
||||
- H5PartGetNumPoints() renamed to H5PartGetNumItems()
|
||||
- Dataset names longer then 64 bytes are handled as error.
|
||||
- Same for step/iteration names.
|
||||
* core API
|
||||
- we use the term 'iteration' instead of 'step'
|
||||
- we use the term 'item' instead of 'point'
|
||||
- re-factor function and variable names
|
||||
- in printing messages/debug output fixed
|
||||
- do not flush (sync to disk) after writing a dataset by default,
|
||||
can be controlled by a property
|
||||
|
||||
|
||||
+3
-1
@@ -1,5 +1,7 @@
|
||||
ACLOCAL_AMFLAGS = -I m4
|
||||
EXTRA_DIST = autogen.sh
|
||||
EXTRA_DIST = \
|
||||
autogen.sh \
|
||||
ax_pkg_swig.m4
|
||||
|
||||
SUBDIRS = \
|
||||
src \
|
||||
|
||||
@@ -0,0 +1,982 @@
|
||||
# ===========================================================================
|
||||
# https://www.gnu.org/software/autoconf-archive/ax_cxx_compile_stdcxx.html
|
||||
# ===========================================================================
|
||||
#
|
||||
# SYNOPSIS
|
||||
#
|
||||
# AX_CXX_COMPILE_STDCXX(VERSION, [ext|noext], [mandatory|optional])
|
||||
#
|
||||
# DESCRIPTION
|
||||
#
|
||||
# Check for baseline language coverage in the compiler for the specified
|
||||
# version of the C++ standard. If necessary, add switches to CXX and
|
||||
# CXXCPP to enable support. VERSION may be '11' (for the C++11 standard)
|
||||
# or '14' (for the C++14 standard).
|
||||
#
|
||||
# The second argument, if specified, indicates whether you insist on an
|
||||
# extended mode (e.g. -std=gnu++11) or a strict conformance mode (e.g.
|
||||
# -std=c++11). If neither is specified, you get whatever works, with
|
||||
# preference for an extended mode.
|
||||
#
|
||||
# The third argument, if specified 'mandatory' or if left unspecified,
|
||||
# indicates that baseline support for the specified C++ standard is
|
||||
# required and that the macro should error out if no mode with that
|
||||
# support is found. If specified 'optional', then configuration proceeds
|
||||
# regardless, after defining HAVE_CXX${VERSION} if and only if a
|
||||
# supporting mode is found.
|
||||
#
|
||||
# LICENSE
|
||||
#
|
||||
# Copyright (c) 2008 Benjamin Kosnik <bkoz@redhat.com>
|
||||
# Copyright (c) 2012 Zack Weinberg <zackw@panix.com>
|
||||
# Copyright (c) 2013 Roy Stogner <roystgnr@ices.utexas.edu>
|
||||
# Copyright (c) 2014, 2015 Google Inc.; contributed by Alexey Sokolov <sokolov@google.com>
|
||||
# Copyright (c) 2015 Paul Norman <penorman@mac.com>
|
||||
# Copyright (c) 2015 Moritz Klammler <moritz@klammler.eu>
|
||||
# Copyright (c) 2016 Krzesimir Nowak <qdlacz@gmail.com>
|
||||
#
|
||||
# Copying and distribution of this file, with or without modification, are
|
||||
# permitted in any medium without royalty provided the copyright notice
|
||||
# and this notice are preserved. This file is offered as-is, without any
|
||||
# warranty.
|
||||
|
||||
#serial 7
|
||||
|
||||
dnl This macro is based on the code from the AX_CXX_COMPILE_STDCXX_11 macro
|
||||
dnl (serial version number 13).
|
||||
|
||||
AX_REQUIRE_DEFINED([AC_MSG_WARN])
|
||||
AC_DEFUN([AX_CXX_COMPILE_STDCXX], [dnl
|
||||
m4_if([$1], [11], [ax_cxx_compile_alternatives="11 0x"],
|
||||
[$1], [14], [ax_cxx_compile_alternatives="14 1y"],
|
||||
[$1], [17], [ax_cxx_compile_alternatives="17 1z"],
|
||||
[m4_fatal([invalid first argument `$1' to AX_CXX_COMPILE_STDCXX])])dnl
|
||||
m4_if([$2], [], [],
|
||||
[$2], [ext], [],
|
||||
[$2], [noext], [],
|
||||
[m4_fatal([invalid second argument `$2' to AX_CXX_COMPILE_STDCXX])])dnl
|
||||
m4_if([$3], [], [ax_cxx_compile_cxx$1_required=true],
|
||||
[$3], [mandatory], [ax_cxx_compile_cxx$1_required=true],
|
||||
[$3], [optional], [ax_cxx_compile_cxx$1_required=false],
|
||||
[m4_fatal([invalid third argument `$3' to AX_CXX_COMPILE_STDCXX])])
|
||||
AC_LANG_PUSH([C++])dnl
|
||||
ac_success=no
|
||||
AC_CACHE_CHECK(whether $CXX supports C++$1 features by default,
|
||||
ax_cv_cxx_compile_cxx$1,
|
||||
[AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_testbody_$1])],
|
||||
[ax_cv_cxx_compile_cxx$1=yes],
|
||||
[ax_cv_cxx_compile_cxx$1=no])])
|
||||
if test x$ax_cv_cxx_compile_cxx$1 = xyes; then
|
||||
ac_success=yes
|
||||
fi
|
||||
|
||||
m4_if([$2], [noext], [], [dnl
|
||||
if test x$ac_success = xno; then
|
||||
for alternative in ${ax_cxx_compile_alternatives}; do
|
||||
switch="-std=gnu++${alternative}"
|
||||
cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx$1_$switch])
|
||||
AC_CACHE_CHECK(whether $CXX supports C++$1 features with $switch,
|
||||
$cachevar,
|
||||
[ac_save_CXX="$CXX"
|
||||
CXX="$CXX $switch"
|
||||
AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_testbody_$1])],
|
||||
[eval $cachevar=yes],
|
||||
[eval $cachevar=no])
|
||||
CXX="$ac_save_CXX"])
|
||||
if eval test x\$$cachevar = xyes; then
|
||||
CXX="$CXX $switch"
|
||||
if test -n "$CXXCPP" ; then
|
||||
CXXCPP="$CXXCPP $switch"
|
||||
fi
|
||||
ac_success=yes
|
||||
break
|
||||
fi
|
||||
done
|
||||
fi])
|
||||
|
||||
m4_if([$2], [ext], [], [dnl
|
||||
if test x$ac_success = xno; then
|
||||
dnl HP's aCC needs +std=c++11 according to:
|
||||
dnl http://h21007.www2.hp.com/portal/download/files/unprot/aCxx/PDF_Release_Notes/769149-001.pdf
|
||||
dnl Cray's crayCC needs "-h std=c++11"
|
||||
for alternative in ${ax_cxx_compile_alternatives}; do
|
||||
for switch in -std=c++${alternative} +std=c++${alternative} "-h std=c++${alternative}"; do
|
||||
cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx$1_$switch])
|
||||
AC_CACHE_CHECK(whether $CXX supports C++$1 features with $switch,
|
||||
$cachevar,
|
||||
[ac_save_CXX="$CXX"
|
||||
CXX="$CXX $switch"
|
||||
AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_testbody_$1])],
|
||||
[eval $cachevar=yes],
|
||||
[eval $cachevar=no])
|
||||
CXX="$ac_save_CXX"])
|
||||
if eval test x\$$cachevar = xyes; then
|
||||
CXX="$CXX $switch"
|
||||
if test -n "$CXXCPP" ; then
|
||||
CXXCPP="$CXXCPP $switch"
|
||||
fi
|
||||
ac_success=yes
|
||||
break
|
||||
fi
|
||||
done
|
||||
if test x$ac_success = xyes; then
|
||||
break
|
||||
fi
|
||||
done
|
||||
fi])
|
||||
AC_LANG_POP([C++])
|
||||
if test x$ax_cxx_compile_cxx$1_required = xtrue; then
|
||||
if test x$ac_success = xno; then
|
||||
AC_MSG_ERROR([*** A compiler with support for C++$1 language features is required.])
|
||||
fi
|
||||
fi
|
||||
if test x$ac_success = xno; then
|
||||
HAVE_CXX$1=0
|
||||
AC_MSG_NOTICE([No compiler with C++$1 support was found])
|
||||
else
|
||||
HAVE_CXX$1=1
|
||||
AC_DEFINE(HAVE_CXX$1,1,
|
||||
[define if the compiler supports basic C++$1 syntax])
|
||||
fi
|
||||
AC_SUBST(HAVE_CXX$1)
|
||||
m4_if([$1], [17], [AC_MSG_WARN([C++17 is not yet standardized, so the checks may change in incompatible ways anytime])])
|
||||
])
|
||||
|
||||
|
||||
dnl Test body for checking C++11 support
|
||||
|
||||
m4_define([_AX_CXX_COMPILE_STDCXX_testbody_11],
|
||||
_AX_CXX_COMPILE_STDCXX_testbody_new_in_11
|
||||
)
|
||||
|
||||
|
||||
dnl Test body for checking C++14 support
|
||||
|
||||
m4_define([_AX_CXX_COMPILE_STDCXX_testbody_14],
|
||||
_AX_CXX_COMPILE_STDCXX_testbody_new_in_11
|
||||
_AX_CXX_COMPILE_STDCXX_testbody_new_in_14
|
||||
)
|
||||
|
||||
m4_define([_AX_CXX_COMPILE_STDCXX_testbody_17],
|
||||
_AX_CXX_COMPILE_STDCXX_testbody_new_in_11
|
||||
_AX_CXX_COMPILE_STDCXX_testbody_new_in_14
|
||||
_AX_CXX_COMPILE_STDCXX_testbody_new_in_17
|
||||
)
|
||||
|
||||
dnl Tests for new features in C++11
|
||||
|
||||
m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_11], [[
|
||||
|
||||
// If the compiler admits that it is not ready for C++11, why torture it?
|
||||
// Hopefully, this will speed up the test.
|
||||
|
||||
#ifndef __cplusplus
|
||||
|
||||
#error "This is not a C++ compiler"
|
||||
|
||||
#elif __cplusplus < 201103L
|
||||
|
||||
#error "This is not a C++11 compiler"
|
||||
|
||||
#else
|
||||
|
||||
namespace cxx11
|
||||
{
|
||||
|
||||
namespace test_static_assert
|
||||
{
|
||||
|
||||
template <typename T>
|
||||
struct check
|
||||
{
|
||||
static_assert(sizeof(int) <= sizeof(T), "not big enough");
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
namespace test_final_override
|
||||
{
|
||||
|
||||
struct Base
|
||||
{
|
||||
virtual void f() {}
|
||||
};
|
||||
|
||||
struct Derived : public Base
|
||||
{
|
||||
virtual void f() override {}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
namespace test_double_right_angle_brackets
|
||||
{
|
||||
|
||||
template < typename T >
|
||||
struct check {};
|
||||
|
||||
typedef check<void> single_type;
|
||||
typedef check<check<void>> double_type;
|
||||
typedef check<check<check<void>>> triple_type;
|
||||
typedef check<check<check<check<void>>>> quadruple_type;
|
||||
|
||||
}
|
||||
|
||||
namespace test_decltype
|
||||
{
|
||||
|
||||
int
|
||||
f()
|
||||
{
|
||||
int a = 1;
|
||||
decltype(a) b = 2;
|
||||
return a + b;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
namespace test_type_deduction
|
||||
{
|
||||
|
||||
template < typename T1, typename T2 >
|
||||
struct is_same
|
||||
{
|
||||
static const bool value = false;
|
||||
};
|
||||
|
||||
template < typename T >
|
||||
struct is_same<T, T>
|
||||
{
|
||||
static const bool value = true;
|
||||
};
|
||||
|
||||
template < typename T1, typename T2 >
|
||||
auto
|
||||
add(T1 a1, T2 a2) -> decltype(a1 + a2)
|
||||
{
|
||||
return a1 + a2;
|
||||
}
|
||||
|
||||
int
|
||||
test(const int c, volatile int v)
|
||||
{
|
||||
static_assert(is_same<int, decltype(0)>::value == true, "");
|
||||
static_assert(is_same<int, decltype(c)>::value == false, "");
|
||||
static_assert(is_same<int, decltype(v)>::value == false, "");
|
||||
auto ac = c;
|
||||
auto av = v;
|
||||
auto sumi = ac + av + 'x';
|
||||
auto sumf = ac + av + 1.0;
|
||||
static_assert(is_same<int, decltype(ac)>::value == true, "");
|
||||
static_assert(is_same<int, decltype(av)>::value == true, "");
|
||||
static_assert(is_same<int, decltype(sumi)>::value == true, "");
|
||||
static_assert(is_same<int, decltype(sumf)>::value == false, "");
|
||||
static_assert(is_same<int, decltype(add(c, v))>::value == true, "");
|
||||
return (sumf > 0.0) ? sumi : add(c, v);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
namespace test_noexcept
|
||||
{
|
||||
|
||||
int f() { return 0; }
|
||||
int g() noexcept { return 0; }
|
||||
|
||||
static_assert(noexcept(f()) == false, "");
|
||||
static_assert(noexcept(g()) == true, "");
|
||||
|
||||
}
|
||||
|
||||
namespace test_constexpr
|
||||
{
|
||||
|
||||
template < typename CharT >
|
||||
unsigned long constexpr
|
||||
strlen_c_r(const CharT *const s, const unsigned long acc) noexcept
|
||||
{
|
||||
return *s ? strlen_c_r(s + 1, acc + 1) : acc;
|
||||
}
|
||||
|
||||
template < typename CharT >
|
||||
unsigned long constexpr
|
||||
strlen_c(const CharT *const s) noexcept
|
||||
{
|
||||
return strlen_c_r(s, 0UL);
|
||||
}
|
||||
|
||||
static_assert(strlen_c("") == 0UL, "");
|
||||
static_assert(strlen_c("1") == 1UL, "");
|
||||
static_assert(strlen_c("example") == 7UL, "");
|
||||
static_assert(strlen_c("another\0example") == 7UL, "");
|
||||
|
||||
}
|
||||
|
||||
namespace test_rvalue_references
|
||||
{
|
||||
|
||||
template < int N >
|
||||
struct answer
|
||||
{
|
||||
static constexpr int value = N;
|
||||
};
|
||||
|
||||
answer<1> f(int&) { return answer<1>(); }
|
||||
answer<2> f(const int&) { return answer<2>(); }
|
||||
answer<3> f(int&&) { return answer<3>(); }
|
||||
|
||||
void
|
||||
test()
|
||||
{
|
||||
int i = 0;
|
||||
const int c = 0;
|
||||
static_assert(decltype(f(i))::value == 1, "");
|
||||
static_assert(decltype(f(c))::value == 2, "");
|
||||
static_assert(decltype(f(0))::value == 3, "");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
namespace test_uniform_initialization
|
||||
{
|
||||
|
||||
struct test
|
||||
{
|
||||
static const int zero {};
|
||||
static const int one {1};
|
||||
};
|
||||
|
||||
static_assert(test::zero == 0, "");
|
||||
static_assert(test::one == 1, "");
|
||||
|
||||
}
|
||||
|
||||
namespace test_lambdas
|
||||
{
|
||||
|
||||
void
|
||||
test1()
|
||||
{
|
||||
auto lambda1 = [](){};
|
||||
auto lambda2 = lambda1;
|
||||
lambda1();
|
||||
lambda2();
|
||||
}
|
||||
|
||||
int
|
||||
test2()
|
||||
{
|
||||
auto a = [](int i, int j){ return i + j; }(1, 2);
|
||||
auto b = []() -> int { return '0'; }();
|
||||
auto c = [=](){ return a + b; }();
|
||||
auto d = [&](){ return c; }();
|
||||
auto e = [a, &b](int x) mutable {
|
||||
const auto identity = [](int y){ return y; };
|
||||
for (auto i = 0; i < a; ++i)
|
||||
a += b--;
|
||||
return x + identity(a + b);
|
||||
}(0);
|
||||
return a + b + c + d + e;
|
||||
}
|
||||
|
||||
int
|
||||
test3()
|
||||
{
|
||||
const auto nullary = [](){ return 0; };
|
||||
const auto unary = [](int x){ return x; };
|
||||
using nullary_t = decltype(nullary);
|
||||
using unary_t = decltype(unary);
|
||||
const auto higher1st = [](nullary_t f){ return f(); };
|
||||
const auto higher2nd = [unary](nullary_t f1){
|
||||
return [unary, f1](unary_t f2){ return f2(unary(f1())); };
|
||||
};
|
||||
return higher1st(nullary) + higher2nd(nullary)(unary);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
namespace test_variadic_templates
|
||||
{
|
||||
|
||||
template <int...>
|
||||
struct sum;
|
||||
|
||||
template <int N0, int... N1toN>
|
||||
struct sum<N0, N1toN...>
|
||||
{
|
||||
static constexpr auto value = N0 + sum<N1toN...>::value;
|
||||
};
|
||||
|
||||
template <>
|
||||
struct sum<>
|
||||
{
|
||||
static constexpr auto value = 0;
|
||||
};
|
||||
|
||||
static_assert(sum<>::value == 0, "");
|
||||
static_assert(sum<1>::value == 1, "");
|
||||
static_assert(sum<23>::value == 23, "");
|
||||
static_assert(sum<1, 2>::value == 3, "");
|
||||
static_assert(sum<5, 5, 11>::value == 21, "");
|
||||
static_assert(sum<2, 3, 5, 7, 11, 13>::value == 41, "");
|
||||
|
||||
}
|
||||
|
||||
// http://stackoverflow.com/questions/13728184/template-aliases-and-sfinae
|
||||
// Clang 3.1 fails with headers of libstd++ 4.8.3 when using std::function
|
||||
// because of this.
|
||||
namespace test_template_alias_sfinae
|
||||
{
|
||||
|
||||
struct foo {};
|
||||
|
||||
template<typename T>
|
||||
using member = typename T::member_type;
|
||||
|
||||
template<typename T>
|
||||
void func(...) {}
|
||||
|
||||
template<typename T>
|
||||
void func(member<T>*) {}
|
||||
|
||||
void test();
|
||||
|
||||
void test() { func<foo>(0); }
|
||||
|
||||
}
|
||||
|
||||
} // namespace cxx11
|
||||
|
||||
#endif // __cplusplus >= 201103L
|
||||
|
||||
]])
|
||||
|
||||
|
||||
dnl Tests for new features in C++14
|
||||
|
||||
m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_14], [[
|
||||
|
||||
// If the compiler admits that it is not ready for C++14, why torture it?
|
||||
// Hopefully, this will speed up the test.
|
||||
|
||||
#ifndef __cplusplus
|
||||
|
||||
#error "This is not a C++ compiler"
|
||||
|
||||
#elif __cplusplus < 201402L
|
||||
|
||||
#error "This is not a C++14 compiler"
|
||||
|
||||
#else
|
||||
|
||||
namespace cxx14
|
||||
{
|
||||
|
||||
namespace test_polymorphic_lambdas
|
||||
{
|
||||
|
||||
int
|
||||
test()
|
||||
{
|
||||
const auto lambda = [](auto&&... args){
|
||||
const auto istiny = [](auto x){
|
||||
return (sizeof(x) == 1UL) ? 1 : 0;
|
||||
};
|
||||
const int aretiny[] = { istiny(args)... };
|
||||
return aretiny[0];
|
||||
};
|
||||
return lambda(1, 1L, 1.0f, '1');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
namespace test_binary_literals
|
||||
{
|
||||
|
||||
constexpr auto ivii = 0b0000000000101010;
|
||||
static_assert(ivii == 42, "wrong value");
|
||||
|
||||
}
|
||||
|
||||
namespace test_generalized_constexpr
|
||||
{
|
||||
|
||||
template < typename CharT >
|
||||
constexpr unsigned long
|
||||
strlen_c(const CharT *const s) noexcept
|
||||
{
|
||||
auto length = 0UL;
|
||||
for (auto p = s; *p; ++p)
|
||||
++length;
|
||||
return length;
|
||||
}
|
||||
|
||||
static_assert(strlen_c("") == 0UL, "");
|
||||
static_assert(strlen_c("x") == 1UL, "");
|
||||
static_assert(strlen_c("test") == 4UL, "");
|
||||
static_assert(strlen_c("another\0test") == 7UL, "");
|
||||
|
||||
}
|
||||
|
||||
namespace test_lambda_init_capture
|
||||
{
|
||||
|
||||
int
|
||||
test()
|
||||
{
|
||||
auto x = 0;
|
||||
const auto lambda1 = [a = x](int b){ return a + b; };
|
||||
const auto lambda2 = [a = lambda1(x)](){ return a; };
|
||||
return lambda2();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
namespace test_digit_separators
|
||||
{
|
||||
|
||||
constexpr auto ten_million = 100'000'000;
|
||||
static_assert(ten_million == 100000000, "");
|
||||
|
||||
}
|
||||
|
||||
namespace test_return_type_deduction
|
||||
{
|
||||
|
||||
auto f(int& x) { return x; }
|
||||
decltype(auto) g(int& x) { return x; }
|
||||
|
||||
template < typename T1, typename T2 >
|
||||
struct is_same
|
||||
{
|
||||
static constexpr auto value = false;
|
||||
};
|
||||
|
||||
template < typename T >
|
||||
struct is_same<T, T>
|
||||
{
|
||||
static constexpr auto value = true;
|
||||
};
|
||||
|
||||
int
|
||||
test()
|
||||
{
|
||||
auto x = 0;
|
||||
static_assert(is_same<int, decltype(f(x))>::value, "");
|
||||
static_assert(is_same<int&, decltype(g(x))>::value, "");
|
||||
return x;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} // namespace cxx14
|
||||
|
||||
#endif // __cplusplus >= 201402L
|
||||
|
||||
]])
|
||||
|
||||
|
||||
dnl Tests for new features in C++17
|
||||
|
||||
m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_17], [[
|
||||
|
||||
// If the compiler admits that it is not ready for C++17, why torture it?
|
||||
// Hopefully, this will speed up the test.
|
||||
|
||||
#ifndef __cplusplus
|
||||
|
||||
#error "This is not a C++ compiler"
|
||||
|
||||
#elif __cplusplus <= 201402L
|
||||
|
||||
#error "This is not a C++17 compiler"
|
||||
|
||||
#else
|
||||
|
||||
#if defined(__clang__)
|
||||
#define REALLY_CLANG
|
||||
#else
|
||||
#if defined(__GNUC__)
|
||||
#define REALLY_GCC
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include <initializer_list>
|
||||
#include <utility>
|
||||
#include <type_traits>
|
||||
|
||||
namespace cxx17
|
||||
{
|
||||
|
||||
#if !defined(REALLY_CLANG)
|
||||
namespace test_constexpr_lambdas
|
||||
{
|
||||
|
||||
// TODO: test it with clang++ from git
|
||||
|
||||
constexpr int foo = [](){return 42;}();
|
||||
|
||||
}
|
||||
#endif // !defined(REALLY_CLANG)
|
||||
|
||||
namespace test::nested_namespace::definitions
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
namespace test_fold_expression
|
||||
{
|
||||
|
||||
template<typename... Args>
|
||||
int multiply(Args... args)
|
||||
{
|
||||
return (args * ... * 1);
|
||||
}
|
||||
|
||||
template<typename... Args>
|
||||
bool all(Args... args)
|
||||
{
|
||||
return (args && ...);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
namespace test_extended_static_assert
|
||||
{
|
||||
|
||||
static_assert (true);
|
||||
|
||||
}
|
||||
|
||||
namespace test_auto_brace_init_list
|
||||
{
|
||||
|
||||
auto foo = {5};
|
||||
auto bar {5};
|
||||
|
||||
static_assert(std::is_same<std::initializer_list<int>, decltype(foo)>::value);
|
||||
static_assert(std::is_same<int, decltype(bar)>::value);
|
||||
}
|
||||
|
||||
namespace test_typename_in_template_template_parameter
|
||||
{
|
||||
|
||||
template<template<typename> typename X> struct D;
|
||||
|
||||
}
|
||||
|
||||
namespace test_fallthrough_nodiscard_maybe_unused_attributes
|
||||
{
|
||||
|
||||
int f1()
|
||||
{
|
||||
return 42;
|
||||
}
|
||||
|
||||
[[nodiscard]] int f2()
|
||||
{
|
||||
[[maybe_unused]] auto unused = f1();
|
||||
|
||||
switch (f1())
|
||||
{
|
||||
case 17:
|
||||
f1();
|
||||
[[fallthrough]];
|
||||
case 42:
|
||||
f1();
|
||||
}
|
||||
return f1();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
namespace test_extended_aggregate_initialization
|
||||
{
|
||||
|
||||
struct base1
|
||||
{
|
||||
int b1, b2 = 42;
|
||||
};
|
||||
|
||||
struct base2
|
||||
{
|
||||
base2() {
|
||||
b3 = 42;
|
||||
}
|
||||
int b3;
|
||||
};
|
||||
|
||||
struct derived : base1, base2
|
||||
{
|
||||
int d;
|
||||
};
|
||||
|
||||
derived d1 {{1, 2}, {}, 4}; // full initialization
|
||||
derived d2 {{}, {}, 4}; // value-initialized bases
|
||||
|
||||
}
|
||||
|
||||
namespace test_general_range_based_for_loop
|
||||
{
|
||||
|
||||
struct iter
|
||||
{
|
||||
int i;
|
||||
|
||||
int& operator* ()
|
||||
{
|
||||
return i;
|
||||
}
|
||||
|
||||
const int& operator* () const
|
||||
{
|
||||
return i;
|
||||
}
|
||||
|
||||
iter& operator++()
|
||||
{
|
||||
++i;
|
||||
return *this;
|
||||
}
|
||||
};
|
||||
|
||||
struct sentinel
|
||||
{
|
||||
int i;
|
||||
};
|
||||
|
||||
bool operator== (const iter& i, const sentinel& s)
|
||||
{
|
||||
return i.i == s.i;
|
||||
}
|
||||
|
||||
bool operator!= (const iter& i, const sentinel& s)
|
||||
{
|
||||
return !(i == s);
|
||||
}
|
||||
|
||||
struct range
|
||||
{
|
||||
iter begin() const
|
||||
{
|
||||
return {0};
|
||||
}
|
||||
|
||||
sentinel end() const
|
||||
{
|
||||
return {5};
|
||||
}
|
||||
};
|
||||
|
||||
void f()
|
||||
{
|
||||
range r {};
|
||||
|
||||
for (auto i : r)
|
||||
{
|
||||
[[maybe_unused]] auto v = i;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
namespace test_lambda_capture_asterisk_this_by_value
|
||||
{
|
||||
|
||||
struct t
|
||||
{
|
||||
int i;
|
||||
int foo()
|
||||
{
|
||||
return [*this]()
|
||||
{
|
||||
return i;
|
||||
}();
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
namespace test_enum_class_construction
|
||||
{
|
||||
|
||||
enum class byte : unsigned char
|
||||
{};
|
||||
|
||||
byte foo {42};
|
||||
|
||||
}
|
||||
|
||||
namespace test_constexpr_if
|
||||
{
|
||||
|
||||
template <bool cond>
|
||||
int f ()
|
||||
{
|
||||
if constexpr(cond)
|
||||
{
|
||||
return 13;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 42;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
namespace test_selection_statement_with_initializer
|
||||
{
|
||||
|
||||
int f()
|
||||
{
|
||||
return 13;
|
||||
}
|
||||
|
||||
int f2()
|
||||
{
|
||||
if (auto i = f(); i > 0)
|
||||
{
|
||||
return 3;
|
||||
}
|
||||
|
||||
switch (auto i = f(); i + 4)
|
||||
{
|
||||
case 17:
|
||||
return 2;
|
||||
|
||||
default:
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#if !defined(REALLY_CLANG)
|
||||
namespace test_template_argument_deduction_for_class_templates
|
||||
{
|
||||
|
||||
// TODO: test it with clang++ from git
|
||||
|
||||
template <typename T1, typename T2>
|
||||
struct pair
|
||||
{
|
||||
pair (T1 p1, T2 p2)
|
||||
: m1 {p1},
|
||||
m2 {p2}
|
||||
{}
|
||||
|
||||
T1 m1;
|
||||
T2 m2;
|
||||
};
|
||||
|
||||
void f()
|
||||
{
|
||||
[[maybe_unused]] auto p = pair{13, 42u};
|
||||
}
|
||||
|
||||
}
|
||||
#endif // !defined(REALLY_CLANG)
|
||||
|
||||
namespace test_non_type_auto_template_parameters
|
||||
{
|
||||
|
||||
template <auto n>
|
||||
struct B
|
||||
{};
|
||||
|
||||
B<5> b1;
|
||||
B<'a'> b2;
|
||||
|
||||
}
|
||||
|
||||
#if !defined(REALLY_CLANG)
|
||||
namespace test_structured_bindings
|
||||
{
|
||||
|
||||
// TODO: test it with clang++ from git
|
||||
|
||||
int arr[2] = { 1, 2 };
|
||||
std::pair<int, int> pr = { 1, 2 };
|
||||
|
||||
auto f1() -> int(&)[2]
|
||||
{
|
||||
return arr;
|
||||
}
|
||||
|
||||
auto f2() -> std::pair<int, int>&
|
||||
{
|
||||
return pr;
|
||||
}
|
||||
|
||||
struct S
|
||||
{
|
||||
int x1 : 2;
|
||||
volatile double y1;
|
||||
};
|
||||
|
||||
S f3()
|
||||
{
|
||||
return {};
|
||||
}
|
||||
|
||||
auto [ x1, y1 ] = f1();
|
||||
auto& [ xr1, yr1 ] = f1();
|
||||
auto [ x2, y2 ] = f2();
|
||||
auto& [ xr2, yr2 ] = f2();
|
||||
const auto [ x3, y3 ] = f3();
|
||||
|
||||
}
|
||||
#endif // !defined(REALLY_CLANG)
|
||||
|
||||
#if !defined(REALLY_CLANG)
|
||||
namespace test_exception_spec_type_system
|
||||
{
|
||||
|
||||
// TODO: test it with clang++ from git
|
||||
|
||||
struct Good {};
|
||||
struct Bad {};
|
||||
|
||||
void g1() noexcept;
|
||||
void g2();
|
||||
|
||||
template<typename T>
|
||||
Bad
|
||||
f(T*, T*);
|
||||
|
||||
template<typename T1, typename T2>
|
||||
Good
|
||||
f(T1*, T2*);
|
||||
|
||||
static_assert (std::is_same_v<Good, decltype(f(g1, g2))>);
|
||||
|
||||
}
|
||||
#endif // !defined(REALLY_CLANG)
|
||||
|
||||
namespace test_inline_variables
|
||||
{
|
||||
|
||||
template<class T> void f(T)
|
||||
{}
|
||||
|
||||
template<class T> inline T g(T)
|
||||
{
|
||||
return T{};
|
||||
}
|
||||
|
||||
template<> inline void f<>(int)
|
||||
{}
|
||||
|
||||
template<> int g<>(int)
|
||||
{
|
||||
return 5;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} // namespace cxx17
|
||||
|
||||
#endif // __cplusplus <= 201402L
|
||||
|
||||
]])
|
||||
@@ -0,0 +1,39 @@
|
||||
# =============================================================================
|
||||
# https://www.gnu.org/software/autoconf-archive/ax_cxx_compile_stdcxx_11.html
|
||||
# =============================================================================
|
||||
#
|
||||
# SYNOPSIS
|
||||
#
|
||||
# AX_CXX_COMPILE_STDCXX_11([ext|noext], [mandatory|optional])
|
||||
#
|
||||
# DESCRIPTION
|
||||
#
|
||||
# Check for baseline language coverage in the compiler for the C++11
|
||||
# standard; if necessary, add switches to CXX and CXXCPP to enable
|
||||
# support.
|
||||
#
|
||||
# This macro is a convenience alias for calling the AX_CXX_COMPILE_STDCXX
|
||||
# macro with the version set to C++11. The two optional arguments are
|
||||
# forwarded literally as the second and third argument respectively.
|
||||
# Please see the documentation for the AX_CXX_COMPILE_STDCXX macro for
|
||||
# more information. If you want to use this macro, you also need to
|
||||
# download the ax_cxx_compile_stdcxx.m4 file.
|
||||
#
|
||||
# LICENSE
|
||||
#
|
||||
# Copyright (c) 2008 Benjamin Kosnik <bkoz@redhat.com>
|
||||
# Copyright (c) 2012 Zack Weinberg <zackw@panix.com>
|
||||
# Copyright (c) 2013 Roy Stogner <roystgnr@ices.utexas.edu>
|
||||
# Copyright (c) 2014, 2015 Google Inc.; contributed by Alexey Sokolov <sokolov@google.com>
|
||||
# Copyright (c) 2015 Paul Norman <penorman@mac.com>
|
||||
# Copyright (c) 2015 Moritz Klammler <moritz@klammler.eu>
|
||||
#
|
||||
# Copying and distribution of this file, with or without modification, are
|
||||
# permitted in any medium without royalty provided the copyright notice
|
||||
# and this notice are preserved. This file is offered as-is, without any
|
||||
# warranty.
|
||||
|
||||
#serial 18
|
||||
|
||||
AX_REQUIRE_DEFINED([AX_CXX_COMPILE_STDCXX])
|
||||
AC_DEFUN([AX_CXX_COMPILE_STDCXX_11], [AX_CXX_COMPILE_STDCXX([11], [$1], [$2])])
|
||||
+136
-63
@@ -1,12 +1,12 @@
|
||||
#
|
||||
# Copyright (c) 2006-2016, The Regents of the University of California,
|
||||
# Copyright (c) 2006-2018, The Regents of the University of California,
|
||||
# through Lawrence Berkeley National Laboratory (subject to receipt of any
|
||||
# required approvals from the U.S. Dept. of Energy) and the Paul Scherrer
|
||||
# Institut (Switzerland). All rights reserved.
|
||||
#
|
||||
# License: see file COPYING in top level of source distribution.
|
||||
#
|
||||
AC_INIT([H5hut], [2.0.0rc1], [h5part@lists.psi.ch], H5hut)
|
||||
AC_INIT([H5hut], [2.0.0rc5], [h5part@lists.psi.ch], H5hut)
|
||||
AC_PREREQ(2.60)
|
||||
AC_CONFIG_HEADERS(config.h)
|
||||
AC_CONFIG_MACRO_DIR([m4])
|
||||
@@ -112,22 +112,50 @@ AC_ARG_WITH(
|
||||
[VTK_PREFIX=$withval], [])
|
||||
|
||||
# Determine a C/C++ compiler to use.
|
||||
CC=''
|
||||
CXX=''
|
||||
if test "x$ENABLE_PARALLEL" = "xyes"; then
|
||||
if test "x$MPICC" != "x"; then
|
||||
CC=$MPICC
|
||||
fi
|
||||
if test "x$MPICXX" != "x"; then
|
||||
CXX=$MPICXX
|
||||
fi
|
||||
if test "x$MPIFC" != "x"; then
|
||||
FC=$MPIFC
|
||||
else
|
||||
FC=''
|
||||
F77=''
|
||||
F90=''
|
||||
fi
|
||||
c_compilers="mpicc cc"
|
||||
cxx_compilers="mpic++ CC"
|
||||
fc_compiler="mpif90 mpif77 mpifort"
|
||||
else
|
||||
c_compilers="pgcc pathcc icc gcc cc_r cc"
|
||||
cxx_compilers="pgcc pathcc icc g++ cc_r c++"
|
||||
fc_compiler="pgf90 ifort xlf_r pathf90 g95 g90 ftn gfortran"
|
||||
fi
|
||||
|
||||
AC_PROG_CC($c_compilers)
|
||||
if test "x$ac_cv_prog_cc_c89" = "xno"; then
|
||||
AC_MSG_ERROR([C compiler not found!])
|
||||
exit 1
|
||||
fi
|
||||
|
||||
AC_PROG_CXX($cxx_compilers)
|
||||
|
||||
if test "X$ENABLE_FORTRAN" = "Xyes"; then
|
||||
AC_PROG_FC($fc_compiler)
|
||||
if test "x$FC" = "x"; then
|
||||
AC_MSG_ERROR([Fortran compiler not found!])
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
CC=`which $CC`
|
||||
CXX=`which $CXX`
|
||||
FC=`which $FC`
|
||||
|
||||
AX_CXX_COMPILE_STDCXX_11
|
||||
AC_PROG_CC_C99
|
||||
if test "x$ac_cv_prog_cc_c99" = "xno"; then
|
||||
AC_MSG_ERROR([Cannot set C compiler to use C99 standard!])
|
||||
@@ -235,6 +263,69 @@ AC_DEFINE_UNQUOTED(MY_UNAME, "$uname", "")
|
||||
###############################################################################
|
||||
# PROCESS ARGUMENTS
|
||||
|
||||
###############################################################################
|
||||
# check libraries
|
||||
|
||||
AC_CHECK_LIB([z], [compress2])
|
||||
|
||||
# hdf5
|
||||
if test -z "${HDF5_PREFIX}"; then
|
||||
# alternatives to HDF5_PREFIX
|
||||
if test -n "${HDF5_DIR}"; then
|
||||
HDF5_PREFIX=${HDF5_DIR}
|
||||
fi
|
||||
fi
|
||||
if test -n "${HDF5_PREFIX}"; then
|
||||
CPPFLAGS="$CPPFLAGS -I$HDF5_PREFIX/include"
|
||||
LDFLAGS="$LDFLAGS -L$HDF5_PREFIX/lib"
|
||||
fi
|
||||
AC_CHECK_LIB([hdf5], [H5open])
|
||||
AS_IF([test "x$ac_cv_lib_hdf5_H5open" != xyes],
|
||||
[AC_MSG_ERROR([Cannot compile and link a HDF5 program]);
|
||||
exit 1])
|
||||
AC_MSG_CHECKING([checking whether hdf5 lib supports parallel IO])
|
||||
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
|
||||
#include "hdf5.h"
|
||||
#ifndef H5_HAVE_PARALLEL
|
||||
# error macro not defined
|
||||
#endif
|
||||
]])], [H5_HAVE_PARALLEL="yes"], [H5_HAVE_PARALLEL="no"])
|
||||
AC_MSG_RESULT([$H5_HAVE_PARALLEL])
|
||||
|
||||
# lustre
|
||||
AC_MSG_CHECKING([for lustre API ])
|
||||
AC_MSG_RESULT([])
|
||||
if test -n "${LUSTREPATH}"; then
|
||||
P=${LUSTREPATH}
|
||||
elif test -n "${LUSTREROOT}" ; then
|
||||
P=${LUSTREROOT}
|
||||
elif test -n "${LUSTREHOME}" ; then
|
||||
P=${LUSTREHOME}
|
||||
elif test -n "${LUSTRE_DIR}" ; then
|
||||
P=${LUSTRE_DIR}
|
||||
else
|
||||
P=''
|
||||
P="$P /usr"
|
||||
P="$P /usr/local"
|
||||
P="$P /usr/local/lustre"
|
||||
P="$P /opt/lustre"
|
||||
fi
|
||||
PATH_Search LUSTREROOT "$P" usr/include/lustre/liblustreapi.h
|
||||
if test -z "$LUSTREROOT"; then
|
||||
AC_MSG_WARN([Couldn't locate the lustre API... building without support for lustre striping!])
|
||||
else
|
||||
CFLAGS="$CFLAGS -DH5_USE_LUSTRE"
|
||||
CPPFLAGS="$CPPFLAGS -I$LUSTREROOT/usr/include"
|
||||
LDFLAGS="$LDFLAGS -L$LUSTREROOT/usr/lib"
|
||||
LIBS="$LIBS -llustreapi"
|
||||
fi
|
||||
|
||||
LIBS="$LIBS -lm"
|
||||
|
||||
|
||||
|
||||
############################ enabled bindings ###############################
|
||||
|
||||
# C enabled?
|
||||
AC_MSG_CHECKING([if C interface enabled])
|
||||
if test "X$ENABLE_C" = "Xyes"; then
|
||||
@@ -248,15 +339,6 @@ AC_MSG_CHECKING([if fortran interface enabled])
|
||||
if test "X$ENABLE_FORTRAN" = "Xyes"; then
|
||||
AC_MSG_RESULT([yes])
|
||||
AC_LANG_PUSH(Fortran)
|
||||
FC=''
|
||||
F77=''
|
||||
F90=''
|
||||
if test "X$ENABLE_PARALLEL" = "Xyes"; then
|
||||
AC_PROG_FC(mpif90 mpif77)
|
||||
else
|
||||
AC_PROG_FC(pgf90 ifort xlf_r pathf90 g95 g90 ftn gfortran)
|
||||
fi
|
||||
FC=`which $FC`
|
||||
|
||||
# Query Fortran symbol mangling. __AC_FC_NAME_MANGLING sets
|
||||
# ac_cv_{f77,fc}_mangling. The value contains three fields, separated
|
||||
@@ -345,6 +427,15 @@ fi
|
||||
AC_MSG_CHECKING([if parallel interface enabled])
|
||||
if test "X$ENABLE_PARALLEL" = "Xyes"; then
|
||||
AC_MSG_RESULT([yes])
|
||||
|
||||
AS_IF([test "x$H5_HAVE_PARALLEL" = "xno"],
|
||||
[AC_MSG_ERROR([hdf5 does not support parallel IO!]);
|
||||
exit 1])
|
||||
|
||||
if test "X$ENABLE_VTKCONVERTER" = "Xyes"; then
|
||||
AC_MSG_ERROR([VTK to H5hut grid converter cannot be compiled parallel!])
|
||||
exit 1
|
||||
fi
|
||||
CPPFLAGS="${CPPFLAGS} -DPARALLEL_IO -DMPICH_IGNORE_CXX_SEEK"
|
||||
|
||||
if test "X$ENABLE_EXPERIMENTAL" = "Xyes"; then
|
||||
@@ -367,62 +458,43 @@ if test "X$ENABLE_PARALLEL" = "Xyes"; then
|
||||
fi
|
||||
else # --enable-parallel=no
|
||||
AC_MSG_RESULT([no])
|
||||
AS_IF([test "x$H5_HAVE_PARALLEL" = "xyes"],
|
||||
[AC_MSG_ERROR([hdf5 with support for parallel IO cannot be used for non-parallel H5hut!]);
|
||||
exit 1])
|
||||
fi
|
||||
|
||||
###############################################################################
|
||||
# LIBRARY PATHS
|
||||
if test -z "${HDF5_PREFIX}"; then
|
||||
# alternatives to HDF5_PREFIX
|
||||
if test -n "${HDF5_DIR}"; then
|
||||
HDF5_PREFIX=${HDF5_DIR}
|
||||
fi
|
||||
fi
|
||||
if test -n "${HDF5_PREFIX}"; then
|
||||
CPPFLAGS="$CPPFLAGS -I$HDF5_PREFIX/include"
|
||||
LDFLAGS="$LDFLAGS -L$HDF5_PREFIX/lib"
|
||||
fi
|
||||
AC_CHECK_LIB([z], [compress2])
|
||||
AC_CHECK_LIB([hdf5], [H5open])
|
||||
AS_IF([test "x$ac_cv_lib_hdf5_H5open" != xyes],
|
||||
[AC_MSG_ERROR([Cannot compile and link a HDF5 program]);
|
||||
exit 1])
|
||||
|
||||
|
||||
AC_MSG_CHECKING([for lustre API ])
|
||||
AC_MSG_RESULT([])
|
||||
if test -n "${LUSTREPATH}"; then
|
||||
P=${LUSTREPATH}
|
||||
elif test -n "${LUSTREROOT}" ; then
|
||||
P=${LUSTREROOT}
|
||||
elif test -n "${LUSTREHOME}" ; then
|
||||
P=${LUSTREHOME}
|
||||
elif test -n "${LUSTRE_DIR}" ; then
|
||||
P=${LUSTRE_DIR}
|
||||
else
|
||||
P=''
|
||||
P="$P /usr"
|
||||
P="$P /usr/local"
|
||||
P="$P /usr/local/lustre"
|
||||
P="$P /opt/lustre"
|
||||
fi
|
||||
PATH_Search LUSTREROOT "$P" usr/include/lustre/liblustreapi.h
|
||||
if test -z "$LUSTREROOT"; then
|
||||
AC_MSG_WARN([Couldn't locate the lustre API... building without support for lustre striping!])
|
||||
else
|
||||
CFLAGS="$CFLAGS -DH5_USE_LUSTRE"
|
||||
CPPFLAGS="$CPPFLAGS -I$LUSTREROOT/usr/include"
|
||||
LDFLAGS="$LDFLAGS -L$LUSTREROOT/usr/lib"
|
||||
LIBS="$LIBS -llustreapi"
|
||||
fi
|
||||
|
||||
LIBS="$LIBS -lm"
|
||||
|
||||
###############################################################################
|
||||
# TOOLS
|
||||
AC_MSG_CHECKING([if we have to compile the VTK to H5hut grid converter])
|
||||
if test "X$ENABLE_VTKCONVERTER" = "Xyes"; then
|
||||
AC_MSG_RESULT([yes])
|
||||
# :TODO: add test whether we can compile/link a prog with vtk
|
||||
if test -n "$VTK_PREFIX"; then
|
||||
SAVE_C_INCLUDE_PATH="$C_INCLUDE_PATH"
|
||||
SAVE_CPLUS_INCLUDE_PATH="$CPLUS_INCLUDE_PATH"
|
||||
SAVE_LIBRARY_PATH="$LIBRARY_PATH"
|
||||
C_INCLUDE_PATH="$C_INCLUDE_PATH $VTK_PREFIX/include"
|
||||
CPLUS_INCLUDE_PATH="$CPLUS_INCLUDE_PATH $VTK_PREFIX/include"
|
||||
LIBRARY_PATH="$LIBRARY_PATH $VTK_PREFIX/lib"
|
||||
fi
|
||||
AC_MSG_CHECKING([VTK inlcude files])
|
||||
VTK_INCLUDES=`cmake --find-package -DNAME=VTK -DCOMPILER_ID=GNU -DLANGUAGE=C -DMODE=COMPILE 2>/dev/null`
|
||||
if test "X$?" != "X0"; then
|
||||
AC_MSG_RESULT([no])
|
||||
AC_MSG_ERROR([Cannot compile VTK to H5hut converter])
|
||||
exit 1
|
||||
else
|
||||
AC_MSG_RESULT([yes])
|
||||
fi
|
||||
AC_MSG_CHECKING([VTK libraries])
|
||||
VTK_LIBS=`cmake --find-package -DNAME=VTK -DCOMPILER_ID=GNU -DLANGUAGE=C -DMODE=LINK 2>/dev/null`
|
||||
if test "X$?" != "X0"; then
|
||||
AC_MSG_RESULT([no])
|
||||
AC_MSG_ERROR([Cannot compile VTK to H5hut converter]);
|
||||
exit 1
|
||||
else
|
||||
AC_MSG_RESULT([yes])
|
||||
fi
|
||||
|
||||
else
|
||||
AC_MSG_RESULT([no])
|
||||
fi
|
||||
@@ -446,7 +518,8 @@ AC_SUBST(CFLAGS)
|
||||
AC_SUBST(FFLAGS)
|
||||
AC_SUBST(AM_CPPFLAGS)
|
||||
AC_SUBST(AM_LDFLAGS)
|
||||
|
||||
AC_SUBST(VTK_INCLUDES)
|
||||
AC_SUBST(VTK_LIBS)
|
||||
AC_CONFIG_FILES([
|
||||
Makefile
|
||||
src/Makefile
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#
|
||||
|
||||
AM_CPPFLAGS += -I${abs_top_srcdir}/src/include
|
||||
AM_CPPFLAGS += -I${abs_top_srcdir}/examples/include
|
||||
FFLAGS += -cpp $(AM_CPPFLAGS)
|
||||
AM_LDFLAGS += -L${abs_top_builddir}/src/h5core/.libs
|
||||
|
||||
@@ -18,6 +19,10 @@ LDADD += -lH5hutF
|
||||
AM_LDFLAGS += -L${abs_top_builddir}/src/Fortran/.libs
|
||||
endif
|
||||
|
||||
if ENABLE_DEBUG
|
||||
AM_LDFLAGS += -static
|
||||
endif
|
||||
|
||||
LDADD += -lH5hut
|
||||
|
||||
noinst_PROGRAMS =
|
||||
@@ -35,7 +40,6 @@ noinst_PROGRAMS += \
|
||||
endif
|
||||
|
||||
if ENABLE_FORTRAN
|
||||
if ENABLE_PARALLEL
|
||||
noinst_PROGRAMS += \
|
||||
openclosef \
|
||||
queryf \
|
||||
@@ -52,7 +56,8 @@ write_file_attribsf_SOURCES = write_file_attribsf.f90
|
||||
write_step_attribsf_SOURCES = write_step_attribsf.f90
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
%.o : %.f90
|
||||
all: ${noinst_PROGRAMS}
|
||||
|
||||
.f90.o:
|
||||
$(FC) $(FFLAGS) -c $<
|
||||
|
||||
@@ -14,6 +14,10 @@
|
||||
|
||||
#define FNAME "attach_file.h5"
|
||||
#define ATTACHMENT "attach_file"
|
||||
#define VERBOSITY H5_VERBOSE_ERROR
|
||||
#define DEBUG_MSK H5_DEBUG_ALL
|
||||
|
||||
#include "examples.h"
|
||||
|
||||
int
|
||||
main (
|
||||
@@ -23,11 +27,13 @@ main (
|
||||
MPI_Init (&argc, &argv);
|
||||
|
||||
H5SetErrorHandler (H5AbortErrorhandler);
|
||||
H5SetVerbosityLevel (255);
|
||||
H5SetVerbosityLevel (VERBOSITY);
|
||||
H5SetDebugMask (DEBUG_MSK);
|
||||
|
||||
h5_file_t f = H5OpenFile (FNAME, H5_O_WRONLY, H5_PROP_DEFAULT);
|
||||
H5AddAttachment (f, ATTACHMENT);
|
||||
H5CloseFile (f);
|
||||
f = H5OpenFile (FNAME, H5_O_RDONLY, H5_PROP_DEFAULT);
|
||||
f = H5OpenFile (FNAME, H5_O_RDWR, H5_PROP_DEFAULT);
|
||||
h5_ssize_t num_attachments = H5GetNumAttachments (f);
|
||||
printf ("Number of attachments: %lld\n", (long long int)num_attachments);
|
||||
int i;
|
||||
|
||||
+19
-7
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (c) 2006-2015, The Regents of the University of California,
|
||||
Copyright (c) 2006-2018, The Regents of the University of California,
|
||||
through Lawrence Berkeley National Laboratory (subject to receipt of any
|
||||
required approvals from the U.S. Dept. of Energy) and the Paul Scherrer
|
||||
Institut (Switzerland). All rights reserved.
|
||||
@@ -9,6 +9,20 @@
|
||||
|
||||
#include "H5hut.h"
|
||||
|
||||
#include "examples.h"
|
||||
|
||||
#if !defined(VERBOSITY)
|
||||
#define VERBOSITY H5_VERBOSE_ERROR
|
||||
#endif
|
||||
|
||||
/*
|
||||
Use H5_DEBUG_ALL to get full debug output
|
||||
*/
|
||||
#if !defined(DEBUGMASK)
|
||||
//#define DEBUGMASK H5_DEBUG_NONE
|
||||
#define DEBUGMASK H5_DEBUG_ALL
|
||||
#endif
|
||||
|
||||
int
|
||||
main (
|
||||
int argc,
|
||||
@@ -16,18 +30,16 @@ main (
|
||||
) {
|
||||
MPI_Comm comm = MPI_COMM_WORLD;
|
||||
|
||||
int myproc;
|
||||
int nprocs;
|
||||
MPI_Init (&argc, &argv);
|
||||
MPI_Comm_size (comm, &nprocs);
|
||||
MPI_Comm_rank (comm, &myproc);
|
||||
|
||||
H5SetVerbosityLevel (VERBOSITY);
|
||||
H5SetDebugMask (DEBUGMASK);
|
||||
h5_prop_t prop = H5CreateFileProp ();
|
||||
H5SetPropFileMPIOCollective (prop, &comm);
|
||||
h5_file_t f = H5OpenFile ("testfile.h5", H5_O_WRONLY, prop);
|
||||
H5CloseProp (prop);
|
||||
H5CloseFile (f);
|
||||
|
||||
H5Finalize ();
|
||||
MPI_Finalize ();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -14,22 +14,33 @@ program openclose
|
||||
|
||||
implicit none
|
||||
|
||||
#if defined(PARALLEL_IO)
|
||||
include 'mpif.h'
|
||||
|
||||
integer :: comm, rank, ierr
|
||||
#endif
|
||||
integer :: comm, rank
|
||||
integer*8 :: file_id, status
|
||||
integer*8 :: props
|
||||
|
||||
|
||||
#if defined(PARALLEL_IO)
|
||||
integer :: ierr
|
||||
comm = MPI_COMM_WORLD
|
||||
call mpi_init(ierr)
|
||||
call mpi_comm_rank(comm, rank, ierr)
|
||||
|
||||
#else
|
||||
comm = 0
|
||||
rank = 1
|
||||
#endif
|
||||
|
||||
props = h5_createprop_file ()
|
||||
#if defined(PARALLEL_IO)
|
||||
status = h5_setprop_file_mpio_collective (props, comm)
|
||||
#endif
|
||||
file_id = h5_openfile ("testfile.h5", H5_O_WRONLY, props)
|
||||
status = h5_closeprop (props)
|
||||
status = h5_closefile (file_id);
|
||||
|
||||
#if defined(PARALLEL_IO)
|
||||
call mpi_finalize(ierr)
|
||||
|
||||
#endif
|
||||
|
||||
end program openclose
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
|
||||
#include "H5hut.h"
|
||||
|
||||
#include "examples.h"
|
||||
|
||||
#define FNAME1 "example_file_attribs.h5"
|
||||
#define FNAME2 "example_step_attribs.h5"
|
||||
|
||||
|
||||
+10
-5
@@ -1,5 +1,5 @@
|
||||
!
|
||||
! Copyright (c) 2006-2013, The Regents of the University of California,
|
||||
! Copyright (c) 2006-2017, The Regents of the University of California,
|
||||
! through Lawrence Berkeley National Laboratory (subject to receipt of any
|
||||
! required approvals from the U.S. Dept. of Energy) and the Paul Scherrer
|
||||
! Institut (Switzerland). All rights reserved.!
|
||||
@@ -7,15 +7,17 @@
|
||||
! License: see file COPYING in top level of source distribution.
|
||||
!
|
||||
include 'H5hut.f90'
|
||||
|
||||
|
||||
program query
|
||||
use H5hut
|
||||
implicit none
|
||||
#if defined(PARALLEL_IO)
|
||||
include 'mpif.h'
|
||||
#endif
|
||||
|
||||
! the file name we want to read
|
||||
character (len=*), parameter :: FNAME1 = "example_file_attribs.h5"
|
||||
character (len=*), parameter :: FNAME2 = "example_step_attribs.h5"
|
||||
character (len=*), parameter :: FNAME1 = "example_file_attribs.h5"
|
||||
character (len=*), parameter :: FNAME2 = "example_step_attribs.h5"
|
||||
|
||||
! verbosity level: set it to a power of 2 minus one or zero
|
||||
integer*8, parameter :: verbosity_level = 1
|
||||
@@ -23,7 +25,9 @@
|
||||
! used for mpi error return
|
||||
integer :: ierr
|
||||
|
||||
#if defined(PARALLEL_IO)
|
||||
call mpi_init (ierr)
|
||||
#endif
|
||||
|
||||
! abort program on any H5hut error
|
||||
call h5_abort_on_error ()
|
||||
@@ -33,8 +37,9 @@
|
||||
call query_file (FNAME1);
|
||||
call query_file (FNAME2);
|
||||
|
||||
#if defined(PARALLEL_IO)
|
||||
call mpi_finalize(ierr)
|
||||
|
||||
#endif
|
||||
call exit (ierr)
|
||||
|
||||
contains
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (c) 2006-2015, The Regents of the University of California,
|
||||
Copyright (c) 2006-2016, The Regents of the University of California,
|
||||
through Lawrence Berkeley National Laboratory (subject to receipt of any
|
||||
required approvals from the U.S. Dept. of Energy) and the Paul Scherrer
|
||||
Institut (Switzerland). All rights reserved.
|
||||
@@ -8,9 +8,13 @@
|
||||
*/
|
||||
|
||||
#include "H5hut.h"
|
||||
#include "examples.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#define FNAME "example_file_attribs.h5"
|
||||
#define VERBOSITY H5_VERBOSE_ERROR
|
||||
#define DEBUG_MSK 0
|
||||
|
||||
#define ATTR_STRING "FileAttrString"
|
||||
#define ATTR_INT32 "FileAttrInt32"
|
||||
@@ -23,10 +27,10 @@ main (
|
||||
int argc,
|
||||
char** argv
|
||||
) {
|
||||
MPI_Init (&argc, &argv);
|
||||
H5AbortOnError ();
|
||||
H5SetVerbosityLevel (VERBOSITY);
|
||||
|
||||
MPI_Init (&argc, &argv);
|
||||
H5SetDebugMask (DEBUG_MSK);
|
||||
|
||||
// if file properties is set to default, MPI_COMM_WORLD will be used
|
||||
h5_file_t f = H5OpenFile (FNAME, H5_O_RDONLY, H5_PROP_DEFAULT);
|
||||
|
||||
@@ -11,7 +11,9 @@
|
||||
program read_file_attribs
|
||||
use H5hut
|
||||
implicit none
|
||||
#if defined(PARALLEL_IO)
|
||||
include 'mpif.h'
|
||||
#endif
|
||||
|
||||
! the file name we want to read
|
||||
character (len=*), parameter :: FNAME = "example_file_attribs.h5"
|
||||
@@ -40,9 +42,6 @@
|
||||
real*4, allocatable :: r4_value (:)
|
||||
real*8, allocatable :: r8_value (:)
|
||||
|
||||
! used for mpi error return
|
||||
integer :: ierr
|
||||
|
||||
! H5hut file id
|
||||
integer*8 :: file_id
|
||||
|
||||
@@ -58,7 +57,12 @@
|
||||
! loop index
|
||||
integer*8 i
|
||||
|
||||
#if defined(PARALLEL_IO)
|
||||
! used for mpi error return
|
||||
integer :: ierr
|
||||
|
||||
call mpi_init (ierr)
|
||||
#endif
|
||||
|
||||
! abort program on any H5hut error
|
||||
call h5_abort_on_error ()
|
||||
@@ -109,6 +113,7 @@
|
||||
|
||||
! cleanup
|
||||
status = h5_closefile (file_id)
|
||||
#if defined(PARALLEL_IO)
|
||||
call mpi_finalize(ierr)
|
||||
|
||||
#endif
|
||||
end program read_file_attribs
|
||||
|
||||
@@ -8,6 +8,9 @@
|
||||
*/
|
||||
|
||||
#include "H5hut.h"
|
||||
#include "examples.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#define FNAME "example_step_attribs.h5"
|
||||
|
||||
|
||||
@@ -11,8 +11,11 @@
|
||||
program read_step_attribs
|
||||
use H5hut
|
||||
implicit none
|
||||
include 'mpif.h'
|
||||
|
||||
#if defined(PARALLEL_IO)
|
||||
include 'mpif.h'
|
||||
#endif
|
||||
|
||||
! the file name we want to read
|
||||
character (len=*), parameter :: FNAME = "example_file_attribs.h5"
|
||||
|
||||
@@ -36,9 +39,6 @@
|
||||
real*4, allocatable :: r4_value (:)
|
||||
real*8, allocatable :: r8_value (:)
|
||||
|
||||
! used for mpi error return
|
||||
integer :: ierr
|
||||
|
||||
! H5hut file id
|
||||
integer*8 :: file_id
|
||||
|
||||
@@ -54,8 +54,13 @@
|
||||
! loop index
|
||||
integer*8 i
|
||||
|
||||
call mpi_init (ierr)
|
||||
#if defined(PARALLEL_IO)
|
||||
! used for mpi error return
|
||||
integer :: ierr
|
||||
|
||||
call mpi_init (ierr)
|
||||
#endif
|
||||
|
||||
! abort program on any H5hut error
|
||||
call h5_abort_on_error ()
|
||||
|
||||
@@ -108,6 +113,7 @@
|
||||
|
||||
! cleanup
|
||||
status = h5_closefile (file_id)
|
||||
#if defined(PARALLEL_IO)
|
||||
call mpi_finalize(ierr)
|
||||
|
||||
#endif
|
||||
end program read_step_attribs
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
*/
|
||||
|
||||
#include "H5hut.h"
|
||||
#include "examples.h"
|
||||
|
||||
#define FNAME "example_file_attribs.h5"
|
||||
|
||||
|
||||
Executable
+29
@@ -0,0 +1,29 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
from H5hut import *
|
||||
import numpy as np
|
||||
|
||||
FNAME = "example_file_attribs.h5"
|
||||
|
||||
ATTR_STRING = "FileAttrString"
|
||||
ATTR_INT32 = "FileAttrInt32"
|
||||
ATTR_INT64 = "FileAttrInt64"
|
||||
ATTR_FLOAT32 = "FileAttrFloat32"
|
||||
ATTR_FLOAT64 = "FileAttrFloat64"
|
||||
|
||||
string_value = "This is a string attribute attached to the file."
|
||||
int32_value = np.array ([0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144], dtype='int32')
|
||||
int64_value = np.array ([42, 43, 44, 45], dtype='int64')
|
||||
float32_value = np.array ([2.71828, ], dtype='float32')
|
||||
float64_value = np.array ([3.14159265358979323846264338327950288419716939937510,],
|
||||
dtype='float64')
|
||||
|
||||
f = H5OpenFile (FNAME, H5_O_WRONLY, H5_PROP_DEFAULT)
|
||||
|
||||
H5WriteFileAttrib (f, ATTR_STRING, string_value)
|
||||
H5WriteFileAttrib (f, ATTR_INT32, int32_value)
|
||||
H5WriteFileAttrib (f, ATTR_INT64, int64_value)
|
||||
H5WriteFileAttrib (f, ATTR_FLOAT32, float32_value)
|
||||
H5WriteFileAttrib (f, ATTR_FLOAT64, float64_value)
|
||||
|
||||
H5CloseFile (f)
|
||||
@@ -11,8 +11,11 @@
|
||||
program write_file_attribs
|
||||
use H5hut
|
||||
implicit none
|
||||
include 'mpif.h'
|
||||
|
||||
#if defined(PARALLEL_IO)
|
||||
include 'mpif.h'
|
||||
#endif
|
||||
|
||||
integer*8, parameter :: verbosity_level = 1
|
||||
|
||||
character (len=*), parameter :: FNAME = "example_file_attribs.h5"
|
||||
@@ -29,11 +32,13 @@
|
||||
real*4, parameter, dimension(*) :: r4_value = (/2.71828/)
|
||||
real*8, parameter, dimension(*) :: r8_value = (/3.141592653589793238462643383279502884197169/)
|
||||
|
||||
integer :: ierr
|
||||
integer*8 :: file_id, status
|
||||
|
||||
#if defined(PARALLEL_IO)
|
||||
integer :: ierr
|
||||
call mpi_init(ierr)
|
||||
|
||||
#endif
|
||||
|
||||
! abort program on any H5hut error
|
||||
call h5_abort_on_error()
|
||||
|
||||
@@ -51,6 +56,8 @@
|
||||
|
||||
! cleanup
|
||||
status = h5_closefile (file_id)
|
||||
call mpi_finalize(ierr)
|
||||
|
||||
#if defined(PARALLEL_IO)
|
||||
call mpi_finalize(ierr)
|
||||
#endif
|
||||
end program write_file_attribs
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
*/
|
||||
|
||||
#include "H5hut.h"
|
||||
#include "examples.h"
|
||||
|
||||
#define FNAME "example_step_attribs.h5"
|
||||
|
||||
|
||||
@@ -11,8 +11,11 @@
|
||||
program write_step_attribs
|
||||
use H5hut
|
||||
implicit none
|
||||
include 'mpif.h'
|
||||
|
||||
#if defined(PARALLEL_IO)
|
||||
include 'mpif.h'
|
||||
#endif
|
||||
|
||||
integer*8, parameter :: verbosity_level = 1
|
||||
character (len=*), parameter :: FNAME = "example_step_attribs.h5"
|
||||
|
||||
@@ -29,11 +32,13 @@
|
||||
real*4, parameter, dimension(*) :: r4_value = (/2.71828/)
|
||||
real*8, parameter, dimension(*) :: r8_value = (/3.141592653589793238462643383279502884197169/)
|
||||
|
||||
integer :: ierr
|
||||
integer*8 :: file_id, status
|
||||
|
||||
#if defined(PARALLEL_IO)
|
||||
integer :: ierr
|
||||
call mpi_init(ierr)
|
||||
|
||||
#endif
|
||||
|
||||
! abort program on any H5hut error
|
||||
call h5_abort_on_error()
|
||||
|
||||
@@ -54,6 +59,8 @@
|
||||
|
||||
! cleanup
|
||||
status = h5_closefile (file_id)
|
||||
call mpi_finalize(ierr)
|
||||
|
||||
#if defined(PARALLEL_IO)
|
||||
call mpi_finalize(ierr)
|
||||
#endif
|
||||
end program write_step_attribs
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#
|
||||
|
||||
AM_CPPFLAGS += -I${abs_top_srcdir}/src/include
|
||||
AM_CPPFLAGS += -I${abs_top_srcdir}/examples/include
|
||||
FFLAGS += -cpp $(AM_CPPFLAGS)
|
||||
AM_LDFLAGS += -L${abs_top_builddir}/src/h5core/.libs
|
||||
|
||||
@@ -34,10 +35,8 @@ noinst_PROGRAMS += \
|
||||
endif
|
||||
|
||||
if ENABLE_FORTRAN
|
||||
if ENABLE_PARALLEL
|
||||
noinst_PROGRAMS += read_write_scalar_fieldf
|
||||
endif
|
||||
endif
|
||||
|
||||
attach_field_attributes_SOURCES = attach_field_attributes.c
|
||||
dump_field_attributes_SOURCES = dump_field_attributes.c
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
*/
|
||||
|
||||
#include "H5hut.h"
|
||||
#include "examples.h"
|
||||
|
||||
// name of output file
|
||||
const char* fname = "example_field.h5";
|
||||
@@ -23,11 +24,6 @@ main (
|
||||
|
||||
// initialize MPI & H5hut
|
||||
MPI_Init (&argc, &argv);
|
||||
MPI_Comm comm = MPI_COMM_WORLD;
|
||||
int comm_size = 1;
|
||||
MPI_Comm_size (comm, &comm_size);
|
||||
int comm_rank = 0;
|
||||
MPI_Comm_rank (comm, &comm_rank);
|
||||
H5AbortOnError ();
|
||||
H5SetVerbosityLevel (h5_verbosity);
|
||||
//H5SetDebugMask (-1);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (c) 2006-2015, The Regents of the University of California,
|
||||
Copyright (c) 2006-2017, The Regents of the University of California,
|
||||
through Lawrence Berkeley National Laboratory (subject to receipt of any
|
||||
required approvals from the U.S. Dept. of Energy) and the Paul Scherrer
|
||||
Institut (Switzerland). All rights reserved.
|
||||
@@ -8,6 +8,9 @@
|
||||
*/
|
||||
|
||||
#include "H5hut.h"
|
||||
#include "examples.h"
|
||||
|
||||
#include <inttypes.h>
|
||||
|
||||
// name of output file
|
||||
const char* fname = "example_field.h5";
|
||||
@@ -30,9 +33,9 @@ dump_int64_attrib (
|
||||
attrib_data);
|
||||
printf ("Attribute: '%s'\n", attrib_name);
|
||||
printf (" Type: H5_INT64_T\n");
|
||||
printf (" Data: %lld", attrib_data[0]);
|
||||
printf (" Data: %" PRId64, attrib_data[0]);
|
||||
for (size_t i = 1; i < attrib_nelems; i++) {
|
||||
printf (", %lld", attrib_data[i]);
|
||||
printf (", %" PRId64, attrib_data[i]);
|
||||
}
|
||||
printf ("\n");
|
||||
}
|
||||
@@ -103,13 +106,22 @@ dump_float32_attrib (
|
||||
printf ("\n");
|
||||
}
|
||||
|
||||
inline void
|
||||
static inline void
|
||||
dump_string_attrib (
|
||||
h5_file_t file,
|
||||
const char* const field_name,
|
||||
const char* const attrib_name,
|
||||
h5_size_t attrib_nelems
|
||||
) {
|
||||
char attrib_data[attrib_nelems];
|
||||
H5BlockReadFieldAttribString (
|
||||
file,
|
||||
field_name,
|
||||
attrib_name,
|
||||
attrib_data);
|
||||
printf ("Attribute: '%s'\n", attrib_name);
|
||||
printf (" Type: H5_STRING_T\n");
|
||||
printf (" Data: %s", attrib_data);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -165,7 +177,7 @@ main (
|
||||
h5_ssize_t n_attribs = H5BlockGetNumFieldAttribs (
|
||||
file,
|
||||
field_name);
|
||||
printf ("Field has %lld attributes attached.\n",
|
||||
printf ("Field has %" PRId64 " attributes attached.\n",
|
||||
n_attribs);
|
||||
|
||||
// dump all attached attributes
|
||||
|
||||
@@ -1,4 +1,14 @@
|
||||
/*
|
||||
Copyright (c) 2006-2017, The Regents of the University of California,
|
||||
through Lawrence Berkeley National Laboratory (subject to receipt of any
|
||||
required approvals from the U.S. Dept. of Energy) and the Paul Scherrer
|
||||
Institut (Switzerland). All rights reserved.
|
||||
|
||||
License: see file COPYING in top level of source distribution.
|
||||
*/
|
||||
|
||||
#include <H5hut.h>
|
||||
#include "examples.h"
|
||||
|
||||
#define XSIZE 8
|
||||
#define YSIZE 8
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (c) 2006-2015, The Regents of the University of California,
|
||||
Copyright (c) 2006-2017, The Regents of the University of California,
|
||||
through Lawrence Berkeley National Laboratory (subject to receipt of any
|
||||
required approvals from the U.S. Dept. of Energy) and the Paul Scherrer
|
||||
Institut (Switzerland). All rights reserved.
|
||||
@@ -8,6 +8,9 @@
|
||||
*/
|
||||
|
||||
#include "H5hut.h"
|
||||
#include "examples.h"
|
||||
|
||||
#include <inttypes.h>
|
||||
|
||||
// name of output file
|
||||
const char* fname = "example_write_field.h5";
|
||||
@@ -69,10 +72,10 @@ main (
|
||||
} else if (type == H5_STRING_T) {
|
||||
stype = "H5_STRING_T";
|
||||
}
|
||||
printf ("rank of field: %lld\n", field_rank);
|
||||
printf ("dims of field: [%lld, %lld, %lld]\n",
|
||||
printf ("rank of field: %" PRId64 "\n", field_rank);
|
||||
printf ("dims of field: [%" PRId64 ", %" PRId64 ", %" PRId64"]\n",
|
||||
field_dims[0], field_dims[1], field_dims[2]);
|
||||
printf ("rank of field data: %lld\n", elem_rank);
|
||||
printf ("rank of field data: %" PRId64 "\n", elem_rank);
|
||||
printf ("type of field data: '%s'\n", stype);
|
||||
done:
|
||||
// done
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (c) 2006-2015, The Regents of the University of California,
|
||||
Copyright (c) 2006-2017, The Regents of the University of California,
|
||||
through Lawrence Berkeley National Laboratory (subject to receipt of any
|
||||
required approvals from the U.S. Dept. of Energy) and the Paul Scherrer
|
||||
Institut (Switzerland). All rights reserved.
|
||||
@@ -8,6 +8,9 @@
|
||||
*/
|
||||
|
||||
#include "H5hut.h"
|
||||
#include "examples.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#define NPROCS 8
|
||||
#define DEFAULT_VERBOSITY H5_VERBOSE_DEFAULT
|
||||
|
||||
@@ -11,13 +11,17 @@ include 'H5hut.f90'
|
||||
program read_write_scalar_field
|
||||
use H5hut
|
||||
implicit none
|
||||
|
||||
#if defined(PARALLEL_IO)
|
||||
include 'mpif.h'
|
||||
|
||||
integer :: comm = 0
|
||||
integer :: mpi_err
|
||||
#endif
|
||||
|
||||
integer :: nargs = 0
|
||||
integer :: comm_rank = 0
|
||||
integer :: comm_size = 1
|
||||
integer :: comm = 0
|
||||
integer :: mpi_err
|
||||
integer*8 :: h5_err
|
||||
integer :: i
|
||||
character(len=32) :: arg_str
|
||||
@@ -174,10 +178,15 @@ program read_write_scalar_field
|
||||
end do
|
||||
|
||||
! init MPI & H5hut
|
||||
#if defined(PARALLEL_IO)
|
||||
comm = MPI_COMM_WORLD
|
||||
call mpi_init(mpi_err)
|
||||
call mpi_comm_rank(comm, comm_rank, mpi_err)
|
||||
call mpi_comm_size (comm, comm_size, mpi_err)
|
||||
#else
|
||||
comm_size = 1
|
||||
comm_rank = 0
|
||||
#endif
|
||||
call h5_abort_on_error ()
|
||||
call h5_set_verbosity_level (511_8)
|
||||
|
||||
@@ -215,7 +224,9 @@ program read_write_scalar_field
|
||||
|
||||
case default
|
||||
print *, "Run this test on 1, 8, 16 or 32 cores!"
|
||||
#if defined(PARALLEL_IO)
|
||||
call mpi_finalize
|
||||
#endif
|
||||
call exit (1)
|
||||
end select
|
||||
|
||||
@@ -233,7 +244,9 @@ program read_write_scalar_field
|
||||
|
||||
endif
|
||||
print "('[proc ', I3, ']: Cleanup.')", comm_rank
|
||||
#if defined(PARALLEL_IO)
|
||||
call mpi_finalize
|
||||
#endif
|
||||
print "('[proc ', I3, ']: Done.')", comm_rank
|
||||
call exit (0)
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
*/
|
||||
|
||||
#include "H5hut.h"
|
||||
#include "examples.h"
|
||||
|
||||
// name of output file
|
||||
const char* fname = "example_field.h5";
|
||||
@@ -21,7 +22,7 @@ const ssize_t dim_y = 8;
|
||||
const ssize_t dim_z = 32;
|
||||
|
||||
|
||||
inline ssize_t idx (
|
||||
static inline ssize_t idx (
|
||||
ssize_t i, ssize_t i_dim,
|
||||
ssize_t j, ssize_t j_dim,
|
||||
ssize_t k
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2006-2015, The Regents of the University of California,
|
||||
# Copyright (c) 2006-2016, The Regents of the University of California,
|
||||
# through Lawrence Berkeley National Laboratory (subject to receipt of any
|
||||
# required approvals from the U.S. Dept. of Energy) and the Paul Scherrer
|
||||
# Institut (Switzerland). All rights reserved.!
|
||||
@@ -10,6 +10,9 @@
|
||||
AM_CPPFLAGS += -I${abs_top_srcdir}/src/include
|
||||
FFLAGS += -cpp $(AM_CPPFLAGS)
|
||||
AM_LDFLAGS += -L${abs_top_builddir}/src/h5core/.libs
|
||||
if ENABLE_DEBUG
|
||||
AM_LDFLAGS += -static
|
||||
endif
|
||||
|
||||
LDADD =
|
||||
LDADD += -lH5hut
|
||||
@@ -46,11 +49,12 @@ EXTRA_DIST = \
|
||||
trimesh_write.c \
|
||||
trimesh_2gnuplot.c \
|
||||
trimesh_write_dunetest.c
|
||||
endif
|
||||
# map_tet2globalid.c \
|
||||
# map_triangle2globalid.c \
|
||||
# $(bin_SCRIPTS)
|
||||
|
||||
endif
|
||||
|
||||
clean-local:
|
||||
$(RM) *.h5 *~
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
#include "H5hut.h"
|
||||
|
||||
#ifndef PARALLEL_IO
|
||||
#ifndef H5_HAVE_PARALLEL
|
||||
#ifndef MPI_COMM_WORLD
|
||||
#define MPI_COMM_WORLD 0
|
||||
#endif
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
#include "H5hut.h"
|
||||
|
||||
#ifndef PARALLEL_IO
|
||||
#ifndef H5_HAVE_PARALLEL
|
||||
#ifndef MPI_COMM_WORLD
|
||||
#define MPI_COMM_WORLD 0
|
||||
#endif
|
||||
|
||||
@@ -4,9 +4,6 @@
|
||||
|
||||
#include "H5hut.h"
|
||||
|
||||
#define PRINT_UPADJACENCIES 1
|
||||
#define PRINT_DOWNADJACENCIES 0
|
||||
|
||||
const char* FNAME = "simple_tet.h5";
|
||||
|
||||
typedef struct timer {
|
||||
|
||||
@@ -4,13 +4,12 @@
|
||||
|
||||
#include "H5hut.h"
|
||||
|
||||
// name of input file
|
||||
const char* FNAME = "simple_tet.h5";
|
||||
|
||||
#ifndef PARALLEL_IO
|
||||
#ifndef MPI_COMM_WORLD
|
||||
#define MPI_COMM_WORLD 0
|
||||
#endif
|
||||
#endif
|
||||
// H5hut verbosity/debug level
|
||||
const h5_int64_t h5_verbosity = H5_VERBOSE_DEFAULT;
|
||||
const h5_int64_t h5_debugmsk = H5_DEBUG_ALL;
|
||||
|
||||
typedef struct timer {
|
||||
clock_t _start;
|
||||
@@ -378,10 +377,12 @@ main (
|
||||
int argc,
|
||||
char* argv[]
|
||||
) {
|
||||
|
||||
/* abort program on error, so we don't have to handle them */
|
||||
H5SetErrorHandler (H5AbortErrorhandler);
|
||||
H5SetVerbosityLevel (2);
|
||||
|
||||
H5SetVerbosityLevel (h5_verbosity);
|
||||
H5SetDebugMask (h5_debugmsk);
|
||||
|
||||
/* open file and get number of meshes */
|
||||
h5_file_t f = H5OpenFile (FNAME, H5_O_RDONLY, 0);
|
||||
h5_size_t num_meshes = H5FedGetNumTetrahedralMeshes (f);
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
#include "H5hut.h"
|
||||
|
||||
#ifndef PARALLEL_IO
|
||||
#ifndef H5_HAVE_PARALLEL
|
||||
#ifndef MPI_COMM_WORLD
|
||||
#define MPI_COMM_WORLD 0
|
||||
#endif
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "H5hut.h"
|
||||
#if defined (PARALLEL_IO)
|
||||
#if defined (H5_HAVE_PARALLEL)
|
||||
#include <mpi.h>
|
||||
#endif
|
||||
|
||||
@@ -87,7 +87,7 @@ done:
|
||||
H5FedCloseMesh (m);
|
||||
H5CloseFile (f);
|
||||
|
||||
#if defined (PARALLEL_IO)
|
||||
#if defined (H5_HAVE_PARALLEL)
|
||||
MPI_Finalize ();
|
||||
#endif
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "H5hut.h"
|
||||
#if defined (PARALLEL_IO)
|
||||
#if defined (H5_HAVE_PARALLEL)
|
||||
#include <mpi.h>
|
||||
#endif
|
||||
|
||||
@@ -253,7 +253,7 @@ main (
|
||||
|
||||
/* done */
|
||||
H5CloseFile (f);
|
||||
#if defined (PARALLEL_IO)
|
||||
#if defined (H5_HAVE_PARALLEL)
|
||||
MPI_Finalize ();
|
||||
#endif
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
#include "H5hut.h"
|
||||
|
||||
#ifndef PARALLEL_IO
|
||||
#ifndef H5_HAVE_PARALLEL
|
||||
#ifndef MPI_COMM_WORLD
|
||||
#define MPI_COMM_WORLD 0
|
||||
#endif
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
query
|
||||
read_core_vfd
|
||||
read_core_vfdf
|
||||
read_canonicalviewf
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2006-2015, The Regents of the University of California,
|
||||
# Copyright (c) 2006-2017, The Regents of the University of California,
|
||||
# through Lawrence Berkeley National Laboratory (subject to receipt of any
|
||||
# required approvals from the U.S. Dept. of Energy) and the Paul Scherrer
|
||||
# Institut (Switzerland). All rights reserved.!
|
||||
@@ -8,6 +8,7 @@
|
||||
#
|
||||
|
||||
AM_CPPFLAGS += -I${abs_top_srcdir}/src/include
|
||||
AM_CPPFLAGS += -I${abs_top_srcdir}/examples/include
|
||||
FFLAGS += -cpp $(AM_CPPFLAGS)
|
||||
AM_LDFLAGS += -L${abs_top_builddir}/src/h5core/.libs
|
||||
|
||||
@@ -29,6 +30,7 @@ noinst_PROGRAMS =
|
||||
|
||||
if ENABLE_C
|
||||
noinst_PROGRAMS += \
|
||||
query \
|
||||
read_core_vfd \
|
||||
read_canonicalview \
|
||||
read_setnparticles \
|
||||
@@ -41,7 +43,6 @@ noinst_PROGRAMS += \
|
||||
endif
|
||||
|
||||
if ENABLE_FORTRAN
|
||||
if ENABLE_PARALLEL
|
||||
noinst_PROGRAMS += \
|
||||
read_core_vfdf \
|
||||
read_canonicalviewf \
|
||||
@@ -53,7 +54,6 @@ noinst_PROGRAMS += \
|
||||
write_setviewf \
|
||||
write_stridedf
|
||||
endif
|
||||
endif
|
||||
|
||||
EXTRA_PROGRAMS =
|
||||
|
||||
@@ -73,6 +73,6 @@ endif
|
||||
$(FC) $(FFLAGS) -c $<
|
||||
|
||||
clean-local:
|
||||
$(RM) *~
|
||||
$(RM) -f *~
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,115 @@
|
||||
/*
|
||||
Copyright (c) 2006-2015, The Regents of the University of California,
|
||||
through Lawrence Berkeley National Laboratory (subject to receipt of any
|
||||
required approvals from the U.S. Dept. of Energy) and the Paul Scherrer
|
||||
Institut (Switzerland). All rights reserved.
|
||||
|
||||
License: see file COPYING in top level of source distribution.
|
||||
*/
|
||||
|
||||
#include "H5hut.h"
|
||||
#include "examples.h"
|
||||
|
||||
#define FNAME "example_setview.h5"
|
||||
#define VERBOSITY H5_VERBOSE_ERROR
|
||||
#define DEBUG_MSK 0
|
||||
|
||||
/*
|
||||
Due to the way types are defined in H5hut, we cannot use "switch() {}"
|
||||
*/
|
||||
const char*
|
||||
type2string (
|
||||
h5_int64_t type
|
||||
) {
|
||||
if (type == H5_FLOAT64_T)
|
||||
return "H5_FLOAT64_T";
|
||||
if (type == H5_FLOAT32_T)
|
||||
return "H5_FLOAT32_T";
|
||||
if (type == H5_INT64_T)
|
||||
return "H5_INT64_T";
|
||||
if (type == H5_INT32_T)
|
||||
return "H5_INT32_T";
|
||||
if (type == H5_STRING_T)
|
||||
return "H5_STRING_T";
|
||||
return "unknown type";
|
||||
}
|
||||
|
||||
static inline void
|
||||
print_header (
|
||||
h5_int64_t n
|
||||
) {
|
||||
if (n > 0) {
|
||||
printf ("\t%-6s %-30s %-15s %-10s\n", "idx", "name", "type", "dim");
|
||||
}
|
||||
}
|
||||
|
||||
static inline void
|
||||
print_query_result (
|
||||
h5_int64_t i,
|
||||
const char* const name,
|
||||
h5_int64_t type,
|
||||
h5_int64_t dim
|
||||
) {
|
||||
printf ("\t%-6lld %-30s %-15s %-10lld\n", (long long)i, name, type2string(type), (long long)dim);
|
||||
}
|
||||
|
||||
void
|
||||
query_step_datasets (
|
||||
h5_int64_t f,
|
||||
h5_int64_t step
|
||||
) {
|
||||
char name[H5_MAX_NAME_LEN];
|
||||
h5_int64_t type;
|
||||
h5_size_t dim;
|
||||
|
||||
H5SetStep (f, step);
|
||||
|
||||
// query # of step attributes
|
||||
h5_int64_t n = H5PartGetNumDatasets (f);
|
||||
printf ("\tNumber of datasets in step %lld: %lld\n", (long long)step, (long long)n);
|
||||
|
||||
// output name and type of all datasets
|
||||
print_header (n);
|
||||
for (h5_int64_t i = 0; i < n; i++) {
|
||||
H5PartGetDatasetInfo (f, i, name, sizeof(name), &type, &dim);
|
||||
print_query_result (i, name, type, dim);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
query_file (
|
||||
const char* const fname
|
||||
) {
|
||||
printf ("\nFile: %s\n", fname);
|
||||
// if file properties is set to default, MPI_COMM_WORLD will be used
|
||||
h5_file_t f = H5OpenFile (fname, H5_O_RDONLY, H5_PROP_DEFAULT);
|
||||
|
||||
// query # of steps, if > 0: go to first step, query and output step attribs
|
||||
h5_int64_t n = H5GetNumSteps (f);
|
||||
printf ("\tNumber of steps: %lld\n", (long long)n);
|
||||
|
||||
if (n > 0) {
|
||||
// go to first step
|
||||
h5_int64_t i = -1;
|
||||
while (!H5HasStep (f, ++i));
|
||||
|
||||
query_step_datasets (f, i);
|
||||
}
|
||||
H5CloseFile (f);
|
||||
}
|
||||
|
||||
int
|
||||
main (
|
||||
int argc,
|
||||
char** argv
|
||||
) {
|
||||
MPI_Init (&argc, &argv);
|
||||
H5AbortOnError ();
|
||||
H5SetVerbosityLevel (VERBOSITY);
|
||||
H5SetDebugMask (H5_DEBUG_ALL);
|
||||
|
||||
query_file (FNAME);
|
||||
|
||||
MPI_Finalize ();
|
||||
return 0;
|
||||
}
|
||||
@@ -8,6 +8,9 @@
|
||||
*/
|
||||
|
||||
#include "H5hut.h"
|
||||
#include "examples.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
// name of input file
|
||||
const char* fname = "example_setview.h5";
|
||||
@@ -23,8 +26,6 @@ main (
|
||||
// initialize MPI & H5hut
|
||||
MPI_Init (&argc, &argv);
|
||||
MPI_Comm comm = MPI_COMM_WORLD;
|
||||
int comm_size = 1;
|
||||
MPI_Comm_size (comm, &comm_size);
|
||||
int comm_rank = 0;
|
||||
MPI_Comm_rank (comm, &comm_rank);
|
||||
H5AbortOnError ();
|
||||
|
||||
@@ -11,7 +11,10 @@ include 'H5hut.f90'
|
||||
program read_canonicalview
|
||||
use H5hut
|
||||
implicit none
|
||||
|
||||
#if defined(PARALLEL_IO)
|
||||
include 'mpif.h'
|
||||
#endif
|
||||
|
||||
! name of input file
|
||||
character (len=*), parameter :: fname = "example_setview.h5"
|
||||
@@ -19,17 +22,19 @@ program read_canonicalview
|
||||
! H5hut verbosity level
|
||||
integer*8, parameter :: h5_verbosity = H5_VERBOSE_DEFAULT
|
||||
|
||||
integer :: comm, comm_size, comm_rank, mpi_ierror
|
||||
integer :: comm_rank = 0
|
||||
integer*8 :: file, h5_ierror
|
||||
integer*8 :: num_particles
|
||||
integer*8 :: i
|
||||
integer*4, allocatable :: data(:)
|
||||
|
||||
! initialize MPI & H5hut
|
||||
#if defined(PARALLEL_IO)
|
||||
integer :: comm, mpi_ierror
|
||||
comm = MPI_COMM_WORLD
|
||||
call mpi_init (mpi_ierror)
|
||||
call mpi_comm_size (comm, comm_size, mpi_ierror)
|
||||
call mpi_comm_rank (comm, comm_rank, mpi_ierror)
|
||||
#endif
|
||||
call h5_abort_on_error ()
|
||||
call h5_set_verbosity_level (h5_verbosity)
|
||||
|
||||
@@ -53,6 +58,9 @@ program read_canonicalview
|
||||
! cleanup
|
||||
deallocate (data)
|
||||
h5_ierror = h5_closefile (file)
|
||||
|
||||
#if defined(PARALLEL_IO)
|
||||
call mpi_finalize (mpi_ierror)
|
||||
#endif
|
||||
|
||||
end program read_canonicalview
|
||||
|
||||
@@ -14,6 +14,9 @@
|
||||
the VFD core driver.
|
||||
*/
|
||||
#include "H5hut.h"
|
||||
#include "examples.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
// name of input file
|
||||
const char* fname = "example_core_vfd.h5";
|
||||
@@ -30,8 +33,6 @@ main (
|
||||
// initialize MPI & H5hut
|
||||
MPI_Init (&argc, &argv);
|
||||
MPI_Comm comm = MPI_COMM_WORLD;
|
||||
int comm_size = 1;
|
||||
MPI_Comm_size (comm, &comm_size);
|
||||
int comm_rank = 0;
|
||||
MPI_Comm_rank (comm, &comm_rank);
|
||||
H5AbortOnError ();
|
||||
|
||||
@@ -11,7 +11,10 @@ include 'H5hut.f90'
|
||||
program read_core_vfd
|
||||
use H5hut
|
||||
implicit none
|
||||
|
||||
#if defined(PARALLEL_IO)
|
||||
include 'mpif.h'
|
||||
#endif
|
||||
|
||||
! name of input file
|
||||
character (len=*), parameter :: fname = "example_core_vfd.h5"
|
||||
@@ -19,8 +22,6 @@ program read_core_vfd
|
||||
! H5hut verbosity level
|
||||
integer*8, parameter :: h5_verbosity = H5_VERBOSE_DEFAULT
|
||||
|
||||
|
||||
integer :: comm, comm_size, comm_rank, mpi_ierror
|
||||
integer*8 :: file, h5_ierror
|
||||
integer*8 :: prop
|
||||
integer*8 :: num_particles
|
||||
@@ -28,10 +29,13 @@ program read_core_vfd
|
||||
integer*4, allocatable :: data(:)
|
||||
|
||||
! initialize MPI & H5hut
|
||||
integer :: comm_rank = 0
|
||||
#if defined(PARALLEL_IO)
|
||||
integer :: comm, mpi_ierror
|
||||
comm = MPI_COMM_WORLD
|
||||
call mpi_init (mpi_ierror)
|
||||
call mpi_comm_size (comm, comm_size, mpi_ierror)
|
||||
call mpi_comm_rank (comm, comm_rank, mpi_ierror)
|
||||
#endif
|
||||
call h5_abort_on_error ()
|
||||
call h5_set_verbosity_level (h5_verbosity)
|
||||
|
||||
@@ -57,6 +61,9 @@ program read_core_vfd
|
||||
! cleanup
|
||||
deallocate (data)
|
||||
h5_ierror = h5_closefile (file)
|
||||
|
||||
#if defined(PARALLEL_IO)
|
||||
call mpi_finalize (mpi_ierror)
|
||||
#endif
|
||||
|
||||
end program read_core_vfd
|
||||
|
||||
@@ -8,6 +8,9 @@
|
||||
*/
|
||||
|
||||
#include "H5hut.h"
|
||||
#include "examples.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
// name of input file
|
||||
const char* fname = "example_setnparticles.h5";
|
||||
|
||||
@@ -11,7 +11,10 @@ include 'H5hut.f90'
|
||||
program read_setnparticles
|
||||
use H5hut
|
||||
implicit none
|
||||
|
||||
#if defined(PARALLEL_IO)
|
||||
include 'mpif.h'
|
||||
#endif
|
||||
|
||||
! name of input file
|
||||
character (len=*), parameter :: fname = "example_setnparticles.h5"
|
||||
@@ -19,17 +22,21 @@ program read_setnparticles
|
||||
! H5hut verbosity level
|
||||
integer*8, parameter :: h5_verbosity = H5_VERBOSE_DEFAULT
|
||||
|
||||
integer :: comm, comm_size, comm_rank, mpi_ierror
|
||||
integer :: comm_size = 1
|
||||
integer :: comm_rank = 0
|
||||
integer*8 :: file, h5_ierror
|
||||
integer*8 :: num_particles, num_particles_total
|
||||
integer*8 :: i
|
||||
integer*4, allocatable :: data(:)
|
||||
|
||||
! initialize MPI & H5hut
|
||||
#if defined(PARALLEL_IO)
|
||||
integer :: comm, mpi_ierror
|
||||
comm = MPI_COMM_WORLD
|
||||
call mpi_init (mpi_ierror)
|
||||
call mpi_comm_size (comm, comm_size, mpi_ierror)
|
||||
call mpi_comm_rank (comm, comm_rank, mpi_ierror)
|
||||
#endif
|
||||
call h5_abort_on_error ()
|
||||
call h5_set_verbosity_level (h5_verbosity)
|
||||
|
||||
@@ -61,6 +68,9 @@ program read_setnparticles
|
||||
! cleanup
|
||||
deallocate (data)
|
||||
h5_ierror = h5_closefile (file)
|
||||
|
||||
#if defined(PARALLEL_IO)
|
||||
call mpi_finalize (mpi_ierror)
|
||||
#endif
|
||||
|
||||
end program read_setnparticles
|
||||
|
||||
@@ -8,6 +8,9 @@
|
||||
*/
|
||||
|
||||
#include "H5hut.h"
|
||||
#include "examples.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
// name of input file
|
||||
const char* fname = "example_setview.h5";
|
||||
|
||||
@@ -11,25 +11,32 @@ include 'H5hut.f90'
|
||||
program read_setviewf
|
||||
use H5hut
|
||||
implicit none
|
||||
#if defined(PARALLEL_IO)
|
||||
include 'mpif.h'
|
||||
|
||||
#endif
|
||||
|
||||
! name of input file
|
||||
character (len=*), parameter :: fname = "example_setview.h5"
|
||||
|
||||
! H5hut verbosity level
|
||||
integer*8, parameter :: h5_verbosity = H5_VERBOSE_DEFAULT
|
||||
|
||||
integer :: comm, comm_size, comm_rank, mpi_ierror
|
||||
integer :: comm_size = 1
|
||||
integer :: comm_rank = 0
|
||||
integer*8 :: file, h5_ierror
|
||||
integer*8 :: num_particles, num_particles_total
|
||||
integer*8 :: i, start, end, remainder
|
||||
integer*4, allocatable :: data(:)
|
||||
|
||||
! initialize MPI & H5hut
|
||||
#if defined(PARALLEL_IO)
|
||||
integer :: comm, mpi_ierror
|
||||
comm = MPI_COMM_WORLD
|
||||
call mpi_init (mpi_ierror)
|
||||
call mpi_comm_size (comm, comm_size, mpi_ierror)
|
||||
call mpi_comm_rank (comm, comm_rank, mpi_ierror)
|
||||
#endif
|
||||
|
||||
call h5_abort_on_error ()
|
||||
call h5_set_verbosity_level (h5_verbosity)
|
||||
|
||||
@@ -78,6 +85,9 @@ program read_setviewf
|
||||
! cleanup
|
||||
deallocate (data)
|
||||
h5_ierror = h5_closefile (file)
|
||||
call mpi_finalize (mpi_ierror)
|
||||
|
||||
#if defined(PARALLEL_IO)
|
||||
call mpi_finalize (mpi_ierror)
|
||||
#endif
|
||||
|
||||
end program read_setviewf
|
||||
|
||||
@@ -8,6 +8,9 @@
|
||||
*/
|
||||
|
||||
#include "H5hut.h"
|
||||
#include "examples.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
// name of input file
|
||||
const char* fname = "example_strided.h5";
|
||||
|
||||
@@ -11,24 +11,33 @@ include 'H5hut.f90'
|
||||
program read_stridedf
|
||||
use H5hut
|
||||
implicit none
|
||||
#if defined(PARALLEL_IO)
|
||||
include 'mpif.h'
|
||||
#endif
|
||||
|
||||
! name of input file
|
||||
character (len=*), parameter :: fname = "example_strided.h5"
|
||||
|
||||
! H5hut verbosity level
|
||||
integer*8, parameter :: h5_verbosity = H5_VERBOSE_DEFAULT
|
||||
|
||||
integer :: comm, comm_size, comm_rank, mpi_ierror
|
||||
integer*8 :: file, h5_ierror
|
||||
integer*8 :: num_particles, num_particles_total
|
||||
real*8, allocatable :: data(:)
|
||||
integer*8 :: i, start
|
||||
|
||||
! initialize MPI & H5hut
|
||||
#if defined(PARALLEL_IO)
|
||||
integer :: comm, comm_size, comm_rank, mpi_ierror
|
||||
comm = MPI_COMM_WORLD
|
||||
call mpi_init (mpi_error)
|
||||
call mpi_comm_size (comm, comm_size, mpi_ierror)
|
||||
call mpi_comm_rank (comm, comm_rank, mpi_ierror)
|
||||
#else
|
||||
integer :: comm_size = 1
|
||||
integer :: comm_rank = 0
|
||||
#endif
|
||||
|
||||
call h5_abort_on_error ()
|
||||
call h5_set_verbosity_level (h5_verbosity)
|
||||
|
||||
@@ -68,6 +77,9 @@ program read_stridedf
|
||||
! cleanup
|
||||
deallocate (data)
|
||||
h5_ierror = h5_closefile (file)
|
||||
call mpi_finalize (mpi_ierror)
|
||||
|
||||
#if defined(PARALLEL_IO)
|
||||
call mpi_finalize (mpi_ierror)
|
||||
#endif
|
||||
|
||||
end program read_stridedf
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
the VFD core driver.
|
||||
*/
|
||||
#include "H5hut.h"
|
||||
#include "examples.h"
|
||||
|
||||
// name of output file
|
||||
const char* fname = "example_core_vfd.h5";
|
||||
@@ -33,8 +34,6 @@ main (
|
||||
// initialize MPI & H5hut
|
||||
MPI_Init (&argc, &argv);
|
||||
MPI_Comm comm = MPI_COMM_WORLD;
|
||||
int comm_size = 1;
|
||||
MPI_Comm_size (comm, &comm_size);
|
||||
int comm_rank = 0;
|
||||
MPI_Comm_rank (comm, &comm_rank);
|
||||
H5AbortOnError ();
|
||||
|
||||
@@ -11,8 +11,11 @@ include 'H5hut.f90'
|
||||
program write_core_vfd
|
||||
use H5hut
|
||||
implicit none
|
||||
include 'mpif.h'
|
||||
|
||||
#if defined(PARALLEL_IO)
|
||||
include 'mpif.h'
|
||||
#endif
|
||||
|
||||
! name of output file
|
||||
character (len=*), parameter :: fname = "example_core_vfd.h5"
|
||||
|
||||
@@ -22,17 +25,20 @@ program write_core_vfd
|
||||
! number of particles we are going to write per core
|
||||
integer*4, parameter :: num_particles = 32
|
||||
|
||||
integer :: comm, comm_size, comm_rank, mpi_ierror
|
||||
integer :: comm_rank = 0
|
||||
integer*8 :: file, h5_ierror
|
||||
integer*8 :: prop
|
||||
integer*4 :: i
|
||||
integer*4, allocatable :: data(:)
|
||||
|
||||
! initialize MPI & H5hut
|
||||
#if defined(PARALLEL_IO)
|
||||
integer :: comm, mpi_ierror
|
||||
comm = MPI_COMM_WORLD
|
||||
call mpi_init (mpi_ierror)
|
||||
call mpi_comm_size (comm, comm_size, mpi_ierror)
|
||||
call mpi_comm_rank (comm, comm_rank, mpi_ierror)
|
||||
#endif
|
||||
|
||||
call h5_abort_on_error ()
|
||||
call h5_set_verbosity_level (h5_verbosity)
|
||||
|
||||
@@ -57,6 +63,9 @@ program write_core_vfd
|
||||
! cleanup
|
||||
deallocate (data)
|
||||
h5_ierror = h5_closefile (file)
|
||||
call mpi_finalize (mpi_ierror)
|
||||
|
||||
#if defined(PARALLEL_IO)
|
||||
call mpi_finalize (mpi_ierror)
|
||||
#endif
|
||||
|
||||
end program write_core_vfd
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
*/
|
||||
|
||||
#include "H5hut.h"
|
||||
#include "examples.h"
|
||||
|
||||
// name of output file
|
||||
const char* fname = "example_setnparticles.h5";
|
||||
@@ -27,8 +28,6 @@ main (
|
||||
// initialize MPI & H5hut
|
||||
MPI_Init (&argc, &argv);
|
||||
MPI_Comm comm = MPI_COMM_WORLD;
|
||||
int comm_size = 1;
|
||||
MPI_Comm_size (comm, &comm_size);
|
||||
int comm_rank = 0;
|
||||
MPI_Comm_rank (comm, &comm_rank);
|
||||
H5AbortOnError ();
|
||||
|
||||
@@ -11,8 +11,10 @@ include 'H5hut.f90'
|
||||
program write_setnparticles
|
||||
use H5hut
|
||||
implicit none
|
||||
include 'mpif.h'
|
||||
|
||||
#if defined(PARALLEL_IO)
|
||||
include 'mpif.h'
|
||||
#endif
|
||||
|
||||
! name of output file
|
||||
character (len=*), parameter :: fname = "example_setnparticles.h5"
|
||||
@@ -23,16 +25,19 @@ program write_setnparticles
|
||||
! number of particles we are going to write per core
|
||||
integer*8, parameter :: num_particles = 32
|
||||
|
||||
integer :: comm, comm_size, comm_rank, mpi_ierror
|
||||
integer :: comm_rank = 0
|
||||
integer*8 :: file, h5_ierror
|
||||
integer*4 :: i
|
||||
integer*4, allocatable :: data(:)
|
||||
|
||||
! initialize MPI & H5hut
|
||||
#if defined(PARALLEL_IO)
|
||||
integer :: comm, mpi_ierror
|
||||
comm = MPI_COMM_WORLD
|
||||
call mpi_init (mpi_ierror)
|
||||
call mpi_comm_size (comm, comm_size, mpi_ierror)
|
||||
call mpi_comm_rank (comm, comm_rank, mpi_ierror)
|
||||
#endif
|
||||
|
||||
call h5_abort_on_error ()
|
||||
call h5_set_verbosity_level (h5_verbosity)
|
||||
|
||||
@@ -55,6 +60,9 @@ program write_setnparticles
|
||||
! cleanup
|
||||
deallocate (data)
|
||||
h5_ierror = h5_closefile (file)
|
||||
call mpi_finalize (mpi_ierror)
|
||||
|
||||
#if defined(PARALLEL_IO)
|
||||
call mpi_finalize (mpi_ierror)
|
||||
#endif
|
||||
|
||||
end program write_setnparticles
|
||||
|
||||
@@ -7,36 +7,79 @@
|
||||
License: see file COPYING in top level of source distribution.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "H5hut.h"
|
||||
#include "examples.h"
|
||||
|
||||
// name of output file
|
||||
const char* fname = "example_setview.h5";
|
||||
|
||||
// H5hut verbosity level
|
||||
const h5_int64_t h5_verbosity = H5_VERBOSE_DEFAULT;
|
||||
const h5_int64_t h5_debug_mask = 0;
|
||||
|
||||
// we are going to write multiple consecutive blocks
|
||||
const h5_int64_t num_blocks = 4;
|
||||
const h5_int64_t num_particles_per_block = 32;
|
||||
//const h5_int64_t num_blocks = 32;
|
||||
//const h5_int64_t num_particles_per_block = 1048576*8;
|
||||
|
||||
int
|
||||
main (
|
||||
int argc,
|
||||
char* argv[]
|
||||
){
|
||||
if (argc < 3) {
|
||||
fprintf (stderr, "Usage: %s <number_of_blocks> <sizeof_block>\n", argv[0]);
|
||||
exit (1);
|
||||
}
|
||||
|
||||
char* endptr = NULL;
|
||||
long long n = strtoll (argv[1], &endptr, 10);
|
||||
if (*endptr != 0) {
|
||||
fprintf (stderr, "first argument (number of blocks) is not a unsigned integer!\n");
|
||||
exit (1);
|
||||
}
|
||||
if (n < 1) {
|
||||
fprintf (stderr, "first argument (number of block) must be >= 1!\n");
|
||||
exit (1);
|
||||
}
|
||||
if (n == LLONG_MAX) {
|
||||
fprintf (stderr, "first argument (number of block) to large!\n");
|
||||
exit (1);
|
||||
}
|
||||
h5_int64_t num_blocks = (h5_int64_t)n;
|
||||
n = strtoll (argv[2], &endptr, 10);
|
||||
if (*endptr != 0) {
|
||||
fprintf (stderr, "second argument (sizeof blocks) is not a unsigned integer!\n");
|
||||
exit (1);
|
||||
}
|
||||
if (n < 1024) {
|
||||
fprintf (stderr, "second argument (sizeof block) must be >= 1024!\n");
|
||||
exit (1);
|
||||
}
|
||||
if (n == LLONG_MAX) {
|
||||
fprintf (stderr, "second argument (sizeof block) to large!\n");
|
||||
exit (1);
|
||||
}
|
||||
h5_int64_t num_particles_per_block = (h5_int64_t)n;
|
||||
|
||||
// initialize MPI & H5hut
|
||||
MPI_Init (&argc, &argv);
|
||||
MPI_Comm comm = MPI_COMM_WORLD;
|
||||
int comm_size = 1;
|
||||
MPI_Comm_size (comm, &comm_size);
|
||||
int comm_rank = 0;
|
||||
MPI_Comm_rank (comm, &comm_rank);
|
||||
H5AbortOnError ();
|
||||
H5SetVerbosityLevel (h5_verbosity);
|
||||
H5SetDebugMask (h5_debug_mask);
|
||||
|
||||
h5_prop_t prop = H5CreateFileProp ();
|
||||
H5SetPropFileAlign (prop, 1048576*8);
|
||||
H5SetPropFileMPIOIndependent (prop, &comm);
|
||||
//H5SetPropFileMPIOCollective (prop, &comm);
|
||||
|
||||
// open file and create first step
|
||||
h5_file_t file = H5OpenFile (fname, H5_O_WRONLY, H5_PROP_DEFAULT);
|
||||
h5_file_t file = H5OpenFile (fname, H5_O_WRONLY, prop);
|
||||
//H5PartSetChunkSize (file, 1048576*1);
|
||||
H5SetStep (file, 0);
|
||||
|
||||
/*
|
||||
@@ -53,7 +96,9 @@ main (
|
||||
// write multiple consecutive blocks
|
||||
for (int i = 0; i < num_blocks; i++) {
|
||||
// create fake data
|
||||
h5_int32_t data[num_particles_per_block];
|
||||
//h5_int32_t data[num_particles_per_block];
|
||||
h5_int64_t *data;
|
||||
data = calloc (num_particles_per_block, sizeof(*data));
|
||||
for (int j = 0; j < num_particles_per_block; j++) {
|
||||
data[j] = j + i*num_particles_per_block + offset;
|
||||
}
|
||||
@@ -64,7 +109,7 @@ main (
|
||||
offset + i*num_particles_per_block,
|
||||
offset + (i+1)*num_particles_per_block - 1);
|
||||
// write data
|
||||
H5PartWriteDataInt32 (file, "data", data);
|
||||
H5PartWriteDataInt64 (file, "data", data);
|
||||
}
|
||||
|
||||
// done
|
||||
|
||||
@@ -0,0 +1,120 @@
|
||||
/*
|
||||
Copyright (c) 2006-2015, The Regents of the University of California,
|
||||
through Lawrence Berkeley National Laboratory (subject to receipt of any
|
||||
required approvals from the U.S. Dept. of Energy) and the Paul Scherrer
|
||||
Institut (Switzerland). All rights reserved.
|
||||
|
||||
License: see file COPYING in top level of source distribution.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <mpi.h>
|
||||
|
||||
#include "H5hut.h"
|
||||
#include "examples.h"
|
||||
|
||||
// name of output file
|
||||
const char* fname = "example_setview.h5";
|
||||
|
||||
// H5hut verbosity level
|
||||
const h5_int64_t h5_verbosity = H5_VERBOSE_DEFAULT;
|
||||
const h5_int64_t h5_debug_mask = 0;
|
||||
|
||||
// we are going to write multiple consecutive blocks
|
||||
//const h5_int64_t num_blocks = 32;
|
||||
//const h5_int64_t num_particles_per_block = 1048576*8;
|
||||
|
||||
int
|
||||
main (
|
||||
int argc,
|
||||
char* argv[]
|
||||
){
|
||||
if (argc < 3) {
|
||||
fprintf (stderr, "Usage: %s <number_of_blocks> <sizeof_block>\n", argv[0]);
|
||||
exit (1);
|
||||
}
|
||||
|
||||
char* endptr = NULL;
|
||||
long long n = strtoll (argv[1], &endptr, 10);
|
||||
if (*endptr != 0) {
|
||||
fprintf (stderr, "first argument (number of blocks) is not a unsigned integer!\n");
|
||||
exit (1);
|
||||
}
|
||||
if (n < 1) {
|
||||
fprintf (stderr, "first argument (number of block) must be >= 1!\n");
|
||||
exit (1);
|
||||
}
|
||||
if (n == LLONG_MAX) {
|
||||
fprintf (stderr, "first argument (number of block) to large!\n");
|
||||
exit (1);
|
||||
}
|
||||
h5_int64_t num_blocks = (h5_int64_t)n;
|
||||
n = strtoll (argv[2], &endptr, 10);
|
||||
if (*endptr != 0) {
|
||||
fprintf (stderr, "second argument (sizeof blocks) is not a unsigned integer!\n");
|
||||
exit (1);
|
||||
}
|
||||
if (n < 1024) {
|
||||
fprintf (stderr, "second argument (sizeof block) must be >= 1024!\n");
|
||||
exit (1);
|
||||
}
|
||||
if (n == LLONG_MAX) {
|
||||
fprintf (stderr, "second argument (sizeof block) to large!\n");
|
||||
exit (1);
|
||||
}
|
||||
h5_int64_t num_particles_per_block = (h5_int64_t)n;
|
||||
|
||||
// initialize MPI & H5hut
|
||||
MPI_Init (&argc, &argv);
|
||||
MPI_Comm comm = MPI_COMM_WORLD;
|
||||
int comm_rank = 0;
|
||||
MPI_Comm_rank (comm, &comm_rank);
|
||||
H5AbortOnError ();
|
||||
H5SetVerbosityLevel (h5_verbosity);
|
||||
H5SetDebugMask (h5_debug_mask);
|
||||
|
||||
h5_prop_t prop = H5CreateFileProp ();
|
||||
H5SetPropFileAlign (prop, 1048576*8);
|
||||
H5SetPropFileMPIOIndependent (prop, &comm);
|
||||
//H5SetPropFileMPIOCollective (prop, &comm);
|
||||
|
||||
// open file and create first step
|
||||
h5_file_t file = H5OpenFile (fname, H5_O_WRONLY, prop);
|
||||
//H5PartSetChunkSize (file, 1048576*1);
|
||||
H5SetStep (file, 0);
|
||||
|
||||
/*
|
||||
If we want to write consecutive blocks, the 'view' can be defined
|
||||
with H5PartSetview(). Otherwise we have to define the total number
|
||||
of particles with H5PartSetNumParticles().
|
||||
*/
|
||||
const h5_int64_t offset = comm_rank * num_blocks * num_particles_per_block;
|
||||
H5PartSetView (
|
||||
file,
|
||||
offset,
|
||||
offset + num_blocks*num_particles_per_block -1);
|
||||
dataset_id = H5PartCreateDataSet (file, "data");
|
||||
// write multiple consecutive blocks
|
||||
for (int i = 0; i < num_blocks; i++) {
|
||||
// create fake data
|
||||
//h5_int32_t data[num_particles_per_block];
|
||||
h5_int64_t *data;
|
||||
data = calloc (num_particles_per_block, sizeof(*data));
|
||||
for (int j = 0; j < num_particles_per_block; j++) {
|
||||
data[j] = j + i*num_particles_per_block + offset;
|
||||
}
|
||||
|
||||
// set the "view" to select a subset of the dataset
|
||||
H5PartSetViewOnDataset (
|
||||
file,
|
||||
offset + i*num_particles_per_block,
|
||||
offset + (i+1)*num_particles_per_block - 1);
|
||||
// write data
|
||||
H5PartWriteDatasetInt64 (dataset_id, data);
|
||||
}
|
||||
H5CloseDataset (dataset_id);
|
||||
// done
|
||||
H5CloseFile(file);
|
||||
MPI_Finalize();
|
||||
return 0;
|
||||
}
|
||||
@@ -11,8 +11,11 @@ include 'H5hut.f90'
|
||||
program write_setview
|
||||
use H5hut
|
||||
implicit none
|
||||
include 'mpif.h'
|
||||
|
||||
#if defined(PARALLEL_IO)
|
||||
include 'mpif.h'
|
||||
#endif
|
||||
|
||||
! name of output file
|
||||
character (len=*), parameter :: fname = "example_setview.h5"
|
||||
|
||||
@@ -23,16 +26,19 @@ program write_setview
|
||||
integer*8, parameter :: num_blocks = 4;
|
||||
integer*8, parameter :: num_particles_per_block = 32
|
||||
|
||||
integer :: comm, comm_size, comm_rank, mpi_ierror
|
||||
integer :: comm_rank = 0
|
||||
integer*8 :: file, h5_ierror
|
||||
integer*8 :: i, j, offset
|
||||
integer*4, allocatable :: data(:)
|
||||
|
||||
! initialize MPI & H5hut
|
||||
#if defined(PARALLEL_IO)
|
||||
integer :: comm, mpi_ierror
|
||||
comm = MPI_COMM_WORLD
|
||||
call mpi_init (mpi_ierror)
|
||||
call mpi_comm_size (comm, comm_size, mpi_ierror)
|
||||
call mpi_comm_rank (comm, comm_rank, mpi_ierror)
|
||||
#endif
|
||||
|
||||
call h5_abort_on_error ()
|
||||
call h5_set_verbosity_level (h5_verbosity)
|
||||
|
||||
@@ -61,6 +67,9 @@ program write_setview
|
||||
! cleanup
|
||||
deallocate (data)
|
||||
h5_ierror = h5_closefile (file)
|
||||
call mpi_finalize (mpi_ierror)
|
||||
|
||||
#if defined(PARALLEL_IO)
|
||||
call mpi_finalize (mpi_ierror)
|
||||
#endif
|
||||
|
||||
end program write_setview
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
*/
|
||||
|
||||
#include "H5hut.h"
|
||||
#include "examples.h"
|
||||
|
||||
// name of output file
|
||||
const char* fname = "example_strided.h5";
|
||||
@@ -27,8 +28,6 @@ main (
|
||||
// initialize MPI & H5hut
|
||||
MPI_Init (&argc, &argv);
|
||||
MPI_Comm comm = MPI_COMM_WORLD;
|
||||
int comm_size = 1;
|
||||
MPI_Comm_size (comm, &comm_size);
|
||||
int comm_rank = 0;
|
||||
MPI_Comm_rank (comm, &comm_rank);
|
||||
H5AbortOnError ();
|
||||
|
||||
@@ -11,22 +11,29 @@ include 'H5hut.f90'
|
||||
program write_stridedf
|
||||
use H5hut
|
||||
implicit none
|
||||
include 'mpif.h'
|
||||
|
||||
#if defined(PARALLEL_IO)
|
||||
include 'mpif.h'
|
||||
#endif
|
||||
|
||||
! the file name we want to read
|
||||
character (len=*), parameter :: FNAME = "example_strided.h5"
|
||||
integer*8, parameter :: NPOINTS = 99
|
||||
|
||||
integer :: comm, rank, ierr
|
||||
integer :: rank = 0
|
||||
integer*8 :: file, status
|
||||
integer*4 :: i
|
||||
real*8, allocatable :: particles(:)
|
||||
integer*8, allocatable :: id(:)
|
||||
|
||||
! init MPI & H5hut
|
||||
#if defined(PARALLEL_IO)
|
||||
integer :: comm, ierr
|
||||
comm = MPI_COMM_WORLD
|
||||
call mpi_init(ierr)
|
||||
call mpi_comm_rank(comm, rank, ierr)
|
||||
#endif
|
||||
|
||||
call h5_abort_on_error ()
|
||||
|
||||
! create fake data
|
||||
@@ -66,6 +73,8 @@ program write_stridedf
|
||||
|
||||
deallocate(particles, id)
|
||||
|
||||
#if defined(PARALLEL_IO)
|
||||
call mpi_finalize(ierr)
|
||||
#endif
|
||||
|
||||
end program write_stridedf
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
#ifndef PARALLEL_IO
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,13 @@
|
||||
#ifndef __EXAMPLES_H
|
||||
#define __EXAMPLES_H
|
||||
|
||||
#if !defined (H5_HAVE_PARALLEL)
|
||||
|
||||
#define MPI_COMM_WORLD (0)
|
||||
#define MPI_Init(argc, argv)
|
||||
#define MPI_Comm_size(comm,nprocs) {comm = 0; *nprocs = 1;}
|
||||
#define MPI_Comm_rank(comm,rank) {comm = 0; (void)(comm); *rank = 0;}
|
||||
#define MPI_Finalize()
|
||||
|
||||
#endif
|
||||
#endif
|
||||
+1
-2
@@ -12,8 +12,7 @@ include_HEADERS = \
|
||||
$(top_srcdir)/src/include/H5Part_io.h \
|
||||
$(top_srcdir)/src/include/H5Part_model.h \
|
||||
$(top_srcdir)/src/include/H5_attachments.h \
|
||||
$(top_srcdir)/src/include/H5_debug.h \
|
||||
$(top_srcdir)/src/include/H5_error.h \
|
||||
$(top_srcdir)/src/include/H5_err.h \
|
||||
$(top_srcdir)/src/include/H5_file.h \
|
||||
$(top_srcdir)/src/include/H5_file_attribs.h \
|
||||
$(top_srcdir)/src/include/H5_log.h \
|
||||
|
||||
+7
-9
@@ -9,8 +9,7 @@
|
||||
|
||||
#include "h5_private.h"
|
||||
|
||||
#include "h5core/h5_init.h"
|
||||
#include "h5core/h5_debug.h"
|
||||
#include "h5core/h5_log.h"
|
||||
#include "h5core/h5_file.h"
|
||||
|
||||
#include <hdf5.h>
|
||||
@@ -26,7 +25,7 @@ h5_createprop_file (
|
||||
H5_API_RETURN ((h5_int64_t)h5_create_prop (H5_PROP_FILE));
|
||||
}
|
||||
|
||||
#if defined(PARALLEL_IO)
|
||||
#if defined(H5_HAVE_PARALLEL)
|
||||
#define h5_setprop_file_mpio FC_MANGLING( \
|
||||
h5_setprop_file_mpio, \
|
||||
H5_SETPROP_FILE_MPIO)
|
||||
@@ -166,10 +165,9 @@ h5_openfile (
|
||||
h5_int64_t* _props,
|
||||
const int _len_fname
|
||||
) {
|
||||
int len_fname = strlenf (_fname, _len_fname);
|
||||
H5_API_ENTER (h5_int64_t,
|
||||
"fname = %*s, mode=%lld, props=%lld",
|
||||
len_fname, _fname, (long long int)*_mode, (long long int)*_props);
|
||||
_len_fname, _fname, (long long int)*_mode, (long long int)*_props);
|
||||
char* fname = h5_strdupfor2c (_fname, _len_fname);
|
||||
h5_int64_t mode = *_mode;
|
||||
h5_prop_t props = (h5_prop_t)*_props;
|
||||
@@ -223,7 +221,7 @@ h5_flushstep (
|
||||
) {
|
||||
h5_file_t fh = h5_filehandlefor2c(f);
|
||||
H5_API_ENTER (h5_int64_t, "f=%p", (h5_file_p)fh);
|
||||
H5_API_RETURN (h5_flush_step (fh));
|
||||
H5_API_RETURN (h5_flush_iteration (fh));
|
||||
}
|
||||
|
||||
#define h5_finalize FC_MANGLING( \
|
||||
@@ -234,7 +232,7 @@ h5_finalize (
|
||||
void
|
||||
) {
|
||||
H5_API_ENTER (h5_int64_t, "%s", "");
|
||||
H5_API_RETURN (h5_close_hdf5());
|
||||
H5_API_RETURN (h5_close_h5hut ());
|
||||
}
|
||||
|
||||
|
||||
@@ -249,7 +247,7 @@ h5_set_verbosity_level (
|
||||
) {
|
||||
|
||||
H5_API_ENTER (h5_int64_t, "level=%lld", (long long)*level);
|
||||
H5_API_RETURN(h5_set_debuglevel (*level));
|
||||
H5_API_RETURN(h5_set_loglevel (*level));
|
||||
}
|
||||
|
||||
#define h5_abort_on_error FC_MANGLING( \
|
||||
@@ -260,7 +258,7 @@ h5_abort_on_error (
|
||||
void
|
||||
) {
|
||||
H5_API_ENTER (h5_int64_t, "%s", "");
|
||||
h5_set_debuglevel (1);
|
||||
h5_set_loglevel (1);
|
||||
H5_API_RETURN (h5_set_errorhandler (h5_abort_errorhandler));
|
||||
}
|
||||
|
||||
|
||||
@@ -8,14 +8,9 @@
|
||||
*/
|
||||
|
||||
#include "h5_private.h"
|
||||
#include "h5core/h5_debug.h"
|
||||
#include "h5core/h5_log.h"
|
||||
#include "h5core/h5b_attribs.h"
|
||||
|
||||
#define H5_R8_T H5_FLOAT64_T
|
||||
#define H5_R4_T H5_FLOAT32_T
|
||||
#define H5_I8_T H5_INT64_T
|
||||
#define H5_I4_T H5_INT32_T
|
||||
|
||||
/*
|
||||
__ _ _ _ ___ _ __ _ _
|
||||
/ _` | | | |/ _ \ '__| | | |
|
||||
@@ -231,7 +226,7 @@ h5bl_writefieldattrib_r8 (
|
||||
f,
|
||||
field_name, l_field_name,
|
||||
attrib_name, l_attrib_name,
|
||||
H5_R8_T,
|
||||
H5_FLOAT64_T,
|
||||
attrib_value, *attrib_nelems));
|
||||
}
|
||||
|
||||
@@ -259,7 +254,7 @@ h5bl_readfieldattrib_r8 (
|
||||
f,
|
||||
field_name, l_field_name,
|
||||
attrib_name, l_attrib_name,
|
||||
H5_R8_T,
|
||||
H5_FLOAT64_T,
|
||||
attrib_value));
|
||||
}
|
||||
|
||||
@@ -288,7 +283,7 @@ h5bl_writefieldattrib_r4 (
|
||||
f,
|
||||
field_name, l_field_name,
|
||||
attrib_name, l_attrib_name,
|
||||
H5_R4_T,
|
||||
H5_FLOAT32_T,
|
||||
attrib_value, *attrib_nelems));
|
||||
}
|
||||
|
||||
@@ -316,7 +311,7 @@ h5bl_readfieldattrib_r4 (
|
||||
f,
|
||||
field_name, l_field_name,
|
||||
attrib_name, l_attrib_name,
|
||||
H5_R4_T,
|
||||
H5_FLOAT32_T,
|
||||
attrib_value));
|
||||
}
|
||||
|
||||
@@ -353,7 +348,7 @@ h5bl_writefieldattrib_i8 (
|
||||
f,
|
||||
field_name, l_field_name,
|
||||
attrib_name, l_attrib_name,
|
||||
H5_I8_T,
|
||||
H5_INT64_T,
|
||||
attrib_value, *attrib_nelems));
|
||||
}
|
||||
|
||||
@@ -382,7 +377,7 @@ h5bl_readfieldattrib_i8 (
|
||||
f,
|
||||
field_name, l_field_name,
|
||||
attrib_name, l_attrib_name,
|
||||
H5_I8_T,
|
||||
H5_INT64_T,
|
||||
attrib_value));
|
||||
}
|
||||
|
||||
@@ -411,7 +406,7 @@ h5bl_writefieldattrib_i4 (
|
||||
f,
|
||||
field_name, l_field_name,
|
||||
attrib_name, l_attrib_name,
|
||||
H5_I4_T,
|
||||
H5_INT32_T,
|
||||
attrib_value, *attrib_nelems));
|
||||
}
|
||||
|
||||
@@ -439,7 +434,7 @@ h5bl_readfieldattrib_i4 (
|
||||
f,
|
||||
field_name, l_field_name,
|
||||
attrib_name, l_attrib_name,
|
||||
H5_I4_T,
|
||||
H5_INT32_T,
|
||||
attrib_value));
|
||||
}
|
||||
|
||||
@@ -470,7 +465,7 @@ h5bl_get_fieldorigin (
|
||||
f,
|
||||
field_name, l_field_name,
|
||||
H5BLOCK_FIELD_ORIGIN_NAME, sizeof (H5BLOCK_FIELD_ORIGIN_NAME),
|
||||
H5_R8_T,
|
||||
H5_FLOAT64_T,
|
||||
origin));
|
||||
*x_origin = origin[0];
|
||||
*y_origin = origin[1];
|
||||
@@ -506,7 +501,7 @@ h5bl_set_fieldorigin (
|
||||
f,
|
||||
field_name, l_field_name,
|
||||
H5BLOCK_FIELD_ORIGIN_NAME, sizeof (H5BLOCK_FIELD_ORIGIN_NAME),
|
||||
H5_R8_T,
|
||||
H5_FLOAT64_T,
|
||||
origin, 3));
|
||||
|
||||
H5_API_RETURN (H5_SUCCESS);
|
||||
@@ -539,7 +534,7 @@ h5bl_get_fieldspacing (
|
||||
f,
|
||||
field_name, l_field_name,
|
||||
H5BLOCK_FIELD_ORIGIN_NAME, sizeof (H5BLOCK_FIELD_ORIGIN_NAME),
|
||||
H5_R8_T,
|
||||
H5_FLOAT64_T,
|
||||
spacing));
|
||||
*x_spacing = spacing[0];
|
||||
*y_spacing = spacing[1];
|
||||
@@ -575,7 +570,7 @@ h5bl_set_fieldspacing (
|
||||
f,
|
||||
field_name, l_field_name,
|
||||
H5BLOCK_FIELD_ORIGIN_NAME, sizeof (H5BLOCK_FIELD_SPACING_NAME),
|
||||
H5_R8_T,
|
||||
H5_FLOAT64_T,
|
||||
spacing));
|
||||
|
||||
H5_API_RETURN (H5_SUCCESS);
|
||||
|
||||
+17
-17
@@ -8,7 +8,7 @@
|
||||
*/
|
||||
|
||||
#include "h5_private.h"
|
||||
#include "h5core/h5_debug.h"
|
||||
#include "h5core/h5_log.h"
|
||||
#include "h5core/h5b_io.h"
|
||||
|
||||
#define h5bl_3d_write_scalar_field_r8 FC_MANGLING ( \
|
||||
@@ -27,7 +27,7 @@ h5bl_3d_write_scalar_field_r8 (
|
||||
(h5_file_p)f, l_name, name, buffer);
|
||||
char *name2 = h5_strdupfor2c ( name, l_name );
|
||||
h5_err_t herr = h5b_write_scalar_data (
|
||||
f, name2, (void*)buffer, H5T_NATIVE_DOUBLE );
|
||||
f, name2, (void*)buffer, H5_FLOAT64_T );
|
||||
free ( name2 );
|
||||
H5_API_RETURN(herr);
|
||||
}
|
||||
@@ -48,7 +48,7 @@ h5bl_3d_read_scalar_field_r8 (
|
||||
(h5_file_p)f, name, buffer, l_name);
|
||||
char *name2 = h5_strdupfor2c ( name, l_name );
|
||||
h5_err_t herr = h5b_read_scalar_data (
|
||||
f, name2, buffer, H5T_NATIVE_DOUBLE );
|
||||
f, name2, buffer, H5_FLOAT64_T );
|
||||
free ( name2 );
|
||||
H5_API_RETURN(herr);
|
||||
}
|
||||
@@ -72,7 +72,7 @@ h5bl_3d_write_vector3d_field_r8 (
|
||||
char *name2 = h5_strdupfor2c ( name, l_name );
|
||||
h5_err_t herr = h5b_write_vector3d_data (
|
||||
f, name2,
|
||||
(void*)x_buf, (void*)y_buf, (void*)z_buf, H5T_NATIVE_DOUBLE );
|
||||
(void*)x_buf, (void*)y_buf, (void*)z_buf, H5_FLOAT64_T );
|
||||
free ( name2 );
|
||||
H5_API_RETURN(herr);
|
||||
}
|
||||
@@ -96,7 +96,7 @@ h5bl_3d_read_vector3d_field_r8 (
|
||||
char *name2 = h5_strdupfor2c ( name, l_name );
|
||||
h5_err_t herr = h5b_read_vector3d_data (
|
||||
f, name2,
|
||||
(void*)x_buf, (void*)y_buf, (void*)z_buf, H5T_NATIVE_DOUBLE );
|
||||
(void*)x_buf, (void*)y_buf, (void*)z_buf, H5_FLOAT64_T );
|
||||
free ( name2 );
|
||||
H5_API_RETURN(herr);
|
||||
}
|
||||
@@ -117,7 +117,7 @@ h5bl_3d_write_scalar_field_r4 (
|
||||
(h5_file_p)f, name, buffer, l_name);
|
||||
char *name2 = h5_strdupfor2c ( name, l_name );
|
||||
h5_err_t herr = h5b_write_scalar_data (
|
||||
f, name2, (void*)buffer, H5T_NATIVE_FLOAT );
|
||||
f, name2, (void*)buffer, H5_FLOAT32_T );
|
||||
free ( name2 );
|
||||
H5_API_RETURN(herr);
|
||||
}
|
||||
@@ -138,7 +138,7 @@ h5bl_3d_read_scalar_field_r4 (
|
||||
(h5_file_p)f, name, buffer, l_name);
|
||||
char *name2 = h5_strdupfor2c ( name, l_name );
|
||||
h5_err_t herr = h5b_read_scalar_data (
|
||||
f, name2, buffer, H5T_NATIVE_FLOAT );
|
||||
f, name2, buffer, H5_FLOAT32_T );
|
||||
free ( name2 );
|
||||
H5_API_RETURN(herr);
|
||||
}
|
||||
@@ -162,7 +162,7 @@ h5bl_3d_write_vector3d_field_r4 (
|
||||
char *name2 = h5_strdupfor2c ( name, l_name );
|
||||
h5_err_t herr = h5b_write_vector3d_data (
|
||||
f, name2,
|
||||
(void*)x_buf, (void*)y_buf, (void*)z_buf, H5T_NATIVE_FLOAT );
|
||||
(void*)x_buf, (void*)y_buf, (void*)z_buf, H5_FLOAT32_T );
|
||||
free ( name2 );
|
||||
H5_API_RETURN(herr);
|
||||
}
|
||||
@@ -186,7 +186,7 @@ h5bl_3d_read_vector3d_field_r4 (
|
||||
char *name2 = h5_strdupfor2c ( name, l_name );
|
||||
h5_err_t herr = h5b_read_vector3d_data (
|
||||
f, name2,
|
||||
(void*)x_buf, (void*)y_buf, (void*)z_buf, H5T_NATIVE_FLOAT );
|
||||
(void*)x_buf, (void*)y_buf, (void*)z_buf, H5_FLOAT32_T );
|
||||
free ( name2 );
|
||||
H5_API_RETURN (herr);
|
||||
}
|
||||
@@ -207,7 +207,7 @@ h5bl_3d_write_scalar_field_i8 (
|
||||
(h5_file_p)f, name, buffer, l_name);
|
||||
char *name2 = h5_strdupfor2c ( name, l_name );
|
||||
h5_err_t herr = h5b_write_scalar_data (
|
||||
f, name2, (void*)buffer, H5T_NATIVE_INT64 );
|
||||
f, name2, (void*)buffer, H5_INT64_T );
|
||||
free ( name2 );
|
||||
H5_API_RETURN (herr);
|
||||
}
|
||||
@@ -228,7 +228,7 @@ h5bl_3d_read_scalar_field_i8 (
|
||||
(h5_file_p)f, name, buffer, l_name);
|
||||
char *name2 = h5_strdupfor2c ( name, l_name );
|
||||
h5_err_t herr = h5b_read_scalar_data (
|
||||
f, name2, buffer, H5T_NATIVE_INT64 );
|
||||
f, name2, buffer, H5_INT64_T );
|
||||
free (name2);
|
||||
H5_API_RETURN (herr);
|
||||
}
|
||||
@@ -252,7 +252,7 @@ h5bl_3d_write_vector3d_field_i8 (
|
||||
char *name2 = h5_strdupfor2c ( name, l_name );
|
||||
h5_err_t herr = h5b_write_vector3d_data (
|
||||
f, name2,
|
||||
(void*)x_buf, (void*)y_buf, (void*)z_buf, H5T_NATIVE_INT64 );
|
||||
(void*)x_buf, (void*)y_buf, (void*)z_buf, H5_INT64_T );
|
||||
free ( name2 );
|
||||
H5_API_RETURN(herr);
|
||||
}
|
||||
@@ -276,7 +276,7 @@ h5bl_3d_read_vector3d_field_i8 (
|
||||
char *name2 = h5_strdupfor2c ( name, l_name );
|
||||
h5_err_t herr = h5b_read_vector3d_data (
|
||||
f, name2,
|
||||
(void*)x_buf, (void*)y_buf, (void*)z_buf, H5T_NATIVE_INT64 );
|
||||
(void*)x_buf, (void*)y_buf, (void*)z_buf, H5_INT64_T );
|
||||
free ( name2 );
|
||||
H5_API_RETURN(herr);
|
||||
}
|
||||
@@ -297,7 +297,7 @@ h5bl_3d_write_scalar_field_i4 (
|
||||
(h5_file_p)f, name, buffer, l_name);
|
||||
char *name2 = h5_strdupfor2c ( name, l_name );
|
||||
h5_err_t herr = h5b_write_scalar_data (
|
||||
f, name2, (void*)buffer, H5T_NATIVE_INT32 );
|
||||
f, name2, (void*)buffer, H5_INT32_T );
|
||||
free ( name2 );
|
||||
H5_API_RETURN(herr);
|
||||
}
|
||||
@@ -318,7 +318,7 @@ h5bl_3d_read_scalar_field_i4 (
|
||||
(h5_file_p)f, name, buffer, l_name);
|
||||
char *name2 = h5_strdupfor2c ( name, l_name );
|
||||
h5_err_t herr = h5b_read_scalar_data (
|
||||
f, name2, buffer, H5T_NATIVE_INT32 );
|
||||
f, name2, buffer, H5_INT32_T );
|
||||
free ( name2 );
|
||||
H5_API_RETURN(herr);
|
||||
}
|
||||
@@ -342,7 +342,7 @@ h5bl_3d_write_vector3d_field_i4 (
|
||||
char *name2 = h5_strdupfor2c ( name, l_name );
|
||||
h5_err_t herr = h5b_write_vector3d_data (
|
||||
f, name2,
|
||||
(void*)x_buf, (void*)y_buf, (void*)z_buf, H5T_NATIVE_INT32 );
|
||||
(void*)x_buf, (void*)y_buf, (void*)z_buf, H5_INT32_T );
|
||||
free ( name2 );
|
||||
H5_API_RETURN(herr);
|
||||
}
|
||||
@@ -366,7 +366,7 @@ h5bl_3d_read_vector3d_field_i4 (
|
||||
char *name2 = h5_strdupfor2c ( name, l_name );
|
||||
h5_err_t herr = h5b_read_vector3d_data (
|
||||
f, name2,
|
||||
(void*)x_buf, (void*)y_buf, (void*)z_buf, H5T_NATIVE_INT32 );
|
||||
(void*)x_buf, (void*)y_buf, (void*)z_buf, H5_INT32_T );
|
||||
free ( name2 );
|
||||
H5_API_RETURN(herr);
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*/
|
||||
|
||||
#include "h5_private.h"
|
||||
#include "h5core/h5_debug.h"
|
||||
#include "h5core/h5_log.h"
|
||||
#include "h5core/h5b_model.h"
|
||||
#include "h5core/h5b_io.h"
|
||||
|
||||
@@ -188,7 +188,7 @@ h5bl_3d_getchunk (
|
||||
}
|
||||
|
||||
|
||||
#ifdef PARALLEL_IO
|
||||
#if defined(H5_HAVE_PARALLEL)
|
||||
#define h5bl_3d_setgrid FC_MANGLING ( \
|
||||
h5bl_3d_setgrid, \
|
||||
h5bl_3d_setgrid)
|
||||
|
||||
+17
-17
@@ -8,7 +8,7 @@
|
||||
*/
|
||||
|
||||
#include "h5_private.h"
|
||||
#include "h5core/h5_debug.h"
|
||||
#include "h5core/h5_log.h"
|
||||
|
||||
#include "h5core/h5u_io.h"
|
||||
|
||||
@@ -28,8 +28,8 @@ h5pt_writedata_r8 (
|
||||
"fh=%p, name='%s', data=%p, l_name=%d",
|
||||
(h5_file_p)f, name, data, l_name);
|
||||
char *name2 = h5_strdupfor2c ( name, l_name );
|
||||
h5_int64_t herr = h5u_write_data (
|
||||
f, name2, (void*)data, H5T_NATIVE_DOUBLE );
|
||||
h5_int64_t herr = h5u_write_dataset (
|
||||
f, name2, (void*)data, H5_FLOAT64_T );
|
||||
free ( name2 );
|
||||
H5_API_RETURN(herr);
|
||||
}
|
||||
@@ -49,8 +49,8 @@ h5pt_writedata_r4 (
|
||||
"fh=%p, name='%s', data=%p, l_name=%d",
|
||||
(h5_file_p)f, name, data, l_name);
|
||||
char *name2 = h5_strdupfor2c ( name, l_name );
|
||||
h5_int64_t herr = h5u_write_data (
|
||||
f, name2, (void*)data, H5T_NATIVE_FLOAT );
|
||||
h5_int64_t herr = h5u_write_dataset (
|
||||
f, name2, (void*)data, H5_FLOAT32_T );
|
||||
free ( name2 );
|
||||
H5_API_RETURN(herr);
|
||||
}
|
||||
@@ -70,8 +70,8 @@ h5pt_writedata_i8 (
|
||||
"fh=%p, name='%s', data=%p, l_name=%d",
|
||||
(h5_file_p)f, name, data, l_name);
|
||||
char *name2 = h5_strdupfor2c ( name, l_name );
|
||||
h5_int64_t herr = h5u_write_data (
|
||||
f, name2, (void*)data, H5T_NATIVE_INT64 );
|
||||
h5_int64_t herr = h5u_write_dataset (
|
||||
f, name2, (void*)data, H5_INT64_T );
|
||||
free ( name2 );
|
||||
H5_API_RETURN(herr);
|
||||
}
|
||||
@@ -91,8 +91,8 @@ h5pt_writedata_i4 (
|
||||
"fh=%p, name='%s', data=%p, l_name=%d",
|
||||
(h5_file_p)f, name, data, l_name);
|
||||
char *name2 = h5_strdupfor2c ( name, l_name );
|
||||
h5_int64_t herr = h5u_write_data (
|
||||
f, name2, (void*)data, H5T_NATIVE_INT32 );
|
||||
h5_int64_t herr = h5u_write_dataset (
|
||||
f, name2, (void*)data, H5_INT32_T );
|
||||
free ( name2 );
|
||||
H5_API_RETURN(herr);
|
||||
}
|
||||
@@ -114,8 +114,8 @@ h5pt_readdata_r8 (
|
||||
"fh=%p, name='%s', data=%p, l_name=%d",
|
||||
(h5_file_p)f, name, data, l_name);
|
||||
char *name2 = h5_strdupfor2c ( name, l_name );
|
||||
h5_int64_t herr = h5u_read_data (
|
||||
f, name2, data, H5T_NATIVE_DOUBLE );
|
||||
h5_int64_t herr = h5u_read_dataset (
|
||||
f, name2, data, H5_FLOAT64_T );
|
||||
free ( name2 );
|
||||
H5_API_RETURN(herr);
|
||||
}
|
||||
@@ -135,8 +135,8 @@ h5pt_readdata_r4 (
|
||||
"fh=%p, name='%s', data=%p, l_name=%d",
|
||||
(h5_file_p)f, name, data, l_name);
|
||||
char *name2 = h5_strdupfor2c ( name, l_name );
|
||||
h5_int64_t herr = h5u_read_data (
|
||||
f, name2, data, H5T_NATIVE_FLOAT );
|
||||
h5_int64_t herr = h5u_read_dataset (
|
||||
f, name2, data, H5_FLOAT32_T );
|
||||
free ( name2 );
|
||||
H5_API_RETURN(herr);
|
||||
}
|
||||
@@ -156,8 +156,8 @@ h5pt_readdata_i8 (
|
||||
"fh=%p, name='%s', data=%p, l_name=%d",
|
||||
(h5_file_p)f, name, data, l_name);
|
||||
char *name2 = h5_strdupfor2c ( name, l_name );
|
||||
h5_int64_t herr = h5u_read_data (
|
||||
f, name2, data, H5T_NATIVE_INT64 );
|
||||
h5_int64_t herr = h5u_read_dataset (
|
||||
f, name2, data, H5_INT64_T );
|
||||
|
||||
free ( name2 );
|
||||
H5_API_RETURN(herr);
|
||||
@@ -178,8 +178,8 @@ h5pt_readdata_i4 (
|
||||
"hf=%p, name='%s', data=%p, l_name=%d",
|
||||
(h5_file_p)f, name, data, l_name);
|
||||
char *name2 = h5_strdupfor2c ( name, l_name );
|
||||
h5_int64_t herr = h5u_read_data (
|
||||
f, name2, data, H5T_NATIVE_INT32 );
|
||||
h5_int64_t herr = h5u_read_dataset (
|
||||
f, name2, data, H5_INT32_T );
|
||||
free ( name2 );
|
||||
H5_API_RETURN(herr);
|
||||
}
|
||||
|
||||
+10
-11
@@ -8,7 +8,7 @@
|
||||
*/
|
||||
|
||||
#include "h5_private.h"
|
||||
#include "h5core/h5_debug.h"
|
||||
#include "h5core/h5_log.h"
|
||||
#include "h5core/h5u_model.h"
|
||||
#include "h5core/h5u_io.h"
|
||||
|
||||
@@ -22,13 +22,13 @@
|
||||
h5_int64_t
|
||||
h5pt_setnpoints (
|
||||
const h5_int64_t* const fh,
|
||||
const h5_int64_t* const npoints
|
||||
const h5_int64_t* const num_items
|
||||
) {
|
||||
h5_file_t f = h5_filehandlefor2c (fh);
|
||||
H5_API_ENTER (h5_int64_t,
|
||||
"fh=%p, npoints=%lld",
|
||||
(h5_file_p)f, (long long)*npoints);
|
||||
H5_API_RETURN (h5u_set_num_points (f, *npoints, 1));
|
||||
(h5_file_p)f, (long long)*num_items);
|
||||
H5_API_RETURN (h5u_set_num_items (f, *num_items, 1));
|
||||
}
|
||||
|
||||
#define h5pt_setnpoints_strided FC_MANGLING ( \
|
||||
@@ -37,14 +37,14 @@ h5pt_setnpoints (
|
||||
h5_int64_t
|
||||
h5pt_setnpoints_strided (
|
||||
const h5_int64_t* const fh,
|
||||
const h5_int64_t* const npoints,
|
||||
const h5_int64_t* const num_items,
|
||||
const h5_int64_t* const stride
|
||||
) {
|
||||
h5_file_t f = h5_filehandlefor2c (fh);
|
||||
H5_API_ENTER (h5_int64_t,
|
||||
"fh=%p, npoints=%lld, stride=%lld",
|
||||
(h5_file_p)f, (long long)*npoints, (long long)*stride);
|
||||
H5_API_RETURN (h5u_set_num_points (f, *npoints, *stride));
|
||||
(h5_file_p)f, (long long)*num_items, (long long)*stride);
|
||||
H5_API_RETURN (h5u_set_num_items (f, *num_items, *stride));
|
||||
}
|
||||
|
||||
|
||||
@@ -172,7 +172,7 @@ h5pt_getnpoints (
|
||||
) {
|
||||
h5_file_t f = h5_filehandlefor2c (fh);
|
||||
H5_API_ENTER (h5_int64_t, "fh=%p", (h5_file_p)f);
|
||||
H5_API_RETURN (h5u_get_num_points (f));
|
||||
H5_API_RETURN (h5u_get_num_items (f));
|
||||
}
|
||||
|
||||
#define h5pt_getdatasetname FC_MANGLING ( \
|
||||
@@ -189,7 +189,7 @@ h5pt_getdatasetname (
|
||||
H5_API_ENTER (h5_int64_t,
|
||||
"fh=%p, index=%lld, name='%s', l_name=%d",
|
||||
(h5_file_p)f, (long long)*index, name, l_name);
|
||||
h5_int64_t herr = h5u_get_dataset_info (
|
||||
h5_int64_t herr = h5u_get_dataset_info_by_idx (
|
||||
f, *index - 1, name, l_name, NULL, NULL );
|
||||
h5_strc2for (name, l_name);
|
||||
H5_API_RETURN (herr);
|
||||
@@ -217,14 +217,13 @@ h5pt_getdatasetinfo (
|
||||
(h5_file_p)f,
|
||||
(long long)*dataset_idx,
|
||||
dataset_name, dataset_type, dataset_nelem);
|
||||
h5_int64_t h5err = h5u_get_dataset_info (
|
||||
h5_int64_t h5err = h5u_get_dataset_info_by_idx (
|
||||
f,
|
||||
*dataset_idx - 1,
|
||||
dataset_name, l_dataset_name,
|
||||
dataset_type,
|
||||
(h5_size_t*)dataset_nelem);
|
||||
h5_strc2for (dataset_name, l_dataset_name);
|
||||
convert_type2for (dataset_type);
|
||||
H5_API_RETURN (h5err);
|
||||
}
|
||||
|
||||
|
||||
+20
-22
@@ -9,7 +9,7 @@
|
||||
|
||||
#include "h5_private.h"
|
||||
|
||||
#include "h5core/h5_debug.h"
|
||||
#include "h5core/h5_log.h"
|
||||
#include "h5core/h5_file_attribs.h"
|
||||
#include "h5core/h5_step_attribs.h"
|
||||
|
||||
@@ -68,7 +68,6 @@ h5_getfileattribinfo (
|
||||
attrib_type,
|
||||
(h5_size_t*)attrib_nelem);
|
||||
h5_strc2for (attrib_name, l_attrib_name);
|
||||
convert_type2for (attrib_type);
|
||||
H5_API_RETURN (h5err);
|
||||
}
|
||||
|
||||
@@ -97,7 +96,6 @@ h5_getfileattribinfo_by_name (
|
||||
name,
|
||||
_type,
|
||||
(h5_size_t*)_nelem);
|
||||
convert_type2for (_type);
|
||||
H5_API_RETURN (h5err);
|
||||
}
|
||||
|
||||
@@ -382,7 +380,7 @@ h5_getnstepattribs (
|
||||
H5_API_ENTER (h5_int64_t,
|
||||
"fh=%p",
|
||||
(h5_file_p)f);
|
||||
H5_API_RETURN (h5_get_num_step_attribs (f));
|
||||
H5_API_RETURN (h5_get_num_iteration_attribs (f));
|
||||
}
|
||||
|
||||
#define h5_getstepattribinfo FC_MANGLING( \
|
||||
@@ -407,14 +405,13 @@ h5_getstepattribinfo (
|
||||
(h5_file_p)f,
|
||||
(long long)*attrib_idx,
|
||||
attrib_name, attrib_type, attrib_nelem);
|
||||
h5_int64_t h5err = h5_get_step_attrib_info_by_idx (
|
||||
h5_int64_t h5err = h5_get_iteration_attrib_info_by_idx (
|
||||
f,
|
||||
*attrib_idx - 1,
|
||||
attrib_name, l_attrib_name,
|
||||
attrib_type,
|
||||
(h5_size_t*)attrib_nelem);
|
||||
h5_strc2for (attrib_name, l_attrib_name);
|
||||
convert_type2for (attrib_type);
|
||||
H5_API_RETURN (h5err);
|
||||
}
|
||||
|
||||
@@ -438,12 +435,11 @@ h5_getstepattribinfo_by_name (
|
||||
(h5_file_p)fh,
|
||||
l_name, _name, _type, _nelem);
|
||||
char* name = h5_strdupfor2c (_name, l_name);
|
||||
h5_int64_t h5err = h5_get_step_attrib_info_by_name (
|
||||
h5_int64_t h5err = h5_get_iteration_attrib_info_by_name (
|
||||
f,
|
||||
name,
|
||||
_type,
|
||||
(h5_size_t*)_nelem);
|
||||
convert_type2for (_type);
|
||||
H5_API_RETURN (h5err);
|
||||
}
|
||||
|
||||
@@ -463,7 +459,7 @@ h5_getstepattribinfo_by_name (
|
||||
*/
|
||||
|
||||
static inline h5_int64_t
|
||||
write_step_attrib (
|
||||
write_iteration_attrib (
|
||||
const h5_file_t fh,
|
||||
const char* name,
|
||||
const int l_name,
|
||||
@@ -472,13 +468,14 @@ write_step_attrib (
|
||||
const hsize_t l_buffer
|
||||
) {
|
||||
char *name2 = h5_strdupfor2c (name, l_name);
|
||||
h5_int64_t herr = h5_write_step_attrib (fh, name2, type, buffer, l_buffer );
|
||||
h5_int64_t herr = h5_write_iteration_attrib (
|
||||
fh, name2, type, buffer, l_buffer );
|
||||
free (name2);
|
||||
return herr;
|
||||
}
|
||||
|
||||
static inline h5_int64_t
|
||||
read_step_attrib (
|
||||
read_iteration_attrib (
|
||||
const h5_file_t fh,
|
||||
const char* name,
|
||||
const int l_name,
|
||||
@@ -486,7 +483,7 @@ read_step_attrib (
|
||||
void* const buffer
|
||||
) {
|
||||
char* name2 = h5_strdupfor2c ( name, l_name );
|
||||
h5_int64_t herr = h5_read_step_attrib (fh, name2, type, buffer);
|
||||
h5_int64_t herr = h5_read_iteration_attrib (fh, name2, type, buffer);
|
||||
free (name2);
|
||||
return herr;
|
||||
}
|
||||
@@ -507,7 +504,7 @@ h5_writestepattrib_string (
|
||||
"f=%p, name='%.*s', buffer='%.*s'",
|
||||
(h5_file_p)f, l_name, name, l_buffer, buffer);
|
||||
char *buffer2 = h5_strdupfor2c (buffer, l_buffer);
|
||||
h5_int64_t herr = write_step_attrib (
|
||||
h5_int64_t herr = write_iteration_attrib (
|
||||
f, name, l_name, H5_STRING_T, buffer2, strlen(buffer2)+1 );
|
||||
free (buffer2);
|
||||
H5_API_RETURN (herr);
|
||||
@@ -528,7 +525,8 @@ h5_readstepattrib_string (
|
||||
H5_API_ENTER (h5_int64_t,
|
||||
"f=%p, name='%.*s', buffer='%.*s'",
|
||||
(h5_file_p)f, l_name, name, l_buffer, buffer);
|
||||
h5_int64_t herr = read_step_attrib (f, name, l_name, H5_STRING_T, buffer);
|
||||
h5_int64_t herr = read_iteration_attrib (
|
||||
f, name, l_name, H5_STRING_T, buffer);
|
||||
h5_strc2for (buffer, l_buffer);
|
||||
H5_API_RETURN (herr);
|
||||
}
|
||||
@@ -548,7 +546,7 @@ h5_writestepattrib_r8 (
|
||||
H5_API_ENTER (h5_int64_t,
|
||||
"f=%p, name='%.*s', buffer=%p, nelem=%lld",
|
||||
(h5_file_p)f, l_name, name, buffer, (long long)*nelem);
|
||||
H5_API_RETURN (write_step_attrib(
|
||||
H5_API_RETURN (write_iteration_attrib(
|
||||
f,
|
||||
name, l_name,
|
||||
H5_FLOAT64_T,
|
||||
@@ -569,7 +567,7 @@ h5_readstepattrib_r8 (
|
||||
H5_API_ENTER (h5_int64_t,
|
||||
"f=%p, name='%.*s', buffer=%p",
|
||||
(h5_file_p)f, l_name, name, buffer);
|
||||
H5_API_RETURN (read_step_attrib(
|
||||
H5_API_RETURN (read_iteration_attrib(
|
||||
f,
|
||||
name, l_name,
|
||||
H5_FLOAT64_T,
|
||||
@@ -591,7 +589,7 @@ h5_writestepattrib_r4 (
|
||||
H5_API_ENTER (h5_int64_t,
|
||||
"f=%p, name='%.*s', buffer=%p, nelem=%lld",
|
||||
(h5_file_p)f, l_name, name, buffer, (long long)*nelem);
|
||||
H5_API_RETURN (write_step_attrib(
|
||||
H5_API_RETURN (write_iteration_attrib(
|
||||
f,
|
||||
name, l_name,
|
||||
H5_FLOAT32_T,
|
||||
@@ -612,7 +610,7 @@ h5_readstepattrib_r4 (
|
||||
H5_API_ENTER (h5_int64_t,
|
||||
"f=%p, name='%.*s', buffer=%p",
|
||||
(h5_file_p)f, l_name, name, buffer);
|
||||
H5_API_RETURN (read_step_attrib(
|
||||
H5_API_RETURN (read_iteration_attrib(
|
||||
f,
|
||||
name, l_name,
|
||||
H5_FLOAT32_T,
|
||||
@@ -634,7 +632,7 @@ h5_writestepattrib_i8 (
|
||||
H5_API_ENTER (h5_int64_t,
|
||||
"f=%p, name='%.*s', buffer=%p, nelem=%lld",
|
||||
(h5_file_p)f, l_name, name, buffer, (long long)*nelem);
|
||||
H5_API_RETURN (write_step_attrib(
|
||||
H5_API_RETURN (write_iteration_attrib(
|
||||
f,
|
||||
name, l_name,
|
||||
H5_INT64_T,
|
||||
@@ -655,7 +653,7 @@ h5_readstepattrib_i8 (
|
||||
H5_API_ENTER (h5_int64_t,
|
||||
"f=%p, name='%.*s', buffer=%p",
|
||||
(h5_file_p)f, l_name, name, buffer);
|
||||
H5_API_RETURN (read_step_attrib(
|
||||
H5_API_RETURN (read_iteration_attrib(
|
||||
f,
|
||||
name, l_name,
|
||||
H5_INT64_T,
|
||||
@@ -677,7 +675,7 @@ h5_writestepattrib_i4 (
|
||||
H5_API_ENTER (h5_int64_t,
|
||||
"f=%p, name='%.*s', buffer=%p, nelem=%lld",
|
||||
(h5_file_p)f, l_name, name, buffer, (long long)*nelem);
|
||||
H5_API_RETURN (write_step_attrib(
|
||||
H5_API_RETURN (write_iteration_attrib(
|
||||
f,
|
||||
name, l_name,
|
||||
H5_INT32_T,
|
||||
@@ -698,7 +696,7 @@ h5_readstepattrib_i4 (
|
||||
H5_API_ENTER (h5_int64_t,
|
||||
"f=%p, name='%.*s', buffer=%p",
|
||||
(h5_file_p)f, l_name, name, buffer);
|
||||
H5_API_RETURN (read_step_attrib(
|
||||
H5_API_RETURN (read_iteration_attrib(
|
||||
f,
|
||||
name, l_name,
|
||||
H5_INT32_T,
|
||||
|
||||
@@ -9,8 +9,7 @@
|
||||
|
||||
#include "h5_private.h"
|
||||
|
||||
#include "h5core/h5_init.h"
|
||||
#include "h5core/h5_debug.h"
|
||||
#include "h5core/h5_log.h"
|
||||
#include "h5core/h5_model.h"
|
||||
|
||||
/* H5hut data model */
|
||||
@@ -29,7 +28,7 @@ h5_hasstep (
|
||||
int,
|
||||
"f=%p, stepno=%lld",
|
||||
(h5_file_p)fh, (long long int)step);
|
||||
H5_API_RETURN (h5_has_step (fh, (*step)-1));
|
||||
H5_API_RETURN (h5_has_iteration (fh, (*step)-1));
|
||||
}
|
||||
|
||||
#define h5_setstep FC_MANGLING( \
|
||||
@@ -42,7 +41,7 @@ h5_setstep (
|
||||
|
||||
h5_file_t fh = h5_filehandlefor2c(f);
|
||||
H5_API_ENTER (h5_int64_t, "f=%p, step=%lld", (h5_file_p)fh, (long long)*step);
|
||||
H5_API_RETURN (h5_set_step (fh, (*step)-1));
|
||||
H5_API_RETURN (h5_set_iteration (fh, (*step)-1));
|
||||
}
|
||||
|
||||
#define h5_getstep FC_MANGLING( \
|
||||
@@ -55,7 +54,7 @@ h5_getstep (
|
||||
|
||||
h5_file_t fh = h5_filehandlefor2c(f);
|
||||
H5_API_ENTER (h5_int64_t, "f=%p", (h5_file_p)fh);
|
||||
H5_API_RETURN (h5_get_step (fh) + 1);
|
||||
H5_API_RETURN (h5_get_iteration (fh) + 1);
|
||||
}
|
||||
|
||||
#define h5_getnsteps FC_MANGLING( \
|
||||
@@ -68,5 +67,5 @@ h5_getnsteps (
|
||||
|
||||
h5_file_t fh = h5_filehandlefor2c(f);
|
||||
H5_API_ENTER (h5_int64_t, "f=%p", (h5_file_p)fh);
|
||||
H5_API_RETURN (h5_get_num_steps (fh));
|
||||
H5_API_RETURN (h5_get_num_iterations (fh));
|
||||
}
|
||||
|
||||
@@ -9,13 +9,12 @@ F90_FILES = \
|
||||
$(top_srcdir)/src/include/H5_model.f90 \
|
||||
$(top_srcdir)/src/include/H5_file_attribs.f90 \
|
||||
$(top_srcdir)/src/include/H5_step_attribs.f90 \
|
||||
$(top_srcdir)/src/include/H5_debug.f90 \
|
||||
$(top_srcdir)/src/include/H5_error.f90 \
|
||||
$(top_srcdir)/src/include/H5_err.f90 \
|
||||
$(top_srcdir)/src/include/H5_log.f90 \
|
||||
$(top_srcdir)/src/include/H5Part_model.f90 \
|
||||
$(top_srcdir)/src/include/H5Part_io.f90 \
|
||||
$(top_srcdir)/src/include/H5Block_model.f90 \
|
||||
$(top_srcdir)/src/include/H5Block_attribs.f90 \
|
||||
$(top_srcdir)/src/include/H5Block_attribs.f90 \
|
||||
$(top_srcdir)/src/include/H5Block_io.f90
|
||||
|
||||
EXTRA_HEADERS =
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (c) 2006-2015, The Regents of the University of California,
|
||||
Copyright (c) 2006-2016, The Regents of the University of California,
|
||||
through Lawrence Berkeley National Laboratory (subject to receipt of any
|
||||
required approvals from the U.S. Dept. of Energy) and the Paul Scherrer
|
||||
Institut (Switzerland). All rights reserved.
|
||||
@@ -13,7 +13,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "h5core/h5_init.h"
|
||||
#include "h5core/h5_types.h"
|
||||
|
||||
#if defined(FC_MANGLING_LOWERCASE_NO_UNDERSCORE)
|
||||
# define FC_MANGLING(a,b) a
|
||||
@@ -31,26 +31,6 @@
|
||||
# error "Unknown Fortran symbol mangling"
|
||||
#endif
|
||||
|
||||
#define convert_type2for(type) \
|
||||
if (*type == H5_STRING_T) { \
|
||||
*type = 1; \
|
||||
} else if (*type == H5_INT16_T) { \
|
||||
*type = 2; \
|
||||
} else if (*type == H5_INT32_T) { \
|
||||
*type = 3; \
|
||||
} else if (*type == H5_INT64_T) { \
|
||||
*type = 4; \
|
||||
} else if (*type == H5_FLOAT32_T) { \
|
||||
*type = 5; \
|
||||
} else if (*type == H5_FLOAT64_T) { \
|
||||
*type = 6; \
|
||||
} else { \
|
||||
H5_API_LEAVE ( \
|
||||
h5_error ( \
|
||||
H5_ERR_H5, \
|
||||
"Unknown attribute type")); \
|
||||
}
|
||||
|
||||
static inline char*
|
||||
h5_strdupfor2c (
|
||||
const char* s,
|
||||
|
||||
+1
-1
@@ -1,2 +1,2 @@
|
||||
|
||||
SUBDIRS = Fortran h5core C include
|
||||
SUBDIRS = Fortran h5core C include Python
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
H5hut.py
|
||||
H5hut_wrap.c
|
||||
+120
-12
@@ -1,6 +1,9 @@
|
||||
%module H5hut
|
||||
%{
|
||||
#define SWIG_FILE_WITH_INIT
|
||||
#if defined(PARALLEL_IO)
|
||||
#include <mpi.h>
|
||||
#endif
|
||||
#include <stdint.h>
|
||||
#include "h5core/h5_types.h"
|
||||
//#include "H5.h"
|
||||
@@ -10,10 +13,100 @@
|
||||
%import <stdint.i>
|
||||
|
||||
%include numpy.i
|
||||
%include cstring.i
|
||||
%include cpointer.i
|
||||
|
||||
%apply unsigned long int { h5_prop_t };
|
||||
%apply unsigned long int { h5_file_t };
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
%typemap(out) h5_err_t H5HasFileAttrib {
|
||||
if($1)
|
||||
$result = (PyObject *)Py_True;
|
||||
else
|
||||
$result = (PyObject *)Py_False;
|
||||
}
|
||||
|
||||
|
||||
%cstring_bounded_output(char* const attrib_name, 256);
|
||||
extern h5_err_t H5GetFileAttribInfo (
|
||||
const h5_file_t,
|
||||
const h5_size_t,
|
||||
char* const attrib_name,
|
||||
const h5_size_t l_attrib_name=256,
|
||||
h5_int64_t *OUTPUT,
|
||||
h5_size_t *OUTPUT);
|
||||
|
||||
extern h5_err_t H5GetFileAttribInfoByName (
|
||||
const h5_file_t,
|
||||
const char* const name,
|
||||
h5_int64_t *OUTPUT, h5_size_t *OUTPUT);
|
||||
|
||||
extern h5_err_t H5GetFileAttribName (
|
||||
const h5_file_t,
|
||||
const h5_id_t,
|
||||
char* const attrib_name,
|
||||
const h5_size_t l_attrib_name=256);
|
||||
|
||||
extern h5_err_t H5ReadFileAttribString (
|
||||
const h5_file_t f,
|
||||
const char* const name,
|
||||
char* const buffer);
|
||||
|
||||
extern h5_err_t H5GetStepAttribInfo (
|
||||
const h5_file_t,
|
||||
const h5_size_t,
|
||||
char* const attrib_name,
|
||||
const h5_size_t l_attrib_name=256,
|
||||
h5_int64_t *OUTPUT,
|
||||
h5_size_t *OUTPUT);
|
||||
|
||||
extern h5_err_t H5GetStepAttribInfoByName (
|
||||
const h5_file_t,
|
||||
const char* const name,
|
||||
h5_int64_t *OUTPUT, h5_size_t *OUTPUT);
|
||||
|
||||
extern h5_err_t H5GetStepAttribName (
|
||||
const h5_file_t,
|
||||
const h5_id_t,
|
||||
char* const attrib_name,
|
||||
const h5_size_t l_attrib_name=256);
|
||||
|
||||
%clear char* const attrib_name;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
%cstring_bounded_output(char* const dataset_name, 256);
|
||||
extern h5_err_t H5PartGetDatasetInfo (
|
||||
const h5_file_t,
|
||||
const h5_id_t,
|
||||
char* const dataset_name, const h5_size_t l_dataset_name=256,
|
||||
h5_int64_t *OUTPUT, h5_size_t *OUTPUT);
|
||||
|
||||
extern h5_err_t H5PartGetDatasetInfoByName (
|
||||
const h5_file_t,
|
||||
const char* const name,
|
||||
h5_int64_t *OUTPUT, h5_size_t *OUTPUT);
|
||||
|
||||
extern h5_err_t H5PartGetDatasetName (
|
||||
const h5_file_t,
|
||||
const h5_id_t,
|
||||
char* const dataset_name,
|
||||
const h5_size_t l_dataset_name=256);
|
||||
%clear char* const dataset_name;
|
||||
|
||||
%typemap(out) h5_err_t H5PartHasDataset {
|
||||
if($1)
|
||||
$result = (PyObject *)Py_True;
|
||||
else
|
||||
$result = (PyObject *)Py_False;
|
||||
}
|
||||
|
||||
%typemap(out) h5_err_t H5PartHasView {
|
||||
if($1)
|
||||
$result = (PyObject *)Py_True;
|
||||
else
|
||||
$result = (PyObject *)Py_False;
|
||||
}
|
||||
|
||||
%apply (unsigned long long* IN_ARRAY1) { h5_size_t* };
|
||||
%apply (unsigned int* IN_ARRAY1) { h5_uint32_t* }; //uint32_t
|
||||
@@ -28,6 +121,20 @@
|
||||
import_array();
|
||||
%}
|
||||
|
||||
#if defined (PARALLEL_IO)
|
||||
%include mpi4py/mpi4py.i
|
||||
%mpi4py_typemap(Comm, MPI_Comm);
|
||||
%typemap(in) MPI_Comm* {
|
||||
MPI_Comm *ptr = (MPI_Comm *)0;
|
||||
int res = SWIG_AsPtr_MPI_Comm($input, &ptr);
|
||||
if (!SWIG_IsOK(res) || !ptr) {
|
||||
SWIG_exception_fail(SWIG_ArgError((ptr ? res : SWIG_TypeError)),
|
||||
"in method '" "$symname" "', argument " "$argnum"" of type '" "MPI_Comm""'");
|
||||
}
|
||||
$1 = ptr;
|
||||
if (SWIG_IsNewObj(res)) free((char*)ptr);
|
||||
}
|
||||
#endif
|
||||
|
||||
%ignore h5_report_errorhandler;
|
||||
%ignore h5_abort_errorhandler;
|
||||
@@ -37,22 +144,23 @@ import_array();
|
||||
%ignore H5AbortErrorhandler;
|
||||
|
||||
%include "h5core/h5_types.h"
|
||||
//%include "H5.h"
|
||||
//%include "H5_attribs.h"
|
||||
|
||||
%include "H5_attachments.h"
|
||||
|
||||
%rename(H5OpenFile) H5OpenFile2 (const char* const, const h5_int64_t, const h5_prop_t);
|
||||
%include "H5_file.h"
|
||||
|
||||
%include "H5_model.h"
|
||||
%include "H5hut.h"
|
||||
%include "H5_file_attribs.h"
|
||||
%include "H5_step_attribs.h"
|
||||
%include "H5_log.h"
|
||||
|
||||
%include "H5Block_attribs.h"
|
||||
//%include "H5Block.h"
|
||||
%include "H5Block_io.h"
|
||||
%include "H5Block_model.h"
|
||||
//%include "H5Part.h"
|
||||
|
||||
%include "H5Part_io.h"
|
||||
%include "H5Part_model.h"
|
||||
//%include "H5Fed_adjacency.h"
|
||||
//%include "H5Fed.h"
|
||||
//%include "H5Fed_model.h"
|
||||
//%include "H5Fed_retrieve.h"
|
||||
//%include "H5Fed_store.h"
|
||||
//%include "H5Fed_tags.h"
|
||||
|
||||
|
||||
%clear h5_size_t*;
|
||||
%clear h5_int64_t*;
|
||||
|
||||
@@ -1,71 +0,0 @@
|
||||
%module H5hut_mpi
|
||||
%{
|
||||
#define SWIG_FILE_WITH_INIT
|
||||
#define PARALLEL_IO 1
|
||||
#include <mpi.h>
|
||||
#include <stdint.h>
|
||||
#include "h5core/h5_types.h"
|
||||
//#include "H5.h"
|
||||
#include "H5hut.h"
|
||||
%}
|
||||
|
||||
%import <stdint.i>
|
||||
|
||||
%include numpy.i
|
||||
|
||||
%apply unsigned long int { h5_prop_t };
|
||||
%apply unsigned long int { h5_file_t };
|
||||
|
||||
|
||||
%apply (unsigned long long* IN_ARRAY1) { h5_size_t* };
|
||||
%apply (unsigned int* IN_ARRAY1) { h5_uint32_t* }; //uint32_t
|
||||
%apply (unsigned long long* IN_ARRAY1) { h5_uint64_t* }; //uint64_t
|
||||
%apply (int* IN_ARRAY1) { h5_int32_t* }; //int32_t
|
||||
%apply (long long* IN_ARRAY1) { h5_int64_t* }; //int64_t
|
||||
%apply (float* IN_ARRAY1) { h5_float32_t* };
|
||||
%apply (double* IN_ARRAY1) { h5_float64_t* };
|
||||
|
||||
|
||||
%init %{
|
||||
import_array();
|
||||
%}
|
||||
|
||||
%include mpi4py/mpi4py.i
|
||||
%mpi4py_typemap(Comm, MPI_Comm);
|
||||
%typemap(in) MPI_Comm* {
|
||||
MPI_Comm *ptr = (MPI_Comm *)0;
|
||||
int res = SWIG_AsPtr_MPI_Comm($input, &ptr);
|
||||
if (!SWIG_IsOK(res) || !ptr) {
|
||||
SWIG_exception_fail(SWIG_ArgError((ptr ? res : SWIG_TypeError)), "in method '" "$symname" "', argument " "$argnum"" of type '" "MPI_Comm""'");
|
||||
}
|
||||
$1 = ptr;
|
||||
if (SWIG_IsNewObj(res)) free((char*)ptr);
|
||||
}
|
||||
|
||||
%ignore h5_report_errorhandler;
|
||||
%ignore h5_abort_errorhandler;
|
||||
%ignore h5priv_vprintf;
|
||||
%ignore h5_verror;
|
||||
%ignore H5ReportErrorhandler;
|
||||
%ignore H5AbortErrorhandler;
|
||||
|
||||
%include "h5core/h5_types.h"
|
||||
//%include "H5.h"
|
||||
//%include "H5_attribs.h"
|
||||
%include "H5_model.h"
|
||||
%include "H5hut.h"
|
||||
%include "H5Block_attribs.h"
|
||||
//%include "H5Block.h"
|
||||
%include "H5Block_io.h"
|
||||
%include "H5Block_model.h"
|
||||
//%include "H5Part.h"
|
||||
%include "H5Part_io.h"
|
||||
%include "H5Part_model.h"
|
||||
//%include "H5Fed_adjacency.h"
|
||||
//%include "H5Fed.h"
|
||||
//%include "H5Fed_model.h"
|
||||
//%include "H5Fed_retrieve.h"
|
||||
//%include "H5Fed_store.h"
|
||||
//%include "H5Fed_tags.h"
|
||||
|
||||
|
||||
+18
-28
@@ -1,24 +1,5 @@
|
||||
|
||||
if ENABLE_PYTHON
|
||||
|
||||
if ENABLE_PARALLEL
|
||||
|
||||
BUILT_SOURCES = H5hut_mpi_wrap.c
|
||||
SWIG_SOURCES = H5hut_mpi.i $(MPI4PY_INCLUDE)/mpi4py/mpi4py.i numpy.i
|
||||
|
||||
pkgpython_PYTHON = H5hut_mpi.py __init__.py
|
||||
pkgpyexec_LTLIBRARIES = _H5hut_mpi.la
|
||||
|
||||
_H5hut_mpi_la_SOURCES = H5hut_mpi_wrap.c $(SWIG_SOURCES)
|
||||
_H5hut_mpi_la_CPPFLAGS = -DPARALLEL_IO $(SWIG_PYTHON_CPPFLAGS) -I$(top_srcdir)/src/include -I$(PYTHON_PREFIX)/include/python$(PYTHON_VERSION)/ -I$(MPI4PY_INCLUDE) -I$(NUMPY_INCLUDE)
|
||||
_H5hut_mpi_la_LDFLAGS = -module
|
||||
_H5hut_mpi_la_LIBADD = $(top_builddir)/src/h5core/libH5hut.la
|
||||
|
||||
H5hut_mpi_wrap.c : $(SWIG_SOURCES)
|
||||
$(SWIG) $(SWIG_PYTHON_OPT) -python -DPARALLEL_IO -I$(top_srcdir)/src/include -I$(MPI4PY_INCLUDE) -o $@ $<
|
||||
|
||||
else
|
||||
|
||||
BUILT_SOURCES = H5hut_wrap.c
|
||||
SWIG_SOURCES = H5hut.i numpy.i
|
||||
|
||||
@@ -26,23 +7,32 @@ pkgpython_PYTHON = H5hut.py __init__.py
|
||||
pkgpyexec_LTLIBRARIES = _H5hut.la
|
||||
|
||||
_H5hut_la_SOURCES = H5hut_wrap.c $(SWIG_SOURCES)
|
||||
_H5hut_la_CPPFLAGS = $(SWIG_PYTHON_CPPFLAGS) -I$(top_srcdir)/src/include -I$(PYTHON_PREFIX)/include/python$(PYTHON_VERSION)/ -I$(NUMPY_INCLUDE)
|
||||
_H5hut_la_LDFLAGS = -module
|
||||
_H5hut_la_LIBADD = $(top_builddir)/src/h5core/libH5hut.la
|
||||
_H5hut_la_LDFLAGS = -module
|
||||
_H5hut_la_LIBADD = $(top_builddir)/src/h5core/libH5hut.la
|
||||
_H5hut_la_CPPFLAGS = $(SWIG_PYTHON_CPPFLAGS)
|
||||
_H5hut_la_CPPFLAGS += -I$(top_srcdir)/src/include
|
||||
_H5hut_la_CPPFLAGS += -I$(PYTHON_PREFIX)/include/python$(PYTHON_VERSION)/
|
||||
_H5hut_la_CPPFLAGS += -I$(NUMPY_INCLUDE)
|
||||
|
||||
if ENABLE_PARALLEL
|
||||
|
||||
_H5hut_la_CPPFLAGS += -DPARALLEL_IO -I$(MPI4PY_INCLUDE)
|
||||
|
||||
H5hut_wrap.c : $(SWIG_SOURCES)
|
||||
$(SWIG) $(SWIG_PYTHON_OPT) -python -I$(top_srcdir)/src/include -DPARALLEL_IO -I$(MPI4PY_INCLUDE) -o $@ $<
|
||||
|
||||
else
|
||||
|
||||
H5hut_wrap.c : $(SWIG_SOURCES)
|
||||
$(SWIG) $(SWIG_PYTHON_OPT) -python -I$(top_srcdir)/src/include -o $@ $<
|
||||
|
||||
|
||||
endif
|
||||
|
||||
#all-local:
|
||||
# $(INSTALL) -d $(DESTDIR)/site-packages/h5hut
|
||||
# $(INSTALL) -m644 H5hut.py $(DESTDIR)/site-packages/h5hut/
|
||||
# $(INSTALL) -m644 .libs/_H5hut.so $(DESTDIR)/site-packages/h5hut/
|
||||
else
|
||||
$(info Python is disabled)
|
||||
endif
|
||||
|
||||
clean: clean-am
|
||||
|
||||
clean-local:
|
||||
$(RM) -f *~ H5hut_wrap.c H5hut.py H5hut.pyc H5hut_mpi_wrap.c H5hut_mpi.py H5hut_mpi.pyc
|
||||
$(RM) -f *~ H5hut_wrap.c H5hut.py *.pyc
|
||||
|
||||
+47
-22
@@ -1,29 +1,54 @@
|
||||
#TODO: use the rewrite to swap depending whether mpi is there are not..
|
||||
|
||||
import numpy
|
||||
import sys
|
||||
|
||||
try:
|
||||
import H5hut_mpi as H5hut_rewrite
|
||||
from H5hut_mpi import *
|
||||
except:
|
||||
import H5hut as H5hut_rewrite
|
||||
from H5hut import *
|
||||
import H5hut as H5hut_rewrite
|
||||
from H5hut import *
|
||||
|
||||
|
||||
__h5hut_table__ = {}
|
||||
|
||||
# for now assume last parameter is the data field..
|
||||
#
|
||||
# Rewrite functions for reading and writing datasets and attributes for
|
||||
# the types
|
||||
# - Int32
|
||||
# - Int64
|
||||
# - Float32
|
||||
# - Float64
|
||||
#
|
||||
# These functions have either three or four arguments:
|
||||
# - functions to read or write a dataset have three arguments
|
||||
# - functions to read an attribute have three arguments
|
||||
# - functions to write an attribute have four attributes (except the functions
|
||||
# to write a string attribute, which are not handled here)
|
||||
#
|
||||
# The third arguments is an array in all cases.
|
||||
#
|
||||
funcx = """
|
||||
def {0}(*args, **kwargs):
|
||||
import numpy
|
||||
if type(args[-1]) is numpy.ndarray:
|
||||
#print "writing type", args[-1].dtype
|
||||
__h5hut_table__['{0}'][args[-1].dtype](*args, **kwargs)
|
||||
elif ((type(args[-1]) is list or type(args[-1]) is tuple) and len(args[-1]) > 0):
|
||||
#print "writing type", type(args[-1][0]).dtype
|
||||
__h5hut_table__['{0}'][numpy.dtype(type(args[-1][0]))](*args, **kwargs)
|
||||
import numpy
|
||||
if not len(args) == 3:
|
||||
print 'wrong number of arguments'
|
||||
return -2
|
||||
|
||||
if type (args[2]) is numpy.ndarray:
|
||||
dtype = args[2].dtype
|
||||
size = args[2].size
|
||||
elif isinstance (args[2], (numpy.str)):
|
||||
dtype = numpy.str
|
||||
size = len (args[2])
|
||||
elif isinstance (args[2], (list, tuple)):
|
||||
dtype = numpy.dtype (type(args[2][0]))
|
||||
size = len (args[2])
|
||||
else:
|
||||
print 'last argument is not a numpy data array'
|
||||
print 'third argument must be an array'
|
||||
return -2
|
||||
|
||||
if 'Attrib' in '{0}' and 'Write' in '{0}' and not dtype == type(''):
|
||||
return __h5hut_table__['{0}'][dtype] (args[0], args[1], args[2], size, **kwargs)
|
||||
else:
|
||||
return __h5hut_table__['{0}'][dtype](*args, **kwargs)
|
||||
"""
|
||||
|
||||
def __update_types__():
|
||||
@@ -33,12 +58,17 @@ def __update_types__():
|
||||
|
||||
__h5hut_api__ = dir(H5hut_rewrite)
|
||||
|
||||
__h5hut_types__ = [ "Int32", "Int64", "Float32", "Float64" ]
|
||||
__h5hut_types__ = [ "Int32", "Int64", "Float32", "Float64", "String" ]
|
||||
__numpy_types__ = [ numpy.dtype(numpy.int32),
|
||||
numpy.dtype(numpy.int64),
|
||||
numpy.dtype(numpy.float32),
|
||||
numpy.dtype(numpy.float64) ]
|
||||
numpy.dtype(numpy.float64),
|
||||
numpy.str]
|
||||
|
||||
#
|
||||
# loop over all H5hut C-functions and above types.
|
||||
# Replace function if type is in name.
|
||||
#
|
||||
for __i__ in __h5hut_api__:
|
||||
for __j__ in __h5hut_types__:
|
||||
if __j__ in __i__:
|
||||
@@ -66,8 +96,3 @@ def __update_types__():
|
||||
sys.modules["H5hut"].__dict__[__new_func__] = locals()[__new_func__]
|
||||
|
||||
__update_types__()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
+10
-8
@@ -3,6 +3,8 @@ AUTOMAKE_OPTIONS = subdir-objects
|
||||
AM_CPPFLAGS = -I$(top_srcdir)/src/include @AM_CPPFLAGS@
|
||||
|
||||
EXTRA_HEADERS = \
|
||||
private/h5_const.h \
|
||||
private/h5_file.h \
|
||||
private/h5_hdf5.h \
|
||||
private/h5_hsearch.h \
|
||||
private/h5_init.h \
|
||||
@@ -10,7 +12,6 @@ EXTRA_HEADERS = \
|
||||
private/h5_maps.h \
|
||||
private/h5_model.h \
|
||||
private/h5_mpi.h \
|
||||
private/h5.h \
|
||||
private/h5_qsort.h \
|
||||
private/h5_io.h \
|
||||
private/h5_types.h \
|
||||
@@ -21,7 +22,7 @@ EXTRA_HEADERS = \
|
||||
private/h5t_access.h \
|
||||
private/h5t_adjacencies.h \
|
||||
private/h5t_core.h \
|
||||
private/h5t_errorhandling.h \
|
||||
private/h5t_err.h \
|
||||
private/h5t_map.h \
|
||||
private/h5t_model.h \
|
||||
private/h5t_octree.h \
|
||||
@@ -34,8 +35,8 @@ EXTRA_HEADERS = \
|
||||
private/h5u_io.h \
|
||||
private/h5u_types.h \
|
||||
private/h5_attribs.h \
|
||||
private/h5_debug.h \
|
||||
private/h5_errorhandling.h \
|
||||
private/h5_log.h \
|
||||
private/h5_err.h \
|
||||
private/h5_fcmp.h
|
||||
|
||||
# Extra files that I wish to include in the dist tar ball.
|
||||
@@ -48,17 +49,18 @@ lib_LTLIBRARIES = libH5hut.la
|
||||
libH5hut_la_SOURCES = \
|
||||
h5_attachments.c \
|
||||
h5_attribs.c \
|
||||
h5_debug.c \
|
||||
h5_errorhandling.c \
|
||||
h5_init.c \
|
||||
h5_model.c \
|
||||
h5_err.c \
|
||||
h5_log.c \
|
||||
h5_file.c \
|
||||
h5_model.c \
|
||||
h5_syscall.c \
|
||||
h5u_io.c \
|
||||
h5b_io.c \
|
||||
h5u_model.c \
|
||||
h5b_model.c \
|
||||
h5b_attribs.c \
|
||||
private/h5_hdf5.c \
|
||||
h5_init.c \
|
||||
private/h5_hsearch.c \
|
||||
private/h5_maps.c \
|
||||
private/h5_fcmp.c \
|
||||
|
||||
+63
-63
@@ -7,15 +7,16 @@
|
||||
License: see file COPYING in top level of source distribution.
|
||||
*/
|
||||
|
||||
#include "h5core/h5_init.h"
|
||||
#include "private/h5_types.h"
|
||||
|
||||
#include "private/h5_errorhandling.h"
|
||||
#include "private/h5_err.h"
|
||||
#include "private/h5_hdf5.h"
|
||||
#include "private/h5_model.h"
|
||||
#include "h5core/h5_syscall.h"
|
||||
#include "private/h5_va_macros.h"
|
||||
|
||||
#include "h5core/h5_file.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
@@ -29,19 +30,15 @@ h5_add_attachment (
|
||||
) {
|
||||
h5_file_p f = (h5_file_p)f_;
|
||||
H5_CORE_API_ENTER (h5_err_t, "f=%p, fname='%s'", f, fname);
|
||||
// allowed file modes: O_RDWR, O_WRONLY; O_APPEND
|
||||
if (f->props->flags & H5_O_RDONLY) {
|
||||
H5_PRIV_FUNC_LEAVE (
|
||||
h5priv_handle_file_mode_error (f->props->flags));
|
||||
}
|
||||
CHECK_FILEHANDLE (f);
|
||||
CHECK_WRITABLE_MODE (f);
|
||||
|
||||
struct stat st;
|
||||
if (stat (fname, &st) < 0) {
|
||||
H5_CORE_API_LEAVE (
|
||||
h5_error (
|
||||
H5_ERR_HDF5,
|
||||
"Cannot stat file '%s'",
|
||||
fname));
|
||||
H5_RETURN_ERROR (
|
||||
H5_ERR_HDF5,
|
||||
"Cannot stat file '%s'",
|
||||
fname);
|
||||
}
|
||||
hsize_t fsize = st.st_size;
|
||||
hsize_t write_length;
|
||||
@@ -51,30 +48,27 @@ h5_add_attachment (
|
||||
write_length = fsize;
|
||||
int fd;
|
||||
if ((fd = open (fname, O_RDONLY)) < 0) {
|
||||
H5_CORE_API_LEAVE (
|
||||
h5_error (
|
||||
H5_ERR_HDF5,
|
||||
"Cannot open file '%s' for reading",
|
||||
fname));
|
||||
H5_RETURN_ERROR (
|
||||
H5_ERR_HDF5,
|
||||
"Cannot open file '%s' for reading",
|
||||
fname);
|
||||
}
|
||||
again:
|
||||
if (read (fd, buf, fsize) < 0) {
|
||||
if (errno == EINTR) {
|
||||
goto again;
|
||||
} else {
|
||||
H5_CORE_API_LEAVE (
|
||||
h5_error (
|
||||
H5_ERR_HDF5,
|
||||
"Cannot read file '%s'",
|
||||
fname));
|
||||
H5_RETURN_ERROR (
|
||||
H5_ERR_HDF5,
|
||||
"Cannot read file '%s'",
|
||||
fname);
|
||||
}
|
||||
}
|
||||
if (close (fd) < 0) {
|
||||
H5_CORE_API_LEAVE (
|
||||
h5_error (
|
||||
H5_ERR_HDF5,
|
||||
"Cannot close file '%s'",
|
||||
fname));
|
||||
H5_RETURN_ERROR (
|
||||
H5_ERR_HDF5,
|
||||
"Cannot close file '%s'",
|
||||
fname);
|
||||
}
|
||||
|
||||
} else {
|
||||
@@ -83,11 +77,11 @@ h5_add_attachment (
|
||||
}
|
||||
|
||||
hid_t loc_id;
|
||||
TRY (loc_id = h5priv_open_group (1, f->file, H5_ATTACHMENT));
|
||||
TRY (loc_id = h5priv_create_group (f->file, H5_ATTACHMENT));
|
||||
h5_err_t exists;
|
||||
TRY (exists = hdf5_link_exists (loc_id, fname));
|
||||
if (exists && (f->props->flags & H5_O_APPENDONLY)) {
|
||||
H5_PRIV_FUNC_LEAVE (
|
||||
H5_LEAVE (
|
||||
h5priv_handle_file_mode_error (f->props->flags));
|
||||
}
|
||||
hid_t diskspace_id;
|
||||
@@ -124,7 +118,7 @@ h5_add_attachment (
|
||||
|
||||
TRY (h5_free (buf));
|
||||
|
||||
H5_CORE_API_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
@@ -133,9 +127,9 @@ h5_has_attachments (
|
||||
) {
|
||||
h5_file_p f = (h5_file_p)f_;
|
||||
H5_CORE_API_ENTER (h5_ssize_t, "f=%p", f);
|
||||
h5_err_t exists;
|
||||
TRY (exists = hdf5_link_exists (f->file, H5_ATTACHMENT));
|
||||
H5_CORE_API_RETURN (exists);
|
||||
CHECK_FILEHANDLE (f);
|
||||
TRY (ret_value = hdf5_link_exists (f->file, H5_ATTACHMENT));
|
||||
H5_RETURN (ret_value);
|
||||
}
|
||||
|
||||
h5_ssize_t
|
||||
@@ -144,6 +138,7 @@ h5_get_num_attachments (
|
||||
) {
|
||||
h5_file_p f = (h5_file_p)f_;
|
||||
H5_CORE_API_ENTER (h5_ssize_t, "f=%p", f);
|
||||
CHECK_FILEHANDLE (f);
|
||||
h5_err_t exists;
|
||||
TRY (exists = hdf5_link_exists (f->file, H5_ATTACHMENT));
|
||||
if (exists == 0) {
|
||||
@@ -151,10 +146,9 @@ h5_get_num_attachments (
|
||||
}
|
||||
hid_t group_id;
|
||||
TRY (group_id = hdf5_open_group (f->file, H5_ATTACHMENT));
|
||||
h5_ssize_t num = 0;
|
||||
TRY (num = hdf5_get_num_datasets (group_id));
|
||||
TRY (ret_value = hdf5_get_num_datasets (group_id));
|
||||
TRY (hdf5_close_group (group_id));
|
||||
H5_CORE_API_RETURN (num);
|
||||
H5_RETURN (ret_value);
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
@@ -171,6 +165,7 @@ h5_get_attachment_info_by_idx (
|
||||
f, (unsigned long long)idx,
|
||||
fname, (unsigned long long)len_fname,
|
||||
fsize);
|
||||
CHECK_FILEHANDLE (f);
|
||||
hid_t loc_id;
|
||||
TRY (loc_id = hdf5_open_group (f->file, H5_ATTACHMENT));
|
||||
TRY (hdf5_get_name_of_dataset_by_idx (
|
||||
@@ -185,7 +180,7 @@ h5_get_attachment_info_by_idx (
|
||||
*fsize = ssize;
|
||||
}
|
||||
TRY (hdf5_close_group (loc_id));
|
||||
H5_CORE_API_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
@@ -195,11 +190,11 @@ h5_has_attachment (
|
||||
) {
|
||||
h5_file_p f = (h5_file_p)f_;
|
||||
H5_CORE_API_ENTER (h5_err_t, "f=%p, fname='%s'", f, fname);
|
||||
CHECK_FILEHANDLE (f);
|
||||
hid_t loc_id;
|
||||
TRY (loc_id = hdf5_open_group (f->file, H5_ATTACHMENT));
|
||||
h5_err_t exists;
|
||||
TRY (exists = hdf5_link_exists (f->file, fname));
|
||||
H5_CORE_API_RETURN (exists);
|
||||
TRY (ret_value = hdf5_link_exists (f->file, fname));
|
||||
H5_RETURN (ret_value);
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
@@ -210,7 +205,8 @@ h5_get_attachment_info_by_name (
|
||||
) {
|
||||
h5_file_p f = (h5_file_p)f_;
|
||||
H5_CORE_API_ENTER (h5_err_t, "f=%p, fname='%s', fsize=%p", f, fname, fsize);
|
||||
|
||||
CHECK_FILEHANDLE (f);
|
||||
|
||||
hid_t loc_id;
|
||||
TRY (loc_id = hdf5_open_group (f->file, H5_ATTACHMENT));
|
||||
if (fsize) {
|
||||
@@ -220,7 +216,7 @@ h5_get_attachment_info_by_name (
|
||||
*fsize = ssize;
|
||||
}
|
||||
TRY (hdf5_close_group (loc_id));
|
||||
H5_CORE_API_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
@@ -230,10 +226,11 @@ h5_get_attachment (
|
||||
) {
|
||||
h5_file_p f = (h5_file_p)f_;
|
||||
H5_CORE_API_ENTER (h5_err_t, "f=%p, fname='%s'", f, fname);
|
||||
CHECK_FILEHANDLE (f);
|
||||
// allowed modes: O_RDWR, O_RDONLY; O_APPEND
|
||||
// forbidden modes: O_WRONLY
|
||||
if (f->props->flags & H5_O_WRONLY) {
|
||||
H5_PRIV_FUNC_LEAVE (
|
||||
H5_LEAVE (
|
||||
h5priv_handle_file_mode_error (f->props->flags));
|
||||
}
|
||||
|
||||
@@ -243,18 +240,18 @@ h5_get_attachment (
|
||||
// read dataset
|
||||
hid_t dataset_id, diskspace_id;
|
||||
h5_ssize_t fsize;
|
||||
TRY (dataset_id = hdf5_open_dataset (loc_id, fname));
|
||||
TRY (dataset_id = hdf5_open_dataset_by_name (loc_id, fname));
|
||||
TRY (diskspace_id = hdf5_get_dataset_space (dataset_id));
|
||||
TRY (fsize = hdf5_get_npoints_of_dataspace (diskspace_id));
|
||||
|
||||
hsize_t read_length;
|
||||
char* buf = NULL;
|
||||
if (f->myproc == 0) {
|
||||
buf = malloc (fsize);
|
||||
buf = h5_calloc (1, fsize);
|
||||
read_length = fsize;
|
||||
|
||||
} else {
|
||||
buf = malloc (1);
|
||||
buf = h5_calloc (1, 1);
|
||||
read_length = 0;
|
||||
}
|
||||
|
||||
@@ -286,30 +283,27 @@ h5_get_attachment (
|
||||
if (f->myproc == 0) {
|
||||
int fd;
|
||||
if ((fd = open (fname, O_WRONLY|O_CREAT|O_TRUNC, 0600)) < 0) {
|
||||
H5_CORE_API_LEAVE (
|
||||
h5_error (
|
||||
H5_ERR_H5,
|
||||
"Error opening file '%s': %s",
|
||||
fname, strerror(errno)));
|
||||
H5_RETURN_ERROR (
|
||||
H5_ERR_H5,
|
||||
"Error opening file '%s': %s",
|
||||
fname, strerror(errno));
|
||||
}
|
||||
if (write (fd, buf, fsize) != fsize) {
|
||||
H5_CORE_API_LEAVE (
|
||||
h5_error (
|
||||
H5_ERR_H5,
|
||||
"Error writing to file '%s': %s",
|
||||
fname, strerror(errno)));
|
||||
H5_RETURN_ERROR (
|
||||
H5_ERR_H5,
|
||||
"Error writing to file '%s': %s",
|
||||
fname, strerror(errno));
|
||||
}
|
||||
if (close (fd) < 0) {
|
||||
H5_CORE_API_LEAVE (
|
||||
h5_error (
|
||||
H5_ERR_H5,
|
||||
"Error closing file '%s': %s",
|
||||
fname, strerror(errno)));
|
||||
H5_RETURN_ERROR (
|
||||
H5_ERR_H5,
|
||||
"Error closing file '%s': %s",
|
||||
fname, strerror(errno));
|
||||
}
|
||||
}
|
||||
TRY (h5_free (buf));
|
||||
|
||||
H5_CORE_API_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
@@ -319,10 +313,16 @@ h5_delete_attachment (
|
||||
) {
|
||||
h5_file_p f = (h5_file_p)f_;
|
||||
H5_CORE_API_ENTER (h5_err_t, "f=%p, fname='%s'", f, fname);
|
||||
CHECK_FILEHANDLE (f);
|
||||
// allowed file modes: O_RDWR, O_WRONLY; O_APPEND
|
||||
if (f->props->flags & H5_O_RDONLY) {
|
||||
H5_LEAVE (
|
||||
h5priv_handle_file_mode_error (f->props->flags));
|
||||
}
|
||||
|
||||
hid_t loc_id;
|
||||
TRY (loc_id = hdf5_open_group (f->file, H5_ATTACHMENT));
|
||||
TRY (hdf5_delete_link (loc_id, fname, H5P_DEFAULT));
|
||||
TRY (hdf5_close_group (loc_id));
|
||||
H5_CORE_API_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
+147
-260
@@ -7,145 +7,13 @@
|
||||
License: see file COPYING in top level of source distribution.
|
||||
*/
|
||||
|
||||
#include "h5core/h5_init.h"
|
||||
#include "h5core/h5_debug.h"
|
||||
#include "h5core/h5_log.h"
|
||||
#include "h5core/h5_file_attribs.h"
|
||||
#include "h5core/h5_step_attribs.h"
|
||||
|
||||
#include "private/h5_types.h"
|
||||
#include "private/h5.h"
|
||||
#include "private/h5_io.h"
|
||||
#include "private/h5_hdf5.h"
|
||||
#include "private/h5_attribs.h"
|
||||
|
||||
|
||||
|
||||
h5_err_t
|
||||
h5priv_get_attrib_info_by_idx (
|
||||
const hid_t id, /*!< HDF5 object ID */
|
||||
const h5_size_t attrib_idx, /*!< index of attribute */
|
||||
char* attrib_name, /*!< OUT: name of attribute */
|
||||
const h5_size_t len_attrib_name,/*!< buffer length */
|
||||
h5_int64_t* attrib_type, /*!< OUT: H5 type of attribute */
|
||||
h5_size_t* attrib_nelem /*!< OUT: number of elements */
|
||||
) {
|
||||
H5_PRIV_API_ENTER (h5_err_t,
|
||||
"id=%lld, "
|
||||
"attrib_idx=%llu, "
|
||||
"attrib_name=%p, len_attrib_name=%llu, "
|
||||
"attrib_type=%p, attrib_nelem=%p",
|
||||
(long long int)id,
|
||||
(long long unsigned)attrib_idx,
|
||||
attrib_name,
|
||||
(long long unsigned)len_attrib_name,
|
||||
attrib_type,
|
||||
attrib_nelem);
|
||||
hid_t attrib_id;
|
||||
TRY (attrib_id = hdf5_open_attribute_idx (
|
||||
id,
|
||||
(unsigned int)attrib_idx));
|
||||
|
||||
if (attrib_name) {
|
||||
TRY (hdf5_get_attribute_name (
|
||||
attrib_id,
|
||||
(size_t)len_attrib_name,
|
||||
attrib_name));
|
||||
}
|
||||
H5_PRIV_API_RETURN (get_attrib_info (attrib_id, attrib_type, attrib_nelem));
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
h5priv_read_attrib (
|
||||
const hid_t id, /*!< HDF5 object ID */
|
||||
const char* attrib_name, /*!< name of HDF5 attribute to read */
|
||||
const hid_t attrib_type, /*!< HDF5 type of attribute */
|
||||
void* const attrib_value /*!< OUT: attribute value */
|
||||
) {
|
||||
H5_PRIV_API_ENTER (h5_err_t,
|
||||
"id=%lld, attrib_name='%s', attrib_type=%lld, attrib_value=%p",
|
||||
(long long int)id,
|
||||
attrib_name,
|
||||
(long long int)attrib_type,
|
||||
attrib_value);
|
||||
hid_t attrib_id;
|
||||
hid_t type_id;
|
||||
hid_t space_id;
|
||||
TRY (attrib_id = hdf5_open_attribute (id, attrib_name));
|
||||
TRY (type_id = hdf5_get_attribute_type (attrib_id));
|
||||
|
||||
hid_t h5type_id;
|
||||
TRY (h5type_id = h5priv_normalize_h5_type (type_id));
|
||||
if (h5type_id != attrib_type)
|
||||
H5_PRIV_API_LEAVE (
|
||||
h5_error (
|
||||
H5_ERR_HDF5,
|
||||
"Attribute '%s' has type '%s' but was requested as '%s'.",
|
||||
attrib_name,
|
||||
hdf5_get_type_name (h5type_id),
|
||||
hdf5_get_type_name (attrib_type)));
|
||||
|
||||
TRY (space_id = hdf5_get_attribute_dataspace (attrib_id));
|
||||
TRY (hdf5_read_attribute (attrib_id, type_id, attrib_value));
|
||||
TRY (hdf5_close_dataspace(space_id));
|
||||
TRY (hdf5_close_type (type_id));
|
||||
TRY (hdf5_close_attribute (attrib_id));
|
||||
H5_PRIV_API_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
h5priv_write_attrib (
|
||||
const hid_t id, /*!< HDF5 object ID */
|
||||
const char* attrib_name, /*!< name of HDF5 attribute to write */
|
||||
const hid_t attrib_type, /*!< HDF5 type of attribute */
|
||||
const void* attrib_value, /*!< value of attribute */
|
||||
const hsize_t attrib_nelem, /*!< number of elements (dimension) */
|
||||
const int overwrite
|
||||
) {
|
||||
H5_PRIV_API_ENTER (h5_err_t,
|
||||
"id=%lld, attrib_name='%s', attrib_type=%lld, "
|
||||
"attrib_value=%p, attrib_nelem=%llu, overwrite=%d",
|
||||
(long long int)id,
|
||||
attrib_name,
|
||||
(long long int)attrib_type,
|
||||
attrib_value,
|
||||
attrib_nelem,
|
||||
overwrite);
|
||||
hid_t space_id;
|
||||
hid_t attrib_id;
|
||||
hid_t type_id;
|
||||
if ( attrib_type == H5T_NATIVE_CHAR ) {
|
||||
TRY (type_id = hdf5_create_string_type (attrib_nelem));
|
||||
TRY (space_id = hdf5_create_dataspace_scalar ());
|
||||
} else {
|
||||
type_id = attrib_type;
|
||||
TRY (space_id = hdf5_create_dataspace (1, &attrib_nelem, NULL));
|
||||
}
|
||||
h5_err_t exists;
|
||||
TRY (exists = hdf5_attribute_exists (id, attrib_name));
|
||||
if (exists) {
|
||||
if (overwrite) {
|
||||
TRY (hdf5_delete_attribute (id, attrib_name));
|
||||
} else {
|
||||
H5_PRIV_API_LEAVE (
|
||||
h5_error (H5_ERR_H5, "Cannot overwrite attribute %s/%s",
|
||||
hdf5_get_objname (id), attrib_name));
|
||||
}
|
||||
}
|
||||
TRY (attrib_id = hdf5_create_attribute (
|
||||
id,
|
||||
attrib_name,
|
||||
type_id,
|
||||
space_id,
|
||||
H5P_DEFAULT, H5P_DEFAULT));
|
||||
|
||||
TRY (hdf5_write_attribute (attrib_id, type_id, attrib_value));
|
||||
TRY (hdf5_close_attribute (attrib_id));
|
||||
TRY (hdf5_close_dataspace (space_id));
|
||||
|
||||
if (attrib_type == H5T_NATIVE_CHAR)
|
||||
TRY (hdf5_close_type (type_id));
|
||||
|
||||
H5_PRIV_API_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
h5_has_file_attrib (
|
||||
const h5_file_t f_,
|
||||
@@ -158,11 +26,12 @@ h5_has_file_attrib (
|
||||
f,
|
||||
attrib_name);
|
||||
CHECK_FILEHANDLE (f);
|
||||
H5_CORE_API_RETURN (hdf5_attribute_exists(f->root_gid, attrib_name));
|
||||
TRY (ret_value = hdf5_attribute_exists(f->root_gid, attrib_name));
|
||||
H5_RETURN (ret_value);
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
h5_has_step_attrib (
|
||||
h5_has_iteration_attrib (
|
||||
const h5_file_t f_,
|
||||
const char* const attrib_name
|
||||
) {
|
||||
@@ -172,55 +41,9 @@ h5_has_step_attrib (
|
||||
"attrib_name='%s'",
|
||||
f,
|
||||
attrib_name);
|
||||
CHECK_FILEHANDLE (f);
|
||||
H5_CORE_API_RETURN (hdf5_attribute_exists(f->step_gid, attrib_name));
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
h5_get_file_attrib_info_by_name (
|
||||
const h5_file_t f_, /*!< IN: handle to open file */
|
||||
char* attrib_name, /*!< IN: name of attribute */
|
||||
h5_int64_t* attrib_type, /*!< OUT: H5 type of attribute */
|
||||
h5_size_t* attrib_nelem /*!< OUT: number of elements */
|
||||
) {
|
||||
h5_file_p f = (h5_file_p)f_;
|
||||
H5_CORE_API_ENTER (h5_err_t,
|
||||
"f=%p, "
|
||||
"attrib_name=%s, "
|
||||
"attrib_type=%p, attrib_nelem=%p",
|
||||
f,
|
||||
attrib_name,
|
||||
attrib_type,
|
||||
attrib_nelem);
|
||||
CHECK_FILEHANDLE (f);
|
||||
TRY (h5priv_get_attrib_info_by_name (
|
||||
f->root_gid, attrib_name,
|
||||
attrib_type, attrib_nelem));
|
||||
H5_CORE_API_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
h5_get_step_attrib_info_by_name (
|
||||
const h5_file_t f_, /*!< handle to open file */
|
||||
char* attrib_name, /*!< OUT: name of attribute */
|
||||
h5_int64_t* attrib_type, /*!< OUT: H5 type of attribute */
|
||||
h5_size_t* attrib_nelem /*!< OUT: number of elements */
|
||||
) {
|
||||
h5_file_p f = (h5_file_p)f_;
|
||||
H5_CORE_API_ENTER (h5_err_t,
|
||||
"f=%p, "
|
||||
"attrib_name=%p, "
|
||||
"attrib_type=%p, attrib_nelem=%p",
|
||||
f,
|
||||
attrib_name,
|
||||
attrib_type, attrib_nelem);
|
||||
CHECK_FILEHANDLE (f);
|
||||
CHECK_TIMEGROUP (f);
|
||||
TRY (h5priv_get_attrib_info_by_name (
|
||||
f->step_gid,
|
||||
attrib_name,
|
||||
attrib_type, attrib_nelem));
|
||||
H5_CORE_API_RETURN (H5_SUCCESS);
|
||||
check_iteration_handle_is_valid (f);
|
||||
TRY (ret_value = hdf5_attribute_exists (f->iteration_gid, attrib_name));
|
||||
H5_RETURN (ret_value);
|
||||
}
|
||||
|
||||
h5_ssize_t
|
||||
@@ -230,28 +53,29 @@ h5_get_num_file_attribs (
|
||||
h5_file_p f = (h5_file_p)f_;
|
||||
H5_CORE_API_ENTER (h5_ssize_t, "f=%p", f);
|
||||
CHECK_FILEHANDLE (f);
|
||||
H5_CORE_API_RETURN (hdf5_get_num_attribute (f->root_gid));
|
||||
TRY (ret_value = hdf5_get_num_attribute (f->root_gid));
|
||||
H5_RETURN (ret_value);
|
||||
}
|
||||
|
||||
h5_ssize_t
|
||||
h5_get_num_step_attribs (
|
||||
h5_get_num_iteration_attribs (
|
||||
const h5_file_t f_ /*!< handle to open file */
|
||||
) {
|
||||
h5_file_p f = (h5_file_p)f_;
|
||||
H5_CORE_API_ENTER (h5_ssize_t, "f=%p", f);
|
||||
CHECK_FILEHANDLE (f);
|
||||
CHECK_TIMEGROUP (f);
|
||||
H5_CORE_API_RETURN (hdf5_get_num_attribute (f->step_gid));
|
||||
check_iteration_handle_is_valid (f);
|
||||
TRY (ret_value = hdf5_get_num_attribute (f->iteration_gid));
|
||||
H5_RETURN (ret_value);
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
h5_get_file_attrib_info_by_idx (
|
||||
const h5_file_t f_, /*!< handle to open file */
|
||||
const h5_size_t attrib_idx, /*!< index of attribute */
|
||||
char* attrib_name, /*!< OUT: name of attribute */
|
||||
char* const attrib_name, /*!< OUT: name of attribute */
|
||||
const h5_size_t len_attrib_name, /*!< buffer length */
|
||||
h5_int64_t* attrib_type, /*!< OUT: H5 type of attribute */
|
||||
h5_size_t* attrib_nelem /*!< OUT: number of elements */
|
||||
h5_int64_t* const attrib_type, /*!< OUT: H5 type of attribute */
|
||||
h5_size_t* const attrib_nelem /*!< OUT: number of elements */
|
||||
) {
|
||||
h5_file_p f = (h5_file_p)f_;
|
||||
H5_CORE_API_ENTER (h5_err_t,
|
||||
@@ -264,14 +88,39 @@ h5_get_file_attrib_info_by_idx (
|
||||
attrib_name, (long long unsigned)len_attrib_name,
|
||||
attrib_type, attrib_nelem);
|
||||
CHECK_FILEHANDLE (f);
|
||||
TRY (h5priv_get_attrib_info_by_idx (
|
||||
f->root_gid, attrib_idx, attrib_name, len_attrib_name,
|
||||
attrib_type, attrib_nelem));
|
||||
H5_CORE_API_RETURN (H5_SUCCESS);
|
||||
TRY (ret_value = h5priv_get_attrib_info_by_idx (
|
||||
f->root_gid,
|
||||
attrib_idx,
|
||||
attrib_name, len_attrib_name,
|
||||
attrib_type, attrib_nelem));
|
||||
H5_RETURN (ret_value);
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
h5_get_step_attrib_info_by_idx (
|
||||
h5_get_file_attrib_info_by_name (
|
||||
const h5_file_t f_, /*!< IN: handle to open file */
|
||||
const char* const attrib_name, /*!< IN: name of attribute */
|
||||
h5_int64_t* attrib_type, /*!< OUT: H5 type of attribute */
|
||||
h5_size_t* attrib_nelem /*!< OUT: number of elements */
|
||||
) {
|
||||
h5_file_p f = (h5_file_p)f_;
|
||||
H5_CORE_API_ENTER (h5_err_t,
|
||||
"f=%p, "
|
||||
"attrib_name=%s, "
|
||||
"attrib_type=%p, attrib_nelem=%p",
|
||||
f,
|
||||
attrib_name,
|
||||
attrib_type, attrib_nelem);
|
||||
CHECK_FILEHANDLE (f);
|
||||
TRY (ret_value = h5priv_get_attrib_info_by_name (
|
||||
f->root_gid,
|
||||
attrib_name,
|
||||
attrib_type, attrib_nelem));
|
||||
H5_RETURN (ret_value);
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
h5_get_iteration_attrib_info_by_idx (
|
||||
const h5_file_t f_, /*!< handle to open file */
|
||||
const h5_size_t attrib_idx, /*!< index of attribute */
|
||||
char* attrib_name, /*!< OUT: name of attribute */
|
||||
@@ -282,28 +131,51 @@ h5_get_step_attrib_info_by_idx (
|
||||
h5_file_p f = (h5_file_p)f_;
|
||||
H5_CORE_API_ENTER (h5_err_t,
|
||||
"f=%p, "
|
||||
"attrib_idx=%llu, attrib_name=%p, len_attrib_name=%llu, "
|
||||
"attrib_idx=%llu, "
|
||||
"attrib_name=%p, len_attrib_name=%llu, "
|
||||
"attrib_type=%p, attrib_nelem=%p",
|
||||
f,
|
||||
(long long unsigned)attrib_idx,
|
||||
attrib_name,
|
||||
(long long unsigned)len_attrib_name,
|
||||
attrib_type,
|
||||
attrib_nelem);
|
||||
CHECK_FILEHANDLE (f);
|
||||
CHECK_TIMEGROUP (f);
|
||||
TRY (h5priv_get_attrib_info_by_idx (
|
||||
f->step_gid, attrib_idx, attrib_name, len_attrib_name,
|
||||
attrib_name, (long long unsigned)len_attrib_name,
|
||||
attrib_type, attrib_nelem);
|
||||
check_iteration_handle_is_valid (f);
|
||||
TRY (ret_value = h5priv_get_attrib_info_by_idx (
|
||||
f->iteration_gid,
|
||||
attrib_idx,
|
||||
attrib_name, len_attrib_name,
|
||||
attrib_type, attrib_nelem));
|
||||
H5_CORE_API_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (ret_value);
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
h5_get_iteration_attrib_info_by_name (
|
||||
const h5_file_t f_, /*!< handle to open file */
|
||||
const char* const attrib_name, /*!< OUT: name of attribute */
|
||||
h5_int64_t* const attrib_type, /*!< OUT: H5 type of attribute */
|
||||
h5_size_t* const attrib_nelem /*!< OUT: number of elements */
|
||||
) {
|
||||
h5_file_p f = (h5_file_p)f_;
|
||||
H5_CORE_API_ENTER (h5_err_t,
|
||||
"f=%p, "
|
||||
"attrib_name=%p, "
|
||||
"attrib_type=%p, attrib_nelem=%p",
|
||||
f,
|
||||
attrib_name,
|
||||
attrib_type, attrib_nelem);
|
||||
check_iteration_handle_is_valid (f);
|
||||
TRY (ret_value = h5priv_get_attrib_info_by_name (
|
||||
f->iteration_gid,
|
||||
attrib_name,
|
||||
attrib_type, attrib_nelem));
|
||||
H5_RETURN (ret_value);
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
h5_read_file_attrib (
|
||||
const h5_file_t f_,
|
||||
const char* const attrib_name,
|
||||
const hid_t attrib_type,
|
||||
void* attrib_value
|
||||
const h5_types_t attrib_type,
|
||||
void* const attrib_value
|
||||
) {
|
||||
h5_file_p f = (h5_file_p)f_;
|
||||
H5_CORE_API_ENTER (h5_err_t,
|
||||
@@ -314,19 +186,20 @@ h5_read_file_attrib (
|
||||
(long long int)attrib_type,
|
||||
attrib_value);
|
||||
CHECK_FILEHANDLE (f);
|
||||
H5_CORE_API_RETURN (h5priv_read_attrib (
|
||||
f->root_gid,
|
||||
attrib_name,
|
||||
attrib_type,
|
||||
attrib_value));
|
||||
TRY (ret_value = h5priv_read_attrib (
|
||||
f->root_gid,
|
||||
attrib_name,
|
||||
attrib_type,
|
||||
attrib_value));
|
||||
H5_RETURN (ret_value);
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
h5_read_step_attrib (
|
||||
h5_read_iteration_attrib (
|
||||
const h5_file_t f_,
|
||||
const char *attrib_name,
|
||||
const hid_t attrib_type,
|
||||
void *attrib_value
|
||||
const char* const attrib_name,
|
||||
const h5_types_t attrib_type,
|
||||
void* const attrib_value
|
||||
) {
|
||||
h5_file_p f = (h5_file_p)f_;
|
||||
H5_CORE_API_ENTER (h5_err_t,
|
||||
@@ -336,71 +209,85 @@ h5_read_step_attrib (
|
||||
attrib_name,
|
||||
(long long int)attrib_type,
|
||||
attrib_value);
|
||||
CHECK_FILEHANDLE (f);
|
||||
CHECK_TIMEGROUP (f);
|
||||
H5_CORE_API_RETURN (h5priv_read_attrib (
|
||||
f->step_gid,
|
||||
attrib_name,
|
||||
attrib_type,
|
||||
attrib_value));
|
||||
check_iteration_is_readable (f);
|
||||
|
||||
TRY (ret_value = h5priv_read_attrib (
|
||||
f->iteration_gid,
|
||||
attrib_name,
|
||||
attrib_type,
|
||||
attrib_value));
|
||||
H5_RETURN (ret_value);
|
||||
}
|
||||
|
||||
|
||||
h5_err_t
|
||||
h5_write_file_attrib (
|
||||
const h5_file_t f_,
|
||||
const char *attrib_name,
|
||||
const hid_t attrib_type,
|
||||
const void *attrib_value,
|
||||
const hsize_t attrib_nelem
|
||||
const char* const attrib_name,
|
||||
const h5_types_t attrib_type,
|
||||
const void* const attrib_value,
|
||||
const h5_size_t attrib_nelem
|
||||
) {
|
||||
h5_file_p f = (h5_file_p)f_;
|
||||
H5_CORE_API_ENTER (h5_err_t,
|
||||
"f=%p, attrib_name='%s', attrib_type=%lld, "
|
||||
"attrib_value=%p, attrib_nelem=%llu",
|
||||
"attrib_value=%p, attrib_nelem=%lld",
|
||||
f,
|
||||
attrib_name,
|
||||
(long long int)attrib_type,
|
||||
attrib_value,
|
||||
attrib_nelem);
|
||||
(long long)attrib_nelem);
|
||||
CHECK_FILEHANDLE (f);
|
||||
CHECK_WRITABLE_MODE (f);
|
||||
H5_CORE_API_RETURN (h5priv_write_attrib (
|
||||
f->root_gid,
|
||||
attrib_name,
|
||||
attrib_type,
|
||||
attrib_value,
|
||||
attrib_nelem,
|
||||
!is_appendonly (f)));
|
||||
if (is_appendonly (f)) {
|
||||
TRY (h5priv_append_attrib (
|
||||
f->root_gid,
|
||||
attrib_name,
|
||||
attrib_type,
|
||||
attrib_value,
|
||||
attrib_nelem));
|
||||
} else {
|
||||
TRY (h5priv_write_attrib (
|
||||
f->root_gid,
|
||||
attrib_name,
|
||||
attrib_type,
|
||||
attrib_value,
|
||||
attrib_nelem));
|
||||
}
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
h5_write_step_attrib (
|
||||
h5_write_iteration_attrib (
|
||||
const h5_file_t f_,
|
||||
const char *attrib_name,
|
||||
const hid_t attrib_type,
|
||||
const void *attrib_value,
|
||||
const hsize_t attrib_nelem
|
||||
const char* const attrib_name,
|
||||
const h5_types_t attrib_type,
|
||||
const void* const attrib_value,
|
||||
const h5_size_t attrib_nelem
|
||||
) {
|
||||
h5_file_p f = (h5_file_p)f_;
|
||||
H5_CORE_API_ENTER (h5_err_t,
|
||||
"f=%p, attrib_name='%s', attrib_type=%lld, "
|
||||
"attrib_value=%p, attrib_nelem=%llu",
|
||||
"attrib_value=%p, attrib_nelem=%lld",
|
||||
f,
|
||||
attrib_name,
|
||||
(long long int)attrib_type,
|
||||
attrib_value,
|
||||
attrib_nelem);
|
||||
CHECK_FILEHANDLE (f);
|
||||
CHECK_TIMEGROUP (f);
|
||||
CHECK_WRITABLE_MODE (f);
|
||||
H5_CORE_API_RETURN (h5priv_write_attrib (
|
||||
f->step_gid,
|
||||
attrib_name,
|
||||
attrib_type,
|
||||
attrib_value,
|
||||
attrib_nelem,
|
||||
!is_appendonly (f)));
|
||||
(long long)attrib_nelem);
|
||||
check_iteration_is_writable (f);
|
||||
if (is_appendonly (f)) {
|
||||
TRY (h5priv_append_attrib (
|
||||
f->iteration_gid,
|
||||
attrib_name,
|
||||
attrib_type,
|
||||
attrib_value,
|
||||
attrib_nelem));
|
||||
} else {
|
||||
TRY (h5priv_write_attrib (
|
||||
f->iteration_gid,
|
||||
attrib_name,
|
||||
attrib_type,
|
||||
attrib_value,
|
||||
attrib_nelem));
|
||||
}
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,79 +0,0 @@
|
||||
/*
|
||||
Copyright (c) 2006-2016, The Regents of the University of California,
|
||||
through Lawrence Berkeley National Laboratory (subject to receipt of any
|
||||
required approvals from the U.S. Dept. of Energy) and the Paul Scherrer
|
||||
Institut (Switzerland). All rights reserved.
|
||||
|
||||
License: see file COPYING in top level of source distribution.
|
||||
*/
|
||||
|
||||
#include "h5core/h5_init.h"
|
||||
#include "private/h5_init.h"
|
||||
|
||||
h5_int32_t h5_debug_level = H5_VERBOSE_ERROR;
|
||||
struct call_stack h5_call_stack;
|
||||
|
||||
char *h5_rfmts[] = {
|
||||
[e_int] "%d",
|
||||
[e_ssize_t] "%ld",
|
||||
[e_char_p] "%s",
|
||||
[e_void_p] "%p",
|
||||
[e_h5_err_t] "%lld",
|
||||
[e_h5_int64_t] "%lld",
|
||||
[e_h5_id_t] "%lld",
|
||||
[e_h5_ssize_t] "%lld",
|
||||
[e_h5_errorhandler_t] "%p",
|
||||
[e_h5_file_p] "%p",
|
||||
[e_h5_file_t] "0x%08x",
|
||||
[e_h5_lvl_idx_t] "%d",
|
||||
[e_h5t_iterator_p] "%p",
|
||||
[e_h5_loc_id_t] "%ld",
|
||||
[e_h5_loc_idx_t] "%ld",
|
||||
[e_hid_t] "%lld",
|
||||
[e_H5O_type_t] "%ld",
|
||||
[e_h5_glb_elem_p] "%p",
|
||||
[e_h5_prop_p] "%p",
|
||||
[e_h5_prop_t] "0x%08x",
|
||||
[e_h5_prop_file_p] "%p",
|
||||
[e_h5_prop_file_t] "0x%08x",
|
||||
[e_herr_t] "%ld"
|
||||
};
|
||||
|
||||
/*!
|
||||
\ingroup h5_core_errorhandling
|
||||
|
||||
Set debug/verbosity level. On level 0 all output will be supressed (even
|
||||
error messages). On level 1 error messages, on level 2 warning messages
|
||||
and on level 3 informational messages will be printed. On level 4 debug
|
||||
messages will be printed.
|
||||
|
||||
Values less than 0 are equivalent to 0. Values greater than 4 are equivalent
|
||||
to 4.
|
||||
|
||||
\return \c H5_SUCCESS on success.
|
||||
\return \c H5_ERR_INVAL if debug level is invalid.
|
||||
*/
|
||||
h5_err_t
|
||||
h5_set_debuglevel (
|
||||
const h5_id_t level /*!< debug level */
|
||||
) {
|
||||
if (level < 0)
|
||||
h5_debug_level = ((1 << 20) - 1) & ~0x7;
|
||||
else
|
||||
h5_debug_level = level;
|
||||
return H5_SUCCESS;
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5_core_errorhandling
|
||||
|
||||
Get current debug/verbosity level.
|
||||
|
||||
\return current debug level
|
||||
*/
|
||||
h5_err_t
|
||||
h5_get_debuglevel (
|
||||
void
|
||||
) {
|
||||
return h5_debug_level;
|
||||
}
|
||||
@@ -7,8 +7,13 @@
|
||||
License: see file COPYING in top level of source distribution.
|
||||
*/
|
||||
|
||||
#include "h5core/h5_init.h"
|
||||
#include "private/h5_init.h"
|
||||
#include "h5core/h5_log.h"
|
||||
#include "h5core/h5_err.h"
|
||||
|
||||
extern int h5_myproc;
|
||||
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
static h5_errorhandler_t h5_errhandler = h5_report_errorhandler;
|
||||
h5_err_t h5_errno;
|
||||
@@ -88,6 +93,26 @@ h5_set_errno (
|
||||
h5_errno = errno;
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5_core_errorhandling
|
||||
|
||||
Print error message to \c stderr. For use in error handlers only.
|
||||
*/
|
||||
void
|
||||
h5_verror (
|
||||
const char* const fmt,
|
||||
va_list ap
|
||||
) {
|
||||
if (__h5_log_level == 0) return;
|
||||
char fmt2[2048];
|
||||
snprintf (fmt2,
|
||||
sizeof(fmt2), "[proc %d] E: %s: %s\n",
|
||||
h5_myproc,
|
||||
h5_call_stack.entry[0].name,
|
||||
fmt);
|
||||
vfprintf (stderr, fmt2, ap);
|
||||
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5_core_errorhandling
|
||||
@@ -99,10 +124,10 @@ h5_set_errno (
|
||||
*/
|
||||
h5_err_t
|
||||
h5_report_errorhandler (
|
||||
const char* fmt,
|
||||
const char* const fmt,
|
||||
va_list ap
|
||||
) {
|
||||
if (h5_debug_level > 0) {
|
||||
if (__h5_log_level > 0) {
|
||||
h5_verror (fmt, ap);
|
||||
}
|
||||
return h5_errno;
|
||||
@@ -116,13 +141,13 @@ h5_report_errorhandler (
|
||||
*/
|
||||
h5_err_t
|
||||
h5_abort_errorhandler (
|
||||
const char* fmt,
|
||||
const char* const fmt,
|
||||
va_list ap
|
||||
) {
|
||||
if (h5_debug_level > 0) {
|
||||
if (__h5_log_level > 0) {
|
||||
h5_verror (fmt, ap);
|
||||
}
|
||||
#ifdef PARALLEL_IO
|
||||
#ifdef H5_HAVE_PARALLEL
|
||||
MPI_Abort(MPI_COMM_WORLD, -(int)h5_errno);
|
||||
#else
|
||||
exit (-(int)h5_errno);
|
||||
@@ -130,20 +155,6 @@ h5_abort_errorhandler (
|
||||
return -(int)h5_errno; // never executed, just to supress a warning
|
||||
}
|
||||
|
||||
void
|
||||
h5priv_vprintf (
|
||||
FILE* f,
|
||||
const char* prefix,
|
||||
const char* __funcname,
|
||||
const char* fmt,
|
||||
va_list ap
|
||||
) {
|
||||
char fmt2[2048];
|
||||
snprintf (fmt2, sizeof(fmt2), "[proc %d] %s: %s: %s\n", h5_myproc, prefix,
|
||||
__funcname, fmt);
|
||||
vfprintf (f, fmt2, ap);
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5_core_errorhandling
|
||||
|
||||
@@ -154,7 +165,7 @@ h5priv_vprintf (
|
||||
h5_err_t
|
||||
h5_error (
|
||||
const h5_err_t errno_,
|
||||
const char* fmt,
|
||||
const char* const fmt,
|
||||
...
|
||||
) {
|
||||
h5_errno = errno_;
|
||||
@@ -166,17 +177,3 @@ h5_error (
|
||||
va_end (ap);
|
||||
return h5_errno;
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5_core_errorhandling
|
||||
|
||||
Print error message to \c stderr. For use in error handlers only.
|
||||
*/
|
||||
void
|
||||
h5_verror (
|
||||
const char* fmt,
|
||||
va_list ap
|
||||
) {
|
||||
if (h5_debug_level == 0) return;
|
||||
h5priv_vprintf (stderr, "E", h5_call_stack.entry[0].name, fmt, ap);
|
||||
}
|
||||
+209
-164
@@ -10,11 +10,11 @@
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "h5core/h5_init.h"
|
||||
#include "h5core/h5_debug.h"
|
||||
#include "h5core/h5_log.h"
|
||||
|
||||
#include "private/h5.h"
|
||||
#include "private/h5_file.h"
|
||||
#include "private/h5_hdf5.h"
|
||||
|
||||
#include "private/h5_model.h"
|
||||
@@ -22,7 +22,7 @@
|
||||
#include "private/h5u_io.h"
|
||||
#include "private/h5b_io.h"
|
||||
|
||||
#include "h5core/h5_errorhandling.h"
|
||||
#include "h5core/h5_err.h"
|
||||
#include "h5core/h5_syscall.h"
|
||||
|
||||
/*!
|
||||
@@ -42,12 +42,7 @@ h5_check_filehandle (
|
||||
const h5_file_t f_ /*!< filehandle to check validity of */
|
||||
) {
|
||||
h5_file_p f = (h5_file_p)f_;
|
||||
if (f == NULL || f_ == H5_FAILURE || f->file < 0 || f->u == NULL || f->b == NULL) {
|
||||
return h5_error (
|
||||
H5_ERR_BADF,
|
||||
"Called with bad filehandle.");
|
||||
}
|
||||
return H5_SUCCESS;
|
||||
return is_valid_file_handle (f) ? H5_SUCCESS : H5_ERR;
|
||||
}
|
||||
|
||||
hid_t
|
||||
@@ -56,19 +51,20 @@ h5_get_hdf5_file(
|
||||
) {
|
||||
h5_file_p f = (h5_file_p)f_;
|
||||
H5_CORE_API_ENTER (hid_t, "f=%p", f);
|
||||
H5_CORE_API_RETURN (f->file);
|
||||
check_file_handle_is_valid (f);
|
||||
H5_RETURN (f->file);
|
||||
}
|
||||
|
||||
/*!
|
||||
Initialize H5Part
|
||||
Initialize H5hut
|
||||
*/
|
||||
static herr_t
|
||||
hdf5_error_handler (
|
||||
hid_t estack_id,
|
||||
void* __f
|
||||
void* __f
|
||||
) {
|
||||
UNUSED_ARGUMENT (__f);
|
||||
if (h5_get_debuglevel() >= 5) {
|
||||
if (h5_get_loglevel() >= 4) {
|
||||
H5Eprint (estack_id, stderr);
|
||||
}
|
||||
return 0;
|
||||
@@ -79,7 +75,7 @@ mpi_init (
|
||||
const h5_file_p f
|
||||
) {
|
||||
H5_INLINE_FUNC_ENTER (h5_err_t);
|
||||
#ifdef PARALLEL_IO
|
||||
#ifdef H5_HAVE_PARALLEL
|
||||
TRY (h5priv_mpi_comm_size (f->props->comm, &f->nprocs));
|
||||
TRY (h5priv_mpi_comm_rank (f->props->comm, &f->myproc));
|
||||
|
||||
@@ -140,8 +136,8 @@ mpi_init (
|
||||
TRY (h5_optimize_for_lustre(f, filename));
|
||||
}
|
||||
#endif
|
||||
#endif /* PARALLEL_IO */
|
||||
H5_INLINE_FUNC_RETURN (H5_SUCCESS);
|
||||
#endif /* H5_HAVE_PARALLEL */
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
static inline h5_err_t
|
||||
@@ -163,25 +159,27 @@ set_alignment (
|
||||
(long long int)f->props->align);
|
||||
TRY (H5Pset_meta_block_size (f->props->access_prop, f->props->align));
|
||||
}
|
||||
H5_INLINE_FUNC_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
static inline h5_err_t
|
||||
set_default_file_props (
|
||||
h5_prop_file_t* _props
|
||||
h5_prop_file_t* const _props
|
||||
) {
|
||||
H5_INLINE_FUNC_ENTER (h5_err_t);
|
||||
h5_prop_file_p props = (h5_prop_file_p)_props;
|
||||
h5_prop_file_t* props = (h5_prop_file_t*)_props;
|
||||
bzero (props, sizeof (*props));
|
||||
props->class = H5_PROP_FILE;
|
||||
TRY (props->prefix_step_name = h5_calloc (1, H5_STEPNAME_LEN));
|
||||
TRY (props->prefix_iteration_name = h5_calloc (1, H5_ITERATION_NAME_LEN));
|
||||
strncpy (
|
||||
props->prefix_step_name,
|
||||
H5_STEPNAME,
|
||||
H5_STEPNAME_LEN - 1);
|
||||
props->width_step_idx = H5_STEPWIDTH;
|
||||
props->prefix_iteration_name,
|
||||
H5_ITERATION_NAME,
|
||||
H5_ITERATION_NAME_LEN - 1);
|
||||
props->width_iteration_idx = H5_ITERATION_NUM_WIDTH;
|
||||
#ifdef H5_HAVE_PARALLEL
|
||||
props->comm = MPI_COMM_WORLD;
|
||||
H5_INLINE_FUNC_RETURN (H5_SUCCESS);
|
||||
#endif
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
@@ -189,16 +187,16 @@ h5_set_prop_file_mpio_collective (
|
||||
h5_prop_t _props,
|
||||
MPI_Comm* comm
|
||||
) {
|
||||
h5_prop_file_p props = (h5_prop_file_p)_props;
|
||||
h5_prop_file_t* props = (h5_prop_file_t*)_props;
|
||||
H5_CORE_API_ENTER (h5_err_t, "props=%p, comm=%p", props, comm);
|
||||
|
||||
if (props->class != H5_PROP_FILE) {
|
||||
H5_INLINE_FUNC_LEAVE (
|
||||
h5_error (
|
||||
H5_ERR_INVAL,
|
||||
"Invalid property class: %lld",
|
||||
(long long int)props->class));
|
||||
H5_RETURN_ERROR (
|
||||
H5_ERR_INVAL,
|
||||
"Invalid property class: %lld",
|
||||
(long long int)props->class);
|
||||
}
|
||||
#ifdef H5_HAVE_PARALLEL
|
||||
props->flags &= ~(H5_VFD_MPIO_POSIX | H5_VFD_MPIO_INDEPENDENT | H5_VFD_CORE);
|
||||
props->flags |= H5_VFD_MPIO_COLLECTIVE;
|
||||
props->comm = *comm;
|
||||
@@ -206,8 +204,10 @@ h5_set_prop_file_mpio_collective (
|
||||
h5_warn ("Throttling is not permitted with collective VFD. Reset throttling.");
|
||||
props->throttle = 0;
|
||||
}
|
||||
|
||||
H5_CORE_API_RETURN (H5_SUCCESS);
|
||||
#else
|
||||
h5_info ("Setting MPIO collective property ignored in serial H5hut");
|
||||
#endif
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
@@ -215,20 +215,23 @@ h5_set_prop_file_mpio_independent (
|
||||
h5_prop_t _props,
|
||||
MPI_Comm* comm
|
||||
) {
|
||||
h5_prop_file_p props = (h5_prop_file_p)_props;
|
||||
h5_prop_file_t* props = (h5_prop_file_t*)_props;
|
||||
H5_CORE_API_ENTER (h5_err_t, "props=%p, comm=%p", props, comm);
|
||||
|
||||
if (props->class != H5_PROP_FILE) {
|
||||
H5_INLINE_FUNC_LEAVE (
|
||||
h5_error (
|
||||
H5_ERR_INVAL,
|
||||
"Invalid property class: %lld",
|
||||
(long long int)props->class));
|
||||
H5_RETURN_ERROR (
|
||||
H5_ERR_INVAL,
|
||||
"Invalid property class: %lld",
|
||||
(long long int)props->class);
|
||||
}
|
||||
#ifdef H5_HAVE_PARALLEL
|
||||
props->flags &= ~(H5_VFD_MPIO_COLLECTIVE | H5_VFD_MPIO_POSIX | H5_VFD_CORE);
|
||||
props->flags |= H5_VFD_MPIO_INDEPENDENT;
|
||||
props->comm = *comm;
|
||||
H5_CORE_API_RETURN (H5_SUCCESS);
|
||||
#else
|
||||
h5_info ("Setting MPIO independent property ignored in serial H5hut");
|
||||
#endif
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
#if H5_VERSION_LE(1,8,12)
|
||||
@@ -237,39 +240,45 @@ h5_set_prop_file_mpio_posix (
|
||||
h5_prop_t _props,
|
||||
MPI_Comm* comm
|
||||
) {
|
||||
h5_prop_file_p props = (h5_prop_file_p)_props;
|
||||
h5_prop_file_t* props = (h5_prop_file_t*)_props;
|
||||
H5_CORE_API_ENTER (h5_err_t, "props=%p, comm=%p", props, comm);
|
||||
|
||||
if (props->class != H5_PROP_FILE) {
|
||||
H5_INLINE_FUNC_LEAVE (
|
||||
h5_error (
|
||||
H5_ERR_INVAL,
|
||||
"Invalid property class: %lld",
|
||||
(long long int)props->class));
|
||||
H5_RETURN_ERROR (
|
||||
H5_ERR_INVAL,
|
||||
"Invalid property class: %lld",
|
||||
(long long int)props->class);
|
||||
}
|
||||
#ifdef H5_HAVE_PARALLEL
|
||||
props->flags &= ~(H5_VFD_MPIO_COLLECTIVE | H5_VFD_MPIO_POSIX | H5_VFD_CORE);
|
||||
props->flags |= H5_VFD_MPIO_INDEPENDENT;
|
||||
props->comm = *comm;
|
||||
H5_CORE_API_RETURN (H5_SUCCESS);
|
||||
#else
|
||||
h5_info ("Setting MPIO POSIX property ignored in serial H5hut");
|
||||
#endif
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
#endif
|
||||
|
||||
h5_err_t
|
||||
h5_set_prop_file_core_vfd (
|
||||
h5_prop_t _props,
|
||||
h5_int64_t increment
|
||||
const h5_int64_t increment
|
||||
) {
|
||||
h5_prop_file_p props = (h5_prop_file_p)_props;
|
||||
H5_CORE_API_ENTER (h5_err_t, "props=%p, increment=%lld", props, (long long int)increment);
|
||||
h5_prop_file_t* props = (h5_prop_file_t*)_props;
|
||||
H5_CORE_API_ENTER (h5_err_t, "props=%p, increment=%lld",
|
||||
props, (long long int)increment);
|
||||
|
||||
if (props->class != H5_PROP_FILE) {
|
||||
H5_INLINE_FUNC_LEAVE (
|
||||
h5_error (
|
||||
H5_ERR_INVAL,
|
||||
"Invalid property class: %lld",
|
||||
(long long int)props->class));
|
||||
H5_RETURN_ERROR (
|
||||
H5_ERR_INVAL,
|
||||
"Invalid property class: %lld",
|
||||
(long long int)props->class);
|
||||
}
|
||||
props->flags &= ~(H5_VFD_MPIO_COLLECTIVE | H5_VFD_MPIO_INDEPENDENT | H5_VFD_MPIO_POSIX);
|
||||
#ifdef H5_HAVE_PARALLEL
|
||||
props->flags &= ~(H5_VFD_MPIO_COLLECTIVE |
|
||||
H5_VFD_MPIO_INDEPENDENT |
|
||||
H5_VFD_MPIO_POSIX);
|
||||
props->flags |= H5_VFD_MPIO_INDEPENDENT;
|
||||
props->comm = MPI_COMM_SELF;
|
||||
props->increment = increment;
|
||||
@@ -277,48 +286,69 @@ h5_set_prop_file_core_vfd (
|
||||
h5_warn ("Throttling is not permitted with core VFD. Reset throttling.");
|
||||
props->throttle = 0;
|
||||
}
|
||||
H5_CORE_API_RETURN (H5_SUCCESS);
|
||||
#else
|
||||
h5_info ("Setting MPIO core property ignored in serial H5hut");
|
||||
#endif
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
|
||||
h5_err_t
|
||||
h5_set_prop_file_align (
|
||||
h5_prop_t _props,
|
||||
h5_int64_t align
|
||||
const h5_int64_t align
|
||||
) {
|
||||
h5_prop_file_p props = (h5_prop_file_p)_props;
|
||||
h5_prop_file_t* props = (h5_prop_file_t*)_props;
|
||||
H5_CORE_API_ENTER (
|
||||
h5_err_t,
|
||||
"props=%p, align=%lld",
|
||||
props, (long long int)align);
|
||||
if (props->class != H5_PROP_FILE) {
|
||||
H5_INLINE_FUNC_LEAVE (
|
||||
h5_error (
|
||||
H5_ERR_INVAL,
|
||||
"Invalid property class: %lld",
|
||||
(long long int)props->class));
|
||||
H5_RETURN_ERROR (
|
||||
H5_ERR_INVAL,
|
||||
"Invalid property class: %lld",
|
||||
(long long int)props->class);
|
||||
}
|
||||
props->align = align;
|
||||
H5_CORE_API_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
h5_set_prop_file_flush_after_write (
|
||||
h5_prop_t _props
|
||||
) {
|
||||
h5_prop_file_t* props = (h5_prop_file_t*)_props;
|
||||
H5_CORE_API_ENTER (
|
||||
h5_err_t,
|
||||
"props=%p",
|
||||
props);
|
||||
if (props->class != H5_PROP_FILE) {
|
||||
H5_RETURN_ERROR (
|
||||
H5_ERR_INVAL,
|
||||
"Invalid property class: %lld",
|
||||
(long long int)props->class);
|
||||
}
|
||||
props->flush = 1;
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
h5_set_prop_file_throttle (
|
||||
h5_prop_t _props,
|
||||
h5_int64_t throttle
|
||||
const h5_int64_t throttle
|
||||
) {
|
||||
h5_prop_file_p props = (h5_prop_file_p)_props;
|
||||
h5_prop_file_t* props = (h5_prop_file_t*)_props;
|
||||
H5_CORE_API_ENTER (
|
||||
h5_err_t,
|
||||
"props=%p, throttle=%lld",
|
||||
props, (long long int)throttle);
|
||||
if (props->class != H5_PROP_FILE) {
|
||||
H5_CORE_API_LEAVE (
|
||||
h5_error (
|
||||
H5_ERR_INVAL,
|
||||
"Invalid property class: %lld",
|
||||
(long long int)props->class));
|
||||
H5_RETURN_ERROR (
|
||||
H5_ERR_INVAL,
|
||||
"Invalid property class: %lld",
|
||||
(long long int)props->class);
|
||||
}
|
||||
#ifdef H5_HAVE_PARALLEL
|
||||
// throttle only if VFD is MPIO independent od POSIX
|
||||
h5_int64_t mask = H5_VFD_MPIO_INDEPENDENT;
|
||||
#if H5_VERSION_LE(1,8,12)
|
||||
@@ -338,13 +368,16 @@ h5_set_prop_file_throttle (
|
||||
}
|
||||
|
||||
props->throttle = throttle;
|
||||
H5_CORE_API_RETURN (H5_SUCCESS);
|
||||
#else
|
||||
h5_info ("Setting the throttle property in serial H5hut");
|
||||
#endif
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
|
||||
h5_prop_t
|
||||
h5_create_prop (
|
||||
h5_int64_t class
|
||||
const h5_int64_t class
|
||||
) {
|
||||
H5_CORE_API_ENTER (
|
||||
h5_prop_t,
|
||||
@@ -357,13 +390,12 @@ h5_create_prop (
|
||||
set_default_file_props ((h5_prop_file_t*)prop);
|
||||
break;
|
||||
default:
|
||||
H5_CORE_API_LEAVE (
|
||||
h5_error (
|
||||
H5_ERR_INVAL,
|
||||
"Invalid property class: %lld",
|
||||
(long long int)class));
|
||||
H5_RETURN_ERROR (
|
||||
H5_ERR_INVAL,
|
||||
"Invalid property class: %lld",
|
||||
(long long int)class);
|
||||
}
|
||||
H5_CORE_API_RETURN ((h5_prop_t)prop);
|
||||
H5_RETURN ((h5_prop_t)prop);
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
@@ -375,24 +407,23 @@ h5_close_prop (
|
||||
switch (prop->class) {
|
||||
case H5_PROP_FILE: {
|
||||
h5_prop_file_t* file_prop = (h5_prop_file_t*)prop;
|
||||
TRY (h5_free (file_prop->prefix_step_name));
|
||||
TRY (h5_free (file_prop->prefix_iteration_name));
|
||||
break;
|
||||
}
|
||||
default:
|
||||
H5_CORE_API_LEAVE (
|
||||
h5_error (
|
||||
H5_ERR_INVAL,
|
||||
"Invalid property class: %lld",
|
||||
(long long int)prop->class));
|
||||
H5_RETURN_ERROR (
|
||||
H5_ERR_INVAL,
|
||||
"Invalid property class: %lld",
|
||||
(long long int)prop->class);
|
||||
}
|
||||
H5_CORE_API_RETURN (h5_free (prop));
|
||||
H5_RETURN (h5_free (prop));
|
||||
}
|
||||
|
||||
static inline h5_err_t
|
||||
open_file (
|
||||
const h5_file_p f,
|
||||
const char* const filename,
|
||||
h5_int32_t mode
|
||||
const h5_int32_t mode
|
||||
) {
|
||||
H5_INLINE_FUNC_ENTER (h5_err_t);
|
||||
h5_info ("Opening file %s.", filename);
|
||||
@@ -401,14 +432,14 @@ open_file (
|
||||
|
||||
f->nprocs = 1; // queried later
|
||||
f->myproc = 0; // queried later
|
||||
f->step_gid = -1;
|
||||
f->iteration_gid = -1;
|
||||
|
||||
TRY (f->step_name = h5_calloc (2, H5_STEPNAME_LEN));
|
||||
TRY (f->iteration_name = h5_calloc (2, H5_ITERATION_NAME_LEN));
|
||||
sprintf (
|
||||
f->step_name,
|
||||
f->iteration_name,
|
||||
"%s#%0*lld",
|
||||
f->props->prefix_step_name,
|
||||
f->props->width_step_idx, (long long)f->step_idx);
|
||||
f->props->prefix_iteration_name,
|
||||
f->props->width_iteration_idx, (long long)f->iteration_idx);
|
||||
|
||||
TRY (hdf5_set_errorhandler (H5E_DEFAULT, hdf5_error_handler, NULL));
|
||||
|
||||
@@ -441,34 +472,32 @@ open_file (
|
||||
}
|
||||
}
|
||||
else {
|
||||
H5_PRIV_FUNC_LEAVE (
|
||||
h5_error (
|
||||
H5_ERR_INVAL,
|
||||
"Invalid file access mode '%lld'.",
|
||||
(long long int)f->props->flags & 0xff));
|
||||
H5_RETURN_ERROR (
|
||||
H5_ERR_INVAL,
|
||||
"Invalid file access mode '%lld'.",
|
||||
(long long int)f->props->flags & 0xff);
|
||||
}
|
||||
|
||||
if (f->file < 0)
|
||||
H5_PRIV_FUNC_LEAVE (
|
||||
h5_error (
|
||||
H5_ERR_HDF5,
|
||||
"Cannot open file '%s' with mode '%s'",
|
||||
filename, H5_O_MODES[f->props->flags & 0xff]));
|
||||
H5_RETURN_ERROR (
|
||||
H5_ERR_HDF5,
|
||||
"Cannot open file '%s' with mode '%s'",
|
||||
filename, H5_O_MODES[f->props->flags & 0xff]);
|
||||
TRY (f->root_gid = hdf5_open_group (f->file, "/" ));
|
||||
|
||||
TRY (h5upriv_open_file (f));
|
||||
TRY (h5bpriv_open_file (f));
|
||||
|
||||
H5_INLINE_FUNC_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
h5_file_t
|
||||
h5_open_file2 (
|
||||
const char* filename,
|
||||
h5_int32_t mode,
|
||||
h5_prop_t props_
|
||||
const char* const filename,
|
||||
const h5_int32_t mode,
|
||||
const h5_prop_t props_
|
||||
) {
|
||||
h5_prop_file_t* props = (h5_prop_file_t*)props_;
|
||||
h5_prop_file_t* const props = (h5_prop_file_t*)props_;
|
||||
H5_CORE_API_ENTER (h5_file_t,
|
||||
"filename='%s', mode=%d, props=%p",
|
||||
filename, mode, props);
|
||||
@@ -477,32 +506,35 @@ h5_open_file2 (
|
||||
TRY (f = h5_calloc (1, sizeof (*f)));
|
||||
|
||||
TRY (f->props = (h5_prop_file_t*)h5_create_prop (H5_PROP_FILE));
|
||||
TRY (set_default_file_props (f->props));
|
||||
TRY (h5_set_stepname_fmt ((uintptr_t)f, H5_STEPNAME, H5_STEPWIDTH));
|
||||
|
||||
if (props != H5_PROP_DEFAULT) {
|
||||
if (props->class != H5_PROP_FILE) {
|
||||
H5_CORE_API_LEAVE (
|
||||
h5_error (
|
||||
H5_ERR_INVAL,
|
||||
"Invalid property class: %lld.",
|
||||
(long long int)props->class));
|
||||
H5_RETURN_ERROR (
|
||||
H5_ERR_INVAL,
|
||||
"Invalid property class: %lld.",
|
||||
(long long int)props->class);
|
||||
}
|
||||
#ifdef H5_HAVE_PARALLEL
|
||||
f->props->comm = props->comm;
|
||||
#endif
|
||||
f->props->flags = props->flags;
|
||||
f->props->throttle = props->throttle;
|
||||
f->props->align = props->align;
|
||||
|
||||
strncpy (
|
||||
f->props->prefix_step_name,
|
||||
props->prefix_step_name,
|
||||
H5_STEPNAME_LEN - 1);
|
||||
f->props->width_step_idx = props->width_step_idx;
|
||||
f->props->prefix_iteration_name,
|
||||
props->prefix_iteration_name,
|
||||
H5_ITERATION_NAME_LEN - 1);
|
||||
f->props->width_iteration_idx = props->width_iteration_idx;
|
||||
}
|
||||
|
||||
TRY (open_file (f, filename, mode));
|
||||
|
||||
H5_CORE_API_RETURN ((h5_file_t)f);
|
||||
TRY (h5_set_iteration_name_fmt ((uintptr_t)f,
|
||||
H5_ITERATION_NAME,
|
||||
H5_ITERATION_NUM_WIDTH));
|
||||
|
||||
H5_RETURN ((h5_file_t)f);
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -526,7 +558,7 @@ h5_open_file1 (
|
||||
const char* filename,
|
||||
h5_int32_t mode,
|
||||
MPI_Comm comm,
|
||||
h5_size_t align
|
||||
const h5_size_t align
|
||||
) {
|
||||
H5_CORE_API_ENTER (
|
||||
h5_file_p,
|
||||
@@ -540,7 +572,7 @@ h5_open_file1 (
|
||||
TRY (f = h5_open_file2 (filename, mode, (h5_prop_t)props));
|
||||
TRY (h5_close_prop ((h5_prop_t)props));
|
||||
h5_file_p _f = (h5_file_p)f;
|
||||
H5_CORE_API_RETURN (_f);
|
||||
H5_RETURN (_f);
|
||||
|
||||
}
|
||||
|
||||
@@ -561,9 +593,9 @@ h5_close_file (
|
||||
H5_CORE_API_ENTER (h5_err_t, "f=%p", f);
|
||||
h5_errno = H5_SUCCESS;
|
||||
|
||||
CHECK_FILEHANDLE (f);
|
||||
check_file_handle_is_valid (f);
|
||||
|
||||
TRY (h5priv_close_step (f));
|
||||
TRY (h5priv_close_iteration (f));
|
||||
TRY (h5upriv_close_file (f));
|
||||
TRY (h5bpriv_close_file (f));
|
||||
TRY (hdf5_close_property (f->props->xfer_prop));
|
||||
@@ -573,26 +605,33 @@ h5_close_file (
|
||||
TRY (hdf5_flush (f->file, H5F_SCOPE_GLOBAL));
|
||||
TRY (h5_close_prop ((h5_prop_t)f->props));
|
||||
TRY (hdf5_close_file (f->file));
|
||||
TRY (h5_free (f->step_name));
|
||||
TRY (h5_free (f->iteration_name));
|
||||
TRY (h5_free (f));
|
||||
H5_CORE_API_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
h5_close_hdf5 (
|
||||
h5_close_h5hut (
|
||||
void
|
||||
) {
|
||||
H5_CORE_API_ENTER (h5_err_t, "%s", "");
|
||||
H5_CORE_API_RETURN (hdf5_close ());
|
||||
TRY (h5_finalize ());
|
||||
TRY (hdf5_close ());
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
h5_flush_step (
|
||||
h5_flush_iteration (
|
||||
const h5_file_t f_
|
||||
) {
|
||||
h5_file_p f = (h5_file_p)f_;
|
||||
H5_CORE_API_ENTER (h5_err_t, "f=%p", f);
|
||||
H5_CORE_API_RETURN (hdf5_flush (f->step_gid, H5F_SCOPE_LOCAL));
|
||||
check_iteration_is_writable (f);
|
||||
ret_value = H5_SUCCESS;
|
||||
if (f->iteration_gid >= 0) {
|
||||
TRY (ret_value = hdf5_flush (f->iteration_gid, H5F_SCOPE_LOCAL));
|
||||
}
|
||||
H5_RETURN (ret_value);
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
@@ -601,22 +640,24 @@ h5_flush_file (
|
||||
) {
|
||||
h5_file_p f = (h5_file_p)f_;
|
||||
H5_CORE_API_ENTER (h5_err_t, "f=%p", f);
|
||||
H5_CORE_API_RETURN (hdf5_flush (f->file, H5F_SCOPE_GLOBAL));
|
||||
check_file_is_writable (f);
|
||||
TRY (ret_value = hdf5_flush (f->file, H5F_SCOPE_GLOBAL));
|
||||
H5_RETURN (ret_value);
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
\ingroup h5_core_filehandling
|
||||
|
||||
Define format of the step names.
|
||||
Define format of the iteration names.
|
||||
|
||||
Example: ==H5FedDefineStepNameFormat( f, "Step", 6 )== defines step names
|
||||
like ==Step#000042==.
|
||||
Example: ==h5_set_iteration_name_fmt (f, "Step", 6)==
|
||||
defines iteration names like ==Step#000042==.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
h5_set_stepname_fmt (
|
||||
h5_set_iteration_name_fmt (
|
||||
const h5_file_t f_,
|
||||
const char* name,
|
||||
int width
|
||||
@@ -625,30 +666,31 @@ h5_set_stepname_fmt (
|
||||
H5_CORE_API_ENTER (h5_err_t,
|
||||
"f=%p, name='%s', width=%d",
|
||||
f, name, width);
|
||||
check_file_handle_is_valid (f);
|
||||
if (width < 0) width = 0;
|
||||
else if (width > H5_STEPNAME_LEN - 1) width = H5_STEPNAME_LEN - 1;
|
||||
else if (width > H5_ITERATION_NAME_LEN - 1) width = H5_ITERATION_NAME_LEN - 1;
|
||||
strncpy (
|
||||
f->props->prefix_step_name,
|
||||
f->props->prefix_iteration_name,
|
||||
name,
|
||||
H5_STEPNAME_LEN - 1);
|
||||
f->props->width_step_idx = width;
|
||||
H5_ITERATION_NAME_LEN - 1);
|
||||
f->props->width_iteration_idx = width;
|
||||
|
||||
H5_CORE_API_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5_core_filehandling
|
||||
|
||||
Get format of the step names.
|
||||
Get format of the iteration names.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
h5_get_stepname_fmt (
|
||||
h5_get_iteration_name_fmt (
|
||||
const h5_file_t f_, /*!< Handle to file */
|
||||
char* name, /*!< OUT: Prefix */
|
||||
int l_name, /*!< length of buffer name */
|
||||
int* width /*!< OUT: Width of the number */
|
||||
char* const name, /*!< OUT: Prefix */
|
||||
const int l_name, /*!< length of buffer name */
|
||||
int* const width /*!< OUT: Width of the number */
|
||||
) {
|
||||
h5_file_p f = (h5_file_p)f_;
|
||||
UNUSED_ARGUMENT (f);
|
||||
@@ -661,17 +703,18 @@ h5_get_stepname_fmt (
|
||||
/*!
|
||||
\ingroup h5_core_filehandling
|
||||
|
||||
Get current step number.
|
||||
Get current iteration number.
|
||||
|
||||
\return Current step number or error code
|
||||
\return Current iteration number or error code
|
||||
*/
|
||||
h5_id_t
|
||||
h5_get_step (
|
||||
h5_get_iteration (
|
||||
const h5_file_t f_ /*!< file handle */
|
||||
) {
|
||||
h5_file_p f = (h5_file_p)f_;
|
||||
H5_CORE_API_ENTER (h5_id_t, "f=%p", f);
|
||||
H5_CORE_API_RETURN (f->step_idx);
|
||||
check_iteration_is_readable (f);
|
||||
H5_RETURN (f->iteration_idx);
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -687,40 +730,42 @@ h5_get_num_procs (
|
||||
) {
|
||||
h5_file_p f = (h5_file_p)f_;
|
||||
H5_CORE_API_ENTER (int, "f=%p", f);
|
||||
H5_CORE_API_RETURN (f->nprocs);
|
||||
check_file_handle_is_valid (f);
|
||||
H5_RETURN (f->nprocs);
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5_core_filehandling
|
||||
|
||||
Get number of steps.
|
||||
Get number of iterations.
|
||||
|
||||
\return Number of steps or error code
|
||||
\return Number of iterations or error code
|
||||
*/
|
||||
h5_ssize_t
|
||||
h5_get_num_steps(
|
||||
h5_get_num_iterations (
|
||||
const h5_file_t f_ /*!< file handle */
|
||||
) {
|
||||
h5_file_p f = (h5_file_p)f_;
|
||||
H5_CORE_API_ENTER (int, "f=%p", f);
|
||||
H5_CORE_API_RETURN (hdf5_get_num_groups_matching_prefix (
|
||||
f->root_gid,
|
||||
f->props->prefix_step_name));
|
||||
check_file_handle_is_valid (f);
|
||||
TRY (ret_value = hdf5_get_num_groups_matching_prefix (
|
||||
f->root_gid,
|
||||
f->props->prefix_iteration_name));
|
||||
H5_RETURN (ret_value);
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5_core_filehandling
|
||||
|
||||
Start traversing steps.
|
||||
Start traversing iterations.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
h5_start_traverse_steps (
|
||||
h5_start_traverse_iterations (
|
||||
const h5_file_t f_ /*!< file handle */
|
||||
) {
|
||||
h5_file_p f = (h5_file_p)f_;
|
||||
H5_CORE_API_ENTER (int, "f=%p", f);
|
||||
H5_CORE_API_ENTER (int, "f=%p", (void*)f_);
|
||||
|
||||
/*
|
||||
fast test: Does Step#0 or Step#1 exist?
|
||||
@@ -728,18 +773,18 @@ h5_start_traverse_steps (
|
||||
loop over all steps and get smallest step number
|
||||
*/
|
||||
|
||||
H5_CORE_API_RETURN (h5_error_not_implemented ());
|
||||
H5_RETURN (h5_error_not_implemented ());
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5_core_filehandling
|
||||
|
||||
Go to next step.
|
||||
Go to next iteration.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
h5_traverse_steps (
|
||||
h5_traverse_iterations (
|
||||
const h5_file_t f_ /*!< file handle */
|
||||
) {
|
||||
h5_file_p f = (h5_file_p)f_;
|
||||
|
||||
+165
-65
@@ -14,15 +14,12 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "h5core/h5_init.h"
|
||||
#include "private/h5_hdf5.h"
|
||||
|
||||
#include "private/h5_mpi.h"
|
||||
#include "private/h5t_types.h"
|
||||
#include "private/h5t_tags.h"
|
||||
|
||||
|
||||
|
||||
int h5_initialized = 0;
|
||||
h5_dta_types_t h5_dta_types; // type ids' for base & compound data types
|
||||
int h5_myproc = 0; // proc id
|
||||
@@ -39,37 +36,50 @@ create_array_types (
|
||||
hsize_t dims[1] = { 3 };
|
||||
TRY(
|
||||
h5_dta_types.h5_coord3d_t = hdf5_create_array_type (
|
||||
H5_FLOAT64_T,
|
||||
H5_FLOAT64,
|
||||
1,
|
||||
dims)
|
||||
);
|
||||
TRY(
|
||||
h5_dta_types.h5_3glb_idx_t = hdf5_create_array_type (
|
||||
H5_ID_T,
|
||||
H5_ID,
|
||||
1,
|
||||
dims)
|
||||
);
|
||||
dims[0] = 4;
|
||||
TRY(
|
||||
h5_dta_types.h5_4glb_idx_t = hdf5_create_array_type (
|
||||
H5_ID_T,
|
||||
H5_ID,
|
||||
1,
|
||||
dims)
|
||||
);
|
||||
TRY(
|
||||
h5_dta_types.h5_4chk_idx_t = hdf5_create_array_type (
|
||||
H5_INT32_T,
|
||||
H5_INT32,
|
||||
1,
|
||||
dims)
|
||||
);
|
||||
dims[0] = 6;
|
||||
TRY(
|
||||
h5_dta_types.h5_coord6d_t = hdf5_create_array_type (
|
||||
H5_FLOAT64_T,
|
||||
H5_FLOAT64,
|
||||
1,
|
||||
dims)
|
||||
);
|
||||
H5_PRIV_FUNC_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
static inline h5_err_t
|
||||
close_array_types (
|
||||
void
|
||||
) {
|
||||
H5_PRIV_FUNC_ENTER (h5_err_t, "%s", "void");
|
||||
TRY (hdf5_close_type (h5_dta_types.h5_coord3d_t));
|
||||
TRY (hdf5_close_type (h5_dta_types.h5_3glb_idx_t));
|
||||
TRY (hdf5_close_type (h5_dta_types.h5_4glb_idx_t));
|
||||
TRY (hdf5_close_type (h5_dta_types.h5_4chk_idx_t));
|
||||
TRY (hdf5_close_type (h5_dta_types.h5_coord6d_t));
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
static inline h5_err_t
|
||||
@@ -80,14 +90,14 @@ create_vertex_type (
|
||||
|
||||
TRY(
|
||||
h5_dta_types.h5_vertex_t = hdf5_create_type (
|
||||
H5_COMPOUND_T,
|
||||
H5T_COMPOUND,
|
||||
sizeof (h5_glb_vertex_t)) );
|
||||
TRY(
|
||||
hdf5_insert_type (
|
||||
h5_dta_types.h5_vertex_t,
|
||||
"idx",
|
||||
HOFFSET (h5_glb_vertex_t, idx),
|
||||
H5_ID_T) );
|
||||
H5_ID) );
|
||||
TRY(
|
||||
hdf5_insert_type (
|
||||
h5_dta_types.h5_vertex_t,
|
||||
@@ -95,9 +105,19 @@ create_vertex_type (
|
||||
HOFFSET (h5_glb_vertex_t, P),
|
||||
h5_dta_types.h5_coord3d_t) );
|
||||
|
||||
H5_PRIV_FUNC_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
static inline h5_err_t
|
||||
close_vertex_type (
|
||||
void
|
||||
) {
|
||||
H5_PRIV_FUNC_ENTER (h5_err_t, "%s", "void");
|
||||
TRY (hdf5_close_type (h5_dta_types.h5_vertex_t));
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
|
||||
static inline h5_err_t
|
||||
create_triangle_type (
|
||||
void
|
||||
@@ -106,44 +126,44 @@ create_triangle_type (
|
||||
|
||||
TRY(
|
||||
h5_dta_types.h5_triangle_t = hdf5_create_type (
|
||||
H5_COMPOUND_T,
|
||||
H5T_COMPOUND,
|
||||
sizeof (h5_glb_tri_t)) );
|
||||
TRY(
|
||||
hdf5_insert_type (
|
||||
h5_dta_types.h5_triangle_t,
|
||||
"idx",
|
||||
HOFFSET (h5_glb_tri_t, idx),
|
||||
H5_ID_T) );
|
||||
H5_ID) );
|
||||
TRY(
|
||||
hdf5_insert_type (
|
||||
h5_dta_types.h5_triangle_t,
|
||||
"parent_idx",
|
||||
HOFFSET (h5_glb_tri_t, parent_idx),
|
||||
H5_ID_T) );
|
||||
H5_ID) );
|
||||
TRY(
|
||||
hdf5_insert_type (
|
||||
h5_dta_types.h5_triangle_t,
|
||||
"child_idx",
|
||||
HOFFSET(h5_glb_tri_t, child_idx),
|
||||
H5_ID_T) );
|
||||
H5_ID) );
|
||||
TRY(
|
||||
hdf5_insert_type (
|
||||
h5_dta_types.h5_triangle_t,
|
||||
"level_idx",
|
||||
HOFFSET(h5_glb_tri_t, level_idx),
|
||||
H5_INT16_T) );
|
||||
H5_INT16) );
|
||||
TRY(
|
||||
hdf5_insert_type (
|
||||
h5_dta_types.h5_triangle_t,
|
||||
"refinement",
|
||||
HOFFSET(h5_glb_tri_t, refinement),
|
||||
H5_INT16_T) );
|
||||
H5_INT16) );
|
||||
TRY(
|
||||
hdf5_insert_type (
|
||||
h5_dta_types.h5_triangle_t,
|
||||
"flags",
|
||||
HOFFSET(h5_glb_tri_t, flags),
|
||||
H5_INT32_T) );
|
||||
H5_INT32) );
|
||||
TRY(
|
||||
hdf5_insert_type (
|
||||
h5_dta_types.h5_triangle_t,
|
||||
@@ -157,33 +177,51 @@ create_triangle_type (
|
||||
HOFFSET(h5_glb_tri_t, neighbor_indices),
|
||||
h5_dta_types.h5_3glb_idx_t) );
|
||||
|
||||
H5_PRIV_FUNC_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
static inline h5_err_t
|
||||
create_tag_types (
|
||||
close_triangle_type (
|
||||
void
|
||||
) {
|
||||
H5_PRIV_FUNC_ENTER (h5_err_t, "%s", "void");
|
||||
TRY (hdf5_close_type (h5_dta_types.h5_triangle_t));
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
static inline h5_err_t
|
||||
create_tag_type (
|
||||
void
|
||||
) {
|
||||
H5_PRIV_FUNC_ENTER (h5_err_t, "%s", "void");
|
||||
|
||||
TRY (
|
||||
h5_dta_types.h5t_glb_tag_idx_t = hdf5_create_type (
|
||||
H5_COMPOUND_T,
|
||||
H5T_COMPOUND,
|
||||
sizeof (h5t_glb_tag_idx_t)) );
|
||||
TRY (
|
||||
hdf5_insert_type (
|
||||
h5_dta_types.h5t_glb_tag_idx_t,
|
||||
"eid",
|
||||
HOFFSET (h5t_glb_tag_idx_t, eid),
|
||||
H5_ID_T) );
|
||||
H5_ID) );
|
||||
TRY (
|
||||
hdf5_insert_type (
|
||||
h5_dta_types.h5t_glb_tag_idx_t,
|
||||
"idx",
|
||||
HOFFSET (h5t_glb_tag_idx_t, idx),
|
||||
H5_ID_T) );
|
||||
H5_ID) );
|
||||
|
||||
H5_PRIV_FUNC_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
static inline h5_err_t
|
||||
close_tag_type (
|
||||
void
|
||||
) {
|
||||
H5_PRIV_FUNC_ENTER (h5_err_t, "%s", "void");
|
||||
TRY (hdf5_close_type (h5_dta_types.h5t_glb_tag_idx_t));
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
static inline h5_err_t
|
||||
@@ -194,44 +232,44 @@ create_tet_type (
|
||||
|
||||
TRY(
|
||||
h5_dta_types.h5_tet_t = hdf5_create_type (
|
||||
H5_COMPOUND_T,
|
||||
H5T_COMPOUND,
|
||||
sizeof (h5_glb_tet_t)) );
|
||||
TRY(
|
||||
hdf5_insert_type (
|
||||
h5_dta_types.h5_tet_t,
|
||||
"idx",
|
||||
HOFFSET (h5_glb_tet_t, idx),
|
||||
H5_ID_T) );
|
||||
H5_ID) );
|
||||
TRY(
|
||||
hdf5_insert_type (
|
||||
h5_dta_types.h5_tet_t,
|
||||
"parent_idx",
|
||||
HOFFSET (h5_glb_tet_t, parent_idx),
|
||||
H5_ID_T) );
|
||||
H5_ID) );
|
||||
TRY(
|
||||
hdf5_insert_type (
|
||||
h5_dta_types.h5_tet_t,
|
||||
"child_idx",
|
||||
HOFFSET (h5_glb_tet_t, child_idx),
|
||||
H5T_NATIVE_INT32) );
|
||||
H5_INT32) );
|
||||
TRY(
|
||||
hdf5_insert_type (
|
||||
h5_dta_types.h5_tet_t,
|
||||
"level_idx",
|
||||
HOFFSET(h5_glb_tet_t, level_idx),
|
||||
H5_INT16_T) );
|
||||
H5_INT16) );
|
||||
TRY(
|
||||
hdf5_insert_type (
|
||||
h5_dta_types.h5_tet_t,
|
||||
"refinement",
|
||||
HOFFSET(h5_glb_tet_t, refinement),
|
||||
H5_INT16_T) );
|
||||
H5_INT16) );
|
||||
TRY(
|
||||
hdf5_insert_type (
|
||||
h5_dta_types.h5_tet_t,
|
||||
"flags",
|
||||
HOFFSET(h5_glb_tet_t, flags),
|
||||
H5_INT32_T) );
|
||||
H5_INT32) );
|
||||
TRY(
|
||||
hdf5_insert_type (
|
||||
h5_dta_types.h5_tet_t,
|
||||
@@ -245,7 +283,16 @@ create_tet_type (
|
||||
HOFFSET (h5_glb_tet_t, neighbor_indices),
|
||||
h5_dta_types.h5_4glb_idx_t) );
|
||||
|
||||
H5_PRIV_FUNC_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
static inline h5_err_t
|
||||
close_tet_type (
|
||||
void
|
||||
) {
|
||||
H5_PRIV_FUNC_ENTER (h5_err_t, "%s", "void");
|
||||
TRY (hdf5_close_type (h5_dta_types.h5_tet_t));
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
#if defined(WITH_PARALLEL_H5GRID)
|
||||
@@ -257,53 +304,63 @@ create_chunk_type (
|
||||
H5_PRIV_FUNC_ENTER (h5_err_t, "%s", "void");
|
||||
TRY(
|
||||
h5_dta_types.h5_chunk_t = hdf5_create_type (
|
||||
H5_COMPOUND_T,
|
||||
H5T_COMPOUND,
|
||||
sizeof (h5t_chunk_t)) );
|
||||
TRY(
|
||||
hdf5_insert_type (
|
||||
h5_dta_types.h5_chunk_t,
|
||||
"idx",
|
||||
HOFFSET (h5t_chunk_t, idx),
|
||||
H5_INT32_T) );
|
||||
H5_INT32) );
|
||||
TRY(
|
||||
hdf5_insert_type (
|
||||
h5_dta_types.h5_chunk_t,
|
||||
"oct_idx",
|
||||
HOFFSET (h5t_chunk_t, oct_idx),
|
||||
H5_INT32_T) );
|
||||
H5_INT32) );
|
||||
TRY(
|
||||
hdf5_insert_type (
|
||||
h5_dta_types.h5_chunk_t,
|
||||
"elem",
|
||||
HOFFSET (h5t_chunk_t, elem),
|
||||
H5_ID_T) );
|
||||
H5_ID) );
|
||||
TRY(
|
||||
hdf5_insert_type (
|
||||
h5_dta_types.h5_chunk_t,
|
||||
"weight",
|
||||
HOFFSET (h5t_chunk_t, weight),
|
||||
H5_ID_T) );
|
||||
H5_ID) );
|
||||
TRY(
|
||||
hdf5_insert_type (
|
||||
h5_dta_types.h5_chunk_t,
|
||||
"num_elems",
|
||||
HOFFSET (h5t_chunk_t, num_elems),
|
||||
H5_UINT16_T) );
|
||||
H5_UINT16) );
|
||||
// TRY(
|
||||
// hdf5_insert_type (
|
||||
// h5_dta_types.h5_chunk_t,
|
||||
// "vtx",
|
||||
// HOFFSET (h5t_chunk_t, vtx),
|
||||
// H5_INT64_T) );
|
||||
// H5_INT64) );
|
||||
// TRY(
|
||||
// hdf5_insert_type (
|
||||
// h5_dta_types.h5_chunk_t,
|
||||
// "num_vtx",
|
||||
// HOFFSET (h5t_chunk_t, num_vtx),
|
||||
// H5_INT64_T) );
|
||||
H5_PRIV_FUNC_RETURN (H5_SUCCESS);
|
||||
// H5_INT64) );
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
static inline h5_err_t
|
||||
close_chunk_type (
|
||||
void
|
||||
) {
|
||||
H5_PRIV_FUNC_ENTER (h5_err_t, "%s", "void");
|
||||
TRY (hdf5_close_type (h5_dta_types.h5_chunk_t));
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
|
||||
static inline h5_err_t
|
||||
create_octree_type (
|
||||
void
|
||||
@@ -311,32 +368,32 @@ create_octree_type (
|
||||
H5_PRIV_FUNC_ENTER (h5_err_t, "%s", "void");
|
||||
TRY(
|
||||
h5_dta_types.h5_octree_t = hdf5_create_type (
|
||||
H5_COMPOUND_T,
|
||||
H5T_COMPOUND,
|
||||
sizeof (h5t_octant_t)) );
|
||||
TRY(
|
||||
hdf5_insert_type (
|
||||
h5_dta_types.h5_octree_t,
|
||||
"idx",
|
||||
HOFFSET (h5t_octant_t, idx),
|
||||
H5_INT32_T) );
|
||||
H5_INT32) );
|
||||
TRY(
|
||||
hdf5_insert_type (
|
||||
h5_dta_types.h5_octree_t,
|
||||
"parent_idx",
|
||||
HOFFSET (h5t_octant_t, parent_idx),
|
||||
H5_INT32_T) );
|
||||
H5_INT32) );
|
||||
TRY(
|
||||
hdf5_insert_type (
|
||||
h5_dta_types.h5_octree_t,
|
||||
"child_idx",
|
||||
HOFFSET (h5t_octant_t, child_idx),
|
||||
H5_INT32_T) );
|
||||
H5_INT32) );
|
||||
TRY(
|
||||
hdf5_insert_type (
|
||||
h5_dta_types.h5_octree_t,
|
||||
"level_idx",
|
||||
HOFFSET (h5t_octant_t, level_idx),
|
||||
H5_INT16_T) );
|
||||
H5_INT16) );
|
||||
// TRY(
|
||||
// hdf5_insert_type (
|
||||
// h5_dta_types.h5_octree_t,
|
||||
@@ -348,9 +405,18 @@ create_octree_type (
|
||||
h5_dta_types.h5_octree_t,
|
||||
"userlevels",
|
||||
HOFFSET (h5t_octant_t, userlevels),
|
||||
H5_INT32_T) );
|
||||
H5_INT32) );
|
||||
|
||||
H5_PRIV_FUNC_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
static inline h5_err_t
|
||||
close_octree_type (
|
||||
void
|
||||
) {
|
||||
H5_PRIV_FUNC_ENTER (h5_err_t, "%s", "void");
|
||||
TRY (hdf5_close_type (h5_dta_types.h5_octree_t));
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
static inline h5_err_t
|
||||
@@ -360,7 +426,7 @@ create_userdata_type (
|
||||
H5_PRIV_FUNC_ENTER (h5_err_t, "%s", "void");
|
||||
TRY(
|
||||
h5_dta_types.h5_userdata_t = hdf5_create_type (
|
||||
H5_COMPOUND_T,
|
||||
H5T_COMPOUND,
|
||||
sizeof (h5t_oct_userdata_t)) );
|
||||
TRY(
|
||||
hdf5_insert_type (
|
||||
@@ -369,7 +435,16 @@ create_userdata_type (
|
||||
HOFFSET (h5t_oct_userdata_t, idx),
|
||||
h5_dta_types.h5_4chk_idx_t) );
|
||||
|
||||
H5_PRIV_FUNC_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
static inline h5_err_t
|
||||
close_userdata_type (
|
||||
void
|
||||
) {
|
||||
H5_PRIV_FUNC_ENTER (h5_err_t, "%s", "void");
|
||||
TRY (hdf5_close_type (h5_dta_types.h5_userdata_t));
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
static inline h5_err_t
|
||||
@@ -442,7 +517,7 @@ create_mpi_type_glb_tet (
|
||||
// commit new type
|
||||
TRY (h5priv_mpi_type_commit (&h5_dta_types.mpi_glb_tet));
|
||||
|
||||
H5_PRIV_FUNC_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
static inline h5_err_t
|
||||
@@ -515,7 +590,7 @@ create_mpi_type_glb_tri (
|
||||
// commit new type
|
||||
TRY (h5priv_mpi_type_commit (&h5_dta_types.mpi_glb_triangle));
|
||||
|
||||
H5_PRIV_FUNC_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
static inline h5_err_t
|
||||
create_mpi_type_glb_vtx (
|
||||
@@ -551,7 +626,7 @@ create_mpi_type_glb_vtx (
|
||||
// commit new type
|
||||
TRY (h5priv_mpi_type_commit (&h5_dta_types.mpi_glb_vtx));
|
||||
|
||||
H5_PRIV_FUNC_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
static inline h5_err_t
|
||||
@@ -600,7 +675,7 @@ create_mpi_type_edge_list_elem (
|
||||
// commit new type
|
||||
TRY (h5priv_mpi_type_commit (&h5_dta_types.mpi_edge_list_elem));
|
||||
|
||||
H5_PRIV_FUNC_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
static inline h5_err_t
|
||||
create_mpi_type_chunk (
|
||||
@@ -655,7 +730,7 @@ create_mpi_type_chunk (
|
||||
// commit new type
|
||||
TRY (h5priv_mpi_type_commit (&h5_dta_types.mpi_chunk));
|
||||
|
||||
H5_PRIV_FUNC_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -669,25 +744,32 @@ h5_err_t
|
||||
h5_initialize (
|
||||
void
|
||||
) {
|
||||
h5_initialized = 1;
|
||||
if (h5_initialized) return 0;
|
||||
memset (&h5_call_stack, 0, sizeof (h5_call_stack));
|
||||
H5_CORE_API_ENTER (h5_err_t, "%s", "void");
|
||||
// must be set here, otherwise next statement will fail!
|
||||
h5_initialized = 1;
|
||||
H5_PRIV_FUNC_ENTER (h5_err_t, "%s", "void");
|
||||
ret_value = H5_SUCCESS;
|
||||
#ifdef PARALLEL_IO
|
||||
#ifdef H5_HAVE_PARALLEL
|
||||
int mpi_is_initialized;
|
||||
MPI_Initialized (&mpi_is_initialized);
|
||||
if (!mpi_is_initialized) {
|
||||
MPI_Init (NULL, NULL);
|
||||
}
|
||||
if (h5priv_mpi_comm_rank (MPI_COMM_WORLD, &h5_myproc) < 0) {
|
||||
exit (42);
|
||||
}
|
||||
#endif
|
||||
h5_dta_types.h5_glb_idx_t = H5_INT64_T;
|
||||
h5_dta_types.h5_int64_t = H5_INT64_T;
|
||||
h5_dta_types.h5_float64_t = H5_FLOAT64_T;
|
||||
h5_dta_types.h5_int32_t = H5_INT32_T;
|
||||
h5_dta_types.h5_glb_idx_t = H5_INT64;
|
||||
h5_dta_types.h5_int64_t = H5_INT64;
|
||||
h5_dta_types.h5_float64_t = H5_FLOAT64;
|
||||
h5_dta_types.h5_int32_t = H5_INT32;
|
||||
|
||||
TRY (create_array_types ());
|
||||
TRY (create_vertex_type ());
|
||||
TRY (create_triangle_type ());
|
||||
TRY (create_tet_type ());
|
||||
TRY (create_tag_types ());
|
||||
TRY (create_tag_type ());
|
||||
|
||||
#if defined(WITH_PARALLEL_H5GRID)
|
||||
TRY (create_chunk_type ());
|
||||
@@ -700,5 +782,23 @@ h5_initialize (
|
||||
TRY (create_mpi_type_chunk ());
|
||||
TRY (create_mpi_type_edge_list_elem());
|
||||
#endif
|
||||
H5_CORE_API_RETURN ((ret_value != H5_SUCCESS) ? _h5_exit (42) : H5_SUCCESS);
|
||||
H5_RETURN ((ret_value != H5_SUCCESS) ? _h5_exit (42) : H5_SUCCESS);
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
h5_finalize (
|
||||
void
|
||||
) {
|
||||
H5_PRIV_FUNC_ENTER (h5_err_t, "%s", "void");
|
||||
TRY (close_array_types ());
|
||||
TRY (close_vertex_type ());
|
||||
TRY (close_triangle_type ());
|
||||
TRY (close_tag_type ());
|
||||
TRY (close_tet_type ());
|
||||
#if defined(WITH_PARALLEL_H5GRID)
|
||||
TRY (close_chunk_type ());
|
||||
TRY (close_octree_type ());
|
||||
TRY (close_userdata_type ());
|
||||
#endif
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,150 @@
|
||||
/*
|
||||
Copyright (c) 2006-2016, The Regents of the University of California,
|
||||
through Lawrence Berkeley National Laboratory (subject to receipt of any
|
||||
required approvals from the U.S. Dept. of Energy) and the Paul Scherrer
|
||||
Institut (Switzerland). All rights reserved.
|
||||
|
||||
License: see file COPYING in top level of source distribution.
|
||||
*/
|
||||
|
||||
#include "h5core/h5_log.h"
|
||||
#include "h5core/h5_err.h"
|
||||
|
||||
extern int h5_myproc;
|
||||
|
||||
|
||||
h5_int64_t __h5_log_level = H5_VERBOSE_ERROR;
|
||||
h5_int64_t __h5_debug_mask = 0;
|
||||
|
||||
struct call_stack h5_call_stack;
|
||||
|
||||
char *h5_rfmts[] = {
|
||||
[e_int] = "%d",
|
||||
[e_ssize_t] = "%ld",
|
||||
[e_char_p] = "%s",
|
||||
[e_void_p] = "%p",
|
||||
[e_h5_err_t] = "%lld",
|
||||
[e_h5_int32_t] = "%ld",
|
||||
[e_h5_uint32_t] = "%lu",
|
||||
[e_h5_int64_t] = "%lld",
|
||||
[e_h5_uint64_t] = "%llu",
|
||||
[e_h5_id_t] = "%lld",
|
||||
[e_h5_ssize_t] = "%lld",
|
||||
[e_h5_errorhandler_t] = "%p",
|
||||
[e_h5_file_p] = "%p",
|
||||
[e_h5_file_t] = "0x%08x",
|
||||
[e_h5_lvl_idx_t] = "%d",
|
||||
[e_h5t_iterator_p] = "%p",
|
||||
[e_h5_loc_id_t] = "%ld",
|
||||
[e_h5_loc_idx_t] = "%ld",
|
||||
[e_hid_t] = "%lld",
|
||||
[e_H5O_type_t] = "%ld",
|
||||
[e_h5_glb_elem_p] = "%p",
|
||||
[e_h5_prop_p] = "%p",
|
||||
[e_h5_prop_t] = "0x%08x",
|
||||
[e_h5_prop_file_p] = "%p",
|
||||
[e_h5_prop_file_t] = "0x%08x",
|
||||
[e_herr_t] = "%ld"
|
||||
};
|
||||
|
||||
/*!
|
||||
\ingroup h5_core_errorhandling
|
||||
|
||||
Set debug/verbosity level. On level 0 all output will be supressed (even
|
||||
error messages). On level 1 error messages, on level 2 warning messages
|
||||
and on level 3 informational messages will be printed. On level 4 debug
|
||||
messages will be printed.
|
||||
|
||||
Values less than 0 are equivalent to 0. Values greater than 4 are equivalent
|
||||
to 4.
|
||||
|
||||
\return \c H5_SUCCESS on success.
|
||||
\return \c H5_ERR_INVAL if debug level is invalid.
|
||||
*/
|
||||
h5_err_t
|
||||
h5_set_loglevel (
|
||||
const h5_int64_t level /*!< log level */
|
||||
) {
|
||||
__h5_log_level = level & 0x7;
|
||||
return H5_SUCCESS;
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
h5_set_debug_mask (
|
||||
const h5_int64_t mask /*!< debug level */
|
||||
) {
|
||||
__h5_debug_mask = mask;
|
||||
return H5_SUCCESS;
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5_core_errorhandling
|
||||
|
||||
Get current debug/verbosity level.
|
||||
|
||||
\return current debug level
|
||||
*/
|
||||
h5_int64_t
|
||||
h5_get_loglevel (
|
||||
void
|
||||
) {
|
||||
return __h5_log_level;
|
||||
}
|
||||
|
||||
void
|
||||
h5priv_vprintf (
|
||||
FILE* f,
|
||||
const char* prefix,
|
||||
const char* __funcname,
|
||||
const char* fmt,
|
||||
va_list ap
|
||||
) {
|
||||
char fmt2[2048];
|
||||
snprintf (fmt2, sizeof(fmt2), "[proc %d] %s: %s: %s\n", h5_myproc, prefix,
|
||||
__funcname, fmt);
|
||||
vfprintf (f, fmt2, ap);
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
h5_warn (
|
||||
const char* fmt,
|
||||
...
|
||||
) {
|
||||
if (__h5_log_level >= 2) {
|
||||
va_list ap;
|
||||
va_start (ap, fmt);
|
||||
h5priv_vprintf (stderr, "W", h5_get_funcname(), fmt, ap);
|
||||
va_end (ap);
|
||||
}
|
||||
return H5_NOK;
|
||||
}
|
||||
|
||||
void
|
||||
h5_info (
|
||||
const char* fmt,
|
||||
...
|
||||
) {
|
||||
if (__h5_log_level >= 3) {
|
||||
va_list ap;
|
||||
va_start (ap, fmt);
|
||||
h5priv_vprintf (stdout, "I", h5_get_funcname(), fmt, ap);
|
||||
va_end (ap);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
h5_debug (
|
||||
const char* const fmt,
|
||||
...
|
||||
) {
|
||||
if (__h5_log_level >= 4) {
|
||||
char prefix[1024];
|
||||
snprintf (prefix, sizeof(prefix), "%*s %s",
|
||||
h5_call_stack_get_level(), "",
|
||||
h5_call_stack_get_name());
|
||||
va_list ap;
|
||||
va_start (ap, fmt);
|
||||
h5priv_vprintf (stdout, "D", prefix, fmt, ap);
|
||||
va_end (ap);
|
||||
}
|
||||
}
|
||||
+58
-115
@@ -9,162 +9,105 @@
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "h5core/h5_init.h"
|
||||
#include "h5core/h5_model.h"
|
||||
#include "private/h5_types.h"
|
||||
#include "private/h5_hdf5.h"
|
||||
#include "private/h5_model.h"
|
||||
#include "private/h5_mpi.h"
|
||||
#include "private/h5_io.h"
|
||||
#include "private/h5_va_macros.h"
|
||||
|
||||
h5_err_t
|
||||
h5priv_close_step (
|
||||
h5priv_close_iteration (
|
||||
const h5_file_p f
|
||||
) {
|
||||
H5_PRIV_API_ENTER (h5_err_t, "f=%p", f);
|
||||
if (f->step_gid <= 0)
|
||||
H5_PRIV_API_LEAVE (H5_SUCCESS);
|
||||
TRY (hdf5_close_group (f->step_gid));
|
||||
if (f->iteration_gid <= 0)
|
||||
H5_LEAVE (H5_SUCCESS);
|
||||
TRY (hdf5_close_group (f->iteration_gid));
|
||||
|
||||
f->step_gid = -1;
|
||||
f->iteration_gid = -1;
|
||||
|
||||
H5_PRIV_API_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
h5_set_step (
|
||||
h5_set_iteration (
|
||||
const h5_file_t f_, /*!< [in] Handle to open file */
|
||||
const h5_id_t step_idx /*!< [in] Step to set. */
|
||||
const h5_id_t iteration_idx /*!< [in] Iteration to set. */
|
||||
) {
|
||||
h5_file_p f = (h5_file_p)f_;
|
||||
H5_CORE_API_ENTER (h5_err_t,
|
||||
"f=%p, step_idx=%lld",
|
||||
f, (long long)step_idx);
|
||||
TRY (h5priv_close_step (f));
|
||||
f->step_idx = step_idx;
|
||||
"f=%p, iteration_idx=%lld",
|
||||
f, (long long)iteration_idx);
|
||||
CHECK_FILEHANDLE (f);
|
||||
TRY (h5priv_close_iteration (f));
|
||||
f->iteration_idx = iteration_idx;
|
||||
|
||||
sprintf (
|
||||
f->step_name,
|
||||
f->iteration_name,
|
||||
"%s#%0*lld",
|
||||
f->props->prefix_step_name, f->props->width_step_idx,
|
||||
(long long) f->step_idx);
|
||||
f->props->prefix_iteration_name, f->props->width_iteration_idx,
|
||||
(long long) f->iteration_idx);
|
||||
h5_info (
|
||||
"Open step #%lld for file %lld",
|
||||
(long long)f->step_idx,
|
||||
"Open iteration #%lld in file %lld",
|
||||
(long long)f->iteration_idx,
|
||||
(long long)(size_t) f);
|
||||
|
||||
TRY (f->step_gid = h5priv_open_group (is_writable(f),
|
||||
f->file,
|
||||
f->step_name));
|
||||
H5_CORE_API_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
/*!
|
||||
Normalize HDF5 type
|
||||
*/
|
||||
h5_int64_t
|
||||
h5priv_normalize_h5_type (
|
||||
hid_t type
|
||||
) {
|
||||
H5_CORE_API_ENTER (h5_int64_t,
|
||||
"type=%lld",
|
||||
(long long int)type);
|
||||
H5T_class_t tclass;
|
||||
int size;
|
||||
TRY (tclass = H5Tget_class (type));
|
||||
TRY (size = H5Tget_size (type));
|
||||
|
||||
switch (tclass){
|
||||
case H5T_INTEGER:
|
||||
if (size==8) {
|
||||
H5_CORE_API_LEAVE (H5_INT64_T);
|
||||
} else if (size==4) {
|
||||
H5_CORE_API_LEAVE (H5_INT32_T);
|
||||
} else if (size==2) {
|
||||
H5_CORE_API_LEAVE (H5_INT16_T);
|
||||
}
|
||||
break;
|
||||
case H5T_FLOAT:
|
||||
if ( size==8 ) {
|
||||
H5_CORE_API_LEAVE (H5_FLOAT64_T);
|
||||
}
|
||||
else if ( size==4 ) {
|
||||
H5_CORE_API_LEAVE (H5_FLOAT32_T);
|
||||
}
|
||||
break;
|
||||
case H5T_STRING:
|
||||
H5_CORE_API_LEAVE (H5_STRING_T);
|
||||
default:
|
||||
; /* NOP */
|
||||
h5_err_t exists;
|
||||
TRY (exists = hdf5_link_exists (f->file, f->iteration_name));
|
||||
if (exists) {
|
||||
TRY (f->iteration_gid = h5priv_open_group (
|
||||
f->file,
|
||||
f->iteration_name));
|
||||
} else if (is_writable (f)) {
|
||||
TRY (f->iteration_gid = h5priv_create_group (
|
||||
f->file,
|
||||
f->iteration_name));
|
||||
}
|
||||
H5_CORE_API_RETURN (h5_warn ("Unknown type %d", (int)type));
|
||||
}
|
||||
|
||||
h5_int64_t
|
||||
h5priv_get_dataset_type(
|
||||
const hid_t group_id,
|
||||
const char* dset_name
|
||||
) {
|
||||
H5_CORE_API_ENTER (h5_int64_t,
|
||||
"group_id=%lld, dset_name='%s'",
|
||||
(long long int)group_id, dset_name);
|
||||
hid_t dset_id;
|
||||
hid_t hdf5_type;
|
||||
h5_int64_t type;
|
||||
TRY (dset_id = hdf5_open_dataset (group_id, dset_name));
|
||||
TRY (hdf5_type = hdf5_get_dataset_type (dset_id));
|
||||
TRY (type = h5priv_normalize_h5_type (hdf5_type));
|
||||
TRY (hdf5_close_type (hdf5_type));
|
||||
TRY (hdf5_close_dataset (dset_id));
|
||||
|
||||
H5_CORE_API_RETURN (type);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
/*
|
||||
returns:
|
||||
TRUE (value > 0): if step exists
|
||||
FALSE (i.e. 0): if step does not exist
|
||||
TRUE (value > 0): if iteration exists
|
||||
FALSE (i.e. 0): if iteration does not exist
|
||||
H5_FAILURE: on error
|
||||
*/
|
||||
h5_err_t
|
||||
h5_has_step (
|
||||
h5_has_iteration (
|
||||
const h5_file_t f_, /*!< [in] Handle to open file */
|
||||
const h5_id_t step_idx /*!< [in] Step number to query */
|
||||
const h5_id_t iteration_idx /*!< [in] Step number to query */
|
||||
) {
|
||||
h5_file_p f = (h5_file_p)f_;
|
||||
H5_CORE_API_ENTER (h5_err_t, "f=%p, step_idx=%lld", f, (long long)step_idx);
|
||||
char name[2*H5_STEPNAME_LEN];
|
||||
H5_CORE_API_ENTER (h5_err_t,
|
||||
"f=%p, iteration_idx=%lld",
|
||||
f, (long long)iteration_idx);
|
||||
CHECK_FILEHANDLE (f);
|
||||
char name[2*H5_ITERATION_NAME_LEN];
|
||||
sprintf (name,
|
||||
"%s#%0*lld",
|
||||
f->props->prefix_step_name, f->props->width_step_idx,
|
||||
(long long)step_idx);
|
||||
h5_err_t exists;
|
||||
TRY (exists = hdf5_link_exists (f->file, name));
|
||||
H5_CORE_API_RETURN (exists);
|
||||
f->props->prefix_iteration_name, f->props->width_iteration_idx,
|
||||
(long long)iteration_idx);
|
||||
TRY (ret_value = hdf5_link_exists (f->file, name));
|
||||
H5_RETURN (ret_value);
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
h5priv_normalize_dataset_name (
|
||||
const char *name,
|
||||
char *name2
|
||||
char* const name
|
||||
) {
|
||||
H5_CORE_API_ENTER (h5_err_t, "name='%s', name2='%p'", name, name2);
|
||||
if ( strlen(name) > H5_DATANAME_LEN-1 ) {
|
||||
strncpy ( name2, name, H5_DATANAME_LEN-1 );
|
||||
name2[H5_DATANAME_LEN-1] = '\0';
|
||||
h5_warn ("Truncated name '%s' to '%s'.", name, name2);
|
||||
} else {
|
||||
strcpy ( name2, name );
|
||||
H5_CORE_API_ENTER (h5_err_t, "name='%s'", name);
|
||||
if (strlen(name) > H5_DATANAME_LEN-1) {
|
||||
H5_RETURN_ERROR (
|
||||
H5_ERR_INVAL,
|
||||
"Dataset name '%s' to long! "
|
||||
"Must be less then %d characters.",
|
||||
name, H5_DATANAME_LEN);
|
||||
}
|
||||
|
||||
if ( strcmp( name2, H5BLOCK_GROUPNAME_BLOCK ) == 0 ) {
|
||||
H5_CORE_API_LEAVE (
|
||||
h5_error (
|
||||
H5_ERR_INVAL,
|
||||
"Can't create dataset or field with name '%s'"
|
||||
" because it is reserved by H5Block.",
|
||||
H5BLOCK_GROUPNAME_BLOCK));
|
||||
if (strcmp (name, H5BLOCK_GROUPNAME_BLOCK) == 0) {
|
||||
H5_RETURN_ERROR (
|
||||
H5_ERR_INVAL,
|
||||
"Can't create dataset or field with name '%s'"
|
||||
" because it is reserved by H5Block.",
|
||||
H5BLOCK_GROUPNAME_BLOCK);
|
||||
}
|
||||
H5_CORE_API_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,99 @@
|
||||
/*
|
||||
Copyright (c) 2006-2016, The Regents of the University of California,
|
||||
through Lawrence Berkeley National Laboratory (subject to receipt of any
|
||||
required approvals from the U.S. Dept. of Energy) and the Paul Scherrer
|
||||
Institut (Switzerland). All rights reserved.
|
||||
|
||||
License: see file COPYING in top level of source distribution.
|
||||
*/
|
||||
|
||||
#ifndef __H5CORE_H5_SYSCALL_H
|
||||
#define __H5CORE_H5_SYSCALL_H
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "h5core/h5_types.h"
|
||||
#include "private/h5_log.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define MALLOC_WRAPPER_ENTER(type, fmt, ...) \
|
||||
__FUNC_ENTER(type, H5_DEBUG_MALLOC, fmt, __VA_ARGS__)
|
||||
|
||||
h5_err_t
|
||||
h5_free (
|
||||
void* ptr
|
||||
) {
|
||||
MALLOC_WRAPPER_ENTER (h5_err_t, "ptr=%p", ptr);
|
||||
if (ptr) {
|
||||
free (ptr);
|
||||
}
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
|
||||
void_p
|
||||
h5_alloc (
|
||||
void* ptr,
|
||||
const size_t size
|
||||
) {
|
||||
MALLOC_WRAPPER_ENTER (void_p, "ptr=%p, size=%lu", ptr, size);
|
||||
if (size < 1) {
|
||||
ret_value = (void_p) h5_free (ptr);
|
||||
H5_LEAVE (NULL);
|
||||
}
|
||||
ptr = realloc (ptr, size);
|
||||
if (ptr == NULL) {
|
||||
H5_LEAVE (
|
||||
(void_p)h5_error (
|
||||
H5_ERR_NOMEM,
|
||||
"Out of memory. Tried to alloc %lld", (long long int)size));
|
||||
}
|
||||
H5_RETURN (ptr);
|
||||
}
|
||||
|
||||
void_p
|
||||
h5_calloc (
|
||||
const size_t count,
|
||||
const size_t size
|
||||
) {
|
||||
MALLOC_WRAPPER_ENTER (void_p, "count=%zu , size=%zu", count, size);
|
||||
void* ptr = NULL;
|
||||
if (count * size < 1) {
|
||||
H5_LEAVE (ptr);
|
||||
}
|
||||
ptr = calloc (count, size);
|
||||
if (ptr == NULL) {
|
||||
H5_LEAVE (
|
||||
(void_p)h5_error (
|
||||
H5_ERR_NOMEM,
|
||||
"Out of memory. Tried to alloc %lld", (long long int)count* size));
|
||||
}
|
||||
H5_RETURN (ptr);
|
||||
}
|
||||
|
||||
|
||||
char_p
|
||||
h5_strdup (
|
||||
const char* s1
|
||||
) {
|
||||
MALLOC_WRAPPER_ENTER (char_p, "s='%s'", s1);
|
||||
|
||||
char_p s2 = (char_p)h5_calloc (1, strlen (s1)+1 );
|
||||
if (s2 == NULL) {
|
||||
H5_LEAVE (
|
||||
(char_p)h5_error (
|
||||
H5_ERR_NOMEM,
|
||||
"Out of memory."));
|
||||
}
|
||||
H5_RETURN (strcpy (s2, s1));
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
+75
-91
@@ -6,13 +6,9 @@
|
||||
|
||||
License: see file COPYING in top level of source distribution.
|
||||
*/
|
||||
#include "h5core/h5_init.h"
|
||||
#include "private/h5_log.h"
|
||||
|
||||
#include "private/h5_debug.h"
|
||||
|
||||
#include "private/h5.h"
|
||||
#include "private/h5_hdf5.h"
|
||||
|
||||
#include "private/h5_attribs.h"
|
||||
#include "private/h5b_types.h"
|
||||
#include "private/h5b_model.h"
|
||||
@@ -37,21 +33,25 @@ h5b_write_field_attrib (
|
||||
(long long int)attrib_type,
|
||||
attrib_value,
|
||||
(long long)attrib_nelem);
|
||||
CHECK_FILEHANDLE (f);
|
||||
CHECK_WRITABLE_MODE (f);
|
||||
CHECK_TIMEGROUP (f);
|
||||
check_iteration_is_writable (f);
|
||||
|
||||
TRY( h5bpriv_create_field_group(f, field_name) );
|
||||
|
||||
TRY( h5priv_write_attrib (
|
||||
f->b->field_gid,
|
||||
attrib_name,
|
||||
attrib_type,
|
||||
attrib_value,
|
||||
attrib_nelem,
|
||||
!is_appendonly (f)) );
|
||||
|
||||
H5_CORE_API_RETURN (H5_SUCCESS);
|
||||
if (is_appendonly (f)) {
|
||||
TRY (h5priv_append_attrib (
|
||||
f->b->field_gid,
|
||||
attrib_name,
|
||||
attrib_type,
|
||||
attrib_value,
|
||||
attrib_nelem));
|
||||
} else {
|
||||
TRY( h5priv_write_attrib (
|
||||
f->b->field_gid,
|
||||
attrib_name,
|
||||
attrib_type,
|
||||
attrib_value,
|
||||
attrib_nelem));
|
||||
}
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
@@ -59,7 +59,7 @@ h5b_read_field_attrib (
|
||||
const h5_file_t fh, /*!< IN: file handle */
|
||||
const char *field_name, /*!< IN: field name */
|
||||
const char *attrib_name, /*!< IN: attribute name */
|
||||
const h5_int64_t attrib_type, /*!< IN: attribute type */
|
||||
const h5_types_t attrib_type, /*!< IN: attribute type */
|
||||
void *buffer /*!< OUT: attribute value */
|
||||
) {
|
||||
h5_file_p f = (h5_file_p)fh;
|
||||
@@ -72,18 +72,17 @@ h5b_read_field_attrib (
|
||||
attrib_name,
|
||||
(long long)attrib_type,
|
||||
buffer);
|
||||
CHECK_FILEHANDLE (f);
|
||||
CHECK_TIMEGROUP (f);
|
||||
check_iteration_is_readable (f);
|
||||
|
||||
TRY( h5bpriv_open_field_group(f, field_name) );
|
||||
TRY (h5bpriv_open_field_group(f, field_name));
|
||||
|
||||
TRY( h5priv_read_attrib (
|
||||
f->b->field_gid,
|
||||
attrib_name,
|
||||
attrib_type,
|
||||
buffer) );
|
||||
TRY (h5priv_read_attrib (
|
||||
f->b->field_gid,
|
||||
attrib_name,
|
||||
attrib_type,
|
||||
buffer));
|
||||
|
||||
H5_CORE_API_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
@@ -100,48 +99,14 @@ h5b_has_field_attrib (
|
||||
f,
|
||||
field_name,
|
||||
attrib_name);
|
||||
CHECK_FILEHANDLE (f);
|
||||
CHECK_TIMEGROUP (f);
|
||||
check_iteration_handle_is_valid (f);
|
||||
|
||||
TRY (h5bpriv_open_field_group(f, field_name));
|
||||
|
||||
H5_CORE_API_RETURN (
|
||||
hdf5_attribute_exists (
|
||||
f->b->field_gid,
|
||||
attrib_name) );
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
h5b_get_field_attrib_info_by_name (
|
||||
const h5_file_t fh, /*!< IN: file handle */
|
||||
const char* const field_name, /*!< IN: field name */
|
||||
const char* const attrib_name, /*!< IN: attribute name */
|
||||
h5_int64_t* attrib_type, /*!< OUT: attribute type */
|
||||
h5_size_t* attrib_nelem /*!< OUT: number of elements */
|
||||
) {
|
||||
h5_file_p f = (h5_file_p)fh;
|
||||
H5_CORE_API_ENTER (h5_err_t,
|
||||
"f=%p, "
|
||||
"field_name='%s', "
|
||||
"attrib_name=%s, "
|
||||
"attrib_type=%p, "
|
||||
"attrib_nelem=%p",
|
||||
f,
|
||||
field_name,
|
||||
attrib_name,
|
||||
attrib_type,
|
||||
attrib_nelem);
|
||||
CHECK_FILEHANDLE (f);
|
||||
CHECK_TIMEGROUP (f);
|
||||
|
||||
TRY (h5bpriv_open_field_group(f, field_name));
|
||||
|
||||
H5_CORE_API_RETURN (
|
||||
h5priv_get_attrib_info_by_name (
|
||||
f->b->field_gid,
|
||||
attrib_name,
|
||||
attrib_type,
|
||||
attrib_nelem));
|
||||
TRY (ret_value = hdf5_attribute_exists (
|
||||
f->b->field_gid,
|
||||
attrib_name));
|
||||
H5_RETURN (ret_value);
|
||||
}
|
||||
|
||||
h5_ssize_t
|
||||
@@ -151,12 +116,12 @@ h5b_get_num_field_attribs (
|
||||
) {
|
||||
h5_file_p f = (h5_file_p)fh;
|
||||
H5_CORE_API_ENTER (h5_err_t, "f=%p field_name='%s'", f, field_name);
|
||||
CHECK_FILEHANDLE (f);
|
||||
CHECK_TIMEGROUP (f);
|
||||
check_iteration_handle_is_valid (f);
|
||||
|
||||
TRY (h5bpriv_open_field_group(f, field_name));
|
||||
|
||||
H5_CORE_API_RETURN (hdf5_get_num_attribute (f->b->field_gid));
|
||||
TRY (ret_value = hdf5_get_num_attribute (f->b->field_gid));
|
||||
H5_RETURN (ret_value);
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
@@ -175,27 +140,47 @@ h5b_get_field_attrib_info_by_idx (
|
||||
"field_name='%s', "
|
||||
"attrib_idx=%llu, "
|
||||
"attrib_name=%p, len_attrib_name=%llu, "
|
||||
"attrib_type=%p, "
|
||||
"attrib_nelem=%p",
|
||||
"attrib_type=%p, attrib_nelem=%p",
|
||||
f,
|
||||
field_name,
|
||||
(long long unsigned)attrib_idx,
|
||||
attrib_name, (long long unsigned)len_attrib_name,
|
||||
attrib_type,
|
||||
attrib_nelem);
|
||||
CHECK_FILEHANDLE (f);
|
||||
CHECK_TIMEGROUP (f);
|
||||
|
||||
attrib_type, attrib_nelem);
|
||||
check_iteration_handle_is_valid (f);
|
||||
TRY (h5bpriv_open_field_group(f, field_name));
|
||||
TRY (ret_value = h5priv_get_attrib_info_by_idx (
|
||||
f->b->field_gid,
|
||||
attrib_idx,
|
||||
attrib_name, len_attrib_name,
|
||||
attrib_type, attrib_nelem));
|
||||
H5_RETURN (ret_value);
|
||||
}
|
||||
|
||||
H5_CORE_API_RETURN (
|
||||
h5priv_get_attrib_info_by_idx (
|
||||
f->b->field_gid,
|
||||
attrib_idx,
|
||||
attrib_name,
|
||||
len_attrib_name,
|
||||
attrib_type,
|
||||
attrib_nelem));
|
||||
h5_err_t
|
||||
h5b_get_field_attrib_info_by_name (
|
||||
const h5_file_t fh, /*!< IN: file handle */
|
||||
const char* const field_name, /*!< IN: field name */
|
||||
const char* const attrib_name, /*!< IN: attribute name */
|
||||
h5_int64_t* attrib_type, /*!< OUT: attribute type */
|
||||
h5_size_t* attrib_nelem /*!< OUT: number of elements */
|
||||
) {
|
||||
h5_file_p f = (h5_file_p)fh;
|
||||
H5_CORE_API_ENTER (h5_err_t,
|
||||
"f=%p, "
|
||||
"field_name='%s', "
|
||||
"attrib_name=%s, "
|
||||
"attrib_type=%p, attrib_nelem=%p",
|
||||
f,
|
||||
field_name,
|
||||
attrib_name,
|
||||
attrib_type, attrib_nelem);
|
||||
check_iteration_handle_is_valid (f);
|
||||
TRY (h5bpriv_open_field_group(f, field_name));
|
||||
TRY (ret_value = h5priv_get_attrib_info_by_name (
|
||||
f->b->field_gid,
|
||||
attrib_name,
|
||||
attrib_type, attrib_nelem));
|
||||
H5_RETURN (ret_value);
|
||||
}
|
||||
|
||||
static inline h5_err_t
|
||||
@@ -256,8 +241,7 @@ h5b_set_3d_field_coords (
|
||||
field_name,
|
||||
attrib_name,
|
||||
coords, (long long unsigned)n_coords);
|
||||
CHECK_FILEHANDLE (f);
|
||||
CHECK_TIMEGROUP (f);
|
||||
check_iteration_is_writable (f);
|
||||
|
||||
TRY (check_coords (f, rank, n_coords));
|
||||
TRY (h5b_write_field_attrib (
|
||||
@@ -268,7 +252,7 @@ h5b_set_3d_field_coords (
|
||||
coords,
|
||||
n_coords));
|
||||
|
||||
H5_CORE_API_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
@@ -292,8 +276,8 @@ h5b_get_3d_field_coords (
|
||||
field_name,
|
||||
attrib_name,
|
||||
coords, (long long unsigned)n_coords);
|
||||
CHECK_FILEHANDLE (f);
|
||||
CHECK_TIMEGROUP (f);
|
||||
|
||||
check_iteration_is_readable (f);
|
||||
|
||||
TRY (check_coords (f, rank, n_coords));
|
||||
TRY (h5b_read_field_attrib (
|
||||
@@ -303,7 +287,7 @@ h5b_get_3d_field_coords (
|
||||
H5_FLOAT64_T,
|
||||
coords));
|
||||
|
||||
H5_CORE_API_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
|
||||
|
||||
+105
-94
@@ -7,7 +7,6 @@
|
||||
License: see file COPYING in top level of source distribution.
|
||||
*/
|
||||
|
||||
#include "h5core/h5_init.h"
|
||||
#include "private/h5_types.h"
|
||||
#include "private/h5_hdf5.h"
|
||||
|
||||
@@ -18,6 +17,9 @@
|
||||
#include "private/h5b_model.h"
|
||||
|
||||
#include "h5core/h5_syscall.h"
|
||||
#include "h5core/h5b_io.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
/*!
|
||||
\ingroup h5_private
|
||||
@@ -38,14 +40,14 @@ h5bpriv_open_file (
|
||||
h5b_fdata_t* b;
|
||||
|
||||
if (f->b)
|
||||
H5_PRIV_API_LEAVE (H5_SUCCESS);
|
||||
H5_LEAVE (H5_SUCCESS);
|
||||
|
||||
TRY (f->b = (h5b_fdata_t*)h5_calloc (1, sizeof (*f->b)));
|
||||
|
||||
b = f->b;
|
||||
memset (b, 0, sizeof (*b));
|
||||
|
||||
#if defined(PARALLEL_IO)
|
||||
#ifdef H5_HAVE_PARALLEL
|
||||
size_t n = sizeof (struct h5b_partition) / sizeof (h5_int64_t);
|
||||
TRY (h5priv_mpi_type_contiguous(n, MPI_LONG_LONG, &b->partition_mpi_t));
|
||||
#endif
|
||||
@@ -61,7 +63,7 @@ h5bpriv_open_file (
|
||||
|
||||
TRY (b->dcreate_prop = hdf5_create_property (H5P_DATASET_CREATE));
|
||||
|
||||
H5_PRIV_API_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -86,17 +88,17 @@ h5bpriv_close_file (
|
||||
TRY (hdf5_close_dataspace (b->diskshape));
|
||||
TRY (hdf5_close_dataspace (b->memshape));
|
||||
TRY (hdf5_close_property (b->dcreate_prop));
|
||||
#if defined(PARALLEL_IO)
|
||||
#ifdef H5_HAVE_PARALLEL
|
||||
TRY (h5priv_mpi_type_free (&b->partition_mpi_t));
|
||||
#endif
|
||||
TRY (h5_free (f->b));
|
||||
f->b = NULL;
|
||||
|
||||
H5_PRIV_API_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
static h5_err_t
|
||||
_select_hyperslab_for_writing (
|
||||
select_hyperslab_for_writing (
|
||||
const h5_file_p f /*!< IN: file handle */
|
||||
) {
|
||||
H5_PRIV_FUNC_ENTER (h5_err_t, "f=%p", f);
|
||||
@@ -104,7 +106,7 @@ _select_hyperslab_for_writing (
|
||||
re-use existing hyperslab
|
||||
*/
|
||||
if ( f->b->shape >= 0 )
|
||||
H5_PRIV_FUNC_LEAVE (H5_SUCCESS);
|
||||
H5_LEAVE (H5_SUCCESS);
|
||||
|
||||
h5b_fdata_t *b = f->b;
|
||||
h5b_partition_t *p = b->write_layout;
|
||||
@@ -189,50 +191,50 @@ _select_hyperslab_for_writing (
|
||||
part_dims,
|
||||
NULL));
|
||||
|
||||
H5_PRIV_FUNC_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
static h5_err_t
|
||||
_write_data (
|
||||
write_data (
|
||||
const h5_file_p f, /*!< IN: file handle */
|
||||
const char *field_name, /*!< IN: name of field */
|
||||
const char *data_name, /*!< IN: name of dataset */
|
||||
const void *data, /*!< IN: data to write */
|
||||
const hid_t type /*!< IN: data type */
|
||||
const h5_types_t type /*!< IN: data type */
|
||||
) {
|
||||
H5_PRIV_FUNC_ENTER (h5_err_t,
|
||||
"f=%p, field_name=%s, data_name=%s, data=%p type=%lld",
|
||||
f, field_name, data_name, data, (long long int)type);
|
||||
"f=%p, data_name=%s, data=%p type=%lld",
|
||||
f, data_name, data, (long long int)type);
|
||||
hid_t dataset;
|
||||
h5b_fdata_t *b = f->b;
|
||||
|
||||
hid_t hdf5_data_type;
|
||||
TRY (hdf5_data_type = h5priv_map_enum_to_normalized_type (type));
|
||||
h5_err_t exists;
|
||||
TRY (exists = hdf5_link_exists (b->field_gid, data_name));
|
||||
if ( exists > 0 ) {
|
||||
TRY (dataset = hdf5_open_dataset (b->field_gid, data_name));
|
||||
hid_t type_file;
|
||||
TRY( type_file = hdf5_get_dataset_type (dataset) );
|
||||
if ( type != type_file ) {
|
||||
H5_PRIV_FUNC_LEAVE (h5_error(
|
||||
H5_ERR_HDF5,
|
||||
"Field '%s' already has type '%s' "
|
||||
"but was written as '%s'.",
|
||||
field_name,
|
||||
hdf5_get_type_name (type_file),
|
||||
hdf5_get_type_name (type)));
|
||||
TRY (dataset = hdf5_open_dataset_by_name (b->field_gid, data_name));
|
||||
hid_t type_of_dataset;
|
||||
TRY (type_of_dataset = h5priv_get_normalized_dataset_type (dataset));
|
||||
if (hdf5_data_type != type_of_dataset) {
|
||||
H5_RETURN_ERROR (
|
||||
H5_ERR_HDF5,
|
||||
"Field '%s' already has type '%s' "
|
||||
"but was written as '%s'.",
|
||||
hdf5_get_objname (b->field_gid),
|
||||
hdf5_get_type_name (type_of_dataset),
|
||||
hdf5_get_type_name (hdf5_data_type));
|
||||
}
|
||||
} else {
|
||||
TRY (dataset = hdf5_create_dataset(
|
||||
b->field_gid,
|
||||
data_name,
|
||||
type,
|
||||
hdf5_data_type,
|
||||
b->shape,
|
||||
b->dcreate_prop));
|
||||
}
|
||||
TRY (h5priv_start_throttle (f));
|
||||
TRY (hdf5_write_dataset(
|
||||
dataset,
|
||||
type,
|
||||
hdf5_data_type,
|
||||
b->memshape,
|
||||
b->diskshape,
|
||||
f->props->xfer_prop,
|
||||
@@ -240,39 +242,38 @@ _write_data (
|
||||
TRY (h5priv_end_throttle (f));
|
||||
TRY (hdf5_close_dataset (dataset));
|
||||
|
||||
H5_PRIV_FUNC_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
h5b_write_scalar_data (
|
||||
const h5_file_t fh, /*!< IN: file handle */
|
||||
const char *field_name, /*!< IN: name of field */
|
||||
const void *data, /*!< IN: data to write */
|
||||
const hid_t type /*!< IN: data type */
|
||||
const char* const field_name, /*!< IN: name of field */
|
||||
const void* const data, /*!< IN: data to write */
|
||||
const h5_types_t type /*!< IN: data type */
|
||||
) {
|
||||
h5_file_p f = (h5_file_p)fh;
|
||||
H5_CORE_API_ENTER (h5_err_t,
|
||||
"f=%p, field_name='%s', data=%p, type=%lld",
|
||||
f, field_name, data, (long long int)type);
|
||||
CHECK_TIMEGROUP (f);
|
||||
CHECK_WRITABLE_MODE (f);
|
||||
check_iteration_is_writable (f);
|
||||
CHECK_LAYOUT (f);
|
||||
|
||||
TRY( h5bpriv_create_field_group(f, field_name) );
|
||||
TRY( _select_hyperslab_for_writing(f) );
|
||||
TRY( _write_data(f, field_name, H5_BLOCKNAME_X, data, type) );
|
||||
TRY (h5bpriv_create_field_group (f, field_name));
|
||||
TRY (select_hyperslab_for_writing (f));
|
||||
TRY (write_data (f, H5_BLOCKNAME_X, data, type));
|
||||
|
||||
H5_CORE_API_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
h5b_write_vector3d_data (
|
||||
const h5_file_t fh, /*!< IN: file handle */
|
||||
const char *field_name, /*!< IN: name of field */
|
||||
const void *xdata, /*!< IN: x data to write */
|
||||
const void *ydata, /*!< IN: y data to write */
|
||||
const void *zdata, /*!< IN: z data to write */
|
||||
const hid_t type /*!< IN: data type */
|
||||
const char* const field_name, /*!< IN: name of field */
|
||||
const void* const xdata, /*!< IN: x data to write */
|
||||
const void* const ydata, /*!< IN: y data to write */
|
||||
const void* const zdata, /*!< IN: z data to write */
|
||||
const h5_types_t type /*!< IN: data type */
|
||||
) {
|
||||
h5_file_p f = (h5_file_p)fh;
|
||||
H5_CORE_API_ENTER (h5_err_t,
|
||||
@@ -282,21 +283,20 @@ h5b_write_vector3d_data (
|
||||
"zdata=%p, "
|
||||
"type=%lld",
|
||||
f, field_name, xdata, ydata, zdata, (long long int)type);
|
||||
CHECK_TIMEGROUP( f );
|
||||
CHECK_WRITABLE_MODE( f );
|
||||
CHECK_LAYOUT( f );
|
||||
check_iteration_is_writable (f);
|
||||
CHECK_LAYOUT (f);
|
||||
|
||||
TRY( h5bpriv_create_field_group(f, field_name) );
|
||||
TRY( _select_hyperslab_for_writing(f) );
|
||||
TRY( _write_data(f, field_name, H5_BLOCKNAME_X, xdata, type) );
|
||||
TRY( _write_data(f, field_name, H5_BLOCKNAME_Y, ydata, type) );
|
||||
TRY( _write_data(f, field_name, H5_BLOCKNAME_Z, zdata, type) );
|
||||
TRY (h5bpriv_create_field_group(f, field_name));
|
||||
TRY (select_hyperslab_for_writing(f));
|
||||
TRY (write_data (f, H5_BLOCKNAME_X, xdata, type));
|
||||
TRY (write_data (f, H5_BLOCKNAME_Y, ydata, type));
|
||||
TRY (write_data (f, H5_BLOCKNAME_Z, zdata, type));
|
||||
|
||||
H5_CORE_API_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
static h5_err_t
|
||||
_select_hyperslab_for_reading (
|
||||
select_hyperslab_for_reading (
|
||||
const h5_file_p f, /*!< IN: file handle */
|
||||
const hid_t dataset
|
||||
) {
|
||||
@@ -325,21 +325,20 @@ _select_hyperslab_for_reading (
|
||||
|
||||
TRY (rank = hdf5_get_dims_of_dataspace(b->diskshape, field_dims, NULL));
|
||||
if (rank != 3)
|
||||
H5_PRIV_FUNC_LEAVE (
|
||||
h5_error(
|
||||
H5_ERR_INVAL,
|
||||
"H5Block dataset has bad rank '%d' instead"
|
||||
" of rank 3! Is the file corrupt?",
|
||||
rank));
|
||||
H5_RETURN_ERROR (
|
||||
H5_ERR_INVAL,
|
||||
"H5Block dataset has bad rank '%d' instead"
|
||||
" of rank 3! Is the file corrupt?",
|
||||
rank);
|
||||
|
||||
if ( (field_dims[0] < (hsize_t)b->k_max) ||
|
||||
(field_dims[1] < (hsize_t)b->j_max) ||
|
||||
(field_dims[2] < (hsize_t)b->i_max) )
|
||||
H5_PRIV_FUNC_LEAVE (
|
||||
h5_error(
|
||||
H5_ERR_VIEW,
|
||||
"H5Block dataset has invalid view. "
|
||||
"Is the file corrupt?"));
|
||||
H5_RETURN_ERROR (
|
||||
H5_ERR_VIEW,
|
||||
"%s",
|
||||
"H5Block dataset has invalid view. "
|
||||
"Is the file corrupt?");
|
||||
|
||||
h5_debug (
|
||||
"field_dims: (%lld,%lld,%lld)",
|
||||
@@ -372,28 +371,40 @@ _select_hyperslab_for_reading (
|
||||
(long long)part_dims[1],
|
||||
(long long)part_dims[0] );
|
||||
|
||||
H5_PRIV_FUNC_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
static h5_err_t
|
||||
read_data (
|
||||
const h5_file_p f, /*!< IN: file handle */
|
||||
const char *dataset_name, /*!< IN: name of dataset */
|
||||
void *data, /*!< OUT: ptr to read buffer */
|
||||
const char* const dataset_name, /*!< IN: name of dataset */
|
||||
void* const data, /*!< OUT: ptr to read buffer */
|
||||
const hid_t type /*!< IN: data type */
|
||||
) {
|
||||
H5_PRIV_FUNC_ENTER (h5_err_t,
|
||||
"f=%p, dataset_name=%s, data=%p, type=%lld",
|
||||
f, dataset_name, data, (long long int)type);
|
||||
hid_t dataset;
|
||||
h5b_fdata_t *b = f->b;
|
||||
hid_t hdf5_data_type;
|
||||
TRY (hdf5_data_type = h5priv_map_enum_to_normalized_type (type));
|
||||
hid_t dataset;
|
||||
TRY (dataset = hdf5_open_dataset_by_name (b->field_gid, dataset_name));
|
||||
hid_t type_of_dataset;
|
||||
TRY (type_of_dataset = h5priv_get_normalized_dataset_type (dataset));
|
||||
if (hdf5_data_type != type_of_dataset) {
|
||||
H5_RETURN_ERROR (
|
||||
H5_ERR_HDF5,
|
||||
"Field '%s' has type '%s', but requested type is '%s'.",
|
||||
hdf5_get_objname (b->field_gid),
|
||||
hdf5_get_type_name (type_of_dataset),
|
||||
hdf5_get_type_name (hdf5_data_type));
|
||||
}
|
||||
|
||||
TRY (dataset = hdf5_open_dataset (b->field_gid, dataset_name));
|
||||
TRY (_select_hyperslab_for_reading (f, dataset) );
|
||||
TRY (select_hyperslab_for_reading (f, dataset) );
|
||||
TRY (h5priv_start_throttle (f));
|
||||
TRY (hdf5_read_dataset(
|
||||
dataset,
|
||||
type,
|
||||
hdf5_data_type,
|
||||
f->b->memshape,
|
||||
f->b->diskshape,
|
||||
f->props->xfer_prop,
|
||||
@@ -401,37 +412,37 @@ read_data (
|
||||
TRY (h5priv_end_throttle (f));
|
||||
TRY (hdf5_close_dataset(dataset));
|
||||
|
||||
H5_PRIV_FUNC_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
h5b_read_scalar_data (
|
||||
const h5_file_p fh, /*!< IN: file handle */
|
||||
const char *field_name, /*!< IN: name of field */
|
||||
void *data, /*!< OUT: read bufer */
|
||||
const hid_t type /*!< IN: data type */
|
||||
const h5_file_t fh, /*!< IN: file handle */
|
||||
const char* const field_name, /*!< IN: name of field */
|
||||
void* const data, /*!< OUT: read bufer */
|
||||
const h5_types_t type /*!< IN: data type */
|
||||
) {
|
||||
h5_file_p f = (h5_file_p)fh;
|
||||
H5_CORE_API_ENTER (h5_err_t,
|
||||
"f=%p, field_name='%s', data=%p, type=%lld",
|
||||
f, field_name, data, (long long int)type);
|
||||
CHECK_TIMEGROUP( f );
|
||||
CHECK_LAYOUT( f );
|
||||
check_iteration_is_readable (f);
|
||||
CHECK_LAYOUT (f);
|
||||
|
||||
TRY( h5bpriv_open_field_group(f, field_name) );
|
||||
TRY( read_data(f, H5_BLOCKNAME_X, data, type) );
|
||||
TRY (h5bpriv_open_field_group(f, field_name));
|
||||
TRY (read_data(f, H5_BLOCKNAME_X, data, type));
|
||||
|
||||
H5_CORE_API_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
h5b_read_vector3d_data (
|
||||
const h5_file_p fh, /*!< IN: file handle */
|
||||
const char *field_name, /*!< IN: name of field */
|
||||
void *xdata, /*!< IN: x data to write */
|
||||
void *ydata, /*!< IN: y data to write */
|
||||
void *zdata, /*!< IN: z data to write */
|
||||
const hid_t type /*!< IN: data type */
|
||||
const h5_file_t fh, /*!< IN: file handle */
|
||||
const char* const field_name, /*!< IN: name of field */
|
||||
void* const xdata, /*!< IN: x data to write */
|
||||
void* const ydata, /*!< IN: y data to write */
|
||||
void* const zdata, /*!< IN: z data to write */
|
||||
const h5_types_t type /*!< IN: data type */
|
||||
) {
|
||||
h5_file_p f = (h5_file_p)fh;
|
||||
H5_CORE_API_ENTER (h5_err_t,
|
||||
@@ -441,14 +452,14 @@ h5b_read_vector3d_data (
|
||||
"zdata=%p, "
|
||||
"type=%lld",
|
||||
f, field_name, xdata, ydata, zdata, (long long int)type);
|
||||
CHECK_TIMEGROUP( f );
|
||||
CHECK_LAYOUT( f );
|
||||
check_iteration_is_readable (f);
|
||||
CHECK_LAYOUT (f);
|
||||
|
||||
TRY( h5bpriv_open_field_group(f, field_name) );
|
||||
TRY( read_data(f, H5_BLOCKNAME_X, xdata, type) );
|
||||
TRY( read_data(f, H5_BLOCKNAME_Y, ydata, type) );
|
||||
TRY( read_data(f, H5_BLOCKNAME_Z, zdata, type) );
|
||||
TRY (h5bpriv_open_field_group(f, field_name));
|
||||
TRY (read_data(f, H5_BLOCKNAME_X, xdata, type));
|
||||
TRY (read_data(f, H5_BLOCKNAME_Y, ydata, type));
|
||||
TRY (read_data(f, H5_BLOCKNAME_Z, zdata, type));
|
||||
|
||||
H5_CORE_API_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
|
||||
+145
-119
@@ -10,10 +10,9 @@
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "h5core/h5_init.h"
|
||||
#include "h5core/h5_syscall.h"
|
||||
|
||||
#include "private/h5.h"
|
||||
#include "private/h5_file.h"
|
||||
#include "private/h5_hdf5.h"
|
||||
|
||||
#include "private/h5_model.h"
|
||||
@@ -42,10 +41,9 @@ h5b_has_field_data (
|
||||
) {
|
||||
h5_file_p f = (h5_file_p)fh;
|
||||
H5_CORE_API_ENTER (h5_err_t, "f=%p", f);
|
||||
CHECK_FILEHANDLE (f);
|
||||
h5_err_t exists;
|
||||
TRY (exists = hdf5_link_exists (f->step_gid, H5BLOCK_GROUPNAME_BLOCK));
|
||||
H5_CORE_API_RETURN (exists);
|
||||
check_iteration_handle_is_valid (f);
|
||||
TRY (ret_value = hdf5_link_exists (f->iteration_gid, H5BLOCK_GROUPNAME_BLOCK));
|
||||
H5_RETURN (ret_value);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -75,7 +73,7 @@ _normalize_partition (
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef PARALLEL_IO
|
||||
#ifdef H5_HAVE_PARALLEL
|
||||
/* MLH: this could be improved with an MPI_Reduce and MAX operator...
|
||||
* but the user_layout array-of-structs would need to be a struct-of-arrays */
|
||||
static void
|
||||
@@ -422,7 +420,7 @@ _dissolve_ghostzones (
|
||||
|
||||
}
|
||||
h5_free (p_begin);
|
||||
H5_PRIV_FUNC_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -443,7 +441,7 @@ h5bpriv_release_hyperslab (
|
||||
TRY (hdf5_close_dataspace(f->b->memshape));
|
||||
f->b->memshape = -1;
|
||||
}
|
||||
H5_PRIV_API_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
@@ -454,13 +452,14 @@ h5bpriv_open_block_group (
|
||||
h5b_fdata_t *b = f->b;
|
||||
|
||||
TRY (hdf5_close_group (b->block_gid));
|
||||
b->block_gid = hdf5_open_group (f->step_gid, H5BLOCK_GROUPNAME_BLOCK);
|
||||
b->block_gid = hdf5_open_group (f->iteration_gid, H5BLOCK_GROUPNAME_BLOCK);
|
||||
if (f->b->block_gid < 0)
|
||||
H5_PRIV_API_LEAVE (h5_error(
|
||||
H5_ERR_INVAL,
|
||||
"Time step does not contain H5Block data!"));
|
||||
H5_RETURN_ERROR (
|
||||
H5_ERR_INVAL,
|
||||
"%s",
|
||||
"step/iteration does not contain H5Block data!");
|
||||
|
||||
H5_PRIV_API_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
static h5_err_t
|
||||
@@ -469,69 +468,72 @@ _create_block_group (
|
||||
) {
|
||||
H5_PRIV_FUNC_ENTER (h5_err_t, "f=%p", f);
|
||||
h5_err_t exists;
|
||||
TRY (exists = hdf5_link_exists (f->step_gid, H5BLOCK_GROUPNAME_BLOCK));
|
||||
TRY (exists = hdf5_link_exists (f->iteration_gid, H5BLOCK_GROUPNAME_BLOCK));
|
||||
|
||||
if (exists > 0) {
|
||||
TRY (h5bpriv_open_block_group(f));
|
||||
} else {
|
||||
TRY (hdf5_close_group(f->b->block_gid) );
|
||||
TRY (f->b->block_gid = hdf5_create_group(
|
||||
f->step_gid, H5BLOCK_GROUPNAME_BLOCK) );
|
||||
f->iteration_gid, H5BLOCK_GROUPNAME_BLOCK) );
|
||||
}
|
||||
H5_PRIV_FUNC_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
h5bpriv_open_field_group (
|
||||
const h5_file_p f, /*!< IN: file handle */
|
||||
const char *name
|
||||
char* const name
|
||||
) {
|
||||
H5_PRIV_API_ENTER (h5_err_t, "f=%p, name='%s'", f, name);
|
||||
char name2[H5_DATANAME_LEN];
|
||||
h5priv_normalize_dataset_name (name, name2);
|
||||
h5priv_normalize_dataset_name (name);
|
||||
|
||||
TRY (hdf5_close_group (f->b->field_gid));
|
||||
TRY (h5bpriv_open_block_group (f));
|
||||
f->b->field_gid = hdf5_open_group (f->b->block_gid, name2);
|
||||
f->b->field_gid = hdf5_open_group (f->b->block_gid, name);
|
||||
if (f->b->field_gid < 0)
|
||||
return h5_error(
|
||||
H5_ERR_INVAL,
|
||||
"Field '%s' does not exist!", name2);
|
||||
"Field '%s' does not exist!", name);
|
||||
|
||||
H5_PRIV_API_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
h5bpriv_create_field_group (
|
||||
const h5_file_p f, /*!< IN: file handle */
|
||||
const char *name /*!< IN: name of field group to create */
|
||||
char* const name /*!< IN: name of field group to create */
|
||||
) {
|
||||
H5_PRIV_API_ENTER (h5_err_t, "f=%p, name='%s'", f, name);
|
||||
h5b_fdata_t *b = f->b;
|
||||
|
||||
TRY( _create_block_group(f) );
|
||||
|
||||
char name2[H5_DATANAME_LEN];
|
||||
h5priv_normalize_dataset_name (name, name2);
|
||||
h5priv_normalize_dataset_name (name);
|
||||
|
||||
h5_err_t exists;
|
||||
TRY (exists = hdf5_link_exists ( b->block_gid, name2));
|
||||
TRY (exists = hdf5_link_exists ( b->block_gid, name));
|
||||
|
||||
if (exists > 0) {
|
||||
TRY (h5bpriv_open_field_group (f, name2));
|
||||
TRY (h5bpriv_open_field_group (f, name));
|
||||
} else {
|
||||
TRY (hdf5_close_group (f->b->field_gid) );
|
||||
TRY (b->field_gid = hdf5_create_group (b->block_gid, name2));
|
||||
TRY (b->field_gid = hdf5_create_group (b->block_gid, name));
|
||||
}
|
||||
|
||||
H5_CORE_API_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
h5_int64_t
|
||||
h5b_3d_has_view (
|
||||
const h5_file_t fh /*!< IN: File handle */
|
||||
) {
|
||||
return (((h5_file_p)fh)->b->have_layout > 0);
|
||||
h5_file_p f = (h5_file_p)fh;
|
||||
H5_CORE_API_ENTER (h5_err_t,
|
||||
"f=%p, ",
|
||||
f);
|
||||
check_iteration_handle_is_valid (f);
|
||||
H5_RETURN (((h5_file_p)fh)->b->have_layout > 0);
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
@@ -545,7 +547,6 @@ h5b_3d_set_view (
|
||||
const h5_size_t k_end /*!< IN: end index of \c k */
|
||||
) {
|
||||
h5_file_p f = (h5_file_p)fh;
|
||||
h5b_fdata_t *b = f->b;
|
||||
H5_CORE_API_ENTER (h5_err_t,
|
||||
"f=%p, "
|
||||
"i_start=%llu, i_end=%llu, "
|
||||
@@ -555,6 +556,8 @@ h5b_3d_set_view (
|
||||
(long long unsigned)i_start, (long long unsigned)i_end,
|
||||
(long long unsigned)j_start, (long long unsigned)j_end,
|
||||
(long long unsigned)k_start, (long long unsigned)k_end);
|
||||
check_iteration_handle_is_valid (f);
|
||||
h5b_fdata_t *b = f->b;
|
||||
b->user_layout[0].i_start = i_start;
|
||||
b->user_layout[0].i_end = i_end;
|
||||
b->user_layout[0].j_start = j_start;
|
||||
@@ -563,7 +566,7 @@ h5b_3d_set_view (
|
||||
b->user_layout[0].k_end = k_end;
|
||||
_normalize_partition(&b->user_layout[0]);
|
||||
|
||||
#ifdef PARALLEL_IO
|
||||
#ifdef H5_HAVE_PARALLEL
|
||||
h5b_partition_t *user_layout;
|
||||
h5b_partition_t *write_layout;
|
||||
|
||||
@@ -611,7 +614,7 @@ h5b_3d_set_view (
|
||||
TRY( h5bpriv_release_hyperslab(f) );
|
||||
b->have_layout = 1;
|
||||
|
||||
H5_CORE_API_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
@@ -634,6 +637,7 @@ h5b_3d_get_view (
|
||||
i_start, i_end,
|
||||
j_start, j_end,
|
||||
k_start, k_end);
|
||||
check_iteration_handle_is_valid (f);
|
||||
h5b_partition_t *p = f->b->user_layout;
|
||||
|
||||
*i_start = p->i_start;
|
||||
@@ -643,7 +647,7 @@ h5b_3d_get_view (
|
||||
*k_start = p->k_start;
|
||||
*k_end = p->k_end;
|
||||
|
||||
H5_CORE_API_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
@@ -666,6 +670,7 @@ h5b_3d_get_reduced_view (
|
||||
i_start, i_end,
|
||||
j_start, j_end,
|
||||
k_start, k_end);
|
||||
check_iteration_handle_is_valid (f);
|
||||
h5b_partition_t *p = f->b->write_layout;
|
||||
|
||||
*i_start = p->i_start;
|
||||
@@ -675,7 +680,7 @@ h5b_3d_get_reduced_view (
|
||||
*k_start = p->k_start;
|
||||
*k_end = p->k_end;
|
||||
|
||||
H5_CORE_API_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
@@ -692,6 +697,7 @@ h5b_3d_set_chunk (
|
||||
(long long unsigned)i,
|
||||
(long long unsigned)j,
|
||||
(long long unsigned)k);
|
||||
check_iteration_handle_is_valid (f);
|
||||
if ( i == 0 || j == 0 || k == 0 )
|
||||
{
|
||||
h5_info ("Disabling chunking" );
|
||||
@@ -704,32 +710,32 @@ h5b_3d_set_chunk (
|
||||
TRY (hdf5_set_chunk_property (f->b->dcreate_prop, 1, dims));
|
||||
}
|
||||
|
||||
H5_CORE_API_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
h5b_3d_get_chunk (
|
||||
const h5_file_t fh, /*!< IN: File handle */
|
||||
const char *field_name, /*!< IN: name of dataset */
|
||||
h5_size_t *const i, /*!< OUT: size of \c i */
|
||||
h5_size_t *const j, /*!< OUT: size of \c j */
|
||||
h5_size_t *const k /*!< OUT: size of \c k */
|
||||
char* const field_name, /*!< IN: name of dataset */
|
||||
h5_size_t* const i, /*!< OUT: size of \c i */
|
||||
h5_size_t* const j, /*!< OUT: size of \c j */
|
||||
h5_size_t* const k /*!< OUT: size of \c k */
|
||||
) {
|
||||
h5_file_p f = (h5_file_p)fh;
|
||||
H5_CORE_API_ENTER (h5_err_t,
|
||||
"f=%p, i=%p, j=%p, k=%p",
|
||||
f, i, j, k);
|
||||
CHECK_TIMEGROUP ( f );
|
||||
check_iteration_handle_is_valid (f);
|
||||
|
||||
h5b_fdata_t *b = f->b;
|
||||
|
||||
TRY( h5bpriv_open_field_group ( f, field_name ) );
|
||||
TRY (h5bpriv_open_field_group (f, field_name));
|
||||
|
||||
hid_t dataset_id;
|
||||
hid_t plist_id;
|
||||
hsize_t hdims[3];
|
||||
|
||||
TRY (dataset_id = hdf5_open_dataset (b->field_gid, H5_BLOCKNAME_X));
|
||||
TRY (dataset_id = hdf5_open_dataset_by_name (b->field_gid, H5_BLOCKNAME_X));
|
||||
TRY (plist_id = hdf5_get_dataset_create_plist (dataset_id));
|
||||
TRY (hdf5_get_chunk_property (plist_id, 3, hdims));
|
||||
TRY (hdf5_close_property (plist_id));
|
||||
@@ -744,10 +750,9 @@ h5b_3d_get_chunk (
|
||||
(long long)hdims[1],
|
||||
(long long)hdims[2] );
|
||||
|
||||
H5_CORE_API_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
#ifdef PARALLEL_IO
|
||||
h5_err_t
|
||||
h5b_3d_set_grid (
|
||||
const h5_file_t fh, /*!< IN: File handle */
|
||||
@@ -762,29 +767,32 @@ h5b_3d_set_grid (
|
||||
(long long unsigned)i,
|
||||
(long long unsigned)j,
|
||||
(long long unsigned)k);
|
||||
check_iteration_handle_is_valid (f);
|
||||
if (i*j*k != f->nprocs) {
|
||||
H5_CORE_API_LEAVE (
|
||||
h5_error(H5_ERR_INVAL,
|
||||
"Grid dimensions (%lld,%lld,%lld) do not multiply "
|
||||
"out to %d MPI processors!",
|
||||
(long long)i,
|
||||
(long long)j,
|
||||
(long long)k,
|
||||
f->nprocs));
|
||||
H5_RETURN_ERROR (
|
||||
H5_ERR_INVAL,
|
||||
"Grid dimensions (%lld,%lld,%lld) do not multiply "
|
||||
"out to %d MPI processors!",
|
||||
(long long)i,
|
||||
(long long)j,
|
||||
(long long)k,
|
||||
f->nprocs);
|
||||
}
|
||||
|
||||
f->b->k_grid = i;
|
||||
f->b->j_grid = j;
|
||||
f->b->i_grid = k;
|
||||
|
||||
#ifdef H5_HAVE_PARALLEL
|
||||
int dims[3] = { k, j, i };
|
||||
int period[3] = { 0, 0, 0 };
|
||||
TRY( h5priv_mpi_cart_create(
|
||||
f->props->comm, 3, dims, period, 0, &f->b->cart_comm) );
|
||||
|
||||
#else
|
||||
h5_warn ("Defining a grid in serial case doesn't make much sense!");
|
||||
#endif
|
||||
f->b->have_grid = 1;
|
||||
|
||||
H5_CORE_API_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
@@ -799,17 +807,24 @@ h5b_3d_get_grid_coords (
|
||||
H5_CORE_API_ENTER (h5_err_t,
|
||||
"f=%p, proc=%d, i=%p, j=%p, k=%p",
|
||||
f, proc, i, j, k);
|
||||
check_iteration_handle_is_valid (f);
|
||||
if ( !f->b->have_grid )
|
||||
H5_CORE_API_LEAVE (
|
||||
h5_error(H5_ERR_INVAL,
|
||||
"Grid dimensions have not been set!"));
|
||||
H5_RETURN_ERROR (
|
||||
H5_ERR_INVAL,
|
||||
"%s",
|
||||
"Grid dimensions have not been set!");
|
||||
|
||||
#ifdef H5_HAVE_PARALLEL
|
||||
int coords[3];
|
||||
TRY( h5priv_mpi_cart_coords(f->b->cart_comm, proc, 3, coords) );
|
||||
*k = coords[0];
|
||||
*j = coords[1];
|
||||
*i = coords[2];
|
||||
H5_CORE_API_RETURN (H5_SUCCESS);
|
||||
#else
|
||||
*k = *j = *i = 1;
|
||||
h5_warn ("Defining grid in serial case doesn't make much sense!");
|
||||
#endif
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
@@ -826,32 +841,37 @@ h5b_3d_set_dims (
|
||||
(long long unsigned)i,
|
||||
(long long unsigned)j,
|
||||
(long long unsigned)k);
|
||||
check_iteration_handle_is_valid (f);
|
||||
if ( !f->b->have_grid )
|
||||
H5_CORE_API_LEAVE (
|
||||
h5_error(H5_ERR_INVAL,
|
||||
"Grid dimensions have not been set!"));
|
||||
H5_RETURN_ERROR (
|
||||
H5_ERR_INVAL,
|
||||
"%s",
|
||||
"Grid dimensions have not been set!");
|
||||
|
||||
h5_size_t dims[3] = { k, j, i };
|
||||
#ifdef H5_HAVE_PARALLEL
|
||||
h5_size_t check_dims[3] = { k, j, i };
|
||||
|
||||
TRY( h5priv_mpi_bcast(
|
||||
check_dims, 3, MPI_LONG_LONG, 0, f->props->comm) );
|
||||
|
||||
#else
|
||||
h5_size_t check_dims[3] = { 1, 1, 1 };
|
||||
h5_warn ("Defining grid in serial case doesn't make much sense!");
|
||||
#endif
|
||||
if ( dims[0] != check_dims[0] ||
|
||||
dims[1] != check_dims[1] ||
|
||||
dims[2] != check_dims[2]
|
||||
) {
|
||||
H5_CORE_API_LEAVE (
|
||||
h5_error(H5_ERR_INVAL,
|
||||
"[%d] Block dimensions do not agree: "
|
||||
"(%lld,%lld,%lld) != (%lld,%lld,%lld)!",
|
||||
f->myproc,
|
||||
(long long)dims[0],
|
||||
(long long)dims[1],
|
||||
(long long)dims[2],
|
||||
(long long)check_dims[0],
|
||||
(long long)check_dims[1],
|
||||
(long long)check_dims[2]));
|
||||
H5_RETURN_ERROR (
|
||||
H5_ERR_INVAL,
|
||||
"[%d] Block dimensions do not agree: "
|
||||
"(%lld,%lld,%lld) != (%lld,%lld,%lld)!",
|
||||
f->myproc,
|
||||
(long long)dims[0],
|
||||
(long long)dims[1],
|
||||
(long long)dims[2],
|
||||
(long long)check_dims[0],
|
||||
(long long)check_dims[1],
|
||||
(long long)check_dims[2]);
|
||||
}
|
||||
h5_int64_t coords[3];
|
||||
TRY( h5b_3d_get_grid_coords((h5_file_t)f,
|
||||
@@ -874,9 +894,8 @@ h5b_3d_set_dims (
|
||||
|
||||
b->have_layout = 1;
|
||||
|
||||
H5_CORE_API_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
#endif
|
||||
|
||||
h5_err_t
|
||||
h5b_3d_set_halo (
|
||||
@@ -893,14 +912,17 @@ h5b_3d_set_halo (
|
||||
(long long unsigned)j,
|
||||
(long long unsigned)k);
|
||||
|
||||
check_iteration_handle_is_valid (f);
|
||||
if ( !f->b->have_grid ) {
|
||||
H5_CORE_API_LEAVE (
|
||||
h5_error(H5_ERR_INVAL,
|
||||
"Grid dimensions have not been set!"));
|
||||
H5_RETURN_ERROR (
|
||||
H5_ERR_INVAL,
|
||||
"%s",
|
||||
"Grid dimensions have not been set!");
|
||||
} else if ( !f->b->have_layout ) {
|
||||
H5_CORE_API_LEAVE (
|
||||
h5_error(H5_ERR_INVAL,
|
||||
"Block dimensions for grid have not been set!"));
|
||||
H5_RETURN_ERROR (
|
||||
H5_ERR_INVAL,
|
||||
"%s",
|
||||
"Block dimensions for grid have not been set!");
|
||||
}
|
||||
h5b_fdata_t *b = f->b;
|
||||
|
||||
@@ -911,7 +933,7 @@ h5b_3d_set_halo (
|
||||
b->user_layout->k_start -= k;
|
||||
b->user_layout->k_end += k;
|
||||
|
||||
H5_CORE_API_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
h5_ssize_t
|
||||
@@ -920,10 +942,11 @@ h5b_get_num_fields (
|
||||
) {
|
||||
h5_file_p f = (h5_file_p)fh;
|
||||
H5_CORE_API_ENTER (h5_ssize_t, "f=%p", f);
|
||||
CHECK_TIMEGROUP( f );
|
||||
check_iteration_handle_is_valid (f);
|
||||
|
||||
TRY (h5bpriv_open_block_group(f));
|
||||
H5_CORE_API_RETURN (hdf5_get_num_objs_in_group (f->b->block_gid));
|
||||
TRY (ret_value = hdf5_get_num_objs_in_group (f->b->block_gid));
|
||||
H5_RETURN (ret_value);
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
@@ -935,62 +958,64 @@ h5b_has_field (
|
||||
H5_CORE_API_ENTER (h5_err_t,
|
||||
"f=%p, name='%s'",
|
||||
f, name);
|
||||
CHECK_TIMEGROUP (f);
|
||||
CHECK_TIMEGROUP (f);
|
||||
check_iteration_handle_is_valid (f);
|
||||
|
||||
const char* path[] = { H5BLOCK_GROUPNAME_BLOCK, name };
|
||||
H5_CORE_API_RETURN (h5priv_link_exists_(f->step_gid, path, 2));
|
||||
TRY (ret_value = h5priv_link_exists_(f->iteration_gid, path, 2));
|
||||
H5_RETURN (ret_value);
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
h5b_get_field_info_by_name (
|
||||
const h5_file_t fh, /*!< IN: file handle */
|
||||
const char *name, /*!< IN: field name */
|
||||
h5_size_t *field_rank, /*!< OUT: field rank */
|
||||
h5_size_t *field_dims, /*!< OUT: field dimensions */
|
||||
h5_size_t *elem_rank, /*!< OUT: element rank */
|
||||
h5_int64_t *type /*!< OUT: datatype */
|
||||
char* const name, /*!< IN: field name */
|
||||
h5_size_t* field_rank, /*!< OUT: field rank */
|
||||
h5_size_t* field_dims, /*!< OUT: field dimensions */
|
||||
h5_size_t* elem_rank, /*!< OUT: element rank */
|
||||
h5_int64_t* type /*!< OUT: datatype */
|
||||
) {
|
||||
h5_file_p f = (h5_file_p)fh;
|
||||
H5_CORE_API_ENTER (h5_err_t,
|
||||
"f=%p, name='%s', "
|
||||
"field_rank=%p, field_dims=%p, elem_rank=%p, type=%p",
|
||||
f, name, field_rank, field_dims, elem_rank, type);
|
||||
CHECK_TIMEGROUP( f );
|
||||
check_iteration_handle_is_valid (f);
|
||||
|
||||
hsize_t dims[16]; /* give it plenty of space even though we don't expect rank > 3 */
|
||||
hsize_t _field_rank, _elem_rank;
|
||||
h5_size_t i, j;
|
||||
/* give it plenty of space even though we don't expect rank > 3 */
|
||||
hsize_t dims[16];
|
||||
|
||||
TRY( h5bpriv_open_field_group(f, name) );
|
||||
TRY (h5bpriv_open_field_group (f, name));
|
||||
|
||||
hid_t dataset_id;
|
||||
hid_t dataspace_id;
|
||||
|
||||
TRY (dataset_id = hdf5_open_dataset (f->b->field_gid, H5_BLOCKNAME_X));
|
||||
TRY (dataset_id = hdf5_open_dataset_by_name (
|
||||
f->b->field_gid, H5_BLOCKNAME_X));
|
||||
TRY (dataspace_id = hdf5_get_dataset_space (dataset_id) );
|
||||
|
||||
TRY (_field_rank = hdf5_get_dims_of_dataspace (dataspace_id, dims, NULL));
|
||||
if (field_rank) *field_rank = (h5_size_t) _field_rank;
|
||||
hsize_t rank;
|
||||
TRY (rank = hdf5_get_dims_of_dataspace (dataspace_id, dims, NULL));
|
||||
if (field_rank) *field_rank = (h5_size_t)rank;
|
||||
|
||||
if (field_dims) {
|
||||
for ( i = 0, j = _field_rank-1; i < _field_rank; i++, j-- )
|
||||
size_t i, j;
|
||||
for (i = 0, j = rank-1; i < rank; i++, j-- )
|
||||
field_dims[i] = (h5_size_t)dims[j];
|
||||
}
|
||||
|
||||
TRY (_elem_rank = hdf5_get_num_objs_in_group (f->b->field_gid));
|
||||
if (elem_rank) *elem_rank = (h5_size_t) _elem_rank;
|
||||
|
||||
hid_t h5type;
|
||||
TRY (h5type = hdf5_get_dataset_type (dataset_id));
|
||||
|
||||
if ( type )
|
||||
TRY( *type = h5priv_normalize_h5_type(h5type) );
|
||||
|
||||
if (elem_rank) {
|
||||
hsize_t _elem_rank;
|
||||
TRY (_elem_rank = hdf5_get_num_objs_in_group (f->b->field_gid));
|
||||
*elem_rank = (h5_size_t) _elem_rank;
|
||||
}
|
||||
if (type) {
|
||||
TRY (*type = h5priv_get_normalized_dataset_type (dataset_id));
|
||||
TRY (*type = h5priv_map_hdf5_type_to_enum(*type));
|
||||
}
|
||||
TRY (hdf5_close_dataspace (dataspace_id));
|
||||
TRY (hdf5_close_dataset (dataset_id));
|
||||
|
||||
H5_CORE_API_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
@@ -1013,7 +1038,7 @@ h5b_get_field_info (
|
||||
(long long unsigned)idx,
|
||||
name, (long long unsigned)len_name,
|
||||
field_rank, field_dims, elem_rank, type);
|
||||
CHECK_TIMEGROUP( f );
|
||||
check_iteration_handle_is_valid (f);
|
||||
|
||||
TRY (h5bpriv_open_block_group(f));
|
||||
TRY (hdf5_get_objname_by_idx(
|
||||
@@ -1022,8 +1047,9 @@ h5b_get_field_info (
|
||||
name,
|
||||
(size_t)len_name) );
|
||||
|
||||
H5_CORE_API_RETURN (h5b_get_field_info_by_name (
|
||||
(h5_file_t)f,
|
||||
name, field_rank, field_dims, elem_rank, type));
|
||||
TRY (h5b_get_field_info_by_name (
|
||||
(h5_file_t)f,
|
||||
name, field_rank, field_dims, elem_rank, type));
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
|
||||
@@ -7,13 +7,11 @@
|
||||
License: see file COPYING in top level of source distribution.
|
||||
*/
|
||||
|
||||
#include "h5core/h5_init.h"
|
||||
#include "h5core/h5_debug.h"
|
||||
#include "h5core/h5_log.h"
|
||||
|
||||
#include "private/h5.h"
|
||||
#include "private/h5_file.h"
|
||||
#include "private/h5t_types.h"
|
||||
#include "private/h5t_adjacencies.h"
|
||||
#include "private/h5t_map.h"
|
||||
#include "private/h5t_core.h"
|
||||
|
||||
#include <time.h>
|
||||
@@ -28,7 +26,8 @@ h5t_get_adjacencies (
|
||||
H5_CORE_API_ENTER (h5_err_t,
|
||||
"m=%p, entity_id=%llu, dim=%d, list=%p",
|
||||
m, (long long unsigned)entity_id, dim, list);
|
||||
H5_CORE_API_RETURN (h5tpriv_get_adjacencies (m, entity_id, dim, list));
|
||||
TRY (ret_value = h5tpriv_get_adjacencies (m, entity_id, dim, list));
|
||||
H5_RETURN (ret_value);
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
@@ -38,7 +37,8 @@ h5t_release_list_of_adjacencies (
|
||||
) {
|
||||
H5_CORE_API_ENTER (h5_err_t, "m=%p, list=%p", m, list);
|
||||
UNUSED_ARGUMENT (m);
|
||||
H5_CORE_API_RETURN (h5priv_free_loc_idlist (list));
|
||||
TRY (ret_value = h5priv_free_loc_idlist (list));
|
||||
H5_RETURN (ret_value);
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
@@ -54,5 +54,6 @@ h5t_find_te2 (
|
||||
(long long)face_idx,
|
||||
(long long)elem_idx,
|
||||
retval);
|
||||
H5_CORE_API_RETURN (h5tpriv_find_te2 (m,face_idx,elem_idx,retval));
|
||||
TRY (ret_value = h5tpriv_find_te2 (m,face_idx,elem_idx,retval));
|
||||
H5_RETURN (ret_value);
|
||||
}
|
||||
|
||||
+313
-451
File diff suppressed because it is too large
Load Diff
+49
-39
@@ -17,6 +17,8 @@
|
||||
#include "private/h5t_model.h"
|
||||
#include "private/h5_mpi.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
/*
|
||||
Mapping of global to local id's:
|
||||
|
||||
@@ -70,7 +72,7 @@ h5tpriv_sort_local_vertex_indices (
|
||||
}
|
||||
indices[j] = idx;
|
||||
}
|
||||
H5_PRIV_API_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -95,7 +97,7 @@ h5tpriv_find_glb_idx_in_map (
|
||||
if (loc_idx < 0) { // set to next position
|
||||
loc_idx = map->num_items;
|
||||
}
|
||||
H5_CORE_API_RETURN (loc_idx);
|
||||
H5_RETURN (loc_idx);
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -109,11 +111,15 @@ h5t_map_global_vertex_idx2local (
|
||||
H5_CORE_API_ENTER (h5_loc_idx_t, "m=%p, glb_idx=%lld", m, (long long)glb_idx);
|
||||
if (glb_idx < 0) return -1;
|
||||
|
||||
h5_loc_idx_t loc_idx = h5priv_search_idxmap (&m->map_vertex_g2l, glb_idx); // loc_idx is position in map
|
||||
// loc_idx is position in map
|
||||
h5_loc_idx_t loc_idx = h5priv_search_idxmap (&m->map_vertex_g2l, glb_idx);
|
||||
if (loc_idx < 0) {
|
||||
H5_CORE_API_LEAVE (h5tpriv_error_global_id_nexist ("vertex", glb_idx));
|
||||
H5_LEAVE (
|
||||
h5tpriv_error_global_id_nexist ("vertex", glb_idx));
|
||||
}
|
||||
H5_CORE_API_RETURN (m->map_vertex_g2l.items[loc_idx].loc_idx); // loc_idx is position in m->vertices!
|
||||
// loc_idx is position in m->vertices!
|
||||
TRY (ret_value = m->map_vertex_g2l.items[loc_idx].loc_idx);
|
||||
H5_RETURN (ret_value);
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
@@ -131,7 +137,7 @@ h5t_map_global_vertex_indices2local (
|
||||
TRY (loc_indices[i] =
|
||||
h5t_map_global_vertex_idx2local (m, glb_indices[i]));
|
||||
}
|
||||
H5_CORE_API_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -154,13 +160,13 @@ h5t_map_glb_elem_idx2loc (
|
||||
m, (long long)glb_idx);
|
||||
|
||||
// global index is -1, if the cell is at the geometric border
|
||||
if (glb_idx < 0) H5_CORE_API_LEAVE (-1);
|
||||
if (glb_idx < 0) H5_LEAVE (-1);
|
||||
|
||||
h5_loc_idx_t i = h5priv_search_idxmap (&m->map_elem_g2l, glb_idx);
|
||||
// global index >= 0 && negative result means: element is on other proc
|
||||
if (i < 0) H5_CORE_API_LEAVE (-glb_idx-2);
|
||||
if (i < 0) H5_LEAVE (-glb_idx-2);
|
||||
|
||||
H5_CORE_API_RETURN (m->map_elem_g2l.items[i].loc_idx);
|
||||
H5_RETURN (m->map_elem_g2l.items[i].loc_idx);
|
||||
}
|
||||
|
||||
|
||||
@@ -181,7 +187,7 @@ h5t_map_glb_elem_indices2loc (
|
||||
loc_indices++;
|
||||
glb_indices++;
|
||||
}
|
||||
H5_CORE_API_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
|
||||
@@ -207,7 +213,7 @@ h5tpriv_rebuild_map_vertex_g2l (
|
||||
m->map_vertex_g2l.num_items++;
|
||||
}
|
||||
h5priv_sort_idxmap (&m->map_vertex_g2l);
|
||||
H5_PRIV_API_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
/*
|
||||
rebuild mapping of global vertex indices to their local indices
|
||||
@@ -230,7 +236,7 @@ h5tpriv_rebuild_map_vertex_g2l_partial (
|
||||
m->map_vertex_g2l.num_items++;
|
||||
}
|
||||
h5priv_sort_idxmap (&m->map_vertex_g2l);
|
||||
H5_PRIV_API_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
/*
|
||||
Get local vertex indices of entity given by it's local ID.
|
||||
@@ -256,7 +262,7 @@ h5t_get_loc_vertex_indices_of_entity (
|
||||
case H5T_TYPE_TRIANGLE: dim = 2; break;
|
||||
case H5T_TYPE_TET: dim = 3; break;
|
||||
default:
|
||||
H5_CORE_API_LEAVE (h5_error_internal ());
|
||||
H5_LEAVE (h5_error_internal ());
|
||||
}
|
||||
h5_loc_idx_t* indices = h5tpriv_get_loc_elem_vertex_indices (m, elem_idx);
|
||||
const h5t_ref_elem_t* ref_elem = m->ref_elem;
|
||||
@@ -265,7 +271,7 @@ h5t_get_loc_vertex_indices_of_entity (
|
||||
int idx = h5tpriv_ref_elem_get_vertex_idx(m, dim, face_idx, i);
|
||||
vertex_indices[i] = indices[idx];
|
||||
}
|
||||
H5_CORE_API_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
@@ -289,7 +295,7 @@ h5t_get_glb_vertex_indices_of_entity (
|
||||
case H5T_TYPE_TRIANGLE: dim = 2; break;
|
||||
case H5T_TYPE_TET: dim = 3; break;
|
||||
default:
|
||||
H5_CORE_API_LEAVE (h5_error_internal ());
|
||||
H5_LEAVE (h5_error_internal ());
|
||||
}
|
||||
h5_loc_idx_t* indices = h5tpriv_get_loc_elem_vertex_indices (m, elem_idx);
|
||||
const h5t_ref_elem_t* ref_elem = m->ref_elem;
|
||||
@@ -299,7 +305,7 @@ h5t_get_glb_vertex_indices_of_entity (
|
||||
h5_loc_idx_t loc_idx = indices[idx];
|
||||
vertex_indices[i] = m->vertices[loc_idx].idx;
|
||||
}
|
||||
H5_CORE_API_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
@@ -315,8 +321,9 @@ h5tpriv_get_loc_vtx_idx_of_vtx (
|
||||
(long long unsigned)*vertex_index);
|
||||
h5_loc_idx_t face_idx = h5tpriv_get_face_idx (entity_id);
|
||||
h5_loc_idx_t elem_idx = h5tpriv_get_elem_idx (entity_id);
|
||||
H5_CORE_API_RETURN (h5tpriv_get_loc_vtx_idx_of_vtx2 (
|
||||
m, face_idx, elem_idx, vertex_index));
|
||||
TRY (ret_value = h5tpriv_get_loc_vtx_idx_of_vtx2 (
|
||||
m, face_idx, elem_idx, vertex_index));
|
||||
H5_RETURN (ret_value);
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
@@ -333,7 +340,7 @@ h5tpriv_get_loc_vtx_idx_of_vtx2 (
|
||||
(long long unsigned)elem_idx,
|
||||
vertex_indices);
|
||||
vertex_indices[0] = h5tpriv_get_loc_elem_vertex_idx (m, elem_idx, face_idx);
|
||||
H5_CORE_API_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -352,8 +359,10 @@ h5t_get_loc_vertex_indices_of_edge (
|
||||
vertex_indices);
|
||||
h5_loc_idx_t face_idx = h5tpriv_get_face_idx (entity_id);
|
||||
h5_loc_idx_t elem_idx = h5tpriv_get_elem_idx (entity_id);
|
||||
H5_CORE_API_RETURN (h5t_get_loc_vertex_indices_of_edge2 (
|
||||
m, face_idx, elem_idx, vertex_indices));
|
||||
|
||||
TRY (ret_value = h5t_get_loc_vertex_indices_of_edge2 (
|
||||
m, face_idx, elem_idx, vertex_indices));
|
||||
H5_RETURN (ret_value);
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -383,7 +392,7 @@ h5t_get_loc_vertex_indices_of_edge2 (
|
||||
vertex_indices[0] = indices[idx];
|
||||
idx = h5tpriv_ref_elem_get_vertex_idx (m, 1, face_idx, 1);
|
||||
vertex_indices[1] = indices[idx];
|
||||
H5_CORE_API_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
@@ -399,8 +408,9 @@ h5t_get_loc_vertex_indices_of_triangle (
|
||||
vertex_indices);
|
||||
h5_loc_idx_t face_idx = h5tpriv_get_face_idx (entity_id);
|
||||
h5_loc_idx_t elem_idx = h5tpriv_get_elem_idx (entity_id);
|
||||
H5_CORE_API_RETURN (h5t_get_loc_vertex_indices_of_triangle2 (
|
||||
m, face_idx, elem_idx, vertex_indices));
|
||||
TRY (ret_value = h5t_get_loc_vertex_indices_of_triangle2 (
|
||||
m, face_idx, elem_idx, vertex_indices));
|
||||
H5_RETURN (ret_value);
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
@@ -425,7 +435,7 @@ h5t_get_loc_vertex_indices_of_triangle2 (
|
||||
vertex_indices[1] = indices[idx];
|
||||
idx = h5tpriv_ref_elem_get_vertex_idx (m, 2, face_idx, 2);
|
||||
vertex_indices[2] = indices[idx];
|
||||
H5_CORE_API_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
@@ -453,7 +463,7 @@ h5t_get_loc_vertex_indices_of_tet (
|
||||
vertex_indices[2] = indices[idx];
|
||||
idx = h5tpriv_ref_elem_get_vertex_idx (m, 3, 0, 3);
|
||||
vertex_indices[3] = indices[idx];
|
||||
H5_CORE_API_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
#ifdef WITH_PARALLEL_H5GRID
|
||||
@@ -468,10 +478,10 @@ compare_glb_idx_oct (const void * p_a,const void* p_b) {
|
||||
*/
|
||||
h5_err_t
|
||||
h5priv_exchange_loc_list_to_glb (
|
||||
h5t_mesh_t* const m,
|
||||
h5_glb_idxlist_t** glb_list
|
||||
) {
|
||||
H5_PRIV_FUNC_ENTER (h5_err_t, "m=%p, glb_list=%p", m, glb_list);
|
||||
h5t_mesh_t* const m,
|
||||
h5_glb_idxlist_t** glb_list
|
||||
) {
|
||||
H5_PRIV_API_ENTER (h5_err_t, "m=%p, glb_list=%p", m, glb_list);
|
||||
int* num_elems = NULL;
|
||||
TRY (num_elems = h5_calloc (m->f->nprocs, sizeof (*num_elems)));
|
||||
|
||||
@@ -490,11 +500,11 @@ h5priv_exchange_loc_list_to_glb (
|
||||
// loc -> glb
|
||||
for (int i = 0; i < m->marked_entities->num_items; i++) {
|
||||
if (m->marked_entities->items[i] > m->last_stored_eid) {
|
||||
H5_PRIV_FUNC_LEAVE (h5_error (
|
||||
H5_ERR_INVAL,
|
||||
"Element chosen to be refined is %d but there are only %d elements",
|
||||
m->marked_entities->items[i],
|
||||
m->last_stored_eid + 1 ));
|
||||
H5_RETURN_ERROR (
|
||||
H5_ERR_INVAL,
|
||||
"Element chosen to be refined is %d but there are only %d elements",
|
||||
m->marked_entities->items[i],
|
||||
m->last_stored_eid + 1);
|
||||
}
|
||||
|
||||
sendbuf[i] = h5tpriv_get_loc_elem_glb_idx (m, m->marked_entities->items[i]);
|
||||
@@ -528,7 +538,7 @@ h5priv_exchange_loc_list_to_glb (
|
||||
TRY (h5_free (num_elems));
|
||||
TRY (h5_free (sendbuf));
|
||||
TRY (h5_free (recvdispls));
|
||||
H5_PRIV_FUNC_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -544,7 +554,7 @@ h5priv_find_idlist (
|
||||
"list=%p, item=%llu",
|
||||
list, (long long unsigned)item);
|
||||
if (!list) {
|
||||
H5_PRIV_API_LEAVE (-1);
|
||||
H5_LEAVE (-1);
|
||||
}
|
||||
register size_t low = 0;
|
||||
register size_t mid;
|
||||
@@ -564,8 +574,8 @@ h5priv_find_idlist (
|
||||
else if ( diff < 0 )
|
||||
low = mid + 1;
|
||||
else
|
||||
H5_PRIV_API_LEAVE (mid); // found
|
||||
H5_LEAVE (mid); // found
|
||||
}
|
||||
H5_PRIV_API_RETURN (-(low+1)); // not found
|
||||
H5_RETURN (-(low+1)); // not found
|
||||
}
|
||||
|
||||
|
||||
+42
-43
@@ -7,25 +7,22 @@
|
||||
License: see file COPYING in top level of source distribution.
|
||||
*/
|
||||
|
||||
#include "h5core/h5_init.h"
|
||||
#include "h5core/h5_debug.h"
|
||||
#include "h5core/h5_log.h"
|
||||
|
||||
#include "private/h5.h"
|
||||
#include "private/h5_file.h"
|
||||
#include "private/h5_mpi.h"
|
||||
#include "private/h5_errorhandling.h"
|
||||
#include "private/h5_err.h"
|
||||
|
||||
#include "private/h5_attribs.h"
|
||||
#include "private/h5_hdf5.h"
|
||||
|
||||
#include "private/h5t_types.h"
|
||||
#include "private/h5t_errorhandling.h"
|
||||
#include "private/h5t_err.h"
|
||||
#include "private/h5t_model.h"
|
||||
#include "private/h5t_adjacencies.h"
|
||||
#include "private/h5t_io.h"
|
||||
#include "private/h5t_tags.h"
|
||||
|
||||
#include "private/h5_init.h"
|
||||
|
||||
#include "h5core/h5_model.h"
|
||||
#include "private/h5t_core.h"
|
||||
#include "private/h5t_store.h"
|
||||
@@ -196,7 +193,7 @@ h5tpriv_init_mesh (
|
||||
TRY (h5priv_read_attrib (
|
||||
m->mesh_gid,
|
||||
"__num_leaf_levels__",
|
||||
H5T_NATIVE_INT16,
|
||||
H5_INT16_T,
|
||||
&m->num_leaf_levels));
|
||||
//seems not to be set otherwise but for reading vtx it should be...
|
||||
m->leaf_level = m->num_leaf_levels-1;
|
||||
@@ -215,19 +212,19 @@ h5tpriv_init_mesh (
|
||||
TRY (h5priv_read_attrib (
|
||||
m->mesh_gid,
|
||||
"__num_elems__",
|
||||
H5T_NATIVE_INT64,
|
||||
H5_INT64_T,
|
||||
m->num_glb_elems));
|
||||
|
||||
TRY (h5priv_read_attrib (
|
||||
m->mesh_gid,
|
||||
"__num_leaf_elems__",
|
||||
H5T_NATIVE_INT64,
|
||||
H5_INT64_T,
|
||||
m->num_glb_leaf_elems));
|
||||
|
||||
TRY (h5priv_read_attrib (
|
||||
m->mesh_gid,
|
||||
"__num_vertices__",
|
||||
H5T_NATIVE_INT64,
|
||||
H5_INT64_T,
|
||||
m->num_glb_vertices));
|
||||
// if the file version is lower the following attributes are missing:
|
||||
hid_t exists;
|
||||
@@ -239,22 +236,22 @@ h5tpriv_init_mesh (
|
||||
TRY (h5priv_read_attrib (
|
||||
m->mesh_gid,
|
||||
"__num_b_vertices__",
|
||||
H5T_NATIVE_INT64,
|
||||
H5_INT64_T,
|
||||
m->num_b_vtx));
|
||||
TRY (h5priv_read_attrib (
|
||||
m->mesh_gid,
|
||||
"__first_b_vertices__",
|
||||
H5T_NATIVE_INT64,
|
||||
H5_INT64_T,
|
||||
m->first_b_vtx));
|
||||
TRY (h5priv_read_attrib (
|
||||
m->mesh_gid,
|
||||
"__is_chunked__",
|
||||
H5T_NATIVE_INT16,
|
||||
H5_INT16_T,
|
||||
&m->is_chunked));
|
||||
TRY (h5priv_read_attrib (
|
||||
m->mesh_gid,
|
||||
"__num_weights__",
|
||||
H5T_NATIVE_INT32,
|
||||
H5_INT32_T,
|
||||
&m->num_weights));
|
||||
} else {
|
||||
memset (m->num_b_vtx, -1, m->num_leaf_levels * sizeof (m->num_b_vtx));
|
||||
@@ -265,7 +262,7 @@ h5tpriv_init_mesh (
|
||||
|
||||
|
||||
}
|
||||
H5_PRIV_FUNC_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
|
||||
@@ -284,7 +281,7 @@ release_elems (
|
||||
TRY (h5_free (m->num_interior_leaf_elems)); m->num_interior_leaf_elems = NULL;
|
||||
TRY (h5_free (m->num_ghost_elems)); m->num_ghost_elems = NULL;
|
||||
TRY (h5_free (m->map_elem_g2l.items)); m->map_elem_g2l.items = NULL;
|
||||
H5_PRIV_FUNC_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
static h5_err_t
|
||||
@@ -298,7 +295,7 @@ release_vertices (
|
||||
TRY (h5_free (m->map_vertex_g2l.items)); m->map_vertex_g2l.items = NULL;
|
||||
TRY (h5_free (m->first_b_vtx)); m->first_b_vtx = NULL;
|
||||
TRY (h5_free (m->num_b_vtx)); m->num_b_vtx = NULL;
|
||||
H5_PRIV_FUNC_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
static h5_err_t
|
||||
@@ -317,7 +314,7 @@ release_memory (
|
||||
}
|
||||
#endif
|
||||
TRY (h5_free (m));
|
||||
H5_PRIV_FUNC_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
@@ -365,7 +362,7 @@ write_timing (
|
||||
m->timing.measure[26] - m->timing.measure[25]);
|
||||
fclose (file);
|
||||
}
|
||||
H5_CORE_API_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
h5_err_t
|
||||
set_timing_file (
|
||||
@@ -374,7 +371,7 @@ set_timing_file (
|
||||
) {
|
||||
H5_CORE_API_ENTER (h5_err_t, "m=%p", m);
|
||||
m->timing.f = time_f;
|
||||
H5_CORE_API_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
h5_err_t
|
||||
h5t_close_mesh (
|
||||
@@ -387,10 +384,10 @@ h5t_close_mesh (
|
||||
#endif
|
||||
// check if tagsets are still open
|
||||
if (m->mtagsets && m->mtagsets->num_items > 0)
|
||||
H5_CORE_API_LEAVE (
|
||||
h5_error (
|
||||
H5_ERR_H5FED,
|
||||
"Mesh cannot be closed: Mesh is referenced by open tagsets"));
|
||||
H5_RETURN_ERROR (
|
||||
H5_ERR_H5FED,
|
||||
"%s",
|
||||
"Mesh cannot be closed: Mesh is referenced by open tagsets");
|
||||
|
||||
if (!(m->f->props->flags & H5_O_RDONLY)) {
|
||||
TRY (h5tpriv_write_mesh (m));
|
||||
@@ -400,7 +397,7 @@ h5t_close_mesh (
|
||||
TRY (write_timing (m));
|
||||
#endif
|
||||
TRY (release_memory (m));
|
||||
H5_CORE_API_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
@@ -411,7 +408,7 @@ h5t_set_level (
|
||||
H5_CORE_API_ENTER (h5_err_t, "m=%p, level_id=%d", m, level_id);
|
||||
|
||||
if ((level_id < 0) || (level_id >= m->num_leaf_levels))
|
||||
H5_CORE_API_LEAVE (HANDLE_H5_OUT_OF_RANGE_ERR ("Level", level_id));
|
||||
H5_LEAVE (HANDLE_H5_OUT_OF_RANGE_ERR ("Level", level_id));
|
||||
|
||||
h5_lvl_idx_t prev_level = m->leaf_level;
|
||||
m->leaf_level = level_id;
|
||||
@@ -419,7 +416,7 @@ h5t_set_level (
|
||||
if (level_id >= m->num_loaded_levels) {
|
||||
TRY (h5tpriv_update_internal_structs (m, ++prev_level));
|
||||
}
|
||||
H5_CORE_API_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
@@ -428,7 +425,7 @@ h5t_set_mesh_changed (
|
||||
) {
|
||||
H5_CORE_API_ENTER (h5_err_t, "m=%p",m);
|
||||
m->mesh_changed = 1;
|
||||
H5_CORE_API_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -439,14 +436,14 @@ h5tpriv_alloc_loc_vertices (
|
||||
h5t_mesh_t* const m,
|
||||
const h5_size_t num
|
||||
) {
|
||||
H5_PRIV_FUNC_ENTER (h5_err_t,
|
||||
H5_PRIV_API_ENTER (h5_err_t,
|
||||
"m=%p, num=%llu",
|
||||
m,
|
||||
(long long unsigned)num);
|
||||
ssize_t size = num * sizeof (m->vertices[0]);
|
||||
TRY (m->vertices = h5_alloc (m->vertices, size));
|
||||
TRY (h5priv_grow_idxmap (&m->map_vertex_g2l, num));
|
||||
H5_PRIV_API_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
|
||||
@@ -470,12 +467,12 @@ get_num_meshes (
|
||||
|
||||
h5_err_t exists;
|
||||
TRY (exists = hdf5_link_exists (f->root_gid, H5T_CONTAINER_GRPNAME));
|
||||
if (!exists) H5_CORE_API_LEAVE (0);
|
||||
if (!exists) H5_LEAVE (0);
|
||||
|
||||
TRY (topo_gid = hdf5_open_group (f->root_gid, H5T_CONTAINER_GRPNAME));
|
||||
|
||||
TRY (exists = hdf5_link_exists (topo_gid, grpname));
|
||||
if (!exists) H5_CORE_API_LEAVE (0);
|
||||
if (!exists) H5_LEAVE (0);
|
||||
|
||||
TRY (meshes_gid = hdf5_open_group (topo_gid, grpname));
|
||||
h5_ssize_t num_meshes;
|
||||
@@ -483,7 +480,7 @@ get_num_meshes (
|
||||
TRY (hdf5_close_group (meshes_gid) );
|
||||
TRY (hdf5_close_group (topo_gid) );
|
||||
|
||||
H5_CORE_API_RETURN (num_meshes);
|
||||
H5_RETURN (num_meshes);
|
||||
}
|
||||
|
||||
h5_ssize_t
|
||||
@@ -491,7 +488,8 @@ h5t_get_num_tetmeshes (
|
||||
const h5_file_t fh
|
||||
) {
|
||||
H5_CORE_API_ENTER (h5_ssize_t, "f=%p", (h5_file_p)fh);
|
||||
H5_CORE_API_RETURN (get_num_meshes (fh, TETRAHEDRAL_MESHES_GRPNAME));
|
||||
TRY (ret_value = get_num_meshes (fh, TETRAHEDRAL_MESHES_GRPNAME));
|
||||
H5_RETURN (ret_value);
|
||||
}
|
||||
|
||||
h5_ssize_t
|
||||
@@ -499,7 +497,8 @@ h5t_get_num_trimeshes (
|
||||
const h5_file_t fh
|
||||
) {
|
||||
H5_CORE_API_ENTER (h5_ssize_t, "f=%p", (h5_file_p)fh);
|
||||
H5_CORE_API_RETURN (get_num_meshes (fh, TRIANGLE_MESHES_GRPNAME));
|
||||
TRY (ret_value = get_num_meshes (fh, TRIANGLE_MESHES_GRPNAME));
|
||||
H5_RETURN (ret_value);
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -514,7 +513,7 @@ h5t_get_num_leaf_levels (
|
||||
h5t_mesh_t* const m
|
||||
) {
|
||||
H5_CORE_API_ENTER (h5_ssize_t, "m=%p", m);
|
||||
H5_CORE_API_RETURN (m->num_leaf_levels);
|
||||
H5_RETURN (m->num_leaf_levels);
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -529,7 +528,7 @@ h5t_get_level (
|
||||
h5t_mesh_t* const m
|
||||
) {
|
||||
H5_CORE_API_ENTER (h5_lvl_idx_t, "m=%p", m);
|
||||
H5_CORE_API_RETURN (m->leaf_level);
|
||||
H5_RETURN (m->leaf_level);
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -556,9 +555,9 @@ h5t_get_num_leaf_elems (
|
||||
UNUSED_ARGUMENT (cnode);
|
||||
|
||||
if (m->leaf_level < 0) {
|
||||
H5_CORE_API_LEAVE (h5tpriv_error_undef_level ());
|
||||
H5_LEAVE (h5tpriv_error_undef_level ());
|
||||
}
|
||||
H5_CORE_API_RETURN (m->num_interior_leaf_elems[m->leaf_level]);
|
||||
H5_RETURN (m->num_interior_leaf_elems[m->leaf_level]);
|
||||
}
|
||||
/*!
|
||||
Return number of vertices on compute node \c cnode_id
|
||||
@@ -584,9 +583,9 @@ h5t_get_num_vertices (
|
||||
UNUSED_ARGUMENT (cnode);
|
||||
|
||||
if (m->leaf_level < 0) {
|
||||
H5_CORE_API_LEAVE (h5tpriv_error_undef_level ());
|
||||
H5_LEAVE (h5tpriv_error_undef_level ());
|
||||
}
|
||||
H5_CORE_API_RETURN (m->num_loc_vertices[m->leaf_level]);
|
||||
H5_RETURN (m->num_loc_vertices[m->leaf_level]);
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -601,6 +600,6 @@ h5t_is_chunked (
|
||||
h5t_mesh_t* const m
|
||||
) {
|
||||
H5_CORE_API_ENTER (h5_lvl_idx_t, "m=%p", m);
|
||||
H5_CORE_API_RETURN (m->is_chunked);
|
||||
H5_RETURN (m->is_chunked);
|
||||
}
|
||||
|
||||
|
||||
+298
-239
File diff suppressed because it is too large
Load Diff
+23
-22
@@ -7,13 +7,12 @@
|
||||
License: see file COPYING in top level of source distribution.
|
||||
*/
|
||||
|
||||
#include "h5core/h5_init.h"
|
||||
#include "h5core/h5_debug.h"
|
||||
#include "h5core/h5_log.h"
|
||||
|
||||
#include "private/h5.h"
|
||||
#include "private/h5_file.h"
|
||||
|
||||
#include "private/h5t_types.h"
|
||||
#include "private/h5t_errorhandling.h"
|
||||
#include "private/h5t_err.h"
|
||||
#include "private/h5t_map.h"
|
||||
#include "private/h5t_model.h"
|
||||
#include "private/h5t_access.h"
|
||||
@@ -84,7 +83,7 @@ iterate_boundary_facets (
|
||||
h5_loc_id_t elem_id;
|
||||
TRY( elem_id = iterate_geom_boundary_elems (iter) );
|
||||
if (elem_id == H5_NOK) {
|
||||
H5_PRIV_FUNC_LEAVE (H5_NOK); // done!
|
||||
H5_LEAVE (H5_NOK); // done!
|
||||
}
|
||||
it->elem_idx = h5tpriv_get_elem_idx (elem_id);
|
||||
it->face_idx = 0;
|
||||
@@ -93,7 +92,8 @@ iterate_boundary_facets (
|
||||
}
|
||||
} while (!h5tpriv_is_boundary_facet (it->mesh, it->elem_idx, it->face_idx));
|
||||
int type = h5tpriv_ref_elem_get_entity_type (it, dim);
|
||||
H5_PRIV_FUNC_RETURN (h5tpriv_build_entity_id (type, it->face_idx, it->elem_idx));
|
||||
TRY (ret_value = h5tpriv_build_entity_id (type, it->face_idx, it->elem_idx));
|
||||
H5_RETURN (ret_value);
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -112,7 +112,7 @@ iterate_leaf_faces (
|
||||
do {
|
||||
if (it->face_idx >= num_faces) {
|
||||
if (iter_leaf_elem_idx (it) == H5_NOK) {
|
||||
H5_PRIV_FUNC_LEAVE (H5_NOK); // done!
|
||||
H5_LEAVE (H5_NOK); // done!
|
||||
}
|
||||
it->face_idx = 0;
|
||||
} else {
|
||||
@@ -141,7 +141,7 @@ iterate_leaf_faces (
|
||||
current level and the element index of entry->items[i] is the smallest
|
||||
element index with the given face on the current level.
|
||||
*/
|
||||
H5_PRIV_FUNC_RETURN (entry->items[i]);
|
||||
H5_RETURN (entry->items[i]);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -165,7 +165,7 @@ iterate_boundary_faces (
|
||||
h5_loc_id_t elem_id;
|
||||
TRY( elem_id = iterate_geom_boundary_elems (iter) );
|
||||
if (elem_id == H5_NOK) {
|
||||
H5_PRIV_FUNC_LEAVE (H5_NOK); // done!
|
||||
H5_LEAVE (H5_NOK); // done!
|
||||
}
|
||||
it->face_idx = 0;
|
||||
} else {
|
||||
@@ -175,7 +175,7 @@ iterate_boundary_faces (
|
||||
it->mesh, dim, it->elem_idx, it->face_idx));
|
||||
// Skip already visited faces
|
||||
} while (0);
|
||||
H5_PRIV_FUNC_RETURN (h5_error_internal ());
|
||||
H5_RETURN (h5_error_internal ());
|
||||
}
|
||||
|
||||
static h5_loc_id_t
|
||||
@@ -196,7 +196,7 @@ iterate_tags (
|
||||
tags = iter->tagset->elems[iter->elem_idx];
|
||||
} while ((tags == NULL) || (tags->idx[iter->subentity_idx]));
|
||||
#endif
|
||||
H5_PRIV_FUNC_RETURN (h5_error_internal ());
|
||||
H5_RETURN (h5_error_internal ());
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
@@ -220,7 +220,7 @@ h5t_init_leaf_iterator (
|
||||
it->iter = iterate_leaf_elems;
|
||||
}
|
||||
TRY (h5tpriv_init_entity_iterator (m, iter, codim));
|
||||
H5_CORE_API_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
@@ -239,14 +239,14 @@ h5t_init_boundary_face_iterator (
|
||||
it->ref_elem = m->ref_elem;
|
||||
|
||||
if (it->codim <= 0 || it->codim > it->ref_elem->dim) {
|
||||
H5_CORE_API_LEAVE (h5tpriv_inval_codim (codim, 1, it->ref_elem->dim));
|
||||
H5_LEAVE (h5tpriv_inval_codim (codim, 1, it->ref_elem->dim));
|
||||
} else if (it->codim == 1) {
|
||||
it->iter = iterate_boundary_facets;
|
||||
}
|
||||
else if (it->codim > 1) {
|
||||
it->iter = iterate_boundary_faces;
|
||||
}
|
||||
H5_CORE_API_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
@@ -263,7 +263,7 @@ h5t_init_mtag_iterator (
|
||||
it->subentity_idx = 999;
|
||||
it->level_idx = m->leaf_level;
|
||||
it->iter = iterate_tags;
|
||||
H5_CORE_API_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
@@ -271,7 +271,8 @@ h5t_release_entity_iterator (
|
||||
h5t_iterator_t* iter
|
||||
) {
|
||||
H5_CORE_API_ENTER (h5_err_t, "iter=%p", iter);
|
||||
H5_CORE_API_RETURN (h5_free (iter));
|
||||
TRY (ret_value = h5_free (iter));
|
||||
H5_RETURN (ret_value);
|
||||
}
|
||||
|
||||
h5_loc_id_t
|
||||
@@ -279,7 +280,7 @@ h5t_iterate_entities (
|
||||
h5t_iterator_t* iter
|
||||
) {
|
||||
H5_CORE_API_ENTER (h5_err_t, "iter=%p", iter);
|
||||
H5_CORE_API_RETURN (iter->iter (iter));
|
||||
H5_RETURN (iter->iter (iter));
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
@@ -292,7 +293,7 @@ h5t_end_iterate_entities (
|
||||
it->face_idx = -1;
|
||||
it->elem_idx = -1;
|
||||
it->codim = -1;
|
||||
H5_CORE_API_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
@@ -308,7 +309,7 @@ h5t_get_vertex_coords_by_index (
|
||||
P);
|
||||
h5_loc_vertex_t *vertex = &m->vertices[vertex_index];
|
||||
memcpy ( P, &vertex->P, sizeof ( vertex->P ) );
|
||||
H5_CORE_API_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
@@ -325,7 +326,7 @@ h5t_get_vertex_coords_by_id (
|
||||
h5_loc_idx_t vertex_index;
|
||||
TRY (h5tpriv_get_loc_vtx_idx_of_vtx (m, vertex_id, &vertex_index));
|
||||
TRY (h5t_get_vertex_coords_by_index (m, vertex_index, P));
|
||||
H5_CORE_API_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
@@ -343,7 +344,7 @@ h5t_get_vertex_by_id (
|
||||
TRY (h5tpriv_get_loc_vtx_idx_of_vtx (m, vertex_id, &idx));
|
||||
*glb_idx = m->vertices[idx].idx;
|
||||
*P = m->vertices[idx].P;
|
||||
H5_CORE_API_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
|
||||
@@ -364,5 +365,5 @@ h5t_get_neighbor_indices (
|
||||
for (int i = 0; i < num_facets; i++) {
|
||||
neighbor_indices[i] = indices[i];
|
||||
}
|
||||
H5_CORE_API_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
+246
-249
File diff suppressed because it is too large
Load Diff
+80
-78
@@ -10,8 +10,6 @@
|
||||
#include "private/h5t_types.h"
|
||||
#include "h5core/h5t_map.h"
|
||||
|
||||
#include "h5core/h5_init.h"
|
||||
|
||||
#include "private/h5_va_macros.h"
|
||||
|
||||
#include "private/h5_attribs.h"
|
||||
@@ -23,8 +21,6 @@
|
||||
#include "private/h5t_model.h"
|
||||
#include "private/h5t_tags.h"
|
||||
|
||||
#include "private/h5_init.h"
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
static h5_err_t
|
||||
@@ -37,7 +33,7 @@ read_dataset (
|
||||
hid_t (*set_dspace)(h5t_mesh_t*,hid_t),
|
||||
void* const data
|
||||
) {
|
||||
H5_PRIV_API_ENTER (h5_err_t,
|
||||
H5_PRIV_FUNC_ENTER (h5_err_t,
|
||||
"f=%p, dset_id=%lld (%s), dsinfo=%p, set_mspace=%p, "
|
||||
"set_dspace=%p, data=%p",
|
||||
f, (long long int)dset_id, hdf5_get_objname(dset_id),
|
||||
@@ -61,7 +57,7 @@ read_dataset (
|
||||
TRY (hdf5_close_dataspace (dspace_id));
|
||||
TRY (hdf5_close_dataspace (mspace_id));
|
||||
|
||||
H5_PRIV_API_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
static hid_t
|
||||
@@ -85,14 +81,14 @@ h5t_get_num_mtagsets (
|
||||
h5_ssize_t num_mtagsets = 0;
|
||||
h5_err_t exists = 0;
|
||||
TRY (exists = h5priv_link_exists (m->mesh_gid, "Tags"));
|
||||
if (!exists) H5_CORE_API_LEAVE (0);
|
||||
if (!exists) H5_LEAVE (0);
|
||||
|
||||
hid_t loc_id;
|
||||
TRY (loc_id = h5priv_open_group (0, m->mesh_gid, "Tags"));
|
||||
TRY (loc_id = h5priv_open_group (m->mesh_gid, "Tags"));
|
||||
TRY (num_mtagsets = hdf5_get_num_groups (loc_id));
|
||||
TRY (hdf5_close_group (loc_id));
|
||||
|
||||
H5_CORE_API_RETURN (num_mtagsets);
|
||||
H5_RETURN (num_mtagsets);
|
||||
|
||||
}
|
||||
|
||||
@@ -117,15 +113,13 @@ get_tagset_info (
|
||||
// open this tag
|
||||
TRY (tag_id = hdf5_open_group (tags_id, name));
|
||||
// determine type of dataset with values
|
||||
TRY (dset_id = hdf5_open_dataset (tag_id, "values"));
|
||||
hid_t type_;
|
||||
TRY (type_ = hdf5_get_dataset_type (dset_id));
|
||||
TRY (*type = h5priv_normalize_h5_type (type_));
|
||||
TRY (dset_id = hdf5_open_dataset_by_name (tag_id, "values"));
|
||||
TRY (*type = h5priv_get_normalized_dataset_type (dset_id));
|
||||
|
||||
TRY (hdf5_close_dataset (dset_id));
|
||||
TRY (hdf5_close_group (tag_id));
|
||||
TRY (hdf5_close_group (tags_id));
|
||||
H5_PRIV_FUNC_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -145,9 +139,8 @@ h5t_get_mtagset_info (
|
||||
"m=%p, idx=%llu, name=%p, len_name=%llu, type=%p",
|
||||
m, (long long unsigned)idx, name,
|
||||
(long long unsigned)len_name, type);
|
||||
|
||||
|
||||
H5_CORE_API_RETURN (get_tagset_info(m->mesh_gid, idx, name, len_name, type));
|
||||
TRY (ret_value = get_tagset_info(m->mesh_gid, idx, name, len_name, type));
|
||||
H5_RETURN (ret_value);
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -159,7 +152,8 @@ h5t_mtagset_exists (
|
||||
const char name[]
|
||||
) {
|
||||
H5_CORE_API_ENTER (h5_err_t, "m=%p, name=%s", m, name);
|
||||
H5_CORE_API_RETURN (h5priv_link_exists (m->mesh_gid, "Tags", name));
|
||||
TRY (ret_value = h5priv_link_exists (m->mesh_gid, "Tags", name));
|
||||
H5_RETURN (ret_value);
|
||||
}
|
||||
|
||||
static h5_err_t
|
||||
@@ -189,7 +183,7 @@ new_tagset (
|
||||
TRY (h5priv_search_strlist (&m->mtagsets, name));
|
||||
|
||||
*rtagset = tagset;
|
||||
H5_PRIV_FUNC_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -199,7 +193,7 @@ h5_err_t
|
||||
h5t_create_mtagset (
|
||||
h5t_mesh_t* const m,
|
||||
const char name[],
|
||||
const h5_id_t type,
|
||||
const h5_types_t type,
|
||||
h5t_tagset_t** set
|
||||
) {
|
||||
H5_CORE_API_ENTER (h5_err_t,
|
||||
@@ -207,27 +201,29 @@ h5t_create_mtagset (
|
||||
m, name, (long long unsigned)type, set);
|
||||
// validate name
|
||||
if (name == NULL || name[0] == '\0') {
|
||||
H5_PRIV_FUNC_LEAVE (
|
||||
h5_error (H5_ERR_INVAL, "Invalid name" ));
|
||||
H5_RETURN_ERROR (
|
||||
H5_ERR_INVAL,
|
||||
"%s",
|
||||
"Invalid name");
|
||||
}
|
||||
|
||||
// validate type
|
||||
if (type != H5_INT64_T && type != H5_FLOAT64_T) {
|
||||
H5_PRIV_FUNC_LEAVE (
|
||||
h5_error (H5_ERR_INVAL, "Unsupported data type." ));
|
||||
H5_RETURN_ERROR (
|
||||
H5_ERR_INVAL,
|
||||
"%s",
|
||||
"Unsupported data type.");
|
||||
}
|
||||
|
||||
// check if a tagset with given name already exists
|
||||
h5_err_t exists;
|
||||
TRY (exists = h5priv_link_exists (m->mesh_gid, "Tags", name));
|
||||
if (exists || h5priv_find_strlist (m->mtagsets, name) >= 0)
|
||||
H5_CORE_API_LEAVE (
|
||||
h5_error (
|
||||
H5_ERR_H5FED,
|
||||
"Cannot create tagset '%s': Tagset exists", name));
|
||||
|
||||
|
||||
H5_CORE_API_RETURN (new_tagset (m, m->mesh_gid, name, type, set));
|
||||
H5_RETURN_ERROR (
|
||||
H5_ERR_H5FED,
|
||||
"Cannot create tagset '%s': Tagset exists", name);
|
||||
TRY (ret_value = new_tagset (m, m->mesh_gid, name, type, set));
|
||||
H5_RETURN (ret_value);
|
||||
}
|
||||
|
||||
static int
|
||||
@@ -263,7 +259,7 @@ remove_tag (
|
||||
"tagset=%p, face_id=%lld, elem_idx=%lld",
|
||||
tagset, (long long)face_id, (long long)elem_idx);
|
||||
if (tagset->elems[elem_idx] == NULL) {
|
||||
H5_PRIV_FUNC_LEAVE (
|
||||
H5_LEAVE (
|
||||
h5_warn (
|
||||
"Tag %s not set for face %llx of element %lld",
|
||||
tagset->name,
|
||||
@@ -275,7 +271,7 @@ remove_tag (
|
||||
// remove values
|
||||
int idx = find_face_id (eleminfo, face_id);
|
||||
if (idx < 0) {
|
||||
H5_PRIV_FUNC_LEAVE (
|
||||
H5_LEAVE (
|
||||
h5_warn (
|
||||
"Tag %s not set for face %llx of element %lld",
|
||||
tagset->name,
|
||||
@@ -295,7 +291,7 @@ remove_tag (
|
||||
(eleminfo->num_tags-idx-1)*sizeof (ti[0]) );
|
||||
|
||||
// we don't resize the eleminfo structure!!!
|
||||
H5_PRIV_FUNC_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
static h5_err_t
|
||||
@@ -333,7 +329,7 @@ add_tag (
|
||||
dim*sizeof (*tagset->values));
|
||||
ti->val_idx = tagset->num_values;
|
||||
tagset->num_values += dim;
|
||||
H5_PRIV_FUNC_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
static inline h5_err_t
|
||||
@@ -392,7 +388,7 @@ set_tag (
|
||||
if (tagset->m->leaf_level > tagset->scope.max_level) {
|
||||
tagset->scope.max_level = tagset->m->leaf_level;
|
||||
}
|
||||
H5_PRIV_FUNC_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
|
||||
@@ -404,8 +400,9 @@ read_tagset (
|
||||
hid_t loc_id = 0;
|
||||
|
||||
// open HDF5 group
|
||||
|
||||
TRY (loc_id = h5priv_open_group (0, tagset->parent_gid, "Tags", tagset->name));
|
||||
TRY (loc_id = h5priv_open_group_with_intermediates (
|
||||
tagset->parent_gid,
|
||||
"Tags", tagset->name, NULL));
|
||||
|
||||
// read datasets:
|
||||
|
||||
@@ -414,7 +411,7 @@ read_tagset (
|
||||
size_t num_interior_elems = 0;
|
||||
|
||||
hid_t dset_id;
|
||||
TRY (dset_id = hdf5_open_dataset (loc_id, "elems"));
|
||||
TRY (dset_id = hdf5_open_dataset_by_name (loc_id, "elems"));
|
||||
TRY (num_interior_elems = hdf5_get_npoints_of_dataset (dset_id));
|
||||
TRY (elems = h5_calloc (num_interior_elems, sizeof(*elems)));
|
||||
|
||||
@@ -436,7 +433,7 @@ read_tagset (
|
||||
h5t_glb_tag_idx_t* entities;
|
||||
size_t ent_idx = 0;
|
||||
size_t num_entities = 0;
|
||||
TRY (dset_id = hdf5_open_dataset (loc_id, "entities"));
|
||||
TRY (dset_id = hdf5_open_dataset_by_name (loc_id, "entities"));
|
||||
TRY (num_entities = hdf5_get_npoints_of_dataset (dset_id));
|
||||
TRY (entities = h5_calloc (num_entities, sizeof(*entities)));
|
||||
TRY (read_dataset (
|
||||
@@ -452,10 +449,10 @@ read_tagset (
|
||||
// "values"
|
||||
h5_int64_t* vals;
|
||||
size_t num_vals = 0;
|
||||
TRY (dset_id = hdf5_open_dataset (loc_id, "values"));
|
||||
TRY (dset_id = hdf5_open_dataset_by_name (loc_id, "values"));
|
||||
TRY (num_vals = hdf5_get_npoints_of_dataset (dset_id));
|
||||
TRY (vals = h5_calloc (num_vals, sizeof (*vals)));
|
||||
TRY (dsinfo.type_id = hdf5_get_dataset_type (dset_id));
|
||||
TRY (dsinfo.type_id = h5priv_get_normalized_dataset_type (dset_id));
|
||||
TRY (read_dataset (
|
||||
tagset->m,
|
||||
tagset->m->f,
|
||||
@@ -463,8 +460,8 @@ read_tagset (
|
||||
&dsinfo,
|
||||
open_space_all, open_space_all,
|
||||
vals));
|
||||
TRY (hdf5_close_dataset (dset_id ));
|
||||
tagset->type = h5priv_normalize_h5_type (dsinfo.type_id);
|
||||
TRY (hdf5_close_dataset (dset_id));
|
||||
tagset->type = dsinfo.type_id;
|
||||
|
||||
/*
|
||||
add tagset and set values
|
||||
@@ -493,10 +490,11 @@ read_tagset (
|
||||
dim,
|
||||
&vals[entity->idx]));
|
||||
}
|
||||
TRY (hdf5_close_group (loc_id));
|
||||
TRY (h5_free (elems));
|
||||
TRY (h5_free (entities));
|
||||
TRY (h5_free (vals));
|
||||
H5_PRIV_FUNC_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -513,28 +511,32 @@ h5t_open_mtagset (
|
||||
m, name, set);
|
||||
// validate name
|
||||
if (name == NULL || name[0] == '\0') {
|
||||
H5_PRIV_FUNC_LEAVE (
|
||||
h5_error (H5_ERR_INVAL, "Invalid name" ));
|
||||
H5_RETURN_ERROR (
|
||||
H5_ERR_INVAL,
|
||||
"%s",
|
||||
"Invalid name");
|
||||
}
|
||||
|
||||
// check if a tagset with given name exists
|
||||
h5_err_t exists;
|
||||
TRY (exists = h5priv_link_exists (m->mesh_gid, "Tags", name));
|
||||
if (!exists) H5_CORE_API_LEAVE (
|
||||
h5_error (
|
||||
H5_ERR_INVAL,
|
||||
"Cannot open tagset '%s': No such tagset ", name));
|
||||
if (!exists)
|
||||
H5_RETURN_ERROR (
|
||||
H5_ERR_INVAL,
|
||||
"Cannot open tagset '%s': No such tagset ",
|
||||
name);
|
||||
|
||||
// check if tagset has already been opened
|
||||
if (h5priv_find_strlist (m->mtagsets, name) >= 0) H5_CORE_API_LEAVE (
|
||||
h5_error (
|
||||
H5_ERR_INVAL,
|
||||
"Cannot open tagset '%s': Already open ", name));
|
||||
if (h5priv_find_strlist (m->mtagsets, name) >= 0)
|
||||
H5_RETURN_ERROR (
|
||||
H5_ERR_INVAL,
|
||||
"Cannot open tagset '%s': Already open ",
|
||||
name);
|
||||
|
||||
|
||||
TRY (new_tagset (m, m->mesh_gid, name, -1, set));
|
||||
TRY (read_tagset (*set));
|
||||
H5_CORE_API_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -560,11 +562,11 @@ write_tagset (
|
||||
|
||||
h5t_mesh_t* m = tagset->m;
|
||||
if (m->num_leaf_levels <= 0) {
|
||||
H5_PRIV_FUNC_LEAVE (H5_SUCCESS); // nothing to do
|
||||
H5_LEAVE (H5_SUCCESS); // nothing to do
|
||||
}
|
||||
num_interior_elems = m->num_interior_elems[m->num_leaf_levels-1];
|
||||
if (num_interior_elems == 0 || tagset->num_entities == 0) {
|
||||
H5_PRIV_FUNC_LEAVE (H5_SUCCESS); // nothing to do
|
||||
H5_LEAVE (H5_SUCCESS); // nothing to do
|
||||
}
|
||||
// allocate memory per element (plus 1)
|
||||
TRY (elems = h5_calloc (num_interior_elems+1, sizeof(*elems)));
|
||||
@@ -611,11 +613,9 @@ write_tagset (
|
||||
tagset->num_values = entity->idx = val_idx;
|
||||
|
||||
// write data
|
||||
TRY (group_id = h5priv_open_group (
|
||||
1,
|
||||
TRY (group_id = h5priv_create_group_with_intermediates (
|
||||
tagset->parent_gid,
|
||||
"Tags",
|
||||
tagset->name));
|
||||
"Tags", tagset->name, NULL));
|
||||
h5_dsinfo_t dsinfo;
|
||||
memset (&dsinfo, 0, sizeof(dsinfo));
|
||||
dsinfo.rank = 1;
|
||||
@@ -661,15 +661,15 @@ write_tagset (
|
||||
open_space_all, open_space_all,
|
||||
values));
|
||||
h5_int64_t scope = tagset->scope.min_level;
|
||||
TRY (h5priv_write_attrib (group_id, "__scope_min__", H5_INT64_T, &scope, 1, 1));
|
||||
TRY (h5priv_write_attrib (group_id, "__scope_min__", H5_INT64_T, &scope, 1));
|
||||
scope = tagset->scope.max_level;
|
||||
TRY (h5priv_write_attrib (group_id, "__scope_max__", H5_INT64_T, &scope, 1, 1));
|
||||
TRY (h5priv_write_attrib (group_id, "__scope_max__", H5_INT64_T, &scope, 1));
|
||||
|
||||
TRY (hdf5_close_group (group_id));
|
||||
TRY (h5_free (elems));
|
||||
TRY (h5_free (entities));
|
||||
TRY (h5_free (values));
|
||||
H5_PRIV_FUNC_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
|
||||
@@ -696,7 +696,7 @@ release_mtagset (
|
||||
TRY (h5_free (tagset->values));
|
||||
TRY (h5_free (tagset));
|
||||
|
||||
H5_PRIV_FUNC_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -713,7 +713,7 @@ h5t_close_mtagset (
|
||||
TRY (write_tagset (tagset));
|
||||
}
|
||||
TRY (release_mtagset (tagset));
|
||||
H5_CORE_API_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -750,7 +750,7 @@ remove_tagset (
|
||||
TRY (hdf5_delete_link (loc_id, "values", H5P_DEFAULT));
|
||||
TRY (hdf5_close_group (loc_id));
|
||||
TRY (hdf5_delete_link (tagsets_id, name, H5P_DEFAULT));
|
||||
H5_PRIV_FUNC_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -769,16 +769,17 @@ h5t_remove_mtagset (
|
||||
H5_CORE_API_ENTER (h5_err_t, "m=%p, name='%s'", m, name);
|
||||
|
||||
// check if tagset has a copy in memory
|
||||
if (h5priv_find_strlist (m->mtagsets, name) >= 0) H5_CORE_API_LEAVE (
|
||||
h5_error (
|
||||
H5_ERR_INVAL,
|
||||
"Cannot remove tagset '%s': Still open ", name));
|
||||
if (h5priv_find_strlist (m->mtagsets, name) >= 0)
|
||||
H5_RETURN_ERROR (
|
||||
H5_ERR_INVAL,
|
||||
"Cannot remove tagset '%s': Still open ",
|
||||
name);
|
||||
|
||||
hid_t loc_id;
|
||||
TRY (loc_id = hdf5_open_group (m->mesh_gid, "Tags"));
|
||||
TRY (remove_tagset (loc_id, name));
|
||||
TRY (hdf5_close_group (loc_id));
|
||||
H5_CORE_API_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -801,7 +802,7 @@ h5t_set_tag (
|
||||
h5_loc_idx_t elem_idx = h5tpriv_get_elem_idx (entity_id);
|
||||
TRY (set_tag (tagset, face_id, elem_idx, size, val));
|
||||
tagset->changed = 1;
|
||||
H5_CORE_API_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
static inline h5_err_t
|
||||
@@ -850,7 +851,7 @@ h5t_get_tag (
|
||||
dim,
|
||||
values);
|
||||
if (tagset->m->leaf_level < tagset->scope.min_level) {
|
||||
H5_CORE_API_LEAVE (H5_NOK); // entity not tagged
|
||||
H5_LEAVE (H5_NOK); // entity not tagged
|
||||
}
|
||||
h5_loc_id_t id = entity_id;
|
||||
h5_err_t h5err;
|
||||
@@ -861,7 +862,7 @@ h5t_get_tag (
|
||||
(id = h5tpriv_get_loc_entity_parent (tagset->m, id)) >= 0) ;
|
||||
|
||||
if (h5err < 0)
|
||||
H5_CORE_API_LEAVE (H5_NOK); // entity not tagged
|
||||
H5_LEAVE (H5_NOK); // entity not tagged
|
||||
|
||||
h5_loc_idx_t elem_idx = h5tpriv_get_elem_idx (id);
|
||||
h5t_taginfo_t* ti = &tagset->elems[elem_idx]->ti[ti_idx];
|
||||
@@ -872,7 +873,7 @@ h5t_get_tag (
|
||||
if (values != NULL) {
|
||||
memcpy (values, v + val_idx, *dim*sizeof(*v) );
|
||||
}
|
||||
H5_CORE_API_RETURN (id);
|
||||
H5_RETURN (id);
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -891,6 +892,7 @@ h5t_remove_tag (
|
||||
tagset, (long long)entity_id);
|
||||
h5_loc_idx_t face_id = h5tpriv_get_face_id (entity_id);
|
||||
h5_loc_idx_t elem_idx = h5tpriv_get_elem_idx (entity_id);
|
||||
H5_CORE_API_RETURN (remove_tag (tagset, face_id, elem_idx));
|
||||
TRY (ret_value = remove_tag (tagset, face_id, elem_idx));
|
||||
H5_RETURN (ret_value);
|
||||
}
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user