From: eap Date: Tue, 22 Apr 2014 15:46:18 +0000 (+0400) Subject: Regression SALOME_TESTS/Grids/smesh/viscous_layers_00/A1 X-Git-Tag: V7_4_0rc1~38 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=3f0822bd99d7a77dda623a448d2ee63282744c3d;p=modules%2Fsmesh.git Regression SALOME_TESTS/Grids/smesh/viscous_layers_00/A1 --- diff --git a/src/SMESH/SMESH_subMesh.cxx b/src/SMESH/SMESH_subMesh.cxx index 0b9269fed..8ec6a77b6 100644 --- a/src/SMESH/SMESH_subMesh.cxx +++ b/src/SMESH/SMESH_subMesh.cxx @@ -2122,7 +2122,7 @@ TopoDS_Shape SMESH_subMesh::getCollection(SMESH_Gen * theGen, theAlgo->GetUsedHypothesis( *_father, _subShape, ignoreAuxiliaryHyps ); // copy // put in a compound all shapes with the same hypothesis assigned - // and a good ComputState + // and a good ComputeState TopoDS_Compound aCompound; BRep_Builder aBuilder; diff --git a/src/StdMeshers/StdMeshers_ViscousLayers.cxx b/src/StdMeshers/StdMeshers_ViscousLayers.cxx index d4f0f678f..1f6d46263 100644 --- a/src/StdMeshers/StdMeshers_ViscousLayers.cxx +++ b/src/StdMeshers/StdMeshers_ViscousLayers.cxx @@ -54,6 +54,7 @@ #include #include #include +#include #include #include #include @@ -1811,45 +1812,36 @@ bool _ViscousBuilder::setEdgeData(_LayerEdge& edge, totalNbFaces++; F = TopoDS::Face( s ); - // IDEA: if there is a problem with finding a normal, - // we can compute an area-weighted sum of normals of all faces sharing the node gp_XY uv = helper.GetNodeUV( F, node, 0, &normOK ); Handle(Geom_Surface) surface = BRep_Tool::Surface( F ); - surface->D1( uv.X(), uv.Y(), p, du,dv ); - geomNorm = du ^ dv; - double size2 = geomNorm.SquareMagnitude(); - if ( size2 < 1e-10 ) // singularity { - SMDS_ElemIteratorPtr fIt = node->GetInverseElementIterator(SMDSAbs_Face); - while ( fIt->more() ) + gp_Dir normal; + if ( GeomLib::NormEstim( surface, uv, 1e-10, normal ) < 3 ) + { + geomNorm = normal; + normOK = true; + } + else // hard singularity { - const SMDS_MeshElement* f = fIt->next(); - if ( editor.FindShape( f ) == *id ) + SMDS_ElemIteratorPtr fIt = node->GetInverseElementIterator(SMDSAbs_Face); + while ( fIt->more() ) { - SMESH_MeshAlgos::FaceNormal( f, (gp_XYZ&) geomNorm.XYZ(), /*normalized=*/false ); - size2 = geomNorm.SquareMagnitude(); - break; + const SMDS_MeshElement* f = fIt->next(); + if ( editor.FindShape( f ) == *id ) + { + SMESH_MeshAlgos::FaceNormal( f, (gp_XYZ&) geomNorm.XYZ(), /*normalized=*/false ); + if ( helper.IsReversedSubMesh( F )) + geomNorm.Reverse(); + break; + } } + double size2 = geomNorm.SquareMagnitude(); + if ( size2 > numeric_limits::min() ) + geomNorm /= sqrt( size2 ); + else + normOK = false; } - // double ddu = 0, ddv = 0; - // if ( du.SquareMagnitude() > dv.SquareMagnitude() ) - // ddu = 1e-3; - // else - // ddv = 1e-3; - // surface->D1( uv.X()+ddu, uv.Y()+ddv, p, du,dv ); - // geomNorm = du ^ dv; - // size2 = geomNorm.SquareMagnitude(); - // if ( size2 < 1e-10 ) - // { - // surface->D1( uv.X()-ddu, uv.Y()-ddv, p, du,dv ); - // geomNorm = du ^ dv; - // size2 = geomNorm.SquareMagnitude(); - // } } - if ( size2 > numeric_limits::min() ) - geomNorm /= sqrt( size2 ); - else - normOK = false; if ( helper.GetSubShapeOri( data._solid, F ) != TopAbs_REVERSED ) geomNorm.Reverse(); edge._normal += geomNorm.XYZ();