Loading src/TNL/Solvers/IterativeSolverMonitor.h +6 −2 Original line number Diff line number Diff line Loading @@ -36,6 +36,8 @@ public: void setVerbose( const Index& verbose ); void setNodesPerIteration( const IndexType& nodes ); virtual void refresh(); protected: Loading @@ -45,11 +47,13 @@ protected: std::atomic_bool saved; RealType time, saved_time, timeStep, saved_timeStep, residue, saved_residue; RealType time, saved_time, timeStep, saved_timeStep, residue, saved_residue, elapsed_time_before_refresh; IndexType iterations, saved_iterations; IndexType iterations, saved_iterations, iterations_before_refresh; IndexType verbose; IndexType nodesPerIteration; }; } // namespace Solvers Loading src/TNL/Solvers/IterativeSolverMonitor_impl.h +19 −2 Original line number Diff line number Diff line Loading @@ -37,9 +37,12 @@ IterativeSolverMonitor< Real, Index > :: IterativeSolverMonitor() saved_timeStep( 0.0 ), residue( 0.0 ), saved_residue( 0.0 ), elapsed_time_before_refresh( 0.0 ), iterations( 0 ), saved_iterations( 0 ), verbose( 1 ) iterations_before_refresh( 0 ), verbose( 1 ), nodesPerIteration( 0 ) { } Loading Loading @@ -93,6 +96,12 @@ void IterativeSolverMonitor< Real, Index > :: setVerbose( const Index& verbose ) this->verbose = verbose; } template< typename Real, typename Index> void IterativeSolverMonitor< Real, Index > :: setNodesPerIteration( const IndexType& nodes ) { this->nodesPerIteration = nodes; } template< typename Real, typename Index> void IterativeSolverMonitor< Real, Index > :: refresh() { Loading Loading @@ -133,7 +142,7 @@ void IterativeSolverMonitor< Real, Index > :: refresh() if( (saved) ? saved_timeStep : timeStep > 0 ) { // print_item( " TAU:" ); print_item( " TAU:", 0 ); print_item( real_to_string( (saved) ? saved_timeStep : timeStep, 5 ), 8 ); print_item( real_to_string( (saved) ? saved_timeStep : timeStep, 5 ), 10 ); } const std::string displayed_stage = (saved) ? saved_stage : stage; Loading @@ -159,6 +168,14 @@ void IterativeSolverMonitor< Real, Index > :: refresh() print_item( real_to_string( (saved) ? saved_residue : residue, 5 ), 12 ); } if( nodesPerIteration ) { const RealType mlups = nodesPerIteration * (iterations - iterations_before_refresh) / (getElapsedTime() - elapsed_time_before_refresh) * 1e-6; print_item( " MLUPS:", 0 ); print_item( real_to_string( mlups, 5 ), 7 ); } iterations_before_refresh = iterations; elapsed_time_before_refresh = getElapsedTime(); // return to the beginning of the line std::cout << "\r" << std::flush; } Loading Loading
src/TNL/Solvers/IterativeSolverMonitor.h +6 −2 Original line number Diff line number Diff line Loading @@ -36,6 +36,8 @@ public: void setVerbose( const Index& verbose ); void setNodesPerIteration( const IndexType& nodes ); virtual void refresh(); protected: Loading @@ -45,11 +47,13 @@ protected: std::atomic_bool saved; RealType time, saved_time, timeStep, saved_timeStep, residue, saved_residue; RealType time, saved_time, timeStep, saved_timeStep, residue, saved_residue, elapsed_time_before_refresh; IndexType iterations, saved_iterations; IndexType iterations, saved_iterations, iterations_before_refresh; IndexType verbose; IndexType nodesPerIteration; }; } // namespace Solvers Loading
src/TNL/Solvers/IterativeSolverMonitor_impl.h +19 −2 Original line number Diff line number Diff line Loading @@ -37,9 +37,12 @@ IterativeSolverMonitor< Real, Index > :: IterativeSolverMonitor() saved_timeStep( 0.0 ), residue( 0.0 ), saved_residue( 0.0 ), elapsed_time_before_refresh( 0.0 ), iterations( 0 ), saved_iterations( 0 ), verbose( 1 ) iterations_before_refresh( 0 ), verbose( 1 ), nodesPerIteration( 0 ) { } Loading Loading @@ -93,6 +96,12 @@ void IterativeSolverMonitor< Real, Index > :: setVerbose( const Index& verbose ) this->verbose = verbose; } template< typename Real, typename Index> void IterativeSolverMonitor< Real, Index > :: setNodesPerIteration( const IndexType& nodes ) { this->nodesPerIteration = nodes; } template< typename Real, typename Index> void IterativeSolverMonitor< Real, Index > :: refresh() { Loading Loading @@ -133,7 +142,7 @@ void IterativeSolverMonitor< Real, Index > :: refresh() if( (saved) ? saved_timeStep : timeStep > 0 ) { // print_item( " TAU:" ); print_item( " TAU:", 0 ); print_item( real_to_string( (saved) ? saved_timeStep : timeStep, 5 ), 8 ); print_item( real_to_string( (saved) ? saved_timeStep : timeStep, 5 ), 10 ); } const std::string displayed_stage = (saved) ? saved_stage : stage; Loading @@ -159,6 +168,14 @@ void IterativeSolverMonitor< Real, Index > :: refresh() print_item( real_to_string( (saved) ? saved_residue : residue, 5 ), 12 ); } if( nodesPerIteration ) { const RealType mlups = nodesPerIteration * (iterations - iterations_before_refresh) / (getElapsedTime() - elapsed_time_before_refresh) * 1e-6; print_item( " MLUPS:", 0 ); print_item( real_to_string( mlups, 5 ), 7 ); } iterations_before_refresh = iterations; elapsed_time_before_refresh = getElapsedTime(); // return to the beginning of the line std::cout << "\r" << std::flush; } Loading