Push compatibility to HDF5 1.12
This commit is contained in:
parent
31d0f19408
commit
f03751907b
@ -7,16 +7,16 @@ This software is a computer program whose purpose is to provide a toolbox for co
|
|||||||
data analysis (e.g. filters, generalized Fourier transforms, power spectra, ...)
|
data analysis (e.g. filters, generalized Fourier transforms, power spectra, ...)
|
||||||
|
|
||||||
This software is governed by the CeCILL license under French law and
|
This software is governed by the CeCILL license under French law and
|
||||||
abiding by the rules of distribution of free software. You can use,
|
abiding by the rules of distribution of free software. You can use,
|
||||||
modify and/ or redistribute the software under the terms of the CeCILL
|
modify and/ or redistribute the software under the terms of the CeCILL
|
||||||
license as circulated by CEA, CNRS and INRIA at the following URL
|
license as circulated by CEA, CNRS and INRIA at the following URL
|
||||||
"http://www.cecill.info".
|
"http://www.cecill.info".
|
||||||
|
|
||||||
As a counterpart to the access to the source code and rights to copy,
|
As a counterpart to the access to the source code and rights to copy,
|
||||||
modify and redistribute granted by the license, users are provided only
|
modify and redistribute granted by the license, users are provided only
|
||||||
with a limited warranty and the software's author, the holder of the
|
with a limited warranty and the software's author, the holder of the
|
||||||
economic rights, and the successive licensors have only limited
|
economic rights, and the successive licensors have only limited
|
||||||
liability.
|
liability.
|
||||||
|
|
||||||
In this respect, the user's attention is drawn to the risks associated
|
In this respect, the user's attention is drawn to the risks associated
|
||||||
with loading, using, modifying and/or developing or reproducing the
|
with loading, using, modifying and/or developing or reproducing the
|
||||||
@ -25,9 +25,9 @@ that may mean that it is complicated to manipulate, and that also
|
|||||||
therefore means that it is reserved for developers and experienced
|
therefore means that it is reserved for developers and experienced
|
||||||
professionals having in-depth computer knowledge. Users are therefore
|
professionals having in-depth computer knowledge. Users are therefore
|
||||||
encouraged to load and test the software's suitability as regards their
|
encouraged to load and test the software's suitability as regards their
|
||||||
requirements in conditions enabling the security of their systems and/or
|
requirements in conditions enabling the security of their systems and/or
|
||||||
data to be ensured and, more generally, to use and operate it in the
|
data to be ensured and, more generally, to use and operate it in the
|
||||||
same conditions as regards security.
|
same conditions as regards security.
|
||||||
|
|
||||||
The fact that you are presently reading this means that you have had
|
The fact that you are presently reading this means that you have had
|
||||||
knowledge of the CeCILL license and that you accept its terms.
|
knowledge of the CeCILL license and that you accept its terms.
|
||||||
@ -59,8 +59,8 @@ int ipvz_out = 5;
|
|||||||
|
|
||||||
/* xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx */
|
/* xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx */
|
||||||
|
|
||||||
/* n*_runtime_parameters should be set by the caller to
|
/* n*_runtime_parameters should be set by the caller to
|
||||||
the maximum number of runtime parameters to read.
|
the maximum number of runtime parameters to read.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void h5_read_runtime_parameters
|
void h5_read_runtime_parameters
|
||||||
@ -100,12 +100,12 @@ void h5_read_runtime_parameters
|
|||||||
nreal_runtime_parameters = MAX_PARM;
|
nreal_runtime_parameters = MAX_PARM;
|
||||||
|
|
||||||
/* integer runtime parameters */
|
/* integer runtime parameters */
|
||||||
int_rt_parms = (int_runtime_params_t *) malloc(nint_runtime_parameters * sizeof(int_runtime_params_t));
|
int_rt_parms = (int_runtime_params_t *) malloc(nint_runtime_parameters * sizeof(int_runtime_params_t));
|
||||||
|
|
||||||
rank = 1;
|
rank = 1;
|
||||||
DataSet dataset = file->openDataSet("integer runtime parameters");
|
DataSet dataset = file->openDataSet("integer runtime parameters");
|
||||||
|
|
||||||
IntType int_rt_type = dataset.getIntType();
|
IntType int_rt_type = dataset.getIntType();
|
||||||
//int_rt_type = H5Dget_type(dataset);
|
//int_rt_type = H5Dget_type(dataset);
|
||||||
|
|
||||||
DataSpace dataspace = dataset.getSpace();
|
DataSpace dataspace = dataset.getSpace();
|
||||||
@ -123,10 +123,7 @@ void h5_read_runtime_parameters
|
|||||||
DataSpace memspace(rank, &dimens_1d);
|
DataSpace memspace(rank, &dimens_1d);
|
||||||
//memspace = H5Screate_simple(rank, &dimens_1d, NULL);
|
//memspace = H5Screate_simple(rank, &dimens_1d, NULL);
|
||||||
|
|
||||||
dataset.read(int_rt_parms, int_rt_type, memspace, dataspace,
|
dataset.read(int_rt_parms, int_rt_type, memspace, dataspace);
|
||||||
H5P_DEFAULT);
|
|
||||||
//status = H5Dread(dataset, int_rt_type, memspace, dataspace,
|
|
||||||
// H5P_DEFAULT, int_rt_parms);
|
|
||||||
|
|
||||||
|
|
||||||
for (i = 0; i < nint_runtime_parameters; i++) {
|
for (i = 0; i < nint_runtime_parameters; i++) {
|
||||||
@ -145,14 +142,14 @@ void h5_read_runtime_parameters
|
|||||||
|
|
||||||
/* reals */
|
/* reals */
|
||||||
|
|
||||||
real_rt_parms = (real_runtime_params_t *) malloc(nreal_runtime_parameters * sizeof(real_runtime_params_t));
|
real_rt_parms = (real_runtime_params_t *) malloc(nreal_runtime_parameters * sizeof(real_runtime_params_t));
|
||||||
|
|
||||||
rank = 1;
|
rank = 1;
|
||||||
dataset = file->openDataSet("real runtime parameters");
|
dataset = file->openDataSet("real runtime parameters");
|
||||||
//dataset = H5Dopen(*file_identifier, "real runtime parameters");
|
//dataset = H5Dopen(*file_identifier, "real runtime parameters");
|
||||||
|
|
||||||
dataspace = dataset.getSpace();
|
dataspace = dataset.getSpace();
|
||||||
FloatType real_rt_type = dataset.getFloatType();
|
FloatType real_rt_type = dataset.getFloatType();
|
||||||
ndims = dataspace.getSimpleExtentDims(&dimens_1d, NULL);
|
ndims = dataspace.getSimpleExtentDims(&dimens_1d, NULL);
|
||||||
//dataspace = H5Dget_space(dataset);
|
//dataspace = H5Dget_space(dataset);
|
||||||
//real_rt_type = H5Dget_type(dataset);
|
//real_rt_type = H5Dget_type(dataset);
|
||||||
@ -167,10 +164,7 @@ void h5_read_runtime_parameters
|
|||||||
memspace = DataSpace(rank, &dimens_1d);
|
memspace = DataSpace(rank, &dimens_1d);
|
||||||
//memspace = H5Screate_simple(rank, &dimens_1d, NULL);
|
//memspace = H5Screate_simple(rank, &dimens_1d, NULL);
|
||||||
|
|
||||||
dataset.read(real_rt_parms, real_rt_type, memspace, dataspace,
|
dataset.read(real_rt_parms, real_rt_type, memspace, dataspace);
|
||||||
H5P_DEFAULT);
|
|
||||||
//status = H5Dread(dataset, real_rt_type, memspace, dataspace,
|
|
||||||
// H5P_DEFAULT, real_rt_parms);
|
|
||||||
|
|
||||||
|
|
||||||
for (i = 0; i < nreal_runtime_parameters; i++) {
|
for (i = 0; i < nreal_runtime_parameters; i++) {
|
||||||
@ -193,7 +187,7 @@ void h5_read_runtime_parameters
|
|||||||
*LBox = real_runtime_parameter_values[i];
|
*LBox = real_runtime_parameter_values[i];
|
||||||
}
|
}
|
||||||
if (strncmp(real_runtime_parameter_names[i],"hubbleconstant", 14) == 0 ) {
|
if (strncmp(real_runtime_parameter_names[i],"hubbleconstant", 14) == 0 ) {
|
||||||
*hubble = real_runtime_parameter_values[i];
|
*hubble = real_runtime_parameter_values[i];
|
||||||
}
|
}
|
||||||
if (strncmp(real_runtime_parameter_names[i],"omegamatter", 11) == 0 ) {
|
if (strncmp(real_runtime_parameter_names[i],"omegamatter", 11) == 0 ) {
|
||||||
*omegam = real_runtime_parameter_values[i];
|
*omegam = real_runtime_parameter_values[i];
|
||||||
@ -205,7 +199,7 @@ void h5_read_runtime_parameters
|
|||||||
*omegalambda = real_runtime_parameter_values[i];
|
*omegalambda = real_runtime_parameter_values[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < nint_runtime_parameters; i++) {
|
for (i = 0; i < nint_runtime_parameters; i++) {
|
||||||
if (strncmp(int_runtime_parameter_names[i],"pt_numx",7) == 0 ) {
|
if (strncmp(int_runtime_parameter_names[i],"pt_numx",7) == 0 ) {
|
||||||
*numPart = int_runtime_parameter_values[i];
|
*numPart = int_runtime_parameter_values[i];
|
||||||
@ -214,7 +208,7 @@ void h5_read_runtime_parameters
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
|
/* xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
|
||||||
void h5_read_flash3_particles (H5File* file,
|
void h5_read_flash3_particles (H5File* file,
|
||||||
int* totalparticles,
|
int* totalparticles,
|
||||||
@ -241,8 +235,8 @@ void h5_read_flash3_particles (H5File* file,
|
|||||||
char *propName;
|
char *propName;
|
||||||
double *partBuffer;
|
double *partBuffer;
|
||||||
char part_names[50][OUTPUT_PROP_LENGTH];
|
char part_names[50][OUTPUT_PROP_LENGTH];
|
||||||
int string_size;
|
int string_size;
|
||||||
|
|
||||||
// char part_names[NPART_PROPS][OUTPUT_PROP_LENGTH];
|
// char part_names[NPART_PROPS][OUTPUT_PROP_LENGTH];
|
||||||
hsize_t dimens_2d[2], maxdimens_2d[2];
|
hsize_t dimens_2d[2], maxdimens_2d[2];
|
||||||
hsize_t start_2d[2], count_2d[2], stride_2d[2];
|
hsize_t start_2d[2], count_2d[2], stride_2d[2];
|
||||||
@ -265,12 +259,12 @@ void h5_read_flash3_particles (H5File* file,
|
|||||||
|
|
||||||
//total number of particle properties
|
//total number of particle properties
|
||||||
numProps = dimens_2d[0];
|
numProps = dimens_2d[0];
|
||||||
|
|
||||||
string_size = OUTPUT_PROP_LENGTH;
|
string_size = OUTPUT_PROP_LENGTH;
|
||||||
StrType string_type = H5Tcopy(H5T_C_S1);
|
StrType string_type = H5Tcopy(H5T_C_S1);
|
||||||
string_type.setSize(string_size);
|
string_type.setSize(string_size);
|
||||||
//status = H5Tset_size(string_type, string_size);
|
//status = H5Tset_size(string_type, string_size);
|
||||||
|
|
||||||
rank = 2;
|
rank = 2;
|
||||||
|
|
||||||
start_2d[0] = 0;
|
start_2d[0] = 0;
|
||||||
@ -282,22 +276,20 @@ void h5_read_flash3_particles (H5File* file,
|
|||||||
count_2d[0] = dimens_2d[0];
|
count_2d[0] = dimens_2d[0];
|
||||||
count_2d[1] = dimens_2d[1];
|
count_2d[1] = dimens_2d[1];
|
||||||
|
|
||||||
dataspace.selectHyperslab(H5S_SELECT_SET, count_2d, start_2d);
|
dataspace.selectHyperslab(H5S_SELECT_SET, count_2d, start_2d);
|
||||||
//status = H5Sselect_hyperslab(dataspace, H5S_SELECT_SET, start_2d,
|
//status = H5Sselect_hyperslab(dataspace, H5S_SELECT_SET, start_2d,
|
||||||
// stride_2d, count_2d, NULL);
|
// stride_2d, count_2d, NULL);
|
||||||
|
|
||||||
DataSpace memspace(rank, dimens_2d);
|
DataSpace memspace(rank, dimens_2d);
|
||||||
//memspace = H5Screate_simple(rank, dimens_2d, NULL);
|
//memspace = H5Screate_simple(rank, dimens_2d, NULL);
|
||||||
|
|
||||||
dataset.read(part_names, string_type, H5S_ALL, H5S_ALL, H5P_DEFAULT);
|
dataset.read(part_names, string_type);
|
||||||
//status = H5Dread(dataset, string_type, H5S_ALL, H5S_ALL,
|
|
||||||
// H5P_DEFAULT, part_names);
|
|
||||||
|
|
||||||
|
|
||||||
string_type.close();
|
string_type.close();
|
||||||
memspace.close();
|
memspace.close();
|
||||||
dataspace.close();
|
dataspace.close();
|
||||||
dataset.close();
|
dataset.close();
|
||||||
//H5Tclose(string_type);
|
//H5Tclose(string_type);
|
||||||
//H5Sclose(memspace);
|
//H5Sclose(memspace);
|
||||||
//H5Sclose(dataspace);
|
//H5Sclose(dataspace);
|
||||||
@ -313,7 +305,7 @@ void h5_read_flash3_particles (H5File* file,
|
|||||||
if (strncmp(part_names[i], "velz", 4) == 0) { ipvz = i+1; }
|
if (strncmp(part_names[i], "velz", 4) == 0) { ipvz = i+1; }
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((iptag < 0) || (ipx < 0) || (ipy < 0) || (ipz < 0) || (ipvx < 0) ||
|
if ((iptag < 0) || (ipx < 0) || (ipy < 0) || (ipz < 0) || (ipvx < 0) ||
|
||||||
(ipvy < 0) || (ipvz < 0) ) {
|
(ipvy < 0) || (ipvz < 0) ) {
|
||||||
printf("One or more required particle attributes not found in file!\n");
|
printf("One or more required particle attributes not found in file!\n");
|
||||||
return;
|
return;
|
||||||
@ -325,7 +317,7 @@ void h5_read_flash3_particles (H5File* file,
|
|||||||
//read particles
|
//read particles
|
||||||
dataset = file->openDataSet("tracer particles");
|
dataset = file->openDataSet("tracer particles");
|
||||||
//dataset = H5Dopen(*file_identifier, "tracer particles");
|
//dataset = H5Dopen(*file_identifier, "tracer particles");
|
||||||
|
|
||||||
FloatType datatype = dataset.getFloatType();
|
FloatType datatype = dataset.getFloatType();
|
||||||
//datatype = H5Dget_type(dataset);
|
//datatype = H5Dget_type(dataset);
|
||||||
|
|
||||||
@ -338,7 +330,7 @@ void h5_read_flash3_particles (H5File* file,
|
|||||||
ndims = dataspace.getSimpleExtentDims(dimens_2d, NULL);
|
ndims = dataspace.getSimpleExtentDims(dimens_2d, NULL);
|
||||||
//dataspace = H5Dget_space(dataset);
|
//dataspace = H5Dget_space(dataset);
|
||||||
//H5Sget_simple_extent_dims(dataspace, dimens_2d, maxdimens_2d);
|
//H5Sget_simple_extent_dims(dataspace, dimens_2d, maxdimens_2d);
|
||||||
|
|
||||||
/*insert particle properties (numPartBuffer) particles at a time*/
|
/*insert particle properties (numPartBuffer) particles at a time*/
|
||||||
pstack = (*localnp);
|
pstack = (*localnp);
|
||||||
poffset = 0;
|
poffset = 0;
|
||||||
@ -366,7 +358,7 @@ void h5_read_flash3_particles (H5File* file,
|
|||||||
dimens_2d[0] = (pcount);
|
dimens_2d[0] = (pcount);
|
||||||
dimens_2d[1] = (numProps);
|
dimens_2d[1] = (numProps);
|
||||||
|
|
||||||
dataspace.selectHyperslab(H5S_SELECT_SET, count_2d, start_2d);
|
dataspace.selectHyperslab(H5S_SELECT_SET, count_2d, start_2d);
|
||||||
//status = H5Sselect_hyperslab(dataspace, H5S_SELECT_SET, start_2d,
|
//status = H5Sselect_hyperslab(dataspace, H5S_SELECT_SET, start_2d,
|
||||||
// stride_2d, count_2d, NULL);
|
// stride_2d, count_2d, NULL);
|
||||||
|
|
||||||
@ -374,8 +366,7 @@ void h5_read_flash3_particles (H5File* file,
|
|||||||
//memspace = H5Screate_simple(rank, dimens_2d, maxdimens_2d);
|
//memspace = H5Screate_simple(rank, dimens_2d, maxdimens_2d);
|
||||||
|
|
||||||
/* read data from the dataset */
|
/* read data from the dataset */
|
||||||
dataset.read(partBuffer, datatype, memspace, dataspace, H5P_DEFAULT);
|
dataset.read(partBuffer, datatype, memspace, dataspace);
|
||||||
//status = H5Dread(dataset, datatype, memspace, dataspace, H5P_DEFAULT, partBuffer);
|
|
||||||
|
|
||||||
/* convert buffer into particle struct */
|
/* convert buffer into particle struct */
|
||||||
|
|
||||||
@ -391,8 +382,8 @@ void h5_read_flash3_particles (H5File* file,
|
|||||||
pos3[p+poffset] = (float) *(partBuffer+ipz-1+p*numProps);
|
pos3[p+poffset] = (float) *(partBuffer+ipz-1+p*numProps);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (vel1 && vel2 && vel3) {
|
if (vel1 && vel2 && vel3) {
|
||||||
for(p=0; p < (pcount); p++) {
|
for(p=0; p < (pcount); p++) {
|
||||||
vel1[p+poffset] = (float) *(partBuffer+ipvx-1+p*numProps);
|
vel1[p+poffset] = (float) *(partBuffer+ipvx-1+p*numProps);
|
||||||
@ -423,7 +414,7 @@ void h5_read_flash3_particles (H5File* file,
|
|||||||
//status = H5Sclose(dataspace);
|
//status = H5Sclose(dataspace);
|
||||||
//status = H5Dclose(dataset);
|
//status = H5Dclose(dataset);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
|
/*xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
|
||||||
|
|
||||||
@ -451,7 +442,7 @@ void h5_read_flash3_header_info(H5File* file,
|
|||||||
|
|
||||||
H5std_string DATASET_NAME;
|
H5std_string DATASET_NAME;
|
||||||
|
|
||||||
string_type = H5Tcopy(H5T_C_S1);
|
string_type = H5Tcopy(H5T_C_S1);
|
||||||
H5Tset_size(string_type, MAX_STRING_LENGTH);
|
H5Tset_size(string_type, MAX_STRING_LENGTH);
|
||||||
|
|
||||||
DataSet dataset = file->openDataSet("real scalars");
|
DataSet dataset = file->openDataSet("real scalars");
|
||||||
@ -467,13 +458,13 @@ void h5_read_flash3_header_info(H5File* file,
|
|||||||
/* malloc a pointer to a list of real_list_t's */
|
/* malloc a pointer to a list of real_list_t's */
|
||||||
real_list = (real_list_t *) malloc(dimens_1d * sizeof(real_list_t));
|
real_list = (real_list_t *) malloc(dimens_1d * sizeof(real_list_t));
|
||||||
|
|
||||||
// create a new simple dataspace of 1 dimension and size of 'dimens_1d'
|
// create a new simple dataspace of 1 dimension and size of 'dimens_1d'
|
||||||
DataSpace memspace(1, &dimens_1d);
|
DataSpace memspace(1, &dimens_1d);
|
||||||
|
|
||||||
// create an empty vessel sized to hold one real_list_t's worth of data
|
// create an empty vessel sized to hold one real_list_t's worth of data
|
||||||
CompType real_list_type( sizeof(real_list_t) );
|
CompType real_list_type( sizeof(real_list_t) );
|
||||||
|
|
||||||
// subdivide the empty vessel into its component sections (name and value)
|
// subdivide the empty vessel into its component sections (name and value)
|
||||||
real_list_type.insertMember(
|
real_list_type.insertMember(
|
||||||
"name",
|
"name",
|
||||||
HOFFSET(real_list_t, name),
|
HOFFSET(real_list_t, name),
|
||||||
@ -484,9 +475,8 @@ void h5_read_flash3_header_info(H5File* file,
|
|||||||
HOFFSET(real_list_t, value),
|
HOFFSET(real_list_t, value),
|
||||||
PredType::NATIVE_DOUBLE);
|
PredType::NATIVE_DOUBLE);
|
||||||
|
|
||||||
// read the data into 'real_list'
|
// read the data into 'real_list'
|
||||||
dataset.read( real_list, real_list_type, memspace, dataspace,
|
dataset.read( real_list, real_list_type, memspace, dataspace);
|
||||||
H5P_DEFAULT);
|
|
||||||
|
|
||||||
|
|
||||||
if (status < 0) {
|
if (status < 0) {
|
||||||
|
Loading…
Reference in New Issue
Block a user