Chaste Commit::f2ff7ee04e70ac9d06c57344df8d017dbb12b97b
ProgressReporter Class Reference

#include <ProgressReporter.hpp>

+ Collaboration diagram for ProgressReporter:

Public Member Functions

 ProgressReporter (std::string outputDirectory, double startTime, double endTime)
 
 ~ProgressReporter ()
 
void Update (double currentTime)
 
void PrintFinalising ()
 
void PrintInitialising ()
 

Private Attributes

double mStartTime
 
double mEndTime
 
out_stream mpFile
 
unsigned mLastPercentage
 

Detailed Description

This class creates the file 'progress_status.txt' in the specified directory and writes "n% completed" etc in the file when n% of a simulation has been done, for integer n.

You can watch the progress of your simulation by doing one of a) watch tail <outputDirectory>/progress_status.txt b) tail -f <outputDirectory>/progress_status.txt

Definition at line 49 of file ProgressReporter.hpp.

Constructor & Destructor Documentation

◆ ProgressReporter()

ProgressReporter::ProgressReporter ( std::string  outputDirectory,
double  startTime,
double  endTime 
)

Constuctor saves times and opens output file ('progress_status.txt').

Parameters
outputDirectorywhere to open the output file
startTimethe start time
endTimethe end time

Definition at line 42 of file ProgressReporter.cpp.

References PetscTools::AmMaster(), mpFile, and OutputFileHandler::OpenOutputFile().

◆ ~ProgressReporter()

ProgressReporter::~ProgressReporter ( )

Destructor.

Definition at line 59 of file ProgressReporter.cpp.

References PetscTools::AmMaster(), mLastPercentage, and mpFile.

Member Function Documentation

◆ PrintFinalising()

void ProgressReporter::PrintFinalising ( )

Print finalising message to file.

Definition at line 85 of file ProgressReporter.cpp.

References PetscTools::AmMaster(), and mpFile.

◆ PrintInitialising()

void ProgressReporter::PrintInitialising ( )

Print initialising message to file.

Definition at line 93 of file ProgressReporter.cpp.

References PetscTools::AmMaster(), and mpFile.

◆ Update()

void ProgressReporter::Update ( double  currentTime)

Calculates the percentage completed using the time given and the start and end time and prints to file if another percent has been done.

Parameters
currentTimethe given time

Definition at line 72 of file ProgressReporter.cpp.

References PetscTools::AmMaster(), mEndTime, mLastPercentage, mpFile, and mStartTime.

Member Data Documentation

◆ mEndTime

double ProgressReporter::mEndTime
private

End time of the simulation

Definition at line 54 of file ProgressReporter.hpp.

Referenced by Update().

◆ mLastPercentage

unsigned ProgressReporter::mLastPercentage
private

Last percentage that was written

Definition at line 56 of file ProgressReporter.hpp.

Referenced by ~ProgressReporter(), and Update().

◆ mpFile

out_stream ProgressReporter::mpFile
private

Progress status file

Definition at line 55 of file ProgressReporter.hpp.

Referenced by ProgressReporter(), ~ProgressReporter(), PrintFinalising(), PrintInitialising(), and Update().

◆ mStartTime

double ProgressReporter::mStartTime
private

Start time of the simulation

Definition at line 53 of file ProgressReporter.hpp.

Referenced by Update().


The documentation for this class was generated from the following files: