source: trunk/examples/extended/parallel/MPI/exMPI02/exMPI02.cc

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

tag geant4.9.4 beta 1 + modifs locales

File size: 4.0 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: exMPI02.cc,v 1.2 2010/05/18 06:08:30 kmura Exp $
27// $Name: geant4-09-04-beta-01 $
28//
29// ====================================================================
30//   exMPI02.cc
31//
32//                                         2007 Q
33// ====================================================================
34#include "G4RunManager.hh"
35#include "G4UImanager.hh"
36
37// my application
38#include "DetectorConstruction.hh"
39#include "MedicalBeam.hh"
40#include "QGSP_BIC.hh"
41#include "RunAction.hh"
42#include "EventAction.hh"
43
44// MPI session
45#include "G4MPImanager.hh"
46#include "G4MPIsession.hh"
47
48#ifdef G4VIS_USE
49#include "G4VisExecutive.hh"
50#endif
51
52int main(int argc,char** argv)
53{
54  // random engine
55  //CLHEP::Ranlux64Engine randomEngine;
56  //CLHEP::HepRandom::setTheEngine(&randomEngine);
57
58  // --------------------------------------------------------------------
59  // MPI session
60  // --------------------------------------------------------------------
61  // At first, G4MPImanager/G4MPIsession should be created.
62  G4MPImanager* g4MPI= new G4MPImanager(argc,argv);
63
64  // MPI session (G4MPIsession) instead of G4UIterminal
65  // Terminal availability depends on your MPI implementation.
66  G4MPIsession* session= g4MPI-> GetMPIsession();
67
68  // LAM/MPI users can use G4tcsh.
69  G4String prompt= "[40;01;33m";
70  prompt+= "G4MPI";
71  prompt+= "[40;31m(%s)[40;36m[%/][00;30m:";
72  session-> SetPrompt(prompt);
73
74  // --------------------------------------------------------------------
75  // user application setting
76  // --------------------------------------------------------------------
77  G4RunManager* runManager= new G4RunManager();
78
79  // setup your application
80  runManager-> SetUserInitialization(new DetectorConstruction);
81  runManager-> SetUserInitialization(new QGSP_BIC);
82  runManager-> SetUserAction(new MedicalBeam);
83  runManager-> SetUserAction(new RunAction);
84  runManager-> SetUserAction(new EventAction);
85
86  runManager-> Initialize();
87
88#ifdef G4VIS_USE
89  G4VisExecutive* visManager= new G4VisExecutive;
90  visManager-> Initialize();
91  G4cout << G4endl;
92#endif
93
94  // --------------------------------------------------------------------
95  // ready for go
96  // MPIsession treats both interactive and batch modes.
97  // Just start your session as below.
98  // --------------------------------------------------------------------
99  session-> SessionStart();
100
101
102  // termination
103#ifdef G4VIS_USE
104  delete visManager;
105#endif
106
107  delete g4MPI;
108
109  delete runManager;
110
111  return 0;
112}
Note: See TracBrowser for help on using the repository browser.