5#ifndef OASIS_BOUNDEDUNARYEXPRESSION_HPP
6#define OASIS_BOUNDEDUNARYEXPRESSION_HPP
16template <
template <IExpression, IExpression, IExpression>
class DerivedT, IExpression OperandT, IExpression LowerBoundT = Expression, IExpression UpperBoundT = LowerBoundT>
19 using DerivedSpecialized = DerivedT<OperandT, LowerBoundT, UpperBoundT>;
20 using DerivedGeneralized = DerivedT<Expression, Expression, Expression>;
55 return this->
Generalize()->Differentiate(differentiationVariable);
73 return operand !=
nullptr;
89 operand = expr.Copy();
98 DerivedGeneralized substituted = DerivedGeneralized { operand, newLowerBound, newUpperBound };
99 return substituted.Copy();
107 const auto& derivedGeneralized =
dynamic_cast<const DerivedGeneralized&
>(*generalized);
Definition BoundedExpression.hpp:15
auto GetLowerBound() const -> const LowerBoundT &
Definition BoundedExpression.hpp:43
auto GetUpperBound() const -> const UpperBoundT &
Definition BoundedExpression.hpp:49
auto HasLowerBound() const -> bool
Definition BoundedExpression.hpp:33
void SetLowerBound(const T &expr)
Definition BoundedExpression.hpp:57
auto HasUpperBound() const -> bool
Definition BoundedExpression.hpp:38
void SetUpperBound(const T &expr)
Definition BoundedExpression.hpp:68
Definition BoundedUnaryExpression.hpp:17
void SetOperand(const T &expr)
Definition BoundedUnaryExpression.hpp:84
auto Copy() const -> std::unique_ptr< Expression > final
Copies this expression.
Definition BoundedUnaryExpression.hpp:42
BoundedUnaryExpression()=default
auto GetOperand() const -> const OperandT &
Definition BoundedUnaryExpression.hpp:76
auto Substitute(const Expression &var, const Expression &val) -> std::unique_ptr< Expression > override
Definition BoundedUnaryExpression.hpp:93
auto Copy(tf::Subflow &) const -> std::unique_ptr< Expression > final
Definition BoundedUnaryExpression.hpp:47
BoundedUnaryExpression(const BoundedUnaryExpression &other)
Definition BoundedUnaryExpression.hpp:25
auto operator=(const BoundedUnaryExpression &other) -> BoundedUnaryExpression &=default
auto HasOperand() const -> bool
Definition BoundedUnaryExpression.hpp:71
void Serialize(SerializationVisitor &visitor) const override
This function serializes the expression object.
Definition BoundedUnaryExpression.hpp:104
auto Differentiate(const Expression &differentiationVariable) const -> std::unique_ptr< Expression > override
Tries to differentiate this function.
Definition BoundedUnaryExpression.hpp:53
BoundedUnaryExpression(const OperandT &operand, const LowerBoundT &lowerBound, const UpperBoundT &upperBound)
Definition BoundedUnaryExpression.hpp:35
auto Equals(const Expression &other) const -> bool final
Compares this expression to another expression for equality.
Definition BoundedUnaryExpression.hpp:58
An expression.
Definition Expression.hpp:56
virtual auto Generalize() const -> std::unique_ptr< Expression >
Converts this expression to a more general expression.
Definition Expression.cpp:225
Definition Serialization.hpp:50
virtual void Serialize(const Real &real)=0
Checks if type T is same as any of the provided types in U.
Definition Concepts.hpp:48