Import Geant4 10.2.0 source tree
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
$Id: History 87360 2014-12-01 16:07:16Z gcosmo $
|
||||
$Id: History 93811 2015-11-02 11:28:41Z gcosmo $
|
||||
|
||||
-------------------------------------------------------------------
|
||||
|
||||
@@ -26,6 +26,166 @@ committal in the CVS repository !
|
||||
History file for visualization management sub-category
|
||||
------------------------------------------------------
|
||||
|
||||
1st November 2015 John Allison (visman-V10-01-20)
|
||||
- Introduced (again!) <chrono> for queue handling in MT mode.
|
||||
o Except for Xeon Phi, which is protected by #ifndef __MIC__
|
||||
|
||||
15th October 2015 John Allison (visman-V10-01-19)
|
||||
- G4VisManager.cc:
|
||||
o Corrected end-of-run printing for the case of
|
||||
"/vis/multithreading/actionOnEventQueueFull discard".
|
||||
- G4VisCommandsViewer.cc:
|
||||
o Improved guidance and confirmation printing for /vis/viewer/save.
|
||||
|
||||
1st October 2015 John Allison (visman-V10-01-18)
|
||||
- Co-works with modeling-V10-01-04.
|
||||
- Added "light" representation to /vis/scene/add/magneticField.
|
||||
|
||||
1st October 2015 John Allison (visman-V10-01-17)
|
||||
- Reverted (again!) to G4THREADSLEEP for queue handling in MT mode.
|
||||
- Minor improvements in messages.
|
||||
|
||||
30th September 2015 John Allison (visman-V10-01-16)
|
||||
- Uses <chrono> for queue handling in MT mode.
|
||||
- New commands for multithreading:
|
||||
/vis/multithreading/actionOnEventQueueFull
|
||||
/vis/multithreading/maxEventQueueSize
|
||||
|
||||
19th August 2015 John Allison (visman-V10-01-15)
|
||||
- Improvements to help and verbosity printing.
|
||||
|
||||
5th August 2015 John Allison (visman-V10-01-14)
|
||||
- Reverted to G4THREADSLEEP for queue handling in MT mode.
|
||||
|
||||
1st August 2015 John Allison (visman-V10-01-13)
|
||||
- Uses <chrono>.
|
||||
|
||||
1st August 2015 John Allison (visman-V10-01-12)
|
||||
- G4VGraphicsSystem.cc, G4VisCommandsSceneHandler.cc, G4VisManager.cc:
|
||||
o Use auto&& (rather than auto or auto&).
|
||||
|
||||
30th July 2015 John Allison (visman-V10-01-11)
|
||||
- Re-implemented graphics system fallback strategy. A graphics system may
|
||||
have more than one nickname. This is used for finding a fallback graphics
|
||||
systems when, for example, a Qt session is requested but the user has not
|
||||
instantiated a Qt session, or when interactive graphics systems are
|
||||
prohibited, as in batch mode. This allows the user to run an application
|
||||
that is fully configured with all available graphics systems, even under
|
||||
circumstances for which the primary graphics system is inappropriate. For
|
||||
example, it allows one to make a image with these commands in a batch macro:
|
||||
/vis/open OGL
|
||||
/vis/drawVolume
|
||||
/vis/ogl/export
|
||||
- G4VGraphicsSystem:
|
||||
o Introduced vector of nicknames.
|
||||
o Introduced AddNickname method.
|
||||
o Removed: Set methods. Data members are set in the constructor and
|
||||
may not be changed, except to add further nicknames with AddNickname.
|
||||
o GetNickname gets first element in nickname vector, which is, therefore,
|
||||
the primary nickname. Other nicknames are used for fallback strategies
|
||||
so that fallback graphics systems can be used when, for example,
|
||||
interactive graphics systems are prohibited, as in batch mode.
|
||||
o Moved all inline functions to .hh. Removed G4VGraphicsSystem.icc.
|
||||
- G4VisManager, G4VisCommandSceneHandlerCreate, G4VisExecutive.icc
|
||||
o Re-implemented graphics system fallback strategy.
|
||||
- /vis/scene/add/volume: Improved guidance.
|
||||
- /vis/open: Simplified.
|
||||
o Handed on parameter checking to /vis/sceneHandler/create.
|
||||
- G4ViewParameters::TouchableCommands: Bug fix.
|
||||
o Fixed bug whereby touchable changes where not properly dumped (with
|
||||
/vis/viewer/save) for re-reading into another viewer.
|
||||
- G4VSceneHandler.cc: Simplified some code with C++11 features.
|
||||
|
||||
3rd June 2015 John Allison (visman-V10-01-10)
|
||||
- G4VViewer and G4VisManager: Introduced
|
||||
// In MT mode these functions are called in the following order for each run:
|
||||
// Called on the master thread before starting the vis sub-thread.
|
||||
virtual void DoneWithMasterThread ();
|
||||
// Called on the master thread after starting the vis sub-thread.
|
||||
virtual void MovingToVisSubThread ();
|
||||
// Called on the vis sub-thread when waiting for events.
|
||||
virtual void SwitchToVisSubThread ();
|
||||
// Called on the vis sub-thread when all events have been processed.
|
||||
virtual void DoneWithVisSubThread ();
|
||||
// Called on the vis sub-thread when all events have been processed.
|
||||
virtual void MovingToMasterThread ();
|
||||
// Called on the master thread after the vis sub-thread has terminated.
|
||||
virtual void SwitchToMasterThread ();
|
||||
|
||||
27th May 2015 Laurent Garnier (visman-V10-01-09 co-works with opengl-V10-01-05)
|
||||
- A bit of cleaning in managing OpenGL context (Qt)
|
||||
|
||||
26th May 2015 Laurent Garnier
|
||||
- Add methods to manage GLContext in Qt (not finished yet!)
|
||||
|
||||
20th March 2015 John Allison (visman-V10-01-08)
|
||||
- G4VisManager.cc: Very minor tidying.
|
||||
|
||||
8th March 2015 John Allison (visman-V10-01-07)
|
||||
- G4VisManager.cc: Tidied.
|
||||
- G4VisCommandGeometryList::SetNewValue: Protected null vis att pointer.
|
||||
|
||||
1st March 2015 John Allison (visman-V10-01-06)
|
||||
- G4VisManager.cc: Limited the use of G4USE_STD11 to the clang compiler for now.
|
||||
|
||||
3rd February 2015 John Allison (visman-V10-01-05)
|
||||
- G4VisManager.cc: Introduced G4USE_STD11 and tidied.
|
||||
|
||||
2nd February 2015 Gabriele Cosmo (visman-V10-01-04)
|
||||
- Fix to sources.cmake script to include missing dependency on external library.
|
||||
|
||||
12th January 2015 Gabriele Cosmo (visman-V10-01-03)
|
||||
- Use G4THREADSLEEP(tick) macro from G4Threading.hh in G4VisManager.
|
||||
- Requires tag "global-V10-01-01".
|
||||
|
||||
19th December 2014 John Allison (visman-V10-01-02)
|
||||
- Removed debug printing (MT mode).
|
||||
|
||||
16th December 2014 John Allison (visman-V10-01-01)
|
||||
- G4VisCommandsSceneAdd.cc: Fixed /vis/scene/add/eventID for MT mode.
|
||||
|
||||
16th December 2014 John Allison (visman-V10-01-00)
|
||||
- G4VisCommandsSceneAdd.cc: Improve guidance for /vis/scene/add/extent.
|
||||
|
||||
2nd December 2014 John Allison (vis-MT-branch-00-man-18)
|
||||
- G4VisManager.cc:
|
||||
o Tidied.
|
||||
o Removed the following from EndOfRun:
|
||||
// // ???? I can't remember why
|
||||
// // if (!fpSceneHandler->GetMarkForClearingTransientStore()) {
|
||||
// // is here. It prevents ShowView at end of run, which seems to be OK
|
||||
// // for sequential mode, but MT mode seems to need it (I have not
|
||||
// // figured out why). ???? JA ????
|
||||
// if (!fpSceneHandler->GetMarkForClearingTransientStore()) {
|
||||
o Removed the following from EndOfRun:
|
||||
// // An extra refresh for auto-refresh viewers.
|
||||
// // ???? I DON'T THINK THIS IS NECESSARY ???? JA ????
|
||||
// if (fpViewer->GetViewParameters().IsAutoRefresh()) {
|
||||
// fpViewer->RefreshView();
|
||||
// }
|
||||
|
||||
1st December 2014 John Allison (vis-MT-branch-00-man-17)
|
||||
- G4VisManager.cc:
|
||||
o Moved KeepTheEvent from the vis sub-thread to EndOfEvent,
|
||||
where it should have been all along!! :)
|
||||
|
||||
1st December 2014 John Allison (vis-MT-branch-00-man-16)
|
||||
- G4VisManager.cc: Prevented vis sub-thread for runs with no events.
|
||||
|
||||
30th November 2014 John Allison (vis-MT-branch-00-man-15)
|
||||
- Introduced DoneWithMaster/VisSubThread.
|
||||
|
||||
30th November 2014 John Allison (vis-MT-branch-00-man-14)
|
||||
- Rationalisation of vis sub-thread code and Begin/EndRun/Event.
|
||||
- Elimination of (commented out) ShowView and extra refresh for
|
||||
auto-refresh viewers at end of run for accumulate mode. Works
|
||||
well for stored sequential mode but in stored MT mode trajectories
|
||||
are drawn to the front buffer (as they should be) but they
|
||||
disappear on refresh, as though the display lists have not been
|
||||
made - or, perhaps made in another space? Also, curiously,
|
||||
they are not cleared at the start of the next run (as they should
|
||||
be via ClearTransientStoreIfMarked).
|
||||
|
||||
28th November 2014 John Allison (visman-V10-00-30)
|
||||
- G4VSceneHandler.cc, G4VisCommands.cc, G4VisCommandsScene.cc,
|
||||
G4VisCommandsSceneAdd.cc:
|
||||
@@ -39,6 +199,15 @@ History file for visualization management sub-category
|
||||
28th November 2014 John Allison (visman-V10-00-29)
|
||||
- G4VisManager.cc: Fixed Coverity warning.
|
||||
|
||||
26th November 2014 John Allison (vis-MT-branch-00-man-13)
|
||||
- G4VisManager.cc: Correct placement of fEventRefreshing = false.
|
||||
|
||||
22nd November 2014 John Allison (vis-MT-branch-00-man-12)
|
||||
- G4VisManager.cc: Minor tidying of #include’s.
|
||||
|
||||
22nd November 2014 John Allison (vis-MT-branch-00-man-11)
|
||||
- Merged visman-V10-00-28 into MT version.
|
||||
|
||||
21st November 2014 John Allison (visman-V10-00-28)
|
||||
- G4VisManager.cc: Reset event reviewing flag at end of run in MT mode.
|
||||
- G4VisCommandsViewerSet.cc: Fix bug affecting file-writing viewers.
|
||||
@@ -63,6 +232,50 @@ History file for visualization management sub-category
|
||||
- G4Scene.cc, G4VisManager.cc: Fixed spelling mistake in message.
|
||||
- G4ViewParameters.icc: Fixed win7-vc12 compiler warnings.
|
||||
|
||||
8th November 2014 John Allison (vis-MT-branch-00-man-10)
|
||||
- G4ViewParameters.icc: Fixed (again) win7-vc12 compiler warnings.
|
||||
|
||||
7th November 2014 John Allison (vis-MT-branch-00-man-09)
|
||||
- G4VisManager.cc: delete mtVisSubThread at end of run.
|
||||
- G4VViewer.icc, G4VisManager.hh: Cosmetic.
|
||||
|
||||
7th November 2014 John Allison (vis-MT-branch-00-man-08)
|
||||
- G4VisManager.cc: Protected event queue with mutex locks.
|
||||
|
||||
6th November 2014 John Allison
|
||||
- G4VisManager.cc: Tidied.
|
||||
|
||||
6th November 2014 John Allison (vis-MT-branch-00-man-07)
|
||||
- G4VisManager.cc: Fixed compiler warning.
|
||||
|
||||
6th November 2014 John Allison (vis-MT-branch-00-man-06)
|
||||
- G4VisManager.cc:
|
||||
o Move event->PostProcessingFinished() into mutex protection.
|
||||
|
||||
5th November 2014 John Allison (vis-MT-branch-00-man-05)
|
||||
- G4VisManager.cc: Protect fpViewer dereferencing in MT mode:
|
||||
if (fpViewer) fpViewer->SwitchToMasterThread
|
||||
- G4Scene.cc: Fix spelling mistake in warning message.
|
||||
|
||||
4th November 2014 John Allison (vis-MT-branch-00-man-04)
|
||||
- G4ViewParameters.icc: Fix win7-vc12 compiler warnings.
|
||||
|
||||
2nd November 2014 John Allison (vis-MT-branch-00-man-03)
|
||||
- Added /vis/set/maxEventQueueSize.
|
||||
If, during a multithreaded run, the simulation gets ahead of the
|
||||
visualisation by more than this maximum, the simulation is delayed
|
||||
until the vis sub-thread has drawn a few more events. You may
|
||||
change this maximum number of events with
|
||||
"/vis/set/maxEventQueueSize <N>”, where N is the
|
||||
maximum number you wish to allow. N <= 0 means "unlimited".
|
||||
To avoid visualisation altogether: “/vis/disable”.
|
||||
|
||||
1st November 2014 John Allison (vis-MT-branch-00-man-01)
|
||||
- Tidied.
|
||||
|
||||
1st November 2014 John Allison (vis-MT-branch-00-man-00)
|
||||
- Merged vis-V10-00-11 and tagged.
|
||||
|
||||
30th October 2014 John Allison (visman-V10-00-21)
|
||||
- G4VisManager.cc, G4VisCommandsSceneAdd.cc, G4Scene.cc:
|
||||
o Added informationals about /vis/scene/add/extent.
|
||||
@@ -78,6 +291,40 @@ History file for visualization management sub-category
|
||||
- G4VSceneHandler.cc, G4ViewParameters.cc
|
||||
o Change contant in .cc nSegmentsMin by GetMinLineSegmentsPerCircle() in the G4VisAttribute
|
||||
|
||||
30th October 2014 John Allison (vis-MT-branch-00-15)
|
||||
- G4VisManager.cc:
|
||||
o Fix drawing of events in refresh mode at end of run.
|
||||
o Fix shadowing of runManager pointer in MT mode.
|
||||
|
||||
29th October 2014 John Allison
|
||||
- Fixed event by event refreshing (/vis/scene/endOfEventAction refresh)
|
||||
in MT mode.
|
||||
|
||||
29th October 2014 John Allison (visman-V10-00-20)
|
||||
- Added /vis/scene/add/extent.
|
||||
o Adds a dummy model with given extent to the current scene.
|
||||
This can be used to provide an extent to the scene even if
|
||||
no other models with extent are available. For example,
|
||||
even if there is no geometry.
|
||||
|
||||
24th October 2014 John Allison (vis-MT-branch-00-05)
|
||||
- Small fix and re-tag.
|
||||
|
||||
24th October 2014 John Allison (vis-MT-branch-00-04)
|
||||
- Event keeping moved to EndOfEvent.
|
||||
- Draw(const G4Event*) now longer needed; removed.
|
||||
|
||||
22nd October 2014 John Allison (vis-MT-branch-00-visman-00)
|
||||
- Sub-thread developments.
|
||||
|
||||
22th October 2014 Laurent Garnier (visman-V10-00-19 require greps-V10-00-08)
|
||||
- G4VSceneHandler.cc, G4ViewParameters.cc
|
||||
o Change contant in .cc nSegmentsMin by GetMinLineSegmentsPerCircle() in the G4VisAttribute
|
||||
|
||||
22nd October 2014 Laurent Garnier (visman-V10-00-19 require greps-V10-00-08)
|
||||
- G4VSceneHandler.cc, G4ViewParameters.cc
|
||||
o Change contant in .cc nSegmentsMin by GetMinLineSegmentsPerCircle() in the G4VisAttribute
|
||||
|
||||
1st October 2014 John Allison (visman-V10-00-18)
|
||||
- G4VisManager: Added DrawEvent. Code split out of EndOfEvent in preparation
|
||||
for calling from special vis sub-thread in multi-threading mode.
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4VGraphicsSystem.hh 78838 2014-01-28 08:46:17Z gcosmo $
|
||||
// $Id: G4VGraphicsSystem.hh 91686 2015-07-31 09:40:08Z gcosmo $
|
||||
//
|
||||
//
|
||||
// John Allison 27th March 1996
|
||||
@@ -38,6 +38,8 @@
|
||||
|
||||
#include "globals.hh"
|
||||
|
||||
#include <vector>
|
||||
|
||||
class G4VSceneHandler;
|
||||
class G4VViewer;
|
||||
|
||||
@@ -75,25 +77,21 @@ public: // With description
|
||||
virtual G4VViewer* CreateViewer (G4VSceneHandler&, const G4String& name) = 0;
|
||||
|
||||
// Access functions.
|
||||
const G4String& GetName () const;
|
||||
const G4String& GetNickname () const;
|
||||
const G4String& GetDescription () const;
|
||||
Functionality GetFunctionality () const;
|
||||
virtual G4bool IsUISessionCompatible () const;
|
||||
void SetName (const G4String&);
|
||||
void SetNickname (const G4String&);
|
||||
void SetDescription (const G4String&);
|
||||
void SetFunctionality (Functionality);
|
||||
const G4String& GetName () const {return fName;}
|
||||
const G4String& GetNickname () const {return fNicknames[0];}
|
||||
const std::vector<G4String>& GetNicknames () const {return fNicknames;}
|
||||
const G4String& GetDescription () const {return fDescription;}
|
||||
Functionality GetFunctionality () const {return fFunctionality;}
|
||||
virtual G4bool IsUISessionCompatible () const;
|
||||
void AddNickname (const G4String& nickname) {fNicknames.push_back(nickname);}
|
||||
|
||||
protected:
|
||||
G4String fName;
|
||||
G4String fNickname;
|
||||
std::vector<G4String> fNicknames;
|
||||
G4String fDescription;
|
||||
Functionality fFunctionality;
|
||||
};
|
||||
|
||||
std::ostream& operator << (std::ostream& os, const G4VGraphicsSystem& gs);
|
||||
|
||||
#include "G4VGraphicsSystem.icc"
|
||||
|
||||
#endif
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4VViewer.hh 71534 2013-06-17 16:07:53Z gcosmo $
|
||||
// $Id: G4VViewer.hh 90651 2015-06-05 13:30:54Z gcosmo $
|
||||
//
|
||||
//
|
||||
// John Allison 27th March 1996
|
||||
@@ -98,6 +98,22 @@ public: // With description
|
||||
// It is not yet the end of all drawing; that is signalled by
|
||||
// ShowView ().)
|
||||
|
||||
#ifdef G4MULTITHREADED
|
||||
// In MT mode these functions are called in the following order for each run:
|
||||
// Called on the master thread before starting the vis sub-thread.
|
||||
virtual void DoneWithMasterThread ();
|
||||
// Called on the master thread after starting the vis sub-thread.
|
||||
virtual void MovingToVisSubThread ();
|
||||
// Called on the vis sub-thread when waiting for events.
|
||||
virtual void SwitchToVisSubThread ();
|
||||
// Called on the vis sub-thread when all events have been processed.
|
||||
virtual void DoneWithVisSubThread ();
|
||||
// Called on the vis sub-thread when all events have been processed.
|
||||
virtual void MovingToMasterThread ();
|
||||
// Called on the master thread after the vis sub-thread has terminated.
|
||||
virtual void SwitchToMasterThread ();
|
||||
#endif
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
// Access functions.
|
||||
const G4String& GetName () const;
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4VViewer.icc 71534 2013-06-17 16:07:53Z gcosmo $
|
||||
// $Id: G4VViewer.icc 90651 2015-06-05 13:30:54Z gcosmo $
|
||||
//
|
||||
//
|
||||
// John Allison 30th December 1996
|
||||
|
||||
+37
-30
@@ -24,41 +24,48 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4VGraphicsSystem.icc 66373 2012-12-18 09:41:34Z gcosmo $
|
||||
//
|
||||
//
|
||||
// John Allison 27th March 1996
|
||||
// Abstract interface class for graphics systems.
|
||||
// $Id: G4VisCommandsMultithreading.hh 66264 2012-12-14 10:17:44Z allison $
|
||||
|
||||
inline const G4String& G4VGraphicsSystem::GetName () const {
|
||||
return fName;
|
||||
}
|
||||
// /vis/multithreading commands - John Allison 29th September 2015
|
||||
|
||||
inline const G4String& G4VGraphicsSystem::GetNickname () const {
|
||||
return fNickname;
|
||||
}
|
||||
#ifdef G4MULTITHREADED
|
||||
|
||||
inline const G4String& G4VGraphicsSystem::GetDescription () const {
|
||||
return fDescription;
|
||||
}
|
||||
#ifndef G4VISCOMMANDSMULTITHREADING_HH
|
||||
#define G4VISCOMMANDSMULTITHREADING_HH
|
||||
|
||||
inline G4VGraphicsSystem::Functionality
|
||||
G4VGraphicsSystem::GetFunctionality () const {
|
||||
return fFunctionality;
|
||||
}
|
||||
#include "G4VVisCommand.hh"
|
||||
|
||||
inline void G4VGraphicsSystem::SetName (const G4String& name) {
|
||||
fName = name;
|
||||
}
|
||||
class G4UIcmdWithAnInteger;
|
||||
class G4UIcmdWithAString;
|
||||
|
||||
inline void G4VGraphicsSystem::SetNickname (const G4String& nickname) {
|
||||
fNickname = nickname;
|
||||
}
|
||||
class G4VisCommandMultithreadingActionOnEventQueueFull: public G4VVisCommand {
|
||||
public:
|
||||
G4VisCommandMultithreadingActionOnEventQueueFull();
|
||||
virtual ~G4VisCommandMultithreadingActionOnEventQueueFull();
|
||||
G4String GetCurrentValue(G4UIcommand* command);
|
||||
void SetNewValue(G4UIcommand* command, G4String newValue);
|
||||
private:
|
||||
G4VisCommandMultithreadingActionOnEventQueueFull
|
||||
(const G4VisCommandMultithreadingActionOnEventQueueFull&);
|
||||
G4VisCommandMultithreadingActionOnEventQueueFull& operator=
|
||||
(const G4VisCommandMultithreadingActionOnEventQueueFull&);
|
||||
G4UIcmdWithAString* fpCommand;
|
||||
};
|
||||
|
||||
inline void G4VGraphicsSystem::SetDescription (const G4String& description) {
|
||||
fDescription = description;
|
||||
}
|
||||
class G4VisCommandMultithreadingMaxEventQueueSize: public G4VVisCommand {
|
||||
public:
|
||||
G4VisCommandMultithreadingMaxEventQueueSize();
|
||||
virtual ~G4VisCommandMultithreadingMaxEventQueueSize();
|
||||
G4String GetCurrentValue(G4UIcommand* command);
|
||||
void SetNewValue(G4UIcommand* command, G4String newValue);
|
||||
private:
|
||||
G4VisCommandMultithreadingMaxEventQueueSize
|
||||
(const G4VisCommandMultithreadingMaxEventQueueSize&);
|
||||
G4VisCommandMultithreadingMaxEventQueueSize& operator=
|
||||
(const G4VisCommandMultithreadingMaxEventQueueSize&);
|
||||
G4UIcmdWithAnInteger* fpCommand;
|
||||
};
|
||||
|
||||
inline void G4VGraphicsSystem::SetFunctionality (Functionality f) {
|
||||
fFunctionality = f;
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4VisCommandsSceneAdd.hh 85582 2014-10-31 09:07:30Z gcosmo $
|
||||
// $Id: G4VisCommandsSceneAdd.hh 93069 2015-10-02 09:54:27Z gcosmo $
|
||||
|
||||
// /vis/scene commands - John Allison 9th August 1998
|
||||
|
||||
@@ -325,7 +325,7 @@ public:
|
||||
private:
|
||||
G4VisCommandSceneAddMagneticField (const G4VisCommandSceneAddMagneticField&);
|
||||
G4VisCommandSceneAddMagneticField& operator = (const G4VisCommandSceneAddMagneticField&);
|
||||
G4UIcmdWithAnInteger* fpCommand;
|
||||
G4UIcommand* fpCommand;
|
||||
};
|
||||
|
||||
class G4VisCommandSceneAddPSHits: public G4VVisCommandScene {
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4VisExecutive.icc 75567 2013-11-04 11:35:11Z gcosmo $
|
||||
// $Id: G4VisExecutive.icc 91686 2015-07-31 09:40:08Z gcosmo $
|
||||
//
|
||||
//
|
||||
// John Allison 24th January 1998.
|
||||
@@ -102,11 +102,6 @@
|
||||
#include "G4VRML2.hh"
|
||||
#endif
|
||||
|
||||
inline
|
||||
G4VisExecutive::G4VisExecutive (const G4String& verbosityString):
|
||||
G4VisManager(verbosityString)
|
||||
{}
|
||||
|
||||
// The inline keyword prevents the compiler making an external
|
||||
// reference even though they cannot actually be inlined since they
|
||||
// are virtual functions. This prevents a "multiple definition" error
|
||||
@@ -115,10 +110,16 @@ G4VisExecutive::G4VisExecutive (const G4String& verbosityString):
|
||||
// necessary to #include "G4VisExecutive.hh" in more than one file
|
||||
// since after instantiation the object can be treated as a
|
||||
// G4VisManager.
|
||||
|
||||
inline
|
||||
G4VisExecutive::G4VisExecutive (const G4String& verbosityString):
|
||||
G4VisManager(verbosityString)
|
||||
{}
|
||||
|
||||
inline void
|
||||
G4VisExecutive::RegisterGraphicsSystems () {
|
||||
|
||||
// Graphics Systems not needing external packages or libraries...
|
||||
// Graphics Systems not needing external packages or libraries...
|
||||
RegisterGraphicsSystem (new G4ASCIITree);
|
||||
RegisterGraphicsSystem (new G4DAWNFILE);
|
||||
RegisterGraphicsSystem (new G4HepRep);
|
||||
@@ -127,163 +128,105 @@ G4VisExecutive::RegisterGraphicsSystems () {
|
||||
RegisterGraphicsSystem (new G4VRML1File);
|
||||
RegisterGraphicsSystem (new G4VRML2File);
|
||||
RegisterGraphicsSystem (new G4GMocrenFile);
|
||||
// Graphics systems needing external packages or libraries...
|
||||
|
||||
// Graphics systems needing external packages or libraries...
|
||||
|
||||
#ifdef G4VIS_USE_DAWN
|
||||
RegisterGraphicsSystem (new G4FukuiRenderer);
|
||||
#endif
|
||||
|
||||
// Register OGL graphics system with generic nicknames.
|
||||
// Note: Any graphics system can be used with any UI session except
|
||||
// OPENGLQT - this must have a UI Qt session unless in batch mode. This
|
||||
// is handled in /vis/sceneHandler/create but a potential fallback is
|
||||
// defined here.
|
||||
#ifdef G4VIS_USE_OPENGL
|
||||
G4VGraphicsSystem* ogl = 0;
|
||||
G4VGraphicsSystem* ogli = 0;
|
||||
G4VGraphicsSystem* ogls = 0;
|
||||
G4VGraphicsSystem* ogl_fallback = 0;
|
||||
G4VGraphicsSystem* ogli_fallback = 0;
|
||||
G4VGraphicsSystem* ogls_fallback = 0;
|
||||
#ifdef G4VIS_USE_VRML
|
||||
RegisterGraphicsSystem (new G4VRML1);
|
||||
RegisterGraphicsSystem (new G4VRML2);
|
||||
#endif
|
||||
|
||||
// Register OGL family of drivers with their normal names,
|
||||
// super-abbreviated names and fallback names where approproiate.
|
||||
|
||||
#ifdef G4VIS_USE_OPENGLQT
|
||||
ogl = new G4OpenGLStoredQt;
|
||||
ogli = new G4OpenGLImmediateQt;
|
||||
ogls = new G4OpenGLStoredQt;
|
||||
#if defined G4VIS_USE_OPENGLXM
|
||||
ogl_fallback = new G4OpenGLStoredXm;
|
||||
ogli_fallback = new G4OpenGLImmediateXm;
|
||||
ogls_fallback = new G4OpenGLStoredXm;
|
||||
#elif defined G4VIS_USE_OPENGLX
|
||||
ogl_fallback = new G4OpenGLStoredX;
|
||||
ogli_fallback = new G4OpenGLImmediateX;
|
||||
ogls_fallback = new G4OpenGLStoredX;
|
||||
#elif defined G4VIS_USE_OPENGLWIN32
|
||||
ogl_fallback = new G4OpenGLStoredWin32;
|
||||
ogli_fallback = new G4OpenGLImmediateWin32;
|
||||
ogls_fallback = new G4OpenGLStoredWin32;
|
||||
#endif
|
||||
#elif defined G4VIS_USE_OPENGLWT
|
||||
ogl = new G4OpenGLImmediateWt;
|
||||
ogli = new G4OpenGLImmediateWt;
|
||||
ogls = new G4OpenGLImmediateWt;
|
||||
#elif defined G4VIS_USE_OPENGLXM
|
||||
ogl = new G4OpenGLStoredXm;
|
||||
ogli = new G4OpenGLImmediateXm;
|
||||
ogls = new G4OpenGLStoredXm;
|
||||
#elif defined G4VIS_USE_OPENGLWIN32
|
||||
ogl = new G4OpenGLStoredWin32;
|
||||
ogli = new G4OpenGLImmediateWin32;
|
||||
ogls = new G4OpenGLStoredWin32;
|
||||
#elif defined G4VIS_USE_OPENGLX
|
||||
ogl = new G4OpenGLStoredX;
|
||||
ogli = new G4OpenGLImmediateX;
|
||||
ogls = new G4OpenGLStoredX;
|
||||
#endif
|
||||
if (ogl) {
|
||||
ogl->SetNickname("OGL");
|
||||
RegisterGraphicsSystem (ogl);
|
||||
}
|
||||
if (ogli) {
|
||||
ogli->SetNickname("OGLI");
|
||||
RegisterGraphicsSystem (ogli);
|
||||
}
|
||||
if (ogls) {
|
||||
ogls->SetNickname("OGLS");
|
||||
RegisterGraphicsSystem (ogls);
|
||||
}
|
||||
if (ogl_fallback) {
|
||||
ogl_fallback->SetNickname("OGL_FALLBACK");
|
||||
RegisterGraphicsSystem (ogl_fallback);
|
||||
}
|
||||
if (ogli_fallback) {
|
||||
ogli_fallback->SetNickname("OGLI_FALLBACK");
|
||||
RegisterGraphicsSystem (ogli_fallback);
|
||||
}
|
||||
if (ogls_fallback) {
|
||||
ogls_fallback->SetNickname("OGLS_FALLBACK");
|
||||
RegisterGraphicsSystem (ogls_fallback);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef G4VIS_USE_OPENGLX
|
||||
RegisterGraphicsSystem (new G4OpenGLImmediateX);
|
||||
RegisterGraphicsSystem (new G4OpenGLStoredX);
|
||||
#endif
|
||||
|
||||
#ifdef G4VIS_USE_OPENGLWIN32
|
||||
RegisterGraphicsSystem (new G4OpenGLImmediateWin32);
|
||||
RegisterGraphicsSystem (new G4OpenGLStoredWin32);
|
||||
G4VGraphicsSystem* ogliqt = new G4OpenGLImmediateQt;
|
||||
G4VGraphicsSystem* oglsqt = new G4OpenGLStoredQt;
|
||||
RegisterGraphicsSystem (ogliqt);
|
||||
RegisterGraphicsSystem (oglsqt);
|
||||
ogliqt->AddNickname("OGLI");
|
||||
oglsqt->AddNickname("OGL");
|
||||
oglsqt->AddNickname("OGLS");
|
||||
#endif
|
||||
|
||||
#ifdef G4VIS_USE_OPENGLXM
|
||||
RegisterGraphicsSystem (new G4OpenGLImmediateXm);
|
||||
RegisterGraphicsSystem (new G4OpenGLStoredXm);
|
||||
G4VGraphicsSystem* oglixm = new G4OpenGLImmediateXm;
|
||||
G4VGraphicsSystem* oglsxm = new G4OpenGLStoredXm;
|
||||
RegisterGraphicsSystem (oglixm);
|
||||
RegisterGraphicsSystem (oglsxm);
|
||||
#ifdef G4VIS_USE_OPENGLQT
|
||||
oglixm->AddNickname("OGLIQt_FALLBACK");
|
||||
oglsxm->AddNickname("OGLSQt_FALLBACK");
|
||||
#else
|
||||
oglixm->AddNickname("OGLI");
|
||||
oglsxm->AddNickname("OGL");
|
||||
oglsxm->AddNickname("OGLS");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef G4VIS_USE_OPENGLX
|
||||
G4VGraphicsSystem* oglix = new G4OpenGLImmediateX;
|
||||
G4VGraphicsSystem* oglsx = new G4OpenGLStoredX;
|
||||
RegisterGraphicsSystem (oglix);
|
||||
RegisterGraphicsSystem (oglsx);
|
||||
#ifdef G4VIS_USE_OPENGLQT
|
||||
G4VGraphicsSystem* gsi = new G4OpenGLImmediateQt;
|
||||
G4VGraphicsSystem* gss = new G4OpenGLStoredQt;
|
||||
RegisterGraphicsSystem (gsi);
|
||||
RegisterGraphicsSystem (gss);
|
||||
G4VGraphicsSystem* gsi_fallback = 0;
|
||||
G4VGraphicsSystem* gss_fallback = 0;
|
||||
#if defined G4VIS_USE_OPENGLXM
|
||||
gsi_fallback = new G4OpenGLImmediateXm;
|
||||
gss_fallback = new G4OpenGLStoredXm;
|
||||
#elif defined G4VIS_USE_OPENGLX
|
||||
gsi_fallback = new G4OpenGLImmediateX;
|
||||
gss_fallback = new G4OpenGLStoredX;
|
||||
#elif defined G4VIS_USE_OPENGLWIN32
|
||||
gsi_fallback = new G4OpenGLImmediateWin32;
|
||||
gss_fallback = new G4OpenGLStoredWin32;
|
||||
oglix->AddNickname("OGLIQt_FALLBACK");
|
||||
oglsx->AddNickname("OGLSQt_FALLBACK");
|
||||
#endif
|
||||
#ifdef G4VIS_USE_OPENGLXM
|
||||
oglix->AddNickname("OGLIXm_FALLBACK");
|
||||
oglsx->AddNickname("OGLSXm_FALLBACK");
|
||||
#endif
|
||||
#if defined (G4VIS_USE_OPENGLQT) || (G4VIS_USE_OPENGLXM)
|
||||
#else
|
||||
oglix->AddNickname("OGLI");
|
||||
oglsx->AddNickname("OGL");
|
||||
oglsx->AddNickname("OGLS");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef G4VIS_USE_OPENGLWIN32
|
||||
G4VGraphicsSystem* ogliwin32 = new G4OpenGLImmediateWin32;
|
||||
G4VGraphicsSystem* oglswin32 = new G4OpenGLStoredWin32;
|
||||
RegisterGraphicsSystem (ogliwin32);
|
||||
RegisterGraphicsSystem (oglswin32);
|
||||
#ifdef G4VIS_USE_OPENGLQT
|
||||
ogliwin32->AddNickname("OGLIQt_FALLBACK");
|
||||
oglswin32->AddNickname("OGLSQt_FALLBACK");
|
||||
#endif
|
||||
if (gsi_fallback) {
|
||||
gsi_fallback->SetNickname(gsi->GetNickname()+"_FALLBACK");
|
||||
RegisterGraphicsSystem (gsi_fallback);
|
||||
}
|
||||
if (gss_fallback) {
|
||||
gss_fallback->SetNickname(gss->GetNickname()+"_FALLBACK");
|
||||
RegisterGraphicsSystem (gss_fallback);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef G4VIS_USE_OPENGLWT
|
||||
RegisterGraphicsSystem (new G4OpenGLImmediateWt);
|
||||
#endif
|
||||
|
||||
// Register OI graphics system with generic nickname
|
||||
// Register OI graphics system with super-abbreviated nickname
|
||||
#ifdef G4VIS_USE_OI
|
||||
G4VGraphicsSystem* oi = 0;
|
||||
#ifdef G4VIS_USE_OIX
|
||||
oi = new G4OpenInventorX;
|
||||
#endif
|
||||
#ifdef G4VIS_USE_OIWIN32
|
||||
#elif G4VIS_USE_OIWIN32
|
||||
oi = new G4OpenInventorWin32;
|
||||
#endif
|
||||
if (oi) {
|
||||
oi->SetNickname("OI");
|
||||
RegisterGraphicsSystem (oi);
|
||||
oi->AddNickname("OI");
|
||||
}
|
||||
#endif
|
||||
|
||||
// The new, extended OI is registered separately for now.
|
||||
#ifdef G4VIS_USE_OIX
|
||||
RegisterGraphicsSystem (new G4OpenInventorX);
|
||||
RegisterGraphicsSystem (new G4OpenInventorXtExtended);
|
||||
#endif
|
||||
|
||||
#ifdef G4VIS_USE_OIWIN32
|
||||
RegisterGraphicsSystem (new G4OpenInventorWin32);
|
||||
#endif
|
||||
|
||||
#ifdef G4VIS_USE_RAYTRACERX
|
||||
RegisterGraphicsSystem (new G4RayTracerX);
|
||||
#endif
|
||||
|
||||
#ifdef G4VIS_USE_VRML
|
||||
RegisterGraphicsSystem (new G4VRML1);
|
||||
RegisterGraphicsSystem (new G4VRML2);
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
// See comments about inlining above.
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4VisManager.hh 85021 2014-10-23 09:53:47Z gcosmo $
|
||||
// $Id: G4VisManager.hh 93026 2015-09-30 16:07:07Z gcosmo $
|
||||
//
|
||||
//
|
||||
|
||||
@@ -329,8 +329,13 @@ public: // With description
|
||||
G4bool FilterDigi(const G4VDigi&);
|
||||
|
||||
#ifdef G4MULTITHREADED
|
||||
|
||||
virtual void SetUpForAThread();
|
||||
// This method is invoked by G4WorkerRunManager
|
||||
|
||||
static G4ThreadFunReturnType G4VisSubThread(G4ThreadFunArgType);
|
||||
// Vis sub-thread function.
|
||||
|
||||
#endif
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
@@ -355,8 +360,6 @@ private:
|
||||
|
||||
void EndOfRun ();
|
||||
|
||||
void DrawEvent (const G4Event*);
|
||||
|
||||
public: // With description
|
||||
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
@@ -394,6 +397,10 @@ public: // With description
|
||||
const G4Event* GetRequestedEvent () const;
|
||||
G4bool GetAbortReviewKeptEvents () const;
|
||||
const G4ViewParameters& GetDefaultViewParameters () const;
|
||||
#ifdef G4MULTITHREADED
|
||||
G4int GetMaxEventQueueSize () const;
|
||||
G4bool GetWaitOnEventQueueFull () const;
|
||||
#endif
|
||||
|
||||
void SetUserAction
|
||||
(G4VUserVisAction* pVisAction,
|
||||
@@ -410,10 +417,16 @@ public: // With description
|
||||
void SetVerboseLevel (Verbosity);
|
||||
void SetEventRefreshing (G4bool);
|
||||
void ResetTransientsDrawnFlags ();
|
||||
void SetTransientsDrawnThisRun (G4bool);
|
||||
void SetTransientsDrawnThisEvent (G4bool);
|
||||
// If non-zero, requested event is used in G4VSceneHandler::ProcessScene.
|
||||
void SetRequestedEvent (const G4Event*);
|
||||
void SetAbortReviewKeptEvents (G4bool);
|
||||
void SetDefaultViewParameters (const G4ViewParameters&);
|
||||
#ifdef G4MULTITHREADED
|
||||
void SetMaxEventQueueSize (G4int);
|
||||
void SetWaitOnEventQueueFull (G4bool);
|
||||
#endif
|
||||
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
// Utility functions.
|
||||
@@ -456,7 +469,7 @@ protected:
|
||||
// available graphics systems.) It is initialised to 1 in the
|
||||
// constructor and cannot be changed.
|
||||
|
||||
void PrintAvailableGraphicsSystems () const;
|
||||
void PrintAvailableGraphicsSystems (Verbosity) const;
|
||||
|
||||
private:
|
||||
|
||||
@@ -497,6 +510,7 @@ private:
|
||||
G4bool fEventRefreshing;
|
||||
G4bool fTransientsDrawnThisRun;
|
||||
G4bool fTransientsDrawnThisEvent;
|
||||
G4int fNoOfEventsDrawnThisRun;
|
||||
G4int fNKeepRequests;
|
||||
G4bool fEventKeepingSuspended;
|
||||
G4bool fKeptLastEvent;
|
||||
@@ -506,6 +520,10 @@ private:
|
||||
G4bool fIsDrawGroup;
|
||||
G4int fDrawGroupNestingDepth;
|
||||
G4bool fIgnoreStateChanges;
|
||||
#ifdef G4MULTITHREADED
|
||||
G4int fMaxEventQueueSize;
|
||||
G4bool fWaitOnEventQueueFull;
|
||||
#endif
|
||||
|
||||
// Trajectory draw model manager
|
||||
G4VisModelManager<G4VTrajectoryModel>* fpTrajDrawModelMgr;
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4VisManager.icc 66373 2012-12-18 09:41:34Z gcosmo $
|
||||
// $Id: G4VisManager.icc 93026 2015-09-30 16:07:07Z gcosmo $
|
||||
//
|
||||
//
|
||||
// GEANT4 Visualization Manager - John Allison 02/Jan/1996.
|
||||
@@ -99,6 +99,18 @@ inline const G4ViewParameters& G4VisManager::GetDefaultViewParameters() const {
|
||||
return fDefaultViewParameters;
|
||||
}
|
||||
|
||||
#ifdef G4MULTITHREADED
|
||||
|
||||
inline G4int G4VisManager::GetMaxEventQueueSize() const {
|
||||
return fMaxEventQueueSize;
|
||||
}
|
||||
|
||||
inline G4bool G4VisManager::GetWaitOnEventQueueFull () const {
|
||||
return fWaitOnEventQueueFull;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
inline void G4VisManager::SetUserAction
|
||||
(G4VUserVisAction* pVisAction,
|
||||
const G4VisExtent& extent) {
|
||||
@@ -126,6 +138,14 @@ inline void G4VisManager::RegisterMessenger(G4UImessenger* msgr)
|
||||
fMessengerList.push_back(msgr);
|
||||
}
|
||||
|
||||
inline void G4VisManager::SetTransientsDrawnThisRun (G4bool b) {
|
||||
fTransientsDrawnThisRun = b;
|
||||
}
|
||||
|
||||
inline void G4VisManager::SetTransientsDrawnThisEvent (G4bool b) {
|
||||
fTransientsDrawnThisEvent = b;
|
||||
}
|
||||
|
||||
inline void G4VisManager::SetRequestedEvent (const G4Event* event) {
|
||||
fpRequestedEvent = event;
|
||||
}
|
||||
@@ -138,3 +158,15 @@ inline void G4VisManager::SetDefaultViewParameters
|
||||
(const G4ViewParameters& vp) {
|
||||
fDefaultViewParameters = vp;
|
||||
}
|
||||
|
||||
#ifdef G4MULTITHREADED
|
||||
|
||||
inline void G4VisManager::SetMaxEventQueueSize (G4int size) {
|
||||
fMaxEventQueueSize = size;
|
||||
}
|
||||
|
||||
inline void G4VisManager::SetWaitOnEventQueueFull (G4bool wait) {
|
||||
fWaitOnEventQueueFull = wait;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -11,12 +11,13 @@
|
||||
#
|
||||
# Generated on : 24/9/2010
|
||||
#
|
||||
# $Id: sources.cmake 81056 2014-05-20 09:02:16Z gcosmo $
|
||||
# $Id: sources.cmake 93026 2015-09-30 16:07:07Z gcosmo $
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
# List external includes needed.
|
||||
include_directories(${CLHEP_INCLUDE_DIRS})
|
||||
include_directories(${USOLIDS_INCLUDE_DIRS})
|
||||
|
||||
# List internal includes needed.
|
||||
include_directories(${CMAKE_SOURCE_DIR}/source/digits_hits/digits/include)
|
||||
@@ -56,7 +57,6 @@ GEANT4_DEFINE_MODULE(NAME G4vis_management
|
||||
G4SceneHandlerList.hh
|
||||
G4SceneList.hh
|
||||
G4VGraphicsSystem.hh
|
||||
G4VGraphicsSystem.icc
|
||||
G4VSceneHandler.hh
|
||||
G4VSceneHandler.icc
|
||||
G4VUserVisAction.hh
|
||||
@@ -73,6 +73,7 @@ GEANT4_DEFINE_MODULE(NAME G4vis_management
|
||||
G4VisCommandsGeometry.hh
|
||||
G4VisCommandsGeometrySet.hh
|
||||
G4VisCommandsListManager.hh
|
||||
G4VisCommandsMultithreading.hh
|
||||
G4VisCommandsSet.hh
|
||||
G4VisCommandsScene.hh
|
||||
G4VisCommandsSceneAdd.hh
|
||||
@@ -105,6 +106,7 @@ GEANT4_DEFINE_MODULE(NAME G4vis_management
|
||||
G4VisCommandsCompound.cc
|
||||
G4VisCommandsGeometry.cc
|
||||
G4VisCommandsGeometrySet.cc
|
||||
G4VisCommandsMultithreading.cc
|
||||
G4VisCommandsSet.cc
|
||||
G4VisCommandsScene.cc
|
||||
G4VisCommandsSceneAdd.cc
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4VGraphicsSystem.cc 66373 2012-12-18 09:41:34Z gcosmo $
|
||||
// $Id: G4VGraphicsSystem.cc 93025 2015-09-30 16:02:12Z gcosmo $
|
||||
//
|
||||
//
|
||||
// John Allison 27th March 1996
|
||||
@@ -39,67 +39,102 @@ G4VGraphicsSystem::~G4VGraphicsSystem () {}
|
||||
G4VGraphicsSystem::G4VGraphicsSystem (const G4String& name,
|
||||
Functionality f):
|
||||
fName (name),
|
||||
fNickname (""),
|
||||
fDescription (""),
|
||||
fFunctionality (f) {}
|
||||
fDescription ("No description"),
|
||||
fFunctionality (f)
|
||||
{
|
||||
fNicknames.push_back("No Nickname");
|
||||
}
|
||||
|
||||
G4VGraphicsSystem::G4VGraphicsSystem (const G4String& name,
|
||||
const G4String& nickname,
|
||||
Functionality f):
|
||||
fName (name),
|
||||
fNickname (nickname),
|
||||
fDescription (""),
|
||||
fFunctionality (f) {}
|
||||
fDescription ("No description"),
|
||||
fFunctionality (f)
|
||||
{
|
||||
fNicknames.push_back(nickname);
|
||||
}
|
||||
|
||||
G4VGraphicsSystem::G4VGraphicsSystem (const G4String& name,
|
||||
const G4String& nickname,
|
||||
const G4String& description,
|
||||
Functionality f):
|
||||
fName (name),
|
||||
fNickname (nickname),
|
||||
fDescription (description),
|
||||
fFunctionality (f) {}
|
||||
fFunctionality (f)
|
||||
{
|
||||
fNicknames.push_back(nickname);
|
||||
}
|
||||
|
||||
G4bool G4VGraphicsSystem::IsUISessionCompatible () const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
std::ostream& operator << (std::ostream& os, const G4VGraphicsSystem& gs) {
|
||||
std::ostream& operator << (std::ostream& os, const G4VGraphicsSystem& gs)
|
||||
{
|
||||
os << "Graphics System: " << gs.GetName ();
|
||||
os << ", nicknames:"; for (auto&& nickname: gs.GetNicknames())
|
||||
{os << ' ' << nickname;}
|
||||
os << "\n Description: " << gs.GetDescription ();
|
||||
os << "\n Functionality: ";
|
||||
switch (gs.GetFunctionality()) {
|
||||
case G4VGraphicsSystem::noFunctionality:
|
||||
os << "None";
|
||||
break;
|
||||
case G4VGraphicsSystem::nonEuclidian:
|
||||
os << "nonEuclidian, e.g., tree representation of geometry hierarchy.";
|
||||
break;
|
||||
case G4VGraphicsSystem::twoD:
|
||||
os << "twoD: Simple 2D, e.g., X (no stored structures).";
|
||||
break;
|
||||
case G4VGraphicsSystem::twoDStore:
|
||||
os << "twoDStore: 2D with stored structures.";
|
||||
break;
|
||||
case G4VGraphicsSystem::threeD:
|
||||
os << "threeD: Passive 3D (with stored structures)";
|
||||
break;
|
||||
case G4VGraphicsSystem::threeDInteractive:
|
||||
os << "threeDInteractive: 3D with \"pick\" functionality.";
|
||||
break;
|
||||
case G4VGraphicsSystem::virtualReality:
|
||||
os << "virtualReality";
|
||||
break;
|
||||
case G4VGraphicsSystem::fileWriter:
|
||||
os << "fileWriter";
|
||||
break;
|
||||
default:
|
||||
os << "unknown";
|
||||
break;
|
||||
}
|
||||
|
||||
G4VisManager* pVMan = G4VisManager::GetInstance ();
|
||||
const G4SceneHandlerList& scenes = pVMan -> GetAvailableSceneHandlers ();
|
||||
os << "Graphics System: " << gs.GetName ();
|
||||
if (gs.GetNickname () != "") {
|
||||
os << ", nickname: " << gs.GetNickname ();
|
||||
}
|
||||
if (gs.GetDescription () != "") {
|
||||
os << "\n Description: " << gs.GetDescription ();
|
||||
}
|
||||
os << "\n Functionality: " << G4int(gs.GetFunctionality());
|
||||
if (pVMan -> GetVerbosity() >= G4VisManager::parameters) {
|
||||
size_t nScenes = scenes.size ();
|
||||
if (nScenes) {
|
||||
G4int nScenesOfThisSystem = 0;
|
||||
for (size_t i = 0; i < nScenes; i++) {
|
||||
if (scenes [i] -> GetGraphicsSystem () == &gs) {
|
||||
nScenesOfThisSystem++;
|
||||
}
|
||||
if (scenes [i] -> GetGraphicsSystem () == &gs) {
|
||||
nScenesOfThisSystem++;
|
||||
}
|
||||
}
|
||||
if (nScenesOfThisSystem) {
|
||||
os << "\n Its scenes are: ";
|
||||
for (size_t i = 0; i < nScenes; i++) {
|
||||
if (scenes [i] -> GetGraphicsSystem () == &gs) {
|
||||
os << "\n " << *(scenes [i]);
|
||||
}
|
||||
}
|
||||
os << "\n Its scenes are: ";
|
||||
for (size_t i = 0; i < nScenes; i++) {
|
||||
if (scenes [i] -> GetGraphicsSystem () == &gs) {
|
||||
os << "\n " << *(scenes [i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
os << "\n It has no scenes at present.";
|
||||
os << "\n It has no scenes at present.";
|
||||
}
|
||||
}
|
||||
else {
|
||||
os << "\n There are no scenes instantiated at present.";
|
||||
}
|
||||
}
|
||||
|
||||
return os;
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4VSceneHandler.cc 87360 2014-12-01 16:07:16Z gcosmo $
|
||||
// $Id: G4VSceneHandler.cc 91686 2015-07-31 09:40:08Z gcosmo $
|
||||
//
|
||||
//
|
||||
// John Allison 19th July 1996
|
||||
@@ -584,7 +584,7 @@ void G4VSceneHandler::ProcessScene () {
|
||||
#endif
|
||||
if (runManager) {
|
||||
const G4Run* run = runManager->GetCurrentRun();
|
||||
const std::vector<const G4Event*>* events =
|
||||
const std::vector<const G4Event*>* events =
|
||||
run? run->GetEventVector(): 0;
|
||||
size_t nKeptEvents = 0;
|
||||
if (events) nKeptEvents = events->size();
|
||||
@@ -604,10 +604,9 @@ void G4VSceneHandler::ProcessScene () {
|
||||
if (verbosity >= G4VisManager::confirmations) {
|
||||
G4cout << "Refreshing events in run..." << G4endl;
|
||||
}
|
||||
for (size_t i = 0; i < nKeptEvents; ++i) {
|
||||
const G4Event* event = (*events)[i];
|
||||
if (event) DrawEvent(event);
|
||||
}
|
||||
for (auto&& event: *events) {
|
||||
if (event) DrawEvent(event);
|
||||
}
|
||||
|
||||
if (!fpScene->GetRefreshAtEndOfRun()) {
|
||||
if (verbosity >= G4VisManager::warnings) {
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4VViewer.cc 66373 2012-12-18 09:41:34Z gcosmo $
|
||||
// $Id: G4VViewer.cc 90651 2015-06-05 13:30:54Z gcosmo $
|
||||
//
|
||||
//
|
||||
// John Allison 27th March 1996
|
||||
@@ -131,6 +131,35 @@ void G4VViewer::SetViewParameters (const G4ViewParameters& vp) {
|
||||
fVP = vp;
|
||||
}
|
||||
|
||||
|
||||
#ifdef G4MULTITHREADED
|
||||
|
||||
void G4VViewer::DoneWithMasterThread () {
|
||||
// G4cout << "G4VViewer::DoneWithMasterThread" << G4endl;
|
||||
}
|
||||
|
||||
void G4VViewer::MovingToMasterThread () {
|
||||
// G4cout << "G4VViewer::MovingToMasterThread" << G4endl;
|
||||
}
|
||||
|
||||
void G4VViewer::SwitchToVisSubThread () {
|
||||
// G4cout << "G4VViewer::SwitchToVisSubThread" << G4endl;
|
||||
}
|
||||
|
||||
void G4VViewer::DoneWithVisSubThread () {
|
||||
// G4cout << "G4VViewer::DoneWithVisSubThread" << G4endl;
|
||||
}
|
||||
|
||||
void G4VViewer::MovingToVisSubThread () {
|
||||
// G4cout << "G4VViewer::MovingToVisSubThread" << G4endl;
|
||||
}
|
||||
|
||||
void G4VViewer::SwitchToMasterThread () {
|
||||
// G4cout << "G4VViewer::SwitchToMasterThread" << G4endl;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
std::ostream& operator << (std::ostream& os, const G4VViewer& v) {
|
||||
os << "View " << v.fName << ":\n";
|
||||
os << v.fVP;
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4ViewParameters.cc 85021 2014-10-23 09:53:47Z gcosmo $
|
||||
// $Id: G4ViewParameters.cc 91686 2015-07-31 09:40:08Z gcosmo $
|
||||
//
|
||||
//
|
||||
// John Allison 19th July 1996
|
||||
@@ -475,12 +475,12 @@ G4String G4ViewParameters::TouchableCommands() const
|
||||
return oss.str();
|
||||
}
|
||||
|
||||
G4ModelingParameters::PVNameCopyNoPath lastPath;
|
||||
std::vector<G4ModelingParameters::VisAttributesModifier>::const_iterator
|
||||
iModifier;
|
||||
for (iModifier = vams.begin();
|
||||
iModifier != vams.end();
|
||||
++iModifier) {
|
||||
static G4ModelingParameters::PVNameCopyNoPath lastPath;
|
||||
const G4ModelingParameters::PVNameCopyNoPath& vamPath =
|
||||
iModifier->GetPVNameCopyNoPath();
|
||||
if (vamPath != lastPath) {
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4VisCommands.cc 87360 2014-12-01 16:07:16Z gcosmo $
|
||||
// $Id: G4VisCommands.cc 93025 2015-09-30 16:02:12Z gcosmo $
|
||||
|
||||
// /vis/ top level commands - John Allison 5th February 2001
|
||||
|
||||
@@ -153,7 +153,7 @@ void G4VisCommandList::SetNewValue (G4UIcommand*, G4String newValue)
|
||||
G4VisManager::Verbosity verbosity =
|
||||
fpVisManager->GetVerbosityValue(verbosityString);
|
||||
|
||||
fpVisManager->PrintAvailableGraphicsSystems();
|
||||
fpVisManager->PrintAvailableGraphicsSystems(verbosity);
|
||||
G4cout << G4endl;
|
||||
fpVisManager->PrintAvailableModels(verbosity);
|
||||
G4cout << G4endl;
|
||||
@@ -162,8 +162,8 @@ void G4VisCommandList::SetNewValue (G4UIcommand*, G4String newValue)
|
||||
fpVisManager->PrintAvailableColours(verbosity);
|
||||
G4cout << G4endl;
|
||||
G4UImanager* UImanager = G4UImanager::GetUIpointer();
|
||||
UImanager->ApplyCommand("/vis/scene/list ! c");
|
||||
UImanager->ApplyCommand("/vis/viewer/list ! c");
|
||||
UImanager->ApplyCommand("/vis/scene/list ! " + newValue);
|
||||
UImanager->ApplyCommand("/vis/viewer/list ! " + newValue);
|
||||
|
||||
G4cout <<
|
||||
"\nAttributes available for modeling and filtering with"
|
||||
@@ -190,7 +190,7 @@ void G4VisCommandList::SetNewValue (G4UIcommand*, G4String newValue)
|
||||
|
||||
if (verbosity < G4VisManager::parameters)
|
||||
G4cout <<
|
||||
"\nTo get more information, \"/vis/list all all\" or use individual commands"
|
||||
"\nTo get more information, \"/vis/list all\" or use individual commands"
|
||||
"\n such as (use \"ls\" or \"help\"):"
|
||||
"\n /vis/scene/list all all"
|
||||
"\n /vis/viewer/list all all"
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4VisCommandsCompound.cc 82050 2014-06-10 08:24:52Z gcosmo $
|
||||
// $Id: G4VisCommandsCompound.cc 91686 2015-07-31 09:40:08Z gcosmo $
|
||||
|
||||
// Compound /vis/ commands - John Allison 15th May 2000
|
||||
|
||||
@@ -238,22 +238,6 @@ G4VisCommandOpen::G4VisCommandOpen() {
|
||||
("The scene handler becomes current (the name is auto-generated).");
|
||||
G4UIparameter* parameter;
|
||||
parameter = new G4UIparameter("graphics-system-name", 's', omitable = false);
|
||||
const G4GraphicsSystemList& gslist =
|
||||
fpVisManager->GetAvailableGraphicsSystems();
|
||||
G4String candidates;
|
||||
for (size_t igslist = 0; igslist < gslist.size(); igslist++) {
|
||||
const G4String& name = gslist[igslist]->GetName();
|
||||
const G4String& nickname = gslist[igslist]->GetNickname();
|
||||
if (nickname.isNull()) {
|
||||
candidates += name;
|
||||
}
|
||||
else {
|
||||
candidates += nickname;
|
||||
}
|
||||
candidates += " ";
|
||||
}
|
||||
candidates = candidates.strip();
|
||||
parameter->SetParameterCandidates(candidates);
|
||||
fpCommand->SetParameter(parameter);
|
||||
parameter = new G4UIparameter("window-size-hint", 's', omitable = true);
|
||||
parameter->SetGuidance
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4VisCommandsGeometry.cc 82799 2014-07-10 13:18:29Z gcosmo $
|
||||
// $Id: G4VisCommandsGeometry.cc 88762 2015-03-09 12:25:11Z gcosmo $
|
||||
|
||||
// /vis/geometry commands - John Allison 31st January 2006
|
||||
|
||||
@@ -75,9 +75,13 @@ void G4VisCommandGeometryList::SetNewValue(G4UIcommand*, G4String newValue)
|
||||
const G4String& logVolName = pLV->GetName();
|
||||
if (newValue == "all" || logVolName == newValue) {
|
||||
const G4VisAttributes* visAtts = pLV->GetVisAttributes();
|
||||
G4cout << "\nLogical Volume \"" << pLV->GetName()
|
||||
<< "\": vis attributes:\n" << *visAtts
|
||||
<< G4endl;
|
||||
G4cout << "\nLogical Volume \"" << pLV->GetName() << "\":";
|
||||
if (visAtts) {
|
||||
G4cout << '\n' << *visAtts;
|
||||
} else {
|
||||
G4cout << " no vis attributes";
|
||||
}
|
||||
G4cout << G4endl;
|
||||
}
|
||||
if (logVolName == newValue) found = true;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,130 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4VisCommandsMultithreading.cc 88742 2015-03-08 13:12:57Z allison $
|
||||
|
||||
// /vis/multithreading commands - John Allison 29th September 2015
|
||||
|
||||
#ifdef G4MULTITHREADED
|
||||
|
||||
#include "G4VisCommandsMultithreading.hh"
|
||||
|
||||
#include "G4UIcmdWithAnInteger.hh"
|
||||
#include "G4UIcmdWithAString.hh"
|
||||
#include "G4VisManager.hh"
|
||||
|
||||
////////////// /vis/multithreading/actionOnEventQueueFull ///////////////////////////////////////
|
||||
|
||||
G4VisCommandMultithreadingActionOnEventQueueFull::G4VisCommandMultithreadingActionOnEventQueueFull()
|
||||
{
|
||||
G4bool omitable;
|
||||
fpCommand = new G4UIcmdWithAString("/vis/multithreading/actionOnEventQueueFull", this);
|
||||
fpCommand->SetGuidance("When event queue for drawing gets full:");
|
||||
fpCommand->SetGuidance("wait: event processing waits for vis manager to catch up.");
|
||||
fpCommand->SetGuidance("discard: events are discarded for drawing.");
|
||||
fpCommand->SetCandidates("wait discard");
|
||||
fpCommand->SetParameterName ("wait", omitable = true);
|
||||
fpCommand->SetDefaultValue ("wait");
|
||||
}
|
||||
|
||||
G4VisCommandMultithreadingActionOnEventQueueFull::~G4VisCommandMultithreadingActionOnEventQueueFull()
|
||||
{
|
||||
delete fpCommand;
|
||||
}
|
||||
|
||||
G4String G4VisCommandMultithreadingActionOnEventQueueFull::GetCurrentValue(G4UIcommand*)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
void G4VisCommandMultithreadingActionOnEventQueueFull::SetNewValue(G4UIcommand*, G4String newValue)
|
||||
{
|
||||
G4VisManager::Verbosity verbosity = fpVisManager->GetVerbosity();
|
||||
|
||||
if (newValue == "wait") {
|
||||
fpVisManager->SetWaitOnEventQueueFull(true);
|
||||
} else {
|
||||
fpVisManager->SetWaitOnEventQueueFull(false);
|
||||
}
|
||||
|
||||
if (verbosity >= G4VisManager::confirmations) {
|
||||
G4cout <<
|
||||
"When event queue for drawing is full,";
|
||||
if (fpVisManager->GetWaitOnEventQueueFull()) {
|
||||
G4cout << " event processing will wait";
|
||||
} else {
|
||||
G4cout << " events will be discarded for drawing";
|
||||
}
|
||||
G4cout << G4endl;
|
||||
}
|
||||
}
|
||||
|
||||
////////////// /vis/multithreading/maxEventQueueSize ///////////////////////////////////////
|
||||
|
||||
G4VisCommandMultithreadingMaxEventQueueSize::G4VisCommandMultithreadingMaxEventQueueSize()
|
||||
{
|
||||
G4bool omitable;
|
||||
fpCommand = new G4UIcmdWithAnInteger("/vis/multithreading/maxEventQueueSize", this);
|
||||
fpCommand->SetGuidance
|
||||
("Defines maximum event queue size. N <=0 means \"unlimited\".");
|
||||
fpCommand->SetGuidance
|
||||
("If adding an event to the visualisation event queue would cause the"
|
||||
" queue size to exceed this value:");
|
||||
fpCommand->SetGuidance
|
||||
(" if actionOnEventQueueFull==wait the worker threads are paused for a short"
|
||||
" time to give the visualisation manager a chance to catch up.");
|
||||
fpCommand->SetGuidance
|
||||
(" if actionOnEventQueueFull==discard the event is discarded for drawing.");
|
||||
fpCommand->SetParameterName ("maxSize", omitable = true);
|
||||
fpCommand->SetDefaultValue (100);
|
||||
}
|
||||
|
||||
G4VisCommandMultithreadingMaxEventQueueSize::~G4VisCommandMultithreadingMaxEventQueueSize()
|
||||
{
|
||||
delete fpCommand;
|
||||
}
|
||||
|
||||
G4String G4VisCommandMultithreadingMaxEventQueueSize::GetCurrentValue(G4UIcommand*)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
void G4VisCommandMultithreadingMaxEventQueueSize::SetNewValue(G4UIcommand*, G4String newValue)
|
||||
{
|
||||
G4VisManager::Verbosity verbosity = fpVisManager->GetVerbosity();
|
||||
|
||||
G4int maxEventQueueSize = fpCommand->GetNewIntValue(newValue);
|
||||
fpVisManager->SetMaxEventQueueSize(maxEventQueueSize);
|
||||
|
||||
if (verbosity >= G4VisManager::confirmations) {
|
||||
G4cout <<
|
||||
"Maximum event queue size has been set to "
|
||||
<< fpVisManager->GetMaxEventQueueSize()
|
||||
<< G4endl;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4VisCommandsSceneAdd.cc 87360 2014-12-01 16:07:16Z gcosmo $
|
||||
// $Id: G4VisCommandsSceneAdd.cc 93069 2015-10-02 09:54:27Z gcosmo $
|
||||
// /vis/scene/add commands - John Allison 9th August 1998
|
||||
|
||||
#include "G4VisCommandsSceneAdd.hh"
|
||||
@@ -642,21 +642,32 @@ void G4VisCommandSceneAddEventID::EventID::operator()
|
||||
oss << "Run " << runID << " Event " << eventID;
|
||||
} else {
|
||||
G4int nEvents = 0;
|
||||
#ifdef G4MULTITHREADED
|
||||
if (G4Threading::G4GetThreadId() != G4Threading::MASTER_ID) {
|
||||
// Vis sub-thread - run in progress
|
||||
#else
|
||||
G4StateManager* stateManager = G4StateManager::GetStateManager();
|
||||
G4ApplicationState state = stateManager->GetCurrentState();
|
||||
if (state == G4State_EventProc) {
|
||||
nEvents = currentRun->GetNumberOfEventToBeProcessed();
|
||||
// Run in progress
|
||||
#endif
|
||||
nEvents = currentRun->GetNumberOfEventToBeProcessed();
|
||||
} else {
|
||||
const std::vector<const G4Event*>* events =
|
||||
currentRun->GetEventVector();
|
||||
if (events) nEvents = events->size();
|
||||
// Rebuilding from kept events
|
||||
const std::vector<const G4Event*>* events =
|
||||
currentRun->GetEventVector();
|
||||
if (events) nEvents = events->size();
|
||||
}
|
||||
#ifndef G4MULTITHREADED
|
||||
// In sequential mode we can recognise the last event and avoid
|
||||
// drawing the event ID. But for MT mode there is no way of
|
||||
// knowing so we have to accept that the event ID will be drawn
|
||||
// at each event, the same characters over and over - but hey!
|
||||
if (eventID < nEvents - 1) return; // Not last event.
|
||||
else {
|
||||
oss << "Run " << runID << " (" << nEvents << " event";
|
||||
if (nEvents != 1) oss << 's';
|
||||
oss << ')';
|
||||
}
|
||||
#endif
|
||||
oss << "Run " << runID << " (" << nEvents << " event";
|
||||
if (nEvents != 1) oss << 's';
|
||||
oss << ')';
|
||||
}
|
||||
G4Text text(oss.str(), G4Point3D(fX, fY, 0.));
|
||||
text.SetScreenSize(fSize);
|
||||
@@ -675,9 +686,14 @@ G4VisCommandSceneAddExtent::G4VisCommandSceneAddExtent () {
|
||||
fpCommand = new G4UIcommand("/vis/scene/add/extent", this);
|
||||
fpCommand -> SetGuidance
|
||||
("Adds a dummy model with given extent to the current scene."
|
||||
"\nRequires the limits: xmin, xmax, ymin, ymax, zmin, zmax unit."
|
||||
"\nThis can be used to provide an extent to the scene even if"
|
||||
"\nno other models with extent are available. For example,"
|
||||
"\neven if there is no geometry.");
|
||||
"\neven if there is no geometry. In that case, for example:"
|
||||
"\n /vis/open OGL"
|
||||
"\n /vis/scene/create"
|
||||
"\n /vis/scene/add/extent -300 300 -300 300 -300 300 cm"
|
||||
"\n /vis/sceneHandler/attach");
|
||||
G4bool omitable;
|
||||
G4UIparameter* parameter;
|
||||
parameter = new G4UIparameter ("xmin", 'd', omitable = true);
|
||||
@@ -1702,14 +1718,12 @@ void G4VisCommandSceneAddLogo2D::Logo2D::operator()
|
||||
////////////// /vis/scene/add/magneticField ///////////////////////////////////////
|
||||
|
||||
G4VisCommandSceneAddMagneticField::G4VisCommandSceneAddMagneticField () {
|
||||
G4bool ommitable;
|
||||
fpCommand = new G4UIcmdWithAnInteger ("/vis/scene/add/magneticField", this);
|
||||
fpCommand->SetParameterName("nDataPointsPerHalfScene",ommitable=true);
|
||||
fpCommand->SetDefaultValue(10);
|
||||
G4bool omitable;
|
||||
fpCommand = new G4UIcommand ("/vis/scene/add/magneticField", this);
|
||||
fpCommand -> SetGuidance
|
||||
("Adds magnetic field representation to current scene.");
|
||||
fpCommand -> SetGuidance
|
||||
("The parameter is no. of data points per half scene. So, possibly, at"
|
||||
("The first parameter is no. of data points per half scene. So, possibly, at"
|
||||
"\nmaximum, the number of data points sampled is (2*n+1)^3, which can grow"
|
||||
"\nlarge--be warned!"
|
||||
"\nYou might find that your scene is cluttered by thousands of arrows for"
|
||||
@@ -1721,6 +1735,14 @@ G4VisCommandSceneAddMagneticField::G4VisCommandSceneAddMagneticField () {
|
||||
("In the arrow representation, the length of the arrow is proportional"
|
||||
"\nto the magnitude of the field and the colour is mapped onto the range"
|
||||
"\nas a fraction of the maximum magnitude: 0->0.5->1 is blue->green->red.");
|
||||
G4UIparameter* parameter;
|
||||
parameter = new G4UIparameter ("nDataPointsPerHalfScene", 'i', omitable = true);
|
||||
parameter -> SetDefaultValue (10);
|
||||
fpCommand -> SetParameter (parameter);
|
||||
parameter = new G4UIparameter ("representation", 's', omitable = true);
|
||||
parameter -> SetParameterCandidates("fullArrow lightArrow");
|
||||
parameter -> SetDefaultValue ("fullArrow");
|
||||
fpCommand -> SetParameter (parameter);
|
||||
}
|
||||
|
||||
G4VisCommandSceneAddMagneticField::~G4VisCommandSceneAddMagneticField () {
|
||||
@@ -1745,10 +1767,17 @@ void G4VisCommandSceneAddMagneticField::SetNewValue
|
||||
return;
|
||||
}
|
||||
|
||||
G4int nDataPointsPerHalfScene = fpCommand->GetNewIntValue(newValue);
|
||||
|
||||
G4int nDataPointsPerHalfScene;
|
||||
G4String representation;
|
||||
std::istringstream iss(newValue);
|
||||
iss >> nDataPointsPerHalfScene >> representation;
|
||||
G4MagneticFieldModel::Representation
|
||||
modelRepresentation = G4MagneticFieldModel::fullArrow;
|
||||
if (representation == "lightArrow") {
|
||||
modelRepresentation = G4MagneticFieldModel::lightArrow;
|
||||
}
|
||||
G4MagneticFieldModel* model =
|
||||
new G4MagneticFieldModel(nDataPointsPerHalfScene);
|
||||
new G4MagneticFieldModel(nDataPointsPerHalfScene,modelRepresentation);
|
||||
const G4String& currentSceneName = pScene -> GetName ();
|
||||
G4bool successful = pScene -> AddRunDurationModel (model, warn);
|
||||
if (successful) {
|
||||
@@ -1756,7 +1785,10 @@ void G4VisCommandSceneAddMagneticField::SetNewValue
|
||||
G4cout << "Magnetic field, if any, will be drawn in scene \""
|
||||
<< currentSceneName
|
||||
<< "\"\n with "
|
||||
<< nDataPointsPerHalfScene << " data points per half scene."
|
||||
<< nDataPointsPerHalfScene
|
||||
<< " data points per half scene and with representation \""
|
||||
<< representation
|
||||
<< '\"'
|
||||
<< G4endl;
|
||||
}
|
||||
}
|
||||
@@ -2675,8 +2707,9 @@ G4VisCommandSceneAddVolume::G4VisCommandSceneAddVolume () {
|
||||
fpCommand -> SetGuidance
|
||||
("If clip-volume-type is specified, the subsequent parameters are used to"
|
||||
"\nto define a clipping volume. For example,"
|
||||
"\n\"vis/scene/add/volume ! ! ! -box km 0 1 0 1 0 1\" will draw the world"
|
||||
"\nwith the positive octant cut away.");
|
||||
"\n\"/vis/scene/add/volume ! ! ! -box km 0 1 0 1 0 1\" will draw the world"
|
||||
"\nwith the positive octant cut away. (If the Boolean Processor issues"
|
||||
"\nwarnings try replacing 0 by 0.000000001 or something.)");
|
||||
fpCommand -> SetGuidance
|
||||
("If clip-volume-type is prepended with '-', the clip-volume is subtracted"
|
||||
"\n(cutaway). (This is the default if there is no prepended character.)"
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4VisCommandsSceneHandler.cc 82756 2014-07-08 14:09:34Z gcosmo $
|
||||
// $Id: G4VisCommandsSceneHandler.cc 91721 2015-08-03 12:06:54Z gcosmo $
|
||||
|
||||
// /vis/sceneHandler commands - John Allison 10th October 1998
|
||||
|
||||
@@ -150,16 +150,11 @@ G4VisCommandSceneHandlerCreate::G4VisCommandSceneHandlerCreate (): fId (0) {
|
||||
const G4GraphicsSystemList& gslist =
|
||||
fpVisManager -> GetAvailableGraphicsSystems ();
|
||||
G4String candidates;
|
||||
for (size_t igslist = 0; igslist < gslist.size (); igslist++) {
|
||||
const G4String& name = gslist [igslist] -> GetName ();
|
||||
const G4String& nickname = gslist [igslist] -> GetNickname ();
|
||||
if (nickname.isNull ()) {
|
||||
candidates += name;
|
||||
}
|
||||
else {
|
||||
candidates += nickname;
|
||||
}
|
||||
candidates += " ";
|
||||
for (auto&& gs: gslist) {
|
||||
const G4String& name = gs -> GetName ();
|
||||
candidates += name + ' ';
|
||||
for (auto&& nickname: gs -> GetNicknames ())
|
||||
candidates += nickname + ' ';
|
||||
}
|
||||
candidates = candidates.strip ();
|
||||
parameter -> SetParameterCandidates(candidates);
|
||||
@@ -213,7 +208,7 @@ void G4VisCommandSceneHandlerCreate::SetNewValue (G4UIcommand*,
|
||||
|
||||
const G4GraphicsSystemList& gsl =
|
||||
fpVisManager -> GetAvailableGraphicsSystems ();
|
||||
int nSystems = gsl.size ();
|
||||
G4int nSystems = gsl.size ();
|
||||
if (nSystems <= 0) {
|
||||
if (verbosity >= G4VisManager::errors) {
|
||||
G4cerr << "ERROR: G4VisCommandSceneHandlerCreate::SetNewValue:"
|
||||
@@ -224,56 +219,97 @@ void G4VisCommandSceneHandlerCreate::SetNewValue (G4UIcommand*,
|
||||
}
|
||||
return;
|
||||
}
|
||||
int iGS; // Selector index.
|
||||
G4int iGS; // Selector index.
|
||||
G4bool found = false;
|
||||
for (iGS = 0; iGS < nSystems; iGS++) {
|
||||
if (graphicsSystem.compareTo (gsl [iGS] -> GetName (),
|
||||
G4String::ignoreCase) == 0 ||
|
||||
graphicsSystem.compareTo (gsl [iGS] -> GetNickname (),
|
||||
G4String::ignoreCase) == 0) {
|
||||
break; // Match found.
|
||||
auto&& gs = gsl[iGS];
|
||||
if (graphicsSystem.compareTo(gs->GetName(), G4String::ignoreCase) == 0) {
|
||||
found = true;
|
||||
break; // Match found
|
||||
} else {
|
||||
auto&& nicknames = gs->GetNicknames();
|
||||
for (size_t i = 0; i < nicknames.size(); ++i) {
|
||||
auto&& nickname = nicknames[i];
|
||||
if (graphicsSystem.compareTo (nickname, G4String::ignoreCase) == 0) {
|
||||
found = true;
|
||||
break; // Match found
|
||||
}
|
||||
}
|
||||
if (found) {
|
||||
break; // Match found
|
||||
}
|
||||
}
|
||||
}
|
||||
if (iGS < 0 || iGS >= nSystems) {
|
||||
if (!found) {
|
||||
// Invalid command line argument or none.
|
||||
// This shouldn't happen!!!!!!
|
||||
if (verbosity >= G4VisManager::errors) {
|
||||
G4cerr << "ERROR: G4VisCommandSceneHandlerCreate::SetNewValue:"
|
||||
" invalid graphics system specified."
|
||||
<< G4endl;
|
||||
G4cerr <<
|
||||
"ERROR: G4VisCommandSceneHandlerCreate::SetNewValue:"
|
||||
"\n invalid graphics system \""
|
||||
<< graphicsSystem
|
||||
<< "\" requested."
|
||||
<< G4endl;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// Check UI session compatibility.
|
||||
if (!gsl[iGS]->IsUISessionCompatible()) {
|
||||
G4bool fallback = false;
|
||||
while (!gsl[iGS]->IsUISessionCompatible()) {
|
||||
// Not compatible, search for a fallback
|
||||
fallback = false;
|
||||
G4String fallbackNickname = gsl[iGS]->GetNickname() + "_FALLBACK";
|
||||
for (iGS = 0; iGS < nSystems; iGS++) {
|
||||
if (fallbackNickname.compareTo (gsl [iGS] -> GetNickname (),
|
||||
G4String::ignoreCase) == 0) {
|
||||
break; // Match found.
|
||||
auto&& nicknames = gsl[iGS]->GetNicknames();
|
||||
for (size_t i = 0; i < nicknames.size(); ++i) {
|
||||
auto&& nickname = nicknames[i];
|
||||
if (fallbackNickname.compareTo (nickname, G4String::ignoreCase) == 0) {
|
||||
fallback = true;
|
||||
break; // Match found
|
||||
}
|
||||
}
|
||||
if (fallback) {
|
||||
break; // Match found
|
||||
}
|
||||
}
|
||||
if (iGS < 0 || iGS >= nSystems) {
|
||||
if (verbosity >= G4VisManager::errors) {
|
||||
G4cerr << "ERROR: G4VisCommandSceneHandlerCreate::SetNewValue:"
|
||||
" could not find fallback graphics system."
|
||||
G4cerr <<
|
||||
"ERROR: G4VisCommandSceneHandlerCreate::SetNewValue:"
|
||||
" could not find fallback graphics system for \""
|
||||
<< graphicsSystem
|
||||
<< "\"."
|
||||
<< G4endl;
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (verbosity >= G4VisManager::warnings) {
|
||||
G4cout << "WARNING: G4VisCommandSceneHandlerCreate::SetNewValue:"
|
||||
" using fallback graphics system."
|
||||
<< G4endl;
|
||||
}
|
||||
// A fallback system found...but go back and check this too.
|
||||
}
|
||||
|
||||
// A graphics system has been found
|
||||
G4VGraphicsSystem* pSystem = gsl [iGS];
|
||||
|
||||
if (fallback && verbosity >= G4VisManager::warnings) {
|
||||
G4cout << "WARNING: G4VisCommandSceneHandlerCreate::SetNewValue:"
|
||||
"\n Using fallback graphics system: "
|
||||
<< pSystem -> GetName ()
|
||||
<< " ("
|
||||
<< pSystem -> GetNickname ()
|
||||
<< ')'
|
||||
<< G4endl;
|
||||
}
|
||||
|
||||
// Set current graphics system in preparation for
|
||||
// creating scene handler.
|
||||
G4VGraphicsSystem* pSystem = gsl [iGS];
|
||||
fpVisManager -> SetCurrentGraphicsSystem (pSystem);
|
||||
if (verbosity >= G4VisManager::confirmations) {
|
||||
G4cout << "Graphics system set to " << pSystem -> GetName () << G4endl;
|
||||
G4cout << "Graphics system set to "
|
||||
<< pSystem -> GetName ()
|
||||
<< " ("
|
||||
<< pSystem -> GetNickname ()
|
||||
<< ')'
|
||||
<< G4endl;
|
||||
}
|
||||
|
||||
// Now deal with name of scene handler.
|
||||
|
||||
@@ -118,7 +118,7 @@ G4VisCommandSetLineWidth::G4VisCommandSetLineWidth ()
|
||||
G4bool omitable;
|
||||
fpCommand = new G4UIcmdWithADouble("/vis/set/lineWidth", this);
|
||||
fpCommand->SetGuidance
|
||||
("Defines line width for future \"/vis/scene/add/\" commands.");
|
||||
("Defines line width for future \"/vis/scene/add/\" commands.");
|
||||
fpCommand->SetParameterName ("lineWidth", omitable = true);
|
||||
fpCommand->SetDefaultValue (1.);
|
||||
fpCommand->SetRange("lineWidth >= 1.");
|
||||
@@ -142,7 +142,7 @@ void G4VisCommandSetLineWidth::SetNewValue (G4UIcommand*, G4String newValue)
|
||||
|
||||
if (verbosity >= G4VisManager::confirmations) {
|
||||
G4cout <<
|
||||
"Line width for future \"/vis/scene/add/\" commands has been set to "
|
||||
"Line width for future \"/vis/scene/add/\" commands has been set to "
|
||||
<< fCurrentLineWidth
|
||||
<< G4endl;
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4VisCommandsViewer.cc 83403 2014-08-21 15:07:30Z gcosmo $
|
||||
// $Id: G4VisCommandsViewer.cc 93303 2015-10-15 15:19:40Z gcosmo $
|
||||
|
||||
// /vis/viewer commands - John Allison 25th October 1998
|
||||
|
||||
@@ -1315,6 +1315,8 @@ G4VisCommandViewerSave::G4VisCommandViewerSave () {
|
||||
fpCommand = new G4UIcmdWithAString ("/vis/viewer/save", this);
|
||||
fpCommand -> SetGuidance
|
||||
("Write commands that define the current view to file.");
|
||||
fpCommand -> SetGuidance
|
||||
("Read them back into the same or any viewer with \"/control/execute <filename>\".");
|
||||
fpCommand -> SetParameterName ("file-name", omitable = true);
|
||||
fpCommand -> SetDefaultValue ("G4cout");
|
||||
}
|
||||
@@ -1419,7 +1421,9 @@ void G4VisCommandViewerSave::SetNewValue (G4UIcommand*, G4String newValue) {
|
||||
if (newValue == "G4cout") {
|
||||
G4cout << "G4cout.";
|
||||
} else {
|
||||
G4cout << "file \'" << newValue << "\".";
|
||||
G4cout << "file \'" << newValue << "\"." <<
|
||||
"\n Read view parameters back into this or any viewer with"
|
||||
"\n \"/control/execute " << newValue << "\"";
|
||||
}
|
||||
G4cout << G4endl;
|
||||
}
|
||||
|
||||
@@ -23,17 +23,22 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4VisManager.cc 87360 2014-12-01 16:07:16Z gcosmo $
|
||||
// $Id: G4VisManager.cc 94688 2015-12-02 17:15:08Z gunter $
|
||||
//
|
||||
//
|
||||
// GEANT4 Visualization Manager - John Allison 02/Jan/1996.
|
||||
|
||||
#include "G4VisManager.hh"
|
||||
|
||||
#ifndef __MIC__
|
||||
#define G4VIS_USE_STD11
|
||||
#endif
|
||||
|
||||
#include "G4VisCommands.hh"
|
||||
#include "G4VisCommandsCompound.hh"
|
||||
#include "G4VisCommandsGeometry.hh"
|
||||
#include "G4VisCommandsGeometrySet.hh"
|
||||
#include "G4VisCommandsMultithreading.hh"
|
||||
#include "G4VisCommandsSet.hh"
|
||||
#include "G4VisCommandsScene.hh"
|
||||
#include "G4VisCommandsSceneAdd.hh"
|
||||
@@ -78,8 +83,17 @@
|
||||
#include <sstream>
|
||||
|
||||
#ifdef G4MULTITHREADED
|
||||
#include "G4MTRunManager.hh"
|
||||
#include "G4Threading.hh"
|
||||
#include "G4AutoLock.hh"
|
||||
#include "G4GeometryWorkspacePool.hh"
|
||||
#include "G4SolidsWorkspacePool.hh"
|
||||
#include <deque>
|
||||
#include <typeinfo>
|
||||
#ifdef G4VIS_USE_STD11
|
||||
#include <chrono>
|
||||
#include <thread>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
G4VisManager* G4VisManager::fpInstance = 0;
|
||||
@@ -97,6 +111,7 @@ G4VisManager::G4VisManager (const G4String& verbosityString):
|
||||
fEventRefreshing (false),
|
||||
fTransientsDrawnThisRun (false),
|
||||
fTransientsDrawnThisEvent (false),
|
||||
fNoOfEventsDrawnThisRun (0),
|
||||
fNKeepRequests (0),
|
||||
fEventKeepingSuspended (false),
|
||||
fKeptLastEvent (false),
|
||||
@@ -105,6 +120,10 @@ G4VisManager::G4VisManager (const G4String& verbosityString):
|
||||
fIsDrawGroup (false),
|
||||
fDrawGroupNestingDepth (0),
|
||||
fIgnoreStateChanges (false)
|
||||
#ifdef G4MULTITHREADED
|
||||
, fMaxEventQueueSize (100)
|
||||
, fWaitOnEventQueueFull (true)
|
||||
#endif
|
||||
// All other objects use default constructors.
|
||||
{
|
||||
fpTrajDrawModelMgr = new G4VisModelManager<G4VTrajectoryModel>("/vis/modeling/trajectories");
|
||||
@@ -274,7 +293,7 @@ void G4VisManager::Initialise () {
|
||||
G4cout <<
|
||||
"\nYou have successfully registered the following graphics systems."
|
||||
<< G4endl;
|
||||
PrintAvailableGraphicsSystems ();
|
||||
PrintAvailableGraphicsSystems (fVerbosity);
|
||||
G4cout << G4endl;
|
||||
}
|
||||
|
||||
@@ -387,6 +406,14 @@ void G4VisManager::RegisterMessengers () {
|
||||
RegisterMessenger(new G4VisCommandGeometrySetForceWireframe);
|
||||
RegisterMessenger(new G4VisCommandGeometrySetVisibility);
|
||||
|
||||
#ifdef G4MULTITHREADED
|
||||
directory = new G4UIdirectory ("/vis/multithreading/");
|
||||
directory -> SetGuidance("Commands unique to multithreading mode.");
|
||||
fDirectoryList.push_back (directory);
|
||||
RegisterMessenger(new G4VisCommandMultithreadingActionOnEventQueueFull);
|
||||
RegisterMessenger(new G4VisCommandMultithreadingMaxEventQueueSize);
|
||||
#endif
|
||||
|
||||
directory = new G4UIdirectory ("/vis/set/");
|
||||
directory -> SetGuidance
|
||||
("Set quantities for use in future commands where appropriate.");
|
||||
@@ -891,7 +918,13 @@ void G4VisManager::Draw (const G4VTrajectory& traj) {
|
||||
// A trajectory needs a trajectories model to provide G4Atts, etc.
|
||||
static G4TrajectoriesModel trajectoriesModel;
|
||||
trajectoriesModel.SetCurrentTrajectory(&traj);
|
||||
const G4Run* currentRun = G4RunManager::GetRunManager()->GetCurrentRun();
|
||||
G4RunManager* runManager = G4RunManager::GetRunManager();
|
||||
#ifdef G4MULTITHREADED
|
||||
if (G4Threading::IsMultithreadedApplication()) {
|
||||
runManager = G4MTRunManager::GetMasterRunManager();
|
||||
}
|
||||
#endif
|
||||
const G4Run* currentRun = runManager->GetCurrentRun();
|
||||
if (currentRun) {
|
||||
trajectoriesModel.SetRunID(currentRun->GetRunID());
|
||||
}
|
||||
@@ -1401,42 +1434,32 @@ void G4VisManager::SetCurrentViewer (G4VViewer* pViewer) {
|
||||
}
|
||||
}
|
||||
|
||||
namespace {
|
||||
struct NicknameComparison {
|
||||
bool operator() (const G4String& lhs, const G4String& rhs) const
|
||||
{return lhs.length()<rhs.length();}
|
||||
};
|
||||
}
|
||||
|
||||
void G4VisManager::PrintAvailableGraphicsSystems () const {
|
||||
G4int nSystems = fAvailableGraphicsSystems.size ();
|
||||
G4cout << "Current available graphics systems are:";
|
||||
if (nSystems) {
|
||||
// Make a map of graphics systems names (there may be repeated systems)
|
||||
// and for each name a set of nicknames. The nicknames are ordered
|
||||
// by length - see struct NicknameComparison above.
|
||||
std::map<G4String,std::set<G4String,NicknameComparison> > systemMap;
|
||||
for (G4int i = 0; i < nSystems; i++) {
|
||||
const G4VGraphicsSystem* pSystem = fAvailableGraphicsSystems[i];
|
||||
systemMap[pSystem->GetName()].insert(pSystem->GetNickname());
|
||||
}
|
||||
// Print the map.
|
||||
std::map<G4String,std::set<G4String,NicknameComparison> >::const_iterator i;
|
||||
for (i = systemMap.begin(); i != systemMap.end(); ++i) {
|
||||
G4cout << "\n " << i->first << " (";
|
||||
const std::set<G4String,NicknameComparison>& nicknames = i->second;
|
||||
std::set<G4String,NicknameComparison>::const_iterator j;
|
||||
for (j = nicknames.begin(); j != nicknames.end(); ++j) {
|
||||
if (j != nicknames.begin()) G4cout << ", ";
|
||||
G4cout << *j;
|
||||
void G4VisManager::PrintAvailableGraphicsSystems (Verbosity verbosity) const
|
||||
{
|
||||
G4cout << "Current available graphics systems are:\n";
|
||||
if (fAvailableGraphicsSystems.size ()) {
|
||||
for (auto&& gs: fAvailableGraphicsSystems) {
|
||||
const G4String& name = gs->GetName();
|
||||
const std::vector<G4String>& nicknames = gs->GetNicknames();
|
||||
if (verbosity <= warnings) {
|
||||
// Brief output
|
||||
G4cout << name << " (";
|
||||
for (size_t i = 0; i < nicknames.size(); ++i) {
|
||||
if (i != 0) {
|
||||
G4cout << ", ";
|
||||
}
|
||||
G4cout << nicknames[i];
|
||||
}
|
||||
G4cout << ')';
|
||||
} else {
|
||||
// Full output
|
||||
G4cout << *gs;
|
||||
}
|
||||
G4cout << ')';
|
||||
G4cout << G4endl;
|
||||
}
|
||||
} else {
|
||||
G4cout << "\n NONE!!! None registered - yet! Mmmmm!" << G4endl;
|
||||
}
|
||||
else {
|
||||
G4cout << "\n NONE!!! None registered - yet! Mmmmm!";
|
||||
}
|
||||
G4cout << G4endl;
|
||||
}
|
||||
|
||||
void G4VisManager::PrintAvailableModels (Verbosity verbosity) const
|
||||
@@ -1569,188 +1592,54 @@ void G4VisManager::PrintInvalidPointers () const {
|
||||
}
|
||||
|
||||
#ifdef G4MULTITHREADED
|
||||
// Start of multithreaded versions of Begin/EndOfRun/Event.
|
||||
|
||||
#include "G4Threading.hh"
|
||||
#include "G4AutoLock.hh"
|
||||
namespace {
|
||||
// G4Mutex visBeginOfRunMutex = G4MUTEX_INITIALIZER;
|
||||
// G4Mutex visBeginOfEventMutex = G4MUTEX_INITIALIZER;
|
||||
G4Mutex visEndOfEventMutex = G4MUTEX_INITIALIZER;
|
||||
// G4Mutex visEndOfRunMutex = G4MUTEX_INITIALIZER;
|
||||
G4bool mtRunInProgress = false;
|
||||
std::deque<const G4Event*> mtVisEventQueue;
|
||||
G4Thread* mtVisSubThread = 0;
|
||||
G4Mutex mtVisSubThreadMutex = G4MUTEX_INITIALIZER;
|
||||
}
|
||||
|
||||
void G4VisManager::BeginOfRun ()
|
||||
G4ThreadFunReturnType G4VisManager::G4VisSubThread(G4ThreadFunArgType p)
|
||||
{
|
||||
if (fIgnoreStateChanges) return;
|
||||
if (G4Threading::IsWorkerThread()) return;
|
||||
fNKeepRequests = 0;
|
||||
fKeptLastEvent = false;
|
||||
fEventKeepingSuspended = false;
|
||||
fTransientsDrawnThisRun = false;
|
||||
if (fpSceneHandler) fpSceneHandler->SetTransientsDrawnThisRun(false);
|
||||
}
|
||||
G4VisManager* pVisManager = (G4VisManager*)p;
|
||||
G4VSceneHandler* pSceneHandler = pVisManager->GetCurrentSceneHandler();
|
||||
if (!pSceneHandler) return 0;
|
||||
G4Scene* pScene = pSceneHandler->GetScene();
|
||||
if (!pScene) return 0;
|
||||
G4VViewer* pViewer = pVisManager->GetCurrentViewer();
|
||||
if (!pViewer) return 0;
|
||||
|
||||
void G4VisManager::BeginOfEvent ()
|
||||
{
|
||||
if (fIgnoreStateChanges) return;
|
||||
}
|
||||
G4UImanager::GetUIpointer()->SetUpForSpecialThread("G4VIS");
|
||||
|
||||
void G4VisManager::EndOfEvent ()
|
||||
{
|
||||
if (fIgnoreStateChanges) return;
|
||||
// G4cout << "G4VisManager::G4VisSubThread: thread: "
|
||||
// << G4Threading::G4GetThreadId() << std::endl;
|
||||
|
||||
if (!GetConcreteInstance()) return;
|
||||
G4GeometryWorkspacePool::GetInstance()->CreateAndUseWorkspace();
|
||||
G4SolidsWorkspacePool::GetInstance()->CreateAndUseWorkspace();
|
||||
|
||||
// Don't call IsValidView unless there is a scene handler. This
|
||||
// avoids WARNING message at end of event and run when the user has
|
||||
// not instantiated a scene handler, e.g., in batch mode.
|
||||
G4bool valid = fpSceneHandler && IsValidView();
|
||||
if (!valid) return;
|
||||
pViewer->SwitchToVisSubThread();
|
||||
|
||||
G4AutoLock al(&visEndOfEventMutex);
|
||||
while (true) {
|
||||
|
||||
if (!fEventKeepingSuspended) {
|
||||
G4MUTEXLOCK(&mtVisSubThreadMutex);
|
||||
G4int eventQueueSize = mtVisEventQueue.size();
|
||||
G4MUTEXUNLOCK(&mtVisSubThreadMutex);
|
||||
// G4cout << "Event queue size (A): " << eventQueueSize << G4endl;
|
||||
|
||||
G4EventManager* eventManager = G4EventManager::GetEventManager();
|
||||
// const G4Event* currentEvent = eventManager->GetConstCurrentEvent();
|
||||
// if (!currentEvent) return;
|
||||
while (eventQueueSize) {
|
||||
|
||||
// G4RunManager* runManager = G4RunManager::GetRunManager();
|
||||
// const G4Run* currentRun = runManager->GetCurrentRun();
|
||||
// if (!currentRun) return;
|
||||
//
|
||||
// const std::vector<const G4Event*>*
|
||||
// eventsFromThreads = currentRun->GetEventVector();
|
||||
// G4int nKeptEvents = eventsFromThreads ? eventsFromThreads->size() : 0;
|
||||
G4MUTEXLOCK(&mtVisSubThreadMutex);
|
||||
const G4Event* event = mtVisEventQueue.front();
|
||||
G4MUTEXUNLOCK(&mtVisSubThreadMutex);
|
||||
// G4int eventID = event->GetEventID();
|
||||
// G4cout <<
|
||||
// "G4VisManager::G4VisSubThread: Vis sub-thread: Dealing with event: "
|
||||
// << eventID << G4endl;
|
||||
|
||||
G4int maxNumberOfKeptEvents = fpScene->GetMaxNumberOfKeptEvents();
|
||||
if (maxNumberOfKeptEvents > 0 && fNKeepRequests >= maxNumberOfKeptEvents) {
|
||||
fEventKeepingSuspended = true;
|
||||
static G4bool warned = false;
|
||||
if (!warned) {
|
||||
if (fVerbosity >= warnings) {
|
||||
G4cout <<
|
||||
"WARNING: G4VisManager::EndOfEvent: Automatic event keeping suspended."
|
||||
"\n The number of events exceeds the maximum, "
|
||||
<< maxNumberOfKeptEvents <<
|
||||
", that may be kept by \n the vis manager."
|
||||
<< G4endl;
|
||||
}
|
||||
warned = true;
|
||||
}
|
||||
} else if (maxNumberOfKeptEvents != 0) {
|
||||
// G4cout << "Requesting keeping event " << currentEvent->GetEventID() << G4endl;
|
||||
eventManager->KeepTheCurrentEvent();
|
||||
fNKeepRequests++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void G4VisManager::EndOfRun ()
|
||||
{
|
||||
if (fIgnoreStateChanges) return;
|
||||
|
||||
if (G4Threading::IsWorkerThread()) return;
|
||||
|
||||
// Don't call IsValidView unless there is a scene handler. This
|
||||
// avoids WARNING message at end of event and run when the user has
|
||||
// not instantiated a scene handler, e.g., in batch mode.
|
||||
G4bool valid = fpSceneHandler && IsValidView();
|
||||
if (!valid) return;
|
||||
|
||||
// G4AutoLock al(&visEndOfRunMutex);
|
||||
|
||||
G4RunManager* runManager = G4RunManager::GetRunManager();
|
||||
const G4Run* currentRun = runManager->GetCurrentRun();
|
||||
if (!currentRun) return;
|
||||
|
||||
const std::vector<const G4Event*>*
|
||||
eventsFromThreads = currentRun->GetEventVector();
|
||||
G4int nKeptEvents = eventsFromThreads ? eventsFromThreads->size() : 0;
|
||||
if (nKeptEvents) {
|
||||
if (fVerbosity >= warnings) {
|
||||
G4cout << "WARNING: " << nKeptEvents;
|
||||
if (nKeptEvents == 1) G4cout << " event has";
|
||||
else G4cout << " events have";
|
||||
G4cout << " been kept for refreshing and/or reviewing." << G4endl;
|
||||
if (nKeptEvents != fNKeepRequests) {
|
||||
G4cout << " (Note: ";
|
||||
if (fNKeepRequests == 0) {
|
||||
G4cout << "No keep requests were";
|
||||
} else if (fNKeepRequests == 1) {
|
||||
G4cout << "Only 1 keep request was";
|
||||
} else {
|
||||
G4cout << "Only " << fNKeepRequests << " keep requests were";
|
||||
}
|
||||
G4cout << " made by the vis manager.)" << G4endl;
|
||||
}
|
||||
G4cout << " \"/vis/reviewKeptEvents\" to review them." << G4endl;
|
||||
}
|
||||
}
|
||||
|
||||
if (fEventKeepingSuspended && fVerbosity >= warnings) {
|
||||
G4cout <<
|
||||
"WARNING: G4VisManager::EndOfRun: Automatic event keeping was suspended."
|
||||
"\n The number of events in the run exceeded the maximum, "
|
||||
<< fpScene->GetMaxNumberOfKeptEvents() <<
|
||||
", that may be\n kept by the vis manager." <<
|
||||
"\n The number of events kept by the vis manager can be changed with"
|
||||
"\n \"/vis/scene/endOfEventAction [accumulate|refresh] <N>\", where N"
|
||||
"\n is the maximum number you wish to allow. N < 0 means \"unlimited\"."
|
||||
<< G4endl;
|
||||
}
|
||||
|
||||
if (GetConcreteInstance() && eventsFromThreads) {
|
||||
std::vector<const G4Event*>::const_iterator i;
|
||||
if (fpScene->GetRefreshAtEndOfEvent()) {
|
||||
|
||||
for (i = eventsFromThreads->begin(); i != eventsFromThreads->end(); ++i) {
|
||||
if (fVerbosity >= confirmations) {
|
||||
G4cout << "Drawing event " << (*i)->GetEventID() << G4endl;
|
||||
}
|
||||
|
||||
// We are about to draw the event (trajectories, etc.), but first we
|
||||
// have to clear the previous event(s) if necessary. If this event
|
||||
// needs to be drawn afresh, e.g., the first event or any event when
|
||||
// "accumulate" is not requested, the old event has to be cleared.
|
||||
// We have postponed this so that, for normal viewers like OGL, the
|
||||
// previous event(s) stay on screen until this new event comes
|
||||
// along. For a file-writing viewer the geometry has to be drawn.
|
||||
// See, for example, G4HepRepFileSceneHandler::ClearTransientStore.
|
||||
// But, for this stop-gap solution...
|
||||
// Deactivate end-of-event and end-of-run models...
|
||||
G4Scene* scene = fpSceneHandler->GetScene();
|
||||
std::vector<G4Scene::Model>& eoeModels = scene->SetEndOfEventModelList();
|
||||
std::vector<G4Scene::Model> tmpEoeModels = eoeModels;
|
||||
std::vector<G4Scene::Model>::iterator iEoe;
|
||||
for (iEoe = eoeModels.begin(); iEoe != eoeModels.end(); ++iEoe) {
|
||||
iEoe->fActive = false;
|
||||
}
|
||||
std::vector<G4Scene::Model>& eorModels = scene->SetEndOfRunModelList();
|
||||
std::vector<G4Scene::Model> tmpEorModels = eorModels;
|
||||
std::vector<G4Scene::Model>::iterator iEor;
|
||||
for (iEor = eoeModels.begin(); iEor != eoeModels.end(); ++iEor) {
|
||||
iEor->fActive = false;
|
||||
}
|
||||
ClearTransientStoreIfMarked();
|
||||
// ...and restore...
|
||||
eoeModels = tmpEoeModels;
|
||||
eorModels = tmpEorModels;
|
||||
|
||||
fTransientsDrawnThisEvent = false;
|
||||
fpSceneHandler->SetTransientsDrawnThisEvent(false);
|
||||
fpSceneHandler->DrawEvent(*i);
|
||||
// ShowView guarantees the view comes to the screen. No action
|
||||
// is taken for passive viewers like OGL*X (without picking enabled),
|
||||
// but it passes control to interactive viewers, such as OGL*X (with
|
||||
// picking enabled) or OGL*Xm, and allows file-writing viewers to
|
||||
// close the file.
|
||||
fpViewer->ShowView();
|
||||
fpSceneHandler->SetMarkForClearingTransientStore(true);
|
||||
}
|
||||
|
||||
} else { // Accumulate events.
|
||||
// Here comes the event drawing
|
||||
pVisManager->SetTransientsDrawnThisEvent(false);
|
||||
pSceneHandler->SetTransientsDrawnThisEvent(false);
|
||||
|
||||
// We are about to draw the event (trajectories, etc.), but first we
|
||||
// have to clear the previous event(s) if necessary. If this event
|
||||
@@ -1760,77 +1649,134 @@ void G4VisManager::EndOfRun ()
|
||||
// previous event(s) stay on screen until this new event comes
|
||||
// along. For a file-writing viewer the geometry has to be drawn.
|
||||
// See, for example, G4HepRepFileSceneHandler::ClearTransientStore.
|
||||
// But, for this stop-gap solution...
|
||||
// Deactivate end-of-event and end-of-run models...
|
||||
G4Scene* scene = fpSceneHandler->GetScene();
|
||||
assert(scene); // To keep Coverity happy.
|
||||
std::vector<G4Scene::Model>& eoeModels = scene->SetEndOfEventModelList();
|
||||
std::vector<G4Scene::Model> tmpEoeModels = eoeModels;
|
||||
std::vector<G4Scene::Model>::iterator iEoe;
|
||||
for (iEoe = eoeModels.begin(); iEoe != eoeModels.end(); ++iEoe) {
|
||||
iEoe->fActive = false;
|
||||
}
|
||||
std::vector<G4Scene::Model>& eorModels = scene->SetEndOfRunModelList();
|
||||
std::vector<G4Scene::Model> tmpEorModels = eorModels;
|
||||
std::vector<G4Scene::Model>::iterator iEor;
|
||||
for (iEor = eoeModels.begin(); iEor != eoeModels.end(); ++iEor) {
|
||||
iEor->fActive = false;
|
||||
}
|
||||
ClearTransientStoreIfMarked();
|
||||
// ...and restore...
|
||||
eoeModels = tmpEoeModels;
|
||||
eorModels = tmpEorModels;
|
||||
pVisManager->ClearTransientStoreIfMarked();
|
||||
|
||||
// Now draw the event...
|
||||
pSceneHandler->DrawEvent(event);
|
||||
++pVisManager->fNoOfEventsDrawnThisRun;
|
||||
|
||||
if (pScene->GetRefreshAtEndOfEvent()) {
|
||||
|
||||
// ShowView guarantees the view comes to the screen. No action
|
||||
// is taken for passive viewers like OGL*X (without picking enabled),
|
||||
// but it passes control to interactive viewers, such as OGL*X (with
|
||||
// picking enabled) or OGL*Xm, and allows file-writing viewers to
|
||||
// close the file.
|
||||
pViewer->ShowView();
|
||||
pSceneHandler->SetMarkForClearingTransientStore(true);
|
||||
|
||||
for (i = eventsFromThreads->begin(); i != eventsFromThreads->end(); ++i) {
|
||||
if (fVerbosity >= confirmations) {
|
||||
G4cout << "Drawing event " << (*i)->GetEventID() << G4endl;
|
||||
}
|
||||
fTransientsDrawnThisEvent = false;
|
||||
fpSceneHandler->SetTransientsDrawnThisEvent(false);
|
||||
fpSceneHandler->DrawEvent(*i);
|
||||
}
|
||||
if (fpScene->GetRefreshAtEndOfRun()) {
|
||||
fpSceneHandler->DrawEndOfRunModels();
|
||||
fpViewer->ShowView();
|
||||
// An extra refresh for auto-refresh viewers
|
||||
if (fpViewer->GetViewParameters().IsAutoRefresh()) {
|
||||
fpViewer->RefreshView();
|
||||
}
|
||||
fpSceneHandler->SetMarkForClearingTransientStore(true);
|
||||
} else {
|
||||
if (fpGraphicsSystem->GetFunctionality() ==
|
||||
G4VGraphicsSystem::fileWriter) {
|
||||
if (fVerbosity >= warnings) {
|
||||
G4cout << "\"/vis/viewer/update\" to close file." << G4endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Testing.
|
||||
// std::this_thread::sleep_for(std::chrono::seconds(5));
|
||||
|
||||
// Then pop and release event
|
||||
G4MUTEXLOCK(&mtVisSubThreadMutex);
|
||||
mtVisEventQueue.pop_front();
|
||||
event->PostProcessingFinished();
|
||||
eventQueueSize = mtVisEventQueue.size();
|
||||
G4MUTEXUNLOCK(&mtVisSubThreadMutex);
|
||||
// G4cout << "Event queue size (B): " << eventQueueSize << G4endl;
|
||||
}
|
||||
|
||||
G4MUTEXLOCK(&mtVisSubThreadMutex);
|
||||
G4int runInProgress = mtRunInProgress;
|
||||
G4MUTEXUNLOCK(&mtVisSubThreadMutex);
|
||||
if (!runInProgress) break;
|
||||
|
||||
// Run still in progress but nothing to draw, so wait a while.
|
||||
#ifdef G4VIS_USE_STD11
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(100));
|
||||
#else
|
||||
G4THREADSLEEP(1);
|
||||
#endif
|
||||
}
|
||||
fEventRefreshing = false;
|
||||
|
||||
// Inform viewer that we have finished all sub-thread drawing for now...
|
||||
pViewer->DoneWithVisSubThread();
|
||||
pViewer->MovingToMasterThread();
|
||||
// G4cout << "G4VisManager::G4VisSubThread: Vis sub-thread: ending" << G4endl;
|
||||
return /*(G4ThreadFunReturnType)*/0;
|
||||
}
|
||||
|
||||
// End of multithreaded versions of Begin/EndOfRun/Event.
|
||||
#else
|
||||
// Start of sequential versions of Begin/EndOfRun/Event.
|
||||
namespace {
|
||||
// G4Mutex visBeginOfRunMutex = G4MUTEX_INITIALIZER;
|
||||
// G4Mutex visBeginOfEventMutex = G4MUTEX_INITIALIZER;
|
||||
G4Mutex visEndOfEventMutex = G4MUTEX_INITIALIZER;
|
||||
// G4Mutex visEndOfRunMutex = G4MUTEX_INITIALIZER;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void G4VisManager::BeginOfRun ()
|
||||
{
|
||||
if (fIgnoreStateChanges) return;
|
||||
//G4cout << "G4VisManager::BeginOfRun" << G4endl;
|
||||
#ifdef G4MULTITHREADED
|
||||
if (G4Threading::IsWorkerThread()) return;
|
||||
#endif
|
||||
// G4cout << "G4VisManager::BeginOfRun: thread: "
|
||||
// << G4Threading::G4GetThreadId() << G4endl;
|
||||
|
||||
G4RunManager* runManager = G4RunManager::GetRunManager();
|
||||
#ifdef G4MULTITHREADED
|
||||
if (G4Threading::IsMultithreadedApplication()) {
|
||||
runManager = G4MTRunManager::GetMasterRunManager();
|
||||
}
|
||||
#endif
|
||||
|
||||
// For a fake run...
|
||||
G4int nEventsToBeProcessed = runManager->GetNumberOfEventsToBeProcessed();
|
||||
if (nEventsToBeProcessed == 0) return;
|
||||
|
||||
fNKeepRequests = 0;
|
||||
fKeptLastEvent = false;
|
||||
fEventKeepingSuspended = false;
|
||||
fTransientsDrawnThisRun = false;
|
||||
if (fpSceneHandler) fpSceneHandler->SetTransientsDrawnThisRun(false);
|
||||
fNoOfEventsDrawnThisRun = 0;
|
||||
|
||||
#ifdef G4MULTITHREADED
|
||||
// There is a static method G4Threading::IsMultithreadedApplication()
|
||||
// that returns true only if G4MTRunManager is instantiated with MT
|
||||
// installation. Thus method returns false if G4RunManager base class is
|
||||
// instantiated even with the MT installation, or of course with sequential
|
||||
// installation.
|
||||
if (G4Threading::IsMultithreadedApplication()) {
|
||||
|
||||
// Inform viewer that we have finished all master thread drawing for now...
|
||||
if (fpViewer) fpViewer->DoneWithMasterThread();
|
||||
|
||||
// Start vis sub-thread
|
||||
// G4cout << "G4VisManager::BeginOfRun: Starting vis sub-thread" << G4endl;
|
||||
G4MUTEXLOCK(&mtVisSubThreadMutex);
|
||||
mtRunInProgress = true;
|
||||
G4MUTEXUNLOCK(&mtVisSubThreadMutex);
|
||||
mtVisSubThread = new G4Thread;
|
||||
// Launch vis thread
|
||||
G4THREADCREATE(mtVisSubThread,G4VisSubThread,this);
|
||||
|
||||
// Tricky things for some viewers (e.g., Qt):
|
||||
// - Launch the vis thread
|
||||
// - Wait for the vis thread to set its QThread
|
||||
// - Then move current QOpenGL context (if Qt) to this Qthread
|
||||
// - Go ahead
|
||||
if (fpViewer) fpViewer->MovingToVisSubThread();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void G4VisManager::BeginOfEvent ()
|
||||
{
|
||||
if (fIgnoreStateChanges) return;
|
||||
//G4cout << "G4VisManager::BeginOfEvent" << G4endl;
|
||||
// G4cout << "G4VisManager::BeginOfEvent: thread: "
|
||||
// << G4Threading::G4GetThreadId() << G4endl;
|
||||
|
||||
// Some instructions that should NOT be in multithreaded version.
|
||||
#ifndef G4MULTITHREADED
|
||||
// These instructions are in G4VisSubThread for multithreading.
|
||||
fTransientsDrawnThisEvent = false;
|
||||
if (fpSceneHandler) fpSceneHandler->SetTransientsDrawnThisEvent(false);
|
||||
#endif
|
||||
}
|
||||
|
||||
void G4VisManager::EndOfEvent ()
|
||||
@@ -1845,28 +1791,258 @@ void G4VisManager::EndOfEvent ()
|
||||
G4bool valid = fpSceneHandler && IsValidView();
|
||||
if (!valid) return;
|
||||
|
||||
// G4cout << "G4VisManager::EndOfEvent: thread: "
|
||||
// << G4Threading::G4GetThreadId() << G4endl;
|
||||
|
||||
#ifdef G4MULTITHREADED
|
||||
G4AutoLock al(&visEndOfEventMutex);
|
||||
// Testing.
|
||||
// std::this_thread::sleep_for(std::chrono::seconds(5));
|
||||
#endif
|
||||
|
||||
G4RunManager* runManager = G4RunManager::GetRunManager();
|
||||
#ifdef G4MULTITHREADED
|
||||
if (G4Threading::IsMultithreadedApplication()) {
|
||||
runManager = G4MTRunManager::GetMasterRunManager();
|
||||
}
|
||||
#endif
|
||||
|
||||
const G4Run* currentRun = runManager->GetCurrentRun();
|
||||
if (!currentRun) return;
|
||||
|
||||
// This gets the thread-local event manager
|
||||
G4EventManager* eventManager = G4EventManager::GetEventManager();
|
||||
const G4Event* currentEvent = eventManager->GetConstCurrentEvent();
|
||||
if (!currentEvent) return;
|
||||
|
||||
//G4cout << "G4VisManager::EndOfEvent" << G4endl;
|
||||
if (G4Threading::IsMultithreadedApplication()) {
|
||||
|
||||
DrawEvent(currentEvent);
|
||||
#ifdef G4MULTITHREADED
|
||||
|
||||
// Wait if too many events in the queue.
|
||||
G4MUTEXLOCK(&mtVisSubThreadMutex);
|
||||
G4int eventQueueSize = mtVisEventQueue.size();
|
||||
G4MUTEXUNLOCK(&mtVisSubThreadMutex);
|
||||
// G4cout << "Event queue size (1): " << eventQueueSize << G4endl;
|
||||
|
||||
G4bool eventQueueFull = false;
|
||||
while (fMaxEventQueueSize > 0 && eventQueueSize >= fMaxEventQueueSize) {
|
||||
|
||||
// G4cout << "Event queue size (2): " << eventQueueSize << G4endl;
|
||||
if (fWaitOnEventQueueFull) {
|
||||
static G4bool warned = false;
|
||||
if (!warned) {
|
||||
G4cout <<
|
||||
"WARNING: The number of events in the visualisation queue has exceeded"
|
||||
"\n the maximum, "
|
||||
<< fMaxEventQueueSize <<
|
||||
".\n If, during a multithreaded run, the simulation gets ahead of the"
|
||||
"\n visualisation by more than this maximum, the simulation is delayed"
|
||||
"\n until the vis sub-thread has drawn a few more events and removed them"
|
||||
"\n from the queue. You may change this maximum number of events with"
|
||||
"\n \"/vis/multithreading/maxEventQueueSize <N>\", where N is the maximum"
|
||||
"\n number you wish to allow. N <= 0 means \"unlimited\"."
|
||||
"\n Alternatively you may choose to discard events for drawing by setting"
|
||||
"\n \"/vis/multithreading/actionOnEventQueueFull discard\"."
|
||||
"\n To avoid visualisation altogether: \"/vis/disable\"."
|
||||
"\n And maybe \"/tracking/storeTrajectories 0\"."
|
||||
<< G4endl;
|
||||
warned = true;
|
||||
}
|
||||
// G4cout << "Event queue size (3): " << eventQueueSize << G4endl;
|
||||
// Wait a while to give event drawing time to reduce the queue...
|
||||
#ifdef G4VIS_USE_STD11
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(100));
|
||||
#else
|
||||
G4THREADSLEEP(1);
|
||||
#endif
|
||||
// G4cout << "Event queue size (4): " << eventQueueSize << G4endl;
|
||||
} else {
|
||||
static G4bool warned = false;
|
||||
if (!warned) {
|
||||
G4cout <<
|
||||
"WARNING: The number of events in the visualisation queue has exceeded"
|
||||
"\n the maximum, "
|
||||
<< fMaxEventQueueSize <<
|
||||
".\n Some events have been discarded for drawing. You may change this"
|
||||
"\n behaviour with \"/vis/multithreading/actionOnEventQueueFull wait\"."
|
||||
"\n To avoid visualisation altogether: \"/vis/disable\"."
|
||||
"\n And maybe \"/tracking/storeTrajectories 0\"."
|
||||
<< G4endl;
|
||||
warned = true;
|
||||
}
|
||||
eventQueueFull = true; // Causes event to be discarded for drawing.
|
||||
break;
|
||||
}
|
||||
|
||||
G4MUTEXLOCK(&mtVisSubThreadMutex);
|
||||
eventQueueSize = mtVisEventQueue.size();
|
||||
G4MUTEXUNLOCK(&mtVisSubThreadMutex);
|
||||
}
|
||||
|
||||
if (!eventQueueFull) {
|
||||
G4MUTEXLOCK(&mtVisSubThreadMutex);
|
||||
// Keep event for processing and put event on vis event queue
|
||||
currentEvent->KeepForPostProcessing();
|
||||
mtVisEventQueue.push_back(currentEvent);
|
||||
G4MUTEXUNLOCK(&mtVisSubThreadMutex);
|
||||
}
|
||||
|
||||
// G4MUTEXLOCK(&mtVisSubThreadMutex);
|
||||
// G4int eQS = mtVisEventQueue.size();
|
||||
// G4MUTEXUNLOCK(&mtVisSubThreadMutex);
|
||||
// G4cout << "Event queue size (5): " << eQS << G4endl;
|
||||
|
||||
#endif
|
||||
|
||||
} else {
|
||||
|
||||
// Sequential mode
|
||||
|
||||
G4int nEventsToBeProcessed = 0;
|
||||
G4int nKeptEvents = 0;
|
||||
G4int eventID = -2; // (If no run manager, triggers ShowView as normal.)
|
||||
if (currentRun) {
|
||||
nEventsToBeProcessed = runManager->GetNumberOfEventsToBeProcessed();
|
||||
eventID = currentEvent->GetEventID();
|
||||
const std::vector<const G4Event*>* events = currentRun->GetEventVector();
|
||||
if (events) nKeptEvents = events->size();
|
||||
}
|
||||
|
||||
// We are about to draw the event (trajectories, etc.), but first we
|
||||
// have to clear the previous event(s) if necessary. If this event
|
||||
// needs to be drawn afresh, e.g., the first event or any event when
|
||||
// "accumulate" is not requested, the old event has to be cleared.
|
||||
// We have postponed this so that, for normal viewers like OGL, the
|
||||
// previous event(s) stay on screen until this new event comes
|
||||
// along. For a file-writing viewer the geometry has to be drawn.
|
||||
// See, for example, G4HepRepFileSceneHandler::ClearTransientStore.
|
||||
ClearTransientStoreIfMarked();
|
||||
|
||||
// Now draw the event...
|
||||
fpSceneHandler->DrawEvent(currentEvent);
|
||||
++fNoOfEventsDrawnThisRun;
|
||||
|
||||
if (fpScene->GetRefreshAtEndOfEvent()) {
|
||||
|
||||
// Unless last event (in which case wait end of run)...
|
||||
if (eventID < nEventsToBeProcessed - 1) {
|
||||
// ShowView guarantees the view comes to the screen. No action
|
||||
// is taken for passive viewers like OGL*X (without picking enabled),
|
||||
// but it passes control to interactive viewers, such as OGL*X (with
|
||||
// picking enabled) or OGL*Xm, and allows file-writing viewers to
|
||||
// close the file.
|
||||
fpViewer->ShowView();
|
||||
} else { // Last event...
|
||||
// Keep, but only if user has not kept any...
|
||||
if (nKeptEvents == 0) {
|
||||
eventManager->KeepTheCurrentEvent();
|
||||
fNKeepRequests++;
|
||||
fKeptLastEvent = true;
|
||||
}
|
||||
}
|
||||
fpSceneHandler->SetMarkForClearingTransientStore(true);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// Both modes - sequential and MT
|
||||
|
||||
if (!(fpScene->GetRefreshAtEndOfEvent())) {
|
||||
|
||||
// Accumulating events...
|
||||
|
||||
G4int maxNumberOfKeptEvents = fpScene->GetMaxNumberOfKeptEvents();
|
||||
|
||||
if (maxNumberOfKeptEvents > 0 &&
|
||||
fNKeepRequests >= maxNumberOfKeptEvents) {
|
||||
|
||||
fEventKeepingSuspended = true;
|
||||
static G4bool warned = false;
|
||||
if (!warned) {
|
||||
if (fVerbosity >= warnings) {
|
||||
G4cout <<
|
||||
"WARNING: G4VisManager::EndOfEvent: Automatic event keeping suspended."
|
||||
"\n The number of events exceeds the maximum, "
|
||||
<< maxNumberOfKeptEvents <<
|
||||
", that may be kept by\n the vis manager."
|
||||
<< G4endl;
|
||||
}
|
||||
warned = true;
|
||||
}
|
||||
|
||||
} else if (maxNumberOfKeptEvents != 0) {
|
||||
|
||||
// If not disabled nor suspended.
|
||||
if (GetConcreteInstance() && !fEventKeepingSuspended) {
|
||||
// G4cout <<
|
||||
// "Requesting keeping event " << currentEvent->GetEventID()
|
||||
// << G4endl;
|
||||
eventManager->KeepTheCurrentEvent();
|
||||
fNKeepRequests++;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void G4VisManager::EndOfRun ()
|
||||
{
|
||||
if (fIgnoreStateChanges) return;
|
||||
//G4cout << "G4VisManager::EndOfRun" << G4endl;
|
||||
#ifdef G4MULTITHREADED
|
||||
if (G4Threading::IsWorkerThread()) return;
|
||||
#endif
|
||||
|
||||
// G4cout << "G4VisManager::EndOfRun: thread: "
|
||||
// << G4Threading::G4GetThreadId() << G4endl;
|
||||
|
||||
G4RunManager* runManager = G4RunManager::GetRunManager();
|
||||
#ifdef G4MULTITHREADED
|
||||
if (G4Threading::IsMultithreadedApplication()) {
|
||||
runManager = G4MTRunManager::GetMasterRunManager();
|
||||
}
|
||||
#endif
|
||||
|
||||
// For a fake run...
|
||||
G4int nEventsToBeProcessed = runManager->GetNumberOfEventsToBeProcessed();
|
||||
if (nEventsToBeProcessed == 0) return;
|
||||
|
||||
const G4Run* currentRun = runManager->GetCurrentRun();
|
||||
if (!currentRun) return;
|
||||
|
||||
#ifdef G4MULTITHREADED
|
||||
// G4AutoLock al(&visEndOfRunMutex); ???
|
||||
if (G4Threading::IsMultithreadedApplication()) {
|
||||
// Reset flag so that sub-thread exits when it has finished processing.
|
||||
G4MUTEXLOCK(&mtVisSubThreadMutex);
|
||||
mtRunInProgress = false;
|
||||
G4MUTEXUNLOCK(&mtVisSubThreadMutex);
|
||||
// Wait for sub-thread to finish.
|
||||
G4THREADJOIN(*mtVisSubThread);
|
||||
delete mtVisSubThread;
|
||||
if (fpViewer) fpViewer->SwitchToMasterThread();
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef G4MULTITHREADED
|
||||
if (IsValidView()) { // I.e., events should have been drawn.
|
||||
G4int noOfEventsRequested = runManager->GetNumberOfEventsToBeProcessed();
|
||||
if (fNoOfEventsDrawnThisRun != noOfEventsRequested) {
|
||||
if (!fWaitOnEventQueueFull && fVerbosity >= warnings) {
|
||||
G4cout
|
||||
<< "WARNING: Number of events drawn this run, "
|
||||
<< fNoOfEventsDrawnThisRun << ", is different to number requested, "
|
||||
<< noOfEventsRequested <<
|
||||
".\n (This is because you requested \"/vis/multithreading/actionOnEventQueueFull discard\".)"
|
||||
<< G4endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
G4int nKeptEvents = 0;
|
||||
const std::vector<const G4Event*>* events =
|
||||
currentRun? currentRun->GetEventVector(): 0;
|
||||
const std::vector<const G4Event*>* events = currentRun->GetEventVector();
|
||||
if (events) nKeptEvents = events->size();
|
||||
|
||||
if (nKeptEvents && !fKeptLastEvent) {
|
||||
if (fVerbosity >= warnings) {
|
||||
G4cout << "WARNING: " << nKeptEvents;
|
||||
@@ -1920,7 +2096,12 @@ void G4VisManager::EndOfRun ()
|
||||
// not instantiated a scene handler, e.g., in batch mode.
|
||||
G4bool valid = fpSceneHandler && IsValidView();
|
||||
if (GetConcreteInstance() && valid) {
|
||||
if (!fpSceneHandler->GetMarkForClearingTransientStore()) {
|
||||
// // ???? I can't remember why
|
||||
// // if (!fpSceneHandler->GetMarkForClearingTransientStore()) {
|
||||
// // is here. It prevents ShowView at end of run, which seems to be OK
|
||||
// // for sequential mode, but MT mode seems to need it (I have not
|
||||
// // figured out why). ???? JA ????
|
||||
// if (!fpSceneHandler->GetMarkForClearingTransientStore()) {
|
||||
if (fpScene->GetRefreshAtEndOfRun()) {
|
||||
fpSceneHandler->DrawEndOfRunModels();
|
||||
// ShowView guarantees the view comes to the screen. No action
|
||||
@@ -1928,11 +2109,12 @@ void G4VisManager::EndOfRun ()
|
||||
// but it passes control to interactive viewers, such as OGL*X (with
|
||||
// picking enabled) or OGL*Xm, and allows file-writing viewers to
|
||||
// close the file.
|
||||
fpViewer->ShowView();
|
||||
// An extra refresh for auto-refresh viewers.
|
||||
if (fpViewer->GetViewParameters().IsAutoRefresh()) {
|
||||
fpViewer->RefreshView();
|
||||
}
|
||||
fpViewer->ShowView();
|
||||
// // An extra refresh for auto-refresh viewers.
|
||||
// // ???? I DON'T THINK THIS IS NECESSARY ???? JA ????
|
||||
// if (fpViewer->GetViewParameters().IsAutoRefresh()) {
|
||||
// fpViewer->RefreshView();
|
||||
// }
|
||||
fpSceneHandler->SetMarkForClearingTransientStore(true);
|
||||
} else {
|
||||
if (fpGraphicsSystem->GetFunctionality() ==
|
||||
@@ -1942,93 +2124,11 @@ void G4VisManager::EndOfRun ()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// }
|
||||
}
|
||||
fEventRefreshing = false;
|
||||
}
|
||||
|
||||
void G4VisManager::DrawEvent(const G4Event* event)
|
||||
{
|
||||
G4EventManager* eventManager = G4EventManager::GetEventManager();
|
||||
|
||||
G4RunManager* runManager = G4RunManager::GetRunManager();
|
||||
const G4Run* currentRun = runManager->GetCurrentRun();
|
||||
if (!currentRun) return;
|
||||
|
||||
// We are about to draw the event (trajectories, etc.), but first we
|
||||
// have to clear the previous event(s) if necessary. If this event
|
||||
// needs to be drawn afresh, e.g., the first event or any event when
|
||||
// "accumulate" is not requested, the old event has to be cleared.
|
||||
// We have postponed this so that, for normal viewers like OGL, the
|
||||
// previous event(s) stay on screen until this new event comes
|
||||
// along. For a file-writing viewer the geometry has to be drawn.
|
||||
// See, for example, G4HepRepFileSceneHandler::ClearTransientStore.
|
||||
ClearTransientStoreIfMarked();
|
||||
|
||||
// Now draw the event...
|
||||
fpSceneHandler->DrawEvent(event);
|
||||
|
||||
G4int nEventsToBeProcessed = 0;
|
||||
G4int nKeptEvents = 0;
|
||||
G4int eventID = -2; // (If no run manager, triggers ShowView as normal.)
|
||||
if (currentRun) {
|
||||
nEventsToBeProcessed = currentRun->GetNumberOfEventToBeProcessed();
|
||||
eventID = event->GetEventID();
|
||||
const std::vector<const G4Event*>* events =
|
||||
currentRun->GetEventVector();
|
||||
if (events) nKeptEvents = events->size();
|
||||
}
|
||||
|
||||
if (fpScene->GetRefreshAtEndOfEvent()) {
|
||||
|
||||
// Unless last event (in which case wait end of run)...
|
||||
if (eventID < nEventsToBeProcessed - 1) {
|
||||
// ShowView guarantees the view comes to the screen. No action
|
||||
// is taken for passive viewers like OGL*X (without picking enabled),
|
||||
// but it passes control to interactive viewers, such as OGL*X (with
|
||||
// picking enabled) or OGL*Xm, and allows file-writing viewers to
|
||||
// close the file.
|
||||
fpViewer->ShowView();
|
||||
fpSceneHandler->SetMarkForClearingTransientStore(true);
|
||||
} else { // Last event...
|
||||
// Keep, but only if user has not kept any...
|
||||
if (!nKeptEvents) {
|
||||
eventManager->KeepTheCurrentEvent();
|
||||
fNKeepRequests++;
|
||||
fKeptLastEvent = true;
|
||||
}
|
||||
}
|
||||
|
||||
} else { // Accumulating events...
|
||||
|
||||
G4int maxNumberOfKeptEvents = fpScene->GetMaxNumberOfKeptEvents();
|
||||
if (maxNumberOfKeptEvents > 0 && fNKeepRequests >= maxNumberOfKeptEvents) {
|
||||
fEventKeepingSuspended = true;
|
||||
static G4bool warned = false;
|
||||
if (!warned) {
|
||||
if (fVerbosity >= warnings) {
|
||||
G4cout <<
|
||||
"WARNING: G4VisManager::EndOfEvent: Automatic event keeping suspended."
|
||||
"\n The number of events exceeds the maximum, "
|
||||
<< maxNumberOfKeptEvents <<
|
||||
", that may be kept by\n the vis manager."
|
||||
<< G4endl;
|
||||
}
|
||||
warned = true;
|
||||
}
|
||||
} else if (maxNumberOfKeptEvents != 0) {
|
||||
// If not disabled nor suspended.
|
||||
if (GetConcreteInstance() && !fEventKeepingSuspended) {
|
||||
// G4cout << "Requesting keeping event " << event->GetEventID() << G4endl;
|
||||
eventManager->KeepTheCurrentEvent();
|
||||
fNKeepRequests++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif // End of sequential versions of Begin/EndOfRun/Event.
|
||||
|
||||
void G4VisManager::ClearTransientStoreIfMarked(){
|
||||
// Assumes valid view.
|
||||
if (fpSceneHandler->GetMarkForClearingTransientStore()) {
|
||||
|
||||
Reference in New Issue
Block a user