Import Geant4 11.1.0.beta source tree

This commit is contained in:
Gabriele Cosmo
2022-07-01 10:44:02 +02:00
parent b3bf75a2a1
commit c07cea1fe0
2172 changed files with 183300 additions and 123938 deletions
@@ -37,7 +37,7 @@ inline const G4String& G4Scene::GetName () const {
}
inline G4bool G4Scene::IsEmpty () const {
return fRunDurationModelList.size () == 0;
return fExtent == G4VisExtent::GetNullExtent();
}
inline const std::vector<G4Scene::Model>&
@@ -43,6 +43,7 @@
#include "G4ViewerList.hh"
#include "G4ViewParameters.hh"
#include "G4THitsMap.hh"
#include "G4PseudoScene.hh"
class G4Scene;
class G4VGraphicsSystem;
@@ -339,6 +340,85 @@ protected:
// Open Inventor driver. G4AttHolder deletes G4AttValues in its
// destructor to ensure proper clean-up of G4AttValues.
//////////////////////////////////////////////////////////////
// Special mesh rendering utilities...
struct NameAndVisAtts {
NameAndVisAtts(const G4String& name = "",const G4VisAttributes& visAtts = G4VisAttributes())
: fName(name),fVisAtts(visAtts) {}
G4String fName;
G4VisAttributes fVisAtts;
};
class PseudoSceneFor3DRectMeshPositions: public G4PseudoScene {
public:
PseudoSceneFor3DRectMeshPositions
(G4PhysicalVolumeModel* pvModel // input
, G4int depth // input...the following are outputs by reference
, std::multimap<const G4Material*,const G4ThreeVector>& positionByMaterial
, std::map<const G4Material*,NameAndVisAtts>& nameAndVisAttsByMaterial)
: fpPVModel(pvModel)
, fDepth(depth)
, fPositionByMaterial(positionByMaterial)
, fNameAndVisAttsByMaterial(nameAndVisAttsByMaterial)
{}
private:
using G4PseudoScene::AddSolid; // except for...
void AddSolid(const G4Box&) override;
void ProcessVolume(const G4VSolid&) override {
// Do nothing if uninteresting solids found, e.g., the container if not marked invisible.
}
G4PhysicalVolumeModel* fpPVModel;
G4int fDepth;
std::multimap<const G4Material*,const G4ThreeVector>& fPositionByMaterial;
std::map<const G4Material*,NameAndVisAtts>& fNameAndVisAttsByMaterial;
};
class PseudoSceneForTetVertices: public G4PseudoScene {
public:
PseudoSceneForTetVertices
(G4PhysicalVolumeModel* pvModel // input
, G4int depth // input...the following are outputs by reference
, std::multimap<const G4Material*,std::vector<G4ThreeVector>>& verticesByMaterial
, std::map<const G4Material*,NameAndVisAtts>& nameAndVisAttsByMaterial)
: fpPVModel(pvModel)
, fDepth(depth)
, fVerticesByMaterial(verticesByMaterial)
, fNameAndVisAttsByMaterial(nameAndVisAttsByMaterial)
{}
private:
using G4PseudoScene::AddSolid; // except for...
void AddSolid(const G4VSolid& solid) override;
void ProcessVolume(const G4VSolid&) override {
// Do nothing if uninteresting solids found, e.g., the container if not marked invisible.
}
G4PhysicalVolumeModel* fpPVModel;
G4int fDepth;
std::multimap<const G4Material*,std::vector<G4ThreeVector>>& fVerticesByMaterial;
std::map<const G4Material*,NameAndVisAtts>& fNameAndVisAttsByMaterial;
};
void StandardSpecialMeshRendering(const G4Mesh&);
// Standard way of special mesh rendering.
// MySceneHandler::AddCompound(const G4Mesh& mesh) may use this if
// appropriate or implement its own special mesh rendereing.
void Draw3DRectMeshAsDots(const G4Mesh&);
// For a rectangular 3-D mesh, draw as coloured dots by colour and material,
// one dot randomly placed in each visible mesh cell.
void Draw3DRectMeshAsSurfaces(const G4Mesh&);
// For a rectangular 3-D mesh, draw as surfaces by colour and material
// with inner shared faces removed.
void DrawTetMeshAsDots(const G4Mesh&);
// For a tetrahedron mesh, draw as coloured dots by colour and material,
// one dot randomly placed in each visible mesh cell.
void DrawTetMeshAsSurfaces(const G4Mesh&);
// For a tetrahedron mesh, draw as surfaces by colour and material
// with inner shared faces removed.
//////////////////////////////////////////////////////////////
// Data members
@@ -140,6 +140,7 @@ public: // With description
G4VSceneHandler* GetSceneHandler () const;
const G4ViewParameters& GetViewParameters () const;
const G4ViewParameters& GetDefaultViewParameters () const;
G4double GetKernelVisitElapsedTimeSeconds () const;
virtual const std::vector<G4ModelingParameters::VisAttributesModifier>*
GetPrivateVisAttributesModifiers() const;
@@ -218,6 +219,8 @@ protected:
G4String fShortName; // Up to first ' ' character, if any.
G4ViewParameters fVP; // View parameters.
G4ViewParameters fDefaultVP; // Default view parameters.
G4double fKernelVisitElapsedTimeSeconds = 999.; // Default to a large number
// Note: fKernelVisitElapsedTimeSeconds is measured in ProcessView().
//////////////////////////////////////////////////////////////
// Other parameters.
@@ -84,3 +84,7 @@ inline const G4VisAttributes* G4VViewer::GetApplicableVisAttributes
inline void G4VViewer::SetNeedKernelVisit (G4bool need) {
fNeedKernelVisit = need;
}
inline G4double G4VViewer::GetKernelVisitElapsedTimeSeconds () const {
return fKernelVisitElapsedTimeSeconds;
}
@@ -81,6 +81,13 @@ protected:
const G4int waitTimePerPointmilliseconds = 20,
const G4String exportString = "");
void Twinkle
// Twinkles the touchables in paths
// /vis/viewer/centreOn to see its effect
(G4VViewer* currentViewer,
const G4ViewParameters& baseVP,
const std::vector<std::vector<G4PhysicalVolumeModel::G4PhysicalVolumeNodeID>>& paths);
// Conversion routines augmenting those in G4UIcommand.
static G4String ConvertToString(G4double x, G4double y,
@@ -114,10 +121,6 @@ protected:
G4double& value);
// Return false if there's a problem
void CopyMostViewParameters
(G4ViewParameters& target, const G4ViewParameters& from);
// Copy view parameters except for autoRefresh and background...
void CopyCameraParameters
(G4ViewParameters& target, const G4ViewParameters& from);
// Copy view parameters pertaining only to camera
@@ -161,7 +164,7 @@ protected:
// creation of a new viewer and *also* at the creation of a new scene
// handler.
static G4bool fThereWasAViewer; // True if there was a viewer
static G4ViewParameters fVPExistingViewer; // Its view parameters
static G4ViewParameters fExistingVP; // Its view parameters
};
#endif
@@ -109,8 +109,16 @@ public: // With description
freeRotation // Free, Google-like rotation, using mouse-grab.
};
enum SMROption { // Special Mesh Rendering Option
meshAsDots,
meshAsSurfaces
};
friend std::ostream& operator <<
(std::ostream&, const DrawingStyle&);
(std::ostream&, DrawingStyle);
friend std::ostream& operator <<
(std::ostream&, SMROption);
friend std::ostream& operator <<
(std::ostream&, const G4ViewParameters&);
@@ -165,6 +173,8 @@ public: // With description
G4int GetWindowAbsoluteLocationHintY (G4int) const;
G4int GetWindowLocationHintX () const;
G4int GetWindowLocationHintY () const;
G4bool IsWindowLocationHintXNegative () const;
G4bool IsWindowLocationHintYNegative () const;
const G4String& GetXGeometryString () const;
// GetXGeometryString is intended to be parsed by XParseGeometry.
// It contains the size information, as in GetWindowSizeHint, but
@@ -202,6 +212,7 @@ public: // With description
G4double GetDisplayLightFrontGreen () const;
G4double GetDisplayLightFrontBlue () const;
G4bool IsSpecialMeshRendering () const;
SMROption GetSpecialMeshRenderingOption () const;
const std::vector<G4ModelingParameters::PVNameCopyNo>& GetSpecialMeshVolumes() const;
// Here Follow functions to evaluate useful quantities as a
@@ -296,6 +307,7 @@ public: // With description
void SetDisplayLightFrontGreen (G4double);
void SetDisplayLightFrontBlue (G4double);
void SetSpecialMeshRendering (G4bool);
void SetSpecialMeshRenderingOption (SMROption);
void SetSpecialMeshVolumes (const std::vector<G4ModelingParameters::PVNameCopyNo>&);
// Command dumping functions.
@@ -392,6 +404,7 @@ private:
fDisplayLightFrontT;
G4double fDisplayLightFrontRed, fDisplayLightFrontGreen, fDisplayLightFrontBlue;
G4bool fSpecialMeshRendering; // Request special rendering of parameterised volumes
SMROption fSpecialMeshRenderingOption; // Special rendering option
std::vector<G4ModelingParameters::PVNameCopyNo> fSpecialMeshVolumes; // If empty, all meshes.
enum { // Constants for geometry mask in ParseGeometry and related functions.
@@ -195,6 +195,14 @@ inline G4int G4ViewParameters::GetWindowLocationHintY () const {
return fWindowLocationHintY;
}
inline G4bool G4ViewParameters::IsWindowLocationHintXNegative () const {
return fWindowLocationHintXNegative;
}
inline G4bool G4ViewParameters::IsWindowLocationHintYNegative () const {
return fWindowLocationHintYNegative;
}
inline const G4String& G4ViewParameters::GetXGeometryString () const {
return fXGeometryString;
}
@@ -298,6 +306,9 @@ inline G4int G4ViewParameters::GetNumberOfCloudPoints () const {
inline G4bool G4ViewParameters::IsSpecialMeshRendering () const
{return fSpecialMeshRendering;}
inline G4ViewParameters::SMROption G4ViewParameters::GetSpecialMeshRenderingOption () const
{return fSpecialMeshRenderingOption;}
inline const std::vector<G4ModelingParameters::PVNameCopyNo>&
G4ViewParameters::GetSpecialMeshVolumes() const
{return fSpecialMeshVolumes;}
@@ -564,6 +575,9 @@ inline void G4ViewParameters::SetDisplayLightFrontBlue (G4double displayLightFro
inline void G4ViewParameters::SetSpecialMeshRendering (G4bool smr)
{fSpecialMeshRendering = smr;}
inline void G4ViewParameters::SetSpecialMeshRenderingOption (G4ViewParameters::SMROption option)
{fSpecialMeshRenderingOption = option;}
inline void G4ViewParameters::SetSpecialMeshVolumes
(const std::vector<G4ModelingParameters::PVNameCopyNo>& smvs)
{fSpecialMeshVolumes = smvs;}
@@ -48,6 +48,18 @@ private:
G4UIcmdWithABool* fpCommand;
};
class G4VisCommandAbortReviewPlots: public G4VVisCommand {
public:
G4VisCommandAbortReviewPlots ();
virtual ~G4VisCommandAbortReviewPlots ();
G4String GetCurrentValue (G4UIcommand* command);
void SetNewValue (G4UIcommand* command, G4String newValue);
private:
G4VisCommandAbortReviewPlots (const G4VisCommandAbortReviewPlots&);
G4VisCommandAbortReviewPlots& operator = (const G4VisCommandAbortReviewKeptEvents&);
G4UIcmdWithABool* fpCommand;
};
class G4VisCommandDrawOnlyToBeKeptEvents: public G4VVisCommand {
public:
G4VisCommandDrawOnlyToBeKeptEvents ();
@@ -108,6 +120,18 @@ private:
G4UIcmdWithAString* fpCommand;
};
class G4VisCommandReviewPlots: public G4VVisCommand {
public:
G4VisCommandReviewPlots ();
virtual ~G4VisCommandReviewPlots ();
G4String GetCurrentValue (G4UIcommand* command);
void SetNewValue (G4UIcommand* command, G4String newValue);
private:
G4VisCommandReviewPlots (const G4VisCommandReviewPlots&);
G4VisCommandReviewPlots& operator = (const G4VisCommandReviewPlots&);
G4UIcmdWithoutParameter* fpCommand;
};
class G4VisCommandVerbose: public G4VVisCommand {
public:
G4VisCommandVerbose ();
@@ -80,6 +80,7 @@ class G4VisCommandOpen: public G4VVisCommand {
public:
G4VisCommandOpen ();
virtual ~G4VisCommandOpen ();
G4String GetCurrentValue(G4UIcommand*);
void SetNewValue (G4UIcommand* command, G4String newValue);
private:
G4VisCommandOpen (const G4VisCommandOpen&);
@@ -87,6 +88,18 @@ private:
G4UIcommand* fpCommand;
};
class G4VisCommandPlot: public G4VVisCommand {
public:
G4VisCommandPlot ();
virtual ~G4VisCommandPlot ();
G4String GetCurrentValue (G4UIcommand* command);
void SetNewValue (G4UIcommand* command, G4String newValue);
private:
G4VisCommandPlot (const G4VisCommandPlot&);
G4VisCommandPlot& operator = (const G4VisCommandPlot&);
G4UIcommand* fpCommand;
};
class G4VisCommandSpecify: public G4VVisCommand {
public:
G4VisCommandSpecify ();
@@ -47,7 +47,7 @@ private:
G4VisCommandsTouchable& operator = (const G4VisCommandsTouchable&);
G4UIcmdWithoutParameter* fpCommandCentreOn;
G4UIcmdWithoutParameter* fpCommandCentreAndZoomInOn;
G4UIcmdWithoutParameter* fpCommandDraw;
G4UIcmdWithABool* fpCommandDraw;
G4UIcmdWithoutParameter* fpCommandDump;
G4UIcmdWithABool* fpCommandExtentForField;
G4UIcommand* fpCommandFindPath;
@@ -245,15 +245,15 @@ private:
G4double fPanToRight, fPanToUp;
};
class G4VisCommandViewerReset: public G4VVisCommand {
class G4VisCommandViewerRebuild: public G4VVisCommand {
public:
G4VisCommandViewerReset ();
virtual ~G4VisCommandViewerReset ();
G4VisCommandViewerRebuild ();
virtual ~G4VisCommandViewerRebuild ();
G4String GetCurrentValue (G4UIcommand* command);
void SetNewValue (G4UIcommand* command, G4String newValue);
private:
G4VisCommandViewerReset (const G4VisCommandViewerReset&);
G4VisCommandViewerReset& operator = (const G4VisCommandViewerReset&);
G4VisCommandViewerRebuild (const G4VisCommandViewerRebuild&);
G4VisCommandViewerRebuild& operator = (const G4VisCommandViewerRebuild&);
G4UIcmdWithAString* fpCommand;
};
@@ -269,15 +269,27 @@ private:
G4UIcmdWithAString* fpCommand;
};
class G4VisCommandViewerRebuild: public G4VVisCommand {
class G4VisCommandViewerReset: public G4VVisCommand {
public:
G4VisCommandViewerRebuild ();
virtual ~G4VisCommandViewerRebuild ();
G4VisCommandViewerReset ();
virtual ~G4VisCommandViewerReset ();
G4String GetCurrentValue (G4UIcommand* command);
void SetNewValue (G4UIcommand* command, G4String newValue);
private:
G4VisCommandViewerRebuild (const G4VisCommandViewerRebuild&);
G4VisCommandViewerRebuild& operator = (const G4VisCommandViewerRebuild&);
G4VisCommandViewerReset (const G4VisCommandViewerReset&);
G4VisCommandViewerReset& operator = (const G4VisCommandViewerReset&);
G4UIcmdWithAString* fpCommand;
};
class G4VisCommandViewerResetCameraParameters: public G4VVisCommand {
public:
G4VisCommandViewerResetCameraParameters ();
virtual ~G4VisCommandViewerResetCameraParameters ();
G4String GetCurrentValue (G4UIcommand* command);
void SetNewValue (G4UIcommand* command, G4String newValue);
private:
G4VisCommandViewerResetCameraParameters (const G4VisCommandViewerResetCameraParameters&);
G4VisCommandViewerResetCameraParameters& operator = (const G4VisCommandViewerResetCameraParameters&);
G4UIcmdWithAString* fpCommand;
};
@@ -36,6 +36,7 @@
class G4UIdirectory;
class G4UIcommand;
class G4UIcmdWithoutParameter;
class G4UIcmdWithAString;
class G4UIcmdWithABool;
class G4UIcmdWithAnInteger;
@@ -70,12 +71,14 @@ private:
G4UIcommand* fpCommandLightsVector;
G4ThreeVector fLightsVector;
G4UIcmdWithAnInteger* fpCommandLineSegments;
G4UIcmdWithoutParameter* fpCommandLineWidth;
G4UIcmdWithAnInteger* fpCommandNumberOfCloudPoints;
G4UIcmdWithABool* fpCommandPicking;
G4UIcommand* fpCommandProjection;
G4UIcmdWithAString* fpCommandRotationStyle;
G4UIcommand* fpCommandSectionPlane;
G4UIcmdWithABool* fpCommandSpecialMeshRendering;
G4UIcmdWithAString* fpCommandSpecialMeshRenderingOption;
G4UIcommand* fpCommandSpecialMeshVolumes;
G4UIcmdWithAString* fpCommandStyle;
G4UIcmdWith3VectorAndUnit* fpCommandTargetPoint;
@@ -234,21 +234,35 @@ G4VisExecutive::RegisterGraphicsSystems () {
#ifdef G4VIS_USE_TOOLSSG_X11_GLES
G4VGraphicsSystem* tsg_x11_gles = new G4ToolsSGX11GLES;
RegisterGraphicsSystem(tsg_x11_gles);
tsg_x11_gles->AddNickname("TSGX11");
#ifdef G4VIS_USE_TOOLSSG_XT_GLES
tsg_x11_gles->AddNickname("TSG_XT_GLES_FALLBACK");
#endif
#ifdef G4VIS_USE_TOOLSSG_QT_GLES
#ifndef G4VIS_USE_TOOLSSG_XT_GLES
tsg_x11_gles->AddNickname("TSG_QT_GLES_FALLBACK");
#endif
#endif
#ifdef G4VIS_USE_TOOLSSG_WINDOWS_GLES
G4VGraphicsSystem* tsg_windows_gles = new G4ToolsSGWindowsGLES;
RegisterGraphicsSystem(tsg_windows_gles);
#endif
#ifdef G4VIS_USE_TOOLSSG_XT_GLES
G4VGraphicsSystem* tsg_xt_gles = new G4ToolsSGXtGLES;
RegisterGraphicsSystem(tsg_xt_gles);
tsg_xt_gles->AddNickname("TSGXt");
#ifdef G4VIS_USE_TOOLSSG_QT_GLES
tsg_xt_gles->AddNickname("TSG_QT_GLES_FALLBACK");
#endif
#endif
#ifdef G4VIS_USE_TOOLSSG_QT_GLES
G4VGraphicsSystem* tsg_qt_gles = new G4ToolsSGQtGLES;
RegisterGraphicsSystem(tsg_qt_gles);
tsg_qt_gles->AddNickname("TSGQt");
#endif
#ifdef G4VIS_USE_TOOLSSG_WINDOWS_GLES
G4VGraphicsSystem* tsg_windows_gles = new G4ToolsSGWindowsGLES;
RegisterGraphicsSystem(tsg_windows_gles);
#endif
#ifdef G4VIS_USE_TOOLSSG_QT_GLES
@@ -264,16 +278,15 @@ G4VisExecutive::RegisterGraphicsSystems () {
#ifdef G4VIS_USE_VTK
G4Vtk* vtkN = new G4Vtk();
RegisterGraphicsSystem(vtkN);
vtkN->AddNickname("VTK_NATIVE");
# ifdef G4VIS_USE_VTK_QT
// Comment out for now until we understand behaviour with a terminal session.
// vtkN->AddNickname("VtkQt_FALLBACK");
vtkN->AddNickname("VTKQt_FALLBACK");
# endif
#endif
#ifdef G4VIS_USE_VTK_QT
G4VtkQt* vtkQt = new G4VtkQt();
RegisterGraphicsSystem(vtkQt);
vtkQt->AddNickname("VTKQt");
#endif
#ifdef G4VIS_USE_VTK_QT
@@ -368,6 +368,7 @@ public: // With description
void Enable();
void Disable();
G4bool IsEnabled() const;
// Global enable/disable functions.
const G4VTrajectoryModel* CurrentTrajDrawModel() const;
@@ -400,6 +401,8 @@ public: // With description
G4int GetNKeepRequests () const;
G4bool GetReviewingKeptEvents () const;
G4bool GetAbortReviewKeptEvents () const;
G4bool GetReviewingPlots () const;
G4bool GetAbortReviewPlots () const;
const G4ViewParameters& GetDefaultViewParameters () const;
#ifdef G4MULTITHREADED
G4int GetMaxEventQueueSize () const;
@@ -424,6 +427,8 @@ public: // With description
void SetRequestedEvent (const G4Event*);
void SetReviewingKeptEvents (G4bool);
void SetAbortReviewKeptEvents (G4bool);
void SetReviewingPlots (G4bool);
void SetAbortReviewPlots (G4bool);
void SetDefaultViewParameters (const G4ViewParameters&);
#ifdef G4MULTITHREADED
void SetMaxEventQueueSize (G4int);
@@ -454,6 +459,8 @@ public: // With description
static std::vector<G4String> VerbosityGuidanceStrings;
// Guidance on the use of visualization verbosity.
void PrintAvailableGraphicsSystems (Verbosity, std::ostream& = G4cout) const;
protected:
virtual void RegisterGraphicsSystems () = 0;
@@ -471,8 +478,6 @@ protected:
// available graphics systems.) It is initialised to 1 in the
// constructor and cannot be changed.
void PrintAvailableGraphicsSystems (Verbosity) const;
private:
// Function templates to implement the Draw methods (to avoid source
@@ -520,6 +525,8 @@ private:
const G4Event* fpRequestedEvent; // If non-zero, scene handler uses.
G4bool fReviewingKeptEvents;
G4bool fAbortReviewKeptEvents;
G4bool fReviewingPlots;
G4bool fAbortReviewPlots;
G4ViewParameters fDefaultViewParameters;
G4bool fIsDrawGroup;
G4int fDrawGroupNestingDepth;
@@ -32,6 +32,10 @@ inline void G4VisManager::Initialize () {
Initialise ();
}
inline G4bool G4VisManager::IsEnabled () const{
return GetConcreteInstance();
}
inline const std::vector<G4VisManager::UserVisAction>&
G4VisManager::GetRunDurationUserVisActions () const {
return fRunDurationUserVisActions;
@@ -106,6 +110,14 @@ inline G4bool G4VisManager::GetAbortReviewKeptEvents() const {
return fAbortReviewKeptEvents;
}
inline G4bool G4VisManager::GetReviewingPlots() const {
return fReviewingPlots;
}
inline G4bool G4VisManager::GetAbortReviewPlots() const {
return fAbortReviewPlots;
}
inline const G4ViewParameters& G4VisManager::GetDefaultViewParameters() const {
return fDefaultViewParameters;
}
@@ -162,10 +174,19 @@ inline void G4VisManager::SetRequestedEvent (const G4Event* event) {
inline void G4VisManager::SetReviewingKeptEvents (G4bool reveiwing) {
fReviewingKeptEvents = reveiwing;
}
inline void G4VisManager::SetAbortReviewKeptEvents (G4bool abort) {
fAbortReviewKeptEvents = abort;
}
inline void G4VisManager::SetReviewingPlots (G4bool reveiwing) {
fReviewingPlots = reveiwing;
}
inline void G4VisManager::SetAbortReviewPlots (G4bool abort) {
fAbortReviewPlots = abort;
}
inline void G4VisManager::SetDefaultViewParameters
(const G4ViewParameters& vp) {
fDefaultViewParameters = vp;