Import Geant4 11.1.0 source tree

This commit is contained in:
Gabriele Cosmo
2022-12-09 14:43:28 +01:00
parent c07cea1fe0
commit 9f34590941
3810 changed files with 200490 additions and 182326 deletions
@@ -33,6 +33,7 @@
#include "globals.hh"
#include "G4BoundingEnvelope.hh"
#include "G4GeometryTolerance.hh"
#include "G4Normal3D.hh"
const G4double kCarTolerance =
G4GeometryTolerance::GetInstance()->GetSurfaceTolerance();
@@ -129,7 +130,7 @@ void G4BoundingEnvelope::CheckBoundingBox()
//
void G4BoundingEnvelope::CheckBoundingPolygons()
{
G4int nbases = fPolygons->size();
std::size_t nbases = fPolygons->size();
if (nbases < 2)
{
std::ostringstream message;
@@ -140,7 +141,7 @@ void G4BoundingEnvelope::CheckBoundingPolygons()
return;
}
G4int nsize = std::max((*fPolygons)[0]->size(),(*fPolygons)[1]->size());
std::size_t nsize = std::max((*fPolygons)[0]->size(),(*fPolygons)[1]->size());
if (nsize < 3)
{
std::ostringstream message;
@@ -154,9 +155,9 @@ void G4BoundingEnvelope::CheckBoundingPolygons()
return;
}
for (G4int k=0; k<nbases; ++k)
for (std::size_t k=0; k<nbases; ++k)
{
G4int np = (*fPolygons)[k]->size();
std::size_t np = (*fPolygons)[k]->size();
if (np == nsize) continue;
if (np == 1 && k==0) continue;
if (np == 1 && k==nbases-1) continue;
@@ -423,7 +424,7 @@ G4BoundingEnvelope::CalculateExtent(const EAxis pAxis,
std::vector<G4Point3D> vertices;
std::vector<std::pair<G4int, G4int>> bases;
TransformVertices(pTransform3D, vertices, bases);
G4int nbases = bases.size();
std::size_t nbases = bases.size();
// Create adjusted G4VoxelLimits box. New limits are extended by
// delta, kCarTolerance multiplied by max scale factor of
@@ -447,7 +448,7 @@ G4BoundingEnvelope::CalculateExtent(const EAxis pAxis,
G4Segment3D extent;
extent.first = G4Point3D( kInfinity, kInfinity, kInfinity);
extent.second = G4Point3D(-kInfinity,-kInfinity,-kInfinity);
for (G4int k=0; k<nbases-1; ++k)
for (std::size_t k=0; k<nbases-1; ++k)
{
baseA.resize(bases[k].second);
for (G4int i = 0; i < bases[k].second; ++i)
@@ -599,7 +600,7 @@ TransformVertices(const G4Transform3D& pTransform3D,
G4int index = 0;
for (auto i = ia; i != iaend; ++i)
{
G4int nv = (*i)->size();
G4int nv = (G4int)(*i)->size();
pBases.push_back(std::make_pair(index, nv));
index += nv;
}
@@ -680,14 +681,14 @@ G4BoundingEnvelope::CreateListOfEdges(const G4Polygon3D& baseA,
const G4Polygon3D& baseB,
std::vector<G4Segment3D>& pEdges) const
{
G4int na = baseA.size();
G4int nb = baseB.size();
std::size_t na = baseA.size();
std::size_t nb = baseB.size();
pEdges.clear();
if (na == nb)
{
pEdges.resize(3*na);
G4int k = na - 1;
for (G4int i=0; i<na; ++i)
std::size_t k = na - 1;
for (std::size_t i=0; i<na; ++i)
{
pEdges.push_back(G4Segment3D(baseA[i],baseB[i]));
pEdges.push_back(G4Segment3D(baseA[i],baseA[k]));
@@ -698,8 +699,8 @@ G4BoundingEnvelope::CreateListOfEdges(const G4Polygon3D& baseA,
else if (nb == 1)
{
pEdges.resize(2*na);
G4int k = na - 1;
for (G4int i=0; i<na; ++i)
std::size_t k = na - 1;
for (std::size_t i=0; i<na; ++i)
{
pEdges.push_back(G4Segment3D(baseA[i],baseA[k]));
pEdges.push_back(G4Segment3D(baseA[i],baseB[0]));
@@ -709,8 +710,8 @@ G4BoundingEnvelope::CreateListOfEdges(const G4Polygon3D& baseA,
else if (na == 1)
{
pEdges.resize(2*nb);
G4int k = nb - 1;
for (G4int i=0; i<nb; ++i)
std::size_t k = nb - 1;
for (std::size_t i=0; i<nb; ++i)
{
pEdges.push_back(G4Segment3D(baseB[i],baseB[k]));
pEdges.push_back(G4Segment3D(baseB[i],baseA[0]));
@@ -730,12 +731,12 @@ G4BoundingEnvelope::CreateListOfPlanes(const G4Polygon3D& baseA,
{
// Find centers of the bases and internal point of the prism
//
G4int na = baseA.size();
G4int nb = baseB.size();
std::size_t na = baseA.size();
std::size_t nb = baseB.size();
G4Point3D pa(0.,0.,0.), pb(0.,0.,0.), p0;
G4Normal3D norm;
for (G4int i=0; i<na; ++i) pa += baseA[i];
for (G4int i=0; i<nb; ++i) pb += baseB[i];
for (std::size_t i=0; i<na; ++i) pa += baseA[i];
for (std::size_t i=0; i<nb; ++i) pb += baseB[i];
pa /= na; pb /= nb; p0 = (pa+pb)/2.;
// Create list of planes
@@ -743,8 +744,8 @@ G4BoundingEnvelope::CreateListOfPlanes(const G4Polygon3D& baseA,
pPlanes.clear();
if (na == nb) // bases with equal number of vertices
{
G4int k = na - 1;
for (G4int i=0; i<na; ++i)
std::size_t k = na - 1;
for (std::size_t i=0; i<na; ++i)
{
norm = (baseB[k]-baseA[i]).cross(baseA[k]-baseB[i]);
if (norm.mag2() > kCarTolerance)
@@ -766,8 +767,8 @@ G4BoundingEnvelope::CreateListOfPlanes(const G4Polygon3D& baseA,
}
else if (nb == 1) // baseB has one vertex
{
G4int k = na - 1;
for (G4int i=0; i<na; ++i)
std::size_t k = na - 1;
for (std::size_t i=0; i<na; ++i)
{
norm = (baseA[i]-baseB[0]).cross(baseA[k]-baseB[0]);
if (norm.mag2() > kCarTolerance)
@@ -784,8 +785,8 @@ G4BoundingEnvelope::CreateListOfPlanes(const G4Polygon3D& baseA,
}
else if (na == 1) // baseA has one vertex
{
G4int k = nb - 1;
for (G4int i=0; i<nb; ++i)
std::size_t k = nb - 1;
for (std::size_t i=0; i<nb; ++i)
{
norm = (baseB[i]-baseA[0]).cross(baseB[k]-baseA[0]);
if (norm.mag2() > kCarTolerance)
@@ -803,8 +804,8 @@ G4BoundingEnvelope::CreateListOfPlanes(const G4Polygon3D& baseA,
// Ensure that normals of the planes point to outside
//
G4int nplanes = pPlanes.size();
for (G4int i=0; i<nplanes; ++i)
std::size_t nplanes = pPlanes.size();
for (std::size_t i=0; i<nplanes; ++i)
{
pPlanes[i].normalize();
if (pPlanes[i].distance(p0) > 0)
@@ -830,8 +831,8 @@ G4BoundingEnvelope::ClipEdgesByVoxel(const std::vector<G4Segment3D>& pEdges,
G4Point3D emin = pExtent.first;
G4Point3D emax = pExtent.second;
G4int nedges = pEdges.size();
for (G4int k=0; k<nedges; ++k)
std::size_t nedges = pEdges.size();
for (std::size_t k=0; k<nedges; ++k)
{
G4Point3D p1 = pEdges[k].first;
G4Point3D p2 = pEdges[k].second;
@@ -36,6 +36,7 @@
#endif
#include "geomdefs.hh"
#include "G4Normal3D.hh"
#include "G4Plane3D.hh"
//---------------------------------------------------------------------
@@ -75,7 +75,7 @@ G4double G4GeomTools::QuadArea(const G4TwoVector& A,
G4double G4GeomTools::PolygonArea(const G4TwoVectorList& p)
{
G4int n = p.size();
G4int n = (G4int)p.size();
if (n < 3) return 0.0; // degenerate polygon
G4double area = p[n-1].x()*p[0].y() - p[0].x()*p[n-1].y();
for(G4int i=1; i<n; ++i)
@@ -145,7 +145,7 @@ G4bool G4GeomTools::PointInTriangle(const G4TwoVector& A,
G4bool G4GeomTools::PointInPolygon(const G4TwoVector& p,
const G4TwoVectorList& v)
{
G4int Nv = v.size();
G4int Nv = (G4int)v.size();
G4bool in = false;
for (G4int i = 0, k = Nv - 1; i < Nv; k = i++)
{
@@ -169,7 +169,7 @@ G4bool G4GeomTools::IsConvex(const G4TwoVectorList& polygon)
G4bool gotNegative = false;
G4bool gotPositive = false;
G4int n = polygon.size();
G4int n = (G4int)polygon.size();
if (n <= 0) return false;
for (G4int icur=0; icur<n; ++icur)
{
@@ -197,7 +197,7 @@ G4bool G4GeomTools::TriangulatePolygon(const G4TwoVectorList& polygon,
std::vector<G4int> triangles;
G4bool reply = TriangulatePolygon(polygon,triangles);
G4int n = triangles.size();
G4int n = (G4int)triangles.size();
for (G4int i=0; i<n; ++i) result.push_back(polygon[triangles[i]]);
return reply;
}
@@ -213,7 +213,7 @@ G4bool G4GeomTools::TriangulatePolygon(const G4TwoVectorList& polygon,
// allocate and initialize list of Vertices in polygon
//
G4int n = polygon.size();
G4int n = (G4int)polygon.size();
if (n < 3) return false;
// we want a counter-clockwise polygon in V
@@ -312,7 +312,7 @@ void G4GeomTools::RemoveRedundantVertices(G4TwoVectorList& polygon,
// set special value to mark vertices for removal
G4double removeIt = kInfinity;
G4int nv = polygon.size();
G4int nv = (G4int)polygon.size();
// Main loop: check every three consecutive points, if the points
// are collinear then mark middle point for removal
@@ -620,7 +620,7 @@ G4ThreeVector G4GeomTools::QuadAreaNormal(const G4ThreeVector& A,
G4ThreeVector G4GeomTools::PolygonAreaNormal(const G4ThreeVectorList& p)
{
G4int n = p.size();
G4int n = (G4int)p.size();
if (n < 3) return G4ThreeVector(0,0,0); // degerate polygon
G4ThreeVector normal = p[n-1].cross(p[0]);
for(G4int i=1; i<n; ++i)
@@ -33,6 +33,7 @@
#include "G4Timer.hh"
#include "G4GeometryManager.hh"
#include "G4SystemOfUnits.hh"
#include "G4Threading.hh"
#ifdef G4GEOMETRY_VOXELDEBUG
#include "G4ios.hh"
@@ -78,7 +79,7 @@ G4GeometryManager::~G4GeometryManager()
G4bool G4GeometryManager::CloseGeometry(G4bool pOptimise, G4bool verbose,
G4VPhysicalVolume* pVolume)
{
if (!fIsClosed)
if (!fIsClosed && G4Threading::IsMasterThread())
{
if (pVolume != nullptr)
{
@@ -101,7 +102,7 @@ G4bool G4GeometryManager::CloseGeometry(G4bool pOptimise, G4bool verbose,
//
void G4GeometryManager::OpenGeometry(G4VPhysicalVolume* pVolume)
{
if (fIsClosed)
if (fIsClosed && G4Threading::IsMasterThread())
{
if (pVolume != nullptr)
{
@@ -357,7 +358,7 @@ G4GeometryManager::ReportVoxelStats( std::vector<G4SmartVoxelStat> & stats,
//
// Get total memory use
//
G4int i, nStat = stats.size();
G4int i, nStat = (G4int)stats.size();
G4long totalMemory = 0;
for( i=0; i<nStat; ++i ) { totalMemory += stats[i].GetMemoryUse(); }
@@ -88,27 +88,14 @@ void G4LogicalVolumeStore::Clean()
//
locked = true;
std::size_t i = 0;
G4LogicalVolumeStore* store = GetInstance();
#ifdef G4GEOMETRY_VOXELDEBUG
G4cout << "Deleting Logical Volumes ... ";
#endif
for(auto pos=store->cbegin(); pos!=store->cend(); ++pos)
{
if (fgNotifier != nullptr) { fgNotifier->NotifyDeRegistration(); }
if (*pos != nullptr) { (*pos)->Lock(); delete *pos; }
++i;
}
#ifdef G4GEOMETRY_VOXELDEBUG
if (store->size() < i-1)
{ G4cout << "No volumes deleted. Already deleted by user ?" << G4endl; }
else
{ G4cout << i-1 << " volumes deleted !" << G4endl; }
#endif
store->bmap.clear(); store->mvalid = false;
locked = false;
store->clear();
@@ -90,26 +90,14 @@ void G4PhysicalVolumeStore::Clean()
//
locked = true;
std::size_t i=0;
G4PhysicalVolumeStore* store = GetInstance();
#ifdef G4GEOMETRY_VOXELDEBUG
G4cout << "Deleting Physical Volumes ... ";
#endif
for(auto pos=store->cbegin(); pos!=store->cend(); ++pos)
{
if (fgNotifier != nullptr) { fgNotifier->NotifyDeRegistration(); }
delete *pos; ++i;
delete *pos;
}
#ifdef G4GEOMETRY_VOXELDEBUG
if (store->size() < i-1)
{ G4cout << "No volumes deleted. Already deleted by user ?" << G4endl; }
else
{ G4cout << i-1 << " volumes deleted !" << G4endl; }
#endif
store->bmap.clear(); store->mvalid = false;
locked = false;
store->clear();
+11 -11
View File
@@ -175,7 +175,7 @@ void G4Region::ScanVolumeTree(G4LogicalVolume* lv, G4bool region)
// its material to the list if not already present
//
G4Region* currentRegion = nullptr;
size_t noDaughters = lv->GetNoDaughters();
std::size_t noDaughters = lv->GetNoDaughters();
G4Material* volMat = lv->GetMaterial();
if((volMat == nullptr) && fInMassGeometry)
{
@@ -217,10 +217,10 @@ void G4Region::ScanVolumeTree(G4LogicalVolume* lv, G4bool region)
if (pParam->GetMaterialScanner() != nullptr)
{
size_t matNo = pParam->GetMaterialScanner()->GetNumberOfMaterials();
for (size_t mat=0; mat<matNo; ++mat)
std::size_t matNo = pParam->GetMaterialScanner()->GetNumberOfMaterials();
for (std::size_t mat=0; mat<matNo; ++mat)
{
volMat = pParam->GetMaterialScanner()->GetMaterial(mat);
volMat = pParam->GetMaterialScanner()->GetMaterial((G4int)mat);
if(!volMat && fInMassGeometry)
{
std::ostringstream message;
@@ -242,10 +242,10 @@ void G4Region::ScanVolumeTree(G4LogicalVolume* lv, G4bool region)
}
else
{
size_t repNo = daughterPVol->GetMultiplicity();
for (size_t rep=0; rep<repNo; ++rep)
std::size_t repNo = daughterPVol->GetMultiplicity();
for (std::size_t rep=0; rep<repNo; ++rep)
{
volMat = pParam->ComputeMaterial(rep, daughterPVol);
volMat = pParam->ComputeMaterial((G4int)rep, daughterPVol);
if((volMat == nullptr) && fInMassGeometry)
{
std::ostringstream message;
@@ -270,7 +270,7 @@ void G4Region::ScanVolumeTree(G4LogicalVolume* lv, G4bool region)
}
else
{
for (size_t i=0; i<noDaughters; ++i)
for (std::size_t i=0; i<noDaughters; ++i)
{
G4LogicalVolume* daughterLVol = lv->GetDaughter(i)->GetLogicalVolume();
if (!daughterLVol->IsRootRegion())
@@ -416,7 +416,7 @@ G4bool G4Region::BelongsTo(G4VPhysicalVolume* thePhys) const
G4LogicalVolume* currLog = thePhys->GetLogicalVolume();
if (currLog->GetRegion()==this) {return true;}
G4int nDaughters = currLog->GetNoDaughters();
std::size_t nDaughters = currLog->GetNoDaughters();
while (nDaughters--) // Loop checking, 06.08.2015, G.Cosmo
{
if (BelongsTo(currLog->GetDaughter(nDaughters))) {return true;}
@@ -475,12 +475,12 @@ G4Region* G4Region::GetParentRegion(G4bool& unique) const
//
for(auto lvItr=lvStore->cbegin(); lvItr!=lvStore->cend(); ++lvItr)
{
G4int nD = (*lvItr)->GetNoDaughters();
std::size_t nD = (*lvItr)->GetNoDaughters();
G4Region* aR = (*lvItr)->GetRegion();
// Loop over all daughters of each logical volume
//
for(auto iD=0; iD<nD; ++iD)
for(std::size_t iD=0; iD<nD; ++iD)
{
if((*lvItr)->GetDaughter(iD)->GetLogicalVolume()->GetRegion()==this)
{
@@ -91,26 +91,14 @@ void G4RegionStore::Clean()
//
locked = true;
std::size_t i=0;
G4RegionStore* store = GetInstance();
#ifdef G4GEOMETRY_VOXELDEBUG
G4cout << "Deleting Regions ... ";
#endif
for(auto pos=store->cbegin(); pos!=store->cend(); ++pos)
{
if (fgNotifier != nullptr) { fgNotifier->NotifyDeRegistration(); }
delete *pos; ++i;
delete *pos;
}
#ifdef G4GEOMETRY_VOXELDEBUG
if (store->size() < i-1)
{ G4cout << "No regions deleted. Already deleted by user ?" << G4endl; }
else
{ G4cout << i-1 << " regions deleted !" << G4endl; }
#endif
store->bmap.clear(); store->mvalid = false;
locked = false;
store->clear();
@@ -338,8 +326,8 @@ void G4RegionStore::SetWorldVolume()
//
G4PhysicalVolumeStore* fPhysicalVolumeStore
= G4PhysicalVolumeStore::GetInstance();
size_t nPhys = fPhysicalVolumeStore->size();
for(size_t iPhys=0; iPhys<nPhys; ++iPhys)
std::size_t nPhys = fPhysicalVolumeStore->size();
for(std::size_t iPhys=0; iPhys<nPhys; ++iPhys)
{
G4VPhysicalVolume* fPhys = (*fPhysicalVolumeStore)[iPhys];
if(fPhys->GetMotherLogical() != nullptr) { continue; } // not a world volume
@@ -62,7 +62,7 @@ G4SmartVoxelHeader::G4SmartVoxelHeader(G4LogicalVolume* pVolume,
fmaxEquivalent(pSlice),
fparamAxis(kUndefined)
{
size_t nDaughters = pVolume->GetNoDaughters();
std::size_t nDaughters = pVolume->GetNoDaughters();
// Determine whether daughter is replicated
//
@@ -121,7 +121,7 @@ G4SmartVoxelHeader::~G4SmartVoxelHeader()
// Manually destroy underlying nodes/headers
// Delete collected headers and nodes once only
//
size_t node, proxy, maxNode=fslices.size();
std::size_t node, proxy, maxNode=fslices.size();
G4SmartVoxelProxy* lastProxy = nullptr;
G4SmartVoxelNode *dyingNode, *lastNode=nullptr;
G4SmartVoxelHeader *dyingHeader, *lastHeader=nullptr;
@@ -179,7 +179,7 @@ G4bool G4SmartVoxelHeader::operator == (const G4SmartVoxelHeader& pHead) const
&& (GetMinExtent() == pHead.GetMinExtent())
&& (GetMaxExtent() == pHead.GetMaxExtent()) )
{
size_t node, maxNode;
std::size_t node, maxNode;
G4SmartVoxelProxy *leftProxy, *rightProxy;
G4SmartVoxelHeader *leftHeader, *rightHeader;
G4SmartVoxelNode *leftNode, *rightNode;
@@ -239,13 +239,13 @@ G4bool G4SmartVoxelHeader::operator == (const G4SmartVoxelHeader& pHead) const
void G4SmartVoxelHeader::BuildVoxels(G4LogicalVolume* pVolume)
{
G4VoxelLimits limits; // Create `unlimited' limits object
size_t nDaughters = pVolume->GetNoDaughters();
std::size_t nDaughters = pVolume->GetNoDaughters();
G4VolumeNosVector targetList;
targetList.reserve(nDaughters);
for (size_t i=0; i<nDaughters; ++i)
for (std::size_t i=0; i<nDaughters; ++i)
{
targetList.push_back(i);
targetList.push_back((G4int)i);
}
BuildVoxelsWithinLimits(pVolume, limits, &targetList);
}
@@ -444,7 +444,7 @@ G4SmartVoxelHeader::BuildVoxelsWithinLimits(G4LogicalVolume* pVolume,
G4double goodSliceScore=kInfinity, testSliceScore;
EAxis goodSliceAxis = kXAxis;
EAxis testAxis = kXAxis;
size_t node, maxNode, iaxis;
std::size_t node, maxNode, iaxis;
G4VoxelLimits noLimits;
// Try all non-limited cartesian axes
@@ -573,8 +573,8 @@ G4SmartVoxelHeader::BuildVoxelsWithinLimits(G4LogicalVolume* pVolume,
//
void G4SmartVoxelHeader::BuildEquivalentSliceNos()
{
size_t sliceNo, minNo, maxNo, equivNo;
size_t maxNode = fslices.size();
std::size_t sliceNo, minNo, maxNo, equivNo;
std::size_t maxNode = fslices.size();
G4SmartVoxelNode *startNode, *sampleNode;
for (sliceNo=0; sliceNo<maxNode; ++sliceNo)
{
@@ -599,8 +599,8 @@ void G4SmartVoxelHeader::BuildEquivalentSliceNos()
for (equivNo=minNo; equivNo<=maxNo; ++equivNo)
{
sampleNode = fslices[equivNo]->GetNode();
sampleNode->SetMinEquivalentSliceNo(minNo);
sampleNode->SetMaxEquivalentSliceNo(maxNo);
sampleNode->SetMinEquivalentSliceNo((G4int)minNo);
sampleNode->SetMaxEquivalentSliceNo((G4int)maxNo);
}
// Advance outer loop to end of equivalent group
//
@@ -620,8 +620,8 @@ void G4SmartVoxelHeader::BuildEquivalentSliceNos()
//
void G4SmartVoxelHeader::CollectEquivalentNodes()
{
size_t sliceNo, maxNo, equivNo;
size_t maxNode=fslices.size();
std::size_t sliceNo, maxNo, equivNo;
std::size_t maxNode=fslices.size();
G4SmartVoxelNode* equivNode;
G4SmartVoxelProxy* equivProxy;
@@ -667,8 +667,8 @@ void G4SmartVoxelHeader::CollectEquivalentNodes()
//
void G4SmartVoxelHeader::CollectEquivalentHeaders()
{
size_t sliceNo, maxNo, equivNo;
size_t maxNode = fslices.size();
std::size_t sliceNo, maxNo, equivNo;
std::size_t maxNode = fslices.size();
G4SmartVoxelHeader *equivHeader, *sampleHeader;
G4SmartVoxelProxy *equivProxy;
@@ -750,10 +750,10 @@ G4ProxyVector* G4SmartVoxelHeader::BuildNodes(G4LogicalVolume* pVolume,
G4VSolid *targetSolid;
G4AffineTransform targetTransform;
G4bool replicated;
size_t nCandidates = pCandidates->size();
size_t nVol, nNode, targetVolNo;
std::size_t nCandidates = pCandidates->size();
std::size_t nVol, nNode, targetVolNo;
G4VoxelLimits noLimits;
#ifdef G4GEOMETRY_VOXELDEBUG
G4cout << "**** G4SmartVoxelHeader::BuildNodes" << G4endl
<< " Limits = " << pLimits << G4endl
@@ -825,15 +825,15 @@ G4ProxyVector* G4SmartVoxelHeader::BuildNodes(G4LogicalVolume* pVolume,
{
// Find solid
//
targetSolid = pParam->ComputeSolid(targetVolNo,pDaughter);
targetSolid = pParam->ComputeSolid((G4int)targetVolNo,pDaughter);
// Setup solid
//
targetSolid->ComputeDimensions(pParam,targetVolNo,pDaughter);
targetSolid->ComputeDimensions(pParam,(G4int)targetVolNo,pDaughter);
// Setup transform
//
pParam->ComputeTransformation(targetVolNo,pDaughter);
pParam->ComputeTransformation((G4int)targetVolNo,pDaughter);
targetTransform = G4AffineTransform(pDaughter->GetRotation(),
pDaughter->GetTranslation());
}
@@ -966,7 +966,7 @@ G4ProxyVector* G4SmartVoxelHeader::BuildNodes(G4LogicalVolume* pVolume,
for (nNode=0; G4long(nNode)<noNodes; ++nNode)
{
G4SmartVoxelNode *pNode;
pNode = new G4SmartVoxelNode(nNode);
pNode = new G4SmartVoxelNode((G4int)nNode);
if (pNode == nullptr)
{
G4Exception("G4SmartVoxelHeader::BuildNodes()", "GeomMgt0003",
@@ -1064,11 +1064,11 @@ G4ProxyVector* G4SmartVoxelHeader::BuildNodes(G4LogicalVolume* pVolume,
G4double G4SmartVoxelHeader::CalculateQuality(G4ProxyVector *pSlice)
{
G4double quality;
size_t nNodes = pSlice->size();
size_t noContained, maxContained=0, sumContained=0, sumNonEmptyNodes=0;
std::size_t nNodes = pSlice->size();
std::size_t noContained, maxContained=0, sumContained=0, sumNonEmptyNodes=0;
G4SmartVoxelNode *node;
for (size_t i=0; i<nNodes; ++i)
for (std::size_t i=0; i<nNodes; ++i)
{
if ((*pSlice)[i]->IsNode())
{
@@ -1130,8 +1130,8 @@ G4double G4SmartVoxelHeader::CalculateQuality(G4ProxyVector *pSlice)
void G4SmartVoxelHeader::RefineNodes(G4LogicalVolume* pVolume,
G4VoxelLimits pLimits)
{
size_t refinedDepth=0, minVolumes;
size_t maxNode = fslices.size();
std::size_t refinedDepth=0, minVolumes;
std::size_t maxNode = fslices.size();
if (pLimits.IsXLimited())
{
@@ -1163,7 +1163,7 @@ void G4SmartVoxelHeader::RefineNodes(G4LogicalVolume* pVolume,
if (refinedDepth<2)
{
size_t targetNo, noContainedDaughters, minNo, maxNo, replaceNo, i;
std::size_t targetNo, noContainedDaughters, minNo, maxNo, replaceNo, i;
G4double sliceWidth = (fmaxExtent-fminExtent)/maxNode;
G4VoxelLimits newLimits;
G4SmartVoxelNode* targetNode;
@@ -1194,7 +1194,7 @@ void G4SmartVoxelHeader::RefineNodes(G4LogicalVolume* pVolume,
targetList->reserve(noContainedDaughters);
for (i=0; i<noContainedDaughters; ++i)
{
targetList->push_back(targetNode->GetVolume(i));
targetList->push_back(targetNode->GetVolume((G4int)i));
}
minNo = targetNode->GetMinEquivalentSliceNo();
maxNo = targetNode->GetMaxEquivalentSliceNo();
@@ -1232,15 +1232,15 @@ void G4SmartVoxelHeader::RefineNodes(G4LogicalVolume* pVolume,
newLimits.AddLimit(faxis,fminExtent+sliceWidth*minNo,
fminExtent+sliceWidth*(maxNo+1));
replaceHeader = new G4SmartVoxelHeader(pVolume,newLimits,
targetList,replaceNo);
targetList,(G4int)replaceNo);
if (replaceHeader == nullptr)
{
G4Exception("G4SmartVoxelHeader::RefineNodes()", "GeomMgt0003",
FatalException, "Refined VoxelHeader allocation error.");
return;
}
replaceHeader->SetMinEquivalentSliceNo(minNo);
replaceHeader->SetMaxEquivalentSliceNo(maxNo);
replaceHeader->SetMinEquivalentSliceNo((G4int)minNo);
replaceHeader->SetMaxEquivalentSliceNo((G4int)maxNo);
replaceHeaderProxy = new G4SmartVoxelProxy(replaceHeader);
if (replaceHeaderProxy == nullptr)
{
@@ -1271,13 +1271,13 @@ void G4SmartVoxelHeader::RefineNodes(G4LogicalVolume* pVolume,
//
G4bool G4SmartVoxelHeader::AllSlicesEqual() const
{
size_t noSlices = fslices.size();
std::size_t noSlices = fslices.size();
G4SmartVoxelProxy* refProxy;
if (noSlices>1)
{
refProxy=fslices[0];
for (size_t i=1; i<noSlices; ++i)
for (std::size_t i=1; i<noSlices; ++i)
{
if (refProxy!=fslices[i])
{
@@ -1296,9 +1296,9 @@ std::ostream& operator << (std::ostream& os, const G4SmartVoxelHeader& h)
{
os << "Axis = " << G4int(h.faxis) << G4endl;
G4SmartVoxelProxy *collectNode=nullptr, *collectHead=nullptr;
G4int collectNodeNo = 0;
G4int collectHeadNo = 0;
size_t i, j;
std::size_t collectNodeNo = 0;
std::size_t collectHeadNo = 0;
std::size_t i, j;
G4bool haveHeaders = false;
for (i=0; i<h.fslices.size(); ++i)
@@ -1309,9 +1309,9 @@ std::ostream& operator << (std::ostream& os, const G4SmartVoxelHeader& h)
if (h.fslices[i]!=collectNode)
{
os << "{";
for (size_t k=0; k<h.fslices[i]->GetNode()->GetNoContained(); ++k)
for (std::size_t k=0; k<h.fslices[i]->GetNode()->GetNoContained(); ++k)
{
os << " " << h.fslices[i]->GetNode()->GetVolume(k);
os << " " << h.fslices[i]->GetNode()->GetVolume((G4int)k);
}
os << " }" << G4endl;
collectNode = h.fslices[i];
@@ -52,7 +52,7 @@ G4bool G4SmartVoxelNode::operator == (const G4SmartVoxelNode& v) const
{
for (std::size_t node=0; node<maxNode; ++node)
{
if (GetVolume(node) != v.GetVolume(node))
if (GetVolume((G4int)node) != v.GetVolume((G4int)node))
{
return false;
}
@@ -118,13 +118,13 @@ G4long G4SmartVoxelStat::GetMemoryUse() const
//
void G4SmartVoxelStat::CountHeadsAndNodes( const G4SmartVoxelHeader* head )
{
G4int numSlices = head->GetNoSlices();
std::size_t numSlices = head->GetNoSlices();
pointers += numSlices;
const G4SmartVoxelProxy* lastProxy = nullptr;
for(auto i=0; i<numSlices; ++i)
for(std::size_t i=0; i<numSlices; ++i)
{
const G4SmartVoxelProxy *proxy = head->GetSlice(i);
if (proxy == lastProxy) continue;
+1 -13
View File
@@ -87,26 +87,14 @@ void G4SolidStore::Clean()
//
locked = true;
std::size_t i = 0;
G4SolidStore* store = GetInstance();
#ifdef G4GEOMETRY_VOXELDEBUG
G4cout << "Deleting Solids ... ";
#endif
for(auto pos=store->cbegin(); pos!=store->cend(); ++pos)
{
if (fgNotifier != nullptr) { fgNotifier->NotifyDeRegistration(); }
delete *pos; ++i;
delete *pos;
}
#ifdef G4GEOMETRY_VOXELDEBUG
if (store->size() < i-1)
{ G4cout << "No solids deleted. Already deleted by user ?" << G4endl; }
else
{ G4cout << i-1 << " solids deleted !" << G4endl; }
#endif
store->bmap.clear(); store->mvalid = false;
locked = false;
store->clear();
+2 -2
View File
@@ -496,7 +496,7 @@ G4VSolid::CalculateClippedPolygonExtent(G4ThreeVectorList& pPolygon,
G4double component;
ClipPolygon(pPolygon,pVoxelLimit,pAxis);
noLeft = pPolygon.size();
noLeft = (G4int)pPolygon.size();
if ( noLeft )
{
@@ -614,7 +614,7 @@ G4VSolid::ClipPolygonToSimpleLimits( G4ThreeVectorList& pPolygon,
const G4VoxelLimits& pVoxelLimit ) const
{
G4int i;
G4int noVertices=pPolygon.size();
G4int noVertices = (G4int)pPolygon.size();
G4ThreeVector vEnd,vStart;
for (i = 0 ; i < noVertices ; ++i )