19 if (mesh_dimension != 2)
22 "A 2D mesh is required for this computation but the provided mesh, "
23 "mesh {:s}, has {:d}D elements.",
24 mesh.
getName(), mesh_dimension);
29 bool const has_inclined_element =
30 std::any_of(elements.begin(), elements.end(),
31 [&mesh_dimension](
auto const& element)
32 { return element->space_dimension_ != mesh_dimension; });
34 if (!has_inclined_element)
39 const bool is_rotated_around_y_axis = std::all_of(
40 elements.cbegin(), elements.cend(),
41 [](
auto const& element)
44 auto const x1 = element->getNode(0)->data();
45 auto const x2 = element->getNode(1)->data();
46 auto const x3 = element->getNode(2)->data();
48 double const a0 = x2[0] - x1[0];
49 double const a2 = x2[2] - x1[2];
51 double const b0 = x3[0] - x1[0];
52 double const b2 = x3[2] - x1[2];
54 double const e_n_1 = -a0 * b2 + a2 * b0;
55 return std::fabs(e_n_1) < std::numeric_limits<double>::epsilon();
58 const bool is_rotated_around_z_axis = std::all_of(
59 elements.cbegin(), elements.cend(),
60 [](
auto const& element)
63 auto const x1 = element->getNode(0)->data();
64 auto const x2 = element->getNode(1)->data();
65 auto const x3 = element->getNode(2)->data();
67 double const a0 = x2[0] - x1[0];
68 double const a1 = x2[1] - x1[1];
70 double const b0 = x3[0] - x1[0];
71 double const b1 = x3[1] - x1[1];
73 double const e_n_2 = a0 * b1 - a1 * b0;
74 return std::fabs(e_n_2) < std::numeric_limits<double>::epsilon();
77 if (!(is_rotated_around_y_axis || is_rotated_around_z_axis))
80 "2D Mesh {:s} is on an inclined plane, which is neither a vertical "
81 "nor horizontal plane that is required for the present "