81 #ifdef G4MULTITHREADED
89 #ifdef G4VIS_USE_STD11
101 fInitialised (false),
102 fpGraphicsSystem (0),
106 fpStateDependent (0),
107 fEventRefreshing (false),
108 fTransientsDrawnThisRun (false),
109 fTransientsDrawnThisEvent (false),
110 fNoOfEventsDrawnThisRun (0),
112 fEventKeepingSuspended (false),
113 fKeptLastEvent (false),
114 fpRequestedEvent (0),
115 fAbortReviewKeptEvents (false),
116 fIsDrawGroup (false),
117 fDrawGroupNestingDepth (0),
118 fIgnoreStateChanges (false)
119 #ifdef G4MULTITHREADED
120 , fMaxEventQueueSize (100)
121 , fWaitOnEventQueueFull (true)
131 (
"Simple graded message scheme - digit or string (1st character defines):");
133 (
" 0) quiet, // Nothing is printed.");
135 (
" 1) startup, // Startup and endup messages are printed...");
137 (
" 2) errors, // ...and errors...");
139 (
" 3) warnings, // ...and warnings...");
141 (
" 4) confirmations, // ...and confirming messages...");
143 (
" 5) parameters, // ...and parameters of scenes and views...");
145 (
" 6) all // ...and everything available.");
149 (
"G4VisManager::G4VisManager",
151 "Attempt to Construct more than one VisManager");
163 <<
"Visualization Manager instantiating with verbosity \""
196 directory -> SetGuidance (
"Visualization commands.");
226 G4cout <<
"Visualization Manager deleting..." <<
G4endl;
244 (
"G4VisManager::GetInstance",
253 G4cout <<
"WARNING: G4VisManager::Initialise: already initialised."
259 G4cout <<
"Visualization Manager initialising..." <<
G4endl;
264 "\nYou have instantiated your own Visualization Manager, inheriting"
265 "\n G4VisManager and implementing RegisterGraphicsSystems(), in which"
266 "\n you should, normally, instantiate drivers which do not need"
267 "\n external packages or libraries, and, optionally, drivers under"
268 "\n control of environment variables."
269 "\n Also you should implement RegisterModelFactories()."
270 "\n See visualization/management/include/G4VisExecutive.hh/icc, for example."
271 "\n In your main() you will have something like:"
272 "\n #ifdef G4VIS_USE"
273 "\n G4VisManager* visManager = new G4VisExecutive;"
274 "\n visManager -> SetVerboseLevel (Verbose);"
275 "\n visManager -> Initialize ();"
277 "\n (Don't forget to delete visManager;)"
290 "\nYou have successfully registered the following graphics systems."
300 directory -> SetGuidance (
"Modeling commands.");
302 directory =
new G4UIdirectory (
"/vis/modeling/trajectories/");
303 directory -> SetGuidance (
"Trajectory model commands.");
305 directory =
new G4UIdirectory (
"/vis/modeling/trajectories/create/");
306 directory -> SetGuidance (
"Create trajectory models and messengers.");
311 directory -> SetGuidance (
"Filtering commands.");
313 directory =
new G4UIdirectory (
"/vis/filtering/trajectories/");
314 directory -> SetGuidance (
"Trajectory filtering commands.");
316 directory =
new G4UIdirectory (
"/vis/filtering/trajectories/create/");
317 directory -> SetGuidance (
"Create trajectory filters and messengers.");
320 directory -> SetGuidance (
"Hit filtering commands.");
322 directory =
new G4UIdirectory (
"/vis/filtering/hits/create/");
323 directory -> SetGuidance (
"Create hit filters and messengers.");
326 directory -> SetGuidance (
"Digi filtering commands.");
328 directory =
new G4UIdirectory (
"/vis/filtering/digi/create/");
329 directory -> SetGuidance (
"Create digi filters and messengers.");
342 "\nYou have successfully registered the following model factories."
387 directory -> SetGuidance(
"Operations on vis attributes of Geant4 geometry.");
393 directory -> SetGuidance(
"Set vis attributes of Geant4 geometry.");
405 #ifdef G4MULTITHREADED
407 directory -> SetGuidance(
"Commands unique to multithreading mode.");
414 directory -> SetGuidance
415 (
"Set quantities for use in future commands where appropriate.");
425 directory -> SetGuidance (
"Operations on Geant4 scenes.");
436 directory -> SetGuidance (
"Add model to current scene.");
462 directory -> SetGuidance (
"Operations on Geant4 scene handlers.");
470 directory -> SetGuidance (
"Operations on touchables.");
475 directory -> SetGuidance (
"Set vis attributes of current touchable.");
480 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 "There are " << nKeptEvents <<
" kept events."
554 "\n \"/vis/reviewKeptEvents\" to review them one by one."
555 "\n \"/vis/viewer/flush\" or \"/vis/viewer/rebuild\" to see them accumulated."
562 "G4VisManager::Enable: WARNING: visualization remains disabled for"
563 "\n above reasons. Rectifying with valid vis commands will"
564 "\n automatically enable."
574 "G4VisManager::Disable: visualization disabled."
575 "\n The pointer returned by GetConcreteInstance will be zero."
576 "\n Note that it will become enabled after some valid vis commands."
580 G4int currentTrajectoryType =
582 if (currentTrajectoryType > 0) {
584 "You may wish to disable trajectory production too:"
585 "\n \"/tracking/storeTrajectory 0\""
586 "\nbut don't forget to re-enable with"
588 "\n \"/tracking/storeTrajectory " << currentTrajectoryType <<
"\" (for your case)."
598 G4cout <<
"G4VisManager::GetAvailableGraphicsSystems: WARNING: no"
599 "\n graphics system available!"
600 "\n 1) Did you have environment variables G4VIS_BUILD_xxxx_DRIVER set"
601 "\n when you compiled/built the visualization code?"
602 "\n 2) Did you instantiate your own Visualization Manager and forget"
603 "\n to implement RegisterGraphicsSystems correctly?"
604 "\n 3) You can register your own graphics system, e.g.,"
605 "\n visManager->RegisterGraphicsSystem(new MyGraphicsSystem);)"
606 "\n after instantiating your vis manager and before"
607 "\n visManager->Initialize()."
619 G4cout <<
"G4VisManager::RegisterGraphicsSystem: "
620 << pSystem -> GetName ();
621 if (pSystem -> GetNickname () !=
"") {
622 G4cout <<
" (" << pSystem -> GetNickname () <<
")";
629 G4cout <<
"G4VisManager::RegisterGraphicsSystem: null pointer!"
649 G4cout<<
"G4VisManager: Using G4TrajectoryDrawByCharge as fallback trajectory model."<<
G4endl;
650 G4cout<<
"See commands in /vis/modeling/trajectories/ for other options."<<
G4endl;
711 #ifdef G4MULTITHREADED
717 (
"G4VisManager::BeginDraw",
719 "Nesting detected. It is illegal to nest Begin/EndDraw."
732 #ifdef G4MULTITHREADED
748 #ifdef G4MULTITHREADED
754 (
"G4VisManager::BeginDraw2D",
756 "Nesting detected. It is illegal to nest Begin/EndDraw2D."
769 #ifdef G4MULTITHREADED
785 #ifdef G4MULTITHREADED
789 if (objectTransform != fpSceneHandler->GetObjectTransformation()) {
791 (
"G4VSceneHandler::DrawT",
793 "Different transform detected in Begin/EndDraw group.");
795 fpSceneHandler -> AddPrimitive (graphics_primitive);
797 if (IsValidView ()) {
798 ClearTransientStoreIfMarked();
799 fpSceneHandler -> BeginPrimitives (objectTransform);
800 fpSceneHandler -> AddPrimitive (graphics_primitive);
801 fpSceneHandler -> EndPrimitives ();
808 #ifdef G4MULTITHREADED
812 if (objectTransform != fpSceneHandler->GetObjectTransformation()) {
814 (
"G4VSceneHandler::DrawT",
816 "Different transform detected in Begin/EndDraw2D group.");
818 fpSceneHandler -> AddPrimitive (graphics_primitive);
820 if (IsValidView ()) {
821 ClearTransientStoreIfMarked();
822 fpSceneHandler -> BeginPrimitives2D (objectTransform);
823 fpSceneHandler -> AddPrimitive (graphics_primitive);
824 fpSceneHandler -> EndPrimitives2D ();
832 DrawT (circle, objectTransform);
838 DrawT (polyhedron, objectTransform);
844 DrawT (line, objectTransform);
850 DrawT (polymarker, objectTransform);
856 DrawT (scale, objectTransform);
862 DrawT (square, objectTransform);
868 DrawT (text, objectTransform);
874 DrawT2D (circle, objectTransform);
880 DrawT2D (polyhedron, objectTransform);
886 DrawT2D (line, objectTransform);
892 DrawT2D (polymarker, objectTransform);
898 DrawT2D (square, objectTransform);
904 DrawT2D (text, objectTransform);
908 #ifdef G4MULTITHREADED
922 #ifdef G4MULTITHREADED
936 #ifdef G4MULTITHREADED
943 #ifdef G4MULTITHREADED
974 #ifdef G4MULTITHREADED
979 Draw (*pSol, attribs, objectTransform);
985 #ifdef G4MULTITHREADED
1005 #ifdef G4MULTITHREADED
1021 G4VSolid* pSol = pLV -> GetSolid ();
1022 Draw (*pSol, attribs, objectTransform);
1030 if (pSceneHandler) {
1036 G4cout <<
"ERROR in G4VisManager::CreateSceneHandler during "
1038 <<
" scene handler creation.\n No action taken."
1050 if (!fInitialised) Initialise ();
1052 if (!fpSceneHandler) {
1053 PrintInvalidPointers ();
1057 G4VViewer* p = fpGraphicsSystem -> CreateViewer (*fpSceneHandler, name);
1060 if (fVerbosity >= errors) {
1061 G4cerr <<
"ERROR in G4VisManager::CreateViewer during "
1062 << fpGraphicsSystem -> GetName ()
1063 <<
" viewer creation.\n No action taken."
1069 if (p -> GetViewId() < 0) {
1070 if (fVerbosity >= errors) {
1071 G4cerr <<
"ERROR in G4VisManager::CreateViewer during "
1072 << fpGraphicsSystem -> GetName ()
1073 <<
" viewer initialisation.\n No action taken."
1084 p -> SetViewParameters(initialvp);
1088 fpSceneHandler -> AddViewerToList (fpViewer);
1089 fpSceneHandler -> SetCurrentViewer (fpViewer);
1090 if (fVerbosity >= confirmations) {
1091 G4cout <<
"G4VisManager::CreateViewer: new viewer created."
1096 if (fVerbosity >= parameters) {
1101 static G4bool warned =
false;
1102 if (fVerbosity >= confirmations) {
1105 "NOTE: objects with visibility flag set to \"false\""
1106 " will not be drawn!"
1107 "\n \"/vis/viewer/set/culling global false\" to Draw such objects."
1108 "\n Also see other \"/vis/viewer/set\" commands."
1115 static G4bool warned =
false;
1116 if (fVerbosity >= warnings) {
1119 "WARNING: covered objects in solid mode will not be rendered!"
1120 "\n \"/vis/viewer/set/culling coveredDaughters false\" to reverse this."
1121 "\n Also see other \"/vis/viewer/set\" commands."
1131 G4cout <<
"G4VisManager::GeometryHasChanged() called." <<
G4endl;
1137 -> GetNavigatorForTracking () -> GetWorldVolume ();
1140 G4cout <<
"WARNING: There is no world volume!" <<
G4endl;
1146 G4int iScene, nScenes = sceneList.size ();
1147 for (iScene = 0; iScene < nScenes; iScene++) {
1148 G4Scene* pScene = sceneList [iScene];
1149 std::vector<G4Scene::Model>& modelList = pScene -> SetRunDurationModelList ();
1150 if (modelList.size ()) {
1153 modelInvalid =
false;
1154 std::vector<G4Scene::Model>::iterator iterModel;
1155 for (iterModel = modelList.begin();
1156 iterModel != modelList.end();
1162 G4cout <<
"WARNING: Model \""
1163 << iterModel->fpModel->GetGlobalDescription ()
1165 "\" is no longer valid - being removed\n from scene \""
1166 << pScene -> GetName () <<
"\""
1169 modelList.erase (iterModel);
1173 }
while (modelInvalid);
1175 if (modelList.size () == 0) {
1177 G4cout <<
"WARNING: No models left in this scene \""
1178 << pScene -> GetName ()
1186 ApplyCommand (
G4String(
"/vis/scene/notifyHandlers " + pScene->
GetName()));
1192 if (
fpScene &&
fpScene -> GetRunDurationModelList ().size () == 0) {
1194 G4cout <<
"WARNING: The current scene \""
1196 <<
"\" has no models."
1205 G4cout <<
"G4VisManager::NotifyHandler() called." <<
G4endl;
1210 G4int iScene, nScenes = sceneList.size ();
1211 for (iScene = 0; iScene < nScenes; iScene++) {
1212 G4Scene* pScene = sceneList [iScene];
1213 std::vector<G4Scene::Model>& modelList = pScene -> SetRunDurationModelList ();
1215 if (modelList.size ()) {
1218 ApplyCommand (
G4String(
"/vis/scene/notifyHandlers " + pScene->
GetName()));
1223 if (
fpScene &&
fpScene -> GetRunDurationModelList ().size () == 0) {
1225 G4cout <<
"WARNING: The current scene \""
1227 <<
"\" has no models."
1267 assert (0 != trajectoryModel);
1270 trajectoryModel->
Draw(trajectory, visible);
1278 fRunDurationUserVisActions.push_back(
UserVisAction(name,pVisAction));
1280 fUserVisActionExtents[pVisAction] = extent;
1282 if (fVerbosity >= warnings) {
1284 "WARNING: No extent set for user vis action \"" << name <<
"\"."
1294 fEndOfEventUserVisActions.push_back(
UserVisAction(name,pVisAction));
1296 fUserVisActionExtents[pVisAction] = extent;
1298 if (fVerbosity >= warnings) {
1300 "WARNING: No extent set for user vis action \"" << name <<
"\"."
1310 fEndOfRunUserVisActions.push_back(
UserVisAction(name,pVisAction));
1312 fUserVisActionExtents[pVisAction] = extent;
1314 if (fVerbosity >= warnings) {
1316 "WARNING: No extent set for user vis action \"" << name <<
"\"."
1334 G4cout <<
"G4VisManager::SetCurrentGraphicsSystem: system now "
1335 << pSystem -> GetName () <<
G4endl;
1342 G4int nSH = sceneHandlerList.size ();
1344 for (iSH = nSH - 1; iSH >= 0; iSH--) {
1345 if (sceneHandlerList [iSH] -> GetGraphicsSystem () == pSystem)
break;
1350 G4cout <<
" Scene Handler now "
1356 G4cout <<
" Scene now \""
1361 if (viewerList.size ()) {
1381 G4cout <<
"G4VisManager::SetCurrentSceneHandler: scene handler now \""
1382 << pSceneHandler -> GetName () <<
"\"" <<
G4endl;
1387 G4cout <<
" Scene now \""
1394 G4cout <<
" Graphics system now \""
1399 G4int nViewers = viewerList.size ();
1402 for (iViewer = 0; iViewer < nViewers; iViewer++) {
1403 if (
fpViewer == viewerList [iViewer])
break;
1405 if (iViewer >= nViewers) {
1415 "WARNING: Problem setting scene handler - please report circumstances."
1424 "WARNING: No viewers for this scene handler - please create one."
1433 G4cout <<
"G4VisManager::SetCurrentViewer: viewer now "
1434 << pViewer -> GetName ()
1441 "WARNING: No scene handler for this viewer - please create one."
1453 "WARNING: Problem setting viewer - please report circumstances."
1461 G4cout <<
"Current available graphics systems are:\n";
1464 const G4String& name = gs->GetName();
1465 const std::vector<G4String>& nicknames = gs->GetNicknames();
1469 for (
size_t i = 0; i < nicknames.size(); ++i) {
1483 G4cout <<
"\n NONE!!! None registered - yet! Mmmmm!" <<
G4endl;
1492 const std::vector<G4VModelFactory<G4VTrajectoryModel>*>& factoryList =
1494 if (factoryList.empty())
G4cout <<
" None" << G4endl;
1496 std::vector<G4VModelFactory<G4VTrajectoryModel>*>::const_iterator i;
1497 for (i = factoryList.begin(); i != factoryList.end(); ++i)
1502 const std::map<G4String, G4VTrajectoryModel*>& modelMap =
1504 if (!modelMap.empty()) {
1506 std::map<G4String, G4VTrajectoryModel*>::const_iterator i;
1507 for (i = modelMap.begin(); i != modelMap.end(); ++i) {
1508 G4cout <<
" " << i->second->Name();
1509 if (i->second == listManager->
Current())
G4cout <<
" (Current)";
1521 const std::vector<G4VModelFactory<G4VFilter<G4VTrajectory> >*>&
1523 if (factoryList.empty())
G4cout <<
" None" << G4endl;
1525 std::vector<G4VModelFactory<G4VFilter<G4VTrajectory> >*>::const_iterator i;
1526 for (i = factoryList.begin(); i != factoryList.end(); ++i)
1529 const std::vector<G4VFilter<G4VTrajectory>*>&
1531 if (!filterList.empty()) {
1533 std::vector<G4VFilter<G4VTrajectory>*>::const_iterator i;
1534 for (i = filterList.begin(); i != filterList.end(); ++i) {
1545 "You have successfully registered the following user vis actions."
1547 G4cout <<
"Run Duration User Vis Actions:";
1557 G4cout <<
"End of Event User Vis Actions:";
1567 G4cout <<
"End of Run User Vis Actions:";
1580 "Some /vis commands (optionally) take a string to specify colour."
1581 "\nAvailable colours:\n ";
1583 for (std::map<G4String, G4Colour>::const_iterator i = map.begin();
1586 if (++i != map.end())
G4cout <<
", ";
1593 G4cerr <<
"ERROR: G4VisManager::PrintInvalidPointers:";
1595 G4cerr <<
"\n null graphics system pointer.";
1602 "\n Null scene pointer. Use \"/vis/drawVolume\" or"
1603 " \"/vis/scene/create\".";
1606 "\n Null scene handler pointer. Use \"/vis/open\" or"
1607 " \"/vis/sceneHandler/create\".";
1610 "\n Null viewer pointer. Use \"/vis/viewer/create\".";
1616 #ifdef G4MULTITHREADED
1619 G4bool mtRunInProgress =
false;
1620 std::deque<const G4Event*> mtVisEventQueue;
1629 if (!pSceneHandler)
return 0;
1631 if (!pScene)
return 0;
1633 if (!pViewer)
return 0;
1648 pViewer->SwitchToVisSubThread();
1653 G4int eventQueueSize = mtVisEventQueue.size();
1657 while (eventQueueSize) {
1660 const G4Event*
event = mtVisEventQueue.front();
1700 mtVisEventQueue.pop_front();
1701 event->PostProcessingFinished();
1702 eventQueueSize = mtVisEventQueue.size();
1708 G4int runInProgress = mtRunInProgress;
1710 if (!runInProgress) {
1717 #ifdef G4VIS_USE_STD11
1718 std::this_thread::sleep_for(std::chrono::milliseconds(100));
1725 pViewer->DoneWithVisSubThread();
1726 pViewer->MovingToMasterThread();
1746 #ifdef G4MULTITHREADED
1753 #ifdef G4MULTITHREADED
1761 if (nEventsToBeProcessed == 0)
return;
1770 #ifdef G4MULTITHREADED
1784 mtRunInProgress =
true;
1810 #ifndef G4MULTITHREADED
1832 #ifdef G4MULTITHREADED
1839 #ifdef G4MULTITHREADED
1846 if (!currentRun)
return;
1851 if (!currentEvent)
return;
1855 #ifdef G4MULTITHREADED
1859 G4int eventQueueSize = mtVisEventQueue.size();
1863 G4bool eventQueueFull =
false;
1864 while (fMaxEventQueueSize > 0 && eventQueueSize >= fMaxEventQueueSize) {
1867 if (fWaitOnEventQueueFull) {
1868 static G4bool warned =
false;
1871 "WARNING: The number of events in the visualisation queue has exceeded"
1873 << fMaxEventQueueSize <<
1874 ".\n If, during a multithreaded run, the simulation gets ahead of the"
1875 "\n visualisation by more than this maximum, the simulation is delayed"
1876 "\n until the vis sub-thread has drawn a few more events and removed them"
1877 "\n from the queue. You may change this maximum number of events with"
1878 "\n \"/vis/multithreading/maxEventQueueSize <N>\", where N is the maximum"
1879 "\n number you wish to allow. N <= 0 means \"unlimited\"."
1880 "\n Alternatively you may choose to discard events for drawing by setting"
1881 "\n \"/vis/multithreading/actionOnEventQueueFull discard\"."
1882 "\n To avoid visualisation altogether: \"/vis/disable\"."
1883 "\n And maybe \"/tracking/storeTrajectories 0\"."
1889 #ifdef G4VIS_USE_STD11
1890 std::this_thread::sleep_for(std::chrono::milliseconds(100));
1896 static G4bool warned =
false;
1899 "WARNING: The number of events in the visualisation queue has exceeded"
1901 << fMaxEventQueueSize <<
1902 ".\n Some events have been discarded for drawing. You may change this"
1903 "\n behaviour with \"/vis/multithreading/actionOnEventQueueFull wait\"."
1904 "\n To avoid visualisation altogether: \"/vis/disable\"."
1905 "\n And maybe \"/tracking/storeTrajectories 0\"."
1909 eventQueueFull =
true;
1914 eventQueueSize = mtVisEventQueue.size();
1918 if (!eventQueueFull) {
1922 mtVisEventQueue.push_back(currentEvent);
1937 G4int nEventsToBeProcessed = 0;
1938 G4int nKeptEvents = 0;
1943 const std::vector<const G4Event*>* events = currentRun->
GetEventVector();
1944 if (events) nKeptEvents = events->size();
1964 if (eventID < nEventsToBeProcessed - 1) {
1971 if (nKeptEvents == 0) {
1990 if (maxNumberOfKeptEvents > 0 &&
1994 static G4bool warned =
false;
1998 "WARNING: G4VisManager::EndOfEvent: Automatic event keeping suspended."
1999 "\n The number of events exceeds the maximum, "
2000 << maxNumberOfKeptEvents <<
2001 ", that may be kept by\n the vis manager."
2007 }
else if (maxNumberOfKeptEvents != 0) {
2028 #ifdef G4MULTITHREADED
2036 #ifdef G4MULTITHREADED
2044 if (nEventsToBeProcessed == 0)
return;
2047 if (!currentRun)
return;
2049 #ifdef G4MULTITHREADED
2054 mtRunInProgress =
false;
2058 delete mtVisSubThread;
2063 #ifdef G4MULTITHREADED
2073 <<
"WARNING: Number of events drawn this run, "
2075 << noOfEventsRequested <<
2076 ".\n (This is because you requested \"/vis/multithreading/actionOnEventQueueFull discard\".)"
2083 G4int nKeptEvents = 0;
2084 const std::vector<const G4Event*>* events = currentRun->
GetEventVector();
2085 if (events) nKeptEvents = events->size();
2088 G4cout <<
"WARNING: " << nKeptEvents;
2089 if (nKeptEvents == 1)
G4cout <<
" event has";
2090 else G4cout <<
" events have";
2091 G4cout <<
" been kept for refreshing and/or reviewing." <<
G4endl;
2095 G4cout <<
"No keep requests were";
2097 G4cout <<
"Only 1 keep request was";
2104 "\n \"/vis/reviewKeptEvents\" to review them one by one."
2105 "\n \"/vis/viewer/flush\" or \"/vis/viewer/rebuild\" to see them accumulated."
2128 "WARNING: G4VisManager::EndOfRun: Automatic event keeping was suspended."
2129 "\n The number of events in the run exceeded the maximum, "
2131 ", that may be\n kept by the vis manager." <<
2132 "\n The number of events kept by the vis manager can be changed with"
2133 "\n \"/vis/scene/endOfEventAction accumulate <N>\", where N is the"
2134 "\n maximum number you wish to allow. N < 0 means \"unlimited\"."
2165 G4cout <<
"\"/vis/viewer/update\" to close file." <<
G4endl;
2195 (*i)->SetTransientsDrawnThisEvent(
false);
2196 (*i)->SetTransientsDrawnThisRun(
false);
2201 G4String viewerShortName (viewerName);
2202 viewerShortName = viewerShortName (0, viewerShortName.find (
' '));
2203 return viewerShortName.
strip ();
2209 size_t iHandler, iViewer;
2212 for (iHandler = 0; iHandler < nHandlers; iHandler++) {
2214 const G4ViewerList& viewerList = sceneHandler -> GetViewerList ();
2215 for (iViewer = 0; iViewer < viewerList.size (); iViewer++) {
2216 viewer = viewerList [iViewer];
2217 if (viewerShortName == viewer -> GetShortName ()) {
2224 if (found)
return viewer;
2232 switch (verbosity) {
2233 case quiet: rs =
"quiet (0)";
break;
2234 case startup: rs =
"startup (1)";
break;
2235 case errors: rs =
"errors (2)";
break;
2236 case warnings: rs =
"warnings (3)";
break;
2238 case parameters: rs =
"parameters (5)";
break;
2239 case all: rs =
"all (6)";
break;
2248 if (ss(0) ==
'q') verbosity =
quiet;
2249 else if (ss(0) ==
's') verbosity =
startup;
2250 else if (ss(0) ==
'e') verbosity =
errors;
2251 else if (ss(0) ==
'w') verbosity =
warnings;
2253 else if (ss(0) ==
'p') verbosity =
parameters;
2254 else if (ss(0) ==
'a') verbosity =
all;
2257 std::istringstream is(ss);
2260 G4cerr <<
"ERROR: G4VisManager::GetVerbosityValue: invalid verbosity \""
2261 << verbosityString <<
"\"";
2279 else if (intVerbosity >
all) verbosity =
all;
2280 else verbosity =
Verbosity(intVerbosity);
2300 static G4bool noGSPrinting =
true;
2305 noGSPrinting =
false;
2308 "WARNING: G4VisManager::IsValidView(): Attempt to draw when no graphics system"
2309 "\n has been instantiated. Use \"/vis/open\" or \"/vis/sceneHandler/create\"."
2310 "\n Alternatively, to avoid this message, suppress instantiation of vis"
2311 "\n manager (G4VisExecutive), possibly by setting G4VIS_NONE, and ensure"
2312 "\n drawing code is executed only if G4VVisManager::GetConcreteInstance()"
2323 "ERROR: G4VisManager::IsValidView(): Current view is not valid."
2332 G4cerr <<
"ERROR: G4VisManager::IsValidView ():";
2335 "\n The current scene \""
2337 <<
"\" is not handled by"
2338 "\n the current scene handler \""
2341 "\n (it currently handles scene \""
2345 "\n (a) attach it to the scene handler with"
2346 "\n /vis/sceneHandler/attach "
2349 "\n (b) create a new scene handler with "
2350 "\n /vis/sceneHandler/create <graphics-system>,"
2351 "\n in which case it should pick up the the new scene."
2355 G4cout <<
"\n Scene handler \""
2357 <<
"\" has null scene pointer."
2358 "\n Attach a scene with /vis/sceneHandler/attach [<scene-name>]"
2366 if (viewerList.size () == 0) {
2369 "ERROR: G4VisManager::IsValidView (): the current scene handler\n \""
2371 <<
"\" has no viewers. Do /vis/viewer/create."
2381 if (!successful ||
fpScene -> IsEmpty ()) {
2383 G4cerr <<
"ERROR: G4VisManager::IsValidView ():";
2385 "\n Attempt at some drawing operation when scene is empty."
2386 "\n Maybe the geometry has not yet been defined."
2387 " Try /run/initialize."
2388 "\n Or use \"/vis/scene/add/extent\"."
2397 "WARNING: G4VisManager: the scene was empty, \"world\" has been"
2398 "\n added and the scene handlers notified.";
2410 G4cout<<
"G4VisManager: No model factories registered with G4VisManager."<<
G4endl;
2411 G4cout<<
"G4VisManager::RegisterModelFactories() should be overridden in derived"<<
G4endl;
2412 G4cout<<
"class. See G4VisExecutive for an example."<<
G4endl;
2416 #ifdef G4MULTITHREADED
2417 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)
G4TrackingManager * GetTrackingManager() const
void SetRunID(G4int runID)
static G4SolidsWorkspacePool * GetInstance()
const G4ViewParameters & GetViewParameters() const
G4Navigator * GetNavigatorForTracking() const
G4VSolid * GetSolid() const
void GeometryHasChanged()
const std::vector< const G4Event * > * GetEventVector() const
const Model * Current() const
void SetCurrentScene(G4Scene *)
const char * name(G4int ptype)
G4bool GetMarkForClearingTransientStore() const
G4bool GetRefreshAtEndOfEvent() const
static std::vector< G4String > VerbosityGuidanceStrings
const G4String & GetName() const
static Verbosity GetVerbosityValue(const G4String &)
static G4RunManagerKernel * GetRunManagerKernel()
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)
static G4RunManagerKernel * GetMasterRunManagerKernel()
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
void SetWorldVolume(G4VPhysicalVolume *pWorld)
static G4EventManager * GetEventManager()
const List * ListManager() const
G4int GetStoreTrajectory() 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()
G4bool IsAutoRefresh() const
G4int ApplyCommand(const char *aCommand)
G4GLOB_DLL std::ostream G4cerr
void * G4ThreadFunReturnType
G4bool fTransientsDrawnThisRun