LehrFEM++ 1.0.0
A simple Finite Element Library for teaching
Loading...
Searching...
No Matches
check_integration_element.cc
1
9#include "check_integration_element.h"
10
11#include <gtest/gtest.h>
12
13#include <Eigen/LU>
14
16
18 const Eigen::MatrixXd &eval_points) {
19 const size_t num_points = eval_points.cols();
20 const size_t dim_local = geom.DimLocal();
21 const size_t dim_global = geom.DimGlobal();
22
23 Eigen::MatrixXd jacobians = geom.Jacobian(eval_points);
24 Eigen::VectorXd integrationElements = geom.IntegrationElement(eval_points);
25
26 EXPECT_EQ(integrationElements.rows(), num_points)
27 << "IntegrationElement has " << integrationElements.rows()
28 << " rows instead of " << num_points;
29 EXPECT_EQ(integrationElements.cols(), 1)
30 << "IntegrationElement has " << integrationElements.cols()
31 << " cols instead of " << 1;
32
33 for (int j = 0; j < num_points; ++j) {
34 Eigen::MatrixXd jacobian =
35 jacobians.block(0, j * dim_local, dim_global, dim_local);
36
37 const double integrationElement = integrationElements(j);
38 const double approx_integrationElement =
39 std::sqrt((jacobian.transpose() * jacobian).determinant());
40
41 EXPECT_FLOAT_EQ(integrationElement, approx_integrationElement)
42 << "IntegrationElement incorrect at point " << eval_points.col(j);
43 }
44}
45
46} // namespace lf::geometry::test_utils
Interface class for shape information on a mesh cell in the spirit of parametric finite element metho...
virtual dim_t DimLocal() const =0
Dimension of the domain of this mapping.
virtual dim_t DimGlobal() const =0
Dimension of the image of this mapping.
virtual Eigen::VectorXd IntegrationElement(const Eigen::MatrixXd &local) const =0
The integration element (factor appearing in integral transformation formula, see below) at number of...
virtual Eigen::MatrixXd Jacobian(const Eigen::MatrixXd &local) const =0
Evaluate the jacobian of the mapping simultaneously at numPoints points.
Defines the Geometry::test_utils module and provides a number of test functions to check geometry obj...
void checkIntegrationElement(const lf::geometry::Geometry &geom, const Eigen::MatrixXd &eval_points)
Checks if IntegrationElement() is implemented correctly under the assumption that Jacobian() is corre...