15 const int valueDimensions = input.size() / mesh->
nVertices();
16 const auto & values = input;
17 Eigen::VectorXd integral = Eigen::VectorXd::Zero(valueDimensions);
19 if (meshDimensions == 2) {
20 for (
const auto &edge : mesh->
edges()) {
21 int vertex1 = edge.vertex(0).getID() * valueDimensions;
22 int vertex2 = edge.vertex(1).getID() * valueDimensions;
23 for (
int dim = 0; dim < valueDimensions; ++dim) {
24 integral(dim) += 0.5 * edge.getLength() * (values(vertex1 + dim) + values(vertex2 + dim));
28 for (
const auto &face : mesh->
triangles()) {
29 int vertex1 = face.vertex(0).getID() * valueDimensions;
30 int vertex2 = face.vertex(1).getID() * valueDimensions;
31 int vertex3 = face.vertex(2).getID() * valueDimensions;
33 for (
int dim = 0; dim < valueDimensions; ++dim) {
34 integral(dim) += (face.getArea() / 3.0) * (values(vertex1 + dim) + values(vertex2 + dim) + values(vertex3 + dim));
45 const int valueDimensions = input.size() / mesh->
nVertices();
46 const auto & values = input;
47 Eigen::VectorXd integral = Eigen::VectorXd::Zero(valueDimensions);
48 if (meshDimensions == 2) {
49 for (
const auto &face : mesh->
triangles()) {
50 int vertex1 = face.vertex(0).getID() * valueDimensions;
51 int vertex2 = face.vertex(1).getID() * valueDimensions;
52 int vertex3 = face.vertex(2).getID() * valueDimensions;
53 for (
int dim = 0; dim < valueDimensions; ++dim) {
54 integral(dim) += (face.getArea() / 3.0) * (values(vertex1 + dim) + values(vertex2 + dim) + values(vertex3 + dim));
59 int vertex1 = tetra.vertex(0).getID() * valueDimensions;
60 int vertex2 = tetra.vertex(1).getID() * valueDimensions;
61 int vertex3 = tetra.vertex(2).getID() * valueDimensions;
62 int vertex4 = tetra.vertex(3).getID() * valueDimensions;
64 for (
int dim = 0; dim < valueDimensions; ++dim) {
65 integral(dim) += (tetra.getVolume() / 4.0) * (values(vertex1 + dim) + values(vertex2 + dim) + values(vertex3 + dim) + values(vertex4 + dim));
#define PRECICE_ASSERT(...)
int getDimensions() const
std::size_t nVertices() const
Returns the number of vertices.
TetraContainer & tetrahedra()
Returns modifiable container holding all tetrahedra.
TriangleContainer & triangles()
Returns modifiable container holding all triangles.
EdgeContainer & edges()
Returns modifiable container holding all edges.
provides Mesh, Data and primitives.
Eigen::VectorXd integrateSurface(const PtrMesh &mesh, const Eigen::VectorXd &input)
Given the data and the mesh, this function returns the surface integral. Assumes no overlap exists fo...
Eigen::VectorXd integrateVolume(const PtrMesh &mesh, const Eigen::VectorXd &input)
Given the data and the mesh, this function returns the volume integral. Assumes no overlap exists for...