C3D Toolkit  Kernel - 117982, Vision - 2.9.2.2

Function as node of a binary tree. More...

#include <pars_equation_tree.h>

+ Inheritance diagram for BTreeFunction:
+ Collaboration diagram for BTreeFunction:

Public Types

enum  EquFnCode {
  eFnCode_unknown = -1 , eFnCode_first = 0 , eFnCode_sin = eFnCode_first , eFnCode_cos ,
  eFnCode_tan , eFnCode_sqrt , eFnCode_atan , eFnCode_exp ,
  eFnCode_ln , eFnCode_abs , eFnCode_DegBegin , eFnCode_sind = eFnCode_DegBegin ,
  eFnCode_cosd , eFnCode_tand , eFnCode_DegEnd = eFnCode_tand , eFnCode_atand ,
  eFnCode_lg , eFnCode_ceil , eFnCode_floor , eFnCode_round ,
  eFnCode_acos , eFnCode_acosd , eFnCode_asin , eFnCode_asind ,
  eFnCode_rad , eFnCode_deg , eFnCode_last = eFnCode_deg
}
 Types of functions. More...
 
- Public Types inherited from BTreeNode
typedef std::map< ItTreeVariable *, ItTreeVariable * > EqualVarsMap
 A set of pairs of variables.
 
typedef std::map< const ItCoord *, DerivesValuesVarsDerives
 A set of pairs: coordinate - value and derivatives.
 

Public Member Functions

 BTreeFunction (EquFnCode code, BTreeNode &p)
 Constructor. More...
 
 BTreeFunction (const BTreeFunction &)
 Copy-constructor.
 
virtual ~BTreeFunction ()
 Destructor.
 
BteNodeType IsA () const override
 Get type of a tree node.
 
BTreeNodeDuplicate () const override
 Create a copy of the object.
 
bool IsLine () const override
 Function is linear.
 
bool IsCos () const
 looks like a * cos() + b
 
Functions for calculation of the value and the derivative.
EquTreeResCode GetValue (double &value) const override
 Calculate value. More...
 
EquTreeResCode CalculateDerives (double &, double &, double &, double &, const VarsDerives &) const override
 Calculate a value and derivatives. More...
 
void GetUsedVariables (SSArray< ItTreeVariable * > &, SSArray< ItUserFunc * > &) const override
 Get the used variables. More...
 
bool SetValue (double, const std::set< ItTreeVariable * > &) override
 Set value. More...
 
Functions for replacing variables by names.
void ReplaceParVariable (const c3d::string_t &varName, ItTreeVariable &newVar) override
 Replace variables. More...
 
void ReplaceParVariable (const ItTreeVariable &var, const BTreeNode &subTree) override
 Replace a node. More...
 
Functions for access to data.
virtual BTreeNodeGetSubNode (size_t i)
 Get a child node by an index.
 
bool GetDefRange (DefRange &, ItTreeVariable &, bool stopOnBreak) const override
 Domain. More...
 
std::unique_ptr< BTreeNodeFixVars (const RPArray< ItTreeVariable > &unfixed, PArray< ItUserFunc > &newFuncs, EquTreeResCode &) const override
 Fixed variables. More...
 
std::unique_ptr< BTreeNodeGetCalcEquivalent () const override
 Get equivalent node.
 
void GetString (c3d::string_t &str) const override
 Get string. More...
 
size_t SizeOf () const override
 Get size in bytes.
 
Comparison function.
bool IsEqual (const BTreeNode &other, const EqualVarsMap &equVars) const override
 Whether a node is equal to the given node. More...
 
bool IsEqual (const BTreeFunction &other, const EqualVarsMap &equVars) const override
 Whether a node is equal to the given node. More...
 
- Public Member Functions inherited from BTreeNode
EquTreeResCode CalculateDerives (const ItCoord *coord, double &v, double &fd, double &sd, double &td) const
 Calculate a value and derivatives. More...
 
virtual void ReplaceIntVariable (const c3d::string_t &, ItIntervalTreeVariable &)
 Replace variables. More...
 
