78 if( acommand.length() < 2 )
return fCommandSucceeded;
86 if( command.substr(0,11) ==
"/mpi/beamOn" ) {
87 g4mpi_-> ExecuteBeamOnThread(command);
88 returnVal = fCommandSucceeded;
89 }
else if( command.substr(0,12) ==
"/mpi/.beamOn" ) {
90 G4bool threadStatus =
g4mpi_-> CheckThreadStatus();
93 G4cout <<
"G4MPIsession:: beamOn is still running." << G4endl;
95 returnVal = fCommandSucceeded;
97 returnVal = UI-> ApplyCommand(command);
100 returnVal = UI-> ApplyCommand(command);
103 G4int paramIndex = returnVal % 100;
106 G4int commandStatus = returnVal - paramIndex;
109 if( commandStatus != fCommandSucceeded ) {
110 cmd = FindCommand(command);
113 switch( commandStatus ) {
114 case fCommandSucceeded:
116 case fCommandNotFound:
117 G4cerr <<
"command <" << UI-> SolveAlias(command)
118 <<
"> not found" << G4endl;
120 case fIllegalApplicationState:
121 G4cerr <<
"illegal application state -- command refused" << G4endl;
123 case fParameterOutOfRange:
126 case fParameterOutOfCandidates:
127 G4cerr <<
"Parameter is out of candidate list (index "
128 << paramIndex <<
")" << G4endl;
129 G4cerr <<
"Candidates : "
130 << cmd->GetParameter(paramIndex)-> GetParameterCandidates()
133 case fParameterUnreadable:
134 G4cerr <<
"Parameter is wrong type and/or is not omittable (index "
135 << paramIndex <<
")" << G4endl;
141 G4cerr <<
"command refused (" << commandStatus <<
")" << G4endl;
154 G4String::size_type iarg = acommand.find(
' ');
155 if( iarg != G4String::npos ) {
156 strarg = acommand.substr(iarg, acommand.size()-iarg);
157 acommand = acommand.substr(0,iarg);
160 G4String::size_type idx;
161 while( (idx = acommand.find(
"//")) != G4String::npos) {
162 G4String command1 = acommand.substr(0,idx+1);
163 G4String command2 = acommand.substr(idx+2, acommand.size()-idx-2);
164 acommand = command1 + command2;
190 if( acommand.substr(0,11) ==
"/mpi/beamOn" ) {
191#ifdef G4MULTITHREADED
192 acommand =
"/mpi/.beamOn";
193 if(command.length() > 11) {
194 acommand += command.substr(11);
197 if(
g4mpi_-> IsBatchMode()) {
198 acommand =
"/mpi/.beamOn";
199 if(command.length() > 11) {
200 acommand += command.substr(11);
207 if( acommand.substr(0,11) ==
"/run/beamOn" ) {
210 G4bool qdone =
false;
212 for ( G4String::size_type idx = 10; idx < command.size(); idx++ ) {
213 if( command[idx] ==
' ' || command[idx] ==
'\011' ) {
219 strarg += command[idx];
224 if(
g4mpi_-> IsBatchMode() ) {
225 acommand =
"/mpi/.beamOn ";
226 if( command.length() > 11 ) acommand += strarg;
228#ifdef G4MULTITHREADED
230 G4cout <<
"/run/beamOn is overridden by /mpi/.beamOn" << G4endl;
232 acommand =
"/mpi/.beamOn ";
233 if( command.length() > 11 ) acommand += strarg;
236 G4cout <<
"/run/beamOn is overridden by /mpi/beamOn" << G4endl;
238 acommand =
"/mpi/beamOn ";
239 if( command.length() > 11 ) acommand += strarg;
245 if( acommand.substr(0,16) ==
"/control/execute" ) {
247 G4cout <<
"/control/execute is overridden by /mpi/execute"
250 acommand.replace(0, 16,
"/mpi/execute ");