0022904: Clean up sccsid variables
[occt.git] / src / Expr / Expr_Sinh.cxx
CommitLineData
7fd59977 1// Copyright: Matra-Datavision 1991
2// File: Expr_Sinh.cxx
3// Created: Tue May 28 13:05:53 1991
4// Author: Arnaud BOUZY
5// <adn>
6
7#include <Expr_Sinh.ixx>
8#include <Expr_NumericValue.hxx>
9#include <Expr_ArgSinh.hxx>
10#include <Expr_Cosh.hxx>
11#include <Expr_Product.hxx>
12#include <Expr_Operators.hxx>
13#include <Expr.hxx>
14
15Expr_Sinh::Expr_Sinh(const Handle(Expr_GeneralExpression)& exp)
16{
17 CreateOperand(exp);
18}
19
20Handle(Expr_GeneralExpression) Expr_Sinh::ShallowSimplified () const
21{
22 Handle(Expr_GeneralExpression) myexp = Operand();
23 if (myexp->IsKind(STANDARD_TYPE(Expr_NumericValue))) {
24 Handle(Expr_NumericValue) myNVexp = Handle(Expr_NumericValue)::DownCast(myexp);
25 return new Expr_NumericValue(Sinh(myNVexp->GetValue()));
26 }
27 if (myexp->IsKind(STANDARD_TYPE(Expr_ArgSinh))) {
28 return myexp->SubExpression(1);
29 }
30 Handle(Expr_Sinh) me = this;
31 return me;
32}
33
34Handle(Expr_GeneralExpression) Expr_Sinh::Copy () const
35{
36 return new Expr_Sinh(Expr::CopyShare(Operand()));
37}
38
39Standard_Boolean Expr_Sinh::IsIdentical (const Handle(Expr_GeneralExpression)& Other) const
40{
41 if (Other->IsKind(STANDARD_TYPE(Expr_Sinh))) {
42 Handle(Expr_GeneralExpression) myexp = Operand();
43 return myexp->IsIdentical(Other->SubExpression(1));
44 }
45 return Standard_False;
46}
47
48Standard_Boolean Expr_Sinh::IsLinear () const
49{
50 return !ContainsUnknowns();
51}
52
53Handle(Expr_GeneralExpression) Expr_Sinh::Derivative (const Handle(Expr_NamedUnknown)& X) const
54{
55 if (!Contains(X)) {
56 return new Expr_NumericValue(0.0);
57 }
58 Handle(Expr_GeneralExpression) myexp = Operand();
59 Handle(Expr_GeneralExpression) myder = myexp->Derivative(X);
60 Handle(Expr_Cosh) firstder = new Expr_Cosh(Expr::CopyShare(myexp));
61 Handle(Expr_Product) resu = firstder->ShallowSimplified() * myder;
62 return resu->ShallowSimplified();
63}
64
65Standard_Real Expr_Sinh::Evaluate(const Expr_Array1OfNamedUnknown& vars, const TColStd_Array1OfReal& vals) const
66{
67 Standard_Real val = Operand()->Evaluate(vars,vals);
68 return (::Exp(val)-::Exp(-val))/2.0;
69}
70
71TCollection_AsciiString Expr_Sinh::String() const
72{
73 TCollection_AsciiString str("Sinh(");
74 str += Operand()->String();
75 str += ")";
76 return str;
77}