0021823: [CEA 649] Compute failed without any errors

report a warning if no elements are assigned to a sub-shape
This commit is contained in:
eap 2012-08-30 07:42:09 +00:00
parent 9230b68a8f
commit 1a1cf7152f
2 changed files with 25 additions and 12 deletions

View File

@ -1758,13 +1758,25 @@ bool SMESH_subMesh::checkComputeError(SMESH_Algo* theAlgo, const TopoDS_Shape& t
} }
} }
{ {
// Check my state
// Set my _computeState
_computeState = FAILED_TO_COMPUTE;
if ( !_computeError || _computeError->IsOK() ) if ( !_computeError || _computeError->IsOK() )
{ {
// no error description is set to this sub-mesh, check if any mesh is computed // no error description is set to this sub-mesh, check if any mesh is computed
_computeState = IsMeshComputed() ? COMPUTE_OK : FAILED_TO_COMPUTE; _computeState = IsMeshComputed() ? COMPUTE_OK : FAILED_TO_COMPUTE;
} if ( _computeState != COMPUTE_OK )
{
if ( _subShape.ShapeType() == TopAbs_EDGE &&
BRep_Tool::Degenerated( TopoDS::Edge( _subShape )) )
_computeState = COMPUTE_OK;
else else
_computeError = SMESH_ComputeError::New(COMPERR_NO_MESH_ON_SHAPE,"",theAlgo);
}
noErrors = ( _computeState == COMPUTE_OK );
}
if ( !noErrors )
{ {
if ( !_computeError->myAlgo ) if ( !_computeError->myAlgo )
_computeError->myAlgo = theAlgo; _computeError->myAlgo = theAlgo;
@ -1783,7 +1795,6 @@ bool SMESH_subMesh::checkComputeError(SMESH_Algo* theAlgo, const TopoDS_Shape& t
_computeState = _computeError->IsKO() ? FAILED_TO_COMPUTE : COMPUTE_OK; _computeState = _computeError->IsKO() ? FAILED_TO_COMPUTE : COMPUTE_OK;
noErrors = false;
} }
} }
return noErrors; return noErrors;

View File

@ -338,7 +338,7 @@ namespace SMESH
QString text; QString text;
switch ( errCode ) { switch ( errCode ) {
CASE2TEXT( COMPERR_OK ); CASE2TEXT( COMPERR_OK );
CASE2TEXT( COMPERR_BAD_INPUT_MESH); CASE2TEXT( COMPERR_BAD_INPUT_MESH );
CASE2TEXT( COMPERR_STD_EXCEPTION ); CASE2TEXT( COMPERR_STD_EXCEPTION );
CASE2TEXT( COMPERR_OCC_EXCEPTION ); CASE2TEXT( COMPERR_OCC_EXCEPTION );
case SMESH::COMPERR_SLM_EXCEPTION: break; // avoid double "Salome exception" case SMESH::COMPERR_SLM_EXCEPTION: break; // avoid double "Salome exception"
@ -346,6 +346,7 @@ namespace SMESH
CASE2TEXT( COMPERR_MEMORY_PB ); CASE2TEXT( COMPERR_MEMORY_PB );
CASE2TEXT( COMPERR_BAD_SHAPE ); CASE2TEXT( COMPERR_BAD_SHAPE );
CASE2TEXT( COMPERR_CANCELED ); CASE2TEXT( COMPERR_CANCELED );
CASE2TEXT( COMPERR_NO_MESH_ON_SHAPE );
case SMESH::COMPERR_ALGO_FAILED: case SMESH::COMPERR_ALGO_FAILED:
if ( strlen(comment) == 0 ) if ( strlen(comment) == 0 )
text = QObject::tr("COMPERR_ALGO_FAILED"); text = QObject::tr("COMPERR_ALGO_FAILED");
@ -951,7 +952,8 @@ void SMESHGUI_BaseComputeOp::showComputeResult( const bool theMemoryLack,
{ {
bool onlyWarnings = !theNoCompError; // == valid mesh computed but there are errors reported bool onlyWarnings = !theNoCompError; // == valid mesh computed but there are errors reported
for ( int i = 0; i < theCompErrors->length() && onlyWarnings; ++i ) for ( int i = 0; i < theCompErrors->length() && onlyWarnings; ++i )
onlyWarnings = ( theCompErrors[ i ].code == SMESH::COMPERR_WARNING ); onlyWarnings = ( theCompErrors[ i ].code == SMESH::COMPERR_WARNING ||
theCompErrors[ i ].code == SMESH::COMPERR_NO_MESH_ON_SHAPE );
// full or brief mesh info // full or brief mesh info
SMESH::long_array_var aRes = myMesh->GetMeshInfo(); SMESH::long_array_var aRes = myMesh->GetMeshInfo();