4#include <boost/container/flat_set.hpp>
35 const Eigen::VectorXd &inputValues = inData.
values;
36 Eigen::VectorXd & outputValues = outData;
39 const size_t inSize =
input()->nVertices();
40 const int valueDimensions = inData.
dataDims;
42 for (
size_t i = 0; i < inSize; i++) {
45 for (
int dim = 0; dim < valueDimensions; dim++) {
47 const int mapOutputIndex = outputIndex + dim;
48 const int mapInputIndex = (i * valueDimensions) + dim;
50 outputValues(mapOutputIndex) += inputValues(mapInputIndex);
62 const Eigen::VectorXd &inputValues = inData.
values;
63 Eigen::VectorXd & outputValues = outData;
66 const size_t outSize =
output()->nVertices();
67 const int valueDimensions = inData.
dataDims;
69 for (
size_t i = 0; i < outSize; i++) {
72 for (
int dim = 0; dim < valueDimensions; dim++) {
74 const int mapOutputIndex = (i * valueDimensions) + dim;
75 const int mapInputIndex = inputIndex + dim;
77 outputValues(mapOutputIndex) = inputValues(mapInputIndex);
85 return "nearest-neighbor";
#define PRECICE_DEBUG(...)
#define PRECICE_TRACE(...)
mesh::PtrMesh output() const
Returns pointer to output mesh.
Constraint
Specifies additional constraints for a mapping.
mesh::PtrMesh input() const
Returns pointer to input mesh.
bool isScaledConsistent() const
Returns true if mapping is a form of scaled consistent mapping.
void setInputRequirement(MeshRequirement requirement)
Sets the mesh requirement for the input mesh.
void setOutputRequirement(MeshRequirement requirement)
Sets the mesh requirement for the output mesh.
virtual bool hasConstraint(const Constraint &constraint) const
Checks whether the mapping has the given constraint or not.
std::string mappingNameShort
nn or nng
std::vector< int > _vertexIndices
Computed output vertex indices to map data from input vertices to.
std::string getName() const final override
name of the nn mapping
void mapConsistent(const time::Sample &inData, Eigen::VectorXd &outData) final override
Maps data using a consistent constraint.
NearestNeighborMapping(Constraint constraint, int dimensions)
Constructor.
void mapConservative(const time::Sample &inData, Eigen::VectorXd &outData) final override
Maps data using a conservative constraint.
contains data mapping from points to meshes.
static constexpr SynchronizeTag Synchronize
Convenience instance of the SynchronizeTag.
const RangePreview< Iter > previewRange(Size n, const Range &range)
int dataDims
The dimensionality of the data.