Functions, called fields in other contexts, describe a mapping between elements of a (discretization) space to values. Those elements can be associated to quadrature points (also called integration points), vertices (nodes), facets, cells, voxels, depending on the discretization method considered.
MGIS/Function
Let us consider a function pk1
returning the first
Piola-Kirchhoff stress in the material frame, MGIS/Function
allows to create an evaluator of the Cauchy stress in
the global frame as follows:
const auto Ft = F | as_tensor<3>;
const auto sig_ev = pk1 | as_tensor<3> | from_pk1_to_cauchy(Ft) | rotate_backwards(R);
where F
is an evaluator the deformation gradient in the
material frame, R
is the rotation matrix from the global
frame to the material frame (a function returning a different rotation
matrix for each element can also be used).
This evaluator, named sig_ev
, only describes the
operations to be performed to calculate the Cauchy stress and does not
make any calculation at this stage. as_tensor<3>
,
from_pk1_to_cauchy
and the object returned by
rotate_backwards(R)
are called modifiers in
MGIS/Function
. The available operators are described in this page. The pipe operator |
is used to chain the operations.
Hence, the following operations are chained:
pk1
as tridimensional
tensors provided by the TFEL/Math
library,R
.sig_ev
exposes the same space as the pk1
function (accessible from the getSpace
method) and the same
call operators (4
sig_evnatures are possible).
For instance, if the values of pk1
can be retrieved by
using indexes (that are not necessarily integers) associated with the
elements of the space, then the values of the Cauchy stress can be
retrieved by the same indexes. Hence, if i is such an index,
pk1(i)
returns the first Piola-Kirchhoff stress in the
material frame, and sig_ev(i)
returns the Cauchy stress in
the global frame.
For spaces with very simple structure, MGIS/Function
provides algorithms, such as the assign
algorithm which
allows to assign the values of an evaluator to a function. Let
sig
be a function, the following code assigns the values
calculated by sig_ev
MGIS/Function
are a set of algorithms, evaluators and
modifiers used to operate and calculate values on functions.
The description of a discretization space is dependent of the solver considered.
A space must provide a way to iterate over its elements:
MGIS/Function
and each element is associated with a single
index. The index type is often an integer, but this is sometimes not the
case. MGIS/Function
assumes that a function defined on an
element space can return the values associated with an element using its
index.MGIS/Function
.
MGIS/Function
assumes that a function defined on a
quadrature space can return the values associated with an quadrature
point using its indexes.Notes
A space describing quadrature points can be either an element space and/or a quadrature space.
C++
Concepts
defined MGIS/Function
In order to adapt to the structures used by as many solvers as
possible, spaces in mgis
are defined using a set of
C++
concepts: SpaceConcept
,
ElementSpaceConcept
, QuadratureSpaceConcept
,
FunctionalSpace
, LinearElementSpaceConcept
and
LinearQuadratureSpaceConcept
.
Let SpaceType
be a type.
SpaceType
satisfies the SpaceConcept
concept if:
size_type
and a
size
method (returning a size_type
). This
method shall return the total number of elements in the discretization
space.SpaceType
satisfies the
ElementSpaceConcept
concept if:
element_index_type
type.SpaceType
satisfies the
LinearElementSpaceConcept
concept if:
ElementSpaceConcept
,linear_element_indexing
which must be
true
,size()-1
. The element_index_type
must be
identical to size_type
.SpaceType
satisfies the
QuadratureSpaceConcept
concept if:
SpaceConcept
,getNumberOfCells
which
returns a size_type
,cell_index_type
type,quadrature_point_index_type
type. In
MGIS/Function
, this type must be an integer type,getNumberOfQuadraturePoints
which returns the number of quadrature points of a given cell.SpaceType
satisfies the
LinearQuadratureSpaceConcept
concept if:
QuadratureSpaceConcept
,cell_element_indexing
which must be true
,getNumberOfCells()-1
. The cell_index_type
must
be identical to size_type
,getQuadraturePointOffset
which must
be a bijection between all valid cell and quadrature points indices and
the range [0:size()-1]
.A functional space is either an element space and/or a quadrature space.
C++
Concepts
defined MGIS/Function
In order to adapt to the structures used by as many solvers as
possible, spaces in mgis
are defined using a set of
C++
concepts: FunctionConcept
,
ElementFunctionConcept
,
QuadratureFunctionConcept
.
see [petscsection_2025] for a discussion.
Function
classFunctionView
class