3#include <boost/container/flat_set.hpp>
21 bool requiresGradientData,
25 mappingName(
std::move(mappingName)),
26 mappingNameShort(
std::move(mappingNameShort))
49 searchSpace =
input();
53 const size_t verticesSize = origins->nVertices();
54 const auto & sourceVertices = origins->vertices();
60 auto &
index = searchSpace->index();
61 for (
size_t i = 0; i < verticesSize; ++i) {
62 const auto &sourceCoords = sourceVertices[i].getCoords();
63 const auto &matchedVertex =
index.getClosestVertex(sourceCoords);
67 const auto &matchCoords = searchSpace->vertex(matchedVertex.index).getCoords();
68 auto distance = (sourceCoords - matchCoords).norm();
77 if (distanceStatistics.
empty()) {
78 PRECICE_INFO(
"Mapping distance not available due to empty partition.");
96 input()->index().clear();
122 if (indexSet.count(v.getID()) != 0) {
#define PRECICE_DEBUG(...)
#define PRECICE_TRACE(...)
#define PRECICE_INFO(...)
#define PRECICE_ASSERT(...)
Abstract base class for mapping of data from one mesh to another.
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 _hasComputedMapping
Flag to indicate whether computeMapping() has been called.
Constraint getConstraint() const
Returns the constraint (consistent/conservative) of the mapping.
bool requiresGradientData() const
Returns whether the mapping requires gradient data.
virtual std::string getName() const =0
Returns the name of the mapping method for logging purpose.
virtual bool hasConstraint(const Constraint &constraint) const
Checks whether the mapping has the given constraint or not.
InitialGuessRequirement
Specifies whether the mapping requires an initial guess.
std::vector< Eigen::VectorXd > _offsetsMatched
void clear() final override
Removes a computed mapping.
virtual void onMappingComputed(mesh::PtrMesh origins, mesh::PtrMesh searchSpace)
std::string mappingNameShort
nn or nng
std::vector< int > _vertexIndices
Computed output vertex indices to map data from input vertices to.
void tagMeshSecondRound() final override
Method used by partition. Tags vertices that can be filtered out.
void computeMapping() final override
Computes the mapping coefficients from the in- and output mesh.
NearestNeighborBaseMapping(Constraint constraint, int dimensions, bool hasGradient, std::string mappingName, std::string mappingNameShort)
Constructor.
void tagMeshFirstRound() final override
Method used by partition. Tags vertices that could be owned by this rank.
bool empty() const
Returns count == 0.
contains data mapping from points to meshes.
static constexpr SynchronizeTag Synchronize
Convenience instance of the SynchronizeTag.
constexpr auto get(span< E, S > s) -> decltype(s[N])