hp-FEM
Adaptive hp-FEM suite for nano-optics
Loading...
Searching...
No Matches
Classes | Typedefs | Functions
hpfem::adaptivity Namespace Reference

Classes

struct  ElasticFacetCondition
 The natural condition on one boundary facet. More...
 
struct  Estimate
 Element indicators of one discrete solution. More...
 
struct  EstimatorOptions
 
struct  HpDecision
 Marked cells split by the smoothness indicator. More...
 
struct  HpStep
 Result of an hp-refinement step: the mesh relation and the orders of the new cells. More...
 
struct  HypercircleEstimate
 Element indicators of a primal/dual pair. More...
 
struct  HypercircleParts
 Squared contributions of the two constitutive relations of one cell. More...
 
struct  PredictionOptions
 
struct  ResidualParts
 Squared contributions of the four residual terms of one cell. More...
 
struct  SmoothnessOptions
 

Typedefs

template<int Dim>
using ElasticBoundaryFactory = std::function< ElasticFacetCondition< Dim >(Index facet)>
 The condition of a boundary facet by its id.
 
template<int Dim>
using DualDofMap = std::conditional_t< Dim==2, fespace::DofMap< 2 >, fespace::NedelecDofMap< 3 > >
 Space of the dual unknown: H1 in 2D (scalar curl), Nédélec in 3D.
 
template<int Dim>
using DualForm = std::conditional_t< Dim==2, assembly::ScalarForm< 2 >, assembly::MaxwellForm< 3 > >
 Per-cell form of the dual problem in the units of the respective assembler.
 

Functions

Estimate axisymmetric_residual_estimate (const fespace::NedelecDofMap< 2 > &nedelec, const fespace::DofMap< 2 > &h1, const Vector &meridian, const Vector &azimuthal, int m, Real k_squared, const assembly::AxisymmetricFormFactory &form_of_cell, const EstimatorOptions &options={})
 
Estimate conical_residual_estimate (const fespace::NedelecDofMap< 2 > &transverse, const fespace::DofMap< 2 > &longitudinal, const Vector &e, const Vector &v, Real beta, Real k_squared, const assembly::ConicalFormFactory &form_of_cell, const EstimatorOptions &options={}, std::span< const assembly::PeriodicPair< 2 > > periodic={})
 
std::vector< Complex > conical_weighted_residual (const fespace::NedelecDofMap< 2 > &transverse, const fespace::DofMap< 2 > &longitudinal, const Vector &e, const Vector &v, Real beta, Real k_squared, const assembly::ConicalFormFactory &form_of_cell, const fespace::NedelecDofMap< 2 > &weight_transverse, const fespace::DofMap< 2 > &weight_longitudinal, const Vector &weight_e, const Vector &weight_v, const EstimatorOptions &options={})
 
template<int Dim>
Estimate elasticity_residual_estimate (const fespace::DofMap< Dim > &dofs, const Vector &u, const std::type_identity_t< assembly::ElasticFormFactory< Dim > > &form_of_cell, const std::type_identity_t< ElasticBoundaryFactory< Dim > > &boundary, const EstimatorOptions &options={})
 
Estimate axisymmetric_elasticity_residual_estimate (const fespace::DofMap< 2 > &dofs, const Vector &u, const assembly::AxisymmetricElasticFormFactory &form_of_cell, const ElasticBoundaryFactory< 2 > &boundary, const EstimatorOptions &options={})
 
template Estimate elasticity_residual_estimate< 2 > (const fespace::DofMap< 2 > &, const Vector &, const assembly::ElasticFormFactory< 2 > &, const ElasticBoundaryFactory< 2 > &, const EstimatorOptions &)
 
template Estimate elasticity_residual_estimate< 3 > (const fespace::DofMap< 3 > &, const Vector &, const assembly::ElasticFormFactory< 3 > &, const ElasticBoundaryFactory< 3 > &, const EstimatorOptions &)
 
template<int Dim>
DualForm< Dim > dual_form (const assembly::MaxwellForm< Dim > &primal, Real k_squared)
 
template<int Dim>
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<int Dim>
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)
 
template DualForm< 2 > dual_form< 2 > (const assembly::MaxwellForm< 2 > &, Real)
 
