Geant4  10.03.p03
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
exMPI03.cc File Reference
#include "G4MPImanager.hh"
#include "G4MPIsession.hh"
#include "G4RunManager.hh"
#include "G4UImanager.hh"
#include "ActionInitialization.hh"
#include "DetectorConstruction.hh"
#include "FTFP_BERT.hh"
#include "G4ScoringManager.hh"
Include dependency graph for exMPI03.cc:

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 A MPI example code. More...
 

Function Documentation

int main ( int  argc,
char **  argv 
)

A MPI example code.

Definition at line 49 of file exMPI03.cc.

50 {
51  // --------------------------------------------------------------------
52  // MPI session
53  // --------------------------------------------------------------------
54  // At first, G4MPImanager/G4MPIsession should be created.
55  G4MPImanager* g4MPI = new G4MPImanager(argc, argv);
56 
57  // MPI session (G4MPIsession) instead of G4UIterminal
58  // Terminal availability depends on your MPI implementation.
59  G4MPIsession* session = g4MPI-> GetMPIsession();
60 
61  // LAM/MPI users can use G4tcsh.
62  G4String prompt = "";
63  prompt += "G4MPI";
64  prompt += "(%s)[%/]:";
65  session-> SetPrompt(prompt);
66 
67  // --------------------------------------------------------------------
68  // user application setting
69  // --------------------------------------------------------------------
70 #ifdef G4MULTITHREADED
71  G4MTRunManager* runManager = new G4MTRunManager();
72  runManager-> SetNumberOfThreads(4);
73 #else
74  G4RunManager* runManager = new G4RunManager();
75 #endif
77  scManager->SetVerboseLevel(1);
78  // setup your application
79  runManager-> SetUserInitialization(new DetectorConstruction);
80  runManager-> SetUserInitialization(new FTFP_BERT);
81  runManager-> SetUserInitialization(new ActionInitialization);
82 
83  runManager-> Initialize();
84 
85 #ifdef G4VIS_USE
86  G4VisExecutive* visManager = new G4VisExecutive;
87  visManager-> Initialize();
88  G4cout << G4endl;
89 #endif
90 
91  // --------------------------------------------------------------------
92  // ready for go
93  // MPIsession treats both interactive and batch modes.
94  // Just start your session as below.
95  // --------------------------------------------------------------------
96  session-> SessionStart();
97 
98  // --------------------------------------------------------------------
99  // termination
100  // --------------------------------------------------------------------
101 #ifdef G4VIS_USE
102  delete visManager;
103 #endif
104 
105  delete g4MPI;
106 
107  delete runManager;
108 
109  return EXIT_SUCCESS;
110 }
void Initialize()
Definition: errprop.cc:101
G4GLOB_DLL std::ostream G4cout
static G4UIterminal * session
Detector construction class to define materials and geometry.
#define G4endl
Definition: G4ios.hh:61
static G4ScoringManager * GetScoringManager()
void SetVerboseLevel(G4int vl)

Here is the call graph for this function: