source: trunk/examples/extended/parallel/MPI/mpi_interface/include/G4MPIstatus.hh @ 1337

Last change on this file since 1337 was 1337, checked in by garnier, 14 years ago

tag geant4.9.4 beta 1 + modifs locales

File size: 3.8 KB
Line 
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// ********************************************************************
25//
26// $Id: G4MPIstatus.hh,v 1.1 2007/11/16 14:05:41 kmura Exp $
27// $Name: geant4-09-04-beta-01 $
28//
29// ====================================================================
30//   G4MPIstatus.hh
31//
32//                                         2007 Q
33// ====================================================================
34#ifndef G4MPI_STATUS_H
35#define G4MPI_STATUS_H
36
37#include "globals.hh"
38#include "G4ApplicationState.hh"
39#include "G4Timer.hh"
40
41// ====================================================================
42//
43// class definition
44//
45// ====================================================================
46class G4Timer;
47
48class G4MPIstatus {
49private:
50  G4int rank;
51  G4int runID;
52  G4int nEventToBeProcessed;
53  G4int eventID;
54  G4double cputime;
55  G4ApplicationState g4state;
56  G4Timer* timer;
57
58  G4String GetStateString(G4ApplicationState astate) const;
59
60public:
61  enum { NSIZE=10 };
62
63  G4MPIstatus();
64  ~G4MPIstatus();
65
66  // set/get functions
67  void SetStatus(G4int arank, G4int runid, G4int noe, G4int evtid,
68                 G4ApplicationState state);
69
70  G4int GetRank() const;
71  G4int GetRunID() const;
72  G4int GetNEventToBeProcessed() const;
73  G4int GetEventID() const;
74  G4double GetCPUTime() const;
75  G4ApplicationState GetG4State() const;
76
77  // for pickling
78  G4int SizeOf() const;
79  void Pack(G4int* data) const;
80  void UnPack(G4int* data);
81
82  // for timer
83  void StartTimer();
84  void StopTimer();
85
86  void Print() const;
87
88};
89
90// ====================================================================
91//   inline functions
92// ====================================================================
93inline G4int G4MPIstatus::SizeOf() const
94{
95  return NSIZE;
96}
97
98inline G4int G4MPIstatus::GetRank() const
99{
100  return rank;
101}
102
103inline G4int G4MPIstatus::GetRunID() const
104{
105  return runID;
106}
107
108inline G4int G4MPIstatus::GetNEventToBeProcessed() const
109{
110  return nEventToBeProcessed;
111}
112
113inline G4int G4MPIstatus::GetEventID() const
114{
115  return eventID;
116}
117
118inline G4double G4MPIstatus::GetCPUTime() const
119{
120  return cputime;
121}
122
123inline G4ApplicationState G4MPIstatus::GetG4State() const
124{
125  return g4state;
126}
127
128inline void G4MPIstatus::StartTimer()
129{
130  timer-> Start();
131}
132
133inline void G4MPIstatus::StopTimer()
134{
135  timer-> Stop();
136}
137
138#endif
Note: See TracBrowser for help on using the repository browser.