Loading...
Searching...
No Matches
gridfire::trigger::Trigger< TriggerContextStruct > Class Template Referenceabstract

Generic trigger interface for signaling events/conditions during integration. More...

`#include <trigger_abstract.h>`

Inheritance diagram for gridfire::trigger::Trigger< TriggerContextStruct >:
[legend]

## Public Member Functions

virtual | ~Trigger ()=default
| Virtual destructor for polymorphic use.
virtual bool | check (const TriggerContextStruct &ctx) const =0
| Evaluate the trigger condition against the provided context.
virtual void | update (const TriggerContextStruct &ctx)=0
| Update any internal state with the given context (e.g., counters, windows).
virtual void | step (const TriggerContextStruct &ctx)=0
| similar to update but intended to be run on every step not just those where the trigger triggered
virtual void | reset ()=0
| Reset internal state and diagnostics counters.
virtual std::string | name () const =0
| Short, stable name for this trigger (suitable for logs/UI).
virtual std::string | describe () const =0
| Human-readable description of this trigger's logic.
virtual TriggerResult | why (const TriggerContextStruct &ctx) const =0
| Explain why the last evaluation would be true/false in a structured way.
virtual size_t | numTriggers () const =0
| Total number of times this trigger evaluated to true since last reset.
virtual size_t | numMisses () const =0
| Total number of times this trigger evaluated to false since last reset.

## Detailed Description

template<typename TriggerContextStruct>
class gridfire::trigger::Trigger< TriggerContextStruct >

Generic trigger interface for signaling events/conditions during integration.

A Trigger encapsulates a condition evaluated against a user-defined context struct (TriggerContextStruct). The interface supports:

- check(): evaluate the current condition without mutating external state
- update(): feed the context to update internal state (counters, sliding windows, etc.)
- reset(): clear internal state and counters
- name()/describe(): human-readable identification and textual description
- why(): structured explanation (tree of TriggerResult) of the last evaluation
- numTriggers()/numMisses(): simple counters for diagnostics

Logical compositions (AND/OR/NOT/EveryNth) are provided in trigger_logical.h and implement this interface for any TriggerContextStruct.

Template Parameters

  TriggerContextStruct | User-defined context passed to triggers (e.g., timestep info).

## Constructor & Destructor Documentation

## ~Trigger()

template<typename TriggerContextStruct>

virtual gridfire::trigger::Trigger< TriggerContextStruct >::~Trigger | ( |  | ) |

virtualdefault

Virtual destructor for polymorphic use.

## Member Function Documentation

## check()

template<typename TriggerContextStruct>

virtual bool gridfire::trigger::Trigger< TriggerContextStruct >::check | ( | const TriggerContextStruct & | ctx | ) | const

pure virtual

Evaluate the trigger condition against the provided context.

Parameters

  ctx | Context snapshot (immutable view) used to evaluate the condition.

Returns
  true if the condition is satisfied; false otherwise.

Implemented in gridfire::trigger::AndTrigger< TriggerContextStruct >, gridfire::trigger::EveryNthTrigger< TriggerContextStruct >, gridfire::trigger::NotTrigger< TriggerContextStruct >, gridfire::trigger::OrTrigger< TriggerContextStruct >, gridfire::trigger::solver::CVODE::ConvergenceFailureTrigger, gridfire::trigger::solver::CVODE::OffDiagonalTrigger, gridfire::trigger::solver::CVODE::SimulationTimeTrigger, and gridfire::trigger::solver::CVODE::TimestepCollapseTrigger.

## describe()

template<typename TriggerContextStruct>

virtual std::string gridfire::trigger::Trigger< TriggerContextStruct >::describe | ( |  | ) | const

nodiscardpure virtual

Human-readable description of this trigger's logic.

Implemented in gridfire::trigger::AndTrigger< TriggerContextStruct >, gridfire::trigger::EveryNthTrigger< TriggerContextStruct >, gridfire::trigger::NotTrigger< TriggerContextStruct >, gridfire::trigger::OrTrigger< TriggerContextStruct >, gridfire::trigger::solver::CVODE::ConvergenceFailureTrigger, gridfire::trigger::solver::CVODE::OffDiagonalTrigger, gridfire::trigger::solver::CVODE::SimulationTimeTrigger, and gridfire::trigger::solver::CVODE::TimestepCollapseTrigger.

## name()

template<typename TriggerContextStruct>

virtual std::string gridfire::trigger::Trigger< TriggerContextStruct >::name | ( |  | ) | const

nodiscardpure virtual

Short, stable name for this trigger (suitable for logs/UI).

Implemented in gridfire::trigger::AndTrigger< TriggerContextStruct >, gridfire::trigger::EveryNthTrigger< TriggerContextStruct >, gridfire::trigger::NotTrigger< TriggerContextStruct >, gridfire::trigger::OrTrigger< TriggerContextStruct >, gridfire::trigger::solver::CVODE::ConvergenceFailureTrigger, gridfire::trigger::solver::CVODE::OffDiagonalTrigger, gridfire::trigger::solver::CVODE::SimulationTimeTrigger, and gridfire::trigger::solver::CVODE::TimestepCollapseTrigger.

## numMisses()

template<typename TriggerContextStruct>

