From eaff026082ad84e0e699eb0a8fec91173711fe2c Mon Sep 17 00:00:00 2001 From: eap Date: Thu, 6 Oct 2011 16:01:08 +0000 Subject: [PATCH] 0021371: EDF SMESH: The propagation of elements courbure is sometimes wrong in quadratic conversion with nodes on geometry In FixQuadraticElements(), enhance detection of straight links --- src/SMESH/SMESH_MesherHelper.cxx | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/SMESH/SMESH_MesherHelper.cxx b/src/SMESH/SMESH_MesherHelper.cxx index 65ff6c657..c8c149da6 100644 --- a/src/SMESH/SMESH_MesherHelper.cxx +++ b/src/SMESH/SMESH_MesherHelper.cxx @@ -2617,7 +2617,7 @@ namespace { // Structures used by FixQuadraticElements() gp_XYZ mid1 = _qlink->MiddlePnt(); gp_XYZ mid2 = _qfaces[0]->_sides[ iOpp ]->MiddlePnt(); double faceSize2 = (mid1-mid2).SquareModulus(); - isStraight = _qlink->_nodeMove.SquareMagnitude() < 1/3./3. * faceSize2; + isStraight = _qlink->_nodeMove.SquareMagnitude() < 1/10./10. * faceSize2; } return isStraight; } @@ -2990,6 +2990,7 @@ void SMESH_MesherHelper::FixQuadraticElements(bool volumeOnly) const SMDS_MeshElement* vol = elemIt->next(); if ( !vol->IsQuadratic() || !volTool.Set( vol )) return; + double volMinSize2 = -1.; for ( int iF = 0; iF < volTool.NbFaces(); ++iF ) // loop on faces of volume { int nbN = volTool.NbFaceNodes( iF ); @@ -3002,10 +3003,17 @@ void SMESH_MesherHelper::FixQuadraticElements(bool volumeOnly) QLink link( faceNodes[iN], faceNodes[iN+2], faceNodes[iN+1] ); pLink = links.insert( link ).first; faceLinks[ iN/2 ] = & *pLink; - if ( !isCurved ) - isCurved = !link.IsStraight(); - if ( link.MediumPos() == SMDS_TOP_3DSPACE && !link.IsStraight() ) - return; // already fixed + + if ( link.MediumPos() == SMDS_TOP_3DSPACE ) + { + if ( !link.IsStraight() ) + return; // already fixed + } + else if ( !isCurved ) + { + if ( volMinSize2 < 0 ) volMinSize2 = volTool.MinLinearSize2(); + isCurved = !isStraightLink( volMinSize2, link._nodeMove.SquareMagnitude() ); + } } // store QFace pFace = faces.insert( QFace( faceLinks )).first; -- 2.39.2