GridFire 0.6.0 General Purpose Nuclear Network

Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
gridfire::trigger::solver::CVODE::TimestepCollapseTrigger Class Referencefinal

Triggers when the timestep deviates from its recent average beyond a threshold. More...

`#include <engine_partitioning_trigger.h>`

Inheritance diagram for gridfire::trigger::solver::CVODE::TimestepCollapseTrigger:

## Public Member Functions
| TimestepCollapseTrigger (double threshold, bool relative)
| Construct with threshold and relative/absolute mode; window size defaults to 1.
| TimestepCollapseTrigger (double threshold, bool relative, size_t windowSize)
| Construct with threshold, mode, and window size.
bool | check (const gridfire::solver::CVODESolverStrategy::TimestepContext &ctx) const override
| Evaluate whether the current dt deviates sufficiently from recent average.
void | update (const gridfire::solver::CVODESolverStrategy::TimestepContext &ctx) override
| Update sliding window with the most recent dt and increment update counter.
void | reset () override
| Reset counters and clear the dt window.
std::string | name () const override
| Stable human-readable name.
TriggerResult | why (const gridfire::solver::CVODESolverStrategy::TimestepContext &ctx) const override
| Structured explanation of the evaluation outcome.
std::string | describe () const override
| Textual description including threshold, mode, and window size.
size_t | numTriggers () const override
| Number of true evaluations since last reset.
size_t | numMisses () const override
| Number of false evaluations since last reset.
Public Member Functions inherited from gridfire::trigger::Trigger< gridfire::solver::CVODESolverStrategy::TimestepContext >
virtual | ~Trigger ()=default
| Virtual destructor for polymorphic use.

## Private Attributes
quill::Logger * | m_logger = fourdst::logging::LogManager::getInstance().getLogger("log")
| Logger used for trace/error diagnostics.
double | m_threshold
| Threshold for absolute or relative deviation.
bool | m_relative
| When true, use relative deviation; otherwise absolute deviation.
size_t | m_windowSize
| Number of dt samples to maintain in the moving window.
std::deque< double > | m_timestep_window
| Sliding window of recent timesteps (most recent at back).
Diagnostics counters
size_t | m_hits = 0
size_t | m_misses = 0
size_t | m_updates = 0
size_t | m_resets = 0

## Detailed Description

Triggers when the timestep deviates from its recent average beyond a threshold.

- Maintains a sliding window of recent dt values (size = windowSize).
- check(ctx):
  - If the window is empty, returns false.
  - Computes the arithmetic mean of values in the window and compares either:
    - relative: |dt - mean| / mean >= threshold
    - absolute: |dt - mean| >= threshold
- update(ctx): pushes ctx.dt into the fixed-size window (dropping oldest when full).

Constraints/Errors:
  - threshold must be >= 0.
  - If relative==true, threshold must be in [0, 1]. Violations throw std::invalid_argument.

Note
  - With windowSize==1, the mean is the most recent prior dt.
  - Counter fields are mutable to allow updates during const check().

See also: engine_partitioning_trigger.cpp for exact logic and logging.

## Constructor & Destructor Documentation

## ◆ TimestepCollapseTrigger() [1/2]

gridfire::trigger::solver::CVODE::TimestepCollapseTrigger::TimestepCollapseTrigger | ( | double | threshold,
|  | bool | relative )
| explicit

Construct with threshold and relative/absolute mode; window size defaults to 1.

Parameters

  threshold | Non-negative threshold; if relative, must be in [0, 1].
  relative | If true, use relative deviation; otherwise use absolute deviation.

Exceptions

  std::invalid_argument | on invalid threshold constraints.

## ◆ TimestepCollapseTrigger() [2/2]

gridfire::trigger::solver::CVODE::TimestepCollapseTrigger::TimestepCollapseTrigger | ( | double | threshold,
|  | bool | relative,
|  | size_t | windowSize )
| explicit

Construct with threshold, mode, and window size.

Parameters

  threshold | Non-negative threshold; if relative, must be in [0, 1].
  relative | If true, use relative deviation; otherwise use absolute deviation.
  windowSize | Number of dt samples to average over (>= 1 recommended).

Exceptions

  std::invalid_argument | on invalid threshold constraints.

## Member Function Documentation

## ◆ check()

bool gridfire::trigger::solver::CVODE::TimestepCollapseTrigger::check | ( | const gridfire::solver::CVODESolverStrategy::TimestepContext & | ctx | ) | const
| override virtual

