1#ifndef RPC_AVERAGE_LIST_ANALYZER_H
2#define RPC_AVERAGE_LIST_ANALYZER_H
12#include <util/accumulators/Average.h>
18 template <
int D>
class System;
75 virtual void sample(
long iStep);
103 const std::string&
name(
int i)
const;
170 double value(
int i)
const;
215 int nSamplePerOutput_;
221 bool hasAccumulators_;
232 {
return nSamplePerOutput_; }
274 return accumulators_[i];
291 {
return *systemPtr_; }
296 {
return *simulatorPtr_; }
298 #ifndef RPC_AVERAGE_LIST_ANALYZER_TPP
bool isAtInterval(long counter) const
Return true iff counter is a multiple of the interval.
void readInterval(std::istream &in)
Optionally read interval from file, with error checking.
const std::string & outputFileName() const
Return outputFileName string.
int interval() const
Get interval value.
Analyzer()
Default constructor.
Analyze averages and block averages of several real variables.
void updateAccumulators(long iStep)
Add current value to accumulator, output block average if needed.
void clearAccumulators()
Clear internal state of all accumulators.
std::ofstream outputFile_
Output file stream.
int nSamplePerOutput() const
Get value of nSamplePerOutput.
const Average & accumulator(int i) const
Get Average accumulator for a specific value.
AverageListAnalyzer(Simulator< D > &simulator, System< D > &system)
Constructor.
void initializeAccumulators(int nValue)
Instantiate Average accumulators and set nValue.
virtual void setup()
Setup before loop.
virtual void output()
Write final results to file after a simulation.
double value(int i) const
Get current value of a specific variable.
const std::string & name(int i) const
Get name associated with value.
int nValue() const
Get number of variables.
System< D > & system()
Return reference to parent system.
virtual void compute()=0
Compute value of sampled quantities.
void setName(int i, std::string name)
Set name of variable.
virtual void sample(long iStep)
Compute a sampled value and update the accumulator.
virtual ~AverageListAnalyzer()
Destructor.
void outputAccumulators()
Write results of statistical analysis to files.
void setValue(int i, double value)
Set current value, used by compute function.
Simulator< D > & simulator()
Return reference to parent Simulator.
virtual void readParameters(std::istream &in)
Read interval, outputFileName and (optionally) nSamplePerOutput.
Field theoretic simulator (base class).
Main class, representing one complete system.
Calculates the average and variance of a sampled property.
Dynamically allocatable contiguous array template.
ScalarParam< Type > & read(std::istream &in, const char *label, Type &value)
Add and read a new required ScalarParam < Type > object.
void setClassName(const char *className)
Set class name string.
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.
Real periodic fields, SCFT and PS-FTS (CPU).
PSCF package top-level namespace.