29 const int meshDimensions =
getMesh()->getDimensions();
31 for (
auto &targetStample :
_targetData->stamples()) {
34 targetValues = targetStample.sample.values;
35 const int valueDimensions =
_targetData->getDimensions();
36 Eigen::VectorXd areas = Eigen::VectorXd::Zero(
getMesh()->nVertices());
37 PRECICE_ASSERT(targetValues.size() / valueDimensions == areas.size());
39 if (meshDimensions == 2) {
41 "The multiply/divide-by-area actions require meshes with connectivity information. In 2D, please ensure that the mesh {} contains edges.",
getMesh()->getName());
43 areas[edge.vertex(0).getID()] += edge.getEnclosingRadius();
44 areas[edge.vertex(1).getID()] += edge.getEnclosingRadius();
48 "The multiply/divide-by-area actions require meshes with connectivity information. In 3D, please ensure that the mesh {} contains triangles.",
getMesh()->getName());
50 areas[face.vertex(0).getID()] += face.getArea() / 3.0;
51 areas[face.vertex(1).getID()] += face.getArea() / 3.0;
52 areas[face.vertex(2).getID()] += face.getArea() / 3.0;
56 for (
int i = 0; i < areas.size(); i++) {
57 for (
int dim = 0; dim < valueDimensions; dim++) {
58 int valueIndex = i * valueDimensions + dim;
59 targetValues[valueIndex] /= areas[i];
63 for (
int i = 0; i < areas.size(); i++) {
64 for (
int dim = 0; dim < valueDimensions; dim++) {
65 int valueIndex = i * valueDimensions + dim;
66 targetValues[valueIndex] *= areas[i];