Import Geant4 11.4.0.beta source tree
This commit is contained in:
@@ -6,6 +6,154 @@ It must **not** be used as a substitute for writing good git commit messages!
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
## 2025-06-08 John Allison (visman-V11-03-12)
|
||||
- G4ViewParameters.cc:
|
||||
- Fix for bug report 2460.
|
||||
- Fix typo whereby "/vis/viewer/set/lightsMove cam" behaves incorrectly for
|
||||
"/vis/viewer/set/lightsVector 0 0 1".
|
||||
|
||||
## 2025-06-01 John Allison (visman-V11-03-11)
|
||||
- Make TSG the "flagship" vis driver.
|
||||
- G4VisExecutive.icc:
|
||||
- Make nickname/alias OGL synonymous with TSG.
|
||||
- Make TSG default for selection by build flags.
|
||||
- G4VisManager.cc:
|
||||
- Initialise fDefaultGraphicsSystemName to TSG.
|
||||
- This is just for consistency, since it is overridden in
|
||||
G4VisExecutive.icc anyway.
|
||||
|
||||
## 2025-05-27 John Allison (visman-V11-03-10)
|
||||
- G4VViewer.cc:
|
||||
- Initialise fTransientsNeedRedrawing(false).
|
||||
- Previously, this was initialised "true", but it is up to the viewer
|
||||
to decide if transients (trajectories) need redrawing.
|
||||
- Testing with OGL, TSG and VTK actually shows no change of behaviour,
|
||||
but some future developments are affected, so this MR corrects.
|
||||
|
||||
## 2025-05-24 John Allison (visman-V11-03-09)
|
||||
- Minor improvement to listing of histograms (if any)
|
||||
- G4VisManager::EndOfRun:
|
||||
- Print list of histograms even if vis is disabled.
|
||||
|
||||
## 2025-04-06 John Allison (visman-V11-03-08)
|
||||
- G4VisCommandsSceneAdd:
|
||||
- Add /vis/scene/add/endOfRunMacro.
|
||||
- The macro is executed at end of run and when rebuild required.
|
||||
- WARNING: some vis commands in the macro cause recursion. Stick to simple
|
||||
commmands, e.g., which invoke vis manager Draw() methods.
|
||||
|
||||
## 2025-04-02 John Allison (visman-V11-03-07)
|
||||
- Co-works: raytracer-V11-03-00, cmake-V11-03-02.
|
||||
- G4VisExecutive.icc: Add RayTracerQt.
|
||||
- G4VisCommandsViewer.cc: /vis/viewer/select:
|
||||
- Remove subsequent refresh, even for auto-refresh drivers.
|
||||
- Refresh not required after a select - window systems keep the image.
|
||||
|
||||
## 2025-04-01 John Allison (visman-V11-03-06)
|
||||
- G4VisCommandsTouchable.cc:
|
||||
- Disable /vis/touchable/centre... and /twinkle in the case of large process times.
|
||||
- This was an omission. It is already done for /vis/viewer/interpolate, etc.
|
||||
- If the time taken to (re-)build is greater than (currently) 0.1 s, fancy
|
||||
features like zooming in on and twinkling that rely on rebuilds are disabled.
|
||||
|
||||
## 2025-03-21 Ben Morgan (visman-V11-03-05)
|
||||
- Modernize g4tools macro-based loops with range-based for.
|
||||
- Update raw for loops with range-for where possible.
|
||||
|
||||
## 2025-02-24 John Allison (visman-V11-03-04)
|
||||
- Split scene processing into its "permanent" (run-duration models) and "transient"
|
||||
(end-of-event and end-of-run models) parts.
|
||||
- This allows us to update just the
|
||||
transient part, e.g., trajectories, which we might want to display in a
|
||||
different way, leaving the permanent part (e.g., detector) unchanged, i.e.,
|
||||
leaving the permanent part of the graphical database unchanged, avoiding
|
||||
unnecessary re-processing. This is exactly the situation for time windowing -
|
||||
the detector does not change, the trajectories also actually do not change,
|
||||
just the way they are drawn changes.
|
||||
- The idea is that the concrete viewer makes the decision in its DrawView().
|
||||
Typically, a viewer has CompareForKernelVisit(), to be used when a *complete*
|
||||
reprocessing is required, and CompareForTransientsRedraw() (say) if only
|
||||
transient models need reprocessing.
|
||||
- G4VSceneHandler:
|
||||
- Introduce virtual void ProcessTransients().
|
||||
- Move pertinent code from ProcessScene() to ProcessTransients().
|
||||
- ProcessScene() calls ProcessTransients(), i.e., the existing "kernel
|
||||
visit" processes both permanent and transient models as before.
|
||||
- Also some re-indentation within ProcessTransients().
|
||||
- G4VViewer:
|
||||
- Introduce void ProcessTransients() and fTransientsNeedRedrawing flag.
|
||||
|
||||
## 2025-02-20 John Allison (visman-V11-03-03)
|
||||
- G4VVisCommand.cc:
|
||||
- InterpolateViews():
|
||||
- Implement desired time per time step (or desired fps). Computation time
|
||||
per step may cause this to increase (i.e., fps to fall below this).
|
||||
- G4VisCommandsViewer.cc:
|
||||
- /vis/viewer/interpolate:
|
||||
- Small improvement to guidance consequent on the above.
|
||||
- G4VisCommandsViewer.cc:
|
||||
- /vis/viewer/set/timeWindow/displayHeadTime:
|
||||
- Implement "current as default". This is more rational; prevents surprises.
|
||||
There might be some minor change of behaviour.
|
||||
|
||||
## 2025-02-01 John Allison (visman-V11-03-02)
|
||||
- Simplify G4ViewParameters.
|
||||
- Co-works: opengl-V11-03-01.
|
||||
- G4ViewParameters.hh/cc:
|
||||
- Use single G4ModelingParameters::TimeParameters to replace 18 time window
|
||||
parameters.
|
||||
- G4VSceneHandler.cc:
|
||||
- Copy time parameters into modeling parameters.
|
||||
- G4VisCommandsViewerSet.cc:
|
||||
- /vis/viewer/set/timeWindow commands:
|
||||
- Follow changes in G4ViewParameters.
|
||||
|
||||
## 2025-01-13 John Allison (visman-V11-03-01)
|
||||
- G4VisCommandsViewerSet:
|
||||
- /vis/viewer/set/transparencyByDepth: improve guidance.
|
||||
|
||||
## 2025-01-06 John Allison (visman-V11-03-00)
|
||||
- Co-works: modeling-V11-03-00, interfaces-V11-03-00, opengl-V11-03-00,
|
||||
visQt3D-V11-03-00, vis_toolssg-V11-03-00, openinventor-V11-03-00,
|
||||
greps-V11-03-00.
|
||||
- Re-instate the transparency slider.
|
||||
- The transparency slider, whereby the user could see into the geometry
|
||||
progressively, was a powerful feature of the OpenGL Qt viewer, but it
|
||||
suffered a demise when we moved to a generic (new) scene tree. In this
|
||||
MR we re-implement it in a generic way, i.e., for all drivers. It is moved
|
||||
from the OpenGL Qt viewer to the Qt GUI (G4UIQt) and uses a new command,
|
||||
"/vis/viewer/set/transparencyByDepth <d> [option]". G4UIQt issues this
|
||||
command on signals from the slider. The user may, of course, use this
|
||||
command directly.
|
||||
- The command initiates a "kernel visit", which causes a rebuild of the
|
||||
graphical database. This may sound very heavy, but it is remarkably quick
|
||||
for reasonable geometries on modern CPUs. (It is envisaged that this
|
||||
feature is most useful when a detector - or a sub-detector - is being
|
||||
developed.)
|
||||
- The design is based on the original design by Laurent Garnier in OpenGL Qt.
|
||||
Laurent's ideas have been borrowed - thanks, Laurent. It was prompted in
|
||||
particular by a user, Andrea Barresi, who missed its presence in G4 11.2,
|
||||
and made some concrete proposals for its reintroduction using existing
|
||||
commands. In the end I felt it deserved a new command to maximise
|
||||
efficiency, but I have really appreciated his engagement in the process
|
||||
of developing this new feature, and one of the algorithms is his
|
||||
(option 3, "X-ray"). Thank you, Andrea. Unfortunately, it didn't make 11.3.
|
||||
- G4VisManager:
|
||||
- Tidy - mainly improved indentation.
|
||||
- G4VSceneHandler:
|
||||
- Calculate and maintain fMaxGeometryDepth (new base class data member).
|
||||
(The base class is G4VGraphicsScene in graphics_reps category. Placing
|
||||
the data member there makes is accessible to G4PhysicalVolumeModel.)
|
||||
- Improve some diagnostic printing.
|
||||
- G4VViewer:
|
||||
- Follow changes in G4PhysicalVolumeModel
|
||||
- Use pvModel->GetTotalAllTouchables()
|
||||
- Tidy
|
||||
- G4ViewParameters:
|
||||
- Add TransparencyByDepth and TransparencyByDepthOption.
|
||||
- G4VisCommandsViewerSet:
|
||||
- Add /vis/viewer/set/transparencyByDepth.
|
||||
|
||||
## 2024-10-27 John Allison (visman-V11-02-28)
|
||||
- G4VisExecutive.icc:
|
||||
- Remove #include <QtGlobal> - no longer needed.
|
||||
|
||||
@@ -319,6 +319,12 @@ protected:
|
||||
// G4OpenGLScenehandler::ProcessScene).
|
||||
virtual void ProcessScene ();
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
// As above, but transients only. For example, at end of run, in "Idle"
|
||||
// state, you might wish to re-draw the trajectories with a different
|
||||
// time window.
|
||||
virtual void ProcessTransients ();
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
// Default routine used by default AddSolid ().
|
||||
virtual void RequestPrimitives (const G4VSolid& solid);
|
||||
|
||||
@@ -188,7 +188,7 @@ public: // With description
|
||||
const G4SceneTreeItem& GetSceneTree() {return fSceneTree;}
|
||||
G4SceneTreeItem& AccessSceneTree() {return fSceneTree;}
|
||||
void UpdateGUISceneTree(); // A utility
|
||||
const G4int fMaxNTouchables = 10000; // Limits memory to about 50 MB
|
||||
const G4int fMaxAllTouchables = 10000; // Limits memory to about 50 MB per PV model
|
||||
G4bool fCurtailDescent = false; // Flag to curtail descent into PV model for scene tree
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
@@ -227,6 +227,9 @@ public: // With description
|
||||
void ProcessView ();
|
||||
// Used by DrawView (). Invokes SetView (). The basic logic is here.
|
||||
|
||||
void ProcessTransients ();
|
||||
// Re-draws transients only
|
||||
|
||||
protected:
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
@@ -263,6 +266,7 @@ protected:
|
||||
//////////////////////////////////////////////////////////////
|
||||
// Other parameters.
|
||||
G4bool fNeedKernelVisit; // See DrawView() for comments.
|
||||
G4bool fTransientsNeedRedrawing; // See DrawView() for comments.
|
||||
};
|
||||
|
||||
#include "G4VViewer.icc"
|
||||
|
||||
@@ -194,27 +194,13 @@ public: // With description
|
||||
RotationStyle GetRotationStyle () const;
|
||||
const std::vector<G4ModelingParameters::VisAttributesModifier>&
|
||||
GetVisAttributesModifiers () const;
|
||||
G4double GetStartTime () const;
|
||||
G4double GetEndTime () const;
|
||||
G4double GetFadeFactor () const;
|
||||
G4bool IsDisplayHeadTime () const;
|
||||
G4double GetDisplayHeadTimeX () const;
|
||||
G4double GetDisplayHeadTimeY () const;
|
||||
G4double GetDisplayHeadTimeSize () const;
|
||||
G4double GetDisplayHeadTimeRed () const;
|
||||
G4double GetDisplayHeadTimeGreen () const;
|
||||
G4double GetDisplayHeadTimeBlue () const;
|
||||
G4bool IsDisplayLightFront () const;
|
||||
G4double GetDisplayLightFrontX () const;
|
||||
G4double GetDisplayLightFrontY () const;
|
||||
G4double GetDisplayLightFrontZ () const;
|
||||
G4double GetDisplayLightFrontT () const;
|
||||
G4double GetDisplayLightFrontRed () const;
|
||||
G4double GetDisplayLightFrontGreen () const;
|
||||
G4double GetDisplayLightFrontBlue () const;
|
||||
const G4ModelingParameters::TimeParameters&
|
||||
GetTimeParameters () const;
|
||||
G4bool IsSpecialMeshRendering () const;
|
||||
SMROption GetSpecialMeshRenderingOption () const;
|
||||
const std::vector<G4ModelingParameters::PVNameCopyNo>& GetSpecialMeshVolumes() const;
|
||||
const std::vector<G4ModelingParameters::PVNameCopyNo>& GetSpecialMeshVolumes () const;
|
||||
G4double GetTransparencyByDepth () const;
|
||||
G4int GetTransparencyByDepthOption () const;
|
||||
|
||||
// Here Follow functions to evaluate useful quantities as a
|
||||
// function of the radius of the Bounding Extent of the object being
|
||||
@@ -289,27 +275,12 @@ public: // With description
|
||||
void SetRotationStyle (RotationStyle);
|
||||
void ClearVisAttributesModifiers ();
|
||||
void AddVisAttributesModifier(const G4ModelingParameters::VisAttributesModifier&);
|
||||
void SetStartTime (G4double);
|
||||
void SetEndTime (G4double);
|
||||
void SetFadeFactor (G4double);
|
||||
void SetDisplayHeadTime (G4bool);
|
||||
void SetDisplayHeadTimeX (G4double);
|
||||
void SetDisplayHeadTimeY (G4double);
|
||||
void SetDisplayHeadTimeSize (G4double);
|
||||
void SetDisplayHeadTimeRed (G4double);
|
||||
void SetDisplayHeadTimeGreen (G4double);
|
||||
void SetDisplayHeadTimeBlue (G4double);
|
||||
void SetDisplayLightFront (G4bool);
|
||||
void SetDisplayLightFrontX (G4double);
|
||||
void SetDisplayLightFrontY (G4double);
|
||||
void SetDisplayLightFrontZ (G4double);
|
||||
void SetDisplayLightFrontT (G4double);
|
||||
void SetDisplayLightFrontRed (G4double);
|
||||
void SetDisplayLightFrontGreen (G4double);
|
||||
void SetDisplayLightFrontBlue (G4double);
|
||||
void SetTimeParameters (const G4ModelingParameters::TimeParameters&);
|
||||
void SetSpecialMeshRendering (G4bool);
|
||||
void SetSpecialMeshRenderingOption (SMROption);
|
||||
void SetSpecialMeshVolumes (const std::vector<G4ModelingParameters::PVNameCopyNo>&);
|
||||
void SetTransparencyByDepth (G4double);
|
||||
void SetTransparencyByDepthOption (G4int);
|
||||
|
||||
// Command dumping functions.
|
||||
// For camera commands we need to provide the standard target point from
|
||||
@@ -394,19 +365,12 @@ private:
|
||||
G4bool fPicking; // Request picking.
|
||||
RotationStyle fRotationStyle; // Rotation style.
|
||||
std::vector<G4ModelingParameters::VisAttributesModifier> fVisAttributesModifiers;
|
||||
G4double fStartTime, fEndTime; // Time range (e.g., for trajectory steps).
|
||||
G4double fFadeFactor; // 0: no fade; 1: maximum fade with time within range.
|
||||
G4bool fDisplayHeadTime; // Display head time (fEndTime) in 2D text.
|
||||
G4double fDisplayHeadTimeX, fDisplayHeadTimeY; // 2D screen coords.
|
||||
G4double fDisplayHeadTimeSize; // Screen size.
|
||||
G4double fDisplayHeadTimeRed, fDisplayHeadTimeGreen, fDisplayHeadTimeBlue;
|
||||
G4bool fDisplayLightFront;// Display light front at head time originating at
|
||||
G4double fDisplayLightFrontX, fDisplayLightFrontY, fDisplayLightFrontZ,
|
||||
fDisplayLightFrontT;
|
||||
G4double fDisplayLightFrontRed, fDisplayLightFrontGreen, fDisplayLightFrontBlue;
|
||||
G4ModelingParameters::TimeParameters fTimeParameters; // For time-slicing, etc.
|
||||
G4bool fSpecialMeshRendering; // Request special rendering of parameterised volumes
|
||||
SMROption fSpecialMeshRenderingOption; // Special rendering option
|
||||
std::vector<G4ModelingParameters::PVNameCopyNo> fSpecialMeshVolumes; // If empty, all meshes.
|
||||
G4double fTransparencyByDepth; // Transparency ~= (geometry depth) - fTransparencyByDepth
|
||||
G4int fTransparencyByDepthOption; // Its option
|
||||
|
||||
enum { // Constants for geometry mask in ParseGeometry and related functions.
|
||||
fNoValue = 0,
|
||||
|
||||
@@ -227,77 +227,9 @@ G4ViewParameters::GetVisAttributesModifiers() const {
|
||||
return fVisAttributesModifiers;
|
||||
}
|
||||
|
||||
inline G4double G4ViewParameters::GetStartTime () const {
|
||||
return fStartTime;
|
||||
}
|
||||
|
||||
inline G4double G4ViewParameters::GetEndTime () const {
|
||||
return fEndTime;
|
||||
}
|
||||
|
||||
inline G4double G4ViewParameters::GetFadeFactor () const {
|
||||
return fFadeFactor;
|
||||
}
|
||||
|
||||
inline G4bool G4ViewParameters::IsDisplayHeadTime () const {
|
||||
return fDisplayHeadTime;
|
||||
}
|
||||
|
||||
inline G4double G4ViewParameters::GetDisplayHeadTimeX () const {
|
||||
return fDisplayHeadTimeX;
|
||||
}
|
||||
|
||||
inline G4double G4ViewParameters::GetDisplayHeadTimeY () const {
|
||||
return fDisplayHeadTimeY;
|
||||
}
|
||||
|
||||
inline G4double G4ViewParameters::GetDisplayHeadTimeSize () const {
|
||||
return fDisplayHeadTimeSize;
|
||||
}
|
||||
|
||||
inline G4double G4ViewParameters::GetDisplayHeadTimeRed () const {
|
||||
return fDisplayHeadTimeRed;
|
||||
}
|
||||
|
||||
inline G4double G4ViewParameters::GetDisplayHeadTimeGreen () const {
|
||||
return fDisplayHeadTimeGreen;
|
||||
}
|
||||
|
||||
inline G4double G4ViewParameters::GetDisplayHeadTimeBlue () const {
|
||||
return fDisplayHeadTimeBlue;
|
||||
}
|
||||
|
||||
inline G4bool G4ViewParameters::IsDisplayLightFront () const {
|
||||
return fDisplayLightFront;
|
||||
}
|
||||
|
||||
inline G4double G4ViewParameters::GetDisplayLightFrontX () const {
|
||||
return fDisplayLightFrontX;
|
||||
}
|
||||
|
||||
inline G4double G4ViewParameters::GetDisplayLightFrontY () const {
|
||||
return fDisplayLightFrontY;
|
||||
}
|
||||
|
||||
inline G4double G4ViewParameters::GetDisplayLightFrontZ () const {
|
||||
return fDisplayLightFrontZ;
|
||||
}
|
||||
|
||||
inline G4double G4ViewParameters::GetDisplayLightFrontT () const {
|
||||
return fDisplayLightFrontT;
|
||||
}
|
||||
|
||||
inline G4double G4ViewParameters::GetDisplayLightFrontRed () const {
|
||||
return fDisplayLightFrontRed;
|
||||
}
|
||||
|
||||
inline G4double G4ViewParameters::GetDisplayLightFrontGreen () const {
|
||||
return fDisplayLightFrontGreen;
|
||||
}
|
||||
|
||||
inline G4double G4ViewParameters::GetDisplayLightFrontBlue () const {
|
||||
return fDisplayLightFrontBlue;
|
||||
}
|
||||
inline const G4ModelingParameters::TimeParameters&
|
||||
G4ViewParameters::GetTimeParameters () const
|
||||
{return fTimeParameters;}
|
||||
|
||||
inline G4int G4ViewParameters::GetNumberOfCloudPoints () const {
|
||||
return fNumberOfCloudPoints;
|
||||
@@ -313,6 +245,14 @@ inline const std::vector<G4ModelingParameters::PVNameCopyNo>&
|
||||
G4ViewParameters::GetSpecialMeshVolumes() const
|
||||
{return fSpecialMeshVolumes;}
|
||||
|
||||
inline G4double G4ViewParameters::GetTransparencyByDepth () const {
|
||||
return fTransparencyByDepth;
|
||||
}
|
||||
|
||||
inline G4int G4ViewParameters::GetTransparencyByDepthOption () const {
|
||||
return fTransparencyByDepthOption;
|
||||
}
|
||||
|
||||
inline void
|
||||
G4ViewParameters::SetDrawingStyle (G4ViewParameters::DrawingStyle style) {
|
||||
fDrawingStyle = style;
|
||||
@@ -500,76 +440,9 @@ inline void G4ViewParameters::ClearVisAttributesModifiers () {
|
||||
fVisAttributesModifiers.clear ();
|
||||
}
|
||||
|
||||
inline void G4ViewParameters::SetStartTime (G4double startTime) {
|
||||
fStartTime = startTime;
|
||||
}
|
||||
|
||||
inline void G4ViewParameters::SetEndTime (G4double endTime) {
|
||||
fEndTime = endTime;
|
||||
}
|
||||
|
||||
inline void G4ViewParameters::SetFadeFactor (G4double fadeFactor) {
|
||||
fFadeFactor = fadeFactor;
|
||||
}
|
||||
|
||||
inline void G4ViewParameters::SetDisplayHeadTime (G4bool displayHeadTime) {
|
||||
fDisplayHeadTime = displayHeadTime;
|
||||
}
|
||||
|
||||
inline void G4ViewParameters::SetDisplayHeadTimeX (G4double displayHeadTimeX) {
|
||||
fDisplayHeadTimeX = displayHeadTimeX;
|
||||
}
|
||||
|
||||
inline void G4ViewParameters::SetDisplayHeadTimeY (G4double displayHeadTimeY) {
|
||||
fDisplayHeadTimeY = displayHeadTimeY;
|
||||
}
|
||||
|
||||
inline void G4ViewParameters::SetDisplayHeadTimeSize (G4double displayHeadTimeSize) {
|
||||
fDisplayHeadTimeSize = displayHeadTimeSize;
|
||||
}
|
||||
|
||||
inline void G4ViewParameters::SetDisplayHeadTimeRed (G4double displayHeadTimeRed) {
|
||||
fDisplayHeadTimeRed = displayHeadTimeRed;
|
||||
}
|
||||
|
||||
inline void G4ViewParameters::SetDisplayHeadTimeGreen (G4double displayHeadTimeGreen) {
|
||||
fDisplayHeadTimeGreen = displayHeadTimeGreen;
|
||||
}
|
||||
|
||||
inline void G4ViewParameters::SetDisplayHeadTimeBlue (G4double displayHeadTimeBlue) {
|
||||
fDisplayHeadTimeBlue = displayHeadTimeBlue;
|
||||
}
|
||||
|
||||
inline void G4ViewParameters::SetDisplayLightFront (G4bool displayLightFront) {
|
||||
fDisplayLightFront = displayLightFront;
|
||||
}
|
||||
|
||||
inline void G4ViewParameters::SetDisplayLightFrontX (G4double displayLightFrontX) {
|
||||
fDisplayLightFrontX = displayLightFrontX;
|
||||
}
|
||||
|
||||
inline void G4ViewParameters::SetDisplayLightFrontY (G4double displayLightFrontY) {
|
||||
fDisplayLightFrontY = displayLightFrontY;
|
||||
}
|
||||
|
||||
inline void G4ViewParameters::SetDisplayLightFrontZ (G4double displayLightFrontZ) {
|
||||
fDisplayLightFrontZ = displayLightFrontZ;
|
||||
}
|
||||
|
||||
inline void G4ViewParameters::SetDisplayLightFrontT (G4double displayLightFrontT) {
|
||||
fDisplayLightFrontT = displayLightFrontT;
|
||||
}
|
||||
|
||||
inline void G4ViewParameters::SetDisplayLightFrontRed (G4double displayLightFrontRed) {
|
||||
fDisplayLightFrontRed = displayLightFrontRed;
|
||||
}
|
||||
|
||||
inline void G4ViewParameters::SetDisplayLightFrontGreen (G4double displayLightFrontGreen) {
|
||||
fDisplayLightFrontGreen = displayLightFrontGreen;
|
||||
}
|
||||
|
||||
inline void G4ViewParameters::SetDisplayLightFrontBlue (G4double displayLightFrontBlue) {
|
||||
fDisplayLightFrontBlue = displayLightFrontBlue;
|
||||
inline void G4ViewParameters::SetTimeParameters
|
||||
(const G4ModelingParameters::TimeParameters& timeParameters) {
|
||||
fTimeParameters = timeParameters;
|
||||
}
|
||||
|
||||
inline void G4ViewParameters::SetSpecialMeshRendering (G4bool smr)
|
||||
@@ -581,3 +454,11 @@ inline void G4ViewParameters::SetSpecialMeshRenderingOption (G4ViewParameters::S
|
||||
inline void G4ViewParameters::SetSpecialMeshVolumes
|
||||
(const std::vector<G4ModelingParameters::PVNameCopyNo>& smvs)
|
||||
{fSpecialMeshVolumes = smvs;}
|
||||
|
||||
inline void G4ViewParameters::SetTransparencyByDepth (G4double transparencyByDepth) {
|
||||
fTransparencyByDepth = transparencyByDepth;
|
||||
}
|
||||
|
||||
inline void G4ViewParameters::SetTransparencyByDepthOption (G4int transparencyByDepthOption) {
|
||||
fTransparencyByDepthOption = transparencyByDepthOption;
|
||||
}
|
||||
|
||||
@@ -128,6 +128,23 @@ private:
|
||||
G4UIcmdWithoutParameter* fpCommand;
|
||||
};
|
||||
|
||||
class G4VisCommandSceneAddEndOfRunMacro: public G4VVisCommandScene {
|
||||
public:
|
||||
G4VisCommandSceneAddEndOfRunMacro ();
|
||||
virtual ~G4VisCommandSceneAddEndOfRunMacro ();
|
||||
G4String GetCurrentValue (G4UIcommand* command);
|
||||
void SetNewValue (G4UIcommand* command, G4String newValue);
|
||||
private:
|
||||
G4VisCommandSceneAddEndOfRunMacro (const G4VisCommandSceneAddEndOfRunMacro&);
|
||||
G4VisCommandSceneAddEndOfRunMacro& operator = (const G4VisCommandSceneAddEndOfRunMacro&);
|
||||
struct EndOfRunMacro {
|
||||
EndOfRunMacro(const G4String& macro): fMacro(macro){};
|
||||
void operator()(G4VGraphicsScene&, const G4ModelingParameters*);
|
||||
G4String fMacro;
|
||||
};
|
||||
G4UIcmdWithAString* fpCommand;
|
||||
};
|
||||
|
||||
class G4VisCommandSceneAddEventID: public G4VVisCommandScene {
|
||||
public:
|
||||
G4VisCommandSceneAddEventID ();
|
||||
|
||||
@@ -82,6 +82,7 @@ private:
|
||||
G4UIcommand* fpCommandSpecialMeshVolumes;
|
||||
G4UIcmdWithAString* fpCommandStyle;
|
||||
G4UIcmdWith3VectorAndUnit* fpCommandTargetPoint;
|
||||
G4UIcommand* fpCommandTransparencyByDepth;
|
||||
G4UIcommand* fpCommandUpThetaPhi;
|
||||
G4UIcommand* fpCommandUpVector;
|
||||
G4ThreeVector fUpVector;
|
||||
|
||||
@@ -85,6 +85,10 @@
|
||||
#include "G4RayTracerX.hh" // no_geant4_module_check
|
||||
#endif
|
||||
|
||||
#ifdef G4VIS_USE_RAYTRACER_QT
|
||||
#include "G4RayTracerQt.hh" // no_geant4_module_check
|
||||
#endif
|
||||
|
||||
#ifdef G4VIS_USE_QT3D
|
||||
#include "G4Qt3D.hh" // no_geant4_module_check
|
||||
#endif
|
||||
@@ -309,14 +313,14 @@ inline
|
||||
void G4VisExecutive::SetDefaultsByBuildFlags()
|
||||
{
|
||||
// 5th, by cpp flags
|
||||
#if defined G4VIS_USE_OPENGLQT || G4VIS_USE_OPENGLXM ||\
|
||||
#if defined G4VIS_USE_TOOLSSG_QT_GLES || G4VIS_USE_TOOLSSG_X11_GLES ||\
|
||||
G4VIS_USE_TOOLSSG_XT_GLES || G4VIS_USE_TOOLSSG_WINDOWS_GLES
|
||||
fDefaultGraphicsSystemName = "TSG";
|
||||
#elif defined G4VIS_USE_OPENGLQT || G4VIS_USE_OPENGLXM ||\
|
||||
G4VIS_USE_OPENGLX || G4VIS_USE_OPENGLWIN32
|
||||
fDefaultGraphicsSystemName = "OGL";
|
||||
#elif defined G4VIS_USE_OI || G4VIS_USE_OIX
|
||||
fDefaultGraphicsSystemName = "OI";
|
||||
#elif defined G4VIS_USE_TOOLSSG_QT_GLES || G4VIS_USE_TOOLSSG_X11_GLES ||\
|
||||
G4VIS_USE_TOOLSSG_XT_GLES || G4VIS_USE_TOOLSSG_WINDOWS_GLES
|
||||
fDefaultGraphicsSystemName = "TSG";
|
||||
#elif defined G4VIS_USE_VTK || G4VIS_USE_VTK_QT
|
||||
fDefaultGraphicsSystemName = "Vtk";
|
||||
#elif defined G4VIS_USE_TOOLSSG_QT_ZB || G4VIS_USE_TOOLSSG_X11_ZB ||\
|
||||
@@ -356,7 +360,6 @@ void G4VisExecutive::RegisterGraphicsSystems () {
|
||||
RegisterGraphicsSystem(ogliqt);
|
||||
RegisterGraphicsSystem(oglsqt);
|
||||
ogliqt->AddNickname("OGLI");
|
||||
oglsqt->AddNickname("OGL");
|
||||
oglsqt->AddNickname("OGLS");
|
||||
#endif
|
||||
|
||||
@@ -370,7 +373,6 @@ void G4VisExecutive::RegisterGraphicsSystems () {
|
||||
oglsxm->AddNickname("OGLSQt_FALLBACK");
|
||||
# else
|
||||
oglixm->AddNickname("OGLI");
|
||||
oglsxm->AddNickname("OGL");
|
||||
oglsxm->AddNickname("OGLS");
|
||||
# endif
|
||||
#endif
|
||||
@@ -391,7 +393,6 @@ void G4VisExecutive::RegisterGraphicsSystems () {
|
||||
# if defined(G4VIS_USE_OPENGLQT) || (G4VIS_USE_OPENGLXM)
|
||||
# else
|
||||
oglix->AddNickname("OGLI");
|
||||
oglsx->AddNickname("OGL");
|
||||
oglsx->AddNickname("OGLS");
|
||||
# endif
|
||||
#endif
|
||||
@@ -406,7 +407,6 @@ void G4VisExecutive::RegisterGraphicsSystems () {
|
||||
oglswin32->AddNickname("OGLSQt_FALLBACK");
|
||||
# else
|
||||
ogliwin32->AddNickname("OGLI");
|
||||
oglswin32->AddNickname("OGL");
|
||||
oglswin32->AddNickname("OGLS");
|
||||
# endif
|
||||
#endif
|
||||
@@ -437,6 +437,10 @@ void G4VisExecutive::RegisterGraphicsSystems () {
|
||||
RegisterGraphicsSystem(new G4RayTracerX);
|
||||
#endif
|
||||
|
||||
#ifdef G4VIS_USE_RAYTRACER_QT
|
||||
RegisterGraphicsSystem(new G4RayTracerQt);
|
||||
#endif
|
||||
|
||||
#ifdef G4VIS_USE_QT3D
|
||||
RegisterGraphicsSystem(new G4Qt3D);
|
||||
#endif
|
||||
@@ -500,19 +504,26 @@ void G4VisExecutive::RegisterGraphicsSystems () {
|
||||
|
||||
#ifdef G4VIS_USE_TOOLSSG_QT_GLES
|
||||
tsg_qt_gles->AddNickname("TSG");
|
||||
tsg_qt_gles->AddNickname("OGL");
|
||||
#elif defined(G4VIS_USE_TOOLSSG_XT_GLES)
|
||||
tsg_xt_gles->AddNickname("TSG");
|
||||
tsg_xt_gles->AddNickname("OGL");
|
||||
#elif defined(G4VIS_USE_TOOLSSG_X11_GLES)
|
||||
tsg_x11_gles->AddNickname("TSG");
|
||||
tsg_x11_gles->AddNickname("OGL");
|
||||
#elif defined(G4VIS_USE_TOOLSSG_WINDOWS_GLES)
|
||||
tsg_windows_gles->AddNickname("TSG");
|
||||
tsg_windows_gles->AddNickname("OGL");
|
||||
#else
|
||||
#ifdef G4VIS_USE_TOOLSSG_QT_ZB
|
||||
tsg_qt_zb->AddNickname("TSG");
|
||||
tsg_qt_zb->AddNickname("OGL");
|
||||
#elif G4VIS_USE_TOOLSSG_WINDOWS_ZB
|
||||
tsg_windows_zb->AddNickname("TSG");
|
||||
tsg_windows_zb->AddNickname("OGL");
|
||||
#else
|
||||
tsg_offscreen->AddNickname("TSG");
|
||||
tsg_offscreen->AddNickname("OGL");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
@@ -29,7 +29,6 @@
|
||||
#include "G4PlotterManager.hh"
|
||||
#include "G4ios.hh"
|
||||
|
||||
#include <tools/forit>
|
||||
#include <tools/tokenize>
|
||||
|
||||
G4PlotterManager& G4PlotterManager::GetInstance () {
|
||||
@@ -46,9 +45,9 @@ G4PlotterManager::~G4PlotterManager() {
|
||||
}
|
||||
|
||||
G4Plotter& G4PlotterManager::GetPlotter(const G4String& a_name) {
|
||||
tools_vforit(NamedPlotter,fPlotters,it) {
|
||||
if((*it).first==a_name) {
|
||||
return (*it).second;
|
||||
for(auto& plotter : fPlotters) {
|
||||
if(plotter.first == a_name) {
|
||||
return plotter.second;
|
||||
}
|
||||
}
|
||||
fPlotters.push_back(NamedPlotter(a_name,G4Plotter()));
|
||||
@@ -56,8 +55,8 @@ G4Plotter& G4PlotterManager::GetPlotter(const G4String& a_name) {
|
||||
}
|
||||
|
||||
void G4PlotterManager::List() const {
|
||||
tools_vforcit(NamedPlotter,fPlotters,it) {
|
||||
G4cout << (*it).first << G4endl;
|
||||
for(const auto& plotter : fPlotters) {
|
||||
G4cout << plotter.first << G4endl;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,16 +65,16 @@ void G4PlotterManager::List() const {
|
||||
//////////////////////////////////////////////////////////////////
|
||||
|
||||
void G4PlotterManager::ListStyles() const {
|
||||
tools_vforcit(NamedStyle,fStyles,it) {
|
||||
G4cout << (*it).first << G4endl;
|
||||
for(const auto& style : fStyles) {
|
||||
G4cout << style.first << G4endl;
|
||||
}
|
||||
}
|
||||
|
||||
G4PlotterManager::Style* G4PlotterManager::FindStyle(const G4String& a_name) {
|
||||
tools_vforit(NamedStyle,fStyles,it){
|
||||
if((*it).first==a_name) return &((*it).second);
|
||||
for(auto& style : fStyles) {
|
||||
if(style.first == a_name) return &style.second;
|
||||
}
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void G4PlotterManager::SelectStyle(const G4String& a_name) {
|
||||
@@ -86,21 +85,21 @@ void G4PlotterManager::SelectStyle(const G4String& a_name) {
|
||||
}
|
||||
|
||||
void G4PlotterManager::RemoveStyle(const G4String& a_name) {
|
||||
tools_vforit(NamedStyle,fStyles,it) {
|
||||
if((*it).first==a_name) {
|
||||
for (auto it = fStyles.begin(); it != fStyles.end(); ++it) {
|
||||
if (it->first == a_name) {
|
||||
fStyles.erase(it);
|
||||
if(fCurrentStyle==a_name) fCurrentStyle.clear();
|
||||
if (fCurrentStyle == a_name) fCurrentStyle.clear();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void G4PlotterManager::PrintStyle(const G4String& a_name) const {
|
||||
tools_vforcit(NamedStyle,fStyles,it) {
|
||||
if((*it).first==a_name) {
|
||||
G4cout << (*it).first << ":" << G4endl;
|
||||
tools_vforcit(StyleItem,(*it).second,its) {
|
||||
G4cout << " " << (*its).first << " " << (*its).second << G4endl;
|
||||
for(const auto& style : fStyles) {
|
||||
if(style.first == a_name) {
|
||||
G4cout << style.first << ":" << G4endl;
|
||||
for(const auto& item : style.second) {
|
||||
G4cout << " " << item.first << " " << item.second << G4endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -112,9 +111,9 @@ void G4PlotterManager::AddStyleParameter(const G4String& a_parameter,const G4Str
|
||||
G4cout << "G4PlotterManager::AddStyleParameter: style " << fCurrentStyle << " not found." << G4endl;
|
||||
return;
|
||||
}
|
||||
tools_vforit(StyleItem,(*_style),it) {
|
||||
if((*it).first==a_parameter) {
|
||||
(*it).second = a_value;
|
||||
for(auto& item : *_style) {
|
||||
if(item.first == a_parameter) {
|
||||
item.second = a_value;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,9 +65,9 @@ void G4Scene::CalculateExtent ()
|
||||
{
|
||||
G4BoundingExtentScene boundingExtentScene;
|
||||
|
||||
for (size_t i = 0; i < fRunDurationModelList.size(); i++) {
|
||||
if (fRunDurationModelList[i].fActive) {
|
||||
G4VModel* model = fRunDurationModelList[i].fpModel;
|
||||
for (auto& i : fRunDurationModelList) {
|
||||
if (i.fActive) {
|
||||
G4VModel* model = i.fpModel;
|
||||
if (model -> Validate()) {
|
||||
const G4VisExtent& thisExtent = model -> GetExtent ();
|
||||
if (thisExtent != G4VisExtent::GetNullExtent()) {
|
||||
@@ -79,9 +79,9 @@ void G4Scene::CalculateExtent ()
|
||||
}
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < fEndOfEventModelList.size(); i++) {
|
||||
if (fEndOfEventModelList[i].fActive) {
|
||||
G4VModel* model = fEndOfEventModelList[i].fpModel;
|
||||
for (auto & i : fEndOfEventModelList) {
|
||||
if (i.fActive) {
|
||||
G4VModel* model = i.fpModel;
|
||||
if (model -> Validate()) {
|
||||
const G4VisExtent& thisExtent = model -> GetExtent ();
|
||||
if (thisExtent != G4VisExtent::GetNullExtent()) {
|
||||
@@ -93,9 +93,9 @@ void G4Scene::CalculateExtent ()
|
||||
}
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < fEndOfRunModelList.size(); i++) {
|
||||
if (fEndOfRunModelList[i].fActive) {
|
||||
G4VModel* model = fEndOfRunModelList[i].fpModel;
|
||||
for (auto & i : fEndOfRunModelList) {
|
||||
if (i.fActive) {
|
||||
G4VModel* model = i.fpModel;
|
||||
if (model -> Validate()) {
|
||||
const G4VisExtent& thisExtent = model -> GetExtent ();
|
||||
if (thisExtent != G4VisExtent::GetNullExtent()) {
|
||||
|
||||
@@ -354,9 +354,8 @@ void G4VSceneHandler::AddCompound (const G4THitsMap<G4double>& hits) {
|
||||
if (mesh && mesh->IsActive()) {
|
||||
MeshScoreMap scoreMap = mesh->GetScoreMap();
|
||||
const G4String& mapNam = const_cast<G4THitsMap<G4double>&>(hits).GetName();
|
||||
for(MeshScoreMap::const_iterator i = scoreMap.cbegin();
|
||||
i != scoreMap.cend(); ++i) {
|
||||
const G4String& scoreMapName = i->first;
|
||||
for(const auto& i : scoreMap) {
|
||||
const G4String& scoreMapName = i.first;
|
||||
if (scoreMapName == mapNam) {
|
||||
G4DefaultLinearColorMap colorMap("G4VSceneHandlerColorMap");
|
||||
scoreMapHits = true;
|
||||
@@ -396,10 +395,9 @@ void G4VSceneHandler::AddCompound (const G4THitsMap<G4StatDouble>& hits) {
|
||||
G4VScoringMesh* mesh = scoringManager->GetMesh((G4int)iMesh);
|
||||
if (mesh && mesh->IsActive()) {
|
||||
MeshScoreMap scoreMap = mesh->GetScoreMap();
|
||||
for(MeshScoreMap::const_iterator i = scoreMap.cbegin();
|
||||
i != scoreMap.cend(); ++i) {
|
||||
const G4String& scoreMapName = i->first;
|
||||
const G4THitsMap<G4StatDouble>* foundHits = i->second;
|
||||
for(const auto& i : scoreMap) {
|
||||
const G4String& scoreMapName = i.first;
|
||||
const G4THitsMap<G4StatDouble>* foundHits = i.second;
|
||||
if (foundHits == &hits) {
|
||||
G4DefaultLinearColorMap colorMap("G4VSceneHandlerColorMap");
|
||||
scoreMapHits = true;
|
||||
@@ -472,8 +470,8 @@ void G4VSceneHandler::AddPrimitive (const G4Polymarker& polymarker) {
|
||||
G4Circle dot (polymarker);
|
||||
dot.SetWorldSize (0.);
|
||||
dot.SetScreenSize (0.1); // Very small circle.
|
||||
for (std::size_t iPoint = 0; iPoint < polymarker.size (); ++iPoint) {
|
||||
dot.SetPosition (polymarker[iPoint]);
|
||||
for (const auto& iPoint : polymarker) {
|
||||
dot.SetPosition (iPoint);
|
||||
AddPrimitive (dot);
|
||||
}
|
||||
}
|
||||
@@ -481,8 +479,8 @@ void G4VSceneHandler::AddPrimitive (const G4Polymarker& polymarker) {
|
||||
case G4Polymarker::circles:
|
||||
{
|
||||
G4Circle circle (polymarker); // Default circle
|
||||
for (std::size_t iPoint = 0; iPoint < polymarker.size (); ++iPoint) {
|
||||
circle.SetPosition (polymarker[iPoint]);
|
||||
for (const auto& iPoint : polymarker) {
|
||||
circle.SetPosition (iPoint);
|
||||
AddPrimitive (circle);
|
||||
}
|
||||
}
|
||||
@@ -490,8 +488,8 @@ void G4VSceneHandler::AddPrimitive (const G4Polymarker& polymarker) {
|
||||
case G4Polymarker::squares:
|
||||
{
|
||||
G4Square square (polymarker); // Default square
|
||||
for (std::size_t iPoint = 0; iPoint < polymarker.size (); ++iPoint) {
|
||||
square.SetPosition (polymarker[iPoint]);
|
||||
for (const auto& iPoint : polymarker) {
|
||||
square.SetPosition (iPoint);
|
||||
AddPrimitive (square);
|
||||
}
|
||||
}
|
||||
@@ -682,10 +680,10 @@ void G4VSceneHandler::ProcessScene()
|
||||
return;
|
||||
|
||||
if(fpScene->GetExtent() == G4VisExtent::GetNullExtent())
|
||||
{
|
||||
{
|
||||
G4Exception("G4VSceneHandler::ProcessScene", "visman0106", JustWarning,
|
||||
"The scene has no extent.");
|
||||
}
|
||||
}
|
||||
|
||||
G4VisManager* visManager = G4VisManager::GetInstance();
|
||||
|
||||
@@ -696,16 +694,10 @@ void G4VSceneHandler::ProcessScene()
|
||||
|
||||
fReadyForTransients = false;
|
||||
|
||||
// Reset fMarkForClearingTransientStore. (Leaving
|
||||
// fMarkForClearingTransientStore true causes problems with
|
||||
// recomputing transients below.) Restore it again at end...
|
||||
G4bool tmpMarkForClearingTransientStore = fMarkForClearingTransientStore;
|
||||
fMarkForClearingTransientStore = false;
|
||||
|
||||
// Traverse geometry tree and send drawing primitives to window(s).
|
||||
|
||||
const std::vector<G4Scene::Model>& runDurationModelList =
|
||||
fpScene->GetRunDurationModelList();
|
||||
fpScene->GetRunDurationModelList();
|
||||
|
||||
if(runDurationModelList.size()) {
|
||||
if(verbosity >= G4VisManager::confirmations) {
|
||||
@@ -728,9 +720,9 @@ void G4VSceneHandler::ProcessScene()
|
||||
// Create modeling parameters from view parameters...
|
||||
G4ModelingParameters* pMP = CreateModelingParameters();
|
||||
|
||||
for(std::size_t i = 0; i < runDurationModelList.size(); ++i) {
|
||||
if(runDurationModelList[i].fActive) {
|
||||
fpModel = runDurationModelList[i].fpModel;
|
||||
for(const auto& i : runDurationModelList) {
|
||||
if(i.fActive) {
|
||||
fpModel = i.fpModel;
|
||||
fpModel->SetModelingParameters(pMP);
|
||||
|
||||
// Describe to the current scene handler
|
||||
@@ -747,6 +739,9 @@ void G4VSceneHandler::ProcessScene()
|
||||
if (pPVModel) {
|
||||
G4VViewer::SceneTreeScene sceneTreeScene(fpViewer, pPVModel);
|
||||
fpModel->DescribeYourselfTo(sceneTreeScene);
|
||||
const auto& maxDepth = pPVModel->GetMaxFullDepth();
|
||||
if (fMaxGeometryDepth < maxDepth) {fMaxGeometryDepth = maxDepth;}
|
||||
// This will be the maximum geometry depth for this scene handler
|
||||
}
|
||||
|
||||
// Reset modeling parameters pointer
|
||||
@@ -761,23 +756,32 @@ void G4VSceneHandler::ProcessScene()
|
||||
}
|
||||
|
||||
// Some printing
|
||||
if(verbosity >= G4VisManager::confirmations) {
|
||||
if(verbosity >= G4VisManager::parameters) {
|
||||
for (const auto& model: runDurationModelList) {
|
||||
if (model.fActive) {
|
||||
auto pvModel = dynamic_cast<G4PhysicalVolumeModel*>(model.fpModel);
|
||||
if (pvModel) {
|
||||
G4int nTouchables = 0;
|
||||
G4cout << "Numbers of touchables by depth in model \""
|
||||
|
||||
G4cout << "Numbers of all touchables by depth \""
|
||||
<< pvModel->GetGlobalDescription() << "\":";
|
||||
for (const auto& dn : pvModel->GetNumberOfTouchables()) {
|
||||
for (const auto& dn : pvModel->GetMapOfAllTouchables()) {
|
||||
G4cout << "\n Depth " << dn.first << ": " << dn.second;
|
||||
nTouchables += dn.second;
|
||||
}
|
||||
G4cout << "\n Total number of touchables: " << nTouchables << G4endl;
|
||||
G4cout << "\n Total number of all touchables: "
|
||||
<< pvModel->GetTotalAllTouchables() << G4endl;
|
||||
|
||||
G4cout << "Numbers of touchables drawn by depth \""
|
||||
<< pvModel->GetGlobalDescription() << "\":";
|
||||
for (const auto& dn : pvModel->GetMapOfDrawnTouchables()) {
|
||||
G4cout << "\n Depth " << dn.first << ": " << dn.second;
|
||||
}
|
||||
G4cout << "\n Total number of drawn touchables: "
|
||||
<< pvModel->GetTotalDrawnTouchables() << G4endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
if(verbosity >= G4VisManager::warnings) {
|
||||
if (fProblematicVolumes.size() > 0) {
|
||||
G4cout << "Problematic volumes:";
|
||||
for (const auto& prob: fProblematicVolumes) {
|
||||
@@ -787,6 +791,22 @@ void G4VSceneHandler::ProcessScene()
|
||||
}
|
||||
}
|
||||
|
||||
ProcessTransients();
|
||||
}
|
||||
|
||||
void G4VSceneHandler::ProcessTransients()
|
||||
{
|
||||
// Assumes transient store has already been cleared
|
||||
|
||||
// Reset fMarkForClearingTransientStore. (Leaving
|
||||
// fMarkForClearingTransientStore true causes problems with
|
||||
// recomputing transients below.) Restore it again at end...
|
||||
G4bool tmpMarkForClearingTransientStore = fMarkForClearingTransientStore;
|
||||
fMarkForClearingTransientStore = false;
|
||||
|
||||
G4VisManager* visManager = G4VisManager::GetInstance();
|
||||
G4VisManager::Verbosity verbosity = visManager->GetVerbosity();
|
||||
|
||||
fReadyForTransients = true;
|
||||
|
||||
// Refresh event from end-of-event model list.
|
||||
@@ -794,75 +814,75 @@ void G4VSceneHandler::ProcessScene()
|
||||
G4StateManager* stateManager = G4StateManager::GetStateManager();
|
||||
G4ApplicationState state = stateManager->GetCurrentState();
|
||||
if(state == G4State_Idle || state == G4State_GeomClosed)
|
||||
{
|
||||
{
|
||||
visManager->SetEventRefreshing(true);
|
||||
|
||||
if(visManager->GetRequestedEvent())
|
||||
{
|
||||
{
|
||||
DrawEvent(visManager->GetRequestedEvent());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
G4RunManager* runManager = G4RunManagerFactory::GetMasterRunManager();
|
||||
if(runManager)
|
||||
{
|
||||
{
|
||||
const G4Run* run = runManager->GetCurrentRun();
|
||||
// Draw a null event in order to pick up models for the scene tree even before a run
|
||||
if (run == nullptr) DrawEvent(0);
|
||||
const std::vector<const G4Event*>* events =
|
||||
run ? run->GetEventVector() : 0;
|
||||
run ? run->GetEventVector() : 0;
|
||||
std::size_t nKeptEvents = 0;
|
||||
if(events)
|
||||
nKeptEvents = events->size();
|
||||
if(nKeptEvents)
|
||||
{
|
||||
if(fpScene->GetRefreshAtEndOfEvent())
|
||||
{
|
||||
if(verbosity >= G4VisManager::confirmations)
|
||||
if(fpScene->GetRefreshAtEndOfEvent())
|
||||
{
|
||||
if(verbosity >= G4VisManager::confirmations)
|
||||
{
|
||||
G4cout << "Refreshing event..." << G4endl;
|
||||
}
|
||||
}
|
||||
const G4Event* event = 0;
|
||||
if(events && events->size())
|
||||
event = events->back();
|
||||
if(event)
|
||||
DrawEvent(event);
|
||||
}
|
||||
}
|
||||
else
|
||||
{ // Accumulating events.
|
||||
{ // Accumulating events.
|
||||
|
||||
if(verbosity >= G4VisManager::confirmations)
|
||||
{
|
||||
G4cout << "Refreshing events in run..." << G4endl;
|
||||
}
|
||||
for(const auto& event : *events)
|
||||
{
|
||||
if(event)
|
||||
DrawEvent(event);
|
||||
}
|
||||
if(verbosity >= G4VisManager::confirmations)
|
||||
{
|
||||
G4cout << "Refreshing events in run..." << G4endl;
|
||||
}
|
||||
for(const auto& event : *events)
|
||||
{
|
||||
if(event)
|
||||
DrawEvent(event);
|
||||
}
|
||||
|
||||
if(!fpScene->GetRefreshAtEndOfRun())
|
||||
{
|
||||
if(verbosity >= G4VisManager::warnings)
|
||||
{
|
||||
G4warn << "WARNING: Cannot refresh events accumulated over more"
|
||||
"\n than one runs. Refreshed just the last run."
|
||||
<< G4endl;
|
||||
}
|
||||
if(!fpScene->GetRefreshAtEndOfRun())
|
||||
{
|
||||
if(verbosity >= G4VisManager::warnings)
|
||||
{
|
||||
G4warn << "WARNING: Cannot refresh events accumulated over more"
|
||||
"\n than one runs. Refreshed just the last run."
|
||||
<< G4endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
visManager->SetEventRefreshing(false);
|
||||
}
|
||||
}
|
||||
|
||||
// Refresh end-of-run model list.
|
||||
// Allow only in Idle or GeomClosed state...
|
||||
if(state == G4State_Idle || state == G4State_GeomClosed)
|
||||
{
|
||||
{
|
||||
DrawEndOfRunModels();
|
||||
}
|
||||
}
|
||||
|
||||
fMarkForClearingTransientStore = tmpMarkForClearingTransientStore;
|
||||
}
|
||||
@@ -995,9 +1015,14 @@ G4ModelingParameters* G4VSceneHandler::CreateModelingParameters ()
|
||||
|
||||
pModelingParams->SetVisAttributesModifiers(vp.GetVisAttributesModifiers());
|
||||
|
||||
pModelingParams->SetTimeParameters(vp.GetTimeParameters());
|
||||
|
||||
pModelingParams->SetSpecialMeshRendering(vp.IsSpecialMeshRendering());
|
||||
pModelingParams->SetSpecialMeshVolumes(vp.GetSpecialMeshVolumes());
|
||||
|
||||
pModelingParams->SetTransparencyByDepth(vp.GetTransparencyByDepth());
|
||||
pModelingParams->SetTransparencyByDepthOption(vp.GetTransparencyByDepthOption());
|
||||
|
||||
return pModelingParams;
|
||||
}
|
||||
|
||||
@@ -1308,8 +1333,8 @@ std::ostream& operator << (std::ostream& os, const G4VSceneHandler& sh) {
|
||||
|
||||
os << "Scene handler " << sh.fName << " has "
|
||||
<< sh.fViewerList.size () << " viewer(s):";
|
||||
for (std::size_t i = 0; i < sh.fViewerList.size (); ++i) {
|
||||
os << "\n " << *(sh.fViewerList [i]);
|
||||
for (const auto* i : sh.fViewerList) {
|
||||
os << "\n " << *i;
|
||||
}
|
||||
|
||||
if (sh.fpScene) {
|
||||
|
||||
@@ -47,7 +47,10 @@
|
||||
#include <sstream>
|
||||
|
||||
G4VViewer::G4VViewer(G4VSceneHandler& sceneHandler, G4int id, const G4String& name)
|
||||
: fSceneHandler(sceneHandler), fViewId(id), fNeedKernelVisit(true)
|
||||
: fSceneHandler(sceneHandler)
|
||||
, fViewId(id)
|
||||
, fNeedKernelVisit(true)
|
||||
, fTransientsNeedRedrawing(false)
|
||||
{
|
||||
if (name == "") {
|
||||
std::ostringstream ost;
|
||||
@@ -126,6 +129,17 @@ void G4VViewer::ProcessView()
|
||||
}
|
||||
}
|
||||
|
||||
void G4VViewer::ProcessTransients()
|
||||
{
|
||||
// If transients change, e.g., a time window change...
|
||||
if (fTransientsNeedRedrawing) {
|
||||
// First, reset the flag - see comment above about recursive calls.
|
||||
fTransientsNeedRedrawing = false;
|
||||
fSceneHandler.ClearTransientStore();
|
||||
fSceneHandler.ProcessTransients();
|
||||
}
|
||||
}
|
||||
|
||||
void G4VViewer::SetViewParameters(const G4ViewParameters& vp)
|
||||
{
|
||||
fVP = vp;
|
||||
@@ -243,26 +257,28 @@ void G4VViewer::InsertModelInSceneTree(G4VModel* model)
|
||||
|
||||
fCurtailDescent = false; // This is used later in SceneTreeScene::ProcessVolume
|
||||
G4String furtherInfo;
|
||||
static G4bool firstWarning = true;
|
||||
G4bool warned = false;
|
||||
if (pvModel) {
|
||||
struct : public G4PseudoScene {
|
||||
void ProcessVolume(const G4VSolid&) {++fNTotalTouchables;}
|
||||
G4int fNTotalTouchables = 0;
|
||||
} counter;
|
||||
pvModel->DescribeYourselfTo(counter); // Calls ProcessVolume for every touchable
|
||||
if (counter.fNTotalTouchables > fMaxNTouchables) {
|
||||
const auto& nAllTouchables = pvModel->GetTotalAllTouchables();
|
||||
if (nAllTouchables > fMaxAllTouchables) {
|
||||
std::ostringstream oss;
|
||||
oss << counter.fNTotalTouchables << " touchables - too many for scene tree";
|
||||
oss << nAllTouchables << " touchables - too many for scene tree";
|
||||
furtherInfo = oss.str();
|
||||
if (G4VisManager::GetInstance()->GetVerbosity() >= G4VisManager::warnings) {
|
||||
G4ExceptionDescription ed;
|
||||
ed << pvModel->GetGlobalDescription() <<
|
||||
":\n Too many touchables (" << counter.fNTotalTouchables
|
||||
<< ") for scene tree. Scene tree for this model will be empty.";
|
||||
G4Exception("G4VViewer::InsertModelInSceneTree", "visman0404", JustWarning, ed);
|
||||
if (firstWarning) {
|
||||
warned = true;
|
||||
if (G4VisManager::GetInstance()->GetVerbosity() >= G4VisManager::warnings) {
|
||||
G4ExceptionDescription ed;
|
||||
ed << pvModel->GetGlobalDescription() <<
|
||||
":\n Too many touchables (" << nAllTouchables
|
||||
<< ") for scene tree. Scene tree for this model will be empty.";
|
||||
G4Exception("G4VViewer::InsertModelInSceneTree", "visman0404", JustWarning, ed);
|
||||
}
|
||||
}
|
||||
fCurtailDescent = true; // This is used later in SceneTreeScene::ProcessVolume
|
||||
}
|
||||
}
|
||||
if (warned) firstWarning = false;
|
||||
|
||||
// Find appropriate model
|
||||
auto& modelItems = fSceneTree.AccessChildren();
|
||||
@@ -302,15 +318,9 @@ G4VViewer::SceneTreeScene::SceneTreeScene(G4VViewer* pViewer, G4PhysicalVolumeMo
|
||||
return; // To keep Coverity happy
|
||||
}
|
||||
|
||||
// Describe the model to an empty scene simply to get the numbers of touchables
|
||||
struct : public G4PseudoScene {
|
||||
void ProcessVolume(const G4VSolid&) {}
|
||||
} counter;
|
||||
fpPVModel->DescribeYourselfTo(counter); // Calls ProcessVolume for every touchable
|
||||
|
||||
// Limit the expanded depth to limit the number expanded so as not to swamp the GUI
|
||||
G4int expanded = 0;
|
||||
for (const auto& dn : fpPVModel->GetNumberOfTouchables()) {
|
||||
for (const auto& dn : fpPVModel->GetMapOfDrawnTouchables()) {
|
||||
expanded += dn.second;
|
||||
if (fMaximumExpandedDepth < dn.first) fMaximumExpandedDepth = dn.first;
|
||||
if (expanded > fMaximumExpanded) break;
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
#include "G4UnitsTable.hh"
|
||||
#include <sstream>
|
||||
#include <cctype>
|
||||
#include <chrono>
|
||||
|
||||
#include "G4PhysicalVolumeModel.hh"
|
||||
#include "G4LogicalVolume.hh"
|
||||
@@ -301,6 +302,8 @@ void G4VVisCommand::InterpolateViews
|
||||
const G4int safety = (G4int)viewVector.size()*nInterpolationPoints;
|
||||
G4int safetyCount = 0;
|
||||
do {
|
||||
// Interpret wait time as a minimum time per interation, i.e., a steady frame rate.
|
||||
auto a = std::chrono::steady_clock::now();
|
||||
G4ViewParameters* vp =
|
||||
G4ViewParameters::CatmullRomCubicSplineInterpolation(viewVector,nInterpolationPoints);
|
||||
if (!vp) break; // Finished.
|
||||
@@ -311,8 +314,14 @@ void G4VVisCommand::InterpolateViews
|
||||
G4UImanager::GetUIpointer()->ApplyCommand("/vis/ogl/export");
|
||||
}
|
||||
currentViewer->ShowView();
|
||||
if (waitTimePerPointmilliseconds > 0)
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(waitTimePerPointmilliseconds));
|
||||
if (waitTimePerPointmilliseconds > 0) {
|
||||
auto b = std::chrono::steady_clock::now();
|
||||
auto timeTaken = b - a;
|
||||
auto timeLeft = std::chrono::milliseconds(waitTimePerPointmilliseconds) - timeTaken;
|
||||
if (timeLeft > std::chrono::duration<double>::zero()) {
|
||||
std::this_thread::sleep_for(timeLeft);
|
||||
}
|
||||
}
|
||||
} while (safetyCount++ < safety); // Loop checking, 16.02.2016, J.Allison
|
||||
}
|
||||
|
||||
|
||||
@@ -85,26 +85,10 @@ G4ViewParameters::G4ViewParameters ():
|
||||
fBackgroundColour (G4Colour(0.,0.,0.)), // Black
|
||||
fPicking (false),
|
||||
fRotationStyle (constrainUpDirection),
|
||||
fStartTime(-G4VisAttributes::fVeryLongTime),
|
||||
fEndTime(G4VisAttributes::fVeryLongTime),
|
||||
fFadeFactor(0.),
|
||||
fDisplayHeadTime(false),
|
||||
fDisplayHeadTimeX(-0.9),
|
||||
fDisplayHeadTimeY(-0.9),
|
||||
fDisplayHeadTimeSize(24.),
|
||||
fDisplayHeadTimeRed(0.),
|
||||
fDisplayHeadTimeGreen(1.),
|
||||
fDisplayHeadTimeBlue(1.),
|
||||
fDisplayLightFront(false),
|
||||
fDisplayLightFrontX(0.),
|
||||
fDisplayLightFrontY(0.),
|
||||
fDisplayLightFrontZ(0.),
|
||||
fDisplayLightFrontT(0.),
|
||||
fDisplayLightFrontRed(0.),
|
||||
fDisplayLightFrontGreen(1.),
|
||||
fDisplayLightFrontBlue(0.),
|
||||
fSpecialMeshRendering(false),
|
||||
fSpecialMeshRenderingOption(meshAsDefault)
|
||||
fSpecialMeshRenderingOption(meshAsDefault),
|
||||
fTransparencyByDepth(0.),
|
||||
fTransparencyByDepthOption(1)
|
||||
{
|
||||
// Pick up default no of sides from G4Polyhedron.
|
||||
// Note that this parameter is variously called:
|
||||
@@ -270,7 +254,7 @@ void G4ViewParameters::SetViewAndLights
|
||||
fActualLightpointDirection =
|
||||
fRelativeLightpointDirection.x () * xprime +
|
||||
fRelativeLightpointDirection.y () * yprime +
|
||||
fRelativeLightpointDirection.x () * zprime;
|
||||
fRelativeLightpointDirection.z () * zprime;
|
||||
} else {
|
||||
fActualLightpointDirection = fRelativeLightpointDirection;
|
||||
}
|
||||
@@ -535,12 +519,12 @@ G4String G4ViewParameters::SceneModifyingCommands() const
|
||||
|
||||
oss << "\n/vis/viewer/clearCutawayPlanes";
|
||||
if (fCutawayPlanes.size()) {
|
||||
for (size_t i = 0; i < fCutawayPlanes.size(); i++) {
|
||||
for (const auto& fCutawayPlane : fCutawayPlanes) {
|
||||
oss << "\n/vis/viewer/addCutawayPlane "
|
||||
<< G4BestUnit(fCutawayPlanes[i].point(),"Length")
|
||||
<< fCutawayPlanes[i].normal().x()
|
||||
<< ' ' << fCutawayPlanes[i].normal().y()
|
||||
<< ' ' << fCutawayPlanes[i].normal().z();
|
||||
<< G4BestUnit(fCutawayPlane.point(),"Length")
|
||||
<< fCutawayPlane.normal().x()
|
||||
<< ' ' << fCutawayPlane.normal().y()
|
||||
<< ' ' << fCutawayPlane.normal().z();
|
||||
}
|
||||
} else {
|
||||
oss << "\n# No cutaway planes defined.";
|
||||
@@ -553,6 +537,9 @@ G4String G4ViewParameters::SceneModifyingCommands() const
|
||||
oss << "\n/vis/viewer/set/lineSegmentsPerCircle "
|
||||
<< fNoOfSides;
|
||||
|
||||
oss << "\n/vis/viewer/set/transparencyByDepth "
|
||||
<< fTransparencyByDepth << ' ' << fTransparencyByDepthOption;
|
||||
|
||||
oss << std::endl;
|
||||
|
||||
return oss.str();
|
||||
@@ -709,46 +696,46 @@ G4String G4ViewParameters::TimeWindowCommands() const
|
||||
|
||||
oss
|
||||
<< "\n/vis/viewer/set/timeWindow/startTime "
|
||||
<< fStartTime/ns << " ns ";
|
||||
<< fTimeParameters.fStartTime/ns << " ns ";
|
||||
|
||||
oss
|
||||
<< "\n/vis/viewer/set/timeWindow/endTime "
|
||||
<< fEndTime/ns << " ns ";
|
||||
<< fTimeParameters.fEndTime/ns << " ns ";
|
||||
|
||||
oss << "\n/vis/viewer/set/timeWindow/fadeFactor "
|
||||
<< fFadeFactor;
|
||||
<< fTimeParameters.fFadeFactor;
|
||||
|
||||
oss
|
||||
<< "\n/vis/viewer/set/timeWindow/displayHeadTime ";
|
||||
if (!fDisplayHeadTime) {
|
||||
if (!fTimeParameters.fDisplayHeadTime) {
|
||||
oss << "false";
|
||||
} else {
|
||||
oss
|
||||
<< "true"
|
||||
<< ' ' << fDisplayHeadTimeX
|
||||
<< ' ' << fDisplayHeadTimeY
|
||||
<< ' ' << fDisplayHeadTimeSize
|
||||
<< ' ' << fDisplayHeadTimeRed
|
||||
<< ' ' << fDisplayHeadTimeGreen
|
||||
<< ' ' << fDisplayHeadTimeBlue;
|
||||
<< ' ' << fTimeParameters.fDisplayHeadTimeX
|
||||
<< ' ' << fTimeParameters.fDisplayHeadTimeY
|
||||
<< ' ' << fTimeParameters.fDisplayHeadTimeSize
|
||||
<< ' ' << fTimeParameters.fDisplayHeadTimeRed
|
||||
<< ' ' << fTimeParameters.fDisplayHeadTimeGreen
|
||||
<< ' ' << fTimeParameters.fDisplayHeadTimeBlue;
|
||||
}
|
||||
|
||||
oss
|
||||
<< "\n/vis/viewer/set/timeWindow/displayLightFront ";
|
||||
if (!fDisplayLightFront) {
|
||||
if (!fTimeParameters.fDisplayLightFront) {
|
||||
oss << "false";
|
||||
} else {
|
||||
oss
|
||||
<< "true"
|
||||
<< ' ' << fDisplayLightFrontX/mm
|
||||
<< ' ' << fDisplayLightFrontY/mm
|
||||
<< ' ' << fDisplayLightFrontZ/mm
|
||||
<< ' ' << fTimeParameters.fDisplayLightFrontX/mm
|
||||
<< ' ' << fTimeParameters.fDisplayLightFrontY/mm
|
||||
<< ' ' << fTimeParameters.fDisplayLightFrontZ/mm
|
||||
<< " mm"
|
||||
<< ' ' << fDisplayLightFrontT/ns
|
||||
<< ' ' << fTimeParameters.fDisplayLightFrontT/ns
|
||||
<< " ns"
|
||||
<< ' ' << fDisplayLightFrontRed
|
||||
<< ' ' << fDisplayLightFrontGreen
|
||||
<< ' ' << fDisplayLightFrontBlue;
|
||||
<< ' ' << fTimeParameters.fDisplayLightFrontRed
|
||||
<< ' ' << fTimeParameters.fDisplayLightFrontGreen
|
||||
<< ' ' << fTimeParameters.fDisplayLightFrontBlue;
|
||||
}
|
||||
|
||||
oss << std::endl;
|
||||
@@ -796,7 +783,9 @@ void G4ViewParameters::PrintDifferences (const G4ViewParameters& v) const {
|
||||
(fAutoRefresh != v.fAutoRefresh) ||
|
||||
(fBackgroundColour != v.fBackgroundColour) ||
|
||||
(fPicking != v.fPicking) ||
|
||||
(fRotationStyle != v.fRotationStyle)
|
||||
(fRotationStyle != v.fRotationStyle) ||
|
||||
(fTransparencyByDepth != v.fTransparencyByDepth) ||
|
||||
(fTransparencyByDepthOption != v.fTransparencyByDepthOption)
|
||||
)
|
||||
G4cout << "Difference in 1st batch." << G4endl;
|
||||
|
||||
@@ -836,38 +825,38 @@ void G4ViewParameters::PrintDifferences (const G4ViewParameters& v) const {
|
||||
G4cout << "Difference in vis attributes modifiers." << G4endl;
|
||||
}
|
||||
|
||||
if (fStartTime != v.fStartTime ||
|
||||
fEndTime != v.fEndTime) {
|
||||
if (fTimeParameters.fStartTime != v.fTimeParameters.fStartTime ||
|
||||
fTimeParameters.fEndTime != v.fTimeParameters.fEndTime) {
|
||||
G4cout << "Difference in time window." << G4endl;
|
||||
}
|
||||
|
||||
if (fFadeFactor != v.fFadeFactor) {
|
||||
if (fTimeParameters.fFadeFactor != v.fTimeParameters.fFadeFactor) {
|
||||
G4cout << "Difference in time window fade factor." << G4endl;
|
||||
}
|
||||
|
||||
if (fDisplayHeadTime != v.fDisplayHeadTime) {
|
||||
if (fTimeParameters.fDisplayHeadTime != v.fTimeParameters.fDisplayHeadTime) {
|
||||
G4cout << "Difference in display head time flag." << G4endl;
|
||||
} else {
|
||||
if (fDisplayHeadTimeX != v.fDisplayHeadTimeX ||
|
||||
fDisplayHeadTimeY != v.fDisplayHeadTimeY ||
|
||||
fDisplayHeadTimeSize != v.fDisplayHeadTimeSize ||
|
||||
fDisplayHeadTimeRed != v.fDisplayHeadTimeRed ||
|
||||
fDisplayHeadTimeGreen != v.fDisplayHeadTimeGreen ||
|
||||
fDisplayHeadTimeBlue != v.fDisplayHeadTimeBlue) {
|
||||
if (fTimeParameters.fDisplayHeadTimeX != v.fTimeParameters.fDisplayHeadTimeX ||
|
||||
fTimeParameters.fDisplayHeadTimeY != v.fTimeParameters.fDisplayHeadTimeY ||
|
||||
fTimeParameters.fDisplayHeadTimeSize != v.fTimeParameters.fDisplayHeadTimeSize ||
|
||||
fTimeParameters.fDisplayHeadTimeRed != v.fTimeParameters.fDisplayHeadTimeRed ||
|
||||
fTimeParameters.fDisplayHeadTimeGreen != v.fTimeParameters.fDisplayHeadTimeGreen ||
|
||||
fTimeParameters.fDisplayHeadTimeBlue != v.fTimeParameters.fDisplayHeadTimeBlue) {
|
||||
G4cout << "Difference in display head time parameters." << G4endl;
|
||||
}
|
||||
}
|
||||
|
||||
if (fDisplayLightFront != v.fDisplayLightFront) {
|
||||
if (fTimeParameters.fDisplayLightFront != v.fTimeParameters.fDisplayLightFront) {
|
||||
G4cout << "Difference in display light front flag." << G4endl;
|
||||
} else {
|
||||
if (fDisplayLightFrontX != v.fDisplayLightFrontX ||
|
||||
fDisplayLightFrontY != v.fDisplayLightFrontY ||
|
||||
fDisplayLightFrontZ != v.fDisplayLightFrontZ ||
|
||||
fDisplayLightFrontT != v.fDisplayLightFrontT ||
|
||||
fDisplayLightFrontRed != v.fDisplayLightFrontRed ||
|
||||
fDisplayLightFrontGreen != v.fDisplayLightFrontGreen ||
|
||||
fDisplayLightFrontBlue != v.fDisplayLightFrontBlue) {
|
||||
if (fTimeParameters.fDisplayLightFrontX != v.fTimeParameters.fDisplayLightFrontX ||
|
||||
fTimeParameters.fDisplayLightFrontY != v.fTimeParameters.fDisplayLightFrontY ||
|
||||
fTimeParameters.fDisplayLightFrontZ != v.fTimeParameters.fDisplayLightFrontZ ||
|
||||
fTimeParameters.fDisplayLightFrontT != v.fTimeParameters.fDisplayLightFrontT ||
|
||||
fTimeParameters.fDisplayLightFrontRed != v.fTimeParameters.fDisplayLightFrontRed ||
|
||||
fTimeParameters.fDisplayLightFrontGreen != v.fTimeParameters.fDisplayLightFrontGreen ||
|
||||
fTimeParameters.fDisplayLightFrontBlue != v.fTimeParameters.fDisplayLightFrontBlue) {
|
||||
G4cout << "Difference in display light front parameters." << G4endl;
|
||||
}
|
||||
}
|
||||
@@ -952,8 +941,8 @@ std::ostream& operator << (std::ostream& os, const G4ViewParameters& v) {
|
||||
|
||||
if (v.IsCutaway()) {
|
||||
os << "\n Cutaway planes: ";
|
||||
for (size_t i = 0; i < v.fCutawayPlanes.size (); i++) {
|
||||
os << ' ' << v.fCutawayPlanes[i];
|
||||
for (const auto& fCutawayPlane : v.fCutawayPlanes) {
|
||||
os << ' ' << fCutawayPlane;
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -1058,29 +1047,29 @@ std::ostream& operator << (std::ostream& os, const G4ViewParameters& v) {
|
||||
}
|
||||
|
||||
os << "\nTime window parameters:"
|
||||
<< "\n Start time: " << v.fStartTime/ns << " ns"
|
||||
<< "\n End time: " << v.fEndTime/ns << " ns"
|
||||
<< "\n Fade factor: " << v.fFadeFactor;
|
||||
if (!v.fDisplayHeadTime) {
|
||||
<< "\n Start time: " << v.fTimeParameters.fStartTime/ns << " ns"
|
||||
<< "\n End time: " << v.fTimeParameters.fEndTime/ns << " ns"
|
||||
<< "\n Fade factor: " << v.fTimeParameters.fFadeFactor;
|
||||
if (!v.fTimeParameters.fDisplayHeadTime) {
|
||||
os << "\n Head time display not requested.";
|
||||
} else {
|
||||
os
|
||||
<< "\n Head time position: "
|
||||
<< v.fDisplayHeadTimeX << ' ' << v.fDisplayHeadTimeY
|
||||
<< "\n Head time size: " << v.fDisplayHeadTimeSize
|
||||
<< "\n Head time colour: " << v.fDisplayHeadTimeRed
|
||||
<< ' ' << v.fDisplayHeadTimeGreen << ' ' << v.fDisplayHeadTimeBlue;
|
||||
<< v.fTimeParameters.fDisplayHeadTimeX << ' ' << v.fTimeParameters.fDisplayHeadTimeY
|
||||
<< "\n Head time size: " << v.fTimeParameters.fDisplayHeadTimeSize
|
||||
<< "\n Head time colour: " << v.fTimeParameters.fDisplayHeadTimeRed
|
||||
<< ' ' << v.fTimeParameters.fDisplayHeadTimeGreen << ' ' << v.fTimeParameters.fDisplayHeadTimeBlue;
|
||||
}
|
||||
if (!v.fDisplayLightFront) {
|
||||
if (!v.fTimeParameters.fDisplayLightFront) {
|
||||
os << "\n Light front display not requested.";
|
||||
} else {
|
||||
os
|
||||
<< "\n Light front position: "
|
||||
<< v.fDisplayLightFrontX/mm << ' ' << v.fDisplayLightFrontY/mm
|
||||
<< ' ' << v.fDisplayLightFrontZ/mm << " mm"
|
||||
<< "\n Light front time: " << v.fDisplayLightFrontT/ns << " ns"
|
||||
<< "\n Light front colour: " << v.fDisplayLightFrontRed
|
||||
<< ' ' << v.fDisplayLightFrontGreen << ' ' << v.fDisplayLightFrontBlue;
|
||||
<< v.fTimeParameters.fDisplayLightFrontX/mm << ' ' << v.fTimeParameters.fDisplayLightFrontY/mm
|
||||
<< ' ' << v.fTimeParameters.fDisplayLightFrontZ/mm << " mm"
|
||||
<< "\n Light front time: " << v.fTimeParameters.fDisplayLightFrontT/ns << " ns"
|
||||
<< "\n Light front colour: " << v.fTimeParameters.fDisplayLightFrontRed
|
||||
<< ' ' << v.fTimeParameters.fDisplayLightFrontGreen << ' ' << v.fTimeParameters.fDisplayLightFrontBlue;
|
||||
}
|
||||
|
||||
os << "\nSpecial Mesh Rendering";
|
||||
@@ -1096,6 +1085,10 @@ std::ostream& operator << (std::ostream& os, const G4ViewParameters& v) {
|
||||
}
|
||||
}
|
||||
} else os << ": off";
|
||||
|
||||
os << "\nTransparency by depth: " << v.fTransparencyByDepth
|
||||
<< ", option: " << v.fTransparencyByDepthOption;
|
||||
|
||||
return os;
|
||||
}
|
||||
|
||||
@@ -1142,7 +1135,9 @@ G4bool G4ViewParameters::operator != (const G4ViewParameters& v) const {
|
||||
(fPicking != v.fPicking) ||
|
||||
(fRotationStyle != v.fRotationStyle) ||
|
||||
(fSpecialMeshRendering != v.fSpecialMeshRendering) ||
|
||||
(fSpecialMeshRenderingOption != v.fSpecialMeshRenderingOption)
|
||||
(fSpecialMeshRenderingOption != v.fSpecialMeshRenderingOption) ||
|
||||
(fTransparencyByDepth != v.fTransparencyByDepth) ||
|
||||
(fTransparencyByDepthOption != v.fTransparencyByDepthOption)
|
||||
)
|
||||
return true;
|
||||
|
||||
@@ -1173,31 +1168,31 @@ G4bool G4ViewParameters::operator != (const G4ViewParameters& v) const {
|
||||
|
||||
if (fVisAttributesModifiers != v.fVisAttributesModifiers) return true;
|
||||
|
||||
if (fStartTime != v.fStartTime ||
|
||||
fEndTime != v.fEndTime ||
|
||||
fFadeFactor != v.fFadeFactor) return true;
|
||||
if (fTimeParameters.fStartTime != v.fTimeParameters.fStartTime ||
|
||||
fTimeParameters.fEndTime != v.fTimeParameters.fEndTime ||
|
||||
fTimeParameters.fFadeFactor != v.fTimeParameters.fFadeFactor) return true;
|
||||
|
||||
if (fDisplayHeadTime != v.fDisplayHeadTime) return true;
|
||||
if (fDisplayHeadTime) {
|
||||
if (fDisplayHeadTimeX != v.fDisplayHeadTimeX ||
|
||||
fDisplayHeadTimeY != v.fDisplayHeadTimeY ||
|
||||
fDisplayHeadTimeSize != v.fDisplayHeadTimeSize ||
|
||||
fDisplayHeadTimeRed != v.fDisplayHeadTimeRed ||
|
||||
fDisplayHeadTimeGreen != v.fDisplayHeadTimeGreen ||
|
||||
fDisplayHeadTimeBlue != v.fDisplayHeadTimeBlue) {
|
||||
if (fTimeParameters.fDisplayHeadTime != v.fTimeParameters.fDisplayHeadTime) return true;
|
||||
if (fTimeParameters.fDisplayHeadTime) {
|
||||
if (fTimeParameters.fDisplayHeadTimeX != v.fTimeParameters.fDisplayHeadTimeX ||
|
||||
fTimeParameters.fDisplayHeadTimeY != v.fTimeParameters.fDisplayHeadTimeY ||
|
||||
fTimeParameters.fDisplayHeadTimeSize != v.fTimeParameters.fDisplayHeadTimeSize ||
|
||||
fTimeParameters.fDisplayHeadTimeRed != v.fTimeParameters.fDisplayHeadTimeRed ||
|
||||
fTimeParameters.fDisplayHeadTimeGreen != v.fTimeParameters.fDisplayHeadTimeGreen ||
|
||||
fTimeParameters.fDisplayHeadTimeBlue != v.fTimeParameters.fDisplayHeadTimeBlue) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (fDisplayLightFront != v.fDisplayLightFront) return true;
|
||||
if (fDisplayLightFront) {
|
||||
if (fDisplayLightFrontX != v.fDisplayLightFrontX ||
|
||||
fDisplayLightFrontY != v.fDisplayLightFrontY ||
|
||||
fDisplayLightFrontZ != v.fDisplayLightFrontZ ||
|
||||
fDisplayLightFrontT != v.fDisplayLightFrontT ||
|
||||
fDisplayLightFrontRed != v.fDisplayLightFrontRed ||
|
||||
fDisplayLightFrontGreen != v.fDisplayLightFrontGreen ||
|
||||
fDisplayLightFrontBlue != v.fDisplayLightFrontBlue) {
|
||||
if (fTimeParameters.fDisplayLightFront != v.fTimeParameters.fDisplayLightFront) return true;
|
||||
if (fTimeParameters.fDisplayLightFront) {
|
||||
if (fTimeParameters.fDisplayLightFrontX != v.fTimeParameters.fDisplayLightFrontX ||
|
||||
fTimeParameters.fDisplayLightFrontY != v.fTimeParameters.fDisplayLightFrontY ||
|
||||
fTimeParameters.fDisplayLightFrontZ != v.fTimeParameters.fDisplayLightFrontZ ||
|
||||
fTimeParameters.fDisplayLightFrontT != v.fTimeParameters.fDisplayLightFrontT ||
|
||||
fTimeParameters.fDisplayLightFrontRed != v.fTimeParameters.fDisplayLightFrontRed ||
|
||||
fTimeParameters.fDisplayLightFrontGreen != v.fTimeParameters.fDisplayLightFrontGreen ||
|
||||
fTimeParameters.fDisplayLightFrontBlue != v.fTimeParameters.fDisplayLightFrontBlue) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1696,10 +1691,10 @@ INTERPOLATE(plane.d()); d = real;
|
||||
// Only two parameters are interpolated. The others are usually chosen
|
||||
// once and for all by the user for a given series of views - or at least,
|
||||
// if not, they will be interpolated by the default "crude" method above.
|
||||
INTERPOLATE(fStartTime)
|
||||
holdingValues.fStartTime = real;
|
||||
INTERPOLATE(fEndTime)
|
||||
holdingValues.fEndTime = real;
|
||||
INTERPOLATE(fTimeParameters.fStartTime)
|
||||
holdingValues.fTimeParameters.fStartTime = real;
|
||||
INTERPOLATE(fTimeParameters.fEndTime)
|
||||
holdingValues.fTimeParameters.fEndTime = real;
|
||||
|
||||
// Increment counters
|
||||
iInterpolationPoint++;
|
||||
|
||||
@@ -560,8 +560,8 @@ G4VisCommandVerbose::G4VisCommandVerbose () {
|
||||
G4bool omitable;
|
||||
|
||||
fpCommand = new G4UIcmdWithAString("/vis/verbose", this);
|
||||
for (size_t i = 0; i < G4VisManager::VerbosityGuidanceStrings.size(); ++i) {
|
||||
fpCommand -> SetGuidance(G4VisManager::VerbosityGuidanceStrings[i]);
|
||||
for (const auto& VerbosityGuidanceString : G4VisManager::VerbosityGuidanceStrings) {
|
||||
fpCommand -> SetGuidance(VerbosityGuidanceString);
|
||||
}
|
||||
fpCommand -> SetParameterName("verbosity", omitable=true);
|
||||
fpCommand -> SetDefaultValue("");
|
||||
|
||||
@@ -71,8 +71,7 @@ void G4VisCommandGeometryList::SetNewValue(G4UIcommand*, G4String newValue)
|
||||
{
|
||||
G4LogicalVolumeStore *pLVStore = G4LogicalVolumeStore::GetInstance();
|
||||
G4bool found = false;
|
||||
for (size_t iLV = 0; iLV < pLVStore->size(); iLV++ ) {
|
||||
G4LogicalVolume*pLV = (*pLVStore)[iLV];
|
||||
for (const auto* pLV : *pLVStore) {
|
||||
const G4String& logVolName = pLV->GetName();
|
||||
if (newValue == "all" || logVolName == newValue) {
|
||||
const G4VisAttributes* visAtts = pLV->GetVisAttributes();
|
||||
|
||||
@@ -46,8 +46,7 @@ void G4VVisCommandGeometrySet::Set
|
||||
G4VisManager::Verbosity verbosity = fpVisManager->GetVerbosity();
|
||||
G4LogicalVolumeStore* pLVStore = G4LogicalVolumeStore::GetInstance();
|
||||
G4bool found = false;
|
||||
for (std::size_t iLV = 0; iLV < pLVStore->size(); ++iLV ) {
|
||||
G4LogicalVolume* pLV = (*pLVStore)[iLV];
|
||||
for (auto* pLV : *pLVStore) {
|
||||
const G4String& logVolName = pLV->GetName();
|
||||
if (logVolName == requestedName) found = true;
|
||||
if (requestedName == "all" || logVolName == requestedName) {
|
||||
|
||||
@@ -153,11 +153,11 @@ void G4VisCommandSceneActivateModel::SetNewValue (G4UIcommand*,
|
||||
|
||||
std::vector<G4Scene::Model>& runDurationModelList =
|
||||
pScene->SetRunDurationModelList();
|
||||
for (size_t i = 0; i < runDurationModelList.size(); i++) {
|
||||
const G4String& modelName = runDurationModelList[i].fpModel->GetGlobalDescription();
|
||||
for (auto& i : runDurationModelList) {
|
||||
const G4String& modelName = i.fpModel->GetGlobalDescription();
|
||||
if (searchString == "all" || modelName.find(searchString) != std::string::npos) {
|
||||
any = true;
|
||||
runDurationModelList[i].fActive = activate;
|
||||
i.fActive = activate;
|
||||
if (verbosity >= G4VisManager::warnings) {
|
||||
G4warn << "Model \"" << modelName;
|
||||
if (activate) G4warn << "\" activated.";
|
||||
@@ -169,11 +169,11 @@ void G4VisCommandSceneActivateModel::SetNewValue (G4UIcommand*,
|
||||
|
||||
std::vector<G4Scene::Model>& endOfEventModelList =
|
||||
pScene->SetEndOfEventModelList();
|
||||
for (size_t i = 0; i < endOfEventModelList.size(); i++) {
|
||||
const G4String& modelName = endOfEventModelList[i].fpModel->GetGlobalDescription();
|
||||
for (auto& i : endOfEventModelList) {
|
||||
const G4String& modelName = i.fpModel->GetGlobalDescription();
|
||||
if (searchString == "all" || modelName.find(searchString) != std::string::npos) {
|
||||
any = true;
|
||||
endOfEventModelList[i].fActive = activate;
|
||||
i.fActive = activate;
|
||||
if (verbosity >= G4VisManager::warnings) {
|
||||
G4warn << "Model \"" << modelName;
|
||||
if (activate) G4warn << "\" activated.";
|
||||
@@ -185,11 +185,11 @@ void G4VisCommandSceneActivateModel::SetNewValue (G4UIcommand*,
|
||||
|
||||
std::vector<G4Scene::Model>& endOfRunModelList =
|
||||
pScene->SetEndOfRunModelList();
|
||||
for (size_t i = 0; i < endOfRunModelList.size(); i++) {
|
||||
const G4String& modelName = endOfRunModelList[i].fpModel->GetGlobalDescription();
|
||||
for (auto& i : endOfRunModelList) {
|
||||
const G4String& modelName = i.fpModel->GetGlobalDescription();
|
||||
if (searchString == "all" || modelName.find(searchString) != std::string::npos) {
|
||||
any = true;
|
||||
endOfRunModelList[i].fActive = activate;
|
||||
i.fActive = activate;
|
||||
if (verbosity >= G4VisManager::warnings) {
|
||||
G4warn << "Model \"" << modelName;
|
||||
if (activate) G4warn << "\" activated.";
|
||||
|
||||
@@ -623,6 +623,65 @@ void G4VisCommandSceneAddElectricField::SetNewValue
|
||||
CheckSceneAndNotifyHandlers (pScene);
|
||||
}
|
||||
|
||||
////////////// /vis/scene/add/endOfRunMacro ///////////////////////////////////////
|
||||
|
||||
G4VisCommandSceneAddEndOfRunMacro::G4VisCommandSceneAddEndOfRunMacro () {
|
||||
G4bool omitable;
|
||||
fpCommand = new G4UIcmdWithAString ("/vis/scene/add/endOfRunMacro", this);
|
||||
fpCommand -> SetGuidance ("Macro is executed at end of run and when rebuild required.");
|
||||
fpCommand -> SetGuidance
|
||||
("WARNING: some vis commands in the macro cause recursion."
|
||||
"\n Stick to simple commmands, e.g., which invoke vis manager Draw() methods.");
|
||||
fpCommand -> SetParameterName ("macro", omitable = false);
|
||||
}
|
||||
|
||||
G4VisCommandSceneAddEndOfRunMacro::~G4VisCommandSceneAddEndOfRunMacro () {
|
||||
delete fpCommand;
|
||||
}
|
||||
|
||||
G4String G4VisCommandSceneAddEndOfRunMacro::GetCurrentValue (G4UIcommand*) {
|
||||
return "";
|
||||
}
|
||||
|
||||
void G4VisCommandSceneAddEndOfRunMacro::SetNewValue (G4UIcommand*, G4String newValue)
|
||||
{
|
||||
G4VisManager::Verbosity verbosity = fpVisManager->GetVerbosity();
|
||||
G4bool warn(verbosity >= G4VisManager::warnings);
|
||||
|
||||
G4Scene* pScene = fpVisManager->GetCurrentScene();
|
||||
if (!pScene) {
|
||||
if (verbosity >= G4VisManager::errors) {
|
||||
G4warn << "ERROR: No current scene. Please create one." << G4endl;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
auto endOfRunMacro = new EndOfRunMacro(newValue);
|
||||
G4VModel* model =
|
||||
new G4CallbackModel<G4VisCommandSceneAddEndOfRunMacro::EndOfRunMacro>(endOfRunMacro);
|
||||
model->SetType("EndOfRunMacro");
|
||||
model->SetGlobalTag("EndOfRunMacro");
|
||||
model->SetGlobalDescription("EndOfRunMacro: " + newValue);
|
||||
const G4String& currentSceneName = pScene -> GetName ();
|
||||
G4bool successful = pScene -> AddEndOfRunModel(model, warn);
|
||||
if (successful) {
|
||||
if (verbosity >= G4VisManager::confirmations) {
|
||||
G4cout << "EndOfRunMacro has been added to scene \""
|
||||
<< currentSceneName << "\"."
|
||||
<< G4endl;
|
||||
}
|
||||
}
|
||||
else G4VisCommandsSceneAddUnsuccessful(verbosity);
|
||||
|
||||
CheckSceneAndNotifyHandlers (pScene);
|
||||
}
|
||||
|
||||
void G4VisCommandSceneAddEndOfRunMacro::EndOfRunMacro::operator()
|
||||
(G4VGraphicsScene&, const G4ModelingParameters*)
|
||||
{
|
||||
G4UImanager::GetUIpointer()->ApplyCommand("/control/execute " + fMacro);
|
||||
}
|
||||
|
||||
////////////// /vis/scene/add/eventID ///////////////////////////////////////
|
||||
|
||||
G4VisCommandSceneAddEventID::G4VisCommandSceneAddEventID () {
|
||||
@@ -2942,9 +3001,9 @@ void G4VisCommandSceneAddUserAction::SetNewValue
|
||||
|
||||
const std::vector<G4VisManager::UserVisAction>& runDurationUserVisActions =
|
||||
fpVisManager->GetRunDurationUserVisActions();
|
||||
for (size_t i = 0; i < runDurationUserVisActions.size(); i++) {
|
||||
const G4String& name = runDurationUserVisActions[i].fName;
|
||||
G4VUserVisAction* visAction = runDurationUserVisActions[i].fpUserVisAction;
|
||||
for (const auto& runDurationUserVisAction : runDurationUserVisActions) {
|
||||
const G4String& name = runDurationUserVisAction.fName;
|
||||
G4VUserVisAction* visAction = runDurationUserVisAction.fpUserVisAction;
|
||||
if (newValue == "all" || name.find(newValue) != std::string::npos) {
|
||||
any = true;
|
||||
AddVisAction(name,visAction,pScene,runDuration,verbosity);
|
||||
@@ -2953,9 +3012,9 @@ void G4VisCommandSceneAddUserAction::SetNewValue
|
||||
|
||||
const std::vector<G4VisManager::UserVisAction>& endOfEventUserVisActions =
|
||||
fpVisManager->GetEndOfEventUserVisActions();
|
||||
for (size_t i = 0; i < endOfEventUserVisActions.size(); i++) {
|
||||
const G4String& name = endOfEventUserVisActions[i].fName;
|
||||
G4VUserVisAction* visAction = endOfEventUserVisActions[i].fpUserVisAction;
|
||||
for (const auto& endOfEventUserVisAction : endOfEventUserVisActions) {
|
||||
const G4String& name = endOfEventUserVisAction.fName;
|
||||
G4VUserVisAction* visAction = endOfEventUserVisAction.fpUserVisAction;
|
||||
if (newValue == "all" || name.find(newValue) != std::string::npos) {
|
||||
any = true;
|
||||
AddVisAction(name,visAction,pScene,endOfEvent,verbosity);
|
||||
@@ -2964,9 +3023,9 @@ void G4VisCommandSceneAddUserAction::SetNewValue
|
||||
|
||||
const std::vector<G4VisManager::UserVisAction>& endOfRunUserVisActions =
|
||||
fpVisManager->GetEndOfRunUserVisActions();
|
||||
for (size_t i = 0; i < endOfRunUserVisActions.size(); i++) {
|
||||
const G4String& name = endOfRunUserVisActions[i].fName;
|
||||
G4VUserVisAction* visAction = endOfRunUserVisActions[i].fpUserVisAction;
|
||||
for (const auto& endOfRunUserVisAction : endOfRunUserVisActions) {
|
||||
const G4String& name = endOfRunUserVisAction.fName;
|
||||
G4VUserVisAction* visAction = endOfRunUserVisAction.fpUserVisAction;
|
||||
if (newValue == "all" || name.find(newValue) != std::string::npos) {
|
||||
any = true;
|
||||
AddVisAction(name,visAction,pScene,endOfRun,verbosity);
|
||||
|
||||
@@ -224,8 +224,7 @@ void G4VisCommandSceneHandlerCreate::SetNewValue (G4UIcommand* command,
|
||||
break; // Match found
|
||||
} else {
|
||||
const auto& nicknames = gs->GetNicknames();
|
||||
for (std::size_t i = 0; i < nicknames.size(); ++i) {
|
||||
const auto& nickname = nicknames[i];
|
||||
for (const auto& nickname : nicknames) {
|
||||
if (G4StrUtil::icompare(graphicsSystem, nickname) == 0) {
|
||||
found = true;
|
||||
break; // Match found
|
||||
@@ -277,8 +276,7 @@ void G4VisCommandSceneHandlerCreate::SetNewValue (G4UIcommand* command,
|
||||
G4String fallbackNickname = gsl[iGS]->GetNickname() + "_FALLBACK";
|
||||
for (iGS = 0; iGS < nSystems; iGS++) {
|
||||
const auto& nicknames = gsl[iGS]->GetNicknames();
|
||||
for (std::size_t i = 0; i < nicknames.size(); ++i) {
|
||||
const auto& nickname = nicknames[i];
|
||||
for (const auto& nickname : nicknames) {
|
||||
if (G4StrUtil::icompare(fallbackNickname, nickname) == 0) {
|
||||
fallback = true;
|
||||
break; // Match found
|
||||
@@ -425,8 +423,8 @@ void G4VisCommandSceneHandlerList::SetNewValue (G4UIcommand*,
|
||||
|
||||
const G4SceneHandlerList& list = fpVisManager -> GetAvailableSceneHandlers ();
|
||||
G4bool found = false;
|
||||
for (std::size_t iSH = 0; iSH < list.size (); ++iSH) {
|
||||
const G4String& iName = list [iSH] -> GetName ();
|
||||
for (const auto* iSH : list) {
|
||||
const G4String& iName = iSH -> GetName ();
|
||||
if (name != "all") {
|
||||
if (name != iName) continue;
|
||||
}
|
||||
@@ -437,10 +435,10 @@ void G4VisCommandSceneHandlerList::SetNewValue (G4UIcommand*,
|
||||
else {
|
||||
G4cout << " ";
|
||||
}
|
||||
G4cout << " scene handler \"" << list [iSH] -> GetName () << "\""
|
||||
<< " (" << list [iSH] -> GetGraphicsSystem () -> GetName () << ")";
|
||||
G4cout << " scene handler \"" << iSH -> GetName () << "\""
|
||||
<< " (" << iSH -> GetGraphicsSystem () -> GetName () << ")";
|
||||
if (verbosity >= G4VisManager::parameters) {
|
||||
G4cout << "\n " << *(list [iSH]);
|
||||
G4cout << "\n " << *iSH;
|
||||
}
|
||||
G4cout << G4endl;
|
||||
}
|
||||
|
||||
@@ -314,13 +314,15 @@ void G4VisCommandsTouchable::SetNewValue
|
||||
const G4Point3D& standardTargetPoint = currentScene->GetStandardTargetPoint();
|
||||
newVP.SetCurrentTargetPoint(newTargetPoint - standardTargetPoint);
|
||||
|
||||
// Interpolate
|
||||
auto keepVisVerbose = fpVisManager->GetVerbosity();
|
||||
fpVisManager->SetVerboseLevel(G4VisManager::errors);
|
||||
if (newVP != saveVP) InterpolateToNewView(currentViewer, saveVP, newVP);
|
||||
// ...and twinkle
|
||||
Twinkle(currentViewer,newVP,touchables);
|
||||
fpVisManager->SetVerboseLevel(keepVisVerbose);
|
||||
if (currentViewer->GetKernelVisitElapsedTimeSeconds() < 0.1) {
|
||||
// Interpolate
|
||||
auto keepVisVerbose = fpVisManager->GetVerbosity();
|
||||
fpVisManager->SetVerboseLevel(G4VisManager::errors);
|
||||
if (newVP != saveVP) InterpolateToNewView(currentViewer, saveVP, newVP);
|
||||
// ...and twinkle
|
||||
Twinkle(currentViewer,newVP,touchables);
|
||||
fpVisManager->SetVerboseLevel(keepVisVerbose);
|
||||
}
|
||||
|
||||
if (verbosity >= G4VisManager::confirmations) {
|
||||
G4cout
|
||||
@@ -446,19 +448,23 @@ void G4VisCommandsTouchable::SetNewValue
|
||||
|
||||
} else if (command == fpCommandTwinkle) {
|
||||
|
||||
G4PhysicalVolumeModel::TouchableProperties properties =
|
||||
G4TouchableUtils::FindTouchableProperties(fCurrentTouchableProperties.fTouchablePath);
|
||||
if (properties.fpTouchablePV) {
|
||||
std::vector<std::vector<G4PhysicalVolumeModel::G4PhysicalVolumeNodeID>> touchables;
|
||||
touchables.push_back(properties.fTouchableFullPVPath);
|
||||
auto keepVisVerbose = fpVisManager->GetVerbosity();
|
||||
fpVisManager->SetVerboseLevel(G4VisManager::errors);
|
||||
auto keepVP = currentViewer->GetViewParameters();
|
||||
Twinkle(currentViewer,currentViewer->GetViewParameters(),touchables);
|
||||
SetViewParameters(currentViewer, keepVP);
|
||||
fpVisManager->SetVerboseLevel(keepVisVerbose);
|
||||
if (currentViewer->GetKernelVisitElapsedTimeSeconds() < 0.1) {
|
||||
G4PhysicalVolumeModel::TouchableProperties properties =
|
||||
G4TouchableUtils::FindTouchableProperties(fCurrentTouchableProperties.fTouchablePath);
|
||||
if (properties.fpTouchablePV) {
|
||||
std::vector<std::vector<G4PhysicalVolumeModel::G4PhysicalVolumeNodeID>> touchables;
|
||||
touchables.push_back(properties.fTouchableFullPVPath);
|
||||
auto keepVisVerbose = fpVisManager->GetVerbosity();
|
||||
fpVisManager->SetVerboseLevel(G4VisManager::errors);
|
||||
auto keepVP = currentViewer->GetViewParameters();
|
||||
Twinkle(currentViewer,currentViewer->GetViewParameters(),touchables);
|
||||
SetViewParameters(currentViewer, keepVP);
|
||||
fpVisManager->SetVerboseLevel(keepVisVerbose);
|
||||
} else {
|
||||
G4warn << "Touchable not found." << G4endl;
|
||||
}
|
||||
} else {
|
||||
G4warn << "Touchable not found." << G4endl;
|
||||
G4warn << "Twinkling not available - image construction time too long." << G4endl;
|
||||
}
|
||||
return;
|
||||
|
||||
|
||||
@@ -1062,8 +1062,8 @@ void G4VisCommandViewerCreate::SetNewValue (G4UIcommand* command, G4String newVa
|
||||
for (std::size_t ih = 0; ih < nHandlers; ++ih) {
|
||||
G4VSceneHandler* sh = sceneHandlerList [ih];
|
||||
const G4ViewerList& viewerList = sh -> GetViewerList ();
|
||||
for (std::size_t iViewer = 0; iViewer < viewerList.size (); iViewer++) {
|
||||
if (viewerList [iViewer] -> GetShortName () == newShortName ) {
|
||||
for (const auto* iViewer : viewerList) {
|
||||
if (iViewer -> GetShortName () == newShortName ) {
|
||||
G4ExceptionDescription ed;
|
||||
ed <<
|
||||
"ERROR: Viewer \"" << newShortName << "\" already exists.";
|
||||
@@ -1291,7 +1291,7 @@ G4VisCommandViewerInterpolate::G4VisCommandViewerInterpolate () {
|
||||
parameter -> SetDefaultValue(50);
|
||||
fpCommand -> SetParameter(parameter);
|
||||
parameter = new G4UIparameter("wait-time", 's', omitable = true);
|
||||
parameter -> SetGuidance("Wait time per interpolated point");
|
||||
parameter -> SetGuidance("Minimum time per interpolated point (steady frame rate)");
|
||||
parameter -> SetDefaultValue("20.");
|
||||
fpCommand -> SetParameter(parameter);
|
||||
parameter = new G4UIparameter("time-unit", 's', omitable = true);
|
||||
@@ -2174,7 +2174,7 @@ void G4VisCommandViewerSelect::SetNewValue (G4UIcommand*, G4String newValue) {
|
||||
// Set pointers, call SetView and print confirmation.
|
||||
fpVisManager -> SetCurrentViewer (viewer);
|
||||
|
||||
RefreshIfRequired(viewer);
|
||||
// Refresh not required after a select - window systems keep the image
|
||||
|
||||
// Update GUI scene tree (make sure it's in sync)
|
||||
viewer->UpdateGUISceneTree();
|
||||
|
||||
@@ -428,6 +428,25 @@ fViewpointVector (G4ThreeVector(0.,0.,1.))
|
||||
fpCommandTargetPoint->SetParameterName("x", "y", "z", omitable = false);
|
||||
fpCommandTargetPoint->SetUnitCategory("Length");
|
||||
|
||||
fpCommandTransparencyByDepth = new G4UIcommand
|
||||
("/vis/viewer/set/transparencyByDepth", this);
|
||||
fpCommandTransparencyByDepth -> SetGuidance
|
||||
("Set overall transparency by depth in geometry tree.");
|
||||
fpCommandTransparencyByDepth -> SetGuidance
|
||||
("For a volume at depth D, the opacity (alpha) is:"
|
||||
"\nOption 1: Unwrap: 0 if D <= d (sudden invisibility);"
|
||||
"\nOption 2: Fade: D - d (fade progresssively layer by layer);"
|
||||
"\nOption 3: X-ray: as (2), but fade over whole range of depth."
|
||||
"\nThe opacity calculated here is truncated [0,1] and then"
|
||||
" multiplies any existing opacity."
|
||||
"\nSee G4PhysicalVolumeModel.cc:644(approx) for details.");
|
||||
parameter = new G4UIparameter("d", 'd', omitable = false);
|
||||
fpCommandTransparencyByDepth -> SetParameter (parameter);
|
||||
parameter = new G4UIparameter("option", 'i', omitable = true);
|
||||
parameter -> SetGuidance("1: Unwrap; 2: Fade; 3: X-ray");
|
||||
parameter -> SetDefaultValue (1);
|
||||
fpCommandTransparencyByDepth -> SetParameter (parameter);
|
||||
|
||||
fpCommandUpThetaPhi = new G4UIcommand
|
||||
("/vis/viewer/set/upThetaPhi", this);
|
||||
fpCommandUpThetaPhi -> SetGuidance ("Set up vector.");
|
||||
@@ -520,27 +539,27 @@ fViewpointVector (G4ThreeVector(0.,0.,1.))
|
||||
parameter = new G4UIparameter ("screenX", 'd', omitable = true);
|
||||
parameter->SetGuidance("-1 < screenX < 1");
|
||||
parameter->SetParameterRange("screenX >= -1. && screenX <= 1.");
|
||||
parameter->SetDefaultValue(-0.9);
|
||||
parameter->SetCurrentAsDefault(true);
|
||||
fpCommandTimeWindowDisplayHeadTime->SetParameter(parameter);
|
||||
parameter = new G4UIparameter ("screenY", 'd', omitable = true);
|
||||
parameter->SetGuidance("-1 < screenY < 1");
|
||||
parameter->SetParameterRange("screenY >= -1. && screenY <= 1.");
|
||||
parameter->SetDefaultValue(-0.9);
|
||||
parameter->SetCurrentAsDefault(true);
|
||||
fpCommandTimeWindowDisplayHeadTime->SetParameter(parameter);
|
||||
parameter = new G4UIparameter ("screenSize", 'd', omitable = true);
|
||||
parameter->SetDefaultValue(24.);
|
||||
parameter->SetCurrentAsDefault(true);
|
||||
fpCommandTimeWindowDisplayHeadTime->SetParameter(parameter);
|
||||
parameter = new G4UIparameter ("red", 'd', omitable = true);
|
||||
parameter->SetParameterRange("red >= 0. && red <= 1.");
|
||||
parameter->SetDefaultValue(0.);
|
||||
parameter->SetCurrentAsDefault(true);
|
||||
fpCommandTimeWindowDisplayHeadTime->SetParameter(parameter);
|
||||
parameter = new G4UIparameter ("green", 'd', omitable = true);
|
||||
parameter->SetParameterRange("green >= 0. && green <= 1.");
|
||||
parameter->SetDefaultValue(1.);
|
||||
parameter->SetCurrentAsDefault(true);
|
||||
fpCommandTimeWindowDisplayHeadTime->SetParameter(parameter);
|
||||
parameter = new G4UIparameter ("blue", 'd', omitable = true);
|
||||
parameter->SetParameterRange("blue >= 0. && blue <= 1.");
|
||||
parameter->SetDefaultValue(1.);
|
||||
parameter->SetCurrentAsDefault(true);
|
||||
fpCommandTimeWindowDisplayHeadTime->SetParameter(parameter);
|
||||
|
||||
fpCommandTimeWindowDisplayLightFront =
|
||||
@@ -646,6 +665,7 @@ G4VisCommandsViewerSet::~G4VisCommandsViewerSet() {
|
||||
delete fpCommandViewpointThetaPhi;
|
||||
delete fpCommandUpVector;
|
||||
delete fpCommandUpThetaPhi;
|
||||
delete fpCommandTransparencyByDepth;
|
||||
delete fpCommandTargetPoint;
|
||||
delete fpCommandStyle;
|
||||
delete fpCommandSpecialMeshVolumes;
|
||||
@@ -677,8 +697,25 @@ G4VisCommandsViewerSet::~G4VisCommandsViewerSet() {
|
||||
delete fpCommandAll;
|
||||
}
|
||||
|
||||
G4String G4VisCommandsViewerSet::GetCurrentValue(G4UIcommand*) {
|
||||
return "";
|
||||
G4String G4VisCommandsViewerSet::GetCurrentValue(G4UIcommand* command) {
|
||||
|
||||
G4VViewer* currentViewer = fpVisManager->GetCurrentViewer();
|
||||
const auto& vp = currentViewer->GetViewParameters();
|
||||
|
||||
if (command == fpCommandTimeWindowDisplayHeadTime) {
|
||||
const auto& tp = vp.GetTimeParameters();
|
||||
return command->ConvertToString(tp.fDisplayHeadTime)
|
||||
+ ' ' + command->ConvertToString(tp.fDisplayHeadTimeX)
|
||||
+ ' ' + command->ConvertToString(tp.fDisplayHeadTimeY)
|
||||
+ ' ' + command->ConvertToString(tp.fDisplayHeadTimeSize)
|
||||
+ ' ' + command->ConvertToString(tp.fDisplayHeadTimeRed)
|
||||
+ ' ' + command->ConvertToString(tp.fDisplayHeadTimeGreen)
|
||||
+ ' ' + command->ConvertToString(tp.fDisplayHeadTimeBlue);
|
||||
}
|
||||
|
||||
else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
void G4VisCommandsViewerSet::SetNewValue
|
||||
@@ -1110,7 +1147,7 @@ void G4VisCommandsViewerSet::SetNewValue
|
||||
|
||||
else if (command == fpCommandLineSegments) {
|
||||
G4int nSides = G4UIcommand::ConvertToInt(newValue);
|
||||
nSides = vp.SetNoOfSides(nSides);
|
||||
vp.SetNoOfSides(nSides);
|
||||
if (verbosity >= G4VisManager::confirmations) {
|
||||
G4cout <<
|
||||
"Number of line segments per circle in polygon approximation is "
|
||||
@@ -1120,7 +1157,7 @@ void G4VisCommandsViewerSet::SetNewValue
|
||||
|
||||
else if (command == fpCommandNumberOfCloudPoints) {
|
||||
G4int nPoints = G4UIcommand::ConvertToInt(newValue);
|
||||
nPoints = vp.SetNumberOfCloudPoints(nPoints);
|
||||
vp.SetNumberOfCloudPoints(nPoints);
|
||||
if (verbosity >= G4VisManager::confirmations) {
|
||||
G4cout <<
|
||||
"Number of points to be used in cloud representation of volumes is "
|
||||
@@ -1441,6 +1478,19 @@ void G4VisCommandsViewerSet::SetNewValue
|
||||
}
|
||||
}
|
||||
|
||||
else if (command == fpCommandTransparencyByDepth) {
|
||||
G4double transparencyByDepth;
|
||||
G4int option;
|
||||
std::istringstream is (newValue);
|
||||
is >> transparencyByDepth >> option;
|
||||
vp.SetTransparencyByDepth(transparencyByDepth);
|
||||
vp.SetTransparencyByDepthOption(option);
|
||||
if (verbosity >= G4VisManager::confirmations) {
|
||||
G4cout << "Transparency by depth set to " << transparencyByDepth
|
||||
<< " with option " << option << G4endl;
|
||||
}
|
||||
}
|
||||
|
||||
else if (command == fpCommandUpThetaPhi) {
|
||||
G4double theta, phi;
|
||||
if (ConvertToDoublePair(newValue, theta, phi)) {
|
||||
@@ -1509,13 +1559,15 @@ void G4VisCommandsViewerSet::SetNewValue
|
||||
std::istringstream iss(newValue);
|
||||
iss >> display >> screenX >> screenY
|
||||
>> screenSize >> red >> green >> blue;
|
||||
vp.SetDisplayHeadTime(command->ConvertToBool(display));
|
||||
vp.SetDisplayHeadTimeX(screenX);
|
||||
vp.SetDisplayHeadTimeY(screenY);
|
||||
vp.SetDisplayHeadTimeSize(screenSize);
|
||||
vp.SetDisplayHeadTimeRed(red);
|
||||
vp.SetDisplayHeadTimeGreen(green);
|
||||
vp.SetDisplayHeadTimeBlue(blue);
|
||||
auto timeParameters = vp.GetTimeParameters();
|
||||
timeParameters.fDisplayHeadTime = command->ConvertToBool(display);
|
||||
timeParameters.fDisplayHeadTimeX = screenX;
|
||||
timeParameters.fDisplayHeadTimeY = screenY;
|
||||
timeParameters.fDisplayHeadTimeSize = screenSize;
|
||||
timeParameters.fDisplayHeadTimeRed = red;
|
||||
timeParameters.fDisplayHeadTimeGreen = green;
|
||||
timeParameters.fDisplayHeadTimeBlue = blue;
|
||||
vp.SetTimeParameters(timeParameters);
|
||||
if (verbosity >= G4VisManager::confirmations) {
|
||||
G4cout << "Display head time flag set: "
|
||||
<< vp
|
||||
@@ -1532,18 +1584,20 @@ void G4VisCommandsViewerSet::SetNewValue
|
||||
>> originX >> originY >> originZ >> unitS
|
||||
>> originT >> unitT
|
||||
>> red >> green >> blue;
|
||||
vp.SetDisplayLightFront(command->ConvertToBool(display));
|
||||
vp.SetDisplayLightFrontX
|
||||
(command->ConvertToDimensionedDouble(G4String(originX + ' ' + unitS)));
|
||||
vp.SetDisplayLightFrontY
|
||||
(command->ConvertToDimensionedDouble(G4String(originY + ' ' + unitS)));
|
||||
vp.SetDisplayLightFrontZ
|
||||
(command->ConvertToDimensionedDouble(G4String(originZ + ' ' + unitS)));
|
||||
vp.SetDisplayLightFrontT
|
||||
(command->ConvertToDimensionedDouble(G4String(originT + ' ' + unitT)));
|
||||
vp.SetDisplayLightFrontRed(red);
|
||||
vp.SetDisplayLightFrontGreen(green);
|
||||
vp.SetDisplayLightFrontBlue(blue);
|
||||
auto timeParameters = vp.GetTimeParameters();
|
||||
timeParameters.fDisplayLightFront = command->ConvertToBool(display);
|
||||
timeParameters.fDisplayLightFrontX
|
||||
= command->ConvertToDimensionedDouble(G4String(originX + ' ' + unitS));
|
||||
timeParameters.fDisplayLightFrontY
|
||||
= command->ConvertToDimensionedDouble(G4String(originY + ' ' + unitS));
|
||||
timeParameters.fDisplayLightFrontZ
|
||||
= command->ConvertToDimensionedDouble(G4String(originZ + ' ' + unitS));
|
||||
timeParameters.fDisplayLightFrontT
|
||||
= command->ConvertToDimensionedDouble(G4String(originT + ' ' + unitT));
|
||||
timeParameters.fDisplayLightFrontRed = red;
|
||||
timeParameters.fDisplayLightFrontGreen = green;
|
||||
timeParameters.fDisplayLightFrontBlue = blue;
|
||||
vp.SetTimeParameters(timeParameters);
|
||||
if (verbosity >= G4VisManager::confirmations) {
|
||||
G4cout << "Display light front flag set: "
|
||||
<< vp
|
||||
@@ -1553,24 +1607,23 @@ void G4VisCommandsViewerSet::SetNewValue
|
||||
|
||||
else if (command == fpCommandTimeWindowEndTime)
|
||||
{
|
||||
G4String end_time_string, end_time_unit,
|
||||
time_range_string, time_range_unit;
|
||||
std::istringstream iss(newValue);
|
||||
iss >> end_time_string >> end_time_unit
|
||||
>> time_range_string >> time_range_unit;
|
||||
vp.SetEndTime
|
||||
(command->ConvertToDimensionedDouble
|
||||
(G4String(end_time_string + ' ' + end_time_unit)));
|
||||
G4double timeRange = command->ConvertToDimensionedDouble
|
||||
(G4String(time_range_string + ' ' + time_range_unit));
|
||||
if (timeRange > 0.) {
|
||||
vp.SetStartTime
|
||||
(vp.GetEndTime() - timeRange);
|
||||
}
|
||||
G4String end_time_string, end_time_unit, time_range_string, time_range_unit;
|
||||
std::istringstream iss(newValue);
|
||||
iss >> end_time_string >> end_time_unit >> time_range_string >> time_range_unit;
|
||||
auto endTime = command->ConvertToDimensionedDouble
|
||||
(G4String(end_time_string + ' ' + end_time_unit));
|
||||
auto timeRange = command->ConvertToDimensionedDouble
|
||||
(G4String(time_range_string + ' ' + time_range_unit));
|
||||
auto timeParameters = vp.GetTimeParameters();
|
||||
timeParameters.fEndTime = endTime;
|
||||
if (timeRange > 0.) {
|
||||
timeParameters.fStartTime = endTime - timeRange;
|
||||
}
|
||||
vp.SetTimeParameters(timeParameters);
|
||||
if (verbosity >= G4VisManager::confirmations) {
|
||||
G4cout
|
||||
<< "Time window start time: " << vp.GetStartTime()/ns << " ns"
|
||||
<< ", time window end time: " << vp.GetEndTime()/ns << " ns";
|
||||
<< "Time window start time: " << vp.GetTimeParameters().fStartTime/ns << " ns"
|
||||
<< ", time window end time: " << vp.GetTimeParameters().fEndTime/ns << " ns";
|
||||
if (timeRange > 0.) {
|
||||
G4cout << "\n (time range: " << timeRange/ns << " ns)";
|
||||
}
|
||||
@@ -1579,33 +1632,34 @@ void G4VisCommandsViewerSet::SetNewValue
|
||||
}
|
||||
|
||||
else if (command == fpCommandTimeWindowFadeFactor) {
|
||||
vp.SetFadeFactor(command->ConvertToDouble(newValue));
|
||||
auto timeParameters = vp.GetTimeParameters();
|
||||
timeParameters.fFadeFactor = command->ConvertToDouble(newValue);
|
||||
vp.SetTimeParameters(timeParameters);
|
||||
if (verbosity >= G4VisManager::confirmations) {
|
||||
G4cout << "Time window fade factor changed to " << vp.GetFadeFactor()
|
||||
G4cout << "Time window fade factor changed to " << vp.GetTimeParameters().fFadeFactor
|
||||
<< G4endl;
|
||||
}
|
||||
}
|
||||
|
||||
else if (command == fpCommandTimeWindowStartTime)
|
||||
{
|
||||
G4String start_time_string, start_time_unit,
|
||||
time_range_string, time_range_unit;
|
||||
G4String start_time_string, start_time_unit, time_range_string, time_range_unit;
|
||||
std::istringstream iss(newValue);
|
||||
iss >> start_time_string >> start_time_unit
|
||||
>> time_range_string >> time_range_unit;
|
||||
vp.SetStartTime
|
||||
(command->ConvertToDimensionedDouble
|
||||
(G4String(start_time_string + ' ' + start_time_unit)));
|
||||
G4double timeRange = command->ConvertToDimensionedDouble
|
||||
iss >> start_time_string >> start_time_unit >> time_range_string >> time_range_unit;
|
||||
auto startTime = command->ConvertToDimensionedDouble
|
||||
(G4String(start_time_string + ' ' + start_time_unit));
|
||||
auto timeRange = command->ConvertToDimensionedDouble
|
||||
(G4String(time_range_string + ' ' + time_range_unit));
|
||||
auto timeParameters = vp.GetTimeParameters();
|
||||
timeParameters.fStartTime = startTime;
|
||||
if (timeRange > 0.) {
|
||||
vp.SetEndTime
|
||||
(vp.GetStartTime() + timeRange);
|
||||
timeParameters.fEndTime = startTime + timeRange;
|
||||
}
|
||||
vp.SetTimeParameters(timeParameters);
|
||||
if (verbosity >= G4VisManager::confirmations) {
|
||||
G4cout
|
||||
<< "Time window start time: " << vp.GetStartTime()/ns << " ns"
|
||||
<< ", time window end time: " << vp.GetEndTime()/ns << " ns";
|
||||
<< "Time window start time: " << vp.GetTimeParameters().fStartTime/ns << " ns"
|
||||
<< ", time window end time: " << vp.GetTimeParameters().fEndTime/ns << " ns";
|
||||
if (timeRange > 0.) {
|
||||
G4cout << "\n (time range: " << timeRange/ns << " ns)";
|
||||
}
|
||||
|
||||
@@ -114,7 +114,7 @@ G4VisManager::Verbosity G4VisManager::fVerbosity = G4VisManager::warnings;
|
||||
|
||||
G4VisManager::G4VisManager (const G4String& verbosityString)
|
||||
: fVerbose (1)
|
||||
, fDefaultGraphicsSystemName("OGL") // Override in G4VisExecutive
|
||||
, fDefaultGraphicsSystemName("TSG") // Override in G4VisExecutive
|
||||
, fDefaultXGeometryString ("600x600-0+0") // Override in G4VisExecutive
|
||||
, fDefaultGraphicsSystemBasis ("G4VisManager initialisation")
|
||||
, fDefaultXGeometryStringBasis("G4VisManager initialisation")
|
||||
@@ -548,6 +548,7 @@ void G4VisManager::RegisterMessengers () {
|
||||
RegisterMessenger(new G4VisCommandSceneAddAxes);
|
||||
RegisterMessenger(new G4VisCommandSceneAddDate);
|
||||
RegisterMessenger(new G4VisCommandSceneAddDigis);
|
||||
RegisterMessenger(new G4VisCommandSceneAddEndOfRunMacro);
|
||||
RegisterMessenger(new G4VisCommandSceneAddEventID);
|
||||
RegisterMessenger(new G4VisCommandSceneAddExtent);
|
||||
RegisterMessenger(new G4VisCommandSceneAddElectricField);
|
||||
@@ -1347,8 +1348,8 @@ void G4VisManager::GeometryHasChanged () {
|
||||
|
||||
// Change the world...
|
||||
G4VPhysicalVolume* pWorld =
|
||||
G4TransportationManager::GetTransportationManager ()
|
||||
-> GetNavigatorForTracking () -> GetWorldVolume ();
|
||||
G4TransportationManager::GetTransportationManager ()
|
||||
-> GetNavigatorForTracking () -> GetWorldVolume ();
|
||||
if (!pWorld) {
|
||||
if (fVerbosity >= warnings) {
|
||||
G4warn << "WARNING: There is no world volume!" << G4endl;
|
||||
@@ -1364,35 +1365,35 @@ void G4VisManager::GeometryHasChanged () {
|
||||
if (modelList.size ()) {
|
||||
G4bool modelInvalid;
|
||||
do { // Remove, if required, one at a time.
|
||||
modelInvalid = false;
|
||||
std::vector<G4Scene::Model>::iterator iterModel;
|
||||
for (iterModel = modelList.begin();
|
||||
iterModel != modelList.end();
|
||||
++iterModel) {
|
||||
modelInvalid = !(iterModel->fpModel->Validate(fVerbosity>=warnings));
|
||||
if (modelInvalid) {
|
||||
// Model invalid - remove and break.
|
||||
if (fVerbosity >= warnings) {
|
||||
G4warn << "WARNING: Model \""
|
||||
<< iterModel->fpModel->GetGlobalDescription ()
|
||||
<<
|
||||
"\" is no longer valid - being removed\n from scene \""
|
||||
<< pScene -> GetName () << "\""
|
||||
<< G4endl;
|
||||
}
|
||||
modelList.erase (iterModel);
|
||||
break;
|
||||
}
|
||||
}
|
||||
modelInvalid = false;
|
||||
std::vector<G4Scene::Model>::iterator iterModel;
|
||||
for (iterModel = modelList.begin();
|
||||
iterModel != modelList.end();
|
||||
++iterModel) {
|
||||
modelInvalid = !(iterModel->fpModel->Validate(fVerbosity>=warnings));
|
||||
if (modelInvalid) {
|
||||
// Model invalid - remove and break.
|
||||
if (fVerbosity >= warnings) {
|
||||
G4warn << "WARNING: Model \""
|
||||
<< iterModel->fpModel->GetGlobalDescription ()
|
||||
<< "\" is no longer valid - being removed\n from scene \""
|
||||
<< pScene -> GetName ()
|
||||
<< "\". You may have to re-establish the scene."
|
||||
<< G4endl;
|
||||
}
|
||||
modelList.erase (iterModel);
|
||||
break;
|
||||
}
|
||||
}
|
||||
} while (modelInvalid);
|
||||
|
||||
if (modelList.size () == 0) {
|
||||
if (fVerbosity >= warnings) {
|
||||
G4warn << "WARNING: No run-duration models left in this scene \""
|
||||
<< pScene -> GetName ()
|
||||
<< "\"."
|
||||
<< G4endl;
|
||||
}
|
||||
if (fVerbosity >= warnings) {
|
||||
G4warn << "WARNING: No run-duration models left in this scene \""
|
||||
<< pScene -> GetName ()
|
||||
<< "\"."
|
||||
<< G4endl;
|
||||
}
|
||||
if (pWorld) {
|
||||
if (fVerbosity >= warnings) {
|
||||
G4warn << " Adding current world to \""
|
||||
@@ -1407,9 +1408,9 @@ void G4VisManager::GeometryHasChanged () {
|
||||
}
|
||||
}
|
||||
else {
|
||||
pScene->CalculateExtent(); // Recalculate extent
|
||||
G4UImanager::GetUIpointer () ->
|
||||
ApplyCommand (G4String("/vis/scene/notifyHandlers " + pScene->GetName()));
|
||||
pScene->CalculateExtent(); // Recalculate extent
|
||||
G4UImanager::GetUIpointer () ->
|
||||
ApplyCommand (G4String("/vis/scene/notifyHandlers " + pScene->GetName()));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1418,10 +1419,10 @@ void G4VisManager::GeometryHasChanged () {
|
||||
if (fpScene && fpScene -> GetRunDurationModelList ().size () == 0) {
|
||||
if (fVerbosity >= warnings) {
|
||||
G4warn << "WARNING: The current scene \""
|
||||
<< fpScene -> GetName ()
|
||||
<< "\" has no run duration models."
|
||||
<< "\n Use \"/vis/scene/add/volume\" or create a new scene."
|
||||
<< G4endl;
|
||||
<< fpScene -> GetName ()
|
||||
<< "\" has no run duration models."
|
||||
<< "\n Use \"/vis/scene/add/volume\" or create a new scene."
|
||||
<< G4endl;
|
||||
}
|
||||
// Clean up
|
||||
if (fpSceneHandler) {
|
||||
@@ -1837,8 +1838,8 @@ void G4VisManager::PrintAvailableUserVisActions (Verbosity) const
|
||||
if (fRunDurationUserVisActions.empty()) G4cout << " none" << G4endl;
|
||||
else {
|
||||
G4cout << G4endl;
|
||||
for (std::size_t i = 0; i < fRunDurationUserVisActions.size(); ++i) {
|
||||
const G4String& name = fRunDurationUserVisActions[i].fName;
|
||||
for (const auto& fRunDurationUserVisAction : fRunDurationUserVisActions) {
|
||||
const G4String& name = fRunDurationUserVisAction.fName;
|
||||
G4cout << " " << name << G4endl;
|
||||
}
|
||||
}
|
||||
@@ -1847,8 +1848,8 @@ void G4VisManager::PrintAvailableUserVisActions (Verbosity) const
|
||||
if (fEndOfEventUserVisActions.empty()) G4cout << " none" << G4endl;
|
||||
else {
|
||||
G4cout << G4endl;
|
||||
for (std::size_t i = 0; i < fEndOfEventUserVisActions.size(); ++i) {
|
||||
const G4String& name = fEndOfEventUserVisActions[i].fName;
|
||||
for (const auto& fEndOfEventUserVisAction : fEndOfEventUserVisActions) {
|
||||
const G4String& name = fEndOfEventUserVisAction.fName;
|
||||
G4cout << " " << name << G4endl;
|
||||
}
|
||||
}
|
||||
@@ -1857,8 +1858,8 @@ void G4VisManager::PrintAvailableUserVisActions (Verbosity) const
|
||||
if (fEndOfRunUserVisActions.empty()) G4cout << " none" << G4endl;
|
||||
else {
|
||||
G4cout << G4endl;
|
||||
for (std::size_t i = 0; i < fEndOfRunUserVisActions.size(); ++i) {
|
||||
const G4String& name = fEndOfRunUserVisActions[i].fName;
|
||||
for (const auto& fEndOfRunUserVisAction : fEndOfRunUserVisActions) {
|
||||
const G4String& name = fEndOfRunUserVisAction.fName;
|
||||
G4cout << " " << name << G4endl;
|
||||
}
|
||||
}
|
||||
@@ -2328,16 +2329,12 @@ void G4VisManager::EndOfRun ()
|
||||
{
|
||||
if (fIgnoreStateChanges) return;
|
||||
if (G4Threading::IsWorkerThread()) return;
|
||||
if (!GetConcreteInstance()) return;
|
||||
if (!isValidViewForRun) return;
|
||||
if (isFakeRun) return;
|
||||
if (fVerbosity >= warnings) PrintListOfPlots(); // Print even if disabled
|
||||
if (!GetConcreteInstance()) return;
|
||||
|
||||
G4RunManager* runManager = G4RunManagerFactory::GetMasterRunManager();
|
||||
|
||||
// For a fake run...
|
||||
G4int nEventsToBeProcessed = runManager->GetNumberOfEventsToBeProcessed();
|
||||
if (nEventsToBeProcessed == 0) return;
|
||||
|
||||
const G4Run* currentRun = runManager->GetCurrentRun();
|
||||
if (!currentRun) return;
|
||||
|
||||
@@ -2399,8 +2396,6 @@ void G4VisManager::EndOfRun ()
|
||||
<< G4endl;
|
||||
}
|
||||
|
||||
if (fVerbosity >= warnings) PrintListOfPlots();
|
||||
|
||||
if (fEventKeepingSuspended && fVerbosity >= warnings) {
|
||||
G4warn <<
|
||||
"WARNING: G4VisManager::EndOfRun: Automatic event keeping was suspended."
|
||||
@@ -2518,8 +2513,8 @@ G4String G4VisManager::VerbosityString(Verbosity verbosity) {
|
||||
void G4VisManager::PrintAvailableVerbosity(std::ostream& os)
|
||||
{
|
||||
os << "Available verbosity options:";
|
||||
for (std::size_t i = 0; i < VerbosityGuidanceStrings.size(); ++i) {
|
||||
os << '\n' << VerbosityGuidanceStrings[i];
|
||||
for (const auto& VerbosityGuidanceString : VerbosityGuidanceStrings) {
|
||||
os << '\n' << VerbosityGuidanceString;
|
||||
}
|
||||
os << "\nCurrent verbosity: " << G4VisManager::VerbosityString(fVerbosity);
|
||||
os << std::endl;
|
||||
|
||||
Reference in New Issue
Block a user