OISEAU
A modern DGTD framework
Loading...
Searching...
No Matches
dg_geometry.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
9#include <array>
10#include <cstddef>
11#include <optional>
12#include <vector>
13
14#include "oiseau/mesh/mesh.hpp"
15
16namespace oiseau::dg {
17
25 public:
27 struct FaceGeometry {
29 std::array<double, 3> outward_normal{};
34 double measure = 0.0;
39 double surface_jacobian = 0.0;
40 };
41
43 struct CellGeometry {
45 std::size_t mesh_cell_index = 0;
47 std::size_t dimension = 0;
53 std::array<double, 9> jacobian{};
58 std::array<double, 9> inverse_jacobian{};
63 double determinant = 0.0;
65 std::vector<FaceGeometry> faces;
66 };
67
75 explicit DGGeometry(const mesh::Mesh& mesh);
76
78 const mesh::Mesh& mesh() const { return m_mesh; }
84 bool has_cell(std::size_t mesh_cell_index) const;
91 const CellGeometry& cell(std::size_t mesh_cell_index) const;
92
93 private:
94 const mesh::Mesh& m_mesh;
95 std::vector<std::optional<CellGeometry>> m_cells;
96};
97
98} // namespace oiseau::dg
const mesh::Mesh & mesh() const
Returns the source mesh.
Definition dg_geometry.hpp:78
DGGeometry(const mesh::Mesh &mesh)
Computes geometric factors for the mesh's top-dimensional cells.
Definition dg_geometry.cpp:382
bool has_cell(std::size_t mesh_cell_index) const
Checks whether geometric data exists for a mesh cell.
Definition dg_geometry.cpp:406
const CellGeometry & cell(std::size_t mesh_cell_index) const
Returns geometric data for a mesh cell.
Definition dg_geometry.cpp:410
Definition mesh.hpp:15
Geometric data for one top-dimensional mesh cell.
Definition dg_geometry.hpp:43
std::array< double, 9 > inverse_jacobian
Inverse Jacobian in padded row-major 3 by 3 storage.
Definition dg_geometry.hpp:58
std::size_t mesh_cell_index
Index of this cell in the source mesh.
Definition dg_geometry.hpp:45
std::array< double, 9 > jacobian
Jacobian mapping reference coordinates to physical coordinates.
Definition dg_geometry.hpp:53
double determinant
Signed Jacobian determinant.
Definition dg_geometry.hpp:63
std::size_t dimension
Topological dimension of this cell.
Definition dg_geometry.hpp:47
std::vector< FaceGeometry > faces
Face geometry in the cell type's local face order.
Definition dg_geometry.hpp:65
Geometric data for one cell face.
Definition dg_geometry.hpp:27
double surface_jacobian
Ratio of physical to reference face measure.
Definition dg_geometry.hpp:39
std::array< double, 3 > outward_normal
Outward unit normal, padded to three coordinates.
Definition dg_geometry.hpp:29
double measure
Physical face measure.
Definition dg_geometry.hpp:34