Geant4 11.4.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4UImanager Class Reference

#include <G4UImanager.hh>

Inheritance diagram for G4UImanager:

Public Member Functions

 ~G4UImanager () override
 G4UImanager (const G4UImanager &)=delete
const G4UImanageroperator= (const G4UImanager &)=delete
G4bool operator== (const G4UImanager &) const =delete
G4bool operator!= (const G4UImanager &) const =delete
G4String GetCurrentValues (const char *aCommand)
void AddNewCommand (G4UIcommand *newCommand)
void RemoveCommand (G4UIcommand *aCommand)
void ExecuteMacroFile (const char *fileName)
void Loop (const char *macroFile, const char *variableName, G4double initialValue, G4double finalValue, G4double stepSize=1.0)
void Foreach (const char *macroFile, const char *variableName, const char *candidates)
G4int ApplyCommand (const char *aCommand)
G4int ApplyCommand (const G4String &aCommand)
G4UIcommandFindCommand (const char *aCommand)
G4UIcommandFindCommand (const G4String &aCommand)
void StoreHistory (const char *fileName="G4history.macro")
void StoreHistory (G4bool historySwitch, const char *fileName="G4history.macro")
void ListCommands (const char *direc)
void SetAlias (const char *aliasLine)
void RemoveAlias (const char *aliasName)
void ListAlias ()
G4String SolveAlias (const char *aCmd)
void CreateHTML (const char *dir="/")
void LoopS (const char *valueList)
void ForeachS (const char *valueList)
G4bool Notify (G4ApplicationState requestedState) override
G4String GetCurrentStringValue (const char *aCommand, G4int parameterNumber=1, G4bool reGet=true)
G4int GetCurrentIntValue (const char *aCommand, G4int parameterNumber=1, G4bool reGet=true)
G4double GetCurrentDoubleValue (const char *aCommand, G4int parameterNumber=1, G4bool reGet=true)
G4String GetCurrentStringValue (const char *aCommand, const char *aParameterName, G4bool reGet=true)
G4int GetCurrentIntValue (const char *aCommand, const char *aParameterName, G4bool reGet=true)
G4double GetCurrentDoubleValue (const char *aCommand, const char *aParameterName, G4bool reGet=true)
void SetPauseAtBeginOfEvent (G4bool vl)
G4bool GetPauseAtBeginOfEvent () const
void SetPauseAtEndOfEvent (G4bool vl)
G4bool GetPauseAtEndOfEvent () const
G4UIcommandTreeGetTree () const
G4UIsessionGetSession () const
G4UIsessionGetG4UIWindow () const
G4UIsessionGetBaseSession () const
void SetSession (G4UIsession *const value)
void SetG4UIWindow (G4UIsession *const value)
void SetCoutDestination (G4UIsession *const value)
void SetVerboseLevel (G4int val)
G4int GetVerboseLevel () const
G4int GetNumberOfHistory () const
G4String GetPreviousCommand (G4int i) const
void SetMaxHistSize (G4int mx)
G4int GetMaxHistSize () const
void SetMacroSearchPath (const G4String &path)
const G4StringGetMacroSearchPath () const
void ParseMacroSearchPath ()
G4String FindMacroPath (const G4String &fname) const
void SetMasterUIManager (G4bool val)
void SetIgnoreCmdNotFound (G4bool val)
std::vector< G4String > * GetCommandStack ()
void RegisterBridge (G4UIbridge *brg)
void SetUpForAThread (G4int tId)
void SetUpForSpecialThread (const G4String &aPrefix)
G4int GetThreadID () const
void SetCoutFileName (const G4String &fileN="G4cout.txt", G4bool ifAppend=true)
void SetCerrFileName (const G4String &fileN="G4cerr.txt", G4bool ifAppend=true)
void SetThreadPrefixString (const G4String &prefix="W")
void SetThreadUseBuffer (G4bool flg=true)
void SetThreadIgnore (G4int tid=0)
void SetThreadIgnoreInit (G4bool flg=true)
G4MTcoutDestinationGetThreadCout ()
G4int GetLastReturnCode () const
bool IsLastCommandOutputTreated ()
void SetLastCommandOutputTreated ()
void StartRecording (G4String fn, G4bool ifAppend, G4bool ifTemp=false, G4String assocCmd="**NOCMD**")
void RecordCommand (const G4String &aCommand)
G4int EndRecording ()
Public Member Functions inherited from G4VStateDependent
 G4VStateDependent (G4bool bottom=false)
virtual ~G4VStateDependent ()
G4bool operator== (const G4VStateDependent &right) const
G4bool operator!= (const G4VStateDependent &right) const
virtual void NotifyDeletion (const G4Event *)
virtual void NotifyDeletion (const G4Run *)

Static Public Member Functions

static G4UImanagerGetUIpointer ()
static G4UImanagerGetMasterUIpointer ()
static void UseDoublePrecisionStr (G4bool val)
static G4bool DoublePrecisionStr ()

Protected Member Functions

 G4UImanager ()

Detailed Description

Definition at line 57 of file G4UImanager.hh.

Constructor & Destructor Documentation

◆ ~G4UImanager()

G4UImanager::~G4UImanager ( )
override

Definition at line 113 of file G4UImanager.cc.

114{
115 if (bridges != nullptr) {
116 for (auto bridge : *bridges) {
117 delete bridge;
118 }
119 delete bridges;
120 }
121 SetCoutDestination(nullptr);
122 histVec.clear();
123 if (saveHistory) {
124 historyFile.close();
125 }
126 delete CoutMessenger;
127 delete UnitsMessenger;
128 delete UImessenger;
129 delete treeTop;
130 delete aliasList;
131 fUImanagerHasBeenKilled() = true;
132 fUImanager() = nullptr;
133 if (commandStack != nullptr) {
134 commandStack->clear();
135 delete commandStack;
136 }
137 if (threadID >= 0) {
138 delete threadCout;
140 threadID = -1;
141 }
142}
void G4iosFinalization()
Definition G4ios.cc:297
void SetCoutDestination(G4UIsession *const value)

◆ G4UImanager() [1/2]

G4UImanager::G4UImanager ( const G4UImanager & )
delete

◆ G4UImanager() [2/2]

G4UImanager::G4UImanager ( )
protected

Definition at line 96 of file G4UImanager.cc.

96 : G4VStateDependent(true)
97{
98 treeTop = new G4UIcommandTree("/");
99 aliasList = new G4UIaliasList;
100 SetCoutDestination(session);
101 commandStack = new std::vector<G4String>;
102}
G4VStateDependent(G4bool bottom=false)

Member Function Documentation

◆ AddNewCommand()

void G4UImanager::AddNewCommand ( G4UIcommand * newCommand)

Definition at line 253 of file G4UImanager.cc.

254{
255 treeTop->AddNewCommand(newCommand);
256 if (fMasterUImanager() != nullptr && G4Threading::G4GetThreadId() == 0) {
257 fMasterUImanager()->AddWorkerCommand(newCommand);
258 }
259}
G4int G4GetThreadId()

