Geant4  9.6.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4MPIstatus.hh
Go to the documentation of this file.
1 //
2 // ********************************************************************
3 // * License and Disclaimer *
4 // * *
5 // * The Geant4 software is copyright of the Copyright Holders of *
6 // * the Geant4 Collaboration. It is provided under the terms and *
7 // * conditions of the Geant4 Software License, included in the file *
8 // * LICENSE and available at http://cern.ch/geant4/license . These *
9 // * include a list of copyright holders. *
10 // * *
11 // * Neither the authors of this software system, nor their employing *
12 // * institutes,nor the agencies providing financial support for this *
13 // * work make any representation or warranty, express or implied, *
14 // * regarding this software system or assume any liability for its *
15 // * use. Please see the license in the file LICENSE and URL above *
16 // * for the full disclaimer and the limitation of liability. *
17 // * *
18 // * This code implementation is the result of the scientific and *
19 // * technical work of the GEANT4 collaboration. *
20 // * By using, copying, modifying or distributing the software (or *
21 // * any work based on the software) you agree to acknowledge its *
22 // * use in resulting scientific publications, and indicate your *
23 // * acceptance of all terms of the Geant4 Software license. *
24 // ********************************************************************
27 
28 #ifndef G4MPI_STATUS_H
29 #define G4MPI_STATUS_H
30 
31 #include "globals.hh"
32 #include "G4ApplicationState.hh"
33 #include "G4Timer.hh"
34 
35 class G4Timer;
36 
37 class G4MPIstatus {
38 public:
39  enum { NSIZE = 10 };
40 
41  G4MPIstatus();
42  ~G4MPIstatus();
43 
44  // set/get functions
45  void SetStatus(G4int arank, G4int runid, G4int noe, G4int evtid,
46  G4ApplicationState state);
47 
48  G4int GetRank() const;
49  G4int GetRunID() const;
51  G4int GetEventID() const;
52  G4double GetCPUTime() const;
54 
55  // for pickling
56  G4int SizeOf() const;
57  void Pack(G4int* data) const;
58  void UnPack(G4int* data);
59 
60  // for timer
61  void StartTimer();
62  void StopTimer();
63 
64  void Print() const;
65 
66 private:
67  G4int rank;
68  G4int runID;
69  G4int nEventToBeProcessed;
70  G4int eventID;
71  G4double cputime;
72  G4ApplicationState g4state;
73  G4Timer* timer;
74 
75  G4String GetStateString(G4ApplicationState astate) const;
76 };
77 
78 // ====================================================================
79 inline G4int G4MPIstatus::SizeOf() const
80 {
81  return NSIZE;
82 }
83 
85 {
86  return rank;
87 }
88 
90 {
91  return runID;
92 }
93 
95 {
96  return nEventToBeProcessed;
97 }
98 
100 {
101  return eventID;
102 }
103 
105 {
106  return cputime;
107 }
108 
110 {
111  return g4state;
112 }
113 
115 {
116  timer-> Start();
117 }
118 
120 {
121  timer-> Stop();
122 }
123 
124 #endif