ALPSCore reference
api.hpp
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 #pragma once
8 
9 #include <alps/config.hpp>
10 #include <alps/params.hpp>
11 #include <alps/accumulators.hpp>
12 
13 #include <string>
14 
15 namespace alps {
16 
17  template<typename S> struct result_names_type {
18  typedef typename S::result_names_type type;
19  };
20 
21  template<typename S> struct results_type {
22  typedef typename S::results_type type;
23  };
24 
25  template<typename S> struct parameters_type {
26  typedef typename S::parameters_type type;
27  };
28 
29  template<typename S> typename result_names_type<S>::type result_names(S const & s) {
30  return s.result_names();
31  }
32 
33  template<typename S> typename result_names_type<S>::type unsaved_result_names(S const & s) {
34  return s.unsaved_result_names();
35  }
36 
37  template<typename S> typename results_type<S>::type collect_results(S const & s) {
38  return s.collect_results();
39  }
40 
41  template<typename S> typename results_type<S>::type collect_results(S const & s, typename result_names_type<S>::type const & names) {
42  return s.collect_results(names);
43  }
44 
45  template<typename S> typename results_type<S>::type collect_results(S const & s, std::string const & name) {
46  return collect_results(s, typename result_names_type<S>::type(1, name));
47  }
48 
49  template<typename S> double fraction_completed(S const & s) {
50  return s.fraction_completed();
51  }
52 
53  void save_results(alps::accumulators::accumulator_set const & observables, params const & params, std::string const & filename, std::string const & path);
54  void save_results(alps::accumulators::result_set const & results, params const & params, std::string const & filename, std::string const & path);
55 
56  template<typename C, typename P> void broadcast(C const & c, P & p, int r = 0) {
57  p.broadcast(c, r);
58  }
59 
60 }
Parse sectioned INI file or HDF5 or command line, provide the results as dictionary.
Definition: params.hpp:84
S::parameters_type type
Definition: api.hpp:26
void broadcast(C const &c, P &p, int r=0)
Definition: api.hpp:56
S::results_type type
Definition: api.hpp:22
result_names_type< S >::type result_names(S const &s)
Definition: api.hpp:29
void save_results(alps::accumulators::accumulator_set const &observables, params const &params, std::string const &filename, std::string const &path)
Definition: api.cpp:26
double fraction_completed(S const &s)
Definition: api.hpp:49
results_type< S >::type collect_results(S const &s)
Definition: api.hpp:37
result_names_type< S >::type unsaved_result_names(S const &s)
Definition: api.hpp:33
T r(T x, T y=T(), T z=T())
S::result_names_type type
Definition: api.hpp:18