NPAL16132 (GHS3D execution failed in Salome version 4.0.0)

correctly update _computeState for algos that
     NeedDescretBoundary() && ! OnlyUnaryInput()
This commit is contained in:
eap 2007-06-08 08:57:42 +00:00
parent 1c56e11967
commit 105d08dcbf
2 changed files with 26 additions and 11 deletions

View File

@ -1375,6 +1375,7 @@ bool SMESH_subMesh::ComputeStateEngine(int event)
ret = false; ret = false;
_computeState = FAILED_TO_COMPUTE; _computeState = FAILED_TO_COMPUTE;
_computeError = SMESH_ComputeError::New(COMPERR_OK,"",algo); _computeError = SMESH_ComputeError::New(COMPERR_OK,"",algo);
TopoDS_Shape shape = _subShape;
try { try {
#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 #if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
OCC_CATCH_SIGNALS; OCC_CATCH_SIGNALS;
@ -1389,12 +1390,15 @@ bool SMESH_subMesh::ComputeStateEngine(int event)
} }
else else
{ {
if (!algo->OnlyUnaryInput()) {
shape = GetCollection( gen, algo );
}
if (!algo->NeedDescretBoundary() && !algo->OnlyUnaryInput()) { if (!algo->NeedDescretBoundary() && !algo->OnlyUnaryInput()) {
ret = ApplyToCollection( algo, GetCollection( gen, algo ) ); ret = ApplyToCollection( algo, shape );
break; break;
} }
else { else {
ret = algo->Compute((*_father), _subShape); ret = algo->Compute((*_father), shape);
} }
} }
if ( !ret ) if ( !ret )
@ -1445,11 +1449,11 @@ bool SMESH_subMesh::ComputeStateEngine(int event)
else else
{ {
_computeError.reset(); _computeError.reset();
UpdateDependantsState( SUBMESH_COMPUTED ); // send event SUBMESH_COMPUTED //UpdateDependantsState( SUBMESH_COMPUTED ); // send event SUBMESH_COMPUTED
} }
if ( !algo->NeedDescretBoundary() ) //if ( !algo->NeedDescretBoundary() )
UpdateSubMeshState( ret ? COMPUTE_OK : FAILED_TO_COMPUTE ); // UpdateSubMeshState( ret ? COMPUTE_OK : FAILED_TO_COMPUTE );
CheckComputeError( algo ); CheckComputeError( algo, shape );
} }
break; break;
case CLEAN: 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() ); bool noErrors = ( !_computeError || _computeError->IsOK() );
if ( !noErrors ) if ( !noErrors )
@ -1630,14 +1635,25 @@ bool SMESH_subMesh::CheckComputeError(SMESH_Algo* theAlgo)
else else
{ {
_computeState = COMPUTE_OK; _computeState = COMPUTE_OK;
UpdateDependantsState( SUBMESH_COMPUTED ); // send event SUBMESH_COMPUTED
} }
// Check state of submeshes // Check state of submeshes
if ( !theAlgo->NeedDescretBoundary() /*&& theAlgo->OnlyUnaryInput()*/ ) { if ( !theAlgo->NeedDescretBoundary() )
{
SMESH_subMeshIteratorPtr smIt = getDependsOnIterator(false,false); SMESH_subMeshIteratorPtr smIt = getDependsOnIterator(false,false);
while ( smIt->more() ) while ( smIt->more() )
if ( !smIt->next()->CheckComputeError( theAlgo )) if ( !smIt->next()->CheckComputeError( theAlgo ))
noErrors = false; 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; return noErrors;
} }
@ -1788,7 +1804,6 @@ void SMESH_subMesh::RemoveSubMeshElementsAndNodes()
TopoDS_Shape SMESH_subMesh::GetCollection(SMESH_Gen * theGen, SMESH_Algo* theAlgo) TopoDS_Shape SMESH_subMesh::GetCollection(SMESH_Gen * theGen, SMESH_Algo* theAlgo)
{ {
MESSAGE("SMESH_subMesh::GetCollection"); MESSAGE("SMESH_subMesh::GetCollection");
ASSERT (!theAlgo->NeedDescretBoundary());
TopoDS_Shape mainShape = _father->GetMeshDS()->ShapeToMesh(); TopoDS_Shape mainShape = _father->GetMeshDS()->ShapeToMesh();

View File

@ -253,7 +253,7 @@ protected:
* \brief Update compute_state by _computeError * \brief Update compute_state by _computeError
* \retval bool - false if there are errors * \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. * \brief Return a hypothesis attached to theShape.