MGIS 3.1.0
Loading...
Searching...
No Matches
mgis::function::FixedSizeView< FunctionType, N > Struct Template Reference

a modifier returning the values of a function view as a fixed size span or a scalar More...

#include </home/runner/work/MFrontGenericInterfaceSupport/MFrontGenericInterfaceSupport/include/MGIS/Function/FixedSizeView.hxx>

Inheritance diagram for mgis::function::FixedSizeView< FunctionType, N >:
mgis::PreconditionsChecker< FixedSizeView< FunctionType, N > >

Public Types

using Space = function_space<FunctionType>
 type of the space on which the underlying function is defined
using mutable_value_type
 value returned by the non-const call operators: a mutable reference to a scalar if N is equal to 1, a mutable fixed size span otherwise
using ConstructorArgumentType
 a simple alias used to workaround what seems to be a bug in gcc 16.x: the underlying function is passed to the constructors by value if it is a lightweight view and by reference otherwise

Public Member Functions

constexpr FixedSizeView (ConstructorArgumentType)
 constructor, checking the preconditions
template<bool doPreconditionsCheck>
requires (N > 0)
constexpr FixedSizeView (const PreconditionsCheck< doPreconditionsCheck > &, ConstructorArgumentType)
 constructor
constexpr bool check (AbstractErrorHandler &) const
 perform consistency checks
constexpr decltype(auto) getSpace () const
 return the underlying space
constexpr size_type getNumberOfComponents () const MGIS_NOEXCEPT
constexpr auto operator() (const element_index< Space > &) const
 call operator
constexpr auto operator() (const element_workspace< Space > &, const element_index< Space > &) const
 call operator
constexpr auto operator() (const cell_index< Space > &, const quadrature_point_index< Space > &) const
 call operator
constexpr auto operator() (const cell_workspace< Space > &, const cell_index< Space > &, const quadrature_point_index< Space > &) const
 call operator
constexpr mutable_value_type operator() (const element_index< Space > &)
 call operator returning mutable values
constexpr mutable_value_type operator() (const element_workspace< Space > &, const element_index< Space > &)
 call operator returning mutable values
constexpr mutable_value_type operator() (const cell_index< Space > &, const quadrature_point_index< Space > &)
 call operator returning mutable values
constexpr mutable_value_type operator() (const cell_workspace< Space > &, const cell_index< Space > &, const quadrature_point_index< Space > &)
 call operator returning mutable values

Static Public Member Functions

static constexpr bool checkPreconditions (AbstractErrorHandler &, const FunctionType &)
 method checking that the preconditions of the constructor are met

Detailed Description

template<FunctionConcept FunctionType, size_type N>
requires (N > 0)
struct mgis::function::FixedSizeView< FunctionType, N >

a modifier returning the values of a function view as a fixed size span or a scalar

The view is built from a function with exactly N components. Its call operators return the values associated with an integration point:

  • a scalar if N is equal to 1 for the constant call operators and a mutable reference to a scalar for the non-constant ones,
  • a std::span<const real, N> for the constant call operators and a std::span<real, N> for the non-constant ones if N is greater than 1.

Only the call operators which match the way the underlying function can be called are available.

Template Parameters
FunctionTypetype of the underlying function
Nnumber of components of the values returned by the view, which must be strictly positive

Member Typedef Documentation

◆ ConstructorArgumentType

template<FunctionConcept FunctionType, size_type N>
using mgis::function::FixedSizeView< FunctionType, N >::ConstructorArgumentType
Initial value:
std::conditional_t<LightweightViewConcept<FunctionType>,
FunctionType,
FunctionType&>

a simple alias used to workaround what seems to be a bug in gcc 16.x: the underlying function is passed to the constructors by value if it is a lightweight view and by reference otherwise

◆ mutable_value_type

template<FunctionConcept FunctionType, size_type N>
using mgis::function::FixedSizeView< FunctionType, N >::mutable_value_type
Initial value:
std::conditional_t<N == 1, real&, std::span<real, N>>

value returned by the non-const call operators: a mutable reference to a scalar if N is equal to 1, a mutable fixed size span otherwise

Constructor & Destructor Documentation

◆ FixedSizeView() [1/2]

template<FunctionConcept FunctionType, size_type N>
requires (N > 0)
mgis::function::FixedSizeView< FunctionType, N >::FixedSizeView ( ConstructorArgumentType values)
constexpr

constructor, checking the preconditions

Parameters
[in]valuesfunction used to build the view

◆ FixedSizeView() [2/2]

template<FunctionConcept FunctionType, size_type N>
requires (N > 0)
template<bool doPreconditionsCheck>
requires (N > 0)
mgis::function::FixedSizeView< FunctionType, N >::FixedSizeView ( const PreconditionsCheck< doPreconditionsCheck > & pcheck,
ConstructorArgumentType values )
constexpr

constructor

Template Parameters
doPreconditionsCheckboolean stating if the preconditions must be checked
Parameters
[in]pcheckobject stating if preconditions must be checked
[in]valuesfunction used to build the view

Member Function Documentation

◆ check()

template<FunctionConcept FunctionType, size_type N>
requires (N > 0)
bool mgis::function::FixedSizeView< FunctionType, N >::check ( AbstractErrorHandler & eh) const
nodiscardconstexpr

perform consistency checks

Parameters
[in]eherror handler used to report the errors
Returns
true if the number of components of the underlying function is equal to N

◆ checkPreconditions()

template<FunctionConcept FunctionType, size_type N>
requires (N > 0)
bool mgis::function::FixedSizeView< FunctionType, N >::checkPreconditions ( AbstractErrorHandler & eh,
const FunctionType & values )
staticconstexpr

method checking that the preconditions of the constructor are met

Parameters
[in]eherror handler used to report the errors
[in]valuesfunction used to build the view
Returns
true if the number of components of the function is equal to N

◆ getNumberOfComponents()

template<FunctionConcept FunctionType, size_type N>
requires (N > 0)
size_type mgis::function::FixedSizeView< FunctionType, N >::getNumberOfComponents ( ) const
nodiscardconstexpr
Returns
the number of components of the values returned by the view, which is N

◆ getSpace()

template<FunctionConcept FunctionType, size_type N>
requires (N > 0)
decltype(auto) constexpr mgis::function::FixedSizeView< FunctionType, N >::getSpace ( ) const
nodiscardconstexpr

return the underlying space

Returns
the space on which the underlying function is defined

◆ operator()() [1/8]

template<FunctionConcept FunctionType, size_type N>
requires ((internals::FunctionResultQuery<FunctionType>::b3) && (isFunctionResultTypeMappable<FunctionType>))
FixedSizeView< FunctionType, N >::mutable_value_type mgis::function::FixedSizeView< FunctionType, N >::operator() ( const cell_index< Space > & e,
const quadrature_point_index< Space > & i )
nodiscardconstexpr

call operator returning mutable values

Parameters
[in]ecell index
[in]iquadrature point index
Returns
the value of the function at the given integration point, which may be modified: a mutable reference to a scalar if N is equal to 1, a std::span<real, N> otherwise
Note
only available if the underlying function can be called with a cell index and a quadrature point index and if the values it returns can be mapped to mutable memory

◆ operator()() [2/8]

template<FunctionConcept FunctionType, size_type N>
requires ((internals::FunctionResultQuery<FunctionType>::b3) && (isFunctionConstResultTypeMappable<FunctionType>))
auto mgis::function::FixedSizeView< FunctionType, N >::operator() ( const cell_index< Space > & e,
const quadrature_point_index< Space > & i ) const
nodiscardconstexpr

call operator

Parameters
[in]ecell index
[in]iquadrature point index
Returns
the value of the function at the given integration point: a scalar if N is equal to 1, a std::span<const real, N> otherwise
Note
only available if the underlying function can be called with a cell index and a quadrature point index and if the values it returns can be mapped to memory

◆ operator()() [3/8]

template<FunctionConcept FunctionType, size_type N>
requires ((internals::FunctionResultQuery<FunctionType>::b4) && (isFunctionResultTypeMappable<FunctionType>))
FixedSizeView< FunctionType, N >::mutable_value_type mgis::function::FixedSizeView< FunctionType, N >::operator() ( const cell_workspace< Space > & wk,
const cell_index< Space > & e,
const quadrature_point_index< Space > & i )
nodiscardconstexpr

call operator returning mutable values

Parameters
[in]wkcell workspace
[in]ecell index
[in]iquadrature point index
Returns
the value of the function at the given integration point, which may be modified: a mutable reference to a scalar if N is equal to 1, a std::span<real, N> otherwise
Note
only available if the underlying function can be called with a cell workspace, a cell index and a quadrature point index and if the values it returns can be mapped to mutable memory

◆ operator()() [4/8]

template<FunctionConcept FunctionType, size_type N>
requires ((internals::FunctionResultQuery<FunctionType>::b4) && (isFunctionConstResultTypeMappable<FunctionType>))
auto mgis::function::FixedSizeView< FunctionType, N >::operator() ( const cell_workspace< Space > & wk,
const cell_index< Space > & e,
const quadrature_point_index< Space > & i ) const
nodiscardconstexpr

call operator

Parameters
[in]wkcell workspace
[in]ecell index
[in]iquadrature point index
Returns
the value of the function at the given integration point: a scalar if N is equal to 1, a std::span<const real, N> otherwise
Note
only available if the underlying function can be called with a cell workspace, a cell index and a quadrature point index and if the values it returns can be mapped to memory

◆ operator()() [5/8]

template<FunctionConcept FunctionType, size_type N>
requires ((internals::FunctionResultQuery<FunctionType>::b1) && (isFunctionResultTypeMappable<FunctionType>))
FixedSizeView< FunctionType, N >::mutable_value_type mgis::function::FixedSizeView< FunctionType, N >::operator() ( const element_index< Space > & i)
nodiscardconstexpr

call operator returning mutable values

Parameters
[in]iintegration point index
Returns
the value of the function at the given integration point, which may be modified: a mutable reference to a scalar if N is equal to 1, a std::span<real, N> otherwise
Note
only available if the underlying function can be called with an element index and if the values it returns can be mapped to mutable memory

◆ operator()() [6/8]

template<FunctionConcept FunctionType, size_type N>
requires ((internals::FunctionResultQuery<FunctionType>::b1) && (isFunctionConstResultTypeMappable<FunctionType>))
auto mgis::function::FixedSizeView< FunctionType, N >::operator() ( const element_index< Space > & i) const
nodiscardconstexpr

call operator

Parameters
[in]iintegration point index
Returns
the value of the function at the given integration point: a scalar if N is equal to 1, a std::span<const real, N> otherwise
Note
only available if the underlying function can be called with an element index and if the values it returns can be mapped to memory

◆ operator()() [7/8]

template<FunctionConcept FunctionType, size_type N>
requires ((internals::FunctionResultQuery<FunctionType>::b2) && (isFunctionResultTypeMappable<FunctionType>))
FixedSizeView< FunctionType, N >::mutable_value_type mgis::function::FixedSizeView< FunctionType, N >::operator() ( const element_workspace< Space > & wk,
const element_index< Space > & i )
nodiscardconstexpr

call operator returning mutable values

Parameters
[in]wkelement workspace
[in]iintegration point index
Returns
the value of the function at the given integration point, which may be modified: a mutable reference to a scalar if N is equal to 1, a std::span<real, N> otherwise
Note
only available if the underlying function can be called with an element workspace and an element index and if the values it returns can be mapped to mutable memory

◆ operator()() [8/8]

template<FunctionConcept FunctionType, size_type N>
requires ((internals::FunctionResultQuery<FunctionType>::b2) && (isFunctionConstResultTypeMappable<FunctionType>))
auto mgis::function::FixedSizeView< FunctionType, N >::operator() ( const element_workspace< Space > & wk,
const element_index< Space > & i ) const
nodiscardconstexpr

call operator

Parameters
[in]wkelement workspace
[in]iintegration point index
Returns
the value of the function at the given integration point: a scalar if N is equal to 1, a std::span<const real, N> otherwise
Note
only available if the underlying function can be called with an element workspace and an element index and if the values it returns can be mapped to memory

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