Import Geant4 10.4.0 source tree
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
$Id: History 104670 2017-06-09 10:01:02Z gcosmo $
|
||||
$Id: History 107408 2017-11-10 13:35:09Z gcosmo $
|
||||
-------------------------------------------------------------------
|
||||
|
||||
=========================================================
|
||||
@@ -17,6 +17,19 @@ committal in the CVS repository !
|
||||
* Reverse chronological order (last date on top), please *
|
||||
----------------------------------------------------------
|
||||
|
||||
November 10, P.Arce (geommng-V10-03-22)
|
||||
- Bug report 2011: precision correction in G4ErrorPlaneSurfaceTarget.cc
|
||||
|
||||
October 16, 2017 G.Cosmo geommng-V10-03-21
|
||||
- Removed G4USolid base wrapper for USolids. Only native VecGeom
|
||||
implementation through G4UAdapter is now supported.
|
||||
Requires corresponding tag "geom-specific-V10-03-20".
|
||||
- Enable proper implementation of operator=() in G4UAdapter.
|
||||
|
||||
October 11, 2017 E.Tcherniaev geommng-V10-03-20, 19
|
||||
- G4GeomTools: added PointInPolygon() function, to dtermine the position of a
|
||||
point relative to a polygon in 2D.
|
||||
|
||||
June 9, 2017 G.Cosmo geommng-V10-03-18
|
||||
- Corrections and improvements to G4UAdapter.
|
||||
|
||||
|
||||
@@ -94,11 +94,9 @@ class G4GeomTools
|
||||
const G4TwoVector& C);
|
||||
// Decide if point P is inside triangle ABC
|
||||
|
||||
/*
|
||||
static G4bool PointInPolygon(const G4TwoVector& P
|
||||
static G4bool PointInPolygon(const G4TwoVector& P,
|
||||
const G4TwoVectorList& Polygon);
|
||||
// Decide if point P is inside Polygon
|
||||
*/
|
||||
|
||||
static G4bool IsConvex(const G4TwoVectorList& polygon);
|
||||
// Decide if 2D polygon is convex, i.e. all internal angles are
|
||||
|
||||
@@ -19,6 +19,8 @@
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
@@ -295,6 +297,7 @@ operator=(const G4UAdapter& rhs)
|
||||
// Copy base class data
|
||||
//
|
||||
G4VSolid::operator=(rhs);
|
||||
UnplacedVolume_t::operator=(rhs);
|
||||
|
||||
// Copy data
|
||||
//
|
||||
|
||||
@@ -1,314 +0,0 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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:$
|
||||
// GEANT4 tag $Name:$
|
||||
//
|
||||
//
|
||||
// class G4USolid
|
||||
//
|
||||
// Class description:
|
||||
//
|
||||
// Bridge base class for solids defined in the Unified Solids Library.
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
#ifndef G4USolid_HH
|
||||
#define G4USolid_HH
|
||||
|
||||
#include "G4VSolid.hh"
|
||||
|
||||
#if ( defined(G4GEOM_USE_USOLIDS) || defined(G4GEOM_USE_PARTIAL_USOLIDS) )
|
||||
|
||||
#include "VUSolid.hh"
|
||||
|
||||
class G4VPVParameterisation;
|
||||
|
||||
class G4USolid : public G4VSolid
|
||||
{
|
||||
public: // with description
|
||||
|
||||
G4USolid(const G4String& pName, VUSolid* shape);
|
||||
// Creates a new shape, with the supplied name. No provision is made
|
||||
// for sharing a common name amongst multiple classes.
|
||||
virtual ~G4USolid();
|
||||
// Default destructor.
|
||||
|
||||
G4bool operator==(const G4USolid& s) const;
|
||||
// Return true only if addresses are the same.
|
||||
|
||||
virtual G4bool CalculateExtent(const EAxis pAxis,
|
||||
const G4VoxelLimits& pVoxelLimit,
|
||||
const G4AffineTransform& pTransform,
|
||||
G4double& pMin, G4double& pMax) const;
|
||||
// Calculate the minimum and maximum extent of the solid, when under the
|
||||
// specified transform, and within the specified limits. If the solid
|
||||
// is not intersected by the region, return false, else return true.
|
||||
|
||||
virtual EInside Inside(const G4ThreeVector& p) const;
|
||||
// Returns kOutside if the point at offset p is outside the shapes
|
||||
// boundaries plus Tolerance/2, kSurface if the point is <= Tolerance/2
|
||||
// from a surface, otherwise kInside.
|
||||
|
||||
virtual G4ThreeVector SurfaceNormal(const G4ThreeVector& p) const;
|
||||
// Returns the outwards pointing unit normal of the shape for the
|
||||
// surface closest to the point at offset p.
|
||||
|
||||
virtual G4double DistanceToIn(const G4ThreeVector& p,
|
||||
const G4ThreeVector& v) const;
|
||||
// Return the distance along the normalised vector v to the shape,
|
||||
// from the point at offset p. If there is no intersection, return
|
||||
// kInfinity. The first intersection resulting from `leaving' a
|
||||
// surface/volume is discarded. Hence, it is tolerant of points on
|
||||
// the surface of the shape.
|
||||
|
||||
virtual G4double DistanceToIn(const G4ThreeVector& p) const;
|
||||
// Calculate the distance to the nearest surface of a shape from an
|
||||
// outside point. The distance can be an underestimate.
|
||||
|
||||
virtual G4double DistanceToOut(const G4ThreeVector& p,
|
||||
const G4ThreeVector& v,
|
||||
const G4bool calcNorm = false,
|
||||
G4bool* validNorm = 0,
|
||||
G4ThreeVector* n = 0) const;
|
||||
// Return the distance along the normalised vector v to the shape,
|
||||
// from a point at an offset p inside or on the surface of the shape.
|
||||
// Intersections with surfaces, when the point is < Tolerance/2 from a
|
||||
// surface must be ignored.
|
||||
// If calcNorm==true:
|
||||
// validNorm set true if the solid lies entirely behind or on the
|
||||
// exiting surface.
|
||||
// n set to exiting outwards normal vector (undefined Magnitude).
|
||||
// validNorm set to false if the solid does not lie entirely behind
|
||||
// or on the exiting surface
|
||||
// If calcNorm==false:
|
||||
// validNorm and n are unused.
|
||||
//
|
||||
// Must be called as solid.DistanceToOut(p,v) or by specifying all
|
||||
// the parameters.
|
||||
|
||||
virtual G4double DistanceToOut(const G4ThreeVector& p) const;
|
||||
// Calculate the distance to the nearest surface of a shape from an
|
||||
// inside point. The distance can be an underestimate.
|
||||
|
||||
virtual void ComputeDimensions(G4VPVParameterisation* p,
|
||||
const G4int n,
|
||||
const G4VPhysicalVolume* pRep);
|
||||
// Throw exception if ComputeDimensions called from an illegal
|
||||
// derived class.
|
||||
|
||||
virtual G4double GetCubicVolume();
|
||||
// Returns an estimation of the solid volume in internal units.
|
||||
// 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.
|
||||
// Note: the computed value is NOT cached.
|
||||
|
||||
virtual G4double GetSurfaceArea();
|
||||
// Return an estimation of the solid surface area in internal units.
|
||||
// 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.
|
||||
// Note: the computed value is NOT cached.
|
||||
|
||||
virtual G4GeometryType GetEntityType() const;
|
||||
// Provide identification of the class of an object.
|
||||
// (required for persistency and STEP interface)
|
||||
|
||||
virtual G4ThreeVector GetPointOnSurface() const;
|
||||
// Returns a random point located on the surface of the solid.
|
||||
|
||||
virtual G4VSolid* Clone() const;
|
||||
// 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.
|
||||
|
||||
virtual std::ostream& StreamInfo(std::ostream& os) const;
|
||||
// Dumps contents of the solid to a stream.
|
||||
|
||||
virtual void DescribeYourselfTo(G4VGraphicsScene& scene) const;
|
||||
// A "double dispatch" function which identifies the solid
|
||||
// to the graphics scene for visualization.
|
||||
|
||||
virtual G4VisExtent GetExtent() const;
|
||||
// Provide extent (bounding box) as possible hint to the graphics view.
|
||||
virtual G4Polyhedron* CreatePolyhedron() const;
|
||||
// Create Polyhedron used for Visualisation
|
||||
virtual G4Polyhedron* GetPolyhedron() const;
|
||||
// Smart access function - creates on request and stores for future
|
||||
// access. A null pointer means "not available".
|
||||
|
||||
public: // without description
|
||||
|
||||
G4USolid(__void__&);
|
||||
// Fake default constructor for usage restricted to direct object
|
||||
// persistency for clients requiring preallocation of memory for
|
||||
// persistifiable objects.
|
||||
|
||||
G4USolid(const G4USolid& rhs);
|
||||
G4USolid& operator=(const G4USolid& rhs);
|
||||
// Copy constructor and assignment operator.
|
||||
|
||||
VUSolid* GetSolid() const
|
||||
{
|
||||
return fShape;
|
||||
}
|
||||
|
||||
protected: // data
|
||||
|
||||
VUSolid* fShape;
|
||||
mutable G4bool fRebuildPolyhedron;
|
||||
mutable G4Polyhedron* fPolyhedron;
|
||||
};
|
||||
|
||||
// Inline implementations
|
||||
|
||||
inline
|
||||
EInside G4USolid::Inside(const G4ThreeVector& p) const
|
||||
{
|
||||
UVector3 pt;
|
||||
VUSolid::EnumInside in_temp;
|
||||
EInside in = kOutside;
|
||||
pt.x() = p.x();
|
||||
pt.y() = p.y();
|
||||
pt.z() = p.z(); // better assign at construction
|
||||
|
||||
in_temp = fShape->Inside(pt);
|
||||
|
||||
if (in_temp == VUSolid::EnumInside::eInside) in = kInside;
|
||||
else if (in_temp == VUSolid::EnumInside::eSurface) in = kSurface;
|
||||
|
||||
return in;
|
||||
}
|
||||
|
||||
inline
|
||||
G4ThreeVector G4USolid::SurfaceNormal(const G4ThreeVector& pt) const
|
||||
{
|
||||
UVector3 p;
|
||||
p.x() = pt.x();
|
||||
p.y() = pt.y();
|
||||
p.z() = pt.z();
|
||||
UVector3 n;
|
||||
fShape->Normal(p, n);
|
||||
return G4ThreeVector(n.x(), n.y(), n.z());
|
||||
}
|
||||
|
||||
inline
|
||||
G4double G4USolid::DistanceToIn(const G4ThreeVector& pt,
|
||||
const G4ThreeVector& d) const
|
||||
{
|
||||
UVector3 p;
|
||||
p.x() = pt.x();
|
||||
p.y() = pt.y();
|
||||
p.z() = pt.z(); // better assign at construction
|
||||
UVector3 v;
|
||||
v.x() = d.x();
|
||||
v.y() = d.y();
|
||||
v.z() = d.z(); // better assign at construction
|
||||
G4double dist = fShape->DistanceToIn(p, v);
|
||||
// return (dist > halfTolerance) ? dist : 0.0;
|
||||
return (dist > kInfinity) ? kInfinity : dist;
|
||||
}
|
||||
|
||||
inline
|
||||
G4double G4USolid::DistanceToIn(const G4ThreeVector& pt) const
|
||||
{
|
||||
UVector3 p;
|
||||
p.x() = pt.x();
|
||||
p.y() = pt.y();
|
||||
p.z() = pt.z(); // better assign at construction
|
||||
G4double dist = fShape->SafetyFromOutside(p); // true?
|
||||
// return (dist > halfTolerance) ? dist : 0.0;
|
||||
return (dist > kInfinity) ? kInfinity : dist;
|
||||
}
|
||||
|
||||
inline
|
||||
G4double G4USolid::DistanceToOut(const G4ThreeVector& pt,
|
||||
const G4ThreeVector& d,
|
||||
const G4bool calcNorm,
|
||||
G4bool* validNorm,
|
||||
G4ThreeVector* norm) const
|
||||
{
|
||||
UVector3 p;
|
||||
p.x() = pt.x();
|
||||
p.y() = pt.y();
|
||||
p.z() = pt.z(); // better assign at construction
|
||||
UVector3 v;
|
||||
v.x() = d.x();
|
||||
v.y() = d.y();
|
||||
v.z() = d.z(); // better assign at construction
|
||||
UVector3 n;
|
||||
G4bool valid;
|
||||
G4double dist = fShape->DistanceToOut(p, v, n, valid); // should use local variable
|
||||
if(calcNorm)
|
||||
{
|
||||
if(valid){ *validNorm = true; }
|
||||
else { *validNorm = false; }
|
||||
if(*validNorm) // *norm = n, but only after calcNorm check
|
||||
{
|
||||
norm->setX(n.x());
|
||||
norm->setY(n.y());
|
||||
norm->setZ(n.z());
|
||||
}
|
||||
}
|
||||
// return (dist > halfTolerance) ? dist : 0.0;
|
||||
return (dist > kInfinity) ? kInfinity : dist;
|
||||
}
|
||||
|
||||
inline
|
||||
G4double G4USolid::DistanceToOut(const G4ThreeVector& pt) const
|
||||
{
|
||||
UVector3 p;
|
||||
p.x() = pt.x();
|
||||
p.y() = pt.y();
|
||||
p.z() = pt.z(); // better assign at construction
|
||||
G4double dist = fShape->SafetyFromInside(p); // true?
|
||||
// return (dist > halfTolerance) ? dist : 0.0;
|
||||
return dist;
|
||||
}
|
||||
|
||||
inline
|
||||
G4double G4USolid::GetCubicVolume()
|
||||
{
|
||||
return fShape->Capacity();
|
||||
}
|
||||
|
||||
inline
|
||||
G4double G4USolid::GetSurfaceArea()
|
||||
{
|
||||
return fShape->SurfaceArea();
|
||||
}
|
||||
|
||||
inline
|
||||
G4ThreeVector G4USolid::GetPointOnSurface() const
|
||||
{
|
||||
UVector3 p;
|
||||
p = fShape->GetPointOnSurface();
|
||||
return G4ThreeVector(p.x(), p.y(), p.z());
|
||||
}
|
||||
|
||||
#endif // G4GEOM_USE_USOLIDS
|
||||
|
||||
#endif
|
||||
@@ -11,7 +11,7 @@
|
||||
#
|
||||
# Generated on : 24/9/2010
|
||||
#
|
||||
# $Id: sources.cmake 104304 2017-05-24 08:57:31Z gcosmo $
|
||||
# $Id: sources.cmake 106604 2017-10-16 09:18:30Z gcosmo $
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
@@ -70,7 +70,6 @@ GEANT4_DEFINE_MODULE(NAME G4geometrymng
|
||||
G4SolidStore.hh
|
||||
G4TouchableHandle.hh
|
||||
G4UAdapter.hh
|
||||
G4USolid.hh
|
||||
G4VCurvedTrajectoryFilter.hh
|
||||
G4VNestedParameterisation.hh
|
||||
G4VPVDivisionFactory.hh
|
||||
@@ -113,7 +112,6 @@ GEANT4_DEFINE_MODULE(NAME G4geometrymng
|
||||
G4SmartVoxelProxy.cc
|
||||
G4SmartVoxelStat.cc
|
||||
G4SolidStore.cc
|
||||
G4USolid.cc
|
||||
G4VCurvedTrajectoryFilter.cc
|
||||
G4VNestedParameterisation.cc
|
||||
G4VPVDivisionFactory.cc
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4ErrorPlaneSurfaceTarget.cc 66356 2012-12-18 09:02:32Z gcosmo $
|
||||
// $Id: G4ErrorPlaneSurfaceTarget.cc 107408 2017-11-10 13:35:09Z gcosmo $
|
||||
//
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
@@ -148,8 +148,7 @@ G4double G4ErrorPlaneSurfaceTarget::
|
||||
GetDistanceFromPoint( const G4ThreeVector& pt ) const
|
||||
{
|
||||
G4ThreeVector vec = point() - pt;
|
||||
G4double alpha = std::acos( vec * normal() / vec.mag() / normal().mag() );
|
||||
G4double dist = std::fabs(vec.mag() * std::cos( alpha ));
|
||||
G4double dist = std::fabs(vec * normal() / normal().mag());
|
||||
|
||||
#ifdef G4VERBOSE
|
||||
if(G4ErrorPropagatorData::verbose() >= 3 )
|
||||
|
||||
@@ -144,6 +144,26 @@ G4bool G4GeomTools::PointInTriangle(const G4TwoVector& A,
|
||||
return true;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Point inside 2D polygon
|
||||
|
||||
G4bool G4GeomTools::PointInPolygon(const G4TwoVector& p,
|
||||
const G4TwoVectorList& v)
|
||||
{
|
||||
G4int Nv = v.size();
|
||||
G4bool in = false;
|
||||
for (G4int i = 0, k = Nv - 1; i < Nv; k = i++)
|
||||
{
|
||||
if ((v[i].y() > p.y()) != (v[k].y() > p.y()))
|
||||
{
|
||||
G4double ctg = (v[k].x()-v[i].x())/(v[k].y()-v[i].y());
|
||||
in ^= (p.x() < (p.y()-v[i].y())*ctg + v[i].x());
|
||||
}
|
||||
}
|
||||
return in;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Detemine whether 2D polygon is convex or not
|
||||
|
||||
@@ -1,206 +0,0 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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:$
|
||||
// GEANT4 tag $Name:$
|
||||
//
|
||||
//
|
||||
// G4USolid implementation
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
#include "G4USolid.hh"
|
||||
|
||||
#if ( defined(G4GEOM_USE_USOLIDS) || defined(G4GEOM_USE_PARTIAL_USOLIDS) )
|
||||
|
||||
#include "G4AffineTransform.hh"
|
||||
#include "G4VoxelLimits.hh"
|
||||
#include "G4VGraphicsScene.hh"
|
||||
#include "G4Polyhedron.hh"
|
||||
#include "G4VisExtent.hh"
|
||||
#include "G4PhysicalConstants.hh"
|
||||
#include "G4GeometryTolerance.hh"
|
||||
#include "G4BoundingEnvelope.hh"
|
||||
|
||||
#include "G4AutoLock.hh"
|
||||
|
||||
namespace
|
||||
{
|
||||
G4Mutex polyhedronMutex = G4MUTEX_INITIALIZER;
|
||||
}
|
||||
|
||||
G4USolid::G4USolid(const G4String& name, VUSolid* s) :
|
||||
G4VSolid(name), fShape(s), fRebuildPolyhedron(false), fPolyhedron(0)
|
||||
{
|
||||
}
|
||||
|
||||
G4USolid::G4USolid(__void__& a)
|
||||
: G4VSolid(a), fShape(0), fRebuildPolyhedron(false), fPolyhedron(0)
|
||||
{
|
||||
}
|
||||
|
||||
G4USolid::~G4USolid()
|
||||
{
|
||||
delete fPolyhedron; fPolyhedron = 0;
|
||||
}
|
||||
|
||||
G4bool G4USolid::operator==(const G4USolid& s) const
|
||||
{
|
||||
return (this == &s) ? true : false;
|
||||
}
|
||||
|
||||
void G4USolid::ComputeDimensions(G4VPVParameterisation*,
|
||||
const G4int,
|
||||
const G4VPhysicalVolume*)
|
||||
{
|
||||
std::ostringstream message;
|
||||
message << "Illegal call to G4USolid::ComputeDimensions()" << G4endl
|
||||
<< "Method not overloaded by derived class !";
|
||||
G4Exception("G4USolid::ComputeDimensions()", "GeomSolids0003",
|
||||
FatalException, message);
|
||||
}
|
||||
|
||||
void G4USolid::DescribeYourselfTo(G4VGraphicsScene& scene) const
|
||||
{
|
||||
scene.AddSolid(*this);
|
||||
}
|
||||
|
||||
G4GeometryType G4USolid::GetEntityType() const
|
||||
{
|
||||
|
||||
G4String string = fShape->GetEntityType();
|
||||
return "G4" + string;
|
||||
}
|
||||
|
||||
std::ostream& G4USolid::StreamInfo(std::ostream& os) const
|
||||
{
|
||||
return fShape->StreamInfo(os);
|
||||
}
|
||||
|
||||
G4USolid::G4USolid(const G4USolid& rhs)
|
||||
: G4VSolid(rhs), fRebuildPolyhedron(false), fPolyhedron(0)
|
||||
{
|
||||
fShape = rhs.fShape->Clone();
|
||||
}
|
||||
|
||||
G4USolid& G4USolid::operator=(const G4USolid& rhs)
|
||||
{
|
||||
// Check assignment to self
|
||||
//
|
||||
if (this == &rhs)
|
||||
{
|
||||
return *this;
|
||||
}
|
||||
|
||||
// Copy base class data
|
||||
//
|
||||
G4VSolid::operator=(rhs);
|
||||
|
||||
// Copy data
|
||||
//
|
||||
fShape = rhs.fShape->Clone();
|
||||
fRebuildPolyhedron = false;
|
||||
delete fPolyhedron; fPolyhedron = 0;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
G4VSolid* G4USolid::Clone() const
|
||||
{
|
||||
std::ostringstream message;
|
||||
message << "Clone() method not implemented for type: "
|
||||
<< GetEntityType() << "!" << G4endl
|
||||
<< "Returning NULL pointer!";
|
||||
G4Exception("G4USolid::Clone()", "GeomSolids1001", JustWarning, message);
|
||||
return 0;
|
||||
}
|
||||
|
||||
G4bool G4USolid::CalculateExtent(const EAxis pAxis,
|
||||
const G4VoxelLimits& pVoxelLimit,
|
||||
const G4AffineTransform& pTransform,
|
||||
G4double& pMin, G4double& pMax) const
|
||||
{
|
||||
UVector3 vmin, vmax;
|
||||
fShape->Extent(vmin,vmax);
|
||||
G4ThreeVector bmin(vmin.x(),vmin.y(),vmin.z());
|
||||
G4ThreeVector bmax(vmax.x(),vmax.y(),vmax.z());
|
||||
|
||||
// Check correctness of the bounding box
|
||||
//
|
||||
if (bmin.x() >= bmax.x() || bmin.y() >= bmax.y() || bmin.z() >= bmax.z())
|
||||
{
|
||||
std::ostringstream message;
|
||||
message << "Bad bounding box (min >= max) for solid: "
|
||||
<< GetName() << " - " << GetEntityType() << " !"
|
||||
<< "\nmin = " << bmin
|
||||
<< "\nmax = " << bmax;
|
||||
G4Exception("G4USolid::CalculateExtent()", "GeomMgt0001",
|
||||
JustWarning, message);
|
||||
StreamInfo(G4cout);
|
||||
}
|
||||
|
||||
G4BoundingEnvelope bbox(bmin,bmax);
|
||||
return bbox.CalculateExtent(pAxis,pVoxelLimit,pTransform,pMin,pMax);
|
||||
}
|
||||
|
||||
G4Polyhedron* G4USolid::CreatePolyhedron() const
|
||||
{
|
||||
// Must be implemented in concrete wrappers...
|
||||
|
||||
std::ostringstream message;
|
||||
message << "Visualization not supported for USolid shape "
|
||||
<< GetEntityType() << "... Sorry!" << G4endl;
|
||||
G4Exception("G4USolid::CreatePolyhedron()", "GeomSolids0003",
|
||||
FatalException, message);
|
||||
return 0;
|
||||
}
|
||||
|
||||
G4Polyhedron* G4USolid::GetPolyhedron() const
|
||||
{
|
||||
if (!fPolyhedron ||
|
||||
fRebuildPolyhedron ||
|
||||
fPolyhedron->GetNumberOfRotationStepsAtTimeOfCreation() !=
|
||||
fPolyhedron->GetNumberOfRotationSteps())
|
||||
{
|
||||
G4AutoLock l(&polyhedronMutex);
|
||||
delete fPolyhedron;
|
||||
fPolyhedron = CreatePolyhedron();
|
||||
fRebuildPolyhedron = false;
|
||||
l.unlock();
|
||||
}
|
||||
return fPolyhedron;
|
||||
}
|
||||
|
||||
G4VisExtent G4USolid::GetExtent() const
|
||||
{
|
||||
UVector3 vmin, vmax;
|
||||
fShape->Extent(vmin,vmax);
|
||||
return G4VisExtent(vmin.x(),vmax.x(),
|
||||
vmin.y(),vmax.y(),
|
||||
vmin.z(),vmax.z());
|
||||
}
|
||||
|
||||
#endif // G4GEOM_USE_USOLIDS
|
||||
Reference in New Issue
Block a user