acolm.h
Go to the documentation of this file.
1 /*
2  -------------------------------------------------------------------
3 
4  Copyright (C) 2006-2017, 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_ACOLM_H
24 #define O2SCL_ACOLM_H
25 
26 /** \file acolm.h
27  \brief The \ref o2scl_acol::acol_manager class header
28 */
29 #ifdef HAVE_CONFIG_H
30 #include <config.h>
31 #endif
32 
33 #include <iostream>
34 #include <string>
35 #include <vector>
36 #include <fnmatch.h>
37 #include <o2scl/misc.h>
38 #include <o2scl/cli.h>
39 #include <o2scl/fit_nonlin.h>
40 #include <o2scl/table_units.h>
41 #include <o2scl/table3d.h>
42 #include <o2scl/format_float.h>
43 #include <o2scl/hdf_file.h>
44 #include <o2scl/hdf_io.h>
45 #include <o2scl/lib_settings.h>
46 #include <o2scl/contour.h>
47 
48 #ifdef O2SCL_READLINE
49 #include <o2scl/cli_readline.h>
50 #else
51 #include <o2scl/cli.h>
52 #endif
53 
54 /// A namespace for objects associated with the command-line utility 'acol'
55 namespace o2scl_acol {
56 
57  /** \brief The driver for 'acol' command-line utility
58  \nothing
59 
60  \comment
61  There was some concern about the confusion b/w the commands
62  "get row by index" (get-row) and "get row by function"
63  (find-row) and "select rows by function" (select-rows),
64  but it might be ok.
65  \endcomment
66 
67  \future Stack-like operations (push, pop, swap,
68  stack-list, etc.)?
69 
70  \future Use get_input() in comm_create?
71 
72  \future Add functionality to ensure that three digit exponents
73  are still handled gracefully (do this by creating a new boolean
74  setting which, if true, always makes three spaces for
75  exponents?)
76 
77  \future Fix insert and insert_full so that it automatically
78  renames columns
79 
80  \future Allow "insert" commands to be restrictive, avoiding
81  extrapolation
82 
83  \future Replace ~ with $HOME in filenames (this might be best
84  done inside the \ref o2scl::cli class). (Some progress made.
85  Function cli::expand_tilde() is written but not yet
86  implemented.)
87 
88  \future New 3d commands: transpose (for table3d), contours,
89  find_grid_x, find_grid_y.
90 
91  \hline
92  */
93  class acol_manager {
94 
95 #ifndef DOXYGEN_INTERNAL
96 
97  protected:
98 
99 #ifdef DOXYGEN
100  /// The number formatter for html output
101  format_float ffl;
102 #else
104 #endif
105 
106  /// Convert units object (initialized by constructor to global object)
108 
109  /// \name Parameters modifiable by the user
110  //@{
111  /// The output precision (default 6)
112  int prec;
113 
114  /// The verbosity level (default 1)
115  int verbose;
116 
117  /// True if we should make the output into neat columns (default true)
118  bool pretty;
119 
120  /// True if we should output column names
121  bool names_out;
122 
123  /// The name of the table
124  std::string obj_name;
125 
126  /// Filename for units command
127  std::string unit_fname;
128 
129  /// Default arguments from environment
130  std::string def_args;
131 
132  /// The number of columns requested by the user
134 
135  /// The interpolation type
137 
138  /// True for scientific output mode
140  //@}
141 
142  /// \name The parameter objects
143  //@{
144  o2scl::cli::parameter_string p_obj_name;
145  o2scl::cli::parameter_string p_unit_fname;
146  o2scl::cli::parameter_string p_def_args;
147  o2scl::cli::parameter_int p_verbose;
150  o2scl::cli::parameter_int p_interp_type;
151  o2scl::cli::parameter_bool p_scientific;
153  o2scl::cli::parameter_bool p_names_out;
154  //@}
155 
156  /// Number of columns in screen
157  int ncols;
158 
159 #endif
160 
161  public:
162 
163  acol_manager();
164 
165  virtual ~acol_manager() {}
166 
167 #ifdef DOXYGEN
168  /// A pointer to the table
169  table_units<> table_obj;
170 #else
172 #endif
173 
174 #ifdef DOXYGEN
175  /// A pointer to the hist
176  hist hist_obj;
177 #else
179 #endif
180 
181 #ifdef DOXYGEN
182  /// A pointer to the hist
183  hist_2d hist_2d_obj;
184 #else
186 #endif
187 
188  /// String designating the current type
189  std::string type;
190 
191  /// Dummy cli object for cli::cli_gets()
192 #ifdef DOXYGEN
193  cli *cl;
194 #else
195  o2scl::cli *cl;
196 #endif
197 
198 #ifdef DOXYGEN
199  /// Pointer to the three dimensional table
200  table3d table3d_obj;
201 #else
203 #endif
204 
205  /** \brief Contour lines object
206  */
207  std::vector<o2scl::contour_line> cont_obj;
208 
209  /** \brief True if we should run interactive mode after parsing
210  the command-line
211  */
213 
214  /// The environment variable to read from
215  std::string env_var_name;
216 
217  /// String parameters
218  std::map<std::string,std::string *> str_params;
219 
220  /// Integer parameters
221  std::map<std::string,int *> int_params;
222 
223  protected:
224 
225  /** \brief Clear memory associated with the current object and set
226  type to ""
227  */
228  void clear_obj();
229 
230  // Ensure \c col is unique from entries in \c cnames
231  //int make_unique_name(std::string &col, std::vector<std::string> &cnames);
232 
233  public:
234 
235  /** \brief Main run function
236 
237  Process command-line options using cli object, interface with
238  the operating system via getenv(), instantiate and call the
239  acol_manager object.
240  */
241  virtual int run(int argv, char *argc[]);
242 
243  /** \brief For o2graph in o2sclpy
244  */
245  virtual int run_o2graph();
246 
247  /// Create the cli object (with readline support if available)
248  virtual int setup_cli();
249 
250  /// Add the options to the cli object
251  virtual int setup_options();
252 
253  /// Add the help text to the cli object
254  virtual int setup_help();
255 
256  /// Add the parameters for 'set' to the cli object
257  virtual int setup_parameters();
258 
259  /// Assign a constant
260  virtual int comm_assign(std::vector<std::string> &sv, bool itive_com);
261 
262  /// Compute a scalar value
263  virtual int comm_calc(std::vector<std::string> &sv, bool itive_com);
264 
265  /// Create a table from a column of equally spaced values
266  virtual int comm_create(std::vector<std::string> &sv, bool itive_com);
267 
268  /// Create a table3d object
269  virtual int comm_create3(std::vector<std::string> &sv, bool itive_com);
270 
271  /// Delete a column
272  virtual int comm_delete_col(std::vector<std::string> &sv, bool itive_com);
273 
274  /// Delete rows specified by a function
275  virtual int comm_delete_rows(std::vector<std::string> &sv, bool itive_com);
276 
277  /// Create a column which is the derivative of another
278  virtual int comm_deriv(std::vector<std::string> &sv, bool itive_com);
279 
280  /// Create a column which is the second derivative of another
281  virtual int comm_deriv2(std::vector<std::string> &sv, bool itive_com);
282 
283  /// Parameters for iterate_func()
284  typedef struct {
285  std::string tname;
287  bool found;
288  std::string type;
289  int verbose;
290  } iter_parms;
291 
292  /// HDF object iteration function
293  static herr_t iterate_func(hid_t loc, const char *name,
294  const H5L_info_t *inf, void *op_data);
295 
296  /// HDF object iteration function
297  static herr_t filelist_func(hid_t loc, const char *name,
298  const H5L_info_t *inf, void *op_data);
299 
300  /// Read a file
301  virtual int comm_read(std::vector<std::string> &sv, bool itive_com);
302 
303  /// Read a file and list the O2scl objects
304  virtual int comm_filelist(std::vector<std::string> &sv, bool itive_com);
305 
306  /// Desc
307  virtual int comm_nlines(std::vector<std::string> &sv, bool itive_com);
308 
309  /// Desc
310  virtual int comm_to_hist(std::vector<std::string> &sv, bool itive_com);
311 
312  /// Desc
313  virtual int comm_type(std::vector<std::string> &sv, bool itive_com);
314 
315  /// Find a row from a function
316  virtual int comm_find_row(std::vector<std::string> &sv, bool itive_com);
317 
318  /// Create a column from a function
319  virtual int comm_function(std::vector<std::string> &sv, bool itive_com);
320 
321  /// Read a generic data file
322  virtual int comm_generic(std::vector<std::string> &sv, bool itive_com);
323 
324  /// Read a generic data file
325  virtual int comm_gen3_list(std::vector<std::string> &sv, bool itive_com);
326 
327  /// Print out an entire row
328  virtual int comm_get_row(std::vector<std::string> &sv, bool itive_com);
329 
330  /// Extract a slice from a table3d object to generate a table object
331  virtual int comm_slice(std::vector<std::string> &sv, bool itive_com);
332 
333  /// Fit two columns to a function
334  virtual int comm_fit(std::vector<std::string> &sv, bool itive_com);
335 
336 #ifdef O2SCL_NEVER_DEFINED
337  // Create an html file
338  //virtual int comm_html(std::vector<std::string> &sv, bool itive_com);
339 #endif
340 
341  /// Insert a column from an external table using interpolation
342  virtual int comm_insert(std::vector<std::string> &sv, bool itive_com);
343 
344  /// Insert an external table using interpolation
345  virtual int comm_insert_full(std::vector<std::string> &sv, bool itive_com);
346 
347  /// Create a column which is the integral of another
348  virtual int comm_integ(std::vector<std::string> &sv, bool itive_com);
349 
350  /// Toggle interactive mode
351  virtual int comm_interactive(std::vector<std::string> &sv, bool itive_com);
352 
353  /// Output to a file in internal format
354  virtual int comm_internal(std::vector<std::string> &sv, bool itive_com);
355 
356  /// Create an html file
357  virtual int comm_interp(std::vector<std::string> &sv, bool itive_com);
358 
359  /// List columns in table 'tp' named 'tname' assuming screen size 'ncol'
360  virtual int comm_list(std::vector<std::string> &sv, bool itive_com);
361 
362  /// Compute the maximum value of a colum
363  virtual int comm_max(std::vector<std::string> &sv, bool itive_com);
364 
365  /// Compute the minimum value of a colum
366  virtual int comm_min(std::vector<std::string> &sv, bool itive_com);
367 
368  /// Add a column for line numbers
369  virtual int comm_index(std::vector<std::string> &sv, bool itive_com);
370 
371  /// Output to screen or file
372  virtual int comm_output(std::vector<std::string> &sv, bool itive_com);
373 
374  /// Preview the table
375  virtual int comm_preview(std::vector<std::string> &sv, bool itive_com);
376 
377  /// Concatenate two table/table3d objects
378  virtual int comm_cat(std::vector<std::string> &sv, bool itive_com);
379 
380  /// Sum two table/table3d objects
381  virtual int comm_sum(std::vector<std::string> &sv, bool itive_com);
382 
383  /// Rename a column
384  virtual int comm_rename(std::vector<std::string> &sv, bool itive_com);
385 
386  /// Select several columns for a new table
387  virtual int comm_select(std::vector<std::string> &sv, bool itive_com);
388 
389  /// Select several rows for a new table
390  virtual int comm_select_rows(std::vector<std::string> &sv, bool itive_com);
391 
392  /// Post-processing for setting a value
393  virtual int comm_set(std::vector<std::string> &sv, bool itive_com);
394 
395  /// Set an individual data point at a specified row and column
396  virtual int comm_set_data(std::vector<std::string> &sv, bool itive_com);
397 
398  /// Set units of a column
399  virtual int comm_set_unit(std::vector<std::string> &sv, bool itive_com);
400 
401  /// Desc
402  virtual int comm_contours(std::vector<std::string> &sv, bool itive_com);
403 
404  /// Set units of a column
405  virtual int comm_show_units(std::vector<std::string> &sv, bool itive_com);
406 
407  /// Get units of a column
408  virtual int comm_get_unit(std::vector<std::string> &sv, bool itive_com);
409 
410  /// Convert units of a column
411  virtual int comm_convert_unit(std::vector<std::string> &sv,
412  bool itive_com);
413 
414  /// Sort the table by a column
415  virtual int comm_sort(std::vector<std::string> &sv, bool itive_com);
416 
417  /// Get column stats
418  virtual int comm_stats(std::vector<std::string> &sv, bool itive_com);
419 
420  /// Print version
421  virtual int comm_version(std::vector<std::string> &sv, bool itive_com);
422 
423  /// Get a conversion factor
424  virtual int comm_get_conv(std::vector<std::string> &sv, bool itive_com);
425 
426  /// Set screen witdth
427  int set_swidth(int ncol) {
428  ncols=ncol;
429  return 0;
430  }
431 
432  virtual int comm_none(std::vector<std::string> &sv, bool itive_com) {
433  return 0;
434  }
435 
436  protected:
437 
438  /// An internal command for prompting the user for command arguments
439  int get_input(std::vector<std::string> &sv,
440  std::vector<std::string> &directions,
441  std::vector<std::string> &in, std::string comm_name,
442  bool itive_com);
443 
444  /// An internal command for prompting the user for one command argument
445  int get_input_one(std::vector<std::string> &sv, std::string directions,
446  std::string &in, std::string comm_name,
447  bool itive_com);
448 
449  public:
450 
451  /// \name Temporary storage for get slice
452  //@{
453  std::vector<double> xtemp;
454  std::vector<double> ytemp;
455  std::vector<double> stemp;
456  //@}
457 
473 
474  std::string cmap, xtitle, ytitle;
475  double xlo, xhi, ylo, yhi, zlo, zhi;
476  bool xset, yset, zset, colbar, logx, logy;
477 
478  };
479 
480 }
481 
482 extern "C" {
483 
484  /** \brief Create an \ref o2scl_acol::acol_manager object
485  */
488  amp->run_o2graph();
489  return amp;
490  }
491 
492  /** \brief Free memory associated with a \ref
493  o2scl_acol::acol_manager object
494  */
495  void o2scl_free_acol_manager(void *vp) {
497  delete amp;
498  return;
499  }
500 
501  /** \brief Construct a string vector from the data in
502  \c n_entries, \c sizes, and \c str
503  */
504  std::vector<std::string> o2scl_acol_parse_arrays
505  (int n_entries, int *sizes, char *str) {
506  std::vector<std::string> list;
507  size_t ix=0;
508  for(int i=0;i<n_entries;i++) {
509  std::string tmp;
510  for(int j=0;j<sizes[i];j++) {
511  tmp+=str[ix];
512  ix++;
513  }
514  list.push_back(tmp);
515  }
516  return list;
517  }
518 
519  /** \brief Parse the set of commands in \c n_entries, \c sizes
520  and \c str
521  */
522  void o2scl_acol_parse(void *vp, int n_entries, int *sizes,
523  char *str) {
524  std::vector<std::string> args=o2scl_acol_parse_arrays(n_entries,sizes,str);
526  std::vector<o2scl::cmd_line_arg> ca;
527  amp->cl->process_args(args,ca,0);
528  amp->cl->call_args(ca);
529  return;
530  }
531 
532  /** \brief Return the size and a pointer to the column
533  named \c col_name in a table object
534  */
535  int o2scl_acol_get_column(void *vp, char *col_name,
536  int &n, double *&ptr) {
538  if (amp->type=="table3d") {
539  std::cout << "Cannot get column for table3d object."
540  << std::endl;
541  return 1;
542  }
543  if (amp->type!="table") {
544  std::cerr << "No table loaded." << std::endl;
545  return 2;
546  }
547  n=amp->table_obj.get_nlines();
548  std::string stmp=col_name;
549  const std::vector<double> &col=amp->table_obj.get_column(stmp);
550  ptr=(double *)&col[0];
551  return 0;
552  }
553 
554  /** \brief Return the size and a pointer to the column
555  named \c col_name in a table object
556  */
557  int o2scl_acol_get_hist_reps(void *vp, int &n, double *&ptr) {
559  n=amp->hist_obj.size();
560  amp->xtemp.resize(n);
561  for(size_t i=0;i<n;i++) amp->xtemp[i]=amp->hist_obj.get_rep_i(i);
562  ptr=&(amp->xtemp[0]);
563  return 0;
564  }
565 
566  /** \brief Return the size and a pointer to the column
567  named \c col_name in a table object
568  */
569  int o2scl_acol_get_hist_wgts(void *vp, int &n, double *&ptr) {
571  n=amp->hist_obj.size();
572  amp->ytemp.resize(n);
573  for(size_t i=0;i<n;i++) amp->ytemp[i]=amp->hist_obj.get_wgt_i(i);
574  ptr=&(amp->ytemp[0]);
575  return 0;
576  }
577 
578  /** \brief Desc
579  */
580  int o2scl_acol_contours_n(void *vp) {
582  return amp->cont_obj.size();
583  }
584 
585  /** \brief Desc
586  */
587  double o2scl_acol_contours_line(void *vp, int i, int &n, double *&ptrx,
588  double *&ptry) {
590  double lev=amp->cont_obj[i].level;
591  n=amp->cont_obj[i].x.size();
592  ptrx=&(amp->cont_obj[i].x[0]);
593  ptry=&(amp->cont_obj[i].y[0]);
594  return lev;
595  }
596 
597  /** \brief Desc
598  */
599  void o2scl_acol_get_type(void *vp, int &n, char *&str) {
601  n=amp->type.length();
602  if (n>0) {
603  str=(char *)(amp->type.c_str());
604  } else {
605  str=0;
606  }
607  return;
608  }
609 
610  /** \brief Return the size and a pointer to the column
611  named \c col_name in a table object
612  */
613  int o2scl_acol_get_slice(void *vp, char *slice_name,
614  int &nx, double *&xptr,
615  int &ny, double *&yptr,
616  double *&data) {
618  if (amp->type!="table3d") {
619  std::cout << "No table3d object loaded."
620  << std::endl;
621  return 1;
622  }
623 
624  nx=amp->table3d_obj.get_nx();
625  amp->xtemp.resize(nx);
626  o2scl::vector_copy(amp->table3d_obj.get_x_data(),amp->xtemp);
627  xptr=(double *)&amp->xtemp[0];
628 
629  ny=amp->table3d_obj.get_ny();
630  amp->ytemp.resize(ny);
631  o2scl::vector_copy(amp->table3d_obj.get_y_data(),amp->ytemp);
632  yptr=(double *)&amp->ytemp[0];
633 
634  amp->stemp.resize(nx*ny);
635  std::string stmp=slice_name;
636  typedef boost::numeric::ublas::matrix<double> ubmatrix;
637  const ubmatrix &m=amp->table3d_obj.get_slice(stmp);
638  for(size_t i=0;i<nx;i++) {
639  for(size_t j=0;j<ny;j++) {
640  amp->stemp[i*ny+j]=m(i,j);
641  }
642  }
643  data=(double *)&amp->stemp[0];
644  return 0;
645  }
646 
647  int o2scl_acol_get_hist_2d(void *vp,
648  int &nx, double *&xptr,
649  int &ny, double *&yptr,
650  double *&data) {
652  if (amp->type!="hist_2d") {
653  std::cout << "No hist_2d object loaded."
654  << std::endl;
655  return 1;
656  }
657 
658  nx=amp->hist_2d_obj.size_x();
659  amp->xtemp.resize(nx);
660  for(int i=0;i<nx;i++) {
661  amp->xtemp[i]=amp->hist_2d_obj.get_x_rep_i(i);
662  }
663  xptr=(double *)&amp->xtemp[0];
664 
665  ny=amp->hist_2d_obj.size_y();
666  amp->ytemp.resize(ny);
667  for(int i=0;i<ny;i++) {
668  amp->ytemp[i]=amp->hist_2d_obj.get_y_rep_i(i);
669  }
670  yptr=(double *)&amp->ytemp[0];
671 
672  amp->stemp.resize(nx*ny);
673  typedef boost::numeric::ublas::matrix<double> ubmatrix;
674  const ubmatrix &m=amp->hist_2d_obj.get_wgts();
675  for(size_t i=0;i<nx;i++) {
676  for(size_t j=0;j<ny;j++) {
677  amp->stemp[i*ny+j]=m(i,j);
678  }
679  }
680  data=(double *)&amp->stemp[0];
681  return 0;
682  }
683 
684 }
685 
686 #endif
virtual int comm_function(std::vector< std::string > &sv, bool itive_com)
Create a column from a function.
virtual int comm_to_hist(std::vector< std::string > &sv, bool itive_com)
Desc.
virtual int comm_sort(std::vector< std::string > &sv, bool itive_com)
Sort the table by a column.
Parameters for iterate_func()
Definition: acolm.h:284
virtual int comm_internal(std::vector< std::string > &sv, bool itive_com)
Output to a file in internal format.
virtual int comm_integ(std::vector< std::string > &sv, bool itive_com)
Create a column which is the integral of another.
A namespace for objects associated with the command-line utility &#39;acol&#39;.
Definition: acolm.h:55
Double parameter for o2scl::cli.
Definition: cli.h:299
The driver for &#39;acol&#39; command-line utility.
Definition: acolm.h:93
void * o2scl_create_acol_manager()
Create an o2scl_acol::acol_manager object.
Definition: acolm.h:486
virtual int comm_gen3_list(std::vector< std::string > &sv, bool itive_com)
Read a generic data file.
virtual int comm_delete_col(std::vector< std::string > &sv, bool itive_com)
Delete a column.
virtual int run_o2graph()
For o2graph in o2sclpy.
virtual int comm_cat(std::vector< std::string > &sv, bool itive_com)
Concatenate two table/table3d objects.
virtual int comm_sum(std::vector< std::string > &sv, bool itive_com)
Sum two table/table3d objects.
String parameter for o2scl::cli.
Definition: cli.h:253
virtual int comm_preview(std::vector< std::string > &sv, bool itive_com)
Preview the table.
virtual int comm_get_conv(std::vector< std::string > &sv, bool itive_com)
Get a conversion factor.
std::map< std::string, std::string * > str_params
String parameters.
Definition: acolm.h:218
hist_2d hist_2d_obj
A pointer to the hist.
Definition: acolm.h:183
virtual int comm_contours(std::vector< std::string > &sv, bool itive_com)
Desc.
virtual int comm_calc(std::vector< std::string > &sv, bool itive_com)
Compute a scalar value.
virtual int comm_index(std::vector< std::string > &sv, bool itive_com)
Add a column for line numbers.
Convert units.
Definition: convert_units.h:88
virtual int comm_stats(std::vector< std::string > &sv, bool itive_com)
Get column stats.
virtual int comm_slice(std::vector< std::string > &sv, bool itive_com)
Extract a slice from a table3d object to generate a table object.
virtual int comm_insert_full(std::vector< std::string > &sv, bool itive_com)
Insert an external table using interpolation.
int user_ncols
The number of columns requested by the user.
Definition: acolm.h:133
virtual int comm_nlines(std::vector< std::string > &sv, bool itive_com)
Desc.
virtual int setup_options()
Add the options to the cli object.
virtual int comm_filelist(std::vector< std::string > &sv, bool itive_com)
Read a file and list the O2scl objects.
format_float ffl
The number formatter for html output.
Definition: acolm.h:101
int ncols
Number of columns in screen.
Definition: acolm.h:157
int interp_type
The interpolation type.
Definition: acolm.h:136
A two-dimensional histogram class.
Definition: hist_2d.h:103
hist hist_obj
A pointer to the hist.
Definition: acolm.h:176
virtual int comm_find_row(std::vector< std::string > &sv, bool itive_com)
Find a row from a function.
virtual int comm_version(std::vector< std::string > &sv, bool itive_com)
Print version.
void o2scl_acol_parse(void *vp, int n_entries, int *sizes, char *str)
Parse the set of commands in n_entries, sizes and str.
Definition: acolm.h:522
virtual int comm_interp(std::vector< std::string > &sv, bool itive_com)
Create an html file.
table3d table3d_obj
Pointer to the three dimensional table.
Definition: acolm.h:200
std::vector< std::string > o2scl_acol_parse_arrays(int n_entries, int *sizes, char *str)
Construct a string vector from the data in n_entries, sizes, and str.
Definition: acolm.h:505
int prec
The output precision (default 6)
Definition: acolm.h:112
static herr_t filelist_func(hid_t loc, const char *name, const H5L_info_t *inf, void *op_data)
HDF object iteration function.
virtual int comm_interactive(std::vector< std::string > &sv, bool itive_com)
Toggle interactive mode.
int o2scl_acol_get_column(void *vp, char *col_name, int &n, double *&ptr)
Return the size and a pointer to the column named col_name in a table object.
Definition: acolm.h:535
A one-dimensional histogram class.
Definition: hist.h:113
virtual int comm_set(std::vector< std::string > &sv, bool itive_com)
Post-processing for setting a value.
Configurable command-line interface.
Definition: cli.h:230
cli * cl
Dummy cli object for cli::cli_gets()
Definition: acolm.h:193
bool post_interactive
True if we should run interactive mode after parsing the command-line.
Definition: acolm.h:212
std::string env_var_name
The environment variable to read from.
Definition: acolm.h:215
int o2scl_acol_contours_n(void *vp)
Desc.
Definition: acolm.h:580
virtual int comm_insert(std::vector< std::string > &sv, bool itive_com)
Insert a column from an external table using interpolation.
int get_input_one(std::vector< std::string > &sv, std::string directions, std::string &in, std::string comm_name, bool itive_com)
An internal command for prompting the user for one command argument.
virtual int comm_select(std::vector< std::string > &sv, bool itive_com)
Select several columns for a new table.
static herr_t iterate_func(hid_t loc, const char *name, const H5L_info_t *inf, void *op_data)
HDF object iteration function.
std::string type
String designating the current type.
Definition: acolm.h:189
std::vector< o2scl::contour_line > cont_obj
Contour lines object.
Definition: acolm.h:207
virtual int comm_read(std::vector< std::string > &sv, bool itive_com)
Read a file.
void vector_copy(const vec_t &src, vec2_t &dest)
Simple vector copy.
Definition: vector.h:127
virtual int comm_min(std::vector< std::string > &sv, bool itive_com)
Compute the minimum value of a colum.
std::map< std::string, int * > int_params
Integer parameters.
Definition: acolm.h:221
virtual int comm_select_rows(std::vector< std::string > &sv, bool itive_com)
Select several rows for a new table.
int set_swidth(int ncol)
Set screen witdth.
Definition: acolm.h:427
int o2scl_acol_get_hist_wgts(void *vp, int &n, double *&ptr)
Return the size and a pointer to the column named col_name in a table object.
Definition: acolm.h:569
bool names_out
True if we should output column names.
Definition: acolm.h:121
int o2scl_acol_get_hist_reps(void *vp, int &n, double *&ptr)
Return the size and a pointer to the column named col_name in a table object.
Definition: acolm.h:557
virtual int comm_get_row(std::vector< std::string > &sv, bool itive_com)
Print out an entire row.
int verbose
The verbosity level (default 1)
Definition: acolm.h:115
std::string obj_name
The name of the table.
Definition: acolm.h:124
Format a floating point number into a Latex or HTML string.
Definition: format_float.h:113
String parameter for o2scl::cli.
Definition: cli.h:276
virtual int comm_show_units(std::vector< std::string > &sv, bool itive_com)
Set units of a column.
virtual int comm_deriv(std::vector< std::string > &sv, bool itive_com)
Create a column which is the derivative of another.
bool scientific
True for scientific output mode.
Definition: acolm.h:139
int get_input(std::vector< std::string > &sv, std::vector< std::string > &directions, std::vector< std::string > &in, std::string comm_name, bool itive_com)
An internal command for prompting the user for command arguments.
void clear_obj()
Clear memory associated with the current object and set type to "".
table_units table_obj
A pointer to the table.
Definition: acolm.h:169
o2scl::convert_units & cng
Convert units object (initialized by constructor to global object)
Definition: acolm.h:107
virtual int comm_list(std::vector< std::string > &sv, bool itive_com)
List columns in table &#39;tp&#39; named &#39;tname&#39; assuming screen size &#39;ncol&#39;.
virtual int setup_help()
Add the help text to the cli object.
virtual int comm_generic(std::vector< std::string > &sv, bool itive_com)
Read a generic data file.
Integer parameter for o2scl::cli.
Definition: cli.h:333
virtual int comm_output(std::vector< std::string > &sv, bool itive_com)
Output to screen or file.
void o2scl_acol_get_type(void *vp, int &n, char *&str)
Desc.
Definition: acolm.h:599
double o2scl_acol_contours_line(void *vp, int i, int &n, double *&ptrx, double *&ptry)
Desc.
Definition: acolm.h:587
virtual int run(int argv, char *argc[])
Main run function.
virtual int comm_deriv2(std::vector< std::string > &sv, bool itive_com)
Create a column which is the second derivative of another.
Data table table class with units.
Definition: table_units.h:37
virtual int setup_cli()
Create the cli object (with readline support if available)
virtual int comm_type(std::vector< std::string > &sv, bool itive_com)
Desc.
A data structure containing many slices of two-dimensional data points defined on a grid...
Definition: table3d.h:78
void o2scl_free_acol_manager(void *vp)
Free memory associated with a o2scl_acol::acol_manager object.
Definition: acolm.h:495
std::string def_args
Default arguments from environment.
Definition: acolm.h:130
virtual int comm_assign(std::vector< std::string > &sv, bool itive_com)
Assign a constant.
virtual int comm_convert_unit(std::vector< std::string > &sv, bool itive_com)
Convert units of a column.
Store data in an O<span style=&#39;position: relative; top: 0.3em; font-size: 0.8em&#39;>2</span>scl O$_2$sc...
Definition: hdf_file.h:96
virtual int comm_fit(std::vector< std::string > &sv, bool itive_com)
Fit two columns to a function.
virtual int comm_rename(std::vector< std::string > &sv, bool itive_com)
Rename a column.
std::string unit_fname
Filename for units command.
Definition: acolm.h:127
virtual int setup_parameters()
Add the parameters for &#39;set&#39; to the cli object.
bool pretty
True if we should make the output into neat columns (default true)
Definition: acolm.h:118
virtual int comm_max(std::vector< std::string > &sv, bool itive_com)
Compute the maximum value of a colum.
virtual int comm_get_unit(std::vector< std::string > &sv, bool itive_com)
Get units of a column.
virtual int comm_delete_rows(std::vector< std::string > &sv, bool itive_com)
Delete rows specified by a function.
virtual int comm_create(std::vector< std::string > &sv, bool itive_com)
Create a table from a column of equally spaced values.
int o2scl_acol_get_slice(void *vp, char *slice_name, int &nx, double *&xptr, int &ny, double *&yptr, double *&data)
Return the size and a pointer to the column named col_name in a table object.
Definition: acolm.h:613
virtual int comm_set_data(std::vector< std::string > &sv, bool itive_com)
Set an individual data point at a specified row and column.
virtual int comm_set_unit(std::vector< std::string > &sv, bool itive_com)
Set units of a column.
virtual int comm_create3(std::vector< std::string > &sv, bool itive_com)
Create a table3d object.

Documentation generated with Doxygen. Provided under the GNU Free Documentation License (see License Information).