|
PSCF v1.4.0
|
Analyze averages and block averages of several real variables. More...
#include <AverageListAnalyzer.h>
Public Member Functions | |
| AverageListAnalyzer (typename T::Simulator &simulator, typename T::System &system) | |
| Constructor. | |
| void | readParameters (std::istream &in) override |
| Read interval, outputFileName and (optionally) nSamplePerOutput. | |
| void | setup () override |
| Setup before loop. | |
| void | sample (long iStep) override |
| Compute sampled values and update the accumulators. | |
| void | output () override |
| Write final results to file after a simulation. | |
| int | nSamplePerOutput () const |
| Get value of nSamplePerOutput. | |
| int | nValue () const |
| Get the number of variables. | |
| const std::string & | name (int i) const |
| Get name associated with a variable. | |
| const Average & | accumulator (int i) const |
| Get Average accumulator for a specific variable. | |
Protected Member Functions | |
| void | initializeAccumulators (int nValue) |
| Initialize Average accumulators and set nValue. | |
| void | clearAccumulators () |
| Clear internal state of all accumulators. | |
| void | setName (int i, std::string name) |
| Set name of variable. | |
| void | setValue (int i, double value) |
| Set current value, used by compute function. | |
| virtual void | compute ()=0 |
| Compute values of sampled quantities. | |
| double | value (int i) const |
| Get current value of a specific variable. | |
| void | updateAccumulators (long iStep) |
| Add current value to accumulator, output block average if needed. | |
| void | outputAccumulators () |
| Write results of statistical analysis to files. | |
Protected Attributes | |
| std::ofstream | outputFile_ |
| Output file stream. | |
Analyze averages and block averages of several real variables.
This class template evaluates averages of several sampled real variables, and optionally writes block averages to a data file during a simulation. It is intended for use as a base class for Analyzers that evaluate averages and (optionally) block averages for several physical variables.
Specializations of this template are used as base classes for two closely analogous class templates, also named AverageListAnalyzer, that are defined in the Rpc and Rpg namespaces for use in the pscf_rpc and pscf_rpg programs, respectively.
Template parameters:
Definition at line 41 of file fts/analyzer/AverageListAnalyzer.h.
| Pscf::Rp::AverageListAnalyzer< D, T >::AverageListAnalyzer | ( | typename T::Simulator & | simulator, |
| typename T::System & | system ) |
Constructor.
Definition at line 27 of file AverageListAnalyzer.tpp.
|
override |
Read interval, outputFileName and (optionally) nSamplePerOutput.
The optional variable nSamplePerOutput defaults to 0, which disables computation and output of block averages. Setting nSamplePerOutput = 1 outputs every sampled value.
| in | input parameter stream |
Definition at line 40 of file AverageListAnalyzer.tpp.
References nSamplePerOutput(), outputFile_, Util::ParamComposite::readOptional(), and UTIL_CHECK.
|
override |
Setup before loop.
Opens an output file, if nSamplePerOutput > 0.
Definition at line 59 of file AverageListAnalyzer.tpp.
References clearAccumulators(), and UTIL_CHECK.
|
override |
Compute sampled values and update the accumulators.
| iStep | simulation step index |
Definition at line 69 of file AverageListAnalyzer.tpp.
|
override |
Write final results to file after a simulation.
Definition at line 82 of file AverageListAnalyzer.tpp.
|
inline |
Get value of nSamplePerOutput.
If nSamplePerOutput == 0, output of block averages is disabled. For nSamplePerOutput > 0, the value is the number of sampled values averaged in each block.
Definition at line 207 of file fts/analyzer/AverageListAnalyzer.h.
Referenced by readParameters().
|
inline |
Get the number of variables.
Definition at line 214 of file fts/analyzer/AverageListAnalyzer.h.
References UTIL_CHECK.
Referenced by initializeAccumulators(), outputAccumulators(), and updateAccumulators().
|
inline |
Get name associated with a variable.
| i | integer index of name/value pair |
Definition at line 235 of file fts/analyzer/AverageListAnalyzer.h.
References UTIL_CHECK.
Referenced by setName().
|
inline |
Get Average accumulator for a specific variable.
| i | integer index of value |
Definition at line 246 of file fts/analyzer/AverageListAnalyzer.h.
References UTIL_CHECK.
|
protected |
Initialize Average accumulators and set nValue.
Set nValue and allocate arrays with dimensions nValue.
| nValue | number of values |
Definition at line 107 of file AverageListAnalyzer.tpp.
References nValue(), and UTIL_CHECK.
|
protected |
Clear internal state of all accumulators.
Definition at line 133 of file AverageListAnalyzer.tpp.
References UTIL_CHECK.
Referenced by setup().
|
protected |
Set name of variable.
| i | integer index of variable |
| name | name of variable number i |
Definition at line 146 of file AverageListAnalyzer.tpp.
References name(), and UTIL_CHECK.
|
inlineprotected |
Set current value, used by compute function.
| i | integer index of variable |
| value | current value of variable |
Definition at line 257 of file fts/analyzer/AverageListAnalyzer.h.
References UTIL_CHECK, and value().
|
protectedpure virtual |
Compute values of sampled quantities.
|
inlineprotected |
Get current value of a specific variable.
| i | integer index of variable |
Definition at line 224 of file fts/analyzer/AverageListAnalyzer.h.
References UTIL_CHECK.
Referenced by setValue(), and updateAccumulators().
|
protected |
Add current value to accumulator, output block average if needed.
| iStep | simulation step counter |
Definition at line 157 of file AverageListAnalyzer.tpp.
References nValue(), UTIL_CHECK, and value().
|
protected |
Write results of statistical analysis to files.
Definition at line 190 of file AverageListAnalyzer.tpp.
References nValue(), outputFile_, and UTIL_CHECK.
|
protected |
Output file stream.
Definition at line 116 of file fts/analyzer/AverageListAnalyzer.h.
Referenced by outputAccumulators(), and readParameters().