SpECTRE  v2024.09.29
domain::FunctionsOfTime::PiecewisePolynomial< MaxDeriv > Class Template Reference

A function that has a piecewise-constant MaxDerivth derivative. More...

#include <PiecewisePolynomial.hpp>

Public Member Functions

 PiecewisePolynomial (PiecewisePolynomial &&)
 
 PiecewisePolynomial (const PiecewisePolynomial &)
 
PiecewisePolynomialoperator= (PiecewisePolynomial &&)
 
PiecewisePolynomialoperator= (const PiecewisePolynomial &)
 
 PiecewisePolynomial (double t, std::array< DataVector, MaxDeriv+1 > initial_func_and_derivs, double expiration_time)
 
 PiecewisePolynomial (CkMigrateMessage *)
 
auto get_clone () const -> std::unique_ptr< FunctionOfTime > override
 
 WRAPPED_PUPable_decl_template (PiecewisePolynomial< MaxDeriv >)
 
std::array< DataVector, 1 > func (double t) const override
 Returns the function at an arbitrary time t. If MaxDeriv is 0 and update has been called for time t, the updated value is ignored. More...
 
std::array< DataVector, 2 > func_and_deriv (double t) const override
 Returns the function and its first derivative at an arbitrary time t. If MaxDeriv is 1 and update has been called for time t, the updated value is ignored. More...
 
std::array< DataVector, 3 > func_and_2_derivs (double t) const override
 Returns the function and the first two derivatives at an arbitrary time t. If MaxDeriv is 2 and update has been called for time t, the updated value is ignored. More...
 
std::vector< DataVectorfunc_and_all_derivs (double t) const override
 Return the function and all derivs up to and including the MaxDeriv at an arbitrary time t. More...
 
void update (double time_of_update, DataVector updated_max_deriv, double next_expiration_time) override
 Updates the MaxDerivth derivative of the function at the given time. updated_max_deriv is a vector of the MaxDerivths for each component. next_expiration_time is the next expiration time. More...
 
std::array< double, 2 > time_bounds () const override
 Returns the domain of validity of the function, including the extrapolation region. More...
 
double expiration_after (double time) const override
 The first expiration time after time. More...
 
void pup (PUP::er &p) override
 
- Public Member Functions inherited from domain::FunctionsOfTime::FunctionOfTime
 FunctionOfTime (FunctionOfTime &&)=default
 
FunctionOfTimeoperator= (FunctionOfTime &&)=default
 
 FunctionOfTime (const FunctionOfTime &)=default
 
FunctionOfTimeoperator= (const FunctionOfTime &)=default
 
virtual auto get_clone () const -> std::unique_ptr< FunctionOfTime >=0
 
virtual std::array< double, 2 > time_bounds () const =0
 Returns the domain of validity of the function. For FunctionsOfTime that allow a small amount of time extrapolation, time_bounds tells you the bounds including the allowed extrapolation interval. More...
 
virtual double expiration_after (double time) const =0
 The first expiration time after time. More...
 
virtual void update (double, DataVector, double)
 Updates the maximum derivative of the FunctionOfTime at a given time while also resetting the expiration. By default, a FunctionOfTime cannot be updated. More...
 
virtual std::array< DataVector, 1 > func (double t) const =0
 The DataVector can be of any size. More...
 
virtual std::array< DataVector, 2 > func_and_deriv (double t) const =0
 The DataVector can be of any size. More...
 
virtual std::array< DataVector, 3 > func_and_2_derivs (double t) const =0
 The DataVector can be of any size. More...
 
virtual std::vector< DataVectorfunc_and_all_derivs (double t) const
 All derivatives a function of time has to offer (because it can be more than 2) More...
 
 WRAPPED_PUPable_abstract (FunctionOfTime)
 

Friends

template<size_t LocalMaxDeriv>
bool operator== (const PiecewisePolynomial< LocalMaxDeriv > &lhs, const PiecewisePolynomial< LocalMaxDeriv > &rhs)
 
