MGIS 3.1.0
Loading...
Searching...
No Matches
SharedSpace.hxx File Reference

Definition of mgis::function::SharedSpace, a class which encapsulates a space in a std::shared_ptr so that this space can be shared by several functions or evaluators, and of the functions which query the encapsulated space. More...

#include <memory>
#include "MGIS/Raise.hxx"
#include "MGIS/Contract.hxx"
#include "MGIS/Function/SpaceConcept.hxx"

Classes

struct  mgis::function::internals::SharedElementSpaceAddElementWorkspace< bool, ElementSpaceConcept >
 helper class used to build the traits of a SharedSpace: this primary template adds no ElementWorkspace type, which is the case when the underlying space does not expose such a type More...
struct  mgis::function::internals::SharedElementSpaceAddElementWorkspace< true, SpaceType >
 specialization used when the underlying space exposes an ElementWorkspace type: this type is forwarded to the traits of the shared space More...
struct  mgis::function::internals::SharedElementSpaceTraits< typename >
 traits of a SharedSpace whose underlying space does not match the ElementSpaceConcept concept, which are thus empty More...
struct  mgis::function::internals::SharedElementSpaceTraits< SpaceType >
 specialization used when the underlying space matches the ElementSpaceConcept concept: the index type and the element workspace type of the underlying space are forwarded to the traits of the shared space More...
struct  mgis::function::internals::SharedLinearElementSpaceTraits< typename >
 helper class used to build the traits of a SharedSpace: this primary template adds nothing, as the underlying space does not match the LinearElementSpaceConcept concept More...
struct  mgis::function::internals::SharedLinearElementSpaceTraits< SpaceType >
 specialization used when the underlying space matches the LinearElementSpaceConcept concept: the elements of the shared space are addressed exactly as those of the underlying space More...
struct  mgis::function::internals::SharedQuadratureSpaceAddCellWorkspace< bool, QuadratureSpaceConcept >
 helper class used to build the traits of a SharedSpace: this primary template adds no CellWorkspace type, which is the case when the underlying space does not expose such a type More...
struct  mgis::function::internals::SharedQuadratureSpaceAddCellWorkspace< true, SpaceType >
 specialization used when the underlying space exposes a CellWorkspace type: this type is forwarded to the traits of the shared space More...
struct  mgis::function::internals::SharedQuadratureSpaceTraits< typename >
 traits of a SharedSpace whose underlying space does not match the QuadratureSpaceConcept concept, which are thus empty More...
struct  mgis::function::internals::SharedQuadratureSpaceTraits< SpaceType >
 specialization used when the underlying space matches the QuadratureSpaceConcept concept: the index types of the underlying space are forwarded to the traits of the shared space More...
struct  mgis::function::internals::SharedLinearQuadratureSpaceTraits< typename >
 helper class used to build the traits of a SharedSpace: this primary template adds nothing, as the underlying space does not match the LinearQuadratureSpaceConcept concept More...
struct  mgis::function::internals::SharedLinearQuadratureSpaceTraits< SpaceType >
 specialization used when the underlying space matches the LinearQuadratureSpaceConcept concept: the cells of the shared space are addressed exactly as those of the underlying space More...
struct  mgis::function::SharedSpace< SpaceType >
 this class provides a way to encapsulate a space into a sharable object More...
struct  mgis::function::SpaceTraits< SharedSpace< SpaceType > >
 specialization of the SpaceTraits class for a shared space: the properties of the underlying space which make sense for a shared space are forwarded by the helpers of the mgis::function::internals namespace More...

Namespaces

namespace  mgis
 the namespace mgis encloses all the MGIS project.

Functions

template<SpaceConcept SpaceType>
 mgis::function::SharedSpace (const std::shared_ptr< const SpaceType > &) -> SharedSpace< SpaceType >
 deduction guide for a pointer to a constant space
template<SpaceConcept SpaceType>
 mgis::function::SharedSpace (const std::shared_ptr< SpaceType > &) -> SharedSpace< SpaceType >
 deduction guide for a pointer to a space which may be modified
template<SpaceConcept SpaceType>
bool mgis::function::areEquivalent (const SharedSpace< SpaceType > &s, const SharedSpace< SpaceType > &s2) MGIS_NOEXCEPT
 checks if two shared spaces are equivalent
template<SpaceConcept SpaceType>
auto mgis::function::getSpaceSize (const SharedSpace< SpaceType > &s)
 returns the size of the encapsulated space
template<QuadratureSpaceConcept SpaceType>
auto mgis::function::getNumberOfCells (const SharedSpace< SpaceType > &s)
 returns the number of cells of the encapsulated space
template<QuadratureSpaceConcept SpaceType>
auto mgis::function::getNumberOfQuadraturePoints (const SharedSpace< SpaceType > &s, const cell_index< SpaceType > &e)
 returns the number of quadrature points of a given cell of the encapsulated space
template<LinearQuadratureSpaceConcept SpaceType>
auto mgis::function::getQuadraturePointOffset (const SharedSpace< SpaceType > &s, const cell_index< SpaceType > &e, const quadrature_point_index< SpaceType > &i)
 returns the offset of a given quadrature point of the encapsulated space
