From dccff92fcb09f5478a0bb0605bc2012a4668d206 Mon Sep 17 00:00:00 2001 From: eap Date: Tue, 4 Jun 2013 15:00:45 +0000 Subject: [PATCH] 0022103: EDF 2550 SMESH : Allow viscous layer with 3D extrusion = Allow viscous layers on boundary EDGEs of a 2D sub-mesh In ComputeParameters(), more attempts to get a correct result --- src/SMESHUtils/SMESH_Block.cxx | 16 +++++++++++----- src/SMESHUtils/SMESH_Block.hxx | 2 +- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/SMESHUtils/SMESH_Block.cxx b/src/SMESHUtils/SMESH_Block.cxx index 084c49146..f0838270e 100644 --- a/src/SMESHUtils/SMESH_Block.cxx +++ b/src/SMESHUtils/SMESH_Block.cxx @@ -694,12 +694,12 @@ bool SMESH_Block::ComputeParameters(const gp_Pnt& thePoint, start.SetCoord( iParam, sumParam / 4.); } if ( needGrid ) { - // compute nodes of 3 x 3 x 3 grid + // compute nodes of 10 x 10 x 10 grid int iNode = 0; Bnd_Box box; - for ( double x = 0.25; x < 0.9; x += 0.25 ) - for ( double y = 0.25; y < 0.9; y += 0.25 ) - for ( double z = 0.25; z < 0.9; z += 0.25 ) { + for ( double x = 0.05; x < 1.; x += 0.1 ) + for ( double y = 0.05; y < 1.; y += 0.1 ) + for ( double z = 0.05; z < 1.; z += 0.1 ) { TxyzPair & prmPtn = my3x3x3GridNodes[ iNode++ ]; prmPtn.first.SetCoord( x, y, z ); ShellPoint( prmPtn.first, prmPtn.second ); @@ -718,7 +718,7 @@ bool SMESH_Block::ComputeParameters(const gp_Pnt& thePoint, { double minDist = DBL_MAX; gp_XYZ* bestParam = 0; - for ( int iNode = 0; iNode < 27; iNode++ ) { + for ( int iNode = 0; iNode < 1000; iNode++ ) { TxyzPair & prmPtn = my3x3x3GridNodes[ iNode ]; double dist = ( thePoint.XYZ() - prmPtn.second ).SquareModulus(); if ( dist < minDist ) { @@ -819,6 +819,12 @@ bool SMESH_Block::ComputeParameters(const gp_Pnt& thePoint, << " ------ NB IT: " << myNbIterations << ", SUM DIST: " << mySumDist ); #endif + const double reachedDist = sqrt( sqDistance ); + if ( reachedDist > 1000 * myTolerance && + computeParameters( thePoint, theParams, solution ) && + reachedDist > distance() ) + return true; + theParams = solution; if ( myFaceIndex > 0 ) diff --git a/src/SMESHUtils/SMESH_Block.hxx b/src/SMESHUtils/SMESH_Block.hxx index 427cc94de..4f0a60db9 100644 --- a/src/SMESHUtils/SMESH_Block.hxx +++ b/src/SMESHUtils/SMESH_Block.hxx @@ -383,7 +383,7 @@ public: double myValues[ 4 ]; // values computed at myParam: square distance and 3 derivatives typedef std::pair TxyzPair; - TxyzPair my3x3x3GridNodes[ 27 ]; // to compute the first param guess + TxyzPair my3x3x3GridNodes[ 1000 ]; // to compute the first param guess bool myGridComputed; }; -- 2.39.2