template<size_t LocalMaxDeriv>
std::ostreamoperator<< (std::ostream &os, const PiecewisePolynomial< LocalMaxDeriv > &piecewise_polynomial)
 

Detailed Description

template<size_t MaxDeriv>
class domain::FunctionsOfTime::PiecewisePolynomial< MaxDeriv >

A function that has a piecewise-constant MaxDerivth derivative.

Note
This class conforms to the requirements of the Parallel::GlobalCache for objects held by mutable global cache tags.

Member Function Documentation

◆ expiration_after()

template<size_t MaxDeriv>
double domain::FunctionsOfTime::PiecewisePolynomial< MaxDeriv >::expiration_after ( double  time) const
overridevirtual

The first expiration time after time.

Details

For non-updatable functions, this returns infinity. For updatable functions, the first expiration time after time is found by determining the update immediately before time. The expiration time of this update is what is returned. If time happens to be an update itself, then the expiration of that update is returned.

Implements domain::FunctionsOfTime::FunctionOfTime.

◆ func()

template<size_t MaxDeriv>
std::array< DataVector, 1 > domain::FunctionsOfTime::PiecewisePolynomial< MaxDeriv >::func ( double  t) const
inlineoverridevirtual

Returns the function at an arbitrary time t. If MaxDeriv is 0 and update has been called for time t, the updated value is ignored.

Implements domain::FunctionsOfTime::FunctionOfTime.

◆ func_and_2_derivs()

template<size_t MaxDeriv>
std::array< DataVector, 3 > domain::FunctionsOfTime::PiecewisePolynomial< MaxDeriv >::func_and_2_derivs ( double  t) const
inlineoverridevirtual

Returns the function and the first two derivatives at an arbitrary time t. If MaxDeriv is 2 and update has been called for time t, the updated value is ignored.

Implements domain::FunctionsOfTime::FunctionOfTime.

◆ func_and_all_derivs()

template<size_t MaxDeriv>
std::vector< DataVector > domain::FunctionsOfTime::PiecewisePolynomial< MaxDeriv >::func_and_all_derivs ( double  t) const
overridevirtual

Return the function and all derivs up to and including the MaxDeriv at an arbitrary time t.

Reimplemented from domain::FunctionsOfTime::FunctionOfTime.

◆ func_and_deriv()

template<size_t MaxDeriv>
std::array< DataVector, 2 > domain::FunctionsOfTime::PiecewisePolynomial< MaxDeriv >::func_and_deriv ( double  t) const
inlineoverridevirtual

Returns the function and its first derivative at an arbitrary time t. If MaxDeriv is 1 and update has been called for time t, the updated value is ignored.

Implements domain::FunctionsOfTime::FunctionOfTime.

◆ get_clone()

template<size_t MaxDeriv>
auto domain::FunctionsOfTime::PiecewisePolynomial< MaxDeriv >::get_clone ( ) const -> std::unique_ptr< FunctionOfTime >
overridevirtual

◆ time_bounds()

template<size_t MaxDeriv>
std::array< double, 2 > domain::FunctionsOfTime::PiecewisePolynomial< MaxDeriv >::time_bounds ( ) const
overridevirtual

Returns the domain of validity of the function, including the extrapolation region.

Implements domain::FunctionsOfTime::FunctionOfTime.

◆ update()

template<size_t MaxDeriv>
void domain::FunctionsOfTime::PiecewisePolynomial< MaxDeriv >::update ( double  time_of_update,
DataVector  updated_max_deriv,
double  next_expiration_time 
)
overridevirtual

Updates the MaxDerivth derivative of the function at the given time. updated_max_deriv is a vector of the MaxDerivths for each component. next_expiration_time is the next expiration time.

The time_of_update must be the same as the old expiration time. It is passed as a check that the calling code is computing the other arguments with the correct value.

Reimplemented from domain::FunctionsOfTime::FunctionOfTime.


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