Salome HOME
Restoring Regular 1D
authorYoann Audouin <yoann.audouin@edf.fr>
Wed, 21 Sep 2022 13:26:59 +0000 (15:26 +0200)
committerYoann Audouin <yoann.audouin@edf.fr>
Tue, 18 Oct 2022 13:02:19 +0000 (15:02 +0200)
src/StdMeshers/StdMeshers_Regular_1D.cxx

index 625ecdceb85f95c9028bdf3b3f270d09155b9a01..886f72b63abaedfcf247fd8c31e94be7edada513 100644 (file)
@@ -126,22 +126,14 @@ bool StdMeshers_Regular_1D::CheckHypothesis( SMESH_Mesh&         aMesh,
   _onlyUnaryInput = true;
 
   // check propagation in a redefined GetUsedHypothesis()
-  const list <const SMESHDS_Hypothesis * > hyps =
+  const list <const SMESHDS_Hypothesis * > 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 SMESHDS_Hypothesis * >::const_iterator h = hyps.begin();
   for ( ; h != hyps.end(); ++h ) {
     if ( static_cast<const SMESH_Hypothesis*>(*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;
 }