|
PSCF v1.4.0
|
Analyze averages and block averages of a single real variable. More...
#include <AverageAnalyzer.h>
Public Member Functions | |
| virtual void | readParameters (std::istream &in) |
| Read interval, outputFileName and (optionally) nSamplePerOutput. | |
| virtual void | setup () |
| Setup before loop. | |
| virtual void | sample (long iStep) |
| Compute a sampled value and update the accumulator. | |
| virtual void | output () |
| Write final results to file after a simulation. | |
| int | nSamplePerOutput () const |
| Get value of nSamplePerOutput. | |
Protected Member Functions | |
| AverageAnalyzer (typename T::Simulator &simulator, typename T::System &system) | |
| Constructor. | |
| ~AverageAnalyzer ()=default | |
| Destructor. | |
| virtual double | compute ()=0 |
| Compute value of sampled quantity. | |
| virtual void | outputValue (int step, double value) |
| Output a sampled or block average value. | |
Protected Attributes | |
| std::ofstream | outputFile_ |
| Output file stream. | |
| Average | accumulator_ |
| Average object. | |
Analyze averages and block averages of a single real variable.
This class evaluates the average of a single sampled real variables, and optionally writes values or block averages to a data file during a simulation. It is intended for use as a base class for any Analyzer that computes and evaluates an average for a single physical variable.
Specializations of this template are used as base classes for two closely analogous class templates, also named AverageAnalyzer, that are defined in the Rpc and Rpg namespaces for use in the pscf_rpc and pscf_rpg programs.
Template parameters:
Definition at line 40 of file fts/analyzer/AverageAnalyzer.h.
|
protected |
Constructor.
Definition at line 27 of file AverageAnalyzer.tpp.
|
protecteddefault |
Destructor.
|
virtual |
Read interval, outputFileName and (optionally) nSamplePerOutput.
The optional variable nSamplePerOutput defaults to 1, which causes every sampled value to be written to file. Setting nSamplePerOutput = 0 suppresses output of block averages to file.
| in | input parameter file |
Definition at line 37 of file AverageAnalyzer.tpp.
References accumulator_, outputFile_, and Util::ParamComposite::readOptional().
|
virtual |
Setup before loop.
Opens an output file, if nSamplePerOutput > 0.
Definition at line 60 of file AverageAnalyzer.tpp.
References accumulator_.
|
virtual |
Compute a sampled value and update the accumulator.
| iStep | MD time step index |
Definition at line 67 of file AverageAnalyzer.tpp.
|
virtual |
Write final results to file after a simulation.
Write an average value. If the simulation does not have a ramp, it also writes an estimate of the error on the average and information estimates from hierarchichal block averages about how that estimate was obtained. Information about error analysis is suppressed when a ramp exists.
Definition at line 105 of file AverageAnalyzer.tpp.
References outputFile_.
|
inline |
Get value of nSamplePerOutput.
If nSamplePerOutput == 0, output of block averages is disabled. For nSamplePerOutput > 0, nSamplePerOutput is the number of sampled values averaged in each block average.
Definition at line 143 of file fts/analyzer/AverageAnalyzer.h.
|
protectedpure virtual |
Compute value of sampled quantity.
|
protectedvirtual |
Output a sampled or block average value.
| step | value for step counter |
| value | value of physical observable |
Definition at line 93 of file AverageAnalyzer.tpp.
References outputFile_, and UTIL_CHECK.
|
protected |
Output file stream.
Definition at line 96 of file fts/analyzer/AverageAnalyzer.h.
Referenced by output(), outputValue(), and readParameters().
|
protected |
Average object.
Definition at line 99 of file fts/analyzer/AverageAnalyzer.h.
Referenced by readParameters(), and setup().