template DualForm< 3 > dual_form< 3 > (const assembly::MaxwellForm< 3 > &, 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)
 
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 HypercircleEstimate hypercircle_estimate< 2 > (const fespace::NedelecDofMap< 2 > &, const Vector &, const DualDofMap< 2 > &, const Vector &, const assembly::CellFormFactory< 2 > &, Real, int)
 
template HypercircleEstimate hypercircle_estimate< 3 > (const fespace::NedelecDofMap< 3 > &, const Vector &, const DualDofMap< 3 > &, const Vector &, const assembly::CellFormFactory< 3 > &, Real, int)
 
std::vector< Index > dorfler_marking (std::span< const Real > indicators, Real theta)
 
std::vector< Index > maximum_marking (std::span< const Real > indicators, Real gamma)
 
std::vector< Real > predict_indicators (std::span< const Real > indicators, std::span< const int > orders, const HpStep &hp, const PredictionOptions &options={})
 
HpDecision hp_decide_by_prediction (std::span< const Real > indicators, std::span< const Real > predicted, std::span< const Index > marked)
 
std::vector< int > p_refine (std::span< const int > orders, std::span< const Index > marked, int increment=1, int max_order=0)
 
template<int Dim>
HpStep hp_refine (mesh::AdaptiveMesh< Dim > &mesh, std::span< const int > orders, std::span< const Index > h_marked, std::span< const Index > p_marked, int increment=1, int max_order=0, bool spread_p=true)
 
mesh::RefinementStep identity_step (Index num_cells)
 The step relating a mesh to itself (pure p-refinement), for assembly::prolongate.
 
template<int Dim>
std::vector< mesh::RefinementStep > refine_at_points (mesh::AdaptiveMesh< Dim > &mesh, std::span< const Point< Dim > > points, int levels, Real tolerance=1e-9)
 
template std::vector< mesh::RefinementStep > refine_at_points< 2 > (mesh::AdaptiveMesh< 2 > &, std::span< const Point< 2 > >, int, Real)
 
template std::vector< mesh::RefinementStep > refine_at_points< 3 > (mesh::AdaptiveMesh< 3 > &, std::span< const Point< 3 > >, int, Real)
 
template HpStep hp_refine< 2 > (mesh::AdaptiveMesh< 2 > &, std::span< const int >, std::span< const Index >, std::span< const Index >, int, int, bool)
 
template HpStep hp_refine< 3 > (mesh::AdaptiveMesh< 3 > &, std::span< const int >, std::span< const Index >, std::span< const Index >, int, int, bool)
 
template<int Dim>
Estimate residual_estimate (const fespace::NedelecDofMap< Dim > &dofs, const Vector &e_h, Real k_squared, const std::type_identity_t< assembly::CellFormFactory< Dim > > &form_of_cell, const EstimatorOptions &options={}, std::span< const assembly::PeriodicPair< Dim > > periodic={})
 
template<int Dim>
std::vector< Complex > weighted_residual (const fespace::NedelecDofMap< Dim > &dofs, const Vector &e_h, Real k_squared, const std::type_identity_t< assembly::CellFormFactory< Dim > > &form_of_cell, const fespace::NedelecDofMap< Dim > &weight_dofs, const Vector &weight, const EstimatorOptions &options={})
 
template std::vector< Complex > weighted_residual< 2 > (const fespace::NedelecDofMap< 2 > &, const Vector &, Real, const assembly::CellFormFactory< 2 > &, const fespace::NedelecDofMap< 2 > &, const Vector &, const EstimatorOptions &)
 
template std::vector< Complex > weighted_residual< 3 > (const fespace::NedelecDofMap< 3 > &, const Vector &, Real, const assembly::CellFormFactory< 3 > &, const fespace::NedelecDofMap< 3 > &, const Vector &, const EstimatorOptions &)
 
template Estimate residual_estimate< 2 > (const fespace::NedelecDofMap< 2 > &, const Vector &, Real, const assembly::CellFormFactory< 2 > &, const EstimatorOptions &, std::span< const assembly::PeriodicPair< 2 > >)
 
template Estimate residual_estimate< 3 > (const fespace::NedelecDofMap< 3 > &, const Vector &, Real, const assembly::CellFormFactory< 3 > &, const EstimatorOptions &, std::span< const assembly::PeriodicPair< 3 > >)
 
