]> SALOME platform Git repositories - modules/yacs.git/blobdiff - src/engine/Proc.cxx
Salome HOME
new method returning calculation progress
[modules/yacs.git] / src / engine / Proc.cxx
index 5f83fe162dc967e630e282360b65bc76ef8bdfff..4cb7429557d682721059287de61881aa0e0fe619 100644 (file)
@@ -230,6 +230,22 @@ std::string Proc::getNodeProgress(int numId)
   return progress;
 }
 
+int Proc::getGlobalProgressPercent()
+{
+       list<pair <int,int> > weightList = getProgressWeight();
+       int weightDone = 0;
+       int weightTotal = 0;
+       int progressPercent = 0;
+       for(list<pair <int,int> >::const_iterator iter=weightList.begin();iter!=weightList.end();iter++)
+         {
+                 weightDone += (*iter).first;
+                       weightTotal += (*iter).second;
+         }
+  if (weightTotal > 0)
+       progressPercent = int(float(weightDone) / float(weightTotal) * 100);
+  return progressPercent;
+}
+
 std::string Proc::getXMLState(int numId)
 {
   if(YACS::ENGINE::Node::idMap.count(numId) == 0)