Geant4  v4-10.4-release
 모두 클래스 네임스페이스들 파일들 함수 변수 타입정의 열거형 타입 열거형 멤버 Friends 매크로 그룹들 페이지들
G4VisCommandsMultithreading.cc
이 파일의 문서화 페이지로 가기
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 //
27 // $Id: G4VisCommandsMultithreading.cc 88742 2015-03-08 13:12:57Z allison $
28 
29 // /vis/multithreading commands - John Allison 29th September 2015
30 
31 #include "G4Types.hh"
32 #ifdef G4MULTITHREADED
33 
35 
36 #include "G4UIcmdWithAnInteger.hh"
37 #include "G4UIcmdWithAString.hh"
38 #include "G4VisManager.hh"
39 
41 
42 G4VisCommandMultithreadingActionOnEventQueueFull::G4VisCommandMultithreadingActionOnEventQueueFull()
43 {
44  G4bool omitable;
45  fpCommand = new G4UIcmdWithAString("/vis/multithreading/actionOnEventQueueFull", this);
46  fpCommand->SetGuidance("When event queue for drawing gets full:");
47  fpCommand->SetGuidance("wait: event processing waits for vis manager to catch up.");
48  fpCommand->SetGuidance("discard: events are discarded for drawing.");
49  fpCommand->SetCandidates("wait discard");
50  fpCommand->SetParameterName ("wait", omitable = true);
51  fpCommand->SetDefaultValue ("wait");
52 }
53 
54 G4VisCommandMultithreadingActionOnEventQueueFull::~G4VisCommandMultithreadingActionOnEventQueueFull()
55 {
56  delete fpCommand;
57 }
58 
59 G4String G4VisCommandMultithreadingActionOnEventQueueFull::GetCurrentValue(G4UIcommand*)
60 {
61  return "";
62 }
63 
64 void G4VisCommandMultithreadingActionOnEventQueueFull::SetNewValue(G4UIcommand*, G4String newValue)
65 {
66  G4VisManager::Verbosity verbosity = fpVisManager->GetVerbosity();
67 
68  if (newValue == "wait") {
69  fpVisManager->SetWaitOnEventQueueFull(true);
70  } else {
71  fpVisManager->SetWaitOnEventQueueFull(false);
72  }
73 
74  if (verbosity >= G4VisManager::confirmations) {
75  G4cout <<
76  "When event queue for drawing is full,";
77  if (fpVisManager->GetWaitOnEventQueueFull()) {
78  G4cout << " event processing will wait";
79  } else {
80  G4cout << " events will be discarded for drawing";
81  }
82  G4cout << G4endl;
83  }
84 }
85 
87 
88 G4VisCommandMultithreadingMaxEventQueueSize::G4VisCommandMultithreadingMaxEventQueueSize()
89 {
90  G4bool omitable;
91  fpCommand = new G4UIcmdWithAnInteger("/vis/multithreading/maxEventQueueSize", this);
92  fpCommand->SetGuidance
93  ("Defines maximum event queue size. N <=0 means \"unlimited\".");
94  fpCommand->SetGuidance
95  ("If adding an event to the visualisation event queue would cause the"
96  " queue size to exceed this value:");
97  fpCommand->SetGuidance
98  (" if actionOnEventQueueFull==wait the worker threads are paused for a short"
99  " time to give the visualisation manager a chance to catch up.");
100  fpCommand->SetGuidance
101  (" if actionOnEventQueueFull==discard the event is discarded for drawing.");
102  fpCommand->SetParameterName ("maxSize", omitable = true);
103  fpCommand->SetDefaultValue (100);
104 }
105 
106 G4VisCommandMultithreadingMaxEventQueueSize::~G4VisCommandMultithreadingMaxEventQueueSize()
107 {
108  delete fpCommand;
109 }
110 
111 G4String G4VisCommandMultithreadingMaxEventQueueSize::GetCurrentValue(G4UIcommand*)
112 {
113  return "";
114 }
115 
116 void G4VisCommandMultithreadingMaxEventQueueSize::SetNewValue(G4UIcommand*, G4String newValue)
117 {
118  G4VisManager::Verbosity verbosity = fpVisManager->GetVerbosity();
119 
120  G4int maxEventQueueSize = fpCommand->GetNewIntValue(newValue);
121  fpVisManager->SetMaxEventQueueSize(maxEventQueueSize);
122 
123  if (verbosity >= G4VisManager::confirmations) {
124  G4cout <<
125  "Maximum event queue size has been set to "
126  << fpVisManager->GetMaxEventQueueSize()
127  << G4endl;
128  }
129 }
130 
131 #endif
#define G4endl
Definition: G4ios.hh:61
bool G4bool
Definition: G4Types.hh:79
int G4int
Definition: G4Types.hh:78
G4GLOB_DLL std::ostream G4cout