1#ifndef RP_AVERAGE_LIST_ANALYZER_H
2#define RP_AVERAGE_LIST_ANALYZER_H
11#include <util/accumulators/Average.h>
40 template <
int D,
class T>
53 typename T::System& system);
71 void setup()
override;
78 void sample(
long iStep)
override;
104 const std::string&
name(
int i)
const;
175 using AnalyzerT =
typename T::Analyzer;
176 using AnalyzerT::simulator;
177 using AnalyzerT::system;
191 int nSamplePerOutput_;
197 bool hasAccumulators_;
206 template <
int D,
class T>
inline
208 {
return nSamplePerOutput_; }
213 template <
int D,
class T>
inline
223 template <
int D,
class T>
inline
234 template <
int D,
class T>
inline
245 template <
int D,
class T>
inline
250 return accumulators_[i];
256 template <
int D,
class T>
inline
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
void initializeAccumulators(int nValue)
Initialize Average accumulators and set nValue.
void output() override
Write final results to file after a simulation.
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.
AverageListAnalyzer(typename T::Simulator &simulator, typename T::System &system)
Constructor.
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.
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.
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.
Class templates for real-valued periodic fields.
PSCF package top-level namespace.