Import Geant4 10.6.0.beta source tree
This commit is contained in:
@@ -31,7 +31,7 @@
|
||||
#include "G4Scene.hh"
|
||||
|
||||
#include "G4Vector3D.hh"
|
||||
#include "G4BoundingSphereScene.hh"
|
||||
#include "G4BoundingExtentScene.hh"
|
||||
#include "G4VisAttributes.hh"
|
||||
#include "G4PhysicalVolumeModel.hh"
|
||||
#include "G4TransportationManager.hh"
|
||||
@@ -94,28 +94,30 @@ G4bool G4Scene::AddRunDurationModel (G4VModel* pModel, G4bool warn)
|
||||
return true;
|
||||
}
|
||||
|
||||
namespace {
|
||||
void PrintInvalidModel(const G4VModel* model)
|
||||
{
|
||||
G4ExceptionDescription ed;
|
||||
ed << "Invalid model \"" << model->GetGlobalDescription()
|
||||
<< "\".\n Not included in extent calculation.";
|
||||
G4Exception
|
||||
("G4Scene::CalculateExtent",
|
||||
"visman0201", JustWarning, ed);
|
||||
}
|
||||
}
|
||||
|
||||
void G4Scene::CalculateExtent ()
|
||||
{
|
||||
G4BoundingSphereScene boundingSphereScene;
|
||||
G4BoundingExtentScene boundingExtentScene;
|
||||
|
||||
for (size_t i = 0; i < fRunDurationModelList.size(); i++) {
|
||||
if (fRunDurationModelList[i].fActive) {
|
||||
G4VModel* model = fRunDurationModelList[i].fpModel;
|
||||
if (model -> Validate()) { // Validates and also recomputes extent.
|
||||
const G4VisExtent& thisExtent = model -> GetExtent ();
|
||||
G4double thisRadius = thisExtent.GetExtentRadius ();
|
||||
if (thisRadius > 0.) {
|
||||
G4Point3D thisCentre = thisExtent.GetExtentCentre ();
|
||||
thisCentre.transform (model -> GetTransformation ());
|
||||
boundingSphereScene.AccrueBoundingSphere (thisCentre, thisRadius);
|
||||
}
|
||||
const G4VisExtent& thisExtent = model -> GetTransformedExtent ();
|
||||
boundingExtentScene.AccrueBoundingExtent(thisExtent);
|
||||
} else {
|
||||
G4ExceptionDescription ed;
|
||||
ed << "Invalid model \"" << model->GetGlobalDescription()
|
||||
<< "\".\n Not included in extent calculation.";
|
||||
G4Exception
|
||||
("G4Scene::CalculateExtent",
|
||||
"visman0201", JustWarning, ed);
|
||||
PrintInvalidModel(model);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -124,20 +126,10 @@ void G4Scene::CalculateExtent ()
|
||||
if (fEndOfEventModelList[i].fActive) {
|
||||
G4VModel* model = fEndOfEventModelList[i].fpModel;
|
||||
if (model -> Validate()) { // Validates and also recomputes extent.
|
||||
const G4VisExtent& thisExtent = model -> GetExtent ();
|
||||
G4double thisRadius = thisExtent.GetExtentRadius ();
|
||||
if (thisRadius > 0.) {
|
||||
G4Point3D thisCentre = thisExtent.GetExtentCentre ();
|
||||
thisCentre.transform (model -> GetTransformation ());
|
||||
boundingSphereScene.AccrueBoundingSphere (thisCentre, thisRadius);
|
||||
}
|
||||
const G4VisExtent& thisExtent = model -> GetTransformedExtent ();
|
||||
boundingExtentScene.AccrueBoundingExtent(thisExtent);
|
||||
} else {
|
||||
G4ExceptionDescription ed;
|
||||
ed << "Invalid model \"" << model->GetGlobalDescription()
|
||||
<< "\".\n Not included in extent calculation.";
|
||||
G4Exception
|
||||
("G4Scene::CalculateExtent",
|
||||
"visman0201", JustWarning, ed);
|
||||
PrintInvalidModel(model);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -146,25 +138,15 @@ void G4Scene::CalculateExtent ()
|
||||
if (fEndOfRunModelList[i].fActive) {
|
||||
G4VModel* model = fEndOfRunModelList[i].fpModel;
|
||||
if (model -> Validate()) { // Validates and also recomputes extent.
|
||||
const G4VisExtent& thisExtent = model -> GetExtent ();
|
||||
G4double thisRadius = thisExtent.GetExtentRadius ();
|
||||
if (thisRadius > 0.) {
|
||||
G4Point3D thisCentre = thisExtent.GetExtentCentre ();
|
||||
thisCentre.transform (model -> GetTransformation ());
|
||||
boundingSphereScene.AccrueBoundingSphere (thisCentre, thisRadius);
|
||||
}
|
||||
const G4VisExtent& thisExtent = model -> GetTransformedExtent ();
|
||||
boundingExtentScene.AccrueBoundingExtent(thisExtent);
|
||||
} else {
|
||||
G4ExceptionDescription ed;
|
||||
ed << "Invalid model \"" << model->GetGlobalDescription()
|
||||
<< "\".\n Not included in extent calculation.";
|
||||
G4Exception
|
||||
("G4Scene::CalculateExtent",
|
||||
"visman0201", JustWarning, ed);
|
||||
PrintInvalidModel(model);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fExtent = boundingSphereScene.GetBoundingSphereExtent ();
|
||||
fExtent = boundingExtentScene.GetBoundingExtent ();
|
||||
fStandardTargetPoint = fExtent.GetExtentCentre ();
|
||||
if (fExtent.GetExtentRadius() <= 0.) {
|
||||
G4Exception
|
||||
@@ -261,6 +243,9 @@ std::ostream& operator << (std::ostream& os, const G4Scene& scene) {
|
||||
os << "Scene data:";
|
||||
|
||||
os << "\n Run-duration model list:";
|
||||
if (scene.fRunDurationModelList.size () == 0) {
|
||||
os << " none";
|
||||
}
|
||||
for (i = 0; i < scene.fRunDurationModelList.size (); i++) {
|
||||
if (scene.fRunDurationModelList[i].fActive) os << "\n Active: ";
|
||||
else os << "\n Inactive: ";
|
||||
@@ -268,6 +253,9 @@ std::ostream& operator << (std::ostream& os, const G4Scene& scene) {
|
||||
}
|
||||
|
||||
os << "\n End-of-event model list:";
|
||||
if (scene.fEndOfEventModelList.size () == 0) {
|
||||
os << " none";
|
||||
}
|
||||
for (i = 0; i < scene.fEndOfEventModelList.size (); i++) {
|
||||
if (scene.fEndOfEventModelList[i].fActive) os << "\n Active: ";
|
||||
else os << "\n Inactive: ";
|
||||
@@ -275,13 +263,16 @@ std::ostream& operator << (std::ostream& os, const G4Scene& scene) {
|
||||
}
|
||||
|
||||
os << "\n End-of-run model list:";
|
||||
if (scene.fEndOfRunModelList.size () == 0) {
|
||||
os << " none";
|
||||
}
|
||||
for (i = 0; i < scene.fEndOfRunModelList.size (); i++) {
|
||||
if (scene.fEndOfRunModelList[i].fActive) os << "\n Active: ";
|
||||
else os << "\n Inactive: ";
|
||||
os << *(scene.fEndOfRunModelList[i].fpModel);
|
||||
}
|
||||
|
||||
os << "\n Extent or bounding box: " << scene.fExtent;
|
||||
os << "\n Overall extent or bounding box: " << scene.fExtent;
|
||||
|
||||
os << "\n Standard target point: " << scene.fStandardTargetPoint;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user