Import Geant4 10.4.0.beta source tree

This commit is contained in:
Gabriele Cosmo
2017-06-30 10:49:55 +02:00
parent 3a5407696b
commit 1a1316fea4
2180 changed files with 237880 additions and 59109 deletions
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4Ellipsoid.hh 100819 2016-11-02 15:17:36Z gcosmo $
// $Id: G4Ellipsoid.hh 104316 2017-05-24 13:04:23Z gcosmo $
//
//
// --------------------------------------------------------------------
@@ -86,7 +86,7 @@ class G4Ellipsoid : public G4VSolid
const G4int n,
const G4VPhysicalVolume* pRep);
void Extent(G4ThreeVector& pMin, G4ThreeVector& pMax) const;
void BoundingLimits(G4ThreeVector& pMin, G4ThreeVector& pMax) const;
G4bool CalculateExtent(const EAxis pAxis,
const G4VoxelLimits& pVoxelLimit,
const G4AffineTransform& pTransform,
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4EllipticalCone.hh 100819 2016-11-02 15:17:36Z gcosmo $
// $Id: G4EllipticalCone.hh 104316 2017-05-24 13:04:23Z gcosmo $
//
//
// --------------------------------------------------------------------
@@ -104,12 +104,12 @@ class G4EllipticalCone : public G4VSolid
inline void SetSemiAxis (G4double x, G4double y, G4double z);
inline void SetZCut (G4double newzTopCut);
inline G4double GetCubicVolume();
inline G4double GetSurfaceArea();
G4double GetCubicVolume();
G4double GetSurfaceArea();
// Solid standard methods
//
void Extent(G4ThreeVector& pMin, G4ThreeVector& pMax) const;
void BoundingLimits(G4ThreeVector& pMin, G4ThreeVector& pMax) const;
G4bool CalculateExtent(const EAxis pAxis,
const G4VoxelLimits& pVoxelLimit,
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4EllipticalCone.icc 83572 2014-09-01 15:23:27Z gcosmo $
// $Id: G4EllipticalCone.icc 102864 2017-02-27 14:22:02Z gcosmo $
//
//
// --------------------------------------------------------------------
@@ -89,31 +89,3 @@ void G4EllipticalCone::SetZCut (G4double newzTopCut)
{ zTopCut = newzTopCut; }
fRebuildPolyhedron = true;
}
inline
G4double G4EllipticalCone::GetCubicVolume()
{
if(fCubicVolume != 0 ) {;}
else
{
if (zTopCut > +zheight )
{
fCubicVolume = (8./3.)*CLHEP::pi*xSemiAxis*
ySemiAxis*zheight*zheight*zheight;
}
else
{
fCubicVolume = CLHEP::pi*xSemiAxis*ySemiAxis*
(2./3.*std::pow(zTopCut,3.)+2.*sqr(zheight)*zTopCut);
}
}
return fCubicVolume;
}
inline
G4double G4EllipticalCone::GetSurfaceArea()
{
if(fSurfaceArea != 0.) {;}
else { fSurfaceArea = G4VSolid::GetSurfaceArea(); }
return fSurfaceArea;
}
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4EllipticalTube.hh 99781 2016-10-05 10:18:54Z gcosmo $
// $Id: G4EllipticalTube.hh 104316 2017-05-24 13:04:23Z gcosmo $
//
// --------------------------------------------------------------------
// GEANT 4 class header file
@@ -66,7 +66,7 @@ class G4EllipticalTube : public G4VSolid
// Standard solid methods
void Extent(G4ThreeVector& pMin, G4ThreeVector& pMax) const;
void BoundingLimits(G4ThreeVector& pMin, G4ThreeVector& pMax) const;
G4bool CalculateExtent( const EAxis pAxis,
const G4VoxelLimits& pVoxelLimit,
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4ExtrudedSolid.hh 100819 2016-11-02 15:17:36Z gcosmo $
// $Id: G4ExtrudedSolid.hh 104316 2017-05-24 13:04:23Z gcosmo $
//
//
// --------------------------------------------------------------------
@@ -130,7 +130,7 @@ class G4ExtrudedSolid : public G4TessellatedSolid
const G4bool calcNorm=false,
G4bool *validNorm=0, G4ThreeVector *n=0) const;
G4double DistanceToOut (const G4ThreeVector &p) const;
void Extent(G4ThreeVector& pMin, G4ThreeVector& pMax) const;
void BoundingLimits(G4ThreeVector& pMin, G4ThreeVector& pMax) const;
G4bool CalculateExtent(const EAxis pAxis,
const G4VoxelLimits& pVoxelLimit,
const G4AffineTransform& pTransform,
@@ -87,7 +87,7 @@ class G4GenericPolycone : public G4VCSGfaceted
G4double DistanceToIn( const G4ThreeVector &p, const G4ThreeVector &v ) const;
G4double DistanceToIn( const G4ThreeVector &p ) const;
void Extent(G4ThreeVector& pMin, G4ThreeVector& pMax) const;
void BoundingLimits(G4ThreeVector& pMin, G4ThreeVector& pMax) const;
G4bool CalculateExtent(const EAxis pAxis,
const G4VoxelLimits& pVoxelLimit,
const G4AffineTransform& pTransform,
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4GenericTrap.hh 99781 2016-10-05 10:18:54Z gcosmo $
// $Id: G4GenericTrap.hh 104316 2017-05-24 13:04:23Z gcosmo $
//
//
// --------------------------------------------------------------------
@@ -120,7 +120,7 @@ class G4GenericTrap : public G4VSolid
G4bool *validNorm = 0,
G4ThreeVector *n = 0) const;
G4double DistanceToOut(const G4ThreeVector& p) const;
void Extent(G4ThreeVector& pMin, G4ThreeVector& pMax) const;
void BoundingLimits(G4ThreeVector& pMin, G4ThreeVector& pMax) const;
G4bool CalculateExtent(const EAxis pAxis,
const G4VoxelLimits& pVoxelLimit,
const G4AffineTransform& pTransform,
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4Hype.hh 100819 2016-11-02 15:17:36Z gcosmo $
// $Id: G4Hype.hh 104316 2017-05-24 13:04:23Z gcosmo $
// $Original: G4Hype.hh,v 1.0 1998/06/09 16:57:50 safai Exp $
//
//
@@ -81,7 +81,7 @@ class G4Hype : public G4VSolid
const G4int n,
const G4VPhysicalVolume* pRep);
void Extent(G4ThreeVector& pMin, G4ThreeVector& pMax) const;
void BoundingLimits(G4ThreeVector& pMin, G4ThreeVector& pMax) const;
G4bool CalculateExtent(const EAxis pAxis,
const G4VoxelLimits& pVoxelLimit,
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4Paraboloid.hh 100819 2016-11-02 15:17:36Z gcosmo $
// $Id: G4Paraboloid.hh 104316 2017-05-24 13:04:23Z gcosmo $
//
//
// --------------------------------------------------------------------
@@ -104,7 +104,7 @@ class G4Paraboloid : public G4VSolid
//void ComputeDimensions( G4VPVParamerisation p,
// const G4Int n,
// const G4VPhysicalVolume* pRep );
void Extent(G4ThreeVector& pMin, G4ThreeVector& pMax) const;
void BoundingLimits(G4ThreeVector& pMin, G4ThreeVector& pMax) const;
G4bool CalculateExtent(const EAxis pAxis,
const G4VoxelLimits& pVoxelLimit,
const G4AffineTransform& pTransform,
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4Polycone.hh 100819 2016-11-02 15:17:36Z gcosmo $
// $Id: G4Polycone.hh 104316 2017-05-24 13:04:23Z gcosmo $
//
//
// --------------------------------------------------------------------
@@ -107,7 +107,7 @@ class G4Polycone : public G4VCSGfaceted
G4double DistanceToIn( const G4ThreeVector &p, const G4ThreeVector &v ) const;
G4double DistanceToIn( const G4ThreeVector &p ) const;
void Extent(G4ThreeVector& pMin, G4ThreeVector& pMax) const;
void BoundingLimits(G4ThreeVector& pMin, G4ThreeVector& pMax) const;
G4bool CalculateExtent(const EAxis pAxis,
const G4VoxelLimits& pVoxelLimit,
const G4AffineTransform& pTransform,
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4Polyhedra.hh 100819 2016-11-02 15:17:36Z gcosmo $
// $Id: G4Polyhedra.hh 104316 2017-05-24 13:04:23Z gcosmo $
//
//
// --------------------------------------------------------------------
@@ -108,7 +108,7 @@ class G4Polyhedra : public G4VCSGfaceted
const G4ThreeVector &v ) const;
G4double DistanceToIn( const G4ThreeVector &p ) const;
void Extent(G4ThreeVector& pMin, G4ThreeVector& pMax) const;
void BoundingLimits(G4ThreeVector& pMin, G4ThreeVector& pMax) const;
G4bool CalculateExtent(const EAxis pAxis,
const G4VoxelLimits& pVoxelLimit,
const G4AffineTransform& pTransform,
@@ -31,22 +31,20 @@
#define G4SOLIDSWORKSPACEPOOL_HH
class G4SolidsWorkspace;
// #include "G4SolidsWorkspace.hh"
//Note: Investigate potential to make it a template - on the workspace type
class G4SolidsWorkspacePool
{
public:
static G4SolidsWorkspacePool* GetInstance();
// For use with simple MT mode - each thread gets a workspace and uses it until end
G4SolidsWorkspace* CreateWorkspace();
// For use with simple MT mode - each thread gets a workspace
// and uses it until end
void CreateAndUseWorkspace(); // Create it (as above) and use it
// For use with 'dynamic' model of threading - workspaces can be recycled
G4SolidsWorkspace* FindOrCreateWorkspace();
// For use with 'dynamic' model of threading - workspaces can be recycled
// Reuse an existing workspace - or create a new one if needed.
// This will never fail, except if system is out of resources
@@ -60,8 +58,6 @@ class G4SolidsWorkspacePool
// To be called once at the end of the job
protected:
void ReleaseAndDestroyWorkspace(G4SolidsWorkspace*);
// Destroy workspace - after releasing it
// void RegisterWarehouse( G4GeometryWarehouse *) ;
// The (optional) warehouse keeps a list of free workspaces
@@ -73,7 +69,7 @@ class G4SolidsWorkspacePool
private:
static G4SolidsWorkspacePool* thePool;
static G4ThreadLocal G4SolidsWorkspace* fMyWorkspace;
static G4ThreadLocal G4SolidsWorkspace* fMyWorkspace;
// The thread's workspace - if assigned.
};
@@ -24,7 +24,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4TessellatedSolid.hh 100819 2016-11-02 15:17:36Z gcosmo $
// $Id: G4TessellatedSolid.hh 104316 2017-05-24 13:04:23Z gcosmo $
//
// %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
//
@@ -106,7 +106,7 @@
#include "G4VSolid.hh"
#include "G4Types.hh"
#include "G4SurfaceVoxelizer.hh"
#include "G4Voxelizer.hh"
struct G4VertexInfo
{
@@ -180,14 +180,14 @@ class G4TessellatedSolid : public G4VSolid
inline void SetMaxVoxels(G4int max);
inline G4SurfaceVoxelizer &GetVoxels();
inline G4Voxelizer &GetVoxels();
virtual G4bool CalculateExtent(const EAxis pAxis,
const G4VoxelLimits& pVoxelLimit,
const G4AffineTransform& pTransform,
G4double& pMin, G4double& pMax) const;
void Extent(G4ThreeVector& pMin, G4ThreeVector& pMax) const;
void BoundingLimits(G4ThreeVector& pMin, G4ThreeVector& pMax) const;
G4double GetMinXExtent () const;
G4double GetMaxXExtent () const;
@@ -291,7 +291,7 @@ class G4TessellatedSolid : public G4VSolid
G4int fMaxTries;
G4SurfaceVoxelizer fVoxels; // Pointer to the voxelized solid
G4Voxelizer fVoxels; // Pointer to the voxelized solid
G4SurfBits fInsides;
};
@@ -310,7 +310,7 @@ inline void G4TessellatedSolid::SetMaxVoxels(G4int max)
fVoxels.SetMaxVoxels(max);
}
inline G4SurfaceVoxelizer &G4TessellatedSolid::GetVoxels()
inline G4Voxelizer &G4TessellatedSolid::GetVoxels()
{
return fVoxels;
}
@@ -28,7 +28,7 @@
// ********************************************************************
//
//
// $Id: G4Tet.hh 99781 2016-10-05 10:18:54Z gcosmo $
// $Id: G4Tet.hh 104316 2017-05-24 13:04:23Z gcosmo $
//
//
// --------------------------------------------------------------------
@@ -47,7 +47,7 @@
// 10.02.2005 - D.Anninos (CERN) - Added GetPointOnSurface() method.
// 12.11.2006 - M.H.Mendenhall - Added GetSurfaceArea() concrete implementation.
// 20.09.2010 - G.Cosmo (CERN) - Added copy-ctor and operator=().
// 24.09.2016 - E.Tcherniaev - Added Extent(), removed CreateRotatedVertices().
// 24.09.2016 - E.Tcherniaev - Removed CreateRotatedVertices().
// --------------------------------------------------------------------
#ifndef G4TET_HH
#define G4TET_HH
@@ -81,7 +81,7 @@ class G4Tet : public G4VSolid
const G4int n,
const G4VPhysicalVolume* pRep);
void Extent(G4ThreeVector& pMin, G4ThreeVector& pMax) const;
void BoundingLimits(G4ThreeVector& pMin, G4ThreeVector& pMax) const;
G4bool CalculateExtent(const EAxis pAxis,
const G4VoxelLimits& pVoxelLimit,
@@ -133,7 +133,7 @@ class G4Tet : public G4VSolid
// Copy constructor and assignment operator.
const char* CVSHeaderVers()
{ return "$Id: G4Tet.hh 99781 2016-10-05 10:18:54Z gcosmo $"; }
{ return "$Id: G4Tet.hh 104316 2017-05-24 13:04:23Z gcosmo $"; }
const char* CVSFileVers()
{ return CVSVers; }
void PrintWarnings(G4bool flag)
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4TwistedTubs.hh 100819 2016-11-02 15:17:36Z gcosmo $
// $Id: G4TwistedTubs.hh 104316 2017-05-24 13:04:23Z gcosmo $
//
//
// --------------------------------------------------------------------
@@ -104,7 +104,7 @@ class G4TwistedTubs : public G4VSolid
const G4int /* n */ ,
const G4VPhysicalVolume * /* prep */ );
void Extent(G4ThreeVector& pMin, G4ThreeVector& pMax) const;
void BoundingLimits(G4ThreeVector& pMin, G4ThreeVector& pMax) const;
G4bool CalculateExtent(const EAxis pAxis,
const G4VoxelLimits &pVoxelLimit,
@@ -106,7 +106,7 @@ class G4UExtrudedSolid : public G4USolid
G4UExtrudedSolid &operator=(const G4UExtrudedSolid& source);
// Copy constructor and assignment operator.
void Extent(G4ThreeVector& pMin, G4ThreeVector& pMax) const;
void BoundingLimits(G4ThreeVector& pMin, G4ThreeVector& pMax) const;
G4bool CalculateExtent(const EAxis pAxis,
const G4VoxelLimits& pVoxelLimit,
const G4AffineTransform& pTransform,
@@ -88,7 +88,7 @@ class G4UGenericPolycone : public G4USolid
G4UGenericPolycone &operator=(const G4UGenericPolycone& source);
// Copy constructor and assignment operator.
void Extent(G4ThreeVector& pMin, G4ThreeVector& pMax) const;
void BoundingLimits(G4ThreeVector& pMin, G4ThreeVector& pMax) const;
G4bool CalculateExtent(const EAxis pAxis,
const G4VoxelLimits& pVoxelLimit,
@@ -43,17 +43,20 @@
#ifndef G4UGENERICTRAP_hh
#define G4UGENERICTRAP_hh
#include "G4USolid.hh"
#include "G4UAdapter.hh"
#if ( defined(G4GEOM_USE_USOLIDS) || defined(G4GEOM_USE_PARTIAL_USOLIDS) )
#include "UGenericTrap.hh"
#include <volumes/UnplacedGenTrap.h>
#include "G4TwoVector.hh"
#include "G4Polyhedron.hh"
class G4UGenericTrap : public G4USolid
class G4UGenericTrap : public G4UAdapter<vecgeom::UnplacedGenTrap>
{
using Shape_t = vecgeom::UnplacedGenTrap;
using Base_t = G4UAdapter<vecgeom::UnplacedGenTrap>;
public: // with description
G4UGenericTrap(const G4String& name, G4double halfZ,
@@ -61,8 +64,6 @@ class G4UGenericTrap : public G4USolid
~G4UGenericTrap();
inline UGenericTrap* GetShape() const;
G4double GetZHalfLength() const;
G4int GetNofVertices() const;
G4TwoVector GetVertex(G4int index) const;
@@ -72,6 +73,7 @@ class G4UGenericTrap : public G4USolid
G4int GetVisSubdivisions() const;
void SetVisSubdivisions(G4int subdiv);
void SetZHalfLength(G4double);
void Initialise(const std::vector<G4TwoVector>& v);
inline G4GeometryType GetEntityType() const;
@@ -86,7 +88,7 @@ class G4UGenericTrap : public G4USolid
G4UGenericTrap &operator=(const G4UGenericTrap& source);
// Copy constructor and assignment operator.
void Extent(G4ThreeVector& pMin, G4ThreeVector& pMax) const;
void BoundingLimits(G4ThreeVector& pMin, G4ThreeVector& pMax) const;
G4bool CalculateExtent(const EAxis pAxis,
const G4VoxelLimits& pVoxelLimit,
@@ -94,17 +96,18 @@ class G4UGenericTrap : public G4USolid
G4double& pMin, G4double& pMax) const;
G4Polyhedron* CreatePolyhedron() const;
private:
G4int fVisSubdivisions;
std::vector<G4TwoVector> fVertices;
};
// --------------------------------------------------------------------
// Inline methods
// --------------------------------------------------------------------
inline UGenericTrap* G4UGenericTrap::GetShape() const
{
return (UGenericTrap*) fShape;
}
inline G4GeometryType G4UGenericTrap::GetEntityType() const
{
return "G4GenericTrap";
@@ -43,16 +43,18 @@
#ifndef G4UPARABOLOID_HH
#define G4UPARABOLOID_HH
#include "G4USolid.hh"
#include "G4UAdapter.hh"
#if ( defined(G4GEOM_USE_USOLIDS) || defined(G4GEOM_USE_PARTIAL_USOLIDS) )
#include "UParaboloid.hh"
#include <volumes/UnplacedParaboloid.h>
#include "G4Polyhedron.hh"
class G4UParaboloid : public G4USolid
class G4UParaboloid : public G4UAdapter<vecgeom::UnplacedParaboloid>
{
using Shape_t = vecgeom::UnplacedParaboloid;
using Base_t = G4UAdapter<vecgeom::UnplacedParaboloid>;
public: // with description
@@ -63,12 +65,14 @@ class G4UParaboloid : public G4USolid
G4VSolid* Clone() const;
inline UParaboloid* GetShape() const;
G4double GetZHalfLength() const;
G4double GetRadiusMinusZ() const;
G4double GetRadiusPlusZ() const;
void SetZHalfLength(G4double dz);
void SetRadiusMinusZ(G4double r1);
void SetRadiusPlusZ(G4double r2);
inline G4GeometryType GetEntityType() const;
public: // without description
@@ -82,7 +86,7 @@ class G4UParaboloid : public G4USolid
G4UParaboloid &operator=( const G4UParaboloid &source );
// Copy constructor and assignment operator.
void Extent(G4ThreeVector& pMin, G4ThreeVector& pMax) const;
void BoundingLimits(G4ThreeVector& pMin, G4ThreeVector& pMax) const;
G4bool CalculateExtent(const EAxis pAxis,
const G4VoxelLimits& pVoxelLimit,
const G4AffineTransform& pTransform,
@@ -94,11 +98,6 @@ class G4UParaboloid : public G4USolid
// Inline methods
// --------------------------------------------------------------------
inline UParaboloid* G4UParaboloid::GetShape() const
{
return (UParaboloid*) fShape;
}
inline G4GeometryType G4UParaboloid::GetEntityType() const
{
return "G4Paraboloid";
@@ -43,18 +43,21 @@
#ifndef G4UPOLYCONE_HH
#define G4UPOLYCONE_HH
#include "G4USolid.hh"
#include "G4UAdapter.hh"
#if ( defined(G4GEOM_USE_USOLIDS) || defined(G4GEOM_USE_PARTIAL_USOLIDS) )
#include "UPolycone.hh"
#include <volumes/UnplacedPolycone.h>
#include "G4TwoVector.hh"
#include "G4PolyconeSide.hh"
#include "G4PolyconeHistorical.hh"
#include "G4Polyhedron.hh"
class G4UPolycone : public G4USolid
class G4UPolycone : public G4UAdapter<vecgeom::UnplacedPolycone>
{
using Shape_t = vecgeom::UnplacedPolycone;
using Base_t = G4UAdapter<vecgeom::UnplacedPolycone>;
public: // with description
@@ -81,9 +84,8 @@ class G4UPolycone : public G4USolid
G4VSolid* Clone() const;
inline UPolycone* GetShape() const;
G4double GetStartPhi() const;
G4double GetDeltaPhi() const;
G4double GetEndPhi() const;
G4double GetSinStartPhi() const;
G4double GetCosStartPhi() const;
@@ -110,7 +112,7 @@ class G4UPolycone : public G4USolid
G4UPolycone &operator=( const G4UPolycone &source );
// Copy constructor and assignment operator.
void Extent(G4ThreeVector& pMin, G4ThreeVector& pMax) const;
void BoundingLimits(G4ThreeVector& pMin, G4ThreeVector& pMax) const;
G4bool CalculateExtent(const EAxis pAxis,
const G4VoxelLimits& pVoxelLimit,
@@ -119,6 +121,13 @@ class G4UPolycone : public G4USolid
G4Polyhedron* CreatePolyhedron() const;
protected:
void SetOriginalParameters();
G4bool fGenericPcon; // true if created through the 2nd generic constructor
G4PolyconeHistorical fOriginalParameters; // original input parameters
private:
G4double wrStart;
@@ -130,11 +139,6 @@ class G4UPolycone : public G4USolid
// Inline methods
// --------------------------------------------------------------------
inline UPolycone* G4UPolycone::GetShape() const
{
return (UPolycone*) fShape;
}
inline G4GeometryType G4UPolycone::GetEntityType() const
{
return "G4Polycone";
@@ -43,11 +43,12 @@
#ifndef G4UPOLYHEDRA_HH
#define G4UPOLYHEDRA_HH
#include "G4USolid.hh"
#include "G4UAdapter.hh"
#if ( defined(G4GEOM_USE_USOLIDS) || defined(G4GEOM_USE_PARTIAL_USOLIDS) )
#include "UPolyhedra.hh"
#include <volumes/UnplacedPolyhedron.h>
#include "G4TwoVector.hh"
#include "G4PolyhedraSide.hh"
#include "G4PolyhedraHistorical.hh"
@@ -56,8 +57,11 @@
class G4EnclosingCylinder;
class G4ReduciblePolygon;
class G4UPolyhedra : public G4USolid
class G4UPolyhedra : public G4UAdapter<vecgeom::UnplacedPolyhedron>
{
using Shape_t = vecgeom::UnplacedPolyhedron;
using Base_t = G4UAdapter<vecgeom::UnplacedPolyhedron>;
public: // with description
G4UPolyhedra( const G4String& name,
@@ -85,8 +89,6 @@ class G4UPolyhedra : public G4USolid
G4VSolid* Clone() const;
inline UPolyhedra* GetShape() const;
G4int GetNumSide() const;
G4double GetStartPhi() const;
G4double GetEndPhi() const;
@@ -116,7 +118,7 @@ class G4UPolyhedra : public G4USolid
G4UPolyhedra &operator=( const G4UPolyhedra &source );
// Copy constructor and assignment operator.
void Extent(G4ThreeVector& pMin, G4ThreeVector& pMax) const;
void BoundingLimits(G4ThreeVector& pMin, G4ThreeVector& pMax) const;
G4bool CalculateExtent(const EAxis pAxis,
const G4VoxelLimits& pVoxelLimit,
@@ -125,6 +127,13 @@ class G4UPolyhedra : public G4USolid
G4Polyhedron* CreatePolyhedron() const;
protected:
void SetOriginalParameters();
G4bool fGenericPgon; // true if created through the 2nd generic constructor
G4PolyhedraHistorical fOriginalParameters; // original input parameters
private:
G4double wrStart;
@@ -137,11 +146,6 @@ class G4UPolyhedra : public G4USolid
// Inline methods
// --------------------------------------------------------------------
inline UPolyhedra* G4UPolyhedra::GetShape() const
{
return (UPolyhedra*) fShape;
}
inline G4GeometryType G4UPolyhedra::GetEntityType() const
{
return "G4Polyhedra";
@@ -83,7 +83,7 @@ class G4UTet : public G4USolid
G4UTet& operator=(const G4UTet& rhs);
// Copy constructor and assignment operator.
void Extent(G4ThreeVector& pMin, G4ThreeVector& pMax) const;
void BoundingLimits(G4ThreeVector& pMin, G4ThreeVector& pMax) const;
G4bool CalculateExtent(const EAxis pAxis,
const G4VoxelLimits& pVoxelLimit,
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4VTwistedFaceted.hh 99781 2016-10-05 10:18:54Z gcosmo $
// $Id: G4VTwistedFaceted.hh 104316 2017-05-24 13:04:23Z gcosmo $
//
// --------------------------------------------------------------------
// GEANT 4 class header file
@@ -79,7 +79,7 @@ class G4VTwistedFaceted: public G4VSolid
const G4int,
const G4VPhysicalVolume* );
virtual void Extent(G4ThreeVector &pMin, G4ThreeVector &pMax) const;
virtual void BoundingLimits(G4ThreeVector &pMin, G4ThreeVector &pMax) const;
virtual G4bool CalculateExtent(const EAxis pAxis,
const G4VoxelLimits &pVoxelLimit,
@@ -0,0 +1,270 @@
//
// ********************************************************************
// * 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:$
//
// --------------------------------------------------------------------
// GEANT 4 class header file
//
// G4Voxelizer
//
// Class description:
//
// Voxelizer for tessellated surfaces and solids positioning in 3D space,
// used in G4TessellatedSolid and G4MultiUnion.
// History:
// 19.10.12 Marek Gayer, created
// --------------------------------------------------------------------
#ifndef G4Voxelizer_HH
#define G4Voxelizer_HH
#include <vector>
#include <string>
#include <map>
#include "G4Transform3D.hh"
#include "G4RotationMatrix.hh"
#include "G4SurfBits.hh"
#include "G4Box.hh"
#include "G4VFacet.hh"
#include "G4VSolid.hh"
struct G4VoxelBox
{
G4ThreeVector hlen; // half length of the box
G4ThreeVector pos; // position of the box
};
struct G4VoxelInfo
{
G4int count;
G4int previous;
G4int next;
};
class G4Voxelizer
{
public:
template <typename T>
static inline G4int BinarySearch(const std::vector<T> &vec, T value);
void Voxelize(std::vector<G4VSolid *> &solids,
std::vector<G4Transform3D>& transforms);
void Voxelize(std::vector<G4VFacet *> &facets);
void DisplayVoxelLimits() const;
void DisplayBoundaries();
void DisplayListNodes() const;
G4Voxelizer();
~G4Voxelizer();
void GetCandidatesVoxel(std::vector<G4int> &voxels);
// Method displaying the nodes located in a voxel characterized
// by its three indexes.
G4int GetCandidatesVoxelArray(const G4ThreeVector &point,
std::vector<G4int> &list,
G4SurfBits *crossed=0) const;
// Method returning in a vector container the nodes located in a voxel
// characterized by its three indexes.
G4int GetCandidatesVoxelArray(const std::vector<G4int> &voxels,
const G4SurfBits bitmasks[],
std::vector<G4int> &list,
G4SurfBits *crossed=0) const;
G4int GetCandidatesVoxelArray(const std::vector<G4int> &voxels,
std::vector<G4int> &list,
G4SurfBits *crossed=0)const;
inline const std::vector<G4VoxelBox> &GetBoxes() const;
// Method returning the pointer to the array containing the
// characteristics of each box.
inline const std::vector<G4double> &GetBoundary(G4int index) const;
G4bool UpdateCurrentVoxel(const G4ThreeVector &point,
const G4ThreeVector &direction,
std::vector<G4int> &curVoxel) const;
inline void GetVoxel(std::vector<G4int> &curVoxel,
const G4ThreeVector &point) const;
inline G4int GetBitsPerSlice () const;
G4bool Contains(const G4ThreeVector &point) const;
G4double DistanceToNext(const G4ThreeVector &point,
const G4ThreeVector &direction,
std::vector<G4int> &curVoxel) const;
G4double DistanceToFirst(const G4ThreeVector &point,
const G4ThreeVector &direction) const;
G4double DistanceToBoundingBox(const G4ThreeVector &point) const;
inline G4int GetVoxelsIndex(G4int x, G4int y, G4int z) const;
inline G4int GetVoxelsIndex(const std::vector<G4int> &voxels) const;
inline G4bool GetPointVoxel(const G4ThreeVector& p,
std::vector<G4int>& voxels) const;
inline G4int GetPointIndex(const G4ThreeVector &p) const;
inline const G4SurfBits &Empty() const;
inline G4bool IsEmpty(G4int index) const;
void SetMaxVoxels(G4int max);
void SetMaxVoxels(const G4ThreeVector &reductionRatio);
inline G4int GetMaxVoxels(G4ThreeVector &ratioOfReduction);
G4int AllocatedMemory();
inline long long GetCountOfVoxels() const;
inline long long CountVoxels(std::vector<G4double> boundaries[]) const;
inline const std::vector<G4int> &
GetCandidates(std::vector<G4int> &curVoxel) const;
inline G4int GetVoxelBoxesSize() const;
inline const G4VoxelBox &GetVoxelBox(G4int i) const;
inline const std::vector<G4int> &GetVoxelBoxCandidates(G4int i) const;
inline G4int GetTotalCandidates() const;
static G4double MinDistanceToBox (const G4ThreeVector &aPoint,
const G4ThreeVector &f);
static void SetDefaultVoxelsCount(G4int count);
static G4int GetDefaultVoxelsCount();
private:
class G4VoxelComparator
{
public:
std::vector<G4VoxelInfo> &fVoxels;
G4VoxelComparator(std::vector<G4VoxelInfo> &voxels) : fVoxels(voxels) {}
G4bool operator()(const G4int& l, const G4int& r) const
{
G4VoxelInfo &lv = fVoxels[l], &rv = fVoxels[r];
G4int left = lv.count + fVoxels[lv.next].count;
G4int right = rv.count + fVoxels[rv.next].count;
return (left == right) ? l < r : left < right;
}
};
private:
void BuildEmpty ();
G4String GetCandidatesAsString(const G4SurfBits &bits) const;
void CreateSortedBoundary(std::vector<G4double> &boundaryRaw, G4int axis);
void BuildBoundaries();
void BuildReduceVoxels(std::vector<G4double> fBoundaries[],
G4ThreeVector reductionRatio);
void BuildReduceVoxels2(std::vector<G4double> fBoundaries[],
G4ThreeVector reductionRatio);
void BuildVoxelLimits(std::vector<G4VSolid*>& solids,
std::vector<G4Transform3D>& transforms);
void BuildVoxelLimits(std::vector<G4VFacet *> &facets);
void DisplayBoundaries(std::vector<G4double> &fBoundaries);
void BuildBitmasks(std::vector<G4double> fBoundaries[],
G4SurfBits bitmasks[], G4bool countsOnly=false);
void BuildBoundingBox();
void BuildBoundingBox(G4ThreeVector& amin, G4ThreeVector& amax,
G4double tolerance = 0);
void SetReductionRatio(G4int maxVoxels, G4ThreeVector &reductionRatio);
void CreateMiniVoxels(std::vector<G4double> fBoundaries[],
G4SurfBits bitmasks[]);
static void FindComponentsFastest(unsigned int mask,
std::vector<G4int> &list, G4int i);
inline G4ThreeVector GetGlobalPoint(const G4Transform3D& trans,
const G4ThreeVector& lpoint) const;
void TransformLimits(G4ThreeVector& min, G4ThreeVector& max,
const G4Transform3D& transformation) const;
private:
static G4ThreadLocal G4int fDefaultVoxelsCount;
std::vector<G4VoxelBox> fVoxelBoxes;
std::vector<std::vector<G4int> > fVoxelBoxesCandidates;
mutable std::map<G4int, std::vector<G4int> > fCandidates;
const std::vector<G4int> fNoCandidates;
long long fCountOfVoxels;
G4int fNPerSlice;
std::vector<G4VoxelBox> fBoxes;
// Array of box limits on the 3 cartesian axis
std::vector<G4double> fBoundaries[3];
// Sorted and if need skimmed fBoundaries along X,Y,Z axis
std::vector<G4int> fCandidatesCounts[3];
G4int fTotalCandidates;
G4SurfBits fBitmasks[3];
G4ThreeVector fBoundingBoxCenter;
G4Box fBoundingBox;
G4ThreeVector fBoundingBoxSize;
G4ThreeVector fReductionRatio;
G4int fMaxVoxels;
G4double fTolerance;
G4SurfBits fEmpty;
};
#include "G4Voxelizer.icc"
#endif
@@ -0,0 +1,213 @@
//
// ********************************************************************
// * 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: not supported by cvs2svn $
//
// --------------------------------------------------------------------
// GEANT 4 class header file
//
// G4Voxelizer inline methods
//
// History:
// 19.10.12 Marek Gayer, created
// --------------------------------------------------------------------
template <typename T> inline
G4int G4Voxelizer::BinarySearch(const std::vector<T> &vec, T value)
{
typename std::vector<T>::const_iterator begin=vec.begin(), end=vec.end();
G4int res = std::upper_bound(begin, end, value) - begin - 1;
return res;
}
inline
const std::vector<G4VoxelBox> &G4Voxelizer::GetBoxes() const
{
return fBoxes;
}
inline
const std::vector<G4double> &G4Voxelizer::GetBoundary(G4int index) const
{
return fBoundaries[index];
}
inline
void G4Voxelizer::GetVoxel(std::vector<G4int> &curVoxel,
const G4ThreeVector &point) const
{
for (G4int i=0; i<=2; ++i)
{
const std::vector<double> &boundary = GetBoundary(i);
G4int n = BinarySearch(boundary, point[i]);
if (n == -1)
{ n = 0; }
else if (n == G4int(boundary.size()) - 1)
{ n--; }
curVoxel[i] = n;
}
}
inline
G4int G4Voxelizer::GetBitsPerSlice () const
{
return fNPerSlice*8*sizeof(unsigned int);
}
inline
G4int G4Voxelizer::GetVoxelsIndex(G4int x, G4int y, G4int z) const
{
if (x < 0 || y < 0 || z < 0) { return -1; }
G4int maxX = fBoundaries[0].size();
G4int maxY = fBoundaries[1].size();
G4int index = x + y*maxX + z*maxX*maxY;
return index;
}
inline
G4int G4Voxelizer::GetVoxelsIndex(const std::vector<G4int> &voxels) const
{
return GetVoxelsIndex(voxels[0], voxels[1], voxels[2]);
}
inline
G4bool G4Voxelizer::GetPointVoxel(const G4ThreeVector& p,
std::vector<G4int>& voxels) const
{
for (G4int i = 0; i <= 2; ++i)
{
if (p[i] < *fBoundaries[i].begin() || p[i] > *fBoundaries[i].end())
{
return false;
}
}
for (G4int i = 0; i <= 2; ++i)
{
voxels[i] = BinarySearch(fBoundaries[i], p[i]);
}
return true;
}
inline
G4int G4Voxelizer::GetPointIndex(const G4ThreeVector &p) const
{
G4int maxX = fBoundaries[0].size();
G4int maxY = fBoundaries[1].size();
G4int x = BinarySearch(fBoundaries[0], p[0]);
G4int y = BinarySearch(fBoundaries[1], p[1]);
G4int z = BinarySearch(fBoundaries[2], p[2]);
G4int index = x + y*maxX + z*maxX*maxY;
return index;
}
inline
const G4SurfBits &G4Voxelizer::Empty() const
{
return fEmpty;
}
inline
G4bool G4Voxelizer::IsEmpty(G4int index) const
{
return fEmpty[index];
}
inline
G4int G4Voxelizer::GetMaxVoxels(G4ThreeVector &ratioOfReduction)
{
ratioOfReduction = fReductionRatio;
return fMaxVoxels;
}
inline
long long G4Voxelizer::GetCountOfVoxels() const
{
return fCountOfVoxels;
}
inline
long long G4Voxelizer::CountVoxels(std::vector<G4double> boundaries[]) const
{
long long sx = boundaries[0].size() - 1;
long long sy = boundaries[1].size() - 1;
long long sz = boundaries[2].size() - 1;
return sx * sy *sz;
}
inline
const std::vector<G4int>&
G4Voxelizer::GetCandidates(std::vector<G4int> &curVoxel) const
{
G4int voxelsIndex = GetVoxelsIndex(curVoxel);
if (voxelsIndex >= 0 && !fEmpty[voxelsIndex])
{
return fCandidates[voxelsIndex];
}
return fNoCandidates;
}
inline
G4int G4Voxelizer::GetTotalCandidates() const
{
return fTotalCandidates;
}
inline
G4int G4Voxelizer::GetVoxelBoxesSize() const
{
return fVoxelBoxes.size();
}
inline
const G4VoxelBox &G4Voxelizer::GetVoxelBox(G4int i) const
{
return fVoxelBoxes[i];
}
inline
const std::vector<G4int>&
G4Voxelizer::GetVoxelBoxCandidates(G4int i) const
{
return fVoxelBoxesCandidates[i];
}
inline
G4ThreeVector
G4Voxelizer::GetGlobalPoint(const G4Transform3D& trans,
const G4ThreeVector& local) const
{
// Returns global point coordinates converted from the local frame defined
// by the transformation. This is defined by multiplying this transformation
// with the local vector.
return trans*G4Point3D(local);
}