Import Geant4 10.1.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-10 12:08:39 +02:00
parent 286caacf06
commit c9b32a6c0a
5770 changed files with 1050949 additions and 367105 deletions
@@ -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;
}
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4EllipticalCone.cc 72937 2013-08-14 13:20:38Z gcosmo $
// $Id: G4EllipticalCone.cc 83572 2014-09-01 15:23:27Z gcosmo $
//
// Implementation of G4EllipticalCone class
//
@@ -52,10 +52,14 @@
#include "Randomize.hh"
#include "G4VGraphicsScene.hh"
#include "G4Polyhedron.hh"
#include "G4VisExtent.hh"
//#define G4SPECSDEBUG 1
#include "G4AutoLock.hh"
namespace
{
G4Mutex polyhedronMutex = G4MUTEX_INITIALIZER;
}
using namespace CLHEP;
@@ -68,8 +72,8 @@ G4EllipticalCone::G4EllipticalCone(const G4String& pName,
G4double pySemiAxis,
G4double pzMax,
G4double pzTopCut)
: G4VSolid(pName), fpPolyhedron(0), fCubicVolume(0.), fSurfaceArea(0.),
zTopCut(0.)
: G4VSolid(pName), fRebuildPolyhedron(false), fpPolyhedron(0),
fCubicVolume(0.), fSurfaceArea(0.), zTopCut(0.)
{
kRadTolerance = G4GeometryTolerance::GetInstance()->GetRadialTolerance();
@@ -104,8 +108,8 @@ G4EllipticalCone::G4EllipticalCone(const G4String& pName,
// for usage restricted to object persistency.
//
G4EllipticalCone::G4EllipticalCone( __void__& a )
: G4VSolid(a), fpPolyhedron(0), kRadTolerance(0.),
halfRadTol(0.), halfCarTol(0.), fCubicVolume(0.),
: G4VSolid(a), fRebuildPolyhedron(false), fpPolyhedron(0),
kRadTolerance(0.), halfRadTol(0.), halfCarTol(0.), fCubicVolume(0.),
fSurfaceArea(0.), xSemiAxis(0.), ySemiAxis(0.), zheight(0.),
semiAxisMax(0.), zTopCut(0.)
{
@@ -117,6 +121,7 @@ G4EllipticalCone::G4EllipticalCone( __void__& a )
//
G4EllipticalCone::~G4EllipticalCone()
{
delete fpPolyhedron; fpPolyhedron = 0;
}
///////////////////////////////////////////////////////////////////////////////
@@ -125,7 +130,8 @@ G4EllipticalCone::~G4EllipticalCone()
//
G4EllipticalCone::G4EllipticalCone(const G4EllipticalCone& rhs)
: G4VSolid(rhs),
fpPolyhedron(0), kRadTolerance(rhs.kRadTolerance),
fRebuildPolyhedron(false), fpPolyhedron(0),
kRadTolerance(rhs.kRadTolerance),
halfRadTol(rhs.halfRadTol), halfCarTol(rhs.halfCarTol),
fCubicVolume(rhs.fCubicVolume), fSurfaceArea(rhs.fSurfaceArea),
xSemiAxis(rhs.xSemiAxis), ySemiAxis(rhs.ySemiAxis), zheight(rhs.zheight),
@@ -149,11 +155,13 @@ G4EllipticalCone& G4EllipticalCone::operator = (const G4EllipticalCone& rhs)
// Copy data
//
fpPolyhedron = 0; kRadTolerance = rhs.kRadTolerance;
kRadTolerance = rhs.kRadTolerance;
halfRadTol = rhs.halfRadTol; halfCarTol = rhs.halfCarTol;
fCubicVolume = rhs.fCubicVolume; fSurfaceArea = rhs.fSurfaceArea;
xSemiAxis = rhs.xSemiAxis; ySemiAxis = rhs.ySemiAxis;
zheight = rhs.zheight; semiAxisMax = rhs.semiAxisMax; zTopCut = rhs.zTopCut;
fRebuildPolyhedron = false;
delete fpPolyhedron; fpPolyhedron = 0;
return *this;
}
@@ -1074,11 +1082,15 @@ G4Polyhedron* G4EllipticalCone::CreatePolyhedron () const
G4Polyhedron* G4EllipticalCone::GetPolyhedron () const
{
if ( (!fpPolyhedron)
|| fRebuildPolyhedron
|| (fpPolyhedron->GetNumberOfRotationStepsAtTimeOfCreation() !=
fpPolyhedron->GetNumberOfRotationSteps()) )
{
G4AutoLock l(&polyhedronMutex);
delete fpPolyhedron;
fpPolyhedron = CreatePolyhedron();
fRebuildPolyhedron = false;
l.unlock();
}
return fpPolyhedron;
}
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4EllipticalTube.cc 72937 2013-08-14 13:20:38Z gcosmo $
// $Id: G4EllipticalTube.cc 83572 2014-09-01 15:23:27Z gcosmo $
//
//
// --------------------------------------------------------------------
@@ -49,9 +49,15 @@
#include "Randomize.hh"
#include "G4VGraphicsScene.hh"
#include "G4Polyhedron.hh"
#include "G4VisExtent.hh"
#include "G4AutoLock.hh"
namespace
{
G4Mutex polyhedronMutex = G4MUTEX_INITIALIZER;
}
using namespace CLHEP;
//
@@ -61,7 +67,8 @@ G4EllipticalTube::G4EllipticalTube( const G4String &name,
G4double theDx,
G4double theDy,
G4double theDz )
: G4VSolid( name ), fCubicVolume(0.), fSurfaceArea(0.), fpPolyhedron(0)
: G4VSolid( name ), fCubicVolume(0.), fSurfaceArea(0.),
fRebuildPolyhedron(false), fpPolyhedron(0)
{
halfTol = 0.5*kCarTolerance;
@@ -77,7 +84,8 @@ G4EllipticalTube::G4EllipticalTube( const G4String &name,
//
G4EllipticalTube::G4EllipticalTube( __void__& a )
: G4VSolid(a), dx(0.), dy(0.), dz(0.), halfTol(0.),
fCubicVolume(0.), fSurfaceArea(0.), fpPolyhedron(0)
fCubicVolume(0.), fSurfaceArea(0.),
fRebuildPolyhedron(false), fpPolyhedron(0)
{
}
@@ -87,7 +95,7 @@ G4EllipticalTube::G4EllipticalTube( __void__& a )
//
G4EllipticalTube::~G4EllipticalTube()
{
delete fpPolyhedron;
delete fpPolyhedron; fpPolyhedron = 0;
}
@@ -97,7 +105,7 @@ G4EllipticalTube::~G4EllipticalTube()
G4EllipticalTube::G4EllipticalTube(const G4EllipticalTube& rhs)
: G4VSolid(rhs), dx(rhs.dx), dy(rhs.dy), dz(rhs.dz), halfTol(rhs.halfTol),
fCubicVolume(rhs.fCubicVolume), fSurfaceArea(rhs.fSurfaceArea),
fpPolyhedron(0)
fRebuildPolyhedron(false), fpPolyhedron(0)
{
}
@@ -120,7 +128,8 @@ G4EllipticalTube& G4EllipticalTube::operator = (const G4EllipticalTube& rhs)
dx = rhs.dx; dy = rhs.dy; dz = rhs.dz;
halfTol = rhs.halfTol;
fCubicVolume = rhs.fCubicVolume; fSurfaceArea = rhs.fSurfaceArea;
fpPolyhedron = 0;
fRebuildPolyhedron = false;
delete fpPolyhedron; fpPolyhedron = 0;
return *this;
}
@@ -969,11 +978,15 @@ G4Polyhedron* G4EllipticalTube::CreatePolyhedron() const
G4Polyhedron* G4EllipticalTube::GetPolyhedron () const
{
if (!fpPolyhedron ||
fRebuildPolyhedron ||
fpPolyhedron->GetNumberOfRotationStepsAtTimeOfCreation() !=
fpPolyhedron->GetNumberOfRotationSteps())
{
G4AutoLock l(&polyhedronMutex);
delete fpPolyhedron;
fpPolyhedron = CreatePolyhedron();
fRebuildPolyhedron = false;
l.unlock();
}
return fpPolyhedron;
}
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4ExtrudedSolid.cc 69584 2013-05-08 14:12:37Z gcosmo $
// $Id: G4ExtrudedSolid.cc 83851 2014-09-19 10:12:12Z gcosmo $
//
//
// --------------------------------------------------------------------
@@ -35,12 +35,15 @@
// Author: Ivana Hrivnacova, IPN Orsay
// --------------------------------------------------------------------
#include "G4ExtrudedSolid.hh"
#if !defined(G4GEOM_USE_UEXTRUDEDSOLID)
#include <set>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include "G4ExtrudedSolid.hh"
#include "G4PhysicalConstants.hh"
#include "G4SystemOfUnits.hh"
#include "G4VFacet.hh"
@@ -906,3 +909,5 @@ std::ostream& G4ExtrudedSolid::StreamInfo(std::ostream &os) const
return os;
}
#endif
@@ -279,7 +279,7 @@ G4GenericPolycone::G4GenericPolycone( const G4GenericPolycone &source )
//
// Assignment operator
//
const G4GenericPolycone &G4GenericPolycone::operator=( const G4GenericPolycone &source )
G4GenericPolycone &G4GenericPolycone::operator=( const G4GenericPolycone &source )
{
if (this == &source) return *this;
@@ -325,6 +325,9 @@ void G4GenericPolycone::CopyStuff( const G4GenericPolycone &source )
// Enclosing cylinder
//
enclosingCylinder = new G4EnclosingCylinder( *source.enclosingCylinder );
fRebuildPolyhedron = false;
fpPolyhedron = 0;
}
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4GenericTrap.cc 72937 2013-08-14 13:20:38Z gcosmo $
// $Id: G4GenericTrap.cc 83851 2014-09-19 10:12:12Z gcosmo $
//
//
// --------------------------------------------------------------------
@@ -41,9 +41,12 @@
// to CreatePolyhedron() for Visualisation of Boolean
// --------------------------------------------------------------------
#include "G4GenericTrap.hh"
#if !defined(G4GEOM_USE_UGENERICTRAP)
#include <iomanip>
#include "G4GenericTrap.hh"
#include "G4PhysicalConstants.hh"
#include "G4SystemOfUnits.hh"
#include "G4TessellatedSolid.hh"
@@ -58,6 +61,13 @@
#include "G4PolyhedronArbitrary.hh"
#include "G4VisExtent.hh"
#include "G4AutoLock.hh"
namespace
{
G4Mutex polyhedronMutex = G4MUTEX_INITIALIZER;
}
const G4int G4GenericTrap::fgkNofVertices = 8;
const G4double G4GenericTrap::fgkTolerance = 1E-3;
@@ -66,6 +76,7 @@ const G4double G4GenericTrap::fgkTolerance = 1E-3;
G4GenericTrap::G4GenericTrap( const G4String& name, G4double halfZ,
const std::vector<G4TwoVector>& vertices )
: G4VSolid(name),
fRebuildPolyhedron(false),
fpPolyhedron(0),
fDz(halfZ),
fVertices(),
@@ -158,6 +169,7 @@ G4GenericTrap::G4GenericTrap( const G4String& name, G4double halfZ,
G4GenericTrap::G4GenericTrap( __void__& a )
: G4VSolid(a),
fRebuildPolyhedron(false),
fpPolyhedron(0),
halfCarTolerance(0.),
fDz(0.),
@@ -172,8 +184,6 @@ G4GenericTrap::G4GenericTrap( __void__& a )
{
// Fake default constructor - sets only member data and allocates memory
// for usage restricted to object persistency.
for (size_t i=0; i<4; ++i) { fTwist[i]=0.; }
}
// --------------------------------------------------------------------
@@ -188,7 +198,8 @@ G4GenericTrap::~G4GenericTrap()
G4GenericTrap::G4GenericTrap(const G4GenericTrap& rhs)
: G4VSolid(rhs),
fpPolyhedron(0), halfCarTolerance(rhs.halfCarTolerance),
fRebuildPolyhedron(false), fpPolyhedron(0),
halfCarTolerance(rhs.halfCarTolerance),
fDz(rhs.fDz), fVertices(rhs.fVertices),
fIsTwisted(rhs.fIsTwisted), fTessellatedSolid(0),
fMinBBoxVector(rhs.fMinBBoxVector), fMaxBBoxVector(rhs.fMaxBBoxVector),
@@ -216,7 +227,7 @@ G4GenericTrap& G4GenericTrap::operator = (const G4GenericTrap& rhs)
// Copy data
//
fpPolyhedron = 0; halfCarTolerance = rhs.halfCarTolerance;
halfCarTolerance = rhs.halfCarTolerance;
fDz = rhs.fDz; fVertices = rhs.fVertices;
fIsTwisted = rhs.fIsTwisted; fTessellatedSolid = 0;
fMinBBoxVector = rhs.fMinBBoxVector; fMaxBBoxVector = rhs.fMaxBBoxVector;
@@ -228,6 +239,8 @@ G4GenericTrap& G4GenericTrap::operator = (const G4GenericTrap& rhs)
if (rhs.fTessellatedSolid && !fIsTwisted )
{ delete fTessellatedSolid; fTessellatedSolid = CreateTessellatedSolid(); }
#endif
fRebuildPolyhedron = false;
delete fpPolyhedron; fpPolyhedron = 0;
return *this;
}
@@ -255,14 +268,47 @@ G4GenericTrap::InsidePolygone(const G4ThreeVector& p,
if(cross*cross<=len2*halfCarTolerance*halfCarTolerance) // Surface check
{
G4double test;
G4int k,l;
if ( poly[i].y() > poly[j].y() ) { k=i; l=j; }
else { k=j; l=i; }
if ( poly[k].x() != poly[l].x() )
// Check if p lies between the two extremes of the segment
//
G4int iMax;
G4int iMin;
if (poly[j].x() > poly[i].x())
{
test = (p.x()-poly[l].x())/(poly[k].x()-poly[l].x())
* (poly[k].y()-poly[l].y())+poly[l].y();
iMax = j;
iMin = i;
}
else {
iMax = i;
iMin = j;
}
if ( p.x() > poly[iMax].x()+halfCarTolerance
|| p.x() < poly[iMin].x()-halfCarTolerance )
{
return kOutside;
}
if (poly[j].y() > poly[i].y())
{
iMax = j;
iMin = i;
}
else
{
iMax = i;
iMin = j;
}
if ( p.y() > poly[iMax].y()+halfCarTolerance
|| p.y() < poly[iMin].y()-halfCarTolerance )
{
return kOutside;
}
if ( poly[iMax].x() != poly[iMin].x() )
{
test = (p.x()-poly[iMin].x())/(poly[iMax].x()-poly[iMin].x())
* (poly[iMax].y()-poly[iMin].y())+poly[iMin].y();
}
else
{
@@ -271,8 +317,8 @@ G4GenericTrap::InsidePolygone(const G4ThreeVector& p,
// Check if point is Inside Segment
//
if( (test>=(poly[l].y()-halfCarTolerance))
&& (test<=(poly[k].y()+halfCarTolerance)) )
if( (test>=(poly[iMin].y()-halfCarTolerance))
&& (test<=(poly[iMax].y()+halfCarTolerance)) )
{
return kSurface;
}
@@ -2063,11 +2109,15 @@ G4Polyhedron* G4GenericTrap::GetPolyhedron () const
#endif
if ( (!fpPolyhedron)
|| fRebuildPolyhedron
|| (fpPolyhedron->GetNumberOfRotationStepsAtTimeOfCreation() !=
fpPolyhedron->GetNumberOfRotationSteps()) )
{
G4AutoLock l(&polyhedronMutex);
delete fpPolyhedron;
fpPolyhedron = CreatePolyhedron();
fRebuildPolyhedron = false;
l.unlock();
}
return fpPolyhedron;
}
@@ -2206,3 +2256,5 @@ G4Polyhedron* G4GenericTrap::CreatePolyhedron() const
}
// --------------------------------------------------------------------
#endif
+21 -7
View File
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4Hype.cc 72937 2013-08-14 13:20:38Z gcosmo $
// $Id: G4Hype.cc 83572 2014-09-01 15:23:27Z gcosmo $
// $Original: G4Hype.cc,v 1.0 1998/06/09 16:57:50 safai Exp $
//
//
@@ -59,9 +59,15 @@
#include "Randomize.hh"
#include "G4VGraphicsScene.hh"
#include "G4Polyhedron.hh"
#include "G4VisExtent.hh"
#include "G4AutoLock.hh"
namespace
{
G4Mutex polyhedronMutex = G4MUTEX_INITIALIZER;
}
using namespace CLHEP;
// Constructor - check parameters, and fills protected data members
@@ -71,7 +77,8 @@ G4Hype::G4Hype(const G4String& pName,
G4double newInnerStereo,
G4double newOuterStereo,
G4double newHalfLenZ)
: G4VSolid(pName), fCubicVolume(0.), fSurfaceArea(0.), fpPolyhedron(0)
: G4VSolid(pName), fCubicVolume(0.), fSurfaceArea(0.),
fRebuildPolyhedron(false), fpPolyhedron(0)
{
fHalfTol = 0.5*kCarTolerance;
@@ -133,7 +140,8 @@ G4Hype::G4Hype( __void__& a )
outerStereo(0.), tanInnerStereo(0.), tanOuterStereo(0.), tanInnerStereo2(0.),
tanOuterStereo2(0.), innerRadius2(0.), outerRadius2(0.), endInnerRadius2(0.),
endOuterRadius2(0.), endInnerRadius(0.), endOuterRadius(0.),
fCubicVolume(0.), fSurfaceArea(0.), fHalfTol(0.), fpPolyhedron(0)
fCubicVolume(0.), fSurfaceArea(0.), fHalfTol(0.),
fRebuildPolyhedron(false), fpPolyhedron(0)
{
}
@@ -143,7 +151,7 @@ G4Hype::G4Hype( __void__& a )
//
G4Hype::~G4Hype()
{
delete fpPolyhedron;
delete fpPolyhedron; fpPolyhedron = 0;
}
@@ -160,7 +168,7 @@ G4Hype::G4Hype(const G4Hype& rhs)
endInnerRadius2(rhs.endInnerRadius2), endOuterRadius2(rhs.endOuterRadius2),
endInnerRadius(rhs.endInnerRadius), endOuterRadius(rhs.endOuterRadius),
fCubicVolume(rhs.fCubicVolume), fSurfaceArea(rhs.fSurfaceArea),
fHalfTol(rhs.fHalfTol), fpPolyhedron(0)
fHalfTol(rhs.fHalfTol), fRebuildPolyhedron(false), fpPolyhedron(0)
{
}
@@ -189,7 +197,9 @@ G4Hype& G4Hype::operator = (const G4Hype& rhs)
endInnerRadius2 = rhs.endInnerRadius2; endOuterRadius2 = rhs.endOuterRadius2;
endInnerRadius = rhs.endInnerRadius; endOuterRadius = rhs.endOuterRadius;
fCubicVolume = rhs.fCubicVolume; fSurfaceArea = rhs.fSurfaceArea;
fHalfTol = rhs.fHalfTol; fpPolyhedron = 0;
fHalfTol = rhs.fHalfTol;
fRebuildPolyhedron = false;
delete fpPolyhedron; fpPolyhedron = 0;
return *this;
}
@@ -1551,11 +1561,15 @@ G4Polyhedron* G4Hype::CreatePolyhedron() const
G4Polyhedron* G4Hype::GetPolyhedron () const
{
if (!fpPolyhedron ||
fRebuildPolyhedron ||
fpPolyhedron->GetNumberOfRotationStepsAtTimeOfCreation() !=
fpPolyhedron->GetNumberOfRotationSteps())
{
G4AutoLock l(&polyhedronMutex);
delete fpPolyhedron;
fpPolyhedron = CreatePolyhedron();
fRebuildPolyhedron = false;
l.unlock();
}
return fpPolyhedron;
}
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4Paraboloid.cc 66356 2012-12-18 09:02:32Z gcosmo $
// $Id: G4Paraboloid.cc 83572 2014-09-01 15:23:27Z gcosmo $
//
// class G4Paraboloid
//
@@ -45,9 +45,15 @@
#include "Randomize.hh"
#include "G4VGraphicsScene.hh"
#include "G4Polyhedron.hh"
#include "G4VisExtent.hh"
#include "G4AutoLock.hh"
namespace
{
G4Mutex polyhedronMutex = G4MUTEX_INITIALIZER;
}
using namespace CLHEP;
///////////////////////////////////////////////////////////////////////////////
@@ -58,7 +64,8 @@ G4Paraboloid::G4Paraboloid(const G4String& pName,
G4double pDz,
G4double pR1,
G4double pR2)
: G4VSolid(pName), fpPolyhedron(0), fSurfaceArea(0.), fCubicVolume(0.)
: G4VSolid(pName), fRebuildPolyhedron(false), fpPolyhedron(0),
fSurfaceArea(0.), fCubicVolume(0.)
{
if( (pDz <= 0.) || (pR2 <= pR1) || (pR1 < 0.) )
@@ -90,7 +97,8 @@ G4Paraboloid::G4Paraboloid(const G4String& pName,
// for usage restricted to object persistency.
//
G4Paraboloid::G4Paraboloid( __void__& a )
: G4VSolid(a), fpPolyhedron(0), fSurfaceArea(0.), fCubicVolume(0.),
: G4VSolid(a), fRebuildPolyhedron(false), fpPolyhedron(0),
fSurfaceArea(0.), fCubicVolume(0.),
dz(0.), r1(0.), r2(0.), k1(0.), k2(0.)
{
}
@@ -101,6 +109,7 @@ G4Paraboloid::G4Paraboloid( __void__& a )
G4Paraboloid::~G4Paraboloid()
{
delete fpPolyhedron; fpPolyhedron = 0;
}
///////////////////////////////////////////////////////////////////////////////
@@ -108,7 +117,7 @@ G4Paraboloid::~G4Paraboloid()
// Copy constructor
G4Paraboloid::G4Paraboloid(const G4Paraboloid& rhs)
: G4VSolid(rhs), fpPolyhedron(0),
: G4VSolid(rhs), fRebuildPolyhedron(false), fpPolyhedron(0),
fSurfaceArea(rhs.fSurfaceArea), fCubicVolume(rhs.fCubicVolume),
dz(rhs.dz), r1(rhs.r1), r2(rhs.r2), k1(rhs.k1), k2(rhs.k2)
{
@@ -131,9 +140,10 @@ G4Paraboloid& G4Paraboloid::operator = (const G4Paraboloid& rhs)
// Copy data
//
fpPolyhedron = 0;
fSurfaceArea = rhs.fSurfaceArea; fCubicVolume = rhs.fCubicVolume;
dz = rhs.dz; r1 = rhs.r1; r2 = rhs.r2; k1 = rhs.k1; k2 = rhs.k2;
fRebuildPolyhedron = false;
delete fpPolyhedron; fpPolyhedron = 0;
return *this;
}
@@ -1153,11 +1163,15 @@ G4Polyhedron* G4Paraboloid::CreatePolyhedron () const
G4Polyhedron* G4Paraboloid::GetPolyhedron () const
{
if (!fpPolyhedron ||
fRebuildPolyhedron ||
fpPolyhedron->GetNumberOfRotationStepsAtTimeOfCreation() !=
fpPolyhedron->GetNumberOfRotationSteps())
{
G4AutoLock l(&polyhedronMutex);
delete fpPolyhedron;
fpPolyhedron = CreatePolyhedron();
fRebuildPolyhedron = false;
l.unlock();
}
return fpPolyhedron;
}
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4Polycone.cc 76263 2013-11-08 11:41:52Z gcosmo $
// $Id: G4Polycone.cc 83572 2014-09-01 15:23:27Z gcosmo $
//
//
// --------------------------------------------------------------------
@@ -46,7 +46,6 @@
#include "Randomize.hh"
#include "G4Polyhedron.hh"
#include "G4EnclosingCylinder.hh"
#include "G4ReduciblePolygon.hh"
#include "G4VPVParameterisation.hh"
@@ -373,7 +372,7 @@ G4Polycone::G4Polycone( const G4Polycone &source )
//
// Assignment operator
//
const G4Polycone &G4Polycone::operator=( const G4Polycone &source )
G4Polycone &G4Polycone::operator=( const G4Polycone &source )
{
if (this == &source) return *this;
@@ -428,6 +427,9 @@ void G4Polycone::CopyStuff( const G4Polycone &source )
// Enclosing cylinder
//
enclosingCylinder = new G4EnclosingCylinder( *source.enclosingCylinder );
fRebuildPolyhedron = false;
fpPolyhedron = 0;
}
@@ -1085,12 +1087,13 @@ G4bool G4Polycone::SetOriginalParameters(G4ReduciblePolygon *rz)
}
else // Set parameters(r,z) with Rmin==0 as convention
{
#ifdef G4SPECSDEBUG
std::ostringstream message;
message << "Polycone " << GetName() << G4endl
<< "cannot be converted to Polycone with (Rmin,Rmaz,Z) parameters!";
G4Exception("G4Polycone::SetOriginalParameters()", "GeomSolids0002",
JustWarning, message);
#endif
original_parameters = new G4PolyconeHistorical;
original_parameters->Z_values = new G4double[numPlanes];
original_parameters->Rmin = new G4double[numPlanes];
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4Polyhedra.cc 78188 2013-12-04 16:32:00Z gcosmo $
// $Id: G4Polyhedra.cc 83572 2014-09-01 15:23:27Z gcosmo $
//
//
// --------------------------------------------------------------------
@@ -63,7 +63,6 @@
#include "Randomize.hh"
#include "G4Polyhedron.hh"
#include "G4EnclosingCylinder.hh"
#include "G4ReduciblePolygon.hh"
#include "G4VPVParameterisation.hh"
@@ -172,6 +171,15 @@ G4Polyhedra::G4Polyhedra( const G4String& name,
const G4double z[] )
: G4VCSGfaceted( name ), genericPgon(true)
{
if (theNumSide <= 0)
{
std::ostringstream message;
message << "Solid must have at least one side - " << GetName() << G4endl
<< " No sides specified !";
G4Exception("G4Polyhedra::G4Polyhedra()", "GeomSolids0002",
FatalErrorInArgument, message);
}
G4ReduciblePolygon *rz = new G4ReduciblePolygon( r, z, numRZ );
Create( phiStart, phiTotal, theNumSide, rz );
@@ -398,7 +406,7 @@ G4Polyhedra::G4Polyhedra( const G4Polyhedra &source )
//
// Assignment operator
//
const G4Polyhedra &G4Polyhedra::operator=( const G4Polyhedra &source )
G4Polyhedra &G4Polyhedra::operator=( const G4Polyhedra &source )
{
if (this == &source) return *this;
@@ -455,6 +463,9 @@ void G4Polyhedra::CopyStuff( const G4Polyhedra &source )
// Enclosing cylinder
//
enclosingCylinder = new G4EnclosingCylinder( *source.enclosingCylinder );
fRebuildPolyhedron = false;
fpPolyhedron = 0;
}
File diff suppressed because it is too large Load Diff
@@ -24,7 +24,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4TessellatedSolid.cc 72937 2013-08-14 13:20:38Z gcosmo $
// $Id: G4TessellatedSolid.cc 83572 2014-09-01 15:23:27Z gcosmo $
//
// %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
//
@@ -92,6 +92,13 @@
#include "G4VGraphicsScene.hh"
#include "G4VisExtent.hh"
#include "G4AutoLock.hh"
namespace
{
G4Mutex polyhedronMutex = G4MUTEX_INITIALIZER;
}
using namespace std;
///////////////////////////////////////////////////////////////////////////////
@@ -172,7 +179,8 @@ void G4TessellatedSolid::Initialize()
{
kCarToleranceHalf = 0.5*kCarTolerance;
fpPolyhedron = 0; fCubicVolume = 0.; fSurfaceArea = 0.;
fRebuildPolyhedron = false; fpPolyhedron = 0;
fCubicVolume = 0.; fSurfaceArea = 0.;
fGeometryType = "G4TessellatedSolid";
fSolidClosed = false;
@@ -190,6 +198,7 @@ void G4TessellatedSolid::DeleteObjects ()
G4int size = fFacets.size();
for (G4int i = 0; i < size; ++i) { delete fFacets[i]; }
fFacets.clear();
delete fpPolyhedron; fpPolyhedron = 0;
}
///////////////////////////////////////////////////////////////////////////////
@@ -1763,11 +1772,15 @@ G4Polyhedron *G4TessellatedSolid::CreatePolyhedron () const
G4Polyhedron* G4TessellatedSolid::GetPolyhedron () const
{
if (!fpPolyhedron ||
fpPolyhedron->GetNumberOfRotationStepsAtTimeOfCreation() !=
fpPolyhedron->GetNumberOfRotationSteps())
fRebuildPolyhedron ||
fpPolyhedron->GetNumberOfRotationStepsAtTimeOfCreation() !=
fpPolyhedron->GetNumberOfRotationSteps())
{
G4AutoLock l(&polyhedronMutex);
delete fpPolyhedron;
fpPolyhedron = CreatePolyhedron();
fRebuildPolyhedron = false;
l.unlock();
}
return fpPolyhedron;
}
+21 -7
View File
@@ -27,7 +27,7 @@
// * *
// ********************************************************************
//
// $Id: G4Tet.cc 76263 2013-11-08 11:41:52Z gcosmo $
// $Id: G4Tet.cc 83572 2014-09-01 15:23:27Z gcosmo $
//
// class G4Tet
//
@@ -58,7 +58,7 @@
#if !defined(G4GEOM_USE_UTET)
const char G4Tet::CVSVers[]="$Id: G4Tet.cc 76263 2013-11-08 11:41:52Z gcosmo $";
const char G4Tet::CVSVers[]="$Id: G4Tet.cc 83572 2014-09-01 15:23:27Z gcosmo $";
#include "G4VoxelLimits.hh"
#include "G4AffineTransform.hh"
@@ -75,6 +75,13 @@ const char G4Tet::CVSVers[]="$Id: G4Tet.cc 76263 2013-11-08 11:41:52Z gcosmo $";
#include <cmath>
#include "G4AutoLock.hh"
namespace
{
G4Mutex polyhedronMutex = G4MUTEX_INITIALIZER;
}
using namespace CLHEP;
////////////////////////////////////////////////////////////////////////
@@ -91,7 +98,7 @@ G4Tet::G4Tet(const G4String& pName,
G4ThreeVector p2,
G4ThreeVector p3,
G4ThreeVector p4, G4bool *degeneracyFlag)
: G4VSolid(pName), fpPolyhedron(0), warningFlag(0)
: G4VSolid(pName), fRebuildPolyhedron(false), fpPolyhedron(0), warningFlag(0)
{
// fV<x><y> is vector from vertex <y> to vertex <x>
//
@@ -187,7 +194,8 @@ G4Tet::G4Tet(const G4String& pName,
// for usage restricted to object persistency.
//
G4Tet::G4Tet( __void__& a )
: G4VSolid(a), fCubicVolume(0.), fSurfaceArea(0.), fpPolyhedron(0),
: G4VSolid(a), fCubicVolume(0.), fSurfaceArea(0.),
fRebuildPolyhedron(false), fpPolyhedron(0),
fAnchor(0,0,0), fP2(0,0,0), fP3(0,0,0), fP4(0,0,0), fMiddle(0,0,0),
fNormal123(0,0,0), fNormal142(0,0,0), fNormal134(0,0,0),
fNormal234(0,0,0), warningFlag(0),
@@ -203,7 +211,7 @@ G4Tet::G4Tet( __void__& a )
G4Tet::~G4Tet()
{
delete fpPolyhedron;
delete fpPolyhedron; fpPolyhedron = 0;
}
///////////////////////////////////////////////////////////////////////////////
@@ -213,7 +221,7 @@ G4Tet::~G4Tet()
G4Tet::G4Tet(const G4Tet& rhs)
: G4VSolid(rhs),
fCubicVolume(rhs.fCubicVolume), fSurfaceArea(rhs.fSurfaceArea),
fpPolyhedron(0), fAnchor(rhs.fAnchor),
fRebuildPolyhedron(false), fpPolyhedron(0), fAnchor(rhs.fAnchor),
fP2(rhs.fP2), fP3(rhs.fP3), fP4(rhs.fP4), fMiddle(rhs.fMiddle),
fNormal123(rhs.fNormal123), fNormal142(rhs.fNormal142),
fNormal134(rhs.fNormal134), fNormal234(rhs.fNormal234),
@@ -244,7 +252,7 @@ G4Tet& G4Tet::operator = (const G4Tet& rhs)
// Copy data
//
fCubicVolume = rhs.fCubicVolume; fSurfaceArea = rhs.fSurfaceArea;
fpPolyhedron = 0; fAnchor = rhs.fAnchor;
fAnchor = rhs.fAnchor;
fP2 = rhs.fP2; fP3 = rhs.fP3; fP4 = rhs.fP4; fMiddle = rhs.fMiddle;
fNormal123 = rhs.fNormal123; fNormal142 = rhs.fNormal142;
fNormal134 = rhs.fNormal134; fNormal234 = rhs.fNormal234;
@@ -254,6 +262,8 @@ G4Tet& G4Tet::operator = (const G4Tet& rhs)
fYMin = rhs.fYMin; fYMax = rhs.fYMax; fZMin = rhs.fZMin; fZMax = rhs.fZMax;
fDx = rhs.fDx; fDy = rhs.fDy; fDz = rhs.fDz; fTol = rhs.fTol;
fMaxSize = rhs.fMaxSize;
fRebuildPolyhedron = false;
delete fpPolyhedron; fpPolyhedron = 0;
return *this;
}
@@ -852,11 +862,15 @@ G4Polyhedron* G4Tet::CreatePolyhedron () const
G4Polyhedron* G4Tet::GetPolyhedron () const
{
if (!fpPolyhedron ||
fRebuildPolyhedron ||
fpPolyhedron->GetNumberOfRotationStepsAtTimeOfCreation() !=
fpPolyhedron->GetNumberOfRotationSteps())
{
G4AutoLock l(&polyhedronMutex);
delete fpPolyhedron;
fpPolyhedron = CreatePolyhedron();
fRebuildPolyhedron = false;
l.unlock();
}
return fpPolyhedron;
}
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4TwistTrapAlphaSide.cc 72937 2013-08-14 13:20:38Z gcosmo $
// $Id: G4TwistTrapAlphaSide.cc 80289 2014-04-10 09:51:38Z gcosmo $
//
//
// --------------------------------------------------------------------
@@ -217,7 +217,7 @@ G4TwistTrapAlphaSide::DistanceToSurface(const G4ThreeVector &gp,
if (fCurStatWithV.IsDone())
{
for (register int i=0; i<fCurStatWithV.GetNXX(); i++)
for (G4int i=0; i<fCurStatWithV.GetNXX(); i++)
{
gxx[i] = fCurStatWithV.GetXX(i);
distance[i] = fCurStatWithV.GetDistance(i);
@@ -228,7 +228,7 @@ G4TwistTrapAlphaSide::DistanceToSurface(const G4ThreeVector &gp,
}
else // initialise
{
for (register int j=0; j<G4VSURFACENXX ; j++)
for (G4int j=0; j<G4VSURFACENXX ; j++)
{
distance[j] = kInfinity;
areacode[j] = sOutside;
@@ -356,7 +356,7 @@ G4TwistTrapAlphaSide::DistanceToSurface(const G4ThreeVector &gp,
G4JTPolynomialSolver trapEq ;
G4int num = trapEq.FindRoots(c,7,srd,si);
for (register int i = 0 ; i<num ; i++ ) // loop over all math solutions
for (G4int i = 0 ; i<num ; i++ ) // loop over all math solutions
{
if ( si[i]==0.0 ) // only real solutions
{
@@ -393,7 +393,7 @@ G4TwistTrapAlphaSide::DistanceToSurface(const G4ThreeVector &gp,
G4double factor; // a scaling factor
G4int maxint=30; // number of iterations
for ( register size_t k = 0 ; k<xbuf.size() ; k++ )
for ( size_t k = 0 ; k<xbuf.size() ; k++ )
{
#ifdef G4TWISTDEBUG
G4cout << "Solution " << k << " : "
@@ -406,7 +406,7 @@ G4TwistTrapAlphaSide::DistanceToSurface(const G4ThreeVector &gp,
IsConverged = false ; // no convergence at the beginning
for ( register int i = 1 ; i<maxint ; i++ )
for ( G4int i = 1 ; i<maxint ; i++ )
{
xxonsurface = SurfacePoint(phi,u) ;
surfacenormal = NormAng(phi,u) ;
@@ -541,7 +541,7 @@ G4TwistTrapAlphaSide::DistanceToSurface(const G4ThreeVector &gp,
xbuf.push_back(xbuftmp) ; // store it to xbuf
for ( register size_t k = nxxtmp ; k<xbuf.size() ; k++ )
for ( size_t k = nxxtmp ; k<xbuf.size() ; k++ )
{
#ifdef G4TWISTDEBUG
@@ -555,7 +555,7 @@ G4TwistTrapAlphaSide::DistanceToSurface(const G4ThreeVector &gp,
IsConverged = false ; // no convergence at the beginning
for ( register int i = 1 ; i<maxint ; i++ )
for ( G4int i = 1 ; i<maxint ; i++ )
{
xxonsurface = SurfacePoint(phi,u) ;
surfacenormal = NormAng(phi,u) ;
@@ -653,7 +653,7 @@ G4TwistTrapAlphaSide::DistanceToSurface(const G4ThreeVector &gp,
nxx = xbuf.size() ; // determine number of solutions again.
for ( register size_t i = 0 ; i<xbuf.size() ; i++ )
for ( size_t i = 0 ; i<xbuf.size() ; i++ )
{
distance[i] = xbuf[i].distance;
gxx[i] = ComputeGlobalPoint(xbuf[i].xx);
@@ -704,7 +704,7 @@ G4TwistTrapAlphaSide::DistanceToSurface(const G4ThreeVector &gp,
if (fCurStat.IsDone())
{
for (register int i=0; i<fCurStat.GetNXX(); i++)
for (G4int i=0; i<fCurStat.GetNXX(); i++)
{
gxx[i] = fCurStat.GetXX(i);
distance[i] = fCurStat.GetDistance(i);
@@ -714,7 +714,7 @@ G4TwistTrapAlphaSide::DistanceToSurface(const G4ThreeVector &gp,
}
else // initialize
{
for (register int i=0; i<G4VSURFACENXX; i++)
for (G4int i=0; i<G4VSURFACENXX; i++)
{
distance[i] = kInfinity;
areacode[i] = sOutside;
@@ -735,7 +735,7 @@ G4TwistTrapAlphaSide::DistanceToSurface(const G4ThreeVector &gp,
G4double deltaX, uMax ;
G4double halfphi = 0.5*fPhiTwist ;
for ( register int i = 1 ; i<20 ; i++ )
for ( G4int i = 1 ; i<20 ; i++ )
{
xxonsurface = SurfacePoint(phiR,uR) ;
surfacenormal = NormAng(phiR,uR) ;
@@ -1127,13 +1127,13 @@ G4TwistTrapAlphaSide::GetFacets( G4int k, G4int n, G4double xyz[][3],
// calculate the (n-1)*(k-1) vertices
for ( register int i = 0 ; i<n ; i++ )
for ( G4int i = 0 ; i<n ; i++ )
{
z = -fDz+i*(2.*fDz)/(n-1) ;
phi = z*fPhiTwist/(2*fDz) ;
b = GetValueB(phi) ;
for ( register int j = 0 ; j<k ; j++ )
for ( G4int j = 0 ; j<k ; j++ )
{
nnode = GetNode(i,j,k,n,iside) ;
u = -b/2 +j*b/(k-1) ;
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4TwistedBox.cc 66356 2012-12-18 09:02:32Z gcosmo $
// $Id: G4TwistedBox.cc 79492 2014-03-05 15:25:30Z gcosmo $
//
//
// --------------------------------------------------------------------
@@ -71,6 +71,7 @@ G4TwistedBox::~G4TwistedBox()
G4TwistedBox::G4TwistedBox(const G4TwistedBox& rhs)
: G4VTwistedFaceted(rhs)
{
fpPolyhedron = GetPolyhedron();
}
@@ -85,6 +86,7 @@ G4TwistedBox& G4TwistedBox::operator = (const G4TwistedBox& rhs)
// Copy base class data
//
G4VTwistedFaceted::operator=(rhs);
fpPolyhedron = GetPolyhedron();
return *this;
}
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4TwistedTrap.cc 66356 2012-12-18 09:02:32Z gcosmo $
// $Id: G4TwistedTrap.cc 79492 2014-03-05 15:25:30Z gcosmo $
//
//
// --------------------------------------------------------------------
@@ -90,6 +90,7 @@ G4TwistedTrap::~G4TwistedTrap()
G4TwistedTrap::G4TwistedTrap(const G4TwistedTrap& rhs)
: G4VTwistedFaceted(rhs)
{
fpPolyhedron = GetPolyhedron();
}
// Assignment operator
@@ -103,6 +104,7 @@ G4TwistedTrap& G4TwistedTrap::operator = (const G4TwistedTrap& rhs)
// Copy base class data
//
G4VTwistedFaceted::operator=(rhs);
fpPolyhedron = GetPolyhedron();
return *this;
}
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4TwistedTrd.cc 66356 2012-12-18 09:02:32Z gcosmo $
// $Id: G4TwistedTrd.cc 79492 2014-03-05 15:25:30Z gcosmo $
//
//
// --------------------------------------------------------------------
@@ -72,6 +72,7 @@ G4TwistedTrd::~G4TwistedTrd()
G4TwistedTrd::G4TwistedTrd(const G4TwistedTrd& rhs)
: G4VTwistedFaceted(rhs)
{
fpPolyhedron = GetPolyhedron();
}
// Assignment operator
@@ -85,6 +86,7 @@ G4TwistedTrd& G4TwistedTrd::operator = (const G4TwistedTrd& rhs)
// Copy base class data
//
G4VTwistedFaceted::operator=(rhs);
fpPolyhedron = GetPolyhedron();
return *this;
}
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4TwistedTubs.cc 72937 2013-08-14 13:20:38Z gcosmo $
// $Id: G4TwistedTubs.cc 83572 2014-09-01 15:23:27Z gcosmo $
//
//
// --------------------------------------------------------------------
@@ -59,6 +59,13 @@
#include "Randomize.hh"
#include "G4AutoLock.hh"
namespace
{
G4Mutex polyhedronMutex = G4MUTEX_INITIALIZER;
}
//=====================================================================
//* constructors ------------------------------------------------------
@@ -71,7 +78,8 @@ G4TwistedTubs::G4TwistedTubs(const G4String &pname,
: G4VSolid(pname), fDPhi(dphi),
fLowerEndcap(0), fUpperEndcap(0), fLatterTwisted(0),
fFormerTwisted(0), fInnerHype(0), fOuterHype(0),
fCubicVolume(0.), fSurfaceArea(0.), fpPolyhedron(0)
fCubicVolume(0.), fSurfaceArea(0.),
fRebuildPolyhedron(false), fpPolyhedron(0)
{
if (endinnerrad < DBL_MIN)
{
@@ -104,7 +112,8 @@ G4TwistedTubs::G4TwistedTubs(const G4String &pname,
: G4VSolid(pname),
fLowerEndcap(0), fUpperEndcap(0), fLatterTwisted(0),
fFormerTwisted(0), fInnerHype(0), fOuterHype(0),
fCubicVolume(0.), fSurfaceArea(0.), fpPolyhedron(0)
fCubicVolume(0.), fSurfaceArea(0.),
fRebuildPolyhedron(false), fpPolyhedron(0)
{
if (!nseg)
@@ -147,7 +156,8 @@ G4TwistedTubs::G4TwistedTubs(const G4String &pname,
: G4VSolid(pname), fDPhi(dphi),
fLowerEndcap(0), fUpperEndcap(0), fLatterTwisted(0),
fFormerTwisted(0), fInnerHype(0), fOuterHype(0),
fCubicVolume(0.), fSurfaceArea(0.), fpPolyhedron(0)
fCubicVolume(0.), fSurfaceArea(0.),
fRebuildPolyhedron(false), fpPolyhedron(0)
{
if (innerrad < DBL_MIN)
{
@@ -170,7 +180,8 @@ G4TwistedTubs::G4TwistedTubs(const G4String &pname,
: G4VSolid(pname),
fLowerEndcap(0), fUpperEndcap(0), fLatterTwisted(0),
fFormerTwisted(0), fInnerHype(0), fOuterHype(0),
fCubicVolume(0.), fSurfaceArea(0.), fpPolyhedron(0)
fCubicVolume(0.), fSurfaceArea(0.),
fRebuildPolyhedron(false), fpPolyhedron(0)
{
if (!nseg)
{
@@ -200,13 +211,9 @@ G4TwistedTubs::G4TwistedTubs( __void__& a )
fTanOuterStereo(0.), fKappa(0.), fInnerRadius2(0.), fOuterRadius2(0.),
fTanInnerStereo2(0.), fTanOuterStereo2(0.), fLowerEndcap(0), fUpperEndcap(0),
fLatterTwisted(0), fFormerTwisted(0), fInnerHype(0), fOuterHype(0),
fCubicVolume(0.), fSurfaceArea(0.), fpPolyhedron(0)
fCubicVolume(0.), fSurfaceArea(0.),
fRebuildPolyhedron(false), fpPolyhedron(0)
{
fEndZ[0] = 0.; fEndZ[1] = 0.;
fEndInnerRadius[0] = 0.; fEndInnerRadius[1] = 0.;
fEndOuterRadius[0] = 0.; fEndOuterRadius[1] = 0.;
fEndPhi[0] = 0.; fEndPhi[1] = 0.;
fEndZ2[0] = 0.; fEndZ2[1] = 0.;
}
//=====================================================================
@@ -220,7 +227,7 @@ G4TwistedTubs::~G4TwistedTubs()
if (fFormerTwisted) { delete fFormerTwisted; }
if (fInnerHype) { delete fInnerHype; }
if (fOuterHype) { delete fOuterHype; }
if (fpPolyhedron) { delete fpPolyhedron; }
if (fpPolyhedron) { delete fpPolyhedron; fpPolyhedron = 0; }
}
//=====================================================================
@@ -238,7 +245,8 @@ G4TwistedTubs::G4TwistedTubs(const G4TwistedTubs& rhs)
fLowerEndcap(0), fUpperEndcap(0), fLatterTwisted(0), fFormerTwisted(0),
fInnerHype(0), fOuterHype(0),
fCubicVolume(rhs.fCubicVolume), fSurfaceArea(rhs.fSurfaceArea),
fpPolyhedron(0), fLastInside(rhs.fLastInside), fLastNormal(rhs.fLastNormal),
fRebuildPolyhedron(false), fpPolyhedron(0),
fLastInside(rhs.fLastInside), fLastNormal(rhs.fLastNormal),
fLastDistanceToIn(rhs.fLastDistanceToIn),
fLastDistanceToOut(rhs.fLastDistanceToOut),
fLastDistanceToInWithV(rhs.fLastDistanceToInWithV),
@@ -282,7 +290,6 @@ G4TwistedTubs& G4TwistedTubs::operator = (const G4TwistedTubs& rhs)
fLowerEndcap= fUpperEndcap= fLatterTwisted= fFormerTwisted= 0;
fInnerHype= fOuterHype= 0;
fCubicVolume= rhs.fCubicVolume; fSurfaceArea= rhs.fSurfaceArea;
fpPolyhedron= 0;
fLastInside= rhs.fLastInside; fLastNormal= rhs.fLastNormal;
fLastDistanceToIn= rhs.fLastDistanceToIn;
fLastDistanceToOut= rhs.fLastDistanceToOut;
@@ -299,6 +306,8 @@ G4TwistedTubs& G4TwistedTubs::operator = (const G4TwistedTubs& rhs)
}
CreateSurfaces();
fRebuildPolyhedron = false;
delete fpPolyhedron; fpPolyhedron = 0;
return *this;
}
@@ -1124,12 +1133,16 @@ G4Polyhedron* G4TwistedTubs::CreatePolyhedron () const
G4Polyhedron* G4TwistedTubs::GetPolyhedron () const
{
if ((!fpPolyhedron) ||
(fpPolyhedron->GetNumberOfRotationStepsAtTimeOfCreation() !=
fpPolyhedron->GetNumberOfRotationSteps()))
if (!fpPolyhedron ||
fRebuildPolyhedron ||
fpPolyhedron->GetNumberOfRotationStepsAtTimeOfCreation() !=
fpPolyhedron->GetNumberOfRotationSteps())
{
G4AutoLock l(&polyhedronMutex);
delete fpPolyhedron;
fpPolyhedron = CreatePolyhedron();
fRebuildPolyhedron = false;
l.unlock();
}
return fpPolyhedron;
}
@@ -0,0 +1,122 @@
//
// ********************************************************************
// * 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:$
//
//
// Implementation of G4UExtrudedSolid wrapper class
// --------------------------------------------------------------------
#include "G4ExtrudedSolid.hh"
#include "G4UExtrudedSolid.hh"
#include "G4Polyhedron.hh"
////////////////////////////////////////////////////////////////////////
//
// Constructors
//
G4UExtrudedSolid::G4UExtrudedSolid(const G4String& name,
std::vector<G4TwoVector> polygon,
std::vector<ZSection> zsections)
: G4USolid(name, new UExtrudedSolid())
{
GetShape()->SetName(name);
std::vector<UVector2> pvec;
for (unsigned int i=0; i<polygon.size(); ++i)
{
pvec.push_back(UVector2(polygon[i].x(), polygon[i].y()));
}
std::vector<UExtrudedSolid::ZSection> svec;
for (unsigned int i=0; i<zsections.size(); ++i)
{
ZSection sec = zsections[i];
svec.push_back(UExtrudedSolid::ZSection(sec.fZ,
UVector2(sec.fOffset.x(), sec.fOffset.y()), sec.fScale));
}
GetShape()->Initialise(pvec, svec);
}
G4UExtrudedSolid::G4UExtrudedSolid(const G4String& name,
std::vector<G4TwoVector> polygon,
G4double halfZ,
G4TwoVector off1, G4double scale1,
G4TwoVector off2, G4double scale2)
: G4USolid(name, new UExtrudedSolid())
{
GetShape()->SetName(name);
std::vector<UVector2> pvec;
for (unsigned int i=0; i<polygon.size(); ++i)
{
pvec.push_back(UVector2(polygon[i].x(), polygon[i].y()));
}
GetShape()->Initialise(pvec, halfZ, UVector2(off1.x(), off1.y()), scale1,
UVector2(off2.x(), off2.y()), scale2);
}
////////////////////////////////////////////////////////////////////////
//
// Fake default constructor - sets only member data and allocates memory
// for usage restricted to object persistency.
//
G4UExtrudedSolid::G4UExtrudedSolid(__void__& a)
: G4USolid(a)
{
}
//////////////////////////////////////////////////////////////////////////
//
// Destructor
//
G4UExtrudedSolid::~G4UExtrudedSolid()
{
}
//////////////////////////////////////////////////////////////////////////
//
// Copy constructor
//
G4UExtrudedSolid::G4UExtrudedSolid(const G4UExtrudedSolid &source)
: G4USolid(source)
{
}
//////////////////////////////////////////////////////////////////////////
//
// Assignment operator
//
G4UExtrudedSolid&
G4UExtrudedSolid::operator=(const G4UExtrudedSolid &source)
{
if (this == &source) return *this;
G4USolid::operator=( source );
return *this;
}
@@ -0,0 +1,192 @@
//
// ********************************************************************
// * 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:$
//
//
// Implementation of G4UGenericTrap wrapper class
// --------------------------------------------------------------------
#include "G4GenericTrap.hh"
#include "G4UGenericTrap.hh"
#include "G4Polyhedron.hh"
#include "G4PolyhedronArbitrary.hh"
////////////////////////////////////////////////////////////////////////
//
// Constructor (generic parameters)
//
G4UGenericTrap::G4UGenericTrap(const G4String& name, G4double halfZ,
const std::vector<G4TwoVector>& vertices)
: G4USolid(name, new UGenericTrap())
{
SetZHalfLength(halfZ);
std::vector<UVector2> v;
for (size_t n=0; n<vertices.size(); ++n)
{
v.push_back(UVector2(vertices[n].x(),vertices[n].y()));
}
GetShape()->SetName(name);
GetShape()->Initialise(v);
}
////////////////////////////////////////////////////////////////////////
//
// Fake default constructor - sets only member data and allocates memory
// for usage restricted to object persistency.
//
G4UGenericTrap::G4UGenericTrap(__void__& a)
: G4USolid(a)
{
}
//////////////////////////////////////////////////////////////////////////
//
// Destructor
//
G4UGenericTrap::~G4UGenericTrap()
{
}
//////////////////////////////////////////////////////////////////////////
//
// Copy constructor
//
G4UGenericTrap::G4UGenericTrap(const G4UGenericTrap &source)
: G4USolid(source)
{
}
//////////////////////////////////////////////////////////////////////////
//
// Assignment operator
//
G4UGenericTrap&
G4UGenericTrap::operator=(const G4UGenericTrap &source)
{
if (this == &source) return *this;
G4USolid::operator=( source );
return *this;
}
//////////////////////////////////////////////////////////////////////////
//
// CreatePolyhedron()
//
G4Polyhedron* G4UGenericTrap::CreatePolyhedron() const
{
// Approximation of Twisted Side
// Construct extra Points, if Twisted Side
//
G4PolyhedronArbitrary* polyhedron;
size_t nVertices, nFacets;
G4double fDz = GetZHalfLength();
G4int subdivisions=0;
G4int i;
if(IsTwisted())
{
if ( GetVisSubdivisions()!= 0 )
{
subdivisions=GetVisSubdivisions();
}
else
{
// Estimation of Number of Subdivisions for smooth visualisation
//
G4double maxTwist=0.;
for(i=0; i<4; i++)
{
if(GetTwistAngle(i)>maxTwist) { maxTwist=GetTwistAngle(i); }
}
// Computes bounding vectors for the shape
//
G4double Dx,Dy;
UVector3 minBox = GetShape()->GetMinimumBBox();
UVector3 maxBox = GetShape()->GetMaximumBBox();
G4ThreeVector minVec(minBox.x, minBox.y, minBox.z);
G4ThreeVector maxVec(maxBox.x, maxBox.y, maxBox.z);
Dx = 0.5*(maxVec.x()- minVec.y());
Dy = 0.5*(maxVec.y()- minVec.y());
if (Dy > Dx) { Dx=Dy; }
subdivisions=8*G4int(maxTwist/(Dx*Dx*Dx)*fDz);
if (subdivisions<4) { subdivisions=4; }
if (subdivisions>30) { subdivisions=30; }
}
}
G4int sub4=4*subdivisions;
nVertices = 8+subdivisions*4;
nFacets = 6+subdivisions*4;
G4double cf=1./(subdivisions+1);
polyhedron = new G4PolyhedronArbitrary (nVertices, nFacets);
// Add Vertex
//
for (i=0;i<4;i++)
{
polyhedron->AddVertex(G4ThreeVector(GetVertex(i).x(),
GetVertex(i).y(),-fDz));
}
for( i=0;i<subdivisions;i++)
{
for(G4int j=0;j<4;j++)
{
G4TwoVector u=GetVertex(j)+cf*(i+1)*( GetVertex(j+4)-GetVertex(j));
polyhedron->AddVertex(G4ThreeVector(u.x(),u.y(),-fDz+cf*2*fDz*(i+1)));
}
}
for (i=4;i<8;i++)
{
polyhedron->AddVertex(G4ThreeVector(GetVertex(i).x(),
GetVertex(i).y(),fDz));
}
// Add Facets
//
polyhedron->AddFacet(1,4,3,2); //Z-plane
for (i=0;i<subdivisions+1;i++)
{
G4int is=i*4;
polyhedron->AddFacet(5+is,8+is,4+is,1+is);
polyhedron->AddFacet(8+is,7+is,3+is,4+is);
polyhedron->AddFacet(7+is,6+is,2+is,3+is);
polyhedron->AddFacet(6+is,5+is,1+is,2+is);
}
polyhedron->AddFacet(5+sub4,6+sub4,7+sub4,8+sub4); //Z-plane
polyhedron->SetReferences();
polyhedron->InvertFacets();
return (G4Polyhedron*) polyhedron;
}
@@ -32,7 +32,6 @@
#include "G4Polycone.hh"
#include "G4UPolycone.hh"
#include "G4VPVParameterisation.hh"
#include "G4Polyhedron.hh"
////////////////////////////////////////////////////////////////////////
//
@@ -122,6 +121,17 @@ void G4UPolycone::ComputeDimensions(G4VPVParameterisation* p,
p->ComputeDimensions(*(G4Polycone*)this,n,pRep);
}
//////////////////////////////////////////////////////////////////////////
//
// Make a clone of the object
G4VSolid* G4UPolycone::Clone() const
{
return new G4UPolycone(*this);
}
////////////////////////////////////////////////////////////////////////
//
// CreatePolyhedron
@@ -31,7 +31,6 @@
#include "G4Polyhedra.hh"
#include "G4UPolyhedra.hh"
#include "G4Polyhedron.hh"
#include "G4VPVParameterisation.hh"
using CLHEP::twopi;
@@ -130,6 +129,16 @@ void G4UPolyhedra::ComputeDimensions(G4VPVParameterisation* p,
}
//////////////////////////////////////////////////////////////////////////
//
// Make a clone of the object
G4VSolid* G4UPolyhedra::Clone() const
{
return new G4UPolyhedra(*this);
}
////////////////////////////////////////////////////////////////////////
//
// CreatePolyhedron
@@ -29,7 +29,7 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4VCSGfaceted.cc 66356 2012-12-18 09:02:32Z gcosmo $
// $Id: G4VCSGfaceted.cc 83572 2014-09-01 15:23:27Z gcosmo $
//
//
// --------------------------------------------------------------------
@@ -56,12 +56,20 @@
#include "G4VGraphicsScene.hh"
#include "G4VisExtent.hh"
#include "G4AutoLock.hh"
namespace
{
G4Mutex polyhedronMutex = G4MUTEX_INITIALIZER;
}
//
// Constructor
//
G4VCSGfaceted::G4VCSGfaceted( const G4String& name )
: G4VSolid(name),
numFace(0), faces(0), fCubicVolume(0.), fSurfaceArea(0.), fpPolyhedron(0),
numFace(0), faces(0), fCubicVolume(0.), fSurfaceArea(0.),
fRebuildPolyhedron(false), fpPolyhedron(0),
fStatistics(1000000), fCubVolEpsilon(0.001), fAreaAccuracy(-1.)
{
}
@@ -73,7 +81,8 @@ G4VCSGfaceted::G4VCSGfaceted( const G4String& name )
//
G4VCSGfaceted::G4VCSGfaceted( __void__& a )
: G4VSolid(a),
numFace(0), faces(0), fCubicVolume(0.), fSurfaceArea(0.), fpPolyhedron(0),
numFace(0), faces(0), fCubicVolume(0.), fSurfaceArea(0.),
fRebuildPolyhedron(false), fpPolyhedron(0),
fStatistics(1000000), fCubVolEpsilon(0.001), fAreaAccuracy(-1.)
{
}
@@ -84,7 +93,7 @@ G4VCSGfaceted::G4VCSGfaceted( __void__& a )
G4VCSGfaceted::~G4VCSGfaceted()
{
DeleteStuff();
delete fpPolyhedron;
delete fpPolyhedron; fpPolyhedron = 0;
}
@@ -105,7 +114,7 @@ G4VCSGfaceted::G4VCSGfaceted( const G4VCSGfaceted &source )
//
// Assignment operator
//
const G4VCSGfaceted &G4VCSGfaceted::operator=( const G4VCSGfaceted &source )
G4VCSGfaceted &G4VCSGfaceted::operator=( const G4VCSGfaceted &source )
{
if (&source == this) { return *this; }
@@ -146,6 +155,7 @@ void G4VCSGfaceted::CopyStuff( const G4VCSGfaceted &source )
} while( ++sourceFace, ++face < faces+numFace );
fCubicVolume = source.fCubicVolume;
fSurfaceArea = source.fSurfaceArea;
fRebuildPolyhedron = false;
fpPolyhedron = 0;
}
@@ -167,6 +177,7 @@ void G4VCSGfaceted::DeleteStuff()
delete [] faces;
}
delete fpPolyhedron; fpPolyhedron = 0;
}
@@ -572,11 +583,15 @@ G4double G4VCSGfaceted::GetSurfaceArea()
G4Polyhedron* G4VCSGfaceted::GetPolyhedron () const
{
if (!fpPolyhedron ||
fRebuildPolyhedron ||
fpPolyhedron->GetNumberOfRotationStepsAtTimeOfCreation() !=
fpPolyhedron->GetNumberOfRotationSteps())
{
G4AutoLock l(&polyhedronMutex);
delete fpPolyhedron;
fpPolyhedron = CreatePolyhedron();
fRebuildPolyhedron = false;
l.unlock();
}
return fpPolyhedron;
}
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4VTwistedFaceted.cc 66356 2012-12-18 09:02:32Z gcosmo $
// $Id: G4VTwistedFaceted.cc 83572 2014-09-01 15:23:27Z gcosmo $
//
//
// --------------------------------------------------------------------
@@ -56,6 +56,13 @@
#include "Randomize.hh"
#include "G4AutoLock.hh"
namespace
{
G4Mutex polyhedronMutex = G4MUTEX_INITIALIZER;
}
//=====================================================================
//* constructors ------------------------------------------------------
@@ -73,10 +80,10 @@ G4VTwistedFaceted( const G4String &pname, // Name of instance
G4double pDx4, // half x length at +pDz,+pDy
G4double pAlph // tilt angle
)
: G4VSolid(pname),
: G4VSolid(pname), fRebuildPolyhedron(false), fpPolyhedron(0),
fLowerEndcap(0), fUpperEndcap(0), fSide0(0),
fSide90(0), fSide180(0), fSide270(0),
fSurfaceArea(0.), fpPolyhedron(0)
fSurfaceArea(0.)
{
G4double pDytmp ;
@@ -193,11 +200,13 @@ G4VTwistedFaceted( const G4String &pname, // Name of instance
//* Fake default constructor ------------------------------------------
G4VTwistedFaceted::G4VTwistedFaceted( __void__& a )
: G4VSolid(a), fTheta(0.), fPhi(0.), fDy1(0.), fDx1(0.), fDx2(0.),
fDy2(0.), fDx3(0.), fDx4(0.), fDz(0.), fDx(0.), fDy(0.), fAlph(0.),
: G4VSolid(a), fRebuildPolyhedron(false), fpPolyhedron(0),
fTheta(0.), fPhi(0.), fDy1(0.),
fDx1(0.), fDx2(0.), fDy2(0.), fDx3(0.), fDx4(0.),
fDz(0.), fDx(0.), fDy(0.), fAlph(0.),
fTAlph(0.), fdeltaX(0.), fdeltaY(0.), fPhiTwist(0.),
fLowerEndcap(0), fUpperEndcap(0), fSide0(0), fSide90(0), fSide180(0),
fSide270(0), fCubicVolume(0.), fSurfaceArea(0.), fpPolyhedron(0)
fSide270(0), fCubicVolume(0.), fSurfaceArea(0.)
{
}
@@ -206,28 +215,28 @@ G4VTwistedFaceted::G4VTwistedFaceted( __void__& a )
G4VTwistedFaceted::~G4VTwistedFaceted()
{
if (fLowerEndcap) delete fLowerEndcap ;
if (fUpperEndcap) delete fUpperEndcap ;
if (fLowerEndcap) { delete fLowerEndcap ; }
if (fUpperEndcap) { delete fUpperEndcap ; }
if (fSide0) delete fSide0 ;
if (fSide90) delete fSide90 ;
if (fSide180) delete fSide180 ;
if (fSide270) delete fSide270 ;
if (fpPolyhedron) delete fpPolyhedron;
if (fSide0) { delete fSide0 ; }
if (fSide90) { delete fSide90 ; }
if (fSide180) { delete fSide180 ; }
if (fSide270) { delete fSide270 ; }
if (fpPolyhedron) { delete fpPolyhedron; fpPolyhedron = 0; }
}
//=====================================================================
//* Copy constructor --------------------------------------------------
G4VTwistedFaceted::G4VTwistedFaceted(const G4VTwistedFaceted& rhs)
: G4VSolid(rhs), fTheta(rhs.fTheta), fPhi(rhs.fPhi),
: G4VSolid(rhs), fRebuildPolyhedron(false), fpPolyhedron(0),
fTheta(rhs.fTheta), fPhi(rhs.fPhi),
fDy1(rhs.fDy1), fDx1(rhs.fDx1), fDx2(rhs.fDx2), fDy2(rhs.fDy2),
fDx3(rhs.fDx3), fDx4(rhs.fDx4), fDz(rhs.fDz), fDx(rhs.fDx), fDy(rhs.fDy),
fAlph(rhs.fAlph), fTAlph(rhs.fTAlph), fdeltaX(rhs.fdeltaX),
fdeltaY(rhs.fdeltaY), fPhiTwist(rhs.fPhiTwist), fLowerEndcap(0),
fUpperEndcap(0), fSide0(0), fSide90(0), fSide180(0), fSide270(0),
fCubicVolume(rhs.fCubicVolume), fSurfaceArea(rhs.fSurfaceArea),
fpPolyhedron(0),
fLastInside(rhs.fLastInside), fLastNormal(rhs.fLastNormal),
fLastDistanceToIn(rhs.fLastDistanceToIn),
fLastDistanceToOut(rhs.fLastDistanceToOut),
@@ -260,7 +269,8 @@ G4VTwistedFaceted& G4VTwistedFaceted::operator = (const G4VTwistedFaceted& rhs)
fdeltaY= rhs.fdeltaY; fPhiTwist= rhs.fPhiTwist; fLowerEndcap= 0;
fUpperEndcap= 0; fSide0= 0; fSide90= 0; fSide180= 0; fSide270= 0;
fCubicVolume= rhs.fCubicVolume; fSurfaceArea= rhs.fSurfaceArea;
fpPolyhedron= 0;
fRebuildPolyhedron = false;
delete fpPolyhedron; fpPolyhedron= 0;
fLastInside= rhs.fLastInside; fLastNormal= rhs.fLastNormal;
fLastDistanceToIn= rhs.fLastDistanceToIn;
fLastDistanceToOut= rhs.fLastDistanceToOut;
@@ -960,6 +970,9 @@ G4VTwistedFaceted::DistanceToOut( const G4ThreeVector& p,
}
//=====================================================================
//* DistanceToOut (p) -------------------------------------------------
G4double G4VTwistedFaceted::DistanceToOut( const G4ThreeVector& p ) const
{
// DistanceToOut(p):
@@ -1185,11 +1198,15 @@ G4GeometryType G4VTwistedFaceted::GetEntityType() const
G4Polyhedron* G4VTwistedFaceted::GetPolyhedron() const
{
if (!fpPolyhedron ||
fRebuildPolyhedron ||
fpPolyhedron->GetNumberOfRotationStepsAtTimeOfCreation() !=
fpPolyhedron->GetNumberOfRotationSteps())
{
G4AutoLock l(&polyhedronMutex);
delete fpPolyhedron;
fpPolyhedron = CreatePolyhedron();
fRebuildPolyhedron = false;
l.unlock();
}
return fpPolyhedron;