![]() |
OGS
|
|
Statistics for clamping negative input concentrations to zero before speciation. PHREEQC rejects negative concentrations, so every negative value is clamped to zero unconditionally; the warning threshold (a negative value, see ChemistryLib parameter concentration_warning_threshold) only decides whether a clamp is reported. Values in \([\text{warning\_threshold}, 0)\) are treated as floating-point noise and clamped silently; values \(<\text{warning\_threshold}\) are clamped and counted as "severe" so an aggregated warning can be emitted.
The same type is used both as a per-cell leaf (built by clamp()) and as a run-level accumulator (folded by operator+=). It is an aggregate (no user-declared constructor, no private data) so brace-init and = {} reset work.
Definition at line 26 of file ClampingStats.h.
#include <ClampingStats.h>
Public Member Functions | |
| double | clamp (double c, double warning_threshold, std::string_view name) |
| ClampingStats & | operator+= (ClampingStats const &other) |
| Folds another stats object into this accumulator (identity = {}). | |
| void | report (double warning_threshold) const |
| WARN for severe clamps, DBUG for silent noise clamps. No-op when empty. | |
Public Attributes | |
| std::string_view | worst_component_name |
| aliases Component::name | |
| std::size_t | n_cells = 0 |
| cells with any clamping | |
| std::size_t | n_values = 0 |
| total values clamped | |
| std::size_t | n_severe_cells = 0 |
| cells with a severe clamp | |
| std::size_t | n_severe_values = 0 |
| total severe values clamped | |
| double | total_clamped_amount = 0.0 |
| double | worst_negative_value = 0.0 |
| double ChemistryLib::PhreeqcIOData::ClampingStats::clamp | ( | double | c, |
| double | warning_threshold, | ||
| std::string_view | name ) |
Clamps one concentration: negative values are returned as 0 and the value-level counters are updated; non-negative input is returned unchanged. A value below warning_threshold (which is negative) is recorded as severe and may update the worst value/name. The cell-level counters (n_cells / n_severe_cells) are set by the caller after the per-component loop.
Definition at line 12 of file ClampingStats.cpp.
References n_severe_values, n_values, total_clamped_amount, worst_component_name, and worst_negative_value.
Referenced by ChemistryLib::PhreeqcIOData::setAqueousSolution().
| ClampingStats & ChemistryLib::PhreeqcIOData::ClampingStats::operator+= | ( | ClampingStats const & | other | ) |
Folds another stats object into this accumulator (identity = {}).
Definition at line 33 of file ClampingStats.cpp.
References n_cells, n_severe_cells, n_severe_values, n_values, total_clamped_amount, worst_component_name, and worst_negative_value.
| void ChemistryLib::PhreeqcIOData::ClampingStats::report | ( | double | warning_threshold | ) | const |
WARN for severe clamps, DBUG for silent noise clamps. No-op when empty.
Definition at line 48 of file ClampingStats.cpp.
References DBUG(), n_cells, n_severe_cells, n_severe_values, n_values, total_clamped_amount, WARN(), worst_component_name, and worst_negative_value.
| std::size_t ChemistryLib::PhreeqcIOData::ClampingStats::n_cells = 0 |
cells with any clamping
Definition at line 29 of file ClampingStats.h.
Referenced by operator+=(), report(), and ChemistryLib::PhreeqcIOData::setAqueousSolution().
| std::size_t ChemistryLib::PhreeqcIOData::ClampingStats::n_severe_cells = 0 |
cells with a severe clamp
Definition at line 31 of file ClampingStats.h.
Referenced by operator+=(), report(), and ChemistryLib::PhreeqcIOData::setAqueousSolution().
| std::size_t ChemistryLib::PhreeqcIOData::ClampingStats::n_severe_values = 0 |
total severe values clamped
Definition at line 32 of file ClampingStats.h.
Referenced by clamp(), operator+=(), report(), and ChemistryLib::PhreeqcIOData::setAqueousSolution().
| std::size_t ChemistryLib::PhreeqcIOData::ClampingStats::n_values = 0 |
total values clamped
Definition at line 30 of file ClampingStats.h.
Referenced by clamp(), operator+=(), report(), and ChemistryLib::PhreeqcIOData::setAqueousSolution().
| double ChemistryLib::PhreeqcIOData::ClampingStats::total_clamped_amount = 0.0 |
Definition at line 33 of file ClampingStats.h.
Referenced by clamp(), operator+=(), and report().
| std::string_view ChemistryLib::PhreeqcIOData::ClampingStats::worst_component_name |
aliases Component::name
Definition at line 28 of file ClampingStats.h.
Referenced by clamp(), operator+=(), and report().
| double ChemistryLib::PhreeqcIOData::ClampingStats::worst_negative_value = 0.0 |
Definition at line 34 of file ClampingStats.h.
Referenced by clamp(), operator+=(), and report().