15 _type(type), _axis(axis)
28 size_t const inSize =
input()->nVertices();
29 size_t const outSize =
output()->nVertices();
35 "Unknown multiscale axis type.");
41 Eigen::VectorXd axisMidpoints(inSize);
42 auto & inputVerticesRef =
input()->vertices();
47 [effectiveCoordinate, &inputVerticesRef](
const size_t aindex,
const size_t bindex) {
48 return inputVerticesRef[aindex].coord(effectiveCoordinate) < inputVerticesRef[bindex].coord(effectiveCoordinate);
51 for (
size_t i = 0; i < (inSize - 1); i++) {
52 auto axisPositionCurrent = inputVerticesRef[ordered_vertex_indices[i]].coord(effectiveCoordinate);
53 auto axisPositionNext = inputVerticesRef[ordered_vertex_indices[i] + 1].coord(effectiveCoordinate);
54 axisMidpoints(i) = (axisPositionCurrent + axisPositionNext) / 2;
64 for (
size_t i = 0; i < outSize; i++) {
65 auto vertexCoord =
output()->vertex(i).coord(effectiveCoordinate);
67 while (vertexCoord > axisMidpoints(
index)) {
81 Eigen::VectorXd axisMidpoints(outSize);
82 auto & outputVerticesRef =
output()->vertices();
88 [effectiveCoordinate, &outputVerticesRef](
const size_t aindex,
const size_t bindex) {
89 return outputVerticesRef[aindex].coord(effectiveCoordinate) < outputVerticesRef[bindex].coord(effectiveCoordinate);
92 for (
size_t i = 0; i < (outSize - 1); i++) {
93 auto axisPositionCurrent =
output()->vertex(i).coord(effectiveCoordinate);
94 auto axisPositionNext =
output()->vertex(i + 1).coord(effectiveCoordinate);
95 axisMidpoints(i) = (axisPositionCurrent + axisPositionNext) / 2;
104 for (
size_t i = 0; i < inSize; i++) {
105 auto vertexCoords =
input()->vertex(i).coord(effectiveCoordinate);
107 while (vertexCoords > axisMidpoints(
index)) {
112 counters[
index] += 1;
144 const int inDataDimensions = inData.
dataDims;
145 const Eigen::VectorXd &inputValues = inData.
values;
146 Eigen::VectorXd & outputValues = outData;
148 size_t const inSize =
input()->nVertices();
149 size_t const outSize =
output()->nVertices();
152 auto outDataDimensions = outputValues.size() / outSize;
156 inputValues.size(), inDataDimensions,
input()->nVertices());
158 outputValues.size(), outDataDimensions,
output()->nVertices());
166 for (
size_t i = 0; i < outSize; i++) {
176 for (
size_t i = 0; i < outSize; i++) {
177 outputValues(i * outDataDimensions) = 0;
180 for (
size_t i = 0; i < inSize; i++) {
183 for (
size_t i = 0; i < outSize; i++) {
184 outputValues(i * outDataDimensions) = outputValues(i * outDataDimensions) /
_vertexCounter[i];
217 return "radial-geomultiscale";
#define PRECICE_DEBUG(...)
#define PRECICE_TRACE(...)
#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.
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.
std::vector< size_t > _vertexIndicesCollect
MultiscaleType
Geometric multiscale type of the mapping (spread or collect).
RadialGeoMultiscaleMapping(Constraint constraint, int dimensions, MultiscaleType type, MultiscaleAxis axis)
Constructor.
std::vector< size_t > _vertexCounter
counts number of vertices between midpoints for averaging
MultiscaleAxis _axis
main axis along which radial geometric multiscale coupling happens
void tagMeshFirstRound() override
Method used by partition. Tags vertices that could be owned by this rank.
std::vector< size_t > _vertexIndicesSpread
computed vertex indices to map data from input vertices to output vertices and vice versa
std::string getName() const final override
Returns name of the mapping.
MultiscaleType _type
type of mapping, namely spread or collect
void clear() override
Removes a computed mapping.
void tagMeshSecondRound() override
Method used by partition. Tags vertices that can be filtered out.
void mapConservative(const time::Sample &inData, Eigen::VectorXd &outData) override
Maps data using a conservative constraint.
void computeMapping() override
Takes care of compute-heavy operations needed only once to set up the mapping.
void mapConsistent(const time::Sample &inData, Eigen::VectorXd &outData) override
Maps data using a consistent constraint.
contains data mapping from points to meshes.
constexpr auto get(span< E, S > s) -> decltype(s[N])
int dataDims
The dimensionality of the data.