template<int Dim, class Counts >
std::vector< Real > coefficient_decay (const fespace::EntityDofMap< Dim, Counts > &dofs, const Vector &u, std::span< const Index > cells, const SmoothnessOptions &options={})
 
template<int Dim, class Counts >
HpDecision hp_decide (const fespace::EntityDofMap< Dim, Counts > &dofs, const Vector &u, std::span< const Index > marked, const SmoothnessOptions &options={})
 
template std::vector< Real > coefficient_decay< 2, fespace::H1Counts > (const fespace::DofMap< 2 > &, const Vector &, std::span< const Index >, const SmoothnessOptions &)
 
template std::vector< Real > coefficient_decay< 3, fespace::H1Counts > (const fespace::DofMap< 3 > &, const Vector &, std::span< const Index >, const SmoothnessOptions &)
 
template std::vector< Real > coefficient_decay< 2, fespace::NedelecCounts > (const fespace::NedelecDofMap< 2 > &, const Vector &, std::span< const Index >, const SmoothnessOptions &)
 
template std::vector< Real > coefficient_decay< 3, fespace::NedelecCounts > (const fespace::NedelecDofMap< 3 > &, const Vector &, std::span< const Index >, const SmoothnessOptions &)
 
template HpDecision hp_decide< 2, fespace::H1Counts > (const fespace::DofMap< 2 > &, const Vector &, std::span< const Index >, const SmoothnessOptions &)
 
template HpDecision hp_decide< 3, fespace::H1Counts > (const fespace::DofMap< 3 > &, const Vector &, std::span< const Index >, const SmoothnessOptions &)
 
template HpDecision hp_decide< 2, fespace::NedelecCounts > (const fespace::NedelecDofMap< 2 > &, const Vector &, std::span< const Index >, const SmoothnessOptions &)
 
template HpDecision hp_decide< 3, fespace::NedelecCounts > (const fespace::NedelecDofMap< 3 > &, const Vector &, std::span< const Index >, const SmoothnessOptions &)
 

Typedef Documentation

◆ DualDofMap

template<int Dim>
using hpfem::adaptivity::DualDofMap = typedef std::conditional_t<Dim == 2, fespace::DofMap<2>, fespace::NedelecDofMap<3> >

Space of the dual unknown: H1 in 2D (scalar curl), Nédélec in 3D.

◆ DualForm

template<int Dim>
using hpfem::adaptivity::DualForm = typedef std::conditional_t<Dim == 2, assembly::ScalarForm<2>, assembly::MaxwellForm<3> >

Per-cell form of the dual problem in the units of the respective assembler.

◆ ElasticBoundaryFactory

template<int Dim>
using hpfem::adaptivity::ElasticBoundaryFactory = typedef std::function<ElasticFacetCondition<Dim>(Index facet)>

The condition of a boundary facet by its id.

Function Documentation

◆ axisymmetric_elasticity_residual_estimate()

Estimate hpfem::adaptivity::axisymmetric_elasticity_residual_estimate ( const fespace::DofMap< 2 > &  dofs,
const Vector &  u,
const assembly::AxisymmetricElasticFormFactory &  form_of_cell,
const ElasticBoundaryFactory< 2 > &  boundary,
const EstimatorOptions &  options = {} 
)

The same for the axisymmetric problem on the meridian half-plane x = r ≥ 0, y = z (the block (u_r | u_z), assembly::assemble_axisymmetric_elasticity): all integrals with the weight r, the hoop stress in the radial equilibrium, boundary facets on the axis r = 0 skipped (their weight vanishes; give them no natural component). Quadrature +2 on cells touching the axis.

Exceptions
InvalidArgumentas elasticity_residual_estimate.

◆ axisymmetric_residual_estimate()

Estimate hpfem::adaptivity::axisymmetric_residual_estimate ( const fespace::NedelecDofMap< 2 > &  nedelec,
const fespace::DofMap< 2 > &  h1,
const Vector &  meridian,
const Vector &  azimuthal,
int  m,
Real  k_squared,
const assembly::AxisymmetricFormFactory &  form_of_cell,
const EstimatorOptions &  options = {} 
)

Indicators of the order-m field with the coefficients meridian (E_r, E_z on the Nédélec map) and azimuthal (v on the H1 map) for the problem given by the per-cell forms ( \( \mu^{-1}, \varepsilon, f \) of assembly::AxisymmetricForm) and the mass coefficient k_squared (k0² with relative tensors). Quadrature of degree 2p + options.extra_order (+2 on cells touching the axis and on curved cells) or the cell's own quadrature_order; derivatives by central differences in reference coordinates (options.difference_step) as in residual_estimate. Cost: a few basis evaluations per quadrature point on every cell and interior facet, parallel over cells and facets.

Exceptions
InvalidArgumentif the maps differ in mesh, a coefficient vector does not match its map, or the difference step is not positive.

◆ coefficient_decay()

template<int Dim, class Counts >
std::vector< Real > hpfem::adaptivity::coefficient_decay ( const fespace::EntityDofMap< Dim, Counts > &  dofs,
const Vector &  u,
std::span< const Index >  cells,
const SmoothnessOptions &  options = {} 
)

Decay rates \( \sigma_K \) of the listed cells; +∞ if the highest degree carries no energy (the field is a polynomial of lower degree, represented exactly) or only one degree does. O(#cells · p^Dim · quadrature points).

Exceptions
InvalidArgumentif u does not match the DoF map or a cell is out of range.

◆ coefficient_decay< 2, fespace::H1Counts >()

template std::vector< Real > hpfem::adaptivity::coefficient_decay< 2, fespace::H1Counts > ( const fespace::DofMap< 2 > &  ,
const Vector &  ,
std::span< const Index >  ,
const SmoothnessOptions &   
)
extern

◆ coefficient_decay< 2, fespace::NedelecCounts >()

template std::vector< Real > hpfem::adaptivity::coefficient_decay< 2, fespace::NedelecCounts > ( const fespace::NedelecDofMap< 2 > &  ,
const Vector &  ,
std::span< const Index >  ,
const SmoothnessOptions &   
)
extern

◆ coefficient_decay< 3, fespace::H1Counts >()

template std::vector< Real > hpfem::adaptivity::coefficient_decay< 3, fespace::H1Counts > ( const fespace::DofMap< 3 > &  ,
const Vector &  ,
std::span< const Index >  ,
const SmoothnessOptions &   
)
extern

◆ coefficient_decay< 3, fespace::NedelecCounts >()

template std::vector< Real > hpfem::adaptivity::coefficient_decay< 3, fespace::NedelecCounts > ( const fespace::NedelecDofMap< 3 > &  ,
const Vector &  ,
std::span< const Index >  ,
const SmoothnessOptions &   
)
extern

◆ conical_residual_estimate()

Estimate hpfem::adaptivity::conical_residual_estimate ( const fespace::NedelecDofMap< 2 > &  transverse,
const fespace::DofMap< 2 > &  longitudinal,
const Vector &  e,
const Vector &  v,
Real  beta,
Real  k_squared,
const assembly::ConicalFormFactory &  form_of_cell,
const EstimatorOptions &  options = {},
std::span< const assembly::PeriodicPair< 2 > >  periodic = {} 
)

Indicators of the conical field with the coefficients transverse (E_x, E_y on the Nédélec map) and longitudinal (v on the H1 map) for the problem given by the per-cell forms ( \( \mu^{-1}, \varepsilon, f \) of assembly::ConicalForm), the longitudinal wavenumber β and the mass coefficient k_squared (k0² with relative tensors). Quadrature of degree 2p + options.extra_order (+2 on curved cells) or the cell's own quadrature_order; derivatives by central differences in reference coordinates (options.difference_step) as in residual_estimate. Parallel over cells and facets.

Exceptions
InvalidArgumentif the maps differ in mesh, a coefficient vector does not match its map, or the difference step is not positive.

◆ conical_weighted_residual()

std::vector< Complex > hpfem::adaptivity::conical_weighted_residual ( const fespace::NedelecDofMap< 2 > &  transverse,
const fespace::DofMap< 2 > &  longitudinal,
const Vector &  e,
const Vector &  v,
Real  beta,
Real  k_squared,
const assembly::ConicalFormFactory &  form_of_cell,
const fespace::NedelecDofMap< 2 > &  weight_transverse,
const fespace::DofMap< 2 > &  weight_longitudinal,
const Vector &  weight_e,
const Vector &  weight_v,
const EstimatorOptions &  options = {} 
)

Weighted residual of the conical system for goal-oriented estimation: the cell contributions \( r_K(W) = \int_K R_K\cdot W + \tfrac12\sum_{F\subset\partial K}\int_F (n\times[\![w_h]\!])\cdot W \) (no conjugation) of a weight given as coefficients (weight_e on weight_transverse, weight_v on weight_longitudinal, both on the same mesh, e.g. the orders raised by one), with the physical test vector \( W = (W_x, W_y, -i\,w) \) of the scaled test function w (the pairing of the conical forms); boundary facets contribute their one-sided term to their cell, so that \( \sum_K r_K(W) = \ell(W) - a(E_h, W) \) for every tangentially continuous W.

Exceptions
InvalidArgumentfor mismatched maps or vectors.

◆ dorfler_marking()

std::vector< Index > hpfem::adaptivity::dorfler_marking ( std::span< const Real >  indicators,
Real  theta 
)

Dörfler (bulk) marking: the smallest set \( \mathcal M \) of cells, taken in descending order of the indicator, with \( \sum_{K\in\mathcal M}\eta_K^2 \ge \theta\sum_K\eta_K^2 \). Returns the marked cell ids ascending; empty if all indicators vanish. O(N log N).

Exceptions
InvalidArgumentunless 0 < θ ≤ 1.

◆ dual_form()

template<int Dim>
DualForm< Dim > hpfem::adaptivity::dual_form ( const assembly::MaxwellForm< Dim > &  primal,
Real  k_squared 
)

The dual form of one cell: coefficients \( (k^2\varepsilon)^{-1} \) (stiffness), \( \mu \) (mass, entering as permittivity with the mass coefficient 1 in 3D and as the reaction −μ in 2D), the sources \( \mu g \) and \( (k^2\varepsilon)^{-1} f \) (paired with the curl of the test function). Empty coefficient functions of primal mean the identity (μ⁻¹, ε) or zero (f, g).

Exceptions
InvalidArgumentif k² is zero.

◆ dual_form< 2 >()

template DualForm< 2 > hpfem::adaptivity::dual_form< 2 > ( const assembly::MaxwellForm< 2 > &  ,
Real   
)
extern

◆ dual_form< 3 >()

template DualForm< 3 > hpfem::adaptivity::dual_form< 3 > ( const assembly::MaxwellForm< 3 > &  ,
Real   
)
extern

◆ dual_solution()

template<int Dim>
Vector hpfem::adaptivity::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 
)

Galerkin solution of the dual problem on dual_dofs for the per-cell primal forms and the mass coefficient k² of the primal problem. essential_facets are the facets where the primal problem has the natural (PMC) condition: there the dual field has the essential one (tangential trace zero in 3D, value zero in 2D). Where the primal field is PEC nothing is imposed on the dual field. On a one-irregular mesh (mesh::AdaptiveMesh) the hanging DoFs of the dual space are constrained (assembly::hanging_constraints); periodic are the Bloch pairs of the primal problem, which the dual field inherits with the same phases ( \( \sigma = \mu^{-1}\nabla\times E - g \) commutes with the lattice translation). The constrained system is reduced by \( P^H A P \) before the essential condition is imposed on the free DoFs; the result is the full coefficient vector (slaves filled in), ready for hypercircle_estimate.

Exceptions
InvalidArgumentif k² is zero or a periodic pair does not match the mesh.

◆ dual_solution< 2 >()

template Vector hpfem::adaptivity::dual_solution< 2 > ( const DualDofMap< 2 > &  ,
const assembly::CellFormFactory< 2 > &  ,
Real  ,
std::span< const Index >  ,
std::span< const assembly::PeriodicPair< 2 > >  ,
int  ,
solvers::DirectSolverBackend   
)
extern

◆ dual_solution< 3 >()

template Vector hpfem::adaptivity::dual_solution< 3 > ( const DualDofMap< 3 > &  ,
const assembly::CellFormFactory< 3 > &  ,
Real  ,
std::span< const Index >  ,
std::span< const assembly::PeriodicPair< 3 > >  ,
int  ,
solvers::DirectSolverBackend   
)
extern

◆ elasticity_residual_estimate()

