All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
table_units.h
Go to the documentation of this file.
1 /*
2  -------------------------------------------------------------------
3 
4  Copyright (C) 2006-2014, Andrew W. Steiner
5 
6  This file is part of O2scl.
7 
8  O2scl is free software; you can redistribute it and/or modify
9  it under the terms of the GNU General Public License as published by
10  the Free Software Foundation; either version 3 of the License, or
11  (at your option) any later version.
12 
13  O2scl is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  GNU General Public License for more details.
17 
18  You should have received a copy of the GNU General Public License
19  along with O2scl. If not, see <http://www.gnu.org/licenses/>.
20 
21  -------------------------------------------------------------------
22 */
23 #ifndef O2SCL_TABLE_UNITS_H
24 #define O2SCL_TABLE_UNITS_H
25 
26 /** \file table_units.h
27  \brief File defining \ref o2scl::table_units
28 */
29 
30 #include <o2scl/table.h>
31 #include <o2scl/lib_settings.h>
32 
33 #ifndef DOXYGEN_NO_O2NS
34 
35 // Forward definition of the table_units class for HDF I/O
36 namespace o2scl {
37  template<class vec_t> class table_units;
38 }
39 
40 // Forward definition of HDF I/O to extend friendship in table_units
41 namespace o2scl_hdf {
42 
43  class hdf_file;
44 
45  template<class vec_t>
46  void hdf_input(hdf_file &hf, o2scl::table_units<vec_t> &t,
47  std::string name);
48 
49  void hdf_output
50  (hdf_file &hf,
51  o2scl::table_units<std::vector<double> > &t,
52  std::string name);
53 
54  template<class vec_t>
55  void hdf_input_data(hdf_file &hf, o2scl::table_units<vec_t> &t);
56 
57  void hdf_output_data
58  (hdf_file &hf,
59  o2scl::table_units<std::vector<double> > &t);
60 
61 }
62 
63 #endif
64 
65 #ifndef DOXYGEN_NO_O2NS
66 namespace o2scl {
67 #endif
68 
69  /** \brief Data \table class with units
70 
71  \future The unit conversion object is now always a pointer to
72  the global conversion object. This could be modified, so that
73  each table can have it's own, but this might require HDF output
74  of unit conversion objects.
75 
76  \future Make table methods virtual? (not necessary yet since
77  delete_column() isn't referred to internally)
78  */
79  template<class vec_t=std::vector<double> >
80  class table_units : public table<vec_t> {
81 
82  public:
83 
84 #ifdef O2SCL_NEVER_DEFINED
85  }{
86 #endif
87 
88  /** \brief Create a new table_units with space for nlines<=cmaxlines.
89  */
90  table_units(int cmaxlines=0) : table<vec_t>(cmaxlines) {
92  }
93 
94  virtual ~table_units() {
95  utree.clear();
96  }
97 
98  /// \name Copy constructors
99  //@{
100  /// Copy with constructor from \ref table_units
101  table_units(const table_units &t) : table<vec_t>(t.get_nlines()) {
102 
103  // Copy constants
104  this->constants=t.constants;
105 
106  // Copy the columns and data
107  this->nlines=t.get_nlines();
108  this->maxlines=this->nlines;
109  for(size_t i=0;i<t.get_ncolumns();i++) {
110 
111  // Column name
112  std::string cname=t.get_column_name(i);
113 
114  // Insert column into tree
115  typename table<vec_t>::col s;
116  s.dat.resize(this->nlines);
117  s.index=this->atree.size();
118  this->atree.insert(make_pair(cname,s));
119 
120  // Insert in iterator index
121  typename table<vec_t>::aiter it=this->atree.find(cname);
122  this->alist.push_back(it);
123 
124  // Insert in unit list
125  utree.insert(make_pair(cname,t.get_unit(cname)));
126 
127  // Fill the data
128  for(size_t j=0;j<t.get_nlines();j++) {
129  it->second.dat[j]=t.get(cname,j);
130  }
131 
132  }
133 
134  this->intp_set=false;
136 
137  return;
138  }
139 
140  /// Copy with constructor from \ref table
141  table_units(const table<vec_t> &t) : table<vec_t>(t.get_nlines()) {
142 
143  // Copy constants
144  size_t nc=t.get_nconsts();
145  for(size_t i=0;i<nc;i++) {
146  std::string name;
147  double val;
148  t.get_constant(i,name,val);
149  this->constants.insert(make_pair(name,val));
150  }
151 
152  // Copy the columns and data
153  this->nlines=t.get_nlines();
154  this->maxlines=this->nlines;
155  for(size_t i=0;i<t.get_ncolumns();i++) {
156 
157  // Column name
158  std::string cname=t.get_column_name(i);
159 
160  // Insert column into tree
161  typename table<vec_t>::col s;
162  s.dat=new vec_t(this->nlines);
163  s.index=this->atree.size();
164  this->atree.insert(make_pair(cname,s));
165 
166  // Insert in iterator index
167  typename table<vec_t>::aiter it=this->atree.find(cname);
168  this->alist.push_back(it);
169 
170  // Fill the data
171  for(size_t j=0;j<t.get_nlines();j++) {
172  (*it->second.dat)[j]=t.get(cname,j);
173  }
174 
175  }
176 
177  this->intp_set=false;
179 
180  return;
181 
182  }
183 
184  /// Copy with <tt>operator=</tt> from \ref table_units
186 
187  if (this!=&t) {
188 
189  this->clear_table();
190  this->constants.clear();
191  utree.clear();
192 
193  // Copy constants
194  this->constants=t.constants;
195 
196  // Copy the columns and data
197  this->nlines=t.get_nlines();
198  for(size_t i=0;i<t.get_ncolumns();i++) {
199 
200  // Column name
201  std::string cname=t.get_column_name(i);
202 
203  // Insert column into tree
204  typename table<vec_t>::col s;
205  s.dat.resize(this->nlines);
206  s.index=this->atree.size();
207  this->atree.insert(make_pair(cname,s));
208 
209  // Insert in iterator index
210  typename table<vec_t>::aiter it=this->atree.find(cname);
211  this->alist.push_back(it);
212 
213  // Insert in unit list
214  utree.insert(make_pair(cname,t.get_unit(cname)));
215 
216  // Fill the data
217  for(size_t j=0;j<t.get_nlines();j++) {
218  it->second.dat[j]=t.get(cname,j);
219  }
220 
221  }
222 
223  if (this->intp_set) {
224  this->intp_set=false;
225  delete this->si;
226  }
227 
229 
230  }
231 
232  return *this;
233  }
234 
235  /// Copy with <tt>operator=</tt> from \ref table
237 
238  if (this!=&t) {
239 
240  this->clear_table();
241  this->constants.clear();
242  utree.clear();
243 
244  // Copy constants
245  size_t nc=t.get_nconsts();
246  for(size_t i=0;i<nc;i++) {
247  std::string name;
248  double val;
249  t.get_constant(i,name,val);
250  this->constants.insert(make_pair(name,val));
251  }
252 
253  // Copy the columns and data
254  this->nlines=t.get_nlines();
255  for(size_t i=0;i<t.get_ncolumns();i++) {
256 
257  // Column name
258  std::string cname=t.get_column_name(i);
259 
260  // Insert column into tree
261  typename table<vec_t>::col s;
262  s.dat=new vec_t(this->nlines);
263  s.index=this->atree.size();
264  this->atree.insert(make_pair(cname,s));
265 
266  // Insert in iterator index
267  typename table<vec_t>::aiter it=this->atree.find(cname);
268  this->alist.push_back(it);
269 
270  // Fill the data
271  for(size_t j=0;j<t.get_nlines();j++) {
272  (*it->second.dat)[j]=t.get(cname,j);
273  }
274 
275  }
276 
277  if (this->intp_set) {
278  this->intp_set=false;
279  delete this->si;
280  }
281 
283 
284  }
285 
286  return *this;
287  }
288  //@}
289 
290  /// \name Unit manipulation
291  //@{
292  /// Get the unit for column \c scol
293  std::string get_unit(std::string scol) const {
294 
295  uciter it=utree.find(scol);
296  if (it==utree.end()) {
297  // Not found in unit entry, look for column of data
298  typename table<vec_t>::aciter at=this->atree.find(scol);
299  if (at==this->atree.end()) {
300  O2SCL_ERR((((std::string)"Column '")+scol+
301  "' not found in table_units::get_unit().").c_str(),
302  exc_enotfound);
303  } else {
304  return "";
305  }
306  }
307 
308  return it->second;
309  }
310 
311  /// Remove the unit for column \c scol
312  void remove_unit(std::string scol) {
313 
314  uiter it=utree.find(scol);
315  if (it==utree.end()) {
316  O2SCL_ERR((((std::string)"Column '")+scol+
317  "' not found in table_units::get_unit().").c_str(),
318  exc_enotfound);
319  }
320 
321  if (utree.size()==0) {
322  O2SCL_ERR("No units specified in table_units::remove_unit().",
323  exc_efailed);
324  }
325 
326  utree.erase(it);
327  return;
328  }
329 
330  /// Set the unit for column \c scol to \c unit
331  void set_unit(std::string scol, std::string unit) {
332 
333  uiter it=utree.find(scol);
334  if (it==utree.end()) {
335  typename table<vec_t>::aiter at=this->atree.find(scol);
336  if (at==this->atree.end()) {
337  O2SCL_ERR((((std::string)"Column '")+scol+
338  "' not found in table_units::set_unit().").c_str(),
339  exc_enotfound);
340  }
341  utree.insert(make_pair(scol,unit));
342  } else {
343  it->second=unit;
344  }
345 
346  return;
347  }
348 
349  /// Convert the units of column \c scol to \c unit
350  int convert_to_unit(std::string scol, std::string unit,
351  bool err_on_fail=true) {
352 
353  // Find unit entry
354  uiter it=utree.find(scol);
355  if (it==utree.end()) {
356  if (err_on_fail) {
357  O2SCL_ERR((((std::string)"Column '")+scol+"' not found in "+
358  "table_units::convert_to_unit().").c_str(),
359  exc_enotfound);
360  } else {
361  return exc_enotfound;
362  }
363  };
364 
365  // If the units are equal, just do nothing
366  if (it->second==unit) return success;
367 
368  // Find column of data
369  typename table<vec_t>::aiter at=this->atree.find(scol);
370  if (at==this->atree.end()) {
371  if (err_on_fail) {
372  O2SCL_ERR((((std::string)"Column '")+scol+"' not found in "+
373  "table_units::convert_to_unit().").c_str(),
374  exc_enotfound);
375  } else {
376  return exc_enotfound;
377  }
378  };
379 
380  // Perform conversion
381  vec_t &vec=at->second.dat;
382  double conv=cup->convert(it->second,unit,1.0);
383 
384  for(size_t i=0;i<this->get_nlines();i++) {
385  vec[i]*=conv;
386  }
387 
388  // Set new unit entry
389  it->second=unit;
390 
391  return success;
392  }
393 
394  /// Return the number of columns with units
395  size_t get_nunits() {
396  return utree.size();
397  }
398 
399  /*
400  // Get the conversion factor from \c old_unit to \c new_unit
401  double get_conv(std::string old_unit, std::string new_unit);
402 
403  // Set the convert units object
404  void set_convert(convert_units &c) {
405  cup=&c;
406  return;
407  }
408 
409  // Show the unit cache as given by \ref convert_units::print_cache()
410  void show_units() {
411  cup->print_cache();
412  return;
413  }
414 
415  // The default object for unit conversions
416  convert_units def_cu;
417  */
418  //@}
419 
420  /// \name Virtual functions from \ref table
421  //@{
422  /// Delete column named \c scol
423  virtual void delete_column(std::string scol) {
424 
425  // Find the tree iterator for the element we want to erase
426  typename table<vec_t>::aiter it=this->atree.find(scol);
427  if (it==this->atree.end()) {
428  O2SCL_ERR((((std::string)"Column '")+scol+
429  " not found in table_units::delete_column().").c_str(),
430  exc_enotfound);
431  return;
432  }
433 
434  // Remove the unit for the specified column
435  if (get_unit(scol).length()>0) remove_unit(scol);
436 
437  // Find the corresponding list iterator
438  typename table<vec_t>::aviter vit=this->alist.begin();
439  vit+=it->second.index;
440 
441  // Find the last element in the list and it's corresponding table
442  // entry. Change it's index to the index of the column to be
443  // deleted.
444  this->alist[this->alist.size()-1]->second.index=it->second.index;
445 
446  // Erase the elements from the list and the tree
447  this->atree.erase(it);
448  this->alist.erase(vit);
449 
450  // Reset the list to reflect the proper iterators
451  this->reset_list();
452 
453  return;
454  }
455 
456  /// Output a summary of the information stored
457  virtual void summary(std::ostream *out, size_t ncol=79) const {
458 
459  if (this->constants.size()==1) {
460  (*out) << "1 constant:" << std::endl;
461  } else {
462  (*out) << this->constants.size() << " constants:" << std::endl;
463  }
464  std::map<std::string,double>::const_iterator mit;
465  for(mit=this->constants.begin();mit!=this->constants.end();mit++) {
466  (*out) << mit->first << " " << mit->second << std::endl;
467  }
468 
469  // Output number of columns and preprend column numbers
470  size_t nh=this->get_ncolumns(), nh2;
471 
472  if (nh==0) {
473 
474  (*out) << "No columns." << std::endl;
475 
476  } else {
477 
478  if (nh==1) {
479  (*out) << "1 column: " << std::endl;
480  } else {
481  (*out) << nh << " columns: " << std::endl;
482  }
483  std::string *h=new std::string[nh];
484  for(size_t i=0;i<nh;i++) {
485  h[i]=szttos(i)+". "+this->get_column_name(i)+" ["+
486  get_unit(this->get_column_name(i))+"]";
487  }
488 
489  std::vector<std::string> h2;
490  // Convert to string with width 'ncol'
491  screenify(nh,h,h2,ncol);
492  nh2=h2.size();
493 
494  // Output column names
495  for(size_t i=0;i<nh2;i++) {
496  (*out) << h2[i] << std::endl;
497  }
498 
499  delete[] h;
500 
501  }
502 
503  if (this->get_nlines()==0) {
504  (*out) << "No lines of data." << std::endl;
505  } else if (this->get_nlines()==1) {
506  (*out) << "One line of data." << std::endl;
507  } else {
508  (*out) << this->get_nlines() << " lines of data." << std::endl;
509  }
510 
511  return;
512  }
513  //@}
514 
515  /// Return the type, \c "table_units".
516  virtual const char *type() { return "table_units"; }
517 
518  /** \brief Copy data from column named \c src to column named \c
519  dest, creating a new column if necessary \f$ {\cal O}(R
520  \log(C)) \f$
521 
522  This function also sets the units of column \c dest to be the
523  same as that in \c src, even if the column named \c dest
524  already exists and previously had different units.
525  */
526  virtual void copy_column(std::string src, std::string dest) {
527  if (!this->is_column(dest)) this->new_column(dest);
528 
529  typedef typename std::map<std::string,
530  typename table<vec_t>::col,string_comp>::iterator aiter;
531 
532  aiter its=this->atree.find(src);
533  if (its==this->atree.end()) {
534  O2SCL_ERR((((std::string)"Column '")+src+
535  " not found in table_units::copy_column().").c_str(),
536  exc_enotfound);
537  return;
538  }
539  aiter itd=this->atree.find(dest);
540  if (itd==this->atree.end()) {
541  O2SCL_ERR((((std::string)"Destination column '")+dest+
542  " not found in table_units::copy_column().").c_str(),
543  exc_esanity);
544  return;
545  }
546  this->set_unit(dest,this->get_unit(src));
547  for(size_t i=0;i<this->nlines;i++) {
548  itd->second.dat[i]=its->second.dat[i];
549  }
550  return;
551  }
552 
553  /// Clear the current table and read from a generic data file
554  virtual int read_generic(std::istream &fin, int verbose=0) {
555 
556  double data;
557  std::string line;
558  std::string stemp;
559  std::istringstream *is;
560 
561  // Read first line and into list
562  std::vector<std::string> onames, nnames;
563  getline(fin,line);
564  is=new std::istringstream(line);
565  while ((*is) >> stemp) {
566  onames.push_back(stemp);
567  if (verbose>2) {
568  std::cout << "Read possible column name: " << stemp << std::endl;
569  }
570  }
571  delete is;
572 
573  // Count number of likely numbers in the first row
574  size_t n_nums=0;
575  for(size_t i=0;i<onames.size();i++) {
576  if (is_number(onames[i])) n_nums++;
577  }
578 
579  int irow=0;
580 
581  if (n_nums==onames.size()) {
582 
583  if (verbose>0) {
584  std::cout << "First row looks like it contains numerical values."
585  << std::endl;
586  std::cout << "Creating generic column names: ";
587  }
588 
589  for(size_t i=0;i<onames.size();i++) {
590  nnames.push_back(((std::string)"c")+szttos(i+1));
591  if (verbose>0) std::cout << nnames[i] << " ";
592 
593  }
594  if (verbose>0) std::cout << std::endl;
595 
596  // Make columns
597  for(size_t i=0;i<nnames.size();i++) {
598  this->new_column(nnames[i]);
599  }
600 
601  // Add first row of data
602  for(size_t i=0;i<onames.size();i++) {
603  this->set(i,irow,o2scl::stod(onames[i]));
604  }
605  irow++;
606 
607  } else {
608 
609  // Ensure good column names
610  for(size_t i=0;i<onames.size();i++) {
611  std::string temps=onames[i];
612  this->make_fp_varname(temps);
613  this->make_unique_name(temps,nnames);
614  nnames.push_back(temps);
615  if (temps!=onames[i] && verbose>0) {
616  std::cout << "Converted column named '" << onames[i] << "' to '"
617  << temps << "'." << std::endl;
618  }
619  }
620 
621  // Make columns
622  for(size_t i=0;i<nnames.size();i++) {
623  this->new_column(nnames[i]);
624  }
625 
626  // Read another line, and see if it looks like units
627  std::vector<std::string> units;
628  getline(fin,line);
629  is=new std::istringstream(line);
630  int num_units=0;
631  while ((*is) >> stemp) {
632  units.push_back(stemp);
633  if (stemp[0]=='[') num_units++;
634  if (verbose>2) {
635  std::cout << "Read word in second row: " << stemp << std::endl;
636  }
637  }
638  delete is;
639 
640  if (units.size()!=nnames.size()) {
641  std::cout << "Second row appears not to have same number of "
642  << "entries as the first." << std::endl;
643  std::cout << "Aborting." << std::endl;
644  return -1;
645  }
646 
647  if (num_units==((int)units.size()) || num_units>2) {
648  if (verbose>2) {
649  std::cout << "Looks like second row contains units." << std::endl;
650  }
651  for(size_t i=0;i<units.size();i++) {
652  // Remove brackets
653  stemp=units[i];
654  if (stemp[0]=='[') stemp=stemp.substr(1,stemp.length()-1);
655  if (stemp[stemp.length()-1]==']') {
656  stemp=stemp.substr(0,stemp.length()-1);
657  }
658  // Set the units
659  set_unit(nnames[i],stemp);
660  if (verbose>2) {
661  std::cout << "Name,unit: " << nnames[i] << " [" << stemp << "]"
662  << std::endl;
663  }
664  }
665 
666  } else {
667 
668  // Otherwise, assume this is a row of data
669  for(size_t i=0;i<units.size();i++) {
670  this->set(i,0,o2scl::stod(units[i]));
671  }
672  irow++;
673 
674  }
675 
676  }
677 
678  // Read remaining rows
679  while ((fin) >> data) {
680  this->set(0,irow,data);
681  for(size_t i=1;i<this->get_ncolumns();i++) {
682  (fin) >> data;
683  this->set(i,irow,data);
684  }
685  irow++;
686  }
687 
688  return 0;
689  }
690 
691  // ---------
692  // Allow HDF I/O functions to access table_units data
693  friend void o2scl_hdf::hdf_output
694  (o2scl_hdf::hdf_file &hf, table_units<> &t, std::string name);
695 
696  template<class vecf_t> friend void o2scl_hdf::hdf_input
697  (o2scl_hdf::hdf_file &hf, table_units<vecf_t> &t, std::string name);
698 
699  friend void o2scl_hdf::hdf_output_data
701 
702  template<class vecf_t> friend void o2scl_hdf::hdf_input_data
704 
705  // ---------
706 
707 #ifndef DOXYGEN_INTERNAL
708 
709  protected:
710 
711 
712  /// The pointer to the convert units object
714 
715  /// \name Unit map iterator types
716  //@{
717  typedef std::map<std::string,std::string,
718  string_comp>::iterator uiter;
719  typedef std::map<std::string,std::string,
720  string_comp>::const_iterator uciter;
721  //@}
722 
723  /// Unit map
724  std::map<std::string,std::string,string_comp> utree;
725 
726 #endif
727 
728  };
729 
730 #ifndef DOXYGEN_NO_O2NS
731 }
732 #endif
733 
734 #endif
table_units(int cmaxlines=0)
Create a new table_units with space for nlines<=cmaxlines.
Definition: table_units.h:90
std::map< std::string, col, string_comp >::iterator aiter
Map iterator type.
Definition: table.h:2723
const double cup
cm^3
Definition: constants.h:181
void remove_unit(std::string scol)
Remove the unit for column scol.
Definition: table_units.h:312
virtual size_t get_nconsts() const
Get the number of constants.
Definition: table.h:2060
void hdf_input_data(hdf_file &hf, o2scl::table< vec_t > &t)
Internal function for inputting a o2scl::table object.
Definition: hdf_io.h:90
virtual int read_generic(std::istream &fin, int verbose=0)
Clear the current table and read from a generic data file.
Definition: table_units.h:554
Data table table class.
Definition: table.h:47
size_t get_nlines() const
Return the number of lines.
Definition: table.h:432
virtual void delete_column(std::string scol)
Delete column named scol.
Definition: table_units.h:423
virtual const char * type()
Return the type, "table_units".
Definition: table_units.h:516
sanity check failed - shouldn't happen
Definition: err_hnd.h:65
lib_settings_class o2scl_settings
The global library settings object.
Convert units.
Definition: convert_units.h:88
std::string get_unit(std::string scol) const
Get the unit for column scol.
Definition: table_units.h:293
virtual void summary(std::ostream *out, size_t ncol=79) const
Output a summary of the information stored.
Definition: table_units.h:457
Simple string comparison.
Definition: misc.h:50
Generic "not found" result.
Definition: err_hnd.h:117
int convert_to_unit(std::string scol, std::string unit, bool err_on_fail=true)
Convert the units of column scol to unit.
Definition: table_units.h:350
generic failure
Definition: err_hnd.h:61
virtual double get_constant(std::string name) const
Get a constant.
Definition: table.h:2055
std::string get_column_name(size_t icol) const
Returns the name of column col .
Definition: table.h:715
void set_unit(std::string scol, std::string unit)
Set the unit for column scol to unit.
Definition: table_units.h:331
convert_units * cup
The pointer to the convert units object.
Definition: table_units.h:713
size_t get_nunits()
Return the number of columns with units.
Definition: table_units.h:395
table_units & operator=(const table_units &t)
Copy with operator= from table_units.
Definition: table_units.h:185
Column structure for table [protected].
Definition: table.h:2712
convert_units & get_convert_units()
Get the global convert_units object.
Definition: lib_settings.h:143
void screenify(size_t nin, const string_arr_t &in_cols, std::vector< std::string > &out_cols, size_t max_size=80)
Reformat the columns for output of width size.
Definition: misc.h:124
#define O2SCL_ERR(d, n)
Set an error with message d and code n.
Definition: err_hnd.h:273
bool is_number(std::string s)
Return true if the string s is likely a integral or floating point number.
std::map< std::string, std::string, string_comp > utree
Unit map.
Definition: table_units.h:724
size_t get_ncolumns() const
Return the number of columns.
Definition: table.h:424
Data table table class with units.
Definition: table_units.h:37
aiter end()
Return the end of the column tree.
Definition: table.h:2769
table_units(const table< vec_t > &t)
Copy with constructor from table.
Definition: table_units.h:141
table_units & operator=(const table< vec_t > &t)
Copy with operator= from table.
Definition: table_units.h:236
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 ...
Definition: table_units.h:526
Store data in an O<span style='position: relative; top: 0.3em; font-size: 0.8em'>2</span>scl O$_2$scl...
Definition: hdf_file.h:93
std::map< std::string, col, string_comp >::const_iterator aciter
Const map iterator type.
Definition: table.h:2726
double stod(std::string s, bool err_on_fail=true)
Convert a string to a double.
std::string szttos(size_t x)
Convert a size_t to a string.
void hdf_input(hdf_file &hf, o2scl::table< vec_t > &t, std::string name)
Input a o2scl::table object from a hdf_file.
Definition: hdf_io.h:55
vec_t dat
Pointer to column.
Definition: table.h:2715
std::vector< aiter >::iterator aviter
Vector iterator type.
Definition: table.h:2728
int index
Column index.
Definition: table.h:2717
Success.
Definition: err_hnd.h:47
double get(std::string scol, size_t row) const
Get value from row row of column named col. .
Definition: table.h:389
table_units(const table_units &t)
Copy with constructor from table_units.
Definition: table_units.h:101

Documentation generated with Doxygen. Provided under the GNU Free Documentation License (see License Information).
Hosted at Get Object-oriented Scientific Computing
Lib at SourceForge.net. Fast, secure and Free Open Source software
downloads..