PSCF v1.2
rpg/fts/analyzer/AnalyzerManager.tpp
1#ifndef RPG_ANALYZER_MANAGER_TPP
2#define RPG_ANALYZER_MANAGER_TPP
3
4#include "AnalyzerManager.h"
5#include "Analyzer.h"
6#include "AnalyzerFactory.h"
7#include <util/archives/Serializable_includes.h>
8#include <rpg/System.h>
9
10namespace Pscf {
11namespace Rpg {
12
13 using namespace Util;
14
15 /*
16 * Constructor.
17 */
18 template <int D>
20 System<D>& system)
21 : Manager< Analyzer<D> >(),
22 simulatorPtr_(&simulator),
23 systemPtr_(&system)
24 { setClassName("AnalyzerManager"); }
25
26 /*
27 * Destructor.
28 */
29 template <int D>
32
33 /*
34 * Return a pointer to a new AnalyzerFactory object.
35 */
36 template <int D>
38 { return new AnalyzerFactory<D>(*simulatorPtr_, *systemPtr_); }
39
40 /*
41 * Read parameter file.
42 *
43 * \param in input parameter file stream.
44 */
45 template <int D>
47 {
49 readOptional(in,"baseInterval", Analyzer<D>::baseInterval);
50
51 Manager< Analyzer<D> >::readParameters(in);
52 }
53
54 /*
55 * Call initialize method of each analyzer.
56 */
57 template <int D>
59 {
60 for (int i = 0; i < size(); ++i) {
61 (*this)[i].setup();
62 }
63 }
64
65 /*
66 * Call sample method of each analyzer.
67 */
68 template <int D>
70 {
73 for (int i = 0; i < size(); ++i) {
74 (*this)[i].sample(iStep);
75 }
76 }
77
78 /*
79 * Call output method of each analyzer.
80 */
81 template <int D>
83 {
84 for (int i = 0; i < size(); ++i) {
85 (*this)[i].output();
86 }
87 }
88
89 #if 0
90 /*
91 * Read instructions for creating objects from file.
92 */
93 template <int D>
95 {
96 loadParameter<long>(ar, "baseInterval", Analyzer<D>::baseInterval);
97 Manager< Analyzer<D> >::loadParameters(ar);
98 }
99
100 /*
101 * Read instructions for creating objects from file.
102 */
104 {
105 ar << Analyzer<D>::baseInterval;
106 Manager< Analyzer<D> >::save(ar);
107 }
108 #endif
109
110}
111}
112#endif
Factory for subclasses of Analyzer.
Manager for a list of Analyzer objects.
virtual void readParameters(std::istream &in)
Read parameter file.
void setClassName(const char *className)
Set class name string.
AnalyzerManager(Simulator< D > &simulator, System< D > &system)
Constructor.
void output()
Call output method of each analyzer.
void sample(long iStep)
Call sample method of each Analyzer.
void setup()
Call initialize method of each Analyzer.
Abstract base for periodic output and/or analysis actions.
Field theoretic simulator (base class).
Definition rpg/System.h:41
Main class for calculations that represent one system.
Definition rpg/System.h:107
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.