34 #define G4VIS_USE_STD11
85 #ifdef G4MULTITHREADED
93 #ifdef G4VIS_USE_STD11
105 fInitialised (false),
106 fpGraphicsSystem (0),
110 fpStateDependent (0),
111 fEventRefreshing (false),
112 fTransientsDrawnThisRun (false),
113 fTransientsDrawnThisEvent (false),
114 fNoOfEventsDrawnThisRun (0),
116 fEventKeepingSuspended (false),
117 fKeptLastEvent (false),
118 fpRequestedEvent (0),
119 fAbortReviewKeptEvents (false),
120 fIsDrawGroup (false),
121 fDrawGroupNestingDepth (0),
122 fIgnoreStateChanges (false)
123 #ifdef G4MULTITHREADED
124 , fMaxEventQueueSize (100)
125 , fWaitOnEventQueueFull (true)
135 (
"Simple graded message scheme - digit or string (1st character defines):");
137 (
" 0) quiet, // Nothing is printed.");
139 (
" 1) startup, // Startup and endup messages are printed...");
141 (
" 2) errors, // ...and errors...");
143 (
" 3) warnings, // ...and warnings...");
145 (
" 4) confirmations, // ...and confirming messages...");
147 (
" 5) parameters, // ...and parameters of scenes and views...");
149 (
" 6) all // ...and everything available.");
153 (
"G4VisManager::G4VisManager",
155 "Attempt to Construct more than one VisManager");
167 <<
"Visualization Manager instantiating with verbosity \""
200 directory -> SetGuidance (
"Visualization commands.");
230 G4cout <<
"Visualization Manager deleting..." <<
G4endl;
248 (
"G4VisManager::GetInstance",
257 G4cout <<
"WARNING: G4VisManager::Initialise: already initialised."
263 G4cout <<
"Visualization Manager initialising..." <<
G4endl;
268 "\nYou have instantiated your own Visualization Manager, inheriting"
269 "\n G4VisManager and implementing RegisterGraphicsSystems(), in which"
270 "\n you should, normally, instantiate drivers which do not need"
271 "\n external packages or libraries, and, optionally, drivers under"
272 "\n control of environment variables."
273 "\n Also you should implement RegisterModelFactories()."
274 "\n See visualization/include/G4VisExecutive.hh/icc, for example."
275 "\n In your main() you will have something like:"
276 "\n #ifdef G4VIS_USE"
277 "\n G4VisManager* visManager = new G4VisExecutive;"
278 "\n visManager -> SetVerboseLevel (Verbose);"
279 "\n visManager -> Initialize ();"
281 "\n (Don't forget to delete visManager;)"
294 "\nYou have successfully registered the following graphics systems."
304 directory -> SetGuidance (
"Modeling commands.");
306 directory =
new G4UIdirectory (
"/vis/modeling/trajectories/");
307 directory -> SetGuidance (
"Trajectory model commands.");
309 directory =
new G4UIdirectory (
"/vis/modeling/trajectories/create/");
310 directory -> SetGuidance (
"Create trajectory models and messengers.");
315 directory -> SetGuidance (
"Filtering commands.");
317 directory =
new G4UIdirectory (
"/vis/filtering/trajectories/");
318 directory -> SetGuidance (
"Trajectory filtering commands.");
320 directory =
new G4UIdirectory (
"/vis/filtering/trajectories/create/");
321 directory -> SetGuidance (
"Create trajectory filters and messengers.");
324 directory -> SetGuidance (
"Hit filtering commands.");
326 directory =
new G4UIdirectory (
"/vis/filtering/hits/create/");
327 directory -> SetGuidance (
"Create hit filters and messengers.");
330 directory -> SetGuidance (
"Digi filtering commands.");
332 directory =
new G4UIdirectory (
"/vis/filtering/digi/create/");
333 directory -> SetGuidance (
"Create digi filters and messengers.");
346 "\nYou have successfully registered the following model factories."
391 directory -> SetGuidance(
"Operations on vis attributes of Geant4 geometry.");
397 directory -> SetGuidance(
"Set vis attributes of Geant4 geometry.");
409 #ifdef G4MULTITHREADED
411 directory -> SetGuidance(
"Commands unique to multithreading mode.");
418 directory -> SetGuidance
419 (
"Set quantities for use in future commands where appropriate.");
429 directory -> SetGuidance (
"Operations on Geant4 scenes.");
440 directory -> SetGuidance (
"Add model to current scene.");
466 directory -> SetGuidance (
"Operations on Geant4 scene handlers.");
474 directory -> SetGuidance (
"Operations on touchables.");
479 directory -> SetGuidance (
"Set vis attributes of current touchable.");
484 directory -> SetGuidance (
"Operations on Geant4 viewers.");
508 directory -> SetGuidance(
"Set default values for future viewers.");
514 directory -> SetGuidance (
"Set view parameters of current viewer.");
547 G4cout <<
"G4VisManager::Enable: visualization enabled." <<
G4endl;
553 "G4VisManager::Enable: WARNING: visualization remains disabled for"
554 "\n above reasons. Rectifying with valid vis commands will"
555 "\n automatically enable."
565 "G4VisManager::Disable: visualization disabled."
566 "\n The pointer returned by GetConcreteInstance will be zero."
567 "\n Note that it will become enabled after some valid vis commands."
576 G4cout <<
"G4VisManager::GetAvailableGraphicsSystems: WARNING: no"
577 "\n graphics system available!"
578 "\n 1) Did you have environment variables G4VIS_BUILD_xxxx_DRIVER set"
579 "\n when you compiled/built the visualization code?"
580 "\n 2) Did you instantiate your own Visualization Manager and forget"
581 "\n to implement RegisterGraphicsSystems correctly?"
582 "\n 3) You can register your own graphics system, e.g.,"
583 "\n visManager->RegisterGraphicsSystem(new MyGraphicsSystem);)"
584 "\n after instantiating your vis manager and before"
585 "\n visManager->Initialize()."
597 G4cout <<
"G4VisManager::RegisterGraphicsSystem: "
598 << pSystem -> GetName ();
599 if (pSystem -> GetNickname () !=
"") {
600 G4cout <<
" (" << pSystem -> GetNickname () <<
")";
607 G4cout <<
"G4VisManager::RegisterGraphicsSystem: null pointer!"
628 G4cout<<
"G4VisManager: Using G4TrajectoryDrawByCharge as default trajectory model."<<
G4endl;
629 G4cout<<
"See commands in /vis/modeling/trajectories/ for other options."<<
G4endl;
690 #ifdef G4MULTITHREADED
696 (
"G4VisManager::BeginDraw",
698 "Nesting detected. It is illegal to nest Begin/EndDraw."
711 #ifdef G4MULTITHREADED
727 #ifdef G4MULTITHREADED
733 (
"G4VisManager::BeginDraw2D",
735 "Nesting detected. It is illegal to nest Begin/EndDraw2D."
748 #ifdef G4MULTITHREADED
764 #ifdef G4MULTITHREADED
768 if (objectTransform != fpSceneHandler->GetObjectTransformation()) {
770 (
"G4VSceneHandler::DrawT",
772 "Different transform detected in Begin/EndDraw group.");
774 fpSceneHandler -> AddPrimitive (graphics_primitive);
776 if (IsValidView ()) {
777 ClearTransientStoreIfMarked();
778 fpSceneHandler -> BeginPrimitives (objectTransform);
779 fpSceneHandler -> AddPrimitive (graphics_primitive);
780 fpSceneHandler -> EndPrimitives ();
787 #ifdef G4MULTITHREADED
791 if (objectTransform != fpSceneHandler->GetObjectTransformation()) {
793 (
"G4VSceneHandler::DrawT",
795 "Different transform detected in Begin/EndDraw2D group.");
797 fpSceneHandler -> AddPrimitive (graphics_primitive);
799 if (IsValidView ()) {
800 ClearTransientStoreIfMarked();
801 fpSceneHandler -> BeginPrimitives2D (objectTransform);
802 fpSceneHandler -> AddPrimitive (graphics_primitive);
803 fpSceneHandler -> EndPrimitives2D ();
811 DrawT (circle, objectTransform);
817 DrawT (polyhedron, objectTransform);
823 DrawT (line, objectTransform);
829 DrawT (polymarker, objectTransform);
835 DrawT (scale, objectTransform);
841 DrawT (square, objectTransform);
847 DrawT (text, objectTransform);
853 DrawT2D (circle, objectTransform);
859 DrawT2D (polyhedron, objectTransform);
865 DrawT2D (line, objectTransform);
871 DrawT2D (polymarker, objectTransform);
877 DrawT2D (square, objectTransform);
883 DrawT2D (text, objectTransform);
887 #ifdef G4MULTITHREADED
901 #ifdef G4MULTITHREADED
915 #ifdef G4MULTITHREADED
922 #ifdef G4MULTITHREADED
953 #ifdef G4MULTITHREADED
958 Draw (*pSol, attribs, objectTransform);
964 #ifdef G4MULTITHREADED
984 #ifdef G4MULTITHREADED
1000 G4VSolid* pSol = pLV -> GetSolid ();
1001 Draw (*pSol, attribs, objectTransform);
1009 if (pSceneHandler) {
1015 G4cout <<
"ERROR in G4VisManager::CreateSceneHandler during "
1017 <<
" scene handler creation.\n No action taken."
1029 if (!fInitialised) Initialise ();
1031 if (!fpSceneHandler) {
1032 PrintInvalidPointers ();
1036 G4VViewer* p = fpGraphicsSystem -> CreateViewer (*fpSceneHandler, name);
1039 if (fVerbosity >= errors) {
1040 G4cerr <<
"ERROR in G4VisManager::CreateViewer during "
1041 << fpGraphicsSystem -> GetName ()
1042 <<
" viewer creation.\n No action taken."
1048 if (p -> GetViewId() < 0) {
1049 if (fVerbosity >= errors) {
1050 G4cerr <<
"ERROR in G4VisManager::CreateViewer during "
1051 << fpGraphicsSystem -> GetName ()
1052 <<
" viewer initialisation.\n No action taken."
1063 p -> SetViewParameters(initialvp);
1067 fpSceneHandler -> AddViewerToList (fpViewer);
1068 fpSceneHandler -> SetCurrentViewer (fpViewer);
1069 if (fVerbosity >= confirmations) {
1070 G4cout <<
"G4VisManager::CreateViewer: new viewer created."
1075 if (fVerbosity >= parameters) {
1080 static G4bool warned =
false;
1081 if (fVerbosity >= confirmations) {
1084 "NOTE: objects with visibility flag set to \"false\""
1085 " will not be drawn!"
1086 "\n \"/vis/viewer/set/culling global false\" to Draw such objects."
1087 "\n Also see other \"/vis/viewer/set\" commands."
1094 static G4bool warned =
false;
1095 if (fVerbosity >= warnings) {
1098 "WARNING: covered objects in solid mode will not be rendered!"
1099 "\n \"/vis/viewer/set/culling coveredDaughters false\" to reverse this."
1100 "\n Also see other \"/vis/viewer/set\" commands."
1110 G4cout <<
"G4VisManager::GeometryHasChanged() called." <<
G4endl;
1116 -> GetNavigatorForTracking () -> GetWorldVolume ();
1119 G4cout <<
"WARNING: There is no world volume!" <<
G4endl;
1125 G4int iScene, nScenes = sceneList.size ();
1126 for (iScene = 0; iScene < nScenes; iScene++) {
1127 G4Scene* pScene = sceneList [iScene];
1128 std::vector<G4Scene::Model>& modelList = pScene -> SetRunDurationModelList ();
1129 if (modelList.size ()) {
1132 modelInvalid =
false;
1133 std::vector<G4Scene::Model>::iterator iterModel;
1134 for (iterModel = modelList.begin();
1135 iterModel != modelList.end();
1141 G4cout <<
"WARNING: Model \""
1142 << iterModel->fpModel->GetGlobalDescription ()
1144 "\" is no longer valid - being removed\n from scene \""
1145 << pScene -> GetName () <<
"\""
1148 modelList.erase (iterModel);
1152 }
while (modelInvalid);
1154 if (modelList.size () == 0) {
1156 G4cout <<
"WARNING: No models left in this scene \""
1157 << pScene -> GetName ()
1165 ApplyCommand (
G4String(
"/vis/scene/notifyHandlers " + pScene->
GetName()));
1171 if (
fpScene &&
fpScene -> GetRunDurationModelList ().size () == 0) {
1173 G4cout <<
"WARNING: The current scene \""
1175 <<
"\" has no models."
1184 G4cout <<
"G4VisManager::NotifyHandler() called." <<
G4endl;
1189 G4int iScene, nScenes = sceneList.size ();
1190 for (iScene = 0; iScene < nScenes; iScene++) {
1191 G4Scene* pScene = sceneList [iScene];
1192 std::vector<G4Scene::Model>& modelList = pScene -> SetRunDurationModelList ();
1194 if (modelList.size ()) {
1197 ApplyCommand (
G4String(
"/vis/scene/notifyHandlers " + pScene->
GetName()));
1202 if (
fpScene &&
fpScene -> GetRunDurationModelList ().size () == 0) {
1204 G4cout <<
"WARNING: The current scene \""
1206 <<
"\" has no models."
1246 assert (0 != trajectoryModel);
1249 trajectoryModel->
Draw(trajectory, visible);
1257 fRunDurationUserVisActions.push_back(
UserVisAction(name,pVisAction));
1259 fUserVisActionExtents[pVisAction] = extent;
1261 if (fVerbosity >= warnings) {
1263 "WARNING: No extent set for user vis action \"" << name <<
"\"."
1273 fEndOfEventUserVisActions.push_back(
UserVisAction(name,pVisAction));
1275 fUserVisActionExtents[pVisAction] = extent;
1277 if (fVerbosity >= warnings) {
1279 "WARNING: No extent set for user vis action \"" << name <<
"\"."
1289 fEndOfRunUserVisActions.push_back(
UserVisAction(name,pVisAction));
1291 fUserVisActionExtents[pVisAction] = extent;
1293 if (fVerbosity >= warnings) {
1295 "WARNING: No extent set for user vis action \"" << name <<
"\"."
1313 G4cout <<
"G4VisManager::SetCurrentGraphicsSystem: system now "
1314 << pSystem -> GetName () <<
G4endl;
1321 G4int nSH = sceneHandlerList.size ();
1323 for (iSH = nSH - 1; iSH >= 0; iSH--) {
1324 if (sceneHandlerList [iSH] -> GetGraphicsSystem () == pSystem)
break;
1329 G4cout <<
" Scene Handler now "
1335 G4cout <<
" Scene now \""
1340 if (viewerList.size ()) {
1360 G4cout <<
"G4VisManager::SetCurrentSceneHandler: scene handler now \""
1361 << pSceneHandler -> GetName () <<
"\"" <<
G4endl;
1366 G4cout <<
" Scene now \""
1373 G4cout <<
" Graphics system now \""
1378 G4int nViewers = viewerList.size ();
1381 for (iViewer = 0; iViewer < nViewers; iViewer++) {
1382 if (
fpViewer == viewerList [iViewer])
break;
1384 if (iViewer >= nViewers) {
1394 "WARNING: Problem setting scene handler - please report circumstances."
1403 "WARNING: No viewers for this scene handler - please create one."
1412 G4cout <<
"G4VisManager::SetCurrentViewer: viewer now "
1413 << pViewer -> GetName ()
1420 "WARNING: No scene handler for this viewer - please create one."
1431 "WARNING: Problem setting viewer - please report circumstances."
1439 G4cout <<
"Current available graphics systems are:\n";
1442 const G4String& name = gs->GetName();
1443 const std::vector<G4String>& nicknames = gs->GetNicknames();
1447 for (
size_t i = 0; i < nicknames.size(); ++i) {
1461 G4cout <<
"\n NONE!!! None registered - yet! Mmmmm!" <<
G4endl;
1470 const std::vector<G4VModelFactory<G4VTrajectoryModel>*>& factoryList =
1472 if (factoryList.empty())
G4cout <<
" None" << G4endl;
1474 std::vector<G4VModelFactory<G4VTrajectoryModel>*>::const_iterator i;
1475 for (i = factoryList.begin(); i != factoryList.end(); ++i)
1480 const std::map<G4String, G4VTrajectoryModel*>& modelMap =
1482 if (!modelMap.empty()) {
1484 std::map<G4String, G4VTrajectoryModel*>::const_iterator i;
1485 for (i = modelMap.begin(); i != modelMap.end(); ++i) {
1486 G4cout <<
" " << i->second->Name();
1487 if (i->second == listManager->
Current())
G4cout <<
" (Current)";
1499 const std::vector<G4VModelFactory<G4VFilter<G4VTrajectory> >*>&
1501 if (factoryList.empty())
G4cout <<
" None" << G4endl;
1503 std::vector<G4VModelFactory<G4VFilter<G4VTrajectory> >*>::const_iterator i;
1504 for (i = factoryList.begin(); i != factoryList.end(); ++i)
1507 const std::vector<G4VFilter<G4VTrajectory>*>&
1509 if (!filterList.empty()) {
1511 std::vector<G4VFilter<G4VTrajectory>*>::const_iterator i;
1512 for (i = filterList.begin(); i != filterList.end(); ++i) {
1523 "You have successfully registered the following user vis actions."
1525 G4cout <<
"Run Duration User Vis Actions:";
1535 G4cout <<
"End of Event User Vis Actions:";
1545 G4cout <<
"End of Run User Vis Actions:";
1558 "Some /vis commands (optionally) take a string to specify colour."
1559 "\nAvailable colours:\n ";
1561 for (std::map<G4String, G4Colour>::const_iterator i = map.begin();
1564 if (++i != map.end())
G4cout <<
", ";
1571 G4cerr <<
"ERROR: G4VisManager::PrintInvalidPointers:";
1573 G4cerr <<
"\n null graphics system pointer.";
1580 "\n Null scene pointer. Use \"/vis/drawVolume\" or"
1581 " \"/vis/scene/create\".";
1584 "\n Null scene handler pointer. Use \"/vis/open\" or"
1585 " \"/vis/sceneHandler/create\".";
1588 "\n Null viewer pointer. Use \"/vis/viewer/create\".";
1594 #ifdef G4MULTITHREADED
1597 G4bool mtRunInProgress =
false;
1598 std::deque<const G4Event*> mtVisEventQueue;
1607 if (!pSceneHandler)
return 0;
1609 if (!pScene)
return 0;
1611 if (!pViewer)
return 0;
1621 pViewer->SwitchToVisSubThread();
1626 G4int eventQueueSize = mtVisEventQueue.size();
1630 while (eventQueueSize) {
1633 const G4Event*
event = mtVisEventQueue.front();
1675 mtVisEventQueue.pop_front();
1676 event->PostProcessingFinished();
1677 eventQueueSize = mtVisEventQueue.size();
1683 G4int runInProgress = mtRunInProgress;
1685 if (!runInProgress)
break;
1688 #ifdef G4VIS_USE_STD11
1689 std::this_thread::sleep_for(std::chrono::milliseconds(100));
1696 pViewer->DoneWithVisSubThread();
1697 pViewer->MovingToMasterThread();
1714 #ifdef G4MULTITHREADED
1721 #ifdef G4MULTITHREADED
1729 if (nEventsToBeProcessed == 0)
return;
1738 #ifdef G4MULTITHREADED
1752 mtRunInProgress =
true;
1775 #ifndef G4MULTITHREADED
1797 #ifdef G4MULTITHREADED
1804 #ifdef G4MULTITHREADED
1811 if (!currentRun)
return;
1816 if (!currentEvent)
return;
1820 #ifdef G4MULTITHREADED
1824 G4int eventQueueSize = mtVisEventQueue.size();
1828 G4bool eventQueueFull =
false;
1829 while (fMaxEventQueueSize > 0 && eventQueueSize >= fMaxEventQueueSize) {
1832 if (fWaitOnEventQueueFull) {
1833 static G4bool warned =
false;
1836 "WARNING: The number of events in the visualisation queue has exceeded"
1838 << fMaxEventQueueSize <<
1839 ".\n If, during a multithreaded run, the simulation gets ahead of the"
1840 "\n visualisation by more than this maximum, the simulation is delayed"
1841 "\n until the vis sub-thread has drawn a few more events and removed them"
1842 "\n from the queue. You may change this maximum number of events with"
1843 "\n \"/vis/multithreading/maxEventQueueSize <N>\", where N is the maximum"
1844 "\n number you wish to allow. N <= 0 means \"unlimited\"."
1845 "\n Alternatively you may choose to discard events for drawing by setting"
1846 "\n \"/vis/multithreading/actionOnEventQueueFull discard\"."
1847 "\n To avoid visualisation altogether: \"/vis/disable\"."
1848 "\n And maybe \"/tracking/storeTrajectories 0\"."
1854 #ifdef G4VIS_USE_STD11
1855 std::this_thread::sleep_for(std::chrono::milliseconds(100));
1861 static G4bool warned =
false;
1864 "WARNING: The number of events in the visualisation queue has exceeded"
1866 << fMaxEventQueueSize <<
1867 ".\n Some events have been discarded for drawing. You may change this"
1868 "\n behaviour with \"/vis/multithreading/actionOnEventQueueFull wait\"."
1869 "\n To avoid visualisation altogether: \"/vis/disable\"."
1870 "\n And maybe \"/tracking/storeTrajectories 0\"."
1874 eventQueueFull =
true;
1879 eventQueueSize = mtVisEventQueue.size();
1883 if (!eventQueueFull) {
1887 mtVisEventQueue.push_back(currentEvent);
1902 G4int nEventsToBeProcessed = 0;
1903 G4int nKeptEvents = 0;
1908 const std::vector<const G4Event*>* events = currentRun->
GetEventVector();
1909 if (events) nKeptEvents = events->size();
1929 if (eventID < nEventsToBeProcessed - 1) {
1938 if (nKeptEvents == 0) {
1957 if (maxNumberOfKeptEvents > 0 &&
1961 static G4bool warned =
false;
1965 "WARNING: G4VisManager::EndOfEvent: Automatic event keeping suspended."
1966 "\n The number of events exceeds the maximum, "
1967 << maxNumberOfKeptEvents <<
1968 ", that may be kept by\n the vis manager."
1974 }
else if (maxNumberOfKeptEvents != 0) {
1992 #ifdef G4MULTITHREADED
2000 #ifdef G4MULTITHREADED
2008 if (nEventsToBeProcessed == 0)
return;
2011 if (!currentRun)
return;
2013 #ifdef G4MULTITHREADED
2018 mtRunInProgress =
false;
2022 delete mtVisSubThread;
2027 #ifdef G4MULTITHREADED
2033 <<
"WARNING: Number of events drawn this run, "
2035 << noOfEventsRequested <<
2036 ".\n (This is because you requested \"/vis/multithreading/actionOnEventQueueFull discard\".)"
2043 G4int nKeptEvents = 0;
2044 const std::vector<const G4Event*>* events = currentRun->
GetEventVector();
2045 if (events) nKeptEvents = events->size();
2048 G4cout <<
"WARNING: " << nKeptEvents;
2049 if (nKeptEvents == 1)
G4cout <<
" event has";
2050 else G4cout <<
" events have";
2051 G4cout <<
" been kept for refreshing and/or reviewing." <<
G4endl;
2055 G4cout <<
"No keep requests were";
2057 G4cout <<
"Only 1 keep request was";
2063 G4cout <<
" \"/vis/reviewKeptEvents\" to review them." <<
G4endl;
2084 "WARNING: G4VisManager::EndOfRun: Automatic event keeping was suspended."
2085 "\n The number of events in the run exceeded the maximum, "
2087 ", that may be\n kept by the vis manager." <<
2088 "\n The number of events kept by the vis manager can be changed with"
2089 "\n \"/vis/scene/endOfEventAction accumulate <N>\", where N is the"
2090 "\n maximum number you wish to allow. N < 0 means \"unlimited\"."
2123 G4cout <<
"\"/vis/viewer/update\" to close file." <<
G4endl;
2153 (*i)->SetTransientsDrawnThisEvent(
false);
2154 (*i)->SetTransientsDrawnThisRun(
false);
2159 G4String viewerShortName (viewerName);
2160 viewerShortName = viewerShortName (0, viewerShortName.find (
' '));
2161 return viewerShortName.
strip ();
2167 size_t iHandler, iViewer;
2170 for (iHandler = 0; iHandler < nHandlers; iHandler++) {
2172 const G4ViewerList& viewerList = sceneHandler -> GetViewerList ();
2173 for (iViewer = 0; iViewer < viewerList.size (); iViewer++) {
2174 viewer = viewerList [iViewer];
2175 if (viewerShortName == viewer -> GetShortName ()) {
2182 if (found)
return viewer;
2190 switch (verbosity) {
2191 case quiet: rs =
"quiet (0)";
break;
2192 case startup: rs =
"startup (1)";
break;
2193 case errors: rs =
"errors (2)";
break;
2194 case warnings: rs =
"warnings (3)";
break;
2196 case parameters: rs =
"parameters (5)";
break;
2197 case all: rs =
"all (6)";
break;
2206 if (ss(0) ==
'q') verbosity =
quiet;
2207 else if (ss(0) ==
's') verbosity =
startup;
2208 else if (ss(0) ==
'e') verbosity =
errors;
2209 else if (ss(0) ==
'w') verbosity =
warnings;
2211 else if (ss(0) ==
'p') verbosity =
parameters;
2212 else if (ss(0) ==
'a') verbosity =
all;
2215 std::istringstream is(ss);
2218 G4cerr <<
"ERROR: G4VisManager::GetVerbosityValue: invalid verbosity \""
2219 << verbosityString <<
"\"";
2237 else if (intVerbosity >
all) verbosity =
all;
2238 else verbosity =
Verbosity(intVerbosity);
2258 static G4bool noGSPrinting =
true;
2263 noGSPrinting =
false;
2266 "WARNING: G4VisManager::IsValidView(): Attempt to draw when no graphics system"
2267 "\n has been instantiated. Use \"/vis/open\" or \"/vis/sceneHandler/create\"."
2268 "\n Alternatively, to avoid this message, suppress instantiation of vis"
2269 "\n manager (G4VisExecutive), possibly by setting G4VIS_NONE, and ensure"
2270 "\n drawing code is executed only if G4VVisManager::GetConcreteInstance()"
2281 "ERROR: G4VisManager::IsValidView(): Current view is not valid."
2290 G4cerr <<
"ERROR: G4VisManager::IsValidView ():";
2293 "\n The current scene \""
2295 <<
"\" is not handled by"
2296 "\n the current scene handler \""
2299 "\n (it currently handles scene \""
2303 "\n (a) attach it to the scene handler with"
2304 "\n /vis/sceneHandler/attach "
2307 "\n (b) create a new scene handler with "
2308 "\n /vis/sceneHandler/create <graphics-system>,"
2309 "\n in which case it should pick up the the new scene."
2313 G4cout <<
"\n Scene handler \""
2315 <<
"\" has null scene pointer."
2316 "\n Attach a scene with /vis/sceneHandler/attach [<scene-name>]"
2324 if (viewerList.size () == 0) {
2327 "ERROR: G4VisManager::IsValidView (): the current scene handler\n \""
2329 <<
"\" has no viewers. Do /vis/viewer/create."
2339 if (!successful ||
fpScene -> IsEmpty ()) {
2341 G4cerr <<
"ERROR: G4VisManager::IsValidView ():";
2343 "\n Attempt at some drawing operation when scene is empty."
2344 "\n Maybe the geometry has not yet been defined."
2345 " Try /run/initialize."
2346 "\n Or use \"/vis/scene/add/extent\"."
2355 "WARNING: G4VisManager: the scene was empty, \"world\" has been"
2356 "\n added and the scene handlers notified.";
2368 G4cout<<
"G4VisManager: No model factories registered with G4VisManager."<<
G4endl;
2369 G4cout<<
"G4VisManager::RegisterModelFactories() should be overridden in derived"<<
G4endl;
2370 G4cout<<
"class. See G4VisExecutive for an example."<<
G4endl;
2374 #ifdef G4MULTITHREADED
2375 void G4VisManager::SetUpForAThread()
G4bool FilterDigi(const G4VDigi &)
#define G4THREADJOIN(worker)
void RegisterEndOfEventUserVisAction(const G4String &name, G4VUserVisAction *, const G4VisExtent &=G4VisExtent::NullExtent)
void RegisterModelFactory(G4TrajDrawModelFactory *factory)
G4VisFilterManager< G4VTrajectory > * fpTrajFilterMgr
static Verbosity fVerbosity
const std::vector< Factory * > & FactoryList() const
void PrintAvailableColours(Verbosity) const
G4VisFilterManager< G4VHit > * fpHitFilterMgr
void PrintAvailableUserVisActions(Verbosity) const
virtual void RegisterModelFactories()
void PrintAvailableModels(Verbosity) const
void SetCurrentSceneHandler(G4VSceneHandler *)
static G4VVisManager * GetConcreteInstance()
void PrintAvailableGraphicsSystems(Verbosity) const
void SetEventID(G4int eventID)
G4String strip(G4int strip_Type=trailing, char c=' ')
G4bool IsCullingInvisible() const
void RegisterEndOfRunUserVisAction(const G4String &name, G4VUserVisAction *, const G4VisExtent &=G4VisExtent::NullExtent)
G4VisStateDependent * fpStateDependent
void PrintInvalidPointers() const
void SetVerboseLevel(G4int)
void SetRunID(G4int runID)
static G4SolidsWorkspacePool * GetInstance()
void GeometryHasChanged()
const std::vector< const G4Event * > * GetEventVector() const
const Model * Current() const
void SetCurrentScene(G4Scene *)
G4bool GetMarkForClearingTransientStore() const
G4bool GetRefreshAtEndOfEvent() const
static std::vector< G4String > VerbosityGuidanceStrings
const G4String & GetName() const
static Verbosity GetVerbosityValue(const G4String &)
const G4Run * GetCurrentRun() const
#define G4MUTEX_INITIALIZER
void BeginDraw(const G4Transform3D &objectTransformation=G4Transform3D())
const G4VTrajectoryModel * CurrentTrajDrawModel() const
G4bool fTransientsDrawnThisEvent
const std::vector< Filter * > & FilterList() const
std::vector< G4UIcommand * > fDirectoryList
std::vector< G4UImessenger * > fMessengerList
static G4UImanager * GetUIpointer()
void RegisterMessengers()
std::vector< G4VSceneHandler * >::const_iterator G4SceneHandlerListConstIterator
static G4VisManager * fpInstance
G4String Placement() const
void RegisterMessenger(G4UImessenger *messenger)
void SelectTrajectoryModel(const G4String &model)
void SetCurrentTrajectory(const G4VTrajectory *pTraj)
G4VSceneHandler * fpSceneHandler
void SetTransientsDrawnThisEvent(G4bool)
std::vector< UserVisAction > fEndOfRunUserVisActions
#define G4THREADCREATE(worker, func, arg)
G4double GetExtentRadius() const
G4int fDrawGroupNestingDepth
void IgnoreStateChanges(G4bool)
G4bool fEventKeepingSuspended
G4String ViewerShortName(const G4String &viewerName) const
friend class G4VisStateDependent
G4GLOB_DLL std::ostream G4cout
std::vector< UserVisAction > fRunDurationUserVisActions
G4VisModelManager< G4VTrajectoryModel > * fpTrajDrawModelMgr
G4SceneHandlerList fAvailableSceneHandlers
const std::map< G4String, T * > & Map() const
G4bool FilterTrajectory(const G4VTrajectory &)
virtual void Draw(const G4VTrajectory &trajectory, const G4bool &visible=true) const =0
static G4MTRunManager * GetMasterRunManager()
G4bool GetRefreshAtEndOfRun() const
void ResetTransientsDrawnFlags()
G4bool GetTransientsDrawnThisRun() const
static G4VisManager * GetInstance()
G4int fNoOfEventsDrawnThisRun
void KeepForPostProcessing() const
void SetCurrentGraphicsSystem(G4VGraphicsSystem *)
void SetXGeometryString(const G4String &)
G4int GetNumberOfEventsToBeProcessed() const
const T * Current() const
void DrawEndOfRunModels()
G4bool GetTransientsDrawnThisEvent() const
G4bool IsCullingCovered() const
G4VisFilterManager< G4VDigi > * fpDigiFilterMgr
G4bool IsMultithreadedApplication()
void CreateAndUseWorkspace()
G4String Placement() const
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
static G4TransportationManager * GetTransportationManager()
void RegisterRunDurationUserVisAction(const G4String &name, G4VUserVisAction *, const G4VisExtent &=G4VisExtent::NullExtent)
void SetCurrentViewer(G4VViewer *)
virtual void DescribeYourselfTo(G4VGraphicsScene &scene) const =0
static G4RunManager * GetRunManager()
G4Scene * GetScene() const
void SetTransientsDrawnThisEvent(G4bool)
void SetCurrent(const G4String &)
G4GraphicsSystemList fAvailableGraphicsSystems
G4VisManager(const G4String &verbosityString="warnings")
G4bool FilterHit(const G4VHit &)
#define G4THREADSLEEP(tick)
G4LogicalVolume * GetLogicalVolume() const
void DrawEvent(const G4Event *)
G4VViewer * GetViewer(const G4String &viewerName) const
void DrawT(const T &graphics_primitive, const G4Transform3D &objectTransform)
std::vector< UserVisAction > fEndOfEventUserVisActions
void BeginDraw2D(const G4Transform3D &objectTransformation=G4Transform3D())
static G4String VerbosityString(Verbosity)
G4VSceneHandler * GetCurrentSceneHandler() const
static G4EventManager * GetEventManager()
const List * ListManager() const
FilterMode::Mode GetMode() const
static Verbosity GetVerbosity()
G4bool fIgnoreStateChanges
void Draw(const G4Circle &, const G4Transform3D &objectTransformation=G4Transform3D())
static void SetVisManager(G4VisManager *)
virtual void RegisterGraphicsSystems()=0
static G4GeometryWorkspacePool * GetInstance()
void RegisterModel(G4VTrajectoryModel *model)
const std::vector< Factory * > & FactoryList() const
G4bool RegisterGraphicsSystem(G4VGraphicsSystem *)
void CreateAndUseWorkspace()
G4VViewer * GetCurrentViewer() const
void DispatchToModel(const G4VTrajectory &)
static const std::map< G4String, G4Colour > & GetMap()
void CreateViewer(const G4String &name="", const G4String &XGeometry="")
virtual void ClearTransientStore()
void SetTransientsDrawnThisRun(G4bool)
void SetUpForSpecialThread(G4String aPrefix)
const G4Event * GetConstCurrentEvent()
void CreateSceneHandler(const G4String &name="")
G4VGraphicsSystem * fpGraphicsSystem
Functionality GetFunctionality() const
void DrawT2D(const T &graphics_primitive, const G4Transform3D &objectTransform)
const G4GraphicsSystemList & GetAvailableGraphicsSystems()
G4int GetMaxNumberOfKeptEvents() const
static void SetConcreteInstance(G4VVisManager *)
void Draw2D(const G4Circle &, const G4Transform3D &objectTransformation=G4Transform3D())
void ClearTransientStoreIfMarked()
void * G4ThreadFunArgType
void SetMarkForClearingTransientStore(G4bool)
void KeepTheCurrentEvent()
G4int ApplyCommand(const char *aCommand)
G4VSolid * GetSolid() const
G4GLOB_DLL std::ostream G4cerr
void * G4ThreadFunReturnType
G4bool fTransientsDrawnThisRun