29 std::array<MeshLib::Node, N>
const& nodes)
31 double min_angle(2 * std::numbers::pi);
32 double max_angle(0.0);
34 for (
decltype(N) i = 0; i < N; ++i)
38 min_angle = std::min(angle, min_angle);
39 max_angle = std::max(angle, max_angle);
41 return {min_angle, max_angle};
65 std::array<double, 4> min;
66 std::array<double, 4> max;
67 for (
auto face_number = 0; face_number < 4; ++face_number)
69 std::unique_ptr<MeshLib::Element const> face{elem.
getFace(face_number)};
70 std::array
const nodes = {*face->getNode(0), *face->getNode(1),
72 std::tie(min[face_number], max[face_number]) =
getMinMaxAngle(nodes);
75 double const min_angle = *std::min_element(min.begin(), min.end());
76 double const max_angle = *std::max_element(max.begin(), max.end());
78 using namespace std::numbers;
79 return std::max((max_angle - pi / 3) / 2, (pi / 3 - min_angle)) * 3 / pi;
84 std::array<double, 6> min;
85 std::array<double, 6> max;
86 for (
auto face_number = 0; face_number < 6; ++face_number)
88 std::unique_ptr<MeshLib::Element const> face{elem.
getFace(face_number)};
89 std::array
const nodes = {*face->getNode(0), *face->getNode(1),
90 *face->getNode(2), *face->getNode(3)};
91 std::tie(min[face_number], max[face_number]) =
getMinMaxAngle(nodes);
94 double const min_angle = *std::min_element(min.begin(), min.end());
95 double const max_angle = *std::max_element(max.begin(), max.end());
97 using namespace std::numbers;
98 return std::max((max_angle - pi / 2), (pi / 2 - min_angle)) * 2 / pi;
104 std::unique_ptr<MeshLib::Element const> f0{elem.
getFace(0)};
105 std::array
const nodes_f0 = {*f0->getNode(0), *f0->getNode(1),
107 auto const& [min_angle_tri0, max_angle_tri0] =
getMinMaxAngle(nodes_f0);
110 std::unique_ptr<MeshLib::Element const> f4{elem.
getFace(4)};
111 std::array
const nodes_f4 = {*f4->getNode(0), *f4->getNode(1),
113 auto const& [min_angle_tri1, max_angle_tri1] =
getMinMaxAngle(nodes_f4);
115 auto const min_angle_tri = std::min(min_angle_tri0, min_angle_tri1);
116 auto const max_angle_tri = std::max(max_angle_tri0, max_angle_tri1);
118 using namespace std::numbers;
119 double const tri_criterion =
120 std::max((max_angle_tri - pi / 3) / 2, (pi / 3 - min_angle_tri)) * 3 /
123 std::array<double, 3> min;
124 std::array<double, 3> max;
125 for (
int i = 1; i < 4; ++i)
127 std::unique_ptr<MeshLib::Element const> f{elem.
getFace(i)};
128 std::array
const nodes = {*f->getNode(0), *f->getNode(1),
129 *f->getNode(2), *f->getNode(3)};
133 double const min_angle_quad = *std::min_element(min.begin(), min.end());
134 double const max_angle_quad = *std::max_element(max.begin(), max.end());
136 using namespace std::numbers;
137 double const quad_criterion =
138 std::max((max_angle_quad - pi / 2), (pi / 2 - min_angle_quad)) * 2 / pi;
140 return std::min(tri_criterion, quad_criterion);