Import Geant4 10.7.1 source tree
This commit is contained in:
@@ -16,6 +16,18 @@ committal in the CVS repository !
|
||||
* Reverse chronological order (last date on top), please *
|
||||
----------------------------------------------------------
|
||||
|
||||
January 27, 2021 - P.Arce (geomnav-V10-06-09)
|
||||
-------------------------
|
||||
- G4RegularNavigation: Addressing problem report #2314.
|
||||
Added a #ifdef G4DEBUG_NAVIGATION to avoid excessive warnings.
|
||||
Substituted G4cout by G4Exception GeomRegNav1002 (renumbering of exceptions).
|
||||
|
||||
December 16, 2020 - G.Cosmo
|
||||
---------------------------
|
||||
- G4ReplicaNavigation: reduced step correction in ComputeStep().
|
||||
Addressing problem report #2302.
|
||||
- G4PathFinder: moved debug printout within debug block in Locate().
|
||||
|
||||
October 15, 2020 - G.Cosmo (geomnav-V10-06-08)
|
||||
--------------------------
|
||||
- G4ReplicaNavigation: relaxed condition for step correction in ComputeStep().
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// class G4PathFinder Implementation
|
||||
// G4PathFinder Implementation
|
||||
//
|
||||
// Original author: John Apostolakis, April 2006
|
||||
// --------------------------------------------------------------------
|
||||
@@ -464,13 +464,16 @@ void G4PathFinder::Locate( const G4ThreeVector& position,
|
||||
{
|
||||
// Locate the point in each geometry
|
||||
|
||||
auto pNavIter = fpTransportManager->GetActiveNavigatorsIterator();
|
||||
|
||||
G4ThreeVector lastEndPosition = fRelocatedPoint
|
||||
? fLastLocatedPosition
|
||||
: fEndState.GetPosition();
|
||||
fLastLocatedPosition = position;
|
||||
|
||||
#ifdef G4DEBUG_PATHFINDER
|
||||
static const G4double movLenTol = 10*sqr(kCarTolerance);
|
||||
|
||||
std::vector<G4Navigator*>::iterator pNavIter =
|
||||
fpTransportManager->GetActiveNavigatorsIterator();
|
||||
|
||||
G4ThreeVector lastEndPosition = fRelocatedPoint ?
|
||||
fLastLocatedPosition : fEndState.GetPosition();
|
||||
G4ThreeVector moveVec = ( position - lastEndPosition );
|
||||
G4double moveLenSq = moveVec.mag2();
|
||||
if( (!fNewTrack) && ( moveLenSq > movLenTol ) )
|
||||
@@ -478,9 +481,7 @@ void G4PathFinder::Locate( const G4ThreeVector& position,
|
||||
ReportMove( lastEndPosition, position,
|
||||
" (End) Position / G4PathFinder::Locate" );
|
||||
}
|
||||
fLastLocatedPosition = position;
|
||||
|
||||
#ifdef G4DEBUG_PATHFINDER
|
||||
if( fVerboseLevel > 2 )
|
||||
{
|
||||
G4cout << G4endl;
|
||||
|
||||
@@ -226,12 +226,16 @@ G4double G4RegularNavigation::ComputeStepSkippingEqualMaterials(
|
||||
{
|
||||
G4ThreeVector pGlobalpoint = history.GetTransform(ide)
|
||||
.InverseTransformPoint(localPoint);
|
||||
G4cout << "G4RegularNavigation::ComputeStepSkippingEqualMaterials(): another 'zero' step, # "
|
||||
std::ostringstream message;
|
||||
message.precision(16);
|
||||
message << "G4RegularNavigation::ComputeStepSkippingEqualMaterials(): another 'zero' step, # "
|
||||
<< fNumberZeroSteps
|
||||
<< ", at " << pGlobalpoint
|
||||
<< ", nav-comp-step calls # " << ii
|
||||
<< ", Step= " << newStep
|
||||
<< G4endl;
|
||||
<< ", Step= " << newStep;
|
||||
G4Exception("G4RegularNavigation::ComputeStepSkippingEqualMaterials()",
|
||||
"GeomRegNav1002", JustWarning, message,
|
||||
"Potential overlap in geometry!");
|
||||
}
|
||||
#endif
|
||||
if( fNumberZeroSteps > fActionThreshold_NoZeroSteps-1 )
|
||||
@@ -239,7 +243,7 @@ G4double G4RegularNavigation::ComputeStepSkippingEqualMaterials(
|
||||
// Act to recover this stuck track. Pushing it along direction
|
||||
//
|
||||
newStep = std::min(101*kCarTolerance*std::pow(10,fNumberZeroSteps-2),0.1);
|
||||
#ifdef G4VERBOSE
|
||||
#ifdef G4DEBUG_NAVIGATION
|
||||
G4ThreeVector pGlobalpoint = history.GetTransform(ide)
|
||||
.InverseTransformPoint(localPoint);
|
||||
std::ostringstream message;
|
||||
@@ -254,7 +258,7 @@ G4double G4RegularNavigation::ComputeStepSkippingEqualMaterials(
|
||||
<< G4endl
|
||||
<< " Trying pushing it of " << newStep << " mm ...";
|
||||
G4Exception("G4RegularNavigation::ComputeStepSkippingEqualMaterials()",
|
||||
"GeomRegNav1002", JustWarning, message,
|
||||
"GeomRegNav1003", JustWarning, message,
|
||||
"Potential overlap in geometry!");
|
||||
#endif
|
||||
}
|
||||
@@ -273,7 +277,7 @@ G4double G4RegularNavigation::ComputeStepSkippingEqualMaterials(
|
||||
<< "- at point " << pGlobalpoint << G4endl
|
||||
<< " local direction: " << localDirection << G4endl;
|
||||
G4Exception("G4RegularNavigation::ComputeStepSkippingEqualMaterials()",
|
||||
"GeomRegNav1003",
|
||||
"GeomRegNav1004",
|
||||
EventMustBeAborted,
|
||||
message);
|
||||
}
|
||||
|
||||
@@ -925,7 +925,7 @@ G4ReplicaNavigation::ComputeStep(const G4ThreeVector& globalPoint,
|
||||
//
|
||||
if( ourStep<fMinStep )
|
||||
{
|
||||
ourStep = 100*kCarTolerance;
|
||||
ourStep = 2*kCarTolerance;
|
||||
}
|
||||
|
||||
if ( motherSafety<ourSafety )
|
||||
|
||||
@@ -19,6 +19,10 @@ committal in the CVS repository !
|
||||
* Reverse chronological order (last date on top), please *
|
||||
----------------------------------------------------------
|
||||
|
||||
January 28, 2021 I.Hrivnacova, E.Tcherniaev geom-bool-V10-06-01
|
||||
- Added protection against using invalid normal
|
||||
in G4ScaledSolid::DistanceToOut(p,v, ...)
|
||||
|
||||
December 10, 2019 B.Morgan geom-bool-V10-06-00
|
||||
- Cleanup CMake build, removing obsolete granular library options and
|
||||
explicit include_directories.
|
||||
|
||||
@@ -268,7 +268,7 @@ G4ScaledSolid::DistanceToOut( const G4ThreeVector& p,
|
||||
{
|
||||
G4ThreeVector normal;
|
||||
fScale->TransformNormal(solNorm, normal);
|
||||
*n = normal/normal.mag();
|
||||
*n = normal.unit();
|
||||
}
|
||||
|
||||
// Return distance converted to global
|
||||
|
||||
@@ -16,6 +16,10 @@ committal in the CVS repository !
|
||||
* Reverse chronological order (last date on top), please *
|
||||
----------------------------------------------------------
|
||||
|
||||
February 1, 2021 G.Cosmo geom-csg-V10-06-06
|
||||
- G4Trap, G4Para: removed spurious character in printout in StreamInfo().
|
||||
Addressed problem report #2318.
|
||||
|
||||
November 12, 2020 E.Tcherniaev geom-csg-V10-06-05
|
||||
- G4Sphere::InitializeThetaTrigonometry(): tan() replaced with sin()/cos(),
|
||||
it addresses problem report #2289
|
||||
|
||||
@@ -1990,7 +1990,7 @@ G4double G4Cons::DistanceToOut( const G4ThreeVector& p,
|
||||
if( p.x() != 0. || p.y() != 0.)
|
||||
{
|
||||
message << "point phi = " << std::atan2(p.y(),p.x())/degree
|
||||
<< " degree" << G4endl << G4endl ;
|
||||
<< " degrees" << G4endl << G4endl ;
|
||||
}
|
||||
message << "Direction:" << G4endl << G4endl
|
||||
<< "v.x() = " << v.x() << G4endl
|
||||
@@ -2034,7 +2034,7 @@ G4double G4Cons::DistanceToOut(const G4ThreeVector& p) const
|
||||
if( (p.x() != 0.) || (p.x() != 0.) )
|
||||
{
|
||||
G4cout << "point phi = " << std::atan2(p.y(),p.x())/degree
|
||||
<< " degree" << G4endl << G4endl ;
|
||||
<< " degrees" << G4endl << G4endl ;
|
||||
}
|
||||
G4cout.precision(oldprc) ;
|
||||
G4Exception("G4Cons::DistanceToOut(p)", "GeomSolids1002",
|
||||
|
||||
@@ -815,7 +815,6 @@ std::ostream& G4Para::StreamInfo( std::ostream& os ) const
|
||||
G4double theta = std::atan(std::sqrt(fTthetaCphi*fTthetaCphi +
|
||||
fTthetaSphi*fTthetaSphi));
|
||||
G4double phi = std::atan2(fTthetaSphi,fTthetaCphi);
|
||||
G4String signDegree = "\u00B0";
|
||||
|
||||
G4int oldprc = os.precision(16);
|
||||
os << "-----------------------------------------------------------\n"
|
||||
@@ -826,9 +825,9 @@ std::ostream& G4Para::StreamInfo( std::ostream& os ) const
|
||||
<< " half length X: " << fDx/mm << " mm\n"
|
||||
<< " half length Y: " << fDy/mm << " mm\n"
|
||||
<< " half length Z: " << fDz/mm << " mm\n"
|
||||
<< " alpha: " << alpha/degree << signDegree << "\n"
|
||||
<< " theta: " << theta/degree << signDegree << "\n"
|
||||
<< " phi: " << phi/degree << signDegree << "\n"
|
||||
<< " alpha: " << alpha/degree << "degrees\n"
|
||||
<< " theta: " << theta/degree << "degrees\n"
|
||||
<< " phi: " << phi/degree << "degrees\n"
|
||||
<< "-----------------------------------------------------------\n";
|
||||
os.precision(oldprc);
|
||||
|
||||
|
||||
@@ -1129,7 +1129,6 @@ std::ostream& G4Trap::StreamInfo( std::ostream& os ) const
|
||||
+fTthetaSphi*fTthetaSphi));
|
||||
G4double alpha1 = std::atan(fTalpha1);
|
||||
G4double alpha2 = std::atan(fTalpha2);
|
||||
G4String signDegree = "\u00B0";
|
||||
|
||||
G4int oldprc = os.precision(16);
|
||||
os << "-----------------------------------------------------------\n"
|
||||
@@ -1144,10 +1143,10 @@ std::ostream& G4Trap::StreamInfo( std::ostream& os ) const
|
||||
<< " half length Y, face +Dz: " << fDy2/mm << " mm\n"
|
||||
<< " half length X, face +Dz, side -Dy2: " << fDx3/mm << " mm\n"
|
||||
<< " half length X, face +Dz, side +Dy2: " << fDx4/mm << " mm\n"
|
||||
<< " theta: " << theta/degree << signDegree << "\n"
|
||||
<< " phi: " << phi/degree << signDegree << "\n"
|
||||
<< " alpha, face -Dz: " << alpha1/degree << signDegree << "\n"
|
||||
<< " alpha, face +Dz: " << alpha2/degree << signDegree << "\n"
|
||||
<< " theta: " << theta/degree << "degrees\n"
|
||||
<< " phi: " << phi/degree << "degrees\n"
|
||||
<< " alpha, face -Dz: " << alpha1/degree << "degrees\n"
|
||||
<< " alpha, face +Dz: " << alpha2/degree << "degrees\n"
|
||||
<< "-----------------------------------------------------------\n";
|
||||
os.precision(oldprc);
|
||||
|
||||
|
||||
@@ -16,6 +16,11 @@ committal in the source repository !
|
||||
* Reverse chronological order (last date on top), please *
|
||||
----------------------------------------------------------
|
||||
|
||||
13-January-2021 G.Cosmo (geom-specific-V10-06-11)
|
||||
- Reduce cases of bad speculation in G4PolyhedraSide::Inside() and
|
||||
G4PolyPhiFace::InsideEdges(), based on report in profiling analysis
|
||||
by G.Amadio.
|
||||
|
||||
30-October-2020 E.Tcherniaev (geom-specific-V10-06-10)
|
||||
- G4Polycone: Revised GetPointOnSurface();
|
||||
Added protected auxiliary method SetSurfaceElements();
|
||||
|
||||
@@ -806,11 +806,13 @@ G4bool G4PolyPhiFace::InsideEdges( G4double r, G4double z,
|
||||
G4PolyPhiFaceEdge* edge = edges;
|
||||
do // Loop checking, 13.08.2015, G.Cosmo
|
||||
{
|
||||
G4PolyPhiFaceVertex* testMe;
|
||||
G4PolyPhiFaceVertex* testMe = nullptr;
|
||||
G4PolyPhiFaceVertex* v0_vertex = edge->v0;
|
||||
G4PolyPhiFaceVertex* v1_vertex = edge->v1;
|
||||
//
|
||||
// Get distance perpendicular to the edge
|
||||
//
|
||||
G4double dr = (r-edge->v0->r), dz = (z-edge->v0->z);
|
||||
G4double dr = (r-v0_vertex->r), dz = (z-v0_vertex->z);
|
||||
|
||||
G4double distOut = dr*edge->tz - dz*edge->tr;
|
||||
G4double distance2 = distOut*distOut;
|
||||
@@ -827,17 +829,13 @@ G4bool G4PolyPhiFace::InsideEdges( G4double r, G4double z,
|
||||
if (q < 0)
|
||||
{
|
||||
distance2 += q*q;
|
||||
testMe = edge->v0;
|
||||
testMe = v0_vertex;
|
||||
}
|
||||
else if (q > edge->length)
|
||||
{
|
||||
G4double s2 = q-edge->length;
|
||||
distance2 += s2*s2;
|
||||
testMe = edge->v1;
|
||||
}
|
||||
else
|
||||
{
|
||||
testMe = nullptr;
|
||||
testMe = v1_vertex;
|
||||
}
|
||||
|
||||
//
|
||||
@@ -846,11 +844,11 @@ G4bool G4PolyPhiFace::InsideEdges( G4double r, G4double z,
|
||||
if (distance2 < bestDistance2)
|
||||
{
|
||||
bestDistance2 = distance2;
|
||||
if (testMe)
|
||||
if (testMe != nullptr)
|
||||
{
|
||||
G4double distNorm = dr*testMe->rNorm + dz*testMe->zNorm;
|
||||
answer = (distNorm <= 0);
|
||||
if (base3Dnorm)
|
||||
if (base3Dnorm != nullptr)
|
||||
{
|
||||
*base3Dnorm = testMe;
|
||||
*head3Dnorm = &testMe->norm3D;
|
||||
@@ -859,9 +857,9 @@ G4bool G4PolyPhiFace::InsideEdges( G4double r, G4double z,
|
||||
else
|
||||
{
|
||||
answer = (distOut <= 0);
|
||||
if (base3Dnorm)
|
||||
if (base3Dnorm != nullptr)
|
||||
{
|
||||
*base3Dnorm = edge->v0;
|
||||
*base3Dnorm = v0_vertex;
|
||||
*head3Dnorm = &edge->norm3D;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -616,12 +616,10 @@ EInside G4PolyhedraSide::Inside( const G4ThreeVector& p,
|
||||
//
|
||||
// Use distance along normal to decide return value
|
||||
//
|
||||
if ( (std::fabs(norm) < tolerance) && (*bestDistance < 2.0*tolerance) )
|
||||
if ( (std::fabs(norm) > tolerance) || (*bestDistance > 2.0*tolerance) )
|
||||
return (norm < 0) ? kInside : kOutside;
|
||||
else
|
||||
return kSurface;
|
||||
else if (norm < 0)
|
||||
return kInside;
|
||||
else
|
||||
return kOutside;
|
||||
}
|
||||
|
||||
// Normal
|
||||
|
||||
@@ -16,6 +16,14 @@ commit in the repository !
|
||||
* Reverse chronological order (last date on top), please *
|
||||
----------------------------------------------------------
|
||||
|
||||
January 20th, 2021 G.Cosmo - geomvol-V10-06-04
|
||||
- Added creation order index in G4LogicalBorderSurface.
|
||||
Addressing problem report #2311.
|
||||
|
||||
December 10th, 2020 G.Cosmo
|
||||
- G4GeometryWorkspace: added protection for thread contention in function
|
||||
DestroyWorkspace(). Some code cleanup.
|
||||
|
||||
October 11th, 2020 E.Tcherniaev - geomvol-V10-06-03
|
||||
- G4PVPlacement::CheckOverlaps(): Added keeping of bounding box from
|
||||
previous solid and complementory comparison of bounding spheres.
|
||||
|
||||
@@ -40,8 +40,7 @@
|
||||
// classes to work with multi-threading.
|
||||
|
||||
// Authors: John Apostolakis (CERN), Andrea Dotti (SLAC), July 2013
|
||||
// ------------------------------------------------------------
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
#ifndef G4GEOMETRYWORKSPACE_HH
|
||||
#define G4GEOMETRYWORKSPACE_HH
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ using G4LogicalBorderSurfaceTable
|
||||
class G4LogicalBorderSurface : public G4LogicalSurface
|
||||
{
|
||||
|
||||
public: // with description
|
||||
public:
|
||||
|
||||
G4LogicalBorderSurface( const G4String& name,
|
||||
G4VPhysicalVolume* vol1,
|
||||
@@ -65,7 +65,7 @@ class G4LogicalBorderSurface : public G4LogicalSurface
|
||||
|
||||
G4bool operator==( const G4LogicalBorderSurface& right ) const;
|
||||
G4bool operator!=( const G4LogicalBorderSurface& right ) const;
|
||||
// Operators.
|
||||
// Operators
|
||||
|
||||
static G4LogicalBorderSurface* GetSurface( const G4VPhysicalVolume* vol1,
|
||||
const G4VPhysicalVolume* vol2 );
|
||||
@@ -73,7 +73,8 @@ class G4LogicalBorderSurface : public G4LogicalSurface
|
||||
G4VPhysicalVolume* vol2 );
|
||||
inline const G4VPhysicalVolume* GetVolume1() const;
|
||||
inline const G4VPhysicalVolume* GetVolume2() const;
|
||||
// Generic accessors.
|
||||
inline std::size_t GetIndex() const;
|
||||
// Generic accessors
|
||||
|
||||
inline void SetVolume1( G4VPhysicalVolume* vol1 );
|
||||
inline void SetVolume2( G4VPhysicalVolume* vol2 );
|
||||
@@ -81,17 +82,19 @@ class G4LogicalBorderSurface : public G4LogicalSurface
|
||||
|
||||
static void CleanSurfaceTable();
|
||||
static const G4LogicalBorderSurfaceTable* GetSurfaceTable();
|
||||
static size_t GetNumberOfBorderSurfaces();
|
||||
static std::size_t GetNumberOfBorderSurfaces();
|
||||
static void DumpInfo();
|
||||
// To handle the table of surfaces.
|
||||
// To handle the table of surfaces
|
||||
|
||||
private:
|
||||
|
||||
G4VPhysicalVolume* Volume1; // Physical Volume pointer on side 1
|
||||
G4VPhysicalVolume* Volume2; // Physical Volume pointer on side 2
|
||||
|
||||
std::size_t Index; // Creation order index
|
||||
|
||||
static G4LogicalBorderSurfaceTable *theBorderSurfaceTable;
|
||||
// The static Table of BorderSurfaces.
|
||||
// The static Table of BorderSurfaces
|
||||
};
|
||||
|
||||
// ********************************************************************
|
||||
@@ -101,4 +104,3 @@ class G4LogicalBorderSurface : public G4LogicalSurface
|
||||
#include "G4LogicalBorderSurface.icc"
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// class G4LogicalBorderSurface inline implementation
|
||||
// G4LogicalBorderSurface inline implementation
|
||||
//
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
@@ -47,6 +47,12 @@ const G4VPhysicalVolume* G4LogicalBorderSurface::GetVolume2() const
|
||||
return Volume2;
|
||||
}
|
||||
|
||||
inline
|
||||
std::size_t G4LogicalBorderSurface::GetIndex() const
|
||||
{
|
||||
return Index;
|
||||
}
|
||||
|
||||
inline
|
||||
void G4LogicalBorderSurface::SetVolume1(G4VPhysicalVolume* vol1)
|
||||
{
|
||||
|
||||
@@ -23,9 +23,10 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// Class G4GeometryWorkspace - implementation
|
||||
// G4GeometryWorkspace - implementation
|
||||
//
|
||||
// ----------------------------------------------------------------------
|
||||
// Authors: John Apostolakis (CERN), Andrea Dotti (SLAC), July 2013
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
#include "G4GeometryWorkspace.hh"
|
||||
|
||||
@@ -44,7 +45,7 @@
|
||||
|
||||
namespace
|
||||
{
|
||||
G4Mutex solidclone = G4MUTEX_INITIALIZER;
|
||||
G4Mutex mutex_init = G4MUTEX_INITIALIZER;
|
||||
G4GeometryWorkspace::pool_type thePool;
|
||||
}
|
||||
|
||||
@@ -70,6 +71,7 @@ G4GeometryWorkspace::G4GeometryWorkspace()
|
||||
|
||||
// Create a work area for Logical Volumes in this thread
|
||||
// then capture its address
|
||||
//
|
||||
InitialiseWorkspace();
|
||||
|
||||
fLogicalVolumeOffset = fpLogicalVolumeSIM->GetOffset();
|
||||
@@ -97,12 +99,9 @@ G4GeometryWorkspace::UseWorkspace()
|
||||
G4cout << "G4GeometryWorkspace::UseWorkspace: Start " << G4endl;
|
||||
}
|
||||
|
||||
// Implementation originally in:
|
||||
// G4WorkerThread::BuildGeometryAndPhysicsVector()
|
||||
// and improved for G4PVParamaterised
|
||||
|
||||
// Geometry related, split classes mechanism: instantiate sub-instance
|
||||
// for this thread
|
||||
//
|
||||
fpLogicalVolumeSIM->UseWorkArea(fLogicalVolumeOffset);
|
||||
fpPhysicalVolumeSIM->UseWorkArea(fPhysicalVolumeOffset);
|
||||
|
||||
@@ -124,11 +123,11 @@ G4GeometryWorkspace::UseWorkspace()
|
||||
//
|
||||
void G4GeometryWorkspace::ReleaseWorkspace()
|
||||
{
|
||||
fpLogicalVolumeSIM->UseWorkArea(0);
|
||||
fpPhysicalVolumeSIM->UseWorkArea(0);
|
||||
fpLogicalVolumeSIM->UseWorkArea(nullptr);
|
||||
fpPhysicalVolumeSIM->UseWorkArea(nullptr);
|
||||
|
||||
fpReplicaSIM->UseWorkArea(0);
|
||||
fpRegionSIM->UseWorkArea(0);
|
||||
fpReplicaSIM->UseWorkArea(nullptr);
|
||||
fpRegionSIM->UseWorkArea(nullptr);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
@@ -136,7 +135,7 @@ void G4GeometryWorkspace::ReleaseWorkspace()
|
||||
void G4GeometryWorkspace::InitialisePhysicalVolumes()
|
||||
{
|
||||
G4PhysicalVolumeStore* physVolStore = G4PhysicalVolumeStore::GetInstance();
|
||||
for (size_t ip=0; ip<physVolStore->size(); ++ip)
|
||||
for (std::size_t ip=0; ip<physVolStore->size(); ++ip)
|
||||
{
|
||||
G4VPhysicalVolume* physVol = (*physVolStore)[ip];
|
||||
G4LogicalVolume *logicalVol = physVol->GetLogicalVolume();
|
||||
@@ -144,11 +143,11 @@ void G4GeometryWorkspace::InitialisePhysicalVolumes()
|
||||
// Use shadow pointer
|
||||
//
|
||||
G4VSolid* solid = logicalVol->GetMasterSolid();
|
||||
G4PVReplica* g4PVReplica = nullptr;
|
||||
g4PVReplica = dynamic_cast<G4PVReplica*>(physVol);
|
||||
G4PVReplica* g4PVReplica = dynamic_cast<G4PVReplica*>(physVol);
|
||||
if (g4PVReplica == nullptr)
|
||||
{
|
||||
// Placement volume
|
||||
//
|
||||
logicalVol->InitialiseWorker(logicalVol,solid,0);
|
||||
}
|
||||
else
|
||||
@@ -165,7 +164,7 @@ void G4GeometryWorkspace::InitialisePhysicalVolumes()
|
||||
}
|
||||
else
|
||||
{
|
||||
G4PVParameterised *paramVol = dynamic_cast<G4PVParameterised*>(physVol);
|
||||
G4PVParameterised* paramVol = dynamic_cast<G4PVParameterised*>(physVol);
|
||||
if (paramVol == nullptr)
|
||||
{
|
||||
G4Exception("G4GeometryWorkspace::CreateAndUseWorkspace()",
|
||||
@@ -188,12 +187,10 @@ void G4GeometryWorkspace::InitialisePhysicalVolumes()
|
||||
//
|
||||
G4bool G4GeometryWorkspace::CloneReplicaSolid( G4PVReplica *replicaPV )
|
||||
{
|
||||
// The solid Ptr is in the Logical Volume
|
||||
//
|
||||
G4LogicalVolume* logicalV = replicaPV->GetLogicalVolume();
|
||||
G4VSolid* solid = logicalV->GetSolid();
|
||||
|
||||
G4AutoLock aLock(&solidclone);
|
||||
G4AutoLock aLock(&mutex_init);
|
||||
G4VSolid* workerSolid = solid->Clone();
|
||||
aLock.unlock();
|
||||
|
||||
@@ -205,7 +202,7 @@ G4bool G4GeometryWorkspace::CloneReplicaSolid( G4PVReplica *replicaPV )
|
||||
{
|
||||
// In the case that not all solids support(ed) the Clone()
|
||||
// method, we do similar thing here to dynamically cast
|
||||
// and then get the clone method.
|
||||
// and then get the clone method
|
||||
//
|
||||
G4ExceptionDescription ed;
|
||||
ed << "ERROR - Unable to initialise geometry for worker node." << "\n"
|
||||
@@ -220,7 +217,7 @@ G4bool G4GeometryWorkspace::CloneReplicaSolid( G4PVReplica *replicaPV )
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// Each G4PVParameterised instance, has associated with it at least one
|
||||
// Each G4PVParameterised instance has associated with it at least one
|
||||
// solid for each worker thread.
|
||||
// *Simple* Parameterisations have a single type of solid, and the
|
||||
// pointer points to the same instance of a solid during the simulation.
|
||||
@@ -259,16 +256,16 @@ CloneParameterisedSolids( G4PVParameterised* paramVol )
|
||||
// "GeomVol0001", FatalException, ed);
|
||||
// }
|
||||
|
||||
// Threads may attempt to clone a solids simultaneously.
|
||||
// Threads may attempt to clone a solid simultaneously.
|
||||
// Those cloned solids will be registered into a shared solid
|
||||
// store (C++ container). Need a lock to guarantee thread safety
|
||||
//
|
||||
G4AutoLock aLock(&solidclone);
|
||||
G4AutoLock aLock(&mutex_init);
|
||||
G4VSolid *workerSolid = solid->Clone();
|
||||
aLock.unlock();
|
||||
if( workerSolid != nullptr )
|
||||
{
|
||||
logicalV->InitialiseWorker(logicalV,workerSolid,0);
|
||||
logicalV->InitialiseWorker(logicalV, workerSolid, nullptr);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -297,10 +294,6 @@ void G4GeometryWorkspace::InitialiseWorkspace()
|
||||
<< " Copying geometry - Start " << G4endl;
|
||||
}
|
||||
|
||||
// Implementation originally in:
|
||||
// G4WorkerThread::BuildGeometryAndPhysicsVector()
|
||||
// and improved for G4PVParamaterised
|
||||
|
||||
// Geometry related, split classes mechanism:
|
||||
// Do *NOT* instantiate sub-instance for this thread, just copy the contents!
|
||||
//
|
||||
@@ -323,35 +316,25 @@ void G4GeometryWorkspace::InitialiseWorkspace()
|
||||
void G4GeometryWorkspace::DestroyWorkspace()
|
||||
{
|
||||
G4PhysicalVolumeStore* physVolStore = G4PhysicalVolumeStore::GetInstance();
|
||||
for (size_t ip=0; ip<physVolStore->size(); ++ip)
|
||||
for (std::size_t ip=0; ip<physVolStore->size(); ++ip)
|
||||
{
|
||||
G4VPhysicalVolume* physVol = (*physVolStore)[ip];
|
||||
G4LogicalVolume* logicalVol = physVol->GetLogicalVolume();
|
||||
G4PVReplica* g4PVReplica = nullptr;
|
||||
g4PVReplica = dynamic_cast<G4PVReplica*>(physVol);
|
||||
G4PVReplica* g4PVReplica = dynamic_cast<G4PVReplica*>(physVol);
|
||||
if (g4PVReplica != nullptr)
|
||||
{
|
||||
g4PVReplica->TerminateWorker(g4PVReplica);
|
||||
G4PVParameterised* paramVol = nullptr;
|
||||
paramVol = dynamic_cast<G4PVParameterised*>(physVol);
|
||||
if (paramVol != nullptr)
|
||||
{
|
||||
// G4VSolid* solid = logicalVol->fSolid;
|
||||
logicalVol->TerminateWorker(logicalVol);
|
||||
// if( solid->IsClone() ) delete solid;
|
||||
}
|
||||
else
|
||||
{
|
||||
logicalVol->TerminateWorker(logicalVol);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
logicalVol->TerminateWorker(logicalVol);
|
||||
}
|
||||
logicalVol->TerminateWorker(logicalVol);
|
||||
}
|
||||
|
||||
// Threads may attempt to free memory simultaneously.
|
||||
// Need a lock to guarantee thread safety
|
||||
//
|
||||
G4AutoLock aLock(&mutex_init);
|
||||
fpLogicalVolumeSIM->FreeSlave();
|
||||
fpPhysicalVolumeSIM->FreeSlave();
|
||||
fpReplicaSIM->FreeSlave();
|
||||
fpRegionSIM->FreeSlave();
|
||||
aLock.unlock();
|
||||
}
|
||||
|
||||
@@ -47,7 +47,8 @@ G4LogicalBorderSurface(const G4String& name,
|
||||
G4VPhysicalVolume* vol2,
|
||||
G4SurfaceProperty* surfaceProperty)
|
||||
: G4LogicalSurface(name, surfaceProperty),
|
||||
Volume1(vol1), Volume2(vol2)
|
||||
Volume1(vol1), Volume2(vol2),
|
||||
Index(theBorderSurfaceTable != nullptr ? theBorderSurfaceTable->size() : 0)
|
||||
{
|
||||
if (theBorderSurfaceTable == nullptr)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user