Import Geant4 9.4.0 source tree
This commit is contained in:
@@ -24,8 +24,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4ErrorTarget.cc,v 1.1 2007/05/16 12:50:52 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
// $Id: G4ErrorTarget.cc,v 1.2 2010/07/05 09:22:58 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-09-04 $
|
||||
//
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
@@ -34,8 +34,10 @@
|
||||
|
||||
#include "G4ErrorTarget.hh"
|
||||
|
||||
G4ErrorTarget::G4ErrorTarget(){}
|
||||
G4ErrorTarget::~G4ErrorTarget(){}
|
||||
G4ErrorTarget::G4ErrorTarget()
|
||||
: theType(G4ErrorTarget_GeomVolume) {}
|
||||
|
||||
G4ErrorTarget::~G4ErrorTarget() {}
|
||||
|
||||
G4double G4ErrorTarget::GetDistanceFromPoint( const G4ThreeVector&,
|
||||
const G4ThreeVector& ) const
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4GeometryManager.cc,v 1.22 2008/05/16 13:46:48 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
// $Id: G4GeometryManager.cc,v 1.24 2010/07/16 15:52:57 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-09-04 $
|
||||
//
|
||||
// class G4GeometryManager
|
||||
//
|
||||
@@ -260,7 +260,7 @@ void G4GeometryManager::BuildOptimisations(G4bool allOpts,
|
||||
// Don't create voxels for this node
|
||||
#ifdef G4GEOMETRY_VOXELDEBUG
|
||||
G4cout << "**** G4GeometryManager::BuildOptimisations" << G4endl
|
||||
<< " Skipping logical volume name = " << volume->GetName()
|
||||
<< " Skipping logical volume name = " << tVolume->GetName()
|
||||
<< G4endl;
|
||||
#endif
|
||||
}
|
||||
@@ -358,7 +358,8 @@ G4GeometryManager::ReportVoxelStats( std::vector<G4SmartVoxelStat> & stats,
|
||||
G4cout << " Total memory consumed for geometry optimisation: "
|
||||
<< totalMemory/1024 << " kByte" << G4endl;
|
||||
G4cout << " Total CPU time elapsed for geometry optimisation: "
|
||||
<< std::setprecision(2) << totalCpuTime << " seconds" << G4endl;
|
||||
<< std::setprecision(2) << totalCpuTime << " seconds"
|
||||
<< std::setprecision(6) << G4endl;
|
||||
|
||||
//
|
||||
// First list: sort by total CPU time
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4LogicalSurface.cc,v 1.1 2010/07/05 09:22:58 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-09-04 $
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// G4LogicalSurface Class Implementation
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "G4LogicalSurface.hh"
|
||||
|
||||
////////////////////////////
|
||||
// Constructors & Destructor
|
||||
////////////////////////////
|
||||
|
||||
G4LogicalSurface::G4LogicalSurface(const G4String& name,
|
||||
G4SurfaceProperty* surfaceProperty)
|
||||
: theName(name), theSurfaceProperty(surfaceProperty), theTransRadSurface(0)
|
||||
{
|
||||
}
|
||||
|
||||
G4LogicalSurface::G4LogicalSurface(const G4LogicalSurface &r)
|
||||
: theName(r.theName), theSurfaceProperty(r.theSurfaceProperty),
|
||||
theTransRadSurface(r.theTransRadSurface)
|
||||
{
|
||||
}
|
||||
|
||||
G4LogicalSurface::~G4LogicalSurface()
|
||||
{
|
||||
}
|
||||
@@ -24,8 +24,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4LogicalVolume.cc,v 1.34 2009/09/24 13:22:57 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-09-03 $
|
||||
// $Id: G4LogicalVolume.cc,v 1.35 2010/07/05 09:22:58 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-09-04 $
|
||||
//
|
||||
//
|
||||
// class G4LogicalVolume Implementation
|
||||
@@ -210,6 +210,7 @@ G4double G4LogicalVolume::GetMass(G4bool forced,
|
||||
<< fName << " ! Sorry, cannot compute the mass ..." << G4endl;
|
||||
G4Exception("G4LogicalVolume::GetMass()", "InvalidSetup", FatalException,
|
||||
"No material associated to the logical volume !");
|
||||
return 0;
|
||||
}
|
||||
if (!fSolid)
|
||||
{
|
||||
@@ -218,6 +219,7 @@ G4double G4LogicalVolume::GetMass(G4bool forced,
|
||||
<< fName << " ! Sorry, cannot compute the mass ..." << G4endl;
|
||||
G4Exception("G4LogicalVolume::GetMass()", "InvalidSetup", FatalException,
|
||||
"No solid associated to the logical volume !");
|
||||
return 0;
|
||||
}
|
||||
G4double globalDensity = logMaterial->GetDensity();
|
||||
fMass = fSolid->GetCubicVolume() * globalDensity;
|
||||
|
||||
@@ -24,9 +24,9 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4ReflectedSolid.cc,v 1.11 2006/11/08 09:56:33 gcosmo Exp $
|
||||
// $Id: G4ReflectedSolid.cc,v 1.13 2010/10/19 15:20:18 gcosmo Exp $
|
||||
//
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
// GEANT4 tag $Name: geant4-09-04 $
|
||||
//
|
||||
// Implementation for G4ReflectedSolid class for boolean
|
||||
// operations between other solids
|
||||
@@ -92,6 +92,49 @@ G4ReflectedSolid::~G4ReflectedSolid()
|
||||
delete fpPolyhedron;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////
|
||||
//
|
||||
|
||||
G4ReflectedSolid::G4ReflectedSolid(const G4ReflectedSolid& rhs)
|
||||
: G4VSolid(rhs), fPtrSolid(rhs.fPtrSolid), fpPolyhedron(0)
|
||||
{
|
||||
fPtrTransform = new G4AffineTransform(*rhs.fPtrTransform);
|
||||
fDirectTransform = new G4AffineTransform(*rhs.fDirectTransform);
|
||||
fPtrTransform3D = new G4Transform3D(*rhs.fPtrTransform3D);
|
||||
fDirectTransform3D = new G4Transform3D(*rhs.fDirectTransform3D);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////
|
||||
//
|
||||
|
||||
G4ReflectedSolid& G4ReflectedSolid::operator=(const G4ReflectedSolid& rhs)
|
||||
{
|
||||
// Check assignment to self
|
||||
//
|
||||
if (this == &rhs) { return *this; }
|
||||
|
||||
// Copy base class data
|
||||
//
|
||||
G4VSolid::operator=(rhs);
|
||||
|
||||
// Copy data
|
||||
//
|
||||
fPtrSolid= rhs.fPtrSolid; fpPolyhedron= 0;
|
||||
delete fPtrTransform;
|
||||
fPtrTransform= new G4AffineTransform(*rhs.fPtrTransform);
|
||||
delete fDirectTransform;
|
||||
fDirectTransform= new G4AffineTransform(*rhs.fDirectTransform);
|
||||
delete fPtrTransform3D;
|
||||
fPtrTransform3D= new G4Transform3D(*rhs.fPtrTransform3D);
|
||||
delete fDirectTransform3D;
|
||||
fDirectTransform3D= new G4Transform3D(*rhs.fDirectTransform3D);
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////
|
||||
//
|
||||
|
||||
G4GeometryType G4ReflectedSolid::GetEntityType() const
|
||||
{
|
||||
return G4String("G4ReflectedSolid");
|
||||
@@ -256,13 +299,14 @@ G4ReflectedSolid::CalculateExtent( const EAxis pAxis,
|
||||
|
||||
G4Point3D tmpPoint;
|
||||
|
||||
// Calculate rotated vertex coordinates
|
||||
// Calculate rotated vertex coordinates
|
||||
|
||||
G4ThreeVectorList* vertices = new G4ThreeVectorList();
|
||||
vertices->reserve(8);
|
||||
|
||||
if (vertices)
|
||||
{
|
||||
vertices->reserve(8);
|
||||
|
||||
G4ThreeVector vertex0(x1,y1,z1) ;
|
||||
tmpPoint = transform3D*G4Point3D(vertex0);
|
||||
vertex0 = G4ThreeVector(tmpPoint.x(),tmpPoint.y(),tmpPoint.z());
|
||||
@@ -493,7 +537,7 @@ G4ReflectedSolid::ComputeDimensions( G4VPVParameterisation*,
|
||||
const G4VPhysicalVolume* )
|
||||
{
|
||||
DumpInfo();
|
||||
G4Exception("G4BooleanSolid::ComputeDimensions()",
|
||||
G4Exception("G4ReflectedSolid::ComputeDimensions()",
|
||||
"NotApplicable", FatalException,
|
||||
"Method not applicable in this context!");
|
||||
}
|
||||
@@ -511,6 +555,16 @@ G4ThreeVector G4ReflectedSolid::GetPointOnSurface() const
|
||||
return G4ThreeVector(newPoint.x(),newPoint.y(),newPoint.z());
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Make a clone of this object
|
||||
|
||||
G4VSolid* G4ReflectedSolid::Clone() const
|
||||
{
|
||||
return new G4ReflectedSolid(*this);
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Stream object contents to an output stream
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4SmartVoxelHeader.cc,v 1.34 2009/10/30 14:05:47 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-09-03 $
|
||||
// $Id: G4SmartVoxelHeader.cc,v 1.39 2010/09/06 09:39:21 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-09-04 $
|
||||
//
|
||||
//
|
||||
// class G4SmartVoxelHeader
|
||||
@@ -147,7 +147,7 @@ G4SmartVoxelHeader::~G4SmartVoxelHeader()
|
||||
delete dyingHeader;
|
||||
}
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
dyingNode = fslices[node]->GetNode();
|
||||
if (dyingNode!=lastNode)
|
||||
@@ -509,15 +509,19 @@ G4SmartVoxelHeader::BuildVoxelsWithinLimits(G4LogicalVolume* pVolume,
|
||||
tmpProx = pTestSlices->back();
|
||||
pTestSlices->pop_back();
|
||||
for (G4ProxyVector::iterator i=pTestSlices->begin();
|
||||
i!=pTestSlices->end(); i++)
|
||||
i!=pTestSlices->end(); )
|
||||
{
|
||||
if (*i==tmpProx)
|
||||
{
|
||||
pTestSlices->erase(i); i--;
|
||||
i = pTestSlices->erase(i);
|
||||
}
|
||||
else
|
||||
{
|
||||
++i;
|
||||
}
|
||||
}
|
||||
if ( tmpProx ) { delete tmpProx; }
|
||||
}
|
||||
}
|
||||
delete pTestSlices;
|
||||
}
|
||||
}
|
||||
@@ -533,6 +537,7 @@ G4SmartVoxelHeader::BuildVoxelsWithinLimits(G4LogicalVolume* pVolume,
|
||||
G4Exception("G4SmartVoxelHeader::BuildVoxelsWithinLimits()",
|
||||
"InvalidSetup", FatalException,
|
||||
"Cannot select more than 3 axis for optimisation.");
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
@@ -547,7 +552,8 @@ G4SmartVoxelHeader::BuildVoxelsWithinLimits(G4LogicalVolume* pVolume,
|
||||
faxis=goodSliceAxis;
|
||||
|
||||
#ifdef G4GEOMETRY_VOXELDEBUG
|
||||
G4cout << G4endl << " Selected axis = " << faxis << G4endl;
|
||||
G4cout << G4endl << " Volume = " << pVolume->GetName()
|
||||
<< G4endl << " Selected axis = " << faxis << G4endl;
|
||||
for (size_t islice=0; islice<fslices.size(); islice++)
|
||||
{
|
||||
G4cout << " Node #" << islice << " = {";
|
||||
@@ -760,7 +766,8 @@ G4ProxyVector* G4SmartVoxelHeader::BuildNodes(G4LogicalVolume* pVolume,
|
||||
const G4VolumeNosVector* pCandidates,
|
||||
EAxis pAxis)
|
||||
{
|
||||
G4double motherMinExtent, motherMaxExtent, targetMinExtent, targetMaxExtent;
|
||||
G4double motherMinExtent= kInfinity, motherMaxExtent= -kInfinity,
|
||||
targetMinExtent= kInfinity, targetMaxExtent= -kInfinity;
|
||||
G4VPhysicalVolume *pDaughter=0;
|
||||
G4VPVParameterisation *pParam=0;
|
||||
G4VSolid *targetSolid;
|
||||
@@ -806,6 +813,7 @@ G4ProxyVector* G4SmartVoxelHeader::BuildNodes(G4LogicalVolume* pVolume,
|
||||
<< G4endl;
|
||||
G4Exception("G4SmartVoxelHeader::BuildNodes()", "InvalidSetup",
|
||||
FatalException, "Missing parameterisation.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Setup daughter's transformations
|
||||
@@ -863,6 +871,14 @@ G4ProxyVector* G4SmartVoxelHeader::BuildNodes(G4LogicalVolume* pVolume,
|
||||
minExtents[nVol] = targetMinExtent;
|
||||
maxExtents[nVol] = targetMaxExtent;
|
||||
|
||||
#ifdef G4GEOMETRY_VOXELDEBUG
|
||||
G4cout << "---------------------------------------------------" << G4endl
|
||||
<< " Volume = " << pDaughter->GetName() << G4endl
|
||||
<< " Min Extent = " << targetMinExtent << G4endl
|
||||
<< " Max Extent = " << targetMaxExtent << G4endl
|
||||
<< "---------------------------------------------------" << G4endl;
|
||||
#endif
|
||||
|
||||
// Check not entirely outside mother when processing toplevel nodes
|
||||
//
|
||||
if ( (!pLimits.IsLimited()) && ((targetMaxExtent<=motherMinExtent)
|
||||
@@ -958,17 +974,19 @@ G4ProxyVector* G4SmartVoxelHeader::BuildNodes(G4LogicalVolume* pVolume,
|
||||
}
|
||||
G4double nodeWidth = (motherMaxExtent-motherMinExtent)/noNodes;
|
||||
|
||||
// Create G4VoxelNodes. Will Add proxies before setting fslices
|
||||
//
|
||||
// Create G4VoxelNodes. Will Add proxies before setting fslices
|
||||
//
|
||||
G4NodeVector* nodeList = new G4NodeVector();
|
||||
nodeList->reserve(noNodes);
|
||||
if (!nodeList)
|
||||
{
|
||||
G4cerr << "ERROR - G4SmartVoxelHeader::BuildNodes()" << G4endl
|
||||
<< " NodeList allocation failed." << G4endl;
|
||||
G4Exception("G4SmartVoxelHeader::BuildNodes()", "FatalError",
|
||||
FatalException, "NodeList allocation error.");
|
||||
return 0;
|
||||
}
|
||||
nodeList->reserve(noNodes);
|
||||
|
||||
for (nNode=0; nNode<noNodes; nNode++)
|
||||
{
|
||||
G4SmartVoxelNode *pNode;
|
||||
@@ -979,6 +997,7 @@ G4ProxyVector* G4SmartVoxelHeader::BuildNodes(G4LogicalVolume* pVolume,
|
||||
<< " Node allocation failed." << G4endl;
|
||||
G4Exception("G4SmartVoxelHeader::BuildNodes()", "FatalError",
|
||||
FatalException, "Node allocation error.");
|
||||
return 0;
|
||||
}
|
||||
nodeList->push_back(pNode);
|
||||
}
|
||||
@@ -1024,14 +1043,16 @@ G4ProxyVector* G4SmartVoxelHeader::BuildNodes(G4LogicalVolume* pVolume,
|
||||
// (but we must delete nodeList *itself* - not the contents)
|
||||
//
|
||||
G4ProxyVector* proxyList = new G4ProxyVector();
|
||||
proxyList->reserve(noNodes);
|
||||
if (!proxyList)
|
||||
{
|
||||
G4cerr << "ERROR - G4SmartVoxelHeader::BuildNodes()" << G4endl
|
||||
<< " Proxy list allocation failed." << G4endl;
|
||||
G4Exception("G4SmartVoxelHeader::BuildNodes()", "FatalError",
|
||||
FatalException, "Proxy list allocation error.");
|
||||
return 0;
|
||||
}
|
||||
proxyList->reserve(noNodes);
|
||||
|
||||
//
|
||||
// Fill proxy List
|
||||
//
|
||||
@@ -1047,6 +1068,7 @@ G4ProxyVector* G4SmartVoxelHeader::BuildNodes(G4LogicalVolume* pVolume,
|
||||
<< " Proxy node allocation failed." << G4endl;
|
||||
G4Exception("G4SmartVoxelHeader::BuildNodes()", "FatalError",
|
||||
FatalException, "Proxy node allocation failed.");
|
||||
return 0;
|
||||
}
|
||||
proxyList->push_back(pProxyNode);
|
||||
}
|
||||
@@ -1194,7 +1216,6 @@ void G4SmartVoxelHeader::RefineNodes(G4LogicalVolume* pVolume,
|
||||
{
|
||||
noContainedDaughters = targetNode->GetNoContained();
|
||||
targetList = new G4VolumeNosVector();
|
||||
targetList->reserve(noContainedDaughters);
|
||||
if (!targetList)
|
||||
{
|
||||
G4cerr << "ERROR - G4SmartVoxelHeader::RefineNodes()" << G4endl
|
||||
@@ -1203,7 +1224,9 @@ void G4SmartVoxelHeader::RefineNodes(G4LogicalVolume* pVolume,
|
||||
G4Exception("G4SmartVoxelHeader::RefineNodes()",
|
||||
"FatalError", FatalException,
|
||||
"Target volume node list allocation error.");
|
||||
return;
|
||||
}
|
||||
targetList->reserve(noContainedDaughters);
|
||||
for (i=0; i<noContainedDaughters; i++)
|
||||
{
|
||||
targetList->push_back(targetNode->GetVolume(i));
|
||||
@@ -1216,6 +1239,13 @@ void G4SmartVoxelHeader::RefineNodes(G4LogicalVolume* pVolume,
|
||||
<< " Refining nodes " << minNo
|
||||
<< " - " << maxNo << " inclusive" << G4endl;
|
||||
#endif
|
||||
if (minNo > maxNo) // Delete node and list to be replaced
|
||||
{ // and avoid further action ...
|
||||
delete targetNode;
|
||||
delete targetList;
|
||||
return;
|
||||
}
|
||||
|
||||
// Delete node proxies at start of collected sets of nodes/headers
|
||||
//
|
||||
lastProxy=0;
|
||||
@@ -1244,16 +1274,18 @@ void G4SmartVoxelHeader::RefineNodes(G4LogicalVolume* pVolume,
|
||||
<< " Refined VoxelHeader allocation failed." << G4endl;
|
||||
G4Exception("G4SmartVoxelHeader::RefineNodes()", "FatalError",
|
||||
FatalException, "Refined VoxelHeader allocation error.");
|
||||
return;
|
||||
}
|
||||
replaceHeader->SetMinEquivalentSliceNo(minNo);
|
||||
replaceHeader->SetMaxEquivalentSliceNo(maxNo);
|
||||
replaceHeaderProxy = new G4SmartVoxelProxy(replaceHeader);
|
||||
if (!replaceHeader)
|
||||
if (!replaceHeaderProxy)
|
||||
{
|
||||
G4cerr << "ERROR - G4SmartVoxelHeader::RefineNodes()" << G4endl
|
||||
<< " Refined VoxelProxy allocation failed." << G4endl;
|
||||
G4Exception("G4SmartVoxelHeader::RefineNodes()", "FatalError",
|
||||
FatalException, "Refined VoxelProxy allocation error.");
|
||||
return;
|
||||
}
|
||||
for (replaceNo=minNo; replaceNo<=maxNo; replaceNo++)
|
||||
{
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4VSolid.cc,v 1.39 2008/09/23 13:07:41 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
// $Id: G4VSolid.cc,v 1.40 2010/10/19 15:19:37 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-09-04 $
|
||||
//
|
||||
// class G4VSolid
|
||||
//
|
||||
@@ -159,6 +159,176 @@ G4ThreeVector G4VSolid::GetPointOnSurface() const
|
||||
return G4ThreeVector(0,0,0);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Dummy implementations ...
|
||||
|
||||
const G4VSolid* G4VSolid::GetConstituentSolid(G4int) const
|
||||
{ return 0; }
|
||||
|
||||
G4VSolid* G4VSolid::GetConstituentSolid(G4int)
|
||||
{ return 0; }
|
||||
|
||||
const G4DisplacedSolid* G4VSolid::GetDisplacedSolidPtr() const
|
||||
{ return 0; }
|
||||
|
||||
G4DisplacedSolid* G4VSolid::GetDisplacedSolidPtr()
|
||||
{ return 0; }
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Returns an estimation of the solid volume in internal units.
|
||||
// The number of statistics and error accuracy is fixed.
|
||||
// This method may be overloaded by derived classes to compute the
|
||||
// exact geometrical quantity for solids where this is possible.
|
||||
// or anyway to cache the computed value.
|
||||
// This implementation does NOT cache the computed value.
|
||||
|
||||
G4double G4VSolid::GetCubicVolume()
|
||||
{
|
||||
G4int cubVolStatistics = 1000000;
|
||||
G4double cubVolEpsilon = 0.001;
|
||||
return EstimateCubicVolume(cubVolStatistics, cubVolEpsilon);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Calculate cubic volume based on Inside() method.
|
||||
// Accuracy is limited by the second argument or the statistics
|
||||
// expressed by the first argument.
|
||||
// Implementation is courtesy of Vasiliki Despoina Mitsou,
|
||||
// University of Athens.
|
||||
|
||||
G4double G4VSolid::EstimateCubicVolume(G4int nStat, G4double epsilon) const
|
||||
{
|
||||
G4int iInside=0;
|
||||
G4double px,py,pz,minX,maxX,minY,maxY,minZ,maxZ,volume;
|
||||
G4bool yesno;
|
||||
G4ThreeVector p;
|
||||
EInside in;
|
||||
|
||||
// values needed for CalculateExtent signature
|
||||
|
||||
G4VoxelLimits limit; // Unlimited
|
||||
G4AffineTransform origin;
|
||||
|
||||
// min max extents of pSolid along X,Y,Z
|
||||
|
||||
yesno = this->CalculateExtent(kXAxis,limit,origin,minX,maxX);
|
||||
yesno = this->CalculateExtent(kYAxis,limit,origin,minY,maxY);
|
||||
yesno = this->CalculateExtent(kZAxis,limit,origin,minZ,maxZ);
|
||||
|
||||
// limits
|
||||
|
||||
if(nStat < 100) nStat = 100;
|
||||
if(epsilon > 0.01) epsilon = 0.01;
|
||||
|
||||
for(G4int i = 0; i < nStat; i++ )
|
||||
{
|
||||
px = minX+(maxX-minX)*G4UniformRand();
|
||||
py = minY+(maxY-minY)*G4UniformRand();
|
||||
pz = minZ+(maxZ-minZ)*G4UniformRand();
|
||||
p = G4ThreeVector(px,py,pz);
|
||||
in = this->Inside(p);
|
||||
if(in != kOutside) iInside++;
|
||||
}
|
||||
volume = (maxX-minX)*(maxY-minY)*(maxZ-minZ)*iInside/nStat;
|
||||
return volume;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Returns an estimation of the solid surface area in internal units.
|
||||
// The number of statistics and error accuracy is fixed.
|
||||
// This method may be overloaded by derived classes to compute the
|
||||
// exact geometrical quantity for solids where this is possible.
|
||||
// or anyway to cache the computed value.
|
||||
// This implementation does NOT cache the computed value.
|
||||
|
||||
G4double G4VSolid::GetSurfaceArea()
|
||||
{
|
||||
G4int stat = 1000000;
|
||||
G4double ell = -1.;
|
||||
return EstimateSurfaceArea(stat,ell);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Estimate surface area based on Inside(), DistanceToIn(), and
|
||||
// DistanceToOut() methods. Accuracy is limited by the statistics
|
||||
// defined by the first argument. Implemented by Mikhail Kosov.
|
||||
|
||||
G4double G4VSolid::EstimateSurfaceArea(G4int nStat, G4double ell) const
|
||||
{
|
||||
G4int inside=0;
|
||||
G4double px,py,pz,minX,maxX,minY,maxY,minZ,maxZ,surf;
|
||||
G4bool yesno;
|
||||
G4ThreeVector p;
|
||||
EInside in;
|
||||
|
||||
// values needed for CalculateExtent signature
|
||||
|
||||
G4VoxelLimits limit; // Unlimited
|
||||
G4AffineTransform origin;
|
||||
|
||||
// min max extents of pSolid along X,Y,Z
|
||||
|
||||
yesno = this->CalculateExtent(kXAxis,limit,origin,minX,maxX);
|
||||
yesno = this->CalculateExtent(kYAxis,limit,origin,minY,maxY);
|
||||
yesno = this->CalculateExtent(kZAxis,limit,origin,minZ,maxZ);
|
||||
|
||||
// limits
|
||||
|
||||
if(nStat < 100) { nStat = 100; }
|
||||
|
||||
G4double dX=maxX-minX;
|
||||
G4double dY=maxY-minY;
|
||||
G4double dZ=maxZ-minZ;
|
||||
if(ell<=0.) // Automatic definition of skin thickness
|
||||
{
|
||||
G4double minval=dX;
|
||||
if(dY<dX) { minval=dY; }
|
||||
if(dZ<minval) { minval=dZ; }
|
||||
ell=.01*minval;
|
||||
}
|
||||
|
||||
G4double dd=2*ell;
|
||||
minX-=ell; minY-=ell; minZ-=ell; dX+=dd; dY+=dd; dZ+=dd;
|
||||
|
||||
for(G4int i = 0; i < nStat; i++ )
|
||||
{
|
||||
px = minX+dX*G4UniformRand();
|
||||
py = minY+dY*G4UniformRand();
|
||||
pz = minZ+dZ*G4UniformRand();
|
||||
p = G4ThreeVector(px,py,pz);
|
||||
in = this->Inside(p);
|
||||
if(in != kOutside)
|
||||
{
|
||||
if (DistanceToOut(p)<ell) { inside++; }
|
||||
}
|
||||
else if(DistanceToIn(p)<ell) { inside++; }
|
||||
}
|
||||
// @@ The conformal correction can be upgraded
|
||||
surf = dX*dY*dZ*inside/dd/nStat;
|
||||
return surf;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Returns a pointer of a dynamically allocated copy of the solid.
|
||||
// Returns NULL pointer with warning in case the concrete solid does not
|
||||
// implement this method. The caller has responsibility for ownership.
|
||||
//
|
||||
|
||||
G4VSolid* G4VSolid::Clone() const
|
||||
{
|
||||
G4String ErrMessage = "Clone() method not implemented for type: "
|
||||
+ GetEntityType() + "! Returning NULL pointer!";
|
||||
G4Exception("G4VSolid::Clone()", "NotImplemented",
|
||||
JustWarning, ErrMessage);
|
||||
return 0;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Calculate the maximum and minimum extents of the polygon described
|
||||
@@ -446,18 +616,6 @@ G4VSolid::ClipPolygonToSimpleLimits( G4ThreeVectorList& pPolygon,
|
||||
}
|
||||
}
|
||||
|
||||
const G4VSolid* G4VSolid::GetConstituentSolid(G4int) const
|
||||
{ return 0; }
|
||||
|
||||
G4VSolid* G4VSolid::GetConstituentSolid(G4int)
|
||||
{ return 0; }
|
||||
|
||||
const G4DisplacedSolid* G4VSolid::GetDisplacedSolidPtr() const
|
||||
{ return 0; }
|
||||
|
||||
G4DisplacedSolid* G4VSolid::GetDisplacedSolidPtr()
|
||||
{ return 0; }
|
||||
|
||||
G4VisExtent G4VSolid::GetExtent () const
|
||||
{
|
||||
G4VisExtent extent;
|
||||
@@ -490,141 +648,3 @@ G4Polyhedron* G4VSolid::GetPolyhedron () const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Returns an estimation of the solid volume in internal units.
|
||||
// The number of statistics and error accuracy is fixed.
|
||||
// This method may be overloaded by derived classes to compute the
|
||||
// exact geometrical quantity for solids where this is possible.
|
||||
// or anyway to cache the computed value.
|
||||
// This implementation does NOT cache the computed value.
|
||||
|
||||
G4double G4VSolid::GetCubicVolume()
|
||||
{
|
||||
G4int cubVolStatistics = 1000000;
|
||||
G4double cubVolEpsilon = 0.001;
|
||||
return EstimateCubicVolume(cubVolStatistics, cubVolEpsilon);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Calculate cubic volume based on Inside() method.
|
||||
// Accuracy is limited by the second argument or the statistics
|
||||
// expressed by the first argument.
|
||||
// Implementation is courtesy of Vasiliki Despoina Mitsou,
|
||||
// University of Athens.
|
||||
|
||||
G4double G4VSolid::EstimateCubicVolume(G4int nStat, G4double epsilon) const
|
||||
{
|
||||
G4int iInside=0;
|
||||
G4double px,py,pz,minX,maxX,minY,maxY,minZ,maxZ,volume;
|
||||
G4bool yesno;
|
||||
G4ThreeVector p;
|
||||
EInside in;
|
||||
|
||||
// values needed for CalculateExtent signature
|
||||
|
||||
G4VoxelLimits limit; // Unlimited
|
||||
G4AffineTransform origin;
|
||||
|
||||
// min max extents of pSolid along X,Y,Z
|
||||
|
||||
yesno = this->CalculateExtent(kXAxis,limit,origin,minX,maxX);
|
||||
yesno = this->CalculateExtent(kYAxis,limit,origin,minY,maxY);
|
||||
yesno = this->CalculateExtent(kZAxis,limit,origin,minZ,maxZ);
|
||||
|
||||
// limits
|
||||
|
||||
if(nStat < 100) nStat = 100;
|
||||
if(epsilon > 0.01) epsilon = 0.01;
|
||||
|
||||
for(G4int i = 0; i < nStat; i++ )
|
||||
{
|
||||
px = minX+(maxX-minX)*G4UniformRand();
|
||||
py = minY+(maxY-minY)*G4UniformRand();
|
||||
pz = minZ+(maxZ-minZ)*G4UniformRand();
|
||||
p = G4ThreeVector(px,py,pz);
|
||||
in = this->Inside(p);
|
||||
if(in != kOutside) iInside++;
|
||||
}
|
||||
volume = (maxX-minX)*(maxY-minY)*(maxZ-minZ)*iInside/nStat;
|
||||
return volume;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Returns an estimation of the solid surface area in internal units.
|
||||
// The number of statistics and error accuracy is fixed.
|
||||
// This method may be overloaded by derived classes to compute the
|
||||
// exact geometrical quantity for solids where this is possible.
|
||||
// or anyway to cache the computed value.
|
||||
// This implementation does NOT cache the computed value.
|
||||
|
||||
G4double G4VSolid::GetSurfaceArea()
|
||||
{
|
||||
G4int stat = 1000000;
|
||||
G4double ell = -1.;
|
||||
return EstimateSurfaceArea(stat,ell);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Estimate surface area based on Inside(), DistanceToIn(), and
|
||||
// DistanceToOut() methods. Accuracy is limited by the statistics
|
||||
// defined by the first argument. Implemented by Mikhail Kosov.
|
||||
|
||||
G4double G4VSolid::EstimateSurfaceArea(G4int nStat, G4double ell) const
|
||||
{
|
||||
G4int inside=0;
|
||||
G4double px,py,pz,minX,maxX,minY,maxY,minZ,maxZ,surf;
|
||||
G4bool yesno;
|
||||
G4ThreeVector p;
|
||||
EInside in;
|
||||
|
||||
// values needed for CalculateExtent signature
|
||||
|
||||
G4VoxelLimits limit; // Unlimited
|
||||
G4AffineTransform origin;
|
||||
|
||||
// min max extents of pSolid along X,Y,Z
|
||||
|
||||
yesno = this->CalculateExtent(kXAxis,limit,origin,minX,maxX);
|
||||
yesno = this->CalculateExtent(kYAxis,limit,origin,minY,maxY);
|
||||
yesno = this->CalculateExtent(kZAxis,limit,origin,minZ,maxZ);
|
||||
|
||||
// limits
|
||||
|
||||
if(nStat < 100) { nStat = 100; }
|
||||
|
||||
G4double dX=maxX-minX;
|
||||
G4double dY=maxY-minY;
|
||||
G4double dZ=maxZ-minZ;
|
||||
if(ell<=0.) // Automatic definition of skin thickness
|
||||
{
|
||||
G4double minval=dX;
|
||||
if(dY<dX) { minval=dY; }
|
||||
if(dZ<minval) { minval=dZ; }
|
||||
ell=.01*minval;
|
||||
}
|
||||
|
||||
G4double dd=2*ell;
|
||||
minX-=ell; minY-=ell; minZ-=ell; dX+=dd; dY+=dd; dZ+=dd;
|
||||
|
||||
for(G4int i = 0; i < nStat; i++ )
|
||||
{
|
||||
px = minX+dX*G4UniformRand();
|
||||
py = minY+dY*G4UniformRand();
|
||||
pz = minZ+dZ*G4UniformRand();
|
||||
p = G4ThreeVector(px,py,pz);
|
||||
in = this->Inside(p);
|
||||
if(in != kOutside)
|
||||
{
|
||||
if (DistanceToOut(p)<ell) { inside++; }
|
||||
}
|
||||
else if(DistanceToIn(p)<ell) { inside++; }
|
||||
}
|
||||
// @@ The conformal correction can be upgraded
|
||||
surf = dX*dY*dZ*inside/dd/nStat;
|
||||
return surf;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user