ALPSCore reference
api.cpp
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  */
6 
7 #include <alps/mc/api.hpp>
8 #include <alps/hdf5/archive.hpp>
9 
10 namespace alps {
11 
12  namespace detail {
13  template<typename R, typename P> void save_results_impl(R const & results, P const & params, std::string const & filename, std::string const & path) {
14  if (results.size()) {
15  hdf5::archive ar(filename, "w");
16  ar["/parameters"] << params;
17  ar[path] << results;
18  }
19  }
20  }
21 
22  void save_results(alps::accumulators::result_set const & results, params const & params, std::string const & filename, std::string const & path) {
23  detail::save_results_impl(results, params, filename, path);
24  }
25 
26  void save_results(alps::accumulators::accumulator_set const & observables, params const & params, std::string const & filename, std::string const & path) {
27  detail::save_results_impl(observables, params, filename, path);
28  }
29 
30 }
Parse sectioned INI file or HDF5 or command line, provide the results as dictionary.
Definition: params.hpp:84
void save_results(alps::accumulators::accumulator_set const &observables, params const &params, std::string const &filename, std::string const &path)
Definition: api.cpp:26
params_ns::params params
Definition: params.hpp:358