Import Geant4 3.2.0 source tree
This commit is contained in:
@@ -1,12 +1,28 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
// ********************************************************************
|
||||
// * DISCLAIMER *
|
||||
// * *
|
||||
// * The following disclaimer summarizes all the specific disclaimers *
|
||||
// * of contributors to this software. The specific disclaimers,which *
|
||||
// * govern, are listed with their locations in: *
|
||||
// * http://cern.ch/geant4/license *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. *
|
||||
// * *
|
||||
// * This code implementation is the intellectual property of the *
|
||||
// * GEANT4 collaboration. *
|
||||
// * By copying, distributing or modifying the Program (or any work *
|
||||
// * based on the Program) you indicate your acceptance of this *
|
||||
// * statement, and all its terms. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4VSolid.cc,v 1.6 2000/11/16 14:29:23 grichine Exp $
|
||||
// GEANT4 tag $Name: geant4-03-01 $
|
||||
//
|
||||
// $Id: G4VSolid.cc,v 1.7.2.1 2001/06/28 19:08:32 gunter Exp $
|
||||
// GEANT4 tag $Name: $
|
||||
//
|
||||
// class G4VSolid
|
||||
//
|
||||
@@ -32,14 +48,14 @@
|
||||
G4VSolid::G4VSolid(const G4String& name) :
|
||||
fshapeName(name)
|
||||
{
|
||||
G4SolidStore::GetInstance()->append(this);
|
||||
G4SolidStore::GetInstance()->push_back(this);
|
||||
}
|
||||
|
||||
// Destructor (virtual)
|
||||
// - Remove ourselves from solid Store
|
||||
G4VSolid::~G4VSolid()
|
||||
{
|
||||
G4SolidStore::GetInstance()->remove(this);
|
||||
G4SolidStore::GetInstance()->DeRegister(this);
|
||||
}
|
||||
|
||||
// Returns name by value
|
||||
@@ -75,13 +91,13 @@ void G4VSolid::CalculateClippedPolygonExtent(G4ThreeVectorList& pPolygon,
|
||||
G4int noLeft,i;
|
||||
G4double component;
|
||||
ClipPolygon(pPolygon,pVoxelLimit);
|
||||
noLeft = pPolygon.entries();
|
||||
noLeft = pPolygon.size();
|
||||
|
||||
if (noLeft)
|
||||
{
|
||||
for (i=0;i<noLeft;i++)
|
||||
{
|
||||
component = pPolygon(i).operator()(pAxis);
|
||||
component = pPolygon[i].operator()(pAxis);
|
||||
|
||||
if (component < pMin)
|
||||
{
|
||||
@@ -115,10 +131,10 @@ void G4VSolid::ClipCrossSection(G4ThreeVectorList* pVertices,
|
||||
{
|
||||
|
||||
G4ThreeVectorList polygon;
|
||||
polygon.append(pVertices->operator()(pSectionIndex));
|
||||
polygon.append(pVertices->operator()(pSectionIndex+1));
|
||||
polygon.append(pVertices->operator()(pSectionIndex+2));
|
||||
polygon.append(pVertices->operator()(pSectionIndex+3));
|
||||
polygon.push_back((*pVertices)[pSectionIndex]);
|
||||
polygon.push_back((*pVertices)[pSectionIndex+1]);
|
||||
polygon.push_back((*pVertices)[pSectionIndex+2]);
|
||||
polygon.push_back((*pVertices)[pSectionIndex+3]);
|
||||
CalculateClippedPolygonExtent(polygon,pVoxelLimit,pAxis,pMin,pMax);
|
||||
return;
|
||||
}
|
||||
@@ -141,28 +157,28 @@ void G4VSolid::ClipBetweenSections(G4ThreeVectorList* pVertices,
|
||||
G4double& pMin, G4double& pMax) const
|
||||
{
|
||||
G4ThreeVectorList polygon;
|
||||
polygon.append(pVertices->operator()(pSectionIndex));
|
||||
polygon.append(pVertices->operator()(pSectionIndex+4));
|
||||
polygon.append(pVertices->operator()(pSectionIndex+5));
|
||||
polygon.append(pVertices->operator()(pSectionIndex+1));
|
||||
polygon.push_back((*pVertices)[pSectionIndex]);
|
||||
polygon.push_back((*pVertices)[pSectionIndex+4]);
|
||||
polygon.push_back((*pVertices)[pSectionIndex+5]);
|
||||
polygon.push_back((*pVertices)[pSectionIndex+1]);
|
||||
CalculateClippedPolygonExtent(polygon,pVoxelLimit,pAxis,pMin,pMax);
|
||||
polygon.clear();
|
||||
polygon.append(pVertices->operator()(pSectionIndex+1));
|
||||
polygon.append(pVertices->operator()(pSectionIndex+5));
|
||||
polygon.append(pVertices->operator()(pSectionIndex+6));
|
||||
polygon.append(pVertices->operator()(pSectionIndex+2));
|
||||
polygon.push_back((*pVertices)[pSectionIndex+1]);
|
||||
polygon.push_back((*pVertices)[pSectionIndex+5]);
|
||||
polygon.push_back((*pVertices)[pSectionIndex+6]);
|
||||
polygon.push_back((*pVertices)[pSectionIndex+2]);
|
||||
CalculateClippedPolygonExtent(polygon,pVoxelLimit,pAxis,pMin,pMax);
|
||||
polygon.clear();
|
||||
polygon.append(pVertices->operator()(pSectionIndex+2));
|
||||
polygon.append(pVertices->operator()(pSectionIndex+6));
|
||||
polygon.append(pVertices->operator()(pSectionIndex+7));
|
||||
polygon.append(pVertices->operator()(pSectionIndex+3));
|
||||
polygon.push_back((*pVertices)[pSectionIndex+2]);
|
||||
polygon.push_back((*pVertices)[pSectionIndex+6]);
|
||||
polygon.push_back((*pVertices)[pSectionIndex+7]);
|
||||
polygon.push_back((*pVertices)[pSectionIndex+3]);
|
||||
CalculateClippedPolygonExtent(polygon,pVoxelLimit,pAxis,pMin,pMax);
|
||||
polygon.clear();
|
||||
polygon.append(pVertices->operator()(pSectionIndex+3));
|
||||
polygon.append(pVertices->operator()(pSectionIndex+7));
|
||||
polygon.append(pVertices->operator()(pSectionIndex+4));
|
||||
polygon.append(pVertices->operator()(pSectionIndex));
|
||||
polygon.push_back((*pVertices)[pSectionIndex+3]);
|
||||
polygon.push_back((*pVertices)[pSectionIndex+7]);
|
||||
polygon.push_back((*pVertices)[pSectionIndex+4]);
|
||||
polygon.push_back((*pVertices)[pSectionIndex]);
|
||||
CalculateClippedPolygonExtent(polygon,pVoxelLimit,pAxis,pMin,pMax);
|
||||
return;
|
||||
}
|
||||
@@ -197,7 +213,7 @@ void G4VSolid::ClipPolygon(G4ThreeVectorList& pPolygon,
|
||||
ClipPolygonToSimpleLimits(pPolygon,outputPolygon,
|
||||
simpleLimit1);
|
||||
pPolygon.clear();
|
||||
if (!outputPolygon.entries())
|
||||
if (!outputPolygon.size())
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -205,7 +221,7 @@ void G4VSolid::ClipPolygon(G4ThreeVectorList& pPolygon,
|
||||
G4VoxelLimits simpleLimit2;
|
||||
simpleLimit2.AddLimit(kXAxis,-kInfinity,pVoxelLimit.GetMaxXExtent());
|
||||
ClipPolygonToSimpleLimits(outputPolygon,pPolygon,simpleLimit2);
|
||||
if (!pPolygon.entries())
|
||||
if (!pPolygon.size())
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -224,7 +240,7 @@ void G4VSolid::ClipPolygon(G4ThreeVectorList& pPolygon,
|
||||
// Must always clear pPolygon - for clip to simpleLimit2 and incase of
|
||||
// early exit
|
||||
pPolygon.clear();
|
||||
if (!outputPolygon.entries())
|
||||
if (!outputPolygon.size())
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -232,7 +248,7 @@ void G4VSolid::ClipPolygon(G4ThreeVectorList& pPolygon,
|
||||
G4VoxelLimits simpleLimit2;
|
||||
simpleLimit2.AddLimit(kYAxis,-kInfinity,pVoxelLimit.GetMaxYExtent());
|
||||
ClipPolygonToSimpleLimits(outputPolygon,pPolygon,simpleLimit2);
|
||||
if (!pPolygon.entries())
|
||||
if (!pPolygon.size())
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -251,7 +267,7 @@ void G4VSolid::ClipPolygon(G4ThreeVectorList& pPolygon,
|
||||
// Must always clear pPolygon - for clip to simpleLimit2 and incase of
|
||||
// early exit
|
||||
pPolygon.clear();
|
||||
if (!outputPolygon.entries())
|
||||
if (!outputPolygon.size())
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -272,18 +288,18 @@ void G4VSolid::ClipPolygonToSimpleLimits(G4ThreeVectorList& pPolygon,
|
||||
const G4VoxelLimits& pVoxelLimit) const
|
||||
{
|
||||
G4int i;
|
||||
G4int noVertices=pPolygon.entries();
|
||||
G4int noVertices=pPolygon.size();
|
||||
G4ThreeVector vEnd,vStart;
|
||||
for (i=0;i<noVertices;i++)
|
||||
{
|
||||
vStart=pPolygon(i);
|
||||
vStart=pPolygon[i];
|
||||
if (i==noVertices-1)
|
||||
{
|
||||
vEnd=pPolygon(0);
|
||||
vEnd=pPolygon[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
vEnd=pPolygon(i+1);
|
||||
vEnd=pPolygon[i+1];
|
||||
}
|
||||
|
||||
if (pVoxelLimit.Inside(vStart))
|
||||
@@ -291,13 +307,13 @@ void G4VSolid::ClipPolygonToSimpleLimits(G4ThreeVectorList& pPolygon,
|
||||
if (pVoxelLimit.Inside(vEnd))
|
||||
{
|
||||
// vStart and vEnd inside -> output end point
|
||||
outputPolygon.insert(vEnd);
|
||||
outputPolygon.push_back(vEnd);
|
||||
}
|
||||
else
|
||||
{
|
||||
// vStart inside, vEnd outside -> output crossing point
|
||||
pVoxelLimit.ClipToLimits(vStart,vEnd);
|
||||
outputPolygon.insert(vEnd);
|
||||
outputPolygon.push_back(vEnd);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -307,8 +323,8 @@ void G4VSolid::ClipPolygonToSimpleLimits(G4ThreeVectorList& pPolygon,
|
||||
{
|
||||
// vStart outside, vEnd inside -> output inside section
|
||||
pVoxelLimit.ClipToLimits(vStart,vEnd);
|
||||
outputPolygon.insert(vStart);
|
||||
outputPolygon.insert(vEnd);
|
||||
outputPolygon.push_back(vStart);
|
||||
outputPolygon.push_back(vEnd);
|
||||
}
|
||||
else
|
||||
// Both point outside -> no output
|
||||
|
||||
Reference in New Issue
Block a user