◆ ApplyCommand() [1/2]

G4int G4UImanager::ApplyCommand ( const char * aCommand)

Definition at line 448 of file G4UImanager.cc.

449{
450 G4String aCommand = aCmd;
451 if(fRecordDepth<0)
452 {
453 // while recording a command to a macro file, skip solving and record the command as-is
454 aCommand = SolveAlias(aCmd);
455 if (aCommand.empty()) {
456 return fAliasNotFound;
457 }
458 }
459 if (verboseLevel != 0) {
461 fLastCommandOutputTreated = false;
462 }
463 G4cout << aCommand << G4endl;
464 }
465 G4String commandString;
466 G4String commandParameter;
467
468 std::size_t iAt = aCommand.find('@');
469 if (iAt != std::string::npos) {
470 G4String commandStr1 = aCommand.substr(0,iAt);
471 G4String commandStr2 = aCommand.substr(iAt+1,aCommand.length() - (iAt + 1));
472 std::size_t iAt2 = commandStr2.find('@');
473 G4String tmpFileName;
474 G4bool tmpFile = false;
475 if (iAt2 != std::string::npos) {
476 if(iAt2 == 0) {
477 // Two '@'s are connected. temporal file will be created
478 tmpFileName = "tmptmp_";
479 tmpFileName += G4UIcommand::ConvertToString(fRecordDepth+1);
480 tmpFileName += ".tmpmac";
481 tmpFile = true;
482 } else {
483 tmpFileName = commandStr2.substr(0,iAt2);
484 }
485 } else {
486 return fAliasNotFound;
487 }
488 G4String commandStr3 = commandStr2.substr(iAt2+1,commandStr2.length()-(iAt2+1));
489 G4String revisedCommand = commandStr1;
490 revisedCommand += " ";
491 revisedCommand += tmpFileName;
492 revisedCommand += " ";
493 revisedCommand += commandStr3;
494 StartRecording(tmpFileName,false,tmpFile,revisedCommand);
495 return fCommandSucceeded;
496 }
497
498 std::size_t i = aCommand.find(' ');
499 if (i != std::string::npos) {
500 commandString = aCommand.substr(0, i);
501 commandParameter = aCommand.substr(i + 1, aCommand.length() - (i + 1));
502 }
503 else {
504 commandString = aCommand;
505 }
506
507 // remove doubled slash
508 std::size_t len = commandString.length();
509 std::size_t ll = 0;
510 G4String a1;
511 G4String a2;
512 while (ll < len - 1) {
513 if (commandString.substr(ll, 2) == "//") {
514 if (ll == 0) {
515 // Safe because index argument always 0
516 commandString.erase(ll, 1);
517 }
518 else {
519 a1 = commandString.substr(0, ll);
520 a2 = commandString.substr(ll + 1, len - ll - 1);
521 commandString = a1 + a2;
522 }
523 --len;
524 }
525 else {
526 ++ll;
527 }
528 }
529
530 if (isMaster && bridges != nullptr) {
531 for (auto bridge : *bridges) {
532 G4int leng = bridge->DirLength();
533 if (commandString.substr(0, leng) == bridge->DirName()) {
534 return bridge->LocalUI()->ApplyCommand(commandString + " " + commandParameter);
535 }
536 }
537 }
538
539 G4UIcommand* targetCommand = treeTop->FindPath(commandString);
540 if (targetCommand == nullptr) {
541 if (ignoreCmdNotFound) {
542 if (stackCommandsForBroadcast) {
543 commandStack->push_back(commandString + " " + commandParameter);
544 }
545 return fCommandSucceeded;
546 }
547
548 return fCommandNotFound;
549 }
550
551 if (stackCommandsForBroadcast && targetCommand->ToBeBroadcasted()) {
552 commandStack->push_back(commandString + " " + commandParameter);
553 }
554
555 if (!(targetCommand->IsAvailable())) {
557 }
558
559 if (saveHistory) {
560 historyFile << aCommand << G4endl;
561 }
562 if (G4int(histVec.size()) >= maxHistSize) {
563 histVec.erase(histVec.begin());
564 }
565 histVec.push_back(aCommand);
566
567 if(fRecordDepth>=0) {
568 if(aCommand == "/control/endRecord") {
569 EndRecording();
570 return fCommandSucceeded;
571 } else if(commandString != "/control/recordToMacro") {
572 RecordCommand(aCommand);
573 return fCommandSucceeded;
574 }
575 }
576
577 targetCommand->ResetFailure();
578 G4int commandFailureCode = targetCommand->DoIt(commandParameter);
579 if (commandFailureCode == 0) {
580 G4int additionalFailureCode = targetCommand->IfCommandFailed();
581 if (additionalFailureCode > 0) {
583 msg << targetCommand->GetFailureDescription() << "\n"
584 << "Error code : " << additionalFailureCode;
585 G4Exception("G4UImanager::ApplyCommand", "UIMAN0123", JustWarning, msg);
586 commandFailureCode += additionalFailureCode;
587 }
588 }
589 return commandFailureCode;
590}
@ JustWarning
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
std::ostringstream G4ExceptionDescription
bool G4bool
Definition G4Types.hh:86
int G4int
Definition G4Types.hh:85
@ fCommandNotFound
@ fAliasNotFound
@ fIllegalApplicationState
@ fCommandSucceeded
#define G4endl
Definition G4ios.hh:67
G4GLOB_DLL std::ostream G4cout
G4bool ToBeBroadcasted() const
G4int IfCommandFailed()
virtual G4int DoIt(const G4String &parameterList)
static G4String ConvertToString(G4bool boolVal)
void ResetFailure()
G4bool IsAvailable()
const G4String & GetFailureDescription()
G4String SolveAlias(const char *aCmd)
void StartRecording(G4String fn, G4bool ifAppend, G4bool ifTemp=false, G4String assocCmd="**NOCMD**")
G4int EndRecording()
void RecordCommand(const G4String &aCommand)
G4bool IsMasterThread()

Referenced by ApplyCommand(), G4RunManagerKernel::BuildPhysicsTables(), G4SubEvtRunManager::CreateAndStartWorkers(), G4TaskRunManager::CreateAndStartWorkers(), G4TheMTRayTracer::CreateBitMap(), G4WorkerRunManager::DoWork(), EndRecording(), G4VBasicShell::ExecuteCommand(), G4RunManager::GeometryHasBeenModified(), G4TaskRunManagerKernel::InitializeWorker(), G4VVisCommand::InterpolateViews(), G4QTabWidget::paintEvent(), G4RunManager::ProcessOneEvent(), G4SubEvtRunManager::ProcessOneEvent(), G4WorkerRunManager::ProcessOneEvent(), G4WorkerTaskRunManager::ProcessOneEvent(), G4WorkerSubEvtRunManager::ProcessUI(), G4WorkerTaskRunManager::ProcessUI(), G4VVisCommand::RefreshIfRequired(), G4RunManager::ReinitializeGeometry(), G4SubEvtRunManager::RequestWorkersProcessCommandsStack(), G4TaskRunManager::RequestWorkersProcessCommandsStack(), G4VVisCommandGeometrySet::Set(), G4EmExtraParametersMessenger::SetNewValue(), G4EmLowEParametersMessenger::SetNewValue(), G4EmParametersMessenger::SetNewValue(), G4OpenGLViewerMessenger::SetNewValue(), G4OpenGLXmViewerMessenger::SetNewValue(), G4OpticalParametersMessenger::SetNewValue(), G4ProcessManagerMessenger::SetNewValue(), G4ProcessTableMessenger::SetNewValue(), G4TrackingMessenger::SetNewValue(), G4UIcontrolMessenger::SetNewValue(), G4VisCommandDrawLogicalVolume::SetNewValue(), G4VisCommandDrawTree::SetNewValue(), G4VisCommandDrawView::SetNewValue(), G4VisCommandDrawVolume::SetNewValue(), G4VisCommandGeometryRestore::SetNewValue(), G4VisCommandList::SetNewValue(), G4VisCommandOpen::SetNewValue(), G4VisCommandReviewKeptEvents::SetNewValue(), G4VisCommandSceneAddTrajectories::SetNewValue(), G4VisCommandSpecify::SetNewValue(), G4VisCommandsTouchable::SetNewValue(), G4VisCommandsTouchableSet::SetNewValue(), G4VisCommandViewerClone::SetNewValue(), G4VisCommandViewerCreate::SetNewValue(), G4VisCommandViewerFlush::SetNewValue(), G4VisCommandViewerInterpolate::SetNewValue(), G4VisCommandGeometrySetVisibility::SetNewValueOnLV(), G4ToolsSGSceneHandler::SetPlotterHistograms(), G4VViewer::SetTouchable(), G4TheMTRayTracer::Trace(), and G4TheRayTracer::Trace().

◆ ApplyCommand() [2/2]

G4int G4UImanager::ApplyCommand ( const G4String & aCommand)

Definition at line 442 of file G4UImanager.cc.

443{
444 return ApplyCommand(aCmd.data());
445}
G4int ApplyCommand(const char *aCommand)

◆ CreateHTML()

void G4UImanager::CreateHTML ( const char * dir = "/")

Definition at line 749 of file G4UImanager.cc.

750{
751 G4UIcommandTree* tr = FindDirectory(dir);
752 if (tr != nullptr) {
753 tr->CreateHTML();
754 }
755 else {
756 G4cerr << "Directory <" << dir << "> is not found." << G4endl;
757 }
758}
G4GLOB_DLL std::ostream G4cerr
void CreateHTML(const G4String &="")

Referenced by G4UIcontrolMessenger::SetNewValue().

◆ DoublePrecisionStr()

G4bool G4UImanager::DoublePrecisionStr ( )
static

◆ EndRecording()

G4int G4UImanager::EndRecording ( )

Definition at line 969 of file G4UImanager.cc.

970{
971 G4int retVal = fCommandSucceeded;
972 fRecordFile[fRecordDepth]->close();
973 delete fRecordFile[fRecordDepth];
974 fRecordFile.pop_back();
975 G4String assocCmd = fAccosiatedCommand[fRecordDepth];
976 fAccosiatedCommand.pop_back();
977 G4cout << "G4UImanager::EndRecording [" << fRecordDepth << "] "
978 << fRecordFileName[fRecordDepth].first << G4endl;
979 fRecordDepth--;
980 if(assocCmd!="**NOCMD**") {
981 retVal = ApplyCommand(assocCmd);
982 }
983 if(fRecordDepth<0) {
984 while(fRecordFileName.size()>0) {
985 G4String fn = fRecordFileName.back().first;
986 G4bool ifTemp = fRecordFileName.back().second;
987 fRecordFileName.pop_back();
988 if(ifTemp) {
989 std::error_code ec;
990 G4bool res = G4fs::remove(fn.c_str(), ec);
991 if(!res) {
993 ed << "Error removing temporary macro file " << fn << " : "
994 << ec.message();
995 G4Exception("G4UImanager::EndRecording()", "UIMAN0801", JustWarning, ed);
996 }
997 }
998 }
999 }
1000 return retVal;
1001}

Referenced by ApplyCommand().

◆ ExecuteMacroFile()

void G4UImanager::ExecuteMacroFile ( const char * fileName)

Definition at line 283 of file G4UImanager.cc.

284{
285 G4UIsession* batchSession = new G4UIbatch(fileName, session);
286 session = batchSession;
287 lastRC = 0;
288 G4UIsession* previousSession = session->SessionStart();
289 lastRC = session->GetLastReturnCode();
290 delete session;
291 session = previousSession;
292}
virtual G4UIsession * SessionStart()
G4int GetLastReturnCode() const

Referenced by Foreach(), and G4UIcontrolMessenger::SetNewValue().

◆ FindCommand() [1/2]

G4UIcommand * G4UImanager::FindCommand ( const char * aCommand)

Definition at line 599 of file G4UImanager.cc.

600{
601 const G4String& aCommand = SolveAlias(aCmd);
602 if (aCommand.empty()) {
603 return nullptr;
604 }
605
606 G4String commandString;
607
608 std::size_t i = aCommand.find(' ');
609 if (i != std::string::npos) {
610 commandString = aCommand.substr(0, i);
611 }
612 else {
613 commandString = aCommand;
614 }
615
616 return treeTop->FindPath(commandString);
617}

Referenced by FindCommand().

◆ FindCommand() [2/2]

G4UIcommand * G4UImanager::FindCommand ( const G4String & aCommand)

Definition at line 593 of file G4UImanager.cc.

594{
595 return FindCommand(aCmd.data());
596}
G4UIcommand * FindCommand(const char *aCommand)

◆ FindMacroPath()

G4String G4UImanager::FindMacroPath ( const G4String & fname) const

Definition at line 796 of file G4UImanager.cc.

797{
798 G4String macrofile = fname;
799
800 for (const auto& searchDir : searchDirs) {
801 const G4String& fullpath = searchDir + "/" + fname;
802 if (FileFound(fullpath)) {
803 macrofile = fullpath;
804 break;
805 }
806 }
807 return macrofile;
808}

Referenced by G4UIQt::AddIcon(), G4UIQt::AddViewerTabFromFile(), Foreach(), and G4UIcontrolMessenger::SetNewValue().

◆ Foreach()

void G4UImanager::Foreach ( const char * macroFile,
const char * variableName,
const char * candidates )

Definition at line 370 of file G4UImanager.cc.

371{
372 G4String candidatesString = candidates;
373 G4Tokenizer parameterToken(candidatesString);
374 G4String cd;
375 while (!((cd = parameterToken()).empty())) {
376 G4String vl = variableName;
377 vl += " ";
378 vl += cd;
379 SetAlias(vl);
381 if (lastRC != 0) {
383 ed << "Loop aborted due to a command execution error - "
384 << "error code " << lastRC;
385 G4Exception("G4UImanager::Foreach", "UIMAN0201", JustWarning, ed);
386 break;
387 }
388 }
389}
void ExecuteMacroFile(const char *fileName)
void SetAlias(const char *aliasLine)
G4String FindMacroPath(const G4String &fname) const

Referenced by ForeachS(), and Loop().

◆ ForeachS()

void G4UImanager::ForeachS ( const char * valueList)

Definition at line 340 of file G4UImanager.cc.

341{
342 const G4String& vl = valueList;
343 G4Tokenizer parameterToken(vl);
344 const G4String& mf = parameterToken();
345 const G4String& vn = parameterToken();
346 G4String c1 = parameterToken();
347 G4String ca;
348 while (!((ca = parameterToken()).empty())) {
349 c1 += " ";
350 c1 += ca;
351 }
352
353 G4String aliasValue = std::move(c1);
354 if (aliasValue[0] == '"') {
355 G4String strippedValue;
356 if (aliasValue.back() == '"') {
357 strippedValue = aliasValue.substr(1, aliasValue.length() - 2);
358 }
359 else {
360 strippedValue = aliasValue.substr(1, aliasValue.length() - 1);
361 }
362 aliasValue = std::move(strippedValue);
363 }
364
365 // Foreach(mf,vn,c1);
366 Foreach(mf, vn, aliasValue);
367}
void Foreach(const char *macroFile, const char *variableName, const char *candidates)

Referenced by G4UIcontrolMessenger::SetNewValue().

◆ GetBaseSession()

G4UIsession * G4UImanager::GetBaseSession ( ) const

Definition at line 928 of file G4UImanager.cc.

929{
930 // There may be no session - pure batch mode (session == nullptr)
931 // If there is a session, it may be a batch session used for processing macros.
932 // Find base session of this hierarchy of batch sessions.
933 G4UIsession* baseSession = session;
934 while (auto aBatchSession = dynamic_cast<G4UIbatch*>(baseSession)) {
935 auto previousSession = aBatchSession->GetPreviousSession();
936 if (previousSession == nullptr) {
937 // No previouse session - aBatchSession is the desired base session
938 baseSession = aBatchSession;
939 break;
940 }
941 // There is a previous session, which may or may not be a batch.
942 // If not, it will be our desired base - so record and test again.
943 baseSession = previousSession;
944 }
945 return baseSession;
946}

Referenced by G4OpenGLQt::IsUISessionCompatible(), G4OpenGLXm::IsUISessionCompatible(), G4OpenInventor::IsUISessionCompatible(), G4ToolsSGQtGLES::IsUISessionCompatible(), G4ToolsSGQtZB::IsUISessionCompatible(), and G4VtkQt::IsUISessionCompatible().

◆ GetCommandStack()

std::vector< G4String > * G4UImanager::GetCommandStack ( )

Definition at line 811 of file G4UImanager.cc.

812{
813 std::vector<G4String>* returnValue = commandStack;
814 commandStack = new std::vector<G4String>;
815 return returnValue;
816}

Referenced by G4MTRunManager::PrepareCommandsStack().

◆ GetCurrentDoubleValue() [1/2]

G4double G4UImanager::GetCurrentDoubleValue ( const char * aCommand,
const char * aParameterName,
G4bool reGet = true )

Definition at line 229 of file G4UImanager.cc.

231{
232 G4String targetParameter = GetCurrentStringValue(aCommand, aParameterName, reGet);
233 G4double value;
234 const char* t = targetParameter;
235 std::istringstream is(t);
236 is >> value;
237 return value;
238}
double G4double
Definition G4Types.hh:83
G4String GetCurrentStringValue(const char *aCommand, G4int parameterNumber=1, G4bool reGet=true)

◆ GetCurrentDoubleValue() [2/2]

G4double G4UImanager::GetCurrentDoubleValue ( const char * aCommand,
G4int parameterNumber = 1,
G4bool reGet = true )

Definition at line 241 of file G4UImanager.cc.

243{
244 G4String targetParameter = GetCurrentStringValue(aCommand, parameterNumber, reGet);
245 G4double value;
246 const char* t = targetParameter;
247 std::istringstream is(t);
248 is >> value;
249 return value;
250}

◆ GetCurrentIntValue() [1/2]

G4int G4UImanager::GetCurrentIntValue ( const char * aCommand,
const char * aParameterName,
G4bool reGet = true )

Definition at line 206 of file G4UImanager.cc.

208{
209 G4String targetParameter = GetCurrentStringValue(aCommand, aParameterName, reGet);
210 G4int value;
211 const char* t = targetParameter;
212 std::istringstream is(t);
213 is >> value;
214 return value;
215}

◆ GetCurrentIntValue() [2/2]

G4int G4UImanager::GetCurrentIntValue ( const char * aCommand,
G4int parameterNumber = 1,
G4bool reGet = true )

Definition at line 218 of file G4UImanager.cc.

219{
220 G4String targetParameter = GetCurrentStringValue(aCommand, parameterNumber, reGet);
221 G4int value;
222 const char* t = targetParameter;
223 std::istringstream is(t);
224 is >> value;
225 return value;
226}

Referenced by G4TheMTRayTracer::Trace(), and G4TheRayTracer::Trace().

◆ GetCurrentStringValue() [1/2]

G4String G4UImanager::GetCurrentStringValue ( const char * aCommand,
const char * aParameterName,
G4bool reGet = true )

Definition at line 191 of file G4UImanager.cc.

193{
194 if (reGet || savedCommand == nullptr) {
195 G4String parameterValues = GetCurrentValues(aCommand);
196 }
197 for (G4int i = 0; i < (G4int)savedCommand->GetParameterEntries(); ++i) {
198 if (aParameterName == savedCommand->GetParameter(i)->GetParameterName()) {
199 return GetCurrentStringValue(aCommand, i + 1, false);
200 }
201 }
202 return G4String();
203}
G4String GetCurrentValues(const char *aCommand)

◆ GetCurrentStringValue() [2/2]

G4String G4UImanager::GetCurrentStringValue ( const char * aCommand,
G4int parameterNumber = 1,
G4bool reGet = true )

Definition at line 169 of file G4UImanager.cc.

171{
172 if (reGet || savedCommand == nullptr) {
173 savedParameters = GetCurrentValues(aCommand);
174 }
175 G4Tokenizer savedToken(savedParameters);
176 G4String token;
177 for (G4int i_thParameter = 0; i_thParameter < parameterNumber; ++i_thParameter) {
178 token = savedToken();
179 if (token.empty()) {
180 return G4String();
181 }
182 if (token[(size_t)0] == '"') {
183 token.append(" ");
184 token.append(savedToken("\""));
185 }
186 }
187 return token;
188}

Referenced by GetCurrentDoubleValue(), GetCurrentDoubleValue(), GetCurrentIntValue(), GetCurrentIntValue(), and GetCurrentStringValue().

◆ GetCurrentValues()

G4String G4UImanager::GetCurrentValues ( const char * aCommand)

Definition at line 157 of file G4UImanager.cc.

158{
159 G4String theCommand = aCommand;
160 savedCommand = treeTop->FindPath(theCommand);
161 if (savedCommand == nullptr) {
162 G4cerr << "command not found" << G4endl;
163 return G4String();
164 }
165 return savedCommand->GetCurrentValue();
166}

