27 if (mesh_dimension != 2)
30 "A 2D mesh is required for this computation but the provided mesh, "
31 "mesh {:s}, has {:d}D elements.",
32 mesh.
getName(), mesh_dimension);
37 bool const has_inclined_element =
38 std::any_of(elements.begin(), elements.end(),
39 [&mesh_dimension](
auto const& element)
40 { return element->space_dimension_ != mesh_dimension; });
42 if (!has_inclined_element)
47 const bool is_rotated_around_y_axis = std::all_of(
48 elements.cbegin(), elements.cend(),
49 [](
auto const& element)
52 auto const x1 = element->getNode(0)->data();
53 auto const x2 = element->getNode(1)->data();
54 auto const x3 = element->getNode(2)->data();
56 double const a0 = x2[0] - x1[0];
57 double const a2 = x2[2] - x1[2];
59 double const b0 = x3[0] - x1[0];
60 double const b2 = x3[2] - x1[2];
62 double const e_n_1 = -a0 * b2 + a2 * b0;
63 return std::fabs(e_n_1) < std::numeric_limits<double>::epsilon();
66 const bool is_rotated_around_z_axis = std::all_of(
67 elements.cbegin(), elements.cend(),
68 [](
auto const& element)
71 auto const x1 = element->getNode(0)->data();
72 auto const x2 = element->getNode(1)->data();
73 auto const x3 = element->getNode(2)->data();
75 double const a0 = x2[0] - x1[0];
76 double const a1 = x2[1] - x1[1];
78 double const b0 = x3[0] - x1[0];
79 double const b1 = x3[1] - x1[1];
81 double const e_n_2 = a0 * b1 - a1 * b0;
82 return std::fabs(e_n_2) < std::numeric_limits<double>::epsilon();
85 if (!(is_rotated_around_y_axis || is_rotated_around_z_axis))
88 "2D Mesh {:s} is on an inclined plane, which is neither a vertical "
89 "nor horizontal plane that is required for the present "