Salome HOME
19296: EDF 681 SMESH - Pre-evaluation of the number of elements before mesh
authoreap <eap@opencascade.com>
Mon, 16 Nov 2009 16:11:25 +0000 (16:11 +0000)
committereap <eap@opencascade.com>
Mon, 16 Nov 2009 16:11:25 +0000 (16:11 +0000)
    protect ARITHMETIC_1D from FPE

src/StdMeshers/StdMeshers_Regular_1D.cxx

index 8e50b059ba88c416dbc24ed7be91199d7e6b5f79..b2fee20463ce91e499e363aa77e25eb7268b7349 100644 (file)
@@ -757,7 +757,7 @@ bool StdMeshers_Regular_1D::computeInternalParameters(SMESH_Mesh &     theMesh,
     double an = _value[ END_LENGTH_IND ];
 
     double  q = ( an - a1 ) / ( 2 *theLength/( a1 + an ) - 1 );
-    int     n = int( 1 + ( an - a1 ) / q );
+    int n = fabs(q) > numeric_limits<double>::min() ? int( 1 + ( an - a1 ) / q ) : 1+theLength/a1;
 
     double U1 = theReverse ? l : f;
     double Un = theReverse ? f : l;