Referenced by GetCurrentStringValue(), GetCurrentStringValue(), G4UIcontrolMessenger::SetNewValue(), G4ToolsSGSceneHandler::SetPlotterHistograms(), and G4VBasicShell::ShowCurrent().

◆ GetG4UIWindow()

◆ GetLastReturnCode()

G4int G4UImanager::GetLastReturnCode ( ) const
inline

Definition at line 242 of file G4UImanager.hh.

242{ return lastRC; }

Referenced by G4UIcontrolMessenger::SetNewValue().

◆ GetMacroSearchPath()

const G4String & G4UImanager::GetMacroSearchPath ( ) const
inline

Definition at line 206 of file G4UImanager.hh.

206{ return searchPath; }

Referenced by G4UIcontrolMessenger::GetCurrentValue().

◆ GetMasterUIpointer()

G4UImanager * G4UImanager::GetMasterUIpointer ( )
static

Definition at line 90 of file G4UImanager.cc.

91{
92 return fMasterUImanager();
93}

Referenced by G4UIbridge::G4UIbridge().

◆ GetMaxHistSize()

G4int G4UImanager::GetMaxHistSize ( ) const
inline

Definition at line 203 of file G4UImanager.hh.

203{ return maxHistSize; }

Referenced by G4UIcontrolMessenger::GetCurrentValue().

◆ GetNumberOfHistory()

G4int G4UImanager::GetNumberOfHistory ( ) const
inline

Definition at line 193 of file G4UImanager.hh.

193{ return G4int(histVec.size()); }

Referenced by G4VBasicShell::ApplyShellCommand().

◆ GetPauseAtBeginOfEvent()

G4bool G4UImanager::GetPauseAtBeginOfEvent ( ) const
inline

Definition at line 172 of file G4UImanager.hh.

172{ return pauseAtBeginOfEvent; }

◆ GetPauseAtEndOfEvent()

G4bool G4UImanager::GetPauseAtEndOfEvent ( ) const
inline

Definition at line 174 of file G4UImanager.hh.

174{ return pauseAtEndOfEvent; }

◆ GetPreviousCommand()

G4String G4UImanager::GetPreviousCommand ( G4int i) const
inline

Definition at line 194 of file G4UImanager.hh.

195 {
196 G4String st;
197 if (i >= 0 && i < G4int(histVec.size())) {
198 st = histVec[i];
199 }
200 return st;
201 }

Referenced by G4VBasicShell::ApplyShellCommand().

◆ GetSession()

G4UIsession * G4UImanager::GetSession ( ) const
inline

Definition at line 177 of file G4UImanager.hh.

177{ return session; }

Referenced by G4VisCommandReviewKeptEvents::SetNewValue().

◆ GetThreadCout()

G4MTcoutDestination * G4UImanager::GetThreadCout ( )
inline

Definition at line 237 of file G4UImanager.hh.

237{ return threadCout; }

◆ GetThreadID()

G4int G4UImanager::GetThreadID ( ) const
inline

Definition at line 229 of file G4UImanager.hh.

229{ return threadID; }

◆ GetTree()

◆ GetUIpointer()

G4UImanager * G4UImanager::GetUIpointer ( )
static

Definition at line 78 of file G4UImanager.cc.

79{
80 if (fUImanager() == nullptr) {
81 if (!fUImanagerHasBeenKilled()) {
82 fUImanager() = new G4UImanager;
83 fUImanager()->CreateMessenger();
84 }
85 }
86 return fUImanager();
87}
G4UImanager(const G4UImanager &)=delete

Referenced by G4UIQt::AddButton(), G4UIQt::AddIcon(), G4UIcommandTree::AddNewCommand(), G4UIQt::AddViewerTabFromFile(), G4OpenInventorQtExaminerViewer::afterRealizeHook(), G4VBasicShell::ApplyShellCommand(), G4RunManagerKernel::BuildPhysicsTables(), G4VVisCommand::CheckSceneAndNotifyHandlers(), G4VBasicShell::Complete(), G4SubEvtRunManager::CreateAndStartWorkers(), G4TaskRunManager::CreateAndStartWorkers(), G4TheMTRayTracer::CreateBitMap(), G4UImessenger::CreateDirectory(), G4OpenGLQtViewer::CreateMainWindow(), G4VtkQtViewer::CreateMainWindow(), G4WorkerRunManager::DoWork(), G4VBasicShell::ExecuteCommand(), G4VBasicShell::FindCommand(), G4VBasicShell::FindDirectory(), G4MTRunManager::G4MTRunManager(), G4RunManager::G4RunManager(), G4SubEvtRunManager::G4SubEvtRunManager(), G4TaskRunManager::G4TaskRunManager(), G4UIbatch::G4UIbatch(), G4UIQt::G4UIQt(), G4UIterminal::G4UIterminal(), G4UIWin32::G4UIWin32(), G4UIXm::G4UIXm(), G4VisCommandDrawLogicalVolume::G4VisCommandDrawLogicalVolume(), G4VisCommandDrawVolume::G4VisCommandDrawVolume(), G4VisCommandOpen::G4VisCommandOpen(), G4VisCommandSceneAddMagneticField::G4VisCommandSceneAddMagneticField(), G4VisManager::G4VisSubThread(), G4WorkerRunManager::G4WorkerRunManager(), G4RunManager::GeometryHasBeenModified(), G4VisManager::GeometryHasChanged(), G4VUIshell::GetCommandTree(), G4UIcontrolMessenger::GetCurrentValue(), G4RTQtScanner::GetQtWindow(), G4OpenInventorQtViewer::Initialise(), G4ToolsSGQtGLESViewer::Initialise(), G4ToolsSGQtZBViewer::Initialise(), G4TaskRunManagerKernel::InitializeWorker(), G4VVisCommand::InterpolateViews(), G4OpenGLQt::IsUISessionCompatible(), G4OpenGLXm::IsUISessionCompatible(), G4OpenInventor::IsUISessionCompatible(), G4ToolsSGQtGLES::IsUISessionCompatible(), G4ToolsSGQtZB::IsUISessionCompatible(), G4VtkQt::IsUISessionCompatible(), G4VisManager::NotifyHandlers(), G4QTabWidget::paintEvent(), G4MTRunManager::PrepareCommandsStack(), G4RunManager::ProcessOneEvent(), G4SubEvtRunManager::ProcessOneEvent(), G4WorkerRunManager::ProcessOneEvent(), G4WorkerTaskRunManager::ProcessOneEvent(), G4WorkerSubEvtRunManager::ProcessUI(), G4WorkerTaskRunManager::ProcessUI(), G4UIQt::ReceiveG4cout(), G4VVisCommand::RefreshIfRequired(), G4RunManager::ReinitializeGeometry(), G4SubEvtRunManager::RequestWorkersProcessCommandsStack(), G4TaskRunManager::RequestWorkersProcessCommandsStack(), G4UIbatch::SessionStart(), G4VVisCommandGeometrySet::Set(), G4EmExtraParametersMessenger::SetNewValue(), G4EmLowEParametersMessenger::SetNewValue(), G4EmParametersMessenger::SetNewValue(), G4LocalThreadCoutMessenger::SetNewValue(), G4OpenGLViewerMessenger::SetNewValue(), G4OpenGLXmViewerMessenger::SetNewValue(), G4OpticalParametersMessenger::SetNewValue(), G4ProcessManagerMessenger::SetNewValue(), G4ProcessTableMessenger::SetNewValue(), G4RunMessenger::SetNewValue(), G4TrackingMessenger::SetNewValue(), G4UIcontrolMessenger::SetNewValue(), G4VisCommandDrawLogicalVolume::SetNewValue(), G4VisCommandDrawTree::SetNewValue(), G4VisCommandDrawView::SetNewValue(), G4VisCommandDrawVolume::SetNewValue(), G4VisCommandGeometryRestore::SetNewValue(), G4VisCommandList::SetNewValue(), G4VisCommandOpen::SetNewValue(), G4VisCommandPlot::SetNewValue(), G4VisCommandReviewKeptEvents::SetNewValue(), G4VisCommandReviewPlots::SetNewValue(), G4VisCommandSceneAddTrajectories::SetNewValue(), G4VisCommandSceneHandlerCreate::SetNewValue(), G4VisCommandSpecify::SetNewValue(), G4VisCommandsTouchable::SetNewValue(), G4VisCommandsTouchableSet::SetNewValue(), G4VisCommandViewerClone::SetNewValue(), G4VisCommandViewerCreate::SetNewValue(), G4VisCommandViewerFlush::SetNewValue(), G4VisCommandViewerInterpolate::SetNewValue(), G4VisCommandGeometrySetVisibility::SetNewValueOnLV(), G4ToolsSGSceneHandler::SetPlotterHistograms(), G4VViewer::SetTouchable(), G4VBasicShell::ShowCurrent(), G4MTRunManagerKernel::StartThread(), G4VBasicShell::TerminalHelp(), G4TheMTRayTracer::Trace(), G4TheRayTracer::Trace(), G4VViewer::UpdateGUIDrawingStyle(), G4VViewer::UpdateGUIProjectionStyle(), G4VViewer::UpdateGUISceneTree(), G4VViewer::UpdateGUITransparencySlider(), G4OpenGLQtViewer::updateViewerPropertiesTableWidget(), G4RunManagerKernel::~G4RunManagerKernel(), G4UIcommand::~G4UIcommand(), G4UIQt::~G4UIQt(), G4UIterminal::~G4UIterminal(), G4UIWin32::~G4UIWin32(), G4UIXm::~G4UIXm(), and G4VisManager::~G4VisManager().

