23 #ifndef O2SCL_HDF_IO_H 24 #define O2SCL_HDF_IO_H 29 #include <boost/numeric/ublas/vector.hpp> 31 #include <o2scl/hdf_file.h> 32 #include <o2scl/table.h> 33 #include <o2scl/table_units.h> 34 #include <o2scl/hist.h> 35 #include <o2scl/hist_2d.h> 36 #include <o2scl/table3d.h> 37 #include <o2scl/tensor_grid.h> 38 #include <o2scl/expval.h> 39 #include <o2scl/contour.h> 40 #include <o2scl/uniform_grid.h> 41 #include <o2scl/prob_dens_mdim_amr.h> 50 template<
class vec_t,
class mat_t>
56 if (name.length()==0) {
58 if (name.length()==0) {
59 O2SCL_ERR2(
"No object of type prob_dens_mdim_amr found in ",
70 std::vector<double> data;
71 std::vector<size_t> insides;
93 template<
class vec_t,
class mat_t>
99 O2SCL_ERR2(
"File not opened with write access in hdf_output",
100 "(hdf_file,prob_dens_mdim_amr<>,string).",
110 hf.
sets_fixed(
"o2scl_type",
"prob_dens_mdim_amr");
113 std::vector<double> data;
114 std::vector<size_t> insides;
137 #ifndef O2SCL_NO_HDF_INPUT 145 template<
class vec_t>
149 if (name.length()==0) {
151 if (name.length()==0) {
152 O2SCL_ERR2(
"No object of type table found in ",
183 template<
class vec_t>
194 if (type2!=
"table") {
195 O2SCL_ERR2(
"Typename in HDF group does not match ",
200 std::vector<std::string> cnames, cols;
207 if (cnames.size()!=cvalues.size()) {
208 O2SCL_ERR2(
"Size mismatch between constant names and values ",
211 for(
size_t i=0;i<cnames.size();i++) {
217 for(
size_t i=0;i<cols.size();i++) {
223 hf.
geti(
"nlines",nlines2);
237 ubvector vtmp(nlines2);
239 for(
int j=0;j<nlines2;j++) {
269 template<
class vec_t>
274 if (name.length()==0) {
276 if (name.length()==0) {
277 O2SCL_ERR2(
"No object of type table found in ",
307 template<
class vec_t>
319 hf.
geti(
"unit_flag",uf);
323 std::vector<std::string> units;
325 for(
size_t i=0;i<units.size();i++) {
350 std::string name=
"");
366 std::string name=
"");
368 void hdf_output(
hdf_file &hf,
const std::vector<o2scl::contour_line> &cl,
372 std::string name=
"");
374 void hdf_output(
hdf_file &hf,
const std::vector<o2scl::edge_crossings> &ec,
378 std::string name=
"");
381 std::vector<size_t> > &t, std::string name);
384 std::vector<size_t> > &t, std::string name=
"");
int getd_vec(std::string name, std::vector< double > &v)
Get vector dataset and place data in v.
Tensor class with arbitrary dimensions with a grid.
int setd_vec(std::string name, const std::vector< double > &v)
Set vector dataset named name with v.
Matrix expectation value.
int geti(std::string name, int &i)
Get a integer named name.
int set_szt_vec(std::string name, const std::vector< size_t > &v)
Set vector dataset named name with v.
int get_szt_def(std::string name, size_t def, size_t &i)
Get a size_t named name.
void hdf_input_data(hdf_file &hf, o2scl::table< vec_t > &t)
Internal function for inputting a o2scl::table object.
void set_szt(std::string name, size_t u)
Set an unsigned integer named name to value u.
void set_nlines(size_t il)
Set the number of lines.
invalid argument supplied by user
A two-dimensional histogram class.
void sets_fixed(std::string name, std::string s)
Set a fixed-length string named name to value s.
void check_synchro() const
Check if the tree and list are properly synchronized.
int get_szt(std::string name, size_t &u)
Get an unsigned integer named name.
hid_t get_current_id()
Retrieve the current working id.
A one-dimensional histogram class.
virtual void clear_table()
Clear the table and the column names (but leave constants)
int close_group(hid_t group)
Close a previously created group.
int find_object_by_type(std::string type, std::string &name, int verbose=0)
Look in hdf_file hf for an O<span style='position: relative; top: 0.3em; font-size: 0...
void set_unit(std::string scol, std::string unit)
Set the unit for column scol to unit.
Cubic spline for natural boundary conditions.
int gets_fixed(std::string name, std::string &s)
Get a fixed-length string named name.
Vector expectation value.
void copy_to_vectors(size_t &nd, size_t &dc, size_t &ms, std::vector< double > &data, std::vector< size_t > &insides)
Copy the object data to three size_t numbers and two vectors.
#define O2SCL_ERR2(d, d2, n)
Set an error, two-string version.
The O<span style='position: relative; top: 0.3em; font-size: 0.8em'>2</span>scl O$_2$scl namespace ...
bool has_write_access()
If true, then the file has read and write access.
void set_current_id(hid_t cur)
Set the current working id.
virtual void add_constant(std::string name, double val)
Add a constant, or if the constant already exists, change its value.
Scalar expectation value.
Probability distribution from an adaptive mesh created using a matrix of points.
size_t get_ncolumns() const
Return the number of columns.
Data table table class with units.
void new_column(std::string head)
Add a new column owned by the table table .
void set_from_vectors(size_t &nd, size_t &dc, size_t &ms, const std::vector< double > &data, const std::vector< size_t > &insides)
Set the object from data specified as three size_t numbers and a set of two vectors.
A data structure containing one or more slices of two-dimensional data points defined on a grid...
Store data in an O<span style='position: relative; top: 0.3em; font-size: 0.8em'>2</span>scl O$_2$sc...
void set(std::string scol, size_t row, double val)
Set row row of column named col to value val . .
int gets_vec(std::string name, std::vector< std::string > &s)
Get a vector of strings named name and store it in s.
int getd_vec_copy(std::string name, vec_t &v)
Get vector dataset and place data in v.
size_t itype
Current interpolation type.
std::string get_column_name(size_t icol) const
Returns the name of column col .
void hdf_input(hdf_file &hf, o2scl::table< vec_t > &t, std::string name)
Input a o2scl::table object from a hdf_file.
void clear_constants()
CLear all constants.
int get_szt_vec(std::string name, std::vector< size_t > &v)
Get vector dataset and place data in v.
hid_t open_group(hid_t init_id, std::string path)
Open a group relative to the location specified in init_id.