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

This file declares the BinaryOperationModifier and BinaryOperationModifier2 classes, which build a new evaluator by applying a binary operation to the values returned by two existing evaluators, the binary_operation function used to build such evaluators and the predefined modifiers add, substract, multiply, divide, mean_value and inner_product. More...

Classes

struct  mgis::function::internals::BinaryOperationModifierBase< CallableType, FirstEvaluatorType, SecondEvaluatorType >
 helper base class giving the number of components of the values returned by a binary operation applied to two evaluators More...
struct  mgis::function::BinaryOperationModifier< CallableType, FirstEvaluatorType, SecondEvaluatorType >
 an evaluator applying a binary operation to the values returned by two evaluators More...
struct  mgis::function::BinaryOperationModifier2< CallableType, FirstEvaluatorType, SecondEvaluatorType >
 an evaluator applying a binary operation to the values returned by two evaluators, without storing this operation More...
struct  mgis::function::internals::BinaryOperatorCurrying< CallableType, SecondEvaluatorType >
 partial application of a binary operation to the evaluator of its second argument More...
struct  mgis::function::internals::BinaryOperatorCurrying2< CallableType, SecondEvaluatorType >
 partial application of a binary operation to the evaluator of its second argument, without storing the operation More...
struct  mgis::function::internals::binary_operation_modifier< CallableType >
 helper applying a stored binary operation to one or two evaluators More...
struct  mgis::function::internals::binary_operation_modifier2_impl< CallableType >
 helper applying a binary operation which is not stored in the helper to one or two evaluators More...

Namespaces

namespace  mgis
 the namespace mgis encloses all the MGIS project.

Functions

template<typename CallableType, EvaluatorConcept FirstEvaluatorType, EvaluatorConcept SecondEvaluatorType>
MGIS_HOST_DEVICE constexpr mgis::size_type mgis::function::getNumberOfComponents (const BinaryOperationModifier< CallableType, FirstEvaluatorType, SecondEvaluatorType > &)
 return the number of components of the values returned by a binary operation
template<typename CallableType, EvaluatorConcept FirstEvaluatorType, EvaluatorConcept SecondEvaluatorType>
MGIS_HOST_DEVICE constexpr mgis::size_type mgis::function::getNumberOfComponents (const BinaryOperationModifier2< CallableType, FirstEvaluatorType, SecondEvaluatorType > &)
 return the number of components of the values returned by a binary operation which does not store its callable object
template<typename CallableType>
MGIS_HOST_DEVICE constexpr auto mgis::function::internals::binary_operation_modifier2 (CallableType)
 create a helper from a callable object which is only used to deduce the type of the binary operation
template<typename CallableType, typename SecondEvaluatorType>
requires (EvaluatorConcept<std::decay_t<SecondEvaluatorType>>)
MGIS_HOST_DEVICE constexpr auto mgis::function::binary_operation (CallableType &&, SecondEvaluatorType &&)
 partially apply a binary operation to the evaluator of its second argument
