X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FStdMeshers%2FStdMeshers_Import_1D.cxx;h=f27e74dca17ce9b863ff66d61e493962ad0b918f;hb=0eea513c934f0925f9b9ec6cc56892feafc04c0d;hp=5a9880cd8f4a62aea7dbd6ba35fa866063a5fb63;hpb=456850beda350181d4af970ac59b64c55cde20e3;p=modules%2Fsmesh.git diff --git a/src/StdMeshers/StdMeshers_Import_1D.cxx b/src/StdMeshers/StdMeshers_Import_1D.cxx index 5a9880cd8..f27e74dca 100644 --- a/src/StdMeshers/StdMeshers_Import_1D.cxx +++ b/src/StdMeshers/StdMeshers_Import_1D.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2020 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2024 CEA, EDF, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -253,6 +253,7 @@ namespace // INTERNAL STUFF _chord2 = Max( _line. SquareDistance( curve->Value( uf + 0.25 * ( ul - uf ))), Max( _line.SquareDistance( curve->Value( uf + 0.5 * ( ul - uf ))), _line.SquareDistance( curve->Value( uf + 0.75 * ( ul - uf ))))); + _chord2 *= ( 1.05 * 1.05 ); // +5% _chord2 = Max( tol, _chord2 ); _chord = Sqrt( _chord2 ); @@ -944,23 +945,23 @@ bool StdMeshers_Import_1D::Compute(SMESH_Mesh & theMesh, const TopoDS_Shape & th SMESHDS_Mesh* tgtMesh = theMesh.GetMeshDS(); const TopoDS_Edge& geomEdge = TopoDS::Edge( theShape ); - const double edgeTol = BRep_Tool::Tolerance( geomEdge ); - const int shapeID = tgtMesh->ShapeToIndex( geomEdge ); - + const double edgeTol = helper.MaxTolerance( geomEdge ); + const int shapeID = tgtMesh->ShapeToIndex( geomEdge ); double geomTol = Precision::Confusion(); + double minGeomTol = std::numeric_limits::max(); + for ( size_t iG = 0; iG < srcGroups.size(); ++iG ) { const SMESHDS_GroupBase* srcGroup = srcGroups[iG]->GetGroupDS(); for ( SMDS_ElemIteratorPtr srcElems = srcGroup->GetElements(); srcElems->more(); ) { const SMDS_MeshElement* edge = srcElems->next(); - geomTol = Sqrt( 0.5 * ( getMinEdgeLength2( edge->GetNode(0) ) + - getMinEdgeLength2( edge->GetNode(1) ))) / 25; - iG = srcGroups.size(); - break; + minGeomTol = std::min( Sqrt( getMinEdgeLength2( edge->GetNode(0) )) / 25, minGeomTol ); + geomTol = minGeomTol; } } + CurveProjector curveProjector( geomEdge, geomTol ); // get nodes on vertices @@ -1083,7 +1084,7 @@ bool StdMeshers_Import_1D::Compute(SMESH_Mesh & theMesh, const TopoDS_Shape & th } // loop on groups if ( n2n->empty()) - return error("Empty source groups"); + return error("Source groups are empty or mismatching geometry"); // check if the whole geom edge is covered by imported segments; // the check consist in passing by segments from one vetrex node to another @@ -1310,7 +1311,7 @@ bool StdMeshers_Import_1D::Evaluate(SMESH_Mesh & theMesh, if ( srcGroups.empty() ) return error("Invalid source groups"); - vector aVec(SMDSEntity_Last,0); + vector aVec(SMDSEntity_Last,0); bool toCopyMesh, toCopyGroups; _sourceHyp->GetCopySourceMesh(toCopyMesh, toCopyGroups);