template<ElementSpaceConcept SpaceType>
requires (hasElementWorkspace<SpaceType>)
decltype(auto) mgis::function::getElementWorkspace (const SharedSpace< SpaceType > &s, const element_index< SpaceType > &i)
 returns the workspace associated with a given element of the encapsulated space
template<QuadratureSpaceConcept SpaceType>
requires (hasCellWorkspace<SpaceType>)
decltype(auto) mgis::function::getCellWorkspace (const SharedSpace< SpaceType > &s, const cell_index< SpaceType > &e)
 returns the workspace associated with a given cell of the encapsulated space

Detailed Description

Definition of mgis::function::SharedSpace, a class which encapsulates a space in a std::shared_ptr so that this space can be shared by several functions or evaluators, and of the functions which query the encapsulated space.

Author
Thomas Helfer
Date
02/06/2025

Function Documentation

◆ areEquivalent()

template<SpaceConcept SpaceType>
bool mgis::function::areEquivalent ( const SharedSpace< SpaceType > & s,
const SharedSpace< SpaceType > & s2 )
nodiscard

checks if two shared spaces are equivalent

Template Parameters
SpaceTypetype of the encapsulated spaces
Parameters
[in]sfirst shared space
[in]s2second shared space
Returns
true if the two shared spaces point to the same object
Note
contrary to the areEquivalent function of the underlying space, this function does not compare the properties of the spaces but the identity of the objects which own them

◆ getCellWorkspace()

template<QuadratureSpaceConcept SpaceType>
requires (hasCellWorkspace<SpaceType>)
decltype(auto) mgis::function::getCellWorkspace ( const SharedSpace< SpaceType > & s,
const cell_index< SpaceType > & e )
nodiscard

returns the workspace associated with a given cell of the encapsulated space

Template Parameters
SpaceTypetype of the encapsulated space
Parameters
[in]sshared space
[in]ecell index
Returns
the workspace of the cell of index e
Note
this function is only defined if the encapsulated space exposes a CellWorkspace type

◆ getElementWorkspace()

template<ElementSpaceConcept SpaceType>
requires (hasElementWorkspace<SpaceType>)
decltype(auto) mgis::function::getElementWorkspace ( const SharedSpace< SpaceType > & s,
const element_index< SpaceType > & i )
nodiscard

returns the workspace associated with a given element of the encapsulated space

Template Parameters
SpaceTypetype of the encapsulated space
Parameters
[in]sshared space
[in]ielement index
Returns
the workspace of the element of index i
Note
this function is only defined if the encapsulated space exposes an ElementWorkspace type

◆ getNumberOfCells()

template<QuadratureSpaceConcept SpaceType>
auto mgis::function::getNumberOfCells ( const SharedSpace< SpaceType > & s)
nodiscard

returns the number of cells of the encapsulated space

Template Parameters
SpaceTypetype of the encapsulated space
Parameters
[in]sshared space
Returns
the number of cells of the encapsulated space

◆ getNumberOfQuadraturePoints()

template<QuadratureSpaceConcept SpaceType>
auto mgis::function::getNumberOfQuadraturePoints ( const SharedSpace< SpaceType > & s,
const cell_index< SpaceType > & e )
nodiscard

returns the number of quadrature points of a given cell of the encapsulated space

Template Parameters
SpaceTypetype of the encapsulated space
Parameters
[in]sshared space
[in]ecell index
Returns
the number of quadrature points of the cell of index e

◆ getQuadraturePointOffset()

template<LinearQuadratureSpaceConcept SpaceType>
auto mgis::function::getQuadraturePointOffset ( const SharedSpace< SpaceType > & s,
const cell_index< SpaceType > & e,
const quadrature_point_index< SpaceType > & i )
nodiscard

returns the offset of a given quadrature point of the encapsulated space

Template Parameters
SpaceTypetype of the encapsulated space
Parameters
[in]sshared space
[in]ecell index
[in]iquadrature point index of the cell of index e
Returns
the offset of the considered quadrature point

◆ getSpaceSize()

template<SpaceConcept SpaceType>
auto mgis::function::getSpaceSize ( const SharedSpace< SpaceType > & s)
nodiscard

returns the size of the encapsulated space

Template Parameters
SpaceTypetype of the encapsulated space
Parameters
[in]sshared space
Returns
the number of elements of the encapsulated space

◆ SharedSpace() [1/2]

template<SpaceConcept SpaceType>
mgis::function::SharedSpace ( const std::shared_ptr< const SpaceType > & ) ->SharedSpace< SpaceType >

deduction guide for a pointer to a constant space

Template Parameters
SpaceTypetype of the space pointed to

◆ SharedSpace() [2/2]

template<SpaceConcept SpaceType>
mgis::function::SharedSpace ( const std::shared_ptr< SpaceType > & ) ->SharedSpace< SpaceType >

deduction guide for a pointer to a space which may be modified

Template Parameters
SpaceTypetype of the space pointed to