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>
48 void hdf_output(hdf_file &hf,
o2scl::table<> &t, std::string name);
58 if (name.length()==0) {
60 if (name.length()==0) {
61 O2SCL_ERR2(
"No object of type table found in ",
100 if (type2!=
"table") {
101 O2SCL_ERR2(
"Typename in HDF group does not match ",
106 std::vector<std::string> cnames, cols;
113 if (cnames.size()!=cvalues.size()) {
114 O2SCL_ERR2(
"Size mismatch between constant names and values ",
117 for(
size_t i=0;i<cnames.size();i++) {
123 for(
size_t i=0;i<cols.size();i++) {
129 hf.
geti(
"nlines",nlines2);
143 ubvector vtmp(nlines2);
145 for(
int j=0;j<nlines2;j++) {
172 template<
class vec_t>
177 if (name.length()==0) {
179 if (name.length()==0) {
180 O2SCL_ERR2(
"No object of type table found in ",
208 template<
class vec_t>
220 hf.
geti(
"unit_flag",uf);
224 std::vector<std::string> units;
226 for(
size_t i=0;i<units.size();i++) {
235 void hdf_output(hdf_file &hf,
o2scl::hist &h, std::string name);
239 void hdf_output(hdf_file &hf,
o2scl::hist_2d &h, std::string name);
243 void hdf_output(hdf_file &hf,
o2scl::table3d &h, std::string name);
267 std::string name=
"");
269 void hdf_output(hdf_file &hf, std::vector<o2scl::contour_line> &cl,
272 void hdf_input(hdf_file &hf, std::vector<o2scl::contour_line> &cl,
273 std::string name=
"");
275 void hdf_output(hdf_file &hf, std::vector<o2scl::edge_crossings> &ec,
278 void hdf_input(hdf_file &hf, std::vector<o2scl::edge_crossings> &ec,
279 std::string name=
"");
void clear_table()
Clear the table and the column names (but leave constants)
Tensor class with arbitrary dimensions with a grid.
Matrix expectation value.
int geti(std::string name, int &i)
Get a integer named name.
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_nlines(size_t il)
Set the number of lines.
invalid argument supplied by user
A two-dimensional histogram class.
hid_t get_current_id()
Retrieve the current working id.
A one-dimensional histogram class.
void check_synchro() const
Return 0 if the tree and list are properly synchronized.
int close_group(hid_t group)
Close a previously created group.
std::string get_column_name(size_t icol) const
Returns the name of column col .
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.
#define O2SCL_ERR2(d, d2, n)
Set an error, two-string version.
void set_current_id(hid_t cur)
Set the current working id.
int find_group_by_type(hdf_file &hf, std::string type, std::string &group_name, int verbose=0)
Look in hdf_file hf for an O<span style='position: relative; top: 0.3em; font-size: 0...
virtual void add_constant(std::string name, double val)
Add a constant, or if the constant already exists, change its value.
Scalar expectation value.
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 .
A data structure containing many 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$scl...
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.
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.
hid_t open_group(hid_t init_id, std::string path)
Open a group relative to the location specified in init_id.