GCC Code Coverage Report


Directory: src/oiseau/
File: src/oiseau/mesh/cell.hpp
Date: 2026-04-16 00:52:28
Exec Total Coverage
Lines: 3 4 75.0%
Functions: 3 4 75.0%
Branches: 0 0 -%

Line Branch Exec Source
1 // Copyright (C) 2025 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 <array>
10 #include <cstddef>
11 #include <string>
12 #include <string_view>
13 #include <utility>
14 #include <vector>
15
16 namespace oiseau::mesh {
17
18 class Cell;
19 using CellType = const Cell *;
20
21 enum class CellKind {
22 Undefined = 0,
23 Point,
24 Interval,
25 Triangle,
26 Quadrilateral,
27 Tetrahedron,
28 Hexahedron
29 };
30
31 CellType get_cell_type(const CellKind cell);
32
33 class Cell {
34 protected:
35 CellKind m_kind;
36 std::string m_name;
37 int m_dim;
38 std::vector<std::vector<std::vector<std::vector<int>>>> m_topology;
39 std::pair<std::vector<double>, std::array<std::size_t, 2>> m_geometry;
40 CellType m_facet = nullptr;
41 CellType m_edge = nullptr;
42
43 public:
44 34 virtual ~Cell() = default;
45 1 virtual CellType facet() { return m_facet; };
46 1 virtual CellType edge() { return m_edge; };
47 std::string_view name() const;
48 int dimension() const;
49 int num_entities(int dim) const;
50 std::vector<std::vector<int>> get_entity_vertices(int dim) const;
51 std::vector<std::vector<int>> get_sub_entities(int dim0, int dim1) const;
52 const std::vector<std::vector<std::vector<std::vector<int>>>> &topology() const {
53 return m_topology;
54 }
55 int num_sub_entities(int dim) const;
56 CellKind kind() const { return m_kind; }
57 };
58
59 class PointCell : public Cell {
60 public:
61 PointCell();
62 };
63
64 class IntervalCell : public Cell {
65 public:
66 IntervalCell();
67 };
68
69 class TriangleCell : public Cell {
70 private:
71 public:
72 TriangleCell();
73 };
74
75 class QuadrilateralCell : public Cell {
76 public:
77 QuadrilateralCell();
78 };
79
80 class TetrahedronCell : public Cell {
81 public:
82 TetrahedronCell();
83 };
84
85 class HexahedronCell : public Cell {
86 public:
87 HexahedronCell();
88 };
89
90 } // namespace oiseau::mesh
91