From f08f994ee33e3b9cd4a78d2682788ce4329368fc Mon Sep 17 00:00:00 2001 From: eap Date: Thu, 6 Oct 2016 14:11:45 +0300 Subject: [PATCH] DOC: explain the semantics of the precision preference parameters Describe meaning of attributes in StdMeshers.xml Fix regression of SALOME_TESTS/Grids/smesh/3D_mesh_NETGEN_02/C4 SMESH_MesherHelper.cxx Fix SALOME crash on a case of #http://www.salome-platform.org/forum/forum_10/47659287 SMESH_MAT2d.cxx --- .../gui/SMESH/input/mesh_preferences.doc | 10 +++++- resources/StdMeshers.xml.in | 33 ++++++++++++++++--- src/SMESH/SMESH_MesherHelper.cxx | 6 ++-- src/SMESHUtils/SMESH_Block.cxx | 4 --- src/SMESHUtils/SMESH_MAT2d.cxx | 12 ++++--- 5 files changed, 50 insertions(+), 15 deletions(-) diff --git a/doc/salome/gui/SMESH/input/mesh_preferences.doc b/doc/salome/gui/SMESH/input/mesh_preferences.doc index b27ffef24..ea83772f7 100644 --- a/doc/salome/gui/SMESH/input/mesh_preferences.doc +++ b/doc/salome/gui/SMESH/input/mesh_preferences.doc @@ -134,7 +134,15 @@ or in later sessions with this module according to the preferences. when a hypothesis is modified. This allows saving time by omitting loading data of a large mesh that is planned to be recomputed with other parameters. -- Input fields precision +- Input fields precision - allows to adjust input precision of + different parameters. The semantics of the precision values is + described in detail in Using input widgets chapter of GUI + documentation (Introduction to Salome Platform / Introduction to GUI / + Using input widgets). In brief: \b positive precision value is the + maximum allowed number of digits after the decimal point in the + fixed-point format; \b nagative precision value is the maximum + allowed number of significant digits in mantissa in either the + fixed-point or scientific format. - Length precision - allows to adjust input precision of coordinates and dimensions. - Angular precision - allows to adjust input precision of angles. - Length tolerance precision - allows to adjust input precision of tolerance of coordinates and dimensions. diff --git a/resources/StdMeshers.xml.in b/resources/StdMeshers.xml.in index 3a4e607b1..3baade391 100644 --- a/resources/StdMeshers.xml.in +++ b/resources/StdMeshers.xml.in @@ -26,6 +26,31 @@ + + @@ -246,7 +271,7 @@ priority ="10" hypos ="Adaptive1D,LocalLength,MaxLength,Arithmetic1D,GeometricProgression,StartEndLength,NumberOfSegments,Deflection1D,AutomaticLength,FixedPoints1D" opt-hypos="Propagation,PropagOfDistribution,QuadraticMesh" - input ="VERTEX" + input ="NODE" output ="EDGE" need-hyp ="true" dim ="1"> @@ -274,7 +299,7 @@ priority ="20" hypos ="Adaptive1D,LocalLength,MaxLength,Arithmetic1D,GeometricProgression,StartEndLength,NumberOfSegments,Deflection1D,AutomaticLength,FixedPoints1D" opt-hypos="Propagation,PropagOfDistribution,QuadraticMesh" - input ="VERTEX" + input ="NODE" output ="EDGE" need-hyp ="true" dim ="1"> @@ -513,7 +538,7 @@ icon-id ="mesh_algo_regular.png" group-id="1" priority="30" - input ="VERTEX" + input ="NODE" output ="EDGE" dim ="1"> diff --git a/src/SMESH/SMESH_MesherHelper.cxx b/src/SMESH/SMESH_MesherHelper.cxx index ed82de3b4..b9a0e942d 100644 --- a/src/SMESH/SMESH_MesherHelper.cxx +++ b/src/SMESH/SMESH_MesherHelper.cxx @@ -2945,9 +2945,11 @@ bool SMESH_MesherHelper::IsReversedSubMesh (const TopoDS_Face& theFace) double u0 = GetNodeU( TopoDS::Edge( E ), nn[0], nn[1], &ok ); double u1 = GetNodeU( TopoDS::Edge( E ), nn[1], nn[0], &ok ); // check that the 2 nodes are connected with a segment (IPAL53055) + const SMDS_MeshElement* seg; if ( SMESHDS_SubMesh* sm = GetMeshDS()->MeshElements( E )) - if ( sm->NbElements() > 0 && !GetMeshDS()->FindEdge( nn[0], nn[1] )) - ok = false; + if (( sm->NbElements() > 0 ) && + ( seg = GetMeshDS()->FindEdge( nn[0], nn[1] ))) + ok = sm->Contains( seg ); if ( ok ) { isReversed = ( u0 > u1 ); diff --git a/src/SMESHUtils/SMESH_Block.cxx b/src/SMESHUtils/SMESH_Block.cxx index 90bd9bce6..4e6229c30 100644 --- a/src/SMESHUtils/SMESH_Block.cxx +++ b/src/SMESHUtils/SMESH_Block.cxx @@ -1608,7 +1608,6 @@ bool SMESH_Block::LoadMeshBlock(const SMDS_MeshVolume* theVolume, const int theNode001Index, vector& theOrderedNodes) { - MESSAGE(" ::LoadMeshBlock()"); init(); SMDS_VolumeTool vTool; @@ -1736,7 +1735,6 @@ bool SMESH_Block::LoadBlockShapes(const TopoDS_Shell& theShell, const TopoDS_Vertex& theVertex001, TopTools_IndexedMapOfOrientedShape& theShapeIDMap ) { - MESSAGE(" ::LoadBlockShapes()"); return ( FindBlockShapes( theShell, theVertex000, theVertex001, theShapeIDMap ) && LoadBlockShapes( theShapeIDMap )); } @@ -1752,8 +1750,6 @@ bool SMESH_Block::FindBlockShapes(const TopoDS_Shell& theShell, const TopoDS_Vertex& theVertex001, TopTools_IndexedMapOfOrientedShape& theShapeIDMap ) { - MESSAGE(" ::FindBlockShapes()"); - // 8 vertices TopoDS_Shape V000, V100, V010, V110, V001, V101, V011, V111; // 12 edges diff --git a/src/SMESHUtils/SMESH_MAT2d.cxx b/src/SMESHUtils/SMESH_MAT2d.cxx index da57a3148..2c20eb815 100644 --- a/src/SMESHUtils/SMESH_MAT2d.cxx +++ b/src/SMESHUtils/SMESH_MAT2d.cxx @@ -93,8 +93,8 @@ namespace list< const TVDEdge* > _edges; // MA edges in CCW order within _cell InSegment( InPoint * p0, InPoint * p1, size_t iE) - : _p0(p0), _p1(p1), _geomEdgeInd(iE) {} - InSegment() : _p0(0), _p1(0), _geomEdgeInd(0) {} + : _p0(p0), _p1(p1), _geomEdgeInd(iE), _cell(0) {} + InSegment() : _p0(0), _p1(0), _geomEdgeInd(0), _cell(0) {} const InPoint& point0() const { return *_p0; } const InPoint& point1() const { return *_p1; } @@ -662,7 +662,7 @@ namespace // get scale to have the same 2d proportions as in 3d computeProportionScale( face, uvBox, scale ); - // make scale to have coordinates precise enough when converted to int + // make 'scale' such that to have coordinates precise enough when converted to int gp_XY uvMin = uvBox.CornerMin(), uvMax = uvBox.CornerMax(); uvMin.ChangeCoord(1) = uvMin.X() * scale[0]; @@ -672,7 +672,7 @@ namespace double vMax[2] = { Max( Abs( uvMin.X() ), Abs( uvMax.X() )), Max( Abs( uvMin.Y() ), Abs( uvMax.Y() )) }; int iMax = ( vMax[0] > vMax[1] ) ? 0 : 1; - const double precision = 1e-5; + const double precision = Min( 1e-5, minSegLen * 1e-2 ); double preciScale = Min( vMax[iMax] / precision, std::numeric_limits::max() / vMax[iMax] ); preciScale /= scale[iMax]; @@ -703,6 +703,8 @@ namespace { inPoints[ iP++ ] = points[i-1].getInPoint( scale ); inSegments.push_back( InSegment( & inPoints[ iP-2 ], & inPoints[ iP-1 ], iE )); + if ( inPoints[ iP-2 ] == inPoints[ iP-1 ]) + return false; // too short segment } } } @@ -716,6 +718,8 @@ namespace { inPoints[ iP++ ] = points[i].getInPoint( scale ); inSegments.push_back( InSegment( & inPoints[ iP-2 ], & inPoints[ iP-1 ], iE )); + if ( inPoints[ iP-2 ] == inPoints[ iP-1 ]) + return false; // too short segment } } } -- 2.39.2