MGIS 3.1.0
Loading...
Searching...
No Matches
mgis::function::UnaryOperation< CallableType, EvaluatorType > Struct Template Reference

an evaluator applying a unary operation to the values returned by another evaluator More...

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

Inheritance diagram for mgis::function::UnaryOperation< CallableType, EvaluatorType >:
mgis::function::EvaluatorModifierBase< UnaryOperation< CallableType, EvaluatorType >, EvaluatorType > mgis::function::internals::UnaryOperationBase< CallableType, EvaluatorType >

Public Member Functions

MGIS_HOST_DEVICE constexpr UnaryOperation (const CallableType &, const EvaluatorType &)
 constructor
MGIS_HOST_DEVICE constexpr auto apply (const evaluator_result< EvaluatorType > &) const
 apply the modifier
Public Member Functions inherited from mgis::function::EvaluatorModifierBase< UnaryOperation< CallableType, EvaluatorType >, EvaluatorType >
constexpr EvaluatorModifierBase (const EvaluatorType &)
 constructor
constexpr decltype(auto) getSpace () const
 return the underlying space
constexpr bool check (AbstractErrorHandler &) const
 perform consistency checks
constexpr auto operator() (const element_index< Space > &) const
 call operator: the value computed by the underlying evaluator is passed to the apply member function of the derived class

Additional Inherited Members

Public Types inherited from mgis::function::EvaluatorModifierBase< UnaryOperation< CallableType, EvaluatorType >, EvaluatorType >
using Space
 type of the space on which the underlying evaluator is defined
Static Public Member Functions inherited from mgis::function::internals::UnaryOperationBase< CallableType, EvaluatorType >
static constexpr size_type getNumberOfComponents () MGIS_NOEXCEPT
 return the number of components
Protected Attributes inherited from mgis::function::EvaluatorModifierBase< UnaryOperation< CallableType, EvaluatorType >, EvaluatorType >
EvaluatorType evaluator
 underlying evaluator

Detailed Description

template<typename CallableType, EvaluatorConcept EvaluatorType>
requires ((std::is_copy_constructible_v<CallableType>)&&( std::invocable<CallableType, evaluator_result<EvaluatorType>>))
struct mgis::function::UnaryOperation< CallableType, EvaluatorType >

an evaluator applying a unary operation to the values returned by another evaluator

Such an evaluator is usually built with the unary_operation or transform functions, which can either be applied directly to an evaluator or be composed with other modifiers using operator|:

const auto e2 = e | transform([](const real v) { return v * v; });
constexpr auto transform(CallableType &&)
create a modifier transforming the values returned by an evaluator
Definition UnaryOperation.ixx:129
mgis_real real
alias to the numeric type used
Definition Config.hxx:140

The callable object is stored in the instance. The number of components of the returned values is the compile-time size of the type returned by the callable, which must thus be known at compile time. Only the call operators which match the way the underlying evaluator can be called are available, as they are inherited from EvaluatorModifierBase.

Template Parameters
CallableTypetype of the unary operation, which must be copy constructible and callable with the values returned by the evaluator
EvaluatorTypetype of the evaluator whose values are modified

Constructor & Destructor Documentation

◆ UnaryOperation()

template<typename CallableType, EvaluatorConcept EvaluatorType>
requires ((std::is_copy_constructible_v<CallableType>)&&( std::invocable<CallableType, evaluator_result<EvaluatorType>>))
mgis::function::UnaryOperation< CallableType, EvaluatorType >::UnaryOperation ( const CallableType & c,
const EvaluatorType & e )
constexpr

constructor

Parameters
[in]cunary operation, applied to the values returned by the evaluator, a copy of it is stored in the instance
[in]eevaluator providing those values, a copy of it is stored in the instance

Member Function Documentation

◆ apply()

template<typename CallableType, EvaluatorConcept EvaluatorType>
requires ((std::is_copy_constructible_v<CallableType>)&&( std::invocable<CallableType, evaluator_result<EvaluatorType>>))
MGIS_HOST_DEVICE constexpr auto mgis::function::UnaryOperation< CallableType, EvaluatorType >::apply ( const evaluator_result< EvaluatorType > & values) const
constexpr

apply the modifier

calls the stored callable object with the given values

Parameters
[in]valuesvalues computed by the underlying evaluator at a given integration point
Returns
values computed by calling the stored callable with the values computed by the underlying evaluator at a given integration point
Note
this function is called by the call operators inherited from EvaluatorModifierBase

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