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

base class for views whose components are stored contiguously in separate memory regions More...

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

Inheritance diagram for mgis::function::CoalescedMemoryAccessFunctionViewBase< Space, N, is_mutable >:
mgis::PreconditionsChecker< CoalescedMemoryAccessFunctionViewBase< Space, N, is_mutable > >

Public Types

template<size_type size>
using MutableValues = std::array<real*, size>
 array of the addresses of the values of size mutable components at a given integration point
template<size_type size>
using ConstValues = std::array<const real*, size>
 array of the addresses of the values of size constant components at a given integration point
using ScalarComponentFunctionView
 type of the function view associated with a single component, whose values are stored contiguously for the different points of the space

Public Member Functions

constexpr CoalescedMemoryAccessFunctionViewBase (const std::array< ScalarComponentFunctionView, N > &)
 constructor, checking that the components share the same space
constexpr CoalescedMemoryAccessFunctionViewBase (const Space &, std::span< const real >)
 constructor splitting the values into N constant scalar function views, available only for constant views
constexpr CoalescedMemoryAccessFunctionViewBase (const Space &, std::span< real >)
 constructor splitting the values into N scalar function views
constexpr const Space & getSpace () const MGIS_NOEXCEPT
 return the underlying space
constexpr MutableValues< N > getValuesPointers (const size_type)
constexpr MutableValues< N > getValuesPointers (const size_type, const size_type)
constexpr ConstValues< N > getValuesPointers (const size_type) const
constexpr ConstValues< N > getValuesPointers (const size_type, const size_type) const
template<size_type begin, size_type size>
requires ((begin + size <= N) && is_mutable && LinearElementSpaceConcept<Space> && (!hasElementWorkspace<Space>))
constexpr MutableValues< size > getValuesPointers (const size_type)
template<size_type begin, size_type size>
requires ((begin + size <= N) && is_mutable && LinearQuadratureSpaceConcept<Space> && (!hasCellWorkspace<Space>))
constexpr MutableValues< size > getValuesPointers (const size_type, const size_type)
template<size_type begin, size_type size>
requires ((begin + size <= N) && LinearElementSpaceConcept<Space> && (!hasElementWorkspace<Space>))
constexpr ConstValues< size > getValuesPointers (const size_type) const
template<size_type begin, size_type size>
requires ((begin + size <= N) && LinearQuadratureSpaceConcept<Space> && (!hasCellWorkspace<Space>))
constexpr ConstValues< size > getValuesPointers (const size_type, const size_type) const
template<size_type offset>
requires ((offset < N) && is_mutable && LinearElementSpaceConcept<Space> && (!hasElementWorkspace<Space>))
constexpr real * getValuePointer (const size_type)
template<size_type offset>
requires ((offset < N) && is_mutable && LinearQuadratureSpaceConcept<Space> && (!hasCellWorkspace<Space>))
constexpr real * getValuePointer (const size_type, const size_type)
template<size_type offset>
requires ((offset < N) && LinearElementSpaceConcept<Space> && (!hasElementWorkspace<Space>))
constexpr const real * getValuePointer (const size_type) const
template<size_type offset>
requires ((offset < N) && LinearQuadratureSpaceConcept<Space> && (!hasCellWorkspace<Space>))
constexpr const real * getValuePointer (const size_type, const size_type) const
template<size_type begin, size_type size>
requires (N > 0) ((begin + size <= N) && is_mutable && LinearElementSpaceConcept<Space> && (!hasElementWorkspace<Space>))
constexpr CoalescedMemoryAccessFunctionViewBase< Space, N, is_mutable >::template MutableValues< size > getValuesPointers (const size_type i)
template<size_type begin, size_type size>
requires (N > 0) ((begin + size <= N) && is_mutable && LinearQuadratureSpaceConcept<Space> && (!hasCellWorkspace<Space>))
constexpr CoalescedMemoryAccessFunctionViewBase< Space, N, is_mutable >::template MutableValues< size > getValuesPointers (const size_type e, const size_type q)
template<size_type begin, size_type size>
requires (N > 0) ((begin + size <= N) && LinearElementSpaceConcept<Space> && (!hasElementWorkspace<Space>))
constexpr CoalescedMemoryAccessFunctionViewBase< Space, N, is_mutable >::template ConstValues< size > getValuesPointers (const size_type i) const
template<size_type begin, size_type size>
requires (N > 0) ((begin + size <= N) && LinearQuadratureSpaceConcept<Space> && (!hasCellWorkspace<Space>))
constexpr CoalescedMemoryAccessFunctionViewBase< Space, N, is_mutable >::template ConstValues< size > getValuesPointers (const size_type e, const size_type q) const

Static Public Member Functions

static constexpr bool checkPreconditions (AbstractErrorHandler &, const std::array< ScalarComponentFunctionView, N > &)
 check that the preconditions to build the view are met
static constexpr bool checkPreconditions (AbstractErrorHandler &, const Space &space, std::span< const real >)
 check that the preconditions to build the view are met
static constexpr bool checkPreconditions (AbstractErrorHandler &, const Space &, std::span< real >)
 check that the preconditions to build the view are met

Protected Member Functions

template<bool doPreconditionsCheck>
requires (N > 0)
constexpr CoalescedMemoryAccessFunctionViewBase (const PreconditionsCheck< doPreconditionsCheck > &, const std::array< ScalarComponentFunctionView, N > &)
 constructor
template<bool doPreconditionsCheck>
requires (!is_mutable)
constexpr CoalescedMemoryAccessFunctionViewBase (const PreconditionsCheck< doPreconditionsCheck > &, const Space &, std::span< const real >)
 constructor
template<bool doPreconditionsCheck>
requires (N > 0)
constexpr CoalescedMemoryAccessFunctionViewBase (const PreconditionsCheck< doPreconditionsCheck > &, const Space &, std::span< real >)
 constructor

Static Protected Member Functions

static constexpr auto splitValues (const Space &, std::span< real >)
 split the values into N mutable scalar function views
static constexpr auto splitValues (const Space &, std::span< const real >)
 split the values into N constant scalar function views

Protected Attributes

std::array< ScalarComponentFunctionView, N > function_components
 function's view for each component

Detailed Description

template<FunctionalSpaceConcept Space, size_type N, bool is_mutable>
requires (N > 0)
struct mgis::function::CoalescedMemoryAccessFunctionViewBase< Space, N, is_mutable >

base class for views whose components are stored contiguously in separate memory regions

Each component is described by a scalar function view whose data are stored contiguously for the different points of the space, as illustrated by the following scheme:

| <------- Component 1 ---------> |....| <----- Component N ---------> |
+-------++-------++------++-------+----+-------++------++------++-------+
| Elt 1 || Elt 2 || .... || Elt N |....| Elt 1 ||Elt 2 || .... || Elt N |
+-------++-------++------++-------+----+-------++------++------++-------+

The values of the different components at a given integration point are not contiguous: the getValuesPointers function gathers the addresses of those values, which allows the values of all the components at a given integration point to be read or written in a single operation. This scheme is used by the CoalescedMemoryAccessTensorView class to map tensorial objects whose components are stored in separate contiguous memory regions.

Template Parameters
Spacetype of the space on which the views are defined
Nnumber of components, which must be strictly positive
is_mutableboolean stating if the view can return mutable pointers

Member Typedef Documentation

◆ ConstValues

template<FunctionalSpaceConcept Space, size_type N, bool is_mutable>
template<size_type size>
using mgis::function::CoalescedMemoryAccessFunctionViewBase< Space, N, is_mutable >::ConstValues = std::array<const real*, size>

array of the addresses of the values of size constant components at a given integration point

Template Parameters
sizenumber of components

◆ MutableValues

template<FunctionalSpaceConcept Space, size_type N, bool is_mutable>
template<size_type size>
using mgis::function::CoalescedMemoryAccessFunctionViewBase< Space, N, is_mutable >::MutableValues = std::array<real*, size>

array of the addresses of the values of size mutable components at a given integration point

Template Parameters
sizenumber of components

◆ ScalarComponentFunctionView

template<FunctionalSpaceConcept Space, size_type N, bool is_mutable>
using mgis::function::CoalescedMemoryAccessFunctionViewBase< Space, N, is_mutable >::ScalarComponentFunctionView
Initial value:
FunctionView<Space,
.data_stride = 1},
is_mutable>
a simple data structure describing how the data of a function is mapped in memory,...
Definition Function.hxx:113
function defined on a space, whose values are stored in an external memory region.
Definition Function.hxx:224

type of the function view associated with a single component, whose values are stored contiguously for the different points of the space

Constructor & Destructor Documentation

◆ CoalescedMemoryAccessFunctionViewBase() [1/6]

template<FunctionalSpaceConcept Space, size_type N, bool is_mutable>
requires (N > 0)
mgis::function::CoalescedMemoryAccessFunctionViewBase< Space, N, is_mutable >::CoalescedMemoryAccessFunctionViewBase ( const std::array< ScalarComponentFunctionView, N > & components)
constexpr

constructor, checking that the components share the same space

Parameters
[in]componentsviews of the components

◆ CoalescedMemoryAccessFunctionViewBase() [2/6]

template<FunctionalSpaceConcept Space, size_type N, bool is_mutable>
requires (!is_mutable)
mgis::function::CoalescedMemoryAccessFunctionViewBase< Space, N, is_mutable >::CoalescedMemoryAccessFunctionViewBase ( const Space & space,
std::span< const real > values )
constexpr

constructor splitting the values into N constant scalar function views, available only for constant views

Parameters
[in]spacespace on which the view is defined
[in]valuesconstant values

◆ CoalescedMemoryAccessFunctionViewBase() [3/6]

template<FunctionalSpaceConcept Space, size_type N, bool is_mutable>
requires (N > 0)
mgis::function::CoalescedMemoryAccessFunctionViewBase< Space, N, is_mutable >::CoalescedMemoryAccessFunctionViewBase ( const Space & space,
std::span< real > values )
constexpr

constructor splitting the values into N scalar function views

Parameters
[in]spacespace on which the view is defined
[in]valuesvalues

◆ CoalescedMemoryAccessFunctionViewBase() [4/6]

template<FunctionalSpaceConcept Space, size_type N, bool is_mutable>
requires (N > 0)
template<bool doPreconditionsCheck>
requires (N > 0)
mgis::function::CoalescedMemoryAccessFunctionViewBase< Space, N, is_mutable >::CoalescedMemoryAccessFunctionViewBase ( const PreconditionsCheck< doPreconditionsCheck > & pcheck,
const std::array< ScalarComponentFunctionView, N > & components )
constexprprotected

constructor

Template Parameters
doPreconditionsCheckboolean stating if the preconditions must be checked
Parameters
[in]pcheckobject stating if preconditions must be checked
[in]componentsviews of the components

◆ CoalescedMemoryAccessFunctionViewBase() [5/6]

template<FunctionalSpaceConcept Space, size_type N, bool is_mutable>
requires (!is_mutable)
template<bool doPreconditionsCheck>
requires (!is_mutable)
mgis::function::CoalescedMemoryAccessFunctionViewBase< Space, N, is_mutable >::CoalescedMemoryAccessFunctionViewBase ( const PreconditionsCheck< doPreconditionsCheck > & pcheck,
const Space & space,
std::span< const real > values )
constexprprotected

constructor

Template Parameters
doPreconditionsCheckboolean stating if the preconditions must be checked
Parameters
[in]pcheckobject stating if preconditions must be checked
[in]spacespace on which the view is defined
[in]valuesconstant values

◆ CoalescedMemoryAccessFunctionViewBase() [6/6]

template<FunctionalSpaceConcept Space, size_type N, bool is_mutable>
requires (N > 0)
template<bool doPreconditionsCheck>
requires (N > 0)
mgis::function::CoalescedMemoryAccessFunctionViewBase< Space, N, is_mutable >::CoalescedMemoryAccessFunctionViewBase ( const PreconditionsCheck< doPreconditionsCheck > & pcheck,
const Space & space,
std::span< real > values )
constexprprotected

constructor

Template Parameters
doPreconditionsCheckboolean stating if the preconditions must be checked
Parameters
[in]pcheckobject stating if preconditions must be checked
[in]spacespace on which the view is defined
[in]valuesvalues

Member Function Documentation

◆ checkPreconditions() [1/3]

template<FunctionalSpaceConcept Space, size_type N, bool is_mutable>
requires (N > 0)
bool mgis::function::CoalescedMemoryAccessFunctionViewBase< Space, N, is_mutable >::checkPreconditions ( AbstractErrorHandler & eh,
const Space & space,
std::span< real > values )
staticnodiscardconstexpr

check that the preconditions to build the view are met

Parameters
[in]eherror handler used to report the errors
[in]spacespace on which the view is defined
[in]valuesvalues
Returns
true if the number of values is equal to N * getSpaceSize(space)

◆ checkPreconditions() [2/3]

template<FunctionalSpaceConcept Space, size_type N, bool is_mutable>
requires (!is_mutable)
bool mgis::function::CoalescedMemoryAccessFunctionViewBase< Space, N, is_mutable >::checkPreconditions ( AbstractErrorHandler & eh,
const Space & space,
std::span< const real > values )
staticnodiscardconstexpr

check that the preconditions to build the view are met

Parameters
[in]eherror handler used to report the errors
[in]spacespace on which the view is defined
[in]valuesconstant values
Returns
true if the number of values is equal to N * getSpaceSize(space)

◆ checkPreconditions() [3/3]

template<FunctionalSpaceConcept Space, size_type N, bool is_mutable>
requires (N > 0)
bool mgis::function::CoalescedMemoryAccessFunctionViewBase< Space, N, is_mutable >::checkPreconditions ( AbstractErrorHandler & eh,
const std::array< ScalarComponentFunctionView, N > & components )
staticnodiscardconstexpr

check that the preconditions to build the view are met

Parameters
[in]eherror handler used to report the errors
[in]componentsviews of the components
Returns
true if the components are defined on equivalent spaces and if all of them are valid

◆ getSpace()

template<FunctionalSpaceConcept Space, size_type N, bool is_mutable>
requires (N > 0)
const Space & mgis::function::CoalescedMemoryAccessFunctionViewBase< Space, N, is_mutable >::getSpace ( ) const
nodiscardconstexpr

return the underlying space

Returns
the space on which the view is defined, i.e. the space of the first component

◆ getValuePointer() [1/4]

template<FunctionalSpaceConcept Space, size_type N, bool is_mutable>
requires ((offset < N) && is_mutable && LinearElementSpaceConcept<Space> && (!hasElementWorkspace<Space>))
template<size_type offset>
requires ((offset < N) && is_mutable && LinearElementSpaceConcept<Space> && (!hasElementWorkspace<Space>))
real * mgis::function::CoalescedMemoryAccessFunctionViewBase< Space, N, is_mutable >::getValuePointer ( const size_type i)
nodiscardconstexpr
Returns
the address of the value of the offset-th component at the given integration point
Template Parameters
offsetindex of the component, strictly smaller than N
Parameters
[in]ioffset associated with the integration point
Note
only available for mutable views defined on a linear element space without element workspace

◆ getValuePointer() [2/4]

template<FunctionalSpaceConcept Space, size_type N, bool is_mutable>
requires ((offset < N) && LinearElementSpaceConcept<Space> && (!hasElementWorkspace<Space>))
template<size_type offset>
requires ((offset < N) && LinearElementSpaceConcept<Space> && (!hasElementWorkspace<Space>))
const real * mgis::function::CoalescedMemoryAccessFunctionViewBase< Space, N, is_mutable >::getValuePointer ( const size_type i) const
nodiscardconstexpr
Returns
the address of the value of the offset-th component at the given integration point
Template Parameters
offsetindex of the component, strictly smaller than N
Parameters
[in]ioffset associated with the integration point
Note
only available for views defined on a linear element space without element workspace

◆ getValuePointer() [3/4]

