1#include <boost/range.hpp>
21 for (
const auto &stample : other.
stamples()) {
48 existingSample->sample =
sample;
95 PRECICE_ASSERT(
nTimes() >= 2,
"Calling Storage::move() is only allowed, if there is a sample at the beginning and at the end. This ensures that this function is only called at the end of the window.",
getTimes());
163 return stample->sample;
169 auto times = Eigen::VectorXd(
nTimes());
170 for (
int i = 0; i < times.size(); i++) {
189 auto times = Eigen::VectorXd(
nTimes());
191 for (
int i = 0; i < times.size(); i++) {
203 if (usedDegree == 0) {
212 return stample.sample.values;
222 _bspline.emplace(times, values, usedDegree);
232 if (usedDegree == 0) {
236 PRECICE_WARN(
"You specified interpolation degree of {}, but only degree 0 is supported for gradient interpolation", usedDegree);
242 return std::min(requestedDegree, numberOfAvailableSamples - 1);
#define PRECICE_WARN(...)
#define PRECICE_TRACE(...)
#define PRECICE_ASSERT(...)
void trimAfter(double time)
const Sample & getSampleAtEnd() const
Returns the last Sample contained in this Storage.
SampleResult sample(double time) const
Need to use interpolation for the case with changing time grids.
auto stamples() const
Get the stamples.
void trimBefore(double time)
void setSampleAtTime(double time, const Sample &sample)
Store Sample at a specific time.
Storage()
Stores data samples in time and provides corresponding convenience functions.
void clear()
Clears this Storage by deleting all values.
int nDofs() const
Number of Dofs for each values.
Eigen::MatrixXd sampleGradients(double time) const
void trim()
Trims this Storage by deleting all values except values associated with the window start.
std::pair< Eigen::VectorXd, Eigen::MatrixXd > getTimesAndValues() const
Get all normalized dts and values in ascending order (with respect to normalized dts)
double maxStoredTime() const
Get maximum time that is stored in this Storage.
std::optional< math::Bspline > _bspline
int computeUsedDegree(int requestedDegree, int numberOfAvailableSamples) const
Computes which degree may be used for interpolation.
const Sample & getSampleAtOrAfter(double before) const
Returns the Sample at time following "before" contained in this Storage.
Storage & operator=(const Storage &other)
Copy assignment operator to assign Storage to this Storage.
void setInterpolationDegree(int interpolationDegree)
std::vector< Stample > _stampleStorage
Stores Stamples on the current window.
void setAllSamples(const Sample &sample)
Overrides all existing samples.
void move()
Move this Storage by deleting all stamples except the one at the end of the window.
int nTimes() const
Number of stored times.
Eigen::VectorXd getTimes() const
Get all normalized dts stored in this Storage sorted ascending.
const time::Stample & last() const
int getInterpolationDegree() const
static const int MIN_WAVEFORM_DEGREE
The minimum required interpolation degree.
constexpr bool equals(const Eigen::MatrixBase< DerivedA > &A, const Eigen::MatrixBase< DerivedB > &B, double tolerance=NUMERICAL_ZERO_DIFFERENCE)
Compares two Eigen::MatrixBase for equality up to tolerance.
std::enable_if< std::is_arithmetic< Scalar >::value, bool >::type smallerEquals(Scalar A, Scalar B, Scalar tolerance=NUMERICAL_ZERO_DIFFERENCE)
std::enable_if< std::is_arithmetic< Scalar >::value, bool >::type smaller(Scalar A, Scalar B, Scalar tolerance=NUMERICAL_ZERO_DIFFERENCE)
std::enable_if< std::is_arithmetic< Scalar >::value, bool >::type greater(Scalar A, Scalar B, Scalar tolerance=NUMERICAL_ZERO_DIFFERENCE)
contains the time interpolation logic.
Eigen::MatrixXd gradients
The gradients of the data. Use gradients.col(d*i+k) to get the gradient of vertex i,...
Stample containing timestampled Sample.