Import Geant4 10.6.0.beta source tree

This commit is contained in:
Gabriele Cosmo
2019-06-28 11:59:04 +02:00
parent 28a70706e0
commit d0f911957d
1056 changed files with 95168 additions and 78160 deletions
@@ -38,7 +38,7 @@
#include "G4GenericPolycone.hh"
//#if !defined(G4GEOM_USE_UGENERICPOLYCONE)
#if !defined(G4GEOM_USE_UGENERICPOLYCONE)
#include "G4PolyconeSide.hh"
#include "G4PolyPhiFace.hh"
@@ -595,16 +595,7 @@ G4GenericPolycone::CalculateExtent(const EAxis pAxis,
return (pMin < pMax);
}
//
// ComputeDimensions
//
/*void G4GenericPolycone::ComputeDimensions( G4VPVParameterisation* p,
const G4int n,
const G4VPhysicalVolume* pRep )
{
p->ComputeDimensions(*this,n,pRep);
}
*/
//
// GetEntityType
//
@@ -945,4 +936,4 @@ G4Polyhedron* G4GenericPolycone::CreatePolyhedron() const
}
}
//#endif
#endif
@@ -54,7 +54,10 @@ G4PlSideManager G4PolyconeSide::subInstanceManager;
// This macro changes the references to fields that are now encapsulated
// in the class G4PlSideData.
//
#define G4MT_pcphi ((subInstanceManager.offset[instanceID]).fPhi)
#define G4MT_pcphix ((subInstanceManager.offset[instanceID]).fPhix)
#define G4MT_pcphiy ((subInstanceManager.offset[instanceID]).fPhiy)
#define G4MT_pcphiz ((subInstanceManager.offset[instanceID]).fPhiz)
#define G4MT_pcphik ((subInstanceManager.offset[instanceID]).fPhik)
// Returns the private data instance manager.
//
@@ -84,8 +87,7 @@ G4PolyconeSide::G4PolyconeSide( const G4PolyconeSideRZ *prevRZ,
kCarTolerance = G4GeometryTolerance::GetInstance()->GetSurfaceTolerance();
fSurfaceArea = 0.0;
G4MT_pcphi.first = G4ThreeVector(0,0,0);
G4MT_pcphi.second= 0.0;
G4MT_pcphix = 0.0; G4MT_pcphiy = 0.0; G4MT_pcphiz = 0.0; G4MT_pcphik = 0.0;
//
// Record values
@@ -885,16 +887,17 @@ void G4PolyconeSide::CalculateExtent( const EAxis axis,
G4double G4PolyconeSide::GetPhi( const G4ThreeVector& p )
{
G4double val=0.;
G4ThreeVector vphi(G4MT_pcphix, G4MT_pcphiy, G4MT_pcphiz);
if (G4MT_pcphi.first != p)
if (vphi != p)
{
val = p.phi();
G4MT_pcphi.first = p;
G4MT_pcphi.second = val;
G4MT_pcphix = p.x(); G4MT_pcphiy = p.y(); G4MT_pcphiz = p.z();
G4MT_pcphik = val;
}
else
{
val = G4MT_pcphi.second;
val = G4MT_pcphik;
}
return val;
}
@@ -53,7 +53,10 @@ G4PhSideManager G4PolyhedraSide::subInstanceManager;
// This macro changes the references to fields that are now encapsulated
// in the class G4PhSideData.
//
#define G4MT_phphi ((subInstanceManager.offset[instanceID]).fPhi)
#define G4MT_phphix ((subInstanceManager.offset[instanceID]).fPhix)
#define G4MT_phphiy ((subInstanceManager.offset[instanceID]).fPhiy)
#define G4MT_phphiz ((subInstanceManager.offset[instanceID]).fPhiz)
#define G4MT_phphik ((subInstanceManager.offset[instanceID]).fPhik)
// Returns the private data instance manager.
//
@@ -82,9 +85,9 @@ G4PolyhedraSide::G4PolyhedraSide( const G4PolyhedraSideRZ *prevRZ,
instanceID = subInstanceManager.CreateSubInstance();
kCarTolerance = G4GeometryTolerance::GetInstance()->GetSurfaceTolerance();
fSurfaceArea=0.;
G4MT_phphi.first = G4ThreeVector(0,0,0);
G4MT_phphi.second= 0.0;
fSurfaceArea = 0.0;
G4MT_phphix = 0.0; G4MT_phphiy = 0.0; G4MT_phphiz = 0.0;
G4MT_phphik = 0.0;
//
// Record values
@@ -1011,16 +1014,17 @@ G4int G4PolyhedraSide::PhiSegment( G4double phi0 )
G4double G4PolyhedraSide::GetPhi( const G4ThreeVector& p )
{
G4double val=0.;
G4ThreeVector vphi(G4MT_phphix, G4MT_phphiy, G4MT_phphiz);
if (G4MT_phphi.first != p)
if (vphi != p)
{
val = p.phi();
G4MT_phphi.first = p;
G4MT_phphi.second = val;
G4MT_phphix = p.x(); G4MT_phphiy = p.y(); G4MT_phphiz = p.z();
G4MT_phphik = val;
}
else
{
val = G4MT_phphi.second;
val = G4MT_phphik;
}
return val;
}
@@ -202,6 +202,24 @@ void G4TriangularFacet::CopyFrom (const G4TriangularFacet &rhs)
}
}
///////////////////////////////////////////////////////////////////////////////
//
void G4TriangularFacet::MoveFrom (G4TriangularFacet &rhs)
{
fSurfaceNormal = move(rhs.fSurfaceNormal);
fArea = move(rhs.fArea);
fCircumcentre = move(rhs.fCircumcentre);
fRadius = move(rhs.fRadius);
fIndices = move(rhs.fIndices);
fA = move(rhs.fA); fB = move(rhs.fB); fC = move(rhs.fC);
fDet = move(rhs.fDet);
fSqrDist = move(rhs.fSqrDist);
fE1 = move(rhs.fE1); fE2 = move(rhs.fE2);
fIsDefined = move(rhs.fIsDefined);
fVertices = move(rhs.fVertices);
rhs.fVertices = 0;
}
///////////////////////////////////////////////////////////////////////////////
//
G4TriangularFacet::G4TriangularFacet (const G4TriangularFacet &rhs)
@@ -210,6 +228,14 @@ G4TriangularFacet::G4TriangularFacet (const G4TriangularFacet &rhs)
CopyFrom(rhs);
}
///////////////////////////////////////////////////////////////////////////////
//
G4TriangularFacet::G4TriangularFacet (G4TriangularFacet &&rhs)
: G4VFacet(rhs)
{
MoveFrom(rhs);
}
///////////////////////////////////////////////////////////////////////////////
//
G4TriangularFacet &
@@ -218,7 +244,26 @@ G4TriangularFacet::operator=(const G4TriangularFacet &rhs)
SetVertices(0);
if (this != &rhs)
{
delete fVertices;
CopyFrom(rhs);
}
return *this;
}
///////////////////////////////////////////////////////////////////////////////
//
G4TriangularFacet &
G4TriangularFacet::operator=(G4TriangularFacet &&rhs)
{
SetVertices(0);
if (this != &rhs)
{
delete fVertices;
MoveFrom(rhs);
}
return *this;
}
@@ -703,14 +703,14 @@ G4double G4TwistTubsSide::DistanceToPlane(const G4ThreeVector &p,
G4double distToanm = G4VTwistSurface::DistanceToPlane(p, A, (N - A), (M - A), xxanm, nanm) * parity;
G4double distTocmn = G4VTwistSurface::DistanceToPlane(p, C, (M - C), (N - C), xxcmn, ncmn) * parity;
#ifdef G4SPECSDEBUG
// if p is behind of both surfaces, abort.
if (distToanm * distTocmn > 0 && distToanm < 0) {
G4Exception("G4TwistTubsSide::DistanceToPlane()",
"GeomSolids0003", FatalException,
"Point p is behind the surfaces.");
}
#endif
// if p is on surface, return 0.
if (std::fabs(distToanm) <= halftol) {
xx = xxanm;
@@ -30,7 +30,6 @@
// --------------------------------------------------------------------
#include "G4GenericPolycone.hh"
#if 0
#include "G4UGenericPolycone.hh"
#if ( defined(G4GEOM_USE_USOLIDS) || defined(G4GEOM_USE_PARTIAL_USOLIDS) )
@@ -54,8 +53,22 @@ G4UGenericPolycone::G4UGenericPolycone(const G4String& name,
G4int numRZ,
const G4double r[],
const G4double z[] )
: G4USolid(name, new UGenericPolycone(name, phiStart, phiTotal, numRZ, r, z))
: Base_t(name, phiStart, phiTotal, numRZ, r, z)
{
wrStart = phiStart; while (wrStart < 0) wrStart += twopi;
wrDelta = phiTotal;
if (wrDelta <= 0 || wrDelta >= twopi*(1-DBL_EPSILON))
{
wrStart = 0;
wrDelta = twopi;
}
rzcorners.resize(0);
for (G4int i=0; i<numRZ; ++i)
{
rzcorners.push_back(G4TwoVector(r[i],z[i]));
}
std::vector<G4int> iout;
G4GeomTools::RemoveRedundantVertices(rzcorners,iout,2*kCarTolerance);
}
@@ -65,7 +78,7 @@ G4UGenericPolycone::G4UGenericPolycone(const G4String& name,
// for usage restricted to object persistency.
//
G4UGenericPolycone::G4UGenericPolycone(__void__& a)
: G4USolid(a)
: Base_t(a)
{
}
@@ -84,8 +97,11 @@ G4UGenericPolycone::~G4UGenericPolycone()
// Copy constructor
//
G4UGenericPolycone::G4UGenericPolycone(const G4UGenericPolycone &source)
: G4USolid(source)
: Base_t(source)
{
wrStart = source.wrStart;
wrDelta = source.wrDelta;
rzcorners = source.rzcorners;
}
@@ -98,59 +114,71 @@ G4UGenericPolycone::operator=(const G4UGenericPolycone &source)
{
if (this == &source) return *this;
G4USolid::operator=( source );
Base_t::operator=( source );
wrStart = source.wrStart;
wrDelta = source.wrDelta;
rzcorners = source.rzcorners;
return *this;
}
G4double G4UGenericPolycone::GetStartPhi() const
{
return GetShape()->GetStartPhi();
return wrStart;
}
G4double G4UGenericPolycone::GetEndPhi() const
{
return GetShape()->GetEndPhi();
return (wrStart + wrDelta);
}
G4double G4UGenericPolycone::GetSinStartPhi() const
{
if (!GetShape()->IsOpen()) return 0;
G4double phi = GetShape()->GetStartPhi();
if (IsOpen()) return 0;
G4double phi = GetStartPhi();
return std::sin(phi);
}
G4double G4UGenericPolycone::GetCosStartPhi() const
{
if (!GetShape()->IsOpen()) return 1;
G4double phi = GetShape()->GetStartPhi();
if (IsOpen()) return 1;
G4double phi = GetStartPhi();
return std::cos(phi);
}
G4double G4UGenericPolycone::GetSinEndPhi() const
{
if (!GetShape()->IsOpen()) return 0;
G4double phi = GetShape()->GetEndPhi();
if (IsOpen()) return 0;
G4double phi = GetEndPhi();
return std::sin(phi);
}
G4double G4UGenericPolycone::GetCosEndPhi() const
{
if (!GetShape()->IsOpen()) return 1;
G4double phi = GetShape()->GetEndPhi();
if (IsOpen()) return 1;
G4double phi = GetEndPhi();
return std::cos(phi);
}
G4bool G4UGenericPolycone::IsOpen() const
{
return GetShape()->IsOpen();
return (wrDelta < twopi);
}
G4int G4UGenericPolycone::GetNumRZCorner() const
{
return GetShape()->GetNumRZCorner();
return rzcorners.size();
}
G4PolyconeSideRZ G4UGenericPolycone::GetCorner(G4int index) const
{
UPolyconeSideRZ pside = GetShape()->GetCorner(index);
G4PolyconeSideRZ psiderz = { pside.r, pside.z };
G4TwoVector rz = rzcorners.at(index);
G4PolyconeSideRZ psiderz = { rz.x(), rz.y() };
return psiderz;
}
//////////////////////////////////////////////////////////////////////////
//
// Make a clone of the object
G4VSolid* G4UGenericPolycone::Clone() const
{
return new G4UGenericPolycone(*this);
}
//////////////////////////////////////////////////////////////////////////
//
// Get bounding box
@@ -629,4 +657,3 @@ G4Polyhedron* G4UGenericPolycone::CreatePolyhedron() const
}
#endif // G4GEOM_USE_USOLIDS
#endif
+10 -10
View File
@@ -234,20 +234,20 @@ G4UTet::CalculateExtent(const EAxis pAxis,
//
G4Polyhedron* G4UTet::CreatePolyhedron() const
{
G4int index = 0;
G4double array[12];
Base_t::GetParametersList(index, array);
std::vector<U3Vector> vec(4);
Base_t::GetVertices(vec[0], vec[1], vec[2], vec[3]);
G4Polyhedron *ph=new G4Polyhedron;
G4double xyz[4][3];
const G4int faces[4][4]={{1,3,2,0},{1,4,3,0},{1,2,4,0},{2,3,4,0}};
xyz[0][0]=array[0]; xyz[0][1]=array[1]; xyz[0][2]=array[2]; // fAnchor
xyz[1][0]=array[3]; xyz[1][1]=array[4]; xyz[1][2]=array[5]; // fP2
xyz[2][0]=array[6]; xyz[2][1]=array[7]; xyz[2][2]=array[8]; // fP3
xyz[3][0]=array[9]; xyz[3][1]=array[10]; xyz[3][2]=array[11]; // fP4
const G4int faces[4][4] = {{1,3,2,0},{1,4,3,0},{1,2,4,0},{2,3,4,0}};
for (unsigned int i=0; i<4; ++i)
{
xyz[i][0] = vec[i].x();
xyz[i][1] = vec[i].y();
xyz[i][2] = vec[i].z();
}
G4Polyhedron *ph = new G4Polyhedron;
ph->createPolyhedron(4,4,xyz,faces);
return ph;
}