Geant4 10.7.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4UImanager.cc
Go to the documentation of this file.
1//
2// ********************************************************************
3// * License and Disclaimer *
4// * *
5// * The Geant4 software is copyright of the Copyright Holders of *
6// * the Geant4 Collaboration. It is provided under the terms and *
7// * conditions of the Geant4 Software License, included in the file *
8// * LICENSE and available at http://cern.ch/geant4/license . These *
9// * include a list of copyright holders. *
10// * *
11// * Neither the authors of this software system, nor their employing *
12// * institutes,nor the agencies providing financial support for this *
13// * work make any representation or warranty, express or implied, *
14// * regarding this software system or assume any liability for its *
15// * use. Please see the license in the file LICENSE and URL above *
16// * for the full disclaimer and the limitation of liability. *
17// * *
18// * This code implementation is the result of the scientific and *
19// * technical work of the GEANT4 collaboration. *
20// * By using, copying, modifying or distributing the software (or *
21// * any work based on the software) you agree to acknowledge its *
22// * use in resulting scientific publications, and indicate your *
23// * acceptance of all terms of the Geant4 Software license. *
24// ********************************************************************
25//
26// G4UImanager
27//
28// Author: Makoto Asai, 1997
29// --------------------------------------------------------------------
30
31#include "G4UImanager.hh"
32#include "G4UIcommandTree.hh"
33#include "G4UIcommand.hh"
34#include "G4UIsession.hh"
35#include "G4UIbatch.hh"
37#include "G4UnitsMessenger.hh"
40#include "G4ios.hh"
41#include "G4strstreambuf.hh"
42#include "G4StateManager.hh"
43#include "G4UIaliasList.hh"
44#include "G4Tokenizer.hh"
46#include "G4UIbridge.hh"
47#include "G4Threading.hh"
48
49#include <sstream>
50#include <fstream>
51
52G4bool G4UImanager::doublePrecisionStr = false;
53G4int G4UImanager::igThreadID = -1;
54
55// --------------------------------------------------------------------
56G4UImanager*& G4UImanager::fUImanager()
57{
58 G4ThreadLocalStatic G4UImanager* _instance = nullptr;
59 return _instance;
60}
61
62// --------------------------------------------------------------------
63G4bool& G4UImanager::fUImanagerHasBeenKilled()
64{
65 G4ThreadLocalStatic G4bool _instance = false;
66 return _instance;
67}
68
69// --------------------------------------------------------------------
70G4UImanager*& G4UImanager::fMasterUImanager()
71{
72 static G4UImanager* _instance = nullptr;
73 return _instance;
74}
75
76// --------------------------------------------------------------------
78{
79 if(fUImanager() == nullptr)
80 {
81 if(!fUImanagerHasBeenKilled())
82 {
83 fUImanager() = new G4UImanager;
84 fUImanager()->CreateMessenger();
85 }
86 }
87 return fUImanager();
88}
89
90// --------------------------------------------------------------------
92{
93 return fMasterUImanager();
94}
95
96// --------------------------------------------------------------------
98 : G4VStateDependent(true)
99{
100 treeTop = new G4UIcommandTree("/");
101 aliasList = new G4UIaliasList;
102 SetCoutDestination(session);
103 commandStack = new std::vector<G4String>;
104}
105
106// --------------------------------------------------------------------
107void G4UImanager::CreateMessenger()
108{
109 UImessenger = new G4UIcontrolMessenger;
110 UnitsMessenger = new G4UnitsMessenger;
111 CoutMessenger = new G4LocalThreadCoutMessenger;
112 ProfileMessenger = new G4ProfilerMessenger;
113}
114
115// --------------------------------------------------------------------
117{
118 if(bridges != nullptr)
119 {
120 for(auto itr = bridges->cbegin(); itr != bridges->cend(); ++itr)
121 {
122 delete *itr;
123 }
124 delete bridges;
125 }
126 SetCoutDestination(nullptr);
127 histVec.clear();
128 if(saveHistory)
129 historyFile.close();
130 delete CoutMessenger;
131 delete ProfileMessenger;
132 delete UnitsMessenger;
133 delete UImessenger;
134 delete treeTop;
135 delete aliasList;
136 fUImanagerHasBeenKilled() = true;
137 fUImanager() = nullptr;
138 if(commandStack != nullptr)
139 {
140 commandStack->clear();
141 delete commandStack;
142 }
143 if(threadID >= 0)
144 {
145 delete threadCout;
147 threadID = -1;
148 }
149}
150
151// --------------------------------------------------------------------
153{
154 doublePrecisionStr = val;
155}
156
157// --------------------------------------------------------------------
159{
160 return doublePrecisionStr;
161}
162
163// --------------------------------------------------------------------
165{
166 G4String theCommand = aCommand;
167 savedCommand = treeTop->FindPath(theCommand);
168 if(savedCommand == nullptr)
169 {
170 G4cerr << "command not found" << G4endl;
171 return G4String();
172 }
173 return savedCommand->GetCurrentValue();
174}
175
176// --------------------------------------------------------------------
178 G4int parameterNumber, G4bool reGet)
179{
180 if(reGet || savedCommand == nullptr)
181 {
182 savedParameters = GetCurrentValues(aCommand);
183 }
184 G4Tokenizer savedToken(savedParameters);
185 G4String token;
186 for(G4int i_thParameter = 0; i_thParameter < parameterNumber; ++i_thParameter)
187 {
188 token = savedToken();
189 if(token.isNull())
190 return G4String();
191 if(token[(size_t) 0] == '"')
192 {
193 token.append(" ");
194 token.append(savedToken("\""));
195 }
196 }
197 return token;
198}
199
200// --------------------------------------------------------------------
202 const char* aParameterName,
203 G4bool reGet)
204{
205 if(reGet || savedCommand == nullptr)
206 {
207 G4String parameterValues = GetCurrentValues(aCommand);
208 }
209 for(std::size_t i = 0; i < savedCommand->GetParameterEntries(); ++i)
210 {
211 if(aParameterName == savedCommand->GetParameter(i)->GetParameterName())
212 return GetCurrentStringValue(aCommand, i + 1, false);
213 }
214 return G4String();
215}
216
217// --------------------------------------------------------------------
219 const char* aParameterName, G4bool reGet)
220{
221 G4String targetParameter =
222 GetCurrentStringValue(aCommand, aParameterName, reGet);
223 G4int value;
224 const char* t = targetParameter;
225 std::istringstream is(t);
226 is >> value;
227 return value;
228}
229
230// --------------------------------------------------------------------
232 G4int parameterNumber, G4bool reGet)
233{
234 G4String targetParameter =
235 GetCurrentStringValue(aCommand, parameterNumber, reGet);
236 G4int value;
237 const char* t = targetParameter;
238 std::istringstream is(t);
239 is >> value;
240 return value;
241}
242
243// --------------------------------------------------------------------
245 const char* aParameterName,
246 G4bool reGet)
247{
248 G4String targetParameter =
249 GetCurrentStringValue(aCommand, aParameterName, reGet);
250 G4double value;
251 const char* t = targetParameter;
252 std::istringstream is(t);
253 is >> value;
254 return value;
255}
256
257// --------------------------------------------------------------------
259 G4int parameterNumber, G4bool reGet)
260{
261 G4String targetParameter =
262 GetCurrentStringValue(aCommand, parameterNumber, reGet);
263 G4double value;
264 const char* t = targetParameter;
265 std::istringstream is(t);
266 is >> value;
267 return value;
268}
269
270// --------------------------------------------------------------------
272{
273 treeTop->AddNewCommand(newCommand);
274 if(fMasterUImanager() != nullptr && G4Threading::G4GetThreadId() == 0)
275 {
276 fMasterUImanager()->AddWorkerCommand(newCommand);
277 }
278}
279
280// --------------------------------------------------------------------
281void G4UImanager::AddWorkerCommand(G4UIcommand* newCommand)
282{
283 treeTop->AddNewCommand(newCommand, true);
284}
285
286// --------------------------------------------------------------------
288{
289 treeTop->RemoveCommand(aCommand);
290 if(fMasterUImanager() != nullptr && G4Threading::G4GetThreadId() == 0)
291 {
292 fMasterUImanager()->RemoveWorkerCommand(aCommand);
293 }
294}
295
296// --------------------------------------------------------------------
297void G4UImanager::RemoveWorkerCommand(G4UIcommand* aCommand)
298{
299 treeTop->RemoveCommand(aCommand, true);
300}
301
302// --------------------------------------------------------------------
303void G4UImanager::ExecuteMacroFile(const char* fileName)
304{
305 G4UIsession* batchSession = new G4UIbatch(fileName, session);
306 session = batchSession;
307 lastRC = 0;
308 G4UIsession* previousSession = session->SessionStart();
309 lastRC = session->GetLastReturnCode();
310 delete session;
311 session = previousSession;
312}
313
314// --------------------------------------------------------------------
315void G4UImanager::LoopS(const char* valueList)
316{
317 G4String vl = valueList;
318 G4Tokenizer parameterToken(vl);
319 G4String mf = parameterToken();
320 G4String vn = parameterToken();
321 G4String c1 = parameterToken();
322 c1 += " ";
323 c1 += parameterToken();
324 c1 += " ";
325 c1 += parameterToken();
326 const char* t1 = c1;
327 std::istringstream is(t1);
328 G4double d1;
329 G4double d2;
330 G4double d3;
331 is >> d1 >> d2 >> d3;
332 Loop(mf, vn, d1, d2, d3);
333}
334
335// --------------------------------------------------------------------
336void G4UImanager::Loop(const char* macroFile, const char* variableName,
337 G4double initialValue, G4double finalValue,
338 G4double stepSize)
339{
340 G4String cd;
341 if(stepSize > 0)
342 {
343 for(G4double d = initialValue; d <= finalValue; d += stepSize)
344 {
345 std::ostringstream os;
346 os << d;
347 cd += os.str();
348 cd += " ";
349 }
350 }
351 else
352 {
353 for(G4double d = initialValue; d >= finalValue; d += stepSize)
354 {
355 std::ostringstream os;
356 os << d;
357 cd += os.str();
358 cd += " ";
359 }
360 }
361 Foreach(macroFile, variableName, cd);
362}
363
364// --------------------------------------------------------------------
365void G4UImanager::ForeachS(const char* valueList)
366{
367 G4String vl = valueList;
368 G4Tokenizer parameterToken(vl);
369 G4String mf = parameterToken();
370 G4String vn = parameterToken();
371 G4String c1 = parameterToken();
372 G4String ca;
373 while(!((ca = parameterToken()).isNull()))
374 {
375 c1 += " ";
376 c1 += ca;
377 }
378
379 G4String aliasValue = c1;
380 if(aliasValue(0) == '"')
381 {
382 G4String strippedValue;
383 if(aliasValue(aliasValue.length() - 1) == '"')
384 {
385 strippedValue = aliasValue(1, aliasValue.length() - 2);
386 }
387 else
388 {
389 strippedValue = aliasValue(1, aliasValue.length() - 1);
390 }
391 aliasValue = strippedValue;
392 }
393
394 // Foreach(mf,vn,c1);
395 Foreach(mf, vn, aliasValue);
396}
397
398// --------------------------------------------------------------------
399void G4UImanager::Foreach(const char* macroFile, const char* variableName,
400 const char* candidates)
401{
402 G4String candidatesString = candidates;
403 G4Tokenizer parameterToken(candidatesString);
404 G4String cd;
405 while(!((cd = parameterToken()).isNull()))
406 {
407 G4String vl = variableName;
408 vl += " ";
409 vl += cd;
410 SetAlias(vl);
412 if(lastRC != 0)
413 {
415 ed << "Loop aborted due to a command execution error - "
416 << "error code " << lastRC;
417 G4Exception("G4UImanager::Foreach", "UIMAN0201", JustWarning, ed);
418 break;
419 }
420 }
421}
422
423// --------------------------------------------------------------------
425{
426 G4String aCommand = aCmd;
427 G4int ia = aCommand.index("{");
428 G4int iz = aCommand.index("#");
429 while((ia != G4int(std::string::npos)) &&
430 ((iz == G4int(std::string::npos)) || (ia < iz)))
431 {
432 G4int ibx = -1;
433 while(ibx < 0)
434 {
435 G4int ib = aCommand.index("}");
436 if(ib == G4int(std::string::npos))
437 {
438 G4cerr << aCommand << G4endl;
439 for(G4int i = 0; i < ia; ++i)
440 G4cerr << " ";
441 G4cerr << "^" << G4endl;
442 G4cerr << "Unmatched alias parenthesis -- command ignored" << G4endl;
443 G4String nullStr;
444 return nullStr;
445 }
446 G4String ps = aCommand(ia + 1, aCommand.length() - (ia + 1));
447 G4int ic = ps.index("{");
448 G4int id = ps.index("}");
449 if(ic != G4int(std::string::npos) && ic < id)
450 {
451 ia += ic + 1;
452 }
453 else
454 {
455 ibx = ib;
456 }
457 }
458 //--- Here ia represents the position of innermost "{"
459 //--- and ibx represents corresponding "}"
460 G4String subs;
461 if(ia > 0)
462 subs = aCommand(0, ia);
463 G4String alis = aCommand(ia + 1, ibx - ia - 1);
464 G4String rems = aCommand(ibx + 1, aCommand.length() - ibx);
465 G4String* alVal = aliasList->FindAlias(alis);
466 if(!alVal)
467 {
468 G4cerr << "Alias <" << alis << "> not found -- command ignored" << G4endl;
469 G4String nullStr;
470 return nullStr;
471 }
472 aCommand = subs + (*alVal) + rems;
473 ia = aCommand.index("{");
474 }
475 return aCommand;
476}
477
478// --------------------------------------------------------------------
480{
481 return ApplyCommand(aCmd.data());
482}
483
484// --------------------------------------------------------------------
486{
487 G4String aCommand = SolveAlias(aCmd);
488 if(aCommand.isNull())
489 return fAliasNotFound;
490 if(verboseLevel)
491 G4cout << aCommand << G4endl;
492 G4String commandString;
493 G4String commandParameter;
494
495 std::size_t i = aCommand.index(" ");
496 if(i != std::string::npos)
497 {
498 commandString = aCommand(0, i);
499 commandParameter = aCommand(i + 1, aCommand.length() - (i + 1));
500 }
501 else
502 {
503 commandString = aCommand;
504 }
505
506 // remove doubled slash
507 G4int len = commandString.length();
508 G4int ll = 0;
509 G4String a1;
510 G4String a2;
511 while(ll < len - 1)
512 {
513 if(commandString(ll, 2) == "//")
514 {
515 if(ll == 0)
516 {
517 commandString.remove(ll, 1);
518 }
519 else
520 {
521 a1 = commandString(0, ll);
522 a2 = commandString(ll + 1, len - ll - 1);
523 commandString = a1 + a2;
524 }
525 --len;
526 }
527 else
528 {
529 ++ll;
530 }
531 }
532
533 if(isMaster && bridges != nullptr)
534 {
535 for(auto itr = bridges->cbegin(); itr != bridges->cend(); ++itr)
536 {
537 G4int leng = (*itr)->DirLength();
538 if(commandString(0, leng) == (*itr)->DirName())
539 {
540 return (*itr)->LocalUI()->ApplyCommand(commandString + " " +
541 commandParameter);
542 }
543 }
544 }
545
546 G4UIcommand* targetCommand = treeTop->FindPath(commandString);
547 if(targetCommand == nullptr)
548 {
549 if(ignoreCmdNotFound)
550 {
551 if(stackCommandsForBroadcast)
552 {
553 commandStack->push_back(commandString + " " + commandParameter);
554 }
555 return fCommandSucceeded;
556 }
557 else
558 {
559 return fCommandNotFound;
560 }
561 }
562
563 if(stackCommandsForBroadcast && targetCommand->ToBeBroadcasted())
564 {
565 commandStack->push_back(commandString + " " + commandParameter);
566 }
567
568 if(!(targetCommand->IsAvailable()))
569 {
571 }
572
573 if(saveHistory)
574 historyFile << aCommand << G4endl;
575 if(G4int(histVec.size()) >= maxHistSize)
576 {
577 histVec.erase(histVec.begin());
578 }
579 histVec.push_back(aCommand);
580
581 targetCommand->ResetFailure();
582 G4int commandFailureCode = targetCommand->DoIt(commandParameter);
583 if(commandFailureCode == 0)
584 {
585 G4int additionalFailureCode = targetCommand->IfCommandFailed();
586 if(additionalFailureCode > 0)
587 {
589 msg << targetCommand->GetFailureDescription() << "\n"
590 << "Error code : " << additionalFailureCode;
591 G4Exception("G4UImanager::ApplyCommand", "UIMAN0123", JustWarning, msg);
592 commandFailureCode += additionalFailureCode;
593 }
594 }
595 return commandFailureCode;
596}
597
598// --------------------------------------------------------------------
599void G4UImanager::StoreHistory(const char* fileName)
600{
601 StoreHistory(true, fileName);
602}
603
604// --------------------------------------------------------------------
605void G4UImanager::StoreHistory(G4bool historySwitch, const char* fileName)
606{
607 if(historySwitch)
608 {
609 if(saveHistory)
610 {
611 historyFile.close();
612 }
613 historyFile.open((char*) fileName);
614 saveHistory = true;
615 }
616 else
617 {
618 historyFile.close();
619 saveHistory = false;
620 }
621 saveHistory = historySwitch;
622}
623
624// --------------------------------------------------------------------
625void G4UImanager::PauseSession(const char* msg)
626{
627 if(session)
628 session->PauseSessionStart(msg);
629}
630
631// --------------------------------------------------------------------
632void G4UImanager::ListCommands(const char* direct)
633{
634 G4UIcommandTree* comTree = FindDirectory(direct);
635 if(comTree != nullptr)
636 {
637 comTree->List();
638 }
639 else
640 {
641 G4cout << direct << " is not found." << G4endl;
642 }
643}
644
645// --------------------------------------------------------------------
646G4UIcommandTree* G4UImanager::FindDirectory(const char* dirName)
647{
648 G4String aDirName = dirName;
649 G4String targetDir = aDirName.strip(G4String::both);
650 if(targetDir(targetDir.length() - 1) != '/')
651 {
652 targetDir += "/";
653 }
654 G4UIcommandTree* comTree = treeTop;
655 if(targetDir == "/")
656 {
657 return comTree;
658 }
659 G4int idx = 1;
660 while(idx < G4int(targetDir.length()) - 1)
661 {
662 G4int i = targetDir.index("/", idx);
663 G4String targetDirString = targetDir(0, i + 1);
664 comTree = comTree->GetTree(targetDirString);
665 if(comTree == nullptr)
666 {
667 return nullptr;
668 }
669 idx = i + 1;
670 }
671 return comTree;
672}
673
674// --------------------------------------------------------------------
676{
677 if(pauseAtBeginOfEvent)
678 {
679 if(requestedState == G4State_EventProc &&
680 G4StateManager::GetStateManager()->GetPreviousState() ==
682 {
683 PauseSession("BeginOfEvent");
684 }
685 }
686 if(pauseAtEndOfEvent)
687 {
688 if(requestedState == G4State_GeomClosed &&
689 G4StateManager::GetStateManager()->GetPreviousState() ==
691 {
692 PauseSession("EndOfEvent");
693 }
694 }
695 return true;
696}
697
698// --------------------------------------------------------------------
700{
703}
704
705// --------------------------------------------------------------------
706void G4UImanager::SetAlias(const char* aliasLine)
707{
708 G4String aLine = aliasLine;
709 G4int i = aLine.index(" ");
710 G4String aliasName = aLine(0, i);
711 G4String aliasValue = aLine(i + 1, aLine.length() - (i + 1));
712 if(aliasValue(0) == '"')
713 {
714 G4String strippedValue;
715 if(aliasValue(aliasValue.length() - 1) == '"')
716 {
717 strippedValue = aliasValue(1, aliasValue.length() - 2);
718 }
719 else
720 {
721 strippedValue = aliasValue(1, aliasValue.length() - 1);
722 }
723 aliasValue = strippedValue;
724 }
725
726 aliasList->ChangeAlias(aliasName, aliasValue);
727}
728
729// --------------------------------------------------------------------
730void G4UImanager::RemoveAlias(const char* aliasName)
731{
732 G4String aL = aliasName;
733 G4String targetAlias = aL.strip(G4String::both);
734 aliasList->RemoveAlias(targetAlias);
735}
736
737// --------------------------------------------------------------------
739{
740 aliasList->List();
741}
742
743// --------------------------------------------------------------------
744void G4UImanager::CreateHTML(const char* dir)
745{
746 G4UIcommandTree* tr = FindDirectory(dir);
747 if(tr != nullptr)
748 {
749 tr->CreateHTML();
750 }
751 else
752 {
753 G4cerr << "Directory <" << dir << "> is not found." << G4endl;
754 }
755}
756
757// --------------------------------------------------------------------
759{
760 searchDirs.clear();
761
762 std::size_t idxfirst = 0;
763 std::size_t idxend = 0;
764 G4String pathstring = "";
765 while((idxend = searchPath.index(':', idxfirst)) != G4String::npos)
766 {
767 pathstring = searchPath.substr(idxfirst, idxend - idxfirst);
768 if(pathstring.size() != 0)
769 searchDirs.push_back(pathstring);
770 idxfirst = idxend + 1;
771 }
772
773 pathstring = searchPath.substr(idxfirst, searchPath.size() - idxfirst);
774 if(pathstring.size() != 0)
775 searchDirs.push_back(pathstring);
776}
777
778// --------------------------------------------------------------------
779static G4bool FileFound(const G4String& fname)
780{
781 G4bool qopen = false;
782 std::ifstream fs;
783 fs.open(fname.c_str(), std::ios::in);
784 if(fs.good())
785 {
786 fs.close();
787 qopen = true;
788 }
789 return qopen;
790}
791
792// --------------------------------------------------------------------
794{
795 G4String macrofile = fname;
796
797 for(std::size_t i = 0; i < searchDirs.size(); ++i)
798 {
799 G4String fullpath = searchDirs[i] + "/" + fname;
800 if(FileFound(fullpath))
801 {
802 macrofile = fullpath;
803 break;
804 }
805 }
806 return macrofile;
807}
808
809// --------------------------------------------------------------------
810std::vector<G4String>* G4UImanager::GetCommandStack()
811{
812 std::vector<G4String>* returnValue = commandStack;
813 commandStack = new std::vector<G4String>;
814 return returnValue;
815}
816
817// --------------------------------------------------------------------
819{
820 if(brg->LocalUI() == this)
821 {
822 G4Exception("G4UImanager::RegisterBridge()", "UI7002", FatalException,
823 "G4UIBridge cannot bridge between same object.");
824 }
825 else
826 {
827 bridges->push_back(brg);
828 }
829}
830
831// --------------------------------------------------------------------
833{
834 threadID = tId;
836 threadCout = new G4MTcoutDestination(threadID);
837 threadCout->SetIgnoreCout(igThreadID);
838}
839
840// --------------------------------------------------------------------
842{
846 threadCout = new G4MTcoutDestination(threadID);
847 threadCout->SetPrefixString(pref);
848 threadCout->SetIgnoreCout(igThreadID);
849}
850
851// --------------------------------------------------------------------
852void G4UImanager::SetCoutFileName(const G4String& fileN, G4bool ifAppend)
853{
854 // for sequential mode, ignore this method.
855 if(threadID < 0)
856 return;
857
858 if(fileN == "**Screen**")
859 {
860 threadCout->SetCoutFileName(fileN, ifAppend);
861 }
862 else
863 {
864 std::stringstream fn;
865 fn << "G4W_" << threadID << "_" << fileN;
866 threadCout->SetCoutFileName(fn.str(), ifAppend);
867 }
868}
869
870// --------------------------------------------------------------------
871void G4UImanager::SetCerrFileName(const G4String& fileN, G4bool ifAppend)
872{
873 // for sequential mode, ignore this method.
874 if(threadID < 0)
875 return;
876
877 if(fileN == "**Screen**")
878 {
879 threadCout->SetCerrFileName(fileN, ifAppend);
880 }
881 else
882 {
883 std::stringstream fn;
884 fn << "G4W_" << threadID << "_" << fileN;
885 threadCout->SetCerrFileName(fn.str(), ifAppend);
886 }
887}
888
889// --------------------------------------------------------------------
891{
892 // for sequential mode, ignore this method.
893 if(threadID < 0)
894 return;
895 threadCout->SetPrefixString(s);
896}
897
898// --------------------------------------------------------------------
900{
901 // for sequential mode, ignore this method.
902 if(threadID < 0)
903 return;
904 threadCout->EnableBuffering(flg);
905}
906
907// --------------------------------------------------------------------
909{
910 // for sequential mode, ignore this method.
911 if(threadID < 0)
912 {
913 igThreadID = tid;
914 return;
915 }
916 threadCout->SetIgnoreCout(tid);
917}
918
919// --------------------------------------------------------------------
921{
922 // for sequential mode, ignore this method.
923 if(threadID < 0)
924 {
925 return;
926 }
927 threadCout->SetIgnoreInit(flg);
928}
G4ApplicationState
@ G4State_EventProc
@ G4State_GeomClosed
@ JustWarning
@ FatalException
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
Definition: G4Exception.cc:35
std::ostringstream G4ExceptionDescription
Definition: G4Exception.hh:40
double G4double
Definition: G4Types.hh:83
bool G4bool
Definition: G4Types.hh:86
int G4int
Definition: G4Types.hh:85
@ fCommandNotFound
@ fAliasNotFound
@ fIllegalApplicationState
@ fCommandSucceeded
void G4iosFinalization()
Definition: G4ios.cc:112
G4GLOB_DLL std::ostream G4cerr
#define G4endl
Definition: G4ios.hh:57
G4GLOB_DLL std::ostream G4cout
void G4iosInitialization()
Definition: G4ios.cc:111
G4GLOB_DLL G4strstreambuf G4coutbuf
Definition: G4ios.cc:108
G4GLOB_DLL G4strstreambuf G4cerrbuf
Definition: G4ios.cc:109
void SetPrefixString(const G4String &wd="G4WT")
void EnableBuffering(G4bool flag=true)
void SetCoutFileName(const G4String &fileN="G4cout.txt", G4bool ifAppend=true)
void SetIgnoreInit(G4bool val=true)
void SetIgnoreCout(G4int tid=0)
void SetCerrFileName(const G4String &fileN="G4cerr.txt", G4bool ifAppend=true)
static G4StateManager * GetStateManager()
G4String & remove(str_size)
G4String & append(const G4String &)
str_size index(const char *, G4int pos=0) const
G4bool isNull() const
G4String strip(G4int strip_Type=trailing, char c=' ')
const char * data() const
G4String * FindAlias(const char *aliasName)
void ChangeAlias(const char *aliasName, const char *aliasValue)
void RemoveAlias(const char *aliasName)
G4UImanager * LocalUI() const
Definition: G4UIbridge.hh:55
G4UIcommandTree * GetTree(G4int i)
void List() const
void AddNewCommand(G4UIcommand *newCommand, G4bool workerThreadOnly=false)
G4UIcommand * FindPath(const char *commandPath) const
void RemoveCommand(G4UIcommand *aCommand, G4bool workerThreadOnly=false)
std::size_t GetParameterEntries() const
Definition: G4UIcommand.hh:138
G4UIparameter * GetParameter(G4int i) const
Definition: G4UIcommand.hh:139
G4bool ToBeBroadcasted() const
Definition: G4UIcommand.hh:173
G4int IfCommandFailed()
Definition: G4UIcommand.hh:189
virtual G4int DoIt(G4String parameterList)
Definition: G4UIcommand.cc:135
void ResetFailure()
Definition: G4UIcommand.hh:191
G4bool IsAvailable()
Definition: G4UIcommand.cc:328
const G4String & GetFailureDescription()
Definition: G4UIcommand.hh:190
G4String GetCurrentValue()
Definition: G4UIcommand.cc:267
static G4bool DoublePrecisionStr()
Definition: G4UImanager.cc:158
void SetCerrFileName(const G4String &fileN="G4cerr.txt", G4bool ifAppend=true)
Definition: G4UImanager.cc:871
void SetCoutDestination(G4UIsession *const value)
Definition: G4UImanager.cc:699
static void UseDoublePrecisionStr(G4bool val)
Definition: G4UImanager.cc:152
void ForeachS(const char *valueList)
Definition: G4UImanager.cc:365
void SetUpForAThread(G4int tId)
Definition: G4UImanager.cc:832
std::vector< G4String > * GetCommandStack()
Definition: G4UImanager.cc:810
void Foreach(const char *macroFile, const char *variableName, const char *candidates)
Definition: G4UImanager.cc:399
G4int ApplyCommand(const char *aCommand)
Definition: G4UImanager.cc:485
void SetThreadIgnoreInit(G4bool flg=true)
Definition: G4UImanager.cc:920
void CreateHTML(const char *dir="/")
Definition: G4UImanager.cc:744
void Loop(const char *macroFile, const char *variableName, G4double initialValue, G4double finalValue, G4double stepSize=1.0)
Definition: G4UImanager.cc:336
G4int GetCurrentIntValue(const char *aCommand, G4int parameterNumber=1, G4bool reGet=true)
Definition: G4UImanager.cc:231
void LoopS(const char *valueList)
Definition: G4UImanager.cc:315
void StoreHistory(const char *fileName="G4history.macro")
Definition: G4UImanager.cc:599
void ListCommands(const char *direc)
Definition: G4UImanager.cc:632
G4double GetCurrentDoubleValue(const char *aCommand, G4int parameterNumber=1, G4bool reGet=true)
Definition: G4UImanager.cc:258
void ExecuteMacroFile(const char *fileName)
Definition: G4UImanager.cc:303
void SetCoutFileName(const G4String &fileN="G4cout.txt", G4bool ifAppend=true)
Definition: G4UImanager.cc:852
static G4UImanager * GetMasterUIpointer()
Definition: G4UImanager.cc:91
G4String GetCurrentStringValue(const char *aCommand, G4int parameterNumber=1, G4bool reGet=true)
Definition: G4UImanager.cc:177
void SetUpForSpecialThread(G4String aPrefix)
Definition: G4UImanager.cc:841
void AddNewCommand(G4UIcommand *newCommand)
Definition: G4UImanager.cc:271
G4String GetCurrentValues(const char *aCommand)
Definition: G4UImanager.cc:164
virtual G4bool Notify(G4ApplicationState requestedState)
Definition: G4UImanager.cc:675
void SetThreadIgnore(G4int tid=0)
Definition: G4UImanager.cc:908
void SetAlias(const char *aliasLine)
Definition: G4UImanager.cc:706
void SetThreadPrefixString(const G4String &s="W")
Definition: G4UImanager.cc:890
G4String FindMacroPath(const G4String &fname) const
Definition: G4UImanager.cc:793
void RemoveAlias(const char *aliasName)
Definition: G4UImanager.cc:730
G4String SolveAlias(const char *aCmd)
Definition: G4UImanager.cc:424
void ListAlias()
Definition: G4UImanager.cc:738
void RemoveCommand(G4UIcommand *aCommand)
Definition: G4UImanager.cc:287
void ParseMacroSearchPath()
Definition: G4UImanager.cc:758
static G4UImanager * GetUIpointer()
Definition: G4UImanager.cc:77
void RegisterBridge(G4UIbridge *brg)
Definition: G4UImanager.cc:818
void SetThreadUseBuffer(G4bool flg=true)
Definition: G4UImanager.cc:899
const G4String & GetParameterName() const
virtual void PauseSessionStart(const G4String &Prompt)
Definition: G4UIsession.cc:63
virtual G4UIsession * SessionStart()
Definition: G4UIsession.cc:57
G4int GetLastReturnCode() const
Definition: G4UIsession.hh:63
void SetDestination(G4coutDestination *dest)
G4int G4GetThreadId()
Definition: G4Threading.cc:122
void G4SetThreadId(G4int aNewValue)
Definition: G4Threading.cc:125
#define G4ThreadLocalStatic
Definition: tls.hh:76