Geant4  10.03.p03
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4MPIsession Class Reference

#include <G4MPIsession.hh>

Inheritance diagram for G4MPIsession:
Collaboration diagram for G4MPIsession:

Public Member Functions

 G4MPIsession (G4VUIshell *ashell=0)
 
 ~G4MPIsession ()
 
void SetPrompt (const G4String &prompt)
 
void SetShell (G4VUIshell *ashell)
 
virtual G4UIsessionSessionStart ()
 
- Public Member Functions inherited from G4VMPIsession
 G4VMPIsession ()
 
 ~G4VMPIsession ()
 
virtual void PauseSessionStart (const G4String &msg)
 
virtual G4int ReceiveG4cout (const G4String &coutString)
 
virtual G4int ReceiveG4cerr (const G4String &cerrString)
 
- Public Member Functions inherited from G4VBasicShell
 G4VBasicShell ()
 
virtual ~G4VBasicShell ()
 
- Public Member Functions inherited from G4UIsession
 G4UIsession ()
 
 G4UIsession (G4int iBatch)
 
virtual ~G4UIsession ()
 
- Public Member Functions inherited from G4coutDestination
 G4coutDestination ()
 
virtual ~G4coutDestination ()
 

Additional Inherited Members

- Static Public Member Functions inherited from G4UIsession
static G4int InSession ()
 
- Protected Member Functions inherited from G4VMPIsession
G4int ExecCommand (const G4String &acommand)
 
G4String TruncateCommand (const G4String &command) const
 
G4String BypassCommand (const G4String &command) const
 
virtual G4bool GetHelpChoice (G4int &aval)
 
virtual void ExitHelp () const
 
- Protected Member Functions inherited from G4VBasicShell
G4String ModifyToFullPathCommand (const char *aCommandLine) const
 
G4String GetCurrentWorkingDirectory () const
 
G4bool ChangeDirectory (const char *newDir)
 
G4UIcommandTreeFindDirectory (const char *dirName) const
 
G4UIcommandFindCommand (const char *commandName) const
 
G4String Complete (const G4String &)
 
G4String FindMatchingPath (G4UIcommandTree *, const G4String &)
 
virtual void ExecuteCommand (const G4String &)
 
void ApplyShellCommand (const G4String &, G4bool &, G4bool &)
 
void ShowCurrent (const G4String &) const
 
void ChangeDirectoryCommand (const G4String &)
 
void ListDirectory (const G4String &) const
 
void TerminalHelp (const G4String &)
 
- Protected Attributes inherited from G4VMPIsession
G4MPImanagerg4mpi_
 
G4bool is_master_
 
G4bool is_slave_
 
G4int rank_
 
- Protected Attributes inherited from G4UIsession
G4int ifBatch
 
- Static Protected Attributes inherited from G4UIsession
static G4int inSession = 0
 
- Static Protected Attributes inherited from G4coutDestination
static G4coutDestinationmasterG4coutDestination = 0
 

Detailed Description

Definition at line 33 of file G4MPIsession.hh.

Constructor & Destructor Documentation

G4MPIsession::G4MPIsession ( G4VUIshell ashell = 0)

Definition at line 52 of file G4MPIsession.cc.

53  : G4VMPIsession()
54 {
55  ::UI-> SetSession(this);
56  ::UI-> SetCoutDestination(this);
57 
58  // shell
59  if( is_master_ ) {
60  if( ashell ) {
61  shell_ = ashell;
62  } else {
63  if ( g4mpi_-> GetSize() == 1 && ::tcsh_build ) shell_ = new G4UItcsh;
64  else shell_ = new G4UIcsh;
65  }
66  } else {
67  shell_ = new G4UImpish;
68  }
69 }
G4MPImanager * g4mpi_
static const G4bool tcsh_build
G4MPIsession::~G4MPIsession ( )

Definition at line 72 of file G4MPIsession.cc.

73 {
74  delete shell_;
75 
77  ::UI-> SetSession(0);
78  ::UI-> SetCoutDestination(0);
79 }
static G4UImanager * GetUIpointer()
Definition: G4UImanager.cc:59

Here is the call graph for this function:

Member Function Documentation

G4UIsession * G4MPIsession::SessionStart ( )
virtual

Implements G4VBasicShell.

Definition at line 178 of file G4MPIsession.cc.

179 {
180  // execute init macro
181  if( g4mpi_-> IsInitMacro() ) {
182  g4mpi_-> ExecuteMacroFile(g4mpi_->GetInitFileName());
183  }
184 
185  // batch mode
186  if( g4mpi_-> IsBatchMode() ) {
187  g4mpi_-> ExecuteMacroFile(g4mpi_->GetMacroFileName(), true);
188  return NULL;
189  }
190 
191  // interactive session
192  G4String newCommand = "", scommand; // newCommand is always "" in slaves
193 
194  while(1) {
195  if( is_master_ ) newCommand = GetCommand();
196  // broadcast a new G4 command
197  scommand = g4mpi_-> BcastCommand(newCommand);
198  if( scommand == "exit" ) {
199  G4bool qexit = TryForcedTerminate();
200  if( qexit ) break;
201  else scommand = "";
202  }
203  ExecCommand(scommand);
204  }
205 
206  return NULL;
207 }
const G4String & GetInitFileName() const
G4MPImanager * g4mpi_
const G4String & GetMacroFileName() const
bool G4bool
Definition: G4Types.hh:79
G4int ExecCommand(const G4String &acommand)

Here is the call graph for this function:

void G4MPIsession::SetPrompt ( const G4String prompt)

Definition at line 82 of file G4MPIsession.cc.

83 {
84  shell_-> SetPrompt(prompt);
85 }
void SetPrompt(const G4String &prompt)
Definition: G4MPIsession.cc:82
void G4MPIsession::SetShell ( G4VUIshell ashell)

Definition at line 88 of file G4MPIsession.cc.

89 {
90  delete shell_;
91  shell_ = ashell;
92 }

The documentation for this class was generated from the following files: