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::InterpolationDecorator< S > Class Template Reference

Interpolation decorator - adds dense output capabilities to any integrator. More...

#include <interpolation_decorator.hpp>

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

Public Member Functions

 InterpolationDecorator (std::unique_ptr< AbstractIntegrator< S > > integrator, InterpolationConfig config={})
 Construct interpolation decorator.
 
void step (typename IntegratorDecorator< S >::state_type &state, typename IntegratorDecorator< S >::time_type dt) override
 Override step to record state history.
 
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 maintain history during integration.
 
interpolate_at (typename IntegratorDecorator< S >::time_type t)
 Get interpolated state at arbitrary time.
 
std::vector< S > interpolate_at_multiple (const std::vector< typename IntegratorDecorator< S >::time_type > &time_points)
 Get interpolated states at multiple time points.
 
std::pair< std::vector< typename IntegratorDecorator< S >::time_type >, std::vector< S > > get_dense_output (typename IntegratorDecorator< S >::time_type start_time, typename IntegratorDecorator< S >::time_type end_time, size_t num_points)
 Get dense output over time interval.
 
const InterpolationStatsget_statistics () const
 Get current interpolation statistics.
 
void reset_statistics ()
 Reset interpolation statistics.
 
std::pair< typename IntegratorDecorator< S >::time_type, typename IntegratorDecorator< S >::time_type > get_time_bounds () const
 Get time bounds of available history.
 
void clear_history ()
 Clear all history.
 
size_t get_history_size () const
 Get number of stored history points.
 
InterpolationConfigconfig ()
 Access and modify interpolation configuration.
 
const InterpolationConfigconfig () const
 
- 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::InterpolationDecorator< S >

Interpolation decorator - adds dense output capabilities to any integrator.

This decorator provides comprehensive interpolation capabilities with the following features:

  • Dense output with multiple interpolation methods
  • Adaptive sampling and history management
  • Memory-efficient compression
  • Query interface for arbitrary time points

Key Design Principles:

  • Single Responsibility: ONLY handles interpolation and dense output
  • Efficient: Minimal memory overhead with compression
  • Flexible: Multiple interpolation methods
  • Robust: Handles edge cases and extrapolation

Definition at line 226 of file interpolation_decorator.hpp.

Constructor & Destructor Documentation

◆ InterpolationDecorator()

template<system_state S>
diffeq::core::composable::InterpolationDecorator< S >::InterpolationDecorator ( std::unique_ptr< AbstractIntegrator< S > >  integrator,
InterpolationConfig  config = {} 
)
inlineexplicit

Construct interpolation decorator.

Parameters
integratorThe integrator to wrap
configInterpolation configuration (validated on construction)
Exceptions
std::invalid_argumentif config is invalid

Definition at line 243 of file interpolation_decorator.hpp.

Member Function Documentation

◆ clear_history()

template<system_state S>
void diffeq::core::composable::InterpolationDecorator< S >::clear_history ( )
inline

Clear all history.

Definition at line 396 of file interpolation_decorator.hpp.

◆ config() [1/2]

Access and modify interpolation configuration.

Definition at line 413 of file interpolation_decorator.hpp.

◆ config() [2/2]

template<system_state S>
const InterpolationConfig & diffeq::core::composable::InterpolationDecorator< S >::config ( ) const
inline

Definition at line 414 of file interpolation_decorator.hpp.

◆ get_dense_output()

template<system_state S>
std::pair< std::vector< typename IntegratorDecorator< S >::time_type >, std::vector< S > > diffeq::core::composable::InterpolationDecorator< S >::get_dense_output ( typename IntegratorDecorator< S >::time_type  start_time,
typename IntegratorDecorator< S >::time_type  end_time,
size_t  num_points 
)
inline

Get dense output over time interval.

Parameters
start_timeStart time
end_timeEnd time
num_pointsNumber of interpolation points
Returns
Pair of time vector and state vector

Definition at line 345 of file interpolation_decorator.hpp.

Here is the call graph for this function:

◆ get_history_size()

template<system_state S>
size_t diffeq::core::composable::InterpolationDecorator< S >::get_history_size ( ) const
inline

Get number of stored history points.

Definition at line 405 of file interpolation_decorator.hpp.

◆ get_statistics()

template<system_state S>
const InterpolationStats & diffeq::core::composable::InterpolationDecorator< S >::get_statistics ( ) const
inline

Get current interpolation statistics.

Definition at line 370 of file interpolation_decorator.hpp.

◆ get_time_bounds()

template<system_state S>
std::pair< typename IntegratorDecorator< S >::time_type, typename IntegratorDecorator< S >::time_type > diffeq::core::composable::InterpolationDecorator< S >::get_time_bounds ( ) const
inline

Get time bounds of available history.

Returns
Pair of (min_time, max_time)

Definition at line 385 of file interpolation_decorator.hpp.

Here is the caller graph for this function:

◆ integrate()

template<system_state S>
void diffeq::core::composable::InterpolationDecorator< 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 maintain history during integration.

Definition at line 263 of file interpolation_decorator.hpp.

◆ interpolate_at()

template<system_state S>
S diffeq::core::composable::InterpolationDecorator< S >::interpolate_at ( typename IntegratorDecorator< S >::time_type  t)
inline

Get interpolated state at arbitrary time.

Parameters
tTime for interpolation
Returns
Interpolated state
Exceptions
std::runtime_errorif interpolation fails

Definition at line 286 of file interpolation_decorator.hpp.

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

◆ interpolate_at_multiple()

template<system_state S>
std::vector< S > diffeq::core::composable::InterpolationDecorator< S >::interpolate_at_multiple ( const std::vector< typename IntegratorDecorator< S >::time_type > &  time_points)
inline

Get interpolated states at multiple time points.

Parameters
time_pointsVector of time points
Returns
Vector of interpolated states

Definition at line 327 of file interpolation_decorator.hpp.

Here is the call graph for this function:

◆ reset_statistics()

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

Reset interpolation statistics.

Definition at line 377 of file interpolation_decorator.hpp.

◆ step()

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

Override step to record state history.

Definition at line 255 of file interpolation_decorator.hpp.


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