GCC Code Coverage Report


Directory: src/oiseau/
File: src/oiseau/dg/nodal/ref_element.hpp
Date: 2025-05-24 01:28:39
Exec Total Coverage
Lines: 8 8 100.0%
Functions: 6 6 100.0%
Branches: 6 10 60.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 <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 156 virtual ~RefElement() = default;
22
23 14 inline const xt::xarray<double>& v() const { return m_v; }
24 inline const xt::xarray<double>& gv() const { return m_gv; }
25 inline const xt::xarray<double>& d() const { return m_d; }
26 74 inline const xt::xarray<double>& r() const { return m_r; }
27
28 25 inline unsigned order() const { return m_order; }
29 25 inline unsigned number_of_nodes() const { return m_np; }
30 inline unsigned number_of_face_nodes() const { return m_nfp; }
31
32 virtual xt::xarray<double> vandermonde(const xt::xarray<double>&) const = 0;
33
34 protected:
35
3/6
✓ Branch 2 taken 79 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 79 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 79 times.
✗ Branch 9 not taken.
79 explicit RefElement(unsigned order) : m_order(order) {
36
3/4
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 78 times.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
79 if (order == 0) throw std::invalid_argument("Order must be greater than 0");
37 82 }
38
39 unsigned m_order;
40 unsigned m_np{};
41 unsigned m_nfp{};
42 xt::xarray<double> m_v;
43 xt::xarray<double> m_gv;
44 xt::xarray<double> m_d;
45 xt::xarray<double> m_r;
46 };
47
48 std::shared_ptr<RefElement> get_ref_element(RefElementType type, unsigned order);
49
50 } // namespace oiseau::dg::nodal
51