DiffEq - Modern C++ ODE Integration Library 1.0.0
High-performance C++ library for solving ODEs with async signal processing
Loading...
Searching...
No Matches
diffeq::core::composable::OutputDecorator< S > Class Template Reference

Output decorator - adds configurable output to any integrator. More...

#include <output_decorator.hpp>

Inheritance diagram for diffeq::core::composable::OutputDecorator< S >:
Collaboration diagram for diffeq::core::composable::OutputDecorator< S >:

Public Member Functions

 OutputDecorator (std::unique_ptr< AbstractIntegrator< S > > integrator, OutputConfig config={}, std::function< void(const S &, typename IntegratorDecorator< S >::time_type, size_t)> handler=nullptr)
 Construct output decorator.
 
 ~OutputDecorator ()
 Destructor ensures proper cleanup and final output flush.
 
void step (typename IntegratorDecorator< S >::state_type &state, typename IntegratorDecorator< S >::time_type dt) override
 Override step to add output handling.
 
void integrate (typename IntegratorDecorator< S >::state_type &state, typename IntegratorDecorator< S >::time_type dt, typename IntegratorDecorator< S >::time_type end_time) override
 Override integrate to handle different output modes.
 
void set_output_handler (std::function< void(const S &, typename IntegratorDecorator< S >::time_type, size_t)> handler)
 Set or change output handler function.
 
const std::vector< std::tuple< S, typename IntegratorDecorator< S >::time_type, size_t > > & get_buffer () const
 Get current output buffer contents.
 
void clear_buffer ()
 Clear the output buffer.
 
void flush_output ()
 Force immediate output flush.
 
const OutputStatsget_statistics () const
 Get output statistics.
 
void reset_statistics ()
 Reset output statistics.
 
OutputConfigconfig ()
 Access and modify output configuration.
 
const OutputConfigconfig () const
 
void update_config (OutputConfig new_config)
 Update output configuration with validation.
 
- Public Member Functions inherited from diffeq::core::composable::IntegratorDecorator< S >
 IntegratorDecorator (std::unique_ptr< base_type > integrator)
 Construct decorator wrapping another integrator.
 
virtual ~IntegratorDecorator ()=default
 Virtual destructor for proper cleanup.
 
void step (state_type &state, time_type dt) override
 
void integrate (state_type &state, time_type dt, time_type end_time) override
 
time_type current_time () const override
 
void set_time (time_type t) override
 
void set_system (system_function sys) override
 
base_typewrapped ()
 Access to wrapped integrator for advanced use.
 
const base_typewrapped () const
 
bool has_wrapped_integrator () const
 Check if wrapped integrator exists.
 
- Public Member Functions inherited from diffeq::core::AbstractIntegrator< S >
 AbstractIntegrator (system_function sys)
 
time_type current_time () const
 
void set_time (time_type t)
 
void set_system (system_function sys)
 

Additional Inherited Members

- Public Types inherited from diffeq::core::composable::IntegratorDecorator< S >
using base_type = AbstractIntegrator< S >
 
using state_type = typename base_type::state_type
 
using time_type = typename base_type::time_type
 
using system_function = typename base_type::system_function
 
- Public Types inherited from diffeq::core::AbstractIntegrator< S >
using state_type = S
 
using time_type = typename S::value_type
 
using value_type = typename S::value_type
 
using system_function = std::function< void(time_type, const state_type &, state_type &)>
 
- Protected Member Functions inherited from diffeq::core::AbstractIntegrator< S >
void advance_time (time_type dt)
 
- Protected Attributes inherited from diffeq::core::composable::IntegratorDecorator< S >
std::unique_ptr< base_typewrapped_integrator_
 
- Protected Attributes inherited from diffeq::core::AbstractIntegrator< S >
system_function sys_
 
time_type current_time_
 

Detailed Description

template<system_state S>
class diffeq::core::composable::OutputDecorator< S >

Output decorator - adds configurable output to any integrator.

This decorator provides comprehensive output capabilities with the following features:

  • Online, offline, and hybrid output modes
  • Configurable output intervals and buffering
  • Optional file output with compression
  • Detailed statistics and performance monitoring

