GridFire 0.6.0
General Purpose Nuclear Network
Loading...
Searching...
No Matches
gridfire::solver::NetworkSolverStrategy< EngineT > Class Template Referenceabstract

Abstract base class for network solver strategies. More...

#include <solver.h>

Public Member Functions

 NetworkSolverStrategy (EngineT &engine)
 Constructor for the NetworkSolverStrategy.
 
virtual ~NetworkSolverStrategy ()=default
 Virtual destructor.
 
virtual NetOut evaluate (const NetIn &netIn)=0
 Evaluates the network for a given timestep.
 
virtual void set_callback (const std::any &callback)=0
 set the callback function to be called at the end of each timestep.
 
virtual std::vector< std::tuple< std::string, std::string > > describe_callback_context () const =0
 Describe the context that will be passed to the callback function.
 

Protected Attributes

EngineT & m_engine
 The engine used by this solver strategy.
 

Detailed Description

template<typename EngineT>
class gridfire::solver::NetworkSolverStrategy< EngineT >

Abstract base class for network solver strategies.

This class defines the interface for network solver strategies, which are responsible for integrating the reaction network ODEs over a given timestep. It is templated on the engine type to allow for different engine implementations to be used with the same solver.

Template Parameters
EngineTThe type of engine to use with this solver strategy. Must inherit from Engine.

Constructor & Destructor Documentation

◆ NetworkSolverStrategy()

template<typename EngineT>
gridfire::solver::NetworkSolverStrategy< EngineT >::NetworkSolverStrategy ( EngineT & engine)
inlineexplicit

Constructor for the NetworkSolverStrategy.

Parameters
engineThe engine to use for evaluating the network.

◆ ~NetworkSolverStrategy()

template<typename EngineT>
virtual gridfire::solver::NetworkSolverStrategy< EngineT >::~NetworkSolverStrategy ( )
virtualdefault

Virtual destructor.

Member Function Documentation

◆ describe_callback_context()

template<typename EngineT>
virtual std::vector< std::tuple< std::string, std::string > > gridfire::solver::NetworkSolverStrategy< EngineT >::describe_callback_context ( ) const
pure virtual

Describe the context that will be passed to the callback function.

Returns
A vector of tuples, each containing a string for the parameter's name and a string for its type.

This method should be overridden by derived classes to provide a description of the context that will be passed to the callback function. The intent of this method is that an end user can investigate the context that will be passed to the callback function, and use this information to craft their own callback function.

Implemented in gridfire::solver::DirectNetworkSolver, and PyDynamicNetworkSolverStrategy.

◆ evaluate()

template<typename EngineT>
virtual NetOut gridfire::solver::NetworkSolverStrategy< EngineT >::evaluate ( const NetIn & netIn)
pure virtual

Evaluates the network for a given timestep.

Parameters
netInThe input conditions for the network.
Returns
The output conditions after the timestep.

Implemented in gridfire::solver::DirectNetworkSolver, and PyDynamicNetworkSolverStrategy.

◆ set_callback()

template<typename EngineT>
virtual void gridfire::solver::NetworkSolverStrategy< EngineT >::set_callback ( const std::any & callback)
pure virtual

set the callback function to be called at the end of each timestep.

This function allows the user to set a callback function that will be called at the end of each timestep. The callback function will receive a gridfire::solver::<SOMESOLVER>::TimestepContext object. Note that depending on the solver, this context may contain different information. Further, the exact signature of the callback function is left up to each solver. Every solver should provide a type or type alias TimestepCallback that defines the signature of the callback function so that the user can easily get that type information.

Parameters
callbackThe callback function to be called at the end of each timestep.

Implemented in gridfire::solver::DirectNetworkSolver, and PyDynamicNetworkSolverStrategy.

Member Data Documentation

◆ m_engine

template<typename EngineT>
EngineT& gridfire::solver::NetworkSolverStrategy< EngineT >::m_engine
protected

The engine used by this solver strategy.


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