42cf5bc1 |
1 | // Created on: 1991-01-14 |
2 | // Created by: Arnaud BOUZY |
3 | // Copyright (c) 1991-1999 Matra Datavision |
4 | // Copyright (c) 1999-2014 OPEN CASCADE SAS |
5 | // |
6 | // This file is part of Open CASCADE Technology software library. |
7 | // |
8 | // This library is free software; you can redistribute it and/or modify it under |
9 | // the terms of the GNU Lesser General Public License version 2.1 as published |
10 | // by the Free Software Foundation, with special exception defined in the file |
11 | // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
12 | // distribution for complete text of the license and disclaimer of any warranty. |
13 | // |
14 | // Alternatively, this file may be used under the terms of Open CASCADE |
15 | // commercial license or contractual agreement. |
16 | |
17 | #ifndef _Expr_FunctionDerivative_HeaderFile |
18 | #define _Expr_FunctionDerivative_HeaderFile |
19 | |
20 | #include <Standard.hxx> |
21 | #include <Standard_Type.hxx> |
22 | |
23 | #include <Standard_Integer.hxx> |
24 | #include <Expr_GeneralFunction.hxx> |
25 | #include <Standard_Real.hxx> |
26 | #include <Expr_Array1OfNamedUnknown.hxx> |
27 | #include <TColStd_Array1OfReal.hxx> |
28 | #include <Standard_Boolean.hxx> |
29 | class Expr_GeneralFunction; |
30 | class Expr_GeneralExpression; |
31 | class Expr_NamedUnknown; |
32 | class Standard_OutOfRange; |
33 | class Standard_DimensionMismatch; |
34 | class Standard_NumericError; |
35 | class Expr_NotEvaluable; |
36 | class Expr_NamedFunction; |
37 | class TCollection_AsciiString; |
38 | |
39 | |
40 | class Expr_FunctionDerivative; |
41 | DEFINE_STANDARD_HANDLE(Expr_FunctionDerivative, Expr_GeneralFunction) |
42 | |
43 | |
44 | class Expr_FunctionDerivative : public Expr_GeneralFunction |
45 | { |
46 | |
47 | public: |
48 | |
49 | |
50 | //! Creates a FunctionDerivative of degree <deg> relative |
51 | //! to the <withX> variable. |
52 | //! Raises OutOfRange if <deg> lower or equal to zero. |
53 | Standard_EXPORT Expr_FunctionDerivative(const Handle(Expr_GeneralFunction)& func, const Handle(Expr_NamedUnknown)& withX, const Standard_Integer deg); |
54 | |
55 | //! Returns the number of variables of <me>. |
79104795 |
56 | Standard_EXPORT Standard_Integer NbOfVariables() const Standard_OVERRIDE; |
42cf5bc1 |
57 | |
58 | //! Returns the variable denoted by <index> in <me>. |
59 | //! Raises OutOfRange if <index> greater than |
60 | //! NbOfVariables of <me>. |
79104795 |
61 | Standard_EXPORT Handle(Expr_NamedUnknown) Variable (const Standard_Integer index) const Standard_OVERRIDE; |
42cf5bc1 |
62 | |
63 | //! Computes the value of <me> with the given variables. |
64 | //! Raises DimensionMismatch if Length(vars) is different from |
65 | //! Length(values). |
79104795 |
66 | Standard_EXPORT Standard_Real Evaluate (const Expr_Array1OfNamedUnknown& vars, const TColStd_Array1OfReal& values) const Standard_OVERRIDE; |
42cf5bc1 |
67 | |
68 | //! Returns a copy of <me> with the same form. |
79104795 |
69 | Standard_EXPORT Handle(Expr_GeneralFunction) Copy() const Standard_OVERRIDE; |
42cf5bc1 |
70 | |
71 | //! Returns Derivative of <me> for variable <var>. |
79104795 |
72 | Standard_EXPORT Handle(Expr_GeneralFunction) Derivative (const Handle(Expr_NamedUnknown)& var) const Standard_OVERRIDE; |
42cf5bc1 |
73 | |
74 | //! Returns Derivative of <me> for variable <var> with |
75 | //! degree <deg>. |
79104795 |
76 | Standard_EXPORT Handle(Expr_GeneralFunction) Derivative (const Handle(Expr_NamedUnknown)& var, const Standard_Integer deg) const Standard_OVERRIDE; |
42cf5bc1 |
77 | |
78 | //! Tests if <me> and <func> are similar functions (same |
79 | //! name and same used expression). |
79104795 |
80 | Standard_EXPORT Standard_Boolean IsIdentical (const Handle(Expr_GeneralFunction)& func) const Standard_OVERRIDE; |
42cf5bc1 |
81 | |
82 | //! Tests if <me> is linear on variable on range <index> |
79104795 |
83 | Standard_EXPORT Standard_Boolean IsLinearOnVariable (const Standard_Integer index) const Standard_OVERRIDE; |
42cf5bc1 |
84 | |
85 | //! Returns the function of which <me> is the derivative. |
86 | Standard_EXPORT Handle(Expr_GeneralFunction) Function() const; |
87 | |
88 | //! Returns the degree of derivation of <me>. |
89 | Standard_EXPORT Standard_Integer Degree() const; |
90 | |
91 | //! Returns the derivation variable of <me>. |
92 | Standard_EXPORT Handle(Expr_NamedUnknown) DerivVariable() const; |
93 | |
79104795 |
94 | Standard_EXPORT TCollection_AsciiString GetStringName() const Standard_OVERRIDE; |
42cf5bc1 |
95 | |
96 | Standard_EXPORT Handle(Expr_GeneralExpression) Expression() const; |
97 | |
98 | Standard_EXPORT void UpdateExpression(); |
99 | |
100 | |
101 | friend class Expr_NamedFunction; |
102 | |
103 | |
104 | DEFINE_STANDARD_RTTI(Expr_FunctionDerivative,Expr_GeneralFunction) |
105 | |
106 | protected: |
107 | |
108 | |
109 | |
110 | |
111 | private: |
112 | |
113 | |
114 | Handle(Expr_GeneralFunction) myFunction; |
115 | Handle(Expr_GeneralExpression) myExp; |
116 | Handle(Expr_NamedUnknown) myDerivate; |
117 | Standard_Integer myDegree; |
118 | |
119 | |
120 | }; |
121 | |
122 | |
123 | |
124 | |
125 | |
126 | |
127 | |
128 | #endif // _Expr_FunctionDerivative_HeaderFile |