template<FunctionalSpaceConcept Space, size_type N, bool is_mutable>
requires ((offset < N) && is_mutable && LinearQuadratureSpaceConcept<Space> && (!hasCellWorkspace<Space>))
template<size_type offset>
requires ((offset < N) && is_mutable && LinearQuadratureSpaceConcept<Space> && (!hasCellWorkspace<Space>))
real * mgis::function::CoalescedMemoryAccessFunctionViewBase< Space, N, is_mutable >::getValuePointer ( const size_type e,
const size_type q )
nodiscardconstexpr
Returns
the address of the value of the offset-th component at the given integration point
Template Parameters
offsetindex of the component, strictly smaller than N
Parameters
[in]ecell index
[in]qquadrature point index
Note
only available for mutable views defined on a linear quadrature space without cell workspace

◆ getValuePointer() [4/4]

template<FunctionalSpaceConcept Space, size_type N, bool is_mutable>
requires ((offset < N) && LinearQuadratureSpaceConcept<Space> && (!hasCellWorkspace<Space>))
template<size_type offset>
requires ((offset < N) && LinearQuadratureSpaceConcept<Space> && (!hasCellWorkspace<Space>))
const real * mgis::function::CoalescedMemoryAccessFunctionViewBase< Space, N, is_mutable >::getValuePointer ( const size_type e,
const size_type q ) const
nodiscardconstexpr
Returns
the address of the value of the offset-th component at the given integration point
Template Parameters
offsetindex of the component, strictly smaller than N
Parameters
[in]ecell index
[in]qquadrature point index
Note
only available for views defined on a linear quadrature space without cell workspace

◆ getValuesPointers() [1/8]

template<FunctionalSpaceConcept Space, size_type N, bool is_mutable>
template<size_type begin, size_type size>
requires ((begin + size <= N) && is_mutable && LinearElementSpaceConcept<Space> && (!hasElementWorkspace<Space>))
MutableValues< size > mgis::function::CoalescedMemoryAccessFunctionViewBase< Space, N, is_mutable >::getValuesPointers ( const size_type )
nodiscardconstexpr
Returns
the addresses of the values of the components with indices from begin to begin + size - 1 at the given integration point
Template Parameters
beginindex of the first component
sizenumber of components, such that begin + size is not greater than N
Parameters
[in]ioffset associated with the integration point
Note
only available for mutable views defined on a linear element space without element workspace

◆ getValuesPointers() [2/8]

template<FunctionalSpaceConcept Space, size_type N, bool is_mutable>
requires (is_mutable&& LinearElementSpaceConcept<Space> && (!hasElementWorkspace<Space>))
CoalescedMemoryAccessFunctionViewBase< Space, N, is_mutable >::template MutableValues< N > mgis::function::CoalescedMemoryAccessFunctionViewBase< Space, N, is_mutable >::getValuesPointers ( const size_type i)
nodiscardconstexpr
Returns
the addresses of the values of all the components at the given integration point
Parameters
[in]ioffset associated with the integration point
Note
only available for mutable views defined on a linear element space without element workspace

◆ getValuesPointers() [3/8]

template<FunctionalSpaceConcept Space, size_type N, bool is_mutable>
template<size_type begin, size_type size>
requires ((begin + size <= N) && LinearElementSpaceConcept<Space> && (!hasElementWorkspace<Space>))
ConstValues< size > mgis::function::CoalescedMemoryAccessFunctionViewBase< Space, N, is_mutable >::getValuesPointers ( const size_type ) const
nodiscardconstexpr
Returns
the addresses of the values of the components with indices from begin to begin + size - 1 at the given integration point
Template Parameters
beginindex of the first component
sizenumber of components, such that begin + size is not greater than N
Parameters
[in]ioffset associated with the integration point
Note
only available for views defined on a linear element space without element workspace

◆ getValuesPointers() [4/8]

template<FunctionalSpaceConcept Space, size_type N, bool is_mutable>
requires (LinearElementSpaceConcept<Space> && (!hasElementWorkspace<Space>))
CoalescedMemoryAccessFunctionViewBase< Space, N, is_mutable >::template ConstValues< N > mgis::function::CoalescedMemoryAccessFunctionViewBase< Space, N, is_mutable >::getValuesPointers ( const size_type i) const
nodiscardconstexpr
Returns
the addresses of the values of all the components at the given integration point
Parameters
[in]ioffset associated with the integration point
Note
only available for views defined on a linear element space without element workspace

◆ getValuesPointers() [5/8]

template<FunctionalSpaceConcept Space, size_type N, bool is_mutable>
template<size_type begin, size_type size>
requires ((begin + size <= N) && is_mutable && LinearQuadratureSpaceConcept<Space> && (!hasCellWorkspace<Space>))
MutableValues< size > mgis::function::CoalescedMemoryAccessFunctionViewBase< Space, N, is_mutable >::getValuesPointers ( const size_type ,
const size_type  )
nodiscardconstexpr
Returns
the addresses of the values of the components with indices from begin to begin + size - 1 at the given integration point
Template Parameters
beginindex of the first component
sizenumber of components, such that begin + size is not greater than N
Parameters
[in]ecell index
[in]qquadrature point index
Note
only available for mutable views defined on a linear quadrature space without cell workspace

◆ getValuesPointers() [6/8]

template<FunctionalSpaceConcept Space, size_type N, bool is_mutable>
requires (is_mutable&& LinearQuadratureSpaceConcept<Space> && (!hasCellWorkspace<Space>))
CoalescedMemoryAccessFunctionViewBase< Space, N, is_mutable >::template MutableValues< N > mgis::function::CoalescedMemoryAccessFunctionViewBase< Space, N, is_mutable >::getValuesPointers ( const size_type e,
const size_type q )
nodiscardconstexpr
Returns
the addresses of the values of all the components at the given integration point
Parameters
[in]ecell index
[in]qquadrature point index
Note
only available for mutable views defined on a linear quadrature space without cell workspace

◆ getValuesPointers() [7/8]

template<FunctionalSpaceConcept Space, size_type N, bool is_mutable>
template<size_type begin, size_type size>
requires ((begin + size <= N) && LinearQuadratureSpaceConcept<Space> && (!hasCellWorkspace<Space>))
ConstValues< size > mgis::function::CoalescedMemoryAccessFunctionViewBase< Space, N, is_mutable >::getValuesPointers ( const size_type ,
const size_type  ) const
nodiscardconstexpr
Returns
the addresses of the values of the components with indices from begin to begin + size - 1 at the given integration point
Template Parameters
beginindex of the first component
sizenumber of components, such that begin + size is not greater than N
Parameters
[in]ecell index
[in]qquadrature point index
Note
only available for views defined on a linear quadrature space without cell workspace

◆ getValuesPointers() [8/8]

template<FunctionalSpaceConcept Space, size_type N, bool is_mutable>
requires (LinearQuadratureSpaceConcept<Space> && (!hasCellWorkspace<Space>))
CoalescedMemoryAccessFunctionViewBase< Space, N, is_mutable >::template ConstValues< N > mgis::function::CoalescedMemoryAccessFunctionViewBase< Space, N, is_mutable >::getValuesPointers ( const size_type e,
const size_type q ) const
nodiscardconstexpr
Returns
the addresses of the values of all the components at the given integration point
Parameters
[in]ecell index
[in]qquadrature point index
Note
only available for views defined on a linear quadrature space without cell workspace

◆ splitValues() [1/2]

template<FunctionalSpaceConcept Space, size_type N, bool is_mutable>
requires (N > 0)
auto mgis::function::CoalescedMemoryAccessFunctionViewBase< Space, N, is_mutable >::splitValues ( const Space & space,
std::span< const real > values )
staticconstexprprotected

split the values into N constant scalar function views

Parameters
[in]spacespace on which the views are defined
[in]valuesconstant values, whose number of values must be equal to N * getSpaceSize(space)
Returns
the constant views of the components
Note
this function assumes that the preconditions have been checked before being called

◆ splitValues() [2/2]

template<FunctionalSpaceConcept Space, size_type N, bool is_mutable>
requires (N > 0)
auto mgis::function::CoalescedMemoryAccessFunctionViewBase< Space, N, is_mutable >::splitValues ( const Space & space,
std::span< real > values )
staticconstexprprotected

split the values into N mutable scalar function views

Parameters
[in]spacespace on which the views are defined
[in]valuesvalues, whose number of values must be equal to N * getSpaceSize(space)
Returns
the views of the components
Note
this function assumes that the preconditions have been checked before being called

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