hp-FEM
Adaptive hp-FEM suite for nano-optics
Loading...
Searching...
No Matches
hypercircle.hpp
Go to the documentation of this file.
1#pragma once
26#include <span>
27#include <type_traits>
28#include <vector>
29
33#include "hpfem/core/types.hpp"
36
37namespace hpfem::adaptivity {
38
40template <int Dim>
41using DualDofMap = std::conditional_t<Dim == 2, fespace::DofMap<2>, fespace::NedelecDofMap<3>>;
43template <int Dim>
44using DualForm = std::conditional_t<Dim == 2, assembly::ScalarForm<2>, assembly::MaxwellForm<3>>;
45
52template <int Dim>
53[[nodiscard]] DualForm<Dim> dual_form(const assembly::MaxwellForm<Dim>& primal, Real k_squared);
54
67template <int Dim>
68[[nodiscard]] Vector dual_solution(
69 const DualDofMap<Dim>& dual_dofs,
70 const std::type_identity_t<assembly::CellFormFactory<Dim>>& form_of_cell, Real k_squared,
71 std::span<const Index> essential_facets = {},
72 std::span<const assembly::PeriodicPair<Dim>> periodic = {}, int extra_order = 2,
74
79 [[nodiscard]] Real sum() const noexcept { return constitutive + equilibrium; }
80};
81
84 std::vector<Real> indicators;
85 std::vector<HypercircleParts> parts;
87 [[nodiscard]] Real total() const;
89 [[nodiscard]] Index argmax() const;
90};
91
102template <int Dim>
104 const fespace::NedelecDofMap<Dim>& dofs, const Vector& e_h, const DualDofMap<Dim>& dual_dofs,
105 const Vector& sigma_h, const std::type_identity_t<assembly::CellFormFactory<Dim>>& form_of_cell,
106 Real k_squared, int extra_order = 2);
107
111 Real, std::span<const Index>,
112 std::span<const assembly::PeriodicPair<2>>, int,
115 Real, std::span<const Index>,
116 std::span<const assembly::PeriodicPair<3>>, int,
119 const Vector&, const DualDofMap<2>&,
120 const Vector&,
122 Real, int);
124 const Vector&, const DualDofMap<3>&,
125 const Vector&,
127 Real, int);
128
129} // namespace hpfem::adaptivity
Definition dof_map.hpp:51
Definition axisymmetric_estimator.hpp:39
std::conditional_t< Dim==2, fespace::DofMap< 2 >, fespace::NedelecDofMap< 3 > > DualDofMap
Space of the dual unknown: H1 in 2D (scalar curl), Nédélec in 3D.
Definition hypercircle.hpp:41
HypercircleEstimate hypercircle_estimate(const fespace::NedelecDofMap< Dim > &dofs, const Vector &e_h, const DualDofMap< Dim > &dual_dofs, const Vector &sigma_h, const std::type_identity_t< assembly::CellFormFactory< Dim > > &form_of_cell, Real k_squared, int extra_order=2)
DualForm< Dim > dual_form(const assembly::MaxwellForm< Dim > &primal, Real k_squared)
template HypercircleEstimate hypercircle_estimate< 3 >(const fespace::NedelecDofMap< 3 > &, const Vector &, const DualDofMap< 3 > &, const Vector &, const assembly::CellFormFactory< 3 > &, Real, int)
Vector dual_solution(const DualDofMap< Dim > &dual_dofs, const std::type_identity_t< assembly::CellFormFactory< Dim > > &form_of_cell, Real k_squared, std::span< const Index > essential_facets={}, std::span< const assembly::PeriodicPair< Dim > > periodic={}, int extra_order=2, solvers::DirectSolverBackend backend=solvers::DirectSolverBackend::kAuto)
template HypercircleEstimate hypercircle_estimate< 2 >(const fespace::NedelecDofMap< 2 > &, const Vector &, const DualDofMap< 2 > &, const Vector &, const assembly::CellFormFactory< 2 > &, Real, int)
template DualForm< 2 > dual_form< 2 >(const assembly::MaxwellForm< 2 > &, Real)
template Vector dual_solution< 2 >(const DualDofMap< 2 > &, const assembly::CellFormFactory< 2 > &, Real, std::span< const Index >, std::span< const assembly::PeriodicPair< 2 > >, int, solvers::DirectSolverBackend)
std::conditional_t< Dim==2, assembly::ScalarForm< 2 >, assembly::MaxwellForm< 3 > > DualForm
Per-cell form of the dual problem in the units of the respective assembler.
Definition hypercircle.hpp:44
template Vector dual_solution< 3 >(const DualDofMap< 3 > &, const assembly::CellFormFactory< 3 > &, Real, std::span< const Index >, std::span< const assembly::PeriodicPair< 3 > >, int, solvers::DirectSolverBackend)
template DualForm< 3 > dual_form< 3 >(const assembly::MaxwellForm< 3 > &, Real)
std::function< MaxwellForm< Dim >(Index)> CellFormFactory
Definition maxwell_forms.hpp:97
DirectSolverBackend
Direct solver backends.
Definition linear_solver.hpp:70
double Real
Definition types.hpp:15
std::int64_t Index
global indices (DoFs, entities)
Definition types.hpp:17
Eigen::Matrix< Complex, Eigen::Dynamic, 1 > Vector
Definition types.hpp:20
Element indicators of a primal/dual pair.
Definition hypercircle.hpp:83
std::vector< HypercircleParts > parts
Definition hypercircle.hpp:85
Real total() const
Global bound .
Index argmax() const
Cell with the largest indicator (kInvalidIndex if there are none).
std::vector< Real > indicators
η_K per cell
Definition hypercircle.hpp:84
Squared contributions of the two constitutive relations of one cell.
Definition hypercircle.hpp:76
Real equilibrium
‖(k²ε)⁻¹(curl σ_h − f) − E_h‖²_{−k²ε}
Definition hypercircle.hpp:78
Real sum() const noexcept
Definition hypercircle.hpp:79
Real constitutive
‖σ_h − (μ⁻¹ curl E_h − g)‖²_μ
Definition hypercircle.hpp:77
Definition maxwell_forms.hpp:58
Definition periodic.hpp:34