16 int spatialDimensions,
26 _lowerBound = std::vector<std::optional<double>>(dimensions);
27 _upperBound = std::vector<std::optional<double>>(dimensions);
34 int spatialDimensions,
36 std::vector<std::optional<double>> lowerBound,
37 std::vector<std::optional<double>> upperBound)
48 PRECICE_ASSERT(
static_cast<int>(lowerBound.size()) == dimensions, lowerBound.size(), dimensions);
49 PRECICE_ASSERT(
static_cast<int>(upperBound.size()) == dimensions, upperBound.size(), dimensions);
79 return _waveform.getInterpolationDegree();
127 Eigen::Map<const Eigen::VectorXd>(
values.begin(),
values.size())});
135 Eigen::Map<const Eigen::VectorXd>(
values.begin(),
values.size()),
171 using SizeType = std::remove_cv<
decltype(expectedCount)>::type;
173 const SizeType expectedSize = expectedCount *
_dimensions;
174 const auto actualSize =
static_cast<SizeType
>(
_sample.values.size());
176 if (expectedSize < actualSize) {
177 _sample.values.resize(expectedSize);
180 if (expectedSize > actualSize) {
181 const auto leftToAllocate = expectedSize - actualSize;
190 const SizeType expectedColumnSize = expectedCount *
_dimensions;
191 const auto actualColumnSize =
static_cast<SizeType
>(
_sample.gradients.cols());
194 if (expectedColumnSize < actualColumnSize) {
195 _sample.gradients.resize(spaceDimensions, expectedColumnSize);
199 if (expectedColumnSize > actualColumnSize) {
200 const auto columnLeftToAllocate = expectedColumnSize - actualColumnSize;
201 utils::append(
_sample.gradients, Eigen::MatrixXd(Eigen::MatrixXd::Zero(spaceDimensions, columnLeftToAllocate)));
#define PRECICE_DEBUG(...)
#define PRECICE_ASSERT(...)
const std::string & getName() const
Returns the name of the data set, as set in the config file.
std::string _name
Name of the data set.
bool hasSamples() const
Returns if there are sample of this data.
Data(std::string name, DataID id, int dimension, int spatialDimensions=-1, int waveformDegree=time::Time::DEFAULT_WAVEFORM_DEGREE)
Constructor.
std::vector< std::optional< double > > getUpperBound() const
int getDimensions() const
Returns the dimension (i.e., number of components) of one data value (i.e number of columns of one gr...
void requireDataGradient()
Set the additional requirement of gradient data.
bool hasGradient() const
Returns if the data contains gradient data.
int _spatialDimensions
Spatial Dimension of one element -> number of rows (only 2, 3 allowed for 2D, 3D).
auto stamples() const
Returns a the stamples from the waveform.
void allocateValues(int expectedCount)
Allocates memory for the data values and corresponding gradient values.
int getSpatialDimensions() const
Returns the mesh dimension (i.e., number of rows) of one gradient data value .
int _dimensions
Dimensionality of one data value.
int getWaveformDegree() const
get degree of _waveform.
void setGlobalSample(const time::Sample &sample)
Set _sample.
time::SampleResult sampleAtTime(double time) const
Samples _waveform at given time.
std::vector< std::optional< double > > getLowerBound() const
DataID getID() const
Returns the ID of the data set (supposed to be unique).
DataID _id
ID of the data set (supposed to be unique).
bool _hasGradient
Whether gradient data is available or not.
Eigen::VectorXd & values()
Returns a reference to the data values.
std::vector< std::optional< double > > _lowerBound
Lower bound for data values. This vector with optional elements has size of the data dimension....
const time::Sample & sample() const
Returns a const reference to the _sample.
time::Waveform _waveform
Sample storage of this Data.
std::vector< std::optional< double > > _upperBound
Upper bound for data values. This vector with optional elements has size of the data dimension....
time::Waveform & waveform()
Returns a reference to the waveform.
const Eigen::MatrixXd & gradients() const
Returns a const reference to the gradient data values.
void setSampleAtTime(double time, const time::Sample &sample)
Add sample at given time to the waveform.
void emplaceSampleAtTime(double time)
Creates an empty sample at given time.
provides Mesh, Data and primitives.
contains the time interpolation logic.
void append(Eigen::VectorXd &v, double value)