32 PRECICE_CHECK(
input()->nVertices() == 1,
"You can only define an axial geometric multiscale mapping of type spread from a mesh with exactly one vertex.");
43 const int outDataDimensions = 3;
49 "Unknown multiscale axis type.");
53 size_t const outSize =
output()->nVertices();
54 constexpr double distance_to_radius_threshold = 1.05;
59 for (
size_t i = 0; i < outSize; i++) {
60 Eigen::VectorXd difference(outDataDimensions);
62 difference -=
output()->vertex(i).getCoords();
63 double distance_to_radius = difference.norm() /
_radius;
64 PRECICE_CHECK(distance_to_radius <= distance_to_radius_threshold,
"Output mesh has vertices that do not coincide with the geometric multiscale interface defined by the input mesh. Ratio of vertex distance to radius is {} (which is larger than the assumed threshold of distance_to_radius_threshold).", distance_to_radius);
69 PRECICE_CHECK(
output()->nVertices() == 1,
"You can only define an axial geometric multiscale mapping of type spread from a mesh with exactly one vertex.");
98 const int inDataDimensions = inData.
dataDims;
99 const Eigen::VectorXd &inputValues = inData.
values;
100 Eigen::VectorXd & outputValues = outData;
102 const int outDataDimensions = outData.size() /
output()->nVertices();
108 "Unknown multiscale axis type.");
112 inputValues.size(), inDataDimensions,
input()->nVertices());
114 outputValues.size(), outDataDimensions,
output()->nVertices());
126 size_t const outSize =
output()->nVertices();
128 for (
size_t i = 0; i < outSize; i++) {
129 PRECICE_ASSERT(
static_cast<size_t>((i * outDataDimensions) + effectiveCoordinate) <
static_cast<size_t>(outputValues.size()), ((i * outDataDimensions) + effectiveCoordinate), outputValues.size());
140 outputValues(effectiveCoordinate) = 0;
141 size_t const inSize =
input()->nVertices();
142 for (
size_t i = 0; i < inSize; i++) {
143 PRECICE_ASSERT(
static_cast<size_t>((i * inDataDimensions) + effectiveCoordinate) <
static_cast<size_t>(inputValues.size()), ((i * inDataDimensions) + effectiveCoordinate), inputValues.size());
144 outputValues(effectiveCoordinate) += inputValues((i * inDataDimensions) + effectiveCoordinate);
146 outputValues(effectiveCoordinate) = outputValues(effectiveCoordinate) / inSize;
178 return "axial-geomultiscale";
#define PRECICE_DEBUG(...)
#define PRECICE_TRACE(...)
#define PRECICE_CHECK(check,...)
#define PRECICE_ASSERT(...)
#define PRECICE_UNREACHABLE(...)
void mapConservative(const time::Sample &inData, Eigen::VectorXd &outData) override
Maps data using a conservative constraint.
double _radius
radius of the "tube" from or to which the data is mapped, i.e., radius of the circular interface betw...
MultiscaleType
Geometric multiscale nature of the mapping (spread or collect).
std::string getName() const final override
Returns name of the mapping.
AxialGeoMultiscaleMapping(Constraint constraint, int dimensions, MultiscaleType type, MultiscaleAxis axis, double radius)
Constructor.
MultiscaleAxis _axis
main axis along which axial geometric multiscale coupling happens
void tagMeshSecondRound() override
Method used by partition. Tags vertices that can be filtered out.
void tagMeshFirstRound() override
Method used by partition. Tags vertices that could be owned by this rank.
void computeMapping() override
Takes care of compute-heavy operations needed only once to set up the mapping.
void clear() override
Removes a computed mapping.
MultiscaleType _type
type of mapping, namely spread or collect
std::vector< double > _vertexDistances
computed vertex distances to map data from input vertex to output vertices
void mapConsistent(const time::Sample &inData, Eigen::VectorXd &outData) override
Maps data using a consistent constraint.
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.
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.
Eigen::VectorXd getCoords() const
Returns the coordinates of the vertex.
contains data mapping from points to meshes.
constexpr auto get(span< E, S > s) -> decltype(s[N])
int dataDims
The dimensionality of the data.