Skip to content
Snippets Groups Projects
Commit 95c3fdd7 authored by Benjamin Faigle's avatar Benjamin Faigle
Browse files

The timer for the cpu time (wall time) in run() method is now acessible from...

The timer for the cpu time (wall time) in run() method is now acessible from outside (i.e. from problem) via an access function wallTime()

git-svn-id: svn://svn.iws.uni-stuttgart.de/DUMUX/dumux/trunk@6943 2fb0f335-1f38-0410-981e-8018bf24f1b0
parent 1fa565b2
No related branches found
No related tags found
No related merge requests found
...@@ -175,6 +175,12 @@ public: ...@@ -175,6 +175,12 @@ public:
void setEndTime(Scalar t) void setEndTime(Scalar t)
{ endTime_ = t; } { endTime_ = t; }
/*!
* \brief Returns the current wall time (cpu time).
*/
double wallTime() const
{ return timer_.elapsed(); }
/*! /*!
* \brief Set the current time step size to a given value. * \brief Set the current time step size to a given value.
* *
...@@ -352,8 +358,7 @@ public: ...@@ -352,8 +358,7 @@ public:
*/ */
void run() void run()
{ {
Dune::Timer timer; timer_.reset();
timer.reset();
// do the time steps // do the time steps
while (!finished()) while (!finished())
...@@ -382,7 +387,7 @@ public: ...@@ -382,7 +387,7 @@ public:
if (verbose_) { if (verbose_) {
std::cout << std::cout <<
boost::format("Time step %d done. Wall time:%.4g, time:%.4g, time step size:%.4g\n") boost::format("Time step %d done. Wall time:%.4g, time:%.4g, time step size:%.4g\n")
%timeStepIndex()%timer.elapsed()%time()%dt; %timeStepIndex()%timer_.elapsed()%time()%dt;
} }
// write restart file if mandated by the problem // write restart file if mandated by the problem
...@@ -406,9 +411,9 @@ public: ...@@ -406,9 +411,9 @@ public:
if (verbose_) { if (verbose_) {
int numProcesses = Dune::MPIHelper::getCollectiveCommunication().size(); int numProcesses = Dune::MPIHelper::getCollectiveCommunication().size();
std::cout << "Simulation took " << timer.elapsed() <<" seconds on " std::cout << "Simulation took " << timer_.elapsed() <<" seconds on "
<< numProcesses << " processes.\n" << numProcesses << " processes.\n"
<< "The cumulative CPU time was " << timer.elapsed()*numProcesses << " seconds.\n" << "The cumulative CPU time was " << timer_.elapsed()*numProcesses << " seconds.\n"
<< "We hope that you enjoyed simulating with us\n" << "We hope that you enjoyed simulating with us\n"
<< "and that you will choose us next time, too.\n"; << "and that you will choose us next time, too.\n";
} }
...@@ -467,6 +472,7 @@ private: ...@@ -467,6 +472,7 @@ private:
Scalar episodeLength_; Scalar episodeLength_;
std::string episodeDescription_; std::string episodeDescription_;
Dune::Timer timer_;
Scalar time_; Scalar time_;
Scalar endTime_; Scalar endTime_;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment