GCC Code Coverage Report


Directory: src/oiseau/
File: src/oiseau/dg/nodal/ref_element.hpp
Date: 2026-11-23 22:30:49
Exec Total Coverage
Lines: 10 10 100.0%
Functions: 8 8 100.0%
Branches: 6 10 60.0%

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 <memory>
10 #include <stdexcept>
11 #include <xtensor/containers/xarray.hpp>
12
13 #include "xtensor/core/xtensor_forward.hpp"
14
15 namespace oiseau::dg::nodal {
16
17 enum class RefElementType { Line, Triangle, Quadrilateral, Tetrahedron, Hexahedron };
18
19 class RefElement {
20 public:
21 366 virtual ~RefElement() = default;
22
23 303 inline const xt::xarray<double>& v() const { return m_v; }
24 390 inline const xt::xarray<double>& gv() const { return m_gv; }
25 63 inline const xt::xarray<double>& d() const { return m_d; }
26 1545 inline const xt::xarray<double>& r() const { return m_r; }
27
28 xt::xarray<double> mass() const;
29 xt::xarray<double> inv_mass() const;
30 xt::xarray<double> inv_v() const;
31
32 25 inline unsigned order() const { return m_order; }
33 120 inline unsigned number_of_nodes() const { return m_np; }
34 inline unsigned number_of_face_nodes() const { return m_nfp; }
35
36 virtual xt::xarray<double> vandermonde(const xt::xarray<double>&) const = 0;
37
38 protected:
39
3/6
✓ Branch 2 taken 184 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 184 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 184 times.
✗ Branch 9 not taken.
184 explicit RefElement(unsigned order) : m_order(order) {
40
3/4
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 183 times.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
184 if (order == 0) throw std::invalid_argument("Order must be greater than 0");
41 187 }
42
43 unsigned m_order;
44 unsigned m_np{};
45 unsigned m_nfp{};
46 xt::xarray<double> m_v;
47 xt::xarray<double> m_gv;
48 xt::xarray<double> m_d;
49 xt::xarray<double> m_r;
50 };
51
52 std::shared_ptr<RefElement> get_ref_element(RefElementType type, unsigned order);
53
54 } // namespace oiseau::dg::nodal
55