Import Geant4 10.7.0.beta source tree

This commit is contained in:
Gabriele Cosmo
2020-06-26 10:23:25 +02:00
parent c02c370437
commit 67ba86d073
1871 changed files with 174422 additions and 131884 deletions
@@ -115,7 +115,9 @@ void G4Scene::CalculateExtent ()
G4VModel* model = fRunDurationModelList[i].fpModel;
if (model -> Validate()) { // Validates and also recomputes extent.
const G4VisExtent& thisExtent = model -> GetTransformedExtent ();
boundingExtentScene.AccrueBoundingExtent(thisExtent);
if (thisExtent != G4VisExtent::GetNullExtent()) {
boundingExtentScene.AccrueBoundingExtent(thisExtent);
}
} else {
PrintInvalidModel(model);
}
@@ -127,7 +129,9 @@ void G4Scene::CalculateExtent ()
G4VModel* model = fEndOfEventModelList[i].fpModel;
if (model -> Validate()) { // Validates and also recomputes extent.
const G4VisExtent& thisExtent = model -> GetTransformedExtent ();
boundingExtentScene.AccrueBoundingExtent(thisExtent);
if (thisExtent != G4VisExtent::GetNullExtent()) {
boundingExtentScene.AccrueBoundingExtent(thisExtent);
}
} else {
PrintInvalidModel(model);
}
@@ -139,7 +143,9 @@ void G4Scene::CalculateExtent ()
G4VModel* model = fEndOfRunModelList[i].fpModel;
if (model -> Validate()) { // Validates and also recomputes extent.
const G4VisExtent& thisExtent = model -> GetTransformedExtent ();
boundingExtentScene.AccrueBoundingExtent(thisExtent);
if (thisExtent != G4VisExtent::GetNullExtent()) {
boundingExtentScene.AccrueBoundingExtent(thisExtent);
}
} else {
PrintInvalidModel(model);
}
@@ -219,6 +219,23 @@ void G4VVisCommand::CheckSceneAndNotifyHandlers(G4Scene* pScene)
}
G4bool G4VVisCommand::CheckView ()
{
G4VisManager::Verbosity verbosity = fpVisManager->GetVerbosity();
G4VViewer* viewer = fpVisManager -> GetCurrentViewer ();
if (!viewer) {
if (verbosity >= G4VisManager::errors) {
G4cerr <<
"ERROR: No current viewer - \"/vis/viewer/list\" to see possibilities."
<< G4endl;
}
return false;
}
return true;
}
void G4VVisCommand::G4VisCommandsSceneAddUnsuccessful
(G4VisManager::Verbosity verbosity) {
// Some frequently used error printing...
@@ -282,6 +282,61 @@ void G4VisCommandGeometrySetForceAuxEdgeVisible::SetNewValue
Set(name, setForceAuxEdgeVisible, requestedDepth);
}
////////////// /vis/geometry/set/forceCloud /////////////////////////
G4VisCommandGeometrySetForceCloud::G4VisCommandGeometrySetForceCloud()
{
G4bool omitable;
fpCommand = new G4UIcommand("/vis/geometry/set/forceCloud", this);
fpCommand->SetGuidance
("Forces logical volume(s) always to be drawn as a cloud of points,"
"\nregardless of the view parameters.");
fpCommand->SetGuidance("\"all\" sets all logical volumes.");
fpCommand->SetGuidance
("Optionally propagates down hierarchy to given depth.");
G4UIparameter* parameter;
parameter = new G4UIparameter ("logical-volume-name", 's', omitable = true);
parameter->SetDefaultValue("all");
fpCommand->SetParameter(parameter);
parameter = new G4UIparameter("depth", 'd', omitable = true);
parameter->SetDefaultValue(0);
parameter->SetGuidance
("Depth of propagation (-1 means unlimited depth).");
fpCommand->SetParameter(parameter);
parameter = new G4UIparameter("forceCloud", 'b', omitable = true);
parameter->SetDefaultValue(true);
fpCommand->SetParameter(parameter);
parameter = new G4UIparameter("nPoints", 'd', omitable = true);
parameter->SetGuidance
("<= 0 means under control of viewer.");
parameter->SetDefaultValue(0);
fpCommand->SetParameter(parameter);
}
G4VisCommandGeometrySetForceCloud::~G4VisCommandGeometrySetForceCloud()
{
delete fpCommand;
}
G4String
G4VisCommandGeometrySetForceCloud::GetCurrentValue(G4UIcommand*)
{
return "";
}
void G4VisCommandGeometrySetForceCloud::SetNewValue
(G4UIcommand*, G4String newValue)
{
G4String name, forceCloudString;
G4int requestedDepth, nPoints;
std::istringstream iss(newValue);
iss >> name >> requestedDepth >> forceCloudString >> nPoints;
G4bool forceCloud = G4UIcommand::ConvertToBool(forceCloudString);;
G4VisCommandGeometrySetForceCloudFunction setForceCloud(forceCloud,nPoints);
Set(name, setForceCloud, requestedDepth);
}
////////////// /vis/geometry/set/forceLineSegmentsPerCircle /////////////////////////
G4VisCommandGeometrySetForceLineSegmentsPerCircle::G4VisCommandGeometrySetForceLineSegmentsPerCircle()
@@ -331,7 +386,8 @@ void G4VisCommandGeometrySetForceLineSegmentsPerCircle::SetNewValue
std::istringstream iss(newValue);
iss >> name >> requestedDepth >> lineSegmentsPerCircle;
G4VisCommandGeometrySetForceLineSegmentsPerCircleFunction setForceLineSegmentsPerCircle(lineSegmentsPerCircle);
G4VisCommandGeometrySetForceLineSegmentsPerCircleFunction
setForceLineSegmentsPerCircle(lineSegmentsPerCircle);
Set(name, setForceLineSegmentsPerCircle, requestedDepth);
}
@@ -912,7 +912,7 @@ void G4VisCommandSceneShowExtents::SetNewValue (G4UIcommand*, G4String) {
<< "\n" << transformedExtent;
DrawExtent(transformedExtent);
}
G4cout << "Overall extent:\n";
G4cout << "\n Overall extent:\n";
DrawExtent(pCurrentScene->GetExtent());
G4cout << G4endl;
}
@@ -553,7 +553,7 @@ G4VisCommandSceneAddElectricField::G4VisCommandSceneAddElectricField () {
fpCommand -> SetGuidance
("In the arrow representation, the length of the arrow is proportional"
"\nto the magnitude of the field and the colour is mapped onto the range"
"\nas a fraction of the maximum magnitude: 0->0.5->1 is blue->green->red.");
"\nas a fraction of the maximum magnitude: 0->0.5->1 is red->green->blue.");
G4UIparameter* parameter;
parameter = new G4UIparameter ("nDataPointsPerHalfScene", 'i', omitable = true);
parameter -> SetDefaultValue (10);
@@ -256,7 +256,9 @@ void G4VisCommandSceneHandlerCreate::SetNewValue (G4UIcommand*,
// Check UI session compatibility.
G4bool fallback = false;
G4int loopCounter = 0;
while (!gsl[iGS]->IsUISessionCompatible()) {
G4int iGSBeingTested = iGS;
// Not compatible, search for a fallback
fallback = false;
G4String fallbackNickname = gsl[iGS]->GetNickname() + "_FALLBACK";
@@ -273,18 +275,19 @@ void G4VisCommandSceneHandlerCreate::SetNewValue (G4UIcommand*,
break; // Match found
}
}
if (iGS < 0 || iGS >= nSystems) {
if (iGS < 0 || iGS >= nSystems || loopCounter >=3) {
if (verbosity >= G4VisManager::errors) {
G4cerr <<
"ERROR: G4VisCommandSceneHandlerCreate::SetNewValue:"
" could not find fallback graphics system for \""
<< graphicsSystem
<< "\"."
"ERROR: G4VisCommandSceneHandlerCreate::SetNewValue: \""
<< gsl[iGSBeingTested]->GetNickname()
<< "\" is not compatible with your chosen session,"
" and no fallback system found."
<< G4endl;
}
return;
}
// A fallback system found...but go back and check this too.
++loopCounter;
}
// A graphics system has been found
@@ -82,18 +82,6 @@ G4VisCommandsTouchableSet::G4VisCommandsTouchableSet()
fpCommandSetForceAuxEdgeVisible->SetParameterName("forceAuxEdgeVisible", omitable = true);
fpCommandSetForceAuxEdgeVisible->SetDefaultValue(true);
fpCommandSetLineSegmentsPerCircle = new G4UIcmdWithAnInteger
("/vis/touchable/set/lineSegmentsPerCircle", this);
fpCommandSetLineSegmentsPerCircle->SetGuidance
("For current touchable, set number of line segments per circle, the"
"\nprecision with which a curved line or surface is represented by a"
"\npolygon or polyhedron, regardless of the view parameters."
"\nNegative to pick up G4Polyhedron default value.");
fpCommandSetLineSegmentsPerCircle->SetGuidance
("Use \"/vis/set/touchable\" to set current touchable.");
fpCommandSetLineSegmentsPerCircle->SetParameterName("lineSegmentsPerCircle", omitable = true);
fpCommandSetLineSegmentsPerCircle->SetDefaultValue(0);
fpCommandSetForceCloud = new G4UIcmdWithABool
("/vis/touchable/set/forceCloud", this);
fpCommandSetForceCloud->SetGuidance
@@ -121,6 +109,18 @@ G4VisCommandsTouchableSet::G4VisCommandsTouchableSet()
fpCommandSetForceWireframe->SetParameterName("forceWireframe", omitable = true);
fpCommandSetForceWireframe->SetDefaultValue(true);
fpCommandSetLineSegmentsPerCircle = new G4UIcmdWithAnInteger
("/vis/touchable/set/lineSegmentsPerCircle", this);
fpCommandSetLineSegmentsPerCircle->SetGuidance
("For current touchable, set number of line segments per circle, the"
"\nprecision with which a curved line or surface is represented by a"
"\npolygon or polyhedron, regardless of the view parameters."
"\nNegative to pick up G4Polyhedron default value.");
fpCommandSetLineSegmentsPerCircle->SetGuidance
("Use \"/vis/set/touchable\" to set current touchable.");
fpCommandSetLineSegmentsPerCircle->SetParameterName("lineSegmentsPerCircle", omitable = true);
fpCommandSetLineSegmentsPerCircle->SetDefaultValue(0);
fpCommandSetLineStyle = new G4UIcmdWithAString
("/vis/touchable/set/lineStyle", this);
fpCommandSetLineStyle->SetGuidance("Set line style of current touchable drawing.");
@@ -141,13 +141,11 @@ G4VisCommandsTouchableSet::G4VisCommandsTouchableSet()
fpCommandSetNumberOfCloudPoints = new G4UIcmdWithAnInteger
("/vis/touchable/set/numberOfCloudPoints", this);
fpCommandSetNumberOfCloudPoints->SetGuidance
("For current touchable, set number of line segments per circle, the"
"\nprecision with which a curved line or surface is represented by a"
"\npolygon or polyhedron, regardless of the view parameters."
"\nNegative to pick up G4Polyhedron default value.");
("For current touchable, set number of cloud points for cloud drawing."
"\n<= 0 means under control of viewer.");
fpCommandSetNumberOfCloudPoints->SetGuidance
("Use \"/vis/set/touchable\" to set current touchable.");
fpCommandSetNumberOfCloudPoints->SetParameterName("lineSegmentsPerCircle", omitable = true);
fpCommandSetNumberOfCloudPoints->SetParameterName("numberOfCloudPoints", omitable = true);
fpCommandSetNumberOfCloudPoints->SetDefaultValue(0);
fpCommandSetVisibility = new G4UIcmdWithABool
@@ -479,6 +479,7 @@ void G4VisManager::RegisterMessengers () {
RegisterMessenger(new G4VisCommandGeometrySetLineStyle);
RegisterMessenger(new G4VisCommandGeometrySetLineWidth);
RegisterMessenger(new G4VisCommandGeometrySetForceAuxEdgeVisible);
RegisterMessenger(new G4VisCommandGeometrySetForceCloud);
RegisterMessenger(new G4VisCommandGeometrySetForceLineSegmentsPerCircle);
RegisterMessenger(new G4VisCommandGeometrySetForceSolid);
RegisterMessenger(new G4VisCommandGeometrySetForceWireframe);
@@ -691,7 +692,8 @@ void G4VisManager::Disable() {
"\n \"/tracking/storeTrajectory 0\""
"\nbut don't forget to re-enable with"
"\n \"/vis/enable\""
"\n \"/tracking/storeTrajectory " << currentTrajectoryType << '\"'
"\n \"/tracking/storeTrajectory " << currentTrajectoryType
<< "\"\n and maybe \"/vis/viewer/rebuild\""
<< G4endl;
}
}
@@ -1613,14 +1615,14 @@ void G4VisManager::SetCurrentViewer (G4VViewer* pViewer) {
void G4VisManager::PrintAvailableGraphicsSystems (Verbosity verbosity) const
{
G4cout << "Current available graphics systems are:\n";
G4cout << "Registered graphics systems are:\n";
if (fAvailableGraphicsSystems.size ()) {
for (const auto& gs: fAvailableGraphicsSystems) {
const G4String& name = gs->GetName();
const std::vector<G4String>& nicknames = gs->GetNicknames();
if (verbosity <= warnings) {
// Brief output
G4cout << name << " (";
G4cout << " " << name << " (";
for (size_t i = 0; i < nicknames.size(); ++i) {
if (i != 0) {
G4cout << ", ";
@@ -1635,7 +1637,7 @@ void G4VisManager::PrintAvailableGraphicsSystems (Verbosity verbosity) const
G4cout << G4endl;
}
} else {
G4cout << "\n NONE!!! None registered - yet! Mmmmm!" << G4endl;
G4cout << " NONE!!! None registered - yet! Mmmmm!" << G4endl;
}
}
@@ -1649,15 +1651,17 @@ void G4VisManager::PrintAvailableModels (Verbosity verbosity) const
if (factoryList.empty()) G4cout << " None" << G4endl;
else {
std::vector<G4VModelFactory<G4VTrajectoryModel>*>::const_iterator i;
for (i = factoryList.begin(); i != factoryList.end(); ++i)
(*i)->Print(G4cout);
for (i = factoryList.begin(); i != factoryList.end(); ++i) {
(*i)->Print(G4cout);
}
}
G4cout << "\nRegistered models:" << G4endl;
const G4VisListManager<G4VTrajectoryModel>* listManager =
fpTrajDrawModelMgr->ListManager();
const std::map<G4String, G4VTrajectoryModel*>& modelMap =
listManager->Map();
if (!modelMap.empty()) {
G4cout << "\nRegistered models:" << G4endl;
if (modelMap.empty()) G4cout << " None" << G4endl;
else {
std::map<G4String, G4VTrajectoryModel*>::const_iterator i;
for (i = modelMap.begin(); i != modelMap.end(); ++i) {
G4cout << " " << i->second->Name();
@@ -1678,13 +1682,16 @@ void G4VisManager::PrintAvailableModels (Verbosity verbosity) const
if (factoryList.empty()) G4cout << " None" << G4endl;
else {
std::vector<G4VModelFactory<G4VFilter<G4VTrajectory> >*>::const_iterator i;
for (i = factoryList.begin(); i != factoryList.end(); ++i)
(*i)->Print(G4cout);
for (i = factoryList.begin(); i != factoryList.end(); ++i) {
(*i)->Print(G4cout);
}
}
G4cout << "\nRegistered filters:" << G4endl;
const std::vector<G4VFilter<G4VTrajectory>*>&
filterList = fpTrajFilterMgr->FilterList();
if (!filterList.empty()) {
G4cout << "\nRegistered filters:" << G4endl;
if (filterList.empty()) G4cout << " None" << G4endl;
else {
std::vector<G4VFilter<G4VTrajectory>*>::const_iterator i;
for (i = filterList.begin(); i != filterList.end(); ++i) {
G4cout << " " << (*i)->GetName() << G4endl;