Evaluate whether the current dt deviates sufficiently from recent average.

Parameters

  ctx | CVODE timestep context providing current dt.

Returns
  true if deviation exceeds the configured threshold; false otherwise.

Postcondition
  increments hit/miss counters and may emit trace logs.

Implements gridfire::trigger::Trigger< gridfire::solver::CVODESolverStrategy::TimestepContext >.

## ◆ describe()

std::string gridfire::trigger::solver::CVODE::TimestepCollapseTrigger::describe | ( |  | ) | const
| override virtual

Textual description including threshold, mode, and window size.

Implements gridfire::trigger::Trigger< gridfire::solver::CVODESolverStrategy::TimestepContext >.

## ◆ name()

std::string gridfire::trigger::solver::CVODE::TimestepCollapseTrigger::name | ( |  | ) | const
| override virtual

Stable human-readable name.

Implements gridfire::trigger::Trigger< gridfire::solver::CVODESolverStrategy::TimestepContext >.

## ◆ numMisses()

size_t gridfire::trigger::solver::CVODE::TimestepCollapseTrigger::numMisses | ( |  | ) | const
| override virtual

Number of false evaluations since last reset.

Implements gridfire::trigger::Trigger< gridfire::solver::CVODESolverStrategy::TimestepContext >.

## ◆ numTriggers()

size_t gridfire::trigger::solver::CVODE::TimestepCollapseTrigger::numTriggers | ( |  | ) | const
| override virtual

Number of true evaluations since last reset.

Implements gridfire::trigger::Trigger< gridfire::solver::CVODESolverStrategy::TimestepContext >.

## ◆ reset()

void gridfire::trigger::solver::CVODE::TimestepCollapseTrigger::reset | ( |  | ) |
| override virtual

Reset counters and clear the dt window.

Implements gridfire::trigger::Trigger< gridfire::solver::CVODESolverStrategy::TimestepContext >.

## ◆ update()

void gridfire::trigger::solver::CVODE::TimestepCollapseTrigger::update | ( | const gridfire::solver::CVODESolverStrategy::TimestepContext & | ctx | ) |
| override virtual

Update sliding window with the most recent dt and increment update counter.

Parameters

  ctx | CVODE timestep context.

Implements gridfire::trigger::Trigger< gridfire::solver::CVODESolverStrategy::TimestepContext >.

## ◆ why()

TriggerResult gridfire::trigger::solver::CVODE::TimestepCollapseTrigger::why | ( | const gridfire::solver::CVODESolverStrategy::TimestepContext & | ctx | ) | const
| override virtual

Structured explanation of the evaluation outcome.

Implements gridfire::trigger::Trigger< gridfire::solver::CVODESolverStrategy::TimestepContext >.

## Member Data Documentation

## ◆ m_hits

size_t gridfire::trigger::solver::CVODE::TimestepCollapseTrigger::m_hits = 0
| mutable private

## ◆ m_logger

quill::Logger* gridfire::trigger::solver::CVODE::TimestepCollapseTrigger::m_logger = fourdst::logging::LogManager::getInstance().getLogger("log")
| private

Logger used for trace/error diagnostics.

## ◆ m_misses

size_t gridfire::trigger::solver::CVODE::TimestepCollapseTrigger::m_misses = 0
| mutable private

## ◆ m_relative

bool gridfire::trigger::solver::CVODE::TimestepCollapseTrigger::m_relative
| private

When true, use relative deviation; otherwise absolute deviation.

## ◆ m_resets

size_t gridfire::trigger::solver::CVODE::TimestepCollapseTrigger::m_resets = 0
| mutable private

## ◆ m_threshold

double gridfire::trigger::solver::CVODE::TimestepCollapseTrigger::m_threshold
| private

Threshold for absolute or relative deviation.

## ◆ m_timestep_window

std::deque<double> gridfire::trigger::solver::CVODE::TimestepCollapseTrigger::m_timestep_window
| private

Sliding window of recent timesteps (most recent at back).

## ◆ m_updates

size_t gridfire::trigger::solver::CVODE::TimestepCollapseTrigger::m_updates = 0
| mutable private

## ◆ m_windowSize

size_t gridfire::trigger::solver::CVODE::TimestepCollapseTrigger::m_windowSize
| private

Number of dt samples to maintain in the moving window.

The documentation for this class was generated from the following files:

- src/include/gridfire/solver/strategies/triggers/engine_partitioning_trigger.h
- src/lib/solver/strategies/triggers/engine_partitioning_trigger.cpp