* C-API
- H5PartSetNumPoints() renamed to H5PartSetNumItems() - H5PartGetNumPoints() renamed to H5PartGetNumItems() - Dataset names longer then 64 bytes are handled as error. - Same for step/iteration names. * core API - we use the term 'iteration' instead of 'step' - we use the term 'item' instead of 'point' - re-factor function and variable names - in printing messages/debug output fixed - do not flush (sync to disk) after writing a dataset by default, can be controlled by a property
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
2018-09-14 Gsell Achim <achi.gsell@psi.ch>
|
||||
|
||||
* C-API
|
||||
- H5PartSetNumPoints() renamed to H5PartSetNumItems()
|
||||
- H5PartGetNumPoints() renamed to H5PartGetNumItems()
|
||||
- Dataset names longer then 64 bytes are handled as error.
|
||||
- Same for step/iteration names.
|
||||
* core API
|
||||
- we use the term 'iteration' instead of 'step'
|
||||
- we use the term 'item' instead of 'point'
|
||||
- re-factor function and variable names
|
||||
- in printing messages/debug output fixed
|
||||
- do not flush (sync to disk) after writing a dataset by default,
|
||||
can be controlled by a property
|
||||
|
||||
|
||||
@@ -7,6 +7,9 @@
|
||||
License: see file COPYING in top level of source distribution.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <mpi.h>
|
||||
|
||||
#include "H5hut.h"
|
||||
#include "examples.h"
|
||||
|
||||
@@ -15,16 +18,51 @@ const char* fname = "example_setview.h5";
|
||||
|
||||
// H5hut verbosity level
|
||||
const h5_int64_t h5_verbosity = H5_VERBOSE_DEFAULT;
|
||||
const h5_int64_t h5_debug_mask = 0;
|
||||
|
||||
// we are going to write multiple consecutive blocks
|
||||
const h5_int64_t num_blocks = 4;
|
||||
const h5_int64_t num_particles_per_block = 32;
|
||||
//const h5_int64_t num_blocks = 32;
|
||||
//const h5_int64_t num_particles_per_block = 1048576*8;
|
||||
|
||||
int
|
||||
main (
|
||||
int argc,
|
||||
char* argv[]
|
||||
){
|
||||
if (argc < 3) {
|
||||
fprintf (stderr, "Usage: %s <number_of_blocks> <sizeof_block>\n", argv[0]);
|
||||
exit (1);
|
||||
}
|
||||
|
||||
char* endptr = NULL;
|
||||
long long n = strtoll (argv[1], &endptr, 10);
|
||||
if (*endptr != 0) {
|
||||
fprintf (stderr, "first argument (number of blocks) is not a unsigned integer!\n");
|
||||
exit (1);
|
||||
}
|
||||
if (n < 1) {
|
||||
fprintf (stderr, "first argument (number of block) must be >= 1!\n");
|
||||
exit (1);
|
||||
}
|
||||
if (n == LLONG_MAX) {
|
||||
fprintf (stderr, "first argument (number of block) to large!\n");
|
||||
exit (1);
|
||||
}
|
||||
h5_int64_t num_blocks = (h5_int64_t)n;
|
||||
n = strtoll (argv[2], &endptr, 10);
|
||||
if (*endptr != 0) {
|
||||
fprintf (stderr, "second argument (sizeof blocks) is not a unsigned integer!\n");
|
||||
exit (1);
|
||||
}
|
||||
if (n < 1024) {
|
||||
fprintf (stderr, "second argument (sizeof block) must be >= 1024!\n");
|
||||
exit (1);
|
||||
}
|
||||
if (n == LLONG_MAX) {
|
||||
fprintf (stderr, "second argument (sizeof block) to large!\n");
|
||||
exit (1);
|
||||
}
|
||||
h5_int64_t num_particles_per_block = (h5_int64_t)n;
|
||||
|
||||
// initialize MPI & H5hut
|
||||
MPI_Init (&argc, &argv);
|
||||
@@ -33,9 +71,16 @@ main (
|
||||
MPI_Comm_rank (comm, &comm_rank);
|
||||
H5AbortOnError ();
|
||||
H5SetVerbosityLevel (h5_verbosity);
|
||||
H5SetDebugMask (h5_debug_mask);
|
||||
|
||||
h5_prop_t prop = H5CreateFileProp ();
|
||||
H5SetPropFileAlign (prop, 1048576*8);
|
||||
H5SetPropFileMPIOIndependent (prop, &comm);
|
||||
//H5SetPropFileMPIOCollective (prop, &comm);
|
||||
|
||||
// open file and create first step
|
||||
h5_file_t file = H5OpenFile (fname, H5_O_WRONLY, H5_PROP_DEFAULT);
|
||||
h5_file_t file = H5OpenFile (fname, H5_O_WRONLY, prop);
|
||||
//H5PartSetChunkSize (file, 1048576*1);
|
||||
H5SetStep (file, 0);
|
||||
|
||||
/*
|
||||
@@ -52,7 +97,9 @@ main (
|
||||
// write multiple consecutive blocks
|
||||
for (int i = 0; i < num_blocks; i++) {
|
||||
// create fake data
|
||||
h5_int32_t data[num_particles_per_block];
|
||||
//h5_int32_t data[num_particles_per_block];
|
||||
h5_int64_t *data;
|
||||
data = calloc (num_particles_per_block, sizeof(*data));
|
||||
for (int j = 0; j < num_particles_per_block; j++) {
|
||||
data[j] = j + i*num_particles_per_block + offset;
|
||||
}
|
||||
@@ -63,7 +110,7 @@ main (
|
||||
offset + i*num_particles_per_block,
|
||||
offset + (i+1)*num_particles_per_block - 1);
|
||||
// write data
|
||||
H5PartWriteDataInt32 (file, "data", data);
|
||||
H5PartWriteDataInt64 (file, "data", data);
|
||||
}
|
||||
|
||||
// done
|
||||
|
||||
@@ -0,0 +1,120 @@
|
||||
/*
|
||||
Copyright (c) 2006-2015, The Regents of the University of California,
|
||||
through Lawrence Berkeley National Laboratory (subject to receipt of any
|
||||
required approvals from the U.S. Dept. of Energy) and the Paul Scherrer
|
||||
Institut (Switzerland). All rights reserved.
|
||||
|
||||
License: see file COPYING in top level of source distribution.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <mpi.h>
|
||||
|
||||
#include "H5hut.h"
|
||||
#include "examples.h"
|
||||
|
||||
// name of output file
|
||||
const char* fname = "example_setview.h5";
|
||||
|
||||
// H5hut verbosity level
|
||||
const h5_int64_t h5_verbosity = H5_VERBOSE_DEFAULT;
|
||||
const h5_int64_t h5_debug_mask = 0;
|
||||
|
||||
// we are going to write multiple consecutive blocks
|
||||
//const h5_int64_t num_blocks = 32;
|
||||
//const h5_int64_t num_particles_per_block = 1048576*8;
|
||||
|
||||
int
|
||||
main (
|
||||
int argc,
|
||||
char* argv[]
|
||||
){
|
||||
if (argc < 3) {
|
||||
fprintf (stderr, "Usage: %s <number_of_blocks> <sizeof_block>\n", argv[0]);
|
||||
exit (1);
|
||||
}
|
||||
|
||||
char* endptr = NULL;
|
||||
long long n = strtoll (argv[1], &endptr, 10);
|
||||
if (*endptr != 0) {
|
||||
fprintf (stderr, "first argument (number of blocks) is not a unsigned integer!\n");
|
||||
exit (1);
|
||||
}
|
||||
if (n < 1) {
|
||||
fprintf (stderr, "first argument (number of block) must be >= 1!\n");
|
||||
exit (1);
|
||||
}
|
||||
if (n == LLONG_MAX) {
|
||||
fprintf (stderr, "first argument (number of block) to large!\n");
|
||||
exit (1);
|
||||
}
|
||||
h5_int64_t num_blocks = (h5_int64_t)n;
|
||||
n = strtoll (argv[2], &endptr, 10);
|
||||
if (*endptr != 0) {
|
||||
fprintf (stderr, "second argument (sizeof blocks) is not a unsigned integer!\n");
|
||||
exit (1);
|
||||
}
|
||||
if (n < 1024) {
|
||||
fprintf (stderr, "second argument (sizeof block) must be >= 1024!\n");
|
||||
exit (1);
|
||||
}
|
||||
if (n == LLONG_MAX) {
|
||||
fprintf (stderr, "second argument (sizeof block) to large!\n");
|
||||
exit (1);
|
||||
}
|
||||
h5_int64_t num_particles_per_block = (h5_int64_t)n;
|
||||
|
||||
// initialize MPI & H5hut
|
||||
MPI_Init (&argc, &argv);
|
||||
MPI_Comm comm = MPI_COMM_WORLD;
|
||||
int comm_rank = 0;
|
||||
MPI_Comm_rank (comm, &comm_rank);
|
||||
H5AbortOnError ();
|
||||
H5SetVerbosityLevel (h5_verbosity);
|
||||
H5SetDebugMask (h5_debug_mask);
|
||||
|
||||
h5_prop_t prop = H5CreateFileProp ();
|
||||
H5SetPropFileAlign (prop, 1048576*8);
|
||||
H5SetPropFileMPIOIndependent (prop, &comm);
|
||||
//H5SetPropFileMPIOCollective (prop, &comm);
|
||||
|
||||
// open file and create first step
|
||||
h5_file_t file = H5OpenFile (fname, H5_O_WRONLY, prop);
|
||||
//H5PartSetChunkSize (file, 1048576*1);
|
||||
H5SetStep (file, 0);
|
||||
|
||||
/*
|
||||
If we want to write consecutive blocks, the 'view' can be defined
|
||||
with H5PartSetview(). Otherwise we have to define the total number
|
||||
of particles with H5PartSetNumParticles().
|
||||
*/
|
||||
const h5_int64_t offset = comm_rank * num_blocks * num_particles_per_block;
|
||||
H5PartSetView (
|
||||
file,
|
||||
offset,
|
||||
offset + num_blocks*num_particles_per_block -1);
|
||||
dataset_id = H5PartCreateDataSet (file, "data");
|
||||
// write multiple consecutive blocks
|
||||
for (int i = 0; i < num_blocks; i++) {
|
||||
// create fake data
|
||||
//h5_int32_t data[num_particles_per_block];
|
||||
h5_int64_t *data;
|
||||
data = calloc (num_particles_per_block, sizeof(*data));
|
||||
for (int j = 0; j < num_particles_per_block; j++) {
|
||||
data[j] = j + i*num_particles_per_block + offset;
|
||||
}
|
||||
|
||||
// set the "view" to select a subset of the dataset
|
||||
H5PartSetViewOnDataset (
|
||||
file,
|
||||
offset + i*num_particles_per_block,
|
||||
offset + (i+1)*num_particles_per_block - 1);
|
||||
// write data
|
||||
H5PartWriteDatasetInt64 (dataset_id, data);
|
||||
}
|
||||
H5CloseDataset (dataset_id);
|
||||
// done
|
||||
H5CloseFile(file);
|
||||
MPI_Finalize();
|
||||
return 0;
|
||||
}
|
||||
+1
-1
@@ -222,7 +222,7 @@ h5_flushstep (
|
||||
) {
|
||||
h5_file_t fh = h5_filehandlefor2c(f);
|
||||
H5_API_ENTER (h5_int64_t, "f=%p", (h5_file_p)fh);
|
||||
H5_API_RETURN (h5_flush_step (fh));
|
||||
H5_API_RETURN (h5_flush_iteration (fh));
|
||||
}
|
||||
|
||||
#define h5_finalize FC_MANGLING( \
|
||||
|
||||
@@ -28,7 +28,7 @@ h5pt_writedata_r8 (
|
||||
"fh=%p, name='%s', data=%p, l_name=%d",
|
||||
(h5_file_p)f, name, data, l_name);
|
||||
char *name2 = h5_strdupfor2c ( name, l_name );
|
||||
h5_int64_t herr = h5u_write_data (
|
||||
h5_int64_t herr = h5u_write_dataset (
|
||||
f, name2, (void*)data, H5_FLOAT64_T );
|
||||
free ( name2 );
|
||||
H5_API_RETURN(herr);
|
||||
@@ -49,7 +49,7 @@ h5pt_writedata_r4 (
|
||||
"fh=%p, name='%s', data=%p, l_name=%d",
|
||||
(h5_file_p)f, name, data, l_name);
|
||||
char *name2 = h5_strdupfor2c ( name, l_name );
|
||||
h5_int64_t herr = h5u_write_data (
|
||||
h5_int64_t herr = h5u_write_dataset (
|
||||
f, name2, (void*)data, H5_FLOAT32_T );
|
||||
free ( name2 );
|
||||
H5_API_RETURN(herr);
|
||||
@@ -70,7 +70,7 @@ h5pt_writedata_i8 (
|
||||
"fh=%p, name='%s', data=%p, l_name=%d",
|
||||
(h5_file_p)f, name, data, l_name);
|
||||
char *name2 = h5_strdupfor2c ( name, l_name );
|
||||
h5_int64_t herr = h5u_write_data (
|
||||
h5_int64_t herr = h5u_write_dataset (
|
||||
f, name2, (void*)data, H5_INT64_T );
|
||||
free ( name2 );
|
||||
H5_API_RETURN(herr);
|
||||
@@ -91,7 +91,7 @@ h5pt_writedata_i4 (
|
||||
"fh=%p, name='%s', data=%p, l_name=%d",
|
||||
(h5_file_p)f, name, data, l_name);
|
||||
char *name2 = h5_strdupfor2c ( name, l_name );
|
||||
h5_int64_t herr = h5u_write_data (
|
||||
h5_int64_t herr = h5u_write_dataset (
|
||||
f, name2, (void*)data, H5_INT32_T );
|
||||
free ( name2 );
|
||||
H5_API_RETURN(herr);
|
||||
@@ -114,7 +114,7 @@ h5pt_readdata_r8 (
|
||||
"fh=%p, name='%s', data=%p, l_name=%d",
|
||||
(h5_file_p)f, name, data, l_name);
|
||||
char *name2 = h5_strdupfor2c ( name, l_name );
|
||||
h5_int64_t herr = h5u_read_data (
|
||||
h5_int64_t herr = h5u_read_dataset (
|
||||
f, name2, data, H5_FLOAT64_T );
|
||||
free ( name2 );
|
||||
H5_API_RETURN(herr);
|
||||
@@ -135,7 +135,7 @@ h5pt_readdata_r4 (
|
||||
"fh=%p, name='%s', data=%p, l_name=%d",
|
||||
(h5_file_p)f, name, data, l_name);
|
||||
char *name2 = h5_strdupfor2c ( name, l_name );
|
||||
h5_int64_t herr = h5u_read_data (
|
||||
h5_int64_t herr = h5u_read_dataset (
|
||||
f, name2, data, H5_FLOAT32_T );
|
||||
free ( name2 );
|
||||
H5_API_RETURN(herr);
|
||||
@@ -156,7 +156,7 @@ h5pt_readdata_i8 (
|
||||
"fh=%p, name='%s', data=%p, l_name=%d",
|
||||
(h5_file_p)f, name, data, l_name);
|
||||
char *name2 = h5_strdupfor2c ( name, l_name );
|
||||
h5_int64_t herr = h5u_read_data (
|
||||
h5_int64_t herr = h5u_read_dataset (
|
||||
f, name2, data, H5_INT64_T );
|
||||
|
||||
free ( name2 );
|
||||
@@ -178,7 +178,7 @@ h5pt_readdata_i4 (
|
||||
"hf=%p, name='%s', data=%p, l_name=%d",
|
||||
(h5_file_p)f, name, data, l_name);
|
||||
char *name2 = h5_strdupfor2c ( name, l_name );
|
||||
h5_int64_t herr = h5u_read_data (
|
||||
h5_int64_t herr = h5u_read_dataset (
|
||||
f, name2, data, H5_INT32_T );
|
||||
free ( name2 );
|
||||
H5_API_RETURN(herr);
|
||||
|
||||
@@ -22,13 +22,13 @@
|
||||
h5_int64_t
|
||||
h5pt_setnpoints (
|
||||
const h5_int64_t* const fh,
|
||||
const h5_int64_t* const npoints
|
||||
const h5_int64_t* const num_items
|
||||
) {
|
||||
h5_file_t f = h5_filehandlefor2c (fh);
|
||||
H5_API_ENTER (h5_int64_t,
|
||||
"fh=%p, npoints=%lld",
|
||||
(h5_file_p)f, (long long)*npoints);
|
||||
H5_API_RETURN (h5u_set_num_points (f, *npoints, 1));
|
||||
(h5_file_p)f, (long long)*num_items);
|
||||
H5_API_RETURN (h5u_set_num_items (f, *num_items, 1));
|
||||
}
|
||||
|
||||
#define h5pt_setnpoints_strided FC_MANGLING ( \
|
||||
@@ -37,14 +37,14 @@ h5pt_setnpoints (
|
||||
h5_int64_t
|
||||
h5pt_setnpoints_strided (
|
||||
const h5_int64_t* const fh,
|
||||
const h5_int64_t* const npoints,
|
||||
const h5_int64_t* const num_items,
|
||||
const h5_int64_t* const stride
|
||||
) {
|
||||
h5_file_t f = h5_filehandlefor2c (fh);
|
||||
H5_API_ENTER (h5_int64_t,
|
||||
"fh=%p, npoints=%lld, stride=%lld",
|
||||
(h5_file_p)f, (long long)*npoints, (long long)*stride);
|
||||
H5_API_RETURN (h5u_set_num_points (f, *npoints, *stride));
|
||||
(h5_file_p)f, (long long)*num_items, (long long)*stride);
|
||||
H5_API_RETURN (h5u_set_num_items (f, *num_items, *stride));
|
||||
}
|
||||
|
||||
|
||||
@@ -172,7 +172,7 @@ h5pt_getnpoints (
|
||||
) {
|
||||
h5_file_t f = h5_filehandlefor2c (fh);
|
||||
H5_API_ENTER (h5_int64_t, "fh=%p", (h5_file_p)f);
|
||||
H5_API_RETURN (h5u_get_num_points (f));
|
||||
H5_API_RETURN (h5u_get_num_items (f));
|
||||
}
|
||||
|
||||
#define h5pt_getdatasetname FC_MANGLING ( \
|
||||
|
||||
+19
-17
@@ -380,7 +380,7 @@ h5_getnstepattribs (
|
||||
H5_API_ENTER (h5_int64_t,
|
||||
"fh=%p",
|
||||
(h5_file_p)f);
|
||||
H5_API_RETURN (h5_get_num_step_attribs (f));
|
||||
H5_API_RETURN (h5_get_num_iteration_attribs (f));
|
||||
}
|
||||
|
||||
#define h5_getstepattribinfo FC_MANGLING( \
|
||||
@@ -405,7 +405,7 @@ h5_getstepattribinfo (
|
||||
(h5_file_p)f,
|
||||
(long long)*attrib_idx,
|
||||
attrib_name, attrib_type, attrib_nelem);
|
||||
h5_int64_t h5err = h5_get_step_attrib_info_by_idx (
|
||||
h5_int64_t h5err = h5_get_iteration_attrib_info_by_idx (
|
||||
f,
|
||||
*attrib_idx - 1,
|
||||
attrib_name, l_attrib_name,
|
||||
@@ -435,7 +435,7 @@ h5_getstepattribinfo_by_name (
|
||||
(h5_file_p)fh,
|
||||
l_name, _name, _type, _nelem);
|
||||
char* name = h5_strdupfor2c (_name, l_name);
|
||||
h5_int64_t h5err = h5_get_step_attrib_info_by_name (
|
||||
h5_int64_t h5err = h5_get_iteration_attrib_info_by_name (
|
||||
f,
|
||||
name,
|
||||
_type,
|
||||
@@ -459,7 +459,7 @@ h5_getstepattribinfo_by_name (
|
||||
*/
|
||||
|
||||
static inline h5_int64_t
|
||||
write_step_attrib (
|
||||
write_iteration_attrib (
|
||||
const h5_file_t fh,
|
||||
const char* name,
|
||||
const int l_name,
|
||||
@@ -468,13 +468,14 @@ write_step_attrib (
|
||||
const hsize_t l_buffer
|
||||
) {
|
||||
char *name2 = h5_strdupfor2c (name, l_name);
|
||||
h5_int64_t herr = h5_write_step_attrib (fh, name2, type, buffer, l_buffer );
|
||||
h5_int64_t herr = h5_write_iteration_attrib (
|
||||
fh, name2, type, buffer, l_buffer );
|
||||
free (name2);
|
||||
return herr;
|
||||
}
|
||||
|
||||
static inline h5_int64_t
|
||||
read_step_attrib (
|
||||
read_iteration_attrib (
|
||||
const h5_file_t fh,
|
||||
const char* name,
|
||||
const int l_name,
|
||||
@@ -482,7 +483,7 @@ read_step_attrib (
|
||||
void* const buffer
|
||||
) {
|
||||
char* name2 = h5_strdupfor2c ( name, l_name );
|
||||
h5_int64_t herr = h5_read_step_attrib (fh, name2, type, buffer);
|
||||
h5_int64_t herr = h5_read_iteration_attrib (fh, name2, type, buffer);
|
||||
free (name2);
|
||||
return herr;
|
||||
}
|
||||
@@ -503,7 +504,7 @@ h5_writestepattrib_string (
|
||||
"f=%p, name='%.*s', buffer='%.*s'",
|
||||
(h5_file_p)f, l_name, name, l_buffer, buffer);
|
||||
char *buffer2 = h5_strdupfor2c (buffer, l_buffer);
|
||||
h5_int64_t herr = write_step_attrib (
|
||||
h5_int64_t herr = write_iteration_attrib (
|
||||
f, name, l_name, H5_STRING_T, buffer2, strlen(buffer2)+1 );
|
||||
free (buffer2);
|
||||
H5_API_RETURN (herr);
|
||||
@@ -524,7 +525,8 @@ h5_readstepattrib_string (
|
||||
H5_API_ENTER (h5_int64_t,
|
||||
"f=%p, name='%.*s', buffer='%.*s'",
|
||||
(h5_file_p)f, l_name, name, l_buffer, buffer);
|
||||
h5_int64_t herr = read_step_attrib (f, name, l_name, H5_STRING_T, buffer);
|
||||
h5_int64_t herr = read_iteration_attrib (
|
||||
f, name, l_name, H5_STRING_T, buffer);
|
||||
h5_strc2for (buffer, l_buffer);
|
||||
H5_API_RETURN (herr);
|
||||
}
|
||||
@@ -544,7 +546,7 @@ h5_writestepattrib_r8 (
|
||||
H5_API_ENTER (h5_int64_t,
|
||||
"f=%p, name='%.*s', buffer=%p, nelem=%lld",
|
||||
(h5_file_p)f, l_name, name, buffer, (long long)*nelem);
|
||||
H5_API_RETURN (write_step_attrib(
|
||||
H5_API_RETURN (write_iteration_attrib(
|
||||
f,
|
||||
name, l_name,
|
||||
H5_FLOAT64_T,
|
||||
@@ -565,7 +567,7 @@ h5_readstepattrib_r8 (
|
||||
H5_API_ENTER (h5_int64_t,
|
||||
"f=%p, name='%.*s', buffer=%p",
|
||||
(h5_file_p)f, l_name, name, buffer);
|
||||
H5_API_RETURN (read_step_attrib(
|
||||
H5_API_RETURN (read_iteration_attrib(
|
||||
f,
|
||||
name, l_name,
|
||||
H5_FLOAT64_T,
|
||||
@@ -587,7 +589,7 @@ h5_writestepattrib_r4 (
|
||||
H5_API_ENTER (h5_int64_t,
|
||||
"f=%p, name='%.*s', buffer=%p, nelem=%lld",
|
||||
(h5_file_p)f, l_name, name, buffer, (long long)*nelem);
|
||||
H5_API_RETURN (write_step_attrib(
|
||||
H5_API_RETURN (write_iteration_attrib(
|
||||
f,
|
||||
name, l_name,
|
||||
H5_FLOAT32_T,
|
||||
@@ -608,7 +610,7 @@ h5_readstepattrib_r4 (
|
||||
H5_API_ENTER (h5_int64_t,
|
||||
"f=%p, name='%.*s', buffer=%p",
|
||||
(h5_file_p)f, l_name, name, buffer);
|
||||
H5_API_RETURN (read_step_attrib(
|
||||
H5_API_RETURN (read_iteration_attrib(
|
||||
f,
|
||||
name, l_name,
|
||||
H5_FLOAT32_T,
|
||||
@@ -630,7 +632,7 @@ h5_writestepattrib_i8 (
|
||||
H5_API_ENTER (h5_int64_t,
|
||||
"f=%p, name='%.*s', buffer=%p, nelem=%lld",
|
||||
(h5_file_p)f, l_name, name, buffer, (long long)*nelem);
|
||||
H5_API_RETURN (write_step_attrib(
|
||||
H5_API_RETURN (write_iteration_attrib(
|
||||
f,
|
||||
name, l_name,
|
||||
H5_INT64_T,
|
||||
@@ -651,7 +653,7 @@ h5_readstepattrib_i8 (
|
||||
H5_API_ENTER (h5_int64_t,
|
||||
"f=%p, name='%.*s', buffer=%p",
|
||||
(h5_file_p)f, l_name, name, buffer);
|
||||
H5_API_RETURN (read_step_attrib(
|
||||
H5_API_RETURN (read_iteration_attrib(
|
||||
f,
|
||||
name, l_name,
|
||||
H5_INT64_T,
|
||||
@@ -673,7 +675,7 @@ h5_writestepattrib_i4 (
|
||||
H5_API_ENTER (h5_int64_t,
|
||||
"f=%p, name='%.*s', buffer=%p, nelem=%lld",
|
||||
(h5_file_p)f, l_name, name, buffer, (long long)*nelem);
|
||||
H5_API_RETURN (write_step_attrib(
|
||||
H5_API_RETURN (write_iteration_attrib(
|
||||
f,
|
||||
name, l_name,
|
||||
H5_INT32_T,
|
||||
@@ -694,7 +696,7 @@ h5_readstepattrib_i4 (
|
||||
H5_API_ENTER (h5_int64_t,
|
||||
"f=%p, name='%.*s', buffer=%p",
|
||||
(h5_file_p)f, l_name, name, buffer);
|
||||
H5_API_RETURN (read_step_attrib(
|
||||
H5_API_RETURN (read_iteration_attrib(
|
||||
f,
|
||||
name, l_name,
|
||||
H5_INT32_T,
|
||||
|
||||
@@ -28,7 +28,7 @@ h5_hasstep (
|
||||
int,
|
||||
"f=%p, stepno=%lld",
|
||||
(h5_file_p)fh, (long long int)step);
|
||||
H5_API_RETURN (h5_has_step (fh, (*step)-1));
|
||||
H5_API_RETURN (h5_has_iteration (fh, (*step)-1));
|
||||
}
|
||||
|
||||
#define h5_setstep FC_MANGLING( \
|
||||
@@ -41,7 +41,7 @@ h5_setstep (
|
||||
|
||||
h5_file_t fh = h5_filehandlefor2c(f);
|
||||
H5_API_ENTER (h5_int64_t, "f=%p, step=%lld", (h5_file_p)fh, (long long)*step);
|
||||
H5_API_RETURN (h5_set_step (fh, (*step)-1));
|
||||
H5_API_RETURN (h5_set_iteration (fh, (*step)-1));
|
||||
}
|
||||
|
||||
#define h5_getstep FC_MANGLING( \
|
||||
@@ -54,7 +54,7 @@ h5_getstep (
|
||||
|
||||
h5_file_t fh = h5_filehandlefor2c(f);
|
||||
H5_API_ENTER (h5_int64_t, "f=%p", (h5_file_p)fh);
|
||||
H5_API_RETURN (h5_get_step (fh) + 1);
|
||||
H5_API_RETURN (h5_get_iteration (fh) + 1);
|
||||
}
|
||||
|
||||
#define h5_getnsteps FC_MANGLING( \
|
||||
@@ -67,5 +67,5 @@ h5_getnsteps (
|
||||
|
||||
h5_file_t fh = h5_filehandlefor2c(f);
|
||||
H5_API_ENTER (h5_int64_t, "f=%p", (h5_file_p)fh);
|
||||
H5_API_RETURN (h5_get_num_steps (fh));
|
||||
H5_API_RETURN (h5_get_num_iterations (fh));
|
||||
}
|
||||
|
||||
+19
-27
@@ -31,7 +31,7 @@ h5_has_file_attrib (
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
h5_has_step_attrib (
|
||||
h5_has_iteration_attrib (
|
||||
const h5_file_t f_,
|
||||
const char* const attrib_name
|
||||
) {
|
||||
@@ -41,9 +41,8 @@ h5_has_step_attrib (
|
||||
"attrib_name='%s'",
|
||||
f,
|
||||
attrib_name);
|
||||
CHECK_FILEHANDLE (f);
|
||||
CHECK_TIMEGROUP (f);
|
||||
TRY (ret_value = hdf5_attribute_exists (f->step_gid, attrib_name));
|
||||
check_iteration_handle_is_valid (f);
|
||||
TRY (ret_value = hdf5_attribute_exists (f->iteration_gid, attrib_name));
|
||||
H5_RETURN (ret_value);
|
||||
}
|
||||
|
||||
@@ -59,14 +58,13 @@ h5_get_num_file_attribs (
|
||||
}
|
||||
|
||||
h5_ssize_t
|
||||
h5_get_num_step_attribs (
|
||||
h5_get_num_iteration_attribs (
|
||||
const h5_file_t f_ /*!< handle to open file */
|
||||
) {
|
||||
h5_file_p f = (h5_file_p)f_;
|
||||
H5_CORE_API_ENTER (h5_ssize_t, "f=%p", f);
|
||||
CHECK_FILEHANDLE (f);
|
||||
CHECK_TIMEGROUP (f);
|
||||
TRY (ret_value = hdf5_get_num_attribute (f->step_gid));
|
||||
check_iteration_handle_is_valid (f);
|
||||
TRY (ret_value = hdf5_get_num_attribute (f->iteration_gid));
|
||||
H5_RETURN (ret_value);
|
||||
}
|
||||
|
||||
@@ -122,7 +120,7 @@ h5_get_file_attrib_info_by_name (
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
h5_get_step_attrib_info_by_idx (
|
||||
h5_get_iteration_attrib_info_by_idx (
|
||||
const h5_file_t f_, /*!< handle to open file */
|
||||
const h5_size_t attrib_idx, /*!< index of attribute */
|
||||
char* attrib_name, /*!< OUT: name of attribute */
|
||||
@@ -140,10 +138,9 @@ h5_get_step_attrib_info_by_idx (
|
||||
(long long unsigned)attrib_idx,
|
||||
attrib_name, (long long unsigned)len_attrib_name,
|
||||
attrib_type, attrib_nelem);
|
||||
CHECK_FILEHANDLE (f);
|
||||
CHECK_TIMEGROUP (f);
|
||||
check_iteration_handle_is_valid (f);
|
||||
TRY (ret_value = h5priv_get_attrib_info_by_idx (
|
||||
f->step_gid,
|
||||
f->iteration_gid,
|
||||
attrib_idx,
|
||||
attrib_name, len_attrib_name,
|
||||
attrib_type, attrib_nelem));
|
||||
@@ -151,7 +148,7 @@ h5_get_step_attrib_info_by_idx (
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
h5_get_step_attrib_info_by_name (
|
||||
h5_get_iteration_attrib_info_by_name (
|
||||
const h5_file_t f_, /*!< handle to open file */
|
||||
const char* const attrib_name, /*!< OUT: name of attribute */
|
||||
h5_int64_t* const attrib_type, /*!< OUT: H5 type of attribute */
|
||||
@@ -165,10 +162,9 @@ h5_get_step_attrib_info_by_name (
|
||||
f,
|
||||
attrib_name,
|
||||
attrib_type, attrib_nelem);
|
||||
CHECK_FILEHANDLE (f);
|
||||
CHECK_TIMEGROUP (f);
|
||||
check_iteration_handle_is_valid (f);
|
||||
TRY (ret_value = h5priv_get_attrib_info_by_name (
|
||||
f->step_gid,
|
||||
f->iteration_gid,
|
||||
attrib_name,
|
||||
attrib_type, attrib_nelem));
|
||||
H5_RETURN (ret_value);
|
||||
@@ -199,7 +195,7 @@ h5_read_file_attrib (
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
h5_read_step_attrib (
|
||||
h5_read_iteration_attrib (
|
||||
const h5_file_t f_,
|
||||
const char* const attrib_name,
|
||||
const h5_types_t attrib_type,
|
||||
@@ -213,12 +209,10 @@ h5_read_step_attrib (
|
||||
attrib_name,
|
||||
(long long int)attrib_type,
|
||||
attrib_value);
|
||||
CHECK_FILEHANDLE (f);
|
||||
CHECK_TIMEGROUP (f);
|
||||
CHECK_READABLE_MODE (f);
|
||||
check_iteration_is_readable (f);
|
||||
|
||||
TRY (ret_value = h5priv_read_attrib (
|
||||
f->step_gid,
|
||||
f->iteration_gid,
|
||||
attrib_name,
|
||||
attrib_type,
|
||||
attrib_value));
|
||||
@@ -263,7 +257,7 @@ h5_write_file_attrib (
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
h5_write_step_attrib (
|
||||
h5_write_iteration_attrib (
|
||||
const h5_file_t f_,
|
||||
const char* const attrib_name,
|
||||
const h5_types_t attrib_type,
|
||||
@@ -279,19 +273,17 @@ h5_write_step_attrib (
|
||||
(long long int)attrib_type,
|
||||
attrib_value,
|
||||
(long long)attrib_nelem);
|
||||
CHECK_FILEHANDLE (f);
|
||||
CHECK_TIMEGROUP (f);
|
||||
CHECK_WRITABLE_MODE (f);
|
||||
check_iteration_is_writable (f);
|
||||
if (is_appendonly (f)) {
|
||||
TRY (h5priv_append_attrib (
|
||||
f->step_gid,
|
||||
f->iteration_gid,
|
||||
attrib_name,
|
||||
attrib_type,
|
||||
attrib_value,
|
||||
attrib_nelem));
|
||||
} else {
|
||||
TRY (h5priv_write_attrib (
|
||||
f->step_gid,
|
||||
f->iteration_gid,
|
||||
attrib_name,
|
||||
attrib_type,
|
||||
attrib_value,
|
||||
|
||||
+3
-3
@@ -103,7 +103,7 @@ h5_verror (
|
||||
const char* const fmt,
|
||||
va_list ap
|
||||
) {
|
||||
if (h5_log_level == 0) return;
|
||||
if (__h5_log_level == 0) return;
|
||||
char fmt2[2048];
|
||||
snprintf (fmt2,
|
||||
sizeof(fmt2), "[proc %d] E: %s: %s\n",
|
||||
@@ -127,7 +127,7 @@ h5_report_errorhandler (
|
||||
const char* const fmt,
|
||||
va_list ap
|
||||
) {
|
||||
if (h5_log_level > 0) {
|
||||
if (__h5_log_level > 0) {
|
||||
h5_verror (fmt, ap);
|
||||
}
|
||||
return h5_errno;
|
||||
@@ -144,7 +144,7 @@ h5_abort_errorhandler (
|
||||
const char* const fmt,
|
||||
va_list ap
|
||||
) {
|
||||
if (h5_log_level > 0) {
|
||||
if (__h5_log_level > 0) {
|
||||
h5_verror (fmt, ap);
|
||||
}
|
||||
#ifdef H5_HAVE_PARALLEL
|
||||
|
||||
+67
-71
@@ -42,12 +42,7 @@ h5_check_filehandle (
|
||||
const h5_file_t f_ /*!< filehandle to check validity of */
|
||||
) {
|
||||
h5_file_p f = (h5_file_p)f_;
|
||||
if (f == NULL || f_ == H5_FAILURE || f->file < 0 || f->u == NULL || f->b == NULL) {
|
||||
return h5_error (
|
||||
H5_ERR_BADF,
|
||||
"Called with bad filehandle.");
|
||||
}
|
||||
return H5_SUCCESS;
|
||||
return is_valid_file_handle (f) ? H5_SUCCESS : H5_ERR;
|
||||
}
|
||||
|
||||
hid_t
|
||||
@@ -56,7 +51,7 @@ h5_get_hdf5_file(
|
||||
) {
|
||||
h5_file_p f = (h5_file_p)f_;
|
||||
H5_CORE_API_ENTER (hid_t, "f=%p", f);
|
||||
CHECK_FILEHANDLE (f);
|
||||
check_file_handle_is_valid (f);
|
||||
H5_RETURN (f->file);
|
||||
}
|
||||
|
||||
@@ -69,7 +64,7 @@ hdf5_error_handler (
|
||||
void* __f
|
||||
) {
|
||||
UNUSED_ARGUMENT (__f);
|
||||
if (h5_get_loglevel() >= 5) {
|
||||
if (h5_get_loglevel() >= 4) {
|
||||
H5Eprint (estack_id, stderr);
|
||||
}
|
||||
return 0;
|
||||
@@ -175,12 +170,12 @@ set_default_file_props (
|
||||
h5_prop_file_t* props = (h5_prop_file_t*)_props;
|
||||
bzero (props, sizeof (*props));
|
||||
props->class = H5_PROP_FILE;
|
||||
TRY (props->prefix_step_name = h5_calloc (1, H5_STEPNAME_LEN));
|
||||
TRY (props->prefix_iteration_name = h5_calloc (1, H5_ITERATION_NAME_LEN));
|
||||
strncpy (
|
||||
props->prefix_step_name,
|
||||
H5_STEPNAME,
|
||||
H5_STEPNAME_LEN - 1);
|
||||
props->width_step_idx = H5_STEPWIDTH;
|
||||
props->prefix_iteration_name,
|
||||
H5_ITERATION_NAME,
|
||||
H5_ITERATION_NAME_LEN - 1);
|
||||
props->width_iteration_idx = H5_ITERATION_NUM_WIDTH;
|
||||
#ifdef H5_HAVE_PARALLEL
|
||||
props->comm = MPI_COMM_WORLD;
|
||||
#endif
|
||||
@@ -271,7 +266,8 @@ h5_set_prop_file_core_vfd (
|
||||
const h5_int64_t increment
|
||||
) {
|
||||
h5_prop_file_t* props = (h5_prop_file_t*)_props;
|
||||
H5_CORE_API_ENTER (h5_err_t, "props=%p, increment=%lld", props, (long long int)increment);
|
||||
H5_CORE_API_ENTER (h5_err_t, "props=%p, increment=%lld",
|
||||
props, (long long int)increment);
|
||||
|
||||
if (props->class != H5_PROP_FILE) {
|
||||
H5_RETURN_ERROR (
|
||||
@@ -280,7 +276,9 @@ h5_set_prop_file_core_vfd (
|
||||
(long long int)props->class);
|
||||
}
|
||||
#ifdef H5_HAVE_PARALLEL
|
||||
props->flags &= ~(H5_VFD_MPIO_COLLECTIVE | H5_VFD_MPIO_INDEPENDENT | H5_VFD_MPIO_POSIX);
|
||||
props->flags &= ~(H5_VFD_MPIO_COLLECTIVE |
|
||||
H5_VFD_MPIO_INDEPENDENT |
|
||||
H5_VFD_MPIO_POSIX);
|
||||
props->flags |= H5_VFD_MPIO_INDEPENDENT;
|
||||
props->comm = MPI_COMM_SELF;
|
||||
props->increment = increment;
|
||||
@@ -315,26 +313,24 @@ h5_set_prop_file_align (
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
#if 0
|
||||
h5_err_t
|
||||
h5_set_prop_file_flush_step (
|
||||
h5_set_prop_file_flush_after_write (
|
||||
h5_prop_t _props
|
||||
) {
|
||||
h5_prop_file_t* props = (h5_prop_file_t*)_props;
|
||||
H5_CORE_API_ENTER (
|
||||
h5_err_t,
|
||||
"props=%p, align=%lld",
|
||||
props, (long long int)align);
|
||||
"props=%p",
|
||||
props);
|
||||
if (props->class != H5_PROP_FILE) {
|
||||
H5_RETURN_ERROR (
|
||||
H5_ERR_INVAL,
|
||||
"Invalid property class: %lld",
|
||||
(long long int)props->class);
|
||||
}
|
||||
props-> = align;
|
||||
props->flush = 1;
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
#endif
|
||||
|
||||
h5_err_t
|
||||
h5_set_prop_file_throttle (
|
||||
@@ -411,7 +407,7 @@ h5_close_prop (
|
||||
switch (prop->class) {
|
||||
case H5_PROP_FILE: {
|
||||
h5_prop_file_t* file_prop = (h5_prop_file_t*)prop;
|
||||
TRY (h5_free (file_prop->prefix_step_name));
|
||||
TRY (h5_free (file_prop->prefix_iteration_name));
|
||||
break;
|
||||
}
|
||||
default:
|
||||
@@ -436,14 +432,14 @@ open_file (
|
||||
|
||||
f->nprocs = 1; // queried later
|
||||
f->myproc = 0; // queried later
|
||||
f->step_gid = -1;
|
||||
f->iteration_gid = -1;
|
||||
|
||||
TRY (f->step_name = h5_calloc (2, H5_STEPNAME_LEN));
|
||||
TRY (f->iteration_name = h5_calloc (2, H5_ITERATION_NAME_LEN));
|
||||
sprintf (
|
||||
f->step_name,
|
||||
f->iteration_name,
|
||||
"%s#%0*lld",
|
||||
f->props->prefix_step_name,
|
||||
f->props->width_step_idx, (long long)f->step_idx);
|
||||
f->props->prefix_iteration_name,
|
||||
f->props->width_iteration_idx, (long long)f->iteration_idx);
|
||||
|
||||
TRY (hdf5_set_errorhandler (H5E_DEFAULT, hdf5_error_handler, NULL));
|
||||
|
||||
@@ -526,15 +522,17 @@ h5_open_file2 (
|
||||
f->props->align = props->align;
|
||||
|
||||
strncpy (
|
||||
f->props->prefix_step_name,
|
||||
props->prefix_step_name,
|
||||
H5_STEPNAME_LEN - 1);
|
||||
f->props->width_step_idx = props->width_step_idx;
|
||||
f->props->prefix_iteration_name,
|
||||
props->prefix_iteration_name,
|
||||
H5_ITERATION_NAME_LEN - 1);
|
||||
f->props->width_iteration_idx = props->width_iteration_idx;
|
||||
}
|
||||
|
||||
TRY (open_file (f, filename, mode));
|
||||
|
||||
TRY (h5_set_stepname_fmt ((uintptr_t)f, H5_STEPNAME, H5_STEPWIDTH));
|
||||
TRY (h5_set_iteration_name_fmt ((uintptr_t)f,
|
||||
H5_ITERATION_NAME,
|
||||
H5_ITERATION_NUM_WIDTH));
|
||||
|
||||
H5_RETURN ((h5_file_t)f);
|
||||
}
|
||||
@@ -595,9 +593,9 @@ h5_close_file (
|
||||
H5_CORE_API_ENTER (h5_err_t, "f=%p", f);
|
||||
h5_errno = H5_SUCCESS;
|
||||
|
||||
CHECK_FILEHANDLE (f);
|
||||
check_file_handle_is_valid (f);
|
||||
|
||||
TRY (h5priv_close_step (f));
|
||||
TRY (h5priv_close_iteration (f));
|
||||
TRY (h5upriv_close_file (f));
|
||||
TRY (h5bpriv_close_file (f));
|
||||
TRY (hdf5_close_property (f->props->xfer_prop));
|
||||
@@ -607,7 +605,7 @@ h5_close_file (
|
||||
TRY (hdf5_flush (f->file, H5F_SCOPE_GLOBAL));
|
||||
TRY (h5_close_prop ((h5_prop_t)f->props));
|
||||
TRY (hdf5_close_file (f->file));
|
||||
TRY (h5_free (f->step_name));
|
||||
TRY (h5_free (f->iteration_name));
|
||||
TRY (h5_free (f));
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
@@ -623,16 +621,15 @@ h5_close_h5hut (
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
h5_flush_step (
|
||||
h5_flush_iteration (
|
||||
const h5_file_t f_
|
||||
) {
|
||||
h5_file_p f = (h5_file_p)f_;
|
||||
H5_CORE_API_ENTER (h5_err_t, "f=%p", f);
|
||||
CHECK_FILEHANDLE (f);
|
||||
CHECK_TIMEGROUP (f);
|
||||
check_iteration_is_writable (f);
|
||||
ret_value = H5_SUCCESS;
|
||||
if (f->step_gid >= 0) {
|
||||
TRY (ret_value = hdf5_flush (f->step_gid, H5F_SCOPE_LOCAL));
|
||||
if (f->iteration_gid >= 0) {
|
||||
TRY (ret_value = hdf5_flush (f->iteration_gid, H5F_SCOPE_LOCAL));
|
||||
}
|
||||
H5_RETURN (ret_value);
|
||||
}
|
||||
@@ -643,7 +640,7 @@ h5_flush_file (
|
||||
) {
|
||||
h5_file_p f = (h5_file_p)f_;
|
||||
H5_CORE_API_ENTER (h5_err_t, "f=%p", f);
|
||||
CHECK_FILEHANDLE (f);
|
||||
check_file_is_writable (f);
|
||||
TRY (ret_value = hdf5_flush (f->file, H5F_SCOPE_GLOBAL));
|
||||
H5_RETURN (ret_value);
|
||||
}
|
||||
@@ -652,15 +649,15 @@ h5_flush_file (
|
||||
/*!
|
||||
\ingroup h5_core_filehandling
|
||||
|
||||
Define format of the step names.
|
||||
Define format of the iteration names.
|
||||
|
||||
Example: ==H5FedDefineStepNameFormat( f, "Step", 6 )== defines step names
|
||||
like ==Step#000042==.
|
||||
Example: ==h5_set_iteration_name_fmt (f, "Step", 6)==
|
||||
defines iteration names like ==Step#000042==.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
h5_set_stepname_fmt (
|
||||
h5_set_iteration_name_fmt (
|
||||
const h5_file_t f_,
|
||||
const char* name,
|
||||
int width
|
||||
@@ -669,14 +666,14 @@ h5_set_stepname_fmt (
|
||||
H5_CORE_API_ENTER (h5_err_t,
|
||||
"f=%p, name='%s', width=%d",
|
||||
f, name, width);
|
||||
CHECK_FILEHANDLE (f);
|
||||
check_file_handle_is_valid (f);
|
||||
if (width < 0) width = 0;
|
||||
else if (width > H5_STEPNAME_LEN - 1) width = H5_STEPNAME_LEN - 1;
|
||||
else if (width > H5_ITERATION_NAME_LEN - 1) width = H5_ITERATION_NAME_LEN - 1;
|
||||
strncpy (
|
||||
f->props->prefix_step_name,
|
||||
f->props->prefix_iteration_name,
|
||||
name,
|
||||
H5_STEPNAME_LEN - 1);
|
||||
f->props->width_step_idx = width;
|
||||
H5_ITERATION_NAME_LEN - 1);
|
||||
f->props->width_iteration_idx = width;
|
||||
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
@@ -684,16 +681,16 @@ h5_set_stepname_fmt (
|
||||
/*!
|
||||
\ingroup h5_core_filehandling
|
||||
|
||||
Get format of the step names.
|
||||
Get format of the iteration names.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
h5_get_stepname_fmt (
|
||||
h5_get_iteration_name_fmt (
|
||||
const h5_file_t f_, /*!< Handle to file */
|
||||
char* const name, /*!< OUT: Prefix */
|
||||
const int l_name, /*!< length of buffer name */
|
||||
int* const 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);
|
||||
@@ -706,19 +703,18 @@ h5_get_stepname_fmt (
|
||||
/*!
|
||||
\ingroup h5_core_filehandling
|
||||
|
||||
Get current step number.
|
||||
Get current iteration number.
|
||||
|
||||
\return Current step number or error code
|
||||
\return Current iteration number or error code
|
||||
*/
|
||||
h5_id_t
|
||||
h5_get_step (
|
||||
h5_get_iteration (
|
||||
const h5_file_t f_ /*!< file handle */
|
||||
) {
|
||||
h5_file_p f = (h5_file_p)f_;
|
||||
H5_CORE_API_ENTER (h5_id_t, "f=%p", f);
|
||||
CHECK_FILEHANDLE (f);
|
||||
CHECK_TIMEGROUP (f);
|
||||
H5_RETURN (f->step_idx);
|
||||
check_iteration_is_readable (f);
|
||||
H5_RETURN (f->iteration_idx);
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -734,39 +730,39 @@ h5_get_num_procs (
|
||||
) {
|
||||
h5_file_p f = (h5_file_p)f_;
|
||||
H5_CORE_API_ENTER (int, "f=%p", f);
|
||||
CHECK_FILEHANDLE (f);
|
||||
check_file_handle_is_valid (f);
|
||||
H5_RETURN (f->nprocs);
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5_core_filehandling
|
||||
|
||||
Get number of steps.
|
||||
Get number of iterations.
|
||||
|
||||
\return Number of steps or error code
|
||||
\return Number of iterations or error code
|
||||
*/
|
||||
h5_ssize_t
|
||||
h5_get_num_steps(
|
||||
h5_get_num_iterations (
|
||||
const h5_file_t f_ /*!< file handle */
|
||||
) {
|
||||
h5_file_p f = (h5_file_p)f_;
|
||||
H5_CORE_API_ENTER (int, "f=%p", f);
|
||||
CHECK_FILEHANDLE (f);
|
||||
check_file_handle_is_valid (f);
|
||||
TRY (ret_value = hdf5_get_num_groups_matching_prefix (
|
||||
f->root_gid,
|
||||
f->props->prefix_step_name));
|
||||
f->props->prefix_iteration_name));
|
||||
H5_RETURN (ret_value);
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5_core_filehandling
|
||||
|
||||
Start traversing steps.
|
||||
Start traversing iterations.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
h5_start_traverse_steps (
|
||||
h5_start_traverse_iterations (
|
||||
const h5_file_t f_ /*!< file handle */
|
||||
) {
|
||||
h5_file_p f = (h5_file_p)f_;
|
||||
@@ -784,12 +780,12 @@ h5_start_traverse_steps (
|
||||
/*!
|
||||
\ingroup h5_core_filehandling
|
||||
|
||||
Go to next step.
|
||||
Go to next iteration.
|
||||
|
||||
\return \c H5_SUCCESS or error code
|
||||
*/
|
||||
h5_err_t
|
||||
h5_traverse_steps (
|
||||
h5_traverse_iterations (
|
||||
const h5_file_t f_ /*!< file handle */
|
||||
) {
|
||||
h5_file_p f = (h5_file_p)f_;
|
||||
|
||||
+8
-9
@@ -13,8 +13,8 @@
|
||||
extern int h5_myproc;
|
||||
|
||||
|
||||
h5_int64_t h5_log_level = H5_VERBOSE_ERROR;
|
||||
h5_int64_t h5_debug_mask = 0;
|
||||
h5_int64_t __h5_log_level = H5_VERBOSE_ERROR;
|
||||
h5_int64_t __h5_debug_mask = 0;
|
||||
|
||||
struct call_stack h5_call_stack;
|
||||
|
||||
@@ -65,7 +65,7 @@ h5_err_t
|
||||
h5_set_loglevel (
|
||||
const h5_int64_t level /*!< log level */
|
||||
) {
|
||||
h5_log_level = level & 0x7;
|
||||
__h5_log_level = level & 0x7;
|
||||
return H5_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -73,8 +73,7 @@ h5_err_t
|
||||
h5_set_debug_mask (
|
||||
const h5_int64_t mask /*!< debug level */
|
||||
) {
|
||||
h5_log_level = H5_VERBOSE_DEBUG;
|
||||
h5_debug_mask = mask;
|
||||
__h5_debug_mask = mask;
|
||||
return H5_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -89,7 +88,7 @@ h5_int64_t
|
||||
h5_get_loglevel (
|
||||
void
|
||||
) {
|
||||
return h5_log_level;
|
||||
return __h5_log_level;
|
||||
}
|
||||
|
||||
void
|
||||
@@ -111,7 +110,7 @@ h5_warn (
|
||||
const char* fmt,
|
||||
...
|
||||
) {
|
||||
if (h5_log_level >= 2) {
|
||||
if (__h5_log_level >= 2) {
|
||||
va_list ap;
|
||||
va_start (ap, fmt);
|
||||
h5priv_vprintf (stderr, "W", h5_get_funcname(), fmt, ap);
|
||||
@@ -125,7 +124,7 @@ h5_info (
|
||||
const char* fmt,
|
||||
...
|
||||
) {
|
||||
if (h5_log_level >= 3) {
|
||||
if (__h5_log_level >= 3) {
|
||||
va_list ap;
|
||||
va_start (ap, fmt);
|
||||
h5priv_vprintf (stdout, "I", h5_get_funcname(), fmt, ap);
|
||||
@@ -138,7 +137,7 @@ h5_debug (
|
||||
const char* const fmt,
|
||||
...
|
||||
) {
|
||||
if (h5_log_level >= 4) {
|
||||
if (__h5_log_level >= 4) {
|
||||
char prefix[1024];
|
||||
snprintf (prefix, sizeof(prefix), "%*s %s",
|
||||
h5_call_stack_get_level(), "",
|
||||
|
||||
+39
-39
@@ -15,94 +15,94 @@
|
||||
#include "private/h5_model.h"
|
||||
|
||||
h5_err_t
|
||||
h5priv_close_step (
|
||||
h5priv_close_iteration (
|
||||
const h5_file_p f
|
||||
) {
|
||||
H5_PRIV_API_ENTER (h5_err_t, "f=%p", f);
|
||||
if (f->step_gid <= 0)
|
||||
if (f->iteration_gid <= 0)
|
||||
H5_LEAVE (H5_SUCCESS);
|
||||
TRY (hdf5_close_group (f->step_gid));
|
||||
TRY (hdf5_close_group (f->iteration_gid));
|
||||
|
||||
f->step_gid = -1;
|
||||
f->iteration_gid = -1;
|
||||
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
h5_set_step (
|
||||
h5_set_iteration (
|
||||
const h5_file_t f_, /*!< [in] Handle to open file */
|
||||
const h5_id_t step_idx /*!< [in] Step to set. */
|
||||
const h5_id_t iteration_idx /*!< [in] Iteration to set. */
|
||||
) {
|
||||
h5_file_p f = (h5_file_p)f_;
|
||||
H5_CORE_API_ENTER (h5_err_t,
|
||||
"f=%p, step_idx=%lld",
|
||||
f, (long long)step_idx);
|
||||
"f=%p, iteration_idx=%lld",
|
||||
f, (long long)iteration_idx);
|
||||
CHECK_FILEHANDLE (f);
|
||||
TRY (h5priv_close_step (f));
|
||||
f->step_idx = step_idx;
|
||||
TRY (h5priv_close_iteration (f));
|
||||
f->iteration_idx = iteration_idx;
|
||||
|
||||
sprintf (
|
||||
f->step_name,
|
||||
f->iteration_name,
|
||||
"%s#%0*lld",
|
||||
f->props->prefix_step_name, f->props->width_step_idx,
|
||||
(long long) f->step_idx);
|
||||
f->props->prefix_iteration_name, f->props->width_iteration_idx,
|
||||
(long long) f->iteration_idx);
|
||||
h5_info (
|
||||
"Open step #%lld for file %lld",
|
||||
(long long)f->step_idx,
|
||||
"Open iteration #%lld in file %lld",
|
||||
(long long)f->iteration_idx,
|
||||
(long long)(size_t) f);
|
||||
|
||||
h5_err_t exists;
|
||||
TRY (exists = hdf5_link_exists (f->file, f->step_name));
|
||||
TRY (exists = hdf5_link_exists (f->file, f->iteration_name));
|
||||
if (exists) {
|
||||
TRY (f->step_gid = h5priv_open_group (
|
||||
TRY (f->iteration_gid = h5priv_open_group (
|
||||
f->file,
|
||||
f->step_name));
|
||||
f->iteration_name));
|
||||
} else if (is_writable (f)) {
|
||||
TRY (f->step_gid = h5priv_create_group (
|
||||
TRY (f->iteration_gid = h5priv_create_group (
|
||||
f->file,
|
||||
f->step_name));
|
||||
f->iteration_name));
|
||||
}
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
/*
|
||||
returns:
|
||||
TRUE (value > 0): if step exists
|
||||
FALSE (i.e. 0): if step does not exist
|
||||
TRUE (value > 0): if iteration exists
|
||||
FALSE (i.e. 0): if iteration does not exist
|
||||
H5_FAILURE: on error
|
||||
*/
|
||||
h5_err_t
|
||||
h5_has_step (
|
||||
h5_has_iteration (
|
||||
const h5_file_t f_, /*!< [in] Handle to open file */
|
||||
const h5_id_t step_idx /*!< [in] Step number to query */
|
||||
const h5_id_t iteration_idx /*!< [in] Step number to query */
|
||||
) {
|
||||
h5_file_p f = (h5_file_p)f_;
|
||||
H5_CORE_API_ENTER (h5_err_t, "f=%p, step_idx=%lld", f, (long long)step_idx);
|
||||
H5_CORE_API_ENTER (h5_err_t,
|
||||
"f=%p, iteration_idx=%lld",
|
||||
f, (long long)iteration_idx);
|
||||
CHECK_FILEHANDLE (f);
|
||||
char name[2*H5_STEPNAME_LEN];
|
||||
char name[2*H5_ITERATION_NAME_LEN];
|
||||
sprintf (name,
|
||||
"%s#%0*lld",
|
||||
f->props->prefix_step_name, f->props->width_step_idx,
|
||||
(long long)step_idx);
|
||||
f->props->prefix_iteration_name, f->props->width_iteration_idx,
|
||||
(long long)iteration_idx);
|
||||
TRY (ret_value = hdf5_link_exists (f->file, name));
|
||||
H5_RETURN (ret_value);
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
h5priv_normalize_dataset_name (
|
||||
const char *name,
|
||||
char *name2
|
||||
char* const name
|
||||
) {
|
||||
H5_CORE_API_ENTER (h5_err_t, "name='%s', name2='%p'", name, name2);
|
||||
if ( strlen(name) > H5_DATANAME_LEN-1 ) {
|
||||
strncpy ( name2, name, H5_DATANAME_LEN-1 );
|
||||
name2[H5_DATANAME_LEN-1] = '\0';
|
||||
h5_warn ("Truncated name '%s' to '%s'.", name, name2);
|
||||
} else {
|
||||
strcpy (name2, name);
|
||||
H5_CORE_API_ENTER (h5_err_t, "name='%s'", name);
|
||||
if (strlen(name) > H5_DATANAME_LEN-1) {
|
||||
H5_RETURN_ERROR (
|
||||
H5_ERR_INVAL,
|
||||
"Dataset name '%s' to long! "
|
||||
"Must be less then %d characters.",
|
||||
name, H5_DATANAME_LEN);
|
||||
}
|
||||
|
||||
if ( strcmp( name2, H5BLOCK_GROUPNAME_BLOCK ) == 0 ) {
|
||||
if (strcmp (name, H5BLOCK_GROUPNAME_BLOCK) == 0) {
|
||||
H5_RETURN_ERROR (
|
||||
H5_ERR_INVAL,
|
||||
"Can't create dataset or field with name '%s'"
|
||||
|
||||
@@ -33,9 +33,7 @@ h5b_write_field_attrib (
|
||||
(long long int)attrib_type,
|
||||
attrib_value,
|
||||
(long long)attrib_nelem);
|
||||
CHECK_FILEHANDLE (f);
|
||||
CHECK_WRITABLE_MODE (f);
|
||||
CHECK_TIMEGROUP (f);
|
||||
check_iteration_is_writable (f);
|
||||
|
||||
TRY( h5bpriv_create_field_group(f, field_name) );
|
||||
if (is_appendonly (f)) {
|
||||
@@ -74,8 +72,7 @@ h5b_read_field_attrib (
|
||||
attrib_name,
|
||||
(long long)attrib_type,
|
||||
buffer);
|
||||
CHECK_FILEHANDLE (f);
|
||||
CHECK_TIMEGROUP (f);
|
||||
check_iteration_is_readable (f);
|
||||
|
||||
TRY (h5bpriv_open_field_group(f, field_name));
|
||||
|
||||
@@ -102,8 +99,7 @@ h5b_has_field_attrib (
|
||||
f,
|
||||
field_name,
|
||||
attrib_name);
|
||||
CHECK_FILEHANDLE (f);
|
||||
CHECK_TIMEGROUP (f);
|
||||
check_iteration_handle_is_valid (f);
|
||||
|
||||
TRY (h5bpriv_open_field_group(f, field_name));
|
||||
|
||||
@@ -120,8 +116,7 @@ h5b_get_num_field_attribs (
|
||||
) {
|
||||
h5_file_p f = (h5_file_p)fh;
|
||||
H5_CORE_API_ENTER (h5_err_t, "f=%p field_name='%s'", f, field_name);
|
||||
CHECK_FILEHANDLE (f);
|
||||
CHECK_TIMEGROUP (f);
|
||||
check_iteration_handle_is_valid (f);
|
||||
|
||||
TRY (h5bpriv_open_field_group(f, field_name));
|
||||
|
||||
@@ -151,8 +146,7 @@ h5b_get_field_attrib_info_by_idx (
|
||||
(long long unsigned)attrib_idx,
|
||||
attrib_name, (long long unsigned)len_attrib_name,
|
||||
attrib_type, attrib_nelem);
|
||||
CHECK_FILEHANDLE (f);
|
||||
CHECK_TIMEGROUP (f);
|
||||
check_iteration_handle_is_valid (f);
|
||||
TRY (h5bpriv_open_field_group(f, field_name));
|
||||
TRY (ret_value = h5priv_get_attrib_info_by_idx (
|
||||
f->b->field_gid,
|
||||
@@ -180,8 +174,7 @@ h5b_get_field_attrib_info_by_name (
|
||||
field_name,
|
||||
attrib_name,
|
||||
attrib_type, attrib_nelem);
|
||||
CHECK_FILEHANDLE (f);
|
||||
CHECK_TIMEGROUP (f);
|
||||
check_iteration_handle_is_valid (f);
|
||||
TRY (h5bpriv_open_field_group(f, field_name));
|
||||
TRY (ret_value = h5priv_get_attrib_info_by_name (
|
||||
f->b->field_gid,
|
||||
@@ -248,8 +241,7 @@ h5b_set_3d_field_coords (
|
||||
field_name,
|
||||
attrib_name,
|
||||
coords, (long long unsigned)n_coords);
|
||||
CHECK_FILEHANDLE (f);
|
||||
CHECK_TIMEGROUP (f);
|
||||
check_iteration_is_writable (f);
|
||||
|
||||
TRY (check_coords (f, rank, n_coords));
|
||||
TRY (h5b_write_field_attrib (
|
||||
@@ -284,8 +276,8 @@ h5b_get_3d_field_coords (
|
||||
field_name,
|
||||
attrib_name,
|
||||
coords, (long long unsigned)n_coords);
|
||||
CHECK_FILEHANDLE (f);
|
||||
CHECK_TIMEGROUP (f);
|
||||
|
||||
check_iteration_is_readable (f);
|
||||
|
||||
TRY (check_coords (f, rank, n_coords));
|
||||
TRY (h5b_read_field_attrib (
|
||||
|
||||
+4
-10
@@ -256,9 +256,7 @@ h5b_write_scalar_data (
|
||||
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_FILEHANDLE (f);
|
||||
CHECK_WRITABLE_MODE (f);
|
||||
CHECK_TIMEGROUP (f);
|
||||
check_iteration_is_writable (f);
|
||||
CHECK_LAYOUT (f);
|
||||
|
||||
TRY (h5bpriv_create_field_group (f, field_name));
|
||||
@@ -285,9 +283,7 @@ h5b_write_vector3d_data (
|
||||
"zdata=%p, "
|
||||
"type=%lld",
|
||||
f, field_name, xdata, ydata, zdata, (long long int)type);
|
||||
CHECK_FILEHANDLE (f);
|
||||
CHECK_WRITABLE_MODE (f);
|
||||
CHECK_TIMEGROUP (f);
|
||||
check_iteration_is_writable (f);
|
||||
CHECK_LAYOUT (f);
|
||||
|
||||
TRY (h5bpriv_create_field_group(f, field_name));
|
||||
@@ -430,8 +426,7 @@ h5b_read_scalar_data (
|
||||
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_FILEHANDLE (f);
|
||||
CHECK_TIMEGROUP (f);
|
||||
check_iteration_is_readable (f);
|
||||
CHECK_LAYOUT (f);
|
||||
|
||||
TRY (h5bpriv_open_field_group(f, field_name));
|
||||
@@ -457,8 +452,7 @@ h5b_read_vector3d_data (
|
||||
"zdata=%p, "
|
||||
"type=%lld",
|
||||
f, field_name, xdata, ydata, zdata, (long long int)type);
|
||||
CHECK_FILEHANDLE (f);
|
||||
CHECK_TIMEGROUP (f);
|
||||
check_iteration_is_readable (f);
|
||||
CHECK_LAYOUT (f);
|
||||
|
||||
TRY (h5bpriv_open_field_group(f, field_name));
|
||||
|
||||
+41
-58
@@ -41,9 +41,8 @@ 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);
|
||||
CHECK_TIMEGROUP (f);
|
||||
TRY (ret_value = hdf5_link_exists (f->step_gid, H5BLOCK_GROUPNAME_BLOCK));
|
||||
check_iteration_handle_is_valid (f);
|
||||
TRY (ret_value = hdf5_link_exists (f->iteration_gid, H5BLOCK_GROUPNAME_BLOCK));
|
||||
H5_RETURN (ret_value);
|
||||
}
|
||||
|
||||
@@ -453,12 +452,12 @@ h5bpriv_open_block_group (
|
||||
h5b_fdata_t *b = f->b;
|
||||
|
||||
TRY (hdf5_close_group (b->block_gid));
|
||||
b->block_gid = hdf5_open_group (f->step_gid, H5BLOCK_GROUPNAME_BLOCK);
|
||||
b->block_gid = hdf5_open_group (f->iteration_gid, H5BLOCK_GROUPNAME_BLOCK);
|
||||
if (f->b->block_gid < 0)
|
||||
H5_RETURN_ERROR (
|
||||
H5_ERR_INVAL,
|
||||
"%s",
|
||||
"Time step does not contain H5Block data!");
|
||||
"step/iteration does not contain H5Block data!");
|
||||
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
@@ -469,14 +468,14 @@ _create_block_group (
|
||||
) {
|
||||
H5_PRIV_FUNC_ENTER (h5_err_t, "f=%p", f);
|
||||
h5_err_t exists;
|
||||
TRY (exists = hdf5_link_exists (f->step_gid, H5BLOCK_GROUPNAME_BLOCK));
|
||||
TRY (exists = hdf5_link_exists (f->iteration_gid, H5BLOCK_GROUPNAME_BLOCK));
|
||||
|
||||
if (exists > 0) {
|
||||
TRY (h5bpriv_open_block_group(f));
|
||||
} else {
|
||||
TRY (hdf5_close_group(f->b->block_gid) );
|
||||
TRY (f->b->block_gid = hdf5_create_group(
|
||||
f->step_gid, H5BLOCK_GROUPNAME_BLOCK) );
|
||||
f->iteration_gid, H5BLOCK_GROUPNAME_BLOCK) );
|
||||
}
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
@@ -484,19 +483,18 @@ _create_block_group (
|
||||
h5_err_t
|
||||
h5bpriv_open_field_group (
|
||||
const h5_file_p f, /*!< IN: file handle */
|
||||
const char *name
|
||||
char* const name
|
||||
) {
|
||||
H5_PRIV_API_ENTER (h5_err_t, "f=%p, name='%s'", f, name);
|
||||
char name2[H5_DATANAME_LEN];
|
||||
h5priv_normalize_dataset_name (name, name2);
|
||||
h5priv_normalize_dataset_name (name);
|
||||
|
||||
TRY (hdf5_close_group (f->b->field_gid));
|
||||
TRY (h5bpriv_open_block_group (f));
|
||||
f->b->field_gid = hdf5_open_group (f->b->block_gid, name2);
|
||||
f->b->field_gid = hdf5_open_group (f->b->block_gid, name);
|
||||
if (f->b->field_gid < 0)
|
||||
return h5_error(
|
||||
H5_ERR_INVAL,
|
||||
"Field '%s' does not exist!", name2);
|
||||
"Field '%s' does not exist!", name);
|
||||
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
@@ -504,24 +502,23 @@ h5bpriv_open_field_group (
|
||||
h5_err_t
|
||||
h5bpriv_create_field_group (
|
||||
const h5_file_p f, /*!< IN: file handle */
|
||||
const char *name /*!< IN: name of field group to create */
|
||||
char* const name /*!< IN: name of field group to create */
|
||||
) {
|
||||
H5_PRIV_API_ENTER (h5_err_t, "f=%p, name='%s'", f, name);
|
||||
h5b_fdata_t *b = f->b;
|
||||
|
||||
TRY( _create_block_group(f) );
|
||||
|
||||
char name2[H5_DATANAME_LEN];
|
||||
h5priv_normalize_dataset_name (name, name2);
|
||||
h5priv_normalize_dataset_name (name);
|
||||
|
||||
h5_err_t exists;
|
||||
TRY (exists = hdf5_link_exists ( b->block_gid, name2));
|
||||
TRY (exists = hdf5_link_exists ( b->block_gid, name));
|
||||
|
||||
if (exists > 0) {
|
||||
TRY (h5bpriv_open_field_group (f, name2));
|
||||
TRY (h5bpriv_open_field_group (f, name));
|
||||
} else {
|
||||
TRY (hdf5_close_group (f->b->field_gid) );
|
||||
TRY (b->field_gid = hdf5_create_group (b->block_gid, name2));
|
||||
TRY (b->field_gid = hdf5_create_group (b->block_gid, name));
|
||||
}
|
||||
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
@@ -535,8 +532,7 @@ h5b_3d_has_view (
|
||||
H5_CORE_API_ENTER (h5_err_t,
|
||||
"f=%p, ",
|
||||
f);
|
||||
CHECK_FILEHANDLE (f);
|
||||
CHECK_TIMEGROUP (f);
|
||||
check_iteration_handle_is_valid (f);
|
||||
H5_RETURN (((h5_file_p)fh)->b->have_layout > 0);
|
||||
}
|
||||
|
||||
@@ -560,8 +556,7 @@ 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);
|
||||
check_iteration_handle_is_valid (f);
|
||||
h5b_fdata_t *b = f->b;
|
||||
b->user_layout[0].i_start = i_start;
|
||||
b->user_layout[0].i_end = i_end;
|
||||
@@ -642,8 +637,7 @@ h5b_3d_get_view (
|
||||
i_start, i_end,
|
||||
j_start, j_end,
|
||||
k_start, k_end);
|
||||
CHECK_FILEHANDLE (f);
|
||||
CHECK_TIMEGROUP (f);
|
||||
check_iteration_handle_is_valid (f);
|
||||
h5b_partition_t *p = f->b->user_layout;
|
||||
|
||||
*i_start = p->i_start;
|
||||
@@ -676,8 +670,7 @@ h5b_3d_get_reduced_view (
|
||||
i_start, i_end,
|
||||
j_start, j_end,
|
||||
k_start, k_end);
|
||||
CHECK_FILEHANDLE (f);
|
||||
CHECK_TIMEGROUP (f);
|
||||
check_iteration_handle_is_valid (f);
|
||||
h5b_partition_t *p = f->b->write_layout;
|
||||
|
||||
*i_start = p->i_start;
|
||||
@@ -704,8 +697,7 @@ h5b_3d_set_chunk (
|
||||
(long long unsigned)i,
|
||||
(long long unsigned)j,
|
||||
(long long unsigned)k);
|
||||
CHECK_FILEHANDLE (f);
|
||||
CHECK_TIMEGROUP (f);
|
||||
check_iteration_handle_is_valid (f);
|
||||
if ( i == 0 || j == 0 || k == 0 )
|
||||
{
|
||||
h5_info ("Disabling chunking" );
|
||||
@@ -724,21 +716,20 @@ h5b_3d_set_chunk (
|
||||
h5_err_t
|
||||
h5b_3d_get_chunk (
|
||||
const h5_file_t fh, /*!< IN: File handle */
|
||||
const char *field_name, /*!< IN: name of dataset */
|
||||
h5_size_t *const i, /*!< OUT: size of \c i */
|
||||
h5_size_t *const j, /*!< OUT: size of \c j */
|
||||
h5_size_t *const k /*!< OUT: size of \c k */
|
||||
char* const field_name, /*!< IN: name of dataset */
|
||||
h5_size_t* const i, /*!< OUT: size of \c i */
|
||||
h5_size_t* const j, /*!< OUT: size of \c j */
|
||||
h5_size_t* const k /*!< OUT: size of \c k */
|
||||
) {
|
||||
h5_file_p f = (h5_file_p)fh;
|
||||
H5_CORE_API_ENTER (h5_err_t,
|
||||
"f=%p, i=%p, j=%p, k=%p",
|
||||
f, i, j, k);
|
||||
CHECK_FILEHANDLE (f);
|
||||
CHECK_TIMEGROUP (f);
|
||||
check_iteration_handle_is_valid (f);
|
||||
|
||||
h5b_fdata_t *b = f->b;
|
||||
|
||||
TRY( h5bpriv_open_field_group ( f, field_name ) );
|
||||
TRY (h5bpriv_open_field_group (f, field_name));
|
||||
|
||||
hid_t dataset_id;
|
||||
hid_t plist_id;
|
||||
@@ -776,8 +767,7 @@ h5b_3d_set_grid (
|
||||
(long long unsigned)i,
|
||||
(long long unsigned)j,
|
||||
(long long unsigned)k);
|
||||
CHECK_FILEHANDLE (f);
|
||||
CHECK_TIMEGROUP (f);
|
||||
check_iteration_handle_is_valid (f);
|
||||
if (i*j*k != f->nprocs) {
|
||||
H5_RETURN_ERROR (
|
||||
H5_ERR_INVAL,
|
||||
@@ -817,8 +807,7 @@ 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);
|
||||
check_iteration_handle_is_valid (f);
|
||||
if ( !f->b->have_grid )
|
||||
H5_RETURN_ERROR (
|
||||
H5_ERR_INVAL,
|
||||
@@ -852,8 +841,7 @@ h5b_3d_set_dims (
|
||||
(long long unsigned)i,
|
||||
(long long unsigned)j,
|
||||
(long long unsigned)k);
|
||||
CHECK_FILEHANDLE (f);
|
||||
CHECK_TIMEGROUP (f);
|
||||
check_iteration_handle_is_valid (f);
|
||||
if ( !f->b->have_grid )
|
||||
H5_RETURN_ERROR (
|
||||
H5_ERR_INVAL,
|
||||
@@ -924,8 +912,7 @@ h5b_3d_set_halo (
|
||||
(long long unsigned)j,
|
||||
(long long unsigned)k);
|
||||
|
||||
CHECK_FILEHANDLE (f);
|
||||
CHECK_TIMEGROUP (f);
|
||||
check_iteration_handle_is_valid (f);
|
||||
if ( !f->b->have_grid ) {
|
||||
H5_RETURN_ERROR (
|
||||
H5_ERR_INVAL,
|
||||
@@ -955,8 +942,7 @@ h5b_get_num_fields (
|
||||
) {
|
||||
h5_file_p f = (h5_file_p)fh;
|
||||
H5_CORE_API_ENTER (h5_ssize_t, "f=%p", f);
|
||||
CHECK_FILEHANDLE (f);
|
||||
CHECK_TIMEGROUP (f);
|
||||
check_iteration_handle_is_valid (f);
|
||||
|
||||
TRY (h5bpriv_open_block_group(f));
|
||||
TRY (ret_value = hdf5_get_num_objs_in_group (f->b->block_gid));
|
||||
@@ -972,35 +958,33 @@ h5b_has_field (
|
||||
H5_CORE_API_ENTER (h5_err_t,
|
||||
"f=%p, name='%s'",
|
||||
f, name);
|
||||
CHECK_FILEHANDLE (f);
|
||||
CHECK_TIMEGROUP (f);
|
||||
check_iteration_handle_is_valid (f);
|
||||
|
||||
const char* path[] = { H5BLOCK_GROUPNAME_BLOCK, name };
|
||||
TRY (ret_value = h5priv_link_exists_(f->step_gid, path, 2));
|
||||
TRY (ret_value = h5priv_link_exists_(f->iteration_gid, path, 2));
|
||||
H5_RETURN (ret_value);
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
h5b_get_field_info_by_name (
|
||||
const h5_file_t fh, /*!< IN: file handle */
|
||||
const char *name, /*!< IN: field name */
|
||||
h5_size_t *field_rank, /*!< OUT: field rank */
|
||||
h5_size_t *field_dims, /*!< OUT: field dimensions */
|
||||
h5_size_t *elem_rank, /*!< OUT: element rank */
|
||||
h5_int64_t *type /*!< OUT: datatype */
|
||||
char* const name, /*!< IN: field name */
|
||||
h5_size_t* field_rank, /*!< OUT: field rank */
|
||||
h5_size_t* field_dims, /*!< OUT: field dimensions */
|
||||
h5_size_t* elem_rank, /*!< OUT: element rank */
|
||||
h5_int64_t* type /*!< OUT: datatype */
|
||||
) {
|
||||
h5_file_p f = (h5_file_p)fh;
|
||||
H5_CORE_API_ENTER (h5_err_t,
|
||||
"f=%p, name='%s', "
|
||||
"field_rank=%p, field_dims=%p, elem_rank=%p, type=%p",
|
||||
f, name, field_rank, field_dims, elem_rank, type);
|
||||
CHECK_FILEHANDLE (f);
|
||||
CHECK_TIMEGROUP (f);
|
||||
check_iteration_handle_is_valid (f);
|
||||
|
||||
/* give it plenty of space even though we don't expect rank > 3 */
|
||||
hsize_t dims[16];
|
||||
|
||||
TRY( h5bpriv_open_field_group(f, name) );
|
||||
TRY (h5bpriv_open_field_group (f, name));
|
||||
|
||||
hid_t dataset_id;
|
||||
hid_t dataspace_id;
|
||||
@@ -1054,8 +1038,7 @@ h5b_get_field_info (
|
||||
(long long unsigned)idx,
|
||||
name, (long long unsigned)len_name,
|
||||
field_rank, field_dims, elem_rank, type);
|
||||
CHECK_FILEHANDLE (f);
|
||||
CHECK_TIMEGROUP (f);
|
||||
check_iteration_handle_is_valid (f);
|
||||
|
||||
TRY (h5bpriv_open_block_group(f));
|
||||
TRY (hdf5_get_objname_by_idx(
|
||||
|
||||
+6
-6
@@ -2002,7 +2002,7 @@ distribute_octree_parmetis (
|
||||
TRY (vtxdist = h5_calloc (m->f->nprocs+1, sizeof (*vtxdist)));
|
||||
vtxdist[0] = 0;
|
||||
#if !defined(NDEBUG)
|
||||
if (h5_debug_mask & (1<<5) ) {
|
||||
if (__h5_debug_mask & (1<<5) ) {
|
||||
h5_debug ("vtxdist[%d]: %d", 0, 0);
|
||||
}
|
||||
#endif
|
||||
@@ -2014,7 +2014,7 @@ distribute_octree_parmetis (
|
||||
vtxdist[i] = vtxdist[i-1] + n;
|
||||
}
|
||||
#if !defined(NDEBUG)
|
||||
if (h5_debug_mask & (1<<5) ) {
|
||||
if (__h5_debug_mask & (1<<5) ) {
|
||||
h5_debug ("vtxdist[%d]: %d", i, vtxdist[i]);
|
||||
}
|
||||
#endif
|
||||
@@ -2060,7 +2060,7 @@ distribute_octree_parmetis (
|
||||
}
|
||||
xadj[i+1] = xadj[i] + num_neigh;
|
||||
#if !defined(NDEBUG)
|
||||
if (h5_debug_mask & (1<<5) ) {
|
||||
if (__h5_debug_mask & (1<<5) ) {
|
||||
h5_debug ("xadj[%d]: %d", i+1, xadj[i+1]);
|
||||
}
|
||||
#endif
|
||||
@@ -2070,7 +2070,7 @@ distribute_octree_parmetis (
|
||||
if (new_numbering[j] == neighbors[k]) {
|
||||
adjncy[counter] = j;
|
||||
#if !defined(NDEBUG)
|
||||
if (h5_debug_mask & (1<<5) ) {
|
||||
if (__h5_debug_mask & (1<<5) ) {
|
||||
h5_debug ("adjncy[%d]: %d", counter, adjncy[counter]);
|
||||
}
|
||||
#endif
|
||||
@@ -2139,7 +2139,7 @@ distribute_octree_parmetis (
|
||||
TRY (h5_free (ubvec));
|
||||
|
||||
#if !defined(NDEBUG)
|
||||
if (h5_debug_mask & (1<<5) ) {
|
||||
if (__h5_debug_mask & (1<<5) ) {
|
||||
for (i = 0; i < num_interior_oct; i++) {
|
||||
h5_debug ("part[%d]: %llu", i, (unsigned long long)part[i]);
|
||||
}
|
||||
@@ -2498,7 +2498,7 @@ read_chunked_elements (
|
||||
|
||||
|
||||
#if NDEBUG == 0
|
||||
if (h5_debug_mask & (1<<6) ) {
|
||||
if (__h5_debug_mask & (1<<6) ) {
|
||||
sleep (m->f->myproc*2);
|
||||
for (int i = 0; i < num_interior_elems;i++) {
|
||||
h5_debug ("\n"
|
||||
|
||||
+95
-75
@@ -76,9 +76,9 @@ h5upriv_close_file (
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
h5u_read_data (
|
||||
h5u_read_dataset (
|
||||
const h5_file_t fh, /*!< [in] Handle to open file */
|
||||
const char* name, /*!< [in] Name to associate dataset with */
|
||||
char* const name, /*!< [in] Name to associate dataset with */
|
||||
void* data, /*!< [out] Array of data */
|
||||
const h5_types_t type
|
||||
) {
|
||||
@@ -86,36 +86,30 @@ h5u_read_data (
|
||||
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);
|
||||
check_iteration_is_readable (f);
|
||||
|
||||
TRY (h5priv_normalize_dataset_name (name));
|
||||
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;
|
||||
hid_t memspace_id;
|
||||
hsize_t ndisk, nread, nmem;
|
||||
|
||||
if ( f->step_gid < 0 ) {
|
||||
TRY (h5_set_step ((h5_file_t)f, f->step_idx));
|
||||
if ( f->iteration_gid < 0 ) {
|
||||
TRY (h5_set_iteration ((h5_file_t)f, f->iteration_idx));
|
||||
}
|
||||
|
||||
char name2[H5_DATANAME_LEN];
|
||||
TRY (h5priv_normalize_dataset_name (name, name2));
|
||||
|
||||
TRY (dataset_id = hdf5_open_dataset_by_name (f->step_gid, name2));
|
||||
hid_t dataset_id;
|
||||
TRY (dataset_id = hdf5_open_dataset_by_name (f->iteration_gid, name));
|
||||
|
||||
|
||||
/* default spaces, if not using a view selection */
|
||||
memspace_id = H5S_ALL;
|
||||
hid_t memspace_id = H5S_ALL;
|
||||
hid_t space_id;
|
||||
TRY (space_id = hdf5_get_dataset_space (dataset_id));
|
||||
|
||||
/* get the number of elements on disk for the datset */
|
||||
hsize_t ndisk;
|
||||
TRY (ndisk = hdf5_get_npoints_of_dataspace (space_id));
|
||||
|
||||
if (u->diskshape != H5S_ALL) {
|
||||
TRY (nread = hdf5_get_selected_npoints_of_dataspace (u->diskshape));
|
||||
hsize_t nread;
|
||||
if (f->u->diskshape != H5S_ALL) {
|
||||
TRY (nread = hdf5_get_selected_npoints_of_dataspace (f->u->diskshape));
|
||||
|
||||
/* make sure the disk space selected by the view doesn't
|
||||
* exceed the size of the dataset */
|
||||
@@ -131,7 +125,7 @@ h5u_read_data (
|
||||
"Ignoring view: dataset[%s] has fewer "
|
||||
"elements on disk (%lld) than are selected "
|
||||
"(%lld).",
|
||||
name2, (long long)ndisk, (long long)nread );
|
||||
name, (long long)ndisk, (long long)nread );
|
||||
nread = ndisk;
|
||||
}
|
||||
} else {
|
||||
@@ -140,8 +134,9 @@ h5u_read_data (
|
||||
nread = ndisk;
|
||||
}
|
||||
|
||||
if (u->memshape != H5S_ALL) {
|
||||
TRY (nmem = hdf5_get_npoints_of_dataspace (u->memshape));
|
||||
if (f->u->memshape != H5S_ALL) {
|
||||
hid_t nmem;
|
||||
TRY (nmem = hdf5_get_npoints_of_dataspace (f->u->memshape));
|
||||
|
||||
/* make sure the memory space selected by the view has
|
||||
* enough capacity for the read */
|
||||
@@ -154,7 +149,7 @@ h5u_read_data (
|
||||
"Ignoring view: dataset[%s] has more "
|
||||
"elements selected (%lld) than are available "
|
||||
"in memory (%lld).",
|
||||
name2, (long long)nread, (long long)nmem );
|
||||
name, (long long)nread, (long long)nmem );
|
||||
memspace_id = H5S_ALL;
|
||||
}
|
||||
}
|
||||
@@ -177,63 +172,88 @@ h5u_read_data (
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
h5u_write_data (
|
||||
h5u_write (
|
||||
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 */
|
||||
hid_t dset_id,
|
||||
hid_t type,
|
||||
const void* data
|
||||
) {
|
||||
h5_file_p f = (h5_file_p)fh;
|
||||
H5_CORE_API_ENTER (h5_err_t,
|
||||
"f=%p, dset_id=%lld, type=%lld, data=%p",
|
||||
f, (long long)dset_id, (long long int)type, data);
|
||||
TRY (h5priv_start_throttle (f));
|
||||
hid_t hdf5_type;
|
||||
TRY (hdf5_type = h5priv_map_enum_to_normalized_type (type));
|
||||
TRY (hdf5_write_dataset (
|
||||
dset_id,
|
||||
hdf5_type,
|
||||
f->u->memshape,
|
||||
f->u->diskshape,
|
||||
f->props->xfer_prop,
|
||||
data));
|
||||
TRY (h5priv_end_throttle (f));
|
||||
f->empty = 0;
|
||||
if (f->props->flush) {
|
||||
TRY (hdf5_flush (f->iteration_gid, H5F_SCOPE_LOCAL));
|
||||
}
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
hid_t
|
||||
h5u_open_dataset (
|
||||
const h5_file_t fh, /*!< IN: Handle to open file */
|
||||
char* const name, /*!< IN: Name to associate array with */
|
||||
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', type=%lld",
|
||||
f, name, (long long int)type);
|
||||
check_iteration_handle_is_valid (f);
|
||||
|
||||
TRY (h5priv_normalize_dataset_name (name));
|
||||
hid_t hdf5_type;
|
||||
TRY (hdf5_type = h5priv_map_enum_to_normalized_type (type));
|
||||
if ( f->iteration_gid < 0 ) {
|
||||
TRY (h5_set_iteration ((h5_file_t)f, f->iteration_idx));
|
||||
}
|
||||
|
||||
if (f->u->shape == H5S_ALL )
|
||||
h5_warn("The view is unset or invalid.");
|
||||
|
||||
hid_t dset_id;
|
||||
H5E_BEGIN_TRY
|
||||
dset_id = H5Dopen(f->iteration_gid, name, H5P_DEFAULT);
|
||||
H5E_END_TRY
|
||||
|
||||
if (dset_id > 0) {
|
||||
h5_warn("Dataset %s/%s already exists",
|
||||
hdf5_get_objname (f->iteration_gid), name);
|
||||
} else {
|
||||
TRY (dset_id = hdf5_create_dataset (
|
||||
f->iteration_gid,
|
||||
name,
|
||||
hdf5_type,
|
||||
f->u->shape,
|
||||
H5P_DEFAULT));
|
||||
}
|
||||
H5_RETURN (dset_id);
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
h5u_write_dataset (
|
||||
const h5_file_t fh, /*!< IN: Handle to open file */
|
||||
char* const name, /*!< IN: Name to associate array with */
|
||||
const void* data, /*!< IN: Array to commit to disk */
|
||||
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_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;
|
||||
|
||||
char name2[H5_DATANAME_LEN];
|
||||
TRY (h5priv_normalize_dataset_name (name, name2));
|
||||
|
||||
if ( u->shape == H5S_ALL )
|
||||
h5_warn("The view is unset or invalid.");
|
||||
|
||||
/* test for existing dataset */
|
||||
H5E_BEGIN_TRY
|
||||
dset_id = H5Dopen(f->step_gid, name2, H5P_DEFAULT);
|
||||
H5E_END_TRY
|
||||
|
||||
if (dset_id > 0) {
|
||||
h5_warn("Dataset %s/%s already exists",
|
||||
hdf5_get_objname(f->step_gid), name2);
|
||||
} else {
|
||||
TRY (dset_id = hdf5_create_dataset (
|
||||
f->step_gid,
|
||||
name2,
|
||||
hdf5_type,
|
||||
u->shape,
|
||||
H5P_DEFAULT));
|
||||
}
|
||||
|
||||
TRY (h5priv_start_throttle (f));
|
||||
h5_info ("Writing dataset %s/%s.",
|
||||
hdf5_get_objname(f->step_gid), name2);
|
||||
TRY (hdf5_write_dataset (
|
||||
dset_id,
|
||||
hdf5_type,
|
||||
u->memshape,
|
||||
u->diskshape,
|
||||
f->props->xfer_prop,
|
||||
data));
|
||||
TRY (h5priv_end_throttle (f));
|
||||
TRY (hdf5_close_dataset (dset_id));
|
||||
|
||||
f->empty = 0;
|
||||
TRY (hdf5_flush (f->step_gid, H5F_SCOPE_LOCAL));
|
||||
|
||||
TRY (dset_id = h5u_open_dataset (fh, name, type));
|
||||
TRY (h5u_write (fh, dset_id, type, data));
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
|
||||
+56
-98
@@ -22,21 +22,20 @@
|
||||
#include <string.h>
|
||||
|
||||
h5_ssize_t
|
||||
h5u_get_num_points (
|
||||
h5u_get_num_items (
|
||||
const h5_file_t fh /*!< [in] Handle to open file */
|
||||
) {
|
||||
h5_file_p f = (h5_file_p)fh;
|
||||
H5_CORE_API_ENTER (h5_ssize_t, "f=%p", f);
|
||||
CHECK_FILEHANDLE (f);
|
||||
CHECK_TIMEGROUP (f);
|
||||
check_iteration_handle_is_valid (f);
|
||||
h5_ssize_t nparticles;
|
||||
|
||||
if (h5u_has_view ((h5_file_t)f)) {
|
||||
/* if a view exists, use its size as the number of particles */
|
||||
TRY (nparticles = h5u_get_num_points_in_view (fh));
|
||||
TRY (nparticles = h5u_get_num_items_in_view (fh));
|
||||
} else {
|
||||
/* otherwise, report all particles on disk in the first dataset
|
||||
for this timestep */
|
||||
for this iteration */
|
||||
TRY (nparticles = h5u_get_totalnum_particles_by_idx (fh, 0));
|
||||
}
|
||||
|
||||
@@ -44,13 +43,12 @@ h5u_get_num_points (
|
||||
}
|
||||
|
||||
h5_ssize_t
|
||||
h5u_get_num_points_in_view (
|
||||
h5u_get_num_items_in_view (
|
||||
const h5_file_t fh /*!< [in] Handle to open file */
|
||||
) {
|
||||
h5_file_p f = (h5_file_p)fh;
|
||||
H5_CORE_API_ENTER (h5_ssize_t, "f=%p", f);
|
||||
CHECK_FILEHANDLE (f);
|
||||
CHECK_TIMEGROUP (f);
|
||||
check_iteration_handle_is_valid (f);
|
||||
h5_ssize_t nparticles;
|
||||
|
||||
if (!h5u_has_view (fh)) {
|
||||
@@ -73,11 +71,10 @@ h5u_get_totalnum_particles_by_name (
|
||||
H5_CORE_API_ENTER (h5_ssize_t,
|
||||
"f=%p, dataset_name=%s",
|
||||
f, dataset_name);
|
||||
CHECK_FILEHANDLE (f);
|
||||
CHECK_TIMEGROUP (f);
|
||||
check_iteration_handle_is_valid (f);
|
||||
h5_ssize_t nparticles;
|
||||
TRY (nparticles = hdf5_get_npoints_of_dataset_by_name (
|
||||
f->step_gid, dataset_name));
|
||||
f->iteration_gid, dataset_name));
|
||||
h5_debug ("Found %lld particles in dataset %s.",
|
||||
(long long)nparticles, dataset_name);
|
||||
H5_RETURN (nparticles);
|
||||
@@ -90,13 +87,12 @@ 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);
|
||||
check_iteration_handle_is_valid (f);
|
||||
char dataset_name[H5_DATANAME_LEN];
|
||||
dataset_name[0] = '\0';
|
||||
h5_err_t h5err;
|
||||
TRY (h5err = hdf5_get_name_of_dataset_by_idx (
|
||||
f->step_gid,
|
||||
f->iteration_gid,
|
||||
idx,
|
||||
dataset_name,
|
||||
H5_DATANAME_LEN));
|
||||
@@ -104,14 +100,14 @@ h5u_get_totalnum_particles_by_idx (
|
||||
H5_LEAVE (H5_NOK);
|
||||
h5_ssize_t nparticles;
|
||||
TRY (nparticles = hdf5_get_npoints_of_dataset_by_name (
|
||||
f->step_gid, dataset_name));
|
||||
f->iteration_gid, dataset_name));
|
||||
h5_debug ("Found %lld particles in dataset %s.",
|
||||
(long long)nparticles, dataset_name);
|
||||
H5_RETURN (nparticles);
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
h5u_set_num_points (
|
||||
h5u_set_num_items (
|
||||
const h5_file_t fh, /*!< [in] Handle to open file */
|
||||
const h5_size_t nparticles, /*!< [in] Number of particles */
|
||||
const h5_size_t stride /*!< [in] Stride of particles in memory */
|
||||
@@ -122,10 +118,9 @@ h5u_set_num_points (
|
||||
f, (long long unsigned)nparticles,
|
||||
(long long unsigned)stride);
|
||||
CHECK_FILEHANDLE (f);
|
||||
if (f->step_gid < 0) {
|
||||
TRY (h5_set_step (fh, 0));
|
||||
if (f->iteration_gid < 0) {
|
||||
TRY (h5_set_iteration (fh, 0));
|
||||
}
|
||||
CHECK_TIMEGROUP (f);
|
||||
struct h5u_fdata *u = f->u;
|
||||
hsize_t start;
|
||||
hsize_t dmax = H5S_UNLIMITED;
|
||||
@@ -229,8 +224,7 @@ h5u_has_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);
|
||||
check_iteration_handle_is_valid (f);
|
||||
H5_RETURN (f->u->viewindexed || f->u->viewstart >= 0);
|
||||
}
|
||||
|
||||
@@ -240,8 +234,7 @@ 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);
|
||||
check_iteration_handle_is_valid (f);
|
||||
struct h5u_fdata *u = f->u;
|
||||
|
||||
u->viewstart = -1;
|
||||
@@ -270,10 +263,7 @@ 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;
|
||||
check_iteration_handle_is_valid (f);
|
||||
struct h5u_fdata *u = f->u;
|
||||
|
||||
TRY (h5u_reset_view (fh));
|
||||
@@ -281,72 +271,47 @@ h5u_set_view (
|
||||
if (start == -1 && end == -1) // we are already done
|
||||
H5_LEAVE (H5_SUCCESS);
|
||||
|
||||
hssize_t total = 0;
|
||||
if (f->u->shape > 0) {
|
||||
TRY (total = hdf5_get_npoints_of_dataspace (f->u->shape) );
|
||||
} else {
|
||||
TRY (total = (hsize_t)h5u_get_totalnum_particles_by_idx (fh, 0));
|
||||
TRY (total = h5u_get_totalnum_particles_by_idx (fh, 0));
|
||||
}
|
||||
h5_debug ("Total = %lld", (long long) total);
|
||||
if ((long long)total <= 0) {
|
||||
if (total <= 0) {
|
||||
/*
|
||||
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!
|
||||
iteration does not contain a dataset yet!
|
||||
|
||||
:FIXME: Should 'total == 0' be considered valid or not?
|
||||
:FIXME: why not gather total size?
|
||||
*/
|
||||
if (start < 0) {
|
||||
H5_RETURN_ERROR (
|
||||
H5_ERR_INVAL,
|
||||
"Start of selection '%lld' out of range: "
|
||||
"must be >= 0",
|
||||
(long long)start);
|
||||
}
|
||||
if (end < start) {
|
||||
H5_RETURN_ERROR (
|
||||
H5_ERR_INVAL,
|
||||
"End of selection '%lld' out of range: "
|
||||
"must be >= %lld",
|
||||
(long long)end,
|
||||
(long long)start);
|
||||
}
|
||||
#if H5_HAVE_PARALLEL
|
||||
TRY (
|
||||
h5priv_mpi_allreduce_max (
|
||||
&end, &total, 1, MPI_LONG_LONG, f->props->comm)
|
||||
);
|
||||
#else
|
||||
total = end - start;
|
||||
total = end;
|
||||
#endif
|
||||
total++;
|
||||
TRY (h5u_reset_view(fh));
|
||||
|
||||
TRY (hdf5_close_dataspace (u->shape));
|
||||
TRY (u->shape = hdf5_create_dataspace(1, &total, NULL) );
|
||||
hsize_t htotal = (hsize_t)total;
|
||||
TRY (u->shape = hdf5_create_dataspace(1, &htotal, NULL) );
|
||||
} else {
|
||||
if (end < 0) {
|
||||
end = total+end;
|
||||
}
|
||||
|
||||
if (start < 0 || start >= total) {
|
||||
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_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_RETURN_ERROR (
|
||||
H5_ERR_INVAL,
|
||||
"Invalid selection: start=%lld > end=%lld!\n",
|
||||
(long long)start, (long long)end);
|
||||
end = total + end;
|
||||
}
|
||||
}
|
||||
if ((start < 0) ||
|
||||
(start >= total) ||
|
||||
(end >= total) ||
|
||||
(end+1 < start)) {
|
||||
H5_RETURN_ERROR (
|
||||
H5_ERR_INVAL,
|
||||
"Invalid view: start=%lld, end=%lld, total=%lld!",
|
||||
(long long)start,
|
||||
(long long)end,
|
||||
(long long)total);
|
||||
}
|
||||
|
||||
/* setting up the new view */
|
||||
@@ -361,8 +326,9 @@ h5u_set_view (
|
||||
"This view includes %lld particles.",
|
||||
(long long)u->nparticles );
|
||||
|
||||
hsize_t htotal = (hsize_t)total;
|
||||
/* declare overall data size but then will select a subset */
|
||||
TRY (u->diskshape = hdf5_create_dataspace ( 1, &total, NULL ));
|
||||
TRY (u->diskshape = hdf5_create_dataspace (1, &htotal, NULL));
|
||||
|
||||
hsize_t hstart = (hsize_t)start;
|
||||
hsize_t hstride = 1;
|
||||
@@ -375,6 +341,7 @@ h5u_set_view (
|
||||
NULL));
|
||||
|
||||
/* declare local memory datasize */
|
||||
hsize_t dmax = H5S_UNLIMITED;
|
||||
TRY (u->memshape = hdf5_create_dataspace (1, &hcount, &dmax));
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
}
|
||||
@@ -389,8 +356,7 @@ 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);
|
||||
check_iteration_handle_is_valid (f);
|
||||
struct h5u_fdata *u = f->u;
|
||||
|
||||
TRY (h5u_reset_view (fh));
|
||||
@@ -460,10 +426,9 @@ h5u_set_view_indices (
|
||||
"f=%p, indices=%p, nelems=%llu",
|
||||
f, indices, (long long unsigned)nelems);
|
||||
CHECK_FILEHANDLE (f);
|
||||
if (f->step_gid < 0) {
|
||||
TRY (h5_set_step (fh, 0));
|
||||
if (f->iteration_gid < 0) {
|
||||
TRY (h5_set_iteration (fh, 0));
|
||||
}
|
||||
CHECK_TIMEGROUP (f);
|
||||
hsize_t total = 0;
|
||||
hsize_t dmax = H5S_UNLIMITED;
|
||||
struct h5u_fdata *u = f->u;
|
||||
@@ -520,8 +485,7 @@ 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);
|
||||
check_iteration_handle_is_valid (f);
|
||||
struct h5u_fdata *u = f->u;
|
||||
|
||||
if ( u->viewindexed ) {
|
||||
@@ -542,7 +506,7 @@ h5u_get_view (
|
||||
viewend = u->viewend;
|
||||
}
|
||||
else {
|
||||
TRY (viewend = h5u_get_num_points (fh));
|
||||
TRY (viewend = h5u_get_num_items (fh));
|
||||
}
|
||||
|
||||
if ( start ) *start = viewstart;
|
||||
@@ -557,15 +521,14 @@ h5u_set_canonical_view (
|
||||
) {
|
||||
h5_file_p f = (h5_file_p)fh;
|
||||
H5_CORE_API_ENTER (h5_int64_t, "f=%p", f);
|
||||
CHECK_FILEHANDLE (f);
|
||||
CHECK_TIMEGROUP (f);
|
||||
check_iteration_handle_is_valid (f);
|
||||
h5u_fdata_t* u = f->u;
|
||||
TRY( h5u_reset_view (fh) );
|
||||
|
||||
h5_int64_t start = 0;
|
||||
h5_int64_t total = 0;
|
||||
|
||||
TRY (total = h5u_get_num_points (fh));
|
||||
TRY (total = h5u_get_num_items (fh));
|
||||
|
||||
u->nparticles = total / f->nprocs;
|
||||
|
||||
@@ -595,9 +558,8 @@ h5u_get_num_datasets (
|
||||
) {
|
||||
h5_file_p f = (h5_file_p)fh;
|
||||
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));
|
||||
check_iteration_handle_is_valid (f);
|
||||
TRY (ret_value = hdf5_get_num_datasets (f->iteration_gid));
|
||||
H5_RETURN (ret_value);
|
||||
}
|
||||
|
||||
@@ -610,9 +572,8 @@ h5u_has_dataset (
|
||||
H5_CORE_API_ENTER (h5_err_t,
|
||||
"f=%p, name='%s'",
|
||||
f, name);
|
||||
CHECK_FILEHANDLE (f);
|
||||
CHECK_TIMEGROUP (f);
|
||||
TRY (ret_value = hdf5_link_exists (f->step_gid, name));
|
||||
check_iteration_handle_is_valid (f);
|
||||
TRY (ret_value = hdf5_link_exists (f->iteration_gid, name));
|
||||
H5_RETURN (ret_value);
|
||||
}
|
||||
|
||||
@@ -693,10 +654,9 @@ h5u_get_dataset_info_by_idx (
|
||||
dataset_name,
|
||||
(long long unsigned)len_dataset_name,
|
||||
dataset_type, dataset_nelem);
|
||||
CHECK_FILEHANDLE (f);
|
||||
CHECK_TIMEGROUP (f);
|
||||
check_iteration_handle_is_valid (f);
|
||||
TRY (h5priv_get_dataset_info_by_idx (
|
||||
f->step_gid,
|
||||
f->iteration_gid,
|
||||
idx,
|
||||
dataset_name, len_dataset_name,
|
||||
dataset_type, dataset_nelem));
|
||||
@@ -742,10 +702,9 @@ h5u_get_dataset_info_by_name (
|
||||
f,
|
||||
dataset_name,
|
||||
dataset_type, dataset_nelem);
|
||||
CHECK_FILEHANDLE (f);
|
||||
CHECK_TIMEGROUP (f);
|
||||
check_iteration_handle_is_valid (f);
|
||||
TRY (h5priv_get_dataset_info_by_name (
|
||||
f->step_gid,
|
||||
f->iteration_gid,
|
||||
dataset_name,
|
||||
dataset_type, dataset_nelem));
|
||||
H5_RETURN (H5_SUCCESS);
|
||||
@@ -782,13 +741,12 @@ 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);
|
||||
check_iteration_handle_is_valid (f);
|
||||
hid_t dataset_id;
|
||||
hid_t plist_id;
|
||||
hsize_t hsize;
|
||||
|
||||
TRY (dataset_id = hdf5_open_dataset_by_name (f->step_gid, name) );
|
||||
TRY (dataset_id = hdf5_open_dataset_by_name (f->iteration_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) );
|
||||
|
||||
@@ -29,11 +29,13 @@ h5priv_fcmp (
|
||||
assert (sizeof (long long) == sizeof (h5_int64_t) );
|
||||
|
||||
// Make [ab]Int lexicographically ordered as a twos-complement int
|
||||
h5_int64_t aInt = *(h5_int64_t*)&A;
|
||||
void* p = (void*)&A;
|
||||
h5_int64_t aInt = *(h5_int64_t*)p;
|
||||
if (aInt < 0)
|
||||
aInt = 0x8000000000000000LL - aInt;
|
||||
|
||||
h5_int64_t bInt = *(h5_int64_t*)&B;
|
||||
p = (void*)&B;
|
||||
h5_int64_t bInt = *(h5_int64_t*)p;
|
||||
if (bInt < 0)
|
||||
bInt = 0x8000000000000000LL - bInt;
|
||||
|
||||
|
||||
@@ -12,35 +12,47 @@
|
||||
#define H5_VFD_CORE 0x00000080
|
||||
|
||||
#define H5_FLUSH_FILE 0x00001000
|
||||
#define H5_FLUSH_STEP 0x00002000
|
||||
#define H5_FLUSH_ITERATION 0x00002000
|
||||
#define H5_FLUSH_DATASET 0x00004000
|
||||
|
||||
#define H5_FS_LUSTRE 0x00010000
|
||||
|
||||
static inline h5_err_t
|
||||
check_filehandle (
|
||||
const h5_file_p f
|
||||
) {
|
||||
if (f == NULL || f->file < 0 || f->u == NULL || f->b == NULL) {
|
||||
return h5_error (
|
||||
H5_ERR_BADF,
|
||||
"Called with bad filehandle.");
|
||||
}
|
||||
return H5_SUCCESS;
|
||||
static inline int
|
||||
is_valid_file_handle(h5_file_p f) {
|
||||
return ((f != NULL) &&
|
||||
(f->file > 0) &&
|
||||
(f->u != NULL) &&
|
||||
(f->b != NULL));
|
||||
}
|
||||
|
||||
#define CHECK_FILEHANDLE(f) \
|
||||
TRY (check_filehandle (f));
|
||||
|
||||
static inline int is_writable(h5_file_p f) {
|
||||
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)
|
||||
|
||||
static inline int
|
||||
is_readable (h5_file_p f) {
|
||||
return (f->props->flags & (H5_O_RDWR | H5_O_RDONLY));
|
||||
}
|
||||
|
||||
static inline int
|
||||
is_readonly (h5_file_p f) {
|
||||
return (f->props->flags & H5_O_RDONLY);
|
||||
}
|
||||
|
||||
static inline int
|
||||
is_appendonly (h5_file_p f) {
|
||||
return (f->props->flags & H5_O_APPENDONLY);
|
||||
}
|
||||
|
||||
#define CHECK_FILEHANDLE(f) \
|
||||
TRY (is_valid_file_handle(f) ? H5_SUCCESS : h5_error ( \
|
||||
H5_ERR_BADF, \
|
||||
"Called with bad filehandle."));
|
||||
|
||||
|
||||
#define CHECK_WRITABLE_MODE(f) \
|
||||
TRY (is_writable (f) ? H5_SUCCESS : h5_error ( \
|
||||
TRY (is_writable (f) ? H5_SUCCESS : h5_error ( \
|
||||
H5_ERR_INVAL, \
|
||||
"Attempting to write to read-only file handle"));
|
||||
|
||||
@@ -50,10 +62,29 @@ static inline int is_writable(h5_file_p f) {
|
||||
"Attempting to read from write-only file handle"));
|
||||
|
||||
#define CHECK_TIMEGROUP(f) \
|
||||
TRY ((f->step_gid > 0) ? H5_SUCCESS : h5_error ( \
|
||||
TRY ((f->iteration_gid > 0) ? H5_SUCCESS : h5_error ( \
|
||||
H5_ERR_INVAL, \
|
||||
"Time step is invalid! Have you set the time step?"));
|
||||
"Iteration is invalid! Have you set the time step?"));
|
||||
|
||||
#define check_file_handle_is_valid(f) \
|
||||
CHECK_FILEHANDLE(f); \
|
||||
|
||||
#define check_file_is_writable(f) \
|
||||
CHECK_FILEHANDLE(f); \
|
||||
CHECK_WRITABLE_MODE(f);
|
||||
|
||||
#define check_iteration_handle_is_valid(f) \
|
||||
CHECK_FILEHANDLE(f); \
|
||||
CHECK_TIMEGROUP(f);
|
||||
|
||||
#define check_iteration_is_readable(f) \
|
||||
CHECK_FILEHANDLE(f); \
|
||||
CHECK_READABLE_MODE(f); \
|
||||
CHECK_TIMEGROUP(f);
|
||||
|
||||
#define check_iteration_is_writable(f) \
|
||||
CHECK_FILEHANDLE(f); \
|
||||
CHECK_WRITABLE_MODE(f); \
|
||||
CHECK_TIMEGROUP(f);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -58,8 +58,7 @@ h5priv_read_dataset (
|
||||
|
||||
h5_err_t
|
||||
h5priv_normalize_dataset_name (
|
||||
const char *name,
|
||||
char *name2
|
||||
char* const name
|
||||
);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
|
||||
#define __FUNC_ENTER(type, mask, fmt, ...) \
|
||||
type ret_value = (type)H5_ERR; \
|
||||
int __log__ = h5_debug_mask & mask; \
|
||||
int __log__ = __h5_debug_mask & mask; \
|
||||
if (__log__) { \
|
||||
h5_call_stack_push (__func__,e_##type); \
|
||||
h5_debug ("(" fmt ")", __VA_ARGS__); \
|
||||
|
||||
@@ -15,9 +15,9 @@
|
||||
* file incompatibilities with previous versions. */
|
||||
|
||||
#define H5_DATANAME_LEN H5_MAX_NAME_LEN
|
||||
#define H5_STEPNAME_LEN H5_MAX_NAME_LEN
|
||||
#define H5_STEPNAME "Step"
|
||||
#define H5_STEPWIDTH 1
|
||||
#define H5_ITERATION_NAME_LEN H5_MAX_NAME_LEN
|
||||
#define H5_ITERATION_NAME "Step"
|
||||
#define H5_ITERATION_NUM_WIDTH 1
|
||||
#define H5BLOCK_GROUPNAME_BLOCK "Block"
|
||||
#define H5_BLOCKNAME_X "0"
|
||||
#define H5_BLOCKNAME_Y "1"
|
||||
@@ -115,7 +115,7 @@ h5priv_end_throttle (const h5_file_p f) {
|
||||
|
||||
|
||||
h5_err_t
|
||||
h5priv_close_step (
|
||||
h5priv_close_iteration (
|
||||
const h5_file_p f
|
||||
);
|
||||
|
||||
@@ -123,6 +123,7 @@ h5priv_close_step (
|
||||
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
|
||||
|
||||
@@ -41,8 +41,9 @@ struct h5_prop_file { // file property
|
||||
hid_t xfer_prop; // dataset transfer properties
|
||||
hid_t access_prop; // file access properties
|
||||
hid_t create_prop; // file create properties
|
||||
char* prefix_step_name; // Prefix of step name
|
||||
int width_step_idx; // pad step index with 0 up to this
|
||||
char* prefix_iteration_name; // Prefix of step name
|
||||
int width_iteration_idx; // pad iteration index with 0 up to this
|
||||
int flush; // flush iteration after writing dataset
|
||||
};
|
||||
typedef struct h5_prop_file h5_prop_file_t;
|
||||
typedef h5_prop_file_t* h5_prop_file_p;
|
||||
@@ -66,12 +67,12 @@ struct h5_file {
|
||||
|
||||
/* HDF5 */
|
||||
hid_t root_gid; // HDF5 group id of root
|
||||
hid_t step_gid; // HDF5 group id of current step
|
||||
hid_t iteration_gid; // HDF5 group id of current iteration
|
||||
|
||||
/* step internal data */
|
||||
char* step_name; // full current step name
|
||||
h5_int64_t step_idx; // current step index
|
||||
int is_new_step; // :FIXME: ?
|
||||
/* iteration internal data */
|
||||
char* iteration_name; // full current iteration name
|
||||
h5_int64_t iteration_idx; // current iteration index
|
||||
int is_new_iteration;// :FIXME: ?
|
||||
|
||||
struct h5u_fdata *u; // pointer to unstructured data
|
||||
struct h5b_fdata *b; // pointer to block data
|
||||
|
||||
@@ -11,7 +11,7 @@ struct h5b_partition {
|
||||
};
|
||||
|
||||
struct h5b_fdata {
|
||||
h5_id_t step_idx;
|
||||
h5_id_t iteration_idx;
|
||||
h5_size_t i_max;
|
||||
h5_size_t j_max;
|
||||
h5_size_t k_max;
|
||||
|
||||
@@ -219,7 +219,7 @@ update_internal_structs (
|
||||
// create index sets
|
||||
|
||||
|
||||
#if (!defined(NDEBUG) && (h5_debug_mask & (1<<5)))
|
||||
#if (!defined(NDEBUG) && (__h5_debug_mask & (1<<5)))
|
||||
if (!m->is_chunked) {
|
||||
h5t_adjacencies_t* adj = &m->adjacencies;
|
||||
h5_loc_idx_t idx = 0;
|
||||
|
||||
@@ -202,7 +202,7 @@ 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_mask >= 6) {
|
||||
if (__h5_debug_mask >= 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);
|
||||
}
|
||||
|
||||
@@ -21,11 +21,11 @@
|
||||
* Complex numbers can be stored as array of float64 with even dimension
|
||||
* Tags are addressed via a name and the entity id.
|
||||
* Tags with the same name are called a "tagset"
|
||||
* Tagsets can be used to store time/step-constant data. These tagsets are
|
||||
* Tagsets can be used to store iteration-constant data. These tagsets are
|
||||
called "m-tagsets" and are assigned directly to a mesh.
|
||||
* Tagsets can be used to store data which may change from step to step.
|
||||
These tagsets are called "s-tagsets" and are assigned to a mesh and a
|
||||
(time-)step.
|
||||
* Tagsets can be used to store data which may change from iteration to
|
||||
iteration. These tagsets are called "s-tagsets" and are assigned to
|
||||
a mesh and a step/iteration.
|
||||
|
||||
ToDo
|
||||
* Scalar values
|
||||
|
||||
@@ -233,7 +233,8 @@ H5Block3dGetFieldOrigin (
|
||||
}
|
||||
|
||||
/**
|
||||
Set field spacing for field \c field_name in the current step.
|
||||
Set field spacing for field \c field_name in the current
|
||||
step/iteration.
|
||||
|
||||
\return \c H5_SUCCESS on success
|
||||
\return \c H5_FAILURE on error
|
||||
@@ -263,7 +264,8 @@ H5Block3dSetFieldSpacing (
|
||||
}
|
||||
|
||||
/**
|
||||
Get field spacing for field \c field_name in the current time step.
|
||||
Get field spacing for field \c field_name in the current
|
||||
step/iteration.
|
||||
|
||||
\return \c H5_SUCCESS on success
|
||||
\return \c H5_FAILURE on error
|
||||
@@ -316,7 +318,7 @@ H5Block3dGetFieldSpacing (
|
||||
)
|
||||
|
||||
Set an explicit list of X,Y respective Z coordinates for field \c
|
||||
field_name in the current time step. The coordinates are a 1D array
|
||||
field_name in the current step/iteration. The coordinates are a 1D array
|
||||
of floating point values with dimension \c n_coords.
|
||||
|
||||
By convention, the \c coords array should have the same length as
|
||||
@@ -414,8 +416,8 @@ H5Block3dSetFieldZCoords (
|
||||
)
|
||||
|
||||
Get the explicit list of X, Y respective Z coordinates for field \c
|
||||
field_name in the current step. The coordinates are read into the 1D
|
||||
array \c coords which has length \c n_coords.
|
||||
field_name in the current step/iteration. The coordinates are read
|
||||
into the 1D array \c coords which has length \c n_coords.
|
||||
|
||||
By convention, the \c coords array should have the same length as
|
||||
the X, Y respective Z dimension of the field. A warning will be
|
||||
|
||||
@@ -56,9 +56,10 @@ extern "C" {
|
||||
const h5_int32_t* buffer
|
||||
)
|
||||
|
||||
Write a 3-dimensional field with scalar values to the current step
|
||||
using the previously defined field view. Ensure that the size of
|
||||
the buffer matches the number of elements in the view.
|
||||
Write a 3-dimensional field with scalar values to the current
|
||||
step/iteration using the previously defined field view. Ensure
|
||||
that the size of the buffer matches the number of elements in
|
||||
the view.
|
||||
|
||||
Supported data types are
|
||||
|
||||
@@ -176,8 +177,8 @@ H5Block3dWriteScalarFieldInt32 (
|
||||
h5_int32_t* buffer
|
||||
)
|
||||
|
||||
Read a 3-dimensional field with scalar values from the current step
|
||||
using the previously defined field layout.
|
||||
Read a 3-dimensional field with scalar values from the current
|
||||
step/iteration using the previously defined field layout.
|
||||
|
||||
Ensure that the size of the buffer matches the number of elements in
|
||||
the view.
|
||||
@@ -295,9 +296,9 @@ H5Block3dReadScalarFieldInt32 (
|
||||
)
|
||||
|
||||
Write a 3-dimensional field with 3-dimensional vectors as values to
|
||||
the current step using the previously defined field view. Ensure
|
||||
that the size of the buffer matches the number of elements in the
|
||||
view.
|
||||
the current step/iteration using the previously defined field view.
|
||||
Ensure that the size of the buffer matches the number of elements in
|
||||
the view.
|
||||
|
||||
Supported data types are
|
||||
|
||||
@@ -439,7 +440,7 @@ H5Block3dWriteVector3dFieldInt32 (
|
||||
)
|
||||
|
||||
Read a 3-dimensional field with 3-dimensional vectors as values from
|
||||
the current step using the previously defined field layout.
|
||||
the current step/iteration using the previously defined field layout.
|
||||
|
||||
Ensure that the size of the buffer matches the number of elements in
|
||||
the view.
|
||||
|
||||
+11
-11
@@ -33,10 +33,10 @@ extern "C" {
|
||||
*/
|
||||
|
||||
/**
|
||||
Checks whether the current time-step has field data or not.
|
||||
Checks whether the current step/iteration has field data or not.
|
||||
|
||||
\return true (value \c >0) if step exists
|
||||
\return false (\c 0) if step does not exist
|
||||
\return true (value \c >0) if step/iteration exists
|
||||
\return false (\c 0) if step/iteration does not exist
|
||||
\return \c H5_FAILURE on error
|
||||
*/
|
||||
static inline h5_err_t
|
||||
@@ -51,7 +51,7 @@ H5BlockHasFieldData (
|
||||
|
||||
|
||||
/**
|
||||
Query number of fields in current time step.
|
||||
Query number of fields in current step/iteration.
|
||||
|
||||
\return \c number of fields
|
||||
\return H5_FAILURE on error
|
||||
@@ -74,8 +74,8 @@ H5BlockGetNumFields (
|
||||
(e.g. scalar or vector).
|
||||
|
||||
This function can be used to retrieve all fields bound to the
|
||||
current time-step by looping from \c 0 to the number of fields
|
||||
minus one. The number of fields bound to the current time-step
|
||||
current step/iteration by looping from \c 0 to the number of fields
|
||||
minus one. The number of fields bound to the current step/iteration
|
||||
can be queried by calling the function \ref H5BlockGetNumFields.
|
||||
|
||||
\return \c H5_SUCCESS on success
|
||||
@@ -171,8 +171,8 @@ H5BlockGetFieldInfoByName (
|
||||
Tests whether a view has been set, either directly with
|
||||
\ref H5Block3dSetView or indirectly with \ref H5Block3dSetGrid.
|
||||
|
||||
\return true (value \c >0) if step exists
|
||||
\return false (\c 0) if step does not exist
|
||||
\return true (value \c >0) if step/iteration exists
|
||||
\return false (\c 0) if step/iteration does not exist
|
||||
\return \c H5_FAILURE on error
|
||||
*/
|
||||
static inline h5_int64_t
|
||||
@@ -190,9 +190,9 @@ H5Block3dHasView (
|
||||
Fortran ordering: the fastest moving index is \c i.
|
||||
|
||||
This routine uses an MPI_Allgather, so at large concurrency it should
|
||||
be called as infrequently as possible. For instance, if several timesteps
|
||||
use the same field dimensions, set the layout only once before the
|
||||
first timestep.
|
||||
be called as infrequently as possible. For instance, if several
|
||||
steps/iteration use the same field dimensions, set the layout only
|
||||
once.
|
||||
|
||||
\return \c H5_SUCCESS on success
|
||||
\return \c H5_FAILURE on error
|
||||
|
||||
+18
-16
@@ -56,12 +56,13 @@ extern "C" {
|
||||
const h5_int32_t* data
|
||||
)
|
||||
|
||||
Write a dataset to the current step.
|
||||
Write a dataset to the current step/iteration.
|
||||
|
||||
After the current (time-)step and view, you can start writing datasets
|
||||
into the file. Each dataset has a name associated with it (chosen by the
|
||||
user) in order to facilitate later retrieval. The name of the dataset is
|
||||
specified in the parameter \c name, which must be a null-terminated string.
|
||||
After setting the current (time-)step/iteration and view, you can start
|
||||
writing datasets into the file. Each dataset has a name associated with
|
||||
it (chosen by the user) in order to facilitate later retrieval. The name
|
||||
of the dataset is specified in the parameter \c name, which must be a
|
||||
null-terminated string.
|
||||
|
||||
There are no restrictions on naming of datasets, but it is useful to arrive
|
||||
at some common naming convention when sharing data with other groups.
|
||||
@@ -70,9 +71,10 @@ extern "C" {
|
||||
the array can be reconstructed properly on other systems with incompatible
|
||||
type representations.
|
||||
|
||||
All data that is written after setting the timestep is associated with that
|
||||
timestep. While the number of elements can change for each timestep, you
|
||||
cannot change the number of elements in the middle of a given timestep.
|
||||
All data that is written after setting the (time-)step/iteration is
|
||||
associated with that (time-)step/iteratiion. While the number of
|
||||
elements can change for each timestep, you cannot change the number
|
||||
of elements in the middle of a given (time-)step/iteration.
|
||||
|
||||
The data is committed to disk before the routine returns.
|
||||
\param f [in] file handle.
|
||||
@@ -97,7 +99,7 @@ H5PartWriteDataFloat64 (
|
||||
"f=%p, name='%s', date=%p",
|
||||
(h5_file_p)f, name, data);
|
||||
H5_API_RETURN (
|
||||
h5u_write_data (
|
||||
h5u_write_dataset (
|
||||
f, name, (void*)data,
|
||||
H5_FLOAT64_T));
|
||||
}
|
||||
@@ -112,7 +114,7 @@ H5PartWriteDataFloat32 (
|
||||
"f=%p, name='%s', date=%p",
|
||||
(h5_file_p)f, name, data);
|
||||
H5_API_RETURN (
|
||||
h5u_write_data(
|
||||
h5u_write_dataset (
|
||||
f, name, (void*)data,
|
||||
H5_FLOAT32_T));
|
||||
}
|
||||
@@ -127,7 +129,7 @@ H5PartWriteDataInt64 (
|
||||
"f=%p, name='%s', date=%p",
|
||||
(h5_file_p)f, name, data);
|
||||
H5_API_RETURN (
|
||||
h5u_write_data (
|
||||
h5u_write_dataset (
|
||||
f, name, (void*)data,
|
||||
H5_INT64_T));
|
||||
}
|
||||
@@ -142,7 +144,7 @@ H5PartWriteDataInt32 (
|
||||
"f=%p, name='%s', date=%p",
|
||||
(h5_file_p)f, name, data);
|
||||
H5_API_RETURN (
|
||||
h5u_write_data (
|
||||
h5u_write_dataset (
|
||||
f, name, (void*)data,
|
||||
H5_INT32_T));
|
||||
}
|
||||
@@ -198,7 +200,7 @@ H5PartReadDataFloat64 (
|
||||
"f=%p, name='%s', date=%p",
|
||||
(h5_file_p)f, name, data);
|
||||
H5_API_RETURN (
|
||||
h5u_read_data (
|
||||
h5u_read_dataset (
|
||||
f, name, data, H5_FLOAT64_T));
|
||||
}
|
||||
|
||||
@@ -212,7 +214,7 @@ H5PartReadDataFloat32 (
|
||||
"f=%p, name='%s', date=%p",
|
||||
(h5_file_p)f, name, data);
|
||||
H5_API_RETURN (
|
||||
h5u_read_data (
|
||||
h5u_read_dataset (
|
||||
f, name, data, H5_FLOAT32_T));
|
||||
}
|
||||
|
||||
@@ -226,7 +228,7 @@ H5PartReadDataInt64 (
|
||||
"f=%p, name='%s', date=%p",
|
||||
(h5_file_p)f, name, data);
|
||||
H5_API_RETURN (
|
||||
h5u_read_data (
|
||||
h5u_read_dataset (
|
||||
f, name, data,
|
||||
H5_INT64_T));
|
||||
}
|
||||
@@ -241,7 +243,7 @@ H5PartReadDataInt32 (
|
||||
"f=%p, name='%s', date=%p",
|
||||
(h5_file_p)f, name, data);
|
||||
H5_API_RETURN (
|
||||
h5u_read_data (
|
||||
h5u_read_dataset (
|
||||
f, name, data,
|
||||
H5_INT32_T));
|
||||
}
|
||||
|
||||
+42
-39
@@ -33,9 +33,10 @@ extern "C" {
|
||||
*/
|
||||
|
||||
/**
|
||||
Get the number of datasets that are stored at the current step.
|
||||
Get the number of datasets that are stored at the current
|
||||
step/iteration.
|
||||
|
||||
\return number of datasets in current timestep
|
||||
\return number of datasets in current step/iteration
|
||||
\return \c H5_FAILURE on error
|
||||
*/
|
||||
static inline h5_ssize_t
|
||||
@@ -49,7 +50,8 @@ H5PartGetNumDatasets (
|
||||
}
|
||||
|
||||
/**
|
||||
Query the name of a dataset given by it's index in the current step.
|
||||
Query the name of a dataset given by it's index in the current
|
||||
step/iteration.
|
||||
|
||||
If the number of datasets is \c n, the range of \c _index is \c 0 to \c n-1.
|
||||
|
||||
@@ -80,7 +82,7 @@ H5PartGetDatasetName (
|
||||
|
||||
/**
|
||||
Gets the name, type and number of elements of a dataset based on its
|
||||
index in the current timestep.
|
||||
index in the current step/iteration.
|
||||
|
||||
Type is one of the following values:
|
||||
|
||||
@@ -121,10 +123,11 @@ H5PartGetDatasetInfo (
|
||||
type, nelems));
|
||||
}
|
||||
/**
|
||||
Determines whether a dataset with given name exists in current step.
|
||||
Determines whether a dataset with given name exists in current
|
||||
step/iteration.
|
||||
|
||||
\return true (value \c >0) if step exists
|
||||
\return false (\c 0) if step does not exist
|
||||
\return true (value \c >0) if step/iteration exists
|
||||
\return false (\c 0) if step/iteration does not exist
|
||||
\return \c H5_FAILURE on error
|
||||
*/
|
||||
static inline h5_err_t
|
||||
@@ -140,7 +143,7 @@ H5PartHasDataset (
|
||||
|
||||
/**
|
||||
Gets the type and number of elements of a dataset based on its
|
||||
name in the current timestep.
|
||||
name in the current step/iteration.
|
||||
|
||||
Type is one of the following values:
|
||||
|
||||
@@ -177,7 +180,7 @@ H5PartGetDatasetInfoByName (
|
||||
}
|
||||
|
||||
/**
|
||||
Set the number of points/particles for the current time-step.
|
||||
Set the number of items/particles for the current step/iteration.
|
||||
After you call this subroutine, all subsequent
|
||||
operations will assume this number of particles will be written.
|
||||
|
||||
@@ -203,19 +206,19 @@ H5PartGetDatasetInfoByName (
|
||||
\return \c H5_FAILURE on error
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5PartSetNumPoints (
|
||||
H5PartSetNumItems (
|
||||
const h5_file_t f, ///< [in] file handle.
|
||||
h5_size_t npoints ///< [in] Number of elements.
|
||||
h5_size_t num_items ///< [in] Number of elements.
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, npoints=%llu",
|
||||
(h5_file_p)f, (long long unsigned)npoints);
|
||||
"f=%p, num_items=%llu",
|
||||
(h5_file_p)f, (long long unsigned)num_items);
|
||||
h5_size_t stride = 1;
|
||||
H5_API_RETURN (h5u_set_num_points (f, npoints, stride));
|
||||
H5_API_RETURN (h5u_set_num_items (f, num_items, stride));
|
||||
}
|
||||
|
||||
/**
|
||||
\see H5PartSetNumPoints()
|
||||
\see H5PartSetNumItems()
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5PartSetNumParticles (
|
||||
@@ -226,7 +229,7 @@ H5PartSetNumParticles (
|
||||
"f=%p, nparticles=%llu",
|
||||
(h5_file_p)f, (long long unsigned)nparticles);
|
||||
h5_size_t stride = 1;
|
||||
H5_API_RETURN (h5u_set_num_points (f, nparticles, stride));
|
||||
H5_API_RETURN (h5u_set_num_items (f, nparticles, stride));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -238,28 +241,28 @@ H5PartSetNumParticles (
|
||||
|
||||
If you have neither set the number of particles
|
||||
nor set a view, then this returns the total number of
|
||||
particles in the first data set of the current time step.
|
||||
Note that H5Part assumes that all data sets within a given time step
|
||||
particles in the first data set of the current step/iteration.
|
||||
Note that H5Part assumes that all data sets within a given step/iteration
|
||||
have the same number of particles (although the number particles can
|
||||
vary across time steps).
|
||||
vary across steps/iteration).
|
||||
|
||||
If none of these conditions are met, an error is thrown.
|
||||
|
||||
\return number of elements in datasets in current step.
|
||||
\return number of elements in datasets in current step/iteration.
|
||||
\return \c H5_FAILURE on error.
|
||||
*/
|
||||
static inline h5_ssize_t
|
||||
H5PartGetNumPoints (
|
||||
H5PartGetNumItems (
|
||||
const h5_file_t f ///< [in] file handle.
|
||||
) {
|
||||
H5_API_ENTER (h5_ssize_t,
|
||||
"f=%p",
|
||||
(h5_file_p)f);
|
||||
H5_API_RETURN (h5u_get_num_points (f));
|
||||
H5_API_RETURN (h5u_get_num_items (f));
|
||||
}
|
||||
|
||||
/**
|
||||
\see H5PartGetNumPoints()
|
||||
\see H5PartGetNumItems()
|
||||
*/
|
||||
static inline h5_ssize_t
|
||||
H5PartGetNumParticles (
|
||||
@@ -268,12 +271,12 @@ H5PartGetNumParticles (
|
||||
H5_API_ENTER (h5_ssize_t,
|
||||
"f=%p",
|
||||
(h5_file_p)f);
|
||||
H5_API_RETURN (h5u_get_num_points (f));
|
||||
H5_API_RETURN (h5u_get_num_items (f));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Set the number of particles for the current time-step.
|
||||
Set the number of particles for the current step/iteration.
|
||||
After you call this subroutine, all subsequent
|
||||
operations will assume this number of particles will be written.
|
||||
|
||||
@@ -301,15 +304,15 @@ H5PartGetNumParticles (
|
||||
static inline h5_err_t
|
||||
H5PartSetNumParticlesStrided (
|
||||
const h5_file_t f, ///< [in] file handle.
|
||||
h5_size_t npoints, ///< [in] number of elements.
|
||||
h5_size_t num_items, ///< [in] number of elements.
|
||||
h5_size_t stride ///< [in] stride value (e.g. number
|
||||
///< of fields in the particle array).
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, npoints=%llu, stride=%llu",
|
||||
(h5_file_p)f, (long long unsigned)npoints,
|
||||
"f=%p, num_items=%llu, stride=%llu",
|
||||
(h5_file_p)f, (long long unsigned)num_items,
|
||||
(long long unsigned)stride);
|
||||
H5_API_RETURN (h5u_set_num_points (f, npoints, stride));
|
||||
H5_API_RETURN (h5u_set_num_items (f, num_items, stride));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -361,8 +364,8 @@ H5PartResetView (
|
||||
\ref H5PartSetNumParticles() or manually with \ref H5PartSetView
|
||||
or \ref H5PartSetViewIndices.
|
||||
|
||||
\return true (value \c >0) if step exists
|
||||
\return false (\c 0) if step does not exist
|
||||
\return true (value \c >0) if step/iteration exists
|
||||
\return false (\c 0) if step/iteration does not exist
|
||||
\return \c H5_FAILURE on error
|
||||
*/
|
||||
static inline h5_err_t
|
||||
@@ -384,10 +387,10 @@ H5PartHasView (
|
||||
is set, or the number of particles in a dataset changes, or the view is
|
||||
"unset" by calling \c H5PartSetView(file,-1,-1);
|
||||
|
||||
Before you set a view, \ref H5PartGetNumPoints will return the
|
||||
total number of particles in the current time-step (even for the parallel
|
||||
reads). However, after you set a view, it will return the number of
|
||||
particles contained in the view.
|
||||
Before you set a view, \ref H5PartGetNumItems will return the
|
||||
total number of particles in the current step/iteration (even for
|
||||
the parallel reads). However, after you set a view, it will
|
||||
return the number of particles contained in the view.
|
||||
|
||||
The range is \e inclusive: the end value is the last index of the
|
||||
data.
|
||||
@@ -421,10 +424,10 @@ H5PartSetView (
|
||||
for all the intermediate values (which will not be touched by the read
|
||||
or write).
|
||||
|
||||
Before you set a view, the \c H5PartGetNumPoints() will return the
|
||||
total number of particles in the current time-step (even for the parallel
|
||||
reads). However, after you set a view, it will return the number of
|
||||
particles contained in the view.
|
||||
Before you set a view, the \c H5PartGetNumItems() will return the
|
||||
total number of particles in the current step/iteration (even for
|
||||
the parallel reads). However, after you set a view, it will return
|
||||
the number of particles contained in the view.
|
||||
|
||||
\return \c H5_SUCCESS on success
|
||||
\return \c H5_FAILURE on error
|
||||
|
||||
+22
-2
@@ -233,6 +233,26 @@ H5SetPropFileThrottle (
|
||||
H5_API_RETURN (h5_set_prop_file_throttle (prop, throttle));
|
||||
}
|
||||
|
||||
/**
|
||||
Flush data after each write.
|
||||
|
||||
\return \c H5_SUCCESS on success
|
||||
\return \c H5_FAILURE on error
|
||||
|
||||
\note
|
||||
| Release | Change |
|
||||
| :------ | :----- |
|
||||
| \c 2.0.0rc5 | Function introduced in this release. |
|
||||
*/
|
||||
static inline h5_err_t
|
||||
H5SetPropFileFlush (
|
||||
h5_prop_t prop ///< [in,out] identifier for file property list
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t, "prop=%p",
|
||||
(void*)prop);
|
||||
H5_API_RETURN (h5_set_prop_file_flush_after_write (prop));
|
||||
}
|
||||
|
||||
/**
|
||||
Close file property list.
|
||||
|
||||
@@ -357,7 +377,7 @@ H5CheckFile (
|
||||
}
|
||||
|
||||
/**
|
||||
Flush step data to disk.
|
||||
Flush step/iteration data to disk.
|
||||
|
||||
\return \c H5_SUCCESS on success
|
||||
\return \c H5_FAILURE on error
|
||||
@@ -369,7 +389,7 @@ H5FlushStep (
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p",
|
||||
(h5_file_p)f);
|
||||
H5_API_RETURN (h5_flush_step (f));
|
||||
H5_API_RETURN (h5_flush_iteration (f));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+20
-20
@@ -23,7 +23,7 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
Define format of the step names.
|
||||
Define format of the step/iteration names.
|
||||
|
||||
Example: ==H5SetStepNameFormat( f, "Step", 6 )== defines step names
|
||||
like ==Step#000042==.
|
||||
@@ -35,16 +35,16 @@ static inline h5_err_t
|
||||
H5SetStepNameFormat (
|
||||
const h5_file_t f, ///< [in] file handle
|
||||
const char* name, ///< [in] prefix, defaults to \c Step
|
||||
const h5_int64_t width ///< [in] width of step number
|
||||
const h5_int64_t width ///< [in] width of step/iteration number
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, name='%s', width=%lld",
|
||||
(h5_file_p)f, name, (long long) width);
|
||||
H5_API_RETURN (h5_set_stepname_fmt (f, name, width));
|
||||
H5_API_RETURN (h5_set_iteration_name_fmt (f, name, width));
|
||||
}
|
||||
|
||||
/**
|
||||
Get format of the step names.
|
||||
Get format of the step/iteration names.
|
||||
|
||||
\return \c H5_SUCCESS on success
|
||||
\return \c H5_FAILURE on error
|
||||
@@ -54,16 +54,16 @@ H5GetStepNameFormat (
|
||||
const h5_file_t f, ///< [in] file handle
|
||||
char* name, ///< [out] prefix
|
||||
const h5_size_t l_name, ///< [in] length of buffer name
|
||||
int* width ///< [out] width of step number
|
||||
int* width ///< [out] width of step/iteration number
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, name=%p, l_name=%llu, width=%p",
|
||||
(h5_file_p)f, name, (unsigned long long)l_name, width);
|
||||
H5_API_RETURN (h5_get_stepname_fmt (f, name, l_name, width));
|
||||
H5_API_RETURN (h5_get_iteration_name_fmt (f, name, l_name, width));
|
||||
}
|
||||
|
||||
/**
|
||||
Set the current step.
|
||||
Set the current step/iteration.
|
||||
|
||||
\return \c H5_SUCCESS on success
|
||||
\return \c H5_FAILURE on error
|
||||
@@ -71,18 +71,18 @@ H5GetStepNameFormat (
|
||||
static inline h5_err_t
|
||||
H5SetStep (
|
||||
const h5_file_t f, ///< [in] file handle.
|
||||
const h5_id_t step ///< [in] step to set.
|
||||
const h5_id_t step ///< [in] step/iteration to set.
|
||||
) {
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, step=%lld",
|
||||
(h5_file_p)f, (long long)step);
|
||||
H5_API_RETURN (h5_set_step (f, step));
|
||||
H5_API_RETURN (h5_set_iteration (f, step));
|
||||
}
|
||||
|
||||
/**
|
||||
Get current step.
|
||||
Get current step/iteration.
|
||||
|
||||
\return Step number
|
||||
\return Step/iteration number
|
||||
\return \c H5_FAILURE on error
|
||||
*/
|
||||
static inline h5_id_t
|
||||
@@ -92,17 +92,17 @@ H5GetStep (
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p",
|
||||
(h5_file_p)f);
|
||||
H5_API_RETURN (h5_get_step (f));
|
||||
H5_API_RETURN (h5_get_iteration (f));
|
||||
}
|
||||
|
||||
/**
|
||||
Get the number of time-steps that are currently stored in the file
|
||||
\c f.
|
||||
Get the number of steps/iterations that are currently stored
|
||||
in the file \c f.
|
||||
|
||||
It works for both reading and writing of files, but is probably
|
||||
only typically used when you are reading.
|
||||
|
||||
\return Number of time-steps
|
||||
\return Number of steps/iterations
|
||||
\return \c H5_FAILURE on error.
|
||||
*/
|
||||
static inline h5_ssize_t
|
||||
@@ -112,14 +112,14 @@ H5GetNumSteps (
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p",
|
||||
(h5_file_p)f);
|
||||
H5_API_RETURN (h5_get_num_steps(f));
|
||||
H5_API_RETURN (h5_get_num_iterations(f));
|
||||
}
|
||||
|
||||
/**
|
||||
Query whether a particular step already exists in the file.
|
||||
Query whether a particular step/iteration already exists in the file.
|
||||
|
||||
\return true (value \c >0) if step exists
|
||||
\return false (\c 0) if step does not exist
|
||||
\return true (value \c >0) if step/iteration exists
|
||||
\return false (\c 0) if step/iteration does not exist
|
||||
\return \c H5_FAILURE on error
|
||||
*/
|
||||
static inline h5_err_t
|
||||
@@ -130,7 +130,7 @@ H5HasStep (
|
||||
H5_API_ENTER (h5_err_t,
|
||||
"f=%p, stepno=%lld",
|
||||
(h5_file_p)f, (long long)stepno);
|
||||
H5_API_RETURN (h5_has_step (f, stepno));
|
||||
H5_API_RETURN (h5_has_iteration (f, stepno));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -29,12 +29,13 @@ extern "C" {
|
||||
!
|
||||
*/
|
||||
/**
|
||||
\addtogroup h5_step_attribs
|
||||
\addtogroup h5_iteration_attribs
|
||||
@{
|
||||
*/
|
||||
|
||||
/**
|
||||
Query the number of attributes attached to the current step.
|
||||
Query the number of attributes attached to the current
|
||||
step/iteration.
|
||||
|
||||
\return number of attributes
|
||||
\return \c H5_FAILURE on error
|
||||
@@ -46,17 +47,17 @@ H5GetNumStepAttribs (
|
||||
H5_API_ENTER (h5_int64_t,
|
||||
"f=%p",
|
||||
(h5_file_p)f);
|
||||
H5_API_RETURN (h5_get_num_step_attribs (f));
|
||||
H5_API_RETURN (h5_get_num_iteration_attribs (f));
|
||||
}
|
||||
|
||||
/**
|
||||
Gets the name, type and number of elements of the step attribute
|
||||
Gets the name, type and number of elements of the iteration attribute
|
||||
given by its index.
|
||||
|
||||
This function can be used to retrieve all attributes attached to the
|
||||
current step by looping from \c 0 to the number of attribute
|
||||
current step/iteration by looping from \c 0 to the number of attribute
|
||||
minus one. The number of attributes attached to the current
|
||||
step can be queried by calling \ref H5GetNumStepAttribs().
|
||||
step/iteration can be queried by calling \ref H5GetNumStepAttribs().
|
||||
|
||||
\return \c H5_SUCCESS on success
|
||||
\return \c H5_FAILURE on error
|
||||
@@ -81,7 +82,7 @@ H5GetStepAttribInfo (
|
||||
attrib_type,
|
||||
nelems);
|
||||
H5_API_RETURN (
|
||||
h5_get_step_attrib_info_by_idx (
|
||||
h5_get_iteration_attrib_info_by_idx (
|
||||
f,
|
||||
idx,
|
||||
attrib_name,
|
||||
@@ -105,7 +106,7 @@ H5GetStepAttribName (
|
||||
attrib_name,
|
||||
(long long unsigned)len_attrib_name);
|
||||
H5_API_RETURN (
|
||||
h5_get_step_attrib_info_by_idx (
|
||||
h5_get_iteration_attrib_info_by_idx (
|
||||
f,
|
||||
idx,
|
||||
attrib_name, len_attrib_name,
|
||||
@@ -114,7 +115,8 @@ H5GetStepAttribName (
|
||||
}
|
||||
|
||||
/**
|
||||
Determines whether a step attribute with a given name exists in current step.
|
||||
Determines whether a step attribute with a given name exists in
|
||||
current step/iteration.
|
||||
|
||||
\return true (value \c >0) if atrribute exists
|
||||
\return false (\c 0) if attribute does not exist
|
||||
@@ -131,13 +133,14 @@ H5HasStepAttrib (
|
||||
(h5_file_p)f,
|
||||
attrib_name);
|
||||
H5_API_RETURN (
|
||||
h5_has_step_attrib (
|
||||
h5_has_iteration_attrib (
|
||||
f,
|
||||
attrib_name));
|
||||
}
|
||||
|
||||
/**
|
||||
Gets the type and number of elements of a given step attribute.
|
||||
Gets the type and number of elements of a given step/iteration
|
||||
attribute.
|
||||
|
||||
\return \c H5_SUCCESS on success
|
||||
\return \c H5_FAILURE on error
|
||||
@@ -157,7 +160,7 @@ H5GetStepAttribInfoByName (
|
||||
attrib_name,
|
||||
attrib_type, nelems);
|
||||
H5_API_RETURN (
|
||||
h5_get_step_attrib_info_by_name (
|
||||
h5_get_iteration_attrib_info_by_name (
|
||||
f,
|
||||
attrib_name,
|
||||
attrib_type, nelems));
|
||||
@@ -240,7 +243,7 @@ H5WriteStepAttribString (
|
||||
"f=%p, attrib_name='%s', buffer='%s'",
|
||||
(h5_file_p)f, attrib_name, buffer);
|
||||
H5_API_RETURN (
|
||||
h5_write_step_attrib (
|
||||
h5_write_iteration_attrib (
|
||||
f,
|
||||
attrib_name,
|
||||
H5_STRING_T,
|
||||
@@ -259,7 +262,7 @@ H5WriteStepAttribFloat64 (
|
||||
"f=%p, attrib_name='%s', buffer=%p, nelems=%llu",
|
||||
(h5_file_p)f, attrib_name, buffer, (long long unsigned)nelems);
|
||||
H5_API_RETURN (
|
||||
h5_write_step_attrib (
|
||||
h5_write_iteration_attrib (
|
||||
f,
|
||||
attrib_name,
|
||||
H5_FLOAT64_T,
|
||||
@@ -278,7 +281,7 @@ H5WriteStepAttribFloat32 (
|
||||
"f=%p, attrib_name='%s', buffer=%p, nelems=%llu",
|
||||
(h5_file_p)f, attrib_name, buffer, (long long unsigned)nelems);
|
||||
H5_API_RETURN (
|
||||
h5_write_step_attrib (
|
||||
h5_write_iteration_attrib (
|
||||
f,
|
||||
attrib_name,
|
||||
H5_FLOAT32_T,
|
||||
@@ -297,7 +300,7 @@ H5WriteStepAttribInt64 (
|
||||
"f=%p, attrib_name='%s', buffer=%p, nelems=%llu",
|
||||
(h5_file_p)f, attrib_name, buffer, (long long unsigned)nelems);
|
||||
H5_API_RETURN (
|
||||
h5_write_step_attrib (
|
||||
h5_write_iteration_attrib (
|
||||
f,
|
||||
attrib_name,
|
||||
H5_INT64_T,
|
||||
@@ -316,7 +319,7 @@ H5WriteStepAttribInt32 (
|
||||
"f=%p, attrib_name='%s', buffer=%p, nelems=%llu",
|
||||
(h5_file_p)f, attrib_name, buffer, (long long unsigned)nelems);
|
||||
H5_API_RETURN (
|
||||
h5_write_step_attrib (
|
||||
h5_write_iteration_attrib (
|
||||
f,
|
||||
attrib_name,
|
||||
H5_INT32_T,
|
||||
@@ -393,7 +396,7 @@ H5ReadStepAttribString (
|
||||
"f=%p, attrib_name='%s', buffer=%p",
|
||||
(h5_file_p)f, attrib_name, buffer);
|
||||
H5_API_RETURN (
|
||||
h5_read_step_attrib (
|
||||
h5_read_iteration_attrib (
|
||||
f,
|
||||
attrib_name,
|
||||
H5_STRING_T,
|
||||
@@ -410,7 +413,7 @@ H5ReadStepAttribFloat64 (
|
||||
"f=%p, attrib_name='%s', buffer=%p",
|
||||
(h5_file_p)f, attrib_name, buffer);
|
||||
H5_API_RETURN (
|
||||
h5_read_step_attrib (
|
||||
h5_read_iteration_attrib (
|
||||
f,
|
||||
attrib_name,
|
||||
H5_FLOAT64_T,
|
||||
@@ -427,7 +430,7 @@ H5ReadStepAttribFloat32 (
|
||||
"f=%p, attrib_name='%s', buffer=%p",
|
||||
(h5_file_p)f, attrib_name, buffer);
|
||||
H5_API_RETURN (
|
||||
h5_read_step_attrib (
|
||||
h5_read_iteration_attrib (
|
||||
f,
|
||||
attrib_name,
|
||||
H5_FLOAT32_T,
|
||||
@@ -444,7 +447,7 @@ H5ReadStepAttribInt64 (
|
||||
"f=%p, attrib_name='%s', buffer=%p",
|
||||
(h5_file_p)f, attrib_name, buffer);
|
||||
H5_API_RETURN (
|
||||
h5_read_step_attrib (
|
||||
h5_read_iteration_attrib (
|
||||
f,
|
||||
attrib_name,
|
||||
H5_INT64_T,
|
||||
@@ -461,7 +464,7 @@ H5ReadStepAttribInt32 (
|
||||
"f=%p, attrib_name='%s', buffer=%p",
|
||||
(h5_file_p)f, attrib_name, buffer);
|
||||
H5_API_RETURN (
|
||||
h5_read_step_attrib (
|
||||
h5_read_iteration_attrib (
|
||||
f,
|
||||
attrib_name,
|
||||
H5_INT32_T,
|
||||
|
||||
+1
-1
@@ -29,7 +29,7 @@
|
||||
\ingroup h5block_model
|
||||
|
||||
\note
|
||||
Different field sizes are allowed in the same time-step.
|
||||
Different field sizes are allowed in the same step/iteration.
|
||||
|
||||
\note
|
||||
The same layout can be used, if the size of the field matches the
|
||||
|
||||
@@ -45,6 +45,10 @@ h5_err_t
|
||||
h5_set_prop_file_core_vfd (
|
||||
h5_prop_t, h5_int64_t);
|
||||
|
||||
h5_err_t
|
||||
h5_set_prop_file_flush_after_write (
|
||||
h5_prop_t _props);
|
||||
|
||||
h5_err_t
|
||||
h5_close_prop (
|
||||
h5_prop_t);
|
||||
@@ -70,7 +74,7 @@ h5_close_h5hut (
|
||||
void);
|
||||
|
||||
h5_err_t
|
||||
h5_flush_step (
|
||||
h5_flush_iteration (
|
||||
const h5_file_t);
|
||||
|
||||
h5_err_t
|
||||
|
||||
@@ -79,8 +79,8 @@ struct call_stack {
|
||||
struct call_stack_entry entry[1024];
|
||||
};
|
||||
|
||||
extern h5_int64_t h5_log_level;
|
||||
extern h5_int64_t h5_debug_mask;
|
||||
extern h5_int64_t __h5_log_level;
|
||||
extern h5_int64_t __h5_debug_mask;
|
||||
extern struct call_stack h5_call_stack;
|
||||
|
||||
// :FIXME: Should go to another header file
|
||||
@@ -223,7 +223,7 @@ h5_get_loglevel (
|
||||
h5_initialize(); \
|
||||
h5_call_stack_reset (); \
|
||||
h5_call_stack_push (__func__,e_##type); \
|
||||
int __log__ = h5_debug_mask & H5_DEBUG_API; \
|
||||
int __log__ = __h5_debug_mask & H5_DEBUG_API; \
|
||||
if (__log__) { \
|
||||
h5_debug ("(" fmt ")", __VA_ARGS__); \
|
||||
}
|
||||
|
||||
@@ -19,29 +19,29 @@ extern "C" {
|
||||
#define H5_MAX_NAME_LEN 64
|
||||
|
||||
h5_err_t
|
||||
h5_set_stepname_fmt (
|
||||
h5_set_iteration_name_fmt (
|
||||
const h5_file_t, const char*, const int);
|
||||
|
||||
h5_err_t
|
||||
h5_get_stepname_fmt (
|
||||
h5_get_iteration_name_fmt (
|
||||
const h5_file_t, char* const, const int, int* const);
|
||||
|
||||
|
||||
h5_int64_t
|
||||
h5_set_step (
|
||||
h5_set_iteration (
|
||||
const h5_file_t, const h5_int64_t);
|
||||
|
||||
|
||||
h5_int64_t
|
||||
h5_get_step (
|
||||
h5_get_iteration (
|
||||
const h5_file_t);
|
||||
|
||||
h5_ssize_t
|
||||
h5_get_num_steps (
|
||||
h5_get_num_iterations (
|
||||
const h5_file_t);
|
||||
|
||||
h5_int64_t
|
||||
h5_has_step (
|
||||
h5_has_iteration (
|
||||
const h5_file_t, const h5_int64_t);
|
||||
|
||||
int
|
||||
|
||||
@@ -18,30 +18,30 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
h5_err_t
|
||||
h5_has_step_attrib (
|
||||
h5_has_iteration_attrib (
|
||||
const h5_file_t, const char* const);
|
||||
|
||||
h5_err_t
|
||||
h5_get_step_attrib_info_by_name (
|
||||
h5_get_iteration_attrib_info_by_name (
|
||||
const h5_file_t, const char* const,
|
||||
h5_int64_t* const, h5_size_t* const);
|
||||
|
||||
h5_ssize_t
|
||||
h5_get_num_step_attribs (
|
||||
h5_get_num_iteration_attribs (
|
||||
const h5_file_t f);
|
||||
|
||||
h5_err_t
|
||||
h5_get_step_attrib_info_by_idx (
|
||||
h5_get_iteration_attrib_info_by_idx (
|
||||
const h5_file_t, const h5_size_t, char* const, const h5_size_t,
|
||||
h5_int64_t* const, h5_size_t* const);
|
||||
|
||||
h5_err_t
|
||||
h5_read_step_attrib (
|
||||
h5_read_iteration_attrib (
|
||||
const h5_file_t, const char* const, const h5_types_t,
|
||||
void* const);
|
||||
|
||||
h5_err_t
|
||||
h5_write_step_attrib (
|
||||
h5_write_iteration_attrib (
|
||||
const h5_file_t, const char* const, const h5_types_t,
|
||||
const void* const, const h5_size_t);
|
||||
|
||||
|
||||
@@ -148,7 +148,7 @@ typedef struct h5_glb_idxlist {
|
||||
} h5_glb_idxlist_t;
|
||||
|
||||
enum h5_iterators {
|
||||
step_iterator
|
||||
iteration_iterator
|
||||
};
|
||||
|
||||
struct h5_iterator;
|
||||
|
||||
@@ -18,12 +18,12 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
h5_int64_t
|
||||
h5u_read_data (
|
||||
h5u_read_dataset (
|
||||
const h5_file_t,
|
||||
const char* const, void* const, const h5_types_t);
|
||||
|
||||
h5_int64_t
|
||||
h5u_write_data (
|
||||
h5u_write_dataset (
|
||||
const h5_file_t,
|
||||
const char* const, const void* const, const h5_types_t);
|
||||
|
||||
|
||||
@@ -41,11 +41,11 @@ h5u_get_dataset_info_by_name (
|
||||
);
|
||||
|
||||
h5_ssize_t
|
||||
h5u_get_num_points (
|
||||
h5u_get_num_items (
|
||||
const h5_file_t);
|
||||
|
||||
h5_ssize_t
|
||||
h5u_get_num_points_in_view (
|
||||
h5u_get_num_items_in_view (
|
||||
const h5_file_t);
|
||||
|
||||
h5_ssize_t
|
||||
@@ -59,7 +59,7 @@ h5u_get_totalnum_particles_by_idx (
|
||||
h5_id_t);
|
||||
|
||||
h5_err_t
|
||||
h5u_set_num_points (
|
||||
h5u_set_num_items (
|
||||
const h5_file_t,
|
||||
const h5_size_t, const h5_size_t);
|
||||
|
||||
|
||||
+4
-4
@@ -360,7 +360,7 @@ test_read_data32(h5_file_t file, int nparticles, int step)
|
||||
status = H5PartReadDataFloat32(file, "pz", pz);
|
||||
RETURN(status, H5_SUCCESS, "H5PartReadDataFloat32");
|
||||
|
||||
status = H5PartReadDataInt32(file, LONGNAME2, id);
|
||||
status = H5PartReadDataInt32(file, "id", id);
|
||||
RETURN(status, H5_SUCCESS, "H5PartReadDataInt32");
|
||||
|
||||
for (i=0; i<nparticles; i++)
|
||||
@@ -489,7 +489,7 @@ void h5u_test_read3(void)
|
||||
RETURN(status, H5_SUCCESS, "H5CheckFile");
|
||||
|
||||
TEST("Redefining step name");
|
||||
status = H5SetStepNameFormat(file1, LONGNAME, 16);
|
||||
status = H5SetStepNameFormat(file1, "data", 16);
|
||||
RETURN(status, H5_SUCCESS, "H5SetStepNameFormat");
|
||||
|
||||
test_read_strided_data64(file1, NPARTICLES, 0);
|
||||
@@ -525,10 +525,10 @@ void h5u_test_read4(void)
|
||||
RETURN(status, H5_SUCCESS, "H5CloseProp");
|
||||
|
||||
TEST("Redefining step name");
|
||||
status = H5SetStepNameFormat(file1, LONGNAME, 16);
|
||||
status = H5SetStepNameFormat(file1, "data", 16);
|
||||
RETURN(status, H5_SUCCESS, "H5SetStepNameFormat");
|
||||
|
||||
status = H5SetStepNameFormat(file2, LONGNAME, 16);
|
||||
status = H5SetStepNameFormat(file2, "data", 16);
|
||||
RETURN(status, H5_SUCCESS, "H5SetStepNameFormat");
|
||||
|
||||
test_read_file_attribs(file1, 1);
|
||||
|
||||
+5
-5
@@ -266,7 +266,7 @@ test_write_data32(h5_file_t file, int nparticles, int step)
|
||||
status = H5PartWriteDataFloat32(file, "pz", pz);
|
||||
RETURN(status, H5_SUCCESS, "H5PartWriteDataFloat32");
|
||||
|
||||
status = H5PartWriteDataInt32(file, LONGNAME2, id);
|
||||
status = H5PartWriteDataInt32(file, "id", id);
|
||||
RETURN(status, H5_SUCCESS, "H5PartWriteDataInt32");
|
||||
|
||||
/* the second write phase... */
|
||||
@@ -293,7 +293,7 @@ test_write_data32(h5_file_t file, int nparticles, int step)
|
||||
status = H5PartWriteDataFloat32(file, "pz", pz+32);
|
||||
RETURN(status, H5_SUCCESS, "H5PartWriteDataFloat32");
|
||||
|
||||
status = H5PartWriteDataInt32(file, LONGNAME, id+32);
|
||||
status = H5PartWriteDataInt32(file, "id", id+32);
|
||||
RETURN(status, H5_SUCCESS, "H5PartWriteDataInt32");
|
||||
}
|
||||
}
|
||||
@@ -435,7 +435,7 @@ void h5u_test_write3(void)
|
||||
RETURN(status, H5_SUCCESS, "H5CloseProp");
|
||||
|
||||
TEST("Redefining step name");
|
||||
status = H5SetStepNameFormat(file1, LONGNAME, 16);
|
||||
status = H5SetStepNameFormat(file1, "data", 16);
|
||||
RETURN(status, H5_SUCCESS, "H5SetStepNameFormat");
|
||||
|
||||
test_write_strided_data64(file1, NPARTICLES, 0);
|
||||
@@ -474,10 +474,10 @@ void h5u_test_write4(void)
|
||||
RETURN(status, H5_SUCCESS, "H5CloseProp");
|
||||
|
||||
TEST("Redefining step name");
|
||||
status = H5SetStepNameFormat(file1, LONGNAME, 16);
|
||||
status = H5SetStepNameFormat(file1, "data", 16);
|
||||
RETURN(status, H5_SUCCESS, "H5SetStepNameFormat");
|
||||
|
||||
status = H5SetStepNameFormat(file2, LONGNAME, 16);
|
||||
status = H5SetStepNameFormat(file2, "data", 16);
|
||||
RETURN(status, H5_SUCCESS, "H5SetStepNameFormat");
|
||||
|
||||
status = H5PartSetChunkSize(file1, NPARTICLES);
|
||||
|
||||
Reference in New Issue
Block a user