From e0f019ccf9e53e6751aa85445acf2cf2831a8c24 Mon Sep 17 00:00:00 2001 From: eap Date: Mon, 8 Jul 2013 11:27:16 +0000 Subject: [PATCH] Compute Progress bar: ignore sub-meshes that are NOT_READY to compute --- src/SMESH/SMESH_Mesh.cxx | 21 ++++++++++++++------- src/SMESH/SMESH_subMesh.cxx | 6 ++++-- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/src/SMESH/SMESH_Mesh.cxx b/src/SMESH/SMESH_Mesh.cxx index 3c3dca37f..d63079217 100644 --- a/src/SMESH/SMESH_Mesh.cxx +++ b/src/SMESH/SMESH_Mesh.cxx @@ -1476,13 +1476,16 @@ double SMESH_Mesh::GetComputeProgress() const while ( smIt->more() ) { SMESH_subMesh* sm = smIt->next(); - const int smCost = sm->GetComputeCost(); - totalCost += smCost; - if ( sm != curSM && - ( !sm->IsEmpty() || - sm->GetComputeState() == SMESH_subMesh::FAILED_TO_COMPUTE )) + if ( sm->GetComputeState() != SMESH_subMesh::NOT_READY ) { - computedCost += smCost; + const int smCost = sm->GetComputeCost(); + totalCost += smCost; + if ( sm != curSM && + ( !sm->IsEmpty() || + sm->GetComputeState() == SMESH_subMesh::FAILED_TO_COMPUTE )) + { + computedCost += smCost; + } } } } @@ -1496,10 +1499,14 @@ double SMESH_Mesh::GetComputeProgress() const //cout << " rate: " << rate << " cost " << algo->GetComputeCost() << endl; computedCost += rate * algo->GetComputeCost(); } - else + else if ( curSM->IsEmpty() ) { computedCost += algo->GetProgressByTic() * algo->GetComputeCost(); } + else + { + computedCost += 0.99 * algo->GetComputeCost(); + } } //cout << "Total: " << totalCost << " progress: " << computedCost / totalCost << endl; return computedCost / totalCost; diff --git a/src/SMESH/SMESH_subMesh.cxx b/src/SMESH/SMESH_subMesh.cxx index a78efcdfc..7b7fc75b9 100644 --- a/src/SMESH/SMESH_subMesh.cxx +++ b/src/SMESH/SMESH_subMesh.cxx @@ -2089,7 +2089,8 @@ TopoDS_Shape SMESH_subMesh::getCollection(SMESH_Gen * theGen, { const TopoDS_Shape& S = anExplorer.Current(); SMESH_subMesh* subMesh = _father->GetSubMesh( S ); - theComputeCost += subMesh->GetComputeCost(); + if ( subMesh->GetComputeState() != NOT_READY ) + theComputeCost += subMesh->GetComputeCost(); if ( subMesh == this ) { aBuilder.Add( aCompound, S ); @@ -2109,7 +2110,8 @@ TopoDS_Shape SMESH_subMesh::getCollection(SMESH_Gen * theGen, while ( smIt->more() ) { SMESH_subMesh* sm = smIt->next(); - if ( sm->IsEmpty() ) + if ( sm->GetComputeState() != NOT_READY && + sm->IsEmpty() ) theComputeCost += sm->GetComputeCost(); } } -- 2.30.2