template<int Dim>
Estimate hpfem::adaptivity::elasticity_residual_estimate ( const fespace::DofMap< Dim > &  dofs,
const Vector &  u,
const std::type_identity_t< assembly::ElasticFormFactory< Dim > > &  form_of_cell,
const std::type_identity_t< ElasticBoundaryFactory< Dim > > &  boundary,
const EstimatorOptions &  options = {} 
)

Indicators of the block displacement coefficients u on dofs (plane strain in 2D) for the per-cell forms (stiffness, body force, eigenstrains of assembly::ElasticForm) and the boundary conditions boundary (called once per boundary facet). Quadrature of degree 2p + options.extra_order (+2 on curved cells); the divergence of σ_h by central differences in reference coordinates (options.difference_step), exact up to rounding on affine cells with constant data. Parallel over cells and facets. divergence_terms and length_scale of the options do not apply.

Exceptions
InvalidArgumentif u does not match the map, the difference step is not positive, or a cell has no stiffness.

◆ elasticity_residual_estimate< 2 >()

template Estimate hpfem::adaptivity::elasticity_residual_estimate< 2 > ( const fespace::DofMap< 2 > &  ,
const Vector &  ,
const assembly::ElasticFormFactory< 2 > &  ,
const ElasticBoundaryFactory< 2 > &  ,
const EstimatorOptions &   
)
extern

◆ elasticity_residual_estimate< 3 >()

template Estimate hpfem::adaptivity::elasticity_residual_estimate< 3 > ( const fespace::DofMap< 3 > &  ,
const Vector &  ,
const assembly::ElasticFormFactory< 3 > &  ,
const ElasticBoundaryFactory< 3 > &  ,
const EstimatorOptions &   
)
extern

◆ hp_decide()

template<int Dim, class Counts >
HpDecision hpfem::adaptivity::hp_decide ( const fespace::EntityDofMap< Dim, Counts > &  dofs,
const Vector &  u,
std::span< const Index >  marked,
const SmoothnessOptions &  options = {} 
)

◆ hp_decide< 2, fespace::H1Counts >()

template HpDecision hpfem::adaptivity::hp_decide< 2, fespace::H1Counts > ( const fespace::DofMap< 2 > &  ,
const Vector &  ,
std::span< const Index >  ,
const SmoothnessOptions &   
)
extern

◆ hp_decide< 2, fespace::NedelecCounts >()

template HpDecision hpfem::adaptivity::hp_decide< 2, fespace::NedelecCounts > ( const fespace::NedelecDofMap< 2 > &  ,
const Vector &  ,
std::span< const Index >  ,
const SmoothnessOptions &   
)
extern

◆ hp_decide< 3, fespace::H1Counts >()

template HpDecision hpfem::adaptivity::hp_decide< 3, fespace::H1Counts > ( const fespace::DofMap< 3 > &  ,
const Vector &  ,
std::span< const Index >  ,
const SmoothnessOptions &   
)
extern

◆ hp_decide< 3, fespace::NedelecCounts >()

template HpDecision hpfem::adaptivity::hp_decide< 3, fespace::NedelecCounts > ( const fespace::NedelecDofMap< 3 > &  ,
const Vector &  ,
std::span< const Index >  ,
const SmoothnessOptions &   
)
extern

◆ hp_decide_by_prediction()

HpDecision hpfem::adaptivity::hp_decide_by_prediction ( std::span< const Real >  indicators,
std::span< const Real >  predicted,
std::span< const Index >  marked 
)

Splits the marked cells: indicator at most the prediction → p, otherwise → h. Without predictions (empty span, the first step) every marked cell is h-refined. decay of the result holds the ratio indicator / prediction.

Exceptions
InvalidArgumentif predicted is neither empty nor of the indicators' size.

◆ hp_refine()

template<int Dim>
HpStep hpfem::adaptivity::hp_refine ( mesh::AdaptiveMesh< Dim > &  mesh,
std::span< const int >  orders,
std::span< const Index >  h_marked,
std::span< const Index >  p_marked,
int  increment = 1,
int  max_order = 0,
bool  spread_p = true 
)

