![]() |
|
|||
File indexing completed on 2025-10-13 08:28:26
0001 // 0002 // ******************************************************************** 0003 // * License and Disclaimer * 0004 // * * 0005 // * The Geant4 software is copyright of the Copyright Holders of * 0006 // * the Geant4 Collaboration. It is provided under the terms and * 0007 // * conditions of the Geant4 Software License, included in the file * 0008 // * LICENSE and available at http://cern.ch/geant4/license . These * 0009 // * include a list of copyright holders. * 0010 // * * 0011 // * Neither the authors of this software system, nor their employing * 0012 // * institutes,nor the agencies providing financial support for this * 0013 // * work make any representation or warranty, express or implied, * 0014 // * regarding this software system or assume any liability for its * 0015 // * use. Please see the license in the file LICENSE and URL above * 0016 // * for the full disclaimer and the limitation of liability. * 0017 // * * 0018 // * This code implementation is the result of the scientific and * 0019 // * technical work of the GEANT4 collaboration. * 0020 // * By using, copying, modifying or distributing the software (or * 0021 // * any work based on the software) you agree to acknowledge its * 0022 // * use in resulting scientific publications, and indicate your * 0023 // * acceptance of all terms of the Geant4 Software license. * 0024 // ******************************************************************** 0025 /// @file exMPI01.cc 0026 // 0027 /// @brief A MPI example code 0028 0029 #include "G4MPImanager.hh" 0030 #include "G4MPIsession.hh" 0031 0032 #ifdef G4MULTITHREADED 0033 # include "G4MTRunManager.hh" 0034 #else 0035 # include "G4RunManager.hh" 0036 #endif 0037 0038 #include "ActionInitialization.hh" 0039 #include "DetectorConstruction.hh" 0040 #include "FTFP_BERT.hh" 0041 0042 #include "G4UImanager.hh" 0043 #include "G4VisExecutive.hh" 0044 0045 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 0046 0047 int main(int argc, char** argv) 0048 { 0049 // random engine 0050 CLHEP::MTwistEngine randomEngine; 0051 G4Random::setTheEngine(&randomEngine); 0052 0053 // -------------------------------------------------------------------- 0054 // MPI session 0055 // -------------------------------------------------------------------- 0056 // At first, G4MPImanager/G4MPIsession should be created. 0057 G4MPImanager* g4MPI = new G4MPImanager(argc, argv); 0058 0059 // MPI session (G4MPIsession) instead of G4UIterminal 0060 // Terminal availability depends on your MPI implementation. 0061 G4MPIsession* session = g4MPI->GetMPIsession(); 0062 0063 // LAM/MPI users can use G4tcsh. 0064 G4String prompt = "[40;01;33m"; 0065 prompt += "G4MPI"; 0066 prompt += "[40;31m(%s)[40;36m[%/][00;30m:"; 0067 session->SetPrompt(prompt); 0068 0069 // -------------------------------------------------------------------- 0070 // user application setting 0071 // -------------------------------------------------------------------- 0072 #ifdef G4MULTITHREADED 0073 G4MTRunManager* runManager = new G4MTRunManager(); 0074 runManager->SetNumberOfThreads(4); 0075 #else 0076 G4RunManager* runManager = new G4RunManager(); 0077 #endif 0078 0079 // setup your application 0080 runManager->SetUserInitialization(new DetectorConstruction); 0081 runManager->SetUserInitialization(new FTFP_BERT); 0082 runManager->SetUserInitialization(new ActionInitialization); 0083 0084 runManager->Initialize(); 0085 0086 G4VisExecutive* visManager = new G4VisExecutive; 0087 visManager->Initialize(); 0088 G4cout << G4endl; 0089 0090 // -------------------------------------------------------------------- 0091 // ready for go 0092 // MPIsession treats both interactive and batch modes. 0093 // Just start your session as below. 0094 // -------------------------------------------------------------------- 0095 session->SessionStart(); 0096 0097 // -------------------------------------------------------------------- 0098 // termination 0099 // -------------------------------------------------------------------- 0100 delete visManager; 0101 0102 delete g4MPI; 0103 0104 delete runManager; 0105 0106 return EXIT_SUCCESS; 0107 }
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
![]() ![]() |