◆ GetVerboseLevel()

◆ IsLastCommandOutputTreated()

bool G4UImanager::IsLastCommandOutputTreated ( )
inline

Definition at line 244 of file G4UImanager.hh.

244{ return fLastCommandOutputTreated; }

Referenced by G4UIQt::ReceiveG4cout().

◆ ListAlias()

void G4UImanager::ListAlias ( )

Definition at line 743 of file G4UImanager.cc.

744{
745 aliasList->List();
746}

Referenced by G4UIcontrolMessenger::SetNewValue().

◆ ListCommands()

void G4UImanager::ListCommands ( const char * direc)

Definition at line 651 of file G4UImanager.cc.

652{
653 G4UIcommandTree* comTree = FindDirectory(direct);
654 if (comTree != nullptr) {
655 comTree->List();
656 }
657 else {
658 G4cout << direct << " is not found." << G4endl;
659 }
660}

Referenced by G4UIcontrolMessenger::SetNewValue().

◆ Loop()

void G4UImanager::Loop ( const char * macroFile,
const char * variableName,
G4double initialValue,
G4double finalValue,
G4double stepSize = 1.0 )

Definition at line 316 of file G4UImanager.cc.

318{
319 G4String cd;
320 if (stepSize > 0) {
321 for (G4double d = initialValue; d <= finalValue; d += stepSize) {
322 std::ostringstream os;
323 os << d;
324 cd += os.str();
325 cd += " ";
326 }
327 }
328 else {
329 for (G4double d = initialValue; d >= finalValue; d += stepSize) {
330 std::ostringstream os;
331 os << d;
332 cd += os.str();
333 cd += " ";
334 }
335 }
336 Foreach(macroFile, variableName, cd);
337}

Referenced by LoopS().

◆ LoopS()

void G4UImanager::LoopS ( const char * valueList)

Definition at line 295 of file G4UImanager.cc.

296{
297 G4String vl = valueList;
298 G4Tokenizer parameterToken(vl);
299 G4String mf = parameterToken();
300 G4String vn = parameterToken();
301 G4String c1 = parameterToken();
302 c1 += " ";
303 c1 += parameterToken();
304 c1 += " ";
305 c1 += parameterToken();
306 const char* t1 = c1;
307 std::istringstream is(t1);
308 G4double d1;
309 G4double d2;
310 G4double d3;
311 is >> d1 >> d2 >> d3;
312 Loop(mf, vn, d1, d2, d3);
313}
void Loop(const char *macroFile, const char *variableName, G4double initialValue, G4double finalValue, G4double stepSize=1.0)

Referenced by G4UIcontrolMessenger::SetNewValue().

◆ Notify()

G4bool G4UImanager::Notify ( G4ApplicationState requestedState)
overridevirtual

Implements G4VStateDependent.

Definition at line 688 of file G4UImanager.cc.

689{
690 if (pauseAtBeginOfEvent) {
691 if (requestedState == G4State_EventProc
692 && G4StateManager::GetStateManager()->GetPreviousState() == G4State_GeomClosed)
693 {
694 PauseSession("BeginOfEvent");
695 }
696 }
697 if (pauseAtEndOfEvent) {
698 if (requestedState == G4State_GeomClosed
699 && G4StateManager::GetStateManager()->GetPreviousState() == G4State_EventProc)
700 {
701 PauseSession("EndOfEvent");
702 }
703 }
704 return true;
705}
@ G4State_EventProc
@ G4State_GeomClosed
static G4StateManager * GetStateManager()

◆ operator!=()

G4bool G4UImanager::operator!= ( const G4UImanager & ) const
delete

◆ operator=()

const G4UImanager & G4UImanager::operator= ( const G4UImanager & )
delete

◆ operator==()

G4bool G4UImanager::operator== ( const G4UImanager & ) const
delete

◆ ParseMacroSearchPath()

void G4UImanager::ParseMacroSearchPath ( )

Definition at line 761 of file G4UImanager.cc.

762{
763 searchDirs.clear();
764
765 std::size_t idxfirst = 0;
766 std::size_t idxend = 0;
767 G4String pathstring = "";
768 while ((idxend = searchPath.find(':', idxfirst)) != G4String::npos) {
769 pathstring = searchPath.substr(idxfirst, idxend - idxfirst);
770 if (!pathstring.empty()) {
771 searchDirs.push_back(pathstring);
772 }
773 idxfirst = idxend + 1;
774 }
775
776 pathstring = searchPath.substr(idxfirst, searchPath.size() - idxfirst);
777 if (!pathstring.empty()) {
778 searchDirs.push_back(std::move(pathstring));
779 }
780}

