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

File which defines the concept an evaluator must satisfy and the helpers used to query the space on which an evaluator is defined and the type of the values it returns. More...

#include <concepts>
#include <type_traits>
#include "MGIS/Config.hxx"
#include "MGIS/AbstractErrorHandler.hxx"
#include "MGIS/Function/CompileTimeSize.hxx"
#include "MGIS/Function/SpaceConcept.hxx"
#include "MGIS/Function/EvaluatorConcept.ixx"

Classes

struct  mgis::function::internals::EvaluatorResultQueryImplementation1< bool, EvaluatorType >
 helper class used to determine the type returned by an evaluator called with an element index, which is an invalid type if the evaluator cannot be called this way More...
struct  mgis::function::internals::EvaluatorResultQueryImplementation1< true, EvaluatorType >
 specialization used when the evaluator can be called this way More...
struct  mgis::function::internals::EvaluatorResultQueryImplementation2< bool, EvaluatorType >
 helper class used to determine the type returned by an evaluator called with an element workspace and an element index, which is an invalid type if the evaluator cannot be called this way More...
struct  mgis::function::internals::EvaluatorResultQueryImplementation2< true, EvaluatorType >
 specialization used when the evaluator can be called this way More...
struct  mgis::function::internals::EvaluatorResultQueryImplementation3< bool, EvaluatorType >
 helper class used to determine the type returned by an evaluator called with a cell index and a quadrature point index, which is an invalid type if the evaluator cannot be called this way More...
struct  mgis::function::internals::EvaluatorResultQueryImplementation3< true, EvaluatorType >
 specialization used when the evaluator can be called this way More...
struct  mgis::function::internals::EvaluatorResultQueryImplementation4< bool, EvaluatorType >
 helper class used to determine the type returned by an evaluator called with a cell workspace, a cell index and a quadrature point index, which is an invalid type if the evaluator cannot be called this way More...
struct  mgis::function::internals::EvaluatorResultQueryImplementation4< true, EvaluatorType >
 specialization used when the evaluator can be called this way More...
struct  mgis::function::internals::EvaluatorResultQueryImplementation< bool, EvaluatorType >
 helper class used to determine how an evaluator can be called and the type of the values it returns More...
struct  mgis::function::internals::EvaluatorResultQueryImplementation< true, EvaluatorType >
 specialization used when the evaluator provides a getSpace function More...
struct  mgis::function::internals::EvaluatorResultQuery< EvaluatorType >
 alias used to determine how an evaluator can be called and the type of the values it returns More...
struct  mgis::function::internals::NumberOfComponents< EvaluatorType >
 number of components of an evaluator when known at compile-time, dynamic_extent otherwise More...

Namespaces

namespace  mgis
 the namespace mgis encloses all the MGIS project.

Concepts

concept  mgis::function::EvaluatorConcept
 a concept that must satisfy an evaluator
concept  mgis::function::ElementEvaluatorConcept
 concept defining evaluators working on an element space
concept  mgis::function::QuadratureEvaluatorConcept
 concept defining evaluators working on a quadrature space
concept  mgis::function::internals::is_pointer_to_real
 concept satisfied by a pointer to a scalar value, possibly constant
concept  mgis::function::internals::is_real
 concept satisfied by real, possibly const or a reference

Typedefs

template<EvaluatorConcept EvaluatorType>
using mgis::function::evaluator_space
 alias giving the type of the space on which an evaluator is defined
template<EvaluatorConcept EvaluatorType>
using mgis::function::evaluator_result
 type of the result of an evaluator, i.e. the type of the constant values returned by the evaluator, which can be a scalar value, a constant std::span or a constant std::array

Functions

constexpr bool mgis::function::checkMatchingSpaces (AbstractErrorHandler &ctx, const EvaluatorConcept auto &e1, const EvaluatorConcept auto &e2)
 check if the given evaluators share the same space
template<typename ResultType>
requires ( requires(ResultType & rr) { { rr.data() } -> internals::is_pointer_to_real; })
constexpr auto mgis::function::getDataPointer (ResultType &&r)
 returns a pointer to the values held by an object with a data method, such as std::span, std::array or the tensorial objects of TFEL/Math
template<internals::is_real ScalarType>
constexpr auto mgis::function::getDataPointer (ScalarType &&r) MGIS_NOEXCEPT
 returns a pointer to a scalar value
template<EvaluatorConcept EvaluatorType>
constexpr decltype(auto) mgis::function::internals::disambiguateGetSpace (const EvaluatorType &e)
 This helper function allows to disambiguate the call to the getSpace function.
template<EvaluatorConcept EvaluatorType>
constexpr bool mgis::function::internals::disambiguateCheck (AbstractErrorHandler &eh, const EvaluatorType &e)
 This helper function allows to disambiguate the call to the check function.
template<EvaluatorConcept EvaluatorType>
constexpr mgis::size_type mgis::function::internals::disambiguateGetNumberOfComponents (const EvaluatorType &e)
 This helper function allows to disambiguate the call to the getNumberOfComponents function.
template<EvaluatorConcept EvaluatorType, size_type N>
constexpr bool mgis::function::internals::checkEvaluatorNumberOfComponentsCompatibility () MGIS_NOEXCEPT
 checks if the number of components of an evaluator is compatible with the number of components expected by a modifier

Variables

template<EvaluatorConcept EvaluatorType>
constexpr auto mgis::function::isEvaluatorResultTypeMappable
 true if the result of an evaluator is a mappable type, i.e. a type for which the getDataPointer function returns a pointer to the values it holds

Detailed Description

File which defines the concept an evaluator must satisfy and the helpers used to query the space on which an evaluator is defined and the type of the values it returns.

Author
Thomas Helfer
Date
14/05/2025

Typedef Documentation

◆ evaluator_result

template<EvaluatorConcept EvaluatorType>
using mgis::function::evaluator_result
Initial value:
alias used to determine how an evaluator can be called and the type of the values it returns
Definition EvaluatorConcept.hxx:270

type of the result of an evaluator, i.e. the type of the constant values returned by the evaluator, which can be a scalar value, a constant std::span or a constant std::array

Template Parameters
EvaluatorTypeevaluator type

◆ evaluator_space

template<EvaluatorConcept EvaluatorType>
using mgis::function::evaluator_space
Initial value:
std::decay_t<decltype(getSpace(std::declval<EvaluatorType>()))>

alias giving the type of the space on which an evaluator is defined

Template Parameters
EvaluatorTypeevaluator type

Function Documentation

◆ checkEvaluatorNumberOfComponentsCompatibility()

template<EvaluatorConcept EvaluatorType, size_type N>
bool mgis::function::internals::checkEvaluatorNumberOfComponentsCompatibility ( )
nodiscardconstexpr

checks if the number of components of an evaluator is compatible with the number of components expected by a modifier

The check is always satisfied if the number of components of the evaluator is only known at run time.

Template Parameters
EvaluatorTypeevaluator type
Nnumber of components expected by the modifier
Returns
true if the number of components is compatible

◆ checkMatchingSpaces()

bool mgis::function::checkMatchingSpaces ( AbstractErrorHandler & ctx,
const EvaluatorConcept auto & e1,
const EvaluatorConcept auto & e2 )
nodiscardconstexpr

check if the given evaluators share the same space

implementation of the checkMatchingSpaces function

Parameters
[in]ctxerror handler used to report the errors
[in]e1first evaluator
[in]e2second evaluator
Returns
true if the two evaluators share the same space
Note
if the spaces of the two evaluators are not equivalent, the error message "unmatched quadrature spaces" is registered in the error handler and the call returns false.

◆ disambiguateCheck()

template<EvaluatorConcept EvaluatorType>
bool mgis::function::internals::disambiguateCheck ( AbstractErrorHandler & eh,
const EvaluatorType & e )
nodiscardconstexpr

This helper function allows to disambiguate the call to the check function.

forwards the call to the check function of the evaluator

Template Parameters
EvaluatorTypeevaluator type
Parameters
[in]eherror handler
[in]eevaluator
Returns
true if the values computed by the evaluator are valid

◆ disambiguateGetNumberOfComponents()

template<EvaluatorConcept EvaluatorType>
mgis::size_type mgis::function::internals::disambiguateGetNumberOfComponents ( const EvaluatorType & e)
nodiscardconstexpr

This helper function allows to disambiguate the call to the getNumberOfComponents function.

forwards the call to the getNumberOfComponents function

Template Parameters
EvaluatorTypeevaluator type
Parameters
[in]eevaluator
Returns
the number of components of the values returned by the evaluator

◆ disambiguateGetSpace()

template<EvaluatorConcept EvaluatorType>
decltype(auto) mgis::function::internals::disambiguateGetSpace ( const EvaluatorType & e)
constexpr

This helper function allows to disambiguate the call to the getSpace function.

forwards the call to the getSpace function of the evaluator

Template Parameters
EvaluatorTypeevaluator type
Parameters
[in]eevaluator
Returns
the space on which the evaluator is defined

◆ getDataPointer() [1/2]

template<typename ResultType>
requires ( requires(ResultType & rr) { { rr.data() } -> internals::is_pointer_to_real; })
auto mgis::function::getDataPointer ( ResultType && r)
nodiscardconstexpr

returns a pointer to the values held by an object with a data method, such as std::span, std::array or the tensorial objects of TFEL/Math

Template Parameters
ResultTypetype of the object
Parameters
[in]robject exposing a data method returning a pointer to scalar values
Returns
a pointer to the values held by the object
Note
getDataPointer is used by the views and modifiers to map the results of functions and evaluators. It can be overloaded to support other result types.

◆ getDataPointer() [2/2]

template<internals::is_real ScalarType>
auto mgis::function::getDataPointer ( ScalarType && r)
nodiscardconstexpr

returns a pointer to a scalar value

Template Parameters
ScalarTypetype of the scalar value, which may be a constant reference or a mutable reference
Parameters
[in]rscalar value
Returns
a pointer to the scalar value

Variable Documentation

◆ isEvaluatorResultTypeMappable

template<EvaluatorConcept EvaluatorType>
auto mgis::function::isEvaluatorResultTypeMappable
inlineconstexpr
Initial value:
=
}
constexpr auto getDataPointer(ResultType &&r)
returns a pointer to the values held by an object with a data method, such as std::span,...
Definition EvaluatorConcept.hxx:421
typename internals::EvaluatorResultQuery< EvaluatorType >::type evaluator_result
type of the result of an evaluator, i.e. the type of the constant values returned by the evaluator,...
Definition EvaluatorConcept.hxx:368
concept satisfied by a pointer to a scalar value, possibly constant
Definition EvaluatorConcept.hxx:393

true if the result of an evaluator is a mappable type, i.e. a type for which the getDataPointer function returns a pointer to the values it holds

Template Parameters
EvaluatorTypeevaluator type