GCC Code Coverage Report


Directory: src/oiseau/
File: src/oiseau/dg/ref_element_type.hpp
Date: 2026-11-23 22:30:49
Exec Total Coverage
Lines: 14 14 100.0%
Functions: 1 1 100.0%
Branches: 7 8 87.5%

Line Branch Exec Source
1 // Copyright (C) 2026 Tiago V. L. Amorim (@tiagovla)
2 //
3 // This file is part of oiseau (https://github.com/tiagovla/oiseau)
4 //
5 // SPDX-License-Identifier: GPL-3.0-or-later
6
7 #pragma once
8
9 #include <stdexcept>
10
11 #include "oiseau/dg/nodal/ref_element.hpp"
12 #include "oiseau/mesh/cell.hpp"
13
14 namespace oiseau::dg {
15
16 /**
17 * @brief Returns the nodal reference element type for a mesh cell kind.
18 * @param kind Mesh cell kind to convert.
19 * @return Matching nodal reference element type.
20 * @throws std::invalid_argument If the cell kind is unsupported.
21 */
22 744 inline nodal::RefElementType ref_type_for(mesh::CellKind kind) {
23
6/6
✓ Branch 0 taken 517 times.
✓ Branch 1 taken 119 times.
✓ Branch 2 taken 75 times.
✓ Branch 3 taken 27 times.
✓ Branch 4 taken 4 times.
✓ Branch 5 taken 2 times.
744 switch (kind) {
24 517 case mesh::CellKind::Interval:
25 517 return nodal::RefElementType::Line;
26 119 case mesh::CellKind::Triangle:
27 119 return nodal::RefElementType::Triangle;
28 75 case mesh::CellKind::Quadrilateral:
29 75 return nodal::RefElementType::Quadrilateral;
30 27 case mesh::CellKind::Tetrahedron:
31 27 return nodal::RefElementType::Tetrahedron;
32 4 case mesh::CellKind::Hexahedron:
33 4 return nodal::RefElementType::Hexahedron;
34 2 default:
35
1/2
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
2 throw std::invalid_argument("Unsupported mesh cell kind for DG reference element");
36 }
37 }
38
39 } // namespace oiseau::dg
40