[bos #20282] EDF 22320 - general compute fails

Correct tree icon of partially computed sub-mesh
This commit is contained in:
eap 2020-11-20 11:26:59 +03:00
parent 982a098136
commit 97b0a95536
3 changed files with 57 additions and 2 deletions

View File

@ -272,6 +272,42 @@ bool SMESH_subMesh::IsMeshComputed() const
return false;
}
//================================================================================
/*!
* \brief Check if any upper level sub-shape is not computed.
* Used to update a sub-mesh icon
*/
//================================================================================
bool SMESH_subMesh::IsComputedPartially() const
{
SMESH_subMeshIteratorPtr smIt = getDependsOnIterator(/*includeSelf=*/true,
/*SolidFirst=*/true);
bool allComputed = true;
TopAbs_ShapeEnum readyType = TopAbs_VERTEX; // max value
while ( smIt->more() && allComputed )
{
SMESH_subMesh* sm = smIt->next();
if ( sm->GetSubShape().ShapeType() > readyType )
break; // lower dimension -> stop
if ( sm->GetComputeState() != SMESH_subMesh::NOT_READY )
readyType = sm->GetSubShape().ShapeType();
switch ( sm->GetComputeState() )
{
case SMESH_subMesh::READY_TO_COMPUTE:
case SMESH_subMesh::FAILED_TO_COMPUTE:
allComputed = false;// sm->IsMeshComputed();
break;
case SMESH_subMesh::NOT_READY:
case SMESH_subMesh::COMPUTE_OK:
continue;
}
}
return !allComputed;
}
//=============================================================================
/*!
* Return true if all sub-meshes have been meshed

View File

@ -257,6 +257,9 @@ public:
bool IsMeshComputed() const;
// check if _subMeshDS contains mesh elements unless _alwaysComputed==true
bool IsComputedPartially() const;
// check if any upper level sub-shape is not computed
/*!
* \brief Set sub-shapes that are allowed to compute at once by a multidimensional algo
*/

View File

@ -1009,8 +1009,23 @@ void SMESH_Gen_i::UpdateIcons( SMESH::SMESH_Mesh_ptr theMesh )
{
SMESH::array_of_ElementType_var elemTypes = idSrc->GetTypes();
isEmpty = ( elemTypes->length() == 0 );
if ( !isEmpty )
{
// check if all sub-shapes of sub-mesh on group are computed
// (pb: "Compute sub-mesh" menu is missing if a sub-mesh is partially computed)
SMESH::SMESH_subMesh_var subMesh = SMESH::SMESH_subMesh::_narrow( obj );
if ( !subMesh->_is_nil() )
if ( SMESH_subMesh* sm = mesh_i->GetImpl().GetSubMeshContaining( subMesh->GetId() ))
if ( sm->IsComputedPartially() )
{
SetPixMap( so, "ICON_SMESH_TREE_MESH_PARTIAL" );
continue;
}
}
}
}
if ( isEmpty )
SetPixMap( so, "ICON_SMESH_TREE_MESH_WARN");
else if ( !isGroup )
@ -1019,8 +1034,9 @@ void SMESH_Gen_i::UpdateIcons( SMESH::SMESH_Mesh_ptr theMesh )
SetPixMap( so, "ICON_SMESH_TREE_GROUP_ON_FILTER" );
else
SetPixMap( so, "ICON_SMESH_TREE_GROUP" );
}
}
} // loop on sub-meshes or groups
} // loop on roots
}
//=======================================================================