Referenced by G4UIcontrolMessenger::SetNewValue().

◆ RecordCommand()

void G4UImanager::RecordCommand ( const G4String & aCommand)

Definition at line 963 of file G4UImanager.cc.

964{
965 *(fRecordFile[fRecordDepth]) << aCommand << G4endl;
966}

Referenced by ApplyCommand().

◆ RegisterBridge()

void G4UImanager::RegisterBridge ( G4UIbridge * brg)

Definition at line 819 of file G4UImanager.cc.

820{
821 if (brg->LocalUI() == this) {
822 G4Exception("G4UImanager::RegisterBridge()", "UI7002", FatalException,
823 "G4UIBridge cannot bridge between same object.");
824 }
825 else {
826 bridges->push_back(brg);
827 }
828}
@ FatalException
G4UImanager * LocalUI() const
Definition G4UIbridge.hh:54

◆ RemoveAlias()

void G4UImanager::RemoveAlias ( const char * aliasName)

Definition at line 735 of file G4UImanager.cc.

736{
737 const G4String& aL = aliasName;
738 G4String targetAlias = G4StrUtil::strip_copy(aL);
739 aliasList->RemoveAlias(targetAlias);
740}
G4String strip_copy(G4String str, char ch=' ')
Return copy of string with leading and trailing characters removed.

Referenced by G4UIcontrolMessenger::SetNewValue().

◆ RemoveCommand()

void G4UImanager::RemoveCommand ( G4UIcommand * aCommand)

Definition at line 268 of file G4UImanager.cc.

269{
270 treeTop->RemoveCommand(aCommand);
271 if (fMasterUImanager() != nullptr && G4Threading::G4GetThreadId() == 0) {
272 fMasterUImanager()->RemoveWorkerCommand(aCommand);
273 }
274}

Referenced by G4UIcommand::~G4UIcommand().

◆ SetAlias()

void G4UImanager::SetAlias ( const char * aliasLine)

Definition at line 714 of file G4UImanager.cc.

715{
716 const G4String& aLine = aliasLine;
717 std::size_t i = aLine.find(' ');
718 const G4String& aliasName = aLine.substr(0, i);
719 G4String aliasValue = aLine.substr(i + 1, aLine.length() - (i + 1));
720 if (aliasValue[0] == '"') {
721 G4String strippedValue;
722 if (aliasValue.back() == '"') {
723 strippedValue = aliasValue.substr(1, aliasValue.length() - 2);
724 }
725 else {
726 strippedValue = aliasValue.substr(1, aliasValue.length() - 1);
727 }
728 aliasValue = std::move(strippedValue);
729 }
730
731 aliasList->ChangeAlias(aliasName, aliasValue);
732}

Referenced by Foreach(), G4MTRunManager::G4MTRunManager(), G4RunManager::G4RunManager(), G4SubEvtRunManager::G4SubEvtRunManager(), and G4UIcontrolMessenger::SetNewValue().

◆ SetCerrFileName()

void G4UImanager::SetCerrFileName ( const G4String & fileN = "G4cerr.txt",
G4bool ifAppend = true )

Definition at line 869 of file G4UImanager.cc.

870{
871 // for sequential mode, ignore this method.
872 if (threadID < 0) {
873 return;
874 }
875
876 if (fileN == "**Screen**") {
877 threadCout->SetCerrFileName(fileN, ifAppend);
878 }
879 else {
880 std::stringstream fn;
881 fn << "G4W_" << threadID << "_" << fileN;
882 threadCout->SetCerrFileName(fn.str(), ifAppend);
883 }
884}

Referenced by G4LocalThreadCoutMessenger::SetNewValue().

◆ SetCoutDestination()

void G4UImanager::SetCoutDestination ( G4UIsession *const value)

◆ SetCoutFileName()

void G4UImanager::SetCoutFileName ( const G4String & fileN = "G4cout.txt",
G4bool ifAppend = true )

Definition at line 851 of file G4UImanager.cc.

852{
853 // for sequential mode, ignore this method.
854 if (threadID < 0) {
855 return;
856 }
857
858 if (fileN == "**Screen**") {
859 threadCout->SetCoutFileName(fileN, ifAppend);
860 }
861 else {
862 std::stringstream fn;
863 fn << "G4W_" << threadID << "_" << fileN;
864 threadCout->SetCoutFileName(fn.str(), ifAppend);
865 }
866}

Referenced by G4LocalThreadCoutMessenger::SetNewValue().

◆ SetG4UIWindow()

void G4UImanager::SetG4UIWindow ( G4UIsession *const value)
inline

Definition at line 184 of file G4UImanager.hh.

184{ g4UIWindow = value; }

Referenced by G4UIQt::G4UIQt(), G4UIWin32::G4UIWin32(), G4UIQt::~G4UIQt(), and G4UIWin32::~G4UIWin32().

◆ SetIgnoreCmdNotFound()

void G4UImanager::SetIgnoreCmdNotFound ( G4bool val)
inline

Definition at line 219 of file G4UImanager.hh.

219{ ignoreCmdNotFound = val; }

Referenced by G4WorkerRunManager::G4WorkerRunManager().

◆ SetLastCommandOutputTreated()

void G4UImanager::SetLastCommandOutputTreated ( )
inline

Definition at line 245 of file G4UImanager.hh.

245{ fLastCommandOutputTreated = true; }

Referenced by G4UIQt::ReceiveG4cout().

◆ SetMacroSearchPath()

void G4UImanager::SetMacroSearchPath ( const G4String & path)
inline

Definition at line 205 of file G4UImanager.hh.

205{ searchPath = path; }

Referenced by G4UIcontrolMessenger::SetNewValue().

◆ SetMasterUIManager()

void G4UImanager::SetMasterUIManager ( G4bool val)
inline

Definition at line 210 of file G4UImanager.hh.

211 {
212 isMaster = val;
213 stackCommandsForBroadcast = val;
214 if (val && (bridges == nullptr)) {
215 bridges = new std::vector<G4UIbridge*>;
216 fMasterUImanager() = this;
217 }
218 }

Referenced by G4MTRunManager::G4MTRunManager(), and G4TaskRunManager::G4TaskRunManager().

◆ SetMaxHistSize()

void G4UImanager::SetMaxHistSize ( G4int mx)
inline

Definition at line 202 of file G4UImanager.hh.

202{ maxHistSize = mx; }

Referenced by G4UIcontrolMessenger::SetNewValue().

◆ SetPauseAtBeginOfEvent()

void G4UImanager::SetPauseAtBeginOfEvent ( G4bool vl)
inline

Definition at line 171 of file G4UImanager.hh.

171{ pauseAtBeginOfEvent = vl; }

Referenced by G4RunMessenger::SetNewValue().

◆ SetPauseAtEndOfEvent()

