1#ifndef RP_AVERAGE_LIST_ANALYZER_H
2#define RP_AVERAGE_LIST_ANALYZER_H
11#include <rp/fts/analyzer/Analyzer.h>
12#include <util/accumulators/Average.h>
13#include <util/containers/DArray.h>
15#include <pscf/backend/TmplDeclare.h>
39 template <
int D,
class T>
70 void setup()
override;
77 void sample(
long iStep)
override;
103 const std::string&
name(
int i)
const;
160 double value(
int i)
const;
190 int nSamplePerOutput_;
196 bool hasAccumulators_;
205 template <
int D,
class T>
inline
207 {
return nSamplePerOutput_; }
212 template <
int D,
class T>
inline
222 template <
int D,
class T>
inline
233 template <
int D,
class T>
inline
244 template <
int D,
class T>
inline
249 return accumulators_[i];
255 template <
int D,
class T>
inline
Analyzer(Simulator< D, T > &simulator, System< D, T > &system)
Constructor.
Simulator< D, T > & simulator()
Get the parent Simulator by reference.
System< D, T > & system()
Get the parent System by reference.
Analyze averages and block averages of several real variables.
const std::string & name(int i) const
Get name associated with a variable.
void setup() override
Setup before loop.
void outputAccumulators()
Write results of statistical analysis to files.
void sample(long iStep) override
Compute sampled values and update the accumulators.
double value(int i) const
Get current value of a specific variable.
void initializeAccumulators(int nValue)
Initialize Average accumulators and set nValue.
Simulator< D, T > & simulator()
Get the parent Simulator by reference.
void output() override
Write final results to file after a simulation.
AverageListAnalyzer(Simulator< D, T > &simulator, System< D, T > &system)
Constructor.
std::ofstream outputFile_
Output file stream.
void clearAccumulators()
Clear internal state of all accumulators.
void setName(int i, std::string name)
Set name of variable.
const Average & accumulator(int i) const
Get Average accumulator for a specific variable.
int nValue() const
Get the number of variables.
void updateAccumulators(long iStep)
Add current value to accumulator, output block average if needed.
int nSamplePerOutput() const
Get value of nSamplePerOutput.
virtual void compute()=0
Compute values of sampled quantities.
System< D, T > & system()
Get the parent System by reference.
void readParameters(std::istream &in) override
Read interval, outputFileName and (optionally) nSamplePerOutput.
void setValue(int i, double value)
Set current value, used by compute function.
Base class for field theoretic PS-FTS simulator.
Base class template for classes that represent a complete system.
Calculates the average and variance of a sampled property.
Dynamically allocatable contiguous array template.
File containing preprocessor macros for error handling.
#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.