Import Geant4 11.2.2 source tree

This commit is contained in:
Gabriele Cosmo
2024-06-21 15:46:33 +02:00
parent dda54bbdcf
commit f7b23877ed
411 changed files with 22817 additions and 21317 deletions
+4
View File
@@ -6,6 +6,10 @@ It must **not** be used as a substitute for writing good git commit messages!
-------------------------------------------------------------------------------
## 2024-04-17 Ben Morgan (field-V11-01-07)
- Fix maybe-uninitialized warnings found in ATLAS builds
- Reported in internal ATLASSIM-6058 ticket.
## 2023-11-03 Gabriele Cosmo (field-V11-01-06)
- Reinstated default DormandPrince745 stepper.
@@ -130,7 +130,7 @@ void G4DormandPrince745::Stepper(const G4double yInput[],
dc7 = -(- 1.0 / 40.0);
const G4int numberOfVariables = GetNumberOfVariables();
State yTemp;
State yTemp = {0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.};
// The number of variables to be integrated over
//
@@ -304,7 +304,7 @@ void G4DormandPrince745::SetupInterpolation5thOrder()
b98 = -805.0 / 4104.0;
const G4int numberOfVariables = GetNumberOfVariables();
State yTemp;
State yTemp = {0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.};
// Evaluate the extra stages
//
@@ -115,8 +115,10 @@ G4MagInt_Driver::AccurateAdvance(G4FieldTrack& y_current,
G4FieldTrack yFldTrkStart(y_current);
#endif
G4double y[G4FieldTrack::ncompSVEC], dydx[G4FieldTrack::ncompSVEC];
G4double ystart[G4FieldTrack::ncompSVEC], yEnd[G4FieldTrack::ncompSVEC];
G4double y[G4FieldTrack::ncompSVEC] = {0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.};
G4double dydx[G4FieldTrack::ncompSVEC] = {0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.};
G4double ystart[G4FieldTrack::ncompSVEC] = {0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.};
G4double yEnd[G4FieldTrack::ncompSVEC] = {0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.};
G4double x1, x2;
G4bool succeeded = true;
+5
View File
@@ -6,6 +6,11 @@ It must **not** be used as a substitute for writing good git commit messages!
-------------------------------------------------------------------------------
## 2024-04-21 Gabriele Cosmo (geomnav-V11-01-09)
- Fixed compilation error in G4Navigator on Windows VC++ with
C++20 Standard enabled.
Based on [GitHub PR#69](https://github.com/Geant4/geant4/pull/69).
## 2023-11-17 Gabriele Cosmo (geomnav-V11-01-08)
- Fixed "/geometry/test/check_parallel" UI command in G4GeometryMessenger.
@@ -1031,7 +1031,7 @@ G4double G4Navigator::ComputeStep( const G4ThreeVector& pGlobalpoint,
<< " (local position: " << newLocalPoint << ")" << G4endl
<< " (local direction: " << localDirection << ")." << G4endl
<< " Previous phys volume: '"
<< ( fLastMotherPhys != nullptr ? fLastMotherPhys->GetName() : "" )
<< ( fLastMotherPhys != nullptr ? fLastMotherPhys->GetName() : G4String("") )
<< "'" << G4endl << G4endl;
if( actAndReport || abandon )
{
+3
View File
@@ -6,6 +6,9 @@ It must **not** be used as a substitute for writing good git commit messages!
-------------------------------------------------------------------------------
## 2024-02-01 Gabriele Cosmo (geom-specific-V11-01-07)
- Use std::size_t for array sizes in G4PolyhedraSide and G4PolyPhiFace.
## 2023-07-10 Evgueni Tcherniaev (geom-specific-V11-01-06)
- Fixed bounding box calculation in G4VTwistedFaceted::BoundingLimits().
@@ -43,7 +43,7 @@
// Author: David C. Williams (davidw@scipp.ucsc.edu)
// --------------------------------------------------------------------
#ifndef G4POLYPHIFACE_HH
#define G4POLYPHIFACE_HH
#define G4POLYPHIFACE_HH 1
#include "G4VCSGface.hh"
#include "G4TwoVector.hh"
@@ -65,7 +65,7 @@ struct G4PolyPhiFaceVertex
struct G4PolyPhiFaceEdge
{
G4PolyPhiFaceEdge() {}
G4PolyPhiFaceEdge() = default;
G4PolyPhiFaceVertex *v0{nullptr}, *v1{nullptr}; // Corners
G4double tr{.0}, tz{0.}, // Unit vector along edge
length{0.}; // Length of edge
@@ -205,7 +205,7 @@ class G4PolyPhiFace : public G4VCSGface
protected:
G4int numEdges; // Number of edges
G4int numEdges = 0; // Number of edges
G4PolyPhiFaceEdge* edges = nullptr; // The edges of the face
G4PolyPhiFaceVertex* corners = nullptr; // And the corners
G4ThreeVector normal; // Normal unit vector
@@ -56,7 +56,7 @@ G4PolyPhiFace::G4PolyPhiFace( const G4ReduciblePolygon* rz,
kCarTolerance = G4GeometryTolerance::GetInstance()->GetSurfaceTolerance();
numEdges = rz->NumVertices();
rMin = rz->Amin();
rMax = rz->Amax();
zMin = rz->Bmin();
@@ -92,7 +92,8 @@ G4PolyPhiFace::G4PolyPhiFace( const G4ReduciblePolygon* rz,
//
// Allocate corners
//
corners = new G4PolyPhiFaceVertex[numEdges];
const std::size_t maxEdges = numEdges>0 ? numEdges : 1;
corners = new G4PolyPhiFaceVertex[maxEdges];
//
// Fill them
//
@@ -112,13 +113,13 @@ G4PolyPhiFace::G4PolyPhiFace( const G4ReduciblePolygon* rz,
// Add pointer on prev corner
//
if( corn == corners )
{ corn->prev = corners+numEdges-1;}
{ corn->prev = corners+maxEdges-1;}
else
{ corn->prev = helper; }
// Add pointer on next corner
//
if( corn < corners+numEdges-1 )
if( corn < corners+maxEdges-1 )
{ corn->next = corn+1;}
else
{ corn->next = corners; }
@@ -129,7 +130,7 @@ G4PolyPhiFace::G4PolyPhiFace( const G4ReduciblePolygon* rz,
//
// Allocate edges
//
edges = new G4PolyPhiFaceEdge[numEdges];
edges = new G4PolyPhiFaceEdge[maxEdges];
//
// Fill them
@@ -137,7 +138,7 @@ G4PolyPhiFace::G4PolyPhiFace( const G4ReduciblePolygon* rz,
G4double rFact = std::cos(0.5*deltaPhi);
G4double rFactNormalize = 1.0/std::sqrt(1.0+rFact*rFact);
G4PolyPhiFaceVertex* prev = corners+numEdges-1,
G4PolyPhiFaceVertex* prev = corners+maxEdges-1,
* here = corners;
G4PolyPhiFaceEdge* edge = edges;
do // Loop checking, 13.08.2015, G.Cosmo
@@ -176,12 +177,12 @@ G4PolyPhiFace::G4PolyPhiFace( const G4ReduciblePolygon* rz,
sideNorm += normal;
edge->norm3D = sideNorm.unit();
} while( edge++, prev=here, ++here < corners+numEdges );
} while( edge++, prev=here, ++here < corners+maxEdges );
//
// Go back and fill in corner "normals"
//
G4PolyPhiFaceEdge* prevEdge = edges+numEdges-1;
G4PolyPhiFaceEdge* prevEdge = edges+maxEdges-1;
edge = edges;
do // Loop checking, 13.08.2015, G.Cosmo
{
@@ -238,7 +239,7 @@ G4PolyPhiFace::G4PolyPhiFace( const G4ReduciblePolygon* rz,
// Combine it with the r/z direction from the face
//
edge->v0->norm3D = rNorm*xyVector.unit() + G4ThreeVector( 0, 0, zNorm );
} while( prevEdge=edge, ++edge < edges+numEdges );
} while( prevEdge=edge, ++edge < edges+maxEdges );
//
// Build point on surface
@@ -335,23 +336,25 @@ void G4PolyPhiFace::CopyStuff( const G4PolyPhiFace& source )
kCarTolerance = source.kCarTolerance;
fSurfaceArea = source.fSurfaceArea;
const std::size_t maxEdges = (numEdges > 0) ? numEdges : 1;
//
// Corner dynamic array
//
corners = new G4PolyPhiFaceVertex[numEdges];
corners = new G4PolyPhiFaceVertex[maxEdges];
G4PolyPhiFaceVertex *corn = corners,
*sourceCorn = source.corners;
do // Loop checking, 13.08.2015, G.Cosmo
{
*corn = *sourceCorn;
} while( ++sourceCorn, ++corn < corners+numEdges );
} while( ++sourceCorn, ++corn < corners+maxEdges );
//
// Edge dynamic array
//
edges = new G4PolyPhiFaceEdge[numEdges];
edges = new G4PolyPhiFaceEdge[maxEdges];
G4PolyPhiFaceVertex* prev = corners+numEdges-1,
G4PolyPhiFaceVertex* prev = corners+maxEdges-1,
* here = corners;
G4PolyPhiFaceEdge* edge = edges,
* sourceEdge = source.edges;
@@ -360,7 +363,7 @@ void G4PolyPhiFace::CopyStuff( const G4PolyPhiFace& source )
*edge = *sourceEdge;
edge->v0 = prev;
edge->v1 = here;
} while( ++sourceEdge, ++edge, prev=here, ++here < corners+numEdges );
} while( ++sourceEdge, ++edge, prev=here, ++here < corners+maxEdges );
}
// Intersect
@@ -1095,7 +1098,8 @@ void G4PolyPhiFace::Triangulate()
// The copy of Polycone is made and this copy is reordered in order to
// have a list of triangles. This list is used for GetPointOnFace().
auto tri_help = new G4PolyPhiFaceVertex[numEdges];
const std::size_t maxEdges = (numEdges > 0) ? numEdges : 1;
auto tri_help = new G4PolyPhiFaceVertex[maxEdges];
triangles = tri_help;
G4PolyPhiFaceVertex* triang = triangles;
@@ -1114,18 +1118,18 @@ void G4PolyPhiFace::Triangulate()
triang->r = helper->r;
triang->z = helper->z;
triang->x = helper->x;
triang->y= helper->y;
triang->y = helper->y;
// add pointer on prev corner
//
if( helper==corners )
{ triang->prev=triangles+numEdges-1; }
{ triang->prev=triangles+maxEdges-1; }
else
{ triang->prev=helper2; }
// add pointer on next corner
//
if( helper<corners+numEdges-1 )
if( helper<corners+maxEdges-1 )
{ triang->next=triang+1; }
else
{ triang->next=triangles; }
@@ -1229,11 +1233,11 @@ void G4PolyPhiFace::Triangulate()
if(chose>=Achose1 && chose<Achose2)
{
G4ThreeVector point;
point=points[i] ;
surface_point=point;
break;
point=points[i];
surface_point=point;
break;
}
i++; Achose1=Achose2;
++i; Achose1=Achose2;
} while( i<numEdges-2 );
delete [] tri_help;
@@ -108,13 +108,13 @@ G4PolyhedraSide::G4PolyhedraSide( const G4PolyhedraSideRZ* prevRZ,
//
// Construct side plane vector set
//
numSide = theNumSide;
deltaPhi = phiTotal/theNumSide;
numSide = theNumSide>0 ? theNumSide : 1;
deltaPhi = phiTotal/numSide;
endPhi = startPhi+phiTotal;
vecs = new G4PolyhedraSideVec[numSide];
edges = new G4PolyhedraSideEdge[phiIsOpen ? numSide+1 : numSide];
const std::size_t maxSides = numSide;
vecs = new G4PolyhedraSideVec[maxSides];
edges = new G4PolyhedraSideEdge[phiIsOpen ? maxSides+1 : maxSides];
//
// ...this is where we start
@@ -207,7 +207,7 @@ G4PolyhedraSide::G4PolyhedraSide( const G4PolyhedraSideRZ* prevRZ,
b1 = b2;
c1 = c2;
d1 = d2;
} while( ++vec < vecs+numSide );
} while( ++vec < vecs+maxSides );
//
// Clean up hanging edge
@@ -219,14 +219,14 @@ G4PolyhedraSide::G4PolyhedraSide( const G4PolyhedraSideRZ* prevRZ,
}
else
{
vecs[numSide-1].edges[1] = edges;
vecs[maxSides-1].edges[1] = edges;
}
//
// Go back and fill in remaining fields in edges
//
vec = vecs;
G4PolyhedraSideVec *prev = vecs+numSide-1;
G4PolyhedraSideVec *prev = vecs+maxSides-1;
do // Loop checking, 13.08.2015, G.Cosmo
{
edge = vec->edges[0]; // The edge between prev and vec
@@ -249,7 +249,7 @@ G4PolyhedraSide::G4PolyhedraSide( const G4PolyhedraSideRZ* prevRZ,
eNorm = vec->edgeNorm[1] + prev->edgeNorm[1];
edge->cornNorm[1] = eNorm.unit();
} while( prev=vec, ++vec < vecs + numSide );
} while( prev=vec, ++vec < vecs + maxSides );
if (phiIsOpen)
{
@@ -279,7 +279,7 @@ G4PolyhedraSide::G4PolyhedraSide( const G4PolyhedraSideRZ* prevRZ,
//
// Repeat for ending phi
//
vec = vecs + numSide - 1;
vec = vecs + maxSides - 1;
normvec = vec->edges[1]->corner[0] - vec->edges[1]->corner[1];
normvec = normvec.cross(vec->normal);
@@ -356,11 +356,11 @@ void G4PolyhedraSide::CopyStuff( const G4PolyhedraSide& source )
//
// The simple stuff
//
numSide = source.numSide;
r[0] = source.r[0];
r[1] = source.r[1];
z[0] = source.z[0];
z[1] = source.z[1];
numSide = source.numSide;
startPhi = source.startPhi;
deltaPhi = source.deltaPhi;
endPhi = source.endPhi;
@@ -380,7 +380,8 @@ void G4PolyhedraSide::CopyStuff( const G4PolyhedraSide& source )
//
// Duplicate edges
//
G4int numEdges = phiIsOpen ? numSide+1 : numSide;
const std::size_t numSides = (numSide > 0) ? numSide : 1;
const std::size_t numEdges = phiIsOpen ? numSides+1 : numSides;
edges = new G4PolyhedraSideEdge[numEdges];
G4PolyhedraSideEdge *edge = edges,
@@ -393,7 +394,7 @@ void G4PolyhedraSide::CopyStuff( const G4PolyhedraSide& source )
//
// Duplicate vecs
//
vecs = new G4PolyhedraSideVec[numSide];
vecs = new G4PolyhedraSideVec[numSides];
G4PolyhedraSideVec *vec = vecs,
*sourceVec = source.vecs;
@@ -402,7 +403,7 @@ void G4PolyhedraSide::CopyStuff( const G4PolyhedraSide& source )
*vec = *sourceVec;
vec->edges[0] = edges + (sourceVec->edges[0] - source.edges);
vec->edges[1] = edges + (sourceVec->edges[1] - source.edges);
} while( ++sourceVec, ++vec < vecs + numSide );
} while( ++sourceVec, ++vec < vecs + numSides );
}
// Intersect
+8
View File
@@ -6,6 +6,14 @@ It must **not** be used as a substitute for writing good git commit messages!
-------------------------------------------------------------------------------
## 2024-03-28 Gabriele Cosmo (geomvol-V11-01-03)
- Use 'const auto &' for iterator in G4LogicalSkinSurface::CleanSurfaceTable().
## 2024-03-08 Gabriele Cosmo
- Use std::map instead of std::vector to define G4LogicalSkinSurfaceTable,
to speedup search of skin surfaces in large tables, as already done
previously for G4LogicalBorderSurface. Addressing problem report #2598.
## 2023-10-24 Gabriele Cosmo (geomvol-V11-01-02)
- Minor cleanup and code indentation. No functional changes.
@@ -35,14 +35,15 @@
#ifndef G4LogicalSkinSurface_hh
#define G4LogicalSkinSurface_hh 1
#include <vector>
#include <map>
#include "G4LogicalSurface.hh"
class G4LogicalVolume;
class G4LogicalSkinSurface;
using G4LogicalSkinSurfaceTable = std::vector<G4LogicalSkinSurface*>;
using G4LogicalSkinSurfaceTable
= std::map<const G4LogicalVolume*, G4LogicalSkinSurface*>;
class G4LogicalSkinSurface : public G4LogicalSurface
{
@@ -51,7 +51,7 @@ G4LogicalSkinSurface::G4LogicalSkinSurface(const G4String& name,
}
// Store in the table of Surfaces
//
theSkinSurfaceTable->push_back(this);
theSkinSurfaceTable->insert(std::make_pair(logicalVolume, this));
}
// --------------------------------------------------------------------
@@ -99,10 +99,8 @@ G4LogicalSkinSurface::GetSurface(const G4LogicalVolume* vol)
{
if (theSkinSurfaceTable != nullptr)
{
for(auto pos : *theSkinSurfaceTable)
{
if (pos->GetLogicalVolume() == vol) { return pos; }
}
auto pos = theSkinSurfaceTable->find(vol);
if(pos != theSkinSurfaceTable->cend()) return pos->second;
}
return nullptr;
}
@@ -117,11 +115,12 @@ void G4LogicalSkinSurface::DumpInfo()
if (theSkinSurfaceTable != nullptr)
{
for(auto pos : *theSkinSurfaceTable)
for(const auto & pos : *theSkinSurfaceTable)
{
G4cout << pos->GetName() << " : " << G4endl
G4LogicalSkinSurface* pSurf = pos.second;
G4cout << pSurf->GetName() << " : " << G4endl
<< " Skin of logical volume "
<< pos->GetLogicalVolume()->GetName()
<< pSurf->GetLogicalVolume()->GetName()
<< G4endl;
}
}
@@ -133,9 +132,9 @@ void G4LogicalSkinSurface::CleanSurfaceTable()
{
if (theSkinSurfaceTable != nullptr)
{
for(auto pos : *theSkinSurfaceTable)
for(const auto & pos : *theSkinSurfaceTable)
{
if (pos != nullptr) { delete pos; }
delete pos.second;
}
theSkinSurfaceTable->clear();
}