SyTen
bpo_helper.h File Reference

Helper macros to handle repetitive use of boost::program_options. More...

#include <boost/program_options.hpp>
#include "inc/util/configuration.h"
#include "inc/util/threads.h"
#include "inc/util/macros.h"
#include "inc/util/cached_type.h"
#include "inc/util/cached_type_async.h"
#include "inc/util/blas-wrapper.h"
#include "inc/util/envvars.h"
#include "inc/util/log.h"
#include "inc/util/terminator.h"
#include "inc/util/output.h"
#include "inc/util/version.h"
#include "inc/util/cuda_support.h"
+ Include dependency graph for bpo_helper.h:
+ This graph shows which files directly or indirectly include this file:

Macros

#define SYTEN_BPO_EXEC
 End the boost::program_options section with this. More...
 
#define SYTEN_BPO_INIT
 Start the boost::program_options section with this. More...
 

Detailed Description

Helper macros to handle repetitive use of boost::program_options.

Include this file, then use the macro SYTEN_BPO_INIT first. The macro adds some standard options to the variable opt, you can add more using e.g.

opt.add_options()
("lattice,l", boost::program_options::value(&latFile)->default_value(""),"lattice file [required]")
;

If you want hidden options, use opt_hidden, for positional options, opt_pos. When done, use SYTEN_BPO_EXEC to parse and store the results.

Variables injected after SYTEN_BPO_EXEC:

  • inputVariables: map of all program options used
  • opt: all non-hidden variables, use e.g. in help messages
  • bpo_quiet: true if [-]-q[uiet] was passed: avoid unnecessary output in this case, i.e. only print a single scalar for expectation values, print nothing for state generation etc.
  • bpo_help: true if [-]-h[elp] was passed: print a help message and exit with return value 0.
  • bpo_cache: true if [-]-c[ache] was passed: attempt to use the HDD as cache if possible/reasonable, in particular call State::setMaybeCache(bpo_cache) on state objects (unless you know what you’re doing).