Import Geant4 11.1.0 source tree

This commit is contained in:
Gabriele Cosmo
2022-12-09 14:43:28 +01:00
parent c07cea1fe0
commit 9f34590941
3810 changed files with 200490 additions and 182326 deletions
+90 -2
View File
@@ -1,8 +1,96 @@
# Category visman History
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!
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!
-------------------------------------------------------------------------------
## 2022-11-25 Gabriele Cosmo (visman-V11-00-31)
- Fixed compilation warning for implicit type conversions on macOS/XCode 14.1.
## 2022-11-05 John Allison (visman-V11-00-30)
- Eliminate G4cerr and introduce G4warn in remaining visman files.
- `#define G4warn G4cout`
- The above is temporary until a genuine G4warn output stream is
implemented.
- Change G4cerr to G4warn in all cases.
- Change G4cout to G4warn in those cases where `verbosity >= warnings`.
## 2022-11-04 John Allison (visman-V11-00-29)
- G4VisManager.cc: Eliminate G4cerr and introduce G4warn.
- Only for G4VisManager.cc for now to test the principle.
- Other vis files will be migrated if this MR is successful.
- `#define G4warn G4cout`
- The above is temporary until a genuine G4warn output stream is
implemented.
- Change G4cerr to G4warn in all cases.
- Change G4cout to G4warn in those cases where `verbosity >= warnings`.
## 2022-10-30 John Allison (visman-V11-00-28)
- Implement void G4VisManager::DrawGeometry
(G4VPhysicalVolume* v, const G4Transform3D& t)
- Draws a geometry tree starting at the specified physical volume.
## 2022-10-28 John Allison (visman-V11-00-27)
- Implement generic cutaway.
- Prior to this tag, cutaways were implemented only in OpenGL by using
OpenGL's clipping plane feature. This still pertains for OpenGL because
it is very fast, but this tag implements cutaways using Boolean operations.
Evgueni Tcherniaev and I have found a way to make this reasonably
robust and reliable. The initial motivation and implementation on the
management side (G4VSceneHandler) came from a Geant4 user,
Pooria Heidary, via a GitHub pull request.
- G4VSceneHandler::CreateCutawaySolid:
- The initial implementation is by Pooria Heidary.
- G4VSceneHandler::RequestPrimitives:
- Check validity of Boolean solids. This is particularly pertinent
for cutaways, because the cutting volume (the subtractor) is
large and general and often the target volume is entirely within
or entirely outside. But it is a check that now applies to all
geometries, with or without cutaways, so it is a bug fix.
- Sometimes solids that have no substance get requested. They may
be part of the geometry tree but have been "spirited away", for
example by a Boolean subtraction in which the original volume
is entirely inside the subtractor.
- The problem is that the Boolean Processor still returns a
polyhedron in these cases (IMHO it should not), so the
workaround is to return before the damage is done.
- The check involves seeking a point inside the resulting
Boolean solid. If it cannot be found within a large number
of attempts, it is assumed to be invalid.
- G4VisCommandsViewer.cc:
- Make sure the normal to the cutaway plane is normalised (unit vector).
- G4VisCommandsViewerSet.cc:
- Make sure the normal to the sectioning plane is normalised (unit vector).
## 2022-10-13 Guy Barrand (visman-V11-00-26)
- G4VisExecutive.icc: add TOOLSSG_OFFSCREEN.
## 2022-09-19 John Allison (visman-V11-00-25)
- G4VSceneHandler.cc::StandardSpecialMeshRendering():
- Draw container if not marked invisible.
## 2022-09-13 Evgueni Tcherniaev (visman-V11-00-24)
- G4VSceneHandler: implemented GetPointInBox() and GetPointInTet()
to sample a random point inside a box and a tetrahedron.
## 2022-09-10 Ben Morgan (visman-V11-00-23)
- Mark compile time only and buildmode-specific headers as "no_geant4_module_check"
## 2022-09-03 Ben Morgan (visman-V11-00-22)
- Add PRIVATE dependency on G4volumes for multithreaded builds only.
## 2022-08-17 John Allison (visman-V11-00-21)
- Back out code that forces /vis/verbose and /control/verbose
- G4VisCommandsCompound.cc, G4VisCommandsSceneAdd.cc,
G4VisCommandsTouchable.cc, G4VisCommandsViewer.cc:
- Sometimes the vis system forced extra vis messages or the echoing of
commands. Not sure why this was done - perhaps with a thought to
providing useful information - but it causes surprises, for example,
when the control verbosity is zero (no command echoing) a command is
still echoed. With this patch, there will be no such surprises - what
the user sets as vis and/or control verbosity will apply at all times.
## 2022-06-13 Laurie Nevay (visman-V11-00-20)
- G4VisCommandsSceneAdd - changed the default width of axes added to the scene with
@@ -419,6 +419,15 @@ protected:
// For a tetrahedron mesh, draw as surfaces by colour and material
// with inner shared faces removed.
G4ThreeVector GetPointInBox(const G4ThreeVector& pos,
G4double halfX,
G4double halfY,
G4double halfZ) const;
// Sample a random point inside the box
G4ThreeVector GetPointInTet(const std::vector<G4ThreeVector>& vertices) const;
// Sample a random point inside the tetrahedron
//////////////////////////////////////////////////////////////
// Data members
@@ -198,17 +198,17 @@ protected:
// Operations
void AddSplinePoint(const G4Vector3D& v);
G4Vector3D GetInterpolatedSplinePoint(float t); // t = 0...1; 0=vp[0] ... 1=vp[max]
int GetNumPoints();
G4Vector3D GetInterpolatedSplinePoint(G4float t); // t = 0...1; 0=vp[0] ... 1=vp[max]
G4int GetNumPoints();
G4Vector3D GetPoint(int);
// method for computing the Catmull-Rom parametric equation
// given a time (t) and a vector quadruple (p1,p2,p3,p4).
G4Vector3D CatmullRom_Eq(float t, const G4Vector3D& p1, const G4Vector3D& p2,
G4Vector3D CatmullRom_Eq(G4float t, const G4Vector3D& p1, const G4Vector3D& p2,
const G4Vector3D& p3, const G4Vector3D& p4);
private:
std::vector<G4Vector3D> vp;
float delta_t;
G4float delta_t;
};
//////////////////////////////////////////////////////////////
@@ -31,84 +31,86 @@
#ifndef G4VISEXECUTIVE_ICC
#define G4VISEXECUTIVE_ICC
// Supported drivers...
// Not needing external packages or libraries...
#include "G4ASCIITree.hh"
#include "G4DAWNFILE.hh"
#include "G4HepRepFile.hh"
#include "G4RayTracer.hh"
// Filter/Model Factories
#include "G4HitFilterFactories.hh"
#include "G4DigiFilterFactories.hh"
#include "G4TrajectoryFilterFactories.hh"
#include "G4TrajectoryModelFactories.hh"
#include "G4VRML2File.hh"
#include "G4GMocrenFile.hh"
// Supported drivers...
// Not needing external packages or libraries...
#include "G4ASCIITree.hh" // no_geant4_module_check
#include "G4DAWNFILE.hh" // no_geant4_module_check
#include "G4HepRepFile.hh" // no_geant4_module_check
#include "G4RayTracer.hh" // no_geant4_module_check
#include "G4VRML2File.hh" // no_geant4_module_check
#include "G4GMocrenFile.hh" // no_geant4_module_check
#include "G4ToolsSGOffscreen.hh" // no_geant4_module_check
// Needing external packages or libraries...
#ifdef G4VIS_USE_OPENGLX
#include "G4OpenGLImmediateX.hh"
#include "G4OpenGLStoredX.hh"
#include "G4OpenGLImmediateX.hh" // no_geant4_module_check
#include "G4OpenGLStoredX.hh" // no_geant4_module_check
#endif
#ifdef G4VIS_USE_OPENGLWIN32
#include "G4OpenGLImmediateWin32.hh"
#include "G4OpenGLStoredWin32.hh"
#include "G4OpenGLImmediateWin32.hh" // no_geant4_module_check
#include "G4OpenGLStoredWin32.hh" // no_geant4_module_check
#endif
#ifdef G4VIS_USE_OPENGLXM
#include "G4OpenGLImmediateXm.hh"
#include "G4OpenGLStoredXm.hh"
#include "G4OpenGLImmediateXm.hh" // no_geant4_module_check
#include "G4OpenGLStoredXm.hh" // no_geant4_module_check
#endif
#ifdef G4VIS_USE_OPENGLQT
#include "G4OpenGLImmediateQt.hh"
#include "G4OpenGLStoredQt.hh"
#include "G4OpenGLImmediateQt.hh" // no_geant4_module_check
#include "G4OpenGLStoredQt.hh" // no_geant4_module_check
#endif
#ifdef G4VIS_USE_OIX
#include "G4OpenInventorX.hh"
#include "G4OpenInventorXtExtended.hh"
#include "G4OpenInventorX.hh" // no_geant4_module_check
#include "G4OpenInventorXtExtended.hh" // no_geant4_module_check
#endif
#ifdef G4VIS_USE_OIQT
#include "G4OpenInventorQt.hh"
#include "G4OpenInventorQt.hh" // no_geant4_module_check
#endif
#ifdef G4VIS_USE_OIWIN32
#include "G4OpenInventorWin32.hh"
#include "G4OpenInventorWin32.hh" // no_geant4_module_check
#endif
#ifdef G4VIS_USE_RAYTRACERX
#include "G4RayTracerX.hh"
#include "G4RayTracerX.hh" // no_geant4_module_check
#endif
#ifdef G4VIS_USE_QT3D
#include "G4Qt3D.hh"
#include "G4Qt3D.hh" // no_geant4_module_check
#endif
#ifdef G4VIS_USE_TOOLSSG_X11_GLES
#include "G4ToolsSGX11GLES.hh"
#include "G4ToolsSGX11GLES.hh" // no_geant4_module_check
#endif
#ifdef G4VIS_USE_TOOLSSG_WINDOWS_GLES
#include "G4ToolsSGWindowsGLES.hh"
#include "G4ToolsSGWindowsGLES.hh" // no_geant4_module_check
#endif
#ifdef G4VIS_USE_TOOLSSG_XT_GLES
#include "G4ToolsSGXtGLES.hh"
#include "G4ToolsSGXtGLES.hh" // no_geant4_module_check
#endif
#ifdef G4VIS_USE_TOOLSSG_QT_GLES
#include "G4ToolsSGQtGLES.hh"
#include "G4ToolsSGQtGLES.hh" // no_geant4_module_check
#endif
#ifdef G4VIS_USE_VTK
#include "G4Vtk.hh"
#include "G4Vtk.hh" // no_geant4_module_check
#endif
#ifdef G4VIS_USE_VTK_QT
#include "G4VtkQt.hh"
#include "G4VtkQt.hh" // no_geant4_module_check
#endif
// The inline keyword prevents the compiler making an external
@@ -135,6 +137,11 @@ G4VisExecutive::RegisterGraphicsSystems () {
RegisterGraphicsSystem (new G4RayTracer);
RegisterGraphicsSystem (new G4VRML2File);
RegisterGraphicsSystem (new G4GMocrenFile);
RegisterGraphicsSystem (new G4ToolsSGOffscreen);
G4VGraphicsSystem* tsg_offscreen = new G4ToolsSGOffscreen;
RegisterGraphicsSystem(tsg_offscreen);
tsg_offscreen->AddNickname("TSG_FILE");
// Graphics systems needing external packages or libraries...
// Register OGL family of drivers with their normal names,
@@ -286,6 +286,10 @@ public: // With description
void Draw (const G4VSolid&, const G4VisAttributes&,
const G4Transform3D& objectTransformation = G4Transform3D());
void DrawGeometry
(G4VPhysicalVolume*, const G4Transform3D& t = G4Transform3D());
// Draws a geometry tree starting at the specified physical volume.
//////////////////////////////////////////////////////////////////////
// Optional methods that you may use to bracket a series of Draw
// messages that have identical objectTransformation to improve
@@ -97,3 +97,7 @@ geant4_module_link_libraries(G4vis_management
G4navigation
G4digits
G4heprandom)
if(GEANT4_BUILD_MULTITHREADED)
geant4_module_link_libraries(G4vis_management PRIVATE G4volumes)
endif()
+12 -10
View File
@@ -38,6 +38,8 @@
#include <set>
#define G4warn G4cout
G4Scene::G4Scene (const G4String& name):
fName (name),
fRefreshAtEndOfEvent(true),
@@ -131,7 +133,7 @@ G4bool G4Scene::AddWorldIfEmpty (G4bool warn) {
pWorld -> GetLogicalVolume () -> GetVisAttributes ();
if (!pVisAttribs || pVisAttribs -> IsVisible ()) {
if (warn) {
G4cout <<
G4warn <<
"Your \"world\" has no vis attributes or is marked as visible."
"\n For a better view of the contents, mark the world as"
" invisible, e.g.,"
@@ -144,10 +146,10 @@ G4bool G4Scene::AddWorldIfEmpty (G4bool warn) {
// Note: default depth and no modeling parameters.
if (successful) {
if (warn) {
G4cout <<
G4warn <<
"G4Scene::AddWorldIfEmpty: The scene had no extent."
"\n \"world\" has been added.";
G4cout << G4endl;
G4warn << G4endl;
}
}
}
@@ -165,7 +167,7 @@ G4bool G4Scene::AddRunDurationModel (G4VModel* pModel, G4bool warn)
}
if (i != fRunDurationModelList.end ()) {
if (warn) {
G4cout << "G4Scene::AddRunDurationModel: model \""
G4warn << "G4Scene::AddRunDurationModel: model \""
<< pModel -> GetGlobalDescription ()
<< "\"\n is already in the run-duration list of scene \""
<< fName
@@ -180,14 +182,14 @@ G4bool G4Scene::AddRunDurationModel (G4VModel* pModel, G4bool warn)
}
G4bool G4Scene::AddEndOfEventModel (G4VModel* pModel, G4bool warn) {
G4int i, nModels = fEndOfEventModelList.size ();
for (i = 0; i < nModels; i++) {
std::size_t i, nModels = fEndOfEventModelList.size ();
for (i = 0; i < nModels; ++i) {
if (pModel -> GetGlobalDescription () ==
fEndOfEventModelList[i].fpModel -> GetGlobalDescription ()) break;
}
if (i < nModels) {
if (warn) {
G4cout << "G4Scene::AddEndOfEventModel: a model \""
G4warn << "G4Scene::AddEndOfEventModel: a model \""
<< pModel -> GetGlobalDescription ()
<< "\"\n is already in the end-of-event list of scene \""
<< fName << "\"."
@@ -201,14 +203,14 @@ G4bool G4Scene::AddEndOfEventModel (G4VModel* pModel, G4bool warn) {
}
G4bool G4Scene::AddEndOfRunModel (G4VModel* pModel, G4bool warn) {
G4int i, nModels = fEndOfRunModelList.size ();
for (i = 0; i < nModels; i++) {
std::size_t i, nModels = fEndOfRunModelList.size ();
for (i = 0; i < nModels; ++i) {
if (pModel -> GetGlobalDescription () ==
fEndOfRunModelList[i].fpModel -> GetGlobalDescription ()) break;
}
if (i < nModels) {
if (warn) {
G4cout << "G4Scene::AddEndOfRunModel: a model \""
G4warn << "G4Scene::AddEndOfRunModel: a model \""
<< pModel -> GetGlobalDescription ()
<< "\"\n is already in the end-of-run list of scene \""
<< fName << "\"."
@@ -66,6 +66,8 @@
#include "G4Polyhedra.hh"
#include "G4Tet.hh"
#include "G4DisplacedSolid.hh"
#include "G4UnionSolid.hh"
#include "G4IntersectionSolid.hh"
#include "G4LogicalVolume.hh"
#include "G4PhysicalVolumeModel.hh"
#include "G4ModelingParameters.hh"
@@ -78,7 +80,7 @@
#include "G4VScoringMesh.hh"
#include "G4Mesh.hh"
#include "G4DefaultLinearColorMap.hh"
#include "Randomize.hh"
#include "G4QuickRand.hh"
#include "G4StateManager.hh"
#include "G4RunManager.hh"
#include "G4RunManagerFactory.hh"
@@ -92,6 +94,8 @@
#include <set>
#define G4warn G4cout
G4VSceneHandler::G4VSceneHandler (G4VGraphicsSystem& system, G4int id, const G4String& name):
fSystem (system),
fSceneHandlerId (id),
@@ -344,14 +348,14 @@ void G4VSceneHandler::AddCompound (const G4THitsMap<G4double>& hits) {
G4bool scoreMapHits = false;
G4ScoringManager* scoringManager = G4ScoringManager::GetScoringManagerIfExist();
if (scoringManager) {
size_t nMeshes = scoringManager->GetNumberOfMesh();
for (size_t iMesh = 0; iMesh < nMeshes; ++iMesh) {
G4VScoringMesh* mesh = scoringManager->GetMesh(iMesh);
std::size_t nMeshes = scoringManager->GetNumberOfMesh();
for (std::size_t iMesh = 0; iMesh < nMeshes; ++iMesh) {
G4VScoringMesh* mesh = scoringManager->GetMesh((G4int)iMesh);
if (mesh && mesh->IsActive()) {
MeshScoreMap scoreMap = mesh->GetScoreMap();
const G4String& mapNam = const_cast<G4THitsMap<G4double>&>(hits).GetName();
for(MeshScoreMap::const_iterator i = scoreMap.begin();
i != scoreMap.end(); ++i) {
for(MeshScoreMap::const_iterator i = scoreMap.cbegin();
i != scoreMap.cend(); ++i) {
const G4String& scoreMapName = i->first;
if (scoreMapName == mapNam) {
G4DefaultLinearColorMap colorMap("G4VSceneHandlerColorMap");
@@ -387,13 +391,13 @@ void G4VSceneHandler::AddCompound (const G4THitsMap<G4StatDouble>& hits) {
G4bool scoreMapHits = false;
G4ScoringManager* scoringManager = G4ScoringManager::GetScoringManagerIfExist();
if (scoringManager) {
size_t nMeshes = scoringManager->GetNumberOfMesh();
for (size_t iMesh = 0; iMesh < nMeshes; ++iMesh) {
G4VScoringMesh* mesh = scoringManager->GetMesh(iMesh);
std::size_t nMeshes = scoringManager->GetNumberOfMesh();
for (std::size_t iMesh = 0; iMesh < nMeshes; ++iMesh) {
G4VScoringMesh* mesh = scoringManager->GetMesh((G4int)iMesh);
if (mesh && mesh->IsActive()) {
MeshScoreMap scoreMap = mesh->GetScoreMap();
for(MeshScoreMap::const_iterator i = scoreMap.begin();
i != scoreMap.end(); ++i) {
for(MeshScoreMap::const_iterator i = scoreMap.cbegin();
i != scoreMap.cend(); ++i) {
const G4String& scoreMapName = i->first;
const G4THitsMap<G4StatDouble>* foundHits = i->second;
if (foundHits == &hits) {
@@ -426,7 +430,7 @@ void G4VSceneHandler::AddCompound (const G4THitsMap<G4StatDouble>& hits) {
void G4VSceneHandler::AddCompound(const G4Mesh& mesh)
{
G4cerr <<
G4warn <<
"There has been an attempt to draw a mesh with option \""
<< fpViewer->GetViewParameters().GetSpecialMeshRenderingOption()
<< "\":\n" << mesh
@@ -468,7 +472,7 @@ void G4VSceneHandler::AddPrimitive (const G4Polymarker& polymarker) {
G4Circle dot (polymarker);
dot.SetWorldSize (0.);
dot.SetScreenSize (0.1); // Very small circle.
for (size_t iPoint = 0; iPoint < polymarker.size (); iPoint++) {
for (std::size_t iPoint = 0; iPoint < polymarker.size (); ++iPoint) {
dot.SetPosition (polymarker[iPoint]);
AddPrimitive (dot);
}
@@ -477,7 +481,7 @@ void G4VSceneHandler::AddPrimitive (const G4Polymarker& polymarker) {
case G4Polymarker::circles:
{
G4Circle circle (polymarker); // Default circle
for (size_t iPoint = 0; iPoint < polymarker.size (); iPoint++) {
for (std::size_t iPoint = 0; iPoint < polymarker.size (); ++iPoint) {
circle.SetPosition (polymarker[iPoint]);
AddPrimitive (circle);
}
@@ -486,7 +490,7 @@ void G4VSceneHandler::AddPrimitive (const G4Polymarker& polymarker) {
case G4Polymarker::squares:
{
G4Square square (polymarker); // Default square
for (size_t iPoint = 0; iPoint < polymarker.size (); iPoint++) {
for (std::size_t iPoint = 0; iPoint < polymarker.size (); ++iPoint) {
square.SetPosition (polymarker[iPoint]);
AddPrimitive (square);
}
@@ -504,9 +508,9 @@ void G4VSceneHandler::RemoveViewerFromList (G4VViewer* pViewer) {
void G4VSceneHandler::AddPrimitive (const G4Plotter&) {
G4cerr << "WARNING: Plotter not implemented for " << fSystem.GetName() << G4endl;
G4cerr << " Open a plotter-aware graphics system or remove plotter with" << G4endl;
G4cerr << " /vis/scene/removeModel Plotter" << G4endl;
G4warn << "WARNING: Plotter not implemented for " << fSystem.GetName() << G4endl;
G4warn << " Open a plotter-aware graphics system or remove plotter with" << G4endl;
G4warn << " /vis/scene/removeModel Plotter" << G4endl;
}
void G4VSceneHandler::SetScene (G4Scene* pScene) {
@@ -520,6 +524,31 @@ void G4VSceneHandler::SetScene (G4Scene* pScene) {
void G4VSceneHandler::RequestPrimitives (const G4VSolid& solid)
{
// Sometimes solids that have no substance get requested. They may
// be part of the geometry tree but have been "spirited away", for
// example by a Boolean subtraction in wich the original volume
// is entirely inside the subtractor.
// The problem is that the Boolean Processor still returns a
// polyhedron in these cases (IMHO it should not), so the
// workaround is to return before the damage is done.
auto pSolid = &solid;
auto pBooleanSolid = dynamic_cast<const G4BooleanSolid*>(pSolid);
if (pBooleanSolid) {
G4ThreeVector bmin, bmax;
pBooleanSolid->BoundingLimits(bmin, bmax);
G4bool isGood = false;
for (G4int i=0; i<100000; ++i) {
G4double x = bmin.x() + (bmax.x() - bmin.x())*G4QuickRand();
G4double y = bmin.y() + (bmax.y() - bmin.y())*G4QuickRand();
G4double z = bmin.z() + (bmax.z() - bmin.z())*G4QuickRand();
if (pBooleanSolid->Inside(G4ThreeVector(x,y,z)) == kInside) {
isGood = true;
break;
}
}
if (!isGood) return;
}
const G4ViewParameters::DrawingStyle style = GetDrawingStyle(fpVisAttribs);
const G4ViewParameters& vp = fpViewer->GetViewParameters();
@@ -546,25 +575,25 @@ void G4VSceneHandler::RequestPrimitives (const G4VSolid& solid)
if (verbosity >= G4VisManager::errors &&
problematicSolids.find(&solid) == problematicSolids.end()) {
problematicSolids.insert(&solid);
G4cerr <<
G4warn <<
"ERROR: G4VSceneHandler::RequestPrimitives"
"\n Polyhedron not available for " << solid.GetName ();
G4PhysicalVolumeModel* pPVModel = dynamic_cast<G4PhysicalVolumeModel*>(fpModel);
if (pPVModel) {
G4cerr << "\n Touchable path: " << pPVModel->GetFullPVPath();
G4warn << "\n Touchable path: " << pPVModel->GetFullPVPath();
}
static G4bool explanation = false;
if (!explanation) {
explanation = true;
G4cerr <<
G4warn <<
"\n This means it cannot be visualized in the usual way on most systems."
"\n 1) The solid may not have implemented the CreatePolyhedron method."
"\n 2) For Boolean solids, the BooleanProcessor, which attempts to create"
"\n the resultant polyhedron, may have failed."
"\n Try RayTracer. It uses Geant4's tracking algorithms instead.";
}
G4cerr << "\n Drawing solid with cloud of points.";
G4cerr << G4endl;
G4warn << "\n Drawing solid with cloud of points.";
G4warn << G4endl;
}
}
}
@@ -660,7 +689,7 @@ void G4VSceneHandler::ProcessScene()
// Create modeling parameters from view parameters...
G4ModelingParameters* pMP = CreateModelingParameters();
for(size_t i = 0; i < runDurationModelList.size(); i++)
for(std::size_t i = 0; i < runDurationModelList.size(); ++i)
{
if(runDurationModelList[i].fActive)
{
@@ -702,7 +731,7 @@ void G4VSceneHandler::ProcessScene()
const G4Run* run = runManager->GetCurrentRun();
const std::vector<const G4Event*>* events =
run ? run->GetEventVector() : 0;
size_t nKeptEvents = 0;
std::size_t nKeptEvents = 0;
if(events)
nKeptEvents = events->size();
if(nKeptEvents)
@@ -736,7 +765,7 @@ void G4VSceneHandler::ProcessScene()
{
if(verbosity >= G4VisManager::warnings)
{
G4cout << "WARNING: Cannot refresh events accumulated over more"
G4warn << "WARNING: Cannot refresh events accumulated over more"
"\n than one runs. Refreshed just the last run."
<< G4endl;
}
@@ -762,11 +791,11 @@ void G4VSceneHandler::DrawEvent(const G4Event* event)
{
const std::vector<G4Scene::Model>& EOEModelList =
fpScene -> GetEndOfEventModelList ();
size_t nModels = EOEModelList.size();
std::size_t nModels = EOEModelList.size();
if (nModels) {
G4ModelingParameters* pMP = CreateModelingParameters();
pMP->SetEvent(event);
for (size_t i = 0; i < nModels; i++) {
for (std::size_t i = 0; i < nModels; ++i) {
if (EOEModelList[i].fActive) {
fpModel = EOEModelList[i].fpModel;
fpModel -> SetModelingParameters(pMP);
@@ -783,11 +812,11 @@ void G4VSceneHandler::DrawEndOfRunModels()
{
const std::vector<G4Scene::Model>& EORModelList =
fpScene -> GetEndOfRunModelList ();
size_t nModels = EORModelList.size();
std::size_t nModels = EORModelList.size();
if (nModels) {
G4ModelingParameters* pMP = CreateModelingParameters();
pMP->SetEvent(0);
for (size_t i = 0; i < nModels; i++) {
for (std::size_t i = 0; i < nModels; ++i) {
if (EORModelList[i].fActive) {
fpModel = EORModelList[i].fpModel;
fpModel -> SetModelingParameters(pMP);
@@ -908,32 +937,69 @@ G4DisplacedSolid* G4VSceneHandler::CreateSectionSolid()
G4DisplacedSolid* G4VSceneHandler::CreateCutawaySolid()
{
// To be reviewed.
const G4ViewParameters& vp = fpViewer->GetViewParameters();
if (vp.IsCutaway()) {
std::vector<G4DisplacedSolid*> cutaway_solids;
G4double radius = fpScene->GetExtent().GetExtentRadius();
G4double safe = radius + fpScene->GetExtent().GetExtentCentre().mag();
G4VSolid* cutawayBox =
new G4Box("_cutaway_box", safe, safe, safe); // world box...
for (int plane_no = 0; plane_no < int(vp.GetCutawayPlanes().size()); plane_no++){
const G4Normal3D originalNormal(0,0,1); // ...so this is original normal.
const G4Plane3D& sp = vp.GetCutawayPlanes()[plane_no]; //];
const G4double& a = sp.a();
const G4double& b = sp.b();
const G4double& c = sp.c();
const G4double& d = sp.d();
const G4Normal3D newNormal(-a,-b,-c); // Convention: keep a*x+b*y+c*z+d>=0
// Not easy to see why the above gives the right convention, but it has been
// arrived at by trial and error to agree with the OpenGL implementation
// of clipping planes.
G4Transform3D requiredTransform; // Null transform
// Calculate the rotation
// If newNormal is (0,0,1), no need to do anything
// Treat (0,0,-1) as a special case, since cannot define axis in this case
if (newNormal == G4Normal3D(0,0,-1)) {
requiredTransform = G4Rotate3D(pi,G4Vector3D(1,0,0));
} else if (newNormal != originalNormal) {
const G4double& angle = std::acos(newNormal.dot(originalNormal));
const G4Vector3D& axis = originalNormal.cross(newNormal);
requiredTransform = G4Rotate3D(angle, axis);
}
// Translation
requiredTransform = requiredTransform * G4TranslateZ3D(d + safe);
cutaway_solids.push_back
(new G4DisplacedSolid("_displaced_cutaway_box", cutawayBox, requiredTransform));
}
if (cutaway_solids.size() == 1){
return (G4DisplacedSolid*) cutaway_solids[0];
} else if (vp.GetCutawayMode() == G4ViewParameters::cutawayUnion) {
G4UnionSolid* union2 =
new G4UnionSolid("_union_2", cutaway_solids[0], cutaway_solids[1]);
if (cutaway_solids.size() == 2)
return (G4DisplacedSolid*)union2;
else
return (G4DisplacedSolid*)
new G4UnionSolid("_union_3", union2, cutaway_solids[2]);
} else if (vp.GetCutawayMode() == G4ViewParameters::cutawayIntersection){
G4IntersectionSolid* intersection2 =
new G4IntersectionSolid("_intersection_2", cutaway_solids[0], cutaway_solids[1]);
if (cutaway_solids.size() == 2)
return (G4DisplacedSolid*)intersection2;
else
return (G4DisplacedSolid*)
new G4IntersectionSolid("_intersection_3", intersection2, cutaway_solids[2]);
}
}
return 0;
/*** An alternative way of getting a cutaway is to use
Command /vis/scene/add/volume
Guidance :
Adds a physical volume to current scene, with optional clipping volume.
If physical-volume-name is "world" (the default), the top of the
main geometry tree (material world) is added. If "worlds", the
top of all worlds - material world and parallel worlds, if any - are
added. Otherwise a search of all worlds is made, taking the first
matching occurrence only. To see a representation of the geometry
hierarchy of the worlds, try "/vis/drawTree [worlds]" or one of the
driver/browser combinations that have the required functionality, e.g., HepRep.
If clip-volume-type is specified, the subsequent parameters are used to
to define a clipping volume. For example,
"/vis/scene/add/volume ! ! ! -box km 0 1 0 1 0 1" will draw the world
with the positive octant cut away. (If the Boolean Processor issues
warnings try replacing 0 by 0.000000001 or something.)
If clip-volume-type is prepended with '-', the clip-volume is subtracted
(cutaway). (This is the default if there is no prepended character.)
If '*' is prepended, the intersection of the physical-volume and the
clip-volume is made. (You can make a section/DCUT with a thin box, for
example).
For "box", the parameters are xmin,xmax,ymin,ymax,zmin,zmax.
Only "box" is programmed at present.
***/
}
void G4VSceneHandler::LoadAtts(const G4Visible& visible, G4AttHolder* holder)
@@ -1126,7 +1192,7 @@ G4int G4VSceneHandler::GetNoOfSides(const G4VisAttributes* pVisAttribs)
lineSegmentsPerCircle = pVisAttribs->GetForcedLineSegmentsPerCircle();
if (lineSegmentsPerCircle < pVisAttribs->GetMinLineSegmentsPerCircle()) {
lineSegmentsPerCircle = pVisAttribs->GetMinLineSegmentsPerCircle();
G4cout <<
G4warn <<
"G4VSceneHandler::GetNoOfSides: attempt to set the"
"\nnumber of line segments per circle < " << lineSegmentsPerCircle
<< "; forced to " << pVisAttribs->GetMinLineSegmentsPerCircle() << G4endl;
@@ -1139,7 +1205,7 @@ std::ostream& operator << (std::ostream& os, const G4VSceneHandler& sh) {
os << "Scene handler " << sh.fName << " has "
<< sh.fViewerList.size () << " viewer(s):";
for (size_t i = 0; i < sh.fViewerList.size (); i++) {
for (std::size_t i = 0; i < sh.fViewerList.size (); ++i) {
os << "\n " << *(sh.fViewerList [i]);
}
@@ -1238,8 +1304,26 @@ void G4VSceneHandler::StandardSpecialMeshRendering(const G4Mesh& mesh)
case G4Mesh::sphere: [[fallthrough]];
case G4Mesh::invalid: break;
}
if (!implemented) {
G4VSceneHandler::AddCompound(mesh); // Base class function - just print warning
if (implemented) {
// Draw container if not marked invisible...
auto container = mesh.GetContainerVolume();
auto containerLogical = container->GetLogicalVolume();
auto containerVisAtts = containerLogical->GetVisAttributes();
if (containerVisAtts == nullptr || containerVisAtts->IsVisible()) {
auto solid = containerLogical->GetSolid();
auto polyhedron = solid->GetPolyhedron();
// Always draw as wireframe
G4VisAttributes tmpVisAtts;
if (containerVisAtts != nullptr) tmpVisAtts = *containerVisAtts;
tmpVisAtts.SetForceWireframe();
polyhedron->SetVisAttributes(tmpVisAtts);
BeginPrimitives(mesh.GetTransform());
AddPrimitive(*polyhedron);
EndPrimitives();
}
} else {
// Invoke base class function
G4VSceneHandler::AddCompound(mesh);
}
return;
}
@@ -1324,10 +1408,7 @@ void G4VSceneHandler::Draw3DRectMeshAsDots(const G4Mesh& mesh)
auto& dotsInMap = dotsByMaterial[material];
const auto& range = positionByMaterial.equal_range(material);
for (auto posByMat = range.first; posByMat != range.second; ++posByMat) {
const G4double x = posByMat->second.getX() + (2.*G4UniformRand()-1.)*halfX;
const G4double y = posByMat->second.getY() + (2.*G4UniformRand()-1.)*halfY;
const G4double z = posByMat->second.getZ() + (2.*G4UniformRand()-1.)*halfZ;
dotsInMap.push_back(G4ThreeVector(x,y,z));
dotsInMap.push_back(GetPointInBox(posByMat->second, halfX, halfY, halfZ));
++nDots;
}
@@ -1610,28 +1691,7 @@ void G4VSceneHandler::DrawTetMeshAsDots(const G4Mesh& mesh)
auto& dotsInMap = dotsByMaterial[material];
const auto& range = verticesByMaterial.equal_range(material);
for (auto vByMat = range.first; vByMat != range.second; ++vByMat) {
const std::vector<G4ThreeVector>& vertices = vByMat->second;
// Calculate extent/bounding box
G4double xmin, xmax, ymin, ymax, zmin, zmax;
xmin = ymin = zmin = DBL_MAX;
xmax = ymax = zmax = -DBL_MAX;
for (const auto& vertex: vertices) {
if (xmin > vertex.x()) xmin = vertex.x();
if (ymin > vertex.y()) ymin = vertex.y();
if (zmin > vertex.z()) zmin = vertex.z();
if (xmax < vertex.x()) xmax = vertex.x();
if (ymax < vertex.y()) ymax = vertex.y();
if (zmax < vertex.z()) zmax = vertex.z();
}
// Place dot at random in the extent/bounding box. Yes, I know this will
// be bigger than the tetrahedron, so sometimes the position will be outside
// the tetrahedron, but it will still give a reasonable visual representation.
// If you have a smart algorithm for generating a random point in a
// tetrahedron, please let us know.
const G4double x = xmin + G4UniformRand()*(xmax - xmin);
const G4double y = ymin + G4UniformRand()*(ymax - ymin);
const G4double z = zmin + G4UniformRand()*(zmax - zmin);
dotsInMap.push_back(G4ThreeVector(x,y,z));
dotsInMap.push_back(GetPointInTet(vByMat->second));
++nDots;
}
@@ -1719,8 +1779,6 @@ void G4VSceneHandler::DrawTetMeshAsSurfaces(const G4Mesh& mesh)
<< G4endl;
}
const auto& container = mesh.GetContainerVolume();
// This map is static so that once filled it stays filled.
static std::map<G4String,std::map<const G4Material*,G4Polyhedron>> surfacesByMaterialAndMesh;
auto& surfacesByMaterial = surfacesByMaterialAndMesh[mesh.GetContainerVolume()->GetName()];
@@ -1736,7 +1794,7 @@ void G4VSceneHandler::DrawTetMeshAsSurfaces(const G4Mesh& mesh)
tmpMP.SetCullingInvisible(true); // ... or invisble volumes.
const G4bool useFullExtent = true; // To avoid calculating the extent
G4PhysicalVolumeModel tmpPVModel
(container,
(mesh.GetContainerVolume(),
G4PhysicalVolumeModel::UNLIMITED,
G4Transform3D(), // so that positions are in local coordinates
&tmpMP,
@@ -1836,3 +1894,42 @@ void G4VSceneHandler::DrawTetMeshAsSurfaces(const G4Mesh& mesh)
firstPrint = false;
return;
}
G4ThreeVector
G4VSceneHandler::GetPointInBox(const G4ThreeVector& pos,
G4double halfX,
G4double halfY,
G4double halfZ) const
{
G4double x = pos.getX() + (2.*G4QuickRand() - 1.)*halfX;
G4double y = pos.getY() + (2.*G4QuickRand() - 1.)*halfY;
G4double z = pos.getZ() + (2.*G4QuickRand() - 1.)*halfZ;
return G4ThreeVector(x, y, z);
}
G4ThreeVector
G4VSceneHandler::GetPointInTet(const std::vector<G4ThreeVector>& vertices) const
{
G4double p = G4QuickRand();
G4double q = G4QuickRand();
G4double r = G4QuickRand();
if (p + q > 1.)
{
p = 1. - p;
q = 1. - q;
}
if (q + r > 1.)
{
G4double tmp = r;
r = 1. - p - q;
q = 1. - tmp;
}
else if (p + q + r > 1.)
{
G4double tmp = r;
r = p + q + r - 1.;
p = 1. - q - tmp;
}
G4double a = 1. - p - q - r;
return vertices[0]*a + vertices[1]*p + vertices[2]*q + vertices[3]*r;
}
@@ -135,8 +135,8 @@ void G4VViewer::SetTouchable
const auto& pvStore = G4PhysicalVolumeStore::GetInstance();
for (const auto& pvNodeId: fullPath) {
const auto& pv = pvNodeId.GetPhysicalVolume();
auto iterator = find(pvStore->begin(),pvStore->end(),pv);
if (iterator == pvStore->end()) {
auto iterator = find(pvStore->cbegin(),pvStore->cend(),pv);
if (iterator == pvStore->cend()) {
G4ExceptionDescription ed;
ed << "Volume no longer in physical volume store.";
G4Exception("G4VViewer::SetTouchable", "visman0501", JustWarning, ed);
@@ -155,12 +155,8 @@ void G4VViewer::TouchableSetVisibility
{
// Changes the Vis Attribute Modifiers WITHOUT triggering a rebuild.
std::ostringstream oss;
oss << "/vis/touchable/set/visibility ";
if (visibiity) oss << "true"; else oss << "false";
// The following is equivalent to
// G4UImanager::GetUIpointer()->ApplyCommand(oss.str());
// G4UImanager::GetUIpointer()->ApplyCommand("/vis/touchable/set/visibility ...");
// (assuming the touchable has already been set), but avoids view rebuild.
// Instantiate a working copy of a G4VisAttributes object...
@@ -176,11 +172,6 @@ void G4VViewer::TouchableSetVisibility
// G4ModelingParameters::VASVisibility (VAS = Vis Attribute Signifier)
// signifies that it is the visibility that should be picked out
// and merged with the touchable's normal vis attributes.
// Record on G4cout (with #) for information.
if (G4UImanager::GetUIpointer()->GetVerboseLevel() >= 2) {
G4cout << "# " << oss.str() << G4endl;
}
}
void G4VViewer::TouchableSetColour
@@ -189,13 +180,8 @@ void G4VViewer::TouchableSetColour
{
// Changes the Vis Attribute Modifiers WITHOUT triggering a rebuild.
std::ostringstream oss;
oss << "/vis/touchable/set/colour "
<< colour.GetRed() << ' ' << colour.GetGreen()
<< ' ' << colour.GetBlue() << ' ' << colour.GetAlpha();
// The following is equivalent to
// G4UImanager::GetUIpointer()->ApplyCommand(oss.str());
// G4UImanager::GetUIpointer()->ApplyCommand("/vis/touchable/set/colour ...");
// (assuming the touchable has already been set), but avoids view rebuild.
// Instantiate a working copy of a G4VisAttributes object...
@@ -211,11 +197,6 @@ void G4VViewer::TouchableSetColour
// G4ModelingParameters::VASColour (VAS = Vis Attribute Signifier)
// signifies that it is the colour that should be picked out
// and merged with the touchable's normal vis attributes.
// Record on G4cout (with #) for information.
if (G4UImanager::GetUIpointer()->GetVerboseLevel() >= 2) {
G4cout << "# " << oss.str() << G4endl;
}
}
std::vector <G4ThreeVector> G4VViewer::ComputeFlyThrough(G4Vector3D* /*aVect*/)
@@ -228,7 +209,7 @@ std::vector <G4ThreeVector> G4VViewer::ComputeFlyThrough(G4Vector3D* /*aVect*/)
// int myCurveType = Bezier;
// number if step points
int stepPoints = 500;
G4int stepPoints = 500;
G4Spline spline;
@@ -248,8 +229,8 @@ std::vector <G4ThreeVector> G4VViewer::ComputeFlyThrough(G4Vector3D* /*aVect*/)
// Draw the spline
for (int i = 0; i < stepPoints; i++) {
float t = (float)i / (float)stepPoints;
for (G4int i = 0; i < stepPoints; ++i) {
G4float t = (G4float)i / (G4float)stepPoints;
G4Vector3D cameraPosition = spline.GetInterpolatedSplinePoint(t);
// G4Vector3D targetPoint = spline.GetInterpolatedSplinePoint(t);
@@ -415,15 +396,15 @@ G4VViewer::G4Spline::~G4Spline()
{}
// Solve the Catmull-Rom parametric equation for a given time(t) and vector quadruple (p1,p2,p3,p4)
G4Vector3D G4VViewer::G4Spline::CatmullRom_Eq(float t, const G4Vector3D& p1, const G4Vector3D& p2, const G4Vector3D& p3, const G4Vector3D& p4)
G4Vector3D G4VViewer::G4Spline::CatmullRom_Eq(G4float t, const G4Vector3D& p1, const G4Vector3D& p2, const G4Vector3D& p3, const G4Vector3D& p4)
{
float t2 = t * t;
float t3 = t2 * t;
G4float t2 = t * t;
G4float t3 = t2 * t;
float b1 = .5 * ( -t3 + 2*t2 - t);
float b2 = .5 * ( 3*t3 - 5*t2 + 2);
float b3 = .5 * (-3*t3 + 4*t2 + t);
float b4 = .5 * ( t3 - t2 );
G4float b1 = .5 * ( -t3 + 2*t2 - t);
G4float b2 = .5 * ( 3*t3 - 5*t2 + 2);
G4float b3 = .5 * (-3*t3 + 4*t2 + t);
G4float b4 = .5 * ( t3 - t2 );
return (p1*b1 + p2*b2 + p3*b3 + p4*b4);
}
@@ -431,32 +412,32 @@ G4Vector3D G4VViewer::G4Spline::CatmullRom_Eq(float t, const G4Vector3D& p1, con
void G4VViewer::G4Spline::AddSplinePoint(const G4Vector3D& v)
{
vp.push_back(v);
delta_t = (float)1 / (float)vp.size();
delta_t = (G4float)1 / (G4float)vp.size();
}
G4Vector3D G4VViewer::G4Spline::GetPoint(int a)
G4Vector3D G4VViewer::G4Spline::GetPoint(G4int a)
{
return vp[a];
}
int G4VViewer::G4Spline::GetNumPoints()
G4int G4VViewer::G4Spline::GetNumPoints()
{
return vp.size();
return (G4int)vp.size();
}
G4Vector3D G4VViewer::G4Spline::GetInterpolatedSplinePoint(float t)
G4Vector3D G4VViewer::G4Spline::GetInterpolatedSplinePoint(G4float t)
{
// Find out in which interval we are on the spline
int p = (int)(t / delta_t);
G4int p = (G4int)(t / delta_t);
// Compute local control point indices
#define BOUNDS(pp) { if (pp < 0) pp = 0; else if (pp >= (int)vp.size()-1) pp = vp.size() - 1; }
int p0 = p - 1; BOUNDS(p0);
int p1 = p; BOUNDS(p1);
int p2 = p + 1; BOUNDS(p2);
int p3 = p + 2; BOUNDS(p3);
#define BOUNDS(pp) { if (pp < 0) pp = 0; else if (pp >= (G4int)vp.size()-1) pp = (G4int)vp.size() - 1; }
G4int p0 = p - 1; BOUNDS(p0);
G4int p1 = p; BOUNDS(p1);
G4int p2 = p + 1; BOUNDS(p2);
G4int p3 = p + 2; BOUNDS(p3);
// Relative (local) time
float lt = (t - delta_t*(float)p) / delta_t;
G4float lt = (t - delta_t*p) / delta_t;
// Interpolate
return CatmullRom_Eq(lt, vp[p0], vp[p1], vp[p2], vp[p3]);
}
@@ -39,6 +39,8 @@
#include "G4PhysicalVolumeModel.hh"
#include "G4LogicalVolume.hh"
#define G4warn G4cout
G4int G4VVisCommand::fCurrentArrow3DLineSegmentsPerCircle = 6;
G4Colour G4VVisCommand::fCurrentColour = G4Colour::White();
G4Colour G4VVisCommand::fCurrentTextColour = G4Colour::Blue();
@@ -101,7 +103,7 @@ G4bool G4VVisCommand::ConvertToDoublePair(const G4String& paramString,
} else {
G4VisManager::Verbosity verbosity = fpVisManager->GetVerbosity();
if (verbosity >= G4VisManager::errors) {
G4cout << "ERROR: Unrecognised unit" << G4endl;
G4warn << "ERROR: Unrecognised unit" << G4endl;
}
return false;
}
@@ -136,14 +138,14 @@ void G4VVisCommand::ConvertToColour
G4VisManager::Verbosity verbosity = fpVisManager->GetVerbosity();
const size_t iPos0 = 0;
const std::size_t iPos0 = 0;
if (std::isalpha(redOrString[iPos0])) {
// redOrString is probably alphabetic characters defining the colour
if (!G4Colour::GetColour(redOrString, colour)) {
// Not a recognised string
if (verbosity >= G4VisManager::warnings) {
G4cout << "WARNING: Colour \"" << redOrString
G4warn << "WARNING: Colour \"" << redOrString
<< "\" not found. Defaulting to " << colour
<< G4endl;
}
@@ -162,7 +164,7 @@ void G4VVisCommand::ConvertToColour
iss >> red;
if (iss.fail()) {
if (verbosity >= G4VisManager::warnings) {
G4cout << "WARNING: String \"" << redOrString
G4warn << "WARNING: String \"" << redOrString
<< "\" cannot be parsed. Defaulting to " << colour
<< G4endl;
}
@@ -188,17 +190,17 @@ G4bool G4VVisCommand::ProvideValueOfUnit
G4bool success = true;
if (!G4UnitDefinition::IsUnitDefined(unit)) {
if (verbosity >= G4VisManager::warnings) {
G4cerr << where
G4warn << where
<< "\n Unit \"" << unit << "\" not defined"
<< G4endl;
}
success = false;
} else if (G4UnitDefinition::GetCategory(unit) != category) {
if (verbosity >= G4VisManager::warnings) {
G4cerr << where
G4warn << where
<< "\n Unit \"" << unit << "\" not a unit of " << category;
if (category == "Volumic Mass") G4cerr << " (density)";
G4cerr << G4endl;
if (category == "Volumic Mass") G4warn << " (density)";
G4warn << G4endl;
}
success = false;
} else {
@@ -213,7 +215,7 @@ void G4VVisCommand::CheckSceneAndNotifyHandlers(G4Scene* pScene)
if (!pScene) {
if (verbosity >= G4VisManager::warnings) {
G4cout << "WARNING: Scene pointer is null."
G4warn << "WARNING: Scene pointer is null."
<< G4endl;
}
return;
@@ -222,7 +224,7 @@ void G4VVisCommand::CheckSceneAndNotifyHandlers(G4Scene* pScene)
G4VSceneHandler* pSceneHandler = fpVisManager -> GetCurrentSceneHandler();
if (!pSceneHandler) {
if (verbosity >= G4VisManager::warnings) {
G4cout << "WARNING: Scene handler not found." << G4endl;
G4warn << "WARNING: Scene handler not found." << G4endl;
}
return;
}
@@ -244,7 +246,7 @@ G4bool G4VVisCommand::CheckView ()
if (!viewer) {
if (verbosity >= G4VisManager::errors) {
G4cerr <<
G4warn <<
"ERROR: No current viewer - \"/vis/viewer/list\" to see possibilities."
<< G4endl;
}
@@ -258,7 +260,7 @@ void G4VVisCommand::G4VisCommandsSceneAddUnsuccessful
(G4VisManager::Verbosity verbosity) {
// Some frequently used error printing...
if (verbosity >= G4VisManager::warnings) {
G4cout <<
G4warn <<
"WARNING: For some reason, possibly mentioned above, it has not been"
"\n possible to add to the scene."
<< G4endl;
@@ -281,7 +283,7 @@ void G4VVisCommand::RefreshIfRequired(G4VViewer* viewer) {
}
else {
if (verbosity >= G4VisManager::warnings) {
G4cout << "Issue /vis/viewer/refresh or flush to see effect."
G4warn << "Issue /vis/viewer/refresh or flush to see effect."
<< G4endl;
}
}
@@ -295,7 +297,7 @@ void G4VVisCommand::InterpolateViews
const G4int waitTimePerPointmilliseconds,
const G4String exportString)
{
const G4int safety = viewVector.size()*nInterpolationPoints;
const G4int safety = (G4int)viewVector.size()*nInterpolationPoints;
G4int safetyCount = 0;
do {
G4ViewParameters* vp =
@@ -395,7 +397,7 @@ void G4VVisCommand::CopyGuidanceFrom
(const G4UIcommand* fromCmd, G4UIcommand* toCmd, G4int startLine)
{
if (fromCmd && toCmd) {
const G4int nGuideEntries = fromCmd->GetGuidanceEntries();
const G4int nGuideEntries = (G4int)fromCmd->GetGuidanceEntries();
for (G4int i = startLine; i < nGuideEntries; ++i) {
const G4String& guidance = fromCmd->GetGuidanceLine(i);
toCmd->SetGuidance(guidance);
@@ -407,7 +409,7 @@ void G4VVisCommand::CopyParametersFrom
(const G4UIcommand* fromCmd, G4UIcommand* toCmd)
{
if (fromCmd && toCmd) {
const G4int nParEntries = fromCmd->GetParameterEntries();
const G4int nParEntries = (G4int)fromCmd->GetParameterEntries();
for (G4int i = 0; i < nParEntries; ++i) {
G4UIparameter* parameter = new G4UIparameter(*(fromCmd->GetParameter(i)));
toCmd->SetParameter(parameter);
@@ -40,6 +40,8 @@
#include <sstream>
#include <cmath>
#define G4warn G4cout
G4ViewParameters::G4ViewParameters ():
fDrawingStyle (wireframe),
fNumberOfCloudPoints(10000),
@@ -184,7 +186,7 @@ void G4ViewParameters::AddCutawayPlane (const G4Plane3D& cutawayPlane) {
fCutawayPlanes.push_back (cutawayPlane);
}
else {
G4cerr <<
G4warn <<
"ERROR: G4ViewParameters::AddCutawayPlane:"
"\n A maximum of 3 cutaway planes supported." << G4endl;
}
@@ -193,7 +195,7 @@ void G4ViewParameters::AddCutawayPlane (const G4Plane3D& cutawayPlane) {
void G4ViewParameters::ChangeCutawayPlane
(size_t index, const G4Plane3D& cutawayPlane) {
if (index >= fCutawayPlanes.size()) {
G4cerr <<
G4warn <<
"ERROR: G4ViewParameters::ChangeCutawayPlane:"
"\n Plane " << index << " does not exist." << G4endl;
} else {
@@ -204,12 +206,12 @@ void G4ViewParameters::ChangeCutawayPlane
void G4ViewParameters::SetVisibleDensity (G4double visibleDensity) {
const G4double reasonableMaximum = 10.0 * g / cm3;
if (visibleDensity < 0) {
G4cout << "G4ViewParameters::SetVisibleDensity: attempt to set negative "
G4warn << "G4ViewParameters::SetVisibleDensity: attempt to set negative "
"density - ignored." << G4endl;
}
else {
if (visibleDensity > reasonableMaximum) {
G4cout << "G4ViewParameters::SetVisibleDensity: density > "
G4warn << "G4ViewParameters::SetVisibleDensity: density > "
<< G4BestUnit (reasonableMaximum, "Volumic Mass")
<< " - did you mean this?"
<< G4endl;
@@ -222,7 +224,7 @@ G4int G4ViewParameters::SetNoOfSides (G4int nSides) {
const G4int nSidesMin = fDefaultVisAttributes.GetMinLineSegmentsPerCircle();
if (nSides < nSidesMin) {
nSides = nSidesMin;
G4cout << "G4ViewParameters::SetNoOfSides: attempt to set the"
G4warn << "G4ViewParameters::SetNoOfSides: attempt to set the"
"\nnumber of sides per circle < " << nSidesMin
<< "; forced to " << nSides << G4endl;
}
@@ -234,7 +236,7 @@ G4int G4ViewParameters::SetNumberOfCloudPoints(G4int nPoints) {
const G4int nPointsMin = 100;
if (nPoints < nPointsMin) {
nPoints = nPointsMin;
G4cout << "G4ViewParameters::SetNumberOfCloudPoints:"
G4warn << "G4ViewParameters::SetNumberOfCloudPoints:"
"\nnumber of points per cloud set to minimum " << nPoints
<< G4endl;
}
@@ -253,7 +255,7 @@ void G4ViewParameters::SetViewAndLights
static G4bool firstTime = true;
if (firstTime) {
firstTime = false;
G4cout <<
G4warn <<
"WARNING: Viewpoint direction is very close to the up vector direction."
"\n Change the up vector or \"/vis/viewer/set/rotationStyle freeRotation\"."
<< G4endl;
@@ -1259,7 +1261,7 @@ void G4ViewParameters::SetXGeometryString (const G4String& geomString)
// if there is only Width. Special case to be backward compatible
// We set Width and Height the same to obtain a square windows.
G4cout << "Unrecognised geometry string \""
G4warn << "Unrecognised geometry string \""
<< geomString
<< "\". No Height found. Using Width value instead"
<< G4endl;
@@ -47,6 +47,8 @@
#include "G4PhysicalVolumeModel.hh"
#include "G4AttDef.hh"
#define G4warn G4cout
////////////// /vis/abortReviewKeptEvents /////////////////////////////
G4VisCommandAbortReviewKeptEvents::G4VisCommandAbortReviewKeptEvents () {
@@ -69,7 +71,7 @@ G4String G4VisCommandAbortReviewKeptEvents::GetCurrentValue (G4UIcommand*) {
void G4VisCommandAbortReviewKeptEvents::SetNewValue (G4UIcommand*,
G4String newValue) {
fpVisManager->SetAbortReviewKeptEvents(G4UIcommand::ConvertToBool(newValue));
G4cout << "Type \"continue\" to complete the abort." << G4endl;
G4warn << "Type \"continue\" to complete the abort." << G4endl;
}
////////////// /vis/abortReviewPlots /////////////////////////////
@@ -94,7 +96,7 @@ G4String G4VisCommandAbortReviewPlots::GetCurrentValue (G4UIcommand*) {
void G4VisCommandAbortReviewPlots::SetNewValue (G4UIcommand*,
G4String newValue) {
fpVisManager->SetAbortReviewPlots(G4UIcommand::ConvertToBool(newValue));
G4cout << "Type \"continue\" to complete the abort." << G4endl;
G4warn << "Type \"continue\" to complete the abort." << G4endl;
}
////////////// /vis/drawOnlyToBeKeptEvents /////////////////////////////
@@ -131,9 +133,9 @@ void G4VisCommandDrawOnlyToBeKeptEvents::SetNewValue (G4UIcommand*,
G4VisManager::Verbosity verbosity = fpVisManager->GetVerbosity();
if (verbosity < G4VisManager::warnings) {
if (fpVisManager->GetDrawEventOnlyIfToBeKept()) {
G4cout << "Only events that have been kept will be drawn." << G4endl;
G4warn << "Only events that have been kept will be drawn." << G4endl;
} else {
G4cout << "All events will be drawn." << G4endl;
G4warn << "All events will be drawn." << G4endl;
}
}
}
@@ -299,7 +301,7 @@ G4String G4VisCommandReviewKeptEvents::GetCurrentValue (G4UIcommand*)
void G4VisCommandReviewKeptEvents::SetNewValue (G4UIcommand*, G4String newValue)
{
if (fpVisManager->GetReviewingKeptEvents()) {
G4cout <<
G4warn <<
"\"/vis/reviewKeptEvents\" not allowed within an already started review."
"\n No action taken."
<< G4endl;
@@ -317,7 +319,7 @@ void G4VisCommandReviewKeptEvents::SetNewValue (G4UIcommand*, G4String newValue)
if (!nKeptEvents) {
if (verbosity >= G4VisManager::errors) {
G4cerr <<
G4warn <<
"ERROR: G4VisCommandReviewKeptEvents::SetNewValue: No kept events,"
"\n or kept events not accessible."
<< G4endl;
@@ -328,7 +330,7 @@ void G4VisCommandReviewKeptEvents::SetNewValue (G4UIcommand*, G4String newValue)
G4VViewer* viewer = fpVisManager->GetCurrentViewer();
if (!viewer) {
if (verbosity >= G4VisManager::errors) {
G4cerr <<
G4warn <<
"ERROR: No current viewer - \"/vis/viewer/list\" to see possibilities."
<< G4endl;
}
@@ -338,7 +340,7 @@ void G4VisCommandReviewKeptEvents::SetNewValue (G4UIcommand*, G4String newValue)
G4Scene* pScene = fpVisManager->GetCurrentScene();
if (!pScene) {
if (verbosity >= G4VisManager::errors) {
G4cerr << "ERROR: No current scene. Please create one." << G4endl;
G4warn << "ERROR: No current scene. Please create one." << G4endl;
}
return;
}
@@ -367,13 +369,13 @@ void G4VisCommandReviewKeptEvents::SetNewValue (G4UIcommand*, G4String newValue)
for (size_t i = 0; i < nKeptEvents; ++i) {
const G4Event* event = (*events)[i];
if (verbosity >= G4VisManager::warnings) {
G4cout << "Drawing event : " << event->GetEventID() <<
G4warn << "Drawing event : " << event->GetEventID() <<
". At EndOfEvent, enter any command, then \"cont[inue]\"..."
<< G4endl;
static G4bool first = true;
if (first) {
first = false;
G4cout <<
G4warn <<
" Useful commands might be:"
"\n \"/vis/scene/add/trajectories\" if not already added."
"\n \"/vis/viewer/...\" to change the view (zoom, set/viewpoint,...)."
@@ -413,7 +415,7 @@ void G4VisCommandReviewKeptEvents::SetNewValue (G4UIcommand*, G4String newValue)
for (size_t i = 0; i < nKeptEvents; ++i) {
const G4Event* event = (*events)[i];
if (verbosity >= G4VisManager::warnings) {
G4cout << "Drawing event : " << event->GetEventID()
G4warn << "Drawing event : " << event->GetEventID()
<< " with macro file \"" << macroFileName << G4endl;
}
fpVisManager->SetRequestedEvent(event);
@@ -496,7 +498,7 @@ namespace {
void G4VisCommandReviewPlots::SetNewValue (G4UIcommand*, G4String)
{
if (fpVisManager->GetReviewingPlots()) {
G4cout <<
G4warn <<
"\"/vis/reviewPlots\" not allowed within an already started review."
"\n No action taken."
<< G4endl;
@@ -508,7 +510,7 @@ void G4VisCommandReviewPlots::SetNewValue (G4UIcommand*, G4String)
auto currentViewer = fpVisManager->GetCurrentViewer();
if (!currentViewer) {
if (verbosity >= G4VisManager::errors) {
G4cerr <<
G4warn <<
"ERROR: No current viewer - \"/vis/viewer/list\" to see possibilities."
<< G4endl;
}
@@ -516,7 +518,7 @@ void G4VisCommandReviewPlots::SetNewValue (G4UIcommand*, G4String)
}
if (currentViewer->GetName().find("TOOLSSG") == std::string::npos) {
G4cerr <<
G4warn <<
"WARNING: Current viewer not able to draw plots."
"\n Try \"/vis/open TSG\", then \"/vis/reviewPlots\" again."
<< G4endl;
@@ -526,7 +528,7 @@ void G4VisCommandReviewPlots::SetNewValue (G4UIcommand*, G4String)
G4Scene* pScene = fpVisManager->GetCurrentScene();
if (!pScene) {
if (verbosity >= G4VisManager::errors) {
G4cerr << "ERROR: No current scene. Please create one." << G4endl;
G4warn << "ERROR: No current scene. Please create one." << G4endl;
}
return;
}
@@ -37,6 +37,8 @@
#include <sstream>
#include <set>
#define G4warn G4cout
////////////// /vis/drawTree ///////////////////////////////////////
G4VisCommandDrawTree::G4VisCommandDrawTree() {
@@ -112,7 +114,7 @@ void G4VisCommandDrawTree::SetNewValue(G4UIcommand*, G4String newValue) {
}
if (keepViewer) {
if (fpVisManager->GetVerbosity() >= G4VisManager::warnings) {
G4cout << "Reverting to " << keepViewer->GetName() << G4endl;
G4warn << "Reverting to " << keepViewer->GetName() << G4endl;
}
fpVisManager->SetCurrentGraphicsSystem(keepSystem);
fpVisManager->SetCurrentScene(keepScene);
@@ -168,7 +170,7 @@ void G4VisCommandDrawView::SetNewValue(G4UIcommand*, G4String newValue) {
G4VViewer* currentViewer = fpVisManager->GetCurrentViewer();
if (!currentViewer) {
if (verbosity >= G4VisManager::warnings) {
G4cout <<
G4warn <<
"WARNING: G4VisCommandsDrawView::SetNewValue: no current viewer."
<< G4endl;
}
@@ -188,12 +190,6 @@ void G4VisCommandDrawView::SetNewValue(G4UIcommand*, G4String newValue) {
>> zoomFactor >> dolly >> dollyUnit;
G4UImanager* UImanager = G4UImanager::GetUIpointer();
G4int keepVerbose = UImanager->GetVerboseLevel();
G4int newVerbose(0);
if (keepVerbose >= 2 ||
fpVisManager->GetVerbosity() >= G4VisManager::confirmations)
newVerbose = 2;
UImanager->SetVerboseLevel(newVerbose);
G4ViewParameters vp = currentViewer->GetViewParameters();
G4bool keepAutoRefresh = vp.IsAutoRefresh();
vp.SetAutoRefresh(false);
@@ -209,7 +205,6 @@ void G4VisCommandDrawView::SetNewValue(G4UIcommand*, G4String newValue) {
currentViewer->SetViewParameters(vp);
UImanager->ApplyCommand(
G4String("/vis/viewer/dollyTo " + dolly + " " + dollyUnit));
UImanager->SetVerboseLevel(keepVerbose);
}
////////////// /vis/drawLogicalVolume ///////////////////////////////////////
@@ -238,11 +233,6 @@ G4VisCommandDrawLogicalVolume::~G4VisCommandDrawLogicalVolume() {
void G4VisCommandDrawLogicalVolume::SetNewValue(G4UIcommand*, G4String newValue) {
G4VisManager::Verbosity verbosity = fpVisManager->GetVerbosity();
G4UImanager* UImanager = G4UImanager::GetUIpointer();
G4int keepVerbose = UImanager->GetVerboseLevel();
G4int newVerbose(0);
if (keepVerbose >= 2 || verbosity >= G4VisManager::confirmations)
newVerbose = 2;
UImanager->SetVerboseLevel(newVerbose);
G4VViewer* currentViewer = fpVisManager->GetCurrentViewer();
const G4ViewParameters& currentViewParams = currentViewer->GetViewParameters();
G4bool keepAutoRefresh = currentViewParams.IsAutoRefresh();
@@ -256,10 +246,9 @@ void G4VisCommandDrawLogicalVolume::SetNewValue(G4UIcommand*, G4String newValue)
G4bool keepMarkerNotHidden = currentViewParams.IsMarkerNotHidden();
if (!keepMarkerNotHidden) UImanager->ApplyCommand("/vis/viewer/set/hiddenMarker false");
if (keepAutoRefresh) UImanager->ApplyCommand("/vis/viewer/set/autoRefresh true");
UImanager->SetVerboseLevel(keepVerbose);
if (verbosity >= G4VisManager::warnings) {
if (keepDrawingStyle != currentViewParams.GetDrawingStyle()) {
G4cout
G4warn
<< "Drawing style changed to wireframe. To restore previous style:";
G4String style, edge;
switch (keepDrawingStyle) {
@@ -274,12 +263,12 @@ void G4VisCommandDrawLogicalVolume::SetNewValue(G4UIcommand*, G4String newValue)
case G4ViewParameters::cloud:
style = "cloud"; edge = ""; break;
}
G4cout << "\n /vis/viewer/set/style " + style;
if (!edge.empty()) G4cout << "\n /vis/viewer/set/hiddenEdge " + edge;
G4cout << G4endl;
G4warn << "\n /vis/viewer/set/style " + style;
if (!edge.empty()) G4warn << "\n /vis/viewer/set/hiddenEdge " + edge;
G4warn << G4endl;
}
if (keepMarkerNotHidden != currentViewParams.IsMarkerNotHidden()) {
G4cout
G4warn
<< "Markers changed to \"not hidden\". To restore previous condition:"
<< "\n /vis/viewer/set/hiddenmarker true"
<< G4endl;
@@ -317,15 +306,9 @@ G4VisCommandDrawVolume::~G4VisCommandDrawVolume() {
void G4VisCommandDrawVolume::SetNewValue(G4UIcommand*, G4String newValue) {
G4VisManager::Verbosity verbosity = fpVisManager->GetVerbosity();
G4UImanager* UImanager = G4UImanager::GetUIpointer();
G4int keepVerbose = UImanager->GetVerboseLevel();
G4int newVerbose(0);
if (keepVerbose >= 2 || verbosity >= G4VisManager::confirmations)
newVerbose = 2;
UImanager->SetVerboseLevel(newVerbose);
UImanager->ApplyCommand("/vis/scene/create");
UImanager->ApplyCommand(G4String("/vis/scene/add/volume " + newValue));
UImanager->ApplyCommand("/vis/sceneHandler/attach");
UImanager->SetVerboseLevel(keepVerbose);
static G4bool warned = false;
if (verbosity >= G4VisManager::confirmations && !warned) {
G4cout <<
@@ -384,12 +367,6 @@ void G4VisCommandOpen::SetNewValue (G4UIcommand* command, G4String newValue)
std::istringstream is(newValue);
is >> systemName >> windowSizeHint;
G4UImanager* UImanager = G4UImanager::GetUIpointer();
G4int keepVerbose = UImanager->GetVerboseLevel();
G4int newVerbose(0);
if (keepVerbose >= 2 ||
fpVisManager->GetVerbosity() >= G4VisManager::confirmations)
newVerbose = 2;
UImanager->SetVerboseLevel(newVerbose);
auto errorCode = UImanager->ApplyCommand(G4String("/vis/sceneHandler/create " + systemName));
if (errorCode) {
@@ -413,8 +390,6 @@ finish:
fpVisManager->PrintAvailableGraphicsSystems(G4VisManager::warnings,ed);
command->CommandFailed(errorCode,ed);
}
UImanager->SetVerboseLevel(keepVerbose);
}
////////////// /vis/plot ///////////////////////////////////////
@@ -447,7 +422,7 @@ void G4VisCommandPlot::SetNewValue (G4UIcommand*, G4String newValue)
{
auto currentViewer = fpVisManager->GetCurrentViewer();
if (currentViewer->GetName().find("TOOLSSG") == std::string::npos) {
G4cerr <<
G4warn <<
"WARNING: Current viewer not able to draw plots."
"\n Try \"/vis/open TSG\", then \"/vis/plot " << newValue << "\" again."
<< G4endl;
@@ -476,7 +451,7 @@ void G4VisCommandPlot::SetNewValue (G4UIcommand*, G4String newValue)
if (!keepEnable) {
fpVisManager->Disable();
G4cerr <<
G4warn <<
"WARNING: drawing was enabled for plotting but is now restored to disabled mode."
<< G4endl;
}
@@ -533,16 +508,10 @@ G4VisCommandSpecify::~G4VisCommandSpecify() {
void G4VisCommandSpecify::SetNewValue(G4UIcommand*, G4String newValue) {
G4VisManager::Verbosity verbosity = fpVisManager->GetVerbosity();
G4UImanager* UImanager = G4UImanager::GetUIpointer();
G4int keepVerbose = UImanager->GetVerboseLevel();
G4int newVerbose(0);
if (keepVerbose >= 2 || verbosity >= G4VisManager::confirmations)
newVerbose = 2;
UImanager->SetVerboseLevel(newVerbose);
// UImanager->ApplyCommand(G4String("/geometry/print " + newValue));
UImanager->ApplyCommand("/vis/scene/create");
UImanager->ApplyCommand(G4String("/vis/scene/add/logicalVolume " + newValue));
UImanager->ApplyCommand("/vis/sceneHandler/attach");
UImanager->SetVerboseLevel(keepVerbose);
static G4bool warned = false;
if (verbosity >= G4VisManager::confirmations && !warned) {
G4cout <<
@@ -34,6 +34,8 @@
#include "G4LogicalVolumeStore.hh"
#include "G4UImanager.hh"
#define G4warn G4cout
std::map<G4LogicalVolume*, const G4VisAttributes*>
G4VVisCommandGeometry::fVisAttsMap;
@@ -86,7 +88,7 @@ void G4VisCommandGeometryList::SetNewValue(G4UIcommand*, G4String newValue)
}
if (newValue != "all" && !found) {
if (fpVisManager->GetVerbosity() >= G4VisManager::errors) {
G4cerr << "ERROR: Logical volume \"" << newValue
G4warn << "ERROR: Logical volume \"" << newValue
<< "\" not found in logical volume store." << G4endl;
}
return;
@@ -143,7 +145,7 @@ void G4VisCommandGeometryRestore::SetNewValue(G4UIcommand*, G4String newValue)
}
if (newValue != "all" && !found) {
if (verbosity >= G4VisManager::errors) {
G4cerr << "ERROR: Logical volume \"" << newValue
G4warn << "ERROR: Logical volume \"" << newValue
<< "\" not found in logical volume store." << G4endl;
}
return;
@@ -36,6 +36,8 @@
#include <sstream>
#define G4warn G4cout
void G4VVisCommandGeometrySet::Set
(G4String requestedName,
const G4VVisCommandGeometrySetFunction& setFunction,
@@ -44,7 +46,7 @@ void G4VVisCommandGeometrySet::Set
G4VisManager::Verbosity verbosity = fpVisManager->GetVerbosity();
G4LogicalVolumeStore* pLVStore = G4LogicalVolumeStore::GetInstance();
G4bool found = false;
for (size_t iLV = 0; iLV < pLVStore->size(); iLV++ ) {
for (std::size_t iLV = 0; iLV < pLVStore->size(); ++iLV ) {
G4LogicalVolume* pLV = (*pLVStore)[iLV];
const G4String& logVolName = pLV->GetName();
if (logVolName == requestedName) found = true;
@@ -54,7 +56,7 @@ void G4VVisCommandGeometrySet::Set
}
if (requestedName != "all" && !found) {
if (verbosity >= G4VisManager::errors) {
G4cerr << "ERROR: Logical volume \"" << requestedName
G4warn << "ERROR: Logical volume \"" << requestedName
<< "\" not found in logical volume store." << G4endl;
}
return;
@@ -102,7 +104,7 @@ void G4VVisCommandGeometrySet::SetLVVisAtts
<< G4endl;
}
if (requestedDepth < 0 || depth < requestedDepth) {
G4int nDaughters = pLV->GetNoDaughters();
G4int nDaughters = (G4int)pLV->GetNoDaughters();
for (G4int i = 0; i < nDaughters; ++i) {
SetLVVisAtts(pLV->GetDaughter(i)->GetLogicalVolume(),
setFunction, ++depth, requestedDepth);
@@ -218,7 +220,7 @@ void G4VisCommandGeometrySetDaughtersInvisible::SetNewValue
if (requestedDepth !=0) {
requestedDepth = 0;
if (fpVisManager->GetVerbosity() >= G4VisManager::warnings) {
G4cout << "Recursive application suppressed for this attribute."
G4warn << "Recursive application suppressed for this attribute."
<< G4endl;
}
}
@@ -232,7 +234,7 @@ void G4VisCommandGeometrySetDaughtersInvisible::SetNewValue
const G4ViewParameters& viewParams = pViewer->GetViewParameters();
if (fpVisManager->GetVerbosity() >= G4VisManager::warnings) {
if (!viewParams.IsCulling()) {
G4cout <<
G4warn <<
"Culling must be on - \"/vis/viewer/set/culling global true\" - to see effect."
<< G4endl;
}
@@ -658,7 +660,7 @@ void G4VisCommandGeometrySetVisibility::SetNewValue
if (fpVisManager->GetVerbosity() >= G4VisManager::warnings) {
if (!viewParams.IsCulling() ||
!viewParams.IsCullingInvisible()) {
G4cout <<
G4warn <<
"Culling must be on - \"/vis/viewer/set/culling global true\" and"
"\n \"/vis/viewer/set/culling invisible true\" - to see effect."
<< G4endl;
@@ -681,7 +683,7 @@ void G4VisCommandGeometrySetVisibility::SetNewValueOnLV
if (fpVisManager->GetVerbosity() >= G4VisManager::warnings) {
if (!viewParams.IsCulling() ||
!viewParams.IsCullingInvisible()) {
G4cout <<
G4warn <<
"Culling must be on - \"/vis/viewer/set/culling global true\" and"
"\n \"/vis/viewer/set/culling invisible true\" - to see effect."
<< G4endl;
@@ -34,6 +34,8 @@
#include <sstream>
#define G4warn G4cout
/////////////////////////////////////////////////////////////////////////////
////////////// /vis/plotter/create //////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
@@ -162,7 +164,7 @@ void G4VisCommandPlotterAddRegionStyle::SetNewValue (G4UIcommand*, G4String newV
is >> plotter >> region >> style;
if(region<0) {
if (verbosity >= G4VisManager::errors) {
G4cerr << "ERROR: bad region index " << region << "." << G4endl;
G4warn << "ERROR: bad region index " << region << "." << G4endl;
}
return;
}
@@ -205,7 +207,7 @@ void G4VisCommandPlotterAddRegionParameter::SetNewValue (G4UIcommand* command, G
tools::double_quotes_tokenize(newValue, args);
if ( args.size() != command->GetParameterEntries() ) { // check consistency.
if (verbosity >= G4VisManager::errors) {
G4cerr << "ERROR: tokenize value problem." << G4endl;
G4warn << "ERROR: tokenize value problem." << G4endl;
}
return;
}
@@ -216,7 +218,7 @@ void G4VisCommandPlotterAddRegionParameter::SetNewValue (G4UIcommand* command, G
std::string value = args[3];
if(region<0) {
if (verbosity >= G4VisManager::errors) {
G4cerr << "ERROR: bad region index " << region << "." << G4endl;
G4warn << "ERROR: bad region index " << region << "." << G4endl;
}
return;
}
@@ -279,7 +281,7 @@ void G4VisCommandPlotterClearRegion::SetNewValue (G4UIcommand*, G4String newValu
is >> plotter >> region;
if(region<0) {
if (verbosity >= G4VisManager::errors) {
G4cerr << "ERROR: bad region index " << region << "." << G4endl;
G4warn << "ERROR: bad region index " << region << "." << G4endl;
}
return;
}
@@ -339,7 +341,7 @@ void G4VisCommandPlotterAddRegionH1::SetNewValue (G4UIcommand*, G4String newValu
if(region<0) {
if (verbosity >= G4VisManager::errors) {
G4cerr << "ERROR: bad region index " << region << "." << G4endl;
G4warn << "ERROR: bad region index " << region << "." << G4endl;
}
return;
}
@@ -384,7 +386,7 @@ void G4VisCommandPlotterAddRegionH2::SetNewValue (G4UIcommand*, G4String newValu
if(region<0) {
if (verbosity >= G4VisManager::errors) {
G4cerr << "ERROR: bad region index " << region << "." << G4endl;
G4warn << "ERROR: bad region index " << region << "." << G4endl;
}
return;
}
@@ -43,6 +43,8 @@
#include "G4ios.hh"
#include <sstream>
#define G4warn G4cout
G4VVisCommandScene::G4VVisCommandScene () {}
G4VVisCommandScene::~G4VVisCommandScene () {}
@@ -97,7 +99,7 @@ void G4VisCommandSceneActivateModel::SetNewValue (G4UIcommand*,
G4Scene* pScene = fpVisManager->GetCurrentScene();
if (!pScene) {
if (verbosity >= G4VisManager::errors) {
G4cerr << "ERROR: No current scene. Please create one." << G4endl;
G4warn << "ERROR: No current scene. Please create one." << G4endl;
}
return;
}
@@ -105,14 +107,14 @@ void G4VisCommandSceneActivateModel::SetNewValue (G4UIcommand*,
G4VSceneHandler* pSceneHandler = fpVisManager->GetCurrentSceneHandler();
if (!pSceneHandler) {
if (verbosity >= G4VisManager::errors) {
G4cerr << "ERROR: No current sceneHandler. Please create one." << G4endl;
G4warn << "ERROR: No current sceneHandler. Please create one." << G4endl;
}
return;
}
if (searchString == "all" && !activate) {
if (verbosity >= G4VisManager::warnings) {
G4cout <<
G4warn <<
"WARNING: You are not allowed to de-activate all models."
"\n Command ignored."
<< G4endl;
@@ -132,10 +134,10 @@ void G4VisCommandSceneActivateModel::SetNewValue (G4UIcommand*,
any = true;
runDurationModelList[i].fActive = activate;
if (verbosity >= G4VisManager::warnings) {
G4cout << "Model \"" << modelName;
if (activate) G4cout << "\" activated.";
else G4cout << "\" de-activated.";
G4cout << G4endl;
G4warn << "Model \"" << modelName;
if (activate) G4warn << "\" activated.";
else G4warn << "\" de-activated.";
G4warn << G4endl;
}
}
}
@@ -150,10 +152,10 @@ void G4VisCommandSceneActivateModel::SetNewValue (G4UIcommand*,
any = true;
endOfEventModelList[i].fActive = activate;
if (verbosity >= G4VisManager::warnings) {
G4cout << "Model \"" << modelName;
if (activate) G4cout << "\" activated.";
else G4cout << "\" de-activated.";
G4cout << G4endl;
G4warn << "Model \"" << modelName;
if (activate) G4warn << "\" activated.";
else G4warn << "\" de-activated.";
G4warn << G4endl;
}
}
}
@@ -168,17 +170,17 @@ void G4VisCommandSceneActivateModel::SetNewValue (G4UIcommand*,
any = true;
endOfRunModelList[i].fActive = activate;
if (verbosity >= G4VisManager::warnings) {
G4cout << "Model \"" << modelName;
if (activate) G4cout << "\" activated.";
else G4cout << "\" de-activated.";
G4cout << G4endl;
G4warn << "Model \"" << modelName;
if (activate) G4warn << "\" activated.";
else G4warn << "\" de-activated.";
G4warn << G4endl;
}
}
}
if (!any) {
if (verbosity >= G4VisManager::warnings) {
G4cout << "WARNING: No match found." << G4endl;
G4warn << "WARNING: No match found." << G4endl;
}
return;
}
@@ -225,13 +227,13 @@ void G4VisCommandSceneCreate::SetNewValue (G4UIcommand*, G4String newValue) {
if (newName == nextName) fId++;
G4SceneList& sceneList = fpVisManager -> SetSceneList ();
G4int iScene, nScenes = sceneList.size ();
for (iScene = 0; iScene < nScenes; iScene++) {
std::size_t iScene, nScenes = sceneList.size ();
for (iScene = 0; iScene < nScenes; ++iScene) {
if (sceneList [iScene] -> GetName () == newName) break;
}
if (iScene < nScenes) {
if (verbosity >= G4VisManager::warnings) {
G4cout << "WARNING: Scene \"" << newName << "\" already exists."
G4warn << "WARNING: Scene \"" << newName << "\" already exists."
<< "\n New scene not created."
<< G4endl;
}
@@ -293,7 +295,7 @@ void G4VisCommandSceneEndOfEventAction::SetNewValue (G4UIcommand*,
G4Scene* pScene = fpVisManager->GetCurrentScene();
if (!pScene) {
if (verbosity >= G4VisManager::errors) {
G4cerr << "ERROR: No current scene. Please create one." << G4endl;
G4warn << "ERROR: No current scene. Please create one." << G4endl;
}
return;
}
@@ -301,7 +303,7 @@ void G4VisCommandSceneEndOfEventAction::SetNewValue (G4UIcommand*,
G4VSceneHandler* pSceneHandler = fpVisManager->GetCurrentSceneHandler();
if (!pSceneHandler) {
if (verbosity >= G4VisManager::errors) {
G4cerr << "ERROR: No current sceneHandler. Please create one." << G4endl;
G4warn << "ERROR: No current sceneHandler. Please create one." << G4endl;
}
return;
}
@@ -313,7 +315,7 @@ void G4VisCommandSceneEndOfEventAction::SetNewValue (G4UIcommand*,
else if (action == "refresh") {
if (!pScene->GetRefreshAtEndOfRun()) {
if (verbosity >= G4VisManager::errors) {
G4cerr <<
G4warn <<
"ERROR: Cannot refresh events unless runs refresh too."
"\n Use \"/vis/scene/endOfRun refresh\"."
<< G4endl;
@@ -326,7 +328,7 @@ void G4VisCommandSceneEndOfEventAction::SetNewValue (G4UIcommand*,
}
else {
if (verbosity >= G4VisManager::errors) {
G4cerr <<
G4warn <<
"ERROR: unrecognised parameter \"" << action << "\"."
<< G4endl;
}
@@ -367,23 +369,23 @@ void G4VisCommandSceneEndOfEventAction::SetNewValue (G4UIcommand*,
if (!pScene->GetRefreshAtEndOfEvent() &&
maxNumberOfKeptEvents != 0 &&
verbosity >= G4VisManager::warnings) {
G4cout << "WARNING: ";
G4warn << "WARNING: ";
if (nCurrentlyKept) {
G4cout <<
G4warn <<
"\n There are currently " << nCurrentlyKept
<< " events kept for refreshing and/or reviewing.";
} else {
G4cout << "The vis manager will keep ";
if (maxNumberOfKeptEvents < 0) G4cout << "an unlimited number of";
else G4cout << "up to " << maxNumberOfKeptEvents;
G4cout << " events.";
G4warn << "The vis manager will keep ";
if (maxNumberOfKeptEvents < 0) G4warn << "an unlimited number of";
else G4warn << "up to " << maxNumberOfKeptEvents;
G4warn << " events.";
if (maxNumberOfKeptEvents > 1 || maxNumberOfKeptEvents < 0)
G4cout <<
G4warn <<
"\n This may use a lot of memory."
"\n It may be changed with, e.g., "
"\"/vis/scene/endOfEventAction accumulate 10\".";
}
G4cout << G4endl;
G4warn << G4endl;
}
}
@@ -426,7 +428,7 @@ void G4VisCommandSceneEndOfRunAction::SetNewValue (G4UIcommand*,
G4Scene* pScene = fpVisManager->GetCurrentScene();
if (!pScene) {
if (verbosity >= G4VisManager::errors) {
G4cerr << "ERROR: No current scene. Please create one." << G4endl;
G4warn << "ERROR: No current scene. Please create one." << G4endl;
}
return;
}
@@ -434,7 +436,7 @@ void G4VisCommandSceneEndOfRunAction::SetNewValue (G4UIcommand*,
G4VSceneHandler* pSceneHandler = fpVisManager->GetCurrentSceneHandler();
if (!pSceneHandler) {
if (verbosity >= G4VisManager::errors) {
G4cerr << "ERROR: No current sceneHandler. Please create one." << G4endl;
G4warn << "ERROR: No current sceneHandler. Please create one." << G4endl;
}
return;
}
@@ -442,7 +444,7 @@ void G4VisCommandSceneEndOfRunAction::SetNewValue (G4UIcommand*,
if (action == "accumulate") {
if (pScene->GetRefreshAtEndOfEvent()) {
if (verbosity >= G4VisManager::errors) {
G4cerr <<
G4warn <<
"ERROR: Cannot accumulate runs unless events accumulate too."
"\n Use \"/vis/scene/endOfEventAction accumulate\"."
<< G4endl;
@@ -458,7 +460,7 @@ void G4VisCommandSceneEndOfRunAction::SetNewValue (G4UIcommand*,
}
else {
if (verbosity >= G4VisManager::errors) {
G4cerr <<
G4warn <<
"ERROR: unrecognised parameter \"" << action << "\"."
<< G4endl;
}
@@ -512,9 +514,9 @@ void G4VisCommandSceneList::SetNewValue (G4UIcommand*, G4String newValue) {
if (currentScene) currentName = currentScene->GetName();
G4SceneList& sceneList = fpVisManager -> SetSceneList ();
G4int iScene, nScenes = sceneList.size ();
std::size_t iScene, nScenes = sceneList.size ();
G4bool found = false;
for (iScene = 0; iScene < nScenes; iScene++) {
for (iScene = 0; iScene < nScenes; ++iScene) {
G4Scene* pScene = sceneList [iScene];
const G4String& iName = pScene -> GetName ();
if (name != "all") {
@@ -529,13 +531,13 @@ void G4VisCommandSceneList::SetNewValue (G4UIcommand*, G4String newValue) {
}
G4cout << " scene \"" << iName << "\"";
if (verbosity >= G4VisManager::warnings) {
G4int i;
std::size_t i;
G4cout << "\n Run-duration models:";
G4int nRunModels = pScene -> GetRunDurationModelList ().size ();
std::size_t nRunModels = pScene -> GetRunDurationModelList ().size ();
if (nRunModels == 0) {
G4cout << " none.";
}
for (i = 0; i < nRunModels; i++) {
for (i = 0; i < nRunModels; ++i) {
if (pScene -> GetRunDurationModelList()[i].fActive)
G4cout << "\n Active: ";
else G4cout << "\n Inactive: ";
@@ -543,11 +545,11 @@ void G4VisCommandSceneList::SetNewValue (G4UIcommand*, G4String newValue) {
G4cout << pModel -> GetGlobalDescription ();
}
G4cout << "\n End-of-event models:";
G4int nEOEModels = pScene -> GetEndOfEventModelList ().size ();
std::size_t nEOEModels = pScene -> GetEndOfEventModelList ().size ();
if (nEOEModels == 0) {
G4cout << " none.";
}
for (i = 0; i < nEOEModels; i++) {
for (i = 0; i < nEOEModels; ++i) {
if (pScene -> GetEndOfEventModelList()[i].fActive)
G4cout << "\n Active: ";
else G4cout << "\n Inactive: ";
@@ -555,11 +557,11 @@ void G4VisCommandSceneList::SetNewValue (G4UIcommand*, G4String newValue) {
G4cout << pModel -> GetGlobalDescription ();
}
G4cout << "\n End-of-run models:";
G4int nEORModels = pScene -> GetEndOfRunModelList ().size ();
std::size_t nEORModels = pScene -> GetEndOfRunModelList ().size ();
if (nEORModels == 0) {
G4cout << " none.";
}
for (i = 0; i < nEORModels; i++) {
for (i = 0; i < nEORModels; ++i) {
if (pScene -> GetEndOfRunModelList()[i].fActive)
G4cout << "\n Active: ";
else G4cout << "\n Inactive: ";
@@ -573,11 +575,11 @@ void G4VisCommandSceneList::SetNewValue (G4UIcommand*, G4String newValue) {
G4cout << G4endl;
}
if (!found) {
G4cerr << "No scenes found";
G4warn << "No scenes found";
if (name != "all") {
G4cerr << " of name \"" << name << "\"";
G4warn << " of name \"" << name << "\"";
}
G4cerr << "." << G4endl;
G4warn << "." << G4endl;
}
}
@@ -637,15 +639,15 @@ void G4VisCommandSceneNotifyHandlers::SetNewValue (G4UIcommand*,
fpVisManager -> SetAvailableSceneHandlers ();
// Check scene name.
const G4int nScenes = sceneList.size ();
G4int iScene;
for (iScene = 0; iScene < nScenes; iScene++) {
const std::size_t nScenes = sceneList.size ();
std::size_t iScene;
for (iScene = 0; iScene < nScenes; ++iScene) {
G4Scene* scene = sceneList [iScene];
if (sceneName == scene -> GetName ()) break;
}
if (iScene >= nScenes ) {
if (verbosity >= G4VisManager::warnings) {
G4cout << "WARNING: Scene \"" << sceneName << "\" not found."
G4warn << "WARNING: Scene \"" << sceneName << "\" not found."
"\n /vis/scene/list to see scenes."
<< G4endl;
}
@@ -657,7 +659,7 @@ void G4VisCommandSceneNotifyHandlers::SetNewValue (G4UIcommand*,
fpVisManager -> GetCurrentSceneHandler();
if (!pCurrentSceneHandler) {
if (verbosity >= G4VisManager::warnings) {
G4cout << "WARNING: No current scene handler."
G4warn << "WARNING: No current scene handler."
<< G4endl;
}
return;
@@ -665,7 +667,7 @@ void G4VisCommandSceneNotifyHandlers::SetNewValue (G4UIcommand*,
G4VViewer* pCurrentViewer = fpVisManager -> GetCurrentViewer();
if (!pCurrentViewer) {
if (verbosity >= G4VisManager::warnings) {
G4cout << "WARNING: No current viewer."
G4warn << "WARNING: No current viewer."
<< G4endl;
}
return;
@@ -673,7 +675,7 @@ void G4VisCommandSceneNotifyHandlers::SetNewValue (G4UIcommand*,
G4Scene* pCurrentScene = fpVisManager -> GetCurrentScene();
if (!pCurrentScene) {
if (verbosity >= G4VisManager::warnings) {
G4cout << "WARNING: No current scene."
G4warn << "WARNING: No current scene."
<< G4endl;
}
return;
@@ -687,8 +689,8 @@ void G4VisCommandSceneNotifyHandlers::SetNewValue (G4UIcommand*,
// For each scene handler, if it contains the scene, clear and
// rebuild the graphical database, then for each viewer set (make
// current), clear, (re)draw, and show.
const G4int nSceneHandlers = sceneHandlerList.size ();
for (G4int iSH = 0; iSH < nSceneHandlers; iSH++) {
const std::size_t nSceneHandlers = sceneHandlerList.size ();
for (std::size_t iSH = 0; iSH < nSceneHandlers; ++iSH) {
G4VSceneHandler* aSceneHandler = sceneHandlerList [iSH];
G4Scene* aScene = aSceneHandler -> GetScene ();
if (aScene) {
@@ -696,8 +698,8 @@ void G4VisCommandSceneNotifyHandlers::SetNewValue (G4UIcommand*,
if (sceneName == aSceneName) {
aScene->CalculateExtent(); // Check and recalculate extent
G4ViewerList& viewerList = aSceneHandler -> SetViewerList ();
const G4int nViewers = viewerList.size ();
for (G4int iV = 0; iV < nViewers; iV++) {
const std::size_t nViewers = viewerList.size ();
for (std::size_t iV = 0; iV < nViewers; ++iV) {
G4VViewer* aViewer = viewerList [iV];
// Force rebuild of graphical database, if any.
aViewer -> NeedKernelVisit();
@@ -740,7 +742,7 @@ void G4VisCommandSceneNotifyHandlers::SetNewValue (G4UIcommand*,
}
else {
if (verbosity >= G4VisManager::warnings) {
G4cout << "WARNING: G4VisCommandSceneNotifyHandlers: scene handler \""
G4warn << "WARNING: G4VisCommandSceneNotifyHandlers: scene handler \""
<< aSceneHandler->GetName()
<< "\" has a null scene."
<< G4endl;
@@ -761,7 +763,7 @@ void G4VisCommandSceneNotifyHandlers::SetNewValue (G4UIcommand*,
// Take care of special case of scene handler with no viewer yet.
if (pCurrentSceneHandler) {
G4ViewerList& viewerList = pCurrentSceneHandler -> SetViewerList ();
const G4int nViewers = viewerList.size ();
const std::size_t nViewers = viewerList.size ();
if (nViewers) {
pCurrentSceneHandler -> SetCurrentViewer (pCurrentViewer);
// JA: I don't think we need this. SetView will be called when needed.
@@ -807,7 +809,7 @@ void G4VisCommandSceneRemoveModel::SetNewValue (G4UIcommand*,
G4Scene* pScene = fpVisManager->GetCurrentScene();
if (!pScene) {
if (verbosity >= G4VisManager::errors) {
G4cerr << "ERROR: No current scene. Please create one." << G4endl;
G4warn << "ERROR: No current scene. Please create one." << G4endl;
}
return;
}
@@ -815,7 +817,7 @@ void G4VisCommandSceneRemoveModel::SetNewValue (G4UIcommand*,
G4VSceneHandler* pSceneHandler = fpVisManager->GetCurrentSceneHandler();
if (!pSceneHandler) {
if (verbosity >= G4VisManager::errors) {
G4cerr << "ERROR: No current sceneHandler. Please create one." << G4endl;
G4warn << "ERROR: No current sceneHandler. Please create one." << G4endl;
}
return;
}
@@ -831,7 +833,7 @@ void G4VisCommandSceneRemoveModel::SetNewValue (G4UIcommand*,
runDurationModelList.erase(runDurationModelList.begin()+i);
any = true;
if (verbosity >= G4VisManager::warnings) {
G4cout << "Model \"" << modelName << "\" removed." << G4endl;
G4warn << "Model \"" << modelName << "\" removed." << G4endl;
}
break; // Allow only one model at a time to be removed.
}
@@ -846,7 +848,7 @@ void G4VisCommandSceneRemoveModel::SetNewValue (G4UIcommand*,
endOfEventModelList.erase(endOfEventModelList.begin()+i);
any = true;
if (verbosity >= G4VisManager::warnings) {
G4cout << "Model \"" << modelName << "\" removed." << G4endl;
G4warn << "Model \"" << modelName << "\" removed." << G4endl;
}
break; // Allow only one model at a time to be removed.
}
@@ -861,7 +863,7 @@ void G4VisCommandSceneRemoveModel::SetNewValue (G4UIcommand*,
endOfRunModelList.erase(endOfRunModelList.begin()+i);
any = true;
if (verbosity >= G4VisManager::warnings) {
G4cout << "Model \"" << modelName << "\" removed." << G4endl;
G4warn << "Model \"" << modelName << "\" removed." << G4endl;
}
break; // Allow only one model at a time to be removed.
}
@@ -869,7 +871,7 @@ void G4VisCommandSceneRemoveModel::SetNewValue (G4UIcommand*,
if (!any) {
if (verbosity >= G4VisManager::warnings) {
G4cout << "WARNING: No match found." << G4endl;
G4warn << "WARNING: No match found." << G4endl;
}
return;
}
@@ -903,13 +905,13 @@ void G4VisCommandSceneSelect::SetNewValue (G4UIcommand*, G4String newValue) {
G4String& selectName = newValue;
G4SceneList& sceneList = fpVisManager -> SetSceneList ();
G4int iScene, nScenes = sceneList.size ();
for (iScene = 0; iScene < nScenes; iScene++) {
std::size_t iScene, nScenes = sceneList.size ();
for (iScene = 0; iScene < nScenes; ++iScene) {
if (sceneList [iScene] -> GetName () == selectName) break;
}
if (iScene >= nScenes) {
if (verbosity >= G4VisManager::warnings) {
G4cout << "WARNING: Scene \"" << selectName
G4warn << "WARNING: Scene \"" << selectName
<< "\" not found - \"/vis/scene/list\" to see possibilities."
<< G4endl;
}
@@ -947,7 +949,7 @@ void G4VisCommandSceneShowExtents::SetNewValue (G4UIcommand*, G4String) {
fpVisManager -> GetCurrentSceneHandler();
if (!pCurrentSceneHandler) {
if (verbosity >= G4VisManager::warnings) {
G4cout << "WARNING: No current scene handler."
G4warn << "WARNING: No current scene handler."
<< G4endl;
}
return;
@@ -955,7 +957,7 @@ void G4VisCommandSceneShowExtents::SetNewValue (G4UIcommand*, G4String) {
G4VViewer* pCurrentViewer = fpVisManager -> GetCurrentViewer();
if (!pCurrentViewer) {
if (verbosity >= G4VisManager::warnings) {
G4cout << "WARNING: No current viewer."
G4warn << "WARNING: No current viewer."
<< G4endl;
}
return;
@@ -963,18 +965,18 @@ void G4VisCommandSceneShowExtents::SetNewValue (G4UIcommand*, G4String) {
G4Scene* pCurrentScene = fpVisManager -> GetCurrentScene();
if (!pCurrentScene) {
if (verbosity >= G4VisManager::warnings) {
G4cout << "WARNING: No current scene."
G4warn << "WARNING: No current scene."
<< G4endl;
}
return;
}
G4cout << "\n Run-duration models:";
G4int nRunModels = pCurrentScene -> GetRunDurationModelList ().size ();
std::size_t nRunModels = pCurrentScene -> GetRunDurationModelList ().size ();
if (nRunModels == 0) {
G4cout << " none.";
}
for (G4int i = 0; i < nRunModels; i++) {
for (std::size_t i = 0; i < nRunModels; ++i) {
if (pCurrentScene -> GetRunDurationModelList()[i].fActive)
G4cout << "\n Active: ";
else G4cout << "\n Inactive: ";
@@ -985,11 +987,11 @@ void G4VisCommandSceneShowExtents::SetNewValue (G4UIcommand*, G4String) {
DrawExtent(transformedExtent);
}
G4cout << "\n End-of-event models:";
G4int nEOEModels = pCurrentScene -> GetEndOfEventModelList ().size ();
std::size_t nEOEModels = pCurrentScene -> GetEndOfEventModelList ().size ();
if (nEOEModels == 0) {
G4cout << " none.";
}
for (G4int i = 0; i < nEOEModels; i++) {
for (std::size_t i = 0; i < nEOEModels; ++i) {
if (pCurrentScene -> GetEndOfEventModelList()[i].fActive)
G4cout << "\n Active: ";
else G4cout << "\n Inactive: ";
@@ -1000,11 +1002,11 @@ void G4VisCommandSceneShowExtents::SetNewValue (G4UIcommand*, G4String) {
DrawExtent(transformedExtent);
}
G4cout << "\n End-of-run models:";
G4int nEORModels = pCurrentScene -> GetEndOfRunModelList ().size ();
std::size_t nEORModels = pCurrentScene -> GetEndOfRunModelList ().size ();
if (nEORModels == 0) {
G4cout << " none.";
}
for (G4int i = 0; i < nEORModels; i++) {
for (std::size_t i = 0; i < nEORModels; ++i) {
if (pCurrentScene -> GetEndOfRunModelList()[i].fActive)
G4cout << "\n Active: ";
else G4cout << "\n Inactive: ";
@@ -82,6 +82,8 @@
#include <sstream>
#define G4warn G4cout
////////////// /vis/scene/add/arrow ///////////////////////////////////////
G4VisCommandSceneAddArrow::G4VisCommandSceneAddArrow () {
@@ -122,7 +124,7 @@ void G4VisCommandSceneAddArrow::SetNewValue (G4UIcommand*, G4String newValue)
G4Scene* pScene = fpVisManager->GetCurrentScene();
if (!pScene) {
if (verbosity >= G4VisManager::errors) {
G4cerr << "ERROR: No current scene. Please create one." << G4endl;
G4warn << "ERROR: No current scene. Please create one." << G4endl;
}
return;
}
@@ -192,7 +194,7 @@ void G4VisCommandSceneAddArrow2D::SetNewValue (G4UIcommand*, G4String newValue)
G4Scene* pScene = fpVisManager->GetCurrentScene();
if (!pScene) {
if (verbosity >= G4VisManager::errors) {
G4cerr << "ERROR: No current scene. Please create one." << G4endl;
G4warn << "ERROR: No current scene. Please create one." << G4endl;
}
return;
}
@@ -311,13 +313,13 @@ void G4VisCommandSceneAddAxes::SetNewValue (G4UIcommand*, G4String newValue) {
G4Scene* pScene = fpVisManager->GetCurrentScene();
if (!pScene) {
if (verbosity >= G4VisManager::errors) {
G4cerr << "ERROR: No current scene. Please create one." << G4endl;
G4warn << "ERROR: No current scene. Please create one." << G4endl;
}
return;
} else {
if (pScene->GetExtent().GetExtentRadius() <= 0.) {
if (verbosity >= G4VisManager::errors) {
G4cerr
G4warn
<< "ERROR: Scene has no extent. Add volumes or use \"/vis/scene/add/extent\"."
<< G4endl;
}
@@ -417,7 +419,7 @@ void G4VisCommandSceneAddDate::SetNewValue (G4UIcommand*, G4String newValue)
G4Scene* pScene = fpVisManager->GetCurrentScene();
if (!pScene) {
if (verbosity >= G4VisManager::errors) {
G4cerr << "ERROR: No current scene. Please create one." << G4endl;
G4warn << "ERROR: No current scene. Please create one." << G4endl;
}
return;
}
@@ -506,7 +508,7 @@ void G4VisCommandSceneAddDigis::SetNewValue (G4UIcommand*, G4String) {
G4Scene* pScene = fpVisManager->GetCurrentScene();
if (!pScene) {
if (verbosity >= G4VisManager::errors) {
G4cerr << "ERROR: No current scene. Please create one." << G4endl;
G4warn << "ERROR: No current scene. Please create one." << G4endl;
}
return;
}
@@ -580,7 +582,7 @@ void G4VisCommandSceneAddElectricField::SetNewValue
G4Scene* pScene = fpVisManager->GetCurrentScene();
if (!pScene) {
if (verbosity >= G4VisManager::errors) {
G4cerr << "ERROR: No current scene. Please create one." << G4endl;
G4warn << "ERROR: No current scene. Please create one." << G4endl;
}
return;
}
@@ -664,7 +666,7 @@ void G4VisCommandSceneAddEventID::SetNewValue (G4UIcommand*, G4String newValue)
G4Scene* pScene = fpVisManager->GetCurrentScene();
if (!pScene) {
if (verbosity >= G4VisManager::errors) {
G4cerr << "ERROR: No current scene. Please create one." << G4endl;
G4warn << "ERROR: No current scene. Please create one." << G4endl;
}
return;
}
@@ -818,7 +820,7 @@ void G4VisCommandSceneAddExtent::SetNewValue (G4UIcommand*, G4String newValue)
G4Scene* pScene = fpVisManager->GetCurrentScene();
if (!pScene) {
if (verbosity >= G4VisManager::errors) {
G4cerr << "ERROR: No current scene. Please create one." << G4endl;
G4warn << "ERROR: No current scene. Please create one." << G4endl;
}
return;
}
@@ -897,7 +899,7 @@ void G4VisCommandSceneAddFrame::SetNewValue (G4UIcommand*, G4String newValue)
G4Scene* pScene = fpVisManager->GetCurrentScene();
if (!pScene) {
if (verbosity >= G4VisManager::errors) {
G4cerr << "ERROR: No current scene. Please create one." << G4endl;
G4warn << "ERROR: No current scene. Please create one." << G4endl;
}
return;
}
@@ -985,7 +987,7 @@ void G4VisCommandSceneAddGPS::SetNewValue (G4UIcommand*, G4String newValue) {
G4Scene* pScene = fpVisManager->GetCurrentScene();
if (!pScene) {
if (verbosity >= G4VisManager::errors) {
G4cerr << "ERROR: No current scene. Please create one." << G4endl;
G4warn << "ERROR: No current scene. Please create one." << G4endl;
}
return;
}
@@ -1040,7 +1042,7 @@ void G4VisCommandSceneAddHits::SetNewValue (G4UIcommand*, G4String) {
G4Scene* pScene = fpVisManager->GetCurrentScene();
if (!pScene) {
if (verbosity >= G4VisManager::errors) {
G4cerr << "ERROR: No current scene. Please create one." << G4endl;
G4warn << "ERROR: No current scene. Please create one." << G4endl;
}
return;
}
@@ -1100,7 +1102,7 @@ void G4VisCommandSceneAddLine::SetNewValue (G4UIcommand*, G4String newValue)
G4Scene* pScene = fpVisManager->GetCurrentScene();
if (!pScene) {
if (verbosity >= G4VisManager::errors) {
G4cerr << "ERROR: No current scene. Please create one." << G4endl;
G4warn << "ERROR: No current scene. Please create one." << G4endl;
}
return;
}
@@ -1189,7 +1191,7 @@ void G4VisCommandSceneAddLine2D::SetNewValue (G4UIcommand*, G4String newValue)
G4Scene* pScene = fpVisManager->GetCurrentScene();
if (!pScene) {
if (verbosity >= G4VisManager::errors) {
G4cerr << "ERROR: No current scene. Please create one." << G4endl;
G4warn << "ERROR: No current scene. Please create one." << G4endl;
}
return;
}
@@ -1274,7 +1276,7 @@ void G4VisCommandSceneAddLocalAxes::SetNewValue (G4UIcommand*,
G4Scene* pScene = fpVisManager->GetCurrentScene();
if (!pScene) {
if (verbosity >= G4VisManager::errors) {
G4cerr << "ERROR: No current scene. Please create one." << G4endl;
G4warn << "ERROR: No current scene. Please create one." << G4endl;
}
return;
}
@@ -1353,11 +1355,11 @@ void G4VisCommandSceneAddLocalAxes::SetNewValue (G4UIcommand*,
if (findingsVector.empty()) {
if (verbosity >= G4VisManager::errors) {
G4cerr << "ERROR: Volume \"" << name << "\"";
G4warn << "ERROR: Volume \"" << name << "\"";
if (copyNo >= 0) {
G4cerr << ", copy no. " << copyNo << ",";
G4warn << ", copy no. " << copyNo << ",";
}
G4cerr << " not found." << G4endl;
G4warn << " not found." << G4endl;
}
G4VisCommandsSceneAddUnsuccessful(verbosity);
return;
@@ -1421,7 +1423,7 @@ void G4VisCommandSceneAddLogicalVolume::SetNewValue (G4UIcommand*,
G4Scene* pScene = fpVisManager->GetCurrentScene();
if (!pScene) {
if (verbosity >= G4VisManager::errors) {
G4cerr << "ERROR: No current scene. Please create one." << G4endl;
G4warn << "ERROR: No current scene. Please create one." << G4endl;
}
return;
}
@@ -1453,7 +1455,7 @@ void G4VisCommandSceneAddLogicalVolume::SetNewValue (G4UIcommand*,
}
if (i != rdModelList.end()) {
if (verbosity >= G4VisManager::errors) {
G4cout << "There is already a volume, \""
G4warn << "There is already a volume, \""
<< i->fpModel->GetGlobalDescription()
<< "\",\n in the run-duration model list of scene \""
<< pScene -> GetName()
@@ -1493,7 +1495,7 @@ void G4VisCommandSceneAddLogicalVolume::SetNewValue (G4UIcommand*,
// if (verbosity >= G4VisManager::warnings) {
// const std::map<G4String,G4AttDef>* attDefs = model->GetAttDefs();
// std::vector<G4AttValue>* attValues = model->CreateCurrentAttValues();
// G4cout << G4AttCheck(attValues, attDefs);
// G4warn << G4AttCheck(attValues, attDefs);
// delete attValues;
// }
@@ -1600,13 +1602,13 @@ void G4VisCommandSceneAddLogo::SetNewValue (G4UIcommand*, G4String newValue) {
G4Scene* pScene = fpVisManager->GetCurrentScene();
if (!pScene) {
if (verbosity >= G4VisManager::errors) {
G4cerr << "ERROR: No current scene. Please create one." << G4endl;
G4warn << "ERROR: No current scene. Please create one." << G4endl;
}
return;
} else {
if (pScene->GetExtent().GetExtentRadius() <= 0.) {
if (verbosity >= G4VisManager::errors) {
G4cerr
G4warn
<< "ERROR: Scene has no extent. Add volumes or use \"/vis/scene/add/extent\"."
<< G4endl;
}
@@ -1617,7 +1619,7 @@ void G4VisCommandSceneAddLogo::SetNewValue (G4UIcommand*, G4String newValue) {
G4VViewer* pViewer = fpVisManager->GetCurrentViewer();
if (!pViewer) {
if (verbosity >= G4VisManager::errors) {
G4cerr <<
G4warn <<
"ERROR: G4VisCommandSceneAddLogo::SetNewValue: no viewer."
"\n Auto direction needs a viewer."
<< G4endl;
@@ -1665,7 +1667,7 @@ void G4VisCommandSceneAddLogo::SetNewValue (G4UIcommand*, G4String newValue) {
else if (direction[1] == 'z') logoDirection = minusZ;
} else {
if (verbosity >= G4VisManager::errors) {
G4cerr << "ERROR: Unrecogniseed direction: \""
G4warn << "ERROR: Unrecogniseed direction: \""
<< direction << "\"." << G4endl;
return;
}
@@ -1687,7 +1689,7 @@ void G4VisCommandSceneAddLogo::SetNewValue (G4UIcommand*, G4String newValue) {
if (sceneExtent.GetExtentRadius() == 0) {
worried = true;
if (verbosity >= G4VisManager::warnings) {
G4cout <<
G4warn <<
"WARNING: Existing scene does not yet have any extent."
"\n Maybe you have not yet added any geometrical object."
<< G4endl;
@@ -1718,14 +1720,14 @@ void G4VisCommandSceneAddLogo::SetNewValue (G4UIcommand*, G4String newValue) {
if (!room) {
worried = true;
if (verbosity >= G4VisManager::warnings) {
G4cout <<
G4warn <<
"WARNING: Not enough room in existing scene. Maybe logo is too large."
<< G4endl;
}
}
if (worried) {
if (verbosity >= G4VisManager::warnings) {
G4cout <<
G4warn <<
"WARNING: The logo you have asked for is bigger than the existing"
"\n scene. Maybe you have added it too soon. It is recommended that"
"\n you add the logo last so that it can be correctly auto-positioned"
@@ -1964,7 +1966,7 @@ void G4VisCommandSceneAddLogo2D::SetNewValue (G4UIcommand*, G4String newValue)
G4Scene* pScene = fpVisManager->GetCurrentScene();
if (!pScene) {
if (verbosity >= G4VisManager::errors) {
G4cerr << "ERROR: No current scene. Please create one." << G4endl;
G4warn << "ERROR: No current scene. Please create one." << G4endl;
}
return;
}
@@ -2043,7 +2045,7 @@ void G4VisCommandSceneAddMagneticField::SetNewValue
G4Scene* pScene = fpVisManager->GetCurrentScene();
if (!pScene) {
if (verbosity >= G4VisManager::errors) {
G4cerr << "ERROR: No current scene. Please create one." << G4endl;
G4warn << "ERROR: No current scene. Please create one." << G4endl;
}
return;
}
@@ -2117,7 +2119,7 @@ void G4VisCommandSceneAddPSHits::SetNewValue
G4Scene* pScene = fpVisManager->GetCurrentScene();
if (!pScene) {
if (verbosity >= G4VisManager::errors) {
G4cerr << "ERROR: No current scene. Please create one." << G4endl;
G4warn << "ERROR: No current scene. Please create one." << G4endl;
}
return;
}
@@ -2226,13 +2228,13 @@ void G4VisCommandSceneAddScale::SetNewValue (G4UIcommand*, G4String newValue) {
G4Scene* pScene = fpVisManager->GetCurrentScene();
if (!pScene) {
if (verbosity >= G4VisManager::errors) {
G4cerr << "ERROR: No current scene. Please create one." << G4endl;
G4warn << "ERROR: No current scene. Please create one." << G4endl;
}
return;
} else {
if (pScene->GetExtent().GetExtentRadius() <= 0.) {
if (verbosity >= G4VisManager::errors) {
G4cerr
G4warn
<< "ERROR: Scene has no extent. Add volumes or use \"/vis/scene/add/extent\"."
<< G4endl;
}
@@ -2271,7 +2273,7 @@ void G4VisCommandSceneAddScale::SetNewValue (G4UIcommand*, G4String newValue) {
G4VViewer* pViewer = fpVisManager->GetCurrentViewer();
if (!pViewer) {
if (verbosity >= G4VisManager::errors) {
G4cerr <<
G4warn <<
"ERROR: G4VisCommandSceneAddScale::SetNewValue: no viewer."
"\n Auto direction needs a viewer."
<< G4endl;
@@ -2322,7 +2324,7 @@ void G4VisCommandSceneAddScale::SetNewValue (G4UIcommand*, G4String newValue) {
if (sceneExtent.GetExtentRadius() == 0) {
worried = true;
if (verbosity >= G4VisManager::warnings) {
G4cout <<
G4warn <<
"WARNING: Existing scene does not yet have any extent."
"\n Maybe you have not yet added any geometrical object."
<< G4endl;
@@ -2345,14 +2347,14 @@ void G4VisCommandSceneAddScale::SetNewValue (G4UIcommand*, G4String newValue) {
if (!room) {
worried = true;
if (verbosity >= G4VisManager::warnings) {
G4cout <<
G4warn <<
"WARNING: Not enough room in existing scene. Maybe scale is too long."
<< G4endl;
}
}
if (worried) {
if (verbosity >= G4VisManager::warnings) {
G4cout <<
G4warn <<
"WARNING: The scale you have asked for is bigger than the existing"
"\n scene. Maybe you have added it too soon. It is recommended that"
"\n you add the scale last so that it can be correctly auto-positioned"
@@ -2610,7 +2612,7 @@ void G4VisCommandSceneAddText::SetNewValue (G4UIcommand*, G4String newValue) {
G4Scene* pScene = fpVisManager->GetCurrentScene();
if (!pScene) {
if (verbosity >= G4VisManager::errors) {
G4cerr << "ERROR: No current scene. Please create one." << G4endl;
G4warn << "ERROR: No current scene. Please create one." << G4endl;
}
return;
}
@@ -2701,7 +2703,7 @@ void G4VisCommandSceneAddText2D::SetNewValue (G4UIcommand*, G4String newValue) {
G4Scene* pScene = fpVisManager->GetCurrentScene();
if (!pScene) {
if (verbosity >= G4VisManager::errors) {
G4cerr << "ERROR: No current scene. Please create one." << G4endl;
G4warn << "ERROR: No current scene. Please create one." << G4endl;
}
return;
}
@@ -2802,7 +2804,7 @@ void G4VisCommandSceneAddTrajectories::SetNewValue (G4UIcommand*,
G4Scene* pScene = fpVisManager->GetCurrentScene();
if (!pScene) {
if (verbosity >= G4VisManager::errors) {
G4cerr << "ERROR: No current scene. Please create one." << G4endl;
G4warn << "ERROR: No current scene. Please create one." << G4endl;
}
return;
}
@@ -2814,7 +2816,7 @@ void G4VisCommandSceneAddTrajectories::SetNewValue (G4UIcommand*,
if (newValue.find("rich") != std::string::npos) rich = true;
if (newValue.size() && !(rich || smooth)) {
if (verbosity >= G4VisManager::errors) {
G4cerr << "ERROR: Unrecognised parameter \"" << newValue << "\""
G4warn << "ERROR: Unrecognised parameter \"" << newValue << "\""
"\n No action taken."
<< G4endl;
}
@@ -2822,9 +2824,6 @@ void G4VisCommandSceneAddTrajectories::SetNewValue (G4UIcommand*,
}
G4UImanager* UImanager = G4UImanager::GetUIpointer();
G4int keepVerbose = UImanager->GetVerboseLevel();
G4int newVerbose = 2;
UImanager->SetVerboseLevel(newVerbose);
G4String defaultTrajectoryType;
if (smooth && rich) {
UImanager->ApplyCommand("/tracking/storeTrajectory 4");
@@ -2839,23 +2838,22 @@ void G4VisCommandSceneAddTrajectories::SetNewValue (G4UIcommand*,
UImanager->ApplyCommand("/tracking/storeTrajectory 1");
defaultTrajectoryType = "G4Trajectory";
}
UImanager->SetVerboseLevel(keepVerbose);
if (verbosity >= G4VisManager::errors) {
G4cout <<
G4warn <<
"Attributes available for modeling and filtering with"
"\n \"/vis/modeling/trajectories/create/drawByAttribute\" and"
"\n \"/vis/filtering/trajectories/create/attributeFilter\" commands:"
<< G4endl;
G4cout << *G4TrajectoriesModel().GetAttDefs();
G4warn << *G4TrajectoriesModel().GetAttDefs();
if (rich) {
G4cout << *G4RichTrajectory().GetAttDefs()
G4warn << *G4RichTrajectory().GetAttDefs()
<< *G4RichTrajectoryPoint().GetAttDefs();
} else if (smooth) {
G4cout << *G4SmoothTrajectory().GetAttDefs()
G4warn << *G4SmoothTrajectory().GetAttDefs()
<< *G4SmoothTrajectoryPoint().GetAttDefs();
} else {
G4cout << *G4Trajectory().GetAttDefs()
G4warn << *G4Trajectory().GetAttDefs()
<< *G4TrajectoryPoint().GetAttDefs();
}
}
@@ -2882,7 +2880,7 @@ void G4VisCommandSceneAddTrajectories::SetNewValue (G4UIcommand*,
}
if (verbosity >= G4VisManager::warnings) {
G4cout <<
G4warn <<
"WARNING: Trajectory storing has been requested. This action may be"
"\n reversed with \"/tracking/storeTrajectory 0\"."
<< G4endl;
@@ -2924,7 +2922,7 @@ void G4VisCommandSceneAddUserAction::SetNewValue
G4Scene* pScene = fpVisManager->GetCurrentScene();
if (!pScene) {
if (verbosity >= G4VisManager::errors) {
G4cerr << "ERROR: No current scene. Please create one." << G4endl;
G4warn << "ERROR: No current scene. Please create one." << G4endl;
}
return;
}
@@ -2966,7 +2964,7 @@ void G4VisCommandSceneAddUserAction::SetNewValue
if (!any) {
if (verbosity >= G4VisManager::warnings) {
G4cout << "WARNING: No User Vis Action registered." << G4endl;
G4warn << "WARNING: No User Vis Action registered." << G4endl;
}
return;
}
@@ -2991,7 +2989,7 @@ void G4VisCommandSceneAddUserAction::AddVisAction
if (i != visExtentMap.end()) extent = i->second;
if (warn) {
if (extent.GetExtentRadius() <= 0.) {
G4cout
G4warn
<< "WARNING: User Vis Action \"" << name << "\" extent is null."
<< G4endl;
}
@@ -3124,7 +3122,7 @@ void G4VisCommandSceneAddVolume::SetNewValue (G4UIcommand*,
G4Scene* pScene = fpVisManager->GetCurrentScene();
if (!pScene) {
if (verbosity >= G4VisManager::errors) {
G4cerr << "ERROR: No current scene. Please create one." << G4endl;
G4warn << "ERROR: No current scene. Please create one." << G4endl;
}
return;
}
@@ -3170,7 +3168,7 @@ void G4VisCommandSceneAddVolume::SetNewValue (G4UIcommand*,
if (verbosity >= G4VisManager::warnings) {
static G4bool warned = false;
if (!warned && name != "worlds") {
G4cout <<
G4warn <<
"WARNING: Parallel worlds in operation. To visualise, specify"
"\n \"worlds\" or the parallel world volume or sub-volume name"
"\n and control visibility with /vis/geometry."
@@ -3178,7 +3176,7 @@ void G4VisCommandSceneAddVolume::SetNewValue (G4UIcommand*,
std::vector<G4VPhysicalVolume*>::iterator iterWorld =
transportationManager->GetWorldsIterator();
for (size_t i = 0; i < nWorlds; ++i, ++iterWorld) {
G4cout << " World " << i << ": " << (*iterWorld)->GetName()
G4warn << " World " << i << ": " << (*iterWorld)->GetName()
<< G4endl;
warned = true;
}
@@ -3191,7 +3189,7 @@ void G4VisCommandSceneAddVolume::SetNewValue (G4UIcommand*,
if (!world) {
if (verbosity >= G4VisManager::errors) {
G4cerr <<
G4warn <<
"ERROR: G4VisCommandSceneAddVolume::SetNewValue:"
"\n No world. Maybe the geometry has not yet been defined."
"\n Try \"/run/initialize\""
@@ -3229,7 +3227,7 @@ void G4VisCommandSceneAddVolume::SetNewValue (G4UIcommand*,
if (nWorlds <= 1) {
if (verbosity >= G4VisManager::warnings) {
G4cout <<
G4warn <<
"WARNING: G4VisCommandSceneAddVolume::SetNewValue:"
"\n Parallel worlds requested but none exist."
"\n Just adding material world."
@@ -3313,11 +3311,11 @@ void G4VisCommandSceneAddVolume::SetNewValue (G4UIcommand*,
if (findingsVector.empty()) {
if (verbosity >= G4VisManager::errors) {
G4cerr << "ERROR: Volume \"" << name << "\"";
G4warn << "ERROR: Volume \"" << name << "\"";
if (copyNo >= 0) {
G4cerr << ", copy no. " << copyNo << ",";
G4warn << ", copy no. " << copyNo << ",";
}
G4cerr << " not found." << G4endl;
G4warn << " not found." << G4endl;
}
G4VisCommandsSceneAddUnsuccessful(verbosity);
return;
@@ -3350,7 +3348,7 @@ void G4VisCommandSceneAddPlotter::SetNewValue (G4UIcommand*, G4String newValue)
G4Scene* pScene = fpVisManager->GetCurrentScene();
if (!pScene) {
if (verbosity >= G4VisManager::errors) {
G4cerr << "ERROR: No current scene. Please create one." << G4endl;
G4warn << "ERROR: No current scene. Please create one." << G4endl;
}
return;
}
@@ -38,6 +38,8 @@
#include "G4ios.hh"
#include <sstream>
#define G4warn G4cout
////////////// /vis/sceneHandler/attach ///////////////////////////////////////
G4VisCommandSceneHandlerAttach::G4VisCommandSceneHandlerAttach () {
@@ -80,7 +82,7 @@ void G4VisCommandSceneHandlerAttach::SetNewValue (G4UIcommand*,
G4VSceneHandler* pSceneHandler = fpVisManager -> GetCurrentSceneHandler ();
if (!pSceneHandler) {
if (verbosity >= G4VisManager::errors) {
G4cerr <<
G4warn <<
"ERROR: Current scene handler not defined. Please select or create one."
<< G4endl;
}
@@ -91,15 +93,15 @@ void G4VisCommandSceneHandlerAttach::SetNewValue (G4UIcommand*,
if (sceneList.empty ()) {
if (verbosity >= G4VisManager::errors) {
G4cerr <<
G4warn <<
"ERROR: No valid scenes available yet. Please create one."
<< G4endl;
}
return;
}
G4int iScene, nScenes = sceneList.size ();
for (iScene = 0; iScene < nScenes; iScene++) {
std::size_t iScene, nScenes = sceneList.size ();
for (iScene = 0; iScene < nScenes; ++iScene) {
if (sceneList [iScene] -> GetName () == sceneName) break;
}
if (iScene < nScenes) {
@@ -125,7 +127,7 @@ void G4VisCommandSceneHandlerAttach::SetNewValue (G4UIcommand*,
}
else {
if (verbosity >= G4VisManager::errors) {
G4cerr << "ERROR: Scene \"" << sceneName
G4warn << "ERROR: Scene \"" << sceneName
<< "\" not found. Use \"/vis/scene/list\" to see possibilities."
<< G4endl;
}
@@ -209,7 +211,7 @@ void G4VisCommandSceneHandlerCreate::SetNewValue (G4UIcommand* command,
const G4GraphicsSystemList& gsl =
fpVisManager -> GetAvailableGraphicsSystems ();
G4int nSystems = gsl.size ();
std::size_t nSystems = gsl.size ();
if (nSystems <= 0) {
G4ExceptionDescription ed;
ed <<
@@ -220,16 +222,16 @@ void G4VisCommandSceneHandlerCreate::SetNewValue (G4UIcommand* command,
command->CommandFailed(ed);
return;
}
G4int iGS; // Selector index.
std::size_t iGS; // Selector index.
G4bool found = false;
for (iGS = 0; iGS < nSystems; iGS++) {
for (iGS = 0; iGS < nSystems; ++iGS) {
const auto& gs = gsl[iGS];
if (G4StrUtil::icompare(graphicsSystem, gs->GetName()) == 0) {
found = true;
break; // Match found
} else {
const auto& nicknames = gs->GetNicknames();
for (size_t i = 0; i < nicknames.size(); ++i) {
for (std::size_t i = 0; i < nicknames.size(); ++i) {
const auto& nickname = nicknames[i];
if (G4StrUtil::icompare(graphicsSystem, nickname) == 0) {
found = true;
@@ -259,13 +261,13 @@ void G4VisCommandSceneHandlerCreate::SetNewValue (G4UIcommand* command,
G4bool fallback = false;
G4int loopCounter = 0;
while (!gsl[iGS]->IsUISessionCompatible()) {
G4int iGSBeingTested = iGS;
std::size_t iGSBeingTested = iGS;
// Not compatible, search for a fallback
fallback = false;
G4String fallbackNickname = gsl[iGS]->GetNickname() + "_FALLBACK";
for (iGS = 0; iGS < nSystems; iGS++) {
const auto& nicknames = gsl[iGS]->GetNicknames();
for (size_t i = 0; i < nicknames.size(); ++i) {
for (std::size_t i = 0; i < nicknames.size(); ++i) {
const auto& nickname = nicknames[i];
if (G4StrUtil::icompare(fallbackNickname, nickname) == 0) {
fallback = true;
@@ -276,7 +278,7 @@ void G4VisCommandSceneHandlerCreate::SetNewValue (G4UIcommand* command,
break; // Match found
}
}
if (iGS < 0 || iGS >= nSystems || loopCounter >=3) {
if (iGS >= nSystems || loopCounter >=3) {
G4ExceptionDescription ed;
ed << "\"" << gsl[iGSBeingTested]->GetNickname()
<< "\" is not compatible with your chosen session,"
@@ -292,7 +294,7 @@ void G4VisCommandSceneHandlerCreate::SetNewValue (G4UIcommand* command,
G4VGraphicsSystem* pSystem = gsl [iGS];
if (fallback && verbosity >= G4VisManager::warnings) {
G4cout << "WARNING: G4VisCommandSceneHandlerCreate::SetNewValue:"
G4warn << "WARNING: G4VisCommandSceneHandlerCreate::SetNewValue:"
"\n Using fallback graphics system: "
<< pSystem -> GetName ()
<< " ("
@@ -309,8 +311,8 @@ void G4VisCommandSceneHandlerCreate::SetNewValue (G4UIcommand* command,
if (newName == nextName) fId++;
const G4SceneHandlerList& list = fpVisManager -> GetAvailableSceneHandlers ();
size_t iScene;
for (iScene = 0; iScene < list.size (); iScene++) {
std::size_t iScene;
for (iScene = 0; iScene < list.size (); ++iScene) {
G4VSceneHandler* sceneHandler = list [iScene];
if (sceneHandler -> GetName () == newName) {
G4ExceptionDescription ed;
@@ -409,7 +411,7 @@ void G4VisCommandSceneHandlerList::SetNewValue (G4UIcommand*,
const G4SceneHandlerList& list = fpVisManager -> GetAvailableSceneHandlers ();
G4bool found = false;
for (size_t iSH = 0; iSH < list.size (); iSH++) {
for (std::size_t iSH = 0; iSH < list.size (); ++iSH) {
const G4String& iName = list [iSH] -> GetName ();
if (name != "all") {
if (name != iName) continue;
@@ -466,7 +468,7 @@ void G4VisCommandSceneHandlerSelect::SetNewValue (G4UIcommand*,
G4String& selectName = newValue;
const G4SceneHandlerList& list = fpVisManager -> GetAvailableSceneHandlers ();
size_t iSH;
std::size_t iSH;
for (iSH = 0; iSH < list.size (); iSH++) {
if (list [iSH] -> GetName () == selectName) break;
}
@@ -488,7 +490,7 @@ void G4VisCommandSceneHandlerSelect::SetNewValue (G4UIcommand*,
}
else {
if (verbosity >= G4VisManager::errors) {
G4cerr << "ERROR: Scene handler \"" << selectName << "\""
G4warn << "ERROR: Scene handler \"" << selectName << "\""
<< " not found - \"/vis/sceneHandler/list\" to see possibilities."
<< G4endl;
}
@@ -40,6 +40,8 @@
#include "G4BoundingExtentScene.hh"
#include <sstream>
#define G4warn G4cout
////////////// /vis/set/arrow3DLineSegmentsPerCircle ////////////////////////////////////
G4VisCommandSetArrow3DLineSegmentsPerCircle::G4VisCommandSetArrow3DLineSegmentsPerCircle ()
@@ -233,7 +235,7 @@ void G4VisCommandSetLineWidth::SetNewValue (G4UIcommand*, G4String newValue)
fCurrentLineWidth = fpCommand->GetNewDoubleValue(newValue);
if (verbosity >= G4VisManager::warnings) {
G4cout <<
G4warn <<
"Line width for *future* \"/vis/scene/add/\" commands has been set to "
<< fCurrentLineWidth <<
"\nSee \"/vis/viewer/set/lineWidth\" for more information."
@@ -442,7 +444,7 @@ void G4VisCommandSetTouchable::SetNewValue (G4UIcommand*, G4String newValue)
iBegin = newValue.find_first_not_of(' ',iEnd);
if (iBegin == G4String::npos) {
if (verbosity >= G4VisManager::warnings) {
G4cout <<
G4warn <<
"WARNING: G4VisCommandSetTouchable::SetNewValue"
"\n A pair not found. (There should be an even number of parameters.)"
"\n Command ignored."
@@ -458,7 +460,7 @@ void G4VisCommandSetTouchable::SetNewValue (G4UIcommand*, G4String newValue)
std::istringstream iss(newValue.substr(iBegin,iEnd-iBegin));
if (!(iss >> copyNo)) {
if (verbosity >= G4VisManager::warnings) {
G4cout <<
G4warn <<
"WARNING: G4VisCommandSetTouchable::SetNewValue"
"\n Error reading copy number - it was not numeric?"
"\n Command ignored."
@@ -500,7 +502,7 @@ void G4VisCommandSetTouchable::SetNewValue (G4UIcommand*, G4String newValue)
}
} else {
if (verbosity >= G4VisManager::warnings) {
G4cout <<
G4warn <<
"WARNING: G4VisCommandSetTouchable::SetNewValue"
"\n Touchable not found."
<< G4endl;
@@ -577,11 +579,11 @@ void G4VisCommandSetVolumeForField::SetNewValue (G4UIcommand*, G4String newValue
if (fCurrrentPVFindingsForField.empty()) {
if (verbosity >= G4VisManager::errors) {
G4cerr << "ERROR: Volume \"" << name << "\"";
G4warn << "ERROR: Volume \"" << name << "\"";
if (copyNo >= 0) {
G4cerr << ", copy no. " << copyNo << ",";
G4warn << ", copy no. " << copyNo << ",";
}
G4cerr << " not found." << G4endl;
G4warn << " not found." << G4endl;
}
return;
}
@@ -41,6 +41,8 @@
#include "G4AttCheck.hh"
#include "G4AxesModel.hh"
#define G4warn G4cout
G4VisCommandsTouchable::G4VisCommandsTouchable()
{
G4bool omitable;
@@ -159,7 +161,7 @@ void G4VisCommandsTouchable::SetNewValue
G4VPhysicalVolume* world = *(transportationManager->GetWorldsIterator());
if (!world) {
if (verbosity >= G4VisManager::errors) {
G4cerr <<
G4warn <<
"ERROR: G4VisCommandsTouchable::SetNewValue:"
"\n No world. Maybe the geometry has not yet been defined."
"\n Try \"/run/initialize\""
@@ -171,7 +173,7 @@ void G4VisCommandsTouchable::SetNewValue
G4VViewer* currentViewer = fpVisManager -> GetCurrentViewer ();
if (!currentViewer) {
if (verbosity >= G4VisManager::errors) {
G4cerr <<
G4warn <<
"ERROR: No current viewer - \"/vis/viewer/list\" to see possibilities."
<< G4endl;
}
@@ -181,7 +183,7 @@ void G4VisCommandsTouchable::SetNewValue
G4Scene* currentScene = fpVisManager->GetCurrentScene();
if (!currentScene) {
if (verbosity >= G4VisManager::errors) {
G4cerr <<
G4warn <<
"ERROR: No current scene - \"/vis/scene/list\" to see possibilities."
<< G4endl;
}
@@ -232,12 +234,12 @@ void G4VisCommandsTouchable::SetNewValue
newVP.SetCurrentTargetPoint(newTargetPoint - standardTargetPoint);
// Interpolate
auto keepVerbose = fpVisManager->GetVerbosity();
auto keepVisVerbose = fpVisManager->GetVerbosity();
fpVisManager->SetVerboseLevel(G4VisManager::errors);
if (newVP != saveVP) InterpolateToNewView(currentViewer, saveVP, newVP);
// ...and twinkle
Twinkle(currentViewer,newVP,touchables);
fpVisManager->SetVerboseLevel(keepVerbose);
fpVisManager->SetVerboseLevel(keepVisVerbose);
if (verbosity >= G4VisManager::confirmations) {
G4cout
@@ -251,7 +253,7 @@ void G4VisCommandsTouchable::SetNewValue
}
SetViewParameters(currentViewer, newVP);
} else {
G4cout << "Touchable not found." << G4endl;
G4warn << "Touchable not found." << G4endl;
}
return;
@@ -271,16 +273,10 @@ void G4VisCommandsTouchable::SetNewValue
true, // use full extent (prevents calculating own extent, which crashes)
properties.fTouchableBaseFullPVPath);
G4int keepVerbose = UImanager->GetVerboseLevel();
G4int newVerbose(0);
if (keepVerbose >= 2 || verbosity >= G4VisManager::confirmations)
newVerbose = 2;
UImanager->SetVerboseLevel(newVerbose);
UImanager->ApplyCommand("/vis/scene/create");
currentScene = fpVisManager->GetCurrentScene(); // New current scene
G4bool successful = currentScene->AddRunDurationModel(pvModel,warn);
UImanager->ApplyCommand("/vis/sceneHandler/attach");
UImanager->SetVerboseLevel(keepVerbose);
if (successful) {
if (fpCommandDraw->GetNewBoolValue(newValue)) {
@@ -305,7 +301,7 @@ void G4VisCommandsTouchable::SetNewValue
G4VisCommandsSceneAddUnsuccessful(verbosity);
}
} else {
G4cout << "Touchable not found." << G4endl;
G4warn << "Touchable not found." << G4endl;
}
return;
@@ -335,7 +331,7 @@ void G4VisCommandsTouchable::SetNewValue
polyhedron->Transform(transform);
G4cout << "\nGlobal polyhedron coordinates:\n" << *polyhedron;
} else {
G4cout << "Touchable not found." << G4endl;
G4warn << "Touchable not found." << G4endl;
}
return;
@@ -358,7 +354,7 @@ void G4VisCommandsTouchable::SetNewValue
DrawExtent(extent);
}
} else {
G4cout << "Touchable not found." << G4endl;
G4warn << "Touchable not found." << G4endl;
}
return;
@@ -398,9 +394,9 @@ void G4VisCommandsTouchable::SetNewValue
<< "\nor to see overlaps: \"/vis/drawLogicalVolume <mother-logical-volume-name>\""
<< G4endl;
} else {
G4cout << pvName;
if (copyNo >= 0) G4cout << ':' << copyNo;
G4cout << " not found" << G4endl;
G4warn << pvName;
if (copyNo >= 0) G4warn << ':' << copyNo;
G4warn << " not found" << G4endl;
}
} else if (command == fpCommandLocalAxes) {
@@ -427,7 +423,7 @@ void G4VisCommandsTouchable::SetNewValue
G4cout << extent << G4endl;
if (fpCommandShowExtent->GetNewBoolValue(newValue)) DrawExtent(extent);
} else {
G4cout << "Touchable not found." << G4endl;
G4warn << "Touchable not found." << G4endl;
}
return;
@@ -454,14 +450,14 @@ void G4VisCommandsTouchable::SetNewValue
DrawExtent(extent);
}
} else {
G4cout << "Touchable not found." << G4endl;
G4warn << "Touchable not found." << G4endl;
}
return;
} else {
if (verbosity >= G4VisManager::errors) {
G4cerr <<
G4warn <<
"ERROR: G4VisCommandsTouchable::SetNewValue: unrecognised command."
<< G4endl;
}
@@ -38,6 +38,8 @@
#include <sstream>
#define G4warn G4cout
////////////// /vis/touchable/set/colour ///////////////////////////////////////
G4VisCommandsTouchableSet::G4VisCommandsTouchableSet()
@@ -184,7 +186,7 @@ void G4VisCommandsTouchableSet::SetNewValue
G4VViewer* currentViewer = fpVisManager->GetCurrentViewer();
if (!currentViewer) {
if (verbosity >= G4VisManager::errors) {
G4cerr <<
G4warn <<
"ERROR: G4VisCommandsTouchableSet::SetNewValue: no current viewer."
<< G4endl;
}
@@ -311,7 +313,7 @@ void G4VisCommandsTouchableSet::SetNewValue
else {
if (verbosity >= G4VisManager::errors) {
G4cerr <<
G4warn <<
"ERROR: G4VisCommandsTouchableSet::SetNewValue: unrecognised command."
<< G4endl;
}
@@ -54,6 +54,8 @@
#include <regex>
#include <set>
#define G4warn G4cout
////////////// /vis/viewer/addCutawayPlane ///////////////////////////////////////
G4VisCommandViewerAddCutawayPlane::G4VisCommandViewerAddCutawayPlane () {
@@ -107,7 +109,7 @@ void G4VisCommandViewerAddCutawayPlane::SetNewValue (G4UIcommand*, G4String newV
G4VViewer* viewer = fpVisManager -> GetCurrentViewer ();
if (!viewer) {
if (verbosity >= G4VisManager::errors) {
G4cerr <<
G4warn <<
"ERROR: No current viewer - \"/vis/viewer/list\" to see possibilities."
<< G4endl;
}
@@ -122,11 +124,12 @@ void G4VisCommandViewerAddCutawayPlane::SetNewValue (G4UIcommand*, G4String newV
x *= F; y *= F; z *= F;
G4ViewParameters vp = viewer->GetViewParameters();
vp.AddCutawayPlane(G4Plane3D(G4Normal3D(nx,ny,nz), G4Point3D(x,y,z)));
// Make sure normal is normalised.
vp.AddCutawayPlane(G4Plane3D(G4Normal3D(nx,ny,nz).unit(), G4Point3D(x,y,z)));
if (verbosity >= G4VisManager::confirmations) {
G4cout << "Cutaway planes for viewer \"" << viewer->GetName() << "\" now:";
const G4Planes& cutaways = vp.GetCutawayPlanes();
for (size_t i = 0; i < cutaways.size(); ++i)
for (std::size_t i = 0; i < cutaways.size(); ++i)
G4cout << "\n " << i << ": " << cutaways[i];
G4cout << G4endl;
}
@@ -191,7 +194,7 @@ void G4VisCommandViewerCentreOn::SetNewValue (G4UIcommand* command, G4String new
G4VViewer* currentViewer = fpVisManager -> GetCurrentViewer ();
if (!currentViewer) {
if (verbosity >= G4VisManager::errors) {
G4cerr <<
G4warn <<
"ERROR: No current viewer - \"/vis/viewer/list\" to see possibilities."
<< G4endl;
}
@@ -206,11 +209,11 @@ void G4VisCommandViewerCentreOn::SetNewValue (G4UIcommand* command, G4String new
// Find physical volumes
G4TransportationManager* transportationManager =
G4TransportationManager::GetTransportationManager ();
size_t nWorlds = transportationManager->GetNoWorlds();
std::size_t nWorlds = transportationManager->GetNoWorlds();
std::vector<G4PhysicalVolumesSearchScene::Findings> findingsVector;
std::vector<G4VPhysicalVolume*>::iterator iterWorld =
transportationManager->GetWorldsIterator();
for (size_t i = 0; i < nWorlds; ++i, ++iterWorld) {
for (std::size_t i = 0; i < nWorlds; ++i, ++iterWorld) {
G4PhysicalVolumeModel searchModel (*iterWorld); // Unlimited depth.
G4ModelingParameters mp; // Default - no culling.
searchModel.SetModelingParameters (&mp);
@@ -224,12 +227,12 @@ void G4VisCommandViewerCentreOn::SetNewValue (G4UIcommand* command, G4String new
if (findingsVector.empty()) {
if (verbosity >= G4VisManager::warnings) {
G4cerr
G4warn
<< "WARNING: Volume \"" << pvName << "\" ";
if (copyNo > 0) {
G4cerr << "copy number " << copyNo;
G4warn << "copy number " << copyNo;
}
G4cerr << " not found." << G4endl;
G4warn << " not found." << G4endl;
}
return;
}
@@ -297,12 +300,12 @@ void G4VisCommandViewerCentreOn::SetNewValue (G4UIcommand* command, G4String new
// If this particular view is simple enough
if (currentViewer->GetKernelVisitElapsedTimeSeconds() < 0.1) {
// Interpolate
auto keepVerbose = fpVisManager->GetVerbosity();
auto keepVisVerbosity = fpVisManager->GetVerbosity();
fpVisManager->SetVerboseLevel(G4VisManager::errors);
if (newVP != saveVP) InterpolateToNewView(currentViewer, saveVP, newVP);
// ...and twinkle
Twinkle(currentViewer,newVP,foundPaths);
fpVisManager->SetVerboseLevel(keepVerbose);
fpVisManager->SetVerboseLevel(keepVisVerbosity);
}
if (verbosity >= G4VisManager::confirmations) {
@@ -374,14 +377,14 @@ void G4VisCommandViewerChangeCutawayPlane::SetNewValue (G4UIcommand*, G4String n
G4VViewer* viewer = fpVisManager -> GetCurrentViewer ();
if (!viewer) {
if (verbosity >= G4VisManager::errors) {
G4cerr <<
G4warn <<
"ERROR: No current viewer - \"/vis/viewer/list\" to see possibilities."
<< G4endl;
}
return;
}
size_t index;
std::size_t index;
G4double x, y, z, nx, ny, nz;
G4String unit;
std::istringstream is (newValue);
@@ -390,12 +393,13 @@ void G4VisCommandViewerChangeCutawayPlane::SetNewValue (G4UIcommand*, G4String n
x *= F; y *= F; z *= F;
G4ViewParameters vp = viewer->GetViewParameters();
// Make sure normal is normalised.
vp.ChangeCutawayPlane(index,
G4Plane3D(G4Normal3D(nx,ny,nz), G4Point3D(x,y,z)));
G4Plane3D(G4Normal3D(nx,ny,nz).unit(), G4Point3D(x,y,z)));
if (verbosity >= G4VisManager::confirmations) {
G4cout << "Cutaway planes for viewer \"" << viewer->GetName() << "\" now:";
const G4Planes& cutaways = vp.GetCutawayPlanes();
for (size_t i = 0; i < cutaways.size(); ++i)
for (std::size_t i = 0; i < cutaways.size(); ++i)
G4cout << "\n " << i << ": " << cutaways[i];
G4cout << G4endl;
}
@@ -434,7 +438,7 @@ void G4VisCommandViewerClear::SetNewValue (G4UIcommand*, G4String newValue) {
G4VViewer* viewer = fpVisManager -> GetViewer (clearName);
if (!viewer) {
if (verbosity >= G4VisManager::errors) {
G4cerr << "ERROR: Viewer \"" << clearName
G4warn << "ERROR: Viewer \"" << clearName
<< "\" not found - \"/vis/viewer/list\" to see possibilities."
<< G4endl;
}
@@ -473,7 +477,7 @@ void G4VisCommandViewerClearCutawayPlanes::SetNewValue (G4UIcommand*, G4String)
G4VViewer* viewer = fpVisManager -> GetCurrentViewer ();
if (!viewer) {
if (verbosity >= G4VisManager::errors) {
G4cerr <<
G4warn <<
"ERROR: No current viewer - \"/vis/viewer/list\" to see possibilities."
<< G4endl;
}
@@ -521,7 +525,7 @@ void G4VisCommandViewerClearTransients::SetNewValue (G4UIcommand*, G4String newV
G4VViewer* viewer = fpVisManager -> GetViewer (clearName);
if (!viewer) {
if (verbosity >= G4VisManager::errors) {
G4cerr << "ERROR: Viewer \"" << clearName
G4warn << "ERROR: Viewer \"" << clearName
<< "\" not found - \"/vis/viewer/list\" to see possibilities."
<< G4endl;
}
@@ -563,7 +567,7 @@ void G4VisCommandViewerClearVisAttributesModifiers::SetNewValue (G4UIcommand*, G
G4VViewer* viewer = fpVisManager -> GetCurrentViewer ();
if (!viewer) {
if (verbosity >= G4VisManager::errors) {
G4cerr <<
G4warn <<
"ERROR: No current viewer - \"/vis/viewer/list\" to see possibilities."
<< G4endl;
}
@@ -633,7 +637,7 @@ void G4VisCommandViewerClone::SetNewValue (G4UIcommand*, G4String newValue) {
G4VViewer* originalViewer = fpVisManager -> GetViewer (originalName);
if (!originalViewer) {
if (verbosity >= G4VisManager::errors) {
G4cerr << "ERROR: Viewer \"" << originalName
G4warn << "ERROR: Viewer \"" << originalName
<< "\" not found - \"/vis/viewer/list\" to see possibilities."
<< G4endl;
}
@@ -676,7 +680,7 @@ void G4VisCommandViewerClone::SetNewValue (G4UIcommand*, G4String newValue) {
if (errorWhileNaming) {
if (verbosity >= G4VisManager::errors) {
G4cerr << "ERROR: While naming clone viewer \"" << cloneName
G4warn << "ERROR: While naming clone viewer \"" << cloneName
<< "\"."
<< G4endl;
}
@@ -685,7 +689,7 @@ void G4VisCommandViewerClone::SetNewValue (G4UIcommand*, G4String newValue) {
if (fpVisManager -> GetViewer (cloneName)) {
if (verbosity >= G4VisManager::errors) {
G4cerr << "ERROR: Putative clone viewer \"" << cloneName
G4warn << "ERROR: Putative clone viewer \"" << cloneName
<< "\" already exists."
<< G4endl;
}
@@ -696,17 +700,10 @@ void G4VisCommandViewerClone::SetNewValue (G4UIcommand*, G4String newValue) {
originalViewer->GetViewParameters().GetXGeometryString();
G4UImanager* UImanager = G4UImanager::GetUIpointer();
G4int keepVerbose = UImanager->GetVerboseLevel();
G4int newVerbose(0);
if (keepVerbose >= 2 ||
fpVisManager->GetVerbosity() >= G4VisManager::confirmations)
newVerbose = 2;
UImanager->SetVerboseLevel(newVerbose);
UImanager->ApplyCommand(G4String("/vis/viewer/select " + originalName));
UImanager->ApplyCommand
(G4String("/vis/viewer/create ! \"" + cloneName + "\" " + windowSizeHint));
UImanager->ApplyCommand(G4String("/vis/viewer/set/all " + originalName));
UImanager->SetVerboseLevel(keepVerbose);
if (verbosity >= G4VisManager::confirmations) {
G4cout << "Viewer \"" << originalName << "\" cloned." << G4endl;
@@ -769,7 +766,7 @@ void G4VisCommandViewerColourByDensity::SetNewValue (G4UIcommand*, G4String newV
G4VViewer* viewer = fpVisManager -> GetCurrentViewer ();
if (!viewer) {
if (verbosity >= G4VisManager::errors) {
G4cerr <<
G4warn <<
"ERROR: No current viewer - \"/vis/viewer/list\" to see possibilities."
<< G4endl;
}
@@ -785,7 +782,7 @@ void G4VisCommandViewerColourByDensity::SetNewValue (G4UIcommand*, G4String newV
if (algorithmNumber < 0 || algorithmNumber > 1) {
if (verbosity >= G4VisManager::errors) {
G4cerr <<
G4warn <<
"ERROR: Unrecognised algorithm number: " << algorithmNumber
<< G4endl;
}
@@ -802,7 +799,7 @@ void G4VisCommandViewerColourByDensity::SetNewValue (G4UIcommand*, G4String newV
d0 *= valueOfUnit; d1 *= valueOfUnit; d2 *= valueOfUnit;
} else {
if (verbosity >= G4VisManager::errors) {
G4cerr <<
G4warn <<
"ERROR: Unrecognised or inappropriate unit: " << unit
<< G4endl;
}
@@ -860,7 +857,7 @@ void G4VisCommandViewerCopyViewFrom::SetNewValue (G4UIcommand*, G4String newValu
G4VViewer* currentViewer = fpVisManager->GetCurrentViewer();
if (!currentViewer) {
if (verbosity >= G4VisManager::errors) {
G4cerr <<
G4warn <<
"ERROR: G4VisCommandsViewerCopyViewFrom::SetNewValue: no current viewer."
<< G4endl;
}
@@ -871,7 +868,7 @@ void G4VisCommandViewerCopyViewFrom::SetNewValue (G4UIcommand*, G4String newValu
G4VViewer* fromViewer = fpVisManager -> GetViewer (fromViewerName);
if (!fromViewer) {
if (verbosity >= G4VisManager::errors) {
G4cerr << "ERROR: Viewer \"" << fromViewerName
G4warn << "ERROR: Viewer \"" << fromViewerName
<< "\" not found - \"/vis/viewer/list\" to see possibilities."
<< G4endl;
}
@@ -880,7 +877,7 @@ void G4VisCommandViewerCopyViewFrom::SetNewValue (G4UIcommand*, G4String newValu
if (fromViewer == currentViewer) {
if (verbosity >= G4VisManager::warnings) {
G4cout <<
G4warn <<
"WARNING: G4VisCommandsViewerSet::SetNewValue:"
"\n from-viewer and current viewer are identical."
<< G4endl;
@@ -1010,8 +1007,8 @@ void G4VisCommandViewerCreate::SetNewValue (G4UIcommand* command, G4String newVa
const G4SceneHandlerList& sceneHandlerList =
fpVisManager -> GetAvailableSceneHandlers ();
G4int nHandlers = sceneHandlerList.size ();
if (nHandlers <= 0) {
std::size_t nHandlers = sceneHandlerList.size ();
if (nHandlers == 0) {
G4ExceptionDescription ed;
ed <<
"ERROR: G4VisCommandViewerCreate::SetNewValue: no scene handlers."
@@ -1020,12 +1017,12 @@ void G4VisCommandViewerCreate::SetNewValue (G4UIcommand* command, G4String newVa
return;
}
G4int iHandler;
for (iHandler = 0; iHandler < nHandlers; iHandler++) {
std::size_t iHandler;
for (iHandler = 0; iHandler < nHandlers; ++iHandler) {
if (sceneHandlerList [iHandler] -> GetName () == sceneHandlerName) break;
}
if (iHandler < 0 || iHandler >= nHandlers) {
if (iHandler >= nHandlers) {
// Invalid command line argument or none.
// This shouldn't happen!!!!!!
G4ExceptionDescription ed;
@@ -1050,10 +1047,10 @@ void G4VisCommandViewerCreate::SetNewValue (G4UIcommand* command, G4String newVa
if (newName == nextName) fId++;
G4String newShortName = fpVisManager -> ViewerShortName (newName);
for (G4int ih = 0; ih < nHandlers; ih++) {
for (std::size_t ih = 0; ih < nHandlers; ++ih) {
G4VSceneHandler* sh = sceneHandlerList [ih];
const G4ViewerList& viewerList = sh -> GetViewerList ();
for (size_t iViewer = 0; iViewer < viewerList.size (); iViewer++) {
for (std::size_t iViewer = 0; iViewer < viewerList.size (); iViewer++) {
if (viewerList [iViewer] -> GetShortName () == newShortName ) {
G4ExceptionDescription ed;
ed <<
@@ -1117,7 +1114,7 @@ void G4VisCommandViewerCreate::SetNewValue (G4UIcommand* command, G4String newVa
}
else {
if (verbosity >= G4VisManager::warnings) {
G4cout << "Issue /vis/viewer/refresh or flush to see effect."
G4warn << "Issue /vis/viewer/refresh or flush to see effect."
<< G4endl;
}
}
@@ -1180,7 +1177,7 @@ void G4VisCommandViewerDolly::SetNewValue (G4UIcommand* command,
G4VViewer* currentViewer = fpVisManager->GetCurrentViewer();
if (!currentViewer) {
if (verbosity >= G4VisManager::errors) {
G4cerr <<
G4warn <<
"ERROR: G4VisCommandsViewerDolly::SetNewValue: no current viewer."
<< G4endl;
}
@@ -1240,7 +1237,7 @@ void G4VisCommandViewerFlush::SetNewValue (G4UIcommand*, G4String newValue) {
G4VViewer* viewer = fpVisManager -> GetViewer (flushName);
if (!viewer) {
if (verbosity >= G4VisManager::errors) {
G4cerr << "ERROR: Viewer \"" << flushName << "\"" <<
G4warn << "ERROR: Viewer \"" << flushName << "\"" <<
" not found - \"/vis/viewer/list\"\n to see possibilities."
<< G4endl;
}
@@ -1248,14 +1245,8 @@ void G4VisCommandViewerFlush::SetNewValue (G4UIcommand*, G4String newValue) {
}
G4UImanager* ui = G4UImanager::GetUIpointer();
G4int keepVerbose = ui->GetVerboseLevel();
G4int newVerbose(0);
if (keepVerbose >= 2 || verbosity >= G4VisManager::confirmations)
newVerbose = 2;
ui->SetVerboseLevel(newVerbose);
ui->ApplyCommand(G4String("/vis/viewer/refresh " + flushName));
ui->ApplyCommand(G4String("/vis/viewer/update " + flushName));
ui->SetVerboseLevel(keepVerbose);
if (verbosity >= G4VisManager::confirmations) {
G4cout << "Viewer \"" << viewer -> GetName () << "\""
<< " flushed." << G4endl;
@@ -1319,7 +1310,7 @@ void G4VisCommandViewerInterpolate::SetNewValue (G4UIcommand*, G4String newValue
G4VViewer* currentViewer = fpVisManager->GetCurrentViewer();
if (!currentViewer) {
if (verbosity >= G4VisManager::errors) {
G4cerr <<
G4warn <<
"ERROR: G4VisCommandViewerInterpolate::SetNewValue: no current viewer."
<< G4endl;
}
@@ -1392,7 +1383,7 @@ void G4VisCommandViewerInterpolate::SetNewValue (G4UIcommand*, G4String newValue
// Default pattern is *.g4view, which translates to ^.*\\.g4view
// Convert pattern into a regexp
G4String regexp_pattern("^");
for (size_t i = 0; i < pattern.length(); ++i) {
for (G4int i = 0; i < (G4int)pattern.length(); ++i) {
if (pattern[i] == '.') {
regexp_pattern += "\\.";
} else if (pattern[i] == '*') {
@@ -1416,7 +1407,7 @@ void G4VisCommandViewerInterpolate::SetNewValue (G4UIcommand*, G4String newValue
if (safetyCount > safety) {
if (verbosity >= G4VisManager::errors) {
G4cerr <<
G4warn <<
"/vis/viewer/interpolate:"
"\n the number of way points has been limited to the maximum currently allowed: "
<< safety << G4endl;
@@ -1496,10 +1487,10 @@ void G4VisCommandViewerList::SetNewValue (G4UIcommand*, G4String newValue) {
const G4SceneHandlerList& sceneHandlerList =
fpVisManager -> GetAvailableSceneHandlers ();
G4int nHandlers = sceneHandlerList.size ();
std::size_t nHandlers = sceneHandlerList.size ();
G4bool found = false;
G4bool foundCurrent = false;
for (int iHandler = 0; iHandler < nHandlers; iHandler++) {
for (std::size_t iHandler = 0; iHandler < nHandlers; ++iHandler) {
G4VSceneHandler* sceneHandler = sceneHandlerList [iHandler];
const G4ViewerList& viewerList = sceneHandler -> GetViewerList ();
G4cout
@@ -1510,12 +1501,12 @@ void G4VisCommandViewerList::SetNewValue (G4UIcommand*, G4String newValue) {
G4cout << ", scene \"" << pScene -> GetName () << "\"";
}
G4cout << ':';
G4int nViewers = viewerList.size ();
std::size_t nViewers = viewerList.size ();
if (nViewers == 0) {
G4cout << "\n No viewers for this scene handler." << G4endl;
}
else {
for (int iViewer = 0; iViewer < nViewers; iViewer++) {
for (std::size_t iViewer = 0; iViewer < nViewers; ++iViewer) {
const G4VViewer* thisViewer = viewerList [iViewer];
G4String thisName = thisViewer -> GetName ();
G4String thisShortName = thisViewer -> GetShortName ();
@@ -1625,7 +1616,7 @@ void G4VisCommandViewerPan::SetNewValue (G4UIcommand* command,
G4VViewer* currentViewer = fpVisManager->GetCurrentViewer();
if (!currentViewer) {
if (verbosity >= G4VisManager::errors) {
G4cerr <<
G4warn <<
"ERROR: G4VisCommandsViewerPan::SetNewValue: no current viewer."
<< G4endl;
}
@@ -1688,7 +1679,7 @@ void G4VisCommandViewerRebuild::SetNewValue (G4UIcommand*, G4String newValue) {
G4VViewer* viewer = fpVisManager -> GetViewer (rebuildName);
if (!viewer) {
if (verbosity >= G4VisManager::errors) {
G4cerr << "ERROR: Viewer \"" << rebuildName
G4warn << "ERROR: Viewer \"" << rebuildName
<< "\" not found - \"/vis/viewer/list\" to see possibilities."
<< G4endl;
}
@@ -1698,7 +1689,7 @@ void G4VisCommandViewerRebuild::SetNewValue (G4UIcommand*, G4String newValue) {
G4VSceneHandler* sceneHandler = viewer->GetSceneHandler();
if (!sceneHandler) {
if (verbosity >= G4VisManager::errors) {
G4cerr << "ERROR: Viewer \"" << viewer->GetName() << "\"" <<
G4warn << "ERROR: Viewer \"" << viewer->GetName() << "\"" <<
" has no scene handler - report serious bug."
<< G4endl;
}
@@ -1748,7 +1739,7 @@ void G4VisCommandViewerRefresh::SetNewValue (G4UIcommand*, G4String newValue) {
G4VViewer* viewer = fpVisManager -> GetViewer (refreshName);
if (!viewer) {
if (verbosity >= G4VisManager::errors) {
G4cerr << "ERROR: Viewer \"" << refreshName << "\"" <<
G4warn << "ERROR: Viewer \"" << refreshName << "\"" <<
" not found - \"/vis/viewer/list\"\n to see possibilities."
<< G4endl;
}
@@ -1758,7 +1749,7 @@ void G4VisCommandViewerRefresh::SetNewValue (G4UIcommand*, G4String newValue) {
G4VSceneHandler* sceneHandler = viewer->GetSceneHandler();
if (!sceneHandler) {
if (verbosity >= G4VisManager::errors) {
G4cerr << "ERROR: Viewer \"" << refreshName << "\"" <<
G4warn << "ERROR: Viewer \"" << refreshName << "\"" <<
" has no scene handler - report serious bug."
<< G4endl;
}
@@ -1781,7 +1772,7 @@ void G4VisCommandViewerRefresh::SetNewValue (G4UIcommand*, G4String newValue) {
G4bool successful = scene -> AddWorldIfEmpty (warn);
if (!successful) {
if (verbosity >= G4VisManager::warnings) {
G4cout <<
G4warn <<
"WARNING: Scene is empty. Perhaps no geometry exists."
"\n Try /run/initialize."
<< G4endl;
@@ -1843,7 +1834,7 @@ void G4VisCommandViewerReset::SetNewValue (G4UIcommand*, G4String newValue) {
G4VViewer* viewer = fpVisManager -> GetViewer (resetName);
if (!viewer) {
if (verbosity >= G4VisManager::errors) {
G4cerr << "ERROR: Viewer \"" << resetName
G4warn << "ERROR: Viewer \"" << resetName
<< "\" not found - \"/vis/viewer/list\" to see possibilities."
<< G4endl;
}
@@ -1890,7 +1881,7 @@ void G4VisCommandViewerResetCameraParameters::SetNewValue (G4UIcommand*, G4Strin
G4VViewer* viewer = fpVisManager -> GetViewer (resetName);
if (!viewer) {
if (verbosity >= G4VisManager::errors) {
G4cerr << "ERROR: Viewer \"" << resetName
G4warn << "ERROR: Viewer \"" << resetName
<< "\" not found - \"/vis/viewer/list\" to see possibilities."
<< G4endl;
}
@@ -1958,7 +1949,7 @@ void G4VisCommandViewerSave::SetNewValue (G4UIcommand*, G4String newValue) {
const G4VViewer* currentViewer = fpVisManager->GetCurrentViewer();
if (!currentViewer) {
if (verbosity >= G4VisManager::errors) {
G4cerr <<
G4warn <<
"ERROR: G4VisCommandsViewerSave::SetNewValue: no current viewer."
<< G4endl;
}
@@ -1968,7 +1959,7 @@ void G4VisCommandViewerSave::SetNewValue (G4UIcommand*, G4String newValue) {
const G4Scene* currentScene = currentViewer->GetSceneHandler()->GetScene();
if (!currentScene) {
if (verbosity >= G4VisManager::errors) {
G4cerr <<
G4warn <<
"ERROR: G4VisCommandsViewerSave::SetNewValue: no current scene."
<< G4endl;
}
@@ -1996,7 +1987,7 @@ void G4VisCommandViewerSave::SetNewValue (G4UIcommand*, G4String newValue) {
static G4int sequenceNumber = 0;
if (sequenceNumber >= maxNoOfFiles) {
if (verbosity >= G4VisManager::errors) {
G4cerr
G4warn
<< "ERROR: G4VisCommandsViewerSave::SetNewValue: Maximum number, "
<< maxNoOfFiles
<< ", of files exceeded."
@@ -2021,7 +2012,7 @@ void G4VisCommandViewerSave::SetNewValue (G4UIcommand*, G4String newValue) {
std::ofstream ofs(filename);
if (!ofs) {
if (verbosity >= G4VisManager::errors) {
G4cerr <<
G4warn <<
"ERROR: G4VisCommandsViewerSave::SetNewValue: Trouble opening file \""
<< filename << "\"."
<< G4endl;
@@ -2034,18 +2025,18 @@ void G4VisCommandViewerSave::SetNewValue (G4UIcommand*, G4String newValue) {
}
if (verbosity >= G4VisManager::warnings) {
G4cout << "Viewer \"" << currentViewer -> GetName ()
G4warn << "Viewer \"" << currentViewer -> GetName ()
<< "\"" << " saved to ";
if (filename == "-") {
G4cout << "G4cout.";
G4warn << "G4cout.";
} else {
G4cout << "file \'" << filename << "\"." <<
G4warn << "file \'" << filename << "\"." <<
"\n Read the view back into this or any viewer with"
"\n \"/control/execute " << filename << "\" or use"
"\n \"/vis/viewer/interpolate\" if you have several saved files -"
"\n see \"help /vis/viewer/interpolate\" for guidance.";
}
G4cout << G4endl;
G4warn << G4endl;
}
}
@@ -2104,7 +2095,7 @@ void G4VisCommandViewerScale::SetNewValue (G4UIcommand* command,
G4VViewer* currentViewer = fpVisManager->GetCurrentViewer();
if (!currentViewer) {
if (verbosity >= G4VisManager::errors) {
G4cerr <<
G4warn <<
"ERROR: G4VisCommandsViewerScale::SetNewValue: no current viewer."
<< G4endl;
}
@@ -2157,8 +2148,8 @@ void G4VisCommandViewerSelect::SetNewValue (G4UIcommand*, G4String newValue) {
if (!viewer) {
if (verbosity >= G4VisManager::errors) {
G4cerr << "ERROR: Viewer \"" << selectName << "\"";
G4cerr << " not found - \"/vis/viewer/list\""
G4warn << "ERROR: Viewer \"" << selectName << "\"";
G4warn << " not found - \"/vis/viewer/list\""
"\n to see possibilities."
<< G4endl;
}
@@ -2167,7 +2158,7 @@ void G4VisCommandViewerSelect::SetNewValue (G4UIcommand*, G4String newValue) {
if (viewer == fpVisManager -> GetCurrentViewer ()) {
if (verbosity >= G4VisManager::warnings) {
G4cout << "WARNING: Viewer \"" << viewer -> GetName () << "\""
G4warn << "WARNING: Viewer \"" << viewer -> GetName () << "\""
<< " already selected." << G4endl;
}
return;
@@ -2219,7 +2210,7 @@ void G4VisCommandViewerUpdate::SetNewValue (G4UIcommand*, G4String newValue) {
G4VViewer* viewer = fpVisManager -> GetViewer (updateName);
if (!viewer) {
if (verbosity >= G4VisManager::errors) {
G4cout <<
G4warn <<
"WARNING: command \"/vis/viewer/update\" could not be applied: no current viewer."
<< G4endl;
}
@@ -2229,7 +2220,7 @@ void G4VisCommandViewerUpdate::SetNewValue (G4UIcommand*, G4String newValue) {
G4VSceneHandler* sceneHandler = viewer->GetSceneHandler();
if (!sceneHandler) {
if (verbosity >= G4VisManager::errors) {
G4cerr << "ERROR: Viewer \"" << updateName << "\"" <<
G4warn << "ERROR: Viewer \"" << updateName << "\"" <<
" has no scene handler - report serious bug."
<< G4endl;
}
@@ -2310,7 +2301,7 @@ void G4VisCommandViewerZoom::SetNewValue (G4UIcommand* command,
G4VViewer* currentViewer = fpVisManager->GetCurrentViewer();
if (!currentViewer) {
if (verbosity >= G4VisManager::errors) {
G4cerr <<
G4warn <<
"ERROR: G4VisCommandsViewerZoom::SetNewValue: no current viewer."
<< G4endl;
}
@@ -33,6 +33,8 @@
#include "G4UIcmdWithAString.hh"
#include "G4UIcmdWithABool.hh"
#define G4warn G4cout
////////////// /vis/viewer/default/hiddenEdge ///////////////////////////////////////
G4VisCommandViewerDefaultHiddenEdge::G4VisCommandViewerDefaultHiddenEdge()
@@ -193,7 +195,7 @@ void G4VisCommandViewerDefaultStyle::SetNewValue(G4UIcommand*, G4String newValue
}
else {
if (verbosity >= G4VisManager::errors) {
G4cerr << "ERROR: \"" << newValue << "\" not recognised."
G4warn << "ERROR: \"" << newValue << "\" not recognised."
" Looking for 'w' or 's' or 'c' first character." << G4endl;
}
return;
@@ -44,6 +44,8 @@
#include <sstream>
#include <iomanip>
#define G4warn G4cout
G4VisCommandsViewerSet::G4VisCommandsViewerSet ():
fLightsVector (G4ThreeVector(1.,1.,1.)),
fUpVector (G4ThreeVector(0.,1.,0.)),
@@ -686,7 +688,7 @@ void G4VisCommandsViewerSet::SetNewValue
G4VViewer* currentViewer = fpVisManager->GetCurrentViewer();
if (!currentViewer) {
if (verbosity >= G4VisManager::errors) {
G4cerr <<
G4warn <<
"ERROR: G4VisCommandsViewerSet::SetNewValue: no current viewer."
<< G4endl;
}
@@ -699,7 +701,7 @@ void G4VisCommandsViewerSet::SetNewValue
G4VViewer* fromViewer = fpVisManager->GetViewer(newValue);
if (!fromViewer) {
if (verbosity >= G4VisManager::errors) {
G4cerr <<
G4warn <<
"ERROR: G4VisCommandsViewerSet::SetNewValue: all:"
"\n unrecognised from-viewer."
<< G4endl;
@@ -708,7 +710,7 @@ void G4VisCommandsViewerSet::SetNewValue
}
if (fromViewer == currentViewer) {
if (verbosity >= G4VisManager::warnings) {
G4cout <<
G4warn <<
"WARNING: G4VisCommandsViewerSet::SetNewValue: all:"
"\n from-viewer and current viewer are identical."
<< G4endl;
@@ -737,7 +739,7 @@ void G4VisCommandsViewerSet::SetNewValue
<< G4endl;
}
if (verbosity >= G4VisManager::warnings) {
G4cout << "You may need \"/vis/viewer/rebuild\"."
G4warn << "You may need \"/vis/viewer/rebuild\"."
<< G4endl;
}
}
@@ -748,7 +750,7 @@ void G4VisCommandsViewerSet::SetNewValue
currentViewer->GetDefaultViewParameters();
if (autoRefresh && !defaultVP.IsAutoRefresh()) {
if (verbosity >= G4VisManager::warnings) {
G4cout
G4warn
<< "WARNING: "
<< currentViewer->GetName() << " is NOT auto-refesh by default"
<< "\n so cannot be set to auto-refresh."
@@ -868,7 +870,7 @@ void G4VisCommandsViewerSet::SetNewValue
}
else {
if (verbosity >= G4VisManager::errors) {
G4cerr <<
G4warn <<
"ERROR: G4VisCommandsViewerSet::SetNewValue: culling:"
"\n option not recognised."
<< G4endl;
@@ -1061,7 +1063,7 @@ void G4VisCommandsViewerSet::SetNewValue
vp.SetLightsMoveWithCamera(false);
else {
if (verbosity >= G4VisManager::errors) {
G4cerr << "ERROR: \"" << newValue << "\" not recognised."
G4warn << "ERROR: \"" << newValue << "\" not recognised."
" Looking for \"cam\" or \"obj\" in string." << G4endl;
}
}
@@ -1101,7 +1103,7 @@ void G4VisCommandsViewerSet::SetNewValue
else if (command == fpCommandLineWidth) {
if (verbosity >= G4VisManager::errors) {
// A do-nothing command
G4cerr << command->GetGuidanceLine(0) << G4endl;
G4warn << command->GetGuidanceLine(0) << G4endl;
}
}
@@ -1134,7 +1136,7 @@ void G4VisCommandsViewerSet::SetNewValue
G4cout << G4endl;
}
if (verbosity >= G4VisManager::warnings) {
G4cout << "You may need to issue \"/vis/viewer/update\"."
G4warn << "You may need to issue \"/vis/viewer/update\"."
<< G4endl;
}
}
@@ -1153,16 +1155,16 @@ void G4VisCommandsViewerSet::SetNewValue
fieldHalfAngle *= G4UIcommand::ValueOf(unit);
if (fieldHalfAngle > 89.5 * deg || fieldHalfAngle <= 0.0) {
if (verbosity >= G4VisManager::errors) {
G4cerr <<
G4warn <<
"ERROR: Field half angle should be 0 < angle <= 89.5 degrees.";
G4cout << G4endl;
G4warn << G4endl;
}
return;
}
}
else {
if (verbosity >= G4VisManager::errors) {
G4cerr << "ERROR: \"" << newValue << "\" not recognised."
G4warn << "ERROR: \"" << newValue << "\" not recognised."
" Looking for 'o' or 'p' first character." << G4endl;
}
return;
@@ -1190,7 +1192,7 @@ void G4VisCommandsViewerSet::SetNewValue
style = G4ViewParameters::freeRotation;
else {
if (verbosity >= G4VisManager::errors) {
G4cerr << "ERROR: \"" << newValue << "\" not recognised." << G4endl;
G4warn << "ERROR: \"" << newValue << "\" not recognised." << G4endl;
}
return;
}
@@ -1214,7 +1216,7 @@ void G4VisCommandsViewerSet::SetNewValue
G4UIcommand::ConvertToBool(choice)) iSelector = 1;
if (iSelector < 0) {
if (verbosity >= G4VisManager::errors) {
G4cout << "Choice not recognised (on/true or off/false)." << G4endl;
G4warn << "Choice not recognised (on/true or off/false)." << G4endl;
}
goto write_result;
}
@@ -1228,10 +1230,11 @@ void G4VisCommandsViewerSet::SetNewValue
x *= F; y *= F; z *= F;
if (nx == 0. && ny == 0. && nz == 0.) {
if (verbosity >= G4VisManager::errors) {
G4cout << "Null normal." << G4endl;
G4warn << "Null normal." << G4endl;
}
break;;
}
// Make sure normal is normalised
const G4Normal3D& normal = G4Normal3D(nx,ny,nz).unit();
vp.SetSectionPlane(G4Plane3D(normal, G4Point3D(x,y,z)));
vp.SetViewpointDirection(normal);
@@ -1300,7 +1303,7 @@ void G4VisCommandsViewerSet::SetNewValue
iBegin = newValue.find_first_not_of(' ',iEnd);
if (iBegin == G4String::npos) {
if (verbosity >= G4VisManager::warnings) {
G4cout <<
G4warn <<
"WARNING: G4VisCommandsViewerSet::SetNewValue: /vis/viewer/set/specialMeshVolumes"
"\n A pair not found. (There should be an even number of parameters.)"
"\n Command ignored."
@@ -1316,7 +1319,7 @@ void G4VisCommandsViewerSet::SetNewValue
std::istringstream iss(newValue.substr(iBegin,iEnd-iBegin));
if (!(iss >> copyNo)) {
if (verbosity >= G4VisManager::warnings) {
G4cout <<
G4warn <<
"WARNING: G4VisCommandsViewerSet::SetNewValue: /vis/viewer/set/specialMeshVolumes"
"\n Error reading copy number - it was not numeric?"
"\n Command ignored."
@@ -1402,7 +1405,7 @@ void G4VisCommandsViewerSet::SetNewValue
}
else {
if (verbosity >= G4VisManager::errors) {
G4cerr << "ERROR: \"" << newValue << "\" not recognised."
G4warn << "ERROR: \"" << newValue << "\" not recognised."
" Looking for 'w' or 's' or 'c' first character." << G4endl;
}
return;
@@ -1479,7 +1482,7 @@ void G4VisCommandsViewerSet::SetNewValue
G4ThreeVector viewpointVector = G4UIcommand::ConvertTo3Vector(newValue);
if (viewpointVector.mag2() <= 0.) {
if (verbosity >= G4VisManager::errors) {
G4cerr << "ERROR: Null viewpoint vector. No action taken." << G4endl;
G4warn << "ERROR: Null viewpoint vector. No action taken." << G4endl;
}
} else {
fViewpointVector = viewpointVector.unit();
@@ -1608,7 +1611,7 @@ void G4VisCommandsViewerSet::SetNewValue
else {
if (verbosity >= G4VisManager::errors) {
G4cerr <<
G4warn <<
"ERROR: G4VisCommandsViewerSet::SetNewValue: unrecognised command."
<< G4endl;
}
@@ -83,7 +83,7 @@
#ifdef G4MULTITHREADED
# include "G4Threading.hh"
# include "G4AutoLock.hh"
# include "G4GeometryWorkspace.hh"
# include "G4GeometryWorkspace.hh" // no_geant4_module_check(!G4MULTITHREADED)
# include "G4SolidsWorkspace.hh"
# include <deque>
# include <typeinfo>
@@ -91,6 +91,8 @@
# include <thread>
#endif
#define G4warn G4cout
G4VisManager* G4VisManager::fpInstance = 0;
G4VisManager::Verbosity G4VisManager::fVerbosity = G4VisManager::warnings;
@@ -212,7 +214,7 @@ G4VisManager::~G4VisManager()
{
G4UImanager* UImanager = G4UImanager::GetUIpointer();
UImanager->SetCoutDestination(nullptr);
size_t i;
std::size_t i;
for (i = 0; i < fSceneList.size (); ++i) {
delete fSceneList[i];
}
@@ -256,7 +258,7 @@ G4VisManager* G4VisManager::GetInstance () {
void G4VisManager::Initialise () {
if (fInitialised && fVerbosity >= warnings) {
G4cout << "WARNING: G4VisManager::Initialise: already initialised."
G4warn << "WARNING: G4VisManager::Initialise: already initialised."
<< G4endl;
return;
}
@@ -694,7 +696,7 @@ namespace {
"There " << isare << ' ' << _n << ' ' << plotType << " histogram" << plural
<< G4endl;
if (_n <= 5) {
for (size_t i = 0; i < _n; ++i) {
for (std::size_t i = 0; i < _n; ++i) {
const auto& _h = (*_v)[i];
G4cout
<< std::setw(3) << i
@@ -727,7 +729,7 @@ void G4VisManager::Enable() {
G4cout << "G4VisManager::Enable: visualization enabled." << G4endl;
}
if (fVerbosity >= warnings) {
G4int nKeptEvents = 0;
std::size_t nKeptEvents = 0;
const G4Run* run = G4RunManager::GetRunManager()->GetCurrentRun();
if (run) nKeptEvents = run->GetEventVector()->size();
G4String isare("are"),plural("s");
@@ -746,7 +748,7 @@ void G4VisManager::Enable() {
}
else {
if (fVerbosity >= warnings) {
G4cout <<
G4warn <<
"G4VisManager::Enable: WARNING: visualization remains disabled for"
"\n above reasons. Rectifying with valid vis commands will"
"\n automatically enable."
@@ -768,7 +770,7 @@ void G4VisManager::Disable() {
G4int currentTrajectoryType =
G4RunManagerKernel::GetRunManagerKernel()->GetTrackingManager()->GetStoreTrajectory();
if (currentTrajectoryType > 0) {
G4cout <<
G4warn <<
"You may wish to disable trajectory production too:"
"\n \"/tracking/storeTrajectory 0\""
"\nbut don't forget to re-enable with"
@@ -781,10 +783,10 @@ void G4VisManager::Disable() {
}
const G4GraphicsSystemList& G4VisManager::GetAvailableGraphicsSystems () {
G4int nSystems = fAvailableGraphicsSystems.size ();
std::size_t nSystems = fAvailableGraphicsSystems.size ();
if (nSystems == 0) {
if (fVerbosity >= warnings) {
G4cout << "G4VisManager::GetAvailableGraphicsSystems: WARNING: no"
G4warn << "G4VisManager::GetAvailableGraphicsSystems: WARNING: no"
"\n graphics system available!"
"\n 1) Did you have environment variables G4VIS_BUILD_xxxx_DRIVER set"
"\n when you compiled/built the visualization code?"
@@ -815,7 +817,7 @@ G4bool G4VisManager::RegisterGraphicsSystem (G4VGraphicsSystem* pSystem) {
}
else {
if (fVerbosity >= errors) {
G4cout << "G4VisManager::RegisterGraphicsSystem: null pointer!"
G4warn << "G4VisManager::RegisterGraphicsSystem: null pointer!"
<< G4endl;
}
happy=false;
@@ -835,8 +837,8 @@ G4VisManager::CurrentTrajDrawModel() const
// Use G4TrajectoryDrawByCharge as a fallback.
fpTrajDrawModelMgr->Register(new G4TrajectoryDrawByCharge("DefaultModel"));
if (fVerbosity >= warnings) {
G4cout<<"G4VisManager: Using G4TrajectoryDrawByCharge as fallback trajectory model."<<G4endl;
G4cout<<"See commands in /vis/modeling/trajectories/ for other options."<<G4endl;
G4warn<<"G4VisManager: Using G4TrajectoryDrawByCharge as fallback trajectory model."<<G4endl;
G4warn<<"See commands in /vis/modeling/trajectories/ for other options."<<G4endl;
}
}
@@ -1200,6 +1202,18 @@ void G4VisManager::Draw (const G4VPhysicalVolume& physicalVol,
Draw (*pSol, attribs, objectTransform);
}
void G4VisManager::DrawGeometry
(G4VPhysicalVolume* v, const G4Transform3D& t)
// Draws a geometry tree starting at the specified physical volume.
{
auto modelingParameters = fpSceneHandler->CreateModelingParameters();
auto depth = G4PhysicalVolumeModel::UNLIMITED;
const G4bool useFullExtent = true;
G4PhysicalVolumeModel aPVModel(v,depth,t,modelingParameters,useFullExtent);
aPVModel.DescribeYourselfTo(*fpSceneHandler);
delete modelingParameters;
}
void G4VisManager::CreateSceneHandler (const G4String& name) {
if (!fInitialised) Initialise ();
if (fpGraphicsSystem) {
@@ -1211,7 +1225,7 @@ void G4VisManager::CreateSceneHandler (const G4String& name) {
}
else {
if (fVerbosity >= errors) {
G4cout << "ERROR in G4VisManager::CreateSceneHandler during "
G4warn << "ERROR in G4VisManager::CreateSceneHandler during "
<< fpGraphicsSystem -> GetName ()
<< " scene handler creation.\n No action taken."
<< G4endl;
@@ -1236,7 +1250,7 @@ void G4VisManager::CreateViewer
if (!p) {
if (fVerbosity >= errors) {
G4cerr << "ERROR in G4VisManager::CreateViewer: null pointer during "
G4warn << "ERROR in G4VisManager::CreateViewer: null pointer during "
<< fpGraphicsSystem -> GetName ()
<< " viewer creation.\n No action taken."
<< G4endl;
@@ -1246,7 +1260,7 @@ void G4VisManager::CreateViewer
if (p -> GetViewId() < 0) {
if (fVerbosity >= errors) {
G4cerr << "ERROR in G4VisManager::CreateViewer during "
G4warn << "ERROR in G4VisManager::CreateViewer during "
<< fpGraphicsSystem -> GetName ()
<< " viewer instantiation.\n No action taken."
<< G4endl;
@@ -1263,7 +1277,7 @@ void G4VisManager::CreateViewer
p -> Initialise (); // (Viewer itself may change view parameters further.)
if (p -> GetViewId() < 0) {
if (fVerbosity >= errors) {
G4cerr << "ERROR in G4VisManager::CreateViewer during "
G4warn << "ERROR in G4VisManager::CreateViewer during "
<< fpGraphicsSystem -> GetName ()
<< " viewer initialisation.\n No action taken."
<< G4endl;
@@ -1302,7 +1316,7 @@ void G4VisManager::CreateViewer
static G4bool warned = false;
if (fVerbosity >= warnings) {
if (!warned) {
G4cout <<
G4warn <<
"WARNING: covered objects in solid mode will not be rendered!"
"\n \"/vis/viewer/set/culling coveredDaughters false\" to reverse this."
"\n Also see other \"/vis/viewer/set\" commands."
@@ -1324,14 +1338,14 @@ void G4VisManager::GeometryHasChanged () {
-> GetNavigatorForTracking () -> GetWorldVolume ();
if (!pWorld) {
if (fVerbosity >= warnings) {
G4cout << "WARNING: There is no world volume!" << G4endl;
G4warn << "WARNING: There is no world volume!" << G4endl;
}
}
// Check scenes.
G4SceneList& sceneList = fSceneList;
G4int iScene, nScenes = sceneList.size ();
for (iScene = 0; iScene < nScenes; iScene++) {
std::size_t iScene, nScenes = sceneList.size ();
for (iScene = 0; iScene < nScenes; ++iScene) {
G4Scene* pScene = sceneList [iScene];
std::vector<G4Scene::Model>& modelList = pScene -> SetRunDurationModelList ();
if (modelList.size ()) {
@@ -1346,7 +1360,7 @@ void G4VisManager::GeometryHasChanged () {
if (modelInvalid) {
// Model invalid - remove and break.
if (fVerbosity >= warnings) {
G4cout << "WARNING: Model \""
G4warn << "WARNING: Model \""
<< iterModel->fpModel->GetGlobalDescription ()
<<
"\" is no longer valid - being removed\n from scene \""
@@ -1361,14 +1375,14 @@ void G4VisManager::GeometryHasChanged () {
if (modelList.size () == 0) {
if (fVerbosity >= warnings) {
G4cout << "WARNING: No run-duration models left in this scene \""
G4warn << "WARNING: No run-duration models left in this scene \""
<< pScene -> GetName ()
<< "\"."
<< G4endl;
}
if (pWorld) {
if (fVerbosity >= warnings) {
G4cout << " Adding current world to \""
G4warn << " Adding current world to \""
<< pScene -> GetName ()
<< "\"."
<< G4endl;
@@ -1390,7 +1404,7 @@ void G4VisManager::GeometryHasChanged () {
// Check the manager's current scene...
if (fpScene && fpScene -> GetRunDurationModelList ().size () == 0) {
if (fVerbosity >= warnings) {
G4cout << "WARNING: The current scene \""
G4warn << "WARNING: The current scene \""
<< fpScene -> GetName ()
<< "\" has no run duration models."
<< "\n Use \"/vis/scene/add/volume\" or create a new scene."
@@ -1420,8 +1434,8 @@ void G4VisManager::NotifyHandlers () {
// Check scenes.
G4SceneList& sceneList = fSceneList;
G4int iScene, nScenes = sceneList.size ();
for (iScene = 0; iScene < nScenes; iScene++) {
std::size_t iScene, nScenes = sceneList.size ();
for (iScene = 0; iScene < nScenes; ++iScene) {
G4Scene* pScene = sceneList [iScene];
std::vector<G4Scene::Model>& modelList = pScene -> SetRunDurationModelList ();
@@ -1435,7 +1449,7 @@ void G4VisManager::NotifyHandlers () {
// Check the manager's current scene...
if (fpScene && fpScene -> GetRunDurationModelList ().size () == 0) {
if (fVerbosity >= warnings) {
G4cout << "WARNING: The current scene \""
G4warn << "WARNING: The current scene \""
<< fpScene -> GetName ()
<< "\" has no run duration models."
<< "\n Use \"/vis/scene/add/volume\" or create a new scene."
@@ -1501,7 +1515,7 @@ void G4VisManager::RegisterRunDurationUserVisAction
fUserVisActionExtents[pVisAction] = extent;
} else {
if (fVerbosity >= warnings) {
G4cout <<
G4warn <<
"WARNING: No extent set for user vis action \"" << name << "\"."
<< G4endl;
}
@@ -1522,7 +1536,7 @@ void G4VisManager::RegisterEndOfEventUserVisAction
fUserVisActionExtents[pVisAction] = extent;
} else {
if (fVerbosity >= warnings) {
G4cout <<
G4warn <<
"WARNING: No extent set for user vis action \"" << name << "\"."
<< G4endl;
}
@@ -1543,7 +1557,7 @@ void G4VisManager::RegisterEndOfRunUserVisAction
fUserVisActionExtents[pVisAction] = extent;
} else {
if (fVerbosity >= warnings) {
G4cout <<
G4warn <<
"WARNING: No extent set for user vis action \"" << name << "\"."
<< G4endl;
}
@@ -1575,7 +1589,7 @@ void G4VisManager::SetCurrentGraphicsSystem (G4VGraphicsSystem* pSystem) {
// Or clear pointers.
if (!(fpSceneHandler && fpSceneHandler -> GetGraphicsSystem () == pSystem)) {
const G4SceneHandlerList& sceneHandlerList = fAvailableSceneHandlers;
G4int nSH = sceneHandlerList.size (); // No. of scene handlers.
G4int nSH = (G4int)sceneHandlerList.size (); // No. of scene handlers.
G4int iSH;
for (iSH = nSH - 1; iSH >= 0; iSH--) {
if (sceneHandlerList [iSH] -> GetGraphicsSystem () == pSystem) break;
@@ -1632,10 +1646,10 @@ void G4VisManager::SetCurrentSceneHandler (G4VSceneHandler* pSceneHandler) {
}
}
const G4ViewerList& viewerList = fpSceneHandler -> GetViewerList ();
G4int nViewers = viewerList.size ();
std::size_t nViewers = viewerList.size ();
if (nViewers) {
G4int iViewer;
for (iViewer = 0; iViewer < nViewers; iViewer++) {
std::size_t iViewer;
for (iViewer = 0; iViewer < nViewers; ++iViewer) {
if (fpViewer == viewerList [iViewer]) break;
}
if (iViewer >= nViewers) {
@@ -1647,7 +1661,7 @@ void G4VisManager::SetCurrentSceneHandler (G4VSceneHandler* pSceneHandler) {
}
if (!IsValidView ()) {
if (fVerbosity >= warnings) {
G4cout <<
G4warn <<
"WARNING: Problem setting scene handler - please report circumstances."
<< G4endl;
}
@@ -1656,7 +1670,7 @@ void G4VisManager::SetCurrentSceneHandler (G4VSceneHandler* pSceneHandler) {
else {
fpViewer = 0;
if (fVerbosity >= warnings) {
G4cout <<
G4warn <<
"WARNING: No viewers for this scene handler - please create one."
<< G4endl;
}
@@ -1680,7 +1694,7 @@ void G4VisManager::SetCurrentViewer (G4VViewer* pViewer) {
fpSceneHandler = fpViewer -> GetSceneHandler ();
if (!fpSceneHandler) {
if (fVerbosity >= warnings) {
G4cout <<
G4warn <<
"WARNING: No scene handler for this viewer - please create one."
<< G4endl;
}
@@ -1693,7 +1707,7 @@ void G4VisManager::SetCurrentViewer (G4VViewer* pViewer) {
fpGraphicsSystem = fpSceneHandler -> GetGraphicsSystem ();
if (!IsValidView ()) {
if (fVerbosity >= warnings) {
G4cout <<
G4warn <<
"WARNING: Problem setting viewer - please report circumstances."
<< G4endl;
}
@@ -1711,7 +1725,7 @@ void G4VisManager::PrintAvailableGraphicsSystems
if (verbosity <= warnings) {
// Brief output
out << " " << name << " (";
for (size_t i = 0; i < nicknames.size(); ++i) {
for (std::size_t i = 0; i < nicknames.size(); ++i) {
if (i != 0) {
out << ", ";
}
@@ -1798,7 +1812,7 @@ void G4VisManager::PrintAvailableUserVisActions (Verbosity) const
if (fRunDurationUserVisActions.empty()) G4cout << " none" << G4endl;
else {
G4cout << G4endl;
for (size_t i = 0; i < fRunDurationUserVisActions.size(); i++) {
for (std::size_t i = 0; i < fRunDurationUserVisActions.size(); ++i) {
const G4String& name = fRunDurationUserVisActions[i].fName;
G4cout << " " << name << G4endl;
}
@@ -1808,7 +1822,7 @@ void G4VisManager::PrintAvailableUserVisActions (Verbosity) const
if (fEndOfEventUserVisActions.empty()) G4cout << " none" << G4endl;
else {
G4cout << G4endl;
for (size_t i = 0; i < fEndOfEventUserVisActions.size(); i++) {
for (std::size_t i = 0; i < fEndOfEventUserVisActions.size(); ++i) {
const G4String& name = fEndOfEventUserVisActions[i].fName;
G4cout << " " << name << G4endl;
}
@@ -1818,7 +1832,7 @@ void G4VisManager::PrintAvailableUserVisActions (Verbosity) const
if (fEndOfRunUserVisActions.empty()) G4cout << " none" << G4endl;
else {
G4cout << G4endl;
for (size_t i = 0; i < fEndOfRunUserVisActions.size(); i++) {
for (std::size_t i = 0; i < fEndOfRunUserVisActions.size(); ++i) {
const G4String& name = fEndOfRunUserVisActions[i].fName;
G4cout << " " << name << G4endl;
}
@@ -1840,26 +1854,26 @@ void G4VisManager::PrintAvailableColours (Verbosity) const {
void G4VisManager::PrintInvalidPointers () const {
if (fVerbosity >= errors) {
G4cerr << "ERROR: G4VisManager::PrintInvalidPointers:";
G4warn << "ERROR: G4VisManager::PrintInvalidPointers:";
if (!fpGraphicsSystem) {
G4cerr << "\n null graphics system pointer.";
G4warn << "\n null graphics system pointer.";
}
else {
G4cerr << "\n Graphics system is " << fpGraphicsSystem -> GetName ()
G4warn << "\n Graphics system is " << fpGraphicsSystem -> GetName ()
<< " but:";
if (!fpScene)
G4cerr <<
G4warn <<
"\n Null scene pointer. Use \"/vis/drawVolume\" or"
" \"/vis/scene/create\".";
if (!fpSceneHandler)
G4cerr <<
G4warn <<
"\n Null scene handler pointer. Use \"/vis/open\" or"
" \"/vis/sceneHandler/create\".";
if (!fpViewer )
G4cerr <<
G4warn <<
"\n Null viewer pointer. Use \"/vis/viewer/create\".";
}
G4cerr << G4endl;
G4warn << G4endl;
}
}
@@ -1900,7 +1914,7 @@ G4ThreadFunReturnType G4VisManager::G4VisSubThread(G4ThreadFunArgType p)
while (true) {
G4MUTEXLOCK(&mtVisSubThreadMutex);
G4int eventQueueSize = mtVisEventQueue.size();
std::size_t eventQueueSize = mtVisEventQueue.size();
G4MUTEXUNLOCK(&mtVisSubThreadMutex);
// G4cout << "Event queue size (A): " << eventQueueSize << G4endl;
@@ -2102,18 +2116,18 @@ void G4VisManager::EndOfEvent ()
// Wait if too many events in the queue.
G4MUTEXLOCK(&mtVisSubThreadMutex);
G4int eventQueueSize = mtVisEventQueue.size();
std::size_t eventQueueSize = mtVisEventQueue.size();
G4MUTEXUNLOCK(&mtVisSubThreadMutex);
// G4cout << "Event queue size (1): " << eventQueueSize << G4endl;
G4bool eventQueueFull = false;
while (fMaxEventQueueSize > 0 && eventQueueSize >= fMaxEventQueueSize) {
while (fMaxEventQueueSize > 0 && (G4int)eventQueueSize >= fMaxEventQueueSize) {
// G4cout << "Event queue size (2): " << eventQueueSize << G4endl;
if (fWaitOnEventQueueFull) {
static G4bool warned = false;
if (!warned) {
G4cout <<
G4warn <<
"WARNING: The number of events in the visualisation queue has exceeded"
"\n the maximum, "
<< fMaxEventQueueSize <<
@@ -2137,7 +2151,7 @@ void G4VisManager::EndOfEvent ()
} else {
static G4bool warned = false;
if (!warned) {
G4cout <<
G4warn <<
"WARNING: The number of events in the visualisation queue has exceeded"
"\n the maximum, "
<< fMaxEventQueueSize <<
@@ -2190,7 +2204,7 @@ void G4VisManager::EndOfEvent ()
nEventsToBeProcessed = runManager->GetNumberOfEventsToBeProcessed();
eventID = currentEvent->GetEventID();
const std::vector<const G4Event*>* events = currentRun->GetEventVector();
if (events) nKeptEvents = events->size();
if (events) nKeptEvents = (G4int)events->size();
}
// We are about to draw the event (trajectories, etc.), but first we
@@ -2242,11 +2256,11 @@ void G4VisManager::EndOfEvent ()
static G4bool warned = false;
if (!warned) {
if (fVerbosity >= warnings) {
G4cout <<
G4warn <<
"WARNING: G4VisManager::EndOfEvent: Automatic event keeping suspended."
<< G4endl;
if (maxNumberOfKeptEvents > 0) {
G4cout <<
G4warn <<
"\n The number of events exceeds the maximum, "
<< maxNumberOfKeptEvents <<
", that may be kept by\n the vis manager."
@@ -2313,7 +2327,7 @@ void G4VisManager::EndOfRun ()
G4int noOfEventsRequested = runManager->GetNumberOfEventsToBeProcessed();
if (fNoOfEventsDrawnThisRun != noOfEventsRequested) {
if (!fWaitOnEventQueueFull && fVerbosity >= warnings) {
G4cout
G4warn
<< "WARNING: Number of events drawn this run, "
<< fNoOfEventsDrawnThisRun << ", is different to number requested, "
<< noOfEventsRequested <<
@@ -2326,32 +2340,32 @@ void G4VisManager::EndOfRun ()
G4int nKeptEvents = 0;
const std::vector<const G4Event*>* events = currentRun->GetEventVector();
if (events) nKeptEvents = events->size();
if (events) nKeptEvents = (G4int)events->size();
if (fVerbosity >= warnings && nKeptEvents > 0) {
G4cout << nKeptEvents;
if (nKeptEvents == 1) G4cout << " event has";
else G4cout << " events have";
G4cout << " been kept for refreshing and/or reviewing." << G4endl;
G4warn << nKeptEvents;
if (nKeptEvents == 1) G4warn << " event has";
else G4warn << " events have";
G4warn << " been kept for refreshing and/or reviewing." << G4endl;
if (nKeptEvents != fNKeepRequests) {
G4cout << " (Note: ";
G4warn << " (Note: ";
if (fNKeepRequests == 0) {
G4cout << "No keep requests were";
G4warn << "No keep requests were";
} else if (fNKeepRequests == 1) {
G4cout << "1 keep request was";
G4warn << "1 keep request was";
} else {
G4cout << fNKeepRequests << " keep requests were";
G4warn << fNKeepRequests << " keep requests were";
}
G4cout << " made by the vis manager.";
G4warn << " made by the vis manager.";
if (fNKeepRequests == 0) {
G4cout <<
G4warn <<
"\n The kept events are those you have asked to be kept in your user action(s).)";
} else {
G4cout <<
G4warn <<
"\n The same or further events may have been kept by you in your user action(s).)";
}
G4cout << G4endl;
G4warn << G4endl;
}
G4cout <<
G4warn <<
" \"/vis/reviewKeptEvents\" to review one by one."
"\n To see accumulated, \"/vis/enable\", then \"/vis/viewer/flush\" or \"/vis/viewer/rebuild\"."
<< G4endl;
@@ -2360,11 +2374,11 @@ void G4VisManager::EndOfRun ()
if (fVerbosity >= warnings) PrintListOfPlots();
if (fEventKeepingSuspended && fVerbosity >= warnings) {
G4cout <<
G4warn <<
"WARNING: G4VisManager::EndOfRun: Automatic event keeping was suspended."
<< G4endl;
if (fpScene->GetMaxNumberOfKeptEvents() > 0) {
G4cout <<
G4warn <<
"\n The number of events in the run exceeded the maximum, "
<< fpScene->GetMaxNumberOfKeptEvents() <<
", that may be\n kept by the vis manager." <<
@@ -2402,7 +2416,7 @@ void G4VisManager::EndOfRun ()
if (fpGraphicsSystem->GetFunctionality() ==
G4VGraphicsSystem::fileWriter) {
if (fVerbosity >= warnings) {
G4cout << "\"/vis/viewer/update\" to close file." << G4endl;
G4warn << "\"/vis/viewer/update\" to close file." << G4endl;
}
}
}
@@ -2444,8 +2458,8 @@ G4String G4VisManager::ViewerShortName (const G4String& viewerName) const {
G4VViewer* G4VisManager::GetViewer (const G4String& viewerName) const {
G4String viewerShortName = ViewerShortName (viewerName);
size_t nHandlers = fAvailableSceneHandlers.size ();
size_t iHandler, iViewer;
std::size_t nHandlers = fAvailableSceneHandlers.size ();
std::size_t iHandler, iViewer;
G4VViewer* viewer = 0;
G4bool found = false;
for (iHandler = 0; iHandler < nHandlers; iHandler++) {
@@ -2496,13 +2510,13 @@ G4VisManager::GetVerbosityValue(const G4String& verbosityString) {
std::istringstream is(ss);
is >> intVerbosity;
if (!is) {
G4cerr << "ERROR: G4VisManager::GetVerbosityValue: invalid verbosity \""
G4warn << "ERROR: G4VisManager::GetVerbosityValue: invalid verbosity \""
<< verbosityString << "\"";
for (size_t i = 0; i < VerbosityGuidanceStrings.size(); ++i) {
G4cerr << '\n' << VerbosityGuidanceStrings[i];
for (std::size_t i = 0; i < VerbosityGuidanceStrings.size(); ++i) {
G4warn << '\n' << VerbosityGuidanceStrings[i];
}
verbosity = warnings;
G4cerr << "\n Returning " << VerbosityString(verbosity)
G4warn << "\n Returning " << VerbosityString(verbosity)
<< G4endl;
}
else {
@@ -2543,7 +2557,7 @@ G4bool G4VisManager::IsValidView () {
if (noGSPrinting) {
noGSPrinting = false;
if (fVerbosity >= warnings) {
G4cout <<
G4warn <<
"WARNING: G4VisManager::IsValidView(): Attempt to draw when no graphics system"
"\n has been instantiated. Use \"/vis/open\" or \"/vis/sceneHandler/create\"."
"\n Alternatively, to avoid this message, suppress instantiation of vis"
@@ -2557,7 +2571,7 @@ G4bool G4VisManager::IsValidView () {
if ((!fpScene) || (!fpSceneHandler) || (!fpViewer)) {
if (fVerbosity >= errors) {
G4cerr <<
G4warn <<
"ERROR: G4VisManager::IsValidView(): Current view is not valid."
<< G4endl;
PrintInvalidPointers ();
@@ -2567,9 +2581,9 @@ G4bool G4VisManager::IsValidView () {
if (fpScene != fpSceneHandler -> GetScene ()) {
if (fVerbosity >= errors) {
G4cerr << "ERROR: G4VisManager::IsValidView ():";
G4warn << "ERROR: G4VisManager::IsValidView ():";
if (fpSceneHandler -> GetScene ()) {
G4cout <<
G4warn <<
"\n The current scene \""
<< fpScene -> GetName ()
<< "\" is not handled by"
@@ -2590,7 +2604,7 @@ G4bool G4VisManager::IsValidView () {
<< G4endl;
}
else {
G4cout << "\n Scene handler \""
G4warn << "\n Scene handler \""
<< fpSceneHandler -> GetName ()
<< "\" has null scene pointer."
"\n Attach a scene with /vis/sceneHandler/attach [<scene-name>]"
@@ -2603,7 +2617,7 @@ G4bool G4VisManager::IsValidView () {
const G4ViewerList& viewerList = fpSceneHandler -> GetViewerList ();
if (viewerList.size () == 0) {
if (fVerbosity >= errors) {
G4cerr <<
G4warn <<
"ERROR: G4VisManager::IsValidView (): the current scene handler\n \""
<< fpSceneHandler -> GetName ()
<< "\" has no viewers. Do /vis/viewer/create."
@@ -2618,8 +2632,8 @@ G4bool G4VisManager::IsValidView () {
G4bool successful = fpScene -> AddWorldIfEmpty (warn);
if (!successful || fpScene -> IsEmpty ()) { // If still empty...
if (fVerbosity >= errors) {
G4cerr << "ERROR: G4VisManager::IsValidView ():";
G4cerr <<
G4warn << "ERROR: G4VisManager::IsValidView ():";
G4warn <<
"\n Attempt at some drawing operation when scene is empty."
"\n Maybe the geometry has not yet been defined."
" Try /run/initialize."
@@ -2631,10 +2645,10 @@ G4bool G4VisManager::IsValidView () {
else {
G4UImanager::GetUIpointer()->ApplyCommand ("/vis/scene/notifyHandlers");
if (fVerbosity >= warnings) {
G4cout <<
G4warn <<
"WARNING: G4VisManager: the scene was empty, \"world\" has been"
"\n added and the scene handlers notified.";
G4cout << G4endl;
G4warn << G4endl;
}
}
}
@@ -2645,9 +2659,9 @@ void
G4VisManager::RegisterModelFactories()
{
if (fVerbosity >= warnings) {
G4cout<<"G4VisManager: No model factories registered with G4VisManager."<<G4endl;
G4cout<<"G4VisManager::RegisterModelFactories() should be overridden in derived"<<G4endl;
G4cout<<"class. See G4VisExecutive for an example."<<G4endl;
G4warn<<"G4VisManager: No model factories registered with G4VisManager."<<G4endl;
G4warn<<"G4VisManager::RegisterModelFactories() should be overridden in derived"<<G4endl;
G4warn<<"class. See G4VisExecutive for an example."<<G4endl;
}
}