Implemented pitch angle resolution.
Still includes (and uses) the non-pitch angle resolved fields as well; have to be either removed completely or refactored s.t. one of the two options is chosen. Pitch angle distribution has a hardcoded number of bins for now, and exists in 'energy_binning.h'
This commit is contained in:
@@ -162,6 +162,36 @@ blitz::Array<double, 4> Hdf5Reader::readD4Double(std::string path) {
|
||||
return data.copy();
|
||||
}
|
||||
|
||||
blitz::Array<double, 5> Hdf5Reader::readD5Double(std::string path) {
|
||||
hid_t file = H5Fopen(absolute_filename_.c_str(), H5F_ACC_RDONLY, H5P_DEFAULT);
|
||||
|
||||
H5Eset_auto(H5E_DEFAULT, NULL, NULL);
|
||||
hid_t dataset;
|
||||
dataset = H5Dopen2(file, path.c_str(), H5P_DEFAULT);
|
||||
hid_t dataspace = H5Dget_space(dataset);
|
||||
if (dataset < 0) {
|
||||
ERROR("The given dataset could not be opened");
|
||||
}
|
||||
// turn error report back onby hdf5 because of check H5Dopen2
|
||||
H5Eset_auto(H5E_DEFAULT, H5E_DEFAULT, H5E_DEFAULT);
|
||||
|
||||
const int ndims = H5Sget_simple_extent_ndims(dataspace);
|
||||
hsize_t dims[ndims];
|
||||
if (ndims != 5) {
|
||||
ERROR("The given dataset is not five-dimensional. It has dims: " + ndims);
|
||||
}
|
||||
H5Sget_simple_extent_dims(dataspace, dims, NULL);
|
||||
|
||||
blitz::Array<double, 5> data(dims[0], dims[1], dims[2], dims[3], dims[4]);
|
||||
|
||||
H5Dread(dataset, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT,
|
||||
data.data());
|
||||
|
||||
H5Dclose(dataset);
|
||||
H5Fclose(file);
|
||||
return data.copy();
|
||||
}
|
||||
|
||||
blitz::Array<long int, 4> Hdf5Reader::readD4LongInt(std::string path) {
|
||||
hid_t file = H5Fopen(absolute_filename_.c_str(), H5F_ACC_RDONLY, H5P_DEFAULT);
|
||||
|
||||
@@ -192,6 +222,35 @@ blitz::Array<long int, 4> Hdf5Reader::readD4LongInt(std::string path) {
|
||||
return data.copy();
|
||||
}
|
||||
|
||||
blitz::Array<long int, 5> Hdf5Reader::readD5LongInt(std::string path) {
|
||||
hid_t file = H5Fopen(absolute_filename_.c_str(), H5F_ACC_RDONLY, H5P_DEFAULT);
|
||||
|
||||
H5Eset_auto(H5E_DEFAULT, NULL, NULL);
|
||||
hid_t dataset;
|
||||
dataset = H5Dopen2(file, path.c_str(), H5P_DEFAULT);
|
||||
hid_t dataspace = H5Dget_space(dataset);
|
||||
if (dataset < 0) {
|
||||
ERROR("The given dataset could not be opened");
|
||||
}
|
||||
// turn error report back onby hdf5 because of check H5Dopen2
|
||||
H5Eset_auto(H5E_DEFAULT, H5E_DEFAULT, H5E_DEFAULT);
|
||||
|
||||
const int ndims = H5Sget_simple_extent_ndims(dataspace);
|
||||
hsize_t dims[ndims];
|
||||
if (ndims != 5) {
|
||||
ERROR("The given dataset is not five-dimensional. It has dims: " + ndims);
|
||||
}
|
||||
H5Sget_simple_extent_dims(dataspace, dims, NULL);
|
||||
|
||||
blitz::Array<long int, 5> data(dims[0], dims[1], dims[2], dims[3], dims[4]);
|
||||
|
||||
H5Dread(dataset, H5T_NATIVE_LONG, H5S_ALL, H5S_ALL, H5P_DEFAULT,
|
||||
data.data());
|
||||
|
||||
H5Dclose(dataset);
|
||||
H5Fclose(file);
|
||||
return data.copy();
|
||||
}
|
||||
|
||||
// reads the engine stringstream with the correct size from the file, such that it should be able
|
||||
// to be used for the initialization of the random engine without any further modification
|
||||
|
||||
Reference in New Issue
Block a user