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

Namespaces

namespace  box_tag
 
namespace  detail
 

Classes

class  AdaptiveMesh
 
class  AffineGeometry
 Affine cell: constant Jacobian data from AffineMap. More...
 
struct  AffineMap
 
class  CellGeometry
 
struct  GeometryPoint
 Geometry data of a cell at one reference point. More...
 
struct  GmshMesh
 The mesh and its periodic links (assembly::PeriodicPair needs only the Bloch phase). More...
 
struct  LocatedPoint
 A physical point expressed in a cell: cell id and reference coordinates. More...
 
class  Mesh
 
struct  MeshReport
 
struct  PeriodicCheck
 
struct  PeriodicFace
 
struct  PeriodicLink
 
class  PointLocator
 
class  QuadraticGeometry
 
struct  Refined
 
struct  RefinementStep
 
struct  SimplexTopology
 Local topology tables of the reference simplex in Dim dimensions. More...
 
struct  SimplexTopology< 2 >
 Reference triangle. More...
 
struct  SimplexTopology< 3 >
 Reference tetrahedron. More...
 
struct  Subdivided
 

Typedefs

using Tag = std::int32_t
 Integer tag of a physical group (Gmsh convention: positive; 0 means untagged).
 

Functions

Mesh< 2 > rectangle (Index nx, Index ny, const Point< 2 > &lower=Point< 2 >::Zero(), const Point< 2 > &upper=Point< 2 >::Ones(), bool tag_sides=true)
 
Mesh< 3 > box (Index nx, Index ny, Index nz, const Point< 3 > &lower=Point< 3 >::Zero(), const Point< 3 > &upper=Point< 3 >::Ones(), bool tag_sides=true)
 
Mesh< 2 > disc (Index n, const Point< 2 > &center=Point< 2 >::Zero(), Real radius=1.0, bool curved=true)
 
Mesh< 3 > ball (Index n, const Point< 3 > &center=Point< 3 >::Zero(), Real radius=1.0, bool curved=true)
 
Mesh< 2 > square_with_disc (Index n, Real radius, Real half_width, Real outer, Tag inclusion_tag=2)
 
Mesh< 3 > box_with_ball (Index n, Real radius, Real half_width, Real outer, Tag inclusion_tag=2)
 
template<int Dim>
Mesh< Dim > extract (const Mesh< Dim > &mesh, std::span< const Index > cells)
 
template<int Dim>
Mesh< Dim > extract (const Mesh< Dim > &mesh, const std::function< bool(const Point< Dim > &)> &keep)
 Sub-mesh of the cells for which keep(centroid) is true.
 
template Mesh< 2 > extract< 2 > (const Mesh< 2 > &, std::span< const Index >)
 
template Mesh< 3 > extract< 3 > (const Mesh< 3 > &, std::span< const Index >)
 
template Mesh< 2 > extract< 2 > (const Mesh< 2 > &, const std::function< bool(const Point< 2 > &)> &)
 
template Mesh< 3 > extract< 3 > (const Mesh< 3 > &, const std::function< bool(const Point< 3 > &)> &)
 
template<int Dim>
AffineMap< Dim > affine_map (const Mesh< Dim > &mesh, Index c)
 
template<int Dim>
std::vector< AffineMap< Dim > > affine_maps (const Mesh< Dim > &mesh)
 Affine maps of all cells, indexed by cell id.
 
template<int Dim>
Real facet_measure (const Mesh< Dim > &mesh, Index f)
 Measure of facet f: edge length in 2D, triangle area in 3D [m^(Dim-1)].
 
template<int Dim>
Point< Dim > outward_normal (const Mesh< Dim > &mesh, Index c, LocalIndex k)
 
template<int Dim>
void curve_boundary (Mesh< Dim > &mesh, std::span< const Index > facets, const std::function< Point< Dim >(const Point< Dim > &)> &project)
 
template<int Dim>
void curve_boundary (Mesh< Dim > &mesh, Tag tag, const std::function< Point< Dim >(const Point< Dim > &)> &project)
 Same for all facets carrying tag.
 