bool GetExtremumPoints (const c3d::DoublePair &interval, ItTreeVariable &var, c3d::DoubleVector &points)
 Get value of parameter of extremum. More...
 
virtual bool IsEqual (const BTreeConst &, const EqualVarsMap &) const
 Whether the node is equal to the given node. More...
 
virtual bool IsEqual (const BTreeIdent &, const EqualVarsMap &) const
 Whether the node is equal to the given node. More...
 
virtual bool IsEqual (const BTreeOperation &, const EqualVarsMap &) const
 Whether the node is equal to the given node. More...
 
virtual bool IsEqual (const BTreeOperation1Arg &, const EqualVarsMap &) const
 Whether the node is equal to the given node. More...
 
virtual bool IsEqual (const BTreeOperation3Args &, const EqualVarsMap &) const
 Whether the node is equal to the given node. More...
 
virtual bool IsEqual (const BTreeUserFunc &, const EqualVarsMap &) const
 Whether the node is equal to the given node. More...
 
- Public Member Functions inherited from TapeBase
 TapeBase (RegistrableRec regs=noRegistrable)
 Constructor.
 
 TapeBase (const TapeBase &)
 Copy-constructor.
 
virtual ~TapeBase ()
 Destructor.
 
RegistrableRec GetRegistrable () const
 Whether the stream class is registrable.
 
void SetRegistrable (RegistrableRec regs=registrable) const
 Set the state of registration of the stream class.
 
virtual const char * GetPureName (const VersionContainer &) const
 Get the class name.
 
virtual bool IsFamilyRegistrable () const
 Whether the object belongs to a registrable family.
 

Additional Inherited Members

- Public Attributes inherited from BTreeNode
BteNodeType type
 A type of node.
 
- Protected Member Functions inherited from BTreeNode
 BTreeNode ()
 Default constructor.
 
- Protected Attributes inherited from BTreeNode
VarsDerives varDers
 Working variables.
 

Detailed Description

Function as node of a binary tree.

Node of a binary tree denoting a function.

Member Enumeration Documentation

◆ EquFnCode

Types of functions.

Types of functions.

Enumerator
eFnCode_unknown 

An unknown type.

eFnCode_first 

Start of the range of known functions.

eFnCode_sin 

Sine.

eFnCode_cos 

Cosine.

eFnCode_tan 

Tangent.

eFnCode_sqrt 

Square root.

eFnCode_atan 

Arctangent.

eFnCode_exp 

Exponent.

eFnCode_ln 

Natural logarithm.

eFnCode_abs 

Absolute value.

eFnCode_DegBegin 

Start of the range of functions with argument in degrees.

eFnCode_sind 

Sine of the angle in degrees.

eFnCode_cosd 

Cosine of the angle in degrees.

eFnCode_tand 

Tangent of the angle in degrees.

eFnCode_DegEnd 

End of the range of functions with argument in degrees.

eFnCode_atand 

Arctangent with the result in degrees.

eFnCode_lg 

Decimal logarithm.

eFnCode_ceil 

Nearest largest integer number.

eFnCode_floor 

Nearest smallest integer number.

eFnCode_round 

Nearest integer number.

eFnCode_acos 

Arccosine.

eFnCode_acosd 

Arccosine with the result in degrees.

eFnCode_asin 

Arcsine.

eFnCode_asind 

Arcsine with the result in degrees.

eFnCode_rad 

Conversion from degrees to radians.

eFnCode_deg 

Conversion from radians to degrees.

eFnCode_last 

End of the range of known functions.

Constructor & Destructor Documentation

◆ BTreeFunction()

BTreeFunction::BTreeFunction ( EquFnCode  code,
BTreeNode p 
)

Constructor.

Constructor.

Parameters
[in]code- Type of a function.
[in]p- Parameter of a function.

Member Function Documentation

◆ GetValue()

EquTreeResCode BTreeFunction::GetValue ( double &  fValue) const
overridevirtual

Calculate value.

Calculate value of node.

Parameters
[out]fValue- Value.
Returns
String parsing result code.

Implements BTreeNode.

◆ CalculateDerives()

EquTreeResCode BTreeFunction::CalculateDerives ( double &  fValue,
double &  derive1,
double &  derive2,
double &  derive3,
const VarsDerives ders 
) const
overridevirtual

Calculate a value and derivatives.

Calculate a value and derivatives.

Parameters
[out]fValue- Value.
[out]derive1- The first derivative.
[out]derive2- The second derivative.
[out]derive3- The third derivative.
[in]ders- Set of values and derivatives.
Returns
String parsing result code.

Implements BTreeNode.

◆ GetUsedVariables()

void BTreeFunction::GetUsedVariables ( SSArray< ItTreeVariable * > &  arr,
SSArray< ItUserFunc * > &  funcs 
) const
overridevirtual

Get the used variables.

Get the used variables.

Parameters
[out]arr- Variables.
[out]funcs- User functions.

Implements BTreeNode.

◆ SetValue()

bool BTreeFunction::SetValue ( double  v,
const std::set< ItTreeVariable * > &  unfixedDVars 
)
inlineoverridevirtual

Set value.

Set 'v' value to a tree node.

Parameters
[in]v- Desirable value.
[in]unfixedDVars- Variables which values can be changed.

Implements BTreeNode.

◆ ReplaceParVariable() [1/2]

void BTreeFunction::ReplaceParVariable ( const c3d::string_t varName,
ItTreeVariable newVar 
)
overridevirtual

Replace variables.

Replace all variables with the specified name by a new variable.

Parameters
[out]varName- Name.
[out]newVar- New variable.

Implements BTreeNode.

◆ ReplaceParVariable() [2/2]

void BTreeFunction::ReplaceParVariable ( const ItTreeVariable var,
const BTreeNode subTree 
)
overridevirtual

Replace a node.

Replace a node with a copy of a new one if the given variable is used.

Parameters
[out]var- Variable.
[out]subTree- New node.

Implements BTreeNode.

◆ GetDefRange()

bool BTreeFunction::GetDefRange ( DefRange defRange,
ItTreeVariable var,
bool  stopOnBreak 
) const
overridevirtual

Domain.

Domain.

Parameters
[in,out]defRange- Domain.
[out]var- Variable.
[in]stopOnBreak- Not to search the discontinuities in the definition domain.

Implements BTreeNode.

◆ FixVars()

std::unique_ptr<BTreeNode> BTreeFunction::FixVars ( const RPArray< ItTreeVariable > &  unfixedVars,
PArray< ItUserFunc > &  newFuncs,
EquTreeResCode code 
) const
overridevirtual

Fixed variables.

Fixed variables.

Parameters
[in]unfixedVars- A set of unfixed variables. If variable was found in set, then fix the copy.
[in]newFuncs- User functions.
[out]code- Result codes of string parsing.
Returns
Variable for fixation.

Implements BTreeNode.

◆ GetString()

void BTreeFunction::GetString ( c3d::string_t ) const
overridevirtual

Get string.

Get expression string.

Parameters
[out]-String.

Implements BTreeNode.

◆ IsEqual() [1/2]

bool BTreeFunction::IsEqual ( const BTreeNode other,
const EqualVarsMap equVars 
) const
inlineoverridevirtual

Whether a node is equal to the given node.

Whether a node is equal to the given node.

Parameters
[in]other- Node for comparison.
[in]equVars- A set of pairs of equal variables.
Returns
true if nodes are equal.

Implements BTreeNode.

◆ IsEqual() [2/2]

bool BTreeFunction::IsEqual ( const BTreeFunction other,
const EqualVarsMap equVars 
) const
overridevirtual

Whether a node is equal to the given node.

Whether a node is equal to the given node.

Parameters
[in]other- Node for comparison.
[in]equVars- A set of pairs of equal variables.
Returns
true if nodes are equal.

Reimplemented from BTreeNode.


The documentation for this class was generated from the following file: