acolm.h
Go to the documentation of this file.
1 /*
2  -------------------------------------------------------------------
3 
4  Copyright (C) 2006-2018, 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 #include <o2scl/tensor_grid.h>
48 
49 #ifdef O2SCL_READLINE
50 #include <o2scl/cli_readline.h>
51 #else
52 #include <o2scl/cli.h>
53 #endif
54 
55 /// A namespace for objects associated with the command-line utility 'acol'
56 namespace o2scl_acol {
57 
58  /** \brief The driver for 'acol' command-line utility
59  \nothing
60 
61  \comment
62  There was some concern about the confusion b/w the commands
63  "get row by index" (get-row) and "get row by function"
64  (find-row) and "select rows by function" (select-rows),
65  but it might be ok.
66  \endcomment
67 
68  \future Stack-like operations (push, pop, swap,
69  stack-list, etc.)?
70 
71  \future Use get_input() in comm_create?
72 
73  \future Add functionality to ensure that three digit exponents
74  are still handled gracefully (do this by creating a new boolean
75  setting which, if true, always makes three spaces for
76  exponents?)
77 
78  \future Fix insert and insert_full so that it automatically
79  renames columns
80 
81  \future Allow "insert" commands to be restrictive, avoiding
82  extrapolation
83 
84  \future Replace ~ with $HOME in filenames (this might be best
85  done inside the \ref o2scl::cli class). (Some progress made.
86  Function cli::expand_tilde() is written but not yet
87  implemented.)
88 
89  \future New 3d commands: transpose (for table3d), contours,
90  find_grid_x, find_grid_y.
91 
92  \hline
93  */
94  class acol_manager {
95 
96 #ifndef DOXYGEN_INTERNAL
97 
98  protected:
99 
100  /** \brief If true, then run in o2graph mode
101  */
103 
104  /** \brief The object for the set function
105  */
107 
108  /** \brief Add new commands for type \c new_type
109  */
110  void command_add(std::string new_type);
111 
112 #ifdef DOXYGEN
113  /// The number formatter for html output
114  format_float ffl;
115 #else
117 #endif
118 
119  /// Convert units object (initialized by constructor to global object)
121 
122  /// \name Parameters modifiable by the user
123  //@{
124  /// The output precision (default 6)
125  int prec;
126 
127  /// The verbosity level (default 1)
128  int verbose;
129 
130  /// True if we should make the output into neat columns (default true)
131  bool pretty;
132 
133  /// True if we should output column names
134  bool names_out;
135 
136  /// The name of the table
137  std::string obj_name;
138 
139  /// Filename for units command
140  std::string unit_fname;
141 
142  /// Default arguments from environment
143  std::string def_args;
144 
145  /// The number of columns requested by the user
147 
148  /// The interpolation type
150 
151  /// If set, try to compress
152  int compress;
153 
154  /// True for scientific output mode
156  //@}
157 
158  /// \name The parameter objects
159  //@{
160  o2scl::cli::parameter_string p_obj_name;
161  o2scl::cli::parameter_string p_unit_fname;
162  o2scl::cli::parameter_string p_def_args;
163  o2scl::cli::parameter_int p_verbose;
164  o2scl::cli::parameter_int p_compress;
167  o2scl::cli::parameter_int p_interp_type;
168  o2scl::cli::parameter_bool p_scientific;
170  o2scl::cli::parameter_bool p_names_out;
171  //@}
172 
173  /// Number of columns in screen
174  int ncols;
175 
176 #endif
177 
178  public:
179 
180  acol_manager();
181 
182  virtual ~acol_manager() {}
183 
184  /// String designating the current type
185  std::string type;
186 
187  /// Dummy cli object for cli::cli_gets()
188 #ifdef DOXYGEN
189  cli *cl;
190 #else
191  o2scl::cli *cl;
192 #endif
193 
194  /// \name Object storage
195  //@{
196  o2scl::table_units<> table_obj;
197  o2scl::table3d table3d_obj;
198  o2scl::hist hist_obj;
199  o2scl::hist_2d hist_2d_obj;
200 
201  int int_obj;
202  char char_obj;
203  double double_obj;
204  size_t size_t_obj;
205  std::string string_obj;
206 
207  std::vector<o2scl::contour_line> cont_obj;
209 
210  std::vector<int> intv_obj;
211  std::vector<double> doublev_obj;
212  std::vector<size_t> size_tv_obj;
213  std::vector<std::string> stringv_obj;
214 
215  o2scl::tensor_grid<> tensor_grid_obj;
216  //@}
217 
218  /** \brief True if we should run interactive mode after parsing
219  the command-line
220  */
222 
223  /// The environment variable to read from
224  std::string env_var_name;
225 
226  /// String parameters
227  std::map<std::string,std::string *> str_params;
228 
229  /// Integer parameters
230  std::map<std::string,int *> int_params;
231 
232  protected:
233 
234  /** \brief Clear memory associated with the current object and set
235  type to ""
236  */
237  void clear_obj();
238 
239  /** \brief Desc
240  */
241  void command_del();
242 
243  // Ensure \c col is unique from entries in \c cnames
244  //int make_unique_name(std::string &col, std::vector<std::string> &cnames);
245 
246  public:
247 
248  /** \brief Main run function
249 
250  Process command-line options using cli object, interface with
251  the operating system via getenv(), instantiate and call the
252  acol_manager object.
253  */
254  virtual int run(int argv, char *argc[], bool set_o2graph_mode=false);
255 
256  /// Create the cli object (with readline support if available)
257  virtual int setup_cli();
258 
259  /// Add the options to the cli object
260  virtual int setup_options();
261 
262  /// Add the help text to the cli object
263  virtual int setup_help();
264 
265  /// Add the parameters for 'set' to the cli object
266  virtual int setup_parameters();
267 
268  /// Assign a constant
269  virtual int comm_assign(std::vector<std::string> &sv, bool itive_com);
270 
271  /// Compute a scalar value
272  virtual int comm_calc(std::vector<std::string> &sv, bool itive_com);
273 
274  /** \brief Desc
275  */
276  virtual int comm_help(std::vector<std::string> &sv, bool itive_com);
277 
278  /** \brief List commands, with an optional type argument
279  */
280  virtual int comm_commands(std::vector<std::string> &sv, bool itive_com);
281 
282  /// Create a table from a column of equally spaced values
283  virtual int comm_create(std::vector<std::string> &sv, bool itive_com);
284 
285  virtual int comm_set_grid(std::vector<std::string> &sv, bool itive_com);
286 
287  /// Download a file from a specified URL
288  virtual int comm_download(std::vector<std::string> &sv, bool itive_com);
289 
290  /// Delete a column
291  virtual int comm_delete_col(std::vector<std::string> &sv, bool itive_com);
292 
293  /// Delete rows specified by a function
294  virtual int comm_delete_rows(std::vector<std::string> &sv, bool itive_com);
295 
296  /// Create a column which is the derivative of another
297  virtual int comm_deriv(std::vector<std::string> &sv, bool itive_com);
298 
299  /** \brief Desc
300  */
301  virtual int comm_to_table(std::vector<std::string> &sv, bool itive_com);
302 
303  /** \brief Desc
304  */
305  virtual int comm_to_table3d(std::vector<std::string> &sv, bool itive_com);
306 
307  /** \brief Desc
308  */
309  virtual int comm_autocorr(std::vector<std::string> &sv, bool itive_com);
310 
311  /// Create a slice which is the derivative wrt x of another
312  virtual int comm_deriv_x(std::vector<std::string> &sv, bool itive_com);
313 
314  /// Create a slice which is the derivative wrt y of another
315  virtual int comm_deriv_y(std::vector<std::string> &sv, bool itive_com);
316 
317  /// Create a column which is the second derivative of another
318  virtual int comm_deriv2(std::vector<std::string> &sv, bool itive_com);
319 
320  /// Parameters for iterate_func()
321  typedef struct {
322  std::string tname;
324  bool found;
325  std::string type;
326  int verbose;
327  int mode;
328  } iter_parms;
329 
330  /// HDF object iteration function
331  static herr_t iterate_func(hid_t loc, const char *name,
332  const H5L_info_t *inf, void *op_data);
333 
334  /// HDF object iteration function
335  static herr_t filelist_func(hid_t loc, const char *name,
336  const H5L_info_t *inf, void *op_data);
337 
338  /// Read a file and list the O2scl objects
339  virtual int comm_filelist(std::vector<std::string> &sv, bool itive_com);
340 
341  /// Read an object from a file
342  virtual int comm_read(std::vector<std::string> &sv, bool itive_com);
343 
344  /// Add 'nlines' as a constant to a \ref o2scl::table object
345  virtual int comm_nlines(std::vector<std::string> &sv, bool itive_com);
346 
347  /// Convert a \ref o2scl::table object to a \ref o2scl::hist object
348  virtual int comm_to_hist(std::vector<std::string> &sv, bool itive_com);
349 
350  /// Output the type of the current object to the screen
351  virtual int comm_type(std::vector<std::string> &sv, bool itive_com);
352 
353  /// Find a row from a function
354  virtual int comm_find_row(std::vector<std::string> &sv, bool itive_com);
355 
356  /// Create a column from a function
357  virtual int comm_function(std::vector<std::string> &sv, bool itive_com);
358 
359  /// Read a generic data file
360  virtual int comm_generic(std::vector<std::string> &sv, bool itive_com);
361 
362  /// Print out an entire row
363  virtual int comm_get_row(std::vector<std::string> &sv, bool itive_com);
364 
365  /// Extract a slice from a table3d object to generate a table object
366  virtual int comm_slice(std::vector<std::string> &sv, bool itive_com);
367 
368  /// Fit two columns to a function
369  virtual int comm_fit(std::vector<std::string> &sv, bool itive_com);
370 
371 #ifdef O2SCL_NEVER_DEFINED
372  // Create an html file
373  //virtual int comm_html(std::vector<std::string> &sv, bool itive_com);
374 #endif
375 
376  /// Insert a column from an external table using interpolation
377  virtual int comm_insert(std::vector<std::string> &sv, bool itive_com);
378 
379  /// Insert an external table using interpolation
380  virtual int comm_insert_full(std::vector<std::string> &sv, bool itive_com);
381 
382  /// Create a column which is the integral of another
383  virtual int comm_integ(std::vector<std::string> &sv, bool itive_com);
384 
385  /// Toggle interactive mode
386  virtual int comm_interactive(std::vector<std::string> &sv, bool itive_com);
387 
388  /// Output to a file in internal format
389  virtual int comm_internal(std::vector<std::string> &sv, bool itive_com);
390 
391  /// Create an html file
392  virtual int comm_interp(std::vector<std::string> &sv, bool itive_com);
393 
394  /// List columns in table 'tp' named 'tname' assuming screen size 'ncol'
395  virtual int comm_list(std::vector<std::string> &sv, bool itive_com);
396 
397  /// Compute the maximum value of a colum
398  virtual int comm_max(std::vector<std::string> &sv, bool itive_com);
399 
400  /// Compute the minimum value of a colum
401  virtual int comm_min(std::vector<std::string> &sv, bool itive_com);
402 
403  /// Add a column for line numbers
404  virtual int comm_index(std::vector<std::string> &sv, bool itive_com);
405 
406  /// Output to screen or file
407  virtual int comm_output(std::vector<std::string> &sv, bool itive_com);
408 
409  /// Preview the table
410  virtual int comm_preview(std::vector<std::string> &sv, bool itive_com);
411  virtual int comm_value(std::vector<std::string> &sv, bool itive_com);
412 
413  /// Concatenate two table/table3d objects
414  virtual int comm_cat(std::vector<std::string> &sv, bool itive_com);
415 
416  /// Sum two table/table3d objects
417  virtual int comm_sum(std::vector<std::string> &sv, bool itive_com);
418 
419  /// Rename a column
420  virtual int comm_rename(std::vector<std::string> &sv, bool itive_com);
421 
422  /// Select several columns for a new table
423  virtual int comm_select(std::vector<std::string> &sv, bool itive_com);
424 
425  /// Select several rows for a new table
426  virtual int comm_select_rows(std::vector<std::string> &sv,
427  bool itive_com);
428 
429  /** \brief A faster form of select rows which requires one to specify
430  the columns needed for the selection criteria first
431  */
432  virtual int comm_select_rows2(std::vector<std::string> &sv,
433  bool itive_com);
434 
435  /// Post-processing for setting a value
436  virtual int comm_set(std::vector<std::string> &sv, bool itive_com);
437 
438  /// Set an individual data point at a specified row and column
439  virtual int comm_set_data(std::vector<std::string> &sv, bool itive_com);
440 
441  /// Set units of a column
442  virtual int comm_set_unit(std::vector<std::string> &sv, bool itive_com);
443 
444  /// Compute contour lines
445  virtual int comm_contours(std::vector<std::string> &sv, bool itive_com);
446 
447  /// Set units of a column
448  virtual int comm_show_units(std::vector<std::string> &sv, bool itive_com);
449 
450  /// Get units of a column
451  virtual int comm_get_unit(std::vector<std::string> &sv, bool itive_com);
452 
453  /// Get an entry
454  virtual int comm_entry(std::vector<std::string> &sv, bool itive_com);
455 
456  /// Convert units of a column
457  virtual int comm_convert_unit(std::vector<std::string> &sv,
458  bool itive_com);
459 
460  /// Sort the table by a column
461  virtual int comm_sort(std::vector<std::string> &sv, bool itive_com);
462 
463  /// Get column stats
464  virtual int comm_stats(std::vector<std::string> &sv, bool itive_com);
465 
466  /// Print version
467  virtual int comm_version(std::vector<std::string> &sv, bool itive_com);
468 
469  /// Get a conversion factor
470  virtual int comm_get_conv(std::vector<std::string> &sv, bool itive_com);
471 
472  /// Set screen witdth
473  int set_swidth(int ncol) {
474  ncols=ncol;
475  return 0;
476  }
477 
478  /** \brief A placeholder function which is used for
479  documenting <tt>o2graph</tt> commands
480  */
481  virtual int comm_none(std::vector<std::string> &sv, bool itive_com) {
482  return 0;
483  }
484 
485  protected:
486 
487  /// An internal command for prompting the user for command arguments
488  int get_input(std::vector<std::string> &sv,
489  std::vector<std::string> &directions,
490  std::vector<std::string> &in, std::string comm_name,
491  bool itive_com);
492 
493  /// An internal command for prompting the user for one command argument
494  int get_input_one(std::vector<std::string> &sv, std::string directions,
495  std::string &in, std::string comm_name,
496  bool itive_com);
497 
498  public:
499 
500  /// \name Temporary storage for get slice
501  //@{
502  std::vector<double> xtemp;
503  std::vector<double> ytemp;
504  std::vector<double> stemp;
505  //@}
506 
507  /// \name Parameters for <tt>o2graph</tt> documentation
508  //@{
525  o2scl::cli::parameter_double p_left_margin;
526  o2scl::cli::parameter_double p_right_margin;
527  o2scl::cli::parameter_double p_bottom_margin;
528  o2scl::cli::parameter_double p_top_margin;
529 
530  std::string cmap, xtitle, ytitle;
531  double xlo, xhi, ylo, yhi, zlo, zhi;
532  bool xset, yset, zset, colbar, logx, logy;
533  int font;
534  double left_margin, right_margin, top_margin, bottom_margin;
535  //@}
536 
537  };
538 
539 }
540 
541 extern "C" {
542 
543  // (remember that \ref's don't work in \name groups)
544  /// \name Functions to integrate o2scl_acol::acol_manager with python
545  //@{
546  /** \brief Create an \ref o2scl_acol::acol_manager object
547 
548  This function creates an object of type
549  \ref o2scl_acol::acol_manager with the <tt>new</tt>
550  operator and then calls the function
551  \ref o2scl_acol::acol_manager::run() .
552  */
554 
555  /** \brief Free memory associated with a \ref
556  o2scl_acol::acol_manager object
557 
558  This function uses <tt>delete</tt> to free the
559  memory associated with an object of type
560  \ref o2scl_acol::acol_manager .
561  */
562  void o2scl_free_acol_manager(void *vp);
563 
564  /** \brief Construct a string vector from the data in
565  \c n_entries, \c sizes, and \c str
566  */
567  std::vector<std::string> o2scl_acol_parse_arrays
568  (int n_entries, int *sizes, char *str);
569 
570  /** \brief Parse the set of commands in \c n_entries, \c sizes
571  and \c str
572  */
573  void o2scl_acol_parse(void *vp, int n_entries, int *sizes,
574  char *str);
575 
576  /** \brief Return the size and a pointer to the column
577  named \c col_name in a table object
578  */
579  int o2scl_acol_get_column(void *vp, char *col_name,
580  int &n, double *&ptr);
581 
582  /** \brief Return the size and a pointer to the column
583  named \c col_name in a table object
584  */
585  int o2scl_acol_get_double_arr(void *vp, int &n, double *&ptr);
586 
587  /** \brief Return the size and a pointer to the column
588  named \c col_name in a table object
589  */
590  int o2scl_acol_get_hist_reps(void *vp, int &n, double *&ptr);
591 
592  /** \brief Return the size and a pointer to the column
593  named \c col_name in a table object
594  */
595  int o2scl_acol_get_hist_wgts(void *vp, int &n, double *&ptr);
596 
597  /** \brief Return the number of contour lines associated with
598  the current contour line vector object
599  */
600  int o2scl_acol_contours_n(void *vp);
601 
602  /** \brief For the current contour line vector object, set the
603  pointers to the x- and y-values in the contour lines and return
604  the contour level
605  */
606  double o2scl_acol_contours_line(void *vp, int i, int &n, double *&ptrx,
607  double *&ptry);
608 
609  /** \brief Return the type of the current object
610  */
611  void o2scl_acol_get_type(void *vp, int &n, char *&str);
612 
613  /** \brief Return the size and a pointer to the column
614  named \c col_name in a table object
615  */
616  int o2scl_acol_get_slice(void *vp, char *slice_name,
617  int &nx, double *&xptr,
618  int &ny, double *&yptr,
619  double *&data);
620 
621  /** \brief For a two-dimensional histogram, return the bin edges,
622  number of bins in both directions, and the weights in each bin
623  */
624  int o2scl_acol_get_hist_2d(void *vp,
625  int &nx, double *&xptr,
626  int &ny, double *&yptr,
627  double *&data);
628  //@}
629 
630 }
631 
632 #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)
Convert a o2scl::table object to a o2scl::hist object.
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:321
virtual int comm_internal(std::vector< std::string > &sv, bool itive_com)
Output to a file in internal format.
virtual int comm_download(std::vector< std::string > &sv, bool itive_com)
Download a file from a specified URL.
Tensor class with arbitrary dimensions with a grid.
Definition: tensor_grid.h:46
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:56
Double parameter for o2scl::cli.
Definition: cli.h:299
int o2scl_acol_get_double_arr(void *vp, int &n, double *&ptr)
Return the size and a pointer to the column named col_name in a table object.
The driver for &#39;acol&#39; command-line utility.
Definition: acolm.h:94
void * o2scl_create_acol_manager()
Create an o2scl_acol::acol_manager object.
virtual int comm_help(std::vector< std::string > &sv, bool itive_com)
Desc.
virtual int comm_delete_col(std::vector< std::string > &sv, bool itive_com)
Delete a column.
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:227
virtual int comm_contours(std::vector< std::string > &sv, bool itive_com)
Compute contour lines.
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 run(int argv, char *argc[], bool set_o2graph_mode=false)
Main run function.
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:146
virtual int comm_nlines(std::vector< std::string > &sv, bool itive_com)
Add &#39;nlines&#39; as a constant to a o2scl::table object.
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:114
int ncols
Number of columns in screen.
Definition: acolm.h:174
int interp_type
The interpolation type.
Definition: acolm.h:149
virtual int comm_to_table3d(std::vector< std::string > &sv, bool itive_com)
Desc.
A two-dimensional histogram class.
Definition: hist_2d.h:103
virtual int comm_find_row(std::vector< std::string > &sv, bool itive_com)
Find a row from a function.
virtual int comm_autocorr(std::vector< std::string > &sv, bool itive_com)
Desc.
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.
virtual int comm_interp(std::vector< std::string > &sv, bool itive_com)
Create an html file.
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.
int prec
The output precision (default 6)
Definition: acolm.h:125
static herr_t filelist_func(hid_t loc, const char *name, const H5L_info_t *inf, void *op_data)
HDF object iteration function.
void command_add(std::string new_type)
Add new commands for type new_type.
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.
bool o2graph_mode
If true, then run in o2graph mode.
Definition: acolm.h:102
A one-dimensional histogram class.
Definition: hist.h:113
virtual int comm_commands(std::vector< std::string > &sv, bool itive_com)
List commands, with an optional type argument.
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:189
bool post_interactive
True if we should run interactive mode after parsing the command-line.
Definition: acolm.h:221
std::string env_var_name
The environment variable to read from.
Definition: acolm.h:224
int o2scl_acol_contours_n(void *vp)
Return the number of contour lines associated with the current contour line vector object...
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:185
virtual int comm_read(std::vector< std::string > &sv, bool itive_com)
Read an object from a file.
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:230
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:473
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.
bool names_out
True if we should output column names.
Definition: acolm.h:134
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.
virtual int comm_get_row(std::vector< std::string > &sv, bool itive_com)
Print out an entire row.
virtual int comm_none(std::vector< std::string > &sv, bool itive_com)
A placeholder function which is used for documenting o2graph commands.
Definition: acolm.h:481
int verbose
The verbosity level (default 1)
Definition: acolm.h:128
Member function pointer for o2scl::cli command function.
Definition: cli.h:100
std::string obj_name
The name of the table.
Definition: acolm.h:137
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:155
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 "".
virtual int comm_to_table(std::vector< std::string > &sv, bool itive_com)
Desc.
o2scl::convert_units & cng
Convert units object (initialized by constructor to global object)
Definition: acolm.h:120
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_select_rows2(std::vector< std::string > &sv, bool itive_com)
A faster form of select rows which requires one to specify the columns needed for the selection crite...
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)
Return the type of the current object.
double o2scl_acol_contours_line(void *vp, int i, int &n, double *&ptrx, double *&ptry)
For the current contour line vector object, set the pointers to the x- and y-values in the contour li...
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:42
o2scl::comm_option_mfptr< acol_manager > cset
The object for the set function.
Definition: acolm.h:106
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)
Output the type of the current object to the screen.
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.
std::string def_args
Default arguments from environment.
Definition: acolm.h:143
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:100
virtual int comm_entry(std::vector< std::string > &sv, bool itive_com)
Get an entry.
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:140
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:131
virtual int comm_max(std::vector< std::string > &sv, bool itive_com)
Compute the maximum value of a colum.
virtual int comm_deriv_y(std::vector< std::string > &sv, bool itive_com)
Create a slice which is the derivative wrt y of another.
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.
int compress
If set, try to compress.
Definition: acolm.h:152
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.
virtual int comm_deriv_x(std::vector< std::string > &sv, bool itive_com)
Create a slice which is the derivative wrt x of another.
virtual int comm_set_data(std::vector< std::string > &sv, bool itive_com)
Set an individual data point at a specified row and column.
int o2scl_acol_get_hist_2d(void *vp, int &nx, double *&xptr, int &ny, double *&yptr, double *&data)
For a two-dimensional histogram, return the bin edges, number of bins in both directions, and the weights in each bin.
virtual int comm_set_unit(std::vector< std::string > &sv, bool itive_com)
Set units of a column.

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