Scippy

UG

Ubiquity Generator framework

paraTimer.h
Go to the documentation of this file.
1 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2 /* */
3 /* This file is part of the program and software framework */
4 /* UG --- Ubquity Generator Framework */
5 /* */
6 /* Copyright Written by Yuji Shinano <shinano@zib.de>, */
7 /* Copyright (C) 2021 by Zuse Institute Berlin, */
8 /* licensed under LGPL version 3 or later. */
9 /* Commercial licenses are available through <licenses@zib.de> */
10 /* */
11 /* This code is free software; you can redistribute it and/or */
12 /* modify it under the terms of the GNU Lesser General Public License */
13 /* as published by the Free Software Foundation; either version 3 */
14 /* of the License, or (at your option) any later version. */
15 /* */
16 /* This program is distributed in the hope that it will be useful, */
17 /* but WITHOUT ANY WARRANTY; without even the implied warranty of */
18 /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
19 /* GNU Lesser General Public License for more details. */
20 /* */
21 /* You should have received a copy of the GNU Lesser General Public License */
22 /* along with this program. If not, see <http://www.gnu.org/licenses/>. */
23 /* */
24 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
25 
26 /**@file paraTimer.h
27  * @brief Base class for Timer.
28  * @author Yuji Shinano
29  *
30  *
31  *
32  */
33 
34 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
35 
36 
37 #ifndef __PARA_TIMER_H__
38 #define __PARA_TIMER_H__
39 
40 namespace UG
41 {
42 
43 class ParaComm;
44 
45 ///
46 /// class ParaTimer
47 ///
48 class ParaTimer
49 {
50 
51 protected:
52 
53  double offset; ///< offset of start time
54 
55 public:
56 
57  ///
58  /// constructor
59  ///
61  )
62  : offset(0.0)
63  {
64  }
65 
66  ///
67  /// destructor
68  ///
69  virtual ~ParaTimer(
70  )
71  {
72  }
73 
74  void setOffset(
75  double time
76  )
77  {
78  offset = time;
79  }
80 
81  ///------------------------------------------
82  /// if you want to set original initial time,
83  /// you can do it init()
84  ///------------------------------------------
85 
86  ///
87  /// initialize timer
88  ///
89  virtual void init(
90  ParaComm* paraComm ///< communicator used
91  ) = 0;
92 
93  ///
94  /// get elapsed time
95  /// @return elapsed time
96  ///
97  virtual double getElapsedTime(
98  ) = 0;
99 
100 };
101 
102 }
103 
104 #endif // __PARA_TIMER_H__
ParaTimer()
constructor
Definition: paraTimer.h:60
virtual double getElapsedTime()=0
get elapsed time
void setOffset(double time)
Definition: paraTimer.h:74
double offset
offset of start time
Definition: paraTimer.h:53
virtual ~ParaTimer()
destructor
Definition: paraTimer.h:69
virtual void init(ParaComm *paraComm)=0
if you want to set original initial time, you can do it init()
class ParaTimer
Definition: paraTimer.h:48
Base class of communicator object.
Definition: paraComm.h:101