Data table class with units. More...
#include <table_units.h>
Definition at line 42 of file table_units.h.
Public Member Functions | |
table_units (int cmaxlines=0) | |
Create a new table_units with space for nlines<=cmaxlines. | |
Copy constructors | |
table_units (const table_units &t) | |
Copy with constructor from table_units. | |
table_units (const table< vec_t > &t) | |
Copy with constructor from table. | |
table_units & | operator= (const table_units &t) |
Copy with operator= from table_units. | |
table_units & | operator= (const table< vec_t > &t) |
Copy with operator= from table. | |
template<class vec2_t > | |
void | copy_rows (std::string func, table_units< vec2_t > &dest) |
Copy all rows matching a particular condition to a new table. More... | |
Unit manipulation | |
std::string | get_unit (std::string scol) const |
Get the unit for column scol . | |
void | line_of_units (std::string unit_line) |
Specify the units as a string separated by spaces. | |
std::string | get_unit (size_t i) const |
Get the unit for column with index i. More... | |
void | remove_unit (std::string scol) |
Remove the unit for column scol . | |
void | set_unit (std::string scol, std::string unit) |
Set the unit for column scol to unit . | |
int | convert_to_unit (std::string scol, std::string unit, bool err_on_fail=true) |
Convert the units of column scol to unit . | |
size_t | get_nunits () |
Return the number of columns with units. | |
Virtual functions from \ref table | |
convert_units< double > * | cup |
The pointer to the convert units object. | |
virtual void | clear_table () |
Clear the table and the column names and units (but leave constants) | |
virtual void | delete_column (std::string scol) |
Delete column named scol . | |
virtual void | rename_column (std::string src, std::string dest) |
Rename column named src to dest ![]() | |
virtual void | summary (std::ostream *out, size_t ncol=79) const |
Output a summary of the information stored. | |
virtual const char * | type () |
Return the type, "table_units" . | |
virtual void | copy_column (std::string src, std::string dest) |
Copy data from column named src to column named dest , creating a new column if necessary ![]() | |
virtual int | read_generic (std::istream &fin, int verbose=0) |
Clear the current table and read from a generic data file. | |
template<class vec2_t > | |
void | insert_table (table_units< vec2_t > &source, std::string src_index, bool allow_extrap=true, std::string dest_index="") |
Insert columns from a source table into the new table by interpolation (or extrapolation) More... | |
void | o2scl_hdf::hdf_output (o2scl_hdf::hdf_file &hf, table_units<> &t, std::string name) |
template<class vecf_t > | |
void | o2scl_hdf::hdf_input (o2scl_hdf::hdf_file &hf, table_units< vecf_t > &t, std::string name) |
void | o2scl_hdf::hdf_output_data (o2scl_hdf::hdf_file &hf, table_units<> &t) |
template<class vecf_t > | |
void | o2scl_hdf::hdf_input_data (o2scl_hdf::hdf_file &hf, table_units< vecf_t > &t) |
Unit map iterator types | |
typedef std::map< std::string, std::string, std::greater< std::string > >::iterator | uiter |
typedef std::map< std::string, std::string, std::greater< std::string > >::const_iterator | uciter |
std::map< std::string, std::string, std::greater< std::string > > | utree |
Unit map. | |
|
inlinevirtual |
This function also sets the units of column dest
to be the same as that in src
, even if the column named dest
already exists and previously had different units.
Definition at line 626 of file table_units.h.
|
inline |
This function begins by ensuring that all columns in the current table are present in dest
, creating new columns (and copying their units) in dest
if necessary. It then copies all rows where func
evaluates to a number greater than 0.5 to table dest
by adding rows at the end of the table.
Definition at line 312 of file table_units.h.
|
inline |
Definition at line 381 of file table_units.h.
|
inline |
This takes all of the columns in source
, and adds them into the current table using interpolation, using the columns src_index
and dest_index
as the independent variable. The column named src_index
is the column of the independent variable in source
and the column named dest_index
is the column of the independent variable in the current table. If dest_index
is empty (the default) then the names in the two tables are taken to be the same.
If necessary, columns are created in the current table for the dependent variable columns in source
. Columns in the current table which do not correspond to dependent variable columns in source
are left unchanged.
If allow_extrap
is false, then extrapolation is not allowed, and rows in the current table which have values of the independent variable which are outside the source table are unmodified.
If a column for a dependent variable in source
has the same name as dest_index
, then it is ignored and not inserted into the current table.
If the column named src_index
cannot be found in source
or the column names dest_index
cannot be found in the current table, then the error handler is called.
If the allow_extrap
is false and either the minimum or maximum values of the column named src_index
in the source
table are not finite, then the error handler is called.
Definition at line 828 of file table_units.h.
Documentation generated with Doxygen. Provided under the
GNU Free Documentation License (see License Information).