Version: 6.3.1
Public Member Functions | Private Member Functions | Private Attributes

FunctionExpr Class Reference

#include <StdMeshers_Distribution.hxx>

Inheritance diagram for FunctionExpr:
Inheritance graph
[legend]

Public Member Functions

 FunctionExpr (const char *, const int)
virtual ~FunctionExpr ()
virtual Standard_Boolean Value (const Standard_Real, Standard_Real &)
virtual bool value (const double, double &) const
virtual double integral (const double, const double) const

Private Member Functions

 Handle (ExprIntrp_GenExp) myExpr

Private Attributes

Expr_Array1OfNamedUnknown myVars
TColStd_Array1OfReal myValues

Detailed Description

Definition at line 89 of file StdMeshers_Distribution.hxx.


Constructor & Destructor Documentation

FunctionExpr::FunctionExpr ( const char *  str,
const int  conv 
)

Definition at line 185 of file StdMeshers_Distribution.cxx.

References Handle(), and myVars.

: Function( conv ),
  myVars( 1, 1 ),
  myValues( 1, 1 )
{
  bool ok = true;
  try {
#ifdef NO_CAS_CATCH
    OCC_CATCH_SIGNALS;
#endif
    myExpr = ExprIntrp_GenExp::Create();
    myExpr->Process( ( Standard_CString )str );
  } catch(Standard_Failure) {
    Handle(Standard_Failure) aFail = Standard_Failure::Caught();
    ok = false;
  }

  if( !ok || !myExpr->IsDone() )
    myExpr.Nullify();

  myVars.ChangeValue( 1 ) = new Expr_NamedUnknown( "t" );
}
FunctionExpr::~FunctionExpr ( ) [virtual]

Definition at line 208 of file StdMeshers_Distribution.cxx.

{
}

Member Function Documentation

FunctionExpr.Handle ( ExprIntrp_GenExp  ) [private]

Referenced by FunctionExpr(), and value().

double FunctionExpr::integral ( const double  a,
const double  b 
) const [virtual]

Implements Function.

Definition at line 242 of file StdMeshers_Distribution.cxx.

References MESSAGE, and SMESH_AdvancedEditor.res.

{
  double res = 0.0;
  try {
#ifdef NO_CAS_CATCH
    OCC_CATCH_SIGNALS;
#endif
    math_GaussSingleIntegration _int
      ( *static_cast<math_Function*>( const_cast<FunctionExpr*> (this) ), a, b, 20 );
    if( _int.IsDone() )
      res = _int.Value();
  } catch(Standard_Failure) {
    res = 0.0;
    MESSAGE( "Exception in integral calculating" );
  }
  return res;
}
Standard_Boolean FunctionExpr::Value ( const Standard_Real  T,
Standard_Real &  F 
) [virtual]

Definition at line 212 of file StdMeshers_Distribution.cxx.

References SMESH_AdvancedEditor.res, and value().

{
  double f;
  Standard_Boolean res = value( T, f );
  F = f;
  return res;
}
bool FunctionExpr::value ( const double  t,
double &  f 
) const [virtual]

Reimplemented from Function.

Definition at line 220 of file StdMeshers_Distribution.cxx.

References Handle(), myValues, and myVars.

Referenced by Value().

{
  if( myExpr.IsNull() )
    return false;

  ( ( TColStd_Array1OfReal& )myValues ).ChangeValue( 1 ) = t;
  bool ok = true;
  try {
#ifdef NO_CAS_CATCH
    OCC_CATCH_SIGNALS;
#endif
    f = myExpr->Expression()->Evaluate( myVars, myValues );
  } catch(Standard_Failure) {
    Handle(Standard_Failure) aFail = Standard_Failure::Caught();
    f = 0.0;
    ok = false;
  }

  ok = Function::value( t, f ) && ok;
  return ok;
}

Field Documentation

TColStd_Array1OfReal FunctionExpr.myValues [private]

Definition at line 101 of file StdMeshers_Distribution.hxx.

Referenced by value().

Expr_Array1OfNamedUnknown FunctionExpr.myVars [private]

Definition at line 100 of file StdMeshers_Distribution.hxx.

Referenced by FunctionExpr(), and value().

Copyright © 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
Copyright © 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS