|
MGIS 3.1.0
|
Declaration of the algorithms which can be applied to the functions and the evaluators of the MGIS/Function library, that is assign and scalar_reduce, and of the helpers used to check if an evaluator can be assigned to a function. More...
#include <version>#include <concepts>#include <optional>#include "MGIS/Config.hxx"#include "MGIS/AbstractErrorHandler.hxx"#include "MGIS/Function/SpaceConcept.hxx"#include "MGIS/Function/EvaluatorConcept.hxx"#include "MGIS/Function/FunctionConcept.hxx"#include "MGIS/Function/Algorithms.ixx"Namespaces | |
| namespace | mgis |
| the namespace mgis encloses all the MGIS project. | |
Concepts | |
| concept | mgis::function::internals::isEvaluatorAssignableToFunction |
| concept stating that an evaluator can be assigned to a function | |
Functions | |
| constexpr void | mgis::function::internals::assign_value (std::span< real >, const auto &) |
| assigns to a span of dynamic size the values of any container which can be iterated over | |
| constexpr void | mgis::function::internals::assign_value (std::span< real >, const std::span< const real >) |
| assigns to a span of dynamic size the values of a constant span | |
| constexpr void | mgis::function::internals::assign_value (std::span< real >, const std::span< real >) |
| assigns to a span of dynamic size the values of a mutable span | |
| constexpr void | mgis::function::internals::assign_value (real &, const std::span< real > &) |
| assigns to a scalar value the first value of a mutable span | |
| constexpr void | mgis::function::internals::assign_value (real &, const std::span< const real > &) |
| assigns to a scalar value the first value of a constant span | |
| constexpr void | mgis::function::internals::assign_value (real &, const std::span< real, 1u > &) |
| assigns to a scalar value the value of a mutable span of one element | |
| constexpr void | mgis::function::internals::assign_value (real &, const std::span< const real, 1u > &) |
| assigns to a scalar value the value of a constant span of one element | |
| constexpr void | mgis::function::internals::assign_value (real &, const std::array< real, 1u > &) |
| assigns to a scalar value the value of an array of one element | |
| constexpr void | mgis::function::internals::assign_value (std::array< real, 1u > &, const real) |
| assigns a scalar value to the unique element of an array | |
| constexpr void | mgis::function::internals::assign_value (std::array< real, 1u > &, const std::array< real, 1u >) |
| assigns the value of an array of one element to an array of one element | |
| constexpr void | mgis::function::internals::assign_value (std::array< real, 1u > &, const std::span< real >) |
| assigns the first value of a mutable span to an array of one element | |
| constexpr void | mgis::function::internals::assign_value (std::array< real, 1u > &, const std::span< const real >) |
| assigns the first value of a constant span to an array of one element | |
| constexpr void | mgis::function::internals::assign_value (std::array< real, 1u > &, const std::span< real, 1u >) |
| assigns the value of a mutable one element span to an array of one element | |
| constexpr void | mgis::function::internals::assign_value (std::array< real, 1u > &, const std::span< const real, 1u >) |
| assigns the value of a constant span of one element to an array of one element | |
| constexpr void | mgis::function::internals::assign_value (std::span< real, 1u >, const real) |
| assigns a scalar value to the unique element of a span | |
| constexpr void | mgis::function::internals::assign_value (std::span< real >, const real) |
| assigns a scalar value to the first element of a span of dynamic size | |
| constexpr void | mgis::function::internals::assign_value (std::span< real >, const std::span< real, 1u >) |
| assigns the value of a mutable span of one element to the first element of a span of dynamic size | |
| constexpr void | mgis::function::internals::assign_value (std::span< real >, const std::span< const real, 1u >) |
| assigns the value of a constant span of one element to the first element of a span of dynamic size | |
| constexpr void | mgis::function::internals::assign_value (std::span< real, 1u >, const std::span< real >) |
| assigns the first value of a mutable span to a span of one element | |
| constexpr void | mgis::function::internals::assign_value (std::span< real, 1u >, const std::span< const real >) |
| assigns the first value of a constant span to a span of one element | |
| constexpr void | mgis::function::internals::assign_value (std::span< real, 1u >, const std::span< real, 1u >) |
| assigns the value of a mutable span of one element to a span of one element | |
| constexpr void | mgis::function::internals::assign_value (std::span< real, 1u >, const std::span< const real, 1u >) |
| assigns the value of a constant span of one element to a span of one element | |
| constexpr void | mgis::function::internals::assign_value (std::span< real, 1u >, const std::array< real, 1u > &) |
| assigns the value of an array of one element to a span of one element | |
| template<ViewableFunctionArgumentConcept FunctionType, EvaluatorConcept EvaluatorType> requires ( (internals::isEvaluatorAssignableToFunction< EvaluatorType, std::decay_t<FunctionType>>)&& // (LinearElementSpaceConcept<evaluator_space<EvaluatorType>>)) | |
| constexpr bool | mgis::function::assign (AbstractErrorHandler &, FunctionType &&, const EvaluatorType) |
| assigns the values computed by an evaluator to a function, the evaluation being sequential | |
| template<EvaluatorConcept EvaluatorType, typename OperatorType> requires (LinearElementSpaceConcept<evaluator_space<EvaluatorType>>) | |
| constexpr std::optional< real > | mgis::function::scalar_reduce (AbstractErrorHandler &, const EvaluatorType, const OperatorType, const real) |
| reduces the values computed by a scalar evaluator to a single value using the given reduction operator, the evaluation being sequential | |
Declaration of the algorithms which can be applied to the functions and the evaluators of the MGIS/Function library, that is assign and scalar_reduce, and of the helpers used to check if an evaluator can be assigned to a function.
|
nodiscardconstexpr |
assigns the values computed by an evaluator to a function, the evaluation being sequential
implementation of the sequential assign algorithm
The spaces of the function and the evaluator are compared and the number of components of the values returned by both objects is checked to be the same before the values computed by the evaluator are assigned.
| FunctionType | type of the function argument, which may be a reference type |
| EvaluatorType | evaluator type |
| [in] | ctx | error handler used to report the errors |
| [in,out] | f | function assigned |
| [in] | e | evaluator providing the values assigned |
The error messages "unmatched spaces" and "unmatched number of components" are registered in the error handler when the spaces of the function and the evaluator are not equivalent or when the number of components of the values they return differs. The evaluator is then checked before the values are assigned.
|
constexpr |
assigns to a span of dynamic size the values of any container which can be iterated over
implementation of the most generic assign_value function, which iterates over the values of the right hand side
| [out] | lhs | span receiving the values |
| [in] | rhs | container providing the values |
The other overloads, declared in MGIS/Function/Algorithms.hxx, copy the values one by one, those connecting a scalar value and a container of a single value using only the first value of this container.
assigns a scalar value to the first element of a span of dynamic size
|
nodiscardconstexpr |
reduces the values computed by a scalar evaluator to a single value using the given reduction operator, the evaluation being sequential
implementation of the sequential scalar_reduce algorithm
The values computed by the evaluator are checked before being reduced.
| EvaluatorType | evaluator type |
| OperatorType | type of the reduction operator, a binary operation taking two scalar values and returning a scalar value |
| [in] | ctx | error handler used to report the errors |
| [in] | e | evaluator reduced |
| [in] | op | reduction operator |
| [in] | initial_value | value the reduction starts from |
The error message "non scalar evaluator" is registered in the error handler when the values returned by the evaluator have more than one component. The evaluator is then checked before being reduced.