X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=blobdiff_plain;f=src%2FStdMeshers%2FStdMeshers_Distribution.cxx;h=5b0416db66581d1c6dc2a55682e2bcbef0bf806d;hp=93858296b6bce1a77ea6492b0a75843bc5ae4d6b;hb=06c42e9c9528a8d54fed01e266c949676fa0d929;hpb=6b471bcc54cbeb90f0d977323db8c76d3d2cce09 diff --git a/src/StdMeshers/StdMeshers_Distribution.cxx b/src/StdMeshers/StdMeshers_Distribution.cxx index 93858296b..5b0416db6 100644 --- a/src/StdMeshers/StdMeshers_Distribution.cxx +++ b/src/StdMeshers/StdMeshers_Distribution.cxx @@ -27,10 +27,8 @@ // $Header$ #include "StdMeshers_Distribution.hxx" -#include -#include -#include -#include +#include "CASCatch.hxx" + #include #include @@ -45,9 +43,6 @@ Function::~Function() bool Function::value( const double, double& f ) const { - CASCatch_CatchSignals aCatchSignals; - aCatchSignals.Activate(); - bool ok = true; if( myConv==0 ) { @@ -55,10 +50,9 @@ bool Function::value( const double, double& f ) const { f = pow( 10, f ); } - CASCatch_CATCH(CASCatch_Failure) + CASCatch_CATCH(Standard_Failure) { - aCatchSignals.Deactivate(); - Handle(CASCatch_Failure) aFail = CASCatch_Failure::Caught(); + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); f = 0.0; ok = false; } @@ -128,10 +122,11 @@ double FunctionTable::integral( const int i ) const double FunctionTable::integral( const int i, const double d ) const { - double f, res = 0.0; - if( value( myData[2*i]+d, f ) ) - res = ( myData[2*i+1] + f ) / 2.0 * d; - + double f1,f2, res = 0.0; + if( value( myData[2*i]+d, f1 ) ) + if(!value(myData[2*i], f2)) + f2 = myData[2*i+1]; + res = (f2+f1) * d / 2.0; return res; } @@ -174,22 +169,17 @@ FunctionExpr::FunctionExpr( const char* str, const int conv ) myVars( 1, 1 ), myValues( 1, 1 ) { - CASCatch_CatchSignals aCatchSignals; - aCatchSignals.Activate(); - bool ok = true; CASCatch_TRY { myExpr = ExprIntrp_GenExp::Create(); myExpr->Process( ( Standard_CString )str ); } - CASCatch_CATCH(CASCatch_Failure) + CASCatch_CATCH(Standard_Failure) { - aCatchSignals.Deactivate(); - Handle(CASCatch_Failure) aFail = CASCatch_Failure::Caught(); + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); ok = false; } - aCatchSignals.Deactivate(); if( !ok || !myExpr->IsDone() ) myExpr.Nullify(); @@ -214,23 +204,17 @@ bool FunctionExpr::value( const double t, double& f ) const if( myExpr.IsNull() ) return false; - OSD::SetSignal( true ); - CASCatch_CatchSignals aCatchSignals; - aCatchSignals.Activate(); - ( ( TColStd_Array1OfReal& )myValues ).ChangeValue( 1 ) = t; bool ok = true; CASCatch_TRY { f = myExpr->Expression()->Evaluate( myVars, myValues ); } - CASCatch_CATCH(CASCatch_Failure) { - aCatchSignals.Deactivate(); - Handle(CASCatch_Failure) aFail = CASCatch_Failure::Caught(); + CASCatch_CATCH(Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); f = 0.0; ok = false; } - aCatchSignals.Deactivate(); ok = Function::value( t, f ) && ok; return ok; } @@ -244,7 +228,7 @@ double FunctionExpr::integral( const double a, const double b ) const if( _int.IsDone() ) res = _int.Value(); } - CASCatch_CATCH(CASCatch_Failure) + CASCatch_CATCH(Standard_Failure) { res = 0.0; MESSAGE( "Exception in integral calculating" );