Refines h_marked cells in the hierarchy (children inherit the parent's order, cells refined for the one-irregular closure as well) and raises the order of p_marked cells (a cell in both lists is h-refined and its children raised). With spread_p, facet neighbours of a p-marked cell (across hanging facets too) whose order is below the cell's new order are raised by increment as well, unless they are h-marked: under the minimum rule the shared edges and faces would otherwise stay at the neighbour's order and the raised cell would gain interior functions only. Both lists refer to the leaf mesh before the call; orders has one entry per leaf cell.

Exceptions
InvalidArgumentfor a mismatch of orders and the mesh or a cell out of range.

◆ hp_refine< 2 >()

template HpStep hpfem::adaptivity::hp_refine< 2 > ( mesh::AdaptiveMesh< 2 > &  ,
std::span< const int >  ,
std::span< const Index >  ,
std::span< const Index >  ,
int  ,
int  ,
bool   
)
extern

◆ hp_refine< 3 >()

template HpStep hpfem::adaptivity::hp_refine< 3 > ( mesh::AdaptiveMesh< 3 > &  ,
std::span< const int >  ,
std::span< const Index >  ,
std::span< const Index >  ,
int  ,
int  ,
bool   
)
extern

◆ hypercircle_estimate()

template<int Dim>
HypercircleEstimate hpfem::adaptivity::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 
)

Indicators of the primal coefficients e_h on dofs and the dual coefficients sigma_h on dual_dofs (same mesh) for the per-cell forms and the mass coefficient k². On a constrained mesh (hanging nodes, Bloch) both vectors are the full coefficients with the slaves filled in (Constraints::expand), so that the fields are conforming. The weighted norms are \( |w^H T w| \) with the energy weights \( T = \mu \) and \( T = -k^2\varepsilon \), which are the exact energy norms for real coefficients and k² < 0 and their moduli otherwise (lossy materials, PML). Quadrature of degree 2p + extra_order (+2 on curved cells).

Exceptions
InvalidArgumentif a coefficient vector does not match its map or the maps have different meshes.

◆ hypercircle_estimate< 2 >()

template HypercircleEstimate hpfem::adaptivity::hypercircle_estimate< 2 > ( const fespace::NedelecDofMap< 2 > &  ,
const Vector &  ,
const DualDofMap< 2 > &  ,
const Vector &  ,
const assembly::CellFormFactory< 2 > &  ,
Real  ,
int   
)
extern

◆ hypercircle_estimate< 3 >()

template HypercircleEstimate hpfem::adaptivity::hypercircle_estimate< 3 > ( const fespace::NedelecDofMap< 3 > &  ,
const Vector &  ,
const DualDofMap< 3 > &  ,
const Vector &  ,
const assembly::CellFormFactory< 3 > &  ,
Real  ,
int   
)
extern

◆ identity_step()

mesh::RefinementStep hpfem::adaptivity::identity_step ( Index  num_cells)

The step relating a mesh to itself (pure p-refinement), for assembly::prolongate.

◆ maximum_marking()

std::vector< Index > hpfem::adaptivity::maximum_marking ( std::span< const Real >  indicators,
Real  gamma 
)

Maximum marking: every cell with \( \eta_K \ge \gamma\,\max_K\eta_K \), ascending ids; empty if all indicators vanish.

Exceptions
InvalidArgumentunless 0 < γ ≤ 1.

◆ p_refine()

std::vector< int > hpfem::adaptivity::p_refine ( std::span< const int >  orders,
std::span< const Index >  marked,
int  increment = 1,
int  max_order = 0 
)

Orders after p-refinement: marked cells are raised by increment (capped at max_order if positive), the others keep their order.

Exceptions
InvalidArgumentfor a cell out of range or a non-positive increment.

◆ predict_indicators()

std::vector< Real > hpfem::adaptivity::predict_indicators ( std::span< const Real >  indicators,
std::span< const int >  orders,
const HpStep &  hp,
const PredictionOptions &  options = {} 
)

Predicted indicators on the mesh after the step of hp_refine from the indicators and orders before it; a cell counts as p-refined if its order rose (marked or spread).

Exceptions
InvalidArgumentfor size mismatches.

◆ refine_at_points()

template<int Dim>
std::vector< mesh::RefinementStep > hpfem::adaptivity::refine_at_points ( mesh::AdaptiveMesh< Dim > &  mesh,
std::span< const Point< Dim > >  points,
int  levels,
Real  tolerance = 1e-9 
)

Pre-refinement at known singular points (material corners, re-entrant edges): levels times, every leaf cell that contains one of the points or has a vertex within tolerance × its diameter of one is refined (with the usual closure and periodic mirroring of the adaptive mesh). Call it before the orders are assigned, or map them with the returned steps (HpStep-style, children inherit). Returns the steps, one per level.

◆ refine_at_points< 2 >()

template std::vector< mesh::RefinementStep > hpfem::adaptivity::refine_at_points< 2 > ( mesh::AdaptiveMesh< 2 > &  ,
std::span< const Point< 2 > >  ,
int  ,
Real   
)
extern

◆ refine_at_points< 3 >()

template std::vector< mesh::RefinementStep > hpfem::adaptivity::refine_at_points< 3 > ( mesh::AdaptiveMesh< 3 > &  ,
std::span< const Point< 3 > >  ,
int  ,
Real   
)
extern

◆ residual_estimate()

template<int Dim>
Estimate hpfem::adaptivity::residual_estimate ( const fespace::NedelecDofMap< Dim > &  dofs,
const Vector &  e_h,
Real  k_squared,
const std::type_identity_t< assembly::CellFormFactory< Dim > > &  form_of_cell,
const EstimatorOptions &  options = {},
std::span< const assembly::PeriodicPair< Dim > >  periodic = {} 
)

Indicators of the coefficients e_h on dofs for the problem given by the per-cell forms (coefficients μ⁻¹, ε, f, g of assembly::MaxwellForm) and the mass coefficient k_squared (k0² for physics::Scattering, ω² with SI tensors). Cost: a few basis evaluations per quadrature point on every cell and interior facet.

Exceptions
InvalidArgumentif e_h does not match the DoF map.

◆ residual_estimate< 2 >()

template Estimate hpfem::adaptivity::residual_estimate< 2 > ( const fespace::NedelecDofMap< 2 > &  ,
const Vector &  ,
Real  ,
const assembly::CellFormFactory< 2 > &  ,
const EstimatorOptions &  ,
std::span< const assembly::PeriodicPair< 2 > >   
)
extern

◆ residual_estimate< 3 >()

template Estimate hpfem::adaptivity::residual_estimate< 3 > ( const fespace::NedelecDofMap< 3 > &  ,
const Vector &  ,
Real  ,
const assembly::CellFormFactory< 3 > &  ,
const EstimatorOptions &  ,
std::span< const assembly::PeriodicPair< 3 > >   
)
extern

◆ weighted_residual()

template<int Dim>
std::vector< Complex > hpfem::adaptivity::weighted_residual ( const fespace::NedelecDofMap< Dim > &  dofs,
const Vector &  e_h,
Real  k_squared,
const std::type_identity_t< assembly::CellFormFactory< Dim > > &  form_of_cell,
const fespace::NedelecDofMap< Dim > &  weight_dofs,
const Vector &  weight,
const EstimatorOptions &  options = {} 
)

Weighted residual for goal-oriented estimation: the cell contributions \( r_K(w) = \int_K R_K\cdot w + \tfrac12\sum_{F\subset\partial K}\int_F (n\times[\![w_h]\!])\cdot w \) (no conjugation, signed) of a weight \( w \) given as coefficients on weight_dofs (same mesh, e.g. the orders raised by one); boundary facets contribute their one-sided term \( \int_F (n imes w_h)\cdot w \) to their cell (the residual of a natural condition), so that \( \sum_K r_K(w) = \ell(w) - a(E_h, w) \) for every tangentially continuous \( w \).

◆ weighted_residual< 2 >()

template std::vector< Complex > hpfem::adaptivity::weighted_residual< 2 > ( const fespace::NedelecDofMap< 2 > &  ,
const Vector &  ,
Real  ,
const assembly::CellFormFactory< 2 > &  ,
const fespace::NedelecDofMap< 2 > &  ,
const Vector &  ,
const EstimatorOptions &   
)
extern

◆ weighted_residual< 3 >()

template std::vector< Complex > hpfem::adaptivity::weighted_residual< 3 > ( const fespace::NedelecDofMap< 3 > &  ,
const Vector &  ,
Real  ,
const assembly::CellFormFactory< 3 > &  ,
const fespace::NedelecDofMap< 3 > &  ,
const Vector &  ,
const EstimatorOptions &   
)
extern