SERiF v0.0.1a
Stellar Evolution and Rotation in Four Dimensions
Loading...
Searching...
No Matches
serif::geometry::deformation::backend::mfem::detail Namespace Reference

Classes

struct  LocatedBoundaryPoint
 A structure representing a located boundary point, including the boundary element index and the integration point on that element. More...
 

Functions

template<typename Value>
std::expected< std::shared_ptr< const Value >, DeformationFailure > share_reference_result (std::expected< Value, DeformationFailure > result)
 Share a successfully compiled immutable table without copying it into each consumer.
 
std::expected< RadialInterpolation, DeformationFailure > compile_radial_reference (const ReferenceDiscretization &input, const std::vector< int > &selected)
 Compile a radial interpolation from a reference discretization and set of material attributes.
 
double logical_radius (const ::mfem::Vector &position)
 compute the cubical local radius of a given position vector. Alternative put: compute the \(L\infty\) norm of the position vector (i.e. the maximum absolute value of its components)
 
std::expected< double, DeformationFailure > boundary_logical_radius (::mfem::Mesh &mesh, int attribute)
 Compute the logical radius of a boundary shell in a mesh, given the mesh and the boundary attribute.
 
std::expected< LocatedBoundaryPoint, DeformationFailure > locate_boundary_point (::mfem::Mesh &mesh, int attribute, const ::mfem::Vector &target)
 Locate a projected logical ray on a quadrilateral shell.
 
template<typename Surface, typename Interior, typename Vacuum, utils::dependencies::IsResource ShapeResource>
auto deformation_inputs (const DomainDeformation< Surface, Interior, Vacuum > &model, const ReferenceDiscretization &discretization, ShapeResource coefficients)
 Share physical input construction between borrowed containers and state views.
 
std::expected< RadialInterpolation, DeformationFailure > build_radial_interpolation (const ::mfem::FiniteElementSpace &scalar_space, const ::mfem::FiniteElementSpace &vector_space, ::mfem::Mesh &logical_mesh, std::span< const int > stellar_element_support, std::span< const int > vacuum_element_support, int surface_attribute, int infinity_attribute, const std::vector< int > &selected)
 Reuse the validated scalar space and surface selection supplied by the reference graph.
 
std::expected< std::vector< std::array< double, 3 > >, DeformationFailure > sample_reference_positions (const ::mfem::FiniteElementSpace &scalar_space, ::mfem::Mesh &reference_mesh)
 Sample paired coordinates after the scalar node-selection stage has validated the space.
 
std::expected< ReferenceSurface, DeformationFailure > sample_reference_surface (const ::mfem::FiniteElementSpace &scalar_space, const std::vector< int > &selected)
 Reuse the graph's canonical surface nodes when only physical coordinates changed.
 
std::expected< std::vector< double >, DeformationFailure > surface_parameter_mass_diagonal (const ::mfem::FiniteElementSpace &scalar_space, int surface_attribute, const ReferenceSurface &reference_surface, const SurfaceEmbedding &embedding)
 Assemble from the current reference trace and its embedding, already paired by the dependency graph.
 

Function Documentation

◆ boundary_logical_radius()

std::expected< double, DeformationFailure > serif::geometry::deformation::backend::mfem::detail::boundary_logical_radius ( ::mfem::Mesh & mesh,
int attribute )
nodiscard

Compute the logical radius of a boundary shell in a mesh, given the mesh and the boundary attribute.

Parameters
meshThe mesh containing the boundary shell.
attributeThe boundary attribute identifying the shell to compute the logical radius for.
Returns
The logical radius of the boundary shell if successful, or a DeformationFailure object if an error occurs (e.g., incompatible discretization, non-finite vertex, or invalid geometry).
Explanation
The algorithm here is as follows
  1. Loop over all boundary elements. validate they they have the correct attribute id (if not skip them)
  2. Get the geometry type of the element and validate that it has a valid transformation and is a square (which for mfem really means a quadrilateral). If not return an error
  3. Get the vertices of the element and loop over them. For each vertex a. Transform the vertex into a position vector b. validate that each component of the position vector is finite. If not return an error c. Compute the logical radius of the position vector (L \(\infty\) norm) and update the minimum and maximum logical radius values seen so far d. Increment the number of samples seen so far
  4. validate that at least one sample was seen, that the minimum values is positive, and that are at least separated by 1e-12 * max(1, maximum). If not return an error
  5. Return the average of the minimum and maximum logical radius values seen.

Effectively then what this does is find an estimate for the radius of some enclosing surface over the boundary elements.

◆ build_radial_interpolation()

std::expected< RadialInterpolation, DeformationFailure > serif::geometry::deformation::backend::mfem::detail::build_radial_interpolation ( const ::mfem::FiniteElementSpace & scalar_space,
const ::mfem::FiniteElementSpace & vector_space,
::mfem::Mesh & logical_mesh,
std::span< const int > stellar_element_support,
std::span< const int > vacuum_element_support,
int surface_attribute,
int infinity_attribute,
const std::vector< int > & selected )
nodiscard

Reuse the validated scalar space and surface selection supplied by the reference graph.

◆ compile_radial_reference()

std::expected< RadialInterpolation, DeformationFailure > serif::geometry::deformation::backend::mfem::detail::compile_radial_reference ( const ReferenceDiscretization & input,
const std::vector< int > & selected )
inlinenodiscard

Compile a radial interpolation from a reference discretization and set of material attributes.

Parameters
inputThe reference discretization containing the scalar and displacement finite element spaces, logical mesh, and material attributes.
selectedA vector of integers representing the selected material attributes for the radial interpolation.
Returns
If successful, returns a RadialInterpolation object representing the compiled radial interpolation. If there is an error, returns a DeformationFailure object describing the failure.
Todo
This is a holdover from the original MeanField code and its bespoke reference tracking system. It is likely that this can be removed in favor of SERiF's more robust dependencies graph system.

Broadly the idea here (I am noticing in this doc writing process I say broadly a lot...) we loop over all elements in the mesh, determine if they have stellar or vacuum support

◆ deformation_inputs()

template<typename Surface, typename Interior, typename Vacuum, utils::dependencies::IsResource ShapeResource>
auto serif::geometry::deformation::backend::mfem::detail::deformation_inputs ( const DomainDeformation< Surface, Interior, Vacuum > & model,
const ReferenceDiscretization & discretization,
ShapeResource coefficients )
nodiscard

Share physical input construction between borrowed containers and state views.

◆ locate_boundary_point()

std::expected< LocatedBoundaryPoint, DeformationFailure > serif::geometry::deformation::backend::mfem::detail::locate_boundary_point ( ::mfem::Mesh & mesh,
int attribute,
const ::mfem::Vector & target )
nodiscard

Locate a projected logical ray on a quadrilateral shell.

Parameters
meshThe mesh containing the boundary shell.
attributeThe boundary attribute identifying the shell to locate the point on.
targetThe target position vector to locate on the boundary shell.
Returns
A LocatedBoundaryPoint object representing the located boundary point if successful, or a DeformationFailure object if an error occurs

◆ logical_radius()

double serif::geometry::deformation::backend::mfem::detail::logical_radius ( const ::mfem::Vector & position)
nodiscard

compute the cubical local radius of a given position vector. Alternative put: compute the \(L\infty\) norm of the position vector (i.e. the maximum absolute value of its components)

Parameters
positionThe position vector for which to compute the logical radius.
Returns
The logical radius of the position vector, defined as the maximum absolute value of its components (i.e., the L \(\infty\) norm).

◆ sample_reference_positions()

std::expected< std::vector< std::array< double, 3 > >, DeformationFailure > serif::geometry::deformation::backend::mfem::detail::sample_reference_positions ( const ::mfem::FiniteElementSpace & scalar_space,
::mfem::Mesh & reference_mesh )
nodiscard

Sample paired coordinates after the scalar node-selection stage has validated the space.

◆ sample_reference_surface()

std::expected< ReferenceSurface, DeformationFailure > serif::geometry::deformation::backend::mfem::detail::sample_reference_surface ( const ::mfem::FiniteElementSpace & scalar_space,
const std::vector< int > & selected )
nodiscard

Reuse the graph's canonical surface nodes when only physical coordinates changed.

◆ share_reference_result()

template<typename Value>
std::expected< std::shared_ptr< const Value >, DeformationFailure > serif::geometry::deformation::backend::mfem::detail::share_reference_result ( std::expected< Value, DeformationFailure > result)
nodiscard

Share a successfully compiled immutable table without copying it into each consumer.

Todo
A shared pointer was the easiest way to implement this; however, this introduces some non-zero overhead related to reference counting. Generally, shared pointers should only be used when absolutely necessary and I have not given deep thought to if that is the case here (and more generally across the graph system).
Parameters
resultThe result of a computation that may be successful or may have failed.
Returns
If the inputted result is successful, returns a shared pointer to the result. If the inputted result is a failure, returns the same failure.

◆ surface_parameter_mass_diagonal()

std::expected< std::vector< double >, DeformationFailure > serif::geometry::deformation::backend::mfem::detail::surface_parameter_mass_diagonal ( const ::mfem::FiniteElementSpace & scalar_space,
int surface_attribute,
const ReferenceSurface & reference_surface,
const SurfaceEmbedding & embedding )
nodiscard

Assemble from the current reference trace and its embedding, already paired by the dependency graph.