virtual size_t gridfire::trigger::Trigger< TriggerContextStruct >::numMisses | ( |  | ) | const

nodiscardpure virtual

Total number of times this trigger evaluated to false since last reset.

Implemented in gridfire::trigger::AndTrigger< TriggerContextStruct >, gridfire::trigger::EveryNthTrigger< TriggerContextStruct >, gridfire::trigger::NotTrigger< TriggerContextStruct >, gridfire::trigger::OrTrigger< TriggerContextStruct >, gridfire::trigger::solver::CVODE::ConvergenceFailureTrigger, gridfire::trigger::solver::CVODE::OffDiagonalTrigger, gridfire::trigger::solver::CVODE::SimulationTimeTrigger, and gridfire::trigger::solver::CVODE::TimestepCollapseTrigger.

## numTriggers()

template<typename TriggerContextStruct>

virtual size_t gridfire::trigger::Trigger< TriggerContextStruct >::numTriggers | ( |  | ) | const

nodiscardpure virtual

Total number of times this trigger evaluated to true since last reset.

Implemented in gridfire::trigger::AndTrigger< TriggerContextStruct >, gridfire::trigger::EveryNthTrigger< TriggerContextStruct >, gridfire::trigger::NotTrigger< TriggerContextStruct >, gridfire::trigger::OrTrigger< TriggerContextStruct >, gridfire::trigger::solver::CVODE::ConvergenceFailureTrigger, gridfire::trigger::solver::CVODE::OffDiagonalTrigger, gridfire::trigger::solver::CVODE::SimulationTimeTrigger, and gridfire::trigger::solver::CVODE::TimestepCollapseTrigger.

## reset()

template<typename TriggerContextStruct>

virtual void gridfire::trigger::Trigger< TriggerContextStruct >::reset | ( |  | ) |

pure virtual

Reset internal state and diagnostics counters.

Implemented in gridfire::trigger::AndTrigger< TriggerContextStruct >, gridfire::trigger::EveryNthTrigger< TriggerContextStruct >, gridfire::trigger::NotTrigger< TriggerContextStruct >, gridfire::trigger::OrTrigger< TriggerContextStruct >, gridfire::trigger::solver::CVODE::ConvergenceFailureTrigger, gridfire::trigger::solver::CVODE::OffDiagonalTrigger, gridfire::trigger::solver::CVODE::SimulationTimeTrigger, and gridfire::trigger::solver::CVODE::TimestepCollapseTrigger.

## step()

template<typename TriggerContextStruct>

virtual void gridfire::trigger::Trigger< TriggerContextStruct >::step | ( | const TriggerContextStruct & | ctx | ) |

pure virtual

similar to update but intended to be run on every step not just those where the trigger triggered

Parameters

  ctx | Context snapshot used to update state.

Implemented in gridfire::trigger::AndTrigger< TriggerContextStruct >, gridfire::trigger::EveryNthTrigger< TriggerContextStruct >, gridfire::trigger::NotTrigger< TriggerContextStruct >, gridfire::trigger::OrTrigger< TriggerContextStruct >, gridfire::trigger::solver::CVODE::ConvergenceFailureTrigger, gridfire::trigger::solver::CVODE::OffDiagonalTrigger, gridfire::trigger::solver::CVODE::SimulationTimeTrigger, and gridfire::trigger::solver::CVODE::TimestepCollapseTrigger.

## update()

template<typename TriggerContextStruct>

virtual void gridfire::trigger::Trigger< TriggerContextStruct >::update | ( | const TriggerContextStruct & | ctx | ) |

pure virtual

Update any internal state with the given context (e.g., counters, windows).

Parameters

  ctx | Context snapshot used to update state.

Implemented in gridfire::trigger::AndTrigger< TriggerContextStruct >, gridfire::trigger::EveryNthTrigger< TriggerContextStruct >, gridfire::trigger::NotTrigger< TriggerContextStruct >, gridfire::trigger::OrTrigger< TriggerContextStruct >, gridfire::trigger::solver::CVODE::ConvergenceFailureTrigger, gridfire::trigger::solver::CVODE::OffDiagonalTrigger, gridfire::trigger::solver::CVODE::SimulationTimeTrigger, and gridfire::trigger::solver::CVODE::TimestepCollapseTrigger.

## why()

template<typename TriggerContextStruct>

virtual TriggerResult gridfire::trigger::Trigger< TriggerContextStruct >::why | ( | const TriggerContextStruct & | ctx | ) | const

nodiscardpure virtual

Explain why the last evaluation would be true/false in a structured way.

Parameters

  ctx | Context snapshot for the explanation.

Returns
  A TriggerResult tree with a boolean value and per-cause details.

Implemented in gridfire::trigger::AndTrigger< TriggerContextStruct >, gridfire::trigger::EveryNthTrigger< TriggerContextStruct >, gridfire::trigger::NotTrigger< TriggerContextStruct >, gridfire::trigger::OrTrigger< TriggerContextStruct >, gridfire::trigger::solver::CVODE::ConvergenceFailureTrigger, gridfire::trigger::solver::CVODE::OffDiagonalTrigger, gridfire::trigger::solver::CVODE::SimulationTimeTrigger, and gridfire::trigger::solver::CVODE::TimestepCollapseTrigger.

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

- src/include/gridfire/trigger/trigger_abstract.h