12#ifndef RESPOND_MODEL_HPP_
13#define RESPOND_MODEL_HPP_
21#include <respond/constants.hpp>
22#include <respond/history.hpp>
23#include <respond/timestep.hpp>
47 static std::unique_ptr<Model>
49 const std::string &log_name = RESPOND_DEFAULT_LOG,
50 const std::string &log_filepath = RESPOND_DEFAULT_LOG_FILE);
63 virtual std::unique_ptr<Model>
clone()
const = 0;
111 virtual const Eigen::Ref<const Eigen::VectorXd>
GetState()
const = 0;
122 virtual const std::map<std::string, History> &
GetHistories()
const = 0;
146 virtual void SetState(
const Eigen::Ref<const Eigen::VectorXd> &state) = 0;
184inline std::ostream &operator<<(std::ostream &os,
const Model &model) {
Abstract base class representing a state transition model. Models manage a state vector,...
Definition: model.hpp:30
virtual const Eigen::Ref< const Eigen::VectorXd > GetState() const =0
Retrieves the current state of the model.
virtual bool GetInitialHistoryRecorded() const =0
Checks if the initial history has been recorded for this model.
virtual void RunTimestep(size_t idx)=0
Executes the timestep in the model's sequence.
Model & operator=(const Model &)=delete
Deleted copy assignment operator (models are non-copyable by public API).
virtual std::unique_ptr< Model > clone() const =0
Creates a deep copy of this model.
virtual Timestep GetTimestepAtIndex(size_t index) const =0
Retrieve a copy of a specific timestep by index.
virtual std::string GetName() const =0
Retrieves the name identifier for this model.
virtual void AddTimestep(const Timestep ×tep)=0
Helper function to add a single timestep to the model.
virtual void RunTimestep()=0
Executes the next timestep in the model's sequence.
static std::unique_ptr< Model > Create(const std::string &name, const std::string &log_name=RESPOND_DEFAULT_LOG, const std::string &log_filepath=RESPOND_DEFAULT_LOG_FILE)
Factory method to create a Model instance.
virtual int GetHistoryCaptureInterval() const =0
Retrieves the global history capture interval.
virtual int GetTimestep() const =0
Retrieves the current simulation timestep.
virtual void SetFinalTimestep(int final_timestep)=0
Sets the final timestep that must always be recorded.
virtual void Serialize(std::ostream &os) const =0
Function to serialize the model's state and metadata to an output stream.
virtual const std::map< std::string, History > & GetHistories() const =0
Retrieves a reference to the map of all registered histories. The histories cannot be edited directly...
virtual void SetInitialHistoryRecorded(bool recorded)=0
Sets whether the initial state has been recorded in history.
Model(const Model &)=delete
Deleted copy constructor (models are non-copyable by public API).
virtual int GetFinalTimestep() const =0
Retrieves the final timestep forced into history output.
virtual ~Model()=default
Virtual destructor for proper polymorphic cleanup.
virtual void SetState(const Eigen::Ref< const Eigen::VectorXd > &state)=0
Sets the current state of the model.
Model()=default
Protected default constructor for subclass initialization. Not intended for direct public use.
virtual void RunTimesteps()=0
Executes all registered timesteps in sequence, applying their transitions to the model's state.
virtual void ClearHistories()=0
Clear all history records and reset the history tracking state.
virtual void CreateDefaultHistories()=0
Creates default history tracking for the model. This method initializes standard history records base...
virtual void ClearTimesteps()=0
Clears all timesteps from the model.
virtual void SetHistoryCaptureInterval(int interval)=0
Sets the global history capture interval for this model.
Represents a single timestep in a simulation, managing a collection of transitions....
Definition: timestep.hpp:30