43 hid_t f,
const char *path,
int abscissaDim,
int ordinateDim,
44 int *abscissaNslots,
double *abscissaMin,
double *abscissaMax,
45 char **abscissaUnits,
char **abscissaNames,
46 char **ordinateUnits,
char **ordinateNames,
double *ordinate) {
51 hid_t histogram = H5Gcreate2(f, path, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
58 dims[0] = ordinateDim;
59 for (
int i=0; i<abscissaDim; i++) {
60 dims[i+1] = abscissaNslots[i];
65 err = H5LTmake_dataset_double(histogram ,
"ordinate", abscissaDim+1,
71 for(
int i=0; i<ordinateDim; i++) {
72 sprintf(temppath,
"name_%02d", i);
73 H5LTset_attribute_string(histogram,
"ordinate", temppath,
75 sprintf(temppath,
"unit_%02d", i);
76 H5LTset_attribute_string(histogram,
"ordinate", temppath,
83 err = H5LTmake_dataset_int(histogram ,
"ordinate_ndim", 1, &dimsize,
89 err = H5LTmake_dataset_int(histogram ,
"abscissa_ndim", 1, &dimsize,
97 for (
int i=0; i<abscissaDim; i++) {
99 double* abscissavec = (
double *) malloc( (dims[i+1]+1)*
sizeof(double) );
100 for(
int j=0; j<dims[i+1]+1; j++) {
102 abscissaMin[i] + j * ( (abscissaMax[i] - abscissaMin[i])
103 / abscissaNslots[i] );
107 char abscissapath[256];
108 sprintf(abscissapath,
"abscissa_vec_%02d",i+1);
109 hsize_t abscissasize[1] = {abscissaNslots[i]+1};
110 err = H5LTmake_dataset_double(histogram , abscissapath, 1, abscissasize,
119 sprintf(temppath,
"abscissa_nbin_%02d", i+1);
120 err = H5LTmake_dataset_int(histogram, temppath, 1, &dimsize,
121 &(abscissaNslots[i]));
128 sprintf(temppath,
"name_%02d", i);
129 H5LTset_attribute_string(histogram, abscissapath, temppath,
131 sprintf(temppath,
"unit_%02d", i);
132 H5LTset_attribute_string(histogram, abscissapath, temppath,
int hdf5_histogram_write_uniform_double(hid_t f, const char *path, int abscissaDim, int ordinateDim, int *abscissaNslots, double *abscissaMin, double *abscissaMax, char **abscissaUnits, char **abscissaNames, char **ordinateUnits, char **ordinateNames, double *ordinate)
Write a histogram with uniform grid to HDF5 file.