Compare commits
80 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 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 |
+3
-8
@@ -5,9 +5,11 @@
|
||||
*.so
|
||||
*.dSYM
|
||||
*~
|
||||
*.h5
|
||||
.deps
|
||||
.dirstamp
|
||||
.libs
|
||||
INSTALL
|
||||
Makefile
|
||||
Makefile.in
|
||||
aclocal.m4
|
||||
@@ -23,9 +25,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 +42,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 +75,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
|
||||
|
||||
+8
-4
@@ -1,12 +1,12 @@
|
||||
#
|
||||
# Copyright (c) 2006-2016, 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.
|
||||
#
|
||||
# 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.0rc3], [h5part@lists.psi.ch], H5hut)
|
||||
AC_PREREQ(2.60)
|
||||
AC_CONFIG_HEADERS(config.h)
|
||||
AC_CONFIG_MACRO_DIR([m4])
|
||||
@@ -112,9 +112,13 @@ 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
|
||||
c_compilers="mpicc cc"
|
||||
cxx_compilers="mpic++ CC"
|
||||
else
|
||||
|
||||
@@ -18,6 +18,10 @@ LDADD += -lH5hutF
|
||||
AM_LDFLAGS += -L${abs_top_builddir}/src/Fortran/.libs
|
||||
endif
|
||||
|
||||
if ENABLE_DEBUG
|
||||
AM_LDFLAGS += -static
|
||||
endif
|
||||
|
||||
LDADD += -lH5hut
|
||||
|
||||
noinst_PROGRAMS =
|
||||
|
||||
@@ -14,6 +14,9 @@
|
||||
|
||||
#define FNAME "attach_file.h5"
|
||||
#define ATTACHMENT "attach_file"
|
||||
#define VERBOSITY H5_VERBOSE_ERROR
|
||||
#define DEBUG_MSK H5_DEBUG_ALL
|
||||
|
||||
|
||||
int
|
||||
main (
|
||||
@@ -23,11 +26,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;
|
||||
|
||||
@@ -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.
|
||||
@@ -9,8 +9,11 @@
|
||||
|
||||
#include "H5hut.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 +26,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);
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
|
||||
#include "H5hut.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#define FNAME "example_step_attribs.h5"
|
||||
|
||||
#define ATTR_STRING "StepAttrString"
|
||||
|
||||
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)
|
||||
@@ -103,13 +103,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
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
|
||||
#include "H5hut.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#define NPROCS 8
|
||||
#define DEFAULT_VERBOSITY H5_VERBOSE_DEFAULT
|
||||
|
||||
|
||||
@@ -21,7 +21,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 *~
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
query
|
||||
read_core_vfd
|
||||
read_core_vfdf
|
||||
read_canonicalviewf
|
||||
|
||||
@@ -29,6 +29,7 @@ noinst_PROGRAMS =
|
||||
|
||||
if ENABLE_C
|
||||
noinst_PROGRAMS += \
|
||||
query \
|
||||
read_core_vfd \
|
||||
read_canonicalview \
|
||||
read_setnparticles \
|
||||
@@ -73,6 +74,6 @@ endif
|
||||
$(FC) $(FFLAGS) -c $<
|
||||
|
||||
clean-local:
|
||||
$(RM) *~
|
||||
$(RM) -f *~
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,114 @@
|
||||
/*
|
||||
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"
|
||||
|
||||
#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;
|
||||
}
|
||||
@@ -9,6 +9,8 @@
|
||||
|
||||
#include "H5hut.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
// name of input file
|
||||
const char* fname = "example_setview.h5";
|
||||
|
||||
|
||||
@@ -15,6 +15,8 @@
|
||||
*/
|
||||
#include "H5hut.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
// name of input file
|
||||
const char* fname = "example_core_vfd.h5";
|
||||
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
|
||||
#include "H5hut.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
// name of input file
|
||||
const char* fname = "example_setnparticles.h5";
|
||||
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
|
||||
#include "H5hut.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
// name of input file
|
||||
const char* fname = "example_setview.h5";
|
||||
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
|
||||
#include "H5hut.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
// name of input file
|
||||
const char* fname = "example_strided.h5";
|
||||
|
||||
|
||||
+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 \
|
||||
|
||||
+3
-4
@@ -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>
|
||||
@@ -249,7 +248,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 +259,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"
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*/
|
||||
|
||||
#include "h5_private.h"
|
||||
#include "h5core/h5_debug.h"
|
||||
#include "h5core/h5_log.h"
|
||||
|
||||
#include "h5core/h5u_io.h"
|
||||
|
||||
@@ -29,7 +29,7 @@ h5pt_writedata_r8 (
|
||||
(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 );
|
||||
f, name2, (void*)data, H5_FLOAT64_T );
|
||||
free ( name2 );
|
||||
H5_API_RETURN(herr);
|
||||
}
|
||||
@@ -50,7 +50,7 @@ h5pt_writedata_r4 (
|
||||
(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 );
|
||||
f, name2, (void*)data, H5_FLOAT32_T );
|
||||
free ( name2 );
|
||||
H5_API_RETURN(herr);
|
||||
}
|
||||
@@ -71,7 +71,7 @@ h5pt_writedata_i8 (
|
||||
(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 );
|
||||
f, name2, (void*)data, H5_INT64_T );
|
||||
free ( name2 );
|
||||
H5_API_RETURN(herr);
|
||||
}
|
||||
@@ -92,7 +92,7 @@ h5pt_writedata_i4 (
|
||||
(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 );
|
||||
f, name2, (void*)data, H5_INT32_T );
|
||||
free ( name2 );
|
||||
H5_API_RETURN(herr);
|
||||
}
|
||||
@@ -115,7 +115,7 @@ h5pt_readdata_r8 (
|
||||
(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 );
|
||||
f, name2, data, H5_FLOAT64_T );
|
||||
free ( name2 );
|
||||
H5_API_RETURN(herr);
|
||||
}
|
||||
@@ -136,7 +136,7 @@ h5pt_readdata_r4 (
|
||||
(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 );
|
||||
f, name2, data, H5_FLOAT32_T );
|
||||
free ( name2 );
|
||||
H5_API_RETURN(herr);
|
||||
}
|
||||
@@ -157,7 +157,7 @@ h5pt_readdata_i8 (
|
||||
(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 );
|
||||
f, name2, data, H5_INT64_T );
|
||||
|
||||
free ( name2 );
|
||||
H5_API_RETURN(herr);
|
||||
@@ -179,7 +179,7 @@ h5pt_readdata_i4 (
|
||||
(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 );
|
||||
f, name2, data, 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/h5u_model.h"
|
||||
#include "h5core/h5u_io.h"
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -414,7 +412,6 @@ h5_getstepattribinfo (
|
||||
attrib_type,
|
||||
(h5_size_t*)attrib_nelem);
|
||||
h5_strc2for (attrib_name, l_attrib_name);
|
||||
convert_type2for (attrib_type);
|
||||
H5_API_RETURN (h5err);
|
||||
}
|
||||
|
||||
@@ -443,7 +440,6 @@ h5_getstepattribinfo_by_name (
|
||||
name,
|
||||
_type,
|
||||
(h5_size_t*)_nelem);
|
||||
convert_type2for (_type);
|
||||
H5_API_RETURN (h5err);
|
||||
}
|
||||
|
||||
|
||||
@@ -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 */
|
||||
|
||||
@@ -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"
|
||||
|
||||
|
||||
+16
-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,30 @@ 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/
|
||||
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 \
|
||||
private/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);
|
||||
}
|
||||
|
||||
+138
-243
@@ -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,7 +26,8 @@ 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
|
||||
@@ -173,54 +42,9 @@ h5_has_step_attrib (
|
||||
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);
|
||||
TRY (ret_value = hdf5_attribute_exists (f->step_gid, attrib_name));
|
||||
H5_RETURN (ret_value);
|
||||
}
|
||||
|
||||
h5_ssize_t
|
||||
@@ -230,7 +54,8 @@ 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
|
||||
@@ -241,17 +66,18 @@ h5_get_num_step_attribs (
|
||||
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));
|
||||
TRY (ret_value = hdf5_get_num_attribute (f->step_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,10 +90,35 @@ 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,
|
||||
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_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_CORE_API_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (ret_value);
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
@@ -282,28 +133,53 @@ 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);
|
||||
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,
|
||||
TRY (ret_value = h5priv_get_attrib_info_by_idx (
|
||||
f->step_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_step_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_FILEHANDLE (f);
|
||||
CHECK_TIMEGROUP (f);
|
||||
TRY (ret_value = h5priv_get_attrib_info_by_name (
|
||||
f->step_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 +190,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 (
|
||||
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,
|
||||
@@ -338,69 +215,87 @@ h5_read_step_attrib (
|
||||
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_READABLE_MODE (f);
|
||||
|
||||
TRY (ret_value = h5priv_read_attrib (
|
||||
f->step_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 (
|
||||
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_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)));
|
||||
if (is_appendonly (f)) {
|
||||
TRY (h5priv_append_attrib (
|
||||
f->step_gid,
|
||||
attrib_name,
|
||||
attrib_type,
|
||||
attrib_value,
|
||||
attrib_nelem));
|
||||
} else {
|
||||
TRY (h5priv_write_attrib (
|
||||
f->step_gid,
|
||||
attrib_name,
|
||||
attrib_type,
|
||||
attrib_value,
|
||||
attrib_nelem));
|
||||
}
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -7,7 +7,8 @@
|
||||
License: see file COPYING in top level of source distribution.
|
||||
*/
|
||||
|
||||
#include "h5core/h5_init.h"
|
||||
#include "h5core/h5_log.h"
|
||||
#include "h5core/h5_err.h"
|
||||
#include "private/h5_init.h"
|
||||
|
||||
static h5_errorhandler_t h5_errhandler = h5_report_errorhandler;
|
||||
@@ -88,6 +89,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 +120,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,10 +137,10 @@ 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
|
||||
@@ -130,20 +151,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 +161,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 +173,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);
|
||||
}
|
||||
+137
-110
@@ -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"
|
||||
|
||||
/*!
|
||||
@@ -56,19 +56,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_FILEHANDLE (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() >= 5) {
|
||||
H5Eprint (estack_id, stderr);
|
||||
}
|
||||
return 0;
|
||||
@@ -141,7 +142,7 @@ mpi_init (
|
||||
}
|
||||
#endif
|
||||
#endif /* PARALLEL_IO */
|
||||
H5_INLINE_FUNC_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
static inline h5_err_t
|
||||
@@ -163,15 +164,15 @@ 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));
|
||||
@@ -181,7 +182,7 @@ set_default_file_props (
|
||||
H5_STEPNAME_LEN - 1);
|
||||
props->width_step_idx = H5_STEPWIDTH;
|
||||
props->comm = MPI_COMM_WORLD;
|
||||
H5_INLINE_FUNC_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
@@ -189,15 +190,14 @@ 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);
|
||||
}
|
||||
props->flags &= ~(H5_VFD_MPIO_POSIX | H5_VFD_MPIO_INDEPENDENT | H5_VFD_CORE);
|
||||
props->flags |= H5_VFD_MPIO_COLLECTIVE;
|
||||
@@ -207,7 +207,7 @@ h5_set_prop_file_mpio_collective (
|
||||
props->throttle = 0;
|
||||
}
|
||||
|
||||
H5_CORE_API_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
@@ -215,20 +215,19 @@ 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);
|
||||
}
|
||||
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);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
#if H5_VERSION_LE(1,8,12)
|
||||
@@ -237,37 +236,35 @@ 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);
|
||||
}
|
||||
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);
|
||||
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_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);
|
||||
props->flags |= H5_VFD_MPIO_INDEPENDENT;
|
||||
@@ -277,47 +274,66 @@ 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);
|
||||
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);
|
||||
}
|
||||
|
||||
#if 0
|
||||
h5_err_t
|
||||
h5_set_prop_file_flush_step (
|
||||
h5_prop_t _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_RETURN_ERROR (
|
||||
H5_ERR_INVAL,
|
||||
"Invalid property class: %lld",
|
||||
(long long int)props->class);
|
||||
}
|
||||
props-> = align;
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
#endif
|
||||
|
||||
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);
|
||||
}
|
||||
// throttle only if VFD is MPIO independent od POSIX
|
||||
h5_int64_t mask = H5_VFD_MPIO_INDEPENDENT;
|
||||
@@ -338,13 +354,13 @@ h5_set_prop_file_throttle (
|
||||
}
|
||||
|
||||
props->throttle = throttle;
|
||||
H5_CORE_API_RETURN (H5_SUCCESS);
|
||||
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 +373,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
|
||||
@@ -379,20 +394,19 @@ h5_close_prop (
|
||||
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);
|
||||
@@ -441,34 +455,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);
|
||||
@@ -478,15 +490,13 @@ h5_open_file2 (
|
||||
|
||||
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);
|
||||
}
|
||||
f->props->comm = props->comm;
|
||||
f->props->flags = props->flags;
|
||||
@@ -502,7 +512,9 @@ h5_open_file2 (
|
||||
|
||||
TRY (open_file (f, filename, mode));
|
||||
|
||||
H5_CORE_API_RETURN ((h5_file_t)f);
|
||||
TRY (h5_set_stepname_fmt ((uintptr_t)f, H5_STEPNAME, H5_STEPWIDTH));
|
||||
|
||||
H5_RETURN ((h5_file_t)f);
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -526,7 +538,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 +552,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);
|
||||
|
||||
}
|
||||
|
||||
@@ -575,7 +587,7 @@ h5_close_file (
|
||||
TRY (hdf5_close_file (f->file));
|
||||
TRY (h5_free (f->step_name));
|
||||
TRY (h5_free (f));
|
||||
H5_CORE_API_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
@@ -583,7 +595,8 @@ h5_close_hdf5 (
|
||||
void
|
||||
) {
|
||||
H5_CORE_API_ENTER (h5_err_t, "%s", "");
|
||||
H5_CORE_API_RETURN (hdf5_close ());
|
||||
TRY (ret_value = hdf5_close ());
|
||||
H5_RETURN (ret_value);
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
@@ -592,7 +605,13 @@ h5_flush_step (
|
||||
) {
|
||||
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_FILEHANDLE (f);
|
||||
CHECK_TIMEGROUP (f);
|
||||
ret_value = H5_SUCCESS;
|
||||
if (f->step_gid >= 0) {
|
||||
TRY (ret_value = hdf5_flush (f->step_gid, H5F_SCOPE_LOCAL));
|
||||
}
|
||||
H5_RETURN (ret_value);
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
@@ -601,7 +620,9 @@ 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_FILEHANDLE (f);
|
||||
TRY (ret_value = hdf5_flush (f->file, H5F_SCOPE_GLOBAL));
|
||||
H5_RETURN (ret_value);
|
||||
}
|
||||
|
||||
|
||||
@@ -625,6 +646,7 @@ h5_set_stepname_fmt (
|
||||
H5_CORE_API_ENTER (h5_err_t,
|
||||
"f=%p, name='%s', width=%d",
|
||||
f, name, width);
|
||||
CHECK_FILEHANDLE (f);
|
||||
if (width < 0) width = 0;
|
||||
else if (width > H5_STEPNAME_LEN - 1) width = H5_STEPNAME_LEN - 1;
|
||||
strncpy (
|
||||
@@ -633,7 +655,7 @@ h5_set_stepname_fmt (
|
||||
H5_STEPNAME_LEN - 1);
|
||||
f->props->width_step_idx = width;
|
||||
|
||||
H5_CORE_API_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -646,9 +668,9 @@ h5_set_stepname_fmt (
|
||||
h5_err_t
|
||||
h5_get_stepname_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);
|
||||
@@ -671,7 +693,9 @@ h5_get_step (
|
||||
) {
|
||||
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_FILEHANDLE (f);
|
||||
CHECK_TIMEGROUP (f);
|
||||
H5_RETURN (f->step_idx);
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -687,7 +711,8 @@ 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_FILEHANDLE (f);
|
||||
H5_RETURN (f->nprocs);
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -703,9 +728,11 @@ h5_get_num_steps(
|
||||
) {
|
||||
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_FILEHANDLE (f);
|
||||
TRY (ret_value = hdf5_get_num_groups_matching_prefix (
|
||||
f->root_gid,
|
||||
f->props->prefix_step_name));
|
||||
H5_RETURN (ret_value);
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -728,7 +755,7 @@ 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 ());
|
||||
}
|
||||
|
||||
/*!
|
||||
|
||||
@@ -7,10 +7,11 @@
|
||||
License: see file COPYING in top level of source distribution.
|
||||
*/
|
||||
|
||||
#include "h5core/h5_init.h"
|
||||
#include "h5core/h5_log.h"
|
||||
#include "h5core/h5_err.h"
|
||||
#include "private/h5_init.h"
|
||||
|
||||
h5_int32_t h5_debug_level = H5_VERBOSE_ERROR;
|
||||
h5_int32_t h5_log_level = H5_VERBOSE_ERROR;
|
||||
struct call_stack h5_call_stack;
|
||||
|
||||
char *h5_rfmts[] = {
|
||||
@@ -54,13 +55,13 @@ char *h5_rfmts[] = {
|
||||
\return \c H5_ERR_INVAL if debug level is invalid.
|
||||
*/
|
||||
h5_err_t
|
||||
h5_set_debuglevel (
|
||||
h5_set_loglevel (
|
||||
const h5_id_t level /*!< debug level */
|
||||
) {
|
||||
if (level < 0)
|
||||
h5_debug_level = ((1 << 20) - 1) & ~0x7;
|
||||
h5_log_level = ((1 << 20) - 1) & ~0x7;
|
||||
else
|
||||
h5_debug_level = level;
|
||||
h5_log_level = level;
|
||||
return H5_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -72,8 +73,66 @@ h5_set_debuglevel (
|
||||
\return current debug level
|
||||
*/
|
||||
h5_err_t
|
||||
h5_get_debuglevel (
|
||||
h5_get_loglevel (
|
||||
void
|
||||
) {
|
||||
return h5_debug_level;
|
||||
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);
|
||||
}
|
||||
}
|
||||
+25
-82
@@ -9,13 +9,10 @@
|
||||
|
||||
#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 (
|
||||
@@ -23,12 +20,12 @@ h5priv_close_step (
|
||||
) {
|
||||
H5_PRIV_API_ENTER (h5_err_t, "f=%p", f);
|
||||
if (f->step_gid <= 0)
|
||||
H5_PRIV_API_LEAVE (H5_SUCCESS);
|
||||
H5_LEAVE (H5_SUCCESS);
|
||||
TRY (hdf5_close_group (f->step_gid));
|
||||
|
||||
f->step_gid = -1;
|
||||
|
||||
H5_PRIV_API_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
@@ -40,6 +37,7 @@ h5_set_step (
|
||||
H5_CORE_API_ENTER (h5_err_t,
|
||||
"f=%p, step_idx=%lld",
|
||||
f, (long long)step_idx);
|
||||
CHECK_FILEHANDLE (f);
|
||||
TRY (h5priv_close_step (f));
|
||||
f->step_idx = step_idx;
|
||||
|
||||
@@ -52,72 +50,19 @@ h5_set_step (
|
||||
"Open step #%lld for file %lld",
|
||||
(long long)f->step_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->step_name));
|
||||
if (exists) {
|
||||
TRY (f->step_gid = h5priv_open_group (
|
||||
f->file,
|
||||
f->step_name));
|
||||
} else if (is_writable (f)) {
|
||||
TRY (f->step_gid = h5priv_create_group (
|
||||
f->file,
|
||||
f->step_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);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -133,14 +78,14 @@ h5_has_step (
|
||||
) {
|
||||
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);
|
||||
CHECK_FILEHANDLE (f);
|
||||
char name[2*H5_STEPNAME_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);
|
||||
TRY (ret_value = hdf5_link_exists (f->file, name));
|
||||
H5_RETURN (ret_value);
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
@@ -154,17 +99,15 @@ h5priv_normalize_dataset_name (
|
||||
name2[H5_DATANAME_LEN-1] = '\0';
|
||||
h5_warn ("Truncated name '%s' to '%s'.", name, name2);
|
||||
} else {
|
||||
strcpy ( name2, name );
|
||||
strcpy (name2, name);
|
||||
}
|
||||
|
||||
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));
|
||||
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
|
||||
+68
-76
@@ -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"
|
||||
@@ -42,16 +38,22 @@ h5b_write_field_attrib (
|
||||
CHECK_TIMEGROUP (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 +61,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;
|
||||
@@ -75,15 +77,15 @@ h5b_read_field_attrib (
|
||||
CHECK_FILEHANDLE (f);
|
||||
CHECK_TIMEGROUP (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
|
||||
@@ -105,43 +107,10 @@ h5b_has_field_attrib (
|
||||
|
||||
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
|
||||
@@ -156,7 +125,8 @@ h5b_get_num_field_attribs (
|
||||
|
||||
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 +145,49 @@ 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);
|
||||
attrib_type, attrib_nelem);
|
||||
CHECK_FILEHANDLE (f);
|
||||
CHECK_TIMEGROUP (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_FILEHANDLE (f);
|
||||
CHECK_TIMEGROUP (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
|
||||
@@ -268,7 +260,7 @@ h5b_set_3d_field_coords (
|
||||
coords,
|
||||
n_coords));
|
||||
|
||||
H5_CORE_API_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
@@ -303,7 +295,7 @@ h5b_get_3d_field_coords (
|
||||
H5_FLOAT64_T,
|
||||
coords));
|
||||
|
||||
H5_CORE_API_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
|
||||
|
||||
+108
-91
@@ -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,7 +40,7 @@ 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)));
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -92,11 +94,11 @@ h5bpriv_close_file (
|
||||
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,40 @@ _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_FILEHANDLE (f);
|
||||
CHECK_WRITABLE_MODE (f);
|
||||
CHECK_TIMEGROUP (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 +285,22 @@ 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_FILEHANDLE (f);
|
||||
CHECK_WRITABLE_MODE (f);
|
||||
CHECK_TIMEGROUP (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 +329,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 +375,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 +416,38 @@ 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_FILEHANDLE (f);
|
||||
CHECK_TIMEGROUP (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 +457,15 @@ 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_FILEHANDLE (f);
|
||||
CHECK_TIMEGROUP (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);
|
||||
}
|
||||
|
||||
|
||||
+119
-84
@@ -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"
|
||||
@@ -43,9 +42,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_TIMEGROUP (f);
|
||||
TRY (ret_value = hdf5_link_exists (f->step_gid, H5BLOCK_GROUPNAME_BLOCK));
|
||||
H5_RETURN (ret_value);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -422,7 +421,7 @@ _dissolve_ghostzones (
|
||||
|
||||
}
|
||||
h5_free (p_begin);
|
||||
H5_PRIV_FUNC_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -443,7 +442,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
|
||||
@@ -456,11 +455,12 @@ h5bpriv_open_block_group (
|
||||
TRY (hdf5_close_group (b->block_gid));
|
||||
b->block_gid = hdf5_open_group (f->step_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",
|
||||
"Time step does not contain H5Block data!");
|
||||
|
||||
H5_PRIV_API_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
static h5_err_t
|
||||
@@ -478,7 +478,7 @@ _create_block_group (
|
||||
TRY (f->b->block_gid = hdf5_create_group(
|
||||
f->step_gid, H5BLOCK_GROUPNAME_BLOCK) );
|
||||
}
|
||||
H5_PRIV_FUNC_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
@@ -498,7 +498,7 @@ h5bpriv_open_field_group (
|
||||
H5_ERR_INVAL,
|
||||
"Field '%s' does not exist!", name2);
|
||||
|
||||
H5_PRIV_API_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
@@ -524,14 +524,20 @@ h5bpriv_create_field_group (
|
||||
TRY (b->field_gid = hdf5_create_group (b->block_gid, name2));
|
||||
}
|
||||
|
||||
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_FILEHANDLE (f);
|
||||
CHECK_TIMEGROUP (f);
|
||||
H5_RETURN (((h5_file_p)fh)->b->have_layout > 0);
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
@@ -545,7 +551,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 +560,9 @@ 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_FILEHANDLE (f);
|
||||
CHECK_TIMEGROUP (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;
|
||||
@@ -611,7 +619,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 +642,8 @@ h5b_3d_get_view (
|
||||
i_start, i_end,
|
||||
j_start, j_end,
|
||||
k_start, k_end);
|
||||
CHECK_FILEHANDLE (f);
|
||||
CHECK_TIMEGROUP (f);
|
||||
h5b_partition_t *p = f->b->user_layout;
|
||||
|
||||
*i_start = p->i_start;
|
||||
@@ -643,7 +653,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 +676,8 @@ h5b_3d_get_reduced_view (
|
||||
i_start, i_end,
|
||||
j_start, j_end,
|
||||
k_start, k_end);
|
||||
CHECK_FILEHANDLE (f);
|
||||
CHECK_TIMEGROUP (f);
|
||||
h5b_partition_t *p = f->b->write_layout;
|
||||
|
||||
*i_start = p->i_start;
|
||||
@@ -675,7 +687,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 +704,8 @@ h5b_3d_set_chunk (
|
||||
(long long unsigned)i,
|
||||
(long long unsigned)j,
|
||||
(long long unsigned)k);
|
||||
CHECK_FILEHANDLE (f);
|
||||
CHECK_TIMEGROUP (f);
|
||||
if ( i == 0 || j == 0 || k == 0 )
|
||||
{
|
||||
h5_info ("Disabling chunking" );
|
||||
@@ -704,7 +718,7 @@ 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
|
||||
@@ -719,7 +733,8 @@ h5b_3d_get_chunk (
|
||||
H5_CORE_API_ENTER (h5_err_t,
|
||||
"f=%p, i=%p, j=%p, k=%p",
|
||||
f, i, j, k);
|
||||
CHECK_TIMEGROUP ( f );
|
||||
CHECK_FILEHANDLE (f);
|
||||
CHECK_TIMEGROUP (f);
|
||||
|
||||
h5b_fdata_t *b = f->b;
|
||||
|
||||
@@ -729,7 +744,7 @@ h5b_3d_get_chunk (
|
||||
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,7 +759,7 @@ 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
|
||||
@@ -762,15 +777,17 @@ h5b_3d_set_grid (
|
||||
(long long unsigned)i,
|
||||
(long long unsigned)j,
|
||||
(long long unsigned)k);
|
||||
CHECK_FILEHANDLE (f);
|
||||
CHECK_TIMEGROUP (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;
|
||||
@@ -784,7 +801,7 @@ h5b_3d_set_grid (
|
||||
|
||||
f->b->have_grid = 1;
|
||||
|
||||
H5_CORE_API_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
@@ -799,17 +816,20 @@ 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_FILEHANDLE (f);
|
||||
CHECK_TIMEGROUP (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!");
|
||||
|
||||
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);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
@@ -826,10 +846,13 @@ h5b_3d_set_dims (
|
||||
(long long unsigned)i,
|
||||
(long long unsigned)j,
|
||||
(long long unsigned)k);
|
||||
CHECK_FILEHANDLE (f);
|
||||
CHECK_TIMEGROUP (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 };
|
||||
h5_size_t check_dims[3] = { k, j, i };
|
||||
@@ -841,17 +864,17 @@ h5b_3d_set_dims (
|
||||
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,7 +897,7 @@ h5b_3d_set_dims (
|
||||
|
||||
b->have_layout = 1;
|
||||
|
||||
H5_CORE_API_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -893,14 +916,18 @@ h5b_3d_set_halo (
|
||||
(long long unsigned)j,
|
||||
(long long unsigned)k);
|
||||
|
||||
CHECK_FILEHANDLE (f);
|
||||
CHECK_TIMEGROUP (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 +938,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 +947,12 @@ 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_FILEHANDLE (f);
|
||||
CHECK_TIMEGROUP (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,11 +964,12 @@ h5b_has_field (
|
||||
H5_CORE_API_ENTER (h5_err_t,
|
||||
"f=%p, name='%s'",
|
||||
f, name);
|
||||
CHECK_TIMEGROUP (f);
|
||||
CHECK_FILEHANDLE (f);
|
||||
CHECK_TIMEGROUP (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->step_gid, path, 2));
|
||||
H5_RETURN (ret_value);
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
@@ -956,41 +986,44 @@ h5b_get_field_info_by_name (
|
||||
"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_FILEHANDLE (f);
|
||||
CHECK_TIMEGROUP (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) );
|
||||
|
||||
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 +1046,8 @@ 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_FILEHANDLE (f);
|
||||
CHECK_TIMEGROUP (f);
|
||||
|
||||
TRY (h5bpriv_open_block_group(f));
|
||||
TRY (hdf5_get_objname_by_idx(
|
||||
@@ -1022,8 +1056,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
-41
@@ -7,18 +7,17 @@
|
||||
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"
|
||||
@@ -196,7 +195,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 +214,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 +238,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 +264,7 @@ h5tpriv_init_mesh (
|
||||
|
||||
|
||||
}
|
||||
H5_PRIV_FUNC_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
|
||||
@@ -284,7 +283,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 +297,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 +316,7 @@ release_memory (
|
||||
}
|
||||
#endif
|
||||
TRY (h5_free (m));
|
||||
H5_PRIV_FUNC_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
@@ -365,7 +364,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 +373,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 +386,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 +399,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 +410,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 +418,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 +427,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 +438,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 +469,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 +482,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 +490,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 +499,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 +515,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 +530,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 +557,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 +585,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 +602,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);
|
||||
}
|
||||
|
||||
+240
-246
File diff suppressed because it is too large
Load Diff
+80
-76
@@ -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"
|
||||
@@ -37,7 +35,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 +59,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 +83,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 +115,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 +141,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 +154,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 +185,7 @@ new_tagset (
|
||||
TRY (h5priv_search_strlist (&m->mtagsets, name));
|
||||
|
||||
*rtagset = tagset;
|
||||
H5_PRIV_FUNC_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -199,7 +195,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 +203,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 +261,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 +273,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 +293,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 +331,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 +390,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 +402,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 +413,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 +435,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 +451,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 +462,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 +492,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 +513,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 +564,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 +615,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 +663,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 +698,7 @@ release_mtagset (
|
||||
TRY (h5_free (tagset->values));
|
||||
TRY (h5_free (tagset));
|
||||
|
||||
H5_PRIV_FUNC_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -713,7 +715,7 @@ h5t_close_mtagset (
|
||||
TRY (write_tagset (tagset));
|
||||
}
|
||||
TRY (release_mtagset (tagset));
|
||||
H5_CORE_API_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -750,7 +752,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 +771,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 +804,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 +853,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 +864,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 +875,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 +894,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);
|
||||
}
|
||||
|
||||
|
||||
+20
-19
@@ -7,14 +7,12 @@
|
||||
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"
|
||||
#include "private/h5_model.h"
|
||||
#include "private/h5_io.h"
|
||||
#include "private/h5u_types.h"
|
||||
|
||||
#include "h5core/h5_init.h"
|
||||
#include "h5core/h5_model.h"
|
||||
#include "h5core/h5_syscall.h"
|
||||
|
||||
@@ -46,7 +44,7 @@ h5upriv_open_file (
|
||||
|
||||
TRY (u->dcreate_prop = hdf5_create_property (H5P_DATASET_CREATE));
|
||||
|
||||
H5_PRIV_API_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -74,7 +72,7 @@ h5upriv_close_file (
|
||||
TRY (h5_free (f->u));
|
||||
f->u = NULL;
|
||||
|
||||
H5_PRIV_API_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
@@ -82,14 +80,18 @@ h5u_read_data (
|
||||
const h5_file_t fh, /*!< [in] Handle to open file */
|
||||
const char* name, /*!< [in] Name to associate dataset with */
|
||||
void* data, /*!< [out] Array of data */
|
||||
const hid_t type
|
||||
const h5_types_t type
|
||||
) {
|
||||
h5_file_p f = (h5_file_p)fh;
|
||||
H5_CORE_API_ENTER (h5_err_t,
|
||||
"f=%p, name='%s', data=%p, type=%lld",
|
||||
f, name, data, (long long int)type);
|
||||
CHECK_FILEHANDLE (f);
|
||||
CHECK_TIMEGROUP (f);
|
||||
|
||||
hid_t hdf5_type;
|
||||
TRY (hdf5_type = h5priv_map_enum_to_normalized_type (type));
|
||||
|
||||
struct h5u_fdata *u = f->u;
|
||||
hid_t dataset_id;
|
||||
hid_t space_id;
|
||||
@@ -103,7 +105,7 @@ h5u_read_data (
|
||||
char name2[H5_DATANAME_LEN];
|
||||
TRY (h5priv_normalize_dataset_name (name, name2));
|
||||
|
||||
TRY (dataset_id = hdf5_open_dataset (f->step_gid, name2));
|
||||
TRY (dataset_id = hdf5_open_dataset_by_name (f->step_gid, name2));
|
||||
|
||||
/* default spaces, if not using a view selection */
|
||||
memspace_id = H5S_ALL;
|
||||
@@ -159,7 +161,7 @@ h5u_read_data (
|
||||
TRY (h5priv_start_throttle (f));
|
||||
TRY (hdf5_read_dataset (
|
||||
dataset_id,
|
||||
type,
|
||||
hdf5_type,
|
||||
memspace_id,
|
||||
space_id,
|
||||
f->props->xfer_prop,
|
||||
@@ -171,7 +173,7 @@ h5u_read_data (
|
||||
|
||||
TRY (hdf5_close_dataset (dataset_id));
|
||||
|
||||
H5_CORE_API_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
@@ -179,15 +181,18 @@ h5u_write_data (
|
||||
const h5_file_t fh, /*!< IN: Handle to open file */
|
||||
const char *name, /*!< IN: Name to associate array with */
|
||||
const void *data, /*!< IN: Array to commit to disk */
|
||||
const hid_t type /*!< IN: Type of data */
|
||||
const h5_types_t type /*!< IN: Type of data */
|
||||
) {
|
||||
h5_file_p f = (h5_file_p)fh;
|
||||
H5_CORE_API_ENTER (h5_err_t,
|
||||
"f=%p, name='%s', data=%p, type=%lld",
|
||||
f, name, data, (long long int)type);
|
||||
CHECK_TIMEGROUP( f );
|
||||
CHECK_WRITABLE_MODE( f );
|
||||
|
||||
CHECK_FILEHANDLE (f);
|
||||
CHECK_WRITABLE_MODE (f);
|
||||
CHECK_TIMEGROUP (f);
|
||||
hid_t hdf5_type;
|
||||
TRY (hdf5_type = h5priv_map_enum_to_normalized_type (type));
|
||||
|
||||
struct h5u_fdata *u = f->u;
|
||||
hid_t dset_id;
|
||||
|
||||
@@ -209,7 +214,7 @@ h5u_write_data (
|
||||
TRY (dset_id = hdf5_create_dataset (
|
||||
f->step_gid,
|
||||
name2,
|
||||
type,
|
||||
hdf5_type,
|
||||
u->shape,
|
||||
H5P_DEFAULT));
|
||||
}
|
||||
@@ -219,20 +224,16 @@ h5u_write_data (
|
||||
hdf5_get_objname(f->step_gid), name2);
|
||||
TRY (hdf5_write_dataset (
|
||||
dset_id,
|
||||
type,
|
||||
hdf5_type,
|
||||
u->memshape,
|
||||
u->diskshape,
|
||||
f->props->xfer_prop,
|
||||
data));
|
||||
TRY (h5priv_end_throttle (f));
|
||||
if (f->props->flags & H5_FLUSH_STEP)
|
||||
TRY (hdf5_flush (f->step_gid, H5F_SCOPE_LOCAL));
|
||||
|
||||
TRY (hdf5_close_dataset (dset_id));
|
||||
|
||||
f->empty = 0;
|
||||
TRY (hdf5_flush (f->step_gid, H5F_SCOPE_LOCAL));
|
||||
|
||||
H5_CORE_API_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
|
||||
+249
-145
@@ -7,12 +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 "h5core/h5u_model.h"
|
||||
#include "h5core/h5u_io.h"
|
||||
|
||||
#include "private/h5.h"
|
||||
#include "private/h5_file.h"
|
||||
#include "private/h5_hdf5.h"
|
||||
|
||||
#include "private/h5_model.h"
|
||||
@@ -20,6 +19,7 @@
|
||||
#include "private/h5_io.h"
|
||||
#include "private/h5u_types.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
h5_ssize_t
|
||||
h5u_get_num_points (
|
||||
@@ -27,6 +27,8 @@ h5u_get_num_points (
|
||||
) {
|
||||
h5_file_p f = (h5_file_p)fh;
|
||||
H5_CORE_API_ENTER (h5_ssize_t, "f=%p", f);
|
||||
CHECK_FILEHANDLE (f);
|
||||
CHECK_TIMEGROUP (f);
|
||||
h5_ssize_t nparticles;
|
||||
|
||||
if (h5u_has_view ((h5_file_t)f)) {
|
||||
@@ -38,7 +40,7 @@ h5u_get_num_points (
|
||||
TRY (nparticles = h5u_get_totalnum_particles_by_idx (fh, 0));
|
||||
}
|
||||
|
||||
H5_CORE_API_RETURN (nparticles);
|
||||
H5_RETURN (nparticles);
|
||||
}
|
||||
|
||||
h5_ssize_t
|
||||
@@ -47,31 +49,38 @@ h5u_get_num_points_in_view (
|
||||
) {
|
||||
h5_file_p f = (h5_file_p)fh;
|
||||
H5_CORE_API_ENTER (h5_ssize_t, "f=%p", f);
|
||||
CHECK_FILEHANDLE (f);
|
||||
CHECK_TIMEGROUP (f);
|
||||
h5_ssize_t nparticles;
|
||||
|
||||
if (!h5u_has_view (fh)) {
|
||||
H5_CORE_API_LEAVE (
|
||||
h5_error (
|
||||
H5_ERR_H5PART,
|
||||
"No view has been set."));
|
||||
H5_RETURN_ERROR (
|
||||
H5_ERR_H5PART,
|
||||
"%s",
|
||||
"No view has been set.");
|
||||
}
|
||||
TRY (nparticles = hdf5_get_selected_npoints_of_dataspace(f->u->diskshape));
|
||||
h5_debug ("Found %lld particles in view.", (long long)nparticles );
|
||||
H5_CORE_API_RETURN (nparticles);
|
||||
H5_RETURN (nparticles);
|
||||
}
|
||||
|
||||
h5_ssize_t
|
||||
h5u_get_totalnum_particles_by_name (
|
||||
const h5_file_t fh, ///< [in] Handle to open file
|
||||
const char* const name ///< [in] Index of dataset to query
|
||||
const h5_file_t fh, ///< [in] Handle to open file
|
||||
const char* const dataset_name ///< [in] dataset to query
|
||||
) {
|
||||
h5_file_p f = (h5_file_p)fh;
|
||||
H5_CORE_API_ENTER (h5_ssize_t, "f=%p, name=%s", f, name);
|
||||
H5_CORE_API_ENTER (h5_ssize_t,
|
||||
"f=%p, dataset_name=%s",
|
||||
f, dataset_name);
|
||||
CHECK_FILEHANDLE (f);
|
||||
CHECK_TIMEGROUP (f);
|
||||
h5_ssize_t nparticles;
|
||||
|
||||
TRY (nparticles = hdf5_get_npoints_of_dataset_by_name (f->step_gid, name));
|
||||
h5_debug ("Found %lld particles in dataset %s.", (long long)nparticles, name);
|
||||
H5_CORE_API_RETURN (nparticles);
|
||||
TRY (nparticles = hdf5_get_npoints_of_dataset_by_name (
|
||||
f->step_gid, dataset_name));
|
||||
h5_debug ("Found %lld particles in dataset %s.",
|
||||
(long long)nparticles, dataset_name);
|
||||
H5_RETURN (nparticles);
|
||||
}
|
||||
|
||||
h5_ssize_t
|
||||
@@ -81,6 +90,8 @@ h5u_get_totalnum_particles_by_idx (
|
||||
) {
|
||||
h5_file_p f = (h5_file_p)fh;
|
||||
H5_CORE_API_ENTER (h5_ssize_t, "f=%p, idx=%lld", f, (long long)idx);
|
||||
CHECK_FILEHANDLE (f);
|
||||
CHECK_TIMEGROUP (f);
|
||||
char dataset_name[H5_DATANAME_LEN];
|
||||
dataset_name[0] = '\0';
|
||||
h5_err_t h5err;
|
||||
@@ -90,8 +101,13 @@ h5u_get_totalnum_particles_by_idx (
|
||||
dataset_name,
|
||||
H5_DATANAME_LEN));
|
||||
if (h5err == H5_NOK)
|
||||
H5_CORE_API_LEAVE (H5_NOK);
|
||||
H5_CORE_API_RETURN (h5u_get_totalnum_particles_by_name (fh, dataset_name));
|
||||
H5_LEAVE (H5_NOK);
|
||||
h5_ssize_t nparticles;
|
||||
TRY (nparticles = hdf5_get_npoints_of_dataset_by_name (
|
||||
f->step_gid, dataset_name));
|
||||
h5_debug ("Found %lld particles in dataset %s.",
|
||||
(long long)nparticles, dataset_name);
|
||||
H5_RETURN (nparticles);
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
@@ -105,16 +121,20 @@ h5u_set_num_points (
|
||||
"f=%p, nparticles=%llu, stride=%llu",
|
||||
f, (long long unsigned)nparticles,
|
||||
(long long unsigned)stride);
|
||||
CHECK_FILEHANDLE (f);
|
||||
if (f->step_gid < 0) {
|
||||
TRY (h5_set_step (fh, 0));
|
||||
}
|
||||
CHECK_TIMEGROUP (f);
|
||||
struct h5u_fdata *u = f->u;
|
||||
hsize_t start;
|
||||
hsize_t dmax = H5S_UNLIMITED;
|
||||
|
||||
if (nparticles < 0)
|
||||
H5_CORE_API_LEAVE (
|
||||
h5_error(
|
||||
H5_ERR_INVAL,
|
||||
"Invalid number of particles: %lld!\n",
|
||||
(long long)nparticles));
|
||||
H5_RETURN_ERROR (
|
||||
H5_ERR_INVAL,
|
||||
"Invalid number of particles: %lld!\n",
|
||||
(long long)nparticles);
|
||||
|
||||
#ifndef PARALLEL_IO
|
||||
/*
|
||||
@@ -124,7 +144,7 @@ h5u_set_num_points (
|
||||
we don't know if things have changed globally
|
||||
*/
|
||||
if ( u->nparticles == nparticles && stride == 1 ) {
|
||||
H5_CORE_API_LEAVE (H5_SUCCESS);
|
||||
H5_LEAVE (H5_SUCCESS);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -206,7 +226,7 @@ h5u_set_num_points (
|
||||
TRY (hdf5_select_none (u->diskshape));
|
||||
}
|
||||
#endif
|
||||
H5_CORE_API_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
@@ -215,7 +235,9 @@ h5u_has_view (
|
||||
) {
|
||||
h5_file_p f = (h5_file_p)fh;
|
||||
H5_CORE_API_ENTER (h5_ssize_t, "f=%p", f);
|
||||
H5_CORE_API_RETURN (f->u->viewindexed || f->u->viewstart >= 0);
|
||||
CHECK_FILEHANDLE (f);
|
||||
CHECK_TIMEGROUP (f);
|
||||
H5_RETURN (f->u->viewindexed || f->u->viewstart >= 0);
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
@@ -224,6 +246,8 @@ h5u_reset_view (
|
||||
) {
|
||||
h5_file_p f = (h5_file_p)fh;
|
||||
H5_CORE_API_ENTER (h5_ssize_t, "f=%p", f);
|
||||
CHECK_FILEHANDLE (f);
|
||||
CHECK_TIMEGROUP (f);
|
||||
struct h5u_fdata *u = f->u;
|
||||
|
||||
u->viewstart = -1;
|
||||
@@ -234,7 +258,7 @@ h5u_reset_view (
|
||||
TRY (hdf5_close_dataspace (u->memshape));
|
||||
u->memshape = H5S_ALL;
|
||||
|
||||
H5_CORE_API_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -252,6 +276,8 @@ h5u_set_view (
|
||||
H5_CORE_API_ENTER (h5_err_t,
|
||||
"f=%p, start=%lld, end=%lld",
|
||||
f, (long long)start, (long long)end);
|
||||
CHECK_FILEHANDLE (f);
|
||||
CHECK_TIMEGROUP (f);
|
||||
hsize_t total = 0;
|
||||
hsize_t dmax = H5S_UNLIMITED;
|
||||
struct h5u_fdata *u = f->u;
|
||||
@@ -259,7 +285,7 @@ h5u_set_view (
|
||||
TRY (h5u_reset_view (fh));
|
||||
|
||||
if (start == -1 && end == -1) // we are already done
|
||||
H5_CORE_API_LEAVE (H5_SUCCESS);
|
||||
H5_LEAVE (H5_SUCCESS);
|
||||
|
||||
if (f->u->shape > 0) {
|
||||
TRY (total = hdf5_get_npoints_of_dataspace (f->u->shape) );
|
||||
@@ -277,21 +303,19 @@ h5u_set_view (
|
||||
:FIXME: why not gather total size?
|
||||
*/
|
||||
if (start < 0) {
|
||||
H5_CORE_API_LEAVE (
|
||||
h5_error(
|
||||
H5_ERR_INVAL,
|
||||
"Start of selection '%lld' out of range: must be >= 0",
|
||||
(long long)start)
|
||||
);
|
||||
H5_RETURN_ERROR (
|
||||
H5_ERR_INVAL,
|
||||
"Start of selection '%lld' out of range: "
|
||||
"must be >= 0",
|
||||
(long long)start);
|
||||
}
|
||||
if (end < start) {
|
||||
H5_CORE_API_LEAVE (
|
||||
h5_error(
|
||||
H5_ERR_INVAL,
|
||||
"End of selection '%lld' out of range: must be >= %lld",
|
||||
(long long)end,
|
||||
(long long)start)
|
||||
);
|
||||
H5_RETURN_ERROR (
|
||||
H5_ERR_INVAL,
|
||||
"End of selection '%lld' out of range: "
|
||||
"must be >= %lld",
|
||||
(long long)end,
|
||||
(long long)start);
|
||||
}
|
||||
#if PARALLEL_IO
|
||||
TRY (
|
||||
@@ -312,23 +336,22 @@ h5u_set_view (
|
||||
}
|
||||
|
||||
if (start < 0 || start >= total) {
|
||||
H5_CORE_API_LEAVE (
|
||||
h5_error(
|
||||
H5_ERR_INVAL,
|
||||
"Start of selection '%lld' out of range: must be in [0..%lld]",
|
||||
(long long)start, (long long)total-1));
|
||||
H5_RETURN_ERROR (
|
||||
H5_ERR_INVAL,
|
||||
"Start of selection '%lld' out of range: "
|
||||
"must be in [0..%lld]",
|
||||
(long long)start, (long long)total-1);
|
||||
} else if (end < 0 || end >= total) {
|
||||
H5_CORE_API_LEAVE (
|
||||
h5_error(
|
||||
H5_ERR_INVAL,
|
||||
"End of selection '%lld' out of range: must be in [0..%lld]",
|
||||
(long long)end, (long long)total-1));
|
||||
H5_RETURN_ERROR (
|
||||
H5_ERR_INVAL,
|
||||
"End of selection '%lld' out of range: "
|
||||
"must be in [0..%lld]",
|
||||
(long long)end, (long long)total-1);
|
||||
} else if (end+1 < start) {
|
||||
H5_CORE_API_LEAVE (
|
||||
h5_error(
|
||||
H5_ERR_INVAL,
|
||||
"Invalid selection: start=%lld > end=%lld!\n",
|
||||
(long long)start, (long long)end));
|
||||
H5_RETURN_ERROR (
|
||||
H5_ERR_INVAL,
|
||||
"Invalid selection: start=%lld > end=%lld!\n",
|
||||
(long long)start, (long long)end);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -359,7 +382,7 @@ h5u_set_view (
|
||||
|
||||
/* declare local memory datasize */
|
||||
TRY (u->memshape = hdf5_create_dataspace (1, &hcount, &dmax));
|
||||
H5_CORE_API_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
@@ -372,12 +395,14 @@ h5u_set_view_length (
|
||||
H5_CORE_API_ENTER (h5_err_t,
|
||||
"f=%p, start=%lld, length=%lld",
|
||||
f, (long long)start, (long long)length);
|
||||
CHECK_FILEHANDLE (f);
|
||||
CHECK_TIMEGROUP (f);
|
||||
struct h5u_fdata *u = f->u;
|
||||
|
||||
TRY (h5u_reset_view (fh));
|
||||
|
||||
if (start == -1 && length == -1)
|
||||
H5_CORE_API_LEAVE (H5_SUCCESS);
|
||||
H5_LEAVE (H5_SUCCESS);
|
||||
|
||||
hsize_t total = 0;
|
||||
if (u->shape > 0) {
|
||||
@@ -392,15 +417,15 @@ h5u_set_view_length (
|
||||
/* No datasets have been created yet and no views are set.
|
||||
* We have to leave the view empty because we don't know how
|
||||
* many particles there should be! */
|
||||
H5_CORE_API_LEAVE (H5_SUCCESS);
|
||||
H5_LEAVE (H5_SUCCESS);
|
||||
}
|
||||
|
||||
if (start < 0 || length < 0 || start+length > total)
|
||||
H5_CORE_API_LEAVE (
|
||||
h5_error(
|
||||
H5_ERR_INVAL,
|
||||
"Invalid view: start=%lld, length=%lld, total=%lld",
|
||||
(long long)start, (long long)length, (long long)total));
|
||||
H5_RETURN_ERROR (
|
||||
H5_ERR_INVAL,
|
||||
"Invalid view: start=%lld, length=%lld, total=%lld",
|
||||
(long long)start, (long long)length,
|
||||
(long long)total);
|
||||
|
||||
/* setting up the new view */
|
||||
u->viewstart = start;
|
||||
@@ -427,7 +452,7 @@ h5u_set_view_length (
|
||||
/* declare local memory datasize */
|
||||
hsize_t dmax = H5S_UNLIMITED;
|
||||
TRY (u->memshape = hdf5_create_dataspace (1, &hcount, &dmax));
|
||||
H5_CORE_API_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
@@ -444,7 +469,7 @@ h5u_set_view_indices (
|
||||
if (f->step_gid < 0) {
|
||||
TRY (h5_set_step (fh, 0));
|
||||
}
|
||||
|
||||
CHECK_TIMEGROUP (f);
|
||||
hsize_t total = 0;
|
||||
hsize_t dmax = H5S_UNLIMITED;
|
||||
struct h5u_fdata *u = f->u;
|
||||
@@ -453,7 +478,7 @@ h5u_set_view_indices (
|
||||
|
||||
if ( indices == NULL ) {
|
||||
h5_warn ("View indices array is null: reseting view.");
|
||||
H5_CORE_API_LEAVE (H5_SUCCESS);
|
||||
H5_LEAVE (H5_SUCCESS);
|
||||
}
|
||||
if (f->u->shape > 0) {
|
||||
TRY (total = hdf5_get_npoints_of_dataspace (f->u->shape) );
|
||||
@@ -467,7 +492,7 @@ h5u_set_view_indices (
|
||||
/* No datasets have been created yet and no views are set.
|
||||
* We have to leave the view empty because we don't know how
|
||||
* many particles there should be! */
|
||||
H5_CORE_API_LEAVE (H5_SUCCESS);
|
||||
H5_LEAVE (H5_SUCCESS);
|
||||
}
|
||||
|
||||
u->nparticles = nelems;
|
||||
@@ -488,7 +513,7 @@ h5u_set_view_indices (
|
||||
}
|
||||
u->viewindexed = 1;
|
||||
|
||||
H5_CORE_API_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
h5_int64_t
|
||||
@@ -501,14 +526,16 @@ h5u_get_view (
|
||||
H5_CORE_API_ENTER (h5_err_t,
|
||||
"f=%p, start=%p, end=%p",
|
||||
f, start, end);
|
||||
CHECK_FILEHANDLE (f);
|
||||
CHECK_TIMEGROUP (f);
|
||||
struct h5u_fdata *u = f->u;
|
||||
|
||||
if ( u->viewindexed ) {
|
||||
H5_CORE_API_LEAVE (
|
||||
h5_error (
|
||||
H5_ERR_INVAL,
|
||||
"The current view has an index selection, but "
|
||||
"this function only works for ranged views." ));
|
||||
H5_RETURN_ERROR (
|
||||
H5_ERR_INVAL,
|
||||
"%s",
|
||||
"The current view has an index selection, but "
|
||||
"this function only works for ranged views." );
|
||||
}
|
||||
|
||||
h5_int64_t viewstart = 0;
|
||||
@@ -527,15 +554,17 @@ h5u_get_view (
|
||||
if ( start ) *start = viewstart;
|
||||
if ( end ) *end = viewend;
|
||||
|
||||
H5_CORE_API_RETURN (viewend - viewstart + 1); // view range is *inclusive*
|
||||
H5_RETURN (viewend - viewstart + 1); // view range is *inclusive*
|
||||
}
|
||||
|
||||
h5_int64_t
|
||||
h5_err_t
|
||||
h5u_set_canonical_view (
|
||||
const h5_file_t fh
|
||||
) {
|
||||
h5_file_p f = (h5_file_p)fh;
|
||||
H5_CORE_API_ENTER (h5_int64_t, "f=%p", f);
|
||||
CHECK_FILEHANDLE (f);
|
||||
CHECK_TIMEGROUP (f);
|
||||
h5u_fdata_t* u = f->u;
|
||||
TRY( h5u_reset_view (fh) );
|
||||
|
||||
@@ -562,7 +591,8 @@ h5u_set_canonical_view (
|
||||
#endif // PARALLEL_IO
|
||||
|
||||
h5_int64_t length = u->nparticles;
|
||||
H5_CORE_API_RETURN (h5u_set_view_length (fh, start, length));
|
||||
TRY (h5u_set_view_length (fh, start, length));
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
h5_ssize_t
|
||||
@@ -570,41 +600,11 @@ h5u_get_num_datasets (
|
||||
const h5_file_t fh /*!< [in] Handle to open file */
|
||||
) {
|
||||
h5_file_p f = (h5_file_p)fh;
|
||||
H5_CORE_API_ENTER (h5_int64_t, "f=%p", f);
|
||||
H5_CORE_API_RETURN (hdf5_get_num_datasets (f->step_gid));
|
||||
}
|
||||
|
||||
/*!
|
||||
Get information about dataset in current index given by its index
|
||||
*/
|
||||
h5_err_t
|
||||
h5u_get_dataset_info (
|
||||
const h5_file_t fh, /*!< [in] Handle to open file */
|
||||
const h5_id_t idx, /*!< [in] Index of the dataset */
|
||||
char *dataset_name, /*!< [out] Name of dataset */
|
||||
const h5_size_t len_dataset_name,
|
||||
/*!< [in] Size of buffer \c dataset_name */
|
||||
h5_int64_t *type, /*!< [out] Type of data in dataset */
|
||||
h5_size_t *nelem /*!< [out] Number of elements. */
|
||||
) {
|
||||
h5_file_p f = (h5_file_p)fh;
|
||||
H5_CORE_API_ENTER (h5_err_t,
|
||||
"f=%p, "
|
||||
"idx=%lld, "
|
||||
"dataset_name='%s', len_dataset_name=%llu, "
|
||||
"type=%p, nelem=%p",
|
||||
f,
|
||||
(long long)idx,
|
||||
dataset_name,
|
||||
(long long unsigned)len_dataset_name,
|
||||
type, nelem);
|
||||
TRY (hdf5_get_name_of_dataset_by_idx (
|
||||
f->step_gid,
|
||||
idx,
|
||||
dataset_name, len_dataset_name) );
|
||||
|
||||
H5_CORE_API_RETURN (
|
||||
h5u_get_dataset_info_by_name(fh, dataset_name, type, nelem));
|
||||
H5_CORE_API_ENTER (h5_ssize_t, "f=%p", f);
|
||||
CHECK_FILEHANDLE (f);
|
||||
CHECK_TIMEGROUP (f);
|
||||
TRY (ret_value = hdf5_get_num_datasets (f->step_gid));
|
||||
H5_RETURN (ret_value);
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
@@ -616,45 +616,145 @@ h5u_has_dataset (
|
||||
H5_CORE_API_ENTER (h5_err_t,
|
||||
"f=%p, name='%s'",
|
||||
f, name);
|
||||
h5_err_t exists;
|
||||
TRY (exists = hdf5_link_exists (f->step_gid, name));
|
||||
H5_CORE_API_RETURN (exists);
|
||||
CHECK_FILEHANDLE (f);
|
||||
CHECK_TIMEGROUP (f);
|
||||
TRY (ret_value = hdf5_link_exists (f->step_gid, name));
|
||||
H5_RETURN (ret_value);
|
||||
}
|
||||
|
||||
|
||||
static inline h5_err_t
|
||||
get_dataset_info (
|
||||
hid_t dataset_id,
|
||||
h5_int64_t* dataset_type,
|
||||
h5_size_t* dataset_nelem
|
||||
) {
|
||||
H5_INLINE_FUNC_ENTER (h5_err_t);
|
||||
if (dataset_type) {
|
||||
h5_int64_t type_;
|
||||
TRY (type_ = h5priv_get_normalized_dataset_type (dataset_id));
|
||||
TRY (*dataset_type = h5priv_map_hdf5_type_to_enum (type_));
|
||||
}
|
||||
if (dataset_nelem) {
|
||||
h5_ssize_t nelem_;
|
||||
TRY (nelem_ = hdf5_get_npoints_of_dataset (dataset_id));
|
||||
*dataset_nelem = nelem_;
|
||||
}
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
h5priv_get_dataset_info_by_idx (
|
||||
const hid_t id, /*!< [in] group ID */
|
||||
const h5_id_t dataset_idx, /*!< [in] Index of the dataset */
|
||||
char* dataset_name, /*!< [out] Name of dataset */
|
||||
const h5_size_t len_dataset_name,/*!<[in] Size of buffer */
|
||||
h5_int64_t* dataset_type, /*!< [out] Type of data in dataset */
|
||||
h5_size_t* dataset_nelem /*!< [out] Number of elements. */
|
||||
) {
|
||||
H5_PRIV_API_ENTER (h5_err_t,
|
||||
"id=%lld, "
|
||||
"dataset_idx=%lld, "
|
||||
"dataset_name='%s', len_dataset_name=%llu, "
|
||||
"dataset_type=%p, dataset_nelem=%p",
|
||||
(long long)id,
|
||||
(long long)dataset_idx,
|
||||
dataset_name,
|
||||
(long long unsigned)len_dataset_name,
|
||||
dataset_type, dataset_nelem);
|
||||
char dataset_name_[H5_DATANAME_LEN];
|
||||
TRY (hdf5_get_name_of_dataset_by_idx (
|
||||
id,
|
||||
dataset_idx,
|
||||
dataset_name_, sizeof(dataset_name_)));
|
||||
hid_t dataset_id;
|
||||
TRY (dataset_id = hdf5_open_dataset_by_name (id, dataset_name_));
|
||||
if (dataset_name) {
|
||||
strncpy (dataset_name, dataset_name_, len_dataset_name);
|
||||
}
|
||||
TRY (get_dataset_info (dataset_id, dataset_type, dataset_nelem));
|
||||
TRY (hdf5_close_dataset (dataset_id));
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
/*!
|
||||
Get information about dataset in current index given by its index
|
||||
*/
|
||||
h5_err_t
|
||||
h5u_get_dataset_info_by_idx (
|
||||
const h5_file_t fh, /*!< [in] Handle to open file */
|
||||
const h5_id_t idx, /*!< [in] Index of the dataset */
|
||||
char *dataset_name, /*!< [out] Name of dataset */
|
||||
const h5_size_t len_dataset_name,/*!< [in] Size of buffer */
|
||||
h5_int64_t *dataset_type, /*!< [out] Type of data in dataset */
|
||||
h5_size_t *dataset_nelem /*!< [out] Number of elements. */
|
||||
) {
|
||||
h5_file_p f = (h5_file_p)fh;
|
||||
H5_CORE_API_ENTER (h5_err_t,
|
||||
"f=%p, "
|
||||
"idx=%lld, "
|
||||
"dataset_name='%s', len_dataset_name=%llu, "
|
||||
"dataset_type=%p, dataset_nelem=%p",
|
||||
f,
|
||||
(long long)idx,
|
||||
dataset_name,
|
||||
(long long unsigned)len_dataset_name,
|
||||
dataset_type, dataset_nelem);
|
||||
CHECK_FILEHANDLE (f);
|
||||
CHECK_TIMEGROUP (f);
|
||||
TRY (h5priv_get_dataset_info_by_idx (
|
||||
f->step_gid,
|
||||
idx,
|
||||
dataset_name, len_dataset_name,
|
||||
dataset_type, dataset_nelem));
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
h5priv_get_dataset_info_by_name (
|
||||
const hid_t id, /*!< [in] group ID */
|
||||
const char* const dataset_name, /*!< [out] Name of dataset */
|
||||
h5_int64_t* dataset_type, /*!< [out] Type of data in dataset */
|
||||
h5_size_t* dataset_nelem /*!< [out] Number of elements. */
|
||||
) {
|
||||
H5_PRIV_API_ENTER (h5_err_t,
|
||||
"id=%lld, "
|
||||
"dataset_name='%s' "
|
||||
"dataset_type=%p, dataset_nelem=%p",
|
||||
(long long)id,
|
||||
dataset_name,
|
||||
dataset_type, dataset_nelem);
|
||||
hid_t dataset_id;
|
||||
TRY (dataset_id = hdf5_open_dataset_by_name (id, dataset_name));
|
||||
TRY (get_dataset_info (dataset_id, dataset_type, dataset_nelem));
|
||||
TRY (hdf5_close_dataset (dataset_id));
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
/*!
|
||||
Get information about dataset in current index given by its index
|
||||
*/
|
||||
h5_err_t
|
||||
h5u_get_dataset_info_by_name (
|
||||
const h5_file_t fh, /*!< [in] Handle to open file */
|
||||
const h5_file_t fh, /*!< [in] Handle to open file */
|
||||
const char* const dataset_name, /*!< [in] Name of dataset */
|
||||
h5_int64_t* const type, /*!< [out] Type of data in dataset */
|
||||
h5_size_t* const nelem /*!< [out] Number of elements. */
|
||||
h5_int64_t* const dataset_type, /*!< [out] Type of data in dataset */
|
||||
h5_size_t* const dataset_nelem /*!< [out] Number of elements. */
|
||||
) {
|
||||
h5_file_p f = (h5_file_p)fh;
|
||||
H5_CORE_API_ENTER (h5_err_t,
|
||||
"f=%p, "
|
||||
"dataset_name='%s', "
|
||||
"type=%p, nelem=%p",
|
||||
"dataset_type=%p, dataset_nelem=%p",
|
||||
f,
|
||||
dataset_name,
|
||||
type, nelem);
|
||||
|
||||
if (nelem) {
|
||||
h5_ssize_t nelem_;
|
||||
TRY (nelem_ = hdf5_get_npoints_of_dataset_by_name (
|
||||
f->step_gid,
|
||||
dataset_name) );
|
||||
if ( nelem_ < 0 ) H5_CORE_API_LEAVE (nelem_);
|
||||
*nelem = nelem_;
|
||||
}
|
||||
|
||||
if (type) {
|
||||
*type = h5priv_get_dataset_type (f->step_gid, dataset_name);
|
||||
if (*type < 0) H5_CORE_API_LEAVE (*type);
|
||||
}
|
||||
|
||||
H5_CORE_API_RETURN (H5_SUCCESS);
|
||||
dataset_type, dataset_nelem);
|
||||
CHECK_FILEHANDLE (f);
|
||||
CHECK_TIMEGROUP (f);
|
||||
TRY (h5priv_get_dataset_info_by_name (
|
||||
f->step_gid,
|
||||
dataset_name,
|
||||
dataset_type, dataset_nelem));
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
@@ -663,19 +763,21 @@ h5u_set_chunk (
|
||||
const h5_size_t size
|
||||
) {
|
||||
h5_file_p f = (h5_file_p)fh;
|
||||
H5_CORE_API_ENTER (h5_int64_t, "f=%p, size=%llu", f, (long long unsigned)size);
|
||||
if ( size == 0 )
|
||||
{
|
||||
H5_CORE_API_ENTER (
|
||||
h5_int64_t,
|
||||
"f=%p, size=%llu",
|
||||
f, (long long unsigned)size);
|
||||
CHECK_FILEHANDLE (f);
|
||||
if (size == 0) {
|
||||
h5_info ("Disabling chunking" );
|
||||
TRY (hdf5_set_layout_property (
|
||||
f->u->dcreate_prop, H5D_CONTIGUOUS));
|
||||
} else
|
||||
{
|
||||
} else {
|
||||
h5_info ("Setting chunk size to %lld particles", (long long)size);
|
||||
TRY (hdf5_set_chunk_property(
|
||||
f->u->dcreate_prop, 1, (hsize_t*)&size));
|
||||
}
|
||||
H5_CORE_API_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
@@ -686,11 +788,13 @@ h5u_get_chunk (
|
||||
) {
|
||||
h5_file_p f = (h5_file_p)fh;
|
||||
H5_CORE_API_ENTER (h5_int64_t, "f=%p, name='%s', size=%p", f,name,size);
|
||||
CHECK_FILEHANDLE (f);
|
||||
CHECK_TIMEGROUP (f);
|
||||
hid_t dataset_id;
|
||||
hid_t plist_id;
|
||||
hsize_t hsize;
|
||||
|
||||
TRY (dataset_id = hdf5_open_dataset (f->step_gid, name) );
|
||||
TRY (dataset_id = hdf5_open_dataset_by_name (f->step_gid, name) );
|
||||
TRY (plist_id = hdf5_get_dataset_create_plist (dataset_id) );
|
||||
TRY (hdf5_get_chunk_property (plist_id, 1, &hsize) );
|
||||
TRY (hdf5_close_property ( plist_id) );
|
||||
@@ -699,6 +803,6 @@ h5u_get_chunk (
|
||||
*size = (h5_size_t)hsize;
|
||||
|
||||
h5_info ("Found chunk size of %lld particles", (long long)*size);
|
||||
H5_CORE_API_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
|
||||
+201
-38
@@ -14,24 +14,164 @@
|
||||
#include "private/h5_model.h"
|
||||
#include "private/h5_hdf5.h"
|
||||
|
||||
h5_err_t
|
||||
|
||||
static inline hid_t
|
||||
h5priv_get_normalized_attribute_type (
|
||||
hid_t attr_id
|
||||
) {
|
||||
H5_PRIV_FUNC_ENTER (
|
||||
hid_t,
|
||||
"attr_id=%lld (%s)",
|
||||
(long long int)attr_id, hdf5_get_objname (attr_id));
|
||||
TRY (ret_value = hdf5_get_attribute_type (attr_id));
|
||||
TRY (ret_value = h5priv_normalize_type (ret_value));
|
||||
H5_RETURN (ret_value);
|
||||
}
|
||||
|
||||
static inline h5_err_t
|
||||
h5priv_read_attrib (
|
||||
const hid_t id,
|
||||
const char* attrib_name,
|
||||
const hid_t attrib_type,
|
||||
void* const attrib_value
|
||||
);
|
||||
const hid_t id, /*!< HDF5 object ID */
|
||||
const char* attrib_name, /*!< name of HDF5 attribute to read */
|
||||
const h5_types_t attrib_type, /*!< H5hut enum 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;
|
||||
TRY (attrib_id = hdf5_open_attribute_by_name (id, attrib_name));
|
||||
hid_t mem_type;
|
||||
hid_t space_id;
|
||||
/*
|
||||
attrib_type -> normalized HDF5 type
|
||||
determine file type of attribute
|
||||
compare normalized types
|
||||
if not equal:
|
||||
error
|
||||
if attribute type is string:
|
||||
set mem type to file type
|
||||
else
|
||||
set mem type to normalized attrib_type
|
||||
|
||||
h5_err_t
|
||||
*/
|
||||
hid_t normalized_type;
|
||||
TRY (normalized_type = h5priv_map_enum_to_normalized_type (attrib_type));
|
||||
hid_t file_type;
|
||||
TRY (file_type = hdf5_get_attribute_type (attrib_id));
|
||||
hid_t normalized_file_type;
|
||||
TRY (normalized_file_type = h5priv_normalize_type (file_type));
|
||||
if (normalized_file_type != normalized_type)
|
||||
H5_RETURN_ERROR (
|
||||
H5_ERR_HDF5,
|
||||
"Attribute '%s' has type '%s' but "
|
||||
"was requested as '%s'.",
|
||||
attrib_name,
|
||||
hdf5_get_type_name (normalized_file_type),
|
||||
hdf5_get_type_name (normalized_type));
|
||||
if (normalized_type == H5_STRING) {
|
||||
mem_type = file_type;
|
||||
} else {
|
||||
mem_type = normalized_type;
|
||||
}
|
||||
TRY (space_id = hdf5_get_attribute_dataspace (attrib_id));
|
||||
TRY (hdf5_read_attribute (attrib_id, mem_type, attrib_value));
|
||||
TRY (hdf5_close_dataspace(space_id));
|
||||
TRY (hdf5_close_attribute (attrib_id));
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
static inline h5_err_t
|
||||
h5priv_write_attrib (
|
||||
const hid_t id,
|
||||
const char* attrib_name,
|
||||
const hid_t attrib_type,
|
||||
const void* attrib_value,
|
||||
const hsize_t attrib_nelem,
|
||||
const int overwrite
|
||||
);
|
||||
const hid_t id, /*!< HDF5 object ID */
|
||||
const char* attrib_name, /*!< name of HDF5 attribute to write */
|
||||
const h5_types_t attrib_type, /*!< type of attribute */
|
||||
const void* attrib_value, /*!< value of attribute */
|
||||
const hsize_t attrib_nelem /*!< number of elements (dimension) */
|
||||
) {
|
||||
H5_PRIV_API_ENTER (h5_err_t,
|
||||
"id=%lld, attrib_name='%s', attrib_type=%lld, "
|
||||
"attrib_value=%p, attrib_nelem=%llu",
|
||||
(long long int)id,
|
||||
attrib_name,
|
||||
(long long int)attrib_type,
|
||||
attrib_value,
|
||||
attrib_nelem);
|
||||
hid_t space_id;
|
||||
hid_t attrib_id;
|
||||
hid_t hdf5_type;
|
||||
if (attrib_type == H5_STRING_T) {
|
||||
TRY (hdf5_type = hdf5_create_string_type (attrib_nelem));
|
||||
TRY (space_id = hdf5_create_dataspace_scalar ());
|
||||
} else {
|
||||
hdf5_type = h5priv_map_enum_to_normalized_type (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) {
|
||||
TRY (hdf5_delete_attribute (id, attrib_name));
|
||||
}
|
||||
TRY (attrib_id = hdf5_create_attribute (
|
||||
id,
|
||||
attrib_name,
|
||||
hdf5_type,
|
||||
space_id,
|
||||
H5P_DEFAULT, H5P_DEFAULT));
|
||||
TRY (hdf5_write_attribute (attrib_id, hdf5_type, attrib_value));
|
||||
|
||||
if (attrib_type == H5_STRING_T) {
|
||||
TRY (hdf5_close_type (hdf5_type));
|
||||
}
|
||||
TRY (hdf5_close_attribute (attrib_id));
|
||||
TRY (hdf5_close_dataspace (space_id));
|
||||
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
static inline h5_err_t
|
||||
h5priv_append_attrib (
|
||||
const hid_t id, /*!< HDF5 object ID */
|
||||
const char* attrib_name, /*!< name of HDF5 attribute to write */
|
||||
const h5_types_t attrib_type, /*!< type of attribute */
|
||||
const void* attrib_value, /*!< value of attribute */
|
||||
const hsize_t attrib_nelem /*!< number of elements (dimension) */
|
||||
) {
|
||||
H5_PRIV_API_ENTER (h5_err_t,
|
||||
"id=%lld, attrib_name='%s', attrib_type=%lld, "
|
||||
"attrib_value=%p, attrib_nelem=%llu",
|
||||
(long long int)id,
|
||||
attrib_name,
|
||||
(long long int)attrib_type,
|
||||
attrib_value,
|
||||
attrib_nelem);
|
||||
h5_err_t exists;
|
||||
TRY (exists = hdf5_attribute_exists (id, attrib_name));
|
||||
if (exists) {
|
||||
H5_RETURN_ERROR (
|
||||
H5_ERR,
|
||||
"Cannot overwrite attribute %s/%s",
|
||||
hdf5_get_objname (id), attrib_name);
|
||||
}
|
||||
H5_RETURN (
|
||||
h5priv_write_attrib (
|
||||
id,
|
||||
attrib_name,
|
||||
attrib_type,
|
||||
attrib_value,
|
||||
attrib_nelem));
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
This is a helper function for
|
||||
|
||||
- h5priv_get_attrib_info_by_name()
|
||||
- h5priv_get_attrib_info_by_idx()
|
||||
*/
|
||||
static inline h5_err_t
|
||||
get_attrib_info (
|
||||
hid_t attrib_id,
|
||||
@@ -39,28 +179,24 @@ get_attrib_info (
|
||||
h5_size_t* attrib_nelem /*!< OUT: number of elements */
|
||||
) {
|
||||
H5_INLINE_FUNC_ENTER (h5_err_t);
|
||||
hid_t mytype;
|
||||
TRY (mytype = hdf5_get_attribute_type (attrib_id));
|
||||
|
||||
H5T_class_t type_class;
|
||||
TRY (type_class = hdf5_get_class_type (mytype));
|
||||
|
||||
hid_t datatype_id;
|
||||
TRY (datatype_id = hdf5_get_attribute_type (attrib_id));
|
||||
if (attrib_nelem) {
|
||||
if (type_class == H5T_STRING) {
|
||||
*attrib_nelem = H5Tget_size(mytype);
|
||||
if (h5priv_normalize_type (datatype_id) == H5_STRING) {
|
||||
*attrib_nelem = H5Tget_size (datatype_id);
|
||||
} else {
|
||||
hid_t space_id;
|
||||
TRY (space_id = hdf5_get_attribute_dataspace (attrib_id));
|
||||
TRY (*attrib_nelem = hdf5_get_npoints_of_dataspace (space_id));
|
||||
TRY (*attrib_nelem = hdf5_get_npoints_of_dataspace (
|
||||
space_id));
|
||||
TRY (hdf5_close_dataspace (space_id));
|
||||
}
|
||||
}
|
||||
if (attrib_type) {
|
||||
TRY (*attrib_type = h5priv_normalize_h5_type (mytype));
|
||||
TRY (*attrib_type = h5priv_map_hdf5_type_to_enum (datatype_id));
|
||||
}
|
||||
TRY (hdf5_close_type (mytype));
|
||||
TRY (hdf5_close_attribute (attrib_id));
|
||||
H5_INLINE_FUNC_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
static inline h5_err_t
|
||||
@@ -76,20 +212,47 @@ h5priv_get_attrib_info_by_name (
|
||||
"attrib_type=%p, attrib_nelem=%p",
|
||||
(long long int)id,
|
||||
attrib_name,
|
||||
attrib_type,
|
||||
attrib_nelem);
|
||||
attrib_type, attrib_nelem);
|
||||
hid_t attrib_id;
|
||||
TRY (attrib_id = hdf5_open_attribute (id, attrib_name));
|
||||
H5_PRIV_API_RETURN (get_attrib_info (attrib_id, attrib_type, attrib_nelem));
|
||||
TRY (attrib_id = hdf5_open_attribute_by_name (id, attrib_name));
|
||||
H5_RETURN (
|
||||
get_attrib_info (
|
||||
attrib_id, attrib_type, attrib_nelem));
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
static inline h5_err_t
|
||||
h5priv_get_attrib_info_by_idx (
|
||||
const hid_t id,
|
||||
const h5_size_t attrib_idx,
|
||||
char* attrib_name,
|
||||
const h5_size_t len_attrib_name,
|
||||
h5_int64_t* attrib_type,
|
||||
h5_size_t* attrib_nelem
|
||||
);
|
||||
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_by_idx (
|
||||
id,
|
||||
(unsigned int)attrib_idx));
|
||||
|
||||
if (attrib_name) {
|
||||
TRY (hdf5_get_attribute_name (
|
||||
attrib_id,
|
||||
(size_t)len_attrib_name,
|
||||
attrib_name));
|
||||
}
|
||||
H5_RETURN (
|
||||
get_attrib_info (
|
||||
attrib_id, attrib_type, attrib_nelem));
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
/*
|
||||
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 __PRIVATE_H5_CONST_H
|
||||
#define __PRIVATE_H5_CONST_H
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
@@ -1,48 +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.
|
||||
*/
|
||||
|
||||
#ifndef __PRIVATE_H5_DEBUG_H
|
||||
#define __PRIVATE_H5_DEBUG_H
|
||||
|
||||
#include "h5core/h5_debug.h"
|
||||
|
||||
#define H5_CORE_API_ENTER(type, fmt, ...) \
|
||||
__FUNC_ENTER(type, H5_DEBUG_CORE_API, fmt, __VA_ARGS__)
|
||||
#define H5_CORE_API_LEAVE(value) __FUNC_LEAVE(value)
|
||||
#define H5_CORE_API_RETURN(value) __FUNC_RETURN(value, H5_DEBUG_CORE_API)
|
||||
|
||||
|
||||
#define H5_PRIV_API_ENTER(type, fmt, ...) \
|
||||
__FUNC_ENTER(type, H5_DEBUG_PRIV_API, fmt, __VA_ARGS__)
|
||||
#define H5_PRIV_API_LEAVE(value) __FUNC_LEAVE(value)
|
||||
#define H5_PRIV_API_RETURN(value) __FUNC_RETURN(value, H5_DEBUG_PRIV_API)
|
||||
|
||||
|
||||
#define H5_PRIV_FUNC_ENTER(type, fmt, ...) \
|
||||
__FUNC_ENTER(type, H5_DEBUG_PRIV_FUNC, fmt, __VA_ARGS__ )
|
||||
#define H5_PRIV_FUNC_LEAVE(value) __FUNC_LEAVE(value)
|
||||
#define H5_PRIV_FUNC_RETURN(value) __FUNC_RETURN(value, H5_DEBUG_PRIV_FUNC)
|
||||
|
||||
|
||||
#define HDF5_WRAPPER_ENTER(type, fmt, ...) \
|
||||
__FUNC_ENTER(type, H5_DEBUG_HDF5, fmt, __VA_ARGS__ )
|
||||
#define HDF5_WRAPPER_LEAVE(value) __FUNC_LEAVE(value)
|
||||
#define HDF5_WRAPPER_RETURN(value) __FUNC_RETURN(value, H5_DEBUG_HDF5)
|
||||
|
||||
|
||||
#define MPI_WRAPPER_ENTER(type, fmt, ...) \
|
||||
__FUNC_ENTER(type, H5_DEBUG_MPI, fmt, __VA_ARGS__ )
|
||||
#define MPI_WRAPPER_LEAVE(value) __FUNC_LEAVE(value)
|
||||
#define MPI_WRAPPER_RETURN(value) __FUNC_RETURN(value, H5_DEBUG_MPI)
|
||||
|
||||
#define H5_INLINE_FUNC_ENTER(type) type ret_value = (type)H5_ERR;
|
||||
#define H5_INLINE_FUNC_LEAVE(expr) __FUNC_LEAVE(expr)
|
||||
#define H5_INLINE_FUNC_RETURN(expr) __FUNC_RETURN(expr, 0)
|
||||
|
||||
#endif
|
||||
@@ -1,7 +1,7 @@
|
||||
#ifndef __PRIVATE_H5_ERRORHANDLING_H
|
||||
#define __PRIVATE_H5_ERRORHANDLING_H
|
||||
#ifndef __PRIVATE_H5_ERROR_H
|
||||
#define __PRIVATE_H5_ERROR_H
|
||||
|
||||
#include "h5core/h5_errorhandling.h"
|
||||
#include "h5core/h5_err.h"
|
||||
|
||||
extern const char* const H5_O_MODES[];
|
||||
|
||||
@@ -1,11 +1,21 @@
|
||||
#ifndef __PRIVATE_H5_H
|
||||
#define __PRIVATE_H5_H
|
||||
#ifndef __PRIVATE_H5_FILE_H
|
||||
#define __PRIVATE_H5_FILE_H
|
||||
|
||||
#include "private/h5_types.h"
|
||||
#include "private/h5_debug.h"
|
||||
#include "private/h5_errorhandling.h"
|
||||
#include "private/h5_log.h"
|
||||
#include "private/h5_err.h"
|
||||
#include "h5core/h5_file.h"
|
||||
|
||||
#define UNUSED_ARGUMENT(x) (void)x
|
||||
#define H5_VFD_MPIO_POSIX 0x00000010
|
||||
#define H5_VFD_MPIO_INDEPENDENT 0x00000020
|
||||
#define H5_VFD_MPIO_COLLECTIVE 0x00000040
|
||||
#define H5_VFD_CORE 0x00000080
|
||||
|
||||
#define H5_FLUSH_FILE 0x00001000
|
||||
#define H5_FLUSH_STEP 0x00002000
|
||||
#define H5_FLUSH_DATASET 0x00004000
|
||||
|
||||
#define H5_FS_LUSTRE 0x00010000
|
||||
|
||||
static inline h5_err_t
|
||||
check_filehandle (
|
||||
@@ -22,7 +32,9 @@ check_filehandle (
|
||||
#define CHECK_FILEHANDLE(f) \
|
||||
TRY (check_filehandle (f));
|
||||
|
||||
#define is_writable(f) (f->props->flags & (H5_O_RDWR | H5_O_WRONLY | H5_O_APPENDONLY))
|
||||
static inline int is_writable(h5_file_p f) {
|
||||
return (f->props->flags & (H5_O_RDWR | H5_O_WRONLY | H5_O_APPENDONLY));
|
||||
}
|
||||
#define is_readable(f) (f->props->flags & (H5_O_RDWR | H5_O_RDONLY))
|
||||
#define is_readonly(f) (f->props->flags & H5_O_RDONLY)
|
||||
#define is_appendonly(f) (f->props->flags & H5_O_APPENDONLY)
|
||||
@@ -30,7 +42,12 @@ check_filehandle (
|
||||
#define CHECK_WRITABLE_MODE(f) \
|
||||
TRY (is_writable (f) ? H5_SUCCESS : h5_error ( \
|
||||
H5_ERR_INVAL, \
|
||||
"Attempting to write to read-only file"));
|
||||
"Attempting to write to read-only file handle"));
|
||||
|
||||
#define CHECK_READABLE_MODE(f) \
|
||||
TRY (is_readable (f) ? H5_SUCCESS : h5_error ( \
|
||||
H5_ERR_INVAL, \
|
||||
"Attempting to read from write-only file handle"));
|
||||
|
||||
#define CHECK_TIMEGROUP(f) \
|
||||
TRY ((f->step_gid > 0) ? H5_SUCCESS : h5_error ( \
|
||||
@@ -10,11 +10,13 @@
|
||||
#include <string.h>
|
||||
#include <hdf5.h>
|
||||
|
||||
#include "private/h5_log.h"
|
||||
#include "private/h5_hdf5.h"
|
||||
|
||||
#include "h5core/h5_types.h"
|
||||
#include "h5core/h5_syscall.h"
|
||||
|
||||
|
||||
/*
|
||||
Test whether given path exists.
|
||||
*/
|
||||
@@ -38,54 +40,18 @@ h5priv_link_exists_ (
|
||||
*s++ = '/';
|
||||
*s = '\0';
|
||||
}
|
||||
if (s+strlen(path[i])+1 >= end) H5_PRIV_API_LEAVE (
|
||||
h5_error (
|
||||
H5_ERR_HDF5,
|
||||
"path %s... to long", name));
|
||||
if (s+strlen(path[i])+1 >= end)
|
||||
H5_RETURN_ERROR (
|
||||
H5_ERR_HDF5,
|
||||
"path %s... to long", name);
|
||||
s = stpcpy (s, path[i]); // return ptr to end!!!
|
||||
h5_err_t exists;
|
||||
TRY (exists = hdf5_link_exists (loc_id, name));
|
||||
if (!exists) H5_PRIV_FUNC_LEAVE (0);
|
||||
if (!exists) H5_LEAVE (0);
|
||||
}
|
||||
H5_PRIV_FUNC_RETURN (1);
|
||||
H5_RETURN (1);
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
h5priv_open_group_ (
|
||||
int create_intermediate,
|
||||
const hid_t loc_id,
|
||||
const char const* path[],
|
||||
size_t size
|
||||
) {
|
||||
H5_PRIV_FUNC_ENTER (h5_err_t,
|
||||
"create_intermediate=%d, loc_id=%lld, (%s), path=%s, ...",
|
||||
create_intermediate, (long long int)loc_id, hdf5_get_objname (loc_id),
|
||||
path[0]);
|
||||
hid_t hid = loc_id;
|
||||
hid_t hid2 = 0;
|
||||
h5_err_t exists;
|
||||
for (size_t i=0; i < size; i++) {
|
||||
TRY (exists = hdf5_link_exists (hid, path[i]));
|
||||
if (exists) {
|
||||
TRY (hid2 = hdf5_open_group (hid, path[i]));
|
||||
} else if (create_intermediate) {
|
||||
TRY (hid2 = hdf5_create_group (hid, path[i]));
|
||||
} else {
|
||||
H5_PRIV_FUNC_LEAVE (
|
||||
h5_error (
|
||||
H5_ERR_HDF5,
|
||||
"No such group '%s/%s'.",
|
||||
hdf5_get_objname (hid),
|
||||
path[i]));
|
||||
|
||||
}
|
||||
if (hid != loc_id) {
|
||||
TRY (hdf5_close_group (hid));
|
||||
}
|
||||
hid = hid2;
|
||||
}
|
||||
H5_PRIV_FUNC_RETURN (hid);
|
||||
}
|
||||
|
||||
typedef struct op_data {
|
||||
int queried_idx;
|
||||
@@ -212,12 +178,12 @@ iter_op_count_match (
|
||||
H5O_type_t type;
|
||||
TRY (type = iter_op_get_obj_type (g_id, name, info));
|
||||
if (type != op_data->type)
|
||||
H5_PRIV_FUNC_LEAVE (0);
|
||||
H5_LEAVE (0);
|
||||
/* count if prefix matches */
|
||||
if (strncmp (name, op_data->prefix, strlen(op_data->prefix)) == 0) {
|
||||
op_data->cnt++;
|
||||
}
|
||||
H5_PRIV_FUNC_RETURN (0);
|
||||
H5_RETURN (0);
|
||||
}
|
||||
|
||||
ssize_t
|
||||
@@ -235,13 +201,12 @@ hdf5_get_num_groups (
|
||||
&start_idx,
|
||||
iter_op_count, &op_data);
|
||||
if (herr < 0) {
|
||||
HDF5_WRAPPER_LEAVE (
|
||||
h5_error (
|
||||
H5_ERR_HDF5,
|
||||
"Cannot get number of groups in '%s'.",
|
||||
hdf5_get_objname (loc_id)));
|
||||
H5_RETURN_ERROR (
|
||||
H5_ERR_HDF5,
|
||||
"Cannot get number of groups in '%s'.",
|
||||
hdf5_get_objname (loc_id));
|
||||
}
|
||||
HDF5_WRAPPER_RETURN (op_data.cnt);
|
||||
H5_RETURN (op_data.cnt);
|
||||
}
|
||||
|
||||
ssize_t
|
||||
@@ -261,14 +226,13 @@ hdf5_get_num_groups_matching_prefix (
|
||||
&start_idx,
|
||||
iter_op_count_match, &op_data);
|
||||
if (herr < 0) {
|
||||
HDF5_WRAPPER_LEAVE (
|
||||
h5_error (
|
||||
H5_ERR_HDF5,
|
||||
"Cannot get number of groups with prefix"
|
||||
" '%s' in '%s'.",
|
||||
prefix, hdf5_get_objname (loc_id)));
|
||||
H5_RETURN_ERROR (
|
||||
H5_ERR_HDF5,
|
||||
"Cannot get number of groups with prefix"
|
||||
" '%s' in '%s'.",
|
||||
prefix, hdf5_get_objname (loc_id));
|
||||
}
|
||||
HDF5_WRAPPER_RETURN (op_data.cnt);
|
||||
H5_RETURN (op_data.cnt);
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
@@ -294,15 +258,14 @@ hdf5_get_name_of_group_by_idx (
|
||||
&start_idx,
|
||||
iter_op_idx, &op_data);
|
||||
if (herr < 0) {
|
||||
HDF5_WRAPPER_LEAVE (
|
||||
h5_error (
|
||||
H5_ERR_HDF5,
|
||||
"Cannot get name of group with index"
|
||||
" '%lu' in '%s'.",
|
||||
(long unsigned int)idx,
|
||||
hdf5_get_objname (loc_id)));
|
||||
H5_RETURN_ERROR (
|
||||
H5_ERR_HDF5,
|
||||
"Cannot get name of group with index"
|
||||
" '%lu' in '%s'.",
|
||||
(long unsigned int)idx,
|
||||
hdf5_get_objname (loc_id));
|
||||
}
|
||||
HDF5_WRAPPER_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
ssize_t
|
||||
@@ -320,13 +283,12 @@ hdf5_get_num_datasets (
|
||||
&start_idx,
|
||||
iter_op_count, &op_data);
|
||||
if (herr < 0) {
|
||||
HDF5_WRAPPER_LEAVE (
|
||||
h5_error (
|
||||
H5_ERR_HDF5,
|
||||
"Cannot get number of datasets in '%s'.",
|
||||
hdf5_get_objname (loc_id)));
|
||||
H5_RETURN_ERROR (
|
||||
H5_ERR_HDF5,
|
||||
"Cannot get number of datasets in '%s'.",
|
||||
hdf5_get_objname (loc_id));
|
||||
}
|
||||
HDF5_WRAPPER_RETURN (op_data.cnt);
|
||||
H5_RETURN (op_data.cnt);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -355,17 +317,16 @@ hdf5_get_name_of_dataset_by_idx (
|
||||
&start_idx,
|
||||
iter_op_idx, &op_data);
|
||||
if (herr < 0) {
|
||||
HDF5_WRAPPER_LEAVE (
|
||||
h5_error (
|
||||
H5_ERR_HDF5,
|
||||
"Cannot get name of dataset with index"
|
||||
" '%lu' in '%s'.",
|
||||
(long unsigned int)idx,
|
||||
hdf5_get_objname (loc_id)));
|
||||
H5_RETURN_ERROR (
|
||||
H5_ERR_HDF5,
|
||||
"Cannot get name of dataset with index"
|
||||
" '%lu' in '%s'.",
|
||||
(long unsigned int)idx,
|
||||
hdf5_get_objname (loc_id));
|
||||
}
|
||||
if (op_data.cnt < 0)
|
||||
HDF5_WRAPPER_LEAVE (H5_NOK);
|
||||
HDF5_WRAPPER_RETURN (H5_SUCCESS);
|
||||
H5_LEAVE (H5_NOK);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
/****** I d e n t i f i e r **************************************************/
|
||||
|
||||
+583
-504
File diff suppressed because it is too large
Load Diff
@@ -32,7 +32,7 @@
|
||||
#include <assert.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#include "private/h5_debug.h"
|
||||
#include "private/h5_log.h"
|
||||
#include "private/h5_hsearch.h"
|
||||
|
||||
#include "h5core/h5_types.h"
|
||||
@@ -90,7 +90,7 @@ h5priv_hcreate (
|
||||
|
||||
/* Test for correct arguments. */
|
||||
if (htab == NULL) {
|
||||
H5_PRIV_API_LEAVE (h5_error_internal ());
|
||||
H5_LEAVE (h5_error_internal ());
|
||||
}
|
||||
/* Change nel to the first prime number not smaller as nel. */
|
||||
nel |= 1; /* make odd */
|
||||
@@ -108,7 +108,7 @@ h5priv_hcreate (
|
||||
htab->size + 1, sizeof (_ENTRY)));
|
||||
|
||||
/* everything went alright */
|
||||
H5_PRIV_API_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -157,7 +157,7 @@ h5priv_hgrow (
|
||||
h5_debug ("Old hash table removed");
|
||||
}
|
||||
*htab = __htab;
|
||||
H5_PRIV_API_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
static inline h5_err_t
|
||||
@@ -172,7 +172,7 @@ hwalk (
|
||||
TRY ((*visit)(&htab->table[idx].entry));
|
||||
}
|
||||
}
|
||||
H5_PRIV_FUNC_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
void*
|
||||
@@ -201,7 +201,7 @@ h5priv_hdestroy (
|
||||
H5_PRIV_API_ENTER (h5_err_t, "htab=%p", htab);
|
||||
/* Test for correct arguments. */
|
||||
if (htab == NULL) {
|
||||
H5_PRIV_API_LEAVE (h5_error_internal ());
|
||||
H5_LEAVE (h5_error_internal ());
|
||||
}
|
||||
/* Free used memory. */
|
||||
if (htab->free_entry) {
|
||||
@@ -211,7 +211,7 @@ h5priv_hdestroy (
|
||||
|
||||
/* the sign for an existing table is an value != NULL in htable */
|
||||
htab->table = NULL;
|
||||
H5_PRIV_API_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
|
||||
@@ -256,7 +256,7 @@ h5priv_hsearch (
|
||||
if (retval) {
|
||||
*retval = htab->table[idx].entry;
|
||||
}
|
||||
H5_PRIV_API_LEAVE (H5_SUCCESS);
|
||||
H5_LEAVE (H5_SUCCESS);
|
||||
}
|
||||
|
||||
/* Second hash function, as suggested in [Knuth] */
|
||||
@@ -283,7 +283,7 @@ h5priv_hsearch (
|
||||
if (retval) {
|
||||
*retval = htab->table[idx].entry;
|
||||
}
|
||||
H5_PRIV_API_LEAVE (H5_SUCCESS);
|
||||
H5_LEAVE (H5_SUCCESS);
|
||||
}
|
||||
} while (htab->table[idx].used);
|
||||
}
|
||||
@@ -296,7 +296,7 @@ h5priv_hsearch (
|
||||
if (retval) {
|
||||
*retval = NULL;
|
||||
}
|
||||
H5_PRIV_API_LEAVE (h5_error_internal ());
|
||||
H5_LEAVE (h5_error_internal ());
|
||||
}
|
||||
|
||||
htab->table[idx].used = hval;
|
||||
@@ -307,15 +307,15 @@ h5priv_hsearch (
|
||||
if (retval) {
|
||||
*retval = htab->table[idx].entry;
|
||||
}
|
||||
H5_PRIV_API_LEAVE (H5_SUCCESS);
|
||||
H5_LEAVE (H5_SUCCESS);
|
||||
} else if (action == H5_REMOVE) {
|
||||
htab->table[idx].used = 0; /* mark as unused, but */
|
||||
*retval = htab->table[idx].entry; /* return ptr to entry */
|
||||
H5_PRIV_API_LEAVE (H5_SUCCESS);
|
||||
H5_LEAVE (H5_SUCCESS);
|
||||
}
|
||||
if (retval) *retval = NULL;
|
||||
h5_debug ("Key not found in hash table.");
|
||||
H5_PRIV_API_RETURN (H5_NOK);
|
||||
H5_RETURN (H5_NOK);
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
@@ -355,7 +355,7 @@ free_string_keyed (
|
||||
h5_hitem_string_keyed_t* entry = (h5_hitem_string_keyed_t*) __entry;
|
||||
TRY (h5_free (entry->key));
|
||||
TRY (h5_free (entry));
|
||||
H5_PRIV_FUNC_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
@@ -376,5 +376,5 @@ h5priv_hcreate_string_keyed (
|
||||
compute_string_keyed,
|
||||
free_entry));
|
||||
}
|
||||
H5_PRIV_API_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
@@ -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,37 @@ 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
|
||||
@@ -80,14 +77,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,7 +92,7 @@ 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
|
||||
@@ -106,44 +103,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,7 +154,7 @@ 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
|
||||
@@ -168,22 +165,22 @@ create_tag_types (
|
||||
|
||||
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
|
||||
@@ -194,44 +191,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 +242,7 @@ 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);
|
||||
}
|
||||
|
||||
#if defined(WITH_PARALLEL_H5GRID)
|
||||
@@ -257,51 +254,51 @@ 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
|
||||
@@ -311,32 +308,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 +345,9 @@ 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
|
||||
@@ -360,7 +357,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 +366,7 @@ 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
|
||||
@@ -442,7 +439,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 +512,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 +548,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 +597,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 +652,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
|
||||
|
||||
@@ -666,22 +663,28 @@ _h5_exit (int status) {
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
h5_initialize (
|
||||
h5priv_initialize (
|
||||
void
|
||||
) {
|
||||
h5_initialized = 1;
|
||||
memset (&h5_call_stack, 0, sizeof (h5_call_stack));
|
||||
// must be set here, otherwise next statement will fail!
|
||||
h5_initialized = 1;
|
||||
H5_CORE_API_ENTER (h5_err_t, "%s", "void");
|
||||
ret_value = H5_SUCCESS;
|
||||
#ifdef PARALLEL_IO
|
||||
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 ());
|
||||
@@ -700,5 +703,5 @@ 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);
|
||||
}
|
||||
@@ -13,14 +13,31 @@
|
||||
#include "h5core/h5_types.h"
|
||||
#include "private/h5t_types.h"
|
||||
|
||||
#define UNUSED_ARGUMENT(x) (void)x
|
||||
|
||||
// dummy MPI calls for serial code
|
||||
#if !defined (PARALLEL_IO)
|
||||
typedef int MPI_Comm;
|
||||
#define MPI_Init(argc, argv)
|
||||
#define MPI_Initialized () (1)
|
||||
#define MPI_Comm_size(comm, nprocs) {(void)comm; *nprocs = 1; }
|
||||
#define MPI_Comm_rank(comm, myproc) {(void)comm; *myproc = 0; }
|
||||
#define MPI_Finalize()
|
||||
#define MPI_COMM_WORLD (0)
|
||||
#define MPI_COMM_SELF (1)
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
h5_err_t
|
||||
h5priv_initialize (void);
|
||||
|
||||
extern int h5_initialized;
|
||||
extern h5_dta_types_t h5_dta_types;
|
||||
extern int h5_myproc;
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
+14
-12
@@ -7,10 +7,8 @@
|
||||
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 "private/h5_io.h"
|
||||
@@ -34,7 +32,8 @@ h5priv_write_dataset_by_name (
|
||||
const void* const data
|
||||
) {
|
||||
H5_PRIV_API_ENTER (h5_err_t,
|
||||
"m=%p, f=%p, loc_id=%lld (%s), dsinfo=%p, set_memspace=%p, "
|
||||
"m=%p, f=%p, loc_id=%lld (%s), dsinfo=%p, "
|
||||
"set_memspace=%p, "
|
||||
"set_diskspace=%p, data=%p",
|
||||
m, f, (long long int)loc_id, hdf5_get_objname(loc_id),
|
||||
dsinfo,
|
||||
@@ -47,7 +46,7 @@ h5priv_write_dataset_by_name (
|
||||
if ((exists > 0) && (f->props->flags & H5_O_APPENDONLY)) {
|
||||
h5_warn ("Dataset %s/%s already exist.",
|
||||
hdf5_get_objname (loc_id), dsinfo->name);
|
||||
H5_PRIV_API_LEAVE (h5priv_handle_file_mode_error(f->props->flags));
|
||||
H5_LEAVE (h5priv_handle_file_mode_error(f->props->flags));
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -61,7 +60,7 @@ h5priv_write_dataset_by_name (
|
||||
|
||||
if (exists) {
|
||||
/* overwrite dataset */
|
||||
TRY (dset_id = hdf5_open_dataset (loc_id, dsinfo->name));
|
||||
TRY (dset_id = hdf5_open_dataset_by_name (loc_id, dsinfo->name));
|
||||
TRY (dataspace_id = hdf5_get_dataset_space (dset_id));
|
||||
TRY (hdf5_set_dataset_extent (dset_id, dsinfo->dims));
|
||||
/* exten dataset? */
|
||||
@@ -94,7 +93,7 @@ h5priv_write_dataset_by_name (
|
||||
TRY (hdf5_close_dataset (dset_id));
|
||||
f->empty = 0;
|
||||
|
||||
H5_PRIV_API_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
|
||||
@@ -104,7 +103,8 @@ h5priv_write_dataset_by_name (
|
||||
|
||||
- Check existance dataset
|
||||
- Write data
|
||||
is needed if dset, mspace, dspace can't be set by the callback functions above
|
||||
is needed if dset, mspace, dspace can't be set by the callback
|
||||
functions above
|
||||
*/
|
||||
h5_err_t
|
||||
h5priv_write_dataset_by_name_id (
|
||||
@@ -117,12 +117,14 @@ h5priv_write_dataset_by_name_id (
|
||||
const void* const data
|
||||
) {
|
||||
H5_PRIV_API_ENTER (h5_err_t,
|
||||
"f=%p, loc_id=%lld (%s), dsinfo=%p, dset_id=%lld, memspace_id=%lld, "
|
||||
"f=%p, loc_id=%lld (%s), dsinfo=%p, dset_id=%lld, "
|
||||
"memspace_id=%lld, "
|
||||
"diskspace_id=%lld, data=%p",
|
||||
f, (long long int)loc_id, hdf5_get_objname(loc_id),
|
||||
dsinfo,
|
||||
(long long int)dset_id,
|
||||
(long long int)memspace_id, (long long int)diskspace_id, data);
|
||||
(long long int)memspace_id,
|
||||
(long long int)diskspace_id, data);
|
||||
h5_info ("Writing dataset %s/%s.",
|
||||
hdf5_get_objname (loc_id), dsinfo->name);
|
||||
|
||||
@@ -131,7 +133,7 @@ h5priv_write_dataset_by_name_id (
|
||||
if ((exists > 0) && (f->props->flags & H5_O_APPENDONLY)) {
|
||||
h5_warn ("Dataset %s/%s already exist.",
|
||||
hdf5_get_objname (loc_id), dsinfo->name);
|
||||
H5_PRIV_API_LEAVE (h5priv_handle_file_mode_error(f->props->flags));
|
||||
H5_LEAVE (h5priv_handle_file_mode_error(f->props->flags));
|
||||
}
|
||||
|
||||
TRY (h5priv_start_throttle (f));
|
||||
@@ -144,5 +146,5 @@ h5priv_write_dataset_by_name_id (
|
||||
data));
|
||||
TRY (h5priv_end_throttle (f));
|
||||
|
||||
H5_PRIV_API_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
@@ -56,12 +56,6 @@ h5priv_read_dataset (
|
||||
hid_t (*)(h5t_mesh_t* const, const hid_t),
|
||||
void* const);
|
||||
|
||||
h5_int64_t
|
||||
h5priv_get_dataset_type(
|
||||
const hid_t group_id,
|
||||
const char *dataset_name
|
||||
);
|
||||
|
||||
h5_err_t
|
||||
h5priv_normalize_dataset_name (
|
||||
const char *name,
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
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 __PRIVATE_H5_DEBUG_H
|
||||
#define __PRIVATE_H5_DEBUG_H
|
||||
|
||||
#include "h5core/h5_types.h"
|
||||
#include "h5core/h5_log.h"
|
||||
#include "private/h5_init.h"
|
||||
|
||||
#if defined(NDEBUG)
|
||||
|
||||
#define __FUNC_ENTER(type, mask, fmt, ...) \
|
||||
type ret_value = (type)H5_ERR;
|
||||
|
||||
#else // NDEBUG not defined
|
||||
|
||||
#define __FUNC_ENTER(type, mask, fmt, ...) \
|
||||
type ret_value = (type)H5_ERR; \
|
||||
int __log__ = h5_log_level & mask; \
|
||||
if (__log__ ) { \
|
||||
h5_call_stack_push (__func__,e_##type); \
|
||||
h5_debug ("(" fmt ")", __VA_ARGS__); \
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#define H5_CORE_API_ENTER(type, fmt, ...) \
|
||||
if (!h5_initialized) { \
|
||||
h5priv_initialize(); \
|
||||
} \
|
||||
__FUNC_ENTER(type, H5_DEBUG_CORE_API, fmt, __VA_ARGS__)
|
||||
|
||||
#define H5_PRIV_API_ENTER(type, fmt, ...) \
|
||||
__FUNC_ENTER(type, H5_DEBUG_PRIV_API, fmt, __VA_ARGS__)
|
||||
|
||||
#define H5_PRIV_FUNC_ENTER(type, fmt, ...) \
|
||||
__FUNC_ENTER(type, H5_DEBUG_PRIV_FUNC, fmt, __VA_ARGS__ )
|
||||
|
||||
#define H5_INLINE_FUNC_ENTER(type) \
|
||||
type ret_value = (type)H5_ERR; int __log__ = 0;
|
||||
|
||||
#define HDF5_WRAPPER_ENTER(type, fmt, ...) \
|
||||
__FUNC_ENTER(type, H5_DEBUG_HDF5, fmt, __VA_ARGS__ )
|
||||
|
||||
#endif
|
||||
@@ -7,8 +7,6 @@
|
||||
License: see file COPYING in top level of source distribution.
|
||||
*/
|
||||
|
||||
#include "h5core/h5_init.h"
|
||||
|
||||
#ifdef H5_USE_LUSTRE
|
||||
|
||||
#include <stdio.h>
|
||||
@@ -94,7 +92,7 @@ _get_lustre_stripe_size(h5_file_t *const f, const char *path )
|
||||
|
||||
close(fd);
|
||||
|
||||
if ( f->myproc == 0 && h5_get_debuglevel() >= 5 )
|
||||
if ( f->myproc == 0 && h5_get_loglevel() >= 5 )
|
||||
_print_stripe_info(lum);
|
||||
|
||||
ssize_t stripe_size = (ssize_t)lum->lmm_stripe_size;
|
||||
@@ -164,7 +162,7 @@ h5_optimize_for_lustre (
|
||||
config.flash_incr_mode = H5C_flash_incr__off;
|
||||
TRY( H5Pset_mdc_config( f->access_prop, &config ) );
|
||||
|
||||
H5_CORE_API_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
#endif // H5_USE_LUSTRE
|
||||
|
||||
@@ -7,11 +7,11 @@
|
||||
License: see file COPYING in top level of source distribution.
|
||||
*/
|
||||
|
||||
#include "h5core/h5_init.h"
|
||||
|
||||
#include "private/h5_errorhandling.h"
|
||||
#include "private/h5_err.h"
|
||||
#include "private/h5_maps.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
/*
|
||||
Allocate new/empty string-list
|
||||
*/
|
||||
@@ -26,7 +26,7 @@ h5priv_alloc_strlist (
|
||||
TRY (*list = h5_calloc (
|
||||
1, sizeof (**list)+size*sizeof ((*list)->items[0])));
|
||||
(*list)->size = size;
|
||||
H5_PRIV_API_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
@@ -34,14 +34,14 @@ h5priv_free_strlist (
|
||||
h5_strlist_t** list
|
||||
) {
|
||||
H5_PRIV_API_ENTER (h5_err_t, "list=%p", list);
|
||||
if (list == NULL || *list == NULL) H5_PRIV_API_LEAVE (H5_SUCCESS);
|
||||
if (list == NULL || *list == NULL) H5_LEAVE (H5_SUCCESS);
|
||||
h5_strlist_t* l = *list;
|
||||
for (size_t i = 0; i < l->size; i++) {
|
||||
TRY (h5_free(l->items[i]));
|
||||
}
|
||||
TRY (h5_free (l));
|
||||
l = NULL;
|
||||
H5_PRIV_API_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
static inline h5_err_t
|
||||
@@ -49,11 +49,11 @@ grow_strlist (
|
||||
h5_strlist_t** list,
|
||||
size_t new_size
|
||||
) {
|
||||
H5_PRIV_API_ENTER (h5_err_t, "list=%p, new_size=%zu", list, new_size);
|
||||
H5_PRIV_FUNC_ENTER (h5_err_t, "list=%p, new_size=%zu", list, new_size);
|
||||
size_t num_bytes = sizeof (**list) + (new_size-1)*sizeof((*list)->items[0]);
|
||||
TRY (*list = h5_alloc (*list, num_bytes));
|
||||
(*list)->size = new_size;
|
||||
H5_PRIV_FUNC_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -90,7 +90,7 @@ h5priv_insert_strlist (
|
||||
}
|
||||
TRY (l->items[idx] = h5_strdup(item));
|
||||
l->num_items++;
|
||||
H5_PRIV_API_RETURN (idx);
|
||||
H5_RETURN (idx);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -103,7 +103,7 @@ h5priv_find_strlist (
|
||||
) {
|
||||
H5_PRIV_API_ENTER (ssize_t, "list=%p, item=%s", list, item);
|
||||
if (!list) {
|
||||
H5_PRIV_API_LEAVE (-1);
|
||||
H5_LEAVE (-1);
|
||||
}
|
||||
register h5_loc_idx_t low = 0;
|
||||
register h5_loc_idx_t high = list->num_items - 1;
|
||||
@@ -117,9 +117,9 @@ h5priv_find_strlist (
|
||||
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
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -136,7 +136,7 @@ h5priv_search_strlist (
|
||||
idx = -(idx+1);
|
||||
TRY (idx = h5priv_insert_strlist (list, item, idx));
|
||||
}
|
||||
H5_PRIV_API_RETURN (idx);
|
||||
H5_RETURN (idx);
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
@@ -146,14 +146,14 @@ h5priv_remove_strlist (
|
||||
) {
|
||||
H5_PRIV_API_ENTER (h5_err_t, "list=%p, item=%s", list, item);
|
||||
ssize_t idx = h5priv_find_strlist (list, item);
|
||||
if (idx < 0) H5_PRIV_API_LEAVE (-1);
|
||||
if (idx < 0) H5_LEAVE (-1);
|
||||
|
||||
list->num_items--;
|
||||
memmove (
|
||||
&list->items[idx],
|
||||
&list->items[idx+1],
|
||||
(list->num_items - idx) * sizeof (list->items[0]));
|
||||
H5_PRIV_API_RETURN (idx);
|
||||
H5_RETURN (idx);
|
||||
}
|
||||
|
||||
|
||||
@@ -170,7 +170,7 @@ h5priv_new_idxmap (
|
||||
TRY (map->items = h5_calloc (size, sizeof (map->items[0])));
|
||||
map->size = size;
|
||||
map->num_items = 0;
|
||||
H5_PRIV_API_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
@@ -185,13 +185,13 @@ h5priv_insert_idxmap (
|
||||
(long long unsigned)glb_idx,
|
||||
(long long unsigned)loc_idx);
|
||||
if (map->num_items == map->size)
|
||||
H5_PRIV_API_LEAVE (
|
||||
H5_LEAVE (
|
||||
HANDLE_H5_OVERFLOW_ERR (
|
||||
(long long)map->size));
|
||||
|
||||
h5_loc_idx_t i = h5priv_search_idxmap (map, glb_idx);
|
||||
if (i >= 0) /* global id already in use ? */
|
||||
H5_PRIV_API_LEAVE (-1);
|
||||
H5_LEAVE (-1);
|
||||
|
||||
i = -(i+1);
|
||||
|
||||
@@ -203,7 +203,7 @@ h5priv_insert_idxmap (
|
||||
map->items[i].loc_idx = loc_idx;
|
||||
map->num_items++;
|
||||
|
||||
H5_PRIV_API_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -234,9 +234,9 @@ h5priv_search_idxmap (
|
||||
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
|
||||
}
|
||||
|
||||
//static int
|
||||
@@ -267,5 +267,5 @@ h5priv_sort_idxmap (
|
||||
H5_PRIV_API_ENTER (h5_err_t, "map=%p", map);
|
||||
qsort ( map->items, map->num_items, sizeof (map->items[0]),
|
||||
cmp_idxmap_items);
|
||||
H5_PRIV_API_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
@@ -11,16 +11,12 @@
|
||||
#define __PRIVATE_H5_MAPS_H
|
||||
|
||||
#include "private/h5_types.h"
|
||||
#include "h5core/h5_debug.h"
|
||||
#include "h5core/h5_errorhandling.h"
|
||||
#include "h5core/h5_log.h"
|
||||
#include "h5core/h5_err.h"
|
||||
#include "h5core/h5_syscall.h"
|
||||
#include "private/h5_debug.h"
|
||||
#include "private/h5_log.h"
|
||||
|
||||
typedef struct {
|
||||
size_t size;
|
||||
size_t num_items;
|
||||
char* items[1];
|
||||
} h5_strlist_t;
|
||||
#include <string.h>
|
||||
|
||||
// Allocate new list
|
||||
#define h5priv_alloc_xlist( type ) \
|
||||
@@ -33,7 +29,7 @@ typedef struct {
|
||||
TRY (*list = h5_calloc ( \
|
||||
1, sizeof (**list)+size*sizeof ((*list)->items[0]))); \
|
||||
(*list)->size = size; \
|
||||
H5_PRIV_API_RETURN (H5_SUCCESS); \
|
||||
H5_RETURN (H5_SUCCESS); \
|
||||
}
|
||||
|
||||
// Free list
|
||||
@@ -43,10 +39,10 @@ typedef struct {
|
||||
h5_ ## type ## list_t**list \
|
||||
) { \
|
||||
H5_PRIV_API_ENTER (h5_err_t, "list=%p", list); \
|
||||
if (*list == NULL) H5_PRIV_API_LEAVE (H5_SUCCESS); \
|
||||
if (*list == NULL) H5_LEAVE (H5_SUCCESS); \
|
||||
TRY (h5_free (*list)); \
|
||||
*list = NULL; \
|
||||
H5_PRIV_API_RETURN (H5_SUCCESS); \
|
||||
H5_RETURN (H5_SUCCESS); \
|
||||
}
|
||||
|
||||
// Insert item
|
||||
@@ -86,7 +82,7 @@ typedef struct {
|
||||
} \
|
||||
l->items[idx] = id; \
|
||||
l->num_items++; \
|
||||
H5_PRIV_API_RETURN (idx); \
|
||||
H5_RETURN (idx); \
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -106,7 +102,7 @@ typedef struct {
|
||||
"list=%p, item=%llu", \
|
||||
list, (long long unsigned)item); \
|
||||
if (!list) { \
|
||||
H5_PRIV_API_LEAVE (-1); \
|
||||
H5_LEAVE (-1); \
|
||||
} \
|
||||
register ssize_t low = 0; \
|
||||
register ssize_t mid; \
|
||||
@@ -118,9 +114,9 @@ typedef struct {
|
||||
else if (list->items[mid] < item) \
|
||||
low = mid + 1; \
|
||||
else \
|
||||
H5_PRIV_API_LEAVE (mid); \
|
||||
H5_LEAVE (mid); \
|
||||
} \
|
||||
H5_PRIV_API_RETURN (-(low+1)); \
|
||||
H5_RETURN (-(low+1)); \
|
||||
}
|
||||
|
||||
|
||||
@@ -140,7 +136,7 @@ typedef struct {
|
||||
idx = -(idx+1); \
|
||||
TRY (idx = h5priv_insert_into_ ## type ## list (list, item, idx)); \
|
||||
} \
|
||||
H5_PRIV_API_RETURN (idx); \
|
||||
H5_RETURN (idx); \
|
||||
}
|
||||
|
||||
|
||||
@@ -190,13 +186,13 @@ h5priv_grow_idxmap (
|
||||
"map=%p, size=%llu",
|
||||
map, (long long unsigned)size);
|
||||
if (map->num_items >= size)
|
||||
H5_PRIV_API_LEAVE (H5_SUCCESS);
|
||||
H5_LEAVE (H5_SUCCESS);
|
||||
int new = (map->items == NULL);
|
||||
size_t size_in_bytes = size * sizeof (map->items[0]);
|
||||
TRY (map->items = h5_alloc (map->items, size_in_bytes));
|
||||
map->size = size;
|
||||
if (new) map->num_items = 0;
|
||||
H5_PRIV_API_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
|
||||
+191
-11
@@ -26,8 +26,10 @@
|
||||
|
||||
#include "h5core/h5_types.h"
|
||||
#include "h5core/h5_model.h"
|
||||
#include "private/h5.h"
|
||||
#include "private/h5_const.h"
|
||||
#include "private/h5_file.h"
|
||||
#include "private/h5_mpi.h"
|
||||
#include "private/h5_hdf5.h"
|
||||
|
||||
#ifdef PARALLEL_IO
|
||||
static inline h5_err_t
|
||||
@@ -46,7 +48,7 @@ h5priv_start_throttle (
|
||||
h5_warn (
|
||||
"Throttling is only permitted with the MPI-POSIX "
|
||||
"or MPI-IO Independent VFD." );
|
||||
H5_CORE_API_LEAVE (H5_SUCCESS);
|
||||
H5_LEAVE (H5_SUCCESS);
|
||||
}
|
||||
|
||||
int token = 1;
|
||||
@@ -60,14 +62,16 @@ h5priv_start_throttle (
|
||||
// wait to receive token before continuing with read
|
||||
TRY( h5priv_mpi_recv(
|
||||
&token, 1, MPI_INT,
|
||||
f->myproc - f->props->throttle, // receive from previous proc
|
||||
f->myproc, // use this proc id as message tag
|
||||
// receive from previous proc
|
||||
f->myproc - f->props->throttle,
|
||||
// use this proc id as message tag
|
||||
f->myproc,
|
||||
f->props->comm
|
||||
) );
|
||||
}
|
||||
h5_debug ("throttle: received token");
|
||||
}
|
||||
H5_CORE_API_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
static inline h5_err_t
|
||||
@@ -84,13 +88,15 @@ h5priv_end_throttle (
|
||||
(long long int)(f->myproc + f->props->throttle));
|
||||
TRY (h5priv_mpi_send(
|
||||
&token, 1, MPI_INT,
|
||||
f->myproc + f->props->throttle, // send to next proc
|
||||
f->myproc + f->props->throttle, // use the id of the target as tag
|
||||
// send to next proc
|
||||
f->myproc + f->props->throttle,
|
||||
// use the id of the target as tag
|
||||
f->myproc + f->props->throttle,
|
||||
f->props->comm
|
||||
));
|
||||
}
|
||||
}
|
||||
H5_PRIV_API_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
#else // PARALLEL_IO
|
||||
static inline h5_err_t
|
||||
@@ -113,9 +119,183 @@ h5priv_close_step (
|
||||
const h5_file_p f
|
||||
);
|
||||
|
||||
h5_int64_t
|
||||
h5priv_normalize_h5_type (
|
||||
/*
|
||||
Map given enumeration type to corresponding HDF5 type. We use this HDF5
|
||||
type for reading and writing datasets and attributes.
|
||||
*/
|
||||
static inline hid_t
|
||||
h5priv_map_enum_to_normalized_type (
|
||||
h5_types_t type
|
||||
) {
|
||||
H5_PRIV_API_ENTER (hid_t,
|
||||
"type=%lld",
|
||||
(long long int)type);
|
||||
switch (type) {
|
||||
case H5_STRING_T:
|
||||
ret_value = H5_STRING;
|
||||
break;
|
||||
case H5_INT16_T:
|
||||
ret_value = H5_INT16;
|
||||
break;
|
||||
case H5_UINT16_T:
|
||||
ret_value = H5_UINT16;
|
||||
break;
|
||||
case H5_INT32_T:
|
||||
ret_value = H5_INT32;
|
||||
break;
|
||||
case H5_UINT32_T:
|
||||
ret_value = H5_UINT32;
|
||||
break;
|
||||
case H5_INT64_T:
|
||||
ret_value = H5_INT64;
|
||||
break;
|
||||
case H5_UINT64_T:
|
||||
ret_value = H5_UINT64;
|
||||
break;
|
||||
case H5_FLOAT32_T:
|
||||
ret_value = H5_FLOAT32;
|
||||
break;
|
||||
case H5_FLOAT64_T:
|
||||
ret_value = H5_FLOAT64;
|
||||
break;
|
||||
default:
|
||||
H5_RETURN_ERROR (
|
||||
H5_ERR_INVAL,
|
||||
"Unknown type %d", (int)type);
|
||||
}
|
||||
H5_RETURN (ret_value);
|
||||
}
|
||||
|
||||
/*
|
||||
Normaize a given HDF5 data type.
|
||||
*/
|
||||
static inline hid_t
|
||||
h5priv_normalize_type (
|
||||
hid_t type
|
||||
);
|
||||
) {
|
||||
H5_PRIV_API_ENTER (hid_t,
|
||||
"type=%lld",
|
||||
(long long int)type);
|
||||
H5T_class_t tclass;
|
||||
TRY (tclass = H5Tget_class (type));
|
||||
int tsize;
|
||||
TRY (tsize = H5Tget_size (type));
|
||||
H5T_sign_t tsign;
|
||||
TRY (tsign = H5Tget_sign (type));
|
||||
switch (tclass){
|
||||
case H5T_INTEGER:
|
||||
if (tsize==8) {
|
||||
if (tsign == H5T_SGN_2) {
|
||||
ret_value = H5_INT64;
|
||||
} else {
|
||||
ret_value = H5_UINT64;
|
||||
}
|
||||
} else if (tsize==4) {
|
||||
if (tsign == H5T_SGN_2) {
|
||||
ret_value = H5_INT32;
|
||||
} else {
|
||||
ret_value = H5_UINT32;
|
||||
}
|
||||
} else if (tsize==2) {
|
||||
if (tsign == H5T_SGN_2) {
|
||||
ret_value = H5_INT16;
|
||||
} else {
|
||||
ret_value = H5_UINT16;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case H5T_FLOAT:
|
||||
if (tsize==8) {
|
||||
ret_value = H5_FLOAT64;
|
||||
}
|
||||
else if (tsize==4) {
|
||||
ret_value = H5_FLOAT32;
|
||||
}
|
||||
break;
|
||||
case H5T_STRING:
|
||||
ret_value = H5_STRING;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (ret_value < 0) {
|
||||
H5_RETURN_ERROR (
|
||||
H5_ERR_INVAL,
|
||||
"Unknown type %d", (int)type);
|
||||
}
|
||||
H5_RETURN (ret_value);
|
||||
}
|
||||
|
||||
/*
|
||||
Map HDF5 type to H5hut type enumeration.
|
||||
*/
|
||||
static inline h5_int64_t
|
||||
h5priv_map_hdf5_type_to_enum (
|
||||
hid_t type
|
||||
) {
|
||||
H5_PRIV_API_ENTER (h5_int64_t,
|
||||
"type=%lld",
|
||||
(long long int)type);
|
||||
H5T_class_t tclass;
|
||||
TRY (tclass = H5Tget_class (type));
|
||||
int tsize;
|
||||
TRY (tsize = H5Tget_size (type));
|
||||
H5T_sign_t tsign;
|
||||
TRY (tsign = H5Tget_sign (type));
|
||||
switch (tclass){
|
||||
case H5T_INTEGER:
|
||||
if (tsize==8) {
|
||||
if (tsign == H5T_SGN_2) {
|
||||
ret_value = H5_INT64_T;
|
||||
} else {
|
||||
ret_value = H5_UINT64_T;
|
||||
}
|
||||
} else if (tsize==4) {
|
||||
if (tsign == H5T_SGN_2) {
|
||||
ret_value = H5_INT32_T;
|
||||
} else {
|
||||
ret_value = H5_UINT32_T;
|
||||
}
|
||||
} else if (tsize==2) {
|
||||
if (tsign == H5T_SGN_2) {
|
||||
ret_value = H5_INT16_T;
|
||||
} else {
|
||||
ret_value = H5_UINT16_T;
|
||||
}
|
||||
} else {
|
||||
ret_value = H5_STRING_T;
|
||||
}
|
||||
break;
|
||||
case H5T_FLOAT:
|
||||
if (tsize==8) {
|
||||
ret_value = H5_FLOAT64_T;
|
||||
}
|
||||
else if (tsize==4) {
|
||||
ret_value = H5_FLOAT32_T;
|
||||
}
|
||||
break;
|
||||
case H5T_STRING:
|
||||
ret_value = H5_STRING_T;
|
||||
break;
|
||||
default:
|
||||
H5_RETURN_ERROR (
|
||||
H5_ERR_INVAL,
|
||||
"Unknown type %d", (int)type);
|
||||
}
|
||||
H5_RETURN (ret_value);
|
||||
}
|
||||
|
||||
|
||||
static inline hid_t
|
||||
h5priv_get_normalized_dataset_type (
|
||||
hid_t dataset
|
||||
) {
|
||||
H5_PRIV_API_ENTER (hid_t,
|
||||
"dataset=%lld",
|
||||
(long long)dataset);
|
||||
TRY (ret_value = hdf5_get_dataset_type (dataset));
|
||||
TRY (ret_value = h5priv_normalize_type (ret_value));
|
||||
H5_RETURN (ret_value);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
+110
-64
@@ -13,8 +13,11 @@
|
||||
#ifdef PARALLEL_IO
|
||||
|
||||
#include "h5core/h5_types.h"
|
||||
#include "h5core/h5_errorhandling.h"
|
||||
#include "private/h5_debug.h"
|
||||
#include "h5core/h5_err.h"
|
||||
#include "private/h5_log.h"
|
||||
|
||||
#define MPI_WRAPPER_ENTER(type, fmt, ...) \
|
||||
__FUNC_ENTER(type, H5_DEBUG_MPI, fmt, __VA_ARGS__ )
|
||||
|
||||
static inline h5_err_t
|
||||
h5priv_mpi_alltoall (
|
||||
@@ -39,11 +42,11 @@ h5priv_mpi_alltoall (
|
||||
recvtype,
|
||||
comm);
|
||||
if (err != MPI_SUCCESS)
|
||||
MPI_WRAPPER_LEAVE (
|
||||
h5_error (
|
||||
H5_ERR_MPI,
|
||||
"Cannot perform all to all communication"));
|
||||
MPI_WRAPPER_RETURN (H5_SUCCESS);
|
||||
H5_RETURN_ERROR (
|
||||
H5_ERR_MPI,
|
||||
"%s",
|
||||
"Cannot perform all to all communication");
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
static inline h5_err_t
|
||||
@@ -75,11 +78,11 @@ h5priv_mpi_alltoallv (
|
||||
recvtype,
|
||||
comm);
|
||||
if (err != MPI_SUCCESS)
|
||||
MPI_WRAPPER_LEAVE (
|
||||
h5_error (
|
||||
H5_ERR_MPI,
|
||||
"Cannot perform all to all communication"));
|
||||
MPI_WRAPPER_RETURN (H5_SUCCESS);
|
||||
H5_RETURN_ERROR (
|
||||
H5_ERR_MPI,
|
||||
"%s",
|
||||
"Cannot perform all to all communication");
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
// barrier
|
||||
@@ -90,11 +93,11 @@ h5priv_mpi_barrier (
|
||||
MPI_WRAPPER_ENTER (h5_err_t, "comm=%p",&comm);
|
||||
int err = MPI_Barrier(comm);
|
||||
if (err != MPI_SUCCESS)
|
||||
MPI_WRAPPER_LEAVE (
|
||||
h5_error (
|
||||
H5_ERR_MPI,
|
||||
"MPI Barrier was not successful"));
|
||||
MPI_WRAPPER_RETURN (H5_SUCCESS);
|
||||
H5_RETURN_ERROR (
|
||||
H5_ERR_MPI,
|
||||
"%s",
|
||||
"MPI Barrier was not successful");
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
// communication routines
|
||||
@@ -120,8 +123,11 @@ h5priv_mpi_recv(
|
||||
MPI_STATUS_IGNORE
|
||||
);
|
||||
if (err != MPI_SUCCESS)
|
||||
MPI_WRAPPER_LEAVE (h5_error (H5_ERR_MPI, "Cannot receive data"));
|
||||
MPI_WRAPPER_RETURN (H5_SUCCESS);
|
||||
H5_RETURN_ERROR (
|
||||
H5_ERR_MPI,
|
||||
"%s",
|
||||
"Cannot receive data");
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
static inline h5_err_t
|
||||
@@ -145,8 +151,11 @@ h5priv_mpi_send(
|
||||
comm
|
||||
);
|
||||
if (err != MPI_SUCCESS)
|
||||
MPI_WRAPPER_LEAVE (h5_error (H5_ERR_MPI, "Cannot send data"));
|
||||
MPI_WRAPPER_RETURN (H5_SUCCESS);
|
||||
H5_RETURN_ERROR (
|
||||
H5_ERR_MPI,
|
||||
"%s",
|
||||
"Cannot send data");
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
static inline h5_err_t
|
||||
@@ -168,8 +177,11 @@ h5priv_mpi_bcast (
|
||||
comm
|
||||
);
|
||||
if (err != MPI_SUCCESS)
|
||||
MPI_WRAPPER_LEAVE (h5_error (H5_ERR_MPI, "Cannot perform broadcast"));
|
||||
MPI_WRAPPER_RETURN (H5_SUCCESS);
|
||||
H5_RETURN_ERROR (
|
||||
H5_ERR_MPI,
|
||||
"%s",
|
||||
"Cannot perform broadcast");
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
static inline h5_err_t
|
||||
@@ -192,8 +204,11 @@ h5priv_mpi_sum (
|
||||
comm
|
||||
);
|
||||
if (err != MPI_SUCCESS)
|
||||
MPI_WRAPPER_LEAVE (h5_error (H5_ERR_MPI, "Cannot perform MPI_SUM reduction"));
|
||||
MPI_WRAPPER_RETURN (H5_SUCCESS);
|
||||
H5_RETURN_ERROR (
|
||||
H5_ERR_MPI,
|
||||
"%s",
|
||||
"Cannot perform MPI_SUM reduction");
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
static inline h5_err_t
|
||||
@@ -215,9 +230,11 @@ h5priv_mpi_allreduce_max (
|
||||
MPI_MAX,
|
||||
comm
|
||||
) != MPI_SUCCESS)
|
||||
MPI_WRAPPER_LEAVE (h5_error (H5_ERR_MPI,
|
||||
"Cannot perform MPI_MAX reduction"));
|
||||
MPI_WRAPPER_RETURN (H5_SUCCESS);
|
||||
H5_RETURN_ERROR (
|
||||
H5_ERR_MPI,
|
||||
"%s",
|
||||
"Cannot perform MPI_MAX reduction");
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
static inline h5_err_t
|
||||
@@ -240,8 +257,11 @@ h5priv_mpi_prefix_sum (
|
||||
comm
|
||||
);
|
||||
if (err != MPI_SUCCESS)
|
||||
MPI_WRAPPER_LEAVE (h5_error (H5_ERR_MPI, "Cannot perform prefix sum"));
|
||||
MPI_WRAPPER_RETURN (H5_SUCCESS);
|
||||
H5_RETURN_ERROR (
|
||||
H5_ERR_MPI,
|
||||
"%s",
|
||||
"Cannot perform prefix sum");
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
#define h5priv_mpi_allgather mpi_allgather
|
||||
@@ -268,8 +288,11 @@ mpi_allgather (
|
||||
recvtype,
|
||||
comm);
|
||||
if (err != MPI_SUCCESS)
|
||||
MPI_WRAPPER_LEAVE (h5_error (H5_ERR_MPI, "Cannot gather data"));
|
||||
MPI_WRAPPER_RETURN (H5_SUCCESS);
|
||||
H5_RETURN_ERROR (
|
||||
H5_ERR_MPI,
|
||||
"%s",
|
||||
"Cannot gather data");
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
#define h5priv_mpi_allgatherv mpi_allgatherv
|
||||
static inline h5_err_t
|
||||
@@ -298,8 +321,11 @@ mpi_allgatherv (
|
||||
recvtype,
|
||||
comm);
|
||||
if (err != MPI_SUCCESS)
|
||||
MPI_WRAPPER_LEAVE (h5_error (H5_ERR_MPI, "Cannot gather data"));
|
||||
MPI_WRAPPER_RETURN (H5_SUCCESS);
|
||||
H5_RETURN_ERROR (
|
||||
H5_ERR_MPI,
|
||||
"%s",
|
||||
"Cannot gather data");
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
///
|
||||
@@ -311,8 +337,11 @@ h5priv_mpi_comm_size (
|
||||
MPI_WRAPPER_ENTER (h5_err_t, "comm=?, size=%p", size);
|
||||
int err = MPI_Comm_size (comm, size);
|
||||
if (err != MPI_SUCCESS)
|
||||
MPI_WRAPPER_LEAVE (h5_error (H5_ERR_MPI, "Cannot get communicator size"));
|
||||
MPI_WRAPPER_RETURN (H5_SUCCESS);
|
||||
H5_RETURN_ERROR (
|
||||
H5_ERR_MPI,
|
||||
"%s",
|
||||
"Cannot get communicator size");
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
static inline h5_err_t
|
||||
@@ -323,8 +352,11 @@ h5priv_mpi_comm_rank (
|
||||
MPI_WRAPPER_ENTER (h5_err_t, "comm=?, rank=%p", rank);
|
||||
int err = MPI_Comm_rank (comm, rank);
|
||||
if (err != MPI_SUCCESS)
|
||||
MPI_WRAPPER_LEAVE (h5_error (H5_ERR_MPI, "Cannot get this task's rank"));
|
||||
MPI_WRAPPER_RETURN (H5_SUCCESS);
|
||||
H5_RETURN_ERROR (
|
||||
H5_ERR_MPI,
|
||||
"%s",
|
||||
"Cannot get this task's rank");
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
static inline h5_err_t
|
||||
@@ -339,11 +371,17 @@ h5priv_mpi_type_contiguous (
|
||||
int err;
|
||||
err = MPI_Type_contiguous ( nelems, oldtype, newtype );
|
||||
if (err != MPI_SUCCESS)
|
||||
MPI_WRAPPER_LEAVE (h5_error (H5_ERR_MPI, "Cannot create new MPI type"));
|
||||
H5_RETURN_ERROR (
|
||||
H5_ERR_MPI,
|
||||
"%s",
|
||||
"Cannot create new MPI type");
|
||||
err = MPI_Type_commit ( newtype );
|
||||
if (err != MPI_SUCCESS)
|
||||
MPI_WRAPPER_LEAVE (h5_error (H5_ERR_MPI, "Cannot commit new MPI type"));
|
||||
MPI_WRAPPER_RETURN (H5_SUCCESS);
|
||||
H5_RETURN_ERROR (
|
||||
H5_ERR_MPI,
|
||||
"%s",
|
||||
"Cannot commit new MPI type");
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
#define h5priv_mpi_get_address mpi_get_address
|
||||
@@ -355,12 +393,11 @@ mpi_get_address (
|
||||
MPI_WRAPPER_ENTER (h5_err_t, "location=%p, address=%p", location, address);
|
||||
int err = MPI_Get_address (location, address);
|
||||
if (err != MPI_SUCCESS) {
|
||||
MPI_WRAPPER_LEAVE (
|
||||
h5_error (
|
||||
H5_ERR_MPI,
|
||||
"Cannot get MPI address of location=%p", location));
|
||||
H5_RETURN_ERROR (
|
||||
H5_ERR_MPI,
|
||||
"Cannot get MPI address of location=%p", location);
|
||||
}
|
||||
MPI_WRAPPER_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
#define h5priv_mpi_create_type_struct mpi_create_type_struct
|
||||
@@ -377,12 +414,12 @@ mpi_create_type_struct (
|
||||
count, blocklens, indices, old_types, new_type);
|
||||
int err = MPI_Type_create_struct (count, blocklens, indices, old_types, new_type);
|
||||
if (err != MPI_SUCCESS) {
|
||||
MPI_WRAPPER_LEAVE (
|
||||
h5_error (
|
||||
H5_ERR_MPI,
|
||||
"Cannot create new MPI struct"));
|
||||
H5_RETURN_ERROR (
|
||||
H5_ERR_MPI,
|
||||
"%s",
|
||||
"Cannot create new MPI struct");
|
||||
}
|
||||
MPI_WRAPPER_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
static inline h5_err_t
|
||||
@@ -391,13 +428,13 @@ h5priv_mpi_type_commit (
|
||||
) {
|
||||
MPI_WRAPPER_ENTER (h5_err_t, "type=%p", type);
|
||||
int err = MPI_Type_commit (type);
|
||||
if (err != MPI_SUCCESS) {
|
||||
MPI_WRAPPER_LEAVE (
|
||||
h5_error (
|
||||
H5_ERR_MPI,
|
||||
"Cannot commit MPI datatype"));
|
||||
}
|
||||
MPI_WRAPPER_RETURN (H5_SUCCESS);
|
||||
if (err != MPI_SUCCESS) {
|
||||
H5_RETURN_ERROR (
|
||||
H5_ERR_MPI,
|
||||
"%s",
|
||||
"Cannot commit MPI datatype");
|
||||
}
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
|
||||
@@ -408,8 +445,11 @@ h5priv_mpi_type_free (
|
||||
MPI_WRAPPER_ENTER (h5_err_t, "type=%p", type);
|
||||
int err = MPI_Type_free( type );
|
||||
if (err != MPI_SUCCESS)
|
||||
MPI_WRAPPER_LEAVE (h5_error(H5_ERR_MPI, "Cannot free MPI type"));
|
||||
MPI_WRAPPER_RETURN (H5_SUCCESS);
|
||||
H5_RETURN_ERROR (
|
||||
H5_ERR_MPI,
|
||||
"%s",
|
||||
"Cannot free MPI type");
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
static inline h5_err_t
|
||||
@@ -427,8 +467,11 @@ h5priv_mpi_cart_create (
|
||||
int err = MPI_Cart_create(
|
||||
old_comm, ndims, dims, period, reorder, new_comm);
|
||||
if (err != MPI_SUCCESS)
|
||||
MPI_WRAPPER_LEAVE (h5_error(H5_ERR_MPI, "Cannot create cartesian grid"));
|
||||
MPI_WRAPPER_RETURN (H5_SUCCESS);
|
||||
H5_RETURN_ERROR (
|
||||
H5_ERR_MPI,
|
||||
"%s",
|
||||
"Cannot create cartesian grid");
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
static inline h5_err_t
|
||||
@@ -442,8 +485,11 @@ h5priv_mpi_cart_coords (
|
||||
rank, maxdim, coords);
|
||||
int err = MPI_Cart_coords( comm, rank, maxdim, coords );
|
||||
if (err != MPI_SUCCESS)
|
||||
MPI_WRAPPER_LEAVE (h5_error(H5_ERR_MPI, "Cannot create cartesian grid"));
|
||||
MPI_WRAPPER_RETURN (H5_SUCCESS);
|
||||
H5_RETURN_ERROR (
|
||||
H5_ERR_MPI,
|
||||
"%s",
|
||||
"Cannot create cartesian grid");
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -13,6 +13,17 @@
|
||||
#include <hdf5.h>
|
||||
#include "h5core/h5_types.h"
|
||||
|
||||
#define H5_INT16 H5T_NATIVE_INT16
|
||||
#define H5_UINT16 H5T_NATIVE_UINT16
|
||||
#define H5_INT32 H5T_NATIVE_INT32
|
||||
#define H5_UINT32 H5T_NATIVE_UINT32
|
||||
#define H5_INT64 H5T_NATIVE_INT64
|
||||
#define H5_UINT64 H5T_NATIVE_UINT64
|
||||
#define H5_FLOAT32 H5T_NATIVE_FLOAT
|
||||
#define H5_FLOAT64 H5T_NATIVE_DOUBLE
|
||||
#define H5_ID H5T_NATIVE_INT64
|
||||
#define H5_STRING H5T_NATIVE_CHAR
|
||||
|
||||
struct h5_prop { // generic property class
|
||||
h5_int64_t class; // property class
|
||||
char pad[248]; // sizeof (struct h5_prop) == 256
|
||||
@@ -44,7 +55,7 @@ typedef h5_prop_file_t* h5_prop_file_p;
|
||||
*/
|
||||
struct h5_file {
|
||||
hid_t file; // HDF5 file id
|
||||
h5_prop_file_p props; // file properties
|
||||
h5_prop_file_t* props; // file properties
|
||||
char empty; // flag (should be int?!)
|
||||
|
||||
/* MPI */
|
||||
@@ -75,4 +86,11 @@ struct h5_idxmap {
|
||||
h5_size_t num_items; /* stored items */
|
||||
h5_idxmap_el_t* items;
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
size_t size;
|
||||
size_t num_items;
|
||||
char* items[1];
|
||||
} h5_strlist_t;
|
||||
|
||||
#endif
|
||||
|
||||
@@ -7,16 +7,19 @@
|
||||
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_syscall.h"
|
||||
|
||||
#include "private/h5.h"
|
||||
#include "private/h5_file.h"
|
||||
#include "private/h5_types.h"
|
||||
#include "private/h5_init.h"
|
||||
#include "private/h5t_types.h"
|
||||
#include "private/h5t_model.h"
|
||||
#include "private/h5t_access.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
/*** op's on local elements ***/
|
||||
|
||||
#if defined(WITH_PARALLEL_H5GRID)
|
||||
@@ -182,7 +185,7 @@ alloc_glb_elems (
|
||||
H5_PRIV_FUNC_ENTER (h5_glb_elem_p, "m=%p, size=%zu", m, size);
|
||||
h5_glb_elem_p buf;
|
||||
TRY (buf = h5_calloc (size, sizeof(h5_glb_tet_t)));
|
||||
H5_PRIV_FUNC_RETURN (buf);
|
||||
H5_RETURN (buf);
|
||||
}
|
||||
|
||||
static h5_glb_elem_t*
|
||||
@@ -664,27 +667,27 @@ get_loc_entity_children (
|
||||
const h5_loc_idx_t elem_idx = h5tpriv_get_elem_idx (entity_id);
|
||||
|
||||
if (h5tpriv_is_leaf_elem (m, &((h5_loc_tet_t*)m->loc_elems)[elem_idx])) {
|
||||
H5_PRIV_FUNC_LEAVE (H5_NOK); // not refined
|
||||
H5_LEAVE (H5_NOK); // not refined
|
||||
}
|
||||
switch (type_id) {
|
||||
case H5T_TYPE_TET: {
|
||||
H5_PRIV_FUNC_LEAVE (
|
||||
H5_LEAVE (
|
||||
get_children_of_loc_elem (m, face_idx, elem_idx, children));
|
||||
break;
|
||||
}
|
||||
case H5T_TYPE_TRIANGLE: {
|
||||
H5_PRIV_FUNC_LEAVE (
|
||||
H5_LEAVE (
|
||||
get_children_of_loc_triangle (m, face_idx, elem_idx, children));
|
||||
break;
|
||||
}
|
||||
case H5T_TYPE_EDGE: {
|
||||
H5_PRIV_FUNC_LEAVE (
|
||||
H5_LEAVE (
|
||||
get_children_of_loc_edge (m, face_idx, elem_idx, children));
|
||||
}
|
||||
default:
|
||||
H5_PRIV_FUNC_LEAVE (h5_error_internal ());
|
||||
H5_LEAVE (h5_error_internal ());
|
||||
}
|
||||
H5_PRIV_FUNC_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
struct h5t_access_methods h5tpriv_access_tetm_methods = {
|
||||
|
||||
@@ -7,15 +7,18 @@
|
||||
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_syscall.h"
|
||||
|
||||
#include "private/h5.h"
|
||||
#include "private/h5_file.h"
|
||||
#include "private/h5_init.h"
|
||||
#include "private/h5t_types.h"
|
||||
#include "private/h5t_model.h"
|
||||
#include "private/h5t_access.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#if defined(WITH_PARALLEL_H5GRID)
|
||||
static MPI_Datatype
|
||||
get_mpi_type_of_glb_elem (
|
||||
@@ -180,7 +183,7 @@ alloc_glb_elems (
|
||||
H5_PRIV_FUNC_ENTER (h5_glb_elem_p, "m=%p, size=%zu", m, size);
|
||||
h5_glb_elem_p buf;
|
||||
TRY (buf = h5_calloc (size, sizeof(h5_glb_tri_t)));
|
||||
H5_PRIV_FUNC_RETURN (buf);
|
||||
H5_RETURN (buf);
|
||||
}
|
||||
|
||||
static h5_glb_elem_t*
|
||||
@@ -371,20 +374,20 @@ get_loc_entity_children (
|
||||
const h5_loc_idx_t elem_idx = h5tpriv_get_elem_idx (entity_id);
|
||||
|
||||
if (h5tpriv_is_leaf_elem (m, &((h5_loc_tri_t*)m->loc_elems)[elem_idx])) {
|
||||
H5_PRIV_FUNC_LEAVE (H5_NOK); // not refined
|
||||
H5_LEAVE (H5_NOK); // not refined
|
||||
}
|
||||
switch (type_id) {
|
||||
case H5T_TYPE_TRIANGLE: {
|
||||
H5_PRIV_FUNC_LEAVE (
|
||||
H5_LEAVE (
|
||||
get_children_of_loc_elem (m, face_idx, elem_idx, children));
|
||||
break;
|
||||
}
|
||||
case H5T_TYPE_EDGE: {
|
||||
H5_PRIV_FUNC_LEAVE (
|
||||
H5_LEAVE (
|
||||
get_children_of_loc_edge (m, face_idx, elem_idx, children));
|
||||
}
|
||||
}
|
||||
H5_PRIV_FUNC_RETURN (h5_error_internal ());
|
||||
H5_RETURN (h5_error_internal ());
|
||||
}
|
||||
|
||||
struct h5t_access_methods h5tpriv_access_trim_methods = {
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
#include "h5core/h5_types.h"
|
||||
#include "private/h5t_types.h"
|
||||
#include "private/h5_debug.h"
|
||||
#include "private/h5_log.h"
|
||||
|
||||
struct h5t_adjacency_methods {
|
||||
h5_err_t (*get_adjacencies)(
|
||||
@@ -34,9 +34,9 @@ h5tpriv_get_adjacencies (
|
||||
"m=%p, entity_id=%lld, dim=%d, list=%p",
|
||||
m, (long long)entity_id, dim, list);
|
||||
if (m->methods->adjacency == NULL) {
|
||||
H5_PRIV_API_LEAVE (h5_error_internal ());
|
||||
H5_LEAVE (h5_error_internal ());
|
||||
}
|
||||
H5_PRIV_API_RETURN (m->methods->adjacency->get_adjacencies(
|
||||
H5_RETURN (m->methods->adjacency->get_adjacencies(
|
||||
m, entity_id, dim, list));
|
||||
}
|
||||
|
||||
|
||||
@@ -69,7 +69,7 @@ get_descendant_of_edge (
|
||||
TRY( get_descendant_of_edge (m, edge_ids[1], children) );
|
||||
}
|
||||
} while (++edge_idp < end);
|
||||
H5_PRIV_FUNC_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
static inline h5_err_t
|
||||
@@ -100,7 +100,7 @@ get_sections_of_edge (
|
||||
if (!refined) {
|
||||
TRY( h5priv_insert_into_loc_idlist (children, te->items[0], -1) );
|
||||
}
|
||||
H5_PRIV_FUNC_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
static inline h5_err_t
|
||||
@@ -131,7 +131,7 @@ get_descendant_of_triangle (
|
||||
TRY (get_descendant_of_triangle (m, triangle_ids[3], children));
|
||||
}
|
||||
} while (++triangle_idp < end);
|
||||
H5_PRIV_FUNC_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
static inline h5_err_t
|
||||
@@ -164,7 +164,7 @@ get_sections_of_triangle (
|
||||
if (!refined) {
|
||||
TRY( h5priv_insert_into_loc_idlist (children, td->items[0], -1) );
|
||||
}
|
||||
H5_PRIV_FUNC_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -185,7 +185,7 @@ add_vertex2 (
|
||||
h5_loc_idlist_t* tv;
|
||||
TRY( h5tpriv_find_tv2 (m, face_idx, elem_idx, &tv) );
|
||||
TRY( h5priv_search_in_loc_idlist (list, tv->items[0]) );
|
||||
H5_PRIV_FUNC_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -204,7 +204,7 @@ add_edge (
|
||||
h5_loc_idlist_t* te = NULL;
|
||||
TRY( h5tpriv_find_te (m, entity_id, &te) );
|
||||
TRY( h5priv_search_in_loc_idlist (list, te->items[0]) );
|
||||
H5_PRIV_FUNC_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
static inline h5_err_t
|
||||
@@ -222,7 +222,7 @@ add_edge2 (
|
||||
h5_loc_idlist_t* te;
|
||||
TRY( h5tpriv_find_te2 (m, face_idx, elem_idx, &te) );
|
||||
TRY( h5priv_search_in_loc_idlist (list, te->items[0]) );
|
||||
H5_PRIV_FUNC_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -242,7 +242,7 @@ add_triangle (
|
||||
TRY( h5tpriv_find_td (m, entity_id, &td) );
|
||||
TRY( h5priv_search_in_loc_idlist (list, td->items[0]) );
|
||||
|
||||
H5_PRIV_FUNC_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
static inline h5_err_t
|
||||
@@ -261,7 +261,7 @@ add_triangle2 (
|
||||
TRY( h5tpriv_find_td2 (m, face_idx, elem_idx, &td) );
|
||||
TRY( h5priv_search_in_loc_idlist (list, td->items[0]) );
|
||||
|
||||
H5_PRIV_FUNC_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
static inline h5_err_t
|
||||
@@ -276,7 +276,7 @@ add_elem2 (
|
||||
h5_loc_id_t elem_id = h5tpriv_build_tet_id ((h5_loc_idx_t)0, elem_idx);
|
||||
TRY( h5priv_search_in_loc_idlist (list, elem_id) );
|
||||
|
||||
H5_PRIV_FUNC_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -319,7 +319,7 @@ get_edges_uadj_to_vertex (
|
||||
m, 0, face_idx, 2),
|
||||
elem_idx) );
|
||||
} while (++vertex_idp < end);
|
||||
H5_PRIV_FUNC_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
static inline h5_err_t
|
||||
@@ -362,7 +362,7 @@ get_triangles_uadj_to_vertex (
|
||||
m, 0, face_idx, 2),
|
||||
elem_idx) );
|
||||
} while (++vertex_idp < end);
|
||||
H5_PRIV_FUNC_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
static inline h5_err_t
|
||||
@@ -389,7 +389,7 @@ get_tets_uadj_to_vertex (
|
||||
}
|
||||
TRY( add_elem2 (list, elem_idx) );
|
||||
} while (++vertex_idp < end);
|
||||
H5_PRIV_FUNC_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
static inline h5_err_t
|
||||
@@ -421,7 +421,7 @@ get_triangles_uadj_to_edge (
|
||||
} while (++edge_idp < end);
|
||||
TRY (h5priv_free_loc_idlist (&children));
|
||||
|
||||
H5_PRIV_FUNC_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
static inline h5_err_t
|
||||
@@ -443,7 +443,7 @@ get_tets_uadj_to_edge (
|
||||
TRY( add_elem2 (list, h5tpriv_get_elem_idx (*edge_idp)) );
|
||||
} while (++edge_idp < end);
|
||||
TRY( h5priv_free_loc_idlist (&children) );
|
||||
H5_PRIV_FUNC_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
static inline h5_err_t
|
||||
@@ -465,7 +465,7 @@ get_tets_uadj_to_triangle (
|
||||
TRY( add_elem2 (list, h5tpriv_get_elem_idx (*triangle_idp)) );
|
||||
} while (++triangle_idp < end);
|
||||
TRY( h5priv_free_loc_idlist (&children) );
|
||||
H5_PRIV_FUNC_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
static inline h5_err_t
|
||||
@@ -498,7 +498,7 @@ get_vertices_dadj_to_edge (
|
||||
elem_idx) );
|
||||
} while (++edge_idp < end);
|
||||
TRY( h5priv_free_loc_idlist(&children) );
|
||||
H5_PRIV_FUNC_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -545,7 +545,7 @@ get_vertices_dadj_to_triangle (
|
||||
elem_idx) );
|
||||
} while (++edge_idp < end );
|
||||
TRY( h5priv_free_loc_idlist(&children) );
|
||||
H5_PRIV_FUNC_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -589,7 +589,7 @@ get_vertices_dadj_to_tet (
|
||||
elem_idx) );
|
||||
} while (++edge_idp < end);
|
||||
TRY( h5priv_free_loc_idlist(&children) );
|
||||
H5_PRIV_FUNC_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
static inline h5_err_t
|
||||
@@ -624,7 +624,7 @@ get_edges_dadj_to_triangle (
|
||||
TRY( add_edge (m, list, *edge_idp) );
|
||||
} while (++edge_idp < end);
|
||||
TRY( h5priv_free_loc_idlist (&children) );
|
||||
H5_PRIV_FUNC_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
static inline h5_err_t
|
||||
@@ -656,7 +656,7 @@ get_edges_dadj_to_tet (
|
||||
TRY( add_edge (m, list, *edge_idp) );
|
||||
} while (++edge_idp < end);
|
||||
TRY( h5priv_free_loc_idlist (&children) );
|
||||
H5_PRIV_FUNC_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
static inline h5_err_t
|
||||
@@ -686,7 +686,7 @@ get_triangles_dadj_to_tet (
|
||||
TRY( add_triangle (m, list, *triangle_idp) );
|
||||
} while (++triangle_idp < end);
|
||||
TRY( h5priv_free_loc_idlist (&children) );
|
||||
H5_PRIV_FUNC_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
static inline h5_err_t
|
||||
|
||||
@@ -48,7 +48,7 @@ get_descendant_of_edge (
|
||||
}
|
||||
} while (++edge_idp < end);
|
||||
|
||||
H5_PRIV_FUNC_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
static inline h5_err_t
|
||||
@@ -79,7 +79,7 @@ get_sections_of_edge (
|
||||
if (!refined) {
|
||||
TRY (h5priv_insert_into_loc_idlist (children, te->items[0], -1));
|
||||
}
|
||||
H5_PRIV_FUNC_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -100,7 +100,7 @@ add_vertex2 (
|
||||
h5_loc_idlist_t* tv;
|
||||
TRY( h5tpriv_find_tv2 (m, face_idx, elem_idx, &tv) );
|
||||
TRY( h5priv_search_in_loc_idlist (list, tv->items[0]) );
|
||||
H5_PRIV_FUNC_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -119,7 +119,7 @@ add_edge (
|
||||
h5_loc_idlist_t* te;
|
||||
TRY( h5tpriv_find_te (m, entity_id, &te) );
|
||||
TRY( h5priv_search_in_loc_idlist (list, te->items[0]) );
|
||||
H5_PRIV_FUNC_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
static inline h5_err_t
|
||||
@@ -137,7 +137,7 @@ add_edge2 (
|
||||
h5_loc_idlist_t *te;
|
||||
TRY( h5tpriv_find_te2 (m, face_idx, elem_idx, &te) );
|
||||
TRY( h5priv_search_in_loc_idlist (list, te->items[0]) );
|
||||
H5_PRIV_FUNC_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
static inline h5_err_t
|
||||
@@ -152,7 +152,7 @@ add_elem2 (
|
||||
h5_loc_id_t elem_id = h5tpriv_build_triangle_id ((h5_loc_idx_t)0, elem_idx);
|
||||
TRY( h5priv_search_in_loc_idlist (list, elem_id) );
|
||||
|
||||
H5_PRIV_FUNC_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -191,7 +191,7 @@ get_edges_uadj_to_vertex (
|
||||
m, 0, face_idx, 1),
|
||||
elem_idx) );
|
||||
} while (++vertex_idp < end);
|
||||
H5_PRIV_FUNC_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
static inline h5_err_t
|
||||
@@ -219,7 +219,7 @@ get_triangles_uadj_to_vertex (
|
||||
}
|
||||
TRY (add_elem2 (list, elem_idx));
|
||||
} while (++vertex_idp < end);
|
||||
H5_PRIV_FUNC_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
static inline h5_err_t
|
||||
@@ -243,7 +243,7 @@ get_triangles_uadj_to_edge (
|
||||
} while (++edge_idp < end);
|
||||
TRY( h5priv_free_loc_idlist (&children) );
|
||||
|
||||
H5_PRIV_FUNC_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
static inline h5_err_t
|
||||
@@ -267,7 +267,7 @@ get_edges_adj_to_edge (
|
||||
TRY( add_edge (m, list, *edge_idp) );
|
||||
} while (++edge_idp < end);
|
||||
TRY( h5priv_free_loc_idlist(&children) );
|
||||
H5_PRIV_FUNC_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
static inline h5_err_t
|
||||
@@ -299,7 +299,7 @@ get_vertices_dadj_to_edge (
|
||||
elem_idx) );
|
||||
} while (++edge_idp < end);
|
||||
TRY( h5priv_free_loc_idlist (&children) );
|
||||
H5_PRIV_FUNC_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -344,7 +344,7 @@ get_vertices_dadj_to_triangle (
|
||||
elem_idx) );
|
||||
} while (++edge_idp < end);
|
||||
TRY (h5priv_free_loc_idlist(&children));
|
||||
H5_PRIV_FUNC_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
static inline h5_err_t
|
||||
@@ -374,7 +374,7 @@ get_edges_dadj_to_triangle (
|
||||
TRY( add_edge (m, list, *edge_idp) );
|
||||
} while (++edge_idp < end);
|
||||
TRY (h5priv_free_loc_idlist(&children));
|
||||
H5_PRIV_FUNC_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
static inline h5_err_t
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#include "private/h5t_map.h"
|
||||
#include "private/h5t_core.h"
|
||||
#include "private/h5t_access.h"
|
||||
#include "private/h5t_errorhandling.h"
|
||||
#include "private/h5t_err.h"
|
||||
|
||||
h5_err_t
|
||||
h5tpriv_grow_te_htab (
|
||||
@@ -46,7 +46,7 @@ h5tpriv_enter_tv2 (
|
||||
*idlist = m->adjacencies.tv.v[vertex_idx];
|
||||
}
|
||||
|
||||
H5_PRIV_API_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
@@ -92,7 +92,7 @@ h5tpriv_enter_te2 (
|
||||
if (idlist) {
|
||||
*idlist = te_entry->value;
|
||||
}
|
||||
H5_PRIV_API_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
@@ -138,7 +138,7 @@ h5tpriv_enter_td2 (
|
||||
if (idlist) {
|
||||
*idlist = td_entry->value;
|
||||
}
|
||||
H5_PRIV_API_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
static int
|
||||
@@ -178,7 +178,7 @@ release_te_entry (
|
||||
h5_loc_idlist_t* list = entry->value;
|
||||
TRY (h5priv_free_loc_idlist (&list));
|
||||
TRY (h5_free (entry));
|
||||
H5_PRIV_FUNC_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
@@ -199,7 +199,7 @@ h5tpriv_grow_te_htab (
|
||||
} else {
|
||||
TRY (h5priv_hgrow (nel, &a->te_hash));
|
||||
}
|
||||
H5_PRIV_API_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -223,12 +223,12 @@ find_te (
|
||||
&m->adjacencies.te_hash));
|
||||
h5t_te_entry_t* entry = (h5t_te_entry_t*)__entry;
|
||||
if (entry == NULL) {
|
||||
H5_PRIV_FUNC_LEAVE (H5_NOK); // not found
|
||||
H5_LEAVE (H5_NOK); // not found
|
||||
}
|
||||
if (idlist) {
|
||||
*idlist = entry->value;
|
||||
}
|
||||
H5_PRIV_FUNC_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -252,7 +252,7 @@ h5tpriv_find_te (
|
||||
item.key.vids));
|
||||
|
||||
TRY (find_te (m, &item, idlist));
|
||||
H5_PRIV_API_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
@@ -272,7 +272,7 @@ h5tpriv_find_te2 (
|
||||
elem_idx,
|
||||
item.key.vids));
|
||||
TRY (find_te (m, &item, idlist));
|
||||
H5_PRIV_API_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
static int
|
||||
@@ -312,7 +312,7 @@ release_td_entry (
|
||||
h5_loc_idlist_t* list = entry->value;
|
||||
TRY (h5priv_free_loc_idlist (&list));
|
||||
TRY (h5_free (entry));
|
||||
H5_PRIV_FUNC_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
|
||||
@@ -334,7 +334,7 @@ h5tpriv_grow_td_htab (
|
||||
} else {
|
||||
TRY (h5priv_hgrow (nel, &a->td_hash));
|
||||
}
|
||||
H5_PRIV_API_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
static inline h5_err_t
|
||||
@@ -372,7 +372,7 @@ h5tpriv_find_td (
|
||||
triangle_id,
|
||||
item.key.vids));
|
||||
TRY (find_td (m, &item, idlist));
|
||||
H5_PRIV_API_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
@@ -392,7 +392,7 @@ h5tpriv_find_td2 (
|
||||
elem_idx,
|
||||
item.key.vids));
|
||||
TRY (find_td (m, &item, idlist));
|
||||
H5_PRIV_API_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -411,7 +411,7 @@ h5tpriv_find_tv2 (
|
||||
h5_loc_idx_t idx;
|
||||
TRY (idx = h5tpriv_get_loc_elem_vertex_idx (m, elem_idx, face_idx));
|
||||
*idlist = m->adjacencies.tv.v[idx];
|
||||
H5_PRIV_API_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -427,5 +427,5 @@ h5tpriv_find_tv3 (
|
||||
"m=%p, vtx_idx=%lld, idlist=%p",
|
||||
m, (long long)vtx_idx, idlist);
|
||||
*idlist = m->adjacencies.tv.v[vtx_idx];
|
||||
H5_PRIV_FUNC_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
@@ -33,13 +33,12 @@
|
||||
#include "private/h5t_retrieve.h"
|
||||
#include "private/h5t_store.h"
|
||||
|
||||
#include "private/h5t_errorhandling.h"
|
||||
#include "private/h5t_err.h"
|
||||
|
||||
#include "private/h5t_octree.h"
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
|
||||
typedef struct h5t_te_entry_key {
|
||||
h5_loc_idx_t vids[2];
|
||||
} h5t_te_entry_key_t;
|
||||
@@ -193,9 +192,9 @@ h5tpriv_release_adjacency_structs (
|
||||
) {
|
||||
H5_PRIV_API_ENTER (h5_err_t, "m=%p", m);
|
||||
if (m->methods->adjacency == NULL) {
|
||||
H5_PRIV_API_LEAVE (H5_OK);
|
||||
H5_LEAVE (H5_OK);
|
||||
}
|
||||
H5_PRIV_API_RETURN (m->methods->core->release_internal_structs(m));
|
||||
H5_RETURN (m->methods->core->release_internal_structs(m));
|
||||
}
|
||||
|
||||
static inline h5_err_t
|
||||
@@ -205,9 +204,9 @@ h5tpriv_update_internal_structs (
|
||||
) {
|
||||
H5_PRIV_API_ENTER (h5_err_t, "m=%p, level_id=%d", m, level_id);
|
||||
if (m->methods->adjacency == NULL) {
|
||||
H5_PRIV_API_LEAVE (H5_OK);
|
||||
H5_LEAVE (H5_OK);
|
||||
}
|
||||
H5_PRIV_API_RETURN (m->methods->core->update_internal_structs(m, level_id));
|
||||
H5_RETURN (m->methods->core->update_internal_structs(m, level_id));
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -179,7 +179,7 @@ alloc_tv (
|
||||
size_t i = from_lvl <= 0 ? 0 : m->num_loc_vertices[from_lvl-1];
|
||||
memset (adj->tv.v+i, 0, (num_loc_vertices-i)*sizeof(*adj->tv.v));
|
||||
|
||||
H5_PRIV_FUNC_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
static inline h5_err_t
|
||||
@@ -246,7 +246,7 @@ update_internal_structs (
|
||||
TRY (h5tpriv_enter_td2 (m, face_idx, elem_idx, NULL));
|
||||
}
|
||||
}
|
||||
H5_PRIV_FUNC_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -259,7 +259,7 @@ release_tv (
|
||||
H5_PRIV_FUNC_ENTER (h5_err_t, "m=%p", m);
|
||||
h5t_adjacencies_t* adj = &m->adjacencies;
|
||||
if (adj->tv.v == NULL)
|
||||
H5_PRIV_FUNC_LEAVE (H5_SUCCESS);
|
||||
H5_LEAVE (H5_SUCCESS);
|
||||
|
||||
h5_loc_idx_t vertex_idx = 0;
|
||||
h5_loc_idx_t last = m->num_loc_vertices[m->num_loaded_levels-1];
|
||||
@@ -268,7 +268,7 @@ release_tv (
|
||||
}
|
||||
TRY( h5_free (adj->tv.v) );
|
||||
adj->tv.v = NULL;
|
||||
H5_PRIV_FUNC_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
static h5_err_t
|
||||
@@ -280,7 +280,7 @@ release_internal_structs (
|
||||
TRY( h5priv_hdestroy (&m->adjacencies.te_hash) );
|
||||
TRY( h5priv_hdestroy (&m->adjacencies.td_hash) );
|
||||
memset (&m->adjacencies, 0, sizeof (m->adjacencies));
|
||||
H5_PRIV_FUNC_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
struct h5t_core_methods h5tpriv_tetm_core_methods = {
|
||||
|
||||
@@ -142,7 +142,7 @@ alloc_tv (
|
||||
size_t i = from_lvl <= 0 ? 0 : m->num_loc_vertices[from_lvl-1];
|
||||
memset (adj->tv.v+i, 0, (num_loc_vertices-i)*sizeof(*adj->tv.v));
|
||||
|
||||
H5_PRIV_FUNC_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -219,7 +219,7 @@ update_internal_structs (
|
||||
// create index sets
|
||||
|
||||
|
||||
#if (!defined(NDEBUG) && (h5_debug_level & (1<<5)))
|
||||
#if (!defined(NDEBUG) && (h5_log_level & (1<<5)))
|
||||
if (!m->is_chunked) {
|
||||
h5t_adjacencies_t* adj = &m->adjacencies;
|
||||
h5_loc_idx_t idx = 0;
|
||||
@@ -237,7 +237,7 @@ update_internal_structs (
|
||||
}
|
||||
}
|
||||
#endif
|
||||
H5_PRIV_FUNC_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
static inline h5_err_t
|
||||
@@ -247,7 +247,7 @@ release_tv (
|
||||
H5_PRIV_FUNC_ENTER (h5_err_t, "m=%p", m);
|
||||
h5t_adjacencies_t* adj = &m->adjacencies;
|
||||
if (adj->tv.v == NULL)
|
||||
H5_PRIV_FUNC_LEAVE (H5_SUCCESS);
|
||||
H5_LEAVE (H5_SUCCESS);
|
||||
|
||||
h5_loc_idx_t vertex_idx = 0;
|
||||
h5_loc_idx_t last = m->num_loc_vertices[m->num_loaded_levels-1];
|
||||
@@ -256,7 +256,7 @@ release_tv (
|
||||
}
|
||||
TRY( h5_free (adj->tv.v) );
|
||||
adj->tv.v = NULL;
|
||||
H5_PRIV_FUNC_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
static inline h5_err_t
|
||||
@@ -267,7 +267,7 @@ release_internal_structs (
|
||||
TRY( release_tv (m) );
|
||||
TRY( h5priv_hdestroy (&m->adjacencies.te_hash) );
|
||||
memset (&m->adjacencies, 0, sizeof (m->adjacencies));
|
||||
H5_PRIV_FUNC_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
struct h5t_core_methods h5tpriv_trim_core_methods = {
|
||||
|
||||
@@ -7,12 +7,12 @@
|
||||
License: see file COPYING in top level of source distribution.
|
||||
*/
|
||||
|
||||
#ifndef __PRIVATE_H5T_ERRORHANDLING_H
|
||||
#define __PRIVATE_H5T_ERRORHANDLING_H
|
||||
#ifndef __PRIVATE_H5T_ERR_H
|
||||
#define __PRIVATE_H5T_ERR_H
|
||||
|
||||
#include "h5core/h5_types.h"
|
||||
#include "h5core/h5_errorhandling.h"
|
||||
#include "private/h5_debug.h"
|
||||
#include "h5core/h5_err.h"
|
||||
#include "private/h5_log.h"
|
||||
|
||||
#define ERR_ELEM_NEXIST "Element with local vertex IDs (%s) doesn't exist!"
|
||||
|
||||
@@ -114,17 +114,11 @@ h5tpriv_get_list_of_chunks_to_read (
|
||||
);
|
||||
|
||||
h5_int32_t
|
||||
find_proc_to_write (
|
||||
h5priv_find_proc_to_write (
|
||||
h5t_mesh_t* const m,
|
||||
h5_loc_idx_t elem_idx
|
||||
);
|
||||
|
||||
//TODO this is a bugfix remove after xfer_prop fix has been done!
|
||||
void
|
||||
set_xfer_prop_to (const h5_file_p file, hid_t prop);
|
||||
void
|
||||
set_xfer_prop_to2 (h5t_mesh_t* const m, hid_t prop);
|
||||
|
||||
// TODO move this to appropriate place
|
||||
typedef struct {
|
||||
int (*compare) (const void *p_a, const void *p_b);
|
||||
|
||||
@@ -76,7 +76,7 @@ init_loc_elems_struct (
|
||||
num_facets,
|
||||
loc_elem->neighbor_indices);
|
||||
}
|
||||
H5_PRIV_FUNC_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
#define H5_LOC_ELEM_T h5_loc_tet_t
|
||||
@@ -126,7 +126,7 @@ init_elem_flags (
|
||||
}
|
||||
elem++;
|
||||
}
|
||||
H5_PRIV_FUNC_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -156,7 +156,7 @@ init_map_elem_g2l (
|
||||
}
|
||||
h5priv_sort_idxmap (map);
|
||||
|
||||
H5_PRIV_FUNC_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -189,7 +189,7 @@ init_glb_elems_struct (
|
||||
loc_elem++;
|
||||
glb_elem++;
|
||||
}
|
||||
H5_PRIV_FUNC_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
static h5_err_t
|
||||
@@ -200,9 +200,9 @@ init_glb_elems_struct_chk (
|
||||
int num_chk
|
||||
) {
|
||||
H5_PRIV_FUNC_ENTER (h5_err_t, "m=%p", m);
|
||||
H5_PRIV_FUNC_LEAVE (H5_ERR_NOT_IMPLEMENTED);
|
||||
H5_LEAVE (H5_ERR_NOT_IMPLEMENTED);
|
||||
// TODO just copy from readwrite_trim and replace 3 indices with 4...
|
||||
H5_PRIV_FUNC_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
struct h5t_read_methods h5tpriv_read_tetm_methods = {
|
||||
|
||||
@@ -83,7 +83,7 @@ init_loc_elems_struct (
|
||||
|
||||
}
|
||||
m->last_stored_eid = from_idx + count -1;
|
||||
H5_PRIV_FUNC_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
static h5_err_t
|
||||
@@ -124,7 +124,7 @@ init_elem_flags (
|
||||
}
|
||||
elem++;
|
||||
}
|
||||
H5_PRIV_FUNC_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
static h5_err_t
|
||||
@@ -151,7 +151,7 @@ init_map_elem_g2l (
|
||||
}
|
||||
h5priv_sort_idxmap (map);
|
||||
|
||||
H5_PRIV_FUNC_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -184,7 +184,7 @@ init_glb_elems_struct (
|
||||
loc_elem++;
|
||||
glb_elem++;
|
||||
}
|
||||
H5_PRIV_FUNC_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
//TODO maybe use ifdef to have name without _chk
|
||||
@@ -239,7 +239,7 @@ init_glb_elems_struct_chk (
|
||||
|
||||
}
|
||||
#endif
|
||||
H5_PRIV_FUNC_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -11,10 +11,11 @@
|
||||
#define __PRIVATE_H5T_MAP_H
|
||||
|
||||
#include "private/h5_types.h"
|
||||
#include "h5core/h5_debug.h"
|
||||
#include "h5core/h5_errorhandling.h"
|
||||
#include "h5core/h5_log.h"
|
||||
#include "h5core/h5_err.h"
|
||||
#include "h5core/h5_syscall.h"
|
||||
#include "private/h5_debug.h"
|
||||
#include "private/h5_log.h"
|
||||
#include "private/h5_maps.h"
|
||||
#include "private/h5t_model.h"
|
||||
|
||||
/*
|
||||
@@ -31,7 +32,7 @@
|
||||
"list=%p, item=%llu", \
|
||||
list, (long long unsigned)item); \
|
||||
if (!list) { \
|
||||
H5_PRIV_API_LEAVE (-1); \
|
||||
H5_LEAVE (-1); \
|
||||
} \
|
||||
register ssize_t low = 0; \
|
||||
register ssize_t mid; \
|
||||
@@ -50,9 +51,9 @@
|
||||
else if ( diff < 0 ) \
|
||||
low = mid + 1; \
|
||||
else \
|
||||
H5_PRIV_API_LEAVE (mid); \
|
||||
H5_LEAVE (mid); \
|
||||
} \
|
||||
H5_PRIV_API_RETURN (-(low+1)); \
|
||||
H5_RETURN (-(low+1)); \
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
#include "private/h5t_retrieve.h"
|
||||
#include "private/h5t_store.h"
|
||||
|
||||
#include "private/h5.h"
|
||||
#include "private/h5_file.h"
|
||||
#include "private/h5_init.h"
|
||||
#include "private/h5t_core.h"
|
||||
|
||||
@@ -47,15 +47,13 @@ h5t_open_tetrahedral_mesh_by_idx (
|
||||
hid_t ctn_hid;
|
||||
char name[1024];
|
||||
|
||||
TRY (ctn_hid = h5priv_open_group (
|
||||
0,
|
||||
TRY (ctn_hid = h5priv_open_group_with_intermediates (
|
||||
f->root_gid,
|
||||
H5T_CONTAINER_GRPNAME,
|
||||
TETRAHEDRAL_MESHES_GRPNAME));
|
||||
H5T_CONTAINER_GRPNAME, TETRAHEDRAL_MESHES_GRPNAME, NULL));
|
||||
TRY (hdf5_get_name_of_group_by_idx (ctn_hid, idx, name, sizeof (name)));
|
||||
TRY (hdf5_close_group (ctn_hid));
|
||||
|
||||
H5_CORE_API_RETURN (h5t_open_tetrahedral_mesh ((h5_file_t)f, name, mesh));
|
||||
H5_RETURN (h5t_open_tetrahedral_mesh ((h5_file_t)f, name, mesh));
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
@@ -68,12 +66,11 @@ h5t_open_tetrahedral_mesh (
|
||||
H5_CORE_API_ENTER (h5_err_t, "f=%p, name=%s, mesh=%p", f, name, mesh);
|
||||
hid_t mesh_hid;
|
||||
|
||||
TRY (mesh_hid = h5priv_open_group (
|
||||
0, // do not create intermediate groups
|
||||
TRY (mesh_hid = h5priv_open_group_with_intermediates (
|
||||
f->root_gid,
|
||||
H5T_CONTAINER_GRPNAME,
|
||||
TETRAHEDRAL_MESHES_GRPNAME,
|
||||
name));
|
||||
name, NULL));
|
||||
|
||||
TRY (*mesh = h5_calloc (1, sizeof(**mesh)));
|
||||
h5t_mesh_t* m = *mesh;
|
||||
@@ -92,7 +89,7 @@ h5t_open_tetrahedral_mesh (
|
||||
#else
|
||||
TRY (h5tpriv_read_mesh (m));
|
||||
#endif
|
||||
H5_CORE_API_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
@@ -106,12 +103,11 @@ h5t_open_tetrahedral_mesh_part (
|
||||
H5_CORE_API_ENTER (h5_err_t, "f=%p, name=%s, mesh=%p", f, name, mesh);
|
||||
hid_t mesh_hid;
|
||||
|
||||
TRY (mesh_hid = h5priv_open_group (
|
||||
0,
|
||||
TRY (mesh_hid = h5priv_open_group_with_intermediates (
|
||||
f->root_gid,
|
||||
H5T_CONTAINER_GRPNAME,
|
||||
TRIANGLE_MESHES_GRPNAME,
|
||||
name));
|
||||
name, NULL));
|
||||
|
||||
TRY (*mesh = h5_calloc (1, sizeof(**mesh)));
|
||||
h5t_mesh_t* m = *mesh;
|
||||
@@ -126,7 +122,7 @@ h5t_open_tetrahedral_mesh_part (
|
||||
0));
|
||||
TRY (h5tpriv_read_mesh_part (m, elem_indices, dim));
|
||||
|
||||
H5_CORE_API_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -151,19 +147,17 @@ h5t_add_tetrahedral_mesh (
|
||||
TETRAHEDRAL_MESHES_GRPNAME,
|
||||
name));
|
||||
if (exists) {
|
||||
H5_CORE_API_LEAVE (
|
||||
h5_error (
|
||||
H5_ERR,
|
||||
"Tetrahedral mesh '%s' already exists!",
|
||||
name));
|
||||
H5_RETURN_ERROR (
|
||||
H5_ERR,
|
||||
"Tetrahedral mesh '%s' already exists!",
|
||||
name);
|
||||
}
|
||||
hid_t mesh_hid;
|
||||
TRY (mesh_hid = h5priv_open_group (
|
||||
1, // create intermediate groups in path
|
||||
TRY (mesh_hid = h5priv_create_group_with_intermediates (
|
||||
f->root_gid,
|
||||
H5T_CONTAINER_GRPNAME,
|
||||
TETRAHEDRAL_MESHES_GRPNAME,
|
||||
name));
|
||||
name, NULL));
|
||||
|
||||
TRY (*mesh = h5_calloc (1, sizeof(**mesh)));
|
||||
h5t_mesh_t* m = *mesh;
|
||||
@@ -183,7 +177,7 @@ h5t_add_tetrahedral_mesh (
|
||||
TRY (h5tpriv_add_level (m));
|
||||
m->mesh_changed = 1;
|
||||
|
||||
H5_CORE_API_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -209,19 +203,17 @@ h5t_add_chunked_tetrahedral_mesh (
|
||||
TETRAHEDRAL_MESHES_GRPNAME,
|
||||
name));
|
||||
if (exists) {
|
||||
H5_CORE_API_LEAVE (
|
||||
h5_error (
|
||||
H5_ERR,
|
||||
"Tetrahedral mesh '%s' already exists!",
|
||||
name));
|
||||
H5_RETURN_ERROR (
|
||||
H5_ERR,
|
||||
"Tetrahedral mesh '%s' already exists!",
|
||||
name);
|
||||
}
|
||||
hid_t mesh_hid;
|
||||
TRY (mesh_hid = h5priv_open_group (
|
||||
1, // create intermediate groups in path
|
||||
TRY (mesh_hid = h5priv_create_group_with_intermediates (
|
||||
f->root_gid,
|
||||
H5T_CONTAINER_GRPNAME,
|
||||
TETRAHEDRAL_MESHES_GRPNAME,
|
||||
name));
|
||||
name, NULL));
|
||||
|
||||
TRY (*mesh = h5_calloc (1, sizeof(**mesh)));
|
||||
h5t_mesh_t* m = *mesh;
|
||||
@@ -241,5 +233,5 @@ h5t_add_chunked_tetrahedral_mesh (
|
||||
TRY (h5tpriv_add_level (m));
|
||||
m->mesh_changed = 1;
|
||||
#endif
|
||||
H5_CORE_API_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*/
|
||||
#include "private/h5t_types.h"
|
||||
|
||||
#include "private/h5.h"
|
||||
#include "private/h5_file.h"
|
||||
#include "private/h5_hdf5.h"
|
||||
#include "private/h5_mpi.h"
|
||||
#include "private/h5_va_macros.h"
|
||||
@@ -46,15 +46,14 @@ h5t_open_triangle_mesh_by_idx (
|
||||
hid_t ctn_hid;
|
||||
char name[1024];
|
||||
|
||||
TRY (ctn_hid = h5priv_open_group (
|
||||
0,
|
||||
TRY (ctn_hid = h5priv_open_group_with_intermediates (
|
||||
f->root_gid,
|
||||
H5T_CONTAINER_GRPNAME,
|
||||
TRIANGLE_MESHES_GRPNAME));
|
||||
TRIANGLE_MESHES_GRPNAME, NULL));
|
||||
TRY (hdf5_get_name_of_group_by_idx (ctn_hid, idx, name, sizeof (name)));
|
||||
TRY (hdf5_close_group (ctn_hid));
|
||||
|
||||
H5_CORE_API_RETURN (h5t_open_triangle_mesh ((h5_file_t)f, name, mesh));
|
||||
H5_RETURN (h5t_open_triangle_mesh ((h5_file_t)f, name, mesh));
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
@@ -73,12 +72,11 @@ h5t_open_triangle_mesh (
|
||||
double start = MPI_Wtime();
|
||||
#endif
|
||||
hid_t mesh_hid;
|
||||
TRY (mesh_hid = h5priv_open_group (
|
||||
0,
|
||||
TRY (mesh_hid = h5priv_open_group_with_intermediates (
|
||||
f->root_gid,
|
||||
H5T_CONTAINER_GRPNAME,
|
||||
TRIANGLE_MESHES_GRPNAME,
|
||||
name));
|
||||
name, NULL));
|
||||
|
||||
TRY (*mesh = h5_calloc (1, sizeof(**mesh)));
|
||||
h5t_mesh_t* m = *mesh;
|
||||
@@ -100,7 +98,7 @@ h5t_open_triangle_mesh (
|
||||
m->is_chunked && m->f->nprocs > 1 ?
|
||||
h5tpriv_read_chunked_mesh (m) : h5tpriv_read_mesh (m)
|
||||
);
|
||||
H5_CORE_API_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
|
||||
@@ -119,12 +117,11 @@ h5t_open_triangle_mesh_part (
|
||||
MPI_Barrier (f->props->comm);
|
||||
double start = MPI_Wtime();
|
||||
#endif
|
||||
TRY (mesh_hid = h5priv_open_group (
|
||||
0,
|
||||
TRY (mesh_hid = h5priv_open_group_with_intermediates (
|
||||
f->root_gid,
|
||||
H5T_CONTAINER_GRPNAME,
|
||||
TRIANGLE_MESHES_GRPNAME,
|
||||
name));
|
||||
name, NULL));
|
||||
|
||||
TRY (*mesh = h5_calloc (1, sizeof(**mesh)));
|
||||
h5t_mesh_t* m = *mesh;
|
||||
@@ -145,7 +142,7 @@ h5t_open_triangle_mesh_part (
|
||||
|
||||
TRY (h5tpriv_read_mesh_part (m, elem_indices, dim));
|
||||
|
||||
H5_CORE_API_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -170,19 +167,17 @@ h5t_add_triangle_mesh (
|
||||
TRIANGLE_MESHES_GRPNAME,
|
||||
name));
|
||||
if (exists) {
|
||||
H5_CORE_API_LEAVE (
|
||||
h5_error (
|
||||
H5_ERR,
|
||||
"Tetrahedral mesh '%s' already exists!",
|
||||
name));
|
||||
H5_RETURN_ERROR (
|
||||
H5_ERR,
|
||||
"Tetrahedral mesh '%s' already exists!",
|
||||
name);
|
||||
}
|
||||
hid_t mesh_hid;
|
||||
TRY (mesh_hid = h5priv_open_group (
|
||||
1, // create intermediate groups in path
|
||||
TRY (mesh_hid = h5priv_create_group_with_intermediates (
|
||||
f->root_gid,
|
||||
H5T_CONTAINER_GRPNAME,
|
||||
TRIANGLE_MESHES_GRPNAME,
|
||||
name));
|
||||
name, NULL));
|
||||
|
||||
TRY (*mesh = h5_calloc (1, sizeof(**mesh)));
|
||||
h5t_mesh_t* m = *mesh;
|
||||
@@ -201,7 +196,7 @@ h5t_add_triangle_mesh (
|
||||
TRY (h5tpriv_add_level (m));
|
||||
m->mesh_changed = 1;
|
||||
|
||||
H5_CORE_API_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
/*!
|
||||
Add new chunked mesh
|
||||
@@ -221,11 +216,10 @@ h5t_add_chunked_triangle_mesh(
|
||||
int size = -1;
|
||||
TRY (h5priv_mpi_comm_size (f->props->comm, &size));
|
||||
if (size != 1) {
|
||||
H5_CORE_API_LEAVE (
|
||||
h5_error (
|
||||
H5_ERR,
|
||||
"Trying to create a chunked mesh with '%d' procs instead of 1!",
|
||||
size));
|
||||
H5_RETURN_ERROR (
|
||||
H5_ERR,
|
||||
"Trying to create a chunked mesh with '%d' procs instead of 1!",
|
||||
size);
|
||||
}
|
||||
|
||||
CHECK_WRITABLE_MODE (f);
|
||||
@@ -236,19 +230,17 @@ h5t_add_chunked_triangle_mesh(
|
||||
TRIANGLE_MESHES_GRPNAME,
|
||||
name));
|
||||
if (exists) {
|
||||
H5_CORE_API_LEAVE (
|
||||
h5_error (
|
||||
H5_ERR,
|
||||
"Triangle mesh '%s' already exists!",
|
||||
name));
|
||||
H5_RETURN_ERROR (
|
||||
H5_ERR,
|
||||
"Triangle mesh '%s' already exists!",
|
||||
name);
|
||||
}
|
||||
hid_t mesh_hid;
|
||||
TRY (mesh_hid = h5priv_open_group (
|
||||
1, // create intermediate groups in path
|
||||
TRY (mesh_hid = h5priv_create_group_with_intermediates (
|
||||
f->root_gid,
|
||||
H5T_CONTAINER_GRPNAME,
|
||||
TRIANGLE_MESHES_GRPNAME,
|
||||
name));
|
||||
name, NULL));
|
||||
|
||||
TRY (*mesh = h5_calloc (1, sizeof(**mesh)));
|
||||
h5t_mesh_t* m = *mesh;
|
||||
@@ -268,5 +260,5 @@ h5t_add_chunked_triangle_mesh(
|
||||
TRY (h5tpriv_add_level (m));
|
||||
m->mesh_changed = 1;
|
||||
#endif
|
||||
H5_CORE_API_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
@@ -113,8 +113,6 @@ typedef struct h5_oct_dtypes {
|
||||
MPI_Datatype mpi_octant;
|
||||
} h5_oct_dta_types_t;
|
||||
|
||||
h5_oct_dta_types_t h5_oct_dta_types;
|
||||
|
||||
h5_err_t H5t_create_mpi_type_octant ( void );
|
||||
|
||||
// Setter functions
|
||||
@@ -169,8 +167,8 @@ h5_oct_idx_t H5t_find_leafoctant_of_point (h5t_octree_t* octree, h5_oct_idx_t oc
|
||||
h5_oct_level_t H5t_oct_has_level (h5t_octree_t* octree, h5_oct_idx_t oct_idx, h5_oct_level_t level);
|
||||
|
||||
// for debug purposes only
|
||||
h5_err_t plot_octants (h5t_octree_t* octree);
|
||||
h5_err_t plot_octant_anc (h5t_octree_t* octree, h5_oct_idx_t oct_idx);
|
||||
h5_err_t h5priv_plot_octants (h5t_octree_t* octree);
|
||||
h5_err_t h5priv_plot_octant_anc (h5t_octree_t* octree, h5_oct_idx_t oct_idx);
|
||||
|
||||
h5_err_t plot_leaf_octants (h5t_octree_t* octree);
|
||||
void print_array (h5_int32_t* neigh, h5_oct_idx_t nbr_neigh, int rank);
|
||||
|
||||
@@ -31,10 +31,6 @@ typedef struct h5t_ref_elem h5t_ref_elem_t;
|
||||
extern const h5t_ref_elem_t h5t_tet_ref_elem;
|
||||
extern const h5t_ref_elem_t h5t_tri_ref_elem;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#define h5tpriv_ref_elem_get_num_vertices(this) (this->ref_elem->num_faces[0])
|
||||
|
||||
#define h5tpriv_ref_elem_get_num_edges(this) (this->ref_elem->num_faces[1])
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*/
|
||||
|
||||
#include "private/h5t_types.h"
|
||||
#include "private/h5t_errorhandling.h"
|
||||
#include "private/h5t_err.h"
|
||||
#include "private/h5t_core.h"
|
||||
#include "private/h5t_map.h"
|
||||
#include "private/h5t_model.h"
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*/
|
||||
|
||||
#include "private/h5t_types.h"
|
||||
#include "private/h5t_errorhandling.h"
|
||||
#include "private/h5t_err.h"
|
||||
#include "private/h5t_core.h"
|
||||
#include "private/h5t_map.h"
|
||||
#include "private/h5t_model.h"
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*/
|
||||
|
||||
#include "private/h5t_types.h"
|
||||
#include "private/h5t_errorhandling.h"
|
||||
#include "private/h5t_err.h"
|
||||
#include "private/h5t_access.h"
|
||||
#include "private/h5t_adjacencies.h"
|
||||
#include "private/h5t_core.h"
|
||||
@@ -36,7 +36,7 @@ alloc_loc_elems (
|
||||
-1,
|
||||
(new-cur) * sizeof (h5_loc_tet_t) );
|
||||
|
||||
H5_PRIV_FUNC_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
|
||||
@@ -75,9 +75,9 @@ bisect_edge (
|
||||
TRY( h5t_get_loc_vertex_indices_of_edge (m, kids[0], edge0) );
|
||||
TRY( h5t_get_loc_vertex_indices_of_edge (m, kids[1], edge1) );
|
||||
if ((edge0[0] == edge1[0]) || (edge0[0] == edge1[1])) {
|
||||
H5_PRIV_FUNC_LEAVE (edge0[0]); // return first vertex
|
||||
H5_LEAVE (edge0[0]); // return first vertex
|
||||
} else {
|
||||
H5_PRIV_FUNC_LEAVE (edge0[1]); // return second vertex
|
||||
H5_LEAVE (edge0[1]); // return second vertex
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -94,7 +94,7 @@ bisect_edge (
|
||||
P[1] = (P0[1] + P1[1]) / 2.0;
|
||||
P[2] = (P0[2] + P1[2]) / 2.0;
|
||||
|
||||
H5_PRIV_FUNC_RETURN (h5t_store_vertex (m, -1, P)); // return idx of new vertex
|
||||
H5_RETURN (h5t_store_vertex (m, -1, P)); // return idx of new vertex
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -128,7 +128,7 @@ pre_refine_tet (
|
||||
unsigned int num_interior_elems_to_refine = m->marked_entities->num_items;
|
||||
TRY (h5t_begin_store_vertices (m, num_interior_elems_to_refine*3 + 192));
|
||||
TRY (h5t_begin_store_elems (m, num_interior_elems_to_refine*8));
|
||||
H5_PRIV_FUNC_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -151,11 +151,10 @@ refine_tet (
|
||||
h5_loc_tet_t* el = (h5_loc_tet_t*)m->loc_elems + elem_idx;
|
||||
|
||||
if ( el->child_idx >= 0 )
|
||||
H5_PRIV_FUNC_LEAVE (
|
||||
h5_error (
|
||||
H5_ERR_INVAL,
|
||||
"Tetrahedron %lld already refined.",
|
||||
(long long)elem_idx ));
|
||||
H5_RETURN_ERROR (
|
||||
H5_ERR_INVAL,
|
||||
"Tetrahedron %lld already refined.",
|
||||
(long long)elem_idx);
|
||||
vertices[0] = el->vertex_indices[0];
|
||||
vertices[1] = el->vertex_indices[1];
|
||||
vertices[2] = el->vertex_indices[2];
|
||||
@@ -256,7 +255,7 @@ refine_tet (
|
||||
((h5_loc_tet_t*)m->loc_elems)[elem_idx].child_idx = elem_idx_of_first_child;
|
||||
m->num_interior_leaf_elems[m->leaf_level]--;
|
||||
|
||||
H5_PRIV_FUNC_RETURN (elem_idx_of_first_child);
|
||||
H5_RETURN (elem_idx_of_first_child);
|
||||
}
|
||||
|
||||
static inline h5_loc_idx_t
|
||||
@@ -278,7 +277,7 @@ compute_neighbor_of_face (
|
||||
elem_idx,
|
||||
&td) );
|
||||
if (td == NULL) {
|
||||
H5_PRIV_FUNC_LEAVE (h5_error_internal ());
|
||||
H5_LEAVE (h5_error_internal ());
|
||||
}
|
||||
if (td->num_items == 1) {
|
||||
// neighbor is coarser or face is on the boundary
|
||||
@@ -296,10 +295,10 @@ compute_neighbor_of_face (
|
||||
}
|
||||
|
||||
} else {
|
||||
H5_PRIV_FUNC_LEAVE (h5_error_internal ());
|
||||
H5_LEAVE (h5_error_internal ());
|
||||
}
|
||||
} while (neighbor_idx < -1);
|
||||
H5_PRIV_FUNC_RETURN (neighbor_idx);
|
||||
H5_RETURN (neighbor_idx);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -312,13 +311,12 @@ compute_neighbors_of_elems (
|
||||
) {
|
||||
H5_PRIV_FUNC_ENTER (h5_err_t, "m=%p, level=%d", m, level);
|
||||
if (level < 0 || level >= m->num_leaf_levels) {
|
||||
H5_PRIV_FUNC_LEAVE (
|
||||
h5_error (
|
||||
H5_ERR_INVAL,
|
||||
"level idx %lld out of bound, must be in [%lld,%lld]",
|
||||
(long long)level,
|
||||
(long long)0,
|
||||
(long long)m->num_leaf_levels));
|
||||
H5_RETURN_ERROR (
|
||||
H5_ERR_INVAL,
|
||||
"level idx %lld out of bound, must be in [%lld,%lld]",
|
||||
(long long)level,
|
||||
(long long)0,
|
||||
(long long)m->num_leaf_levels);
|
||||
}
|
||||
h5_loc_idx_t elem_idx = level == 0 ? 0 : m->num_interior_elems[level-1];
|
||||
const h5_loc_idx_t last_idx = m->num_interior_elems[level] - 1;
|
||||
@@ -333,7 +331,7 @@ compute_neighbors_of_elems (
|
||||
el++;
|
||||
}
|
||||
|
||||
H5_PRIV_FUNC_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
/*
|
||||
* returns number of newly created tetrahedra when refining a tetrahedral
|
||||
@@ -357,7 +355,7 @@ end_store_elems (
|
||||
TRY( h5tpriv_update_internal_structs (m, m->leaf_level) );
|
||||
TRY( compute_neighbors_of_elems (m, m->leaf_level) );
|
||||
TRY( h5tpriv_init_elem_flags (m, start_idx, count) );
|
||||
H5_PRIV_FUNC_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
struct h5t_store_methods h5tpriv_tetm_store_methods = {
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*/
|
||||
|
||||
#include "private/h5t_types.h"
|
||||
#include "private/h5t_errorhandling.h"
|
||||
#include "private/h5t_err.h"
|
||||
#include "private/h5t_access.h"
|
||||
#include "private/h5t_adjacencies.h"
|
||||
#include "private/h5t_core.h"
|
||||
@@ -36,7 +36,7 @@ alloc_loc_elems (
|
||||
-1,
|
||||
(new-cur) * sizeof (h5_loc_tri_t));
|
||||
|
||||
H5_PRIV_FUNC_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -63,7 +63,7 @@ bisect_edge (
|
||||
// for (int j = 0; j < num_b_edges; j++) {
|
||||
// if (b_edges[j].idx == my_glb_idx &&
|
||||
// b_edges[j].face_idx == face_idx) {
|
||||
// H5_PRIV_FUNC_LEAVE (b_edges[j].vtx);
|
||||
// H5_LEAVE (b_edges[j].vtx);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
@@ -75,9 +75,9 @@ bisect_edge (
|
||||
TRY (h5t_get_loc_vertex_indices_of_edge (m, kids[0], edge0));
|
||||
TRY (h5t_get_loc_vertex_indices_of_edge (m, kids[1], edge1));
|
||||
if ((edge0[0] == edge1[0]) || (edge0[0] == edge1[1])) {
|
||||
H5_PRIV_FUNC_LEAVE (edge0[0]);
|
||||
H5_LEAVE (edge0[0]);
|
||||
} else {
|
||||
H5_PRIV_FUNC_LEAVE (edge0[1]);
|
||||
H5_LEAVE (edge0[1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -94,7 +94,7 @@ bisect_edge (
|
||||
P[1] = (P0[1] + P1[1]) / 2.0;
|
||||
P[2] = (P0[2] + P1[2]) / 2.0;
|
||||
|
||||
H5_PRIV_FUNC_RETURN (h5t_store_vertex (m, -1, P));
|
||||
H5_RETURN (h5t_store_vertex (m, -1, P));
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -109,7 +109,7 @@ pre_refine_triangle (
|
||||
unsigned int num_interior_elems_to_refine = m->marked_entities->num_items;
|
||||
TRY (h5t_begin_store_vertices (m, num_interior_elems_to_refine*3 + 64));
|
||||
TRY (h5t_begin_store_elems (m, num_interior_elems_to_refine*4));
|
||||
H5_PRIV_FUNC_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -130,11 +130,10 @@ refine_triangle (
|
||||
h5_loc_tri_t* el = (h5_loc_tri_t*)m->loc_elems + elem_idx;
|
||||
|
||||
if (el->child_idx >= 0)
|
||||
H5_PRIV_FUNC_LEAVE (
|
||||
h5_error (
|
||||
H5_ERR_INVAL,
|
||||
"Element %lld already refined.",
|
||||
(long long)elem_idx));
|
||||
H5_RETURN_ERROR (
|
||||
H5_ERR_INVAL,
|
||||
"Element %lld already refined.",
|
||||
(long long)elem_idx);
|
||||
|
||||
vertices[0] = el->vertex_indices[0];
|
||||
vertices[1] = el->vertex_indices[1];
|
||||
@@ -169,7 +168,7 @@ refine_triangle (
|
||||
((h5_loc_tri_t*)m->loc_elems)[elem_idx].child_idx = elem_idx_of_first_child;
|
||||
m->num_interior_leaf_elems[m->leaf_level]--;
|
||||
|
||||
H5_PRIV_FUNC_RETURN (elem_idx_of_first_child);
|
||||
H5_RETURN (elem_idx_of_first_child);
|
||||
}
|
||||
|
||||
static inline h5_loc_idx_t
|
||||
@@ -191,7 +190,7 @@ compute_neighbor_of_face (
|
||||
elem_idx,
|
||||
&te) );
|
||||
if (te == NULL) {
|
||||
H5_PRIV_FUNC_LEAVE (h5_error_internal ());
|
||||
H5_LEAVE (h5_error_internal ());
|
||||
}
|
||||
if (te->num_items == 1) {
|
||||
h5_loc_idx_t old_elem_idx = elem_idx;
|
||||
@@ -203,12 +202,12 @@ compute_neighbor_of_face (
|
||||
}
|
||||
if (elem_idx < -1) { // this should only happen if we are on the boarder
|
||||
// of a loaded chunk and the parent is on a different chunk
|
||||
if (h5_debug_level >= 6) {
|
||||
if (h5_log_level >= 6) {
|
||||
h5_debug ("Elem %d is on different proc than its parent %d \n"
|
||||
"therefore neighborhood idx is not correct resolved", old_elem_idx, elem_idx);
|
||||
}
|
||||
assert (m->f->myproc != find_proc_to_write (m, old_elem_idx));
|
||||
H5_PRIV_FUNC_LEAVE (~0); //TODO what is a resonable output here?
|
||||
assert (m->f->myproc != h5priv_find_proc_to_write (m, old_elem_idx));
|
||||
H5_LEAVE (~0); //TODO what is a resonable output here?
|
||||
}
|
||||
} else if (te->num_items == 2) {
|
||||
// neighbor has same level of coarsness
|
||||
@@ -220,10 +219,10 @@ compute_neighbor_of_face (
|
||||
|
||||
} else {
|
||||
printf ("elem %d face %d num_items %d", elem_idx, face_idx, te->num_items);
|
||||
H5_PRIV_FUNC_LEAVE (h5_error_internal ());
|
||||
H5_LEAVE (h5_error_internal ());
|
||||
}
|
||||
} while (neighbor_idx < -1);
|
||||
H5_PRIV_FUNC_RETURN (neighbor_idx);
|
||||
H5_RETURN (neighbor_idx);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -236,13 +235,12 @@ compute_neighbors_of_elems (
|
||||
) {
|
||||
H5_PRIV_FUNC_ENTER (h5_err_t, "m=%p, level=%d", m, level);
|
||||
if (level < 0 || level >= m->num_leaf_levels) {
|
||||
H5_PRIV_FUNC_LEAVE (
|
||||
h5_error (
|
||||
H5_ERR_INVAL,
|
||||
"level idx %lld out of bound, must be in [%lld,%lld]",
|
||||
(long long)level,
|
||||
(long long)0,
|
||||
(long long)m->num_leaf_levels));
|
||||
H5_RETURN_ERROR (
|
||||
H5_ERR_INVAL,
|
||||
"level idx %lld out of bound, must be in [%lld,%lld]",
|
||||
(long long)level,
|
||||
(long long)0,
|
||||
(long long)m->num_leaf_levels);
|
||||
}
|
||||
h5_loc_idx_t elem_idx = level == 0 ? 0 : m->num_interior_elems[level-1];
|
||||
const h5_loc_idx_t last_idx = m->num_interior_elems[level] - 1;
|
||||
@@ -257,7 +255,7 @@ compute_neighbors_of_elems (
|
||||
el++;
|
||||
}
|
||||
|
||||
H5_PRIV_FUNC_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
/*
|
||||
* returns number of newly created triangles when refining a triangle
|
||||
@@ -280,7 +278,7 @@ end_store_elems (
|
||||
TRY( h5tpriv_update_internal_structs (m, m->leaf_level) );
|
||||
TRY( compute_neighbors_of_elems (m, m->leaf_level) );
|
||||
TRY( h5tpriv_init_elem_flags (m, start_idx, count) );
|
||||
H5_PRIV_FUNC_RETURN (H5_SUCCESS);
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
struct h5t_store_methods h5tpriv_trim_store_methods = {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user