Drake
Drake C++ Documentation
DenseOutput< T > Class Template Referenceabstract

Detailed Description

template<typename T>
class drake::systems::DenseOutput< T >

An interface for dense output of ODE solutions, to efficiently approximate them at arbitrarily many points when solving them numerically (see IntegratorBase class documentation).

Multiple definitions of dense output may be found in literature. For some authors, it refers to the process of repeatedly adjusting the integration step size so that all points to be approximated are directly provided by the integrator (see [Engquist, 2015]). For others, it stands for any numerical approximation technique used to determine the solution in between steps (see [Hairer, 1993]). Despite this caveat, it is common terminology in IVP literature and thus its imparted functionality is immediately clear.

Herein, the concept in use may be formally stated as follows: given a solution 𝐱(t) ∈ ℝⁿ to an ODE system that is approximated at a discrete set of points 𝐲(tₖ) ∈ ℝⁿ where tₖ ∈ {t₁, ..., tᵢ} with tᵢ ∈ ℝ (e.g. as a result of numerical integration), a dense output of 𝐱(t) is another function 𝐳(t) ∈ ℝⁿ defined for t ∈ [t₁, tᵢ] such that 𝐳(tⱼ) = 𝐲(tⱼ) for all tⱼ ∈ {t₁, ..., tᵢ} and that approximates 𝐱(t) for every value in the closed interval [t₁, tᵢ].

Warning
Dense outputs are, in general, not bound to attain the same accuracy that error-controlled integration schemes do. Check each subclass documentation for further specification.
Note that dense outputs do not enforce any algebraic constraints on the solution that integrators might enforce.
  • [Engquist, 2105] B. Engquist. Encyclopedia of Applied and Computational Mathematics, p. 339, Springer, 2015.
  • [Hairer, 1993] E. Hairer, S. Nørsett and G. Wanner. Solving Ordinary Differential Equations I (Nonstiff Problems), p.188, Springer, 1993.
    Template Parameters
    TThe scalar type, which must be one of the default scalars.

#include <drake/systems/analysis/dense_output.h>

Public Member Functions

virtual ~DenseOutput ()=default
 
VectorX< T > Evaluate (const T &t) const
 Evaluates the output at the given time t. More...
 
EvaluateNth (const T &t, int n) const
 Evaluates the output value's nth scalar element (0-indexed) at the given time t. More...
 
int size () const
 Returns the output size (i.e. More...
 
bool is_empty () const
 Checks whether the output is empty or not. More...
 
const T & start_time () const
 Returns output's start time, or in other words, the oldest time t that it can be evaluated at e.g. More...
 
const T & end_time () const
 Returns output's end time, or in other words, the newest time t that it can be evaluated at e.g. More...
 
Does not allow copy, move, or assignment
 DenseOutput (const DenseOutput &)=delete
 
DenseOutputoperator= (const DenseOutput &)=delete
 
 DenseOutput (DenseOutput &&)=delete
 
DenseOutputoperator= (DenseOutput &&)=delete
 

Protected Member Functions

 DenseOutput ()=default
 
virtual VectorX< T > DoEvaluate (const T &t) const =0
 
virtual T DoEvaluateNth (const T &t, int n) const
 
virtual bool do_is_empty () const =0
 
virtual int do_size () const =0
 
virtual const T & do_start_time () const =0
 
virtual const T & do_end_time () const =0
 
void ThrowIfOutputIsEmpty (const char *func_name) const
 
void ThrowIfNthElementIsInvalid (const char *func_name, int n) const
 
void ThrowIfTimeIsInvalid (const char *func_name, const T &t) const
 

Constructor & Destructor Documentation

◆ DenseOutput() [1/3]

DenseOutput ( const DenseOutput< T > &  )
delete

◆ DenseOutput() [2/3]

DenseOutput ( DenseOutput< T > &&  )
delete

◆ ~DenseOutput()

virtual ~DenseOutput ( )
virtualdefault

◆ DenseOutput() [3/3]

DenseOutput ( )
protecteddefault

Member Function Documentation

◆ do_end_time()

virtual const T& do_end_time ( ) const
protectedpure virtual

◆ do_is_empty()

virtual bool do_is_empty ( ) const
protectedpure virtual

◆ do_size()

virtual int do_size ( ) const
protectedpure virtual

◆ do_start_time()

virtual const T& do_start_time ( ) const
protectedpure virtual

◆ DoEvaluate()

virtual VectorX<T> DoEvaluate ( const T &  t) const
protectedpure virtual

◆ DoEvaluateNth()

virtual T DoEvaluateNth ( const T &  t,
int  n 
) const
protectedvirtual

Reimplemented in HermitianDenseOutput< T >.

◆ end_time()

const T& end_time ( ) const

Returns output's end time, or in other words, the newest time t that it can be evaluated at e.g.

via Evaluate().

Precondition
Output is not empty i.e. is_empty() equals false.
Exceptions
std::exceptionif any of the preconditions is not met.

◆ Evaluate()

VectorX<T> Evaluate ( const T &  t) const

Evaluates the output at the given time t.

Parameters
tTime at which to evaluate output.
Returns
Output vector value.
Precondition
Output is not empty i.e. is_empty() equals false.
Exceptions
std::exceptionif any of the preconditions are not met.
std::exceptionif given t is not within output's domain i.e. t ∉ [start_time(), end_time()].

◆ EvaluateNth()

T EvaluateNth ( const T &  t,
int  n 
) const

Evaluates the output value's nth scalar element (0-indexed) at the given time t.

Note
On some implementations, the computational cost of this method may be lower than that of indexing an Evaluate(const T&) call return vector value, thus making it the preferred mechanism when targeting a single dimension.
Parameters
tTime at which to evaluate output.
nThe nth scalar element (0-indexed) of the output value to evaluate.
Returns
Output value's nth scalar element (0-indexed).
Precondition
Output is not empty i.e. is_empty() equals false.
Exceptions
std::exceptionif any of the preconditions are not met.
std::exceptionif given t is not within output's domain i.e. t ∉ [start_time(), end_time()].
std::exceptionif given n does not refer to a valid output dimension i.e. n ∉ [0, size()).

◆ is_empty()

bool is_empty ( ) const

Checks whether the output is empty or not.

◆ operator=() [1/2]

DenseOutput& operator= ( DenseOutput< T > &&  )
delete

◆ operator=() [2/2]

DenseOutput& operator= ( const DenseOutput< T > &  )
delete

◆ size()

int size ( ) const

Returns the output size (i.e.

the number of elements in an output value).

Precondition
Output is not empty i.e. is_empty() equals false.
Exceptions
std::exceptionif any of the preconditions is not met.

◆ start_time()

const T& start_time ( ) const

Returns output's start time, or in other words, the oldest time t that it can be evaluated at e.g.

via Evaluate().

Precondition
Output is not empty i.e. is_empty() equals false.
Exceptions
std::exceptionif any of the preconditions is not met.

◆ ThrowIfNthElementIsInvalid()

void ThrowIfNthElementIsInvalid ( const char *  func_name,
int  n 
) const
protected

◆ ThrowIfOutputIsEmpty()

void ThrowIfOutputIsEmpty ( const char *  func_name) const
protected

◆ ThrowIfTimeIsInvalid()

void ThrowIfTimeIsInvalid ( const char *  func_name,
const T &  t 
) const
protected

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