Key Design Principles:

  • Single Responsibility: ONLY handles output functionality
  • No Dependencies: Works with any integrator type
  • Flexible: Multiple output modes and configurations
  • Efficient: Minimal performance impact on integration

Definition at line 97 of file output_decorator.hpp.

Constructor & Destructor Documentation

◆ OutputDecorator()

template<system_state S>
diffeq::core::composable::OutputDecorator< S >::OutputDecorator ( std::unique_ptr< AbstractIntegrator< S > >  integrator,
OutputConfig  config = {},
std::function< void(const S &, typename IntegratorDecorator< S >::time_type, size_t)>  handler = nullptr 
)
inlineexplicit

Construct output decorator.

Parameters
integratorThe integrator to wrap
configOutput configuration (validated on construction)
handlerOptional output handler function
Exceptions
std::invalid_argumentif config is invalid

Definition at line 115 of file output_decorator.hpp.

◆ ~OutputDecorator()

Destructor ensures proper cleanup and final output flush.

Definition at line 130 of file output_decorator.hpp.

Here is the call graph for this function:

Member Function Documentation

◆ clear_buffer()

template<system_state S>
void diffeq::core::composable::OutputDecorator< S >::clear_buffer ( )
inline

Clear the output buffer.

Definition at line 192 of file output_decorator.hpp.

◆ config() [1/2]

Access and modify output configuration.

Definition at line 236 of file output_decorator.hpp.

◆ config() [2/2]

template<system_state S>
const OutputConfig & diffeq::core::composable::OutputDecorator< S >::config ( ) const
inline

Definition at line 237 of file output_decorator.hpp.

◆ flush_output()

template<system_state S>
void diffeq::core::composable::OutputDecorator< S >::flush_output ( )
inline

Force immediate output flush.

Definition at line 200 of file output_decorator.hpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_buffer()

template<system_state S>
const std::vector< std::tuple< S, typename IntegratorDecorator< S >::time_type, size_t > > & diffeq::core::composable::OutputDecorator< S >::get_buffer ( ) const
inline

Get current output buffer contents.

Returns
Reference to the output buffer

Definition at line 185 of file output_decorator.hpp.

◆ get_statistics()

template<system_state S>
const OutputStats & diffeq::core::composable::OutputDecorator< S >::get_statistics ( ) const
inline

Get output statistics.

Definition at line 222 of file output_decorator.hpp.

◆ integrate()

template<system_state S>
void diffeq::core::composable::OutputDecorator< S >::integrate ( typename IntegratorDecorator< S >::state_type &  state,
typename IntegratorDecorator< S >::time_type  dt,
typename IntegratorDecorator< S >::time_type  end_time 
)
inlineoverride

Override integrate to handle different output modes.

Definition at line 154 of file output_decorator.hpp.

Here is the call graph for this function:

◆ reset_statistics()

template<system_state S>
void diffeq::core::composable::OutputDecorator< S >::reset_statistics ( )
inline

Reset output statistics.

Definition at line 229 of file output_decorator.hpp.

◆ set_output_handler()

template<system_state S>
void diffeq::core::composable::OutputDecorator< S >::set_output_handler ( std::function< void(const S &, typename IntegratorDecorator< S >::time_type, size_t)>  handler)
inline

Set or change output handler function.

Parameters
handlerNew output handler function

Definition at line 177 of file output_decorator.hpp.

◆ step()

template<system_state S>
void diffeq::core::composable::OutputDecorator< S >::step ( typename IntegratorDecorator< S >::state_type &  state,
typename IntegratorDecorator< S >::time_type  dt 
)
inlineoverride

Override step to add output handling.

Definition at line 144 of file output_decorator.hpp.

Here is the caller graph for this function:

◆ update_config()

template<system_state S>
void diffeq::core::composable::OutputDecorator< S >::update_config ( OutputConfig  new_config)
inline

Update output configuration with validation.

Parameters
new_configNew configuration
Exceptions
std::invalid_argumentif new config is invalid

Definition at line 244 of file output_decorator.hpp.

Here is the call graph for this function:

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