PSCF v1.2
rpc/fts/analyzer/AnalyzerManager.tpp
1#ifndef RPC_ANALYZER_MANAGER_TPP
2#define RPC_ANALYZER_MANAGER_TPP
3
4#include "AnalyzerManager.h"
5#include "AnalyzerFactory.h"
6#include <util/param/ParamComposite.h>
7
8namespace Pscf {
9namespace Rpc {
10
11 using namespace Util;
12
13 /*
14 * Constructor.
15 */
16 template <int D>
18 : Manager< Analyzer<D> >(),
19 simulatorPtr_(&simulator),
20 systemPtr_(&system)
21 { setClassName("AnalyzerManager"); }
22
23 /*
24 * Destructor.
25 */
26 template <int D>
29
30 /*
31 * Return a pointer to a new AnalyzerFactory object.
32 */
33 template <int D>
35 { return new AnalyzerFactory<D>(*simulatorPtr_, *systemPtr_); }
36
37 /*
38 * Read parameter file.
39 *
40 * \param in input parameter file stream.
41 */
42 template <int D>
44 {
46 readOptional(in,"baseInterval", Analyzer<D>::baseInterval);
47 Manager< Analyzer<D> >::readParameters(in);
48 }
49
50 /*
51 * Call initialize method of each analyzer.
52 */
53 template <int D>
55 {
56 for (int i = 0; i < size(); ++i) {
57 (*this)[i].setup();
58 }
59 }
60
61 /*
62 * Call sample method of each analyzer.
63 */
64 template <int D>
66 {
69 for (int i = 0; i < size(); ++i) {
70 (*this)[i].sample(iStep);
71 }
72 }
73
74 /*
75 * Call output method of each analyzer.
76 */
77 template <int D>
79 {
80 for (int i = 0; i < size(); ++i) {
81 (*this)[i].output();
82 }
83 }
84
85 #if 0
86 /*
87 * Read instructions for creating objects from file.
88 */
89 template <int D>
91 {
92 loadParameter<long>(ar, "baseInterval", Analyzer<D>::baseInterval);
93 Manager< Analyzer<D> >::loadParameters(ar);
94 }
95
96 /*
97 * Read instructions for creating objects from file.
98 */
100 {
101 ar << Analyzer<D>::baseInterval;
102 Manager< Analyzer<D> >::save(ar);
103 }
104 #endif
105
106}
107}
108#endif
Factory for subclasses of Analyzer.
Manager for a list of Analyzer objects.
AnalyzerManager(Simulator< D > &simulator, System< D > &system)
Constructor.
void setClassName(const char *className)
Set class name string.
void sample(long iStep)
Call sample method of each Analyzer.
virtual void readParameters(std::istream &in)
Read parameter file.
void setup()
Call initialize method of each Analyzer.
void output()
Call output method of each analyzer.
Abstract base for periodic output and/or analysis actions.
Field theoretic simulator (base class).
Definition rpc/System.h:38
Main class for SCFT or PS-FTS simulation of one system.
Definition rpc/System.h:100
Loading (input) archive for binary istream.
Saving / output archive for binary ostream.
Factory template.
Template container for pointers to objects with a common base class.
Definition Manager.h:39
virtual void loadParameters(Serializable::IArchive &ar)
Load state from archive, without adding Begin and End lines.
virtual void save(OArchive &ar)=0
Save to an archive.
#define UTIL_CHECK(condition)
Assertion macro suitable for serial or parallel production code.
Definition global.h:68
PSCF package top-level namespace.
Definition param_pc.dox:1
Utility classes for scientific computation.