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

#include <G4LocalThreadCoutMessenger.hh>

+ Inheritance diagram for G4LocalThreadCoutMessenger:

Public Member Functions

 G4LocalThreadCoutMessenger ()
 
 ~G4LocalThreadCoutMessenger () override
 
void SetNewValue (G4UIcommand *, G4String) override
 
- Public Member Functions inherited from G4UImessenger
 G4UImessenger ()=default
 
 G4UImessenger (const G4String &path, const G4String &dsc, G4bool commandsToBeBroadcasted=true)
 
virtual ~G4UImessenger ()
 
virtual G4String GetCurrentValue (G4UIcommand *command)
 
G4bool CommandsShouldBeInMaster () const
 

Additional Inherited Members

- Protected Member Functions inherited from G4UImessenger
G4String ItoS (G4int i)
 
G4String LtoS (G4long l)
 
G4String DtoS (G4double a)
 
G4String BtoS (G4bool b)
 
G4int StoI (const G4String &s)
 
G4long StoL (const G4String &s)
 
G4double StoD (const G4String &s)
 
G4bool StoB (G4String s)
 
void AddUIcommand (G4UIcommand *newCommand)
 
void CreateDirectory (const G4String &path, const G4String &dsc, G4bool commandsToBeBroadcasted=true)
 
template<typename T >
T * CreateCommand (const G4String &cname, const G4String &dsc)
 
- Protected Attributes inherited from G4UImessenger
G4UIdirectorybaseDir = nullptr
 
G4String baseDirName = ""
 
G4bool commandsShouldBeInMaster = false
 

Detailed Description

Definition at line 46 of file G4LocalThreadCoutMessenger.hh.

Constructor & Destructor Documentation

◆ G4LocalThreadCoutMessenger()

G4LocalThreadCoutMessenger::G4LocalThreadCoutMessenger ( )

Definition at line 43 of file G4LocalThreadCoutMessenger.cc.

44{
45 coutDir = new G4UIdirectory("/control/cout/");
46 coutDir->SetGuidance("Control cout/cerr for local thread.");
47
48 coutFileNameCmd = new G4UIcommand("/control/cout/setCoutFile", this);
49 coutFileNameCmd->SetGuidance("Send G4cout stream to a file dedicated to a thread. ");
50 coutFileNameCmd->SetGuidance("To have a display output, use special keyword \"**Screen**\".");
51 coutFileNameCmd->SetGuidance("If append flag is true output is appended to file,");
52 coutFileNameCmd->SetGuidance("otherwise file output is overwritten.");
54 auto* pp = new G4UIparameter("fileName", 's', true);
55 pp->SetDefaultValue("**Screen**");
56 coutFileNameCmd->SetParameter(pp);
57 pp = new G4UIparameter("append", 'b', true);
58 pp->SetDefaultValue(1);
59 coutFileNameCmd->SetParameter(pp);
60
61 cerrFileNameCmd = new G4UIcommand("/control/cout/setCerrFile", this);
62 cerrFileNameCmd->SetGuidance("Send G4cerr stream to a file dedicated to a thread. ");
63 cerrFileNameCmd->SetGuidance("To have a display output, use special keyword \"**Screen**\".");
64 cerrFileNameCmd->SetGuidance("If append flag is true output is appended to file,");
65 cerrFileNameCmd->SetGuidance("otherwise file output is overwritten.");
67 pp = new G4UIparameter("fileName", 's', true);
68 pp->SetDefaultValue("**Screen**");
69 cerrFileNameCmd->SetParameter(pp);
70 pp = new G4UIparameter("append", 'b', true);
71 pp->SetDefaultValue(1);
72 cerrFileNameCmd->SetParameter(pp);
73
74 bufferCoutCmd = new G4UIcmdWithABool("/control/cout/useBuffer", this);
75 bufferCoutCmd->SetGuidance("Send cout and/or cerr stream to a buffer.");
76 bufferCoutCmd->SetGuidance("The buffered text will be printed at the end of the job");
77 bufferCoutCmd->SetGuidance(
78 "for each thread at a time, so that output of each thread is grouped.");
79 bufferCoutCmd->SetGuidance("This command has no effect if output goes to a file.");
80 bufferCoutCmd->SetParameterName("flag", true);
81 bufferCoutCmd->SetDefaultValue(true);
83
84 prefixCmd = new G4UIcmdWithAString("/control/cout/prefixString", this);
85 prefixCmd->SetGuidance("Set the prefix string for each cout/cerr line from a thread.");
86 prefixCmd->SetParameterName("prefix", true);
87 prefixCmd->SetDefaultValue("G4WT");
89
90 ignoreCmd = new G4UIcmdWithAnInteger("/control/cout/ignoreThreadsExcept", this);
91 ignoreCmd->SetGuidance("Omit cout from threads except the specified one.");
92 ignoreCmd->SetGuidance(
93 "This command takes effect only if cout destination "
94 "is screen without buffering.");
95 ignoreCmd->SetGuidance("If specified thread ID is greater than the number of threads,");
96 ignoreCmd->SetGuidance("no cout is displayed from worker threads. -1 to reset.");
97 ignoreCmd->SetGuidance("This command does not affect to cerr.");
98 ignoreCmd->SetParameterName("threadID", true);
99 ignoreCmd->SetDefaultValue(0);
101
102 ignoreInitCmd = new G4UIcmdWithABool("/control/cout/ignoreInitializationCout", this);
103 ignoreInitCmd->SetGuidance(
104 "Omit cout from threads during initialization, as "
105 "they should be identical to the master thread.");
106 ignoreInitCmd->SetGuidance(
107 "This command takes effect only if cout "
108 "destination is screen without buffering.");
109 ignoreInitCmd->SetGuidance("This command does not affect to cerr.");
110 ignoreInitCmd->SetParameterName("IgnoreInit", true);
111 ignoreInitCmd->SetDefaultValue(true);
113}
@ G4State_Idle
@ G4State_PreInit
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
void SetDefaultValue(G4bool defVal)
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
void SetDefaultValue(const char *defVal)
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
void SetDefaultValue(G4int defVal)
void SetParameter(G4UIparameter *const newParameter)
void SetGuidance(const char *aGuidance)
void AvailableForStates(G4ApplicationState s1)

◆ ~G4LocalThreadCoutMessenger()

G4LocalThreadCoutMessenger::~G4LocalThreadCoutMessenger ( )
override

Definition at line 116 of file G4LocalThreadCoutMessenger.cc.

117{
118 delete coutFileNameCmd;
119 delete cerrFileNameCmd;
120 delete bufferCoutCmd;
121 delete prefixCmd;
122 delete ignoreCmd;
123 delete ignoreInitCmd;
124 delete coutDir;
125}

Member Function Documentation

◆ SetNewValue()

void G4LocalThreadCoutMessenger::SetNewValue ( G4UIcommand * command,
G4String newVal )
overridevirtual

Reimplemented from G4UImessenger.

Definition at line 128 of file G4LocalThreadCoutMessenger.cc.

129{
131 if (command == coutFileNameCmd) {
132 G4Tokenizer next(newVal);
133 G4String fn = next();
134 G4bool af = StoB(next());
135 UI->SetCoutFileName(fn, af);
136 }
137 else if (command == cerrFileNameCmd) {
138 G4Tokenizer next(newVal);
139 G4String fn = next();
140 G4bool af = StoB(next());
141 UI->SetCerrFileName(fn, af);
142 }
143 else if (command == bufferCoutCmd) {
144 UI->SetThreadUseBuffer(StoB(newVal));
145 }
146 else if (command == prefixCmd) {
147 UI->SetThreadPrefixString(newVal);
148 }
149 else if (command == ignoreCmd) {
150 UI->SetThreadIgnore(StoI(newVal));
151 }
152 else if (command == ignoreInitCmd) {
153 UI->SetThreadIgnoreInit(StoB(newVal));
154 }
155}
bool G4bool
Definition G4Types.hh:86
void SetCerrFileName(const G4String &fileN="G4cerr.txt", G4bool ifAppend=true)
void SetThreadIgnoreInit(G4bool flg=true)
void SetThreadPrefixString(const G4String &prefix="W")
void SetCoutFileName(const G4String &fileN="G4cout.txt", G4bool ifAppend=true)
void SetThreadIgnore(G4int tid=0)
static G4UImanager * GetUIpointer()
void SetThreadUseBuffer(G4bool flg=true)
G4bool StoB(G4String s)
G4int StoI(const G4String &s)

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