From 9c53bb166df3e50ce58f10a5c2cfcec7040d0dfe Mon Sep 17 00:00:00 2001 From: mbs Date: Wed, 13 Nov 2024 15:50:59 +0000 Subject: [PATCH] compute arithmetic increment dependend on number of intervals for ARITHMETIC_1D --- src/StdMeshers/StdMeshers_Regular_1D.cxx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/StdMeshers/StdMeshers_Regular_1D.cxx b/src/StdMeshers/StdMeshers_Regular_1D.cxx index 13b63bcc6..258f73705 100644 --- a/src/StdMeshers/StdMeshers_Regular_1D.cxx +++ b/src/StdMeshers/StdMeshers_Regular_1D.cxx @@ -1042,8 +1042,13 @@ bool StdMeshers_Regular_1D::computeInternalParameters(SMESH_Mesh & theMesh, return error ( SMESH_Comment("Invalid segment lengths (")< numeric_limits::min() ? ( 1+( an-a1 )/q ) : ( 1+theLength/a1 )); + // double q = ( an - a1 ) / ( 2 *theLength/( a1 + an ) - 1 ); + // int n = int(fabs(q) > numeric_limits::min() ? ( 1+( an-a1 )/q ) : ( 1+theLength/a1 )); + int n = int(2 * theLength / ( a1 + an ) + 0.5); + double q = (n > 1 ? ( an - a1 ) / (n - 1) : 0.0); + + std::cout << "a1 = " << a1 << ", an = " << an << ", len = " << theLength << std::endl; + std::cout << "n = " << n << ", q = " << q << std::endl; double U1 = theReverse ? l : f; double Un = theReverse ? f : l; -- 2.39.2