OISEAU
A modern DGTD framework
Loading...
Searching...
No Matches
topology.hpp
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#include <cstddef>
9#include <span>
10#include <vector>
11
12#include "oiseau/mesh/cell.hpp"
13
14namespace oiseau::mesh {
15
16class Topology {
17 public:
18 Topology();
19 Topology(std::vector<std::vector<std::size_t>>&& conn, std::vector<CellType>&& cell_types);
20 Topology(Topology&&) = default;
21 Topology(const Topology&) = default;
22 Topology& operator=(Topology&&) = default;
23 Topology& operator=(const Topology&) = default;
24 ~Topology();
25 std::span<CellType> cell_types();
26 std::span<const CellType> cell_types() const;
27 std::span<std::vector<std::size_t>> conn();
28 std::span<const std::vector<std::size_t>> conn() const;
29 std::span<std::vector<std::size_t>> e_to_e();
30 std::span<std::vector<std::size_t>> e_to_f();
31 std::size_t n_cells() const;
32 int dimension() const;
33 void calculate_connectivity();
34
35 private:
36 std::vector<std::vector<std::size_t>> m_conn;
37 std::vector<std::vector<std::size_t>> m_e_to_v;
38 std::vector<std::vector<std::size_t>> m_e_to_e;
39 std::vector<std::vector<std::size_t>> m_e_to_f;
40 std::vector<CellType> m_cell_types;
41 mutable int m_dimension = -1;
42};
43
44} // namespace oiseau::mesh