- int iter = atoi( desc + 20 );
- double percent = 25. + iter * ( 70 - 25 ) / 20.;
- data->_progress = std::max( data->_progress, ( percent / 100. ));
+ // Compute progress
+ // corresponding messages are:
+ // " -- PHASE 1 COMPLETED" => 10 %
+ // " -- PHASE 2 COMPLETED" => 25 %
+ // " ** ITERATION 1" => 25.* %
+ // " ** ITERATION 2" => 25.* %
+ // " -- PHASE 3 COMPLETED" => 70 %
+ // " -- PHASE 4 COMPLETED" => 98 %
+
+ if ( strncmp( "-- PHASE ", desc + 2, 9 ) == 0 && desc[ 13 ] == 'C' )
+ {
+ const double progress[] = { 10., 25., 70., 98., 100., 100., 100. };
+ int phase = atoi( desc + 11 );
+ data->_progress = std::max( data->_progress, progress[ phase - 1 ] / 100. );
+ }
+ else if ( strncmp( "** ITERATION ", desc + 5, 13 ) == 0 )
+ {
+ int iter = atoi( desc + 20 );
+ double percent = 25. + iter * ( 70 - 25 ) / 20.;
+ data->_progress = std::max( data->_progress, ( percent / 100. ));
+ }