Import Geant4 11.1.0 source tree
This commit is contained in:
@@ -101,7 +101,7 @@ G4bool G4ClippablePolygon::GetExtent( const EAxis axis,
|
||||
//
|
||||
// Okay, how many entries do we have?
|
||||
//
|
||||
G4int noLeft = vertices.size();
|
||||
std::size_t noLeft = vertices.size();
|
||||
|
||||
//
|
||||
// Return false if nothing is left
|
||||
@@ -116,7 +116,7 @@ G4bool G4ClippablePolygon::GetExtent( const EAxis axis,
|
||||
//
|
||||
// Compare to the rest
|
||||
//
|
||||
for( G4int i=1; i<noLeft; ++i )
|
||||
for( std::size_t i=1; i<noLeft; ++i )
|
||||
{
|
||||
G4double component = vertices[i].operator()( axis );
|
||||
if (component < min )
|
||||
@@ -135,15 +135,17 @@ G4bool G4ClippablePolygon::GetExtent( const EAxis axis,
|
||||
//
|
||||
const G4ThreeVector* G4ClippablePolygon::GetMinPoint( const EAxis axis ) const
|
||||
{
|
||||
G4int noLeft = vertices.size();
|
||||
std::size_t noLeft = vertices.size();
|
||||
if (noLeft==0)
|
||||
{
|
||||
G4Exception("G4ClippablePolygon::GetMinPoint()",
|
||||
"GeomSolids0002", FatalException, "Empty polygon.");
|
||||
|
||||
}
|
||||
|
||||
const G4ThreeVector *answer = &(vertices[0]);
|
||||
G4double min = answer->operator()(axis);
|
||||
|
||||
for( G4int i=1; i<noLeft; ++i )
|
||||
for( std::size_t i=1; i<noLeft; ++i )
|
||||
{
|
||||
G4double component = vertices[i].operator()( axis );
|
||||
if (component < min)
|
||||
@@ -163,15 +165,17 @@ const G4ThreeVector* G4ClippablePolygon::GetMinPoint( const EAxis axis ) const
|
||||
//
|
||||
const G4ThreeVector* G4ClippablePolygon::GetMaxPoint( const EAxis axis ) const
|
||||
{
|
||||
G4int noLeft = vertices.size();
|
||||
std::size_t noLeft = vertices.size();
|
||||
if (noLeft==0)
|
||||
{
|
||||
G4Exception("G4ClippablePolygon::GetMaxPoint()",
|
||||
"GeomSolids0002", FatalException, "Empty polygon.");
|
||||
|
||||
}
|
||||
|
||||
const G4ThreeVector *answer = &(vertices[0]);
|
||||
G4double max = answer->operator()(axis);
|
||||
|
||||
for( G4int i=1; i<noLeft; ++i )
|
||||
for( std::size_t i=1; i<noLeft; ++i )
|
||||
{
|
||||
G4double component = vertices[i].operator()( axis );
|
||||
if (component > max)
|
||||
@@ -205,7 +209,7 @@ G4bool G4ClippablePolygon::InFrontOf( const G4ClippablePolygon& other,
|
||||
//
|
||||
// If things are empty, do something semi-sensible
|
||||
//
|
||||
G4int noLeft = vertices.size();
|
||||
std::size_t noLeft = vertices.size();
|
||||
if (noLeft==0) return false;
|
||||
|
||||
if (other.Empty()) return true;
|
||||
@@ -269,7 +273,7 @@ G4bool G4ClippablePolygon::BehindOf( const G4ClippablePolygon& other,
|
||||
//
|
||||
// If things are empty, do something semi-sensible
|
||||
//
|
||||
G4int noLeft = vertices.size();
|
||||
std::size_t noLeft = vertices.size();
|
||||
if (noLeft==0) return false;
|
||||
|
||||
if (other.Empty()) return true;
|
||||
@@ -334,7 +338,7 @@ G4bool G4ClippablePolygon::GetPlanerExtent( const G4ThreeVector& pointOnPlane,
|
||||
//
|
||||
// Okay, how many entries do we have?
|
||||
//
|
||||
G4int noLeft = vertices.size();
|
||||
std::size_t noLeft = vertices.size();
|
||||
|
||||
//
|
||||
// Return false if nothing is left
|
||||
@@ -349,7 +353,7 @@ G4bool G4ClippablePolygon::GetPlanerExtent( const G4ThreeVector& pointOnPlane,
|
||||
//
|
||||
// Compare to the rest
|
||||
//
|
||||
for( G4int i=1; i<noLeft; ++i )
|
||||
for( std::size_t i=1; i<noLeft; ++i )
|
||||
{
|
||||
G4double component = planeNormal.dot(vertices[i] - pointOnPlane);
|
||||
if (component < min )
|
||||
@@ -413,12 +417,12 @@ void G4ClippablePolygon::ClipToSimpleLimits( G4ThreeVectorList& pPolygon,
|
||||
G4ThreeVectorList& outputPolygon,
|
||||
const G4VoxelLimits& pVoxelLimit )
|
||||
{
|
||||
G4int noVertices = pPolygon.size();
|
||||
std::size_t noVertices = pPolygon.size();
|
||||
G4ThreeVector vEnd,vStart;
|
||||
|
||||
outputPolygon.clear();
|
||||
|
||||
for (G4int i=0; i<noVertices; ++i)
|
||||
for (std::size_t i=0; i<noVertices; ++i)
|
||||
{
|
||||
vStart=pPolygon[i];
|
||||
if (i==noVertices-1)
|
||||
|
||||
@@ -342,7 +342,7 @@ G4ThreeVector G4Ellipsoid::SurfaceNormal( const G4ThreeVector& p) const
|
||||
{
|
||||
#ifdef G4SPECSDEBUG
|
||||
std::ostringstream message;
|
||||
G4int oldprc = message.precision(16);
|
||||
G4long oldprc = message.precision(16);
|
||||
message << "Point p is not on surface (!?) of solid: "
|
||||
<< GetName() << "\n";
|
||||
message << "Position:\n";
|
||||
@@ -542,7 +542,7 @@ G4double G4Ellipsoid::DistanceToOut(const G4ThreeVector& p,
|
||||
{
|
||||
#ifdef G4SPECSDEBUG
|
||||
std::ostringstream message;
|
||||
G4int oldprc = message.precision(16);
|
||||
G4long oldprc = message.precision(16);
|
||||
message << "Point p is outside (!?) of solid: "
|
||||
<< GetName() << G4endl;
|
||||
message << "Position: " << p << G4endl;;
|
||||
@@ -659,7 +659,7 @@ G4VSolid* G4Ellipsoid::Clone() const
|
||||
|
||||
std::ostream& G4Ellipsoid::StreamInfo( std::ostream& os ) const
|
||||
{
|
||||
G4int oldprc = os.precision(16);
|
||||
G4long oldprc = os.precision(16);
|
||||
os << "-----------------------------------------------------------\n"
|
||||
<< " *** Dump for solid - " << GetName() << " ***\n"
|
||||
<< " ===================================================\n"
|
||||
|
||||
@@ -304,7 +304,7 @@ G4ThreeVector G4EllipticalCone::SurfaceNormal( const G4ThreeVector& p) const
|
||||
//
|
||||
#ifdef G4CSGDEBUG
|
||||
std::ostringstream message;
|
||||
G4int oldprc = message.precision(16);
|
||||
G4long oldprc = message.precision(16);
|
||||
message << "Point p is not on surface (!?) of solid: "
|
||||
<< GetName() << G4endl;
|
||||
message << "Position:\n";
|
||||
@@ -738,7 +738,7 @@ G4double G4EllipticalCone::DistanceToOut(const G4ThreeVector& p,
|
||||
default: // Should never reach this case ...
|
||||
DumpInfo();
|
||||
std::ostringstream message;
|
||||
G4int oldprc = message.precision(16);
|
||||
G4long oldprc = message.precision(16);
|
||||
message << "Undefined side for valid surface normal to solid."
|
||||
<< G4endl
|
||||
<< "Position:" << G4endl
|
||||
@@ -774,7 +774,7 @@ G4double G4EllipticalCone::DistanceToOut(const G4ThreeVector& p) const
|
||||
if( Inside(p) == kOutside )
|
||||
{
|
||||
std::ostringstream message;
|
||||
G4int oldprc = message.precision(16);
|
||||
G4long oldprc = message.precision(16);
|
||||
message << "Point p is outside (!?) of solid: " << GetName() << "\n"
|
||||
<< "Position:\n"
|
||||
<< " p.x() = " << p.x()/mm << " mm\n"
|
||||
@@ -817,7 +817,7 @@ G4VSolid* G4EllipticalCone::Clone() const
|
||||
|
||||
std::ostream& G4EllipticalCone::StreamInfo( std::ostream& os ) const
|
||||
{
|
||||
G4int oldprc = os.precision(16);
|
||||
G4long oldprc = os.precision(16);
|
||||
os << "-----------------------------------------------------------\n"
|
||||
<< " *** Dump for solid - " << GetName() << " ***\n"
|
||||
<< " ===================================================\n"
|
||||
|
||||
@@ -306,7 +306,7 @@ G4ThreeVector G4EllipticalTube::SurfaceNormal( const G4ThreeVector& p ) const
|
||||
//
|
||||
#ifdef G4SPECDEBUG
|
||||
std::ostringstream message;
|
||||
G4int oldprc = message.precision(16);
|
||||
G4long oldprc = message.precision(16);
|
||||
message << "Point p is not on surface (!?) of solid: "
|
||||
<< GetName() << G4endl;
|
||||
message << "Position:\n";
|
||||
@@ -505,7 +505,7 @@ G4double G4EllipticalTube::DistanceToOut( const G4ThreeVector& p,
|
||||
{
|
||||
#ifdef G4SPECDEBUG
|
||||
std::ostringstream message;
|
||||
G4int oldprc = message.precision(16);
|
||||
G4long oldprc = message.precision(16);
|
||||
message << "Point p is outside (!?) of solid: "
|
||||
<< GetName() << G4endl;
|
||||
message << "Position: " << p << G4endl;;
|
||||
@@ -588,7 +588,7 @@ G4double G4EllipticalTube::DistanceToOut( const G4ThreeVector& p ) const
|
||||
if( Inside(p) == kOutside )
|
||||
{
|
||||
std::ostringstream message;
|
||||
G4int oldprc = message.precision(16);
|
||||
G4long oldprc = message.precision(16);
|
||||
message << "Point p is outside (!?) of solid: " << GetName() << "\n"
|
||||
<< "Position:\n"
|
||||
<< " p.x() = " << p.x()/mm << " mm\n"
|
||||
@@ -683,7 +683,7 @@ G4double G4EllipticalTube::GetSurfaceArea()
|
||||
|
||||
std::ostream& G4EllipticalTube::StreamInfo(std::ostream& os) const
|
||||
{
|
||||
G4int oldprc = os.precision(16);
|
||||
G4long oldprc = os.precision(16);
|
||||
os << "-----------------------------------------------------------\n"
|
||||
<< " *** Dump for solid - " << GetName() << " ***\n"
|
||||
<< " ===================================================\n"
|
||||
|
||||
@@ -93,7 +93,7 @@ G4ExtrudedSolid::G4ExtrudedSolid( const G4String& pName,
|
||||
FatalErrorInArgument, message);
|
||||
}
|
||||
|
||||
for ( G4int i=0; i<fNz-1; ++i )
|
||||
for ( std::size_t i=0; i<fNz-1; ++i )
|
||||
{
|
||||
if ( zsections[i].fZ > zsections[i+1].fZ )
|
||||
{
|
||||
@@ -124,13 +124,13 @@ G4ExtrudedSolid::G4ExtrudedSolid( const G4String& pName,
|
||||
2*kCarTolerance);
|
||||
if (removedVertices.size() != 0)
|
||||
{
|
||||
G4int nremoved = removedVertices.size();
|
||||
std::size_t nremoved = removedVertices.size();
|
||||
std::ostringstream message;
|
||||
message << "The following "<< nremoved
|
||||
<< " vertices have been removed from polygon in " << pName
|
||||
<< "\nas collinear or coincident with other vertices: "
|
||||
<< removedVertices[0];
|
||||
for (G4int i=1; i<nremoved; ++i) message << ", " << removedVertices[i];
|
||||
for (std::size_t i=1; i<nremoved; ++i) message << ", " << removedVertices[i];
|
||||
G4Exception("G4ExtrudedSolid::G4ExtrudedSolid()", "GeomSolids1001",
|
||||
JustWarning, message);
|
||||
}
|
||||
@@ -219,13 +219,13 @@ G4ExtrudedSolid::G4ExtrudedSolid( const G4String& pName,
|
||||
2*kCarTolerance);
|
||||
if (removedVertices.size() != 0)
|
||||
{
|
||||
G4int nremoved = removedVertices.size();
|
||||
std::size_t nremoved = removedVertices.size();
|
||||
std::ostringstream message;
|
||||
message << "The following "<< nremoved
|
||||
<< " vertices have been removed from polygon in " << pName
|
||||
<< "\nas collinear or coincident with other vertices: "
|
||||
<< removedVertices[0];
|
||||
for (G4int i=1; i<nremoved; ++i) message << ", " << removedVertices[i];
|
||||
for (std::size_t i=1; i<nremoved; ++i) message << ", " << removedVertices[i];
|
||||
G4Exception("G4ExtrudedSolid::G4ExtrudedSolid()", "GeomSolids1001",
|
||||
JustWarning, message);
|
||||
}
|
||||
@@ -347,7 +347,7 @@ void G4ExtrudedSolid::ComputeProjectionParameters()
|
||||
// p0 = (p(z) - offset(z))/scale(z);
|
||||
//
|
||||
|
||||
for ( G4int iz=0; iz<fNz-1; ++iz)
|
||||
for (std::size_t iz=0; iz<fNz-1; ++iz)
|
||||
{
|
||||
G4double z1 = fZSections[iz].fZ;
|
||||
G4double z2 = fZSections[iz+1].fZ;
|
||||
@@ -374,9 +374,9 @@ void G4ExtrudedSolid::ComputeLateralPlanes()
|
||||
{
|
||||
// Compute lateral planes: a*x + b*y + c*z + d = 0
|
||||
//
|
||||
G4int Nv = fPolygon.size();
|
||||
std::size_t Nv = fPolygon.size();
|
||||
fPlanes.resize(Nv);
|
||||
for (G4int i=0, k=Nv-1; i<Nv; k=i++)
|
||||
for (std::size_t i=0, k=Nv-1; i<Nv; k=i++)
|
||||
{
|
||||
G4TwoVector norm = (fPolygon[i] - fPolygon[k]).unit();
|
||||
fPlanes[i].a = -norm.y();
|
||||
@@ -390,7 +390,7 @@ void G4ExtrudedSolid::ComputeLateralPlanes()
|
||||
//
|
||||
fLines.resize(Nv);
|
||||
fLengths.resize(Nv);
|
||||
for (G4int i=0, k=Nv-1; i<Nv; k=i++)
|
||||
for (std::size_t i=0, k=Nv-1; i<Nv; k=i++)
|
||||
{
|
||||
if (fPolygon[k].y() == fPolygon[i].y())
|
||||
{
|
||||
@@ -431,7 +431,7 @@ G4TwoVector G4ExtrudedSolid::ProjectPoint(const G4ThreeVector& point) const
|
||||
|
||||
// Select projection (z-segment of the solid) according to p.z()
|
||||
//
|
||||
G4int iz = 0;
|
||||
std::size_t iz = 0;
|
||||
while ( point.z() > fZSections[iz+1].fZ && iz < fNz-2 ) { ++iz; }
|
||||
// Loop checking, 13.08.2015, G.Cosmo
|
||||
|
||||
@@ -607,9 +607,9 @@ G4ExtrudedSolid::MakeUpFacet(G4int ind1, G4int ind2, G4int ind3) const
|
||||
// forming the upper side ( z>0 )
|
||||
|
||||
std::vector<G4ThreeVector> vertices;
|
||||
vertices.push_back(GetVertex(fNz-1, ind1));
|
||||
vertices.push_back(GetVertex(fNz-1, ind2));
|
||||
vertices.push_back(GetVertex(fNz-1, ind3));
|
||||
vertices.push_back(GetVertex((G4int)fNz-1, ind1));
|
||||
vertices.push_back(GetVertex((G4int)fNz-1, ind2));
|
||||
vertices.push_back(GetVertex((G4int)fNz-1, ind3));
|
||||
|
||||
// first vertex most left
|
||||
//
|
||||
@@ -646,7 +646,7 @@ G4bool G4ExtrudedSolid::AddGeneralPolygonFacets()
|
||||
// Fill one more vector
|
||||
//
|
||||
std::vector< Vertex > verticesToBeDone;
|
||||
for ( G4int i=0; i<fNv; ++i )
|
||||
for ( G4int i=0; i<(G4int)fNv; ++i )
|
||||
{
|
||||
verticesToBeDone.push_back(Vertex(fPolygon[i], i));
|
||||
}
|
||||
@@ -671,7 +671,7 @@ G4bool G4ExtrudedSolid::AddGeneralPolygonFacets()
|
||||
|
||||
//G4cout << "angle " << angle << G4endl;
|
||||
|
||||
G4int counter = 0;
|
||||
std::size_t counter = 0;
|
||||
while ( angle >= (pi-kAngTolerance) ) // Loop checking, 13.08.2015, G.Cosmo
|
||||
{
|
||||
// G4cout << "Skipping concave vertex " << c2->second << G4endl;
|
||||
@@ -692,7 +692,7 @@ G4bool G4ExtrudedSolid::AddGeneralPolygonFacets()
|
||||
|
||||
++counter;
|
||||
|
||||
if ( counter > fNv)
|
||||
if ( counter > fNv )
|
||||
{
|
||||
G4Exception("G4ExtrudedSolid::AddGeneralPolygonFacets",
|
||||
"GeomSolids0003", FatalException,
|
||||
@@ -772,9 +772,9 @@ G4bool G4ExtrudedSolid::MakeFacets()
|
||||
GetVertex(0, 2), ABSOLUTE) );
|
||||
if ( ! good ) { return false; }
|
||||
|
||||
good = AddFacet( new G4TriangularFacet( GetVertex(fNz-1, 2),
|
||||
GetVertex(fNz-1, 1),
|
||||
GetVertex(fNz-1, 0),
|
||||
good = AddFacet( new G4TriangularFacet( GetVertex((G4int)fNz-1, 2),
|
||||
GetVertex((G4int)fNz-1, 1),
|
||||
GetVertex((G4int)fNz-1, 0),
|
||||
ABSOLUTE) );
|
||||
if ( ! good ) { return false; }
|
||||
|
||||
@@ -792,10 +792,10 @@ G4bool G4ExtrudedSolid::MakeFacets()
|
||||
ABSOLUTE) );
|
||||
if ( ! good ) { return false; }
|
||||
|
||||
good = AddFacet( new G4QuadrangularFacet( GetVertex(fNz-1, 3),
|
||||
GetVertex(fNz-1, 2),
|
||||
GetVertex(fNz-1, 1),
|
||||
GetVertex(fNz-1, 0),
|
||||
good = AddFacet( new G4QuadrangularFacet( GetVertex((G4int)fNz-1, 3),
|
||||
GetVertex((G4int)fNz-1, 2),
|
||||
GetVertex((G4int)fNz-1, 1),
|
||||
GetVertex((G4int)fNz-1, 0),
|
||||
ABSOLUTE) );
|
||||
if ( ! good ) { return false; }
|
||||
|
||||
@@ -819,9 +819,9 @@ G4bool G4ExtrudedSolid::MakeFacets()
|
||||
|
||||
// The quadrangular sides
|
||||
//
|
||||
for ( G4int iz = 0; iz < fNz-1; ++iz )
|
||||
for ( G4int iz = 0; iz < (G4int)fNz-1; ++iz )
|
||||
{
|
||||
for ( G4int i = 0; i < fNv; ++i )
|
||||
for ( G4int i = 0; i < (G4int)fNv; ++i )
|
||||
{
|
||||
G4int j = (i+1) % fNv;
|
||||
good = AddFacet( new G4QuadrangularFacet
|
||||
@@ -863,8 +863,8 @@ EInside G4ExtrudedSolid::Inside(const G4ThreeVector &p) const
|
||||
G4double dist = std::max(fZSections[0].fZ-p.z(),p.z()-fZSections[1].fZ);
|
||||
if (dist > kCarToleranceHalf) { return kOutside; }
|
||||
|
||||
G4int np = fPlanes.size();
|
||||
for (G4int i=0; i<np; ++i)
|
||||
std::size_t np = fPlanes.size();
|
||||
for (std::size_t i=0; i<np; ++i)
|
||||
{
|
||||
G4double dd = fPlanes[i].a*p.x() + fPlanes[i].b*p.y() + fPlanes[i].d;
|
||||
if (dd > dist) { dist = dd; }
|
||||
@@ -915,7 +915,7 @@ EInside G4ExtrudedSolid::Inside(const G4ThreeVector &p) const
|
||||
|
||||
// Check if on surface of polygon
|
||||
//
|
||||
for ( G4int i=0; i<fNv; ++i )
|
||||
for ( G4int i=0; i<(G4int)fNv; ++i )
|
||||
{
|
||||
G4int j = (i+1) % fNv;
|
||||
if ( IsSameLineSegment(pscaled, fPolygon[i], fPolygon[j]) )
|
||||
@@ -966,7 +966,7 @@ EInside G4ExtrudedSolid::Inside(const G4ThreeVector &p) const
|
||||
G4ThreeVector G4ExtrudedSolid::SurfaceNormal(const G4ThreeVector& p) const
|
||||
{
|
||||
G4int nsurf = 0;
|
||||
G4double nx = 0, ny = 0, nz = 0;
|
||||
G4double nx = 0., ny = 0., nz = 0.;
|
||||
switch (fSolidType)
|
||||
{
|
||||
case 1: // convex right prism
|
||||
@@ -979,7 +979,7 @@ G4ThreeVector G4ExtrudedSolid::SurfaceNormal(const G4ThreeVector& p) const
|
||||
{
|
||||
nz = 1; ++nsurf;
|
||||
}
|
||||
for (G4int i=0; i<fNv; ++i)
|
||||
for (std::size_t i=0; i<fNv; ++i)
|
||||
{
|
||||
G4double dd = fPlanes[i].a*p.x() + fPlanes[i].b*p.y() + fPlanes[i].d;
|
||||
if (std::abs(dd) > kCarToleranceHalf) continue;
|
||||
@@ -1001,7 +1001,7 @@ G4ThreeVector G4ExtrudedSolid::SurfaceNormal(const G4ThreeVector& p) const
|
||||
}
|
||||
|
||||
G4double sqrCarToleranceHalf = kCarToleranceHalf*kCarToleranceHalf;
|
||||
for (G4int i=0, k=fNv-1; i<fNv; k=i++)
|
||||
for (std::size_t i=0, k=fNv-1; i<fNv; k=i++)
|
||||
{
|
||||
G4double ix = p.x() - fPolygon[i].x();
|
||||
G4double iy = p.y() - fPolygon[i].y();
|
||||
@@ -1049,7 +1049,7 @@ G4ThreeVector G4ExtrudedSolid::SurfaceNormal(const G4ThreeVector& p) const
|
||||
//
|
||||
#ifdef G4CSGDEBUG
|
||||
std::ostringstream message;
|
||||
G4int oldprc = message.precision(16);
|
||||
G4long oldprc = message.precision(16);
|
||||
message << "Point p is not on surface (!?) of solid: "
|
||||
<< GetName() << G4endl;
|
||||
message << "Position:\n";
|
||||
@@ -1083,9 +1083,9 @@ G4ThreeVector G4ExtrudedSolid::ApproxSurfaceNormal(const G4ThreeVector& p) const
|
||||
|
||||
// Find nearest lateral side and distance to it
|
||||
//
|
||||
G4int iside = 0;
|
||||
std::size_t iside = 0;
|
||||
G4double dd = DBL_MAX;
|
||||
for (G4int i=0, k=fNv-1; i<fNv; k=i++)
|
||||
for (std::size_t i=0, k=fNv-1; i<fNv; k=i++)
|
||||
{
|
||||
G4double ix = p.x() - fPolygon[i].x();
|
||||
G4double iy = p.y() - fPolygon[i].y();
|
||||
@@ -1179,9 +1179,9 @@ G4double G4ExtrudedSolid::DistanceToIn(const G4ThreeVector& p,
|
||||
|
||||
// Intersection with lateral planes
|
||||
//
|
||||
G4int np = fPlanes.size();
|
||||
std::size_t np = fPlanes.size();
|
||||
G4double txmin = tzmin, txmax = tzmax;
|
||||
for (G4int i=0; i<np; ++i)
|
||||
for (std::size_t i=0; i<np; ++i)
|
||||
{
|
||||
G4double cosa = fPlanes[i].a*v.x()+fPlanes[i].b*v.y();
|
||||
G4double dist = fPlanes[i].a*p.x()+fPlanes[i].b*p.y()+fPlanes[i].d;
|
||||
@@ -1223,8 +1223,8 @@ G4double G4ExtrudedSolid::DistanceToIn (const G4ThreeVector& p) const
|
||||
case 1: // convex right prism
|
||||
{
|
||||
G4double dist = std::max(fZSections[0].fZ-p.z(),p.z()-fZSections[1].fZ);
|
||||
G4int np = fPlanes.size();
|
||||
for (G4int i=0; i<np; ++i)
|
||||
std::size_t np = fPlanes.size();
|
||||
for (std::size_t i=0; i<np; ++i)
|
||||
{
|
||||
G4double dd = fPlanes[i].a*p.x() + fPlanes[i].b*p.y() + fPlanes[i].d;
|
||||
if (dd > dist) dist = dd;
|
||||
@@ -1292,8 +1292,8 @@ G4double G4ExtrudedSolid::DistanceToOut (const G4ThreeVector &p,
|
||||
|
||||
// Intersection with lateral planes
|
||||
//
|
||||
G4int np = fPlanes.size();
|
||||
for (G4int i=0; i<np; ++i)
|
||||
std::size_t np = fPlanes.size();
|
||||
for (std::size_t i=0; i<np; ++i)
|
||||
{
|
||||
G4double cosa = fPlanes[i].a*v.x()+fPlanes[i].b*v.y();
|
||||
if (cosa > 0)
|
||||
@@ -1305,7 +1305,7 @@ G4double G4ExtrudedSolid::DistanceToOut (const G4ThreeVector &p,
|
||||
return 0;
|
||||
}
|
||||
G4double tmp = -dist/cosa;
|
||||
if (tmax > tmp) { tmax = tmp; iside = i; }
|
||||
if (tmax > tmp) { tmax = tmp; iside = (G4int)i; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1344,8 +1344,8 @@ G4double G4ExtrudedSolid::DistanceToOut(const G4ThreeVector& p) const
|
||||
case 1: // convex right prism
|
||||
{
|
||||
G4double dist = std::max(fZSections[0].fZ-p.z(),p.z()-fZSections[1].fZ);
|
||||
G4int np = fPlanes.size();
|
||||
for (G4int i=0; i<np; ++i)
|
||||
std::size_t np = fPlanes.size();
|
||||
for (std::size_t i=0; i<np; ++i)
|
||||
{
|
||||
G4double dd = fPlanes[i].a*p.x() + fPlanes[i].b*p.y() + fPlanes[i].d;
|
||||
if (dd > dist) dist = dd;
|
||||
@@ -1474,7 +1474,7 @@ G4ExtrudedSolid::CalculateExtent(const EAxis pAxis,
|
||||
// main loop along triangles
|
||||
pMin = kInfinity;
|
||||
pMax = -kInfinity;
|
||||
G4int ntria = triangles.size()/3;
|
||||
G4int ntria = (G4int)triangles.size()/3;
|
||||
for (G4int i=0; i<ntria; ++i)
|
||||
{
|
||||
G4int i3 = i*3;
|
||||
@@ -1518,7 +1518,7 @@ G4ExtrudedSolid::CalculateExtent(const EAxis pAxis,
|
||||
|
||||
std::ostream& G4ExtrudedSolid::StreamInfo(std::ostream &os) const
|
||||
{
|
||||
G4int oldprc = os.precision(16);
|
||||
G4long oldprc = os.precision(16);
|
||||
os << "-----------------------------------------------------------\n"
|
||||
<< " *** Dump for solid - " << GetName() << " ***\n"
|
||||
<< " ===================================================\n"
|
||||
@@ -1529,7 +1529,7 @@ std::ostream& G4ExtrudedSolid::StreamInfo(std::ostream &os) const
|
||||
else
|
||||
{ os << " Concave polygon; list of vertices:" << G4endl; }
|
||||
|
||||
for ( G4int i=0; i<fNv; ++i )
|
||||
for ( std::size_t i=0; i<fNv; ++i )
|
||||
{
|
||||
os << std::setw(5) << "#" << i
|
||||
<< " vx = " << fPolygon[i].x()/mm << " mm"
|
||||
@@ -1537,7 +1537,7 @@ std::ostream& G4ExtrudedSolid::StreamInfo(std::ostream &os) const
|
||||
}
|
||||
|
||||
os << " Sections:" << G4endl;
|
||||
for ( G4int iz=0; iz<fNz; ++iz )
|
||||
for ( std::size_t iz=0; iz<fNz; ++iz )
|
||||
{
|
||||
os << " z = " << fZSections[iz].fZ/mm << " mm "
|
||||
<< " x0= " << fZSections[iz].fOffset.x()/mm << " mm "
|
||||
|
||||
@@ -82,8 +82,8 @@ G4GenericPolycone::G4GenericPolycone( const G4String& name,
|
||||
// conversion of arguments
|
||||
//
|
||||
void G4GenericPolycone::Create( G4double phiStart,
|
||||
G4double phiTotal,
|
||||
G4ReduciblePolygon *rz )
|
||||
G4double phiTotal,
|
||||
G4ReduciblePolygon *rz )
|
||||
{
|
||||
//
|
||||
// Perform checks of rz values
|
||||
@@ -237,7 +237,7 @@ void G4GenericPolycone::Create( G4double phiStart,
|
||||
//
|
||||
// We might have dropped a face or two: recalculate numFace
|
||||
//
|
||||
numFace = face-faces;
|
||||
numFace = (G4int)(face-faces);
|
||||
|
||||
//
|
||||
// Make enclosingCylinder
|
||||
@@ -532,7 +532,7 @@ G4GenericPolycone::CalculateExtent(const EAxis pAxis,
|
||||
// main loop along triangles
|
||||
pMin = kInfinity;
|
||||
pMax =-kInfinity;
|
||||
G4int ntria = triangles.size()/3;
|
||||
G4int ntria = (G4int)triangles.size()/3;
|
||||
for (G4int i=0; i<ntria; ++i)
|
||||
{
|
||||
G4int i3 = i*3;
|
||||
@@ -606,7 +606,7 @@ G4VSolid* G4GenericPolycone::Clone() const
|
||||
//
|
||||
std::ostream& G4GenericPolycone::StreamInfo( std::ostream& os ) const
|
||||
{
|
||||
G4int oldprc = os.precision(16);
|
||||
G4long oldprc = os.precision(16);
|
||||
os << "-----------------------------------------------------------\n"
|
||||
<< " *** Dump for solid - " << GetName() << " ***\n"
|
||||
<< " ===================================================\n"
|
||||
@@ -730,7 +730,7 @@ void G4GenericPolycone::SetSurfaceElements() const
|
||||
contourRZ.push_back(G4TwoVector(corner.r, corner.z));
|
||||
}
|
||||
G4GeomTools::TriangulatePolygon(contourRZ, triangles);
|
||||
G4int ntria = triangles.size();
|
||||
G4int ntria = (G4int)triangles.size();
|
||||
for (G4int i=0; i<ntria; i+=3)
|
||||
{
|
||||
G4GenericPolycone::surface_element selem;
|
||||
|
||||
@@ -1119,7 +1119,7 @@ G4double G4GenericTrap::DistanceToOut(const G4ThreeVector& p,
|
||||
default:
|
||||
DumpInfo();
|
||||
std::ostringstream message;
|
||||
G4int oldprc = message.precision(16);
|
||||
G4long oldprc = message.precision(16);
|
||||
message << "Undefined side for valid surface normal to solid." << G4endl
|
||||
<< "Position:" << G4endl
|
||||
<< " p.x() = " << p.x()/mm << " mm" << G4endl
|
||||
@@ -1271,7 +1271,7 @@ G4VSolid* G4GenericTrap::Clone() const
|
||||
|
||||
std::ostream& G4GenericTrap::StreamInfo(std::ostream& os) const
|
||||
{
|
||||
G4int oldprc = os.precision(16);
|
||||
G4long oldprc = os.precision(16);
|
||||
os << "-----------------------------------------------------------\n"
|
||||
<< " *** Dump for solid - " << GetName() << " *** \n"
|
||||
<< " =================================================== \n"
|
||||
@@ -1621,7 +1621,7 @@ void G4GenericTrap::ReorderVertices(std::vector<G4ThreeVector>& vertices) const
|
||||
|
||||
std::vector<G4ThreeVector> oldVertices(vertices);
|
||||
|
||||
for ( size_t i=0; i<oldVertices.size(); ++i )
|
||||
for ( std::size_t i=0; i<oldVertices.size(); ++i )
|
||||
{
|
||||
vertices[i] = oldVertices[oldVertices.size()-1-i];
|
||||
}
|
||||
@@ -2029,7 +2029,7 @@ G4Polyhedron* G4GenericTrap::CreatePolyhedron() const
|
||||
// Construct extra Points, if Twisted Side
|
||||
//
|
||||
G4Polyhedron* polyhedron;
|
||||
size_t nVertices, nFacets;
|
||||
G4int nVertices, nFacets;
|
||||
|
||||
G4int subdivisions = 0;
|
||||
if (fIsTwisted)
|
||||
|
||||
@@ -1126,7 +1126,7 @@ G4double G4Hype::GetSurfaceArea()
|
||||
//
|
||||
std::ostream& G4Hype::StreamInfo(std::ostream& os) const
|
||||
{
|
||||
G4int oldprc = os.precision(16);
|
||||
G4long oldprc = os.precision(16);
|
||||
os << "-----------------------------------------------------------\n"
|
||||
<< " *** Dump for solid - " << GetName() << " ***\n"
|
||||
<< " ===================================================\n"
|
||||
|
||||
@@ -819,7 +819,7 @@ G4double G4Paraboloid::DistanceToOut(const G4ThreeVector& p) const
|
||||
G4cout << G4endl ;
|
||||
DumpInfo();
|
||||
std::ostringstream message;
|
||||
G4int oldprc = message.precision(16);
|
||||
G4long oldprc = message.precision(16);
|
||||
message << "Point p is outside !?" << G4endl
|
||||
<< "Position:" << G4endl
|
||||
<< " p.x() = " << p.x()/mm << " mm" << G4endl
|
||||
@@ -869,7 +869,7 @@ G4VSolid* G4Paraboloid::Clone() const
|
||||
//
|
||||
std::ostream& G4Paraboloid::StreamInfo( std::ostream& os ) const
|
||||
{
|
||||
G4int oldprc = os.precision(16);
|
||||
G4long oldprc = os.precision(16);
|
||||
os << "-----------------------------------------------------------\n"
|
||||
<< " *** Dump for solid - " << GetName() << " ***\n"
|
||||
<< " ===================================================\n"
|
||||
|
||||
@@ -318,7 +318,7 @@ void G4Polycone::Create( G4double phiStart,
|
||||
//
|
||||
// We might have dropped a face or two: recalculate numFace
|
||||
//
|
||||
numFace = face-faces;
|
||||
numFace = (G4int)(face-faces);
|
||||
|
||||
//
|
||||
// Make enclosingCylinder
|
||||
@@ -640,7 +640,7 @@ G4bool G4Polycone::CalculateExtent(const EAxis pAxis,
|
||||
// main loop along triangles
|
||||
pMin = kInfinity;
|
||||
pMax =-kInfinity;
|
||||
G4int ntria = triangles.size()/3;
|
||||
G4int ntria = (G4int)triangles.size()/3;
|
||||
for (G4int i=0; i<ntria; ++i)
|
||||
{
|
||||
G4int i3 = i*3;
|
||||
@@ -711,7 +711,7 @@ G4VSolid* G4Polycone::Clone() const
|
||||
//
|
||||
std::ostream& G4Polycone::StreamInfo( std::ostream& os ) const
|
||||
{
|
||||
G4int oldprc = os.precision(16);
|
||||
G4long oldprc = os.precision(16);
|
||||
os << "-----------------------------------------------------------\n"
|
||||
<< " *** Dump for solid - " << GetName() << " ***\n"
|
||||
<< " ===================================================\n"
|
||||
@@ -856,7 +856,7 @@ void G4Polycone::SetSurfaceElements() const
|
||||
contourRZ.push_back(G4TwoVector(corner.r, corner.z));
|
||||
}
|
||||
G4GeomTools::TriangulatePolygon(contourRZ, triangles);
|
||||
G4int ntria = triangles.size();
|
||||
G4int ntria = (G4int)triangles.size();
|
||||
for (G4int i=0; i<ntria; i+=3)
|
||||
{
|
||||
G4Polycone::surface_element selem;
|
||||
|
||||
@@ -343,7 +343,7 @@ void G4Polyhedra::Create( G4double phiStart,
|
||||
//
|
||||
// We might have dropped a face or two: recalculate numFace
|
||||
//
|
||||
numFace = face-faces;
|
||||
numFace = (G4int)(face-faces);
|
||||
|
||||
//
|
||||
// Make enclosingCylinder
|
||||
@@ -688,7 +688,7 @@ G4bool G4Polyhedra::CalculateExtent(const EAxis pAxis,
|
||||
// main loop along triangles
|
||||
pMin = kInfinity;
|
||||
pMax = -kInfinity;
|
||||
G4int ntria = triangles.size()/3;
|
||||
G4int ntria = (G4int)triangles.size()/3;
|
||||
for (G4int i=0; i<ntria; ++i)
|
||||
{
|
||||
G4double sinCur = sinStart;
|
||||
@@ -755,7 +755,7 @@ G4VSolid* G4Polyhedra::Clone() const
|
||||
//
|
||||
std::ostream& G4Polyhedra::StreamInfo( std::ostream& os ) const
|
||||
{
|
||||
G4int oldprc = os.precision(16);
|
||||
G4long oldprc = os.precision(16);
|
||||
os << "-----------------------------------------------------------\n"
|
||||
<< " *** Dump for solid - " << GetName() << " ***\n"
|
||||
<< " ===================================================\n"
|
||||
@@ -920,7 +920,7 @@ void G4Polyhedra::SetSurfaceElements() const
|
||||
contourRZ.push_back(G4TwoVector(corner.r, corner.z));
|
||||
}
|
||||
G4GeomTools::TriangulatePolygon(contourRZ, triangles);
|
||||
G4int ntria = triangles.size();
|
||||
G4int ntria = (G4int)triangles.size();
|
||||
for (G4int i=0; i<ntria; i+=3)
|
||||
{
|
||||
G4Polyhedra::surface_element selem;
|
||||
|
||||
@@ -173,8 +173,8 @@ void G4TessellatedSolid::Initialize()
|
||||
//
|
||||
void G4TessellatedSolid::DeleteObjects()
|
||||
{
|
||||
G4int size = fFacets.size();
|
||||
for (G4int i = 0; i < size; ++i) { delete fFacets[i]; }
|
||||
std::size_t size = fFacets.size();
|
||||
for (std::size_t i = 0; i < size; ++i) { delete fFacets[i]; }
|
||||
fFacets.clear();
|
||||
delete fpPolyhedron; fpPolyhedron = nullptr;
|
||||
}
|
||||
@@ -220,7 +220,7 @@ G4bool G4TessellatedSolid::AddFacet (G4VFacet* aFacet)
|
||||
= fFacetList.begin(), end = fFacetList.end(), pos, it;
|
||||
G4ThreeVector p = aFacet->GetCircumcentre();
|
||||
G4VertexInfo value;
|
||||
value.id = fFacetList.size();
|
||||
value.id = (G4int)fFacetList.size();
|
||||
value.mag2 = p.x() + p.y() + p.z();
|
||||
|
||||
G4bool found = false;
|
||||
@@ -284,7 +284,6 @@ G4int G4TessellatedSolid::SetAllUsingStack(const std::vector<G4int>& voxel,
|
||||
stack<vector<G4int> > pos;
|
||||
pos.push(xyz);
|
||||
G4int filled = 0;
|
||||
G4int cc = 0, nz = 0;
|
||||
|
||||
vector<G4int> candidates;
|
||||
|
||||
@@ -296,7 +295,6 @@ G4int G4TessellatedSolid::SetAllUsingStack(const std::vector<G4int>& voxel,
|
||||
if (!checked[index])
|
||||
{
|
||||
checked.SetBitNumber(index, true);
|
||||
++cc;
|
||||
|
||||
if (fVoxels.IsEmpty(index))
|
||||
{
|
||||
@@ -321,10 +319,6 @@ G4int G4TessellatedSolid::SetAllUsingStack(const std::vector<G4int>& voxel,
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
++nz;
|
||||
}
|
||||
}
|
||||
}
|
||||
return filled;
|
||||
@@ -335,7 +329,8 @@ G4int G4TessellatedSolid::SetAllUsingStack(const std::vector<G4int>& voxel,
|
||||
void G4TessellatedSolid::PrecalculateInsides()
|
||||
{
|
||||
vector<G4int> voxel(3), maxVoxels(3);
|
||||
for (auto i = 0; i <= 2; ++i) maxVoxels[i] = fVoxels.GetBoundary(i).size();
|
||||
for (auto i = 0; i <= 2; ++i)
|
||||
maxVoxels[i] = (G4int)fVoxels.GetBoundary(i).size();
|
||||
G4int size = maxVoxels[0] * maxVoxels[1] * maxVoxels[2];
|
||||
|
||||
G4SurfBits checked(size-1);
|
||||
@@ -398,9 +393,9 @@ void G4TessellatedSolid::Voxelize ()
|
||||
void G4TessellatedSolid::SetExtremeFacets()
|
||||
{
|
||||
// Copy vertices to local array
|
||||
G4int vsize = fVertexList.size();
|
||||
std::size_t vsize = fVertexList.size();
|
||||
std::vector<G4ThreeVector> vertices(vsize);
|
||||
for (G4int i = 0; i < vsize; ++i) { vertices[i] = fVertexList[i]; }
|
||||
for (std::size_t i = 0; i < vsize; ++i) { vertices[i] = fVertexList[i]; }
|
||||
|
||||
// Shuffle vertices
|
||||
std::mt19937 gen(12345678);
|
||||
@@ -409,7 +404,7 @@ void G4TessellatedSolid::SetExtremeFacets()
|
||||
// Select six extreme vertices in different directions
|
||||
G4ThreeVector points[6];
|
||||
for (G4int i=0; i < 6; ++i) { points[i] = vertices[0]; }
|
||||
for (G4int i=1; i < vsize; ++i)
|
||||
for (std::size_t i=1; i < vsize; ++i)
|
||||
{
|
||||
if (vertices[i].x() < points[0].x()) points[0] = vertices[i];
|
||||
if (vertices[i].x() > points[1].x()) points[1] = vertices[i];
|
||||
@@ -420,8 +415,8 @@ void G4TessellatedSolid::SetExtremeFacets()
|
||||
}
|
||||
|
||||
// Find extreme facets
|
||||
G4int size = fFacets.size();
|
||||
for (G4int j = 0; j < size; ++j)
|
||||
std::size_t size = fFacets.size();
|
||||
for (std::size_t j = 0; j < size; ++j)
|
||||
{
|
||||
G4VFacet &facet = *fFacets[j];
|
||||
|
||||
@@ -435,7 +430,7 @@ void G4TessellatedSolid::SetExtremeFacets()
|
||||
|
||||
// Check vertices
|
||||
G4bool isExtreme = true;
|
||||
for (G4int i=0; i < vsize; ++i)
|
||||
for (std::size_t i=0; i < vsize; ++i)
|
||||
{
|
||||
if (!facet.IsInside(vertices[i]))
|
||||
{
|
||||
@@ -468,13 +463,13 @@ void G4TessellatedSolid::CreateVertexList()
|
||||
G4VertexInfo value;
|
||||
|
||||
fVertexList.clear();
|
||||
G4int size = fFacets.size();
|
||||
std::size_t size = fFacets.size();
|
||||
|
||||
G4double kCarTolerance24 = kCarTolerance * kCarTolerance / 4.0;
|
||||
G4double kCarTolerance3 = 3 * kCarTolerance;
|
||||
vector<G4int> newIndex(100);
|
||||
|
||||
for (G4int k = 0; k < size; ++k)
|
||||
for (std::size_t k = 0; k < size; ++k)
|
||||
{
|
||||
G4VFacet &facet = *fFacets[k];
|
||||
G4int max = facet.GetNumberOfVertices();
|
||||
@@ -482,7 +477,7 @@ void G4TessellatedSolid::CreateVertexList()
|
||||
for (G4int i = 0; i < max; ++i)
|
||||
{
|
||||
p = facet.GetVertex(i);
|
||||
value.id = fVertexList.size();
|
||||
value.id = (G4int)fVertexList.size();
|
||||
value.mag2 = p.x() + p.y() + p.z();
|
||||
|
||||
G4bool found = false;
|
||||
@@ -500,7 +495,7 @@ void G4TessellatedSolid::CreateVertexList()
|
||||
if (found) break;
|
||||
dif = q.x() + q.y() + q.z() - value.mag2;
|
||||
if (dif > kCarTolerance3) break;
|
||||
it++;
|
||||
++it;
|
||||
}
|
||||
|
||||
if (!found && (fVertexList.size() > 1))
|
||||
@@ -676,12 +671,12 @@ G4bool G4TessellatedSolid::GetSolidClosed () const
|
||||
G4int G4TessellatedSolid::CheckStructure() const
|
||||
{
|
||||
G4int nedge = 0;
|
||||
G4int nface = fFacets.size();
|
||||
std::size_t nface = fFacets.size();
|
||||
|
||||
// Calculate volume
|
||||
//
|
||||
G4double volume = 0.;
|
||||
for (G4int i = 0; i < nface; ++i)
|
||||
for (std::size_t i = 0; i < nface; ++i)
|
||||
{
|
||||
G4VFacet& facet = *fFacets[i];
|
||||
nedge += facet.GetNumberOfVertices();
|
||||
@@ -693,7 +688,7 @@ G4int G4TessellatedSolid::CheckStructure() const
|
||||
//
|
||||
std::vector<int64_t> iedge(nedge);
|
||||
G4int kk = 0;
|
||||
for (G4int i = 0; i < nface; ++i)
|
||||
for (std::size_t i = 0; i < nface; ++i)
|
||||
{
|
||||
G4VFacet& facet = *fFacets[i];
|
||||
G4int nnode = facet.GetNumberOfVertices();
|
||||
@@ -759,7 +754,7 @@ G4TessellatedSolid::operator+=(const G4TessellatedSolid& right)
|
||||
//
|
||||
G4int G4TessellatedSolid::GetNumberOfFacets() const
|
||||
{
|
||||
return fFacets.size();
|
||||
return (G4int)fFacets.size();
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
@@ -780,7 +775,7 @@ EInside G4TessellatedSolid::InsideVoxels(const G4ThreeVector& p) const
|
||||
|
||||
const vector<G4int> &startingCandidates =
|
||||
fVoxels.GetCandidates(startingVoxel);
|
||||
G4int limit = startingCandidates.size();
|
||||
std::size_t limit = startingCandidates.size();
|
||||
if (limit == 0 && fInsides.GetNbits())
|
||||
{
|
||||
G4int index = fVoxels.GetPointIndex(p);
|
||||
@@ -790,7 +785,7 @@ EInside G4TessellatedSolid::InsideVoxels(const G4ThreeVector& p) const
|
||||
|
||||
G4double minDist = kInfinity;
|
||||
|
||||
for(G4int i = 0; i < limit; ++i)
|
||||
for(std::size_t i = 0; i < limit; ++i)
|
||||
{
|
||||
G4int candidate = startingCandidates[i];
|
||||
G4VFacet &facet = *fFacets[candidate];
|
||||
@@ -854,7 +849,7 @@ EInside G4TessellatedSolid::InsideVoxels(const G4ThreeVector& p) const
|
||||
const vector<G4int> &candidates =
|
||||
started ? startingCandidates : fVoxels.GetCandidates(curVoxel);
|
||||
started = false;
|
||||
if (G4int candidatesCount = candidates.size())
|
||||
if (G4int candidatesCount = (G4int)candidates.size())
|
||||
{
|
||||
for (G4int i = 0 ; i < candidatesCount; ++i)
|
||||
{
|
||||
@@ -918,7 +913,7 @@ EInside G4TessellatedSolid::InsideVoxels(const G4ThreeVector& p) const
|
||||
// something wrong with geometry.
|
||||
//
|
||||
std::ostringstream message;
|
||||
G4int oldprc = message.precision(16);
|
||||
G4long oldprc = message.precision(16);
|
||||
message << "Cannot determine whether point is inside or outside volume!"
|
||||
<< G4endl
|
||||
<< "Solid name = " << GetName() << G4endl
|
||||
@@ -970,8 +965,8 @@ EInside G4TessellatedSolid::InsideNoVoxels (const G4ThreeVector &p) const
|
||||
//
|
||||
// Check if we are close to a surface
|
||||
//
|
||||
G4int size = fFacets.size();
|
||||
for (G4int i = 0; i < size; ++i)
|
||||
std::size_t size = fFacets.size();
|
||||
for (std::size_t i = 0; i < size; ++i)
|
||||
{
|
||||
G4VFacet& facet = *fFacets[i];
|
||||
G4double dist = facet.Distance(p,minDist);
|
||||
@@ -1025,7 +1020,7 @@ EInside G4TessellatedSolid::InsideNoVoxels (const G4ThreeVector &p) const
|
||||
distOut = distIn = kInfinity;
|
||||
G4ThreeVector v = fRandir[sm];
|
||||
sm++;
|
||||
vector<G4VFacet*>::const_iterator f = fFacets.begin();
|
||||
vector<G4VFacet*>::const_iterator f = fFacets.cbegin();
|
||||
|
||||
do // Loop checking, 13.08.2015, G.Cosmo
|
||||
{
|
||||
@@ -1046,7 +1041,7 @@ EInside G4TessellatedSolid::InsideNoVoxels (const G4ThreeVector &p) const
|
||||
if (crossingI && distI > 0.0 && distI < distIn) distIn = distI;
|
||||
}
|
||||
}
|
||||
} while (!nearParallel && ++f != fFacets.end());
|
||||
} while (!nearParallel && ++f != fFacets.cend());
|
||||
} while (nearParallel && sm != fMaxTries);
|
||||
|
||||
#ifdef G4VERBOSE
|
||||
@@ -1058,7 +1053,7 @@ EInside G4TessellatedSolid::InsideNoVoxels (const G4ThreeVector &p) const
|
||||
// that there is something wrong with geometry.
|
||||
//
|
||||
std::ostringstream message;
|
||||
G4int oldprc = message.precision(16);
|
||||
G4long oldprc = message.precision(16);
|
||||
message << "Cannot determine whether point is inside or outside volume!"
|
||||
<< G4endl
|
||||
<< "Solid name = " << GetName() << G4endl
|
||||
@@ -1110,7 +1105,7 @@ G4int G4TessellatedSolid::GetFacetIndex (const G4ThreeVector& p) const
|
||||
vector<G4int> curVoxel(3);
|
||||
fVoxels.GetVoxel(curVoxel, p);
|
||||
const vector<G4int> &candidates = fVoxels.GetCandidates(curVoxel);
|
||||
if (G4int limit = candidates.size())
|
||||
if (G4int limit = (G4int)candidates.size())
|
||||
{
|
||||
G4double minDist = kInfinity;
|
||||
for(G4int i = 0 ; i < limit ; ++i)
|
||||
@@ -1130,15 +1125,15 @@ G4int G4TessellatedSolid::GetFacetIndex (const G4ThreeVector& p) const
|
||||
else
|
||||
{
|
||||
G4double minDist = kInfinity;
|
||||
G4int size = fFacets.size();
|
||||
for (G4int i = 0; i < size; ++i)
|
||||
std::size_t size = fFacets.size();
|
||||
for (std::size_t i = 0; i < size; ++i)
|
||||
{
|
||||
G4VFacet& facet = *fFacets[i];
|
||||
G4double dist = facet.Distance(p, minDist);
|
||||
if (dist < minDist)
|
||||
{
|
||||
minDist = dist;
|
||||
index = i;
|
||||
index = (G4int)i;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1163,7 +1158,7 @@ G4bool G4TessellatedSolid::Normal (const G4ThreeVector& p,
|
||||
const vector<G4int> &candidates = fVoxels.GetCandidates(curVoxel);
|
||||
// fVoxels.GetCandidatesVoxelArray(p, candidates, 0);
|
||||
|
||||
if (G4int limit = candidates.size())
|
||||
if (G4int limit = (G4int)candidates.size())
|
||||
{
|
||||
minDist = kInfinity;
|
||||
for(G4int i = 0 ; i < limit ; ++i)
|
||||
@@ -1184,8 +1179,8 @@ G4bool G4TessellatedSolid::Normal (const G4ThreeVector& p,
|
||||
else
|
||||
{
|
||||
minDist = kInfinity;
|
||||
G4int size = fFacets.size();
|
||||
for (G4int i = 0; i < size; ++i)
|
||||
std::size_t size = fFacets.size();
|
||||
for (std::size_t i = 0; i < size; ++i)
|
||||
{
|
||||
G4VFacet& f = *fFacets[i];
|
||||
G4double dist = f.Distance(p, minDist);
|
||||
@@ -1255,8 +1250,8 @@ G4TessellatedSolid::DistanceToInNoVoxels (const G4ThreeVector& p,
|
||||
}
|
||||
#endif
|
||||
|
||||
G4int size = fFacets.size();
|
||||
for (G4int i = 0; i < size; ++i)
|
||||
std::size_t size = fFacets.size();
|
||||
for (std::size_t i = 0; i < size; ++i)
|
||||
{
|
||||
G4VFacet& facet = *fFacets[i];
|
||||
if (facet.Intersect(p,v,false,dist,distFromSurface,normal))
|
||||
@@ -1324,8 +1319,8 @@ G4TessellatedSolid::DistanceToOutNoVoxels (const G4ThreeVector& p,
|
||||
#endif
|
||||
|
||||
G4bool isExtreme = false;
|
||||
G4int size = fFacets.size();
|
||||
for (G4int i = 0; i < size; ++i)
|
||||
std::size_t size = fFacets.size();
|
||||
for (std::size_t i = 0; i < size; ++i)
|
||||
{
|
||||
G4VFacet& facet = *fFacets[i];
|
||||
if (facet.Intersect(p,v,true,dist,distFromSurface,normal))
|
||||
@@ -1372,7 +1367,7 @@ DistanceToOutCandidates(const std::vector<G4int>& candidates,
|
||||
G4double& minDist, G4ThreeVector& minNormal,
|
||||
G4int& minCandidate ) const
|
||||
{
|
||||
G4int candidatesCount = candidates.size();
|
||||
G4int candidatesCount = (G4int)candidates.size();
|
||||
G4double dist = 0.0;
|
||||
G4double distFromSurface = 0.0;
|
||||
G4ThreeVector normal;
|
||||
@@ -1483,7 +1478,7 @@ DistanceToInCandidates(const std::vector<G4int>& candidates,
|
||||
const G4ThreeVector& aPoint,
|
||||
const G4ThreeVector& direction) const
|
||||
{
|
||||
G4int candidatesCount = candidates.size();
|
||||
G4int candidatesCount = (G4int)candidates.size();
|
||||
G4double dist = 0.0;
|
||||
G4double distFromSurface = 0.0;
|
||||
G4ThreeVector normal;
|
||||
@@ -1622,7 +1617,7 @@ G4TessellatedSolid::MinDistanceFacet(const G4ThreeVector& p,
|
||||
if (dist > minDist) break;
|
||||
|
||||
const vector<G4int>& candidates = fVoxels.GetVoxelBoxCandidates(inf.first);
|
||||
G4int csize = candidates.size();
|
||||
G4int csize = (G4int)candidates.size();
|
||||
for (G4int j = 0; j < csize; ++j)
|
||||
{
|
||||
G4int candidate = candidates[j];
|
||||
@@ -1686,8 +1681,8 @@ G4double G4TessellatedSolid::SafetyFromOutside (const G4ThreeVector& p,
|
||||
else
|
||||
{
|
||||
minDist = kInfinity;
|
||||
G4int size = fFacets.size();
|
||||
for (G4int i = 0; i < size; ++i)
|
||||
std::size_t size = fFacets.size();
|
||||
for (std::size_t i = 0; i < size; ++i)
|
||||
{
|
||||
G4VFacet& facet = *fFacets[i];
|
||||
G4double dist = facet.Distance(p,minDist);
|
||||
@@ -1732,8 +1727,8 @@ G4TessellatedSolid::SafetyFromInside (const G4ThreeVector& p, G4bool) const
|
||||
{
|
||||
minDist = kInfinity;
|
||||
G4double dist = 0.0;
|
||||
G4int size = fFacets.size();
|
||||
for (G4int i = 0; i < size; ++i)
|
||||
std::size_t size = fFacets.size();
|
||||
for (std::size_t i = 0; i < size; ++i)
|
||||
{
|
||||
G4VFacet& facet = *fFacets[i];
|
||||
dist = facet.Distance(p,minDist);
|
||||
@@ -1763,8 +1758,8 @@ std::ostream &G4TessellatedSolid::StreamInfo(std::ostream &os) const
|
||||
os << "Geometry Type = " << fGeometryType << G4endl;
|
||||
os << "Number of facets = " << fFacets.size() << G4endl;
|
||||
|
||||
G4int size = fFacets.size();
|
||||
for (G4int i = 0; i < size; ++i)
|
||||
std::size_t size = fFacets.size();
|
||||
for (std::size_t i = 0; i < size; ++i)
|
||||
{
|
||||
os << "FACET # = " << i + 1 << G4endl;
|
||||
G4VFacet &facet = *fFacets[i];
|
||||
@@ -1926,21 +1921,21 @@ void G4TessellatedSolid::DescribeYourselfTo (G4VGraphicsScene& scene) const
|
||||
//
|
||||
G4Polyhedron* G4TessellatedSolid::CreatePolyhedron () const
|
||||
{
|
||||
G4int nVertices = fVertexList.size();
|
||||
G4int nFacets = fFacets.size();
|
||||
G4int nVertices = (G4int)fVertexList.size();
|
||||
G4int nFacets = (G4int)fFacets.size();
|
||||
G4Polyhedron* polyhedron = new G4Polyhedron(nVertices, nFacets);
|
||||
for (G4int i = 0; i < nVertices; ++i)
|
||||
for (auto i = 0; i < nVertices; ++i)
|
||||
{
|
||||
polyhedron->SetVertex(i+1, fVertexList[i]);
|
||||
}
|
||||
|
||||
for (G4int i = 0; i < nFacets; ++i)
|
||||
for (auto i = 0; i < nFacets; ++i)
|
||||
{
|
||||
G4VFacet* facet = fFacets[i];
|
||||
G4int v[4] = {0};
|
||||
G4int n = facet->GetNumberOfVertices();
|
||||
if (n > 4) n = 4;
|
||||
for (G4int j = 0; j < n; ++j)
|
||||
for (auto j = 0; j < n; ++j)
|
||||
{
|
||||
v[j] = facet->GetVertexIndex(j) + 1;
|
||||
}
|
||||
@@ -2123,8 +2118,8 @@ G4double G4TessellatedSolid::GetCubicVolume ()
|
||||
// https://en.wikipedia.org/wiki/Polyhedron#Volume
|
||||
// http://wwwf.imperial.ac.uk/~rn/centroid.pdf
|
||||
|
||||
G4int size = fFacets.size();
|
||||
for (G4int i = 0; i < size; ++i)
|
||||
std::size_t size = fFacets.size();
|
||||
for (std::size_t i = 0; i < size; ++i)
|
||||
{
|
||||
G4VFacet &facet = *fFacets[i];
|
||||
G4double area = facet.GetArea();
|
||||
@@ -2141,8 +2136,8 @@ G4double G4TessellatedSolid::GetSurfaceArea ()
|
||||
{
|
||||
if (fSurfaceArea != 0.) return fSurfaceArea;
|
||||
|
||||
G4int size = fFacets.size();
|
||||
for (G4int i = 0; i < size; ++i)
|
||||
std::size_t size = fFacets.size();
|
||||
for (std::size_t i = 0; i < size; ++i)
|
||||
{
|
||||
G4VFacet &facet = *fFacets[i];
|
||||
fSurfaceArea += facet.GetArea();
|
||||
@@ -2224,8 +2219,8 @@ G4int G4TessellatedSolid::AllocatedMemoryWithoutVoxels()
|
||||
base += fVertexList.capacity() * sizeof(G4ThreeVector);
|
||||
base += fRandir.capacity() * sizeof(G4ThreeVector);
|
||||
|
||||
G4int limit = fFacets.size();
|
||||
for (G4int i = 0; i < limit; ++i)
|
||||
std::size_t limit = fFacets.size();
|
||||
for (std::size_t i = 0; i < limit; ++i)
|
||||
{
|
||||
G4VFacet& facet = *fFacets[i];
|
||||
base += facet.AllocatedMemory();
|
||||
|
||||
@@ -447,7 +447,7 @@ G4ThreeVector G4Tet::SurfaceNormal( const G4ThreeVector& p) const
|
||||
{
|
||||
#ifdef G4SPECSDEBUG
|
||||
std::ostringstream message;
|
||||
G4int oldprc = message.precision(16);
|
||||
G4long oldprc = message.precision(16);
|
||||
message << "Point p is not on surface (!?) of solid: "
|
||||
<< GetName() << "\n";
|
||||
message << "Position:\n";
|
||||
@@ -602,7 +602,7 @@ G4VSolid* G4Tet::Clone() const
|
||||
//
|
||||
std::ostream& G4Tet::StreamInfo(std::ostream& os) const
|
||||
{
|
||||
G4int oldprc = os.precision(16);
|
||||
G4long oldprc = os.precision(16);
|
||||
os << "-----------------------------------------------------------\n"
|
||||
<< " *** Dump for solid - " << GetName() << " ***\n"
|
||||
<< " ===================================================\n"
|
||||
|
||||
@@ -184,17 +184,17 @@ void G4TriangularFacet::CopyFrom (const G4TriangularFacet& rhs)
|
||||
//
|
||||
void G4TriangularFacet::MoveFrom (G4TriangularFacet& rhs)
|
||||
{
|
||||
fSurfaceNormal = move(rhs.fSurfaceNormal);
|
||||
fArea = move(rhs.fArea);
|
||||
fCircumcentre = move(rhs.fCircumcentre);
|
||||
fRadius = move(rhs.fRadius);
|
||||
fIndices = move(rhs.fIndices);
|
||||
fA = move(rhs.fA); fB = move(rhs.fB); fC = move(rhs.fC);
|
||||
fDet = move(rhs.fDet);
|
||||
fSqrDist = move(rhs.fSqrDist);
|
||||
fE1 = move(rhs.fE1); fE2 = move(rhs.fE2);
|
||||
fIsDefined = move(rhs.fIsDefined);
|
||||
fVertices = move(rhs.fVertices);
|
||||
fSurfaceNormal = std::move(rhs.fSurfaceNormal);
|
||||
fArea = std::move(rhs.fArea);
|
||||
fCircumcentre = std::move(rhs.fCircumcentre);
|
||||
fRadius = std::move(rhs.fRadius);
|
||||
fIndices = std::move(rhs.fIndices);
|
||||
fA = std::move(rhs.fA); fB = std::move(rhs.fB); fC = std::move(rhs.fC);
|
||||
fDet = std::move(rhs.fDet);
|
||||
fSqrDist = std::move(rhs.fSqrDist);
|
||||
fE1 = std::move(rhs.fE1); fE2 = std::move(rhs.fE2);
|
||||
fIsDefined = std::move(rhs.fIsDefined);
|
||||
fVertices = std::move(rhs.fVertices);
|
||||
rhs.fVertices = nullptr;
|
||||
}
|
||||
|
||||
|
||||
@@ -360,7 +360,7 @@ G4int G4TwistBoxSide::DistanceToSurface(const G4ThreeVector& gp,
|
||||
} // end general case
|
||||
|
||||
|
||||
nxx = xbuf.size() ; // save the number of solutions
|
||||
nxx = (G4int)xbuf.size() ; // save the number of solutions
|
||||
|
||||
G4ThreeVector xxonsurface ; // point on surface
|
||||
G4ThreeVector surfacenormal ; // normal vector
|
||||
@@ -371,7 +371,7 @@ G4int G4TwistBoxSide::DistanceToSurface(const G4ThreeVector& gp,
|
||||
G4int maxint = 30 ; // number of iterations
|
||||
|
||||
|
||||
for ( size_t k = 0 ; k<xbuf.size() ; ++k )
|
||||
for ( std::size_t k = 0 ; k<xbuf.size() ; ++k )
|
||||
{
|
||||
#ifdef G4TWISTDEBUG
|
||||
G4cout << "Solution " << k << " : "
|
||||
@@ -477,7 +477,7 @@ G4int G4TwistBoxSide::DistanceToSurface(const G4ThreeVector& gp,
|
||||
|
||||
// add guesses
|
||||
|
||||
G4int nxxtmp = xbuf.size() ;
|
||||
G4int nxxtmp = (G4int)xbuf.size() ;
|
||||
|
||||
if ( nxxtmp<2 || IsParallel )
|
||||
{
|
||||
@@ -511,7 +511,7 @@ G4int G4TwistBoxSide::DistanceToSurface(const G4ThreeVector& gp,
|
||||
|
||||
xbuf.push_back(xbuftmp) ; // store it to xbuf
|
||||
|
||||
for ( size_t k = nxxtmp ; k<xbuf.size() ; ++k )
|
||||
for ( std::size_t k = nxxtmp ; k<xbuf.size() ; ++k )
|
||||
{
|
||||
#ifdef G4TWISTDEBUG
|
||||
G4cout << "Solution " << k << " : "
|
||||
@@ -617,9 +617,9 @@ G4int G4TwistBoxSide::DistanceToSurface(const G4ThreeVector& gp,
|
||||
G4cout << G4endl << G4endl ;
|
||||
#endif
|
||||
|
||||
nxx = xbuf.size() ; // determine number of solutions again.
|
||||
nxx = (G4int)xbuf.size() ; // determine number of solutions again.
|
||||
|
||||
for ( size_t i = 0 ; i<xbuf.size() ; ++i )
|
||||
for ( G4int i = 0 ; i<(G4int)xbuf.size() ; ++i )
|
||||
{
|
||||
distance[i] = xbuf[i].distance;
|
||||
gxx[i] = ComputeGlobalPoint(xbuf[i].xx);
|
||||
|
||||
@@ -88,7 +88,7 @@ G4TwistTrapAlphaSide(const G4String& name,
|
||||
fa1md1 = 2*fDx2 - 2*fDx1 ;
|
||||
fa2md2 = 2*fDx4 - 2*fDx3 ;
|
||||
|
||||
fPhiTwist = PhiTwist ; // dphi
|
||||
fPhiTwist = PhiTwist ; // dphi
|
||||
fAngleSide = AngleSide ; // 0,90,180,270 deg
|
||||
|
||||
fdeltaX = 2 * fDz * std::tan(fTheta) * std::cos(fPhi);
|
||||
@@ -256,7 +256,7 @@ G4TwistTrapAlphaSide::DistanceToSurface(const G4ThreeVector& gp,
|
||||
// special case vz = 0
|
||||
|
||||
if ( v.z() == 0. )
|
||||
{
|
||||
{
|
||||
if ( std::fabs(p.z()) <= L ) // intersection possible in z
|
||||
{
|
||||
phi = p.z() * fPhiTwist / L ; // phi is determined by the z-position
|
||||
@@ -372,7 +372,7 @@ G4TwistTrapAlphaSide::DistanceToSurface(const G4ThreeVector& gp,
|
||||
} // end loop i
|
||||
} // end general case
|
||||
|
||||
nxx = xbuf.size() ; // save the number of solutions
|
||||
nxx = (G4int)xbuf.size() ; // save the number of solutions
|
||||
|
||||
G4ThreeVector xxonsurface ; // point on surface
|
||||
G4ThreeVector surfacenormal ; // normal vector
|
||||
@@ -381,7 +381,7 @@ G4TwistTrapAlphaSide::DistanceToSurface(const G4ThreeVector& gp,
|
||||
G4double factor; // a scaling factor
|
||||
G4int maxint=30; // number of iterations
|
||||
|
||||
for ( size_t k = 0 ; k<xbuf.size() ; ++k )
|
||||
for ( std::size_t k = 0 ; k<xbuf.size() ; ++k )
|
||||
{
|
||||
#ifdef G4TWISTDEBUG
|
||||
G4cout << "Solution " << k << " : "
|
||||
@@ -494,7 +494,7 @@ G4TwistTrapAlphaSide::DistanceToSurface(const G4ThreeVector& gp,
|
||||
|
||||
// add guesses
|
||||
//
|
||||
G4int nxxtmp = xbuf.size() ;
|
||||
G4int nxxtmp = (G4int)xbuf.size() ;
|
||||
|
||||
if ( nxxtmp<2 || IsParallel ) // positive end
|
||||
{
|
||||
@@ -529,7 +529,7 @@ G4TwistTrapAlphaSide::DistanceToSurface(const G4ThreeVector& gp,
|
||||
|
||||
xbuf.push_back(xbuftmp) ; // store it to xbuf
|
||||
|
||||
for ( size_t k = nxxtmp ; k<xbuf.size() ; ++k )
|
||||
for ( std::size_t k = nxxtmp ; k<xbuf.size() ; ++k )
|
||||
{
|
||||
|
||||
#ifdef G4TWISTDEBUG
|
||||
@@ -639,9 +639,9 @@ G4TwistTrapAlphaSide::DistanceToSurface(const G4ThreeVector& gp,
|
||||
G4cout << G4endl << G4endl ;
|
||||
#endif
|
||||
|
||||
nxx = xbuf.size() ; // determine number of solutions again.
|
||||
nxx = (G4int)xbuf.size() ; // determine number of solutions again.
|
||||
|
||||
for ( size_t i = 0 ; i<xbuf.size() ; ++i )
|
||||
for ( G4int i = 0 ; i<(G4int)xbuf.size() ; ++i )
|
||||
{
|
||||
distance[i] = xbuf[i].distance;
|
||||
gxx[i] = ComputeGlobalPoint(xbuf[i].xx);
|
||||
|
||||
@@ -343,7 +343,7 @@ G4int G4TwistTrapParallelSide::DistanceToSurface(const G4ThreeVector& gp,
|
||||
} // end loop i
|
||||
} // end general case
|
||||
|
||||
nxx = xbuf.size() ; // save the number of solutions
|
||||
nxx = (G4int)xbuf.size() ; // save the number of solutions
|
||||
|
||||
G4ThreeVector xxonsurface ; // point on surface
|
||||
G4ThreeVector surfacenormal ; // normal vector
|
||||
@@ -353,7 +353,7 @@ G4int G4TwistTrapParallelSide::DistanceToSurface(const G4ThreeVector& gp,
|
||||
G4int maxint = 30 ; // number of iterations
|
||||
|
||||
|
||||
for ( size_t k = 0 ; k<xbuf.size() ; ++k )
|
||||
for ( std::size_t k = 0 ; k<xbuf.size() ; ++k )
|
||||
{
|
||||
#ifdef G4TWISTDEBUG
|
||||
G4cout << "Solution " << k << " : "
|
||||
@@ -459,7 +459,7 @@ G4int G4TwistTrapParallelSide::DistanceToSurface(const G4ThreeVector& gp,
|
||||
|
||||
// add guesses
|
||||
|
||||
G4int nxxtmp = xbuf.size() ;
|
||||
G4int nxxtmp = (G4int)xbuf.size() ;
|
||||
|
||||
if ( nxxtmp<2 || IsParallel )
|
||||
{
|
||||
@@ -494,7 +494,7 @@ G4int G4TwistTrapParallelSide::DistanceToSurface(const G4ThreeVector& gp,
|
||||
|
||||
xbuf.push_back(xbuftmp) ; // store it to xbuf
|
||||
|
||||
for ( size_t k = nxxtmp ; k<xbuf.size() ; ++k )
|
||||
for ( std::size_t k = nxxtmp ; k<xbuf.size() ; ++k )
|
||||
{
|
||||
#ifdef G4TWISTDEBUG
|
||||
G4cout << "Solution " << k << " : "
|
||||
@@ -600,9 +600,9 @@ G4int G4TwistTrapParallelSide::DistanceToSurface(const G4ThreeVector& gp,
|
||||
G4cout << G4endl << G4endl ;
|
||||
#endif
|
||||
|
||||
nxx = xbuf.size() ; // determine number of solutions again.
|
||||
nxx = (G4int)xbuf.size() ; // determine number of solutions again.
|
||||
|
||||
for ( size_t i = 0 ; i<xbuf.size() ; ++i )
|
||||
for ( G4int i = 0 ; i<(G4int)xbuf.size() ; ++i )
|
||||
{
|
||||
distance[i] = xbuf[i].distance;
|
||||
gxx[i] = ComputeGlobalPoint(xbuf[i].xx);
|
||||
|
||||
@@ -845,7 +845,7 @@ std::ostream& G4TwistedTubs::StreamInfo(std::ostream& os) const
|
||||
//
|
||||
// Stream object contents to an output stream
|
||||
//
|
||||
G4int oldprc = os.precision(16);
|
||||
G4long oldprc = os.precision(16);
|
||||
os << "-----------------------------------------------------------\n"
|
||||
<< " *** Dump for solid - " << GetName() << " ***\n"
|
||||
<< " ===================================================\n"
|
||||
|
||||
@@ -256,7 +256,7 @@ G4Polyhedron* G4UGenericTrap::CreatePolyhedron() const
|
||||
// Construct extra Points, if Twisted Side
|
||||
//
|
||||
G4Polyhedron* polyhedron;
|
||||
size_t nVertices, nFacets;
|
||||
G4int nVertices, nFacets;
|
||||
G4double fDz = GetZHalfLength();
|
||||
|
||||
G4int subdivisions = 0;
|
||||
|
||||
@@ -70,8 +70,8 @@ G4UTessellatedSolid::G4UTessellatedSolid(__void__& a)
|
||||
//
|
||||
G4UTessellatedSolid::~G4UTessellatedSolid()
|
||||
{
|
||||
G4int size = fFacets.size();
|
||||
for (G4int i = 0; i < size; ++i) { delete fFacets[i]; }
|
||||
std::size_t size = fFacets.size();
|
||||
for (std::size_t i = 0; i < size; ++i) { delete fFacets[i]; }
|
||||
fFacets.clear();
|
||||
}
|
||||
|
||||
@@ -174,14 +174,14 @@ void G4UTessellatedSolid::SetSolidClosed(const G4bool t)
|
||||
if (t && !Base_t::IsClosed())
|
||||
{
|
||||
Base_t::Close();
|
||||
G4int nVertices = fTessellated.fVertices.size();
|
||||
G4int nFacets = fTessellated.fFacets.size();
|
||||
for (G4int j = 0; j < nVertices; ++j)
|
||||
std::size_t nVertices = fTessellated.fVertices.size();
|
||||
std::size_t nFacets = fTessellated.fFacets.size();
|
||||
for (std::size_t j = 0; j < nVertices; ++j)
|
||||
{
|
||||
U3Vector vt = fTessellated.fVertices[j];
|
||||
fVertexList.push_back(G4ThreeVector(vt.x(), vt.y(), vt.z()));
|
||||
}
|
||||
for (G4int i = 0; i < nFacets; ++i)
|
||||
for (std::size_t i = 0; i < nFacets; ++i)
|
||||
{
|
||||
vecgeom::TriangleFacet<G4double>* afacet = Base_t::GetFacet(i);
|
||||
std::vector<G4ThreeVector> v;
|
||||
@@ -255,8 +255,8 @@ G4int G4UTessellatedSolid::AllocatedMemoryWithoutVoxels()
|
||||
G4int base = sizeof(*this);
|
||||
base += fVertexList.capacity() * sizeof(G4ThreeVector);
|
||||
|
||||
G4int limit = fFacets.size();
|
||||
for (G4int i = 0; i < limit; ++i)
|
||||
std::size_t limit = fFacets.size();
|
||||
for (std::size_t i = 0; i < limit; ++i)
|
||||
{
|
||||
G4VFacet &facet = *fFacets[i];
|
||||
base += facet.AllocatedMemory();
|
||||
@@ -379,19 +379,19 @@ G4UTessellatedSolid::CalculateExtent(const EAxis pAxis,
|
||||
//
|
||||
G4Polyhedron* G4UTessellatedSolid::CreatePolyhedron () const
|
||||
{
|
||||
G4int nVertices = fVertexList.size();
|
||||
G4int nFacets = fFacets.size();
|
||||
G4int nVertices = (G4int)fVertexList.size();
|
||||
G4int nFacets = (G4int)fFacets.size();
|
||||
G4Polyhedron* polyhedron = new G4Polyhedron(nVertices, nFacets);
|
||||
for (G4int i = 0; i < nVertices; ++i)
|
||||
for (auto i = 0; i < nVertices; ++i)
|
||||
{
|
||||
polyhedron->SetVertex(i+1, fVertexList[i]);
|
||||
}
|
||||
|
||||
for (G4int i = 0; i < nFacets; ++i)
|
||||
for (auto i = 0; i < nFacets; ++i)
|
||||
{
|
||||
G4int v[3]; // Only facets with 3 vertices are defined in VecGeom
|
||||
G4VFacet* facet = GetFacet(i);
|
||||
for (G4int j = 0; j < 3; ++j) // Retrieve indexing directly from VecGeom
|
||||
for (auto j = 0; j < 3; ++j) // Retrieve indexing directly from VecGeom
|
||||
{
|
||||
v[j] = facet->GetVertexIndex(j) + 1;
|
||||
}
|
||||
|
||||
@@ -886,7 +886,7 @@ std::ostream& G4VTwistedFaceted::StreamInfo(std::ostream& os) const
|
||||
//
|
||||
// Stream object contents to an output stream
|
||||
//
|
||||
G4int oldprc = os.precision(16);
|
||||
G4long oldprc = os.precision(16);
|
||||
os << "-----------------------------------------------------------\n"
|
||||
<< " *** Dump for solid - " << GetName() << " ***\n"
|
||||
<< " ===================================================\n"
|
||||
|
||||
@@ -78,7 +78,7 @@ void G4Voxelizer::BuildEmpty()
|
||||
std::vector<G4int> xyz(3), max(3), candidates(fTotalCandidates);
|
||||
const std::vector<G4int> empty(0);
|
||||
|
||||
for (auto i = 0; i <= 2; ++i) max[i] = fBoundaries[i].size();
|
||||
for (auto i = 0; i <= 2; ++i) max[i] = (G4int)fBoundaries[i].size();
|
||||
unsigned int size = max[0] * max[1] * max[2];
|
||||
|
||||
fEmpty.Clear();
|
||||
@@ -121,17 +121,17 @@ void G4Voxelizer::BuildVoxelLimits(std::vector<G4VSolid*>& solids,
|
||||
// These quantities are stored in the array "fBoxes" (6 different values per
|
||||
// node
|
||||
//
|
||||
if (G4int numNodes = solids.size()) // Number of nodes in "multiUnion"
|
||||
if (std::size_t numNodes = solids.size()) // Number of nodes in "multiUnion"
|
||||
{
|
||||
fBoxes.resize(numNodes); // Array which will store the half lengths
|
||||
fNPerSlice = 1 + (fBoxes.size() - 1) / (8 * sizeof(unsigned int));
|
||||
fNPerSlice = G4int(1 + (fBoxes.size() - 1) / (8 * sizeof(unsigned int)));
|
||||
|
||||
// related to a particular node, but also
|
||||
// the coordinates of its origin
|
||||
|
||||
G4ThreeVector toleranceVector(fTolerance,fTolerance,fTolerance);
|
||||
|
||||
for (G4int i = 0; i < numNodes; ++i)
|
||||
for (std::size_t i = 0; i < numNodes; ++i)
|
||||
{
|
||||
G4VSolid& solid = *solids[i];
|
||||
G4Transform3D transform = transforms[i];
|
||||
@@ -156,7 +156,7 @@ void G4Voxelizer::BuildVoxelLimits(std::vector<G4VSolid*>& solids,
|
||||
fBoxes[i].hlen = (max - min) / 2.;
|
||||
fBoxes[i].pos = (max + min) / 2.;
|
||||
}
|
||||
fTotalCandidates = fBoxes.size();
|
||||
fTotalCandidates = (G4int)fBoxes.size();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -168,14 +168,14 @@ void G4Voxelizer::BuildVoxelLimits(std::vector<G4VFacet*>& facets)
|
||||
// These quantities are stored in the array "fBoxes" (6 different values per
|
||||
// node.
|
||||
|
||||
if (G4int numNodes = facets.size()) // Number of nodes
|
||||
if (std::size_t numNodes = facets.size()) // Number of nodes
|
||||
{
|
||||
fBoxes.resize(numNodes); // Array which will store the half lengths
|
||||
fNPerSlice = 1+(fBoxes.size()-1)/(8*sizeof(unsigned int));
|
||||
fNPerSlice = G4int(1+(fBoxes.size()-1)/(8*sizeof(unsigned int)));
|
||||
|
||||
G4ThreeVector toleranceVector(10*fTolerance, 10*fTolerance, 10*fTolerance);
|
||||
|
||||
for (G4int i = 0; i < numNodes; ++i)
|
||||
for (std::size_t i = 0; i < numNodes; ++i)
|
||||
{
|
||||
G4VFacet &facet = *facets[i];
|
||||
G4ThreeVector min, max;
|
||||
@@ -189,7 +189,7 @@ void G4Voxelizer::BuildVoxelLimits(std::vector<G4VFacet*>& facets)
|
||||
fBoxes[i].hlen = hlen;
|
||||
fBoxes[i].pos = min + hlen;
|
||||
}
|
||||
fTotalCandidates = fBoxes.size();
|
||||
fTotalCandidates = (G4int)fBoxes.size();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -198,9 +198,9 @@ void G4Voxelizer::DisplayVoxelLimits() const
|
||||
{
|
||||
// "DisplayVoxelLimits" displays the dX, dY, dZ, pX, pY and pZ for each node
|
||||
|
||||
G4int numNodes = fBoxes.size();
|
||||
G4int oldprec = G4cout.precision(16);
|
||||
for(G4int i = 0; i < numNodes; ++i)
|
||||
std::size_t numNodes = fBoxes.size();
|
||||
G4long oldprec = G4cout.precision(16);
|
||||
for(std::size_t i = 0; i < numNodes; ++i)
|
||||
{
|
||||
G4cout << setw(10) << setiosflags(ios::fixed) <<
|
||||
" -> Node " << i+1 << ":\n" <<
|
||||
@@ -218,11 +218,11 @@ void G4Voxelizer::CreateSortedBoundary(std::vector<G4double>& boundary,
|
||||
// bounding fBoxes, along each axis. The created boundaries are stored
|
||||
// in the array "boundariesRaw"
|
||||
|
||||
G4int numNodes = fBoxes.size(); // Number of nodes in structure
|
||||
std::size_t numNodes = fBoxes.size(); // Number of nodes in structure
|
||||
|
||||
// Determination of the boundaries along x, y and z axis
|
||||
//
|
||||
for(G4int i = 0 ; i < numNodes; ++i)
|
||||
for(std::size_t i = 0 ; i < numNodes; ++i)
|
||||
{
|
||||
// For each node, the boundaries are created by using the array "fBoxes"
|
||||
// built in method "BuildVoxelLimits"
|
||||
@@ -253,33 +253,28 @@ void G4Voxelizer::BuildBoundaries()
|
||||
// are precise thanks to variables: boundariesCountX, boundariesCountY and
|
||||
// boundariesCountZ.
|
||||
|
||||
if (G4int numNodes = fBoxes.size())
|
||||
if (std::size_t numNodes = fBoxes.size())
|
||||
{
|
||||
const G4double tolerance = fTolerance / 100.0;
|
||||
// Minimal distance to discriminate two boundaries.
|
||||
|
||||
std::vector<G4double> sortedBoundary(2*numNodes);
|
||||
|
||||
G4int considered;
|
||||
|
||||
for (auto j = 0; j <= 2; ++j)
|
||||
{
|
||||
CreateSortedBoundary(sortedBoundary, j);
|
||||
std::vector<G4double> &boundary = fBoundaries[j];
|
||||
boundary.clear();
|
||||
|
||||
considered = 0;
|
||||
|
||||
for(G4int i = 0 ; i < 2*numNodes; ++i)
|
||||
for(std::size_t i = 0 ; i < 2*numNodes; ++i)
|
||||
{
|
||||
G4double newBoundary = sortedBoundary[i];
|
||||
#ifdef G4SPECSDEBUG
|
||||
if (j == 0) G4cout << "Examining " << newBoundary << "..." << G4endl;
|
||||
#endif
|
||||
G4int size = boundary.size();
|
||||
G4int size = (G4int)boundary.size();
|
||||
if(!size || std::abs(boundary[size-1] - newBoundary) > tolerance)
|
||||
{
|
||||
considered++;
|
||||
{
|
||||
#ifdef G4SPECSDEBUG
|
||||
if (j == 0) G4cout << "Adding boundary " << newBoundary << "..."
|
||||
@@ -293,7 +288,7 @@ void G4Voxelizer::BuildBoundaries()
|
||||
// only the first one is considered
|
||||
}
|
||||
|
||||
G4int n = boundary.size();
|
||||
G4int n = (G4int)boundary.size();
|
||||
G4int max = 100000;
|
||||
if (n > max/2)
|
||||
{
|
||||
@@ -303,7 +298,7 @@ void G4Voxelizer::BuildBoundaries()
|
||||
for (G4int i = 0; i < n; ++i)
|
||||
{
|
||||
// 50 ok for 2k, 1000, 2000
|
||||
G4int size = boundary.size();
|
||||
G4int size = (G4int)boundary.size();
|
||||
if (i % skip == 0 || i == 0 || i == size - 1)
|
||||
{
|
||||
// this condition of merging boundaries was wrong,
|
||||
@@ -336,9 +331,9 @@ void G4Voxelizer::DisplayBoundaries(std::vector<G4double> &boundaries)
|
||||
{
|
||||
// Prints the positions of the boundaries of the slices on the three axes
|
||||
|
||||
G4int count = boundaries.size();
|
||||
G4int oldprec = G4cout.precision(16);
|
||||
for(G4int i = 0; i < count; ++i)
|
||||
std::size_t count = boundaries.size();
|
||||
G4long oldprec = G4cout.precision(16);
|
||||
for(std::size_t i = 0; i < count; ++i)
|
||||
{
|
||||
G4cout << setw(10) << setiosflags(ios::fixed) << boundaries[i];
|
||||
if(i != count-1) G4cout << "-> ";
|
||||
@@ -354,14 +349,13 @@ void G4Voxelizer::BuildBitmasks(std::vector<G4double> boundaries[],
|
||||
// "BuildListNodes" stores in the bitmasks solids present in each slice
|
||||
// along an axis.
|
||||
|
||||
G4int numNodes = fBoxes.size();
|
||||
std::size_t numNodes = fBoxes.size();
|
||||
G4int bitsPerSlice = GetBitsPerSlice();
|
||||
|
||||
for (auto k = 0; k < 3; ++k)
|
||||
{
|
||||
G4int total = 0;
|
||||
std::vector<G4double>& boundary = boundaries[k];
|
||||
G4int voxelsCount = boundary.size() - 1;
|
||||
G4int voxelsCount = (G4int)boundary.size() - 1;
|
||||
G4SurfBits& bitmask = bitmasks[k];
|
||||
|
||||
if (!countsOnly)
|
||||
@@ -381,7 +375,7 @@ void G4Voxelizer::BuildBitmasks(std::vector<G4double> boundaries[],
|
||||
|
||||
// Loop on the nodes, number of slices per axis
|
||||
//
|
||||
for(G4int j = 0 ; j < numNodes; ++j)
|
||||
for(std::size_t j = 0 ; j < numNodes; ++j)
|
||||
{
|
||||
// Determination of the minimum and maximum position along x
|
||||
// of the bounding boxe of each node
|
||||
@@ -398,10 +392,9 @@ void G4Voxelizer::BuildBitmasks(std::vector<G4double> boundaries[],
|
||||
{
|
||||
if (!countsOnly)
|
||||
{
|
||||
bitmask.SetBitNumber(i*bitsPerSlice+j);
|
||||
bitmask.SetBitNumber(i*bitsPerSlice+(G4int)j);
|
||||
}
|
||||
candidatesCount[i]++;
|
||||
++total;
|
||||
++i;
|
||||
}
|
||||
while (max > boundary[i] && i < voxelsCount);
|
||||
@@ -418,9 +411,9 @@ G4String G4Voxelizer::GetCandidatesAsString(const G4SurfBits& bits) const
|
||||
// Decodes the candidates in mask as G4String.
|
||||
|
||||
stringstream ss;
|
||||
G4int numNodes = fBoxes.size();
|
||||
G4int numNodes = (G4int)fBoxes.size();
|
||||
|
||||
for(G4int i=0; i<numNodes; ++i)
|
||||
for(auto i=0; i<numNodes; ++i)
|
||||
{
|
||||
if (bits.TestBitNumber(i)) { ss << i+1 << " "; }
|
||||
}
|
||||
@@ -439,7 +432,7 @@ void G4Voxelizer::DisplayListNodes() const
|
||||
for (auto j = 0; j <= 2; ++j)
|
||||
{
|
||||
G4cout << " * " << axis[j] << " axis:" << G4endl;
|
||||
G4int count = fBoundaries[j].size();
|
||||
G4int count = (G4int)fBoundaries[j].size();
|
||||
for(G4int i=0; i < count-1; ++i)
|
||||
{
|
||||
G4cout << " Slice #" << i+1 << ": [" << fBoundaries[j][i]
|
||||
@@ -518,7 +511,7 @@ void G4Voxelizer::BuildReduceVoxels(std::vector<G4double> boundaries[],
|
||||
for (auto k = 0; k <= 2; ++k)
|
||||
{
|
||||
std::vector<G4int> &candidatesCount = fCandidatesCounts[k];
|
||||
G4int max = candidatesCount.size();
|
||||
G4int max = (G4int)candidatesCount.size();
|
||||
std::vector<G4VoxelInfo> voxels(max);
|
||||
G4VoxelComparator comp(voxels);
|
||||
std::set<G4int, G4VoxelComparator> voxelSet(comp);
|
||||
@@ -540,7 +533,7 @@ void G4Voxelizer::BuildReduceVoxels(std::vector<G4double> boundaries[],
|
||||
if (reduction != 0)
|
||||
{
|
||||
G4int count = 0, currentCount;
|
||||
while ((currentCount = voxelSet.size()) > 2)
|
||||
while ((currentCount = (G4int)voxelSet.size()) > 2)
|
||||
{
|
||||
G4double currentRatio = 1 - (G4double) count / max;
|
||||
if ((currentRatio <= reduction) && (currentCount <= 1000))
|
||||
@@ -586,10 +579,10 @@ void G4Voxelizer::BuildReduceVoxels(std::vector<G4double> boundaries[],
|
||||
std::sort(mergings.begin(), mergings.end());
|
||||
|
||||
const std::vector<G4double>& boundary = boundaries[k];
|
||||
int mergingsSize = mergings.size();
|
||||
G4int mergingsSize = (G4int)mergings.size();
|
||||
vector<G4double> reducedBoundary;
|
||||
G4int skip = mergings[0], i = 0;
|
||||
max = boundary.size();
|
||||
max = (G4int)boundary.size();
|
||||
for (G4int j = 0; j < max; ++j)
|
||||
{
|
||||
if (j != skip)
|
||||
@@ -673,7 +666,7 @@ void G4Voxelizer::BuildReduceVoxels2(std::vector<G4double> boundaries[],
|
||||
for (auto k = 0; k <= 2; ++k)
|
||||
{
|
||||
std::vector<G4int> &candidatesCount = fCandidatesCounts[k];
|
||||
G4int max = candidatesCount.size();
|
||||
G4int max = (G4int)candidatesCount.size();
|
||||
G4int total = 0;
|
||||
for (G4int i = 0; i < max; ++i) total += candidatesCount[i];
|
||||
|
||||
@@ -732,7 +725,7 @@ void G4Voxelizer::CreateMiniVoxels(std::vector<G4double> boundaries[],
|
||||
G4SurfBits bitmasks[])
|
||||
{
|
||||
std::vector<G4int> voxel(3), maxVoxels(3);
|
||||
for (auto i = 0; i <= 2; ++i) maxVoxels[i] = boundaries[i].size();
|
||||
for (auto i = 0; i <= 2; ++i) maxVoxels[i] = (G4int)boundaries[i].size();
|
||||
|
||||
G4ThreeVector point;
|
||||
for (voxel[2] = 0; voxel[2] < maxVoxels[2] - 1; ++voxel[2])
|
||||
@@ -769,12 +762,12 @@ void G4Voxelizer::Voxelize(std::vector<G4VFacet*>& facets)
|
||||
G4int maxVoxels = fMaxVoxels;
|
||||
G4ThreeVector reductionRatio = fReductionRatio;
|
||||
|
||||
G4int size = facets.size();
|
||||
std::size_t size = facets.size();
|
||||
if (size < 10)
|
||||
{
|
||||
for (G4int i = 0; i < (G4int) facets.size(); ++i)
|
||||
for (std::size_t i = 0; i < facets.size(); ++i)
|
||||
{
|
||||
if (facets[i]->GetNumberOfVertices() > 3) size++;
|
||||
if (facets[i]->GetNumberOfVertices() > 3) ++size;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -838,7 +831,7 @@ void G4Voxelizer::Voxelize(std::vector<G4VFacet*>& facets)
|
||||
for (auto i = 0; i <= 2; ++i) { miniBoundaries[i] = fBoundaries[i]; }
|
||||
|
||||
G4int voxelsCountMini = (fCountOfVoxels >= 1000)
|
||||
? 100 : fCountOfVoxels / 10;
|
||||
? 100 : G4int(fCountOfVoxels / 10);
|
||||
|
||||
SetReductionRatio(voxelsCountMini, reductionRatioMini);
|
||||
|
||||
@@ -1086,7 +1079,7 @@ G4int G4Voxelizer::GetCandidatesVoxelArray(const G4ThreeVector &point,
|
||||
}
|
||||
*/
|
||||
}
|
||||
return list.size();
|
||||
return (G4int)list.size();
|
||||
}
|
||||
|
||||
//______________________________________________________________________________
|
||||
@@ -1144,7 +1137,7 @@ G4Voxelizer::GetCandidatesVoxelArray(const std::vector<G4int>& voxels,
|
||||
}
|
||||
}
|
||||
}
|
||||
return list.size();
|
||||
return (G4int)list.size();
|
||||
}
|
||||
|
||||
//______________________________________________________________________________
|
||||
@@ -1368,7 +1361,7 @@ G4int G4Voxelizer::AllocatedMemory()
|
||||
size += fBitmasks[0].GetNbytes() + fBitmasks[1].GetNbytes()
|
||||
+ fBitmasks[2].GetNbytes();
|
||||
|
||||
G4int csize = fCandidates.size();
|
||||
G4int csize = (G4int)fCandidates.size();
|
||||
for (G4int i = 0; i < csize; ++i)
|
||||
{
|
||||
size += sizeof(vector<G4int>) + fCandidates[i].capacity() * sizeof(G4int);
|
||||
|
||||
Reference in New Issue
Block a user