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. | |
| 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... | |
| 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 . More... | |
| 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) | |
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. | |
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 | |
| 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. | |
Public Member Functions inherited from o2scl::table< vec_t > | |
| template<class vec2_t > | |
| void | insert_table (table< 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) | |
| table (size_t cmaxlines=0) | |
| Create a new table with space for nlines<=cmaxlines. | |
| virtual | ~table () |
| Table destructor. | |
| table (const table &t) | |
| Copy constructor. | |
| table & | operator= (const table &t) |
| Copy constructor. | |
| void | set (std::string scol, size_t row, double val) |
Set row row of column named col to value val . . More... | |
| void | set (size_t icol, size_t row, double val) |
Set row row of column number icol to value val . . | |
| template<class size_vec_t > | |
| void | set_row (size_t row, size_vec_t &v) |
| Set an entire row of data. More... | |
| double | get (std::string scol, size_t row) const |
Get value from row row of column named col. . | |
| double | get (size_t icol, size_t row) const |
Get value from row row of column number icol. . | |
| size_t | get_ncolumns () const |
| Return the number of columns. | |
| size_t | get_nlines () const |
| Return the number of lines. | |
| void | set_nlines (size_t il) |
| Set the number of lines. More... | |
| size_t | get_maxlines () |
| Return the maximum number of lines before a reallocation is required. | |
| template<class resize_vec_t > | |
| void | get_row (std::string scol, double val, resize_vec_t &row) const |
Returns a copy of the row with value val in column col. . More... | |
| template<class resize_vec_t > | |
| void | get_row (size_t irow, resize_vec_t &row) const |
Returns a copy of row number irow. . More... | |
| void | set_nlines_auto (size_t il) |
| Set the number of lines, increasing the size more agressively. More... | |
| void | inc_maxlines (size_t llines) |
| Manually increase the maximum number of lines. | |
| void | set_maxlines (size_t llines) |
| Manually set the maximum number of lines. More... | |
| const vec_t & | get_column (std::string scol) const |
Returns a reference to the column named col. . | |
| const vec_t & | operator[] (size_t icol) const |
Returns the column of index icol (const version). . More... | |
| const vec_t & | operator[] (std::string scol) const |
Returns the column named scol (const version). . More... | |
| void | new_column (std::string head) |
Add a new column owned by the table . More... | |
| template<class vec2_t > | |
| int | new_column (std::string name, size_t sz, vec2_t &v) |
| Add a new column by copying data from another vector. More... | |
| std::string | get_column_name (size_t icol) const |
Returns the name of column col . More... | |
| virtual void | swap_column_data (std::string scol, vec_t &v) |
Swap the data in column scol with that in vector v. More... | |
| std::string | get_sorted_name (size_t icol) const |
Returns the name of column col in sorted order. . | |
| void | init_column (std::string scol, double val) |
Initialize all values of column named scol to val . More... | |
| bool | is_column (std::string scol) const |
Return true if scol is a column in the current table. More... | |
| size_t | lookup_column (std::string lname) const |
Find the index for column named name . More... | |
| template<class resize_vec_t > | |
| void | column_to_vector (std::string scol, resize_vec_t &v) const |
| Copy a column to a generic vector object. More... | |
| template<class vec2_t > | |
| void | copy_to_column (vec2_t &v, std::string scol) |
| Copy to a column from a generic vector object. More... | |
| template<class vec2_t > | |
| void | add_col_from_table (table< vec2_t > &source, std::string src_index, std::string src_col, std::string dest_index, std::string dest_col="") |
| Insert a column from a separate table, interpolating it into a new column. More... | |
| void | new_row (size_t n) |
Insert a row before row n. More... | |
| void | copy_row (size_t src, size_t dest) |
Copy the data in row src to row dest. More... | |
| void | delete_row (std::string scol, double val) |
Delete the row with the entry closest to the value val in column scol . | |
| void | delete_row (size_t irow) |
Delete the row of index irow . | |
| void | delete_rows_func (std::string func) |
Delete all rows where func evaluates to a number greater than 0.5 . More... | |
| template<class vec2_t > | |
| void | copy_rows (std::string func, table< vec2_t > &dest) |
| Copy all rows matching a particular condition to a new table. More... | |
| void | delete_rows_ends (size_t row_start, size_t row_end) |
Delete all rows between row_start and row_end . More... | |
| template<class vec_size_t > | |
| void | delete_rows_list (vec_size_t &row_list) |
| Delete all rows in a specified list. More... | |
| size_t | delete_rows_tolerance (double tol_rel=1.0e-12, double tol_abs=1.0e-20, int verbose=0) |
| Exaustively search for groups of rows which match within a specified tolerance and remove all but one of each group. More... | |
| void | delete_idadj_rows () |
| Delete all rows which are identical to adjacent rows. More... | |
| void | line_of_names (std::string newheads) |
Read a new set of names from newheads. More... | |
| template<class vec2_t > | |
| void | line_of_data (size_t nv, const vec2_t &v) |
Read a line of data from the first nv entries in a vector and store as a new row in the table. More... | |
| template<class vec2_t > | |
| void | line_of_data (const vec2_t &v) |
| Read a line of data and store in a new row of the table. More... | |
| size_t | ordered_lookup (std::string scol, double val) const |
Look for a value in an ordered column . More... | |
| size_t | lookup (std::string scol, double val) const |
Exhaustively search column col for the value val . | |
| double | lookup_val (std::string scol, double val, std::string scol2) const |
Search column col for the value val and return value in col2. | |
| size_t | lookup (int icol, double val) const |
Exhaustively search column col for the value val . | |
| size_t | mlookup (std::string scol, double val, std::vector< size_t > &results, double threshold=0.0) const |
Exhaustively search column col for many occurences of val . | |
| void | set_interp_type (size_t interp_type) |
| Set the base interpolation objects. | |
| size_t | get_interp_type () const |
| Get the interpolation type. | |
| double | interp (std::string sx, double x0, std::string sy) |
Interpolate value x0 from column named sx into column named sy. More... | |
| double | interp_const (std::string sx, double x0, std::string sy) const |
Interpolate value x0 from column named sx into column named sy (const version) More... | |
| double | interp (size_t ix, double x0, size_t iy) |
Interpolate value x0 from column with index ix into column with index iy . | |
| double | interp_const (size_t ix, double x0, size_t iy) const |
Interpolate value x0 from column with index ix into column with index iy . | |
| void | deriv (std::string x, std::string y, std::string yp) |
Make a new column named yp which is the derivative formed from columns named x and y . | |
| double | deriv (std::string sx, double x0, std::string sy) |
Compute the first derivative of the function defined by x-values stored in column named sx and y-values stored in column named sy at the value x0. More... | |
| double | deriv_const (std::string sx, double x0, std::string sy) const |
Compute the first derivative of the function defined by x-values stored in column named sx and y-values stored in column named sy at the value x0 (const version) More... | |
| double | deriv (size_t ix, double x0, size_t iy) |
Compute the first derivative of the function defined by x-values stored in column with index ix and y-values stored in column with index iy at the value x0. More... | |
| double | deriv_const (size_t ix, double x0, size_t iy) const |
Compute the first derivative of the function defined by x-values stored in column with index ix and y-values stored in column with index iy at the value x0 (const version) More... | |
| void | deriv2 (std::string x, std::string y, std::string yp) |
Create a new column named yp which is equal to the second derivative of the function defined by x-values stored in column named x and y-values stored in column named y, i.e. - O(log(C)*R). | |
| double | deriv2 (std::string sx, double x0, std::string sy) |
Compute the second derivative of the function defined by x-values stored in column named sx and y-values stored in column named sy at the value x0. More... | |
| double | deriv2_const (std::string sx, double x0, std::string sy) const |
The Compute the second derivative of the function defined by x-values stored in column named sx and y-values stored in column named sy at the value x0 (const version) More... | |
| double | deriv2 (size_t ix, double x0, size_t iy) |
Compute the second derivative of the function defined by x-values stored in column with index ix and y-values stored in column with index iy at the value x0. More... | |
| double | deriv2_const (size_t ix, double x0, size_t iy) const |
Compute the second derivative of the function defined by x-values stored in column with index ix and y-values stored in column with index iy at the value x0 (const version) More... | |
| double | integ (std::string sx, double x1, double x2, std::string sy) |
Compute the integral of the function defined by x-values stored in column named sx and y-values stored in column named sy between the values x1 and x2. More... | |
| double | integ_const (std::string sx, double x1, double x2, std::string sy) const |
Compute the integral of the function defined by x-values stored in column named sx and y-values stored in column named sy between the values x1 and x2 (const version) More... | |
| double | integ (size_t ix, double x1, double x2, size_t iy) |
Compute the integral of the function defined by x-values stored in column with index ix and y-values stored in column with index iy between the values x1 and x2. More... | |
| double | integ_const (size_t ix, double x1, double x2, size_t iy) const |
Compute the integral of the function defined by x-values stored in column with index ix and y-values stored in column with index iy between the values x1 and x2 (const version) More... | |
| void | integ (std::string x, std::string y, std::string ynew) |
Create a new column named ynew which is equal to the integral of the function defined by x-values stored in column named x and y-values stored in column named y. More... | |
| double | max (std::string scol) const |
Return column maximum. Makes no assumptions about ordering, . | |
| double | min (std::string scol) const |
Return column minimum. Makes no assumptions about ordering, . | |
| void | subtable (std::string list, size_t top, size_t bottom, table< vec_t > &tnew) const |
| Make a subtable. More... | |
| void | zero_table () |
| Zero the data entries but keep the column names and nlines fixed. | |
| virtual void | clear () |
| Clear everything. | |
| void | clear_data () |
| Remove all of the data by setting the number of lines to zero. More... | |
| void | clear_constants () |
| CLear all constants. | |
| void | sort_table (std::string scol) |
Sort the entire table by the column scol. More... | |
| void | sort_column (std::string scol) |
Individually sort the column scol. | |
| virtual void | add_constant (std::string name, double val) |
| Add a constant, or if the constant already exists, change its value. | |
| virtual int | set_constant (std::string name, double val, bool err_on_notfound=true) |
| Set a constant equal to a value, but don't add it if not already present. More... | |
| virtual bool | is_constant (std::string name) const |
Test if name is a constant. | |
| virtual double | get_constant (std::string name) const |
| Get a constant. | |
| virtual size_t | get_nconsts () const |
| Get the number of constants. | |
| virtual void | get_constant (size_t ix, std::string &name, double &val) const |
| Get a constant by index. | |
| virtual void | remove_constant (std::string name) |
| Remove a constant. | |
| void | check_synchro () const |
| Check if the tree and list are properly synchronized. | |
| void | is_valid () const |
| Check if the table object appears to be valid. | |
| void | functions_columns (std::string list) |
| Create new columns or recompute from a list of functions. More... | |
| void | function_column (std::string function, std::string scol) |
Make a column from the function specified in function and add it to the table. More... | |
| template<class resize_vec_t > | |
| int | function_vector (std::string function, resize_vec_t &vec, bool throw_on_err=true) |
| Compute a column from a function specified in a string. More... | |
| double | row_function (std::string function, size_t row) const |
| Compute a value by applying a function to a row. | |
| size_t | function_find_row (std::string function) const |
| Find a row which maximizes a function. | |
Protected Types | |
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 |
Protected Types inherited from o2scl::table< vec_t > | |
| typedef std::map< std::string, col, std::greater< std::string > >::iterator | aiter |
| Map iterator type. | |
| typedef std::map< std::string, col, std::greater< std::string > >::const_iterator | aciter |
| Const map iterator type. | |
| typedef std::vector< aiter >::iterator | aviter |
| Vector iterator type. | |
Protected Attributes | |
| convert_units * | cup |
| The pointer to the convert units object. | |
| std::map< std::string, std::string, std::greater< std::string > > | utree |
| Unit map. | |
Protected Attributes inherited from o2scl::table< vec_t > | |
| std::map< std::string, double > | constants |
| The list of constants. | |
| vec_t | empty_col |
| An empty vector for get_column() | |
| size_t | maxlines |
| The size of allocated memory. | |
| size_t | nlines |
| The size of presently used memory. | |
| std::map< std::string, col, std::greater< std::string > > | atree |
| The tree of columns. | |
| std::vector< aiter > | alist |
| The list of tree iterators. | |
| bool | intp_set |
| True if the interpolation object is up-to-date. | |
| size_t | itype |
| Current interpolation type. | |
| interp_vec< vec_t > * | si |
| Interpolation object. | |
| std::string | intp_colx |
| The last x-column interpolated. | |
| std::string | intp_coly |
| The last y-column interpolated. | |
Friends | |
| 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) |
Additional Inherited Members | |
Protected Member Functions inherited from o2scl::table< vec_t > | |
| void | reset_list () |
Set the elements of alist with the appropriate iterators from atree. . More... | |
| void | make_fp_varname (std::string &s) |
| Ensure a variable name does not match a function or contain non-alphanumeric characters. | |
| void | make_unique_name (std::string &colx, std::vector< std::string > &cnames) |
| Make sure a name is unique. | |
| aiter | get_iterator (std::string lname) |
| Return the iterator for a column. | |
| col * | get_col_struct (std::string lname) |
| Return the column structure for a column. | |
| aiter | begin () |
| Return the beginning of the column tree. | |
| aiter | end () |
| Return the end of the column tree. | |
|
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.
Reimplemented from o2scl::table< vec_t >.
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.
Documentation generated with Doxygen. Provided under the
GNU Free Documentation License (see License Information).