template<int Dim>
std::unique_ptr< CellGeometry< Dim > > cell_geometry (const Mesh< Dim > &mesh, Index c)
 Geometry of cell c according to mesh.geometry_order().
 
template AffineMap< 2 > affine_map< 2 > (const Mesh< 2 > &, Index)
 
template AffineMap< 3 > affine_map< 3 > (const Mesh< 3 > &, Index)
 
template std::vector< AffineMap< 2 > > affine_maps< 2 > (const Mesh< 2 > &)
 
template std::vector< AffineMap< 3 > > affine_maps< 3 > (const Mesh< 3 > &)
 
template Real facet_measure< 2 > (const Mesh< 2 > &, Index)
 
template Real facet_measure< 3 > (const Mesh< 3 > &, Index)
 
template Point< 2 > outward_normal< 2 > (const Mesh< 2 > &, Index, LocalIndex)
 
template Point< 3 > outward_normal< 3 > (const Mesh< 3 > &, Index, LocalIndex)
 
template std::unique_ptr< CellGeometry< 2 > > cell_geometry< 2 > (const Mesh< 2 > &, Index)
 
template void curve_boundary< 2 > (Mesh< 2 > &, std::span< const Index >, const std::function< Point< 2 >(const Point< 2 > &)> &)
 
template void curve_boundary< 3 > (Mesh< 3 > &, std::span< const Index >, const std::function< Point< 3 >(const Point< 3 > &)> &)
 
template void curve_boundary< 2 > (Mesh< 2 > &, Tag, const std::function< Point< 2 >(const Point< 2 > &)> &)
 
template void curve_boundary< 3 > (Mesh< 3 > &, Tag, const std::function< Point< 3 >(const Point< 3 > &)> &)
 
template std::unique_ptr< CellGeometry< 3 > > cell_geometry< 3 > (const Mesh< 3 > &, Index)
 
template<int Dim>
Mesh< Dim > read_gmsh (std::istream &in, Real scale=1.0)
 
template<int Dim>
Mesh< Dim > read_gmsh (const std::filesystem::path &file, Real scale=1.0)
 As above, from a file.
 
template<int Dim>
GmshMesh< Dim > read_gmsh_with_periodic (std::istream &in, Real scale=1.0)
 
template<int Dim>
GmshMesh< Dim > read_gmsh_with_periodic (const std::filesystem::path &file, Real scale=1.0)
 
template GmshMesh< 2 > read_gmsh_with_periodic< 2 > (std::istream &, Real)
 
template GmshMesh< 3 > read_gmsh_with_periodic< 3 > (std::istream &, Real)
 
template GmshMesh< 2 > read_gmsh_with_periodic< 2 > (const std::filesystem::path &, Real)
 
template GmshMesh< 3 > read_gmsh_with_periodic< 3 > (const std::filesystem::path &, Real)
 
template Mesh< 2 > read_gmsh< 2 > (std::istream &, Real)
 
template Mesh< 3 > read_gmsh< 3 > (std::istream &, Real)
 
template Mesh< 2 > read_gmsh< 2 > (const std::filesystem::path &, Real)
 
template Mesh< 3 > read_gmsh< 3 > (const std::filesystem::path &, Real)
 
template<int Dim>
Refined< Dim > refine_uniform (const Mesh< Dim > &parent)
 
template Refined< 2 > refine_uniform< 2 > (const Mesh< 2 > &)
 
template Refined< 3 > refine_uniform< 3 > (const Mesh< 3 > &)
 
template<int Dim>
MeshReport< Dim > report (const Mesh< Dim > &mesh)
 
template<int Dim>
PeriodicCheck< Dim > check_periodic (const Mesh< Dim > &mesh, Tag master, Tag slave, const Point< Dim > &shift, Real tolerance=1e-8)
 
template MeshReport< 2 > report< 2 > (const Mesh< 2 > &)
 
template MeshReport< 3 > report< 3 > (const Mesh< 3 > &)
 
template PeriodicCheck< 2 > check_periodic< 2 > (const Mesh< 2 > &, Tag, Tag, const Point< 2 > &, Real)
 
template PeriodicCheck< 3 > check_periodic< 3 > (const Mesh< 3 > &, Tag, Tag, const Point< 3 > &, Real)
 
