• Main Page
  • Related Pages
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

MLAPI_TimeObject.h

Go to the documentation of this file.
00001 /* ******************************************************************** */
00002 /* See the file COPYRIGHT for a complete copyright notice, contact      */
00003 /* person and disclaimer.                                               */        
00004 /* ******************************************************************** */
00005 #ifndef MLAPI_TIMEOBJECT_H
00006 #define MLAPI_TIMEOBJECT_H
00007 
00008 #include "MLAPI_Error.h"
00009 #include "MLAPI_Workspace.h"
00010 #include "Epetra_Time.h"
00011 
00012 namespace MLAPI {
00013 
00025 class TimeObject {
00026 
00027 public:
00028 
00030   TimeObject() :
00031     Time_(GetEpetra_Comm())
00032   {
00033     Time_.ResetStartTime();
00034     TotalTime_ = 0.0;
00035   }
00036 
00038   ~TimeObject() {};
00039 
00041   inline void ResetTimer() const
00042   {
00043     Time_.ResetStartTime();
00044   }
00045 
00047   inline void UpdateTime() const
00048   {
00049     TotalTime_ += Time_.ElapsedTime();
00050   }
00051 
00053   inline void UpdateTime(double t) const
00054   {
00055     TotalTime_ += t;
00056   }
00057 
00059   inline double GetTime() const
00060   {
00061     return(TotalTime_);
00062   }
00063 
00064 protected:
00065 
00067   mutable Epetra_Time Time_;
00069   mutable double TotalTime_;
00070 
00071 }; // class TimeObject
00072 
00073 } // namespace MLPI
00074 
00075 #endif // MLAPI_TIMEOBJECT_H