|
ERF
Energy Research and Forecasting: An Atmospheric Modeling Code
|
#include <ERF_RunningStats.H>

Public Member Functions | |
| RunningStats (std::string name, std::string output_root, std::vector< std::string > quantities) | |
| const std::string & | name () const |
| const std::vector< std::string > & | quantities () const |
| void | renamed_from (const std::string &old_name, const std::string &now, bool same) |
| int | num_samples () const |
| double | t_first () const |
| double | t_last () const |
| void | accumulate (double t, const std::vector< amrex::Real > &values) |
| amrex::Real | mean (std::size_t i) const |
| amrex::Real | rms (std::size_t i) const |
| amrex::Real | min (std::size_t i) const |
| amrex::Real | max (std::size_t i) const |
| void | write () const |
| void | write_state (const std::string &dir) const |
| bool | read_state (const std::string &dir) |
Private Attributes | |
| std::string | m_name |
| std::string | m_output_root |
| std::vector< std::string > | m_names |
| std::vector< double > | m_sum |
| std::vector< double > | m_sum2 |
| in double: a float sum over many steps would lose the samples More... | |
| std::vector< amrex::Real > | m_min |
| std::vector< amrex::Real > | m_max |
| int | m_count {0} |
| double | m_t_first {0.0} |
| double | m_t_last {0.0} |
| std::map< std::string, std::pair< std::string, bool > > | m_renamed |
| old name -> (name now, same quantity) More... | |
One set of running statistics: the mean, the root mean square, the minimum and the maximum of each named scalar quantity over every sample added since the caller's averaging start. write() rewrites <output_root>_stats.csv with the current values; the sums are part of the checkpoint, so the statistics continue across a restart. A non-finite sample aborts, naming the statistics and the quantity.
|
inline |
|
inline |
Add one sample of every quantity, taken at time t (s).

|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Restore the state written by write_state(); false when there is none. Aborts, changing nothing, when the file is malformed: a negative count, t_last before t_first, a non-finite value, or quantities other than this object's (but those accepted by renamed_from).

|
inline |
Accept a checkpoint listing quantity old_name where now stands: an earlier name of the same quantity (same true: its statistics continue), or of another quantity (same false: the statistics start afresh at the restart, and say so).
|
inline |
|
inline |
|
inline |
|
inline |
Rewrite <output_root>_stats.csv: one row per quantity with the current statistics.

|
inline |
|
private |
Referenced by accumulate(), max(), mean(), min(), num_samples(), read_state(), rms(), write(), and write_state().
|
private |
Referenced by accumulate(), max(), read_state(), and write_state().
|
private |
Referenced by accumulate(), min(), read_state(), and write_state().
|
private |
Referenced by accumulate(), name(), read_state(), and write_state().
|
private |
Referenced by accumulate(), quantities(), read_state(), write(), and write_state().
|
private |
Referenced by write().
|
private |
old name -> (name now, same quantity)
Referenced by read_state(), and renamed_from().
|
private |
Referenced by accumulate(), mean(), read_state(), and write_state().
|
private |
in double: a float sum over many steps would lose the samples
Referenced by accumulate(), read_state(), rms(), and write_state().
|
private |
Referenced by accumulate(), read_state(), t_first(), write(), and write_state().
|
private |
Referenced by accumulate(), read_state(), t_last(), write(), and write_state().