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

default implementation of a function, which owns its values More...

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

Inheritance diagram for mgis::function::Function< Space, N >:
mgis::PreconditionsChecker< Function< Space, dynamic_extent > > mgis::function::FunctionStorage< Space, dynamic_extent > mgis::function::FunctionView< Space, simple_data_layout_description< N >, true > mgis::PreconditionsChecker< Child > mgis::function::FunctionDataLayout< layout > mgis::function::FunctionDataSize< layout.data_size > mgis::function::FunctionDataStride< layout.data_stride >

Public Member Functions

constexpr Function (const Space &)
 constructor from a space, for a function whose number of components is known at compile time
constexpr Function (const Space &, const size_type)
 constructor from a space and a data size, for a function whose number of components is only known at run time
template<bool doPreconditionsCheck>
requires (N != dynamic_extent)
constexpr Function (const PreconditionsCheck< doPreconditionsCheck > &, const Space &)
 constructor from a space, for a function whose number of components is known at compile time
template<bool doPreconditionsCheck>
requires (N == dynamic_extent)
constexpr Function (const PreconditionsCheck< doPreconditionsCheck > &, const Space &, const size_type)
 constructor from a space and a data size, for a function whose number of components is only known at run time
constexpr Function (const Function &)
 copy constructor when the number of components is only known at run time: copies the values of the function and rebinds the view to them
constexpr Function (Function &&)
 move constructor when the number of components is only known at run time: moves the values of the function and rebinds the view to them
constexpr Function (const Function &)
 copy constructor when the number of components is known at compile time: copies the values of the function and rebinds the view to them
constexpr Function (Function &&)
 move constructor when the number of components is known at compile time: moves the values of the function and rebinds the view to them
constexpr FunctionView< Space, simple_data_layout_description< N >, true > view () &
 return a mutable view of the function
constexpr FunctionView< Space, simple_data_layout_description< N >, false > view () const &
 return an immutable view of the function
auto view () &&=delete
 deletion of the view of a rvalue function to prevent creating a view pointing to values which are about to be destroyed
constexpr bool fill (AbstractErrorHandler &, std::span< const real >) MGIS_NOEXCEPT
 fill the structure using raw data
constexpr bool fill (AbstractErrorHandler &, std::initializer_list< real >) MGIS_NOEXCEPT
 fill the structure using raw data
constexpr ~Function ()
 destructor
Public Member Functions inherited from mgis::function::FunctionStorage< Space, dynamic_extent >
constexpr FunctionStorage (const Space &s)
 constructor for a function whose number of components is known at compile time: allocates N * getSpaceSize(s) values initialized to zero
constexpr ~FunctionStorage ()=default
 destructor
Public Member Functions inherited from mgis::function::FunctionView< Space, simple_data_layout_description< N >, true >
constexpr FunctionView (const Space &, ExternalData, const size_type)
 constructor when the number of components is known at compile time and the stride is only known at run time
constexpr FunctionView (const PreconditionsCheck< doPreconditionsCheck > &, const Space &, ExternalData, const size_type)
 constructor when the number of components is known at compile time and the stride is only known at run time
constexpr FunctionView (const Space &, ExternalData, const size_type, const size_type)
 constructor when both the number of components and the stride are only known at run time
constexpr FunctionView (const PreconditionsCheck< doPreconditionsCheck > &, const Space &, ExternalData, const size_type, const size_type)
 constructor when both the number of components and the stride are only known at run time
constexpr FunctionView (const Space &, ExternalData, const size_type)
 constructor when both the number of components and the stride are only known at run time, the stride being taken equal to the number of components
constexpr FunctionView (const PreconditionsCheck< doPreconditionsCheck > &, const Space &, ExternalData, const size_type)
 constructor when both the number of components and the stride are only known at run time, the stride being taken equal to the number of components
constexpr FunctionView (const Space &, ExternalData, const size_type)
 constructor when the number of components is only known at run time and the stride is known at compile time
constexpr FunctionView (const PreconditionsCheck< doPreconditionsCheck > &, const Space &, ExternalData, const size_type)
 constructor when the number of components is only known at run time and the stride is known at compile time
constexpr FunctionView (const Space &, ExternalData)
 constructor when both the number of components and the stride are known at compile time
constexpr FunctionView (const PreconditionsCheck< doPreconditionsCheck > &, const Space &, ExternalData)
 constructor when both the number of components and the stride are known at compile time
constexpr FunctionView (const Space &, ExternalData, const FunctionDataLayout< layout > &)
 constructor when both the number of components and the stride are only known at run time and are given by a data layout object
constexpr FunctionView (const PreconditionsCheck< doPreconditionsCheck > &, const Space &, ExternalData, const FunctionDataLayout< layout > &)
 constructor when both the number of components and the stride are only known at run time and are given by a data layout object
constexpr FunctionView (const Space &, ExternalData, const FunctionDataLayout< layout > &)
 constructor when the number of components is known at compile time and the stride is only known at run time and given by a data layout object
constexpr FunctionView (const PreconditionsCheck< doPreconditionsCheck > &, const Space &, ExternalData, const FunctionDataLayout< layout > &)
 constructor when the number of components is known at compile time and the stride is only known at run time and given by a data layout object
constexpr FunctionView (const Space &, ExternalData, const FunctionDataLayout< layout > &)
 constructor when the number of components is only known at run time and given by a data layout object, the stride being known at compile time
constexpr FunctionView (const PreconditionsCheck< doPreconditionsCheck > &, const Space &, ExternalData, const FunctionDataLayout< layout > &)
 constructor when the number of components is only known at run time and given by a data layout object, the stride being known at compile time
constexpr FunctionView (FunctionView &&)=default
 move constructor
constexpr FunctionView (const FunctionView &)=default
 copy constructor
constexpr const Space & getSpace () const MGIS_NOEXCEPT
constexpr real * data (mgis::attributes::UnsafeAttribute, const size_type)
 return a pointer to the values associated with an integration point, given its offset
constexpr real * data (mgis::attributes::UnsafeAttribute, const size_type, const size_type)
 return a pointer to the values associated with an integration point, given the index of its cell and its own index
constexpr const real * data (mgis::attributes::UnsafeAttribute, const size_type) const
 return a pointer to the constant values associated with an integration point, given its offset
constexpr const real * data (mgis::attributes::UnsafeAttribute, const size_type, const size_type) const
 return a pointer to the constant values associated with an integration point, given the index of its cell and its own index
constexpr ValuesView operator() (const size_type)
 return the values associated with an integration point, given its offset
constexpr ValuesView operator() (const size_type, const size_type)
 return the values associated with an integration point, given the index of its cell and its own index
constexpr ConstValuesView operator() (const size_type) const
 return the constant values associated with an integration point, given its offset
constexpr ConstValuesView operator() (const size_type, const size_type) const
 return the constant values associated with an integration point, given the index of its cell and its own index
constexpr bool checkCompatibility (const FunctionView &) const
 check if the given view can be used in place of the current one
constexpr std::span< real > data ()
constexpr std::span< const real > data () const
constexpr ~FunctionView ()=default
 destructor
Public Member Functions inherited from mgis::function::FunctionDataLayout< layout >
 FunctionDataLayout ()=default
 default constructor
 FunctionDataLayout (FunctionDataLayout &&)=default
 move constructor
 FunctionDataLayout (const FunctionDataLayout &)=default
 copy constructor
FunctionDataLayout & operator= (FunctionDataLayout &&)=default
 move assignment operator
FunctionDataLayout & operator= (const FunctionDataLayout &)=default
 copy assignment operator
 ~FunctionDataLayout ()=default
 destructor
Public Member Functions inherited from mgis::function::FunctionDataSize< layout.data_size >
constexpr bool isScalar () const MGIS_NOEXCEPT
constexpr size_type getNumberOfComponents () const MGIS_NOEXCEPT
Public Member Functions inherited from mgis::function::FunctionDataStride< layout.data_stride >
constexpr size_type getDataStride () const MGIS_NOEXCEPT

Static Public Member Functions

static constexpr bool checkPreconditions (AbstractErrorHandler &, const Space &)
 check that the preconditions to build the function are met when the number of components is known at compile time
static constexpr bool checkPreconditions (AbstractErrorHandler &, const Space &, const size_type)
 check that the preconditions to build the function are met when the number of components is only known at run time
Static Public Member Functions inherited from mgis::function::FunctionView< Space, simple_data_layout_description< N >, true >
static constexpr bool checkPreconditions (AbstractErrorHandler &, const Space &, ExternalData)
 check that the preconditions to build the view are met when the number of components and the stride are known at compile time
static constexpr bool checkPreconditions (AbstractErrorHandler &, const Space &, ExternalData, const size_type)
 check that the preconditions to build the view are met when the number of components is only known at run time and the stride is known at compile time
static constexpr bool checkPreconditions (AbstractErrorHandler &, const Space &, ExternalData, const size_type)
 check that the preconditions to build the view are met when the number of components is known at compile time and the stride is only known at run time
