From: Yoann Audouin Date: Wed, 21 Sep 2022 13:26:59 +0000 (+0200) Subject: Restoring Regular 1D X-Git-Tag: V9_10_0b1~9^2~12 X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=commitdiff_plain;h=ee7ca3d826183e462048423d2416e96872d06620 Restoring Regular 1D --- diff --git a/src/StdMeshers/StdMeshers_Regular_1D.cxx b/src/StdMeshers/StdMeshers_Regular_1D.cxx index 625ecdceb..886f72b63 100644 --- a/src/StdMeshers/StdMeshers_Regular_1D.cxx +++ b/src/StdMeshers/StdMeshers_Regular_1D.cxx @@ -126,22 +126,14 @@ bool StdMeshers_Regular_1D::CheckHypothesis( SMESH_Mesh& aMesh, _onlyUnaryInput = true; // check propagation in a redefined GetUsedHypothesis() - const list hyps = + const list & hyps = GetUsedHypothesis(aMesh, aShape, /*ignoreAuxiliaryHyps=*/false); + const SMESH_HypoFilter & propagFilter = StdMeshers_Propagation::GetFilter(); // find non-auxiliary hypothesis const SMESHDS_Hypothesis *theHyp = 0; set< string > propagTypes; - //std::cout << "For shape " << aShape.HashCode(1) << " of type "<< aShape.ShapeType() << - // "CheckHypothesis" << std::endl; - // for(auto hyp:hyps){ - // SMESH_Comment hypStr; - // hypStr << hyp << " " << hyp->GetName() << " "; - // ((SMESHDS_Hypothesis*)hyp)->SaveTo( hypStr.Stream() ); - // hypStr << " "; - // std::cout << hypStr << std::endl; - // } list ::const_iterator h = hyps.begin(); for ( ; h != hyps.end(); ++h ) { if ( static_cast(*h)->IsAuxiliary() ) { @@ -856,12 +848,8 @@ bool StdMeshers_Regular_1D::computeInternalParameters(SMESH_Mesh & theMesh, { // Number Of Segments hypothesis nbSegments = _ivalue[ NB_SEGMENTS_IND ]; - if ( nbSegments < 1 ) { - return false; - } - if ( nbSegments == 1 ) { - return true; - } + if ( nbSegments < 1 ) return false; + if ( nbSegments == 1 ) return true; switch (_ivalue[ DISTR_TYPE_IND ]) { @@ -1182,16 +1170,10 @@ bool StdMeshers_Regular_1D::computeInternalParameters(SMESH_Mesh & theMesh, bool StdMeshers_Regular_1D::Compute(SMESH_Mesh & theMesh, const TopoDS_Shape & theShape) { - SMESH_Hypothesis::Hypothesis_Status hyp_status; - theMesh.Lock(); - bool ret = this->CheckHypothesis(theMesh, theShape, hyp_status); - int hypType = _hypType; - theMesh.Unlock(); - - if ( hypType == NONE ) - return false; + if ( _hypType == NONE ) + return false; - if ( hypType == ADAPTIVE ) + if ( _hypType == ADAPTIVE ) { _adaptiveHyp->GetAlgo()->InitComputeError(); _adaptiveHyp->GetAlgo()->Compute( theMesh, theShape ); @@ -1200,8 +1182,6 @@ bool StdMeshers_Regular_1D::Compute(SMESH_Mesh & theMesh, const TopoDS_Shape & t SMESHDS_Mesh * meshDS = theMesh.GetMeshDS(); - theMesh.Lock(); - const TopoDS_Edge & EE = TopoDS::Edge(theShape); TopoDS_Edge E = TopoDS::Edge(EE.Oriented(TopAbs_FORWARD)); int shapeID = meshDS->ShapeToIndex( E ); @@ -1216,11 +1196,9 @@ bool StdMeshers_Regular_1D::Compute(SMESH_Mesh & theMesh, const TopoDS_Shape & t ASSERT(!VLast.IsNull()); const SMDS_MeshNode * nFirst = SMESH_Algo::VertexNode( VFirst, meshDS ); const SMDS_MeshNode * nLast = SMESH_Algo::VertexNode( VLast, meshDS ); - if ( !nFirst || !nLast ){ - theMesh.Unlock(); - //std::cout << "exit no node" << std::endl; + if ( !nFirst || !nLast ) return error( COMPERR_BAD_INPUT_MESH, "No node on vertex"); - } + // remove elements created by e.g. pattern mapping (PAL21999) // CLEAN event is incorrectly ptopagated seemingly due to Propagation hyp // so TEMPORARY solution is to clean the submesh manually @@ -1252,7 +1230,7 @@ bool StdMeshers_Regular_1D::Compute(SMESH_Mesh & theMesh, const TopoDS_Shape & t // take into account reversing the edge the hypothesis is propagated from // (_mainEdge.Orientation() marks mutual orientation of EDGEs in propagation chain) reversed = ( _mainEdge.Orientation() == TopAbs_REVERSED ); - if ( hypType != DISTRIB_PROPAGATION ) { + if ( _hypType != DISTRIB_PROPAGATION ) { int mainID = meshDS->ShapeToIndex(_mainEdge); if ( std::find( _revEdgesIDs.begin(), _revEdgesIDs.end(), mainID) != _revEdgesIDs.end()) reversed = !reversed; @@ -1264,9 +1242,6 @@ bool StdMeshers_Regular_1D::Compute(SMESH_Mesh & theMesh, const TopoDS_Shape & t BRepAdaptor_Curve C3d( E ); if ( ! computeInternalParameters( theMesh, C3d, length, f, l, params, reversed, true )) { - theMesh.Unlock(); - //std::cout << "exit Compute internal failed" << std::endl; - return false; } redistributeNearVertices( theMesh, C3d, length, params, VFirst, VLast ); @@ -1357,9 +1332,6 @@ bool StdMeshers_Regular_1D::Compute(SMESH_Mesh & theMesh, const TopoDS_Shape & t meshDS->SetMeshElementOnShape(edge, shapeID); } } - theMesh.Unlock(); - //std::cout << "exit normal" << std::endl; - return true; }