template<typename CallableType, typename FirstEvaluatorType, typename SecondEvaluatorType>
requires ((EvaluatorConcept<std::decay_t<FirstEvaluatorType>>)&& // (EvaluatorConcept<std::decay_t<SecondEvaluatorType>>)&& // (std::invocable< std::decay_t<CallableType>, evaluator_result<std::decay_t<FirstEvaluatorType>>, evaluator_result<std::decay_t<SecondEvaluatorType>>>))
MGIS_HOST_DEVICE constexpr auto mgis::function::binary_operation (CallableType &&, FirstEvaluatorType &&, SecondEvaluatorType &&)
 apply a binary operation to the values returned by two evaluators

Variables

template<typename CallableType, EvaluatorConcept FirstEvaluatorType, EvaluatorConcept SecondEvaluatorType>
constexpr auto mgis::function::BinaryOperationModifierRequirements
 requirements which must be satisfied by a binary operation which is stored in the evaluator it applies to
template<typename CallableType, EvaluatorConcept FirstEvaluatorType, EvaluatorConcept SecondEvaluatorType>
constexpr auto mgis::function::BinaryOperationModifier2Requirements
 requirements which must be satisfied by a binary operation which is not stored in the evaluator it applies to

Detailed Description

This file declares the BinaryOperationModifier and BinaryOperationModifier2 classes, which build a new evaluator by applying a binary operation to the values returned by two existing evaluators, the binary_operation function used to build such evaluators and the predefined modifiers add, substract, multiply, divide, mean_value and inner_product.

Author
Thomas Helfer
Date
11/05/2025

Function Documentation

◆ binary_operation() [1/2]

template<typename CallableType, typename FirstEvaluatorType, typename SecondEvaluatorType>
requires ((EvaluatorConcept<std::decay_t<FirstEvaluatorType>>)&& // (EvaluatorConcept<std::decay_t<SecondEvaluatorType>>)&& // (std::invocable< std::decay_t<CallableType>, evaluator_result<std::decay_t<FirstEvaluatorType>>, evaluator_result<std::decay_t<SecondEvaluatorType>>>))
MGIS_HOST_DEVICE constexpr auto mgis::function::binary_operation ( CallableType && c,
FirstEvaluatorType && e1,
SecondEvaluatorType && e2 )
constexpr

apply a binary operation to the values returned by two evaluators

Template Parameters
CallableTypetype of the binary operation, which may be a qualified type
FirstEvaluatorTypetype of the evaluator of the first argument, which may be a qualified type
SecondEvaluatorTypetype of the evaluator of the second argument, which may be a qualified type
Parameters
[in]cbinary operation, which must be callable with the values returned by the two evaluators
[in]e1evaluator used to compute the first argument
[in]e2evaluator used to compute the second argument
Returns
a BinaryOperationModifier object, i.e. an evaluator returning the values computed by the binary operation

apply a binary operation to the values returned by two evaluators

◆ binary_operation() [2/2]

template<typename CallableType, typename SecondEvaluatorType>
requires (EvaluatorConcept<std::decay_t<SecondEvaluatorType>>)
MGIS_HOST_DEVICE constexpr auto mgis::function::binary_operation ( CallableType && c,
SecondEvaluatorType && e2 )
constexpr

partially apply a binary operation to the evaluator of its second argument

creates a binary_operation_modifier from the callable object and applies it to the given evaluator, which is the evaluator of the second argument of the operation

The returned modifier can be applied to the evaluator of the first argument using operator|, as in e1 | binary_operation(c, e2).

Template Parameters
CallableTypetype of the binary operation, which may be a qualified type
SecondEvaluatorTypetype of the evaluator of the second argument, which may be a qualified type
Parameters
[in]cbinary operation, a copy of it is stored in the modifier
[in]e2evaluator used to compute the second argument
Returns
a internals::BinaryOperatorCurrying object

◆ binary_operation_modifier2()

template<typename CallableType>
MGIS_HOST_DEVICE constexpr auto mgis::function::internals::binary_operation_modifier2 ( CallableType )
constexpr

create a helper from a callable object which is only used to deduce the type of the binary operation

the argument is only used to deduce the type of the binary operation

Template Parameters
CallableTypetype of the binary operation, which must be trivially default constructible
Parameters
[in]ccallable object which is discarded, as the operation is recreated when the values are computed
Returns
a stateless helper of type binary_operation_modifier2_impl<CallableType>

◆ getNumberOfComponents() [1/2]

template<typename CallableType, EvaluatorConcept FirstEvaluatorType, EvaluatorConcept SecondEvaluatorType>
MGIS_HOST_DEVICE constexpr mgis::size_type mgis::function::getNumberOfComponents ( const BinaryOperationModifier2< CallableType, FirstEvaluatorType, SecondEvaluatorType > & e)
nodiscardconstexpr

return the number of components of the values returned by a binary operation which does not store its callable object

forwards the call to the getNumberOfComponents member

Template Parameters
CallableTypetype of the binary operation
FirstEvaluatorTypetype of the evaluator used to compute the first argument of the operation
SecondEvaluatorTypetype of the evaluator used to compute the second argument of the operation
Parameters
[in]ebinary operation
Returns
number of components of the values returned by the operation

◆ getNumberOfComponents() [2/2]

template<typename CallableType, EvaluatorConcept FirstEvaluatorType, EvaluatorConcept SecondEvaluatorType>
MGIS_HOST_DEVICE constexpr mgis::size_type mgis::function::getNumberOfComponents ( const BinaryOperationModifier< CallableType, FirstEvaluatorType, SecondEvaluatorType > & e)
nodiscardconstexpr

return the number of components of the values returned by a binary operation

forwards the call to the getNumberOfComponents member

Template Parameters
CallableTypetype of the binary operation
FirstEvaluatorTypetype of the evaluator used to compute the first argument of the operation
SecondEvaluatorTypetype of the evaluator used to compute the second argument of the operation
Parameters
[in]ebinary operation
Returns
number of components of the values returned by the operation

Variable Documentation

◆ BinaryOperationModifier2Requirements

template<typename CallableType, EvaluatorConcept FirstEvaluatorType, EvaluatorConcept SecondEvaluatorType>
auto mgis::function::BinaryOperationModifier2Requirements
inlineconstexpr
Initial value:
=
(std::is_trivially_default_constructible_v<CallableType>)&&(
std::invocable<CallableType,
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

requirements which must be satisfied by a binary operation which is not stored in the evaluator it applies to

The callable object must be trivially default constructible and callable with the values returned by the two evaluators it is applied to.

Template Parameters
CallableTypetype of the binary operation
FirstEvaluatorTypetype of the evaluator used to compute the first argument of the operation
SecondEvaluatorTypetype of the evaluator used to compute the second argument of the operation

◆ BinaryOperationModifierRequirements

template<typename CallableType, EvaluatorConcept FirstEvaluatorType, EvaluatorConcept SecondEvaluatorType>
auto mgis::function::BinaryOperationModifierRequirements
inlineconstexpr
Initial value:
=
(std::is_copy_constructible_v<CallableType>)&&(
std::invocable<CallableType,

requirements which must be satisfied by a binary operation which is stored in the evaluator it applies to

The callable object must be copy constructible and callable with the values returned by the two evaluators it is applied to.

Template Parameters
CallableTypetype of the binary operation
FirstEvaluatorTypetype of the evaluator used to compute the first argument of the operation
SecondEvaluatorTypetype of the evaluator used to compute the second argument of the operation