hp-FEM
Adaptive hp-FEM suite for nano-optics
Loading...
Searching...
No Matches
subdivision.hpp
Go to the documentation of this file.
1#pragma once
6
7#include <vector>
8
10#include "hpfem/mesh/mesh.hpp"
11
12namespace hpfem::mesh {
13
19template <int Dim>
20struct Subdivided {
22 std::vector<Index> parent_cell;
23 std::vector<Index> vertex_parent;
24 std::vector<Point<Dim>> vertex_xi;
25
28 [[nodiscard]] static constexpr Index vertices_per_cell(int n) noexcept {
29 const Index m = n;
30 return Dim == 2 ? (m + 1) * (m + 2) / 2 : (m + 1) * (m + 2) * (m + 3) / 6;
31 }
33 [[nodiscard]] static constexpr Index cells_per_cell(int n) noexcept {
34 const Index m = n;
35 return Dim == 2 ? m * m : m * m * m;
36 }
37};
38
46template <int Dim>
47[[nodiscard]] Subdivided<Dim> subdivide(const Mesh<Dim>& mesh, int n);
48
49extern template struct Subdivided<2>;
50extern template struct Subdivided<3>;
51extern template Subdivided<2> subdivide<2>(const Mesh<2>&, int);
52extern template Subdivided<3> subdivide<3>(const Mesh<3>&, int);
53
54} // namespace hpfem::mesh
Definition mesh.hpp:61
Definition adaptive_mesh.hpp:19
template Subdivided< 3 > subdivide< 3 >(const Mesh< 3 > &, int)
Subdivided< Dim > subdivide(const Mesh< Dim > &mesh, int n)
template Subdivided< 2 > subdivide< 2 >(const Mesh< 2 > &, int)
std::int64_t Index
global indices (DoFs, entities)
Definition types.hpp:17
Definition subdivision.hpp:20
std::vector< Index > vertex_parent
parent cell of every sub-vertex
Definition subdivision.hpp:23
static constexpr Index vertices_per_cell(int n) noexcept
Definition subdivision.hpp:28
static constexpr Index cells_per_cell(int n) noexcept
Sub-simplices per parent cell: .
Definition subdivision.hpp:33
Mesh< Dim > mesh
Definition subdivision.hpp:21
std::vector< Point< Dim > > vertex_xi
reference coordinates of every sub-vertex in its parent
Definition subdivision.hpp:24
std::vector< Index > parent_cell
parent of every sub-cell
Definition subdivision.hpp:22