ALPSCore reference
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1998-2018 ALPS Collaboration. See COPYRIGHT.TXT
3  * All rights reserved. Use is subject to license terms. See LICENSE.TXT
4  * For use in publications, see ACKNOWLEDGE.TXT
5  */
9 #include "alps/params.hpp"
13 namespace alps {
14  namespace params_ns {
18  const std::string origin=origin_name(parameters);
19  const std::string basename=alps::fs::remove_extensions(alps::fs::get_basename(origin));
20  parameters
21  .define<std::size_t>("timelimit", 0, "time limit for the simulation")
22  .define<std::string>("outputfile", basename+".out.h5", "name of the output file")
23  ;
24  const std::string base_outname=alps::fs::remove_extensions(alps::fs::get_basename(parameters["outputfile"]));
25  parameters
26  .define<std::string>("checkpoint", base_outname+".clone.h5", "name of the checkpoint file to save to")
27  ;
28  return parameters;
29  }
30  } // end of namespace params_ns
32 } // end of namespace alps
33 #endif
Parse sectioned INI file or HDF5 or command line, provide the results as dictionary.
Definition: params.hpp:84
params & define(const std::string &name, const std::string &descr)
Defines a parameter; returns false on error, and records the error in the object. ...
std::string origin_name(const params &p)
Convenience function to obtain the "origin" filename associated with the parameters object...
Definition: params.cpp:505
params & define_convenience_parameters(params &parameters)
Defines a number of frequently-used parameters. Defines size_t timelimt, string outputfile, string checkpoint.
std::string get_basename(const std::string &path)
Returns the base name of the file (removing leading directories)
std::string remove_extensions(const std::string &filename)
Returns the file name stem with ALL extensions removed.