void G4UImanager::SetPauseAtEndOfEvent ( G4bool vl)
inline

Definition at line 173 of file G4UImanager.hh.

173{ pauseAtEndOfEvent = vl; }

Referenced by G4RunMessenger::SetNewValue().

◆ SetSession()

void G4UImanager::SetSession ( G4UIsession *const value)
inline

◆ SetThreadIgnore()

void G4UImanager::SetThreadIgnore ( G4int tid = 0)

Definition at line 907 of file G4UImanager.cc.

908{
909 // for sequential mode, ignore this method.
910 if (threadID < 0) {
911 igThreadID = tid;
912 return;
913 }
914 threadCout->SetIgnoreCout(tid);
915}

Referenced by G4LocalThreadCoutMessenger::SetNewValue().

◆ SetThreadIgnoreInit()

void G4UImanager::SetThreadIgnoreInit ( G4bool flg = true)

Definition at line 918 of file G4UImanager.cc.

919{
920 // for sequential mode, ignore this method.
921 if (threadID < 0) {
922 return;
923 }
924 threadCout->SetIgnoreInit(flg);
925}

Referenced by G4LocalThreadCoutMessenger::SetNewValue().

◆ SetThreadPrefixString()

void G4UImanager::SetThreadPrefixString ( const G4String & prefix = "W")

Definition at line 887 of file G4UImanager.cc.

888{
889 // for sequential mode, ignore this method.
890 if (threadID < 0) {
891 return;
892 }
893 threadCout->SetPrefixString(s);
894}

Referenced by G4LocalThreadCoutMessenger::SetNewValue().

◆ SetThreadUseBuffer()

void G4UImanager::SetThreadUseBuffer ( G4bool flg = true)

Definition at line 897 of file G4UImanager.cc.

898{
899 // for sequential mode, ignore this method.
900 if (threadID < 0) {
901 return;
902 }
903 threadCout->EnableBuffering(flg);
904}

Referenced by G4LocalThreadCoutMessenger::SetNewValue().

◆ SetUpForAThread()

void G4UImanager::SetUpForAThread ( G4int tId)

Definition at line 831 of file G4UImanager.cc.

832{
833 threadID = tId;
835 threadCout = new G4MTcoutDestination(threadID);
836 threadCout->SetIgnoreCout(igThreadID);
837}
void G4iosInitialization()
Definition G4ios.cc:296

Referenced by G4TaskRunManagerKernel::InitializeWorker(), and G4MTRunManagerKernel::StartThread().

◆ SetUpForSpecialThread()

void G4UImanager::SetUpForSpecialThread ( const G4String & aPrefix)

Definition at line 840 of file G4UImanager.cc.

841{
845 threadCout = new G4MTcoutDestination(threadID);
846 threadCout->SetPrefixString(pref);
847 threadCout->SetIgnoreCout(igThreadID);
848}
void G4SetThreadId(G4int aNewValue)

Referenced by G4VisManager::G4VisSubThread().

◆ SetVerboseLevel()

◆ SolveAlias()

G4String G4UImanager::SolveAlias ( const char * aCmd)

Definition at line 392 of file G4UImanager.cc.

393{
394 G4String aCommand = aCmd;
395 std::size_t ia = aCommand.find('{');
396 std::size_t iz = aCommand.find('#');
397 while ((ia != std::string::npos) && ((iz == std::string::npos) || (ia < iz))) {
398 G4int ibx = -1;
399 while (ibx < 0) {
400 std::size_t ib = aCommand.find('}');
401 if (ib == std::string::npos) {
402 G4cerr << aCommand << G4endl;
403 for (std::size_t i = 0; i < ia; ++i) {
404 G4cerr << " ";
405 }
406 G4cerr << "^" << G4endl;
407 G4cerr << "Unmatched alias parenthesis -- command ignored" << G4endl;
408 G4String nullStr;
409 return nullStr;
410 }
411 G4String ps = aCommand.substr(ia + 1, aCommand.length() - (ia + 1));
412 std::size_t ic = ps.find('{');
413 std::size_t id = ps.find('}');
414 if (ic != std::string::npos && ic < id) {
415 ia += ic + 1;
416 }
417 else {
418 ibx = (G4int)ib;
419 }
420 }
421 //--- Here ia represents the position of innermost "{"
422 //--- and ibx represents corresponding "}"
423 G4String subs;
424 if (ia > 0) {
425 subs = aCommand.substr(0, ia);
426 }
427 G4String alis = aCommand.substr(ia + 1, ibx - ia - 1);
428 G4String rems = aCommand.substr(ibx + 1, aCommand.length() - ibx);
429 const G4String* alVal = aliasList->FindAlias(alis);
430 if (alVal == nullptr) {
431 G4cerr << "Alias <" << alis << "> not found -- command ignored" << G4endl;
432 G4String nullStr;
433 return nullStr;
434 }
435 aCommand = subs + (*alVal) + rems;
436 ia = aCommand.find('{');
437 }
438 return aCommand;
439}

Referenced by ApplyCommand(), FindCommand(), and G4UIcontrolMessenger::SetNewValue().

◆ StartRecording()

void G4UImanager::StartRecording ( G4String fn,
G4bool ifAppend,
G4bool ifTemp = false,
G4String assocCmd = "**NOCMD**" )

Definition at line 949 of file G4UImanager.cc.

950{
951 fRecordDepth++;
952 fRecordFileName.push_back(std::pair<G4String,G4bool>(fn,ifTemp));
953 fAccosiatedCommand.push_back(assocCmd);
954 G4cout << "G4UImanager::StartRecording [" << fRecordDepth << "] " << fn << G4endl;
955 auto mode = std::ios_base::out;
956 if(ifAppend) mode = std::ios_base::app;
957 auto rf = new std::ofstream;
958 rf->open(fn,mode);
959 fRecordFile.push_back(rf);
960}

Referenced by ApplyCommand(), and G4UIcontrolMessenger::SetNewValue().

◆ StoreHistory() [1/2]

void G4UImanager::StoreHistory ( const char * fileName = "G4history.macro")

Definition at line 620 of file G4UImanager.cc.

621{
622 StoreHistory(true, fileName);
623}
void StoreHistory(const char *fileName="G4history.macro")

Referenced by G4UIcontrolMessenger::SetNewValue(), and StoreHistory().

◆ StoreHistory() [2/2]

void G4UImanager::StoreHistory ( G4bool historySwitch,
const char * fileName = "G4history.macro" )

Definition at line 626 of file G4UImanager.cc.

627{
628 if (historySwitch) {
629 if (saveHistory) {
630 historyFile.close();
631 }
632 historyFile.open((char*)fileName);
633 saveHistory = true;
634 }
635 else {
636 historyFile.close();
637 saveHistory = false;
638 }
639 saveHistory = historySwitch;
640}

◆ UseDoublePrecisionStr()

void G4UImanager::UseDoublePrecisionStr ( G4bool val)
static

Definition at line 145 of file G4UImanager.cc.

146{
147 doublePrecisionStr = val;
148}

Referenced by G4UIcontrolMessenger::SetNewValue().


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