22template <
typename RADIAL_BASIS_FUNCTION_T>
36 const RADIAL_BASIS_FUNCTION_T &function,
71 precice::logging::Logger
_log{
"mapping::RadialBasisFctBaseMapping"};
79template <
typename RADIAL_BASIS_FUNCTION_T>
83 const RADIAL_BASIS_FUNCTION_T &function,
86 :
Mapping(constraint, dimensions, false, mappingType),
87 _basisFunction(function)
99template <
typename RADIAL_BASIS_FUNCTION_T>
106 "Setting the z-axis to dead on a 2-dimensional problem has no effect. Please remove the respective mapping's \"z-dead\" attribute.");
107 PRECICE_CHECK(
std::any_of(_deadAxis.begin(), _deadAxis.end(), [](
const auto &ax) { return ax == false; }),
"You cannot set all axes to dead for an RBF mapping. Please remove one of the respective mapping's \"x-dead\", \"y-dead\", or \"z-dead\" attributes.");
110template <
typename RADIAL_BASIS_FUNCTION_T>
115 const int deadDimensions =
std::count(_deadAxis.begin(), _deadAxis.end(),
true);
117 return 1 + getDimensions() - deadDimensions;
124template <
typename RADIAL_BASIS_FUNCTION_T>
129 if (hasConstraint(CONSERVATIVE)) {
130 filterMesh = output();
133 filterMesh = input();
134 otherMesh = output();
137 if (otherMesh->empty())
142 if (_basisFunction.hasCompactSupport()) {
143 auto bb = otherMesh->getBoundingBox();
144 bb.expandBy(_basisFunction.getSupportRadius());
146 auto vertices = filterMesh->index().getVerticesInsideBox(bb);
147 std::for_each(vertices.begin(), vertices.end(), [&filterMesh](
size_t v) { filterMesh->vertex(v).tag(); });
149 filterMesh->tagAll();
157template <
typename RADIAL_BASIS_FUNCTION_T>
162 if (not _basisFunction.hasCompactSupport())
167 if (hasConstraint(CONSERVATIVE)) {
183 bb.
expandBy(_basisFunction.getSupportRadius());
184 auto vertices = mesh->index().getVerticesInsideBox(bb);
185 std::for_each(vertices.begin(), vertices.end(), [&mesh](
size_t v) { mesh->vertex(v).tag(); });
#define PRECICE_WARN_IF(condition,...)
#define PRECICE_TRACE(...)
#define PRECICE_CHECK(check,...)
#define PRECICE_ASSERT(...)
T back_inserter(T... args)
Abstract base class for mapping of data from one mesh to another.
Constraint
Specifies additional constraints for a mapping.
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.
InitialGuessRequirement
Specifies whether the mapping requires an initial guess.
Mapping with radial basis functions.
virtual void computeMapping()=0
Computes the mapping coefficients from the in- and output mesh.
virtual void clear()=0
Removes a computed mapping.
RadialBasisFctBaseMapping(Constraint constraint, int dimensions, const RADIAL_BASIS_FUNCTION_T &function, std::array< bool, 3 > deadAxis, InitialGuessRequirement mappingType)
Constructor.
void setDeadAxis(std::array< bool, 3 > deadAxis)
converts the boolean switches to a boolean vector
virtual void tagMeshSecondRound() final
Method used by partition. Tags vertices that can be filtered out.
virtual ~RadialBasisFctBaseMapping()=default
int getPolynomialParameters() const
Computes the number of polynomial degrees of freedom based on the problem dimension and the dead axis...
std::vector< bool > _deadAxis
true if the mapping along some axis should be ignored
virtual void tagMeshFirstRound() final
Method used by partition. Tags vertices that could be owned by this rank.
precice::logging::Logger _log
RADIAL_BASIS_FUNCTION_T _basisFunction
Radial basis function type used in interpolation.
An axis-aligned bounding box around a (partition of a) mesh.
void expandBy(const BoundingBox &otherBB)
Expand bounding box using another bounding box.
Main namespace of the precice library.