Import Geant4 11.0.0 source tree

This commit is contained in:
Gabriele Cosmo
2021-12-10 14:46:44 +01:00
committed by Ben Morgan
parent 6399a014b6
commit 80e2389dd8
3932 changed files with 202519 additions and 246221 deletions
@@ -39,8 +39,8 @@ void Tokenize(const G4String& str, std::vector<G4String>& tokens)
{
const char* delimiter = " ";
str_size pos0 = str.find_first_not_of(delimiter);
str_size pos = str.find_first_of(delimiter, pos0);
auto pos0 = str.find_first_not_of(delimiter);
auto pos = str.find_first_of(delimiter, pos0);
while (pos != G4String::npos || pos0 != G4String::npos) {
if (str[pos0] == '\"') {
@@ -95,19 +95,19 @@ G4String G4MPIbatch::ReadCommand()
G4String cmdline(linebuf);
// TAB-> ' ' conversion
str_size nb = 0;
G4String::size_type nb = 0;
while ((nb= cmdline.find('\t',nb)) != G4String::npos) {
cmdline.replace(nb, 1, " ");
}
// strip
cmdline = cmdline.strip(G4String::both);
G4StrUtil::strip(cmdline);
// skip null line if single line
if( !qcontinued && cmdline.size() == 0 ) continue;
// '#' is treated as echoing something
if( cmdline(0) == '#' ) return cmdline;
if( cmdline[0] == '#' ) return cmdline;
// tokenize...
std::vector<G4String> tokens;
@@ -115,9 +115,9 @@ G4String G4MPIbatch::ReadCommand()
qcontinued = false;
for( G4int i = 0; i < G4int(tokens.size()); i++ ) {
// string after '#" is ignored
if( tokens[i](0) == '#' ) break;
if( tokens[i][0] == '#' ) break;
// '\' or '_' is treated as continued line.
if( tokens[i] == '\\' || tokens[i] == '_' ) {
if( tokens[i] == "\\" || tokens[i] == "_" ) {
qcontinued = true;
// check nothing after line continuation character
if( i != G4int(tokens.size())-1 ) {
@@ -137,7 +137,7 @@ G4String G4MPIbatch::ReadCommand()
}
// strip again
cmdtotal = cmdtotal.strip(G4String::both);
G4StrUtil::strip(cmdtotal);
// bypass some commands
cmdtotal = BypassCommand(cmdtotal);
@@ -170,7 +170,7 @@ G4UIsession* G4MPIbatch::SessionStart()
}
// just echo something
if( scommand(0) == '#' ) {
if( scommand[0] == '#' ) {
if( G4UImanager::GetUIpointer()-> GetVerboseLevel() == 2 ) {
G4cout << scommand << G4endl;
}
@@ -47,6 +47,7 @@ G4MPIntupleMerger::G4MPIntupleMerger(G4int nofReducedNtupleFiles,
G4bool isMaster = true;
auto analysisManager
= new G4RootMpiAnalysisManager(isMaster);
analysisManager->SetVerboseLevel(1);
// G4cout << "Start configure ntuple MPI merging" << G4endl;
// Get communicator
@@ -100,20 +100,20 @@ G4String G4MPIsession::GetCommand(const char* msg)
// get command from shell...
newCommand = shell_-> GetCommandLineString(msg);
G4String nC= newCommand.strip(G4String::leading);
G4String nC= G4StrUtil::lstrip_copy(newCommand);
if( nC.length() == 0 ) {
newCommand = nullString;
} else if( nC(0) == '#' ) {
} else if( nC[0] == '#' ) {
G4cout << nC << G4endl;
newCommand = nullString;
} else if( nC == "ls" || nC(0,3) == "ls " ) { // list commands
} else if( nC == "ls" || nC.substr(0,3) == "ls " ) { // list commands
ListDirectory(nC);
newCommand = nullString;
} else if( nC == "lc" || nC(0,3) == "lc " ) { // ... by shell
shell_-> ListCommand(nC.remove(0,2));
} else if( nC == "lc" || nC.substr(0,3) == "lc " ) { // ... by shell
shell_-> ListCommand(nC.erase(0,2));
newCommand = nullString;
} else if( nC == "pwd" ) { // show current directory
@@ -125,16 +125,16 @@ G4String G4MPIsession::GetCommand(const char* msg)
shell_-> ShowCurrentDirectory();
newCommand = nullString;
} else if(nC == "cd" || nC(0,3) == "cd " ) { // "cd"
} else if(nC == "cd" || nC.substr(0,3) == "cd " ) { // "cd"
ChangeDirectoryCommand(nC);
shell_-> SetCurrentDirectory(GetCurrentWorkingDirectory());
newCommand = nullString;
} else if( nC == "help" || nC(0,5) == "help " ) { // "help"
} else if( nC == "help" || nC.substr(0,5) == "help " ) { // "help"
TerminalHelp(nC);
newCommand = nullString;
} else if( nC(0) == '?' ) { // "show current value of a parameter"
} else if( nC[0] == '?' ) { // "show current value of a parameter"
ShowCurrent(nC);
newCommand = nullString;
@@ -145,8 +145,8 @@ G4String G4MPIsession::GetCommand(const char* msg)
}
newCommand = nullString;
} else if( nC(0) == '!' ) { // "!"
G4String ss = nC(1, nC.length()-1);
} else if( nC[0] == '!' ) { // "!"
G4String ss = nC.substr(1, nC.length()-1);
G4int vl;
const char* tt = ss;
std::istringstream is(tt);
@@ -83,10 +83,10 @@ G4int G4VMPIsession::ExecCommand(const G4String& acommand)
G4String command = BypassCommand(acommand);
// "/mpi/beamOn is threaded out.
if( command(0,11) == "/mpi/beamOn" ) {
if( command.substr(0,11) == "/mpi/beamOn" ) {
g4mpi_-> ExecuteBeamOnThread(command);
returnVal = fCommandSucceeded;
} else if( command(0,12) == "/mpi/.beamOn" ) { // care for beamOn
} else if( command.substr(0,12) == "/mpi/.beamOn" ) { // care for beamOn
G4bool threadStatus = g4mpi_-> CheckThreadStatus();
if ( threadStatus ) { // still /run/beamOn is active
if( is_master_ ) {
@@ -151,16 +151,16 @@ G4String G4VMPIsession::TruncateCommand(const G4String& command) const
G4String acommand = command;
G4String strarg;
str_size iarg = acommand.find(' ');
G4String::size_type iarg = acommand.find(' ');
if( iarg != G4String::npos ) {
strarg = acommand(iarg, acommand.size()-iarg);
acommand = acommand(0,iarg);
strarg = acommand.substr(iarg, acommand.size()-iarg);
acommand = acommand.substr(0,iarg);
}
str_size idx;
G4String::size_type idx;
while( (idx = acommand.find("//")) != G4String::npos) {
G4String command1 = acommand(0,idx+1);
G4String command2 = acommand(idx+2, acommand.size()-idx-2);
G4String command1 = acommand.substr(0,idx+1);
G4String command2 = acommand.substr(idx+2, acommand.size()-idx-2);
acommand = command1 + command2;
}
@@ -187,7 +187,7 @@ G4String G4VMPIsession::BypassCommand(const G4String& command) const
G4String acommand = command;
// /mpi/beamOn
if( acommand(0,11) == "/mpi/beamOn" ) {
if( acommand.substr(0,11) == "/mpi/beamOn" ) {
#ifdef G4MULTITHREADED
acommand = "/mpi/.beamOn";
if(command.length() > 11) {
@@ -204,12 +204,12 @@ G4String G4VMPIsession::BypassCommand(const G4String& command) const
}
// /run/beamOn
if( acommand(0,11) == "/run/beamOn" ) {
if( acommand.substr(0,11) == "/run/beamOn" ) {
G4String strarg = "";
G4bool qget = false;
G4bool qdone = false;
for ( str_size idx = 10; idx < command.size(); idx++ ) {
for ( G4String::size_type idx = 10; idx < command.size(); idx++ ) {
if( command[idx] == ' ' || command[idx] == '\011' ) {
qget = true;
if(qdone) break;
@@ -242,7 +242,7 @@ G4String G4VMPIsession::BypassCommand(const G4String& command) const
}
// /control/execute
if( acommand(0,16) == "/control/execute" ) {
if( acommand.substr(0,16) == "/control/execute" ) {
if( g4mpi_-> GetVerbose()>0 && is_master_ ) {
G4cout << "/control/execute is overridden by /mpi/execute"
<< G4endl;