Import Geant4 10.4.0.beta source tree
This commit is contained in:
@@ -42,8 +42,6 @@
|
||||
#include "G4Polyhedron.hh"
|
||||
#include "G4PolyhedronArbitrary.hh"
|
||||
|
||||
#include "G4AutoLock.hh"
|
||||
namespace { G4Mutex UGenericTrapMutex = G4MUTEX_INITIALIZER; }
|
||||
using namespace CLHEP;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
@@ -52,16 +50,10 @@ using namespace CLHEP;
|
||||
//
|
||||
G4UGenericTrap::G4UGenericTrap(const G4String& name, G4double halfZ,
|
||||
const std::vector<G4TwoVector>& vertices)
|
||||
: G4USolid(name, new UGenericTrap())
|
||||
: Base_t(name), fVisSubdivisions(0)
|
||||
{
|
||||
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);
|
||||
Initialise(vertices);
|
||||
}
|
||||
|
||||
|
||||
@@ -71,7 +63,7 @@ G4UGenericTrap::G4UGenericTrap(const G4String& name, G4double halfZ,
|
||||
// for usage restricted to object persistency.
|
||||
//
|
||||
G4UGenericTrap::G4UGenericTrap(__void__& a)
|
||||
: G4USolid(a)
|
||||
: Base_t(a), fVisSubdivisions(0), fVertices()
|
||||
{
|
||||
}
|
||||
|
||||
@@ -90,7 +82,9 @@ G4UGenericTrap::~G4UGenericTrap()
|
||||
// Copy constructor
|
||||
//
|
||||
G4UGenericTrap::G4UGenericTrap(const G4UGenericTrap &source)
|
||||
: G4USolid(source)
|
||||
: Base_t(source), fVisSubdivisions(source.fVisSubdivisions),
|
||||
fVertices(source.fVertices)
|
||||
|
||||
{
|
||||
}
|
||||
|
||||
@@ -104,7 +98,9 @@ G4UGenericTrap::operator=(const G4UGenericTrap &source)
|
||||
{
|
||||
if (this == &source) return *this;
|
||||
|
||||
G4USolid::operator=( source );
|
||||
Base_t::operator=( source );
|
||||
fVertices = source.fVertices;
|
||||
fVisSubdivisions = source.fVisSubdivisions;
|
||||
|
||||
return *this;
|
||||
}
|
||||
@@ -115,59 +111,64 @@ G4UGenericTrap::operator=(const G4UGenericTrap &source)
|
||||
//
|
||||
G4double G4UGenericTrap::GetZHalfLength() const
|
||||
{
|
||||
return GetShape()->GetZHalfLength();
|
||||
return GetDZ();
|
||||
}
|
||||
G4int G4UGenericTrap::GetNofVertices() const
|
||||
{
|
||||
return GetShape()->GetNofVertices();
|
||||
return fVertices.size();
|
||||
}
|
||||
G4TwoVector G4UGenericTrap::GetVertex(G4int index) const
|
||||
{
|
||||
UVector2 v = GetShape()->GetVertex(index);
|
||||
return G4TwoVector(v.x,v.y);
|
||||
return G4TwoVector(GetVerticesX()[index], GetVerticesY()[index]);
|
||||
}
|
||||
const std::vector<G4TwoVector>& G4UGenericTrap::GetVertices() const
|
||||
{
|
||||
G4AutoLock l(&UGenericTrapMutex);
|
||||
std::vector<UVector2> v = GetShape()->GetVertices();
|
||||
static std::vector<G4TwoVector> vertices; vertices.clear();
|
||||
for (size_t n=0; n<v.size(); ++n)
|
||||
{
|
||||
vertices.push_back(G4TwoVector(v[n].x,v[n].y));
|
||||
}
|
||||
return vertices;
|
||||
return fVertices;
|
||||
}
|
||||
G4double G4UGenericTrap::GetTwistAngle(G4int index) const
|
||||
{
|
||||
return GetShape()->GetTwistAngle(index);
|
||||
return GetTwist(index);
|
||||
}
|
||||
G4bool G4UGenericTrap::IsTwisted() const
|
||||
{
|
||||
return GetShape()->IsTwisted();
|
||||
return !IsPlanar();
|
||||
}
|
||||
G4int G4UGenericTrap::GetVisSubdivisions() const
|
||||
{
|
||||
return GetShape()->GetVisSubdivisions();
|
||||
return fVisSubdivisions;
|
||||
}
|
||||
|
||||
void G4UGenericTrap::SetVisSubdivisions(G4int subdiv)
|
||||
{
|
||||
GetShape()->SetVisSubdivisions(subdiv);
|
||||
fVisSubdivisions = subdiv;
|
||||
}
|
||||
|
||||
void G4UGenericTrap::SetZHalfLength(G4double halfZ)
|
||||
{
|
||||
GetShape()->SetZHalfLength(halfZ);
|
||||
SetDZ(halfZ);
|
||||
}
|
||||
|
||||
void G4UGenericTrap::Initialise(const std::vector<G4TwoVector>& v)
|
||||
{
|
||||
G4double verticesx[8], verticesy[8];
|
||||
for (G4int i=0; i<8; ++i)
|
||||
{
|
||||
fVertices.push_back(v[i]);
|
||||
verticesx[i] = v[i].x();
|
||||
verticesy[i] = v[i].y();
|
||||
}
|
||||
Initialize(verticesx, verticesy, GetZHalfLength());
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Get bounding box
|
||||
|
||||
void G4UGenericTrap::Extent(G4ThreeVector& pMin, G4ThreeVector& pMax) const
|
||||
void G4UGenericTrap::BoundingLimits(G4ThreeVector& pMin,
|
||||
G4ThreeVector& pMax) const
|
||||
{
|
||||
UVector3 vmin, vmax;
|
||||
GetShape()->Extent(vmin,vmax);
|
||||
U3Vector vmin, vmax;
|
||||
Extent(vmin,vmax);
|
||||
pMin.set(vmin.x(),vmin.y(),vmin.z());
|
||||
pMax.set(vmax.x(),vmax.y(),vmax.z());
|
||||
|
||||
@@ -180,7 +181,8 @@ void G4UGenericTrap::Extent(G4ThreeVector& pMin, G4ThreeVector& pMax) const
|
||||
<< GetName() << " !"
|
||||
<< "\npMin = " << pMin
|
||||
<< "\npMax = " << pMax;
|
||||
G4Exception("G4UGenericTrap::Extent()", "GeomMgt0001", JustWarning, message);
|
||||
G4Exception("G4UGenericTrap::BoundingLimits()", "GeomMgt0001",
|
||||
JustWarning, message);
|
||||
StreamInfo(G4cout);
|
||||
}
|
||||
}
|
||||
@@ -200,7 +202,7 @@ G4UGenericTrap::CalculateExtent(const EAxis pAxis,
|
||||
|
||||
// Check bounding box (bbox)
|
||||
//
|
||||
Extent(bmin,bmax);
|
||||
BoundingLimits(bmin,bmax);
|
||||
G4BoundingEnvelope bbox(bmin,bmax);
|
||||
#ifdef G4BBOX_EXTENT
|
||||
if (true) return bbox.CalculateExtent(pAxis,pVoxelLimit,pTransform,pMin,pMax);
|
||||
@@ -281,10 +283,8 @@ G4Polyhedron* G4UGenericTrap::CreatePolyhedron() const
|
||||
// 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());
|
||||
G4ThreeVector minVec, maxVec;
|
||||
BoundingLimits(minVec,maxVec);
|
||||
Dx = 0.5*(maxVec.x()- minVec.y());
|
||||
Dy = 0.5*(maxVec.y()- minVec.y());
|
||||
if (Dy > Dx) { Dx=Dy; }
|
||||
|
||||
Reference in New Issue
Block a user