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
+30 -2
View File
@@ -16,11 +16,39 @@ committal in the CVS repository !
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
March 8, 2019 G.Cosmo (geommng-V10-04-09)
May 29, G. Cosmo (geommng-V10-05-07)
- Fixed minor Coverity defects.
May 20, G. Cosmo (geommng-V10-05-06)
- Defined move constructor and move assignment operator for G4AffineTransform.
May 14, B. Morgan (geommng-V10-05-05)
- Use header-based #define/undef symbols to configure VecGeom replacements
- G4GeomConfig.hh: Generated header configuring #defines using CMake settings
- G4GeomTypes.hh: "Interface" header to support old GNUmake system. All Geant4
code should #include this rather than the generated header, which is only
present in CMake mode.
- G4UAdapter.hh: Add inclusion of G4GeomTypes.hh
- See also cmake-V10-05-03
May 13, 2019 G.Cosmo (geommng-V10-05-04)
- Replaced deprecated std::binary_function calls with lambdas in
G4SmartVoxelStat and G4GeometryManager.
Courtesy of S.Losilla, from GitHub PR#8.
April 29, 2019 G.Cosmo (geommng-V10-05-03)
- Properly initialise to zero splitted data in G4VPhysicalVolume.
April 23, 2019 G.Cosmo (geommng-V10-05-02)
- G4GeomSplitter: re-enabled use or realloc()/free() and memcpy(), after
adapting G4VPhysicalVolume MT splitted data to adopt only trivial types
for allocation.
March 8, 2019 G.Cosmo (geommng-V10-05-01)
- G4LogicalVolume: in AddDaughter() avoid propagating pointer to field-manager
if this is null. Addressing problem report #2145.
January 30, 2019 A.Dotti, G.Cosmo
January 30, 2019 A.Dotti, G.Cosmo (geommng-V10-05-00)
- Use reverse_iterator in G4SolidStore::DeRegister() in order to speedup
partial deregistration on setups with many solids instances.
- G4Region: added possibility to disable search in the tree in
@@ -94,10 +94,12 @@ public: // with description
// Optionally rotate by *rot then translate by tlate - rot may be null
inline G4AffineTransform(const G4AffineTransform& rhs);
// Copy constructor
inline G4AffineTransform(G4AffineTransform&& rhs) = default;
// Copy and move constructors
inline G4AffineTransform& operator=(const G4AffineTransform& rhs);
// Assignment operator
inline G4AffineTransform& operator=(G4AffineTransform&& rhs) = default;
// Assignment & Move operators
inline ~G4AffineTransform();
// Destructor
@@ -0,0 +1,120 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
//! \file G4GeomConfig.hh
//! \brief Public preprocessor definitions for geometry
#ifndef G4GEOMCONFIG_HH
#define G4GEOMCONFIG_HH
//! \def G4GEOM_USE_USOLIDS
//! \brief Defined if all Geant4 solids use VecGeom implementations
#cmakedefine G4GEOM_USE_USOLIDS
//! \def G4GEOM_USE_PARTIAL_USOLIDS
//! \brief Defined if selected Geant4 solids use VecGeom implementations
#cmakedefine G4GEOM_USE_PARTIAL_USOLIDS
#ifdef G4GEOM_USE_PARTIAL_USOLIDS
//! \def G4GEOM_USE_UBOX
//! \brief Defined if G4Box is replaced with VecGeom UnplacedBox
#cmakedefine G4GEOM_USE_UBOX
//! \def G4GEOM_USE_UCONS
//! \brief Defined if G4Cons is replaced with VecGeom GenericUnplacedCone
#cmakedefine G4GEOM_USE_UCONS
//! \def G4GEOM_USE_UCTUBS
//! \brief Defined if G4CutTubs is replaced with VecGeom UnplacedCutTube
#cmakedefine G4GEOM_USE_UCTUBS
//! \def G4GEOM_USE_UEXTRUDEDSOLID
//! \brief Defined if G4ExtrudedSolid is replaced with VecGeom UnplacedExtruded
#cmakedefine G4GEOM_USE_UEXTRUDEDSOLID
//! \def G4GEOM_USE_UHYPE
//! \brief Defined if G4Hype is replaced with VecGeom GenericUnplacedHype
#cmakedefine G4GEOM_USE_UHYPE
//! \def G4GEOM_USE_UGENERICPOLYCONE
//! \brief Defined if G4GenericPolycone is replaced with VecGeom UnplacedGenericPolycone
#cmakedefine G4GEOM_USE_UGENERICPOLYCONE
//! \def G4GEOM_USE_UGENERICTRAP
//! \brief Defined if G4GenericTrap is replaced with VecGeom UnplacedGenTrap
#cmakedefine G4GEOM_USE_UGENERICTRAP
//! \def G4GEOM_USE_UORB
//! \brief Defined if G4Orb is replaced with VecGeom UnplacedOrb
#cmakedefine G4GEOM_USE_UORB
//! \def G4GEOM_USE_UPARA
//! \brief Defined if G4Para is replaced with VecGeom UnplacedParallelepiped
#cmakedefine G4GEOM_USE_UPARA
//! \def G4GEOM_USE_UPARABOLOID
//! \brief Defined if G4Paraboloid is replaced with VecGeom UnplacedParaboloid
#cmakedefine G4GEOM_USE_UPARABOLOID
//! \def G4GEOM_USE_UPOLYCONE
//! \brief Defined if G4Polycone is replaced with VecGeom GenericUnplacedPolycone
#cmakedefine G4GEOM_USE_UPOLYCONE
//! \def G4GEOM_USE_UPOLYHEDRA
//! \brief Defined if G4Polyhedra is replaced with VecGeom UnplacedPolyhedron
#cmakedefine G4GEOM_USE_UPOLYHEDRA
//! \def G4GEOM_USE_USPHERE
//! \brief Defined if G4Box is replaced with VecGeom UnplacedSphere
#cmakedefine G4GEOM_USE_USPHERE
//! \def G4GEOM_USE_UTESSELLATEDSOLID
//! \brief Defined if G4TessellatedSolid is replaced with VecGeom UnplacedTessellated
#cmakedefine G4GEOM_USE_UTESSELLATEDSOLID
//! \def G4GEOM_USE_UTET
//! \brief Defined if G4Tet is replaced with VecGeom UnplacedTet
#cmakedefine G4GEOM_USE_UTET
//! \def G4GEOM_USE_UTRAP
//! \brief Defined if G4Trap is replaced with VecGeom UnplacedTrapezoid
#cmakedefine G4GEOM_USE_UTRAP
//! \def G4GEOM_USE_UTRD
//! \brief Defined if G4Trd is replaced with VecGeom GenericUnplacedTrd
#cmakedefine G4GEOM_USE_UTRD
//! \def G4GEOM_USE_UTORUS
//! \brief Defined if G4Torus is replaced with VecGeom UnplacedTorus2
#cmakedefine G4GEOM_USE_UTORUS
//! \def G4GEOM_USE_UTUBS
//! \brief Defined if G4Tubs is replaced with VecGeom GenericUnplacedTube
#cmakedefine G4GEOM_USE_UTUBS
#endif // G4GEOM_USE_PARTIAL_USOLIDS
#endif // G4GEOMCONFIG_HH
@@ -43,7 +43,6 @@
#include "globals.hh"
#include "geomwdefs.hh"
#include "G4AutoLock.hh"
#include "G4Allocator.hh"
template <class T> // T is the private data from the object to be split
class G4GeomSplitter
@@ -56,33 +55,10 @@ class G4GeomSplitter
G4MUTEXINIT(mutex);
}
void *operator new(size_t)
// Override "new" for "G4Allocator"
{
if (!anOffsetAllocator) anOffsetAllocator = new G4Allocator<T>;
return (void *) anOffsetAllocator->MallocSingle();
}
void operator delete(void *anOffset)
// Override "delete" for "G4Allocator".
{
anOffsetAllocator->FreeSingle((T*) anOffset);
}
T* Reallocate(G4int size)
{
T* noffset = new T[size];
if (offset)
{
for (G4int i=0; i<totalspace; ++i)
{
noffset[i] = offset[i];
}
delete [] offset;
}
totalspace = size;
return noffset;
return (T *) std::realloc(offset, totalspace * sizeof(T));
}
G4int CreateSubInstance()
@@ -107,10 +83,7 @@ class G4GeomSplitter
void CopyMasterContents()
{
G4AutoLock l(&mutex);
for (G4int i=0; i<totalspace; ++i)
{
offset[i] = sharedOffset[i];
}
std::memcpy(offset, sharedOffset, totalspace * sizeof(T));
}
void SlaveCopySubInstanceArray()
@@ -170,7 +143,7 @@ class G4GeomSplitter
// Invoked by all threads to free the subinstance array.
{
if (!offset) { return; }
delete [] offset;
std::free( offset );
offset = 0;
}
@@ -202,7 +175,6 @@ class G4GeomSplitter
public:
G4GEOM_DLL static G4ThreadLocal T* offset;
G4GEOM_DLL static G4ThreadLocal G4Allocator<T>* anOffsetAllocator;
private:
@@ -212,9 +184,6 @@ class G4GeomSplitter
G4Mutex mutex;
};
template <typename T> G4ThreadLocal
T* G4GeomSplitter<T>::offset = 0;
template <typename T> G4ThreadLocal
G4Allocator<T>* G4GeomSplitter<T>::anOffsetAllocator = 0;
template <typename T> G4ThreadLocal T* G4GeomSplitter<T>::offset = 0;
#endif
@@ -0,0 +1,37 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// GEANT4 geomtetry/solid types
//
#ifndef G4GEOMTYPES_HH
#define G4GEOMTYPES_HH
// Fundamental definitions
#ifndef G4GMAKE
#include "G4GeomConfig.hh"
#endif
#endif /* G4GEOMTYPES_HH */
@@ -41,7 +41,6 @@
#define G4SmartVoxelStat_hh
#include "G4Types.hh"
#include <functional>
class G4LogicalVolume;
class G4SmartVoxelHeader;
@@ -97,32 +96,7 @@ class G4SmartVoxelStat
G4long heads;
G4long nodes;
G4long pointers;
public:
//
// Functor objects for sorting
//
struct ByCpu
: public std::binary_function< const G4SmartVoxelStat,
const G4SmartVoxelStat, G4bool >
{
G4bool operator()( const G4SmartVoxelStat &a, const G4SmartVoxelStat &b )
{
return a.GetTotalTime() > b.GetTotalTime();
}
};
struct ByMemory
: public std::binary_function< const G4SmartVoxelStat,
const G4SmartVoxelStat, G4bool >
{
G4bool operator()( const G4SmartVoxelStat &a, const G4SmartVoxelStat &b )
{
return a.GetMemoryUse() > b.GetMemoryUse();
}
};
};
#endif
@@ -25,12 +25,12 @@
//
//
//
//
//
// class G4UAdapter
//
// Class description:
//
// Utility class for adapting VecGeom solids API to Geant4 solids.
// Utility class for adapting VecGeom solids API to Geant4 solids.
// NOTE: Using protected inheritance since the Adapter is supposed to
// be a G4VSolid "implemented-in-terms-of" the VecGeom UnplacedVolume_t.
// The choice of protected vs private is due to the fact that we want
@@ -56,6 +56,8 @@
#include "G4BoundingEnvelope.hh"
#include "G4AutoLock.hh"
#include "G4GeomTypes.hh"
#if ( defined(G4GEOM_USE_USOLIDS) || defined(G4GEOM_USE_PARTIAL_USOLIDS) )
#include <base/Global.h>
@@ -64,15 +64,17 @@ class G4PVData
// and must have a per-thread state.
public:
G4PVData():frot(0) {}
void initialize() {
G4PVData() : frot(0) {}
void initialize()
{
frot = 0;
ftrans = G4ThreeVector(0,0,0);
tx = 0.; ty = 0.; tz = 0.;
}
G4RotationMatrix *frot;
G4ThreeVector ftrans;
G4double tx = 0., ty = 0., tz = 0.;
};
typedef G4GeomSplitter<G4PVData> G4PVManager;
@@ -124,7 +126,7 @@ class G4VPhysicalVolume
// Older access functions, that do not distinguish between frame/object!
const G4ThreeVector& GetTranslation() const;
const G4ThreeVector GetTranslation() const;
const G4RotationMatrix* GetRotation() const;
// Old access functions, that do not distinguish between frame/object!
// They return the translation/rotation of the volume.
+16
View File
@@ -26,12 +26,27 @@ include_directories(${CMAKE_SOURCE_DIR}/source/graphics_reps/include)
include_directories(${CMAKE_SOURCE_DIR}/source/intercoms/include)
include_directories(${CMAKE_SOURCE_DIR}/source/materials/include)
# Configure header for preprocessor symbols for USolids
configure_file(${CMAKE_CURRENT_LIST_DIR}/include/G4GeomConfig.hh.in
${CMAKE_CURRENT_BINARY_DIR}/include/G4GeomConfig.hh
)
# WORKAROUND: When building/testing examples uing ROOT, ROOT's
# dictionary generation is not smart enough to handle target usage
# requirements for include paths. Explicitly add the path to the
# generated header into build time include paths...
set_property(GLOBAL APPEND
PROPERTY GEANT4_BUILDTREE_INCLUDE_DIRS "${CMAKE_CURRENT_BINARY_DIR}/include")
#
# Define the Geant4 Module.
#
include(Geant4MacroDefineModule)
GEANT4_DEFINE_MODULE(NAME G4geometrymng
HEADERS
${CMAKE_CURRENT_BINARY_DIR}/include/G4GeomConfig.hh
G4AffineTransform.hh
G4AffineTransform.icc
G4BlockingList.hh
@@ -44,6 +59,7 @@ GEANT4_DEFINE_MODULE(NAME G4geometrymng
G4ErrorTarget.hh
G4GeomSplitter.hh
G4GeomTools.hh
G4GeomTypes.hh
G4GeometryManager.hh
G4IdentityTrajectoryFilter.hh
G4LogicalCrystalVolume.hh
@@ -383,7 +383,11 @@ G4GeometryManager::ReportVoxelStats( std::vector<G4SmartVoxelStat> & stats,
//
// First list: sort by total CPU time
//
std::sort( stats.begin(), stats.end(), G4SmartVoxelStat::ByCpu() );
std::sort( stats.begin(), stats.end(),
[](const G4SmartVoxelStat& a, const G4SmartVoxelStat& b)
{
return a.GetTotalTime() > b.GetTotalTime();
} );
G4int nPrint = nStat > 10 ? 10 : nStat;
@@ -424,7 +428,11 @@ G4GeometryManager::ReportVoxelStats( std::vector<G4SmartVoxelStat> & stats,
//
// Second list: sort by memory use
//
std::sort( stats.begin(), stats.end(), G4SmartVoxelStat::ByMemory() );
std::sort( stats.begin(), stats.end(),
[](const G4SmartVoxelStat& a, const G4SmartVoxelStat& b)
{
return a.GetMemoryUse() > b.GetMemoryUse();
} );
if (nPrint)
{
@@ -43,7 +43,9 @@ G4PVManager G4VPhysicalVolume::subInstanceManager;
// in the class G4PVData.
//
#define G4MT_rot ((subInstanceManager.offset[instanceID]).frot)
#define G4MT_trans ((subInstanceManager.offset[instanceID]).ftrans)
#define G4MT_tx ((subInstanceManager.offset[instanceID]).tx)
#define G4MT_ty ((subInstanceManager.offset[instanceID]).ty)
#define G4MT_tz ((subInstanceManager.offset[instanceID]).tz)
#define G4MT_pvdata (subInstanceManager.offset[instanceID])
// Constructor: init parameters and register in Store
@@ -64,7 +66,9 @@ G4VPhysicalVolume::G4VPhysicalVolume( G4RotationMatrix *pRot,
// Initialize 'Shadow' data structure - for use by object persistency
pvdata = new G4PVData();
pvdata->frot = pRot;
pvdata->ftrans = G4ThreeVector(tlate);
pvdata->tx = tlate.x();
pvdata->ty = tlate.y();
pvdata->tz = tlate.z();
G4PhysicalVolumeStore::Register(this);
}
@@ -135,14 +139,14 @@ G4int G4VPhysicalVolume::GetMultiplicity() const
return 1;
}
const G4ThreeVector& G4VPhysicalVolume::GetTranslation() const
const G4ThreeVector G4VPhysicalVolume::GetTranslation() const
{
return G4MT_trans;
return G4ThreeVector(G4MT_tx, G4MT_ty, G4MT_tz);
}
void G4VPhysicalVolume::SetTranslation(const G4ThreeVector &vec)
{
G4MT_trans=vec;
G4MT_tx=vec.x(); G4MT_ty=vec.y(); G4MT_tz=vec.z();
}
const G4RotationMatrix* G4VPhysicalVolume::GetRotation() const
@@ -190,7 +194,7 @@ G4RotationMatrix G4VPhysicalVolume::GetObjectRotationValue() const
G4ThreeVector G4VPhysicalVolume::GetObjectTranslation() const
{
return G4MT_trans;
return G4ThreeVector(G4MT_tx, G4MT_ty, G4MT_tz);
}
const G4RotationMatrix* G4VPhysicalVolume::GetFrameRotation() const
@@ -200,7 +204,7 @@ const G4RotationMatrix* G4VPhysicalVolume::GetFrameRotation() const
G4ThreeVector G4VPhysicalVolume::GetFrameTranslation() const
{
return -G4MT_trans;
return -G4ThreeVector(G4MT_tx, G4MT_ty, G4MT_tz);
}
// Only implemented for placed and parameterised volumes.