1#ifndef RP_AVERAGE_ANALYZER_TPP
2#define RP_AVERAGE_ANALYZER_TPP
11#include "AverageAnalyzer.h"
12#include <rp/fts/simulator/Simulator.h>
13#include <rp/system/System.h>
15#include <util/format/Int.h>
16#include <util/format/Dbl.h>
17#include <util/misc/FileMaster.h>
18#include <util/misc/ioUtil.h>
28 template <
int D,
class T>
38 template <
int D,
class T>
45 nSamplePerOutput_ = 1;
57 template <
int D,
class T>
62 if (nSamplePerOutput_ > 0) {
72 template <
int D,
class T>
81 if (nSamplePerOutput_ > 0) {
82 if (nSamplePerOutput_ == 1) {
87 int beginStep = iStep - (nSamplePerOutput_ - 1)*
interval;
98 template <
int D,
class T>
110 template <
int D,
class T>
117 std::string fileName;
146 "----------------------------------------------------------------";
Analyzer(Simulator< D, T > &simulator, System< D, T > &system)
Constructor.
bool isAtInterval(long counter) const
Return true iff counter is a multiple of the interval.
void setFileMaster(FileMaster &fileMaster)
Set the FileMaster to use to open files.
Simulator< D, T > & simulator()
Get the parent Simulator by reference.
std::string const & outputFileName() const
Get the outputFileName string.
virtual void readParameters(std::istream &in)
Read parameters from archive.
int interval() const
Get the interval value.
System< D, T > & system()
Get the parent System by reference.
virtual void outputValue(int step, double value)
Output a sampled or block average value.
virtual void sample(long iStep)
Compute a sampled value and update the accumulator.
virtual void readParameters(std::istream &in)
Read interval, outputFileName and (optionally) nSamplePerOutput.
Average accumulator_
Average object.
AverageAnalyzer(Simulator< D, T > &simulator, System< D, T > &system)
Constructor.
virtual void output()
Write final results to file after a simulation.
std::ofstream outputFile_
Output file stream.
virtual void setup()
Setup before loop.
virtual double compute()=0
Compute value of sampled quantity.
Base class for field theoretic PS-FTS simulator.
Base class template for classes that represent a complete system.
FileMaster const & fileMaster() const
Get the FileMaster (const).
Dbl()
Default constructor.
Int()
Default constructor.
virtual void writeParam(std::ostream &out) const
Write all parameters to an output stream.
ScalarParam< Type > & readOptional(std::istream &in, const char *label, Type &value)
Add and read a new optional ScalarParam < Type > object.
#define UTIL_CHECK(condition)
Assertion macro suitable for serial or parallel production code.
Code for programs that simulate real-valued periodic fields.
PSCF package top-level namespace.