From 105d08dcbf56b4bec6d8dbe0e5f5ca9b06b9e5fd Mon Sep 17 00:00:00 2001 From: eap Date: Fri, 8 Jun 2007 08:57:42 +0000 Subject: [PATCH] NPAL16132 (GHS3D execution failed in Salome version 4.0.0) correctly update _computeState for algos that NeedDescretBoundary() && ! OnlyUnaryInput() --- src/SMESH/SMESH_subMesh.cxx | 35 +++++++++++++++++++++++++---------- src/SMESH/SMESH_subMesh.hxx | 2 +- 2 files changed, 26 insertions(+), 11 deletions(-) diff --git a/src/SMESH/SMESH_subMesh.cxx b/src/SMESH/SMESH_subMesh.cxx index 3af807281..6b358d329 100644 --- a/src/SMESH/SMESH_subMesh.cxx +++ b/src/SMESH/SMESH_subMesh.cxx @@ -1375,6 +1375,7 @@ bool SMESH_subMesh::ComputeStateEngine(int event) ret = false; _computeState = FAILED_TO_COMPUTE; _computeError = SMESH_ComputeError::New(COMPERR_OK,"",algo); + TopoDS_Shape shape = _subShape; try { #if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 OCC_CATCH_SIGNALS; @@ -1389,12 +1390,15 @@ bool SMESH_subMesh::ComputeStateEngine(int event) } else { + if (!algo->OnlyUnaryInput()) { + shape = GetCollection( gen, algo ); + } if (!algo->NeedDescretBoundary() && !algo->OnlyUnaryInput()) { - ret = ApplyToCollection( algo, GetCollection( gen, algo ) ); + ret = ApplyToCollection( algo, shape ); break; } else { - ret = algo->Compute((*_father), _subShape); + ret = algo->Compute((*_father), shape); } } if ( !ret ) @@ -1445,11 +1449,11 @@ bool SMESH_subMesh::ComputeStateEngine(int event) else { _computeError.reset(); - UpdateDependantsState( SUBMESH_COMPUTED ); // send event SUBMESH_COMPUTED + //UpdateDependantsState( SUBMESH_COMPUTED ); // send event SUBMESH_COMPUTED } - if ( !algo->NeedDescretBoundary() ) - UpdateSubMeshState( ret ? COMPUTE_OK : FAILED_TO_COMPUTE ); - CheckComputeError( algo ); + //if ( !algo->NeedDescretBoundary() ) + // UpdateSubMeshState( ret ? COMPUTE_OK : FAILED_TO_COMPUTE ); + CheckComputeError( algo, shape ); } break; case CLEAN: @@ -1590,11 +1594,12 @@ bool SMESH_subMesh::ComputeStateEngine(int event) //======================================================================= /*! - * \brief Update compute_state by _computeError + * \brief Update compute_state by _computeError and send proper events to + * dependent submeshes */ //======================================================================= -bool SMESH_subMesh::CheckComputeError(SMESH_Algo* theAlgo) +bool SMESH_subMesh::CheckComputeError(SMESH_Algo* theAlgo, const TopoDS_Shape& theShape) { bool noErrors = ( !_computeError || _computeError->IsOK() ); if ( !noErrors ) @@ -1630,14 +1635,25 @@ bool SMESH_subMesh::CheckComputeError(SMESH_Algo* theAlgo) else { _computeState = COMPUTE_OK; + UpdateDependantsState( SUBMESH_COMPUTED ); // send event SUBMESH_COMPUTED } // Check state of submeshes - if ( !theAlgo->NeedDescretBoundary() /*&& theAlgo->OnlyUnaryInput()*/ ) { + if ( !theAlgo->NeedDescretBoundary() ) + { SMESH_subMeshIteratorPtr smIt = getDependsOnIterator(false,false); while ( smIt->more() ) if ( !smIt->next()->CheckComputeError( theAlgo )) noErrors = false; } + if ( !theAlgo->OnlyUnaryInput() && !theShape.IsNull() && + theShape.ShapeType() == TopAbs_COMPOUND ) + { + for (TopoDS_Iterator subIt( theShape ); subIt.More(); subIt.Next()) { + SMESH_subMesh* sm = _father->GetSubMesh( subIt.Value() ); + if ( sm != this && !sm->CheckComputeError( theAlgo )) + noErrors = false; + } + } return noErrors; } @@ -1788,7 +1804,6 @@ void SMESH_subMesh::RemoveSubMeshElementsAndNodes() TopoDS_Shape SMESH_subMesh::GetCollection(SMESH_Gen * theGen, SMESH_Algo* theAlgo) { MESSAGE("SMESH_subMesh::GetCollection"); - ASSERT (!theAlgo->NeedDescretBoundary()); TopoDS_Shape mainShape = _father->GetMeshDS()->ShapeToMesh(); diff --git a/src/SMESH/SMESH_subMesh.hxx b/src/SMESH/SMESH_subMesh.hxx index 001c40203..9770d6da0 100644 --- a/src/SMESH/SMESH_subMesh.hxx +++ b/src/SMESH/SMESH_subMesh.hxx @@ -253,7 +253,7 @@ protected: * \brief Update compute_state by _computeError * \retval bool - false if there are errors */ - bool CheckComputeError(SMESH_Algo* theAlgo); + bool CheckComputeError(SMESH_Algo* theAlgo, const TopoDS_Shape& theShape=TopoDS_Shape()); /*! * \brief Return a hypothesis attached to theShape. -- 2.39.2