static constexpr bool checkPreconditions (AbstractErrorHandler &, const Space &, ExternalData, const size_type)
 check that the preconditions to build the view are met when both the number of components and the stride are only known at run time, the stride being taken equal to the number of components
static constexpr bool checkPreconditions (AbstractErrorHandler &, const Space &, ExternalData, const size_type, const size_type)
 check that the preconditions to build the view are met when both the number of components and the stride are only known at run time
static constexpr bool checkPreconditions (AbstractErrorHandler &, const Space &, ExternalData, const FunctionDataLayout< layout > &)
 check that the preconditions to build the view are met when both the number of components and the stride are only known at run time and are given by a data layout object

Additional Inherited Members

Public Types inherited from mgis::function::FunctionView< Space, simple_data_layout_description< N >, true >
using ExternalData
 type of the view to the external data used by the view, which is a mutable span if is_mutable is true, a constant span otherwise
using ValuesView
 type of the value returned by the call operator, which is a reference to a scalar value if the number of components is equal to one at compile time, a mutable std::span otherwise
using ConstValuesView
 type of the value returned by the call operator of a constant view, i.e. a constant version of ValuesView
Static Public Attributes inherited from mgis::function::FunctionView< Space, simple_data_layout_description< N >, true >
static constexpr bool allowScalarAccessor
 true if the view can be seen as a scalar valued function, i.e. if the number of components is equal to one or is only known at run time
Protected Member Functions inherited from mgis::function::FunctionDataLayout< layout >
constexpr size_type getDataOffset (const size_type) const MGIS_NOEXCEPT
 the data offset of an integration point is its offset multiplied by the stride, which is taken from the template parameter when it is known at compile time, from the FunctionDataStride base class otherwise
Protected Attributes inherited from mgis::function::FunctionStorage< Space, dynamic_extent >
std::vector< real > storage_values
 values
Protected Attributes inherited from mgis::function::FunctionView< Space, simple_data_layout_description< N >, true >
const Space space
 underlying discretization space
ExternalData values
 view to the values stored in the external memory region

Detailed Description

template<LinearFunctionalSpaceConcept Space, size_type N = dynamic_extent>
requires (N > 0)
struct mgis::function::Function< Space, N >

default implementation of a function, which owns its values

A Function stores its values in a FunctionStorage and derives from the corresponding mutable FunctionView, so it can be called like a function. It matches the FunctionConcept concept but not the EvaluatorConcept concept, whose check function is deleted: a view shall be created to evaluate a function.

Template Parameters
Spacetype of the functional space
Nnumber of components, which may be dynamic_extent and which must be greater than zero
Note
the data stride is equal to the data size

Constructor & Destructor Documentation

◆ Function() [1/8]

template<LinearFunctionalSpaceConcept Space, size_type N>
requires (N != dynamic_extent)
mgis::function::Function< Space, N >::Function ( const Space & s)
constexpr

constructor from a space, for a function whose number of components is known at compile time

Parameters
[in]sspace on which the function is defined

◆ Function() [2/8]

template<LinearFunctionalSpaceConcept Space, size_type N>
requires (N == dynamic_extent)
mgis::function::Function< Space, N >::Function ( const Space & s,
const size_type dsize )
constexpr

constructor from a space and a data size, for a function whose number of components is only known at run time

Parameters
[in]sspace on which the function is defined
[in]dsizenumber of components (data size)

◆ Function() [3/8]

template<LinearFunctionalSpaceConcept Space, size_type N>
requires (N != dynamic_extent)
template<bool doPreconditionsCheck>
requires (N != dynamic_extent)
mgis::function::Function< Space, N >::Function ( const PreconditionsCheck< doPreconditionsCheck > & pcheck,
const Space & s )
constexpr

constructor from a space, for a function whose number of components is known at compile time

Template Parameters
doPreconditionsCheckif true, the preconditions are checked, otherwise they are skipped
Parameters
[in]pchecktag stating if the preconditions are checked (preconditions_check) or skipped (no_precondition_check)
[in]sspace on which the function is defined

◆ Function() [4/8]

template<LinearFunctionalSpaceConcept Space, size_type N>
requires (N == dynamic_extent)
template<bool doPreconditionsCheck>
requires (N == dynamic_extent)
mgis::function::Function< Space, N >::Function ( const PreconditionsCheck< doPreconditionsCheck > & pcheck,
const Space & s,
const size_type dsize )
constexpr

constructor from a space and a data size, for a function whose number of components is only known at run time

Template Parameters
doPreconditionsCheckif true, the preconditions are checked, otherwise they are skipped
Parameters
[in]pchecktag stating if the preconditions are checked (preconditions_check) or skipped (no_precondition_check)
[in]sspace on which the function is defined
[in]dsizedata size

◆ Function() [5/8]

template<LinearFunctionalSpaceConcept Space, size_type N>
requires (N == dynamic_extent)
mgis::function::Function< Space, N >::Function ( const Function< Space, N > & f)
constexpr

copy constructor when the number of components is only known at run time: copies the values of the function and rebinds the view to them

the view is bound to the values owned by the constructed function; no precondition check is required since the storage has just been created with the expected size

the FunctionView base is constructed with this->storage_values, i.e. it points to the values owned by the constructed function, not to the values of f

Parameters
[in]ffunction to copy

◆ Function() [6/8]

template<LinearFunctionalSpaceConcept Space, size_type N>
requires (N == dynamic_extent)
mgis::function::Function< Space, N >::Function ( Function< Space, N > && f)
constexpr

move constructor when the number of components is only known at run time: moves the values of the function and rebinds the view to them

same as the copy constructor, except that the values are moved and not copied

the values are moved, not copied, and the FunctionView base is bound to the values owned by the constructed function

Parameters
[in]ffunction to move

◆ Function() [7/8]

template<LinearFunctionalSpaceConcept Space, size_type N = dynamic_extent>
mgis::function::Function< Space, N >::Function ( const Function< Space, N > & )
constexpr

copy constructor when the number of components is known at compile time: copies the values of the function and rebinds the view to them

Parameters
[in]ffunction to copy

◆ Function() [8/8]

template<LinearFunctionalSpaceConcept Space, size_type N = dynamic_extent>
mgis::function::Function< Space, N >::Function ( Function< Space, N > && )
constexpr

move constructor when the number of components is known at compile time: moves the values of the function and rebinds the view to them

Parameters
[in]ffunction to move

Member Function Documentation

◆ checkPreconditions() [1/2]

template<LinearFunctionalSpaceConcept Space, size_type N>
requires (N != dynamic_extent)
bool mgis::function::Function< Space, N >::checkPreconditions ( AbstractErrorHandler & ,
const Space &  )
staticnodiscardconstexpr

check that the preconditions to build the function are met when the number of components is known at compile time

Parameters
[in]ehunused error handler
[in]sunused space
Returns
always true: no check is required in this case

◆ checkPreconditions() [2/2]

template<LinearFunctionalSpaceConcept Space, size_type N>
requires (N == dynamic_extent)
bool mgis::function::Function< Space, N >::checkPreconditions ( AbstractErrorHandler & eh,
const Space & ,
const size_type dsize )
staticnodiscardconstexpr

check that the preconditions to build the function are met when the number of components is only known at run time

Parameters
[in]eherror handler used to report the detected errors
[in]sunused space
[in]dsizenumber of components (data size)
Returns
true if the number of components is greater than zero

◆ fill() [1/2]

template<LinearFunctionalSpaceConcept Space, size_type N>
requires (N > 0)
bool mgis::function::Function< Space, N >::fill ( AbstractErrorHandler & eh,
std::initializer_list< real > values )
nodiscardconstexpr

fill the structure using raw data

Parameters
[in]eherror handler used to report the detected errors
[in]valuesraw data, whose size must be equal to the total number of values held by the function
Returns
true if the raw data has been copied in the function values

◆ fill() [2/2]

template<LinearFunctionalSpaceConcept Space, size_type N>
requires (N > 0)
bool mgis::function::Function< Space, N >::fill ( AbstractErrorHandler & eh,
std::span< const real > values )
nodiscardconstexpr

fill the structure using raw data

Parameters
[in]eherror handler used to report the detected errors
[in]valuesraw data, whose size must be equal to the total number of values held by the function
Returns
true if the raw data has been copied in the function values

◆ view() [1/2]

template<LinearFunctionalSpaceConcept Space, size_type N>
requires (N > 0)
FunctionView< Space, simple_data_layout_description< N >, true > mgis::function::Function< Space, N >::view ( ) &
nodiscardconstexpr

return a mutable view of the function

Returns
a mutable view sharing the values owned by the function

◆ view() [2/2]

template<LinearFunctionalSpaceConcept Space, size_type N>
requires (N > 0)
FunctionView< Space, simple_data_layout_description< N >, false > mgis::function::Function< Space, N >::view ( ) const &
nodiscardconstexpr

return an immutable view of the function

Returns
an immutable view of the function values

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