12#ifndef ARCANE_EXPR_UNARYEXPRESSIONIMPL_H
13#define ARCANE_EXPR_UNARYEXPRESSIONIMPL_H
17#include "arcane/utils/Convert.h"
18#include "arcane/expr/ExpressionImpl.h"
19#include "arcane/expr/Expression.h"
20#include "arcane/expr/ExpressionResult.h"
21#include "arcane/expr/BadOperandException.h"
40class ARCANE_EXPR_EXPORT UnaryExpressionImpl
41:
public ExpressionImpl
71 eOperationType operation);
79 String operationName()
const {
return operationName(m_operation); }
80 static String operationName(eOperationType type);
85 eOperationType m_operation;
118 if (size != a->size())
122 res->allocate(a->type());
126 res->
data()->value(res_val);
131 evaluate(res_val, a_val);
138#define DEFAULT_UNARY_OP(classname, expression) \
140 class classname : public DefaultUnaryOperator<T> \
144 virtual void evaluate(ExpressionResult* res, ArrayVariant* a) \
146 DefaultUnaryOperator<T>::evaluate(res, a); \
149 virtual void evaluate(ArrayView<T> res, \
152 Integer size = res.size(); \
153 for (Integer i = 0; i < size; ++i) \
160DEFAULT_UNARY_OP(UnarySubstractOperator, res[i] = -a[i])
161DEFAULT_UNARY_OP(InverseOperator, res[i] = 1 / a[i])
Polymorphic base type for arrays (dimension 1).
Modifiable view of an array of type T.
constexpr const_pointer data() const noexcept
Pointer to the start of the view.
Exception for operands in expression operations.
Polymorphic base type of an expression.
Interface for the different implementations of an expression.
Unicode character string.
virtual Integer vectorSize() const
Number of elements in the vector.
Generic unary operator for expressions.
double toDouble(Real r)
Converts a Real to double.
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --
Int32 Integer
Type representing an integer.
ConstArrayView< Integer > IntegerConstArrayView
C equivalent of a 1D array of integers.