Geant4  10.01.p02
G4MPIScorerMerger.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 // ********************************************************************
25 //
26 #ifndef G4MPISCORERMERGER_HH
27 #define G4MPISCORERMERGER_HH
28 #include "G4ScoringManager.hh"
29 #include <vector>
30 #include <mpi.h>
31 #include "G4MPImanager.hh"
32 
34 public:
36  G4int destination = G4MPImanager::kRANK_MASTER,
37  G4int verbosity = 0 );
38  virtual ~G4MPIScorerMerger() { clear(); }
43  G4int GetCommSize() const { return commSize; }
44  virtual void Merge();
45  void SetVerbosity( G4int ver ) { verbose = ver; }
46  G4int GetVerbosity() const { return verbose; }
47 
48 protected:
49  //Internal MPI-friendly format
50  //for a single MeshScoreMap
51  struct convMap_t {
56  };
57  virtual convMap_t* convertMap( const G4String& mapName ,
58  G4THitsMap<double>* map ) const;
59  virtual void convertMesh( const G4VScoringMesh* mesh );
60  void clear();
61  std::vector<convMap_t*> convertedMesh;
63 
67  MPI::Intracomm COMM_G4COMMAND_;
69 
70  virtual void SendOneMesh();
71  virtual void ReceiveOneMesh();
72  virtual void MergeOneMesh();
73  friend std::ostream& operator<<(std::ostream& os , const convMap_t& cnv );
74 };
75 
76 #endif //G4MPISCORERMERGER_HH
77 
std::vector< convMap_t * > convertedMesh
G4ScoringManager * GetScoringManager() const
G4int GetDestinationRank() const
void SetVerbosity(G4int ver)
void SetDestinationRank(G4int i)
G4int GetCommSize() const
void SetScoringManager(G4ScoringManager *mgr)
int G4int
Definition: G4Types.hh:78
MPI manager class.
virtual convMap_t * convertMap(const G4String &mapName, G4THitsMap< double > *map) const
virtual void SendOneMesh()
virtual void ReceiveOneMesh()
G4MPIScorerMerger(G4ScoringManager *mgr, G4int destination=G4MPImanager::kRANK_MASTER, G4int verbosity=0)
G4int GetVerbosity() const
virtual void MergeOneMesh()
virtual void Merge()
MPI::Intracomm COMM_G4COMMAND_
virtual void convertMesh(const G4VScoringMesh *mesh)
friend std::ostream & operator<<(std::ostream &os, const convMap_t &cnv)
double G4double
Definition: G4Types.hh:76
virtual ~G4MPIScorerMerger()
G4ScoringManager * scoringManager