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
+2 -3
View File
@@ -1,4 +1,3 @@
# - G4visVtk category build
geant4_global_library_target(COMPONENTS sources.cmake)
include(sources.cmake)
geant4_add_category(G4visVtk MODULES G4visVtk)
+26 -15
View File
@@ -1,21 +1,32 @@
-------------------------------------------------------------------
# Category visVtk History
=========================================================
Geant4 - an Object-Oriented Toolkit for Simulation in HEP
=========================================================
See `CONTRIBUTING.rst` for details of **required** info/format for each entry,
which **must** added in reverse chronological order (newest at the top).
It must **not** be used as a substitute for writing good git commit messages!
Category History file
---------------------
This file should be used by G4 developers and category coordinators
to briefly summarize all major modifications introduced in the code
and keep track of all category-tags.
-------------------------------------------------------------------------------
----------------------------------------------------------
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
## 2022-03-22 Ben Morgan (visVtk-V11-00-03)
- Use geant4_module_sources to add optional sources
- Move setting of G4VIS_USE_VTK_QT flag on G4UIcommon module to that module's
build script.
## 2022-01-28 Ben Morgan (visVtk-V11-00-02)
- Replace `geant4_global_library_target` with direct file inclusion and
call to `geant4_add_category` to define library build from source modules.
## 2022-01-16 John Allison (visVtk-V11-00-01)
- `G4TVtkViewer`: Fix window location for VTKN;
Introduce `pixelFactor` for Apple Mac.
- `G4VtkMessenger`: Fix typo (OpenGL -> Vtk) in message.
## 2021-12-10 Ben Morgan (visVtk-V11-00-00)
- Change to new Markdown History format.
---
# History entries prior to 11.0
History file for visualization/Vtk sub-category
-----------------------------------------------
8 November 2021 - Ben Morgan (visVtk-V10-07-03)
- Retire G4UI/G4INTY_... preprocessor symbols in toolkit build, only required
by obsolete GNUmake system
@@ -24,4 +35,4 @@ History file for visualization/Vtk sub-category
- Implement G4VtkQt::IsUISessionCompatible.
04 October 2021 Stewart Boogert / Laurie Nevay (visVtk-V10-07-01)
- Operational VTK viewer (VtkNative and VtkQt)
- Operational VTK viewer (VtkNative and VtkQt)
+27 -59
View File
@@ -1,73 +1,41 @@
#------------------------------------------------------------------------------
# sources.cmake
# Module : G4visVtk
# Package: Geant4.src.G4visualization.G4visQt3D
#
# Sources description for a library.
# Lists the sources and headers of the code explicitely.
# Lists include paths needed.
# Lists the internal granular and global dependencies of the library.
# Source specific properties should be added at the end.
#
# Generated on : 24/9/2010
#
#
#------------------------------------------------------------------------------
#
# Define the Geant4 Module.
#
set(G4VIS_MODULE_VTK_HEADERS
# - G4visVTK module build definition
# Define the Geant4 Module
geant4_add_module(G4visVtk
PUBLIC_HEADERS
G4Vtk.hh
G4VtkMessenger.hh
G4VtkSceneHandler.hh
G4VtkViewer.hh
vtkTensorGlyphColor.h)
set(G4VIS_MODULE_VTK_SOURCES
vtkTensorGlyphColor.h
SOURCES
G4Vtk.cc
G4VtkMessenger.cc
G4VtkSceneHandler.cc
G4VtkViewer.cc
vtkTensorGlyphColor.cxx)
set(G4VIS_MODULE_VTK_DEFINITIONS
-DG4VIS_USE_VTK)
geant4_module_link_libraries(G4visVtk
PUBLIC
G4modeling
G4globman
G4hepgeometry
G4vis_management
${VTK_LIBRARIES}
PRIVATE
G4graphics_reps
G4UIbasic
G4UIcommon)
# - VTK-Qt if Qt enabled
if(GEANT4_USE_QT)
list(APPEND G4VIS_MODULE_VTK_HEADERS
G4VtkQt.hh
G4VtkQtSceneHandler.hh
G4VtkQtViewer.hh)
list(APPEND G4VIS_MODULE_VTK_SOURCES
G4VtkQt.cc
G4VtkQtSceneHandler.cc
G4VtkQtViewer.cc)
list(APPEND G4VIS_MODULE_VTK_DEFINITIONS -DG4VIS_USE_VTK_QT)
geant4_module_sources(G4visVtk
PUBLIC_HEADERS
G4VtkQt.hh
G4VtkQtSceneHandler.hh
G4VtkQtViewer.hh
SOURCES
G4VtkQt.cc
G4VtkQtSceneHandler.cc
G4VtkQtViewer.cc)
endif()
add_definitions(${G4VIS_MODULE_VTK_DEFINITIONS})
geant4_add_module(G4visVtk
PUBLIC_HEADERS ${G4VIS_MODULE_VTK_HEADERS}
SOURCES ${G4VIS_MODULE_VTK_SOURCES})
geant4_module_compile_definitions(G4visVtk PRIVATE ${G4VIS_MODULE_VTK_DEFINITIONS})
geant4_module_compile_definitions(G4UIcommon PRIVATE ${G4VIS_MODULE_VTK_DEFINITIONS})
geant4_module_link_libraries(G4visVtk
PUBLIC
G4modeling
G4globman
G4hepgeometry
G4vis_management
${VTK_LIBRARIES}
PRIVATE
G4graphics_reps
G4UIbasic
G4UIcommon)
@@ -95,7 +95,7 @@ void G4VtkMessenger::SetNewValue(G4UIcommand *command, G4String newValue)
auto* pVtkViewer = dynamic_cast<G4VtkViewer*>(pViewer);
if (!pVtkViewer) {
G4cout << "G4OpenGLViewerMessenger::SetNewValue: Current viewer is not of type VTK. \n"
G4cout << "G4VtkMessenger::SetNewValue: Current viewer is not of type VTK. \n"
<< "(It is \""
<< pViewer->GetName()
<< "\".)\n"
@@ -128,4 +128,4 @@ void G4VtkMessenger::SetNewValue(G4UIcommand *command, G4String newValue)
{
vtkObject::GlobalWarningDisplayOff();
}
}
}
+33 -27
View File
@@ -22,13 +22,6 @@
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
//
//
// John Allison 5th April 2001
// A template for a simplest possible graphics driver.
//?? Lines or sections marked like this require specialisation for your driver.
#include "G4VtkViewer.hh"
@@ -62,6 +55,8 @@
G4VtkViewer::G4VtkViewer(G4VSceneHandler& sceneHandler, const G4String& name)
: G4VViewer(sceneHandler, sceneHandler.IncrementViewCount(), name)
{
vtkObject::GlobalWarningDisplayOff();
// Set default and current view parameters
fVP.SetAutoRefresh(true);
fDefaultVP.SetAutoRefresh(true);
@@ -74,16 +69,33 @@ void G4VtkViewer::Initialise()
#ifdef G4VTKDEBUG
G4cout << "G4VtkViewer::G4VtkViewer" << G4endl;
G4cout << "G4VtkViewer::G4VtkViewer> " << fVP.GetWindowSizeHintX() << " "
<< fVP.GetWindowSizeHintY() << G4endl;
<< fVP.GetWindowSizeHintY() << G4endl;
G4cout << "G4VtkViewer::G4VtkViewer> " << fVP.GetWindowLocationHintX() << " "
<< fVP.GetWindowLocationHintY() << G4endl;
<< fVP.GetWindowLocationHintY() << G4endl;
#endif
_renderWindow->SetSize(fVP.GetWindowSizeHintX(), fVP.GetWindowSizeHintY());
_renderWindow->SetPosition(fVP.GetWindowLocationHintX(),
fVP.GetWindowLocationHintY());
// Need windowSizeX/Y - obtain from _renderWindow?
G4int screenSizeX = _renderWindow->GetScreenSize()[0];
G4int screenSizeY = _renderWindow->GetScreenSize()[1];
G4int positionX = fVP.GetWindowLocationHintX();
if (fVP.IsWindowLocationHintXNegative()) {
positionX = screenSizeX + positionX - fVP.GetWindowSizeHintX();
}
G4int positionY = fVP.GetWindowLocationHintY();
if (!fVP.IsWindowLocationHintYNegative()) {
positionY = screenSizeY + positionY - fVP.GetWindowSizeHintY();
}
_renderWindow->SetPosition(positionX, positionY);
#ifdef __APPLE__
// Adjust window size for Apple to make it correspond to OpenGL.
// Maybe it's OpenGL that shoud be adjusted.
const G4double pixelFactor = 2.;
#else
const G4double pixelFactor = 1.;
#endif
_renderWindow->SetSize
(pixelFactor*fVP.GetWindowSizeHintX(),pixelFactor*fVP.GetWindowSizeHintY());
_renderWindow->SetWindowName("Vtk viewer");
_renderWindow->AddRenderer(renderer);
@@ -188,18 +200,20 @@ void G4VtkViewer::SetView() {
}
// Rotation style
#if 0
G4ViewParameters::RotationStyle rotationStyle = fVP.GetRotationStyle();
if (rotationStyle == G4ViewParameters::RotationStyle::freeRotation) {
vtkSmartPointer<vtkInteractorStyleTrackballCamera> style =
vtkSmartPointer<vtkInteractorStyleTrackballCamera>::New();
renderWindowInteractor->SetInteractorStyle(style);
_renderWindow->GetInteractor()->SetInteractorStyle(style);
}
else if(rotationStyle == G4ViewParameters::RotationStyle::constrainUpDirection) {
// camera->SetViewUp(upVector.x(), upVector.y(), upVector.z());
vtkSmartPointer<vtkInteractorStyleTerrain> style =
vtkSmartPointer<vtkInteractorStyleTerrain>::New();
renderWindowInteractor->SetInteractorStyle(style);
_renderWindow->GetInteractor()->SetInteractorStyle(style);
}
#endif
}
void G4VtkViewer::ClearView() {
@@ -224,10 +238,6 @@ void G4VtkViewer::ClearView() {
renderer->RemoveViewProp(prop);
prop = props->GetLastProp();
}
G4VtkSceneHandler& fVtkSceneHandler =
dynamic_cast<G4VtkSceneHandler&>(fSceneHandler);
fVtkSceneHandler.Clear();
}
void G4VtkViewer::DrawView() {
@@ -290,8 +300,7 @@ void G4VtkViewer::ShowView()
// static_cast<G4VtkSceneHandler&>(fSceneHandler).PrintStores();
#endif
G4VtkSceneHandler& fVtkSceneHandler =
dynamic_cast<G4VtkSceneHandler&>(fSceneHandler);
G4VtkSceneHandler& fVtkSceneHandler = dynamic_cast<G4VtkSceneHandler&>(fSceneHandler);
fVtkSceneHandler.Modified();
infoTextActor->GetTextProperty()->SetFontSize(28);
@@ -307,19 +316,16 @@ void G4VtkViewer::ShowView()
geant4Callback->SetGeant4ViewParameters(&fVP);
renderer->AddObserver(vtkCommand::EndEvent, geant4Callback);
renderer->AddActor(infoTextActor);
_renderWindow->Render();
renderWindowInteractor->Initialize();
renderWindowInteractor->Start();
}
void G4VtkViewer::FinishView()
{
G4VtkSceneHandler& fVtkSceneHandler =
dynamic_cast<G4VtkSceneHandler&>(fSceneHandler);
G4VtkSceneHandler& fVtkSceneHandler = dynamic_cast<G4VtkSceneHandler&>(fSceneHandler);
fVtkSceneHandler.Modified();
_renderWindow->Render();
_renderWindow->GetInteractor()->Initialize();
_renderWindow->GetInteractor()->Start();
}
void G4VtkViewer::ExportScreenShot(G4String path, G4String format)