Geant4 10.7.0
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 ()
 
void SetNewValue (G4UIcommand *, G4String)
 
- Public Member Functions inherited from G4UImessenger
 G4UImessenger ()
 
 G4UImessenger (const G4String &path, const G4String &dsc, G4bool commandsToBeBroadcasted=true)
 
virtual ~G4UImessenger ()
 
virtual G4String GetCurrentValue (G4UIcommand *command)
 
virtual void SetNewValue (G4UIcommand *command, G4String newValue)
 
G4bool operator== (const G4UImessenger &messenger) const
 
G4bool operator!= (const G4UImessenger &messenger) const
 
G4bool CommandsShouldBeInMaster () const
 

Additional Inherited Members

- Protected Member Functions inherited from G4UImessenger
G4String ItoS (G4int i)
 
G4String DtoS (G4double a)
 
G4String BtoS (G4bool b)
 
G4int StoI (G4String s)
 
G4long StoL (G4String s)
 
G4double StoD (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 44 of file G4LocalThreadCoutMessenger.cc.

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

◆ ~G4LocalThreadCoutMessenger()

G4LocalThreadCoutMessenger::~G4LocalThreadCoutMessenger ( )

Definition at line 127 of file G4LocalThreadCoutMessenger.cc.

128{
129 delete coutFileNameCmd;
130 delete cerrFileNameCmd;
131 delete bufferCoutCmd;
132 delete prefixCmd;
133 delete ignoreCmd;
134 delete ignoreInitCmd;
135 delete coutDir;
136}

Member Function Documentation

◆ SetNewValue()

void G4LocalThreadCoutMessenger::SetNewValue ( G4UIcommand command,
G4String  newVal 
)
virtual

Reimplemented from G4UImessenger.

Definition at line 139 of file G4LocalThreadCoutMessenger.cc.

141{
143 if(command == coutFileNameCmd)
144 {
145 G4Tokenizer next(newVal);
146 G4String fn = next();
147 G4bool af = StoB(next());
148 UI->SetCoutFileName(fn, af);
149 }
150 else if(command == cerrFileNameCmd)
151 {
152 G4Tokenizer next(newVal);
153 G4String fn = next();
154 G4bool af = StoB(next());
155 UI->SetCerrFileName(fn, af);
156 }
157 else if(command == bufferCoutCmd)
158 {
159 UI->SetThreadUseBuffer(StoB(newVal));
160 }
161 else if(command == prefixCmd)
162 {
163 UI->SetThreadPrefixString(newVal);
164 }
165 else if(command == ignoreCmd)
166 {
167 UI->SetThreadIgnore(StoI(newVal));
168 }
169 else if(command == ignoreInitCmd)
170 {
171 UI->SetThreadIgnoreInit(StoB(newVal));
172 }
173}
bool G4bool
Definition: G4Types.hh:86
void SetCerrFileName(const G4String &fileN="G4cerr.txt", G4bool ifAppend=true)
Definition: G4UImanager.cc:871
void SetThreadIgnoreInit(G4bool flg=true)
Definition: G4UImanager.cc:920
void SetCoutFileName(const G4String &fileN="G4cout.txt", G4bool ifAppend=true)
Definition: G4UImanager.cc:852
void SetThreadIgnore(G4int tid=0)
Definition: G4UImanager.cc:908
void SetThreadPrefixString(const G4String &s="W")
Definition: G4UImanager.cc:890
static G4UImanager * GetUIpointer()
Definition: G4UImanager.cc:77
void SetThreadUseBuffer(G4bool flg=true)
Definition: G4UImanager.cc:899
G4int StoI(G4String s)
G4bool StoB(G4String s)

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