SERiF v0.0.1a
Stellar Evolution and Rotation in Four Dimensions
Loading...
Searching...
No Matches
serif::discretization::backend::mfem::CoefficientTracking Struct Reference

Track coefficient values using an owned snapshot and the identity of their binding. More...

#include <coefficient_tracking.hpp>

Public Member Functions

template<typename ViewT>
bool matches (const ::mfem::Vector &captured, const ViewT &view) const
 Check whether the current coefficients equal a captured snapshot.
 
template<typename ViewT>
::mfem::Vector capture (const ViewT &view)
 

Static Public Member Functions

template<typename ViewT>
static ::mfem::Vector capture (const ViewT &view)
 Copy the current coefficient values into an independent snapshot.
 
template<typename ViewT>
static const void * identity (const ViewT &view)
 Identify the persistent binding associated with the coefficients.
 

Detailed Description

Track coefficient values using an owned snapshot and the identity of their binding.

A coefficient vector describes numerical values, while its binding determines how those values correspond to discretization degrees of freedom. Both pieces of information matter when deciding whether cached work can be reused.

This policy provides three operations to the dependency system:

  • capture copies the current coefficient values into an owned snapshot.
  • matches compares current values against a previously captured snapshot.
  • identity identifies the persistent binding associated with the values.

The vector's allocation is not part of its identity. A different vector containing equal coefficients can represent the same input when it uses the same binding. Conversely, equal coefficients associated with a different binding must not automatically reuse the previous calculation.

This policy supplies comparisons; the dependency system decides which computations must run.

Note
Value comparison uses floating-point equality without a tolerance. It does not check whether the coefficients are finite or admissible; those checks belong to input validation.

Member Function Documentation

◆ capture() [1/2]

template<typename ViewT>
static ::mfem::Vector serif::discretization::backend::mfem::CoefficientTracking::capture ( const ViewT & view)
staticnodiscard

Copy the current coefficient values into an independent snapshot.

Subsequent changes to the source vector do not modify the returned snapshot. The entire supplied vector is copied; if the view contains only selected nodal coefficients, only those selected values are captured.

Template Parameters
ViewTView type exposing its coefficients through a values member.
Parameters
[in]viewView of the current coefficients.
Returns
An owned copy of the coefficient vector.

◆ capture() [2/2]

template<typename ViewT>
::mfem::Vector serif::discretization::backend::mfem::CoefficientTracking::capture ( const ViewT & view)

◆ identity()

template<typename ViewT>
const void * serif::discretization::backend::mfem::CoefficientTracking::identity ( const ViewT & view)
staticnodiscard

Identify the persistent binding associated with the coefficients.

The returned address identifies the binding object, rather than the temporary view or the coefficient vector's storage. Creating another view of the same binding therefore preserves this identity.

Template Parameters
ViewTView type exposing its persistent binding through a binding member.
Parameters
[in]viewView referring to the coefficient binding.
Returns
The address of the binding object.
Precondition
The binding member refers to an object whose lifetime and address remain valid while the dependency system relies on this identity.

◆ matches()

template<typename ViewT>
bool serif::discretization::backend::mfem::CoefficientTracking::matches ( const ::mfem::Vector & captured,
const ViewT & view ) const
nodiscard

Check whether the current coefficients equal a captured snapshot.

The vectors must have the same size and equal corresponding entries. Two empty vectors match. Their storage addresses do not affect the comparison.

This method compares values only. Binding identity is supplied separately by identity and checked by the dependency system.

Template Parameters
ViewTView type exposing its coefficients through a values member.
Parameters
[in]capturedPreviously captured coefficient values.
[in]viewView of the current coefficients.
Returns
True when the sizes and all corresponding values are equal.

The documentation for this struct was generated from the following file: