Import Geant4 10.1.0 source tree
This commit is contained in:
@@ -23,7 +23,7 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4Ellipsoid.cc 73430 2013-08-27 11:04:49Z gcosmo $
|
||||
// $Id: G4Ellipsoid.cc 83572 2014-09-01 15:23:27Z gcosmo $
|
||||
//
|
||||
// class G4Ellipsoid
|
||||
//
|
||||
@@ -50,9 +50,15 @@
|
||||
#include "G4VPVParameterisation.hh"
|
||||
|
||||
#include "G4VGraphicsScene.hh"
|
||||
#include "G4Polyhedron.hh"
|
||||
#include "G4VisExtent.hh"
|
||||
|
||||
#include "G4AutoLock.hh"
|
||||
|
||||
namespace
|
||||
{
|
||||
G4Mutex polyhedronMutex = G4MUTEX_INITIALIZER;
|
||||
}
|
||||
|
||||
using namespace CLHEP;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
@@ -66,8 +72,8 @@ G4Ellipsoid::G4Ellipsoid(const G4String& pName,
|
||||
G4double pzSemiAxis,
|
||||
G4double pzBottomCut,
|
||||
G4double pzTopCut)
|
||||
: G4VSolid(pName), fpPolyhedron(0), fCubicVolume(0.), fSurfaceArea(0.),
|
||||
zBottomCut(0.), zTopCut(0.)
|
||||
: G4VSolid(pName), fRebuildPolyhedron(false), fpPolyhedron(0),
|
||||
fCubicVolume(0.), fSurfaceArea(0.), zBottomCut(0.), zTopCut(0.)
|
||||
{
|
||||
// note: for users that want to use the full ellipsoid it is useful
|
||||
// to include a default for the cuts
|
||||
@@ -111,7 +117,7 @@ G4Ellipsoid::G4Ellipsoid(const G4String& pName,
|
||||
// for usage restricted to object persistency.
|
||||
//
|
||||
G4Ellipsoid::G4Ellipsoid( __void__& a )
|
||||
: G4VSolid(a), fpPolyhedron(0), kRadTolerance(0.),
|
||||
: G4VSolid(a), fRebuildPolyhedron(false), fpPolyhedron(0), kRadTolerance(0.),
|
||||
halfCarTolerance(0.), halfRadTolerance(0.), fCubicVolume(0.),
|
||||
fSurfaceArea(0.), xSemiAxis(0.), ySemiAxis(0.), zSemiAxis(0.),
|
||||
semiAxisMax(0.), zBottomCut(0.), zTopCut(0.)
|
||||
@@ -124,6 +130,7 @@ G4Ellipsoid::G4Ellipsoid( __void__& a )
|
||||
|
||||
G4Ellipsoid::~G4Ellipsoid()
|
||||
{
|
||||
delete fpPolyhedron; fpPolyhedron = 0;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
@@ -132,7 +139,8 @@ G4Ellipsoid::~G4Ellipsoid()
|
||||
|
||||
G4Ellipsoid::G4Ellipsoid(const G4Ellipsoid& rhs)
|
||||
: G4VSolid(rhs),
|
||||
fpPolyhedron(0), kRadTolerance(rhs.kRadTolerance),
|
||||
fRebuildPolyhedron(false), fpPolyhedron(0),
|
||||
kRadTolerance(rhs.kRadTolerance),
|
||||
halfCarTolerance(rhs.halfCarTolerance),
|
||||
halfRadTolerance(rhs.halfRadTolerance),
|
||||
fCubicVolume(rhs.fCubicVolume), fSurfaceArea(rhs.fSurfaceArea),
|
||||
@@ -158,13 +166,15 @@ G4Ellipsoid& G4Ellipsoid::operator = (const G4Ellipsoid& rhs)
|
||||
|
||||
// Copy data
|
||||
//
|
||||
fpPolyhedron = 0; kRadTolerance = rhs.kRadTolerance;
|
||||
kRadTolerance = rhs.kRadTolerance;
|
||||
halfCarTolerance = rhs.halfCarTolerance;
|
||||
halfRadTolerance = rhs.halfRadTolerance;
|
||||
fCubicVolume = rhs.fCubicVolume; fSurfaceArea = rhs.fSurfaceArea;
|
||||
xSemiAxis = rhs.xSemiAxis; ySemiAxis = rhs.ySemiAxis;
|
||||
zSemiAxis = rhs.zSemiAxis; semiAxisMax = rhs.semiAxisMax;
|
||||
zBottomCut = rhs.zBottomCut; zTopCut = rhs.zTopCut;
|
||||
fRebuildPolyhedron = false;
|
||||
delete fpPolyhedron; fpPolyhedron = 0;
|
||||
|
||||
return *this;
|
||||
}
|
||||
@@ -1083,11 +1093,15 @@ G4Polyhedron* G4Ellipsoid::CreatePolyhedron () const
|
||||
G4Polyhedron* G4Ellipsoid::GetPolyhedron () const
|
||||
{
|
||||
if (!fpPolyhedron ||
|
||||
fRebuildPolyhedron ||
|
||||
fpPolyhedron->GetNumberOfRotationStepsAtTimeOfCreation() !=
|
||||
fpPolyhedron->GetNumberOfRotationSteps())
|
||||
{
|
||||
G4AutoLock l(&polyhedronMutex);
|
||||
delete fpPolyhedron;
|
||||
fpPolyhedron = CreatePolyhedron();
|
||||
fRebuildPolyhedron = false;
|
||||
l.unlock();
|
||||
}
|
||||
return fpPolyhedron;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user