48 const std::string baseEvent =
"map.np.computeMapping.From" +
input()->getName() +
"To" +
output()->getName();
60 searchSpace =
input();
63 const auto &fVertices = origins->vertices();
67 "2D Mesh \"{}\" does not contain edges. "
68 "Nearest projection mapping falls back to nearest neighbor mapping.",
69 searchSpace->getName());
72 "3D Mesh \"{}\" does not contain triangles. "
73 "Nearest projection mapping will map to primitives of lower dimension.",
74 searchSpace->getName());
81 constexpr int nnearest = 4;
88 auto &
index = searchSpace->index();
89 for (
const auto &fVertex : fVertices) {
92 auto match =
index.findNearestProjection(fVertex.getCoords(), nnearest);
93 distanceStatistics(match.polation.distance());
97 if (distanceStatistics.
empty()) {
98 PRECICE_INFO(
"Mapping distance not available due to empty partition.");
100 PRECICE_INFO(
"Mapping distance {}", distanceStatistics);
108 return "nearest-projection";
#define PRECICE_WARN_IF(condition,...)
#define PRECICE_DEBUG(...)
#define PRECICE_TRACE(...)
#define PRECICE_INFO(...)
#define PRECICE_CHECK(check,...)
#define PRECICE_ASSERT(...)
Base class for interpolation based mappings, where mapping is done using a geometry-based linear comb...
std::vector< Polation > _interpolations
mesh::PtrMesh output() const
Returns pointer to output mesh.
Constraint
Specifies additional constraints for a mapping.
@ SCALED_CONSISTENT_VOLUME
int getDimensions() const
mesh::PtrMesh input() const
Returns pointer to input mesh.
bool _hasComputedMapping
Flag to indicate whether computeMapping() has been called.
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 getName() const final override
name of the np mapping
void computeMapping() final override
Computes the projections and interpolation relations.
NearestProjectionMapping(Constraint constraint, int dimensions)
Constructor, taking mapping constraint.
bool empty() const
Returns count == 0.
contains data mapping from points to meshes.
static constexpr SynchronizeTag Synchronize
Convenience instance of the SynchronizeTag.