1. Functions Precision::IsIllegal(...) and Precision::IsInfinitesimal(...) were added.
2. Detection incorrect numbers read from *.stp and/or *.igs files was added.
#include <Interface_Static.hxx>
#include <Message_Msg.hxx>
#include <OSD_Process.hxx>
+#include <Precision.hxx>
#include <Quantity_Date.hxx>
+#include <Standard_NumericError.hxx>
#include <TCollection_HAsciiString.hxx>
#include <UnitsMethods.hxx>
if (fpt == Interface_ParamInteger) {
// but a real is expected
if ( i == 13 || i == 17 || i == 19 || i == 20)
- realval = Atof(val);
+ {
+ realval = Atof(val);
+
+ if(Precision::IsIllegal(realval))
+ {
+ Standard_NumericError::Raise();
+ }
+
+ if(Precision::IsInfinitesimal(realval))
+ {
+ realval = 0.0;
+ }
+ }
+
intval = atoi(val);
}
if (val[k] == '\0') break;
}
realval = Atof(text);
+
+ if(Precision::IsIllegal(realval))
+ {
+ Standard_NumericError::Raise();
+ }
+
+ if(Precision::IsInfinitesimal(realval))
+ {
+ realval = 0.0;
+ }
}
// if the param is a text
#include <Interface_ParamList.hxx>
#include <Interface_Static.hxx>
#include <Message_Msg.hxx>
+#include <Precision.hxx>
+#include <Standard_NumericError.hxx>
#include <TCollection_HAsciiString.hxx>
#include <stdio.h>
text[j++] = orig[i];
if (orig[i] == '\0') break;
}
- if (FP.ParamType() == Interface_ParamReal)
+ if (FP.ParamType() == Interface_ParamReal)
+ {
val = Atof(text);
+ if(Precision::IsIllegal(val))
+ {
+ Standard_NumericError::Raise();
+ }
+
+ if(Precision::IsInfinitesimal(val))
+ {
+ val = 0.0;
+ }
+ }
else if (FP.ParamType() == Interface_ParamEnum) { // convention
if (!pbrealform) {
if (testconv < 0) testconv = 0; //Interface_Static::IVal("iges.convert.read");
// -> un message avertissement + on ajoute le point puis on convertit
val = Atof(text);
+ if(Precision::IsIllegal(val))
+ {
+ Standard_NumericError::Raise();
+ }
+
+ if(Precision::IsInfinitesimal(val))
+ {
+ val = 0.0;
+ }
} else if (FP.ParamType() == Interface_ParamVoid) {
val = 0.0; // DEFAULT
} else {
text[j++] = orig[i];
if (orig[i] == '\0') break;
}
- if (FP.ParamType() == Interface_ParamReal)
+ if (FP.ParamType() == Interface_ParamReal)
+ {
val = Atof(text);
+ if(Precision::IsIllegal(val))
+ {
+ Standard_NumericError::Raise();
+ }
+
+ if(Precision::IsInfinitesimal(val))
+ {
+ val = 0.0;
+ }
+ }
else if (FP.ParamType() == Interface_ParamEnum) { // convention
if (!pbrealform) {
if (testconv < 0) testconv = 0; //Interface_Static::IVal("iges.convert.read");
// -> un message avertissement + on ajoute le point puis on convertit
val = Atof(text);
+ if(Precision::IsIllegal(val))
+ {
+ Standard_NumericError::Raise();
+ }
+
+ if(Precision::IsInfinitesimal(val))
+ {
+ val = 0.0;
+ }
} else if (FP.ParamType() == Interface_ParamVoid) {
val = 0.0; // DEFAULT
} else {
Precision.cxx
Precision.hxx
-Precision.lxx
#include <Precision.hxx>
+
+//Binary representation of double numbers: expands it to MANTISSA, EXPONENT and SIGN-bit.
+struct stDBLType
+{
+ unsigned int manl:32;
+ unsigned int manh:20;
+ unsigned int exp:11;
+ unsigned int sign:1;
+};
+
+
+//=======================================================================
+//function : IsIllegal
+//purpose : Returns True if R is infinite, NAN or another number
+// which is not supported by OCCT.
+// Fragment of fpclassify(...) function is used, which is taken
+// from here: http://www.jbox.dk/sanos/source/lib/math.c.html
+//=======================================================================
+Standard_Boolean Precision::IsIllegal (const Standard_Real R)
+{
+ stDBLType* aDoubleBits = (struct stDBLType*) &R;
+ if (aDoubleBits->exp == 0)
+ {
+ if (aDoubleBits->manh != 0 || aDoubleBits->manl != 0)
+ {//_FPCLASS_ND (-DBL_MIN/2.0) or _FPCLASS_PD (+DBL_MIN/2.0)
+ return Standard_True;
+ }
+ }
+
+ if (aDoubleBits->exp == 0x7ff)
+ {//_FPCLASS_NINF (-1/0), _FPCLASS_PINF (+1/0), _FPCLASS_QNAN or _FPCLASS_SNAN
+ return Standard_True;
+ }
+
+ const Standard_Real anINf = 2.0*Infinite();
+
+ if(R >= anINf)
+ return Standard_True;
+
+ if(R <= -anINf)
+ return Standard_True;
+
+ return Standard_False;
+}
class Precision
{
public:
-
- DEFINE_STANDARD_ALLOC
-
-
//! Returns the recommended precision value
//! when checking the equality of two angles (given in radians).
//! Standard_Real Angle1 = ... , Angle2 = ... ;
//! you can use :
//! If ( Abs( D1.D2 ) < Precision::Angular() ) ...
//! (although the function IsNormal does exist).
- Standard_EXPORT static Standard_Real Angular();
-
+ static Standard_Real Angular()
+ {
+ return 1.e-12;
+ }
//! Returns the recommended precision value when
//! checking coincidence of two points in real space.
//! distance (1 / 10 millimeter). This distance
//! becomes easily measurable, but only within a restricted
//! space which contains some small objects of the complete scene.
- Standard_EXPORT static Standard_Real Confusion();
-
+ static Standard_Real Confusion()
+ {
+ return 1.e-7;
+ }
//! Returns square of Confusion.
//! Created for speed and convenience.
- Standard_EXPORT static Standard_Real SquareConfusion();
-
+ static Standard_Real SquareConfusion()
+ {
+ return Confusion() * Confusion();
+ }
+
//! Returns the precision value in real space, frequently
//! used by intersection algorithms to decide that a solution is reached.
//! This function provides an acceptable level of precision
//! The tolerance of intersection is equal to :
//! Precision::Confusion() / 100.
//! (that is, 1.e-9).
- Standard_EXPORT static Standard_Real Intersection();
-
+ static Standard_Real Intersection()
+ {
+ return Confusion() * 0.01;
+ }
+
//! Returns the precision value in real space, frequently used
//! by approximation algorithms.
//! This function provides an acceptable level of precision for
//! (that is, 1.e-6).
//! You may use a smaller tolerance in an approximation
//! algorithm, but this option might be costly.
- Standard_EXPORT static Standard_Real Approximation();
-
+ static Standard_Real Approximation()
+ {
+ return Confusion() * 10.;
+ }
+
//! Convert a real space precision to a parametric
//! space precision. <T> is the mean value of the
//! length of the tangent of the curve or the surface.
- //!
//! Value is P / T
- static Standard_Real Parametric (const Standard_Real P, const Standard_Real T);
-
+ static Standard_Real Parametric (const Standard_Real P, const Standard_Real T)
+ {
+ return P / T;
+ }
//! Returns a precision value in parametric space, which may be used :
//! - to test the coincidence of two points in the real space,
//! 2.Pi without impacting on the resulting point.
//! Therefore, take great care when adjusting a parametric
//! tolerance to your own algorithm.
- Standard_EXPORT static Standard_Real PConfusion (const Standard_Real T);
-
+ static Standard_Real PConfusion (const Standard_Real T)
+ {
+ return Parametric(Confusion(),T);
+ }
//! Returns a precision value in parametric space, which
//! may be used by intersection algorithms, to decide that
//! segment whose length is equal to 100. (default value), or T.
//! The parametric tolerance of intersection is equal to :
//! - Precision::Intersection() / 100., or Precision::Intersection() / T.
- Standard_EXPORT static Standard_Real PIntersection (const Standard_Real T);
-
+ static Standard_Real PIntersection (const Standard_Real T)
+ {
+ return Parametric(Intersection(),T);
+ }
+
//! Returns a precision value in parametric space, which may
//! be used by approximation algorithms. The purpose of this
//! function is to provide an acceptable level of precision in
//! segment whose length is equal to 100. (default value), or T.
//! The parametric tolerance of intersection is equal to :
//! - Precision::Approximation() / 100., or Precision::Approximation() / T.
- Standard_EXPORT static Standard_Real PApproximation (const Standard_Real T);
-
+ static Standard_Real PApproximation (const Standard_Real T)
+ {
+ return Parametric(Approximation(),T);
+ }
+
//! Convert a real space precision to a parametric
//! space precision on a default curve.
- //!
//! Value is Parametric(P,1.e+2)
- Standard_EXPORT static Standard_Real Parametric (const Standard_Real P);
-
+ static Standard_Real Parametric (const Standard_Real P)
+ {
+ return Parametric(P, 100.);
+ }
+
//! Used to test distances in parametric space on a
//! default curve.
- //!
//! This is Precision::Parametric(Precision::Confusion())
- static Standard_Real PConfusion();
-
+ static Standard_Real PConfusion()
+ {
+ return Parametric(Confusion());
+ }
+
//! Used for Intersections in parametric space on a
//! default curve.
- //!
//! This is Precision::Parametric(Precision::Intersection())
- static Standard_Real PIntersection();
-
+ static Standard_Real PIntersection()
+ {
+ return Parametric(Intersection());
+ }
+
//! Used for Approximations in parametric space on a
//! default curve.
- //!
//! This is Precision::Parametric(Precision::Approximation())
- static Standard_Real PApproximation();
-
+ static Standard_Real PApproximation()
+ {
+ return Parametric(Approximation());
+ }
+
//! Returns True if R may be considered as an infinite
//! number. Currently Abs(R) > 1e100
- Standard_EXPORT static Standard_Boolean IsInfinite (const Standard_Real R);
-
+ static Standard_Boolean IsInfinite (const Standard_Real R)
+ {
+ return Abs(R) >= (0.5*Precision::Infinite());
+ }
+
//! Returns True if R may be considered as a positive
//! infinite number. Currently R > 1e100
- Standard_EXPORT static Standard_Boolean IsPositiveInfinite (const Standard_Real R);
-
+ static Standard_Boolean IsPositiveInfinite (const Standard_Real R)
+ {
+ return R >= (0.5*Precision::Infinite());
+ }
+
//! Returns True if R may be considered as a negative
//! infinite number. Currently R < -1e100
- Standard_EXPORT static Standard_Boolean IsNegativeInfinite (const Standard_Real R);
-
+ static Standard_Boolean IsNegativeInfinite (const Standard_Real R)
+ {
+ return R <= -(0.5*Precision::Infinite());
+ }
+
//! Returns a big number that can be considered as
//! infinite. Use -Infinite() for a negative big number.
- Standard_EXPORT static Standard_Real Infinite();
-
-
-
+ static Standard_Real Infinite()
+ {
+ return 2.e+100;
+ }
+
+ //! Returns True if R is infinite, NAN or another number
+ //! which is not supported by OCCT.
+ Standard_EXPORT static Standard_Boolean IsIllegal (const Standard_Real R);
+
+ //! Returns True if R is in epsilon-neighborhood of 0.
+ //! The value of epsilon is defined in OCCT and can be returned by
+ //! Precision::Infinite() method.
+ //! Therefore, epsilon-value is chosen to be equal 1/Infinite().
+ //! Some examples of numbers, which this function will return TRUE for:
+ //! R = 0, 3.0e-120, -5.0e-116 etc.
+ static Standard_Boolean IsInfinitesimal (const Standard_Real R)
+ {
+ const Standard_Real aNull = 1/Infinite();
+
+ return (Abs(R) < aNull);
+ }
protected:
};
-
-#include <Precision.lxx>
-
-
-
-
-
#endif // _Precision_HeaderFile
+++ /dev/null
-// Created on: 1993-03-08
-// Created by: Remi LEQUETTE
-// Copyright (c) 1993-1999 Matra Datavision
-// Copyright (c) 1999-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-//=======================================================================
-//function : Angular
-//purpose :
-//=======================================================================
-
-inline Standard_Real Precision::Angular()
-{
-#ifdef PRECISION_OBSOLETE
- static const Standard_Real Precision_Angular = 1.e-12;
- return Precision_Angular;
-#else
- return 1.e-12;
-#endif
-}
-
-
-//=======================================================================
-//function : Confusion
-//purpose :
-//=======================================================================
-
-inline Standard_Real Precision::Confusion()
-{
-#ifdef PRECISION_OBSOLETE
- static const Standard_Real Precision_Confusion = 1.e-7;
- return Precision_Confusion;
-#else
- return 1.e-7;
-#endif
-}
-
-
-//=======================================================================
-//function : SquareConfusion
-//purpose :
-//=======================================================================
-inline Standard_Real Precision::SquareConfusion()
-{
- return Confusion() * Confusion();
-}
-
-
-//=======================================================================
-//function : Intersection
-//purpose :
-//=======================================================================
-
-inline Standard_Real Precision::Intersection()
-{
-#ifdef PRECISION_OBSOLETE
- static const Standard_Real Precision_Intersection = Precision::Confusion() / 100.;
- return Precision_Intersection;
-#else
- return Confusion() * 0.01;
-#endif
-}
-
-
-//=======================================================================
-//function : Approximation
-//purpose :
-//=======================================================================
-
-inline Standard_Real Precision::Approximation()
-{
-#ifdef PRECISION_OBSOLETE
- static const Standard_Real Precision_Approximation = Precision::Confusion() * 10.;
- return Precision_Approximation;
-#else
- return Confusion() * 10.;
-#endif
-}
-
-
-//=======================================================================
-//function : Parametric
-//purpose :
-//=======================================================================
-
-inline Standard_Real Precision::Parametric(const Standard_Real P,
- const Standard_Real T)
-{
- return P / T;
-}
-
-
-//=======================================================================
-//function : PConfusion
-//purpose :
-//=======================================================================
-
-inline Standard_Real Precision::PConfusion(const Standard_Real T)
-{
- return Parametric(Confusion(),T);
-}
-
-
-//=======================================================================
-//function : PIntersection
-//purpose :
-//=======================================================================
-
-inline Standard_Real Precision::PIntersection(const Standard_Real T)
-{
- return Parametric(Intersection(),T);
-}
-
-
-//=======================================================================
-//function : PApproximation
-//purpose :
-//=======================================================================
-
-inline Standard_Real Precision::PApproximation(const Standard_Real T)
-{
- return Parametric(Approximation(),T);
-}
-
-//=======================================================================
-//function : Parametric
-//purpose :
-//=======================================================================
-
-inline Standard_Real Precision::Parametric(const Standard_Real P)
-{
-#ifdef PRECISION_OBSOLETE
- static const Standard_Real Precision_DefTangent = 1.e+2;
- return Parametric(P,Precision_DefTangent);
-#else
- return Parametric(P, 100.);
-#endif
-}
-
-
-//=======================================================================
-//function : PConfusion
-//purpose :
-//=======================================================================
-
-inline Standard_Real Precision::PConfusion()
-{
- return Parametric(Confusion());
-}
-
-
-//=======================================================================
-//function : PIntersection
-//purpose :
-//=======================================================================
-
-inline Standard_Real Precision::PIntersection()
-{
- return Parametric(Intersection());
-}
-
-
-//=======================================================================
-//function : PApproximation
-//purpose :
-//=======================================================================
-
-inline Standard_Real Precision::PApproximation()
-{
- return Parametric(Approximation());
-}
-
-//=======================================================================
-//function : IsInfinite
-//purpose :
-//=======================================================================
-
-inline Standard_Boolean Precision::IsInfinite(const Standard_Real R)
-{
- return Abs(R) >= (0.5*Precision::Infinite());
-}
-
-//=======================================================================
-//function : IsPositiveInfinite
-//purpose :
-//=======================================================================
-
-inline Standard_Boolean Precision::IsPositiveInfinite(const Standard_Real R)
-{
- return R >= (0.5*Precision::Infinite());
-}
-
-//=======================================================================
-//function : IsNegativeInfinite
-//purpose :
-//=======================================================================
-
-inline Standard_Boolean Precision::IsNegativeInfinite(const Standard_Real R)
-{
- return R <= -(0.5*Precision::Infinite());
-}
-
-
-//=======================================================================
-//function : Infinite
-//purpose :
-//=======================================================================
-
-inline Standard_Real Precision::Infinite()
-{
-#ifdef PRECISION_OBSOLETE
- static const Standard_Real Precision_Infinite = 1.e+100;
- static const Standard_Real Precision_InfiniteValue = 2 * Precision_Infinite;
- return Precision_InfiniteValue;
-#else
- return 2.e+100;
-#endif
-}
-
#include <Interface_Static.hxx>
#include <Message.hxx>
#include <Message_Messenger.hxx>
+#include <Precision.hxx>
+#include <Standard_NumericError.hxx>
#include <Standard_Transient.hxx>
#include <Standard_Type.hxx>
#include <StepData_EnumTool.hxx>
Handle(TColStd_HArray1OfReal) hre;
Handle(Interface_HArray1OfHAsciiString) hst;
Standard_Integer kod = 0;
- switch (FT0) {
- case Interface_ParamMisc : return -1;
- case Interface_ParamInteger : kod = 1; break;
- case Interface_ParamReal : kod = 5; break;
- case Interface_ParamIdent : kod = 7; break;
- case Interface_ParamVoid : kod = 0; break;
- case Interface_ParamText : kod = 6; break;
- case Interface_ParamEnum : kod = 4; break; // a confirmer(logical)
- /* kod = 4;
- if ( str[0] == '.' && str[2] == '.' && str[3] == '\0' &&
- (str[1] == 'T' || str[1] == 'F' || str[1] == 'U') ) kod = 3;
- break; */ // svv #2
- case Interface_ParamLogical : return -1;
- case Interface_ParamSub : kod = 0; break;
- case Interface_ParamHexa : return -1;
- case Interface_ParamBinary : return -1;
- default : return -1;
+ switch (FT0)
+ {
+ case Interface_ParamMisc:
+ return -1;
+ case Interface_ParamInteger:
+ kod = 1;
+ break;
+ case Interface_ParamReal:
+ kod = 5;
+ break;
+ case Interface_ParamIdent:
+ kod = 7;
+ break;
+ case Interface_ParamVoid:
+ kod = 0;
+ break;
+ case Interface_ParamText:
+ kod = 6;
+ break;
+ case Interface_ParamEnum:
+ kod = 4;
+ break; // a confirmer(logical)
+ /* kod = 4;
+ if ( str[0] == '.' && str[2] == '.' && str[3] == '\0' &&
+ (str[1] == 'T' || str[1] == 'F' || str[1] == 'U') ) kod = 3;
+ break; */ // svv #2
+ case Interface_ParamLogical:
+ return -1;
+ case Interface_ParamSub:
+ kod = 0;
+ break;
+ case Interface_ParamHexa:
+ return -1;
+ case Interface_ParamBinary:
+ return -1;
+ default:
+ return -1;
+ }
+ if (kod == 1 || kod == 3)
+ {
+ hin = new TColStd_HArray1OfInteger (1,nbp); val = hin;
+ }
+ else if (kod == 5)
+ {
+ hre = new TColStd_HArray1OfReal(1,nbp);
+ val = hre;
+ }
+ else if (kod == 6)
+ {
+ hst = new Interface_HArray1OfHAsciiString(1,nbp);
+ val = hst;
+ }
+ else
+ {
+ htr = new TColStd_HArray1OfTransient(1,nbp);
+ val = htr;
}
- if (kod == 1 || kod == 3) { hin = new TColStd_HArray1OfInteger (1,nbp); val = hin; }
- else if (kod == 5) { hre = new TColStd_HArray1OfReal (1,nbp); val = hre; }
- else if (kod == 6) { hst = new Interface_HArray1OfHAsciiString (1,nbp); val = hst; }
- else { htr = new TColStd_HArray1OfTransient (1,nbp); val = htr; }
// Attention : si type variable, faudra changer son fusil d epaule -> htr
- for (Standard_Integer ip = 1; ip <= nbp; ip ++) {
+ for (Standard_Integer ip = 1; ip <= nbp; ip ++)
+ {
const Interface_FileParameter& FP = Param(numsub,ip);
str = FP.CValue();
FT = FP.ParamType();
- switch (kod) {
- case 1 : {
- if (FT != Interface_ParamInteger) { kod = 0; break; }
- hin->SetValue (ip,atoi(str)); break;
+ switch (kod)
+ {
+ case 1:
+ {
+ if (FT != Interface_ParamInteger)
+ {
+ kod = 0;
+ break;
+ }
+
+ hin->SetValue (ip,atoi(str)); break;
}
- case 2 :
- case 3 : {
- if (FT != Interface_ParamEnum) { kod = 0; break; }
- if (!strcmp(str,".F.")) hin->SetValue (ip,0);
- else if (!strcmp(str,".T.")) hin->SetValue (ip,1);
- else if (!strcmp(str,".U.")) hin->SetValue (ip,2);
- else kod = 0;
- break;
+ case 2:
+ case 3:
+ {
+ if (FT != Interface_ParamEnum)
+ {
+ kod = 0;
+ break;
+ }
+
+ if(!strcmp(str,".F."))
+ hin->SetValue (ip,0);
+ else if(!strcmp(str,".T."))
+ hin->SetValue (ip,1);
+ else if (!strcmp(str,".U."))
+ hin->SetValue (ip,2);
+ else
+ kod = 0;
+ break;
}
- case 4 : {
- if (FT != Interface_ParamEnum) { kod = 0; break; }
- Handle(StepData_SelectNamed) sn = new StepData_SelectNamed;
- sn->SetEnum (-1,str);
- htr->SetValue (ip,sn); break;
+ case 4:
+ {
+ if (FT != Interface_ParamEnum)
+ {
+ kod = 0;
+ break;
+ }
+
+ Handle(StepData_SelectNamed) sn = new StepData_SelectNamed;
+ sn->SetEnum (-1,str);
+ htr->SetValue (ip,sn);
+ break;
}
- case 5 : {
- if (FT != Interface_ParamReal) { kod = 0; break; }
- hre->SetValue (ip,Interface_FileReaderData::Fastof(str)); break;
+ case 5:
+ {
+ if (FT != Interface_ParamReal)
+ {
+ kod = 0;
+ break;
+ }
+
+ Standard_Real aValue = Interface_FileReaderData::Fastof(str);
+ if(Precision::IsIllegal(aValue))
+ {
+ Standard_NumericError::Raise();
+ }
+
+ if(Precision::IsInfinitesimal(aValue))
+ {
+ aValue = 0.0;
+ }
+
+ hre->SetValue (ip,aValue);
+ break;
}
- case 6 : {
- if (FT != Interface_ParamText) { kod = 0; break; }
- Handle(TCollection_HAsciiString) txt = new TCollection_HAsciiString(str);
- CleanText (txt); hst->SetValue (ip,txt); break;
+ case 6:
+ {
+ if (FT != Interface_ParamText)
+ {
+ kod = 0;
+ break;
+ }
+
+ Handle(TCollection_HAsciiString) txt = new TCollection_HAsciiString(str);
+ CleanText (txt);
+ hst->SetValue (ip,txt);
+ break;
}
- case 7 : {
- Handle(Standard_Transient) ent = BoundEntity (FP.EntityNumber());
- htr->SetValue (ip,ent); break;
+ case 7:
+ {
+ Handle(Standard_Transient) ent = BoundEntity (FP.EntityNumber());
+ htr->SetValue (ip,ent);
+ break;
}
- default : break;
+ default:
+ break;
}
-// Restent les autres cas ... tout est possible. cf le type du Param
- if (kod > 0) continue;
-// Il faut passer au transient ...
- if (htr.IsNull()) {
+ // Restent les autres cas ... tout est possible. cf le type du Param
+ if (kod > 0)
+ continue;
+ // Il faut passer au transient ...
+ if (htr.IsNull())
+ {
htr = new TColStd_HArray1OfTransient (1,nbp); val = htr;
Standard_Integer jp;
- if (!hin.IsNull()) {
- for (jp = 1; jp < ip; jp ++) {
- Handle(StepData_SelectInt) sin = new StepData_SelectInt;
- sin->SetInt (hin->Value(jp));
- htr->SetValue (jp,sin);
- }
+ if (!hin.IsNull())
+ {
+ for (jp = 1; jp < ip; jp ++)
+ {
+ Handle(StepData_SelectInt) sin = new StepData_SelectInt;
+ sin->SetInt (hin->Value(jp));
+ htr->SetValue (jp,sin);
+ }
}
- if (!hre.IsNull()) {
- for (jp = 1; jp < ip; jp ++) {
- Handle(StepData_SelectReal) sre = new StepData_SelectReal;
- sre->SetReal (hre->Value(jp));
- htr->SetValue (jp,sre);
- }
+ if (!hre.IsNull())
+ {
+ for (jp = 1; jp < ip; jp ++)
+ {
+ Handle(StepData_SelectReal) sre = new StepData_SelectReal;
+ sre->SetReal (hre->Value(jp));
+ htr->SetValue (jp,sre);
+ }
}
- if (!hst.IsNull()) {
- for (jp = 1; jp < ip; jp ++) {
- htr->SetValue (jp,hst->Value(jp));
- }
+ if (!hst.IsNull())
+ {
+ for (jp = 1; jp < ip; jp ++)
+ {
+ htr->SetValue (jp,hst->Value(jp));
+ }
}
}
-// A present, faut y aller : lire le champ et le mettre en place
-// Ce qui suit ressemble fortement a ReadAny ...
+ // A present, faut y aller : lire le champ et le mettre en place
+ // Ce qui suit ressemble fortement a ReadAny ...
- switch (FT) {
- case Interface_ParamMisc : break;
- case Interface_ParamInteger : {
- Handle(StepData_SelectInt) sin = new StepData_SelectInt;
- sin->SetInteger (atoi(str));
- htr->SetValue (ip,sin); break;
- }
- case Interface_ParamReal : {
- Handle(StepData_SelectReal) sre = new StepData_SelectReal;
- sre->SetReal (Interface_FileReaderData::Fastof(str)); break;
- //htr->SetValue (ip,sre); break; svv #2: unreachable
- }
- case Interface_ParamIdent : htr->SetValue (ip,BoundEntity (FP.EntityNumber())); break;
- case Interface_ParamVoid : break;
- case Interface_ParamEnum : {
- Handle(StepData_SelectInt) sin;
- Handle(StepData_SelectNamed) sna;
- Standard_Integer logic = -1;
-// PTV 16.09.2000
-// set the default value of StepData_Logical
- StepData_Logical slog = StepData_LUnknown;
- if ( str[0] == '.' && str[2] == '.' && str[3] == '\0') {
- if (str[1] == 'F') { slog = StepData_LFalse; logic = 0; }
- else if (str[1] == 'T') { slog = StepData_LTrue; logic = 1; }
- else if (str[1] == 'U') { slog = StepData_LUnknown; logic = 2; }
+ switch (FT)
+ {
+ case Interface_ParamMisc:
+ break;
+ case Interface_ParamInteger:
+ {
+ Handle(StepData_SelectInt) sin = new StepData_SelectInt;
+ sin->SetInteger (atoi(str));
+ htr->SetValue (ip,sin);
+ break;
+ }
+ case Interface_ParamReal:
+ {
+ Handle(StepData_SelectReal) sre = new StepData_SelectReal;
+
+ Standard_Real aValue = Interface_FileReaderData::Fastof(str);
+ if(Precision::IsIllegal(aValue))
+ {
+ Standard_NumericError::Raise();
+ }
+
+ if(Precision::IsInfinitesimal(aValue))
+ {
+ aValue = 0.0;
+ }
+
+ sre->SetReal (aValue);
+ break;
+ //htr->SetValue (ip,sre); break; svv #2: unreachable
}
- if (logic >= 0)
- { sin = new StepData_SelectInt; sin->SetLogical(slog); htr->SetValue(ip,sin); }
- else { sna = new StepData_SelectNamed;
- sna->SetEnum (logic,str); htr->SetValue (ip,sna); }
+ case Interface_ParamIdent:
+ htr->SetValue (ip,BoundEntity (FP.EntityNumber()));
+ break;
+ case Interface_ParamVoid:
+ break;
+ case Interface_ParamEnum:
+ {
+ Handle(StepData_SelectInt) sin;
+ Handle(StepData_SelectNamed) sna;
+ Standard_Integer logic = -1;
+
+ // PTV 16.09.2000
+ // set the default value of StepData_Logical
+
+ StepData_Logical slog = StepData_LUnknown;
+
+ if ( str[0] == '.' && str[2] == '.' && str[3] == '\0')
+ {
+ if (str[1] == 'F')
+ {
+ slog = StepData_LFalse;
+ logic = 0;
+ }
+ else if (str[1] == 'T')
+ {
+ slog = StepData_LTrue;
+ logic = 1;
+ }
+ else if (str[1] == 'U')
+ {
+ slog = StepData_LUnknown;
+ logic = 2;
+ }
+ }
+
+ if (logic >= 0)
+ {
+ sin = new StepData_SelectInt; sin->SetLogical(slog); htr->SetValue(ip,sin);
+ }
+ else
+ {
+ sna = new StepData_SelectNamed;
+ sna->SetEnum (logic,str); htr->SetValue (ip,sna);
+ }
+ break;
+ }
+ case Interface_ParamLogical:
+ break;
+ case Interface_ParamText:
+ {
+ Handle(TCollection_HAsciiString) txt = new TCollection_HAsciiString(str);
+ CleanText (txt);
+ htr->SetValue (ip,txt);
+ break;
+ }
+ case Interface_ParamSub:
+ {
+ Handle(Standard_Transient) sub;
+ Standard_Integer nent = FP.EntityNumber();
+ Standard_Integer kind = ReadSub (nent,mess,ach,descr,sub);
+ if (kind < 0)
+ break;
+
+ htr->SetValue(ip,sub); break;
+ }
+
+ case Interface_ParamHexa:
+ break;
+ case Interface_ParamBinary:
+ break;
+ default:
break;
}
- case Interface_ParamLogical : break;
- case Interface_ParamText : {
- Handle(TCollection_HAsciiString) txt = new TCollection_HAsciiString(str);
- CleanText (txt); htr->SetValue (ip,txt); break;
- }
- case Interface_ParamSub : {
- Handle(Standard_Transient) sub;
- Standard_Integer nent = FP.EntityNumber();
- Standard_Integer kind = ReadSub (nent,mess,ach,descr,sub); if (kind < 0) break;
- htr->SetValue(ip,sub); break;
- }
- case Interface_ParamHexa : break;
- case Interface_ParamBinary : break;
- default : break;
- }
+
return -1;
}
return 8; // pour Any
case Interface_ParamMisc : OK = Standard_False; break;
case Interface_ParamInteger : fild.SetInteger (atoi(str)); break;
case Interface_ParamReal :
- fild.SetReal (Interface_FileReaderData::Fastof(str)); break;
+ {
+ Standard_Real aValue = Interface_FileReaderData::Fastof(str);
+ if(Precision::IsIllegal(aValue))
+ {
+ Standard_NumericError::Raise();
+ }
+
+ if(Precision::IsInfinitesimal(aValue))
+ {
+ aValue = 0.0;
+ }
+
+ fild.SetReal (aValue); break;
+ }
case Interface_ParamIdent :
nent = FP.EntityNumber();
if (nent > 0) fild.SetEntity (BoundEntity(nent));
}
case Interface_ParamReal : {
if (!val.IsNull()) {
- DeclareAndCast(StepData_SelectMember,sm,val);
- sm->SetReal (Interface_FileReaderData::Fastof(str));
- return Standard_True;
+ DeclareAndCast(StepData_SelectMember,sm,val);
+ Standard_Real aValue = Interface_FileReaderData::Fastof(str);
+ if(Precision::IsIllegal(aValue))
+ {
+ Standard_NumericError::Raise();
+ }
+ if(Precision::IsInfinitesimal(aValue))
+ {
+ aValue = 0.0;
+ }
+
+ sm->SetReal (aValue);
+ return Standard_True;
}
Handle(StepData_SelectReal) sre = new StepData_SelectReal;
- sre->SetReal (Interface_FileReaderData::Fastof(str));
+ Standard_Real aValue = Interface_FileReaderData::Fastof(str);
+ if(Precision::IsIllegal(aValue))
+ {
+ Standard_NumericError::Raise();
+ }
+
+ if(Precision::IsInfinitesimal(aValue))
+ {
+ aValue = 0.0;
+ }
+
+ sre->SetReal (aValue);
val = sre;
return Standard_True;
}
if (numsub != 0) {
if (NbParams(numsub) == 2) {
const Interface_FileParameter& FPX = Param(numsub,1);
- if (FPX.ParamType() == Interface_ParamReal) X =
- Interface_FileReaderData::Fastof(FPX.CValue());
+ if (FPX.ParamType() == Interface_ParamReal)
+ {
+ X = Interface_FileReaderData::Fastof(FPX.CValue());
+ if(Precision::IsIllegal(X))
+ {
+ Standard_NumericError::Raise();
+ }
+
+ if(Precision::IsInfinitesimal(X))
+ {
+ X = 0.0;
+ }
+ }
else errmess = new String("Parameter n0.%d (%s) : (X,Y) X not a Real");
const Interface_FileParameter& FPY = Param(numsub,2);
- if (FPY.ParamType() == Interface_ParamReal) Y =
- Interface_FileReaderData::Fastof( FPY.CValue());
+ if (FPY.ParamType() == Interface_ParamReal)
+ {
+ Y = Interface_FileReaderData::Fastof( FPY.CValue());
+ if(Precision::IsIllegal(Y))
+ {
+ Standard_NumericError::Raise();
+ }
+
+ if(Precision::IsInfinitesimal(Y))
+ {
+ Y = 0.0;
+ }
+ }
else errmess = new String("Parameter n0.%d (%s) : (X,Y) Y not a Real");
}
if (numsub != 0) {
if (NbParams(numsub) == 3) {
const Interface_FileParameter& FPX = Param(numsub,1);
- if (FPX.ParamType() == Interface_ParamReal) X =
- Interface_FileReaderData::Fastof(FPX.CValue());
+ if (FPX.ParamType() == Interface_ParamReal)
+ {
+ X = Interface_FileReaderData::Fastof(FPX.CValue());
+ if(Precision::IsIllegal(X))
+ {
+ Standard_NumericError::Raise();
+ }
+
+ if(Precision::IsInfinitesimal(X))
+ {
+ X = 0.0;
+ }
+ }
else errmess = new String("Parameter n0.%d (%s) : (X,Y,Z) X not a Real");
const Interface_FileParameter& FPY = Param(numsub,2);
- if (FPY.ParamType() == Interface_ParamReal) Y =
- Interface_FileReaderData::Fastof(FPY.CValue());
+ if (FPY.ParamType() == Interface_ParamReal)
+ {
+ Y = Interface_FileReaderData::Fastof(FPY.CValue());
+ if(Precision::IsIllegal(Y))
+ {
+ Standard_NumericError::Raise();
+ }
+
+ if(Precision::IsInfinitesimal(Y))
+ {
+ Y = 0.0;
+ }
+ }
else errmess = new String("Parameter n0.%d (%s) : (X,Y,Z) Y not a Real");
const Interface_FileParameter& FPZ = Param(numsub,3);
- if (FPZ.ParamType() == Interface_ParamReal) Z =
- Interface_FileReaderData::Fastof(FPZ.CValue());
+ if (FPZ.ParamType() == Interface_ParamReal)
+ {
+ Z = Interface_FileReaderData::Fastof(FPZ.CValue());
+ if(Precision::IsIllegal(Z))
+ {
+ Standard_NumericError::Raise();
+ }
+
+ if(Precision::IsInfinitesimal(Z))
+ {
+ Z = 0.0;
+ }
+ }
else errmess = new String("Parameter n0.%d (%s) : (X,Y,Z) Z not a Real");
}
Handle(String) errmess; // Null si pas d erreur
if (nump > 0 && nump <= NbParams(num)) {
const Interface_FileParameter& FP = Param(num,nump);
- if (FP.ParamType() == Interface_ParamReal) val =
- Interface_FileReaderData::Fastof(FP.CValue());
+ if (FP.ParamType() == Interface_ParamReal)
+ {
+ val = Interface_FileReaderData::Fastof(FP.CValue());
+ if(Precision::IsIllegal(val))
+ {
+ Standard_NumericError::Raise();
+ }
+
+ if(Precision::IsInfinitesimal(val))
+ {
+ val = 0.0;
+ }
+ }
else errmess = new String("Parameter n0.%d (%s) not a Real");
}
else errmess = new String("Parameter n0.%d (%s) absent");
# !!!! This file is generated automatically, do not edit manually! See end script
puts "TODO CR23096 ALL: NBSHAPES : Faulty"
-puts "TODO CR23096 ALL: TOLERANCE : Faulty"
puts "TODO CR23096 ALL: LABELS : Faulty"
puts "TODO CR23096 ALL: COLORS : Faulty"
-puts "TODO CR25013 ALL: Error : 3 differences with reference data found"
+puts "TODO CR23096 ALL: CHECKSHAPE : Faulty"
-set LinuxDiff 4
-set LinuxFaulties {STATSHAPE}
set filename coque-sup.igs
set ref_data {
DATA : Faulties = 0 ( 0 ) Warnings = 0 ( 0 ) Summary = 0 ( 0 )
-TPSTAT : Faulties = 0 ( 3 ) Warnings = 274 ( 4465 ) Summary = 274 ( 4468 )
-CHECKSHAPE : Wires = 2 ( 2 ) Faces = 3 ( 3 ) Shells = 0 ( 0 ) Solids = 0 ( 0 )
-NBSHAPES : Solid = 0 ( 0 ) Shell = 0 ( 0 ) Face = 1628 ( 1628 ) Summary = 39231 ( 39275 )
-STATSHAPE : Solid = 0 ( 0 ) Shell = 0 ( 0 ) Face = 1628 ( 1628 ) FreeWire = 22 ( 26 ) FreeEdge = 135 ( 135 ) SharedEdge = 17934 ( 17947 )
-TOLERANCE : MaxTol = 4.337400808e+088 ( 8.082392835e+086 ) AvgTol = 2.040579288e+085 ( 5.099401401e+083 )
-LABELS : N0Labels = 6 ( 6 ) N1Labels = 1643 ( 9621 ) N2Labels = 0 ( 0 ) TotalLabels = 1649 ( 9627 ) NameLabels = 1649 ( 2891 ) ColorLabels = 1645 ( 9626 ) LayerLabels = 489 ( 3997 )
+TPSTAT : Faulties = 0 ( 6 ) Warnings = 274 ( 4459 ) Summary = 274 ( 4465 )
+CHECKSHAPE : Wires = 1 ( 1 ) Faces = 3 ( 2 ) Shells = 0 ( 0 ) Solids = 0 ( 0 )
+NBSHAPES : Solid = 0 ( 0 ) Shell = 0 ( 0 ) Face = 1626 ( 1626 ) Summary = 39233 ( 39240 )
+STATSHAPE : Solid = 0 ( 0 ) Shell = 0 ( 0 ) Face = 1626 ( 1626 ) FreeWire = 22 ( 26 ) FreeEdge = 135 ( 135 ) SharedEdge = 17927 ( 17928 )
+TOLERANCE : MaxTol = 0.1961320506 ( 992.8187669 ) AvgTol = 0.0003489506144 ( 0.2649133106 )
+LABELS : N0Labels = 6 ( 6 ) N1Labels = 1641 ( 9630 ) N2Labels = 0 ( 0 ) TotalLabels = 1647 ( 9636 ) NameLabels = 1647 ( 2887 ) ColorLabels = 1643 ( 9635 ) LayerLabels = 487 ( 3989 )
PROPS : Centroid = 0 ( 0 ) Volume = 0 ( 0 ) Area = 0 ( 0 )
NCOLORS : NColors = 4 ( 5 )
COLORS : Colors = BLUE1 CYAN1 GOLD3 GREEN ( BLUE1 CYAN1 GOLD3 GREEN YELLOW )
set filename trj4_s1-ai-214.stp
set ref_data {
-DATA : Faulties = 0 ( 54 ) Warnings = 0 ( 0 ) Summary = 0 ( 54 )
+DATA : Faulties = 0 ( 0 ) Warnings = 0 ( 0 ) Summary = 0 ( 0 )
TPSTAT : Faulties = 0 ( 0 ) Warnings = 2 ( 51 ) Summary = 2 ( 51 )
CHECKSHAPE : Wires = 0 ( 0 ) Faces = 0 ( 0 ) Shells = 0 ( 0 ) Solids = 0 ( 0 )
NBSHAPES : Solid = 8 ( 8 ) Shell = 10 ( 10 ) Face = 108 ( 108 ) Summary = 603 ( 603 )
STATSHAPE : Solid = 8 ( 8 ) Shell = 10 ( 10 ) Face = 108 ( 108 ) FreeWire = 0 ( 0 ) FreeEdge = 0 ( 0 ) SharedEdge = 212 ( 212 )
TOLERANCE : MaxTol = 0.0007308879226 ( 0.002238579085 ) AvgTol = 1.588313862e-05 ( 3.376786703e-05 )
LABELS : N0Labels = 9 ( 9 ) N1Labels = 8 ( 8 ) N2Labels = 0 ( 0 ) TotalLabels = 17 ( 17 ) NameLabels = 17 ( 17 ) ColorLabels = 0 ( 0 ) LayerLabels = 0 ( 0 )
-PROPS : Centroid = 1 ( 1 ) Volume = 1 ( 1 ) Area = 1 ( 1 )
+PROPS : Centroid = 0 ( 0 ) Volume = 1 ( 1 ) Area = 1 ( 1 )
NCOLORS : NColors = 0 ( 0 )
COLORS : Colors = ( )
NLAYERS : NLayers = 0 ( 0 )