Import Geant4 10.4.0 source tree
This commit is contained in:
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4VVisCommand.cc 104163 2017-05-15 06:52:42Z gcosmo $
|
||||
// $Id: G4VVisCommand.cc 105349 2017-07-21 12:23:24Z gcosmo $
|
||||
|
||||
// Base class for visualization commands - John Allison 9th August 1998
|
||||
// It is really a messenger - we have one command per messenger.
|
||||
@@ -94,10 +94,9 @@ const G4String& G4VVisCommand::ConvertToColourGuidance()
|
||||
{
|
||||
static G4String guidance
|
||||
("Accepts (a) RGB triplet. e.g., \".3 .4 .5\", or"
|
||||
"\n(b) string such as \"white\", \"black\", \"grey\", \"red\"..."
|
||||
"\n(c) an additional number for opacity, e.g., \".3 .4 .5 .6\""
|
||||
"\n or \"grey ! ! .6\" (note \"!\"'s for unused green and blue parameters),"
|
||||
"\n e.g. \"! ! ! 0.\" for a transparent colour.");
|
||||
"\n (b) string such as \"white\", \"black\", \"grey\", \"red\"...or"
|
||||
"\n (c) an additional number for opacity, e.g., \".3 .4 .5 .6\""
|
||||
"\n or \"grey ! ! .6\" (note \"!\"'s for unused parameters).");
|
||||
return guidance;
|
||||
}
|
||||
|
||||
@@ -105,12 +104,12 @@ void G4VVisCommand::ConvertToColour
|
||||
(G4Colour& colour,
|
||||
const G4String& redOrString, G4double green, G4double blue, G4double opacity)
|
||||
{
|
||||
// Note: colour is supplied by the caller and becomes the default if the
|
||||
// remaining parameters cannot be parsed.
|
||||
|
||||
// Note: colour is supplied by the caller and some or all of its components
|
||||
// may act as default.
|
||||
//
|
||||
// Note: redOrString is either a number or string. If a string it must be
|
||||
// one of the recognised colours.
|
||||
|
||||
//
|
||||
// Thus the arguments can be, for example:
|
||||
// (colour,"red",...,...,0.5): will give the colour red with opacity 0.5 (the
|
||||
// third and fourth arguments are ignored), or
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4ViewParameters.cc 101035 2016-11-04 08:48:17Z gcosmo $
|
||||
// $Id: G4ViewParameters.cc 106122 2017-09-13 12:51:53Z gcosmo $
|
||||
//
|
||||
//
|
||||
// John Allison 19th July 1996
|
||||
@@ -53,7 +53,7 @@ G4ViewParameters::G4ViewParameters ():
|
||||
fCutawayMode (cutawayUnion),
|
||||
fCutawayPlanes (),
|
||||
fExplodeFactor (1.),
|
||||
fNoOfSides (72),
|
||||
fNoOfSides (24),
|
||||
fViewpointDirection (G4Vector3D (0., 0., 1.)), // On z-axis.
|
||||
fUpVector (G4Vector3D (0., 1., 0.)), // y-axis up.
|
||||
fFieldHalfAngle (0.), // Orthogonal projection.
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4VisCommands.cc 93025 2015-09-30 16:02:12Z gcosmo $
|
||||
// $Id: G4VisCommands.cc 106384 2017-10-09 09:34:51Z gcosmo $
|
||||
|
||||
// /vis/ top level commands - John Allison 5th February 2001
|
||||
|
||||
@@ -70,11 +70,52 @@ G4String G4VisCommandAbortReviewKeptEvents::GetCurrentValue (G4UIcommand*) {
|
||||
}
|
||||
|
||||
void G4VisCommandAbortReviewKeptEvents::SetNewValue (G4UIcommand*,
|
||||
G4String newValue) {
|
||||
G4String newValue) {
|
||||
fpVisManager->SetAbortReviewKeptEvents(G4UIcommand::ConvertToBool(newValue));
|
||||
G4cout << "Type \"continue\" to complete the abort." << G4endl;
|
||||
}
|
||||
|
||||
////////////// /vis/drawOnlyToBeKeptEvents /////////////////////////////
|
||||
|
||||
G4VisCommandDrawOnlyToBeKeptEvents::G4VisCommandDrawOnlyToBeKeptEvents ()
|
||||
{
|
||||
G4bool omitable;
|
||||
|
||||
fpCommand = new G4UIcmdWithABool("/vis/drawOnlyToBeKeptEvents", this);
|
||||
fpCommand -> SetGuidance
|
||||
("DURING A RUN draw only those events that have been \"to be kept\" by the user"
|
||||
"\nwith G4EventManager::GetEventManager()->KeepTheCurrentEvent() or"
|
||||
"\nwith \"/event/keepCurrentEvent\".");
|
||||
fpCommand -> SetGuidance(
|
||||
"To draw selected events the user should set this flag, then in a user action:"
|
||||
"\n if ( some criterion ) {"
|
||||
"\n G4EventManager::GetEventManager()->KeepTheCurrentEvent();"
|
||||
"\n }");
|
||||
fpCommand -> SetParameterName("draw", omitable=true);
|
||||
fpCommand -> SetDefaultValue(true);
|
||||
}
|
||||
|
||||
G4VisCommandDrawOnlyToBeKeptEvents::~G4VisCommandDrawOnlyToBeKeptEvents () {
|
||||
delete fpCommand;
|
||||
}
|
||||
|
||||
G4String G4VisCommandDrawOnlyToBeKeptEvents::GetCurrentValue (G4UIcommand*) {
|
||||
return G4String();
|
||||
}
|
||||
|
||||
void G4VisCommandDrawOnlyToBeKeptEvents::SetNewValue (G4UIcommand*,
|
||||
G4String newValue) {
|
||||
fpVisManager->SetDrawEventOnlyIfToBeKept(G4UIcommand::ConvertToBool(newValue));
|
||||
G4VisManager::Verbosity verbosity = fpVisManager->GetVerbosity();
|
||||
if (verbosity < G4VisManager::warnings) {
|
||||
if (fpVisManager->GetDrawEventOnlyIfToBeKept()) {
|
||||
G4cout << "Only events that have been kept will be drawn." << G4endl;
|
||||
} else {
|
||||
G4cout << "All events will be drawn." << G4endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
////////////// /vis/enable ///////////////////////////////////////
|
||||
|
||||
G4VisCommandEnable::G4VisCommandEnable () {
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4VisCommandsViewerSet.cc 104163 2017-05-15 06:52:42Z gcosmo $
|
||||
// $Id: G4VisCommandsViewerSet.cc 106122 2017-09-13 12:51:53Z gcosmo $
|
||||
|
||||
// /vis/viewer/set commands - John Allison 16th May 2000
|
||||
|
||||
@@ -279,7 +279,7 @@ G4VisCommandsViewerSet::G4VisCommandsViewerSet ():
|
||||
fpCommandLineSegments->SetGuidance
|
||||
("Refers to graphical representation of objects with curved lines/surfaces.");
|
||||
fpCommandLineSegments->SetParameterName("line-segments",omitable = true);
|
||||
fpCommandLineSegments->SetDefaultValue(72);
|
||||
fpCommandLineSegments->SetDefaultValue(24);
|
||||
|
||||
fpCommandPicking = new G4UIcmdWithABool
|
||||
("/vis/viewer/set/picking",this);
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4VisManager.cc 103926 2017-05-03 13:43:27Z gcosmo $
|
||||
// $Id: G4VisManager.cc 106957 2017-10-31 08:32:27Z gcosmo $
|
||||
//
|
||||
//
|
||||
// GEANT4 Visualization Manager - John Allison 02/Jan/1996.
|
||||
@@ -111,6 +111,7 @@ G4VisManager::G4VisManager (const G4String& verbosityString):
|
||||
fNKeepRequests (0),
|
||||
fEventKeepingSuspended (false),
|
||||
fKeptLastEvent (false),
|
||||
fDrawEventOnlyIfToBeKept (false),
|
||||
fpRequestedEvent (0),
|
||||
fAbortReviewKeptEvents (false),
|
||||
fIsDrawGroup (false),
|
||||
@@ -350,14 +351,112 @@ void G4VisManager::Initialise () {
|
||||
G4cout << G4endl;
|
||||
}
|
||||
|
||||
InitialiseG4ColourMap();
|
||||
|
||||
if (fVerbosity >= startup) {
|
||||
PrintAvailableColours (fVerbosity);
|
||||
G4cout << G4endl;
|
||||
G4cout <<
|
||||
"Some /vis commands (optionally) take a string to specify colour."
|
||||
"\n\"/vis/list\" to see available colours."
|
||||
<< G4endl;
|
||||
}
|
||||
|
||||
fInitialised = true;
|
||||
}
|
||||
|
||||
void G4VisManager::InitialiseG4ColourMap() const
|
||||
{
|
||||
G4Colour::InitialiseColourMap(); // Initialises (if not already initialised)
|
||||
|
||||
// our forever 65 named colors taken long time ago from X11.
|
||||
// Extracted from g4tools/include/tools/colors
|
||||
// Copyright (C) 2010, Guy Barrand. All rights reserved.
|
||||
// See the file tools.license for terms.
|
||||
|
||||
#define TOOLS_COLORS_STAT(name,r,g,b) \
|
||||
G4Colour::AddToMap(#name, G4Colour(r,g,b));
|
||||
|
||||
//0-9
|
||||
TOOLS_COLORS_STAT(aquamarine,0.496101F,0.996109F,0.828138F)
|
||||
TOOLS_COLORS_STAT(mediumaquamarine,0.398444F,0.800793F,0.664073F)
|
||||
// TOOLS_COLORS_STAT(black,0,0,0) (already defined)
|
||||
// TOOLS_COLORS_STAT(blue,0,0,1) (already defined)
|
||||
TOOLS_COLORS_STAT(cadetblue,0.371099F,0.617197F,0.62501F)
|
||||
TOOLS_COLORS_STAT(cornflowerblue,0.390631F,0.58204F,0.925795F)
|
||||
TOOLS_COLORS_STAT(darkslateblue,0.281254F,0.238285F,0.542977F)
|
||||
TOOLS_COLORS_STAT(lightblue,0.675792F,0.843763F,0.898451F)
|
||||
TOOLS_COLORS_STAT(lightsteelblue,0.68751F,0.765637F,0.867201F)
|
||||
TOOLS_COLORS_STAT(mediumblue,0,0,0.800793F)
|
||||
|
||||
//10-19
|
||||
TOOLS_COLORS_STAT(mediumslateblue,0.480476F,0.406256F,0.929702F)
|
||||
TOOLS_COLORS_STAT(midnightblue,0.0976577F,0.0976577F,0.437507F)
|
||||
TOOLS_COLORS_STAT(navyblue,0,0,0.500008F)
|
||||
TOOLS_COLORS_STAT(navy,0,0,0.500008F)
|
||||
TOOLS_COLORS_STAT(skyblue,0.527352F,0.8047F,0.917983F)
|
||||
TOOLS_COLORS_STAT(slateblue,0.414069F,0.351568F,0.800793F)
|
||||
TOOLS_COLORS_STAT(steelblue,0.273442F,0.50782F,0.703136F)
|
||||
TOOLS_COLORS_STAT(coral,0.996109F,0.496101F,0.312505F)
|
||||
// TOOLS_COLORS_STAT(cyan,0,1,1) (already defined)
|
||||
TOOLS_COLORS_STAT(firebrick,0.695323F,0.132815F,0.132815F)
|
||||
|
||||
//20-29
|
||||
// TOOLS_COLORS_STAT(brown,0.644541F,0.164065F,0.164065F) (already defined)
|
||||
TOOLS_COLORS_STAT(gold,0.996109F,0.839857F,0)
|
||||
TOOLS_COLORS_STAT(goldenrod,0.851575F,0.644541F,0.125002F)
|
||||
// TOOLS_COLORS_STAT(green,0,1,0) (already defined)
|
||||
TOOLS_COLORS_STAT(darkgreen,0,0.390631F,0)
|
||||
TOOLS_COLORS_STAT(darkolivegreen,0.332036F,0.417975F,0.183597F)
|
||||
TOOLS_COLORS_STAT(forestgreen,0.132815F,0.542977F,0.132815F)
|
||||
TOOLS_COLORS_STAT(limegreen,0.195315F,0.800793F,0.195315F)
|
||||
TOOLS_COLORS_STAT(mediumseagreen,0.234379F,0.699229F,0.441413F)
|
||||
TOOLS_COLORS_STAT(mediumspringgreen,0,0.976577F,0.601572F)
|
||||
|
||||
//30-39
|
||||
TOOLS_COLORS_STAT(palegreen,0.593759F,0.980484F,0.593759F)
|
||||
TOOLS_COLORS_STAT(seagreen,0.17969F,0.542977F,0.339849F)
|
||||
TOOLS_COLORS_STAT(springgreen,0,0.996109F,0.496101F)
|
||||
TOOLS_COLORS_STAT(yellowgreen,0.601572F,0.800793F,0.195315F)
|
||||
TOOLS_COLORS_STAT(darkslategrey,0.183597F,0.308598F,0.308598F)
|
||||
TOOLS_COLORS_STAT(dimgrey,0.410163F,0.410163F,0.410163F)
|
||||
TOOLS_COLORS_STAT(lightgrey,0.824231F,0.824231F,0.824231F)
|
||||
// TOOLS_COLORS_STAT(grey,0.750011F,0.750011F,0.750011F) (already defined)
|
||||
TOOLS_COLORS_STAT(khaki,0.937514F,0.898451F,0.546883F)
|
||||
// TOOLS_COLORS_STAT(magenta,1,0,1) (already defined)
|
||||
|
||||
//40-49
|
||||
TOOLS_COLORS_STAT(maroon,0.68751F,0.187503F,0.375006F)
|
||||
TOOLS_COLORS_STAT(orange,0.996109F,0.644541F,0)
|
||||
TOOLS_COLORS_STAT(orchid,0.851575F,0.437507F,0.83595F)
|
||||
TOOLS_COLORS_STAT(darkorchid,0.597665F,0.195315F,0.796887F)
|
||||
TOOLS_COLORS_STAT(mediumorchid,0.726574F,0.332036F,0.824231F)
|
||||
TOOLS_COLORS_STAT(pink,0.996109F,0.750011F,0.792981F)
|
||||
TOOLS_COLORS_STAT(plum,0.863294F,0.62501F,0.863294F)
|
||||
// TOOLS_COLORS_STAT(red,1,0,0) (already defined)
|
||||
TOOLS_COLORS_STAT(indianred,0.800793F,0.35938F,0.35938F)
|
||||
TOOLS_COLORS_STAT(mediumvioletred,0.777356F,0.0820325F,0.519539F)
|
||||
|
||||
//50-59
|
||||
TOOLS_COLORS_STAT(orangered,0.996109F,0.269535F,0)
|
||||
TOOLS_COLORS_STAT(violetred,0.812512F,0.125002F,0.562509F)
|
||||
TOOLS_COLORS_STAT(salmon,0.976577F,0.500008F,0.445319F)
|
||||
TOOLS_COLORS_STAT(sienna,0.62501F,0.320317F,0.175784F)
|
||||
TOOLS_COLORS_STAT(tan,0.820325F,0.703136F,0.546883F)
|
||||
TOOLS_COLORS_STAT(thistle,0.843763F,0.746105F,0.843763F)
|
||||
TOOLS_COLORS_STAT(turquoise,0.250004F,0.875013F,0.812512F)
|
||||
TOOLS_COLORS_STAT(darkturquoise,0,0.8047F,0.816419F)
|
||||
TOOLS_COLORS_STAT(mediumturquoise,0.281254F,0.816419F,0.796887F)
|
||||
TOOLS_COLORS_STAT(violet,0.929702F,0.50782F,0.929702F)
|
||||
|
||||
//60-64
|
||||
TOOLS_COLORS_STAT(blueviolet,0.539071F,0.167971F,0.882826F)
|
||||
TOOLS_COLORS_STAT(wheat,0.957046F,0.867201F,0.699229F)
|
||||
// TOOLS_COLORS_STAT(white,1,1,1) (already defined)
|
||||
// TOOLS_COLORS_STAT(yellow,1,1,0) (already defined)
|
||||
TOOLS_COLORS_STAT(greenyellow,0.675792F,0.996109F,0.18359F)
|
||||
|
||||
#undef TOOLS_COLORS_STAT
|
||||
}
|
||||
|
||||
void G4VisManager::RegisterMessengers () {
|
||||
|
||||
// Instantiate individual messengers/commands (often - but not
|
||||
@@ -372,6 +471,7 @@ void G4VisManager::RegisterMessengers () {
|
||||
|
||||
// Other top level commands...
|
||||
RegisterMessenger(new G4VisCommandAbortReviewKeptEvents);
|
||||
RegisterMessenger(new G4VisCommandDrawOnlyToBeKeptEvents);
|
||||
RegisterMessenger(new G4VisCommandEnable);
|
||||
RegisterMessenger(new G4VisCommandList);
|
||||
RegisterMessenger(new G4VisCommandReviewKeptEvents);
|
||||
@@ -547,8 +647,9 @@ void G4VisManager::Enable() {
|
||||
G4cout << "G4VisManager::Enable: visualization enabled." << G4endl;
|
||||
}
|
||||
if (fVerbosity >= warnings) {
|
||||
auto nKeptEvents =
|
||||
G4RunManager::GetRunManager()->GetCurrentRun()->GetEventVector()->size();
|
||||
G4int nKeptEvents = 0;
|
||||
const G4Run* run = G4RunManager::GetRunManager()->GetCurrentRun();
|
||||
if (run) nKeptEvents = run->GetEventVector()->size();
|
||||
G4cout <<
|
||||
"There are " << nKeptEvents << " kept events."
|
||||
"\n \"/vis/reviewKeptEvents\" to review them one by one."
|
||||
@@ -1761,8 +1862,6 @@ void G4VisManager::BeginOfRun ()
|
||||
{
|
||||
if (fIgnoreStateChanges) return;
|
||||
|
||||
if (!GetConcreteInstance()) return;
|
||||
|
||||
#ifdef G4MULTITHREADED
|
||||
if (G4Threading::IsWorkerThread()) return;
|
||||
#endif
|
||||
@@ -1870,6 +1969,12 @@ void G4VisManager::EndOfEvent ()
|
||||
const G4Event* currentEvent = eventManager->GetConstCurrentEvent();
|
||||
if (!currentEvent) return;
|
||||
|
||||
// Discard event if fDrawEventOnlyIfToBeKept flag is set unless the
|
||||
// user has requested the event to be kept.
|
||||
if (fDrawEventOnlyIfToBeKept) {
|
||||
if (!currentEvent->ToBeKept()) return;
|
||||
}
|
||||
|
||||
if (G4Threading::IsMultithreadedApplication()) {
|
||||
|
||||
#ifdef G4MULTITHREADED
|
||||
@@ -2043,8 +2148,6 @@ void G4VisManager::EndOfRun ()
|
||||
{
|
||||
if (fIgnoreStateChanges) return;
|
||||
|
||||
if (!GetConcreteInstance()) return;
|
||||
|
||||
#ifdef G4MULTITHREADED
|
||||
if (G4Threading::IsWorkerThread()) return;
|
||||
#endif
|
||||
@@ -2122,7 +2225,7 @@ void G4VisManager::EndOfRun ()
|
||||
}
|
||||
G4cout <<
|
||||
"\n \"/vis/reviewKeptEvents\" to review them one by one."
|
||||
"\n \"/vis/viewer/flush\" or \"/vis/viewer/rebuild\" to see them accumulated."
|
||||
"\n \"/vis/enable\", then \"/vis/viewer/flush\" or \"/vis/viewer/rebuild\" to see them accumulated."
|
||||
<< G4endl;
|
||||
}
|
||||
// static G4bool warned = false;
|
||||
@@ -2328,10 +2431,9 @@ G4bool G4VisManager::IsValidView () {
|
||||
"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"
|
||||
"\n manager (G4VisExecutive), possibly by setting G4VIS_NONE, and ensure"
|
||||
"\n drawing code is executed only if G4VVisManager::GetConcreteInstance()"
|
||||
"\n is non-zero."
|
||||
<< G4endl;
|
||||
"\n manager (G4VisExecutive) and ensure drawing code is executed only if"
|
||||
"\n G4VVisManager::GetConcreteInstance() is non-zero."
|
||||
<< G4endl;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user