template<int Dim>
Subdivided< Dim > subdivide (const Mesh< Dim > &mesh, int n)
 
template Subdivided< 2 > subdivide< 2 > (const Mesh< 2 > &, int)
 
template Subdivided< 3 > subdivide< 3 > (const Mesh< 3 > &, int)
 

Variables

constexpr Tag kDiscBoundary = 1
 Facet tag of the boundary of disc and ball.
 
constexpr Tag kNoTag = 0
 
constexpr std::array< std::array< LocalIndex, 3 >, 6 > kFacePermutations
 

Typedef Documentation

◆ Tag

using hpfem::mesh::Tag = typedef std::int32_t

Integer tag of a physical group (Gmsh convention: positive; 0 means untagged).

Function Documentation

◆ affine_map()

template<int Dim>
AffineMap< Dim > hpfem::mesh::affine_map ( const Mesh< Dim > &  mesh,
Index  c 
)

Affine map of cell c. O(1).

Exceptions
InvalidArgumentif the cell is degenerate (collinear / coplanar vertices).

◆ affine_map< 2 >()

template AffineMap< 2 > hpfem::mesh::affine_map< 2 > ( const Mesh< 2 > &  ,
Index   
)
extern

◆ affine_map< 3 >()

template AffineMap< 3 > hpfem::mesh::affine_map< 3 > ( const Mesh< 3 > &  ,
Index   
)
extern

◆ affine_maps()

template<int Dim>
std::vector< AffineMap< Dim > > hpfem::mesh::affine_maps ( const Mesh< Dim > &  mesh)

Affine maps of all cells, indexed by cell id.

◆ affine_maps< 2 >()

template std::vector< AffineMap< 2 > > hpfem::mesh::affine_maps< 2 > ( const Mesh< 2 > &  )
extern

◆ affine_maps< 3 >()

template std::vector< AffineMap< 3 > > hpfem::mesh::affine_maps< 3 > ( const Mesh< 3 > &  )
extern

◆ ball()

Mesh< 3 > hpfem::mesh::ball ( Index  n,
const Point< 3 > &  center = Point< 3 >::Zero(),
Real  radius = 1.0,
bool  curved = true 
)

Structured mesh of a ball: the cube [-1, 1]^3 with n^3 cubes mapped by \( x = u\sqrt{1 - v^2/2 - w^2/2 + v^2w^2/3} \) (and cyclically) onto the unit ball, scaled and shifted; every cube split into the Kuhn tetrahedra around its body diagonal from the corner nearest the centre (unlike box); boundary edge nodes projected onto the sphere with curved.

◆ box()

Mesh< 3 > hpfem::mesh::box ( Index  nx,
Index  ny,
Index  nz,
const Point< 3 > &  lower = Point< 3 >::Zero(),
const Point< 3 > &  upper = Point< 3 >::Ones(),
bool  tag_sides = true 
)

Box [lower, upper] split into nx × ny × nz cubes, each into six tetrahedra (Kuhn / Freudenthal subdivision, all sharing the cube's body diagonal). Vertices are numbered x-fastest. Counts: V = (nx+1)(ny+1)(nz+1), C = 6 nx ny nz. With tag_sides, boundary faces carry the box_tag of their side; cells stay untagged.

Exceptions
InvalidArgumentfor nx, ny, nz < 1 or upper <= lower in any coordinate.

◆ box_with_ball()

Mesh< 3 > hpfem::mesh::box_with_ball ( Index  n,
Real  radius,
Real  half_width,
Real  outer,
Tag  inclusion_tag = 2 
)

3D counterpart of square_with_disc: the cube [-outer, outer]^3 with a spherical inclusion of the given radius at the origin resolved by (curved) cell faces. The grid of the inner cube is mapped onto the ball as in ball, the shell up to half_width blends linearly between the sphere and the cube (as in square_with_disc), beyond half_width the grid is uniform (space for a PML). Cubes are split as in ball. n is the number of cells per radius; (outer / radius) n must be an integer. Cells: 6 (2 (outer / radius) n)^3 Kuhn tetrahedra. The inclusion cells carry inclusion_tag, the outer sides the box_tags, the interface faces become quadratic (geometry order 2).

Exceptions
InvalidArgumentfor inconsistent sizes.

◆ cell_geometry()

template<int Dim>
std::unique_ptr< CellGeometry< Dim > > hpfem::mesh::cell_geometry ( const Mesh< Dim > &  mesh,
Index  c 
)

Geometry of cell c according to mesh.geometry_order().

◆ cell_geometry< 2 >()

template std::unique_ptr< CellGeometry< 2 > > hpfem::mesh::cell_geometry< 2 > ( const Mesh< 2 > &  ,
Index   
)
extern

◆ cell_geometry< 3 >()

template std::unique_ptr< CellGeometry< 3 > > hpfem::mesh::cell_geometry< 3 > ( const Mesh< 3 > &  ,
Index   
)
extern

◆ check_periodic()

template<int Dim>
PeriodicCheck< Dim > hpfem::mesh::check_periodic ( const Mesh< Dim > &  mesh,
Tag  master,
Tag  slave,
const Point< Dim > &  shift,
Real  tolerance = 1e-8 
)
Exceptions
InvalidArgumentif a side has no facets.

◆ check_periodic< 2 >()

template PeriodicCheck< 2 > hpfem::mesh::check_periodic< 2 > ( const Mesh< 2 > &  ,
Tag  ,
Tag  ,
const Point< 2 > &  ,
Real   
)
extern

◆ check_periodic< 3 >()

template PeriodicCheck< 3 > hpfem::mesh::check_periodic< 3 > ( const Mesh< 3 > &  ,
Tag  ,
Tag  ,
const Point< 3 > &  ,
Real   
)
extern

◆ curve_boundary() [1/2]

template<int Dim>
void hpfem::mesh::curve_boundary ( Mesh< Dim > &  mesh,
std::span< const Index >  facets,
const std::function< Point< Dim >(const Point< Dim > &)> &  project 
)

Curves the mesh along the given facets: installs midpoint edge nodes if the mesh is still affine and moves the node of every edge of these facets to project(node), e.g. the radial projection onto a circle or sphere. The cells touching those edges become order-2 cells (QuadraticGeometry); all other cells keep the exact affine map.

◆ curve_boundary() [2/2]

template<int Dim>
void hpfem::mesh::curve_boundary ( Mesh< Dim > &  mesh,
Tag  tag,
const std::function< Point< Dim >(const Point< Dim > &)> &  project 
)

Same for all facets carrying tag.

◆ curve_boundary< 2 >() [1/2]

template void hpfem::mesh::curve_boundary< 2 > ( Mesh< 2 > &  ,
std::span< const Index >  ,
const std::function< Point< 2 >(const Point< 2 > &)> &   
)
extern

◆ curve_boundary< 2 >() [2/2]

template void hpfem::mesh::curve_boundary< 2 > ( Mesh< 2 > &  ,
Tag  ,
const std::function< Point< 2 >(const Point< 2 > &)> &   
)
extern

◆ curve_boundary< 3 >() [1/2]

template void hpfem::mesh::curve_boundary< 3 > ( Mesh< 3 > &  ,
std::span< const Index >  ,
const std::function< Point< 3 >(const Point< 3 > &)> &   
)
extern

◆ curve_boundary< 3 >() [2/2]

template void hpfem::mesh::curve_boundary< 3 > ( Mesh< 3 > &  ,
Tag  ,
const std::function< Point< 3 >(const Point< 3 > &)> &   
)
extern

◆ disc()

Mesh< 2 > hpfem::mesh::disc ( Index  n,
const Point< 2 > &  center = Point< 2 >::Zero(),
Real  radius = 1.0,
bool  curved = true 
)

Structured mesh of a disc: the square [-1, 1]^2 with n × n cells mapped by \( (u, v) \mapsto (u\sqrt{1 - v^2/2},\; v\sqrt{1 - u^2/2}) \) onto the unit disc, then scaled and shifted. Every square is split along the diagonal pointing away from the centre (unlike rectangle), so that no sliver lines the circle. With curved the nodes of the boundary edges are projected onto the circle (curve_boundary, geometry order 2); otherwise the boundary stays polygonal. All boundary facets carry kDiscBoundary.

Exceptions
InvalidArgumentfor n < 1 or radius ≤ 0.

◆ extract() [1/2]

template<int Dim>
Mesh< Dim > hpfem::mesh::extract ( const Mesh< Dim > &  mesh,
const std::function< bool(const Point< Dim > &)> &  keep 
)

Sub-mesh of the cells for which keep(centroid) is true.

◆ extract() [2/2]

template<int Dim>
Mesh< Dim > hpfem::mesh::extract ( const Mesh< Dim > &  mesh,
std::span< const Index >  cells 
)

Sub-mesh of the given cells (in the given order) of a conforming mesh: vertices are renumbered ascending, cell tags, the facet tags of facets kept, tag names and curved edge nodes transfer. New boundary facets (cut through the interior) stay untagged, e.g. for an L-shaped domain cut from a rectangle.

Exceptions
InvalidArgumentfor a cell out of range or a cell listed twice.

◆ extract< 2 >() [1/2]

template Mesh< 2 > hpfem::mesh::extract< 2 > ( const Mesh< 2 > &  ,
const std::function< bool(const Point< 2 > &)> &   
)
extern

◆ extract< 2 >() [2/2]

template Mesh< 2 > hpfem::mesh::extract< 2 > ( const Mesh< 2 > &  ,
std::span< const Index >   
)
extern

◆ extract< 3 >() [1/2]

template Mesh< 3 > hpfem::mesh::extract< 3 > ( const Mesh< 3 > &  ,
const std::function< bool(const Point< 3 > &)> &   
)
extern

◆ extract< 3 >() [2/2]

template Mesh< 3 > hpfem::mesh::extract< 3 > ( const Mesh< 3 > &  ,
std::span< const Index >   
)
extern

◆ facet_measure()

template<int Dim>
Real hpfem::mesh::facet_measure ( const Mesh< Dim > &  mesh,
Index  f 
)

Measure of facet f: edge length in 2D, triangle area in 3D [m^(Dim-1)].

◆ facet_measure< 2 >()

template Real hpfem::mesh::facet_measure< 2 > ( const Mesh< 2 > &  ,
Index   
)
extern

◆ facet_measure< 3 >()

template Real hpfem::mesh::facet_measure< 3 > ( const Mesh< 3 > &  ,
Index   
)
extern

◆ outward_normal()

template<int Dim>
Point< Dim > hpfem::mesh::outward_normal ( const Mesh< Dim > &  mesh,
Index  c,
LocalIndex  k 
)

Unit normal of local facet k of cell c pointing out of the cell. For an interior facet the normals seen from its two cells are opposite.

◆ outward_normal< 2 >()

template Point< 2 > hpfem::mesh::outward_normal< 2 > ( const Mesh< 2 > &  ,
Index  ,
LocalIndex   
)
extern

◆ outward_normal< 3 >()

template Point< 3 > hpfem::mesh::outward_normal< 3 > ( const Mesh< 3 > &  ,
Index  ,
LocalIndex   
)
extern

◆ read_gmsh() [1/2]

template<int Dim>
Mesh< Dim > hpfem::mesh::read_gmsh ( const std::filesystem::path &  file,
Real  scale = 1.0 
)

As above, from a file.

Exceptions
InvalidArgumentif the file cannot be opened.

◆ read_gmsh() [2/2]

template<int Dim>
Mesh< Dim > hpfem::mesh::read_gmsh ( std::istream &  in,
Real  scale = 1.0 
)

Reads a Gmsh 4.1 ASCII mesh.

  • Cells are the elements of dimension Dim (3- or 6-node triangles / 4- or 10-node tetrahedra), tagged with the first physical group of their geometric entity (kNoTag if none). Second-order files give curved cells: the corner nodes become the vertices, the edge nodes the quadratic geometry of the edges (Mesh::set_edge_nodes); one file holds one order.
  • Elements of dimension Dim - 1 (2- or 3-node lines / 3- or 6-node triangles) tag the facets they lie on in the same way; they must be facets of the mesh.
  • Physical names of dimensions Dim and Dim - 1 are kept (Mesh::tag_name).
  • Elements of other dimensions (points, curves in 3D) are ignored.
  • Gmsh is unit-less: coordinates are multiplied by scale to obtain SI metres, e.g. 1e-9 for a model drawn in nanometres. For Dim = 2 the z coordinate is dropped.
  • Node tags may be sparse; vertices are numbered in file order.
  • A $Periodic section is skipped here; read_gmsh_with_periodic returns it.
Exceptions
InvalidArgumenton malformed input, non-simplex elements, a facet element that is not a facet of the mesh, or a file that mixes first- and second-order elements.
NotImplementedfor binary files and versions other than 4.1.

◆ read_gmsh< 2 >() [1/2]

template Mesh< 2 > hpfem::mesh::read_gmsh< 2 > ( const std::filesystem::path &  ,
Real   
)
extern

◆ read_gmsh< 2 >() [2/2]

template Mesh< 2 > hpfem::mesh::read_gmsh< 2 > ( std::istream &  ,
Real   
)
extern

◆ read_gmsh< 3 >() [1/2]

template Mesh< 3 > hpfem::mesh::read_gmsh< 3 > ( const std::filesystem::path &  ,
Real   
)
extern

◆ read_gmsh< 3 >() [2/2]

template Mesh< 3 > hpfem::mesh::read_gmsh< 3 > ( std::istream &  ,
Real   
)
extern

◆ read_gmsh_with_periodic() [1/2]

template<int Dim>
GmshMesh< Dim > hpfem::mesh::read_gmsh_with_periodic ( const std::filesystem::path &  file,
Real  scale = 1.0 
)

◆ read_gmsh_with_periodic() [2/2]

template<int Dim>
GmshMesh< Dim > hpfem::mesh::read_gmsh_with_periodic ( std::istream &  in,
Real  scale = 1.0 
)

As read_gmsh, with the $Periodic section.

Exceptions
InvalidArgumentas read_gmsh, and if a periodic entity has no physical group or a link has neither an affine transform nor corresponding nodes to take the shift from.

◆ read_gmsh_with_periodic< 2 >() [1/2]

template GmshMesh< 2 > hpfem::mesh::read_gmsh_with_periodic< 2 > ( const std::filesystem::path &  ,
Real   
)
extern

◆ read_gmsh_with_periodic< 2 >() [2/2]

template GmshMesh< 2 > hpfem::mesh::read_gmsh_with_periodic< 2 > ( std::istream &  ,
Real   
)
extern

◆ read_gmsh_with_periodic< 3 >() [1/2]

template GmshMesh< 3 > hpfem::mesh::read_gmsh_with_periodic< 3 > ( const std::filesystem::path &  ,
Real   
)
extern

◆ read_gmsh_with_periodic< 3 >() [2/2]

template GmshMesh< 3 > hpfem::mesh::read_gmsh_with_periodic< 3 > ( std::istream &  ,
Real   
)
extern

◆ rectangle()

Mesh< 2 > hpfem::mesh::rectangle ( Index  nx,
Index  ny,
const Point< 2 > &  lower = Point< 2 >::Zero(),
const Point< 2 > &  upper = Point< 2 >::Ones(),
bool  tag_sides = true 
)

Rectangle [lower, upper] split into nx × ny squares, each into two triangles along the diagonal from (i, j) to (i+1, j+1). Vertices are numbered x-fastest, cells square by square. Counts: V = (nx+1)(ny+1), E = 3 nx ny + nx + ny, C = 2 nx ny. With tag_sides, boundary edges carry the box_tag of their side; cells stay untagged.

Exceptions
InvalidArgumentfor nx, ny < 1 or upper <= lower in any coordinate.

◆ refine_uniform()

template<int Dim>
Refined< Dim > hpfem::mesh::refine_uniform ( const Mesh< Dim > &  parent)

Red refinement of every cell: a triangle into four congruent triangles through the edge midpoints; a tetrahedron into four corner tetrahedra and four from the inner octahedron, split along the diagonal between the midpoints of edges (0,2) and (1,3) (Bey's rule, which keeps the number of congruence classes bounded under repetition).

Transferred to the children: cell tags, facet tags (to the child facets lying on a tagged parent facet), tag names, and second-order geometry: new vertices are placed at the parent edge nodes and child edge nodes are evaluated with the parent cell map, so the refined mesh represents the same curved geometry. O(N log N) in the number of cells.

◆ refine_uniform< 2 >()

template Refined< 2 > hpfem::mesh::refine_uniform< 2 > ( const Mesh< 2 > &  )
extern

◆ refine_uniform< 3 >()

template Refined< 3 > hpfem::mesh::refine_uniform< 3 > ( const Mesh< 3 > &  )
extern

◆ report()

template<int Dim>
MeshReport< Dim > hpfem::mesh::report ( const Mesh< Dim > &  mesh)
Exceptions
InvalidArgumentfor an empty mesh.

◆ report< 2 >()

template MeshReport< 2 > hpfem::mesh::report< 2 > ( const Mesh< 2 > &  )
extern

◆ report< 3 >()

template MeshReport< 3 > hpfem::mesh::report< 3 > ( const Mesh< 3 > &  )
extern

◆ square_with_disc()

Mesh< 2 > hpfem::mesh::square_with_disc ( Index  n,
Real  radius,
Real  half_width,
Real  outer,
Tag  inclusion_tag = 2 
)

Structured mesh of the square [-outer, outer]^2 with a circular inclusion of the given radius at the origin whose interface is resolved by (curved) cell edges: the grid of the inner square is mapped onto the disc as in disc, the ring up to half_width blends linearly between the circle and the square (grid coordinate s = max(|u|, |v|) from 1 to half_width / radius: \( x = R[(1 - t)\,s\,\mathrm{disc}(q/s) + t\,q] \), \( t = (s - 1)/(l - 1) \), so the rings keep the cell size), and beyond half_width the grid continues uniformly (space for a PML). Squares are split along the diagonal pointing away from the centre, as in disc. n is the number of cells per radius; the cell size is about radius / n everywhere, so (outer / radius) n must be an integer. The inclusion cells carry inclusion_tag, the outer sides the box_tags.

Exceptions
InvalidArgumentfor inconsistent sizes.

◆ subdivide()

template<int Dim>
Subdivided< Dim > hpfem::mesh::subdivide ( const Mesh< Dim > &  mesh,
int  n 
)

Splits every cell into \( n^{Dim} \) sub-simplices of equal reference volume: the lattice \( \xi = (i, j[, k]) / n \), \( i + j [+ k] \le n \), with upward and downward triangles (2D) and, per lattice cube, one corner tetrahedron, an octahedron split into four and an inverted tetrahedron (3D, Freudenthal–Bey). Sub-vertices are placed with the parent cell map, so curved cells become piecewise straight. All sub-cells have the orientation (sign of det J) of their parent. O(n^Dim · #cells).

Exceptions
InvalidArgumentif n < 1.

◆ subdivide< 2 >()

template Subdivided< 2 > hpfem::mesh::subdivide< 2 > ( const Mesh< 2 > &  ,
int   
)
extern

◆ subdivide< 3 >()

template Subdivided< 3 > hpfem::mesh::subdivide< 3 > ( const Mesh< 3 > &  ,
int   
)
extern

Variable Documentation

◆ kDiscBoundary

constexpr Tag hpfem::mesh::kDiscBoundary = 1
inlineconstexpr

Facet tag of the boundary of disc and ball.

◆ kFacePermutations

constexpr std::array<std::array<LocalIndex, 3>, 6> hpfem::mesh::kFacePermutations
inlineconstexpr
Initial value:
{
{{0, 1, 2}, {0, 2, 1}, {1, 0, 2}, {1, 2, 0}, {2, 0, 1}, {2, 1, 0}}}

The six permutations of three items in lexicographic order. Mesh<3> stores, per cell and local face, a code k such that local face vertex j sits at position kFacePermutations[k][j] of the globally sorted face (docs/theory/mesh.md). Code 0 is the identity: local and global order agree.

◆ kNoTag

constexpr Tag hpfem::mesh::kNoTag = 0
inlineconstexpr