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