Import Geant4 3.2.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-08 16:10:37 +02:00
parent 137e303ecc
commit 36c080dca6
3464 changed files with 119310 additions and 52696 deletions
@@ -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: G4AssemblyVolume.cc,v 1.5 2001/02/08 12:33:56 radoone Exp $
// GEANT4 tag $Name: geant4-03-01 $
//
// $Id: G4AssemblyVolume.cc,v 1.5.2.1 2001/06/28 19:08:29 gunter Exp $
// GEANT4 tag $Name: $
//
//
// Class G4AssemblyVolume - implementation
+27 -11
View File
@@ -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: G4DrawVoxels.cc,v 1.12 2000/11/20 17:31:34 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-01 $
//
// $Id: G4DrawVoxels.cc,v 1.13.2.1 2001/06/28 19:08:29 gunter Exp $
// GEANT4 tag $Name: $
//
//
// class G4DrawVoxels
@@ -80,7 +96,7 @@ void G4DrawVoxels::ComputeVoxelPolyhedra(const G4LogicalVolume* lv,
G4ThreeVector t_centerofBoundingBox((xmin+xmax)*0.5,(ymin+ymax)*0.5,(zmin+zmax)*0.5);
//ppl->resize(ppl->entries()+1); //manual resize to avoid Rogue grabbing RW_DEFAULT
ppl->insert(G4PlacedPolyhedron(bounding_polyhedronBox,G4Translate3D(t_centerofBoundingBox)));
ppl->push_back(G4PlacedPolyhedron(bounding_polyhedronBox,G4Translate3D(t_centerofBoundingBox)));
G4ThreeVector t_FirstCenterofVoxelPlane;
const G4VisAttributes* voxelsVisAttributes=0;
@@ -147,7 +163,7 @@ void G4DrawVoxels::ComputeVoxelPolyhedra(const G4LogicalVolume* lv,
current_translation_vector*=step*slice_no;
//ppl->resize(ppl->entries()+1); //manual resize to avoid Rogue grabbing RW_DEFAULT
ppl->insert(G4PlacedPolyhedron(voxel_plane,G4Translate3D(current_translation_vector+t_FirstCenterofVoxelPlane)));
ppl->push_back(G4PlacedPolyhedron(voxel_plane,G4Translate3D(current_translation_vector+t_FirstCenterofVoxelPlane)));
slice_no=(slice->IsHeader()?slice->GetHeader()->GetMaxEquivalentSliceNo()+1
:slice->GetNode()->GetMaxEquivalentSliceNo()+1);
@@ -215,8 +231,8 @@ void G4DrawVoxels::DrawVoxels(const G4LogicalVolume* lv) const{
G4PlacedPolyhedronList* pplist=CreatePlacedPolyhedra(lv);
if(pVVisManager) {
//Drawing the bounding and voxel polyhedra for the pVolume
for (size_t i=0;i<pplist->entries();i++)
pVVisManager->Draw((*pplist)(i).GetPolyhedron(),(*pplist)(i).GetTransform()*transf3D);
for (size_t i=0;i<pplist->size();i++)
pVVisManager->Draw((*pplist)[i].GetPolyhedron(),(*pplist)[i].GetTransform()*transf3D);
}
else G4cout << "@@@@ void G4DrawVoxels::DrawVoxels(const G4LogicalVolume*) pVVisManager is null! @@@@" <<G4endl;
delete pplist;
@@ -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: G4GeometryManager.cc,v 1.2 1999/12/15 14:49:52 gunter Exp $
// GEANT4 tag $Name: geant4-03-01 $
//
// $Id: G4GeometryManager.cc,v 1.3.2.1 2001/06/28 19:08:30 gunter Exp $
// GEANT4 tag $Name: $
//
// class G4GeometryManager
//
@@ -70,10 +86,10 @@ void G4GeometryManager::BuildOptimisations(const G4bool allOpts)
G4SmartVoxelHeader *head;
G4int nVolumes,n;
Store=G4LogicalVolumeStore::GetInstance();
nVolumes=Store->entries();
nVolumes=Store->size();
for (n=0;n<nVolumes;n++)
{
volume=Store->operator()(n);
volume=(*Store)[n];
// For safety, check if there are any existing voxels and delete before
// replacement
head = volume->GetVoxelHeader();
@@ -126,10 +142,10 @@ void G4GeometryManager::DeleteOptimisations()
G4LogicalVolume *volume;
G4SmartVoxelHeader *head;
G4int nVolumes,n;
nVolumes=Store->entries();
nVolumes=Store->size();
for (n=0;n<nVolumes;n++)
{
volume=Store->operator()(n);
volume=(*Store)[n];
head=volume->GetVoxelHeader();
if (head)
{
@@ -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: G4LogicalVolume.cc,v 1.5 2000/11/20 17:31:34 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-01 $
//
// $Id: G4LogicalVolume.cc,v 1.7.2.1 2001/06/28 19:08:30 gunter Exp $
// GEANT4 tag $Name: $
//
//
// class G4LogicalVolume Implementation
@@ -30,8 +46,8 @@ G4LogicalVolume::G4LogicalVolume( G4VSolid *pSolid, G4Material *pMaterial,
G4FieldManager *pFieldMgr,
G4VSensitiveDetector *pSDetector,
G4UserLimits *pULimits)
: fDaughters(0), fFieldManager(pFieldMgr), fVoxel(0), fSmartless(2.),
fVisAttributes (0), fFastSimulationManager (0), fIsEnvelope(FALSE)
: fDaughters(0,(G4VPhysicalVolume*)0), fFieldManager(pFieldMgr), fVoxel(0),
fSmartless(2.), fVisAttributes (0), fFastSimulationManager (0), fIsEnvelope(FALSE)
{
SetSolid(pSolid);
SetMaterial(pMaterial);
@@ -136,10 +152,10 @@ G4LogicalVolume::FindMotherLogicalVolumeForEnvelope()
// Look for the current volume's mother volume.
for (size_t LV=0;LV < Store->entries(); LV++){
for (size_t LV=0;LV < Store->size(); LV++){
G4LogicalVolume *aLogVol;
aLogVol= Store->at(LV);
aLogVol= (*Store)[LV];
if( (aLogVol!=this) && // Don't look for it inside itself...
(aLogVol->GetFastSimulationManager()!=NULL)){
@@ -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: G4LogicalVolumeStore.cc,v 1.4 1999/12/15 14:49:52 gunter Exp $
// GEANT4 tag $Name: geant4-03-01 $
//
// $Id: G4LogicalVolumeStore.cc,v 1.5.2.1 2001/06/28 19:08:30 gunter Exp $
// GEANT4 tag $Name: $
//
// G4LogicalVolumeStore
//
@@ -20,14 +36,20 @@
// Protected constructor: Construct underlying container with
// initial size of 100 entries
G4LogicalVolumeStore::G4LogicalVolumeStore() : G4RWTPtrOrderedVector<G4LogicalVolume>(100)
G4LogicalVolumeStore::G4LogicalVolumeStore()
: G4std::vector<G4LogicalVolume*>()
{
reserve(100);
}
// Destructor
G4LogicalVolumeStore::~G4LogicalVolumeStore()
{
while (!isEmpty()) removeFirst();
while (!empty())
{
// delete front();
erase(begin());
}
}
// Static class variable
@@ -36,13 +58,20 @@ G4LogicalVolumeStore* G4LogicalVolumeStore::fgInstance = 0;
// Add volume to container
void G4LogicalVolumeStore::Register(G4LogicalVolume* pVolume)
{
GetInstance()->insert(pVolume);
GetInstance()->push_back(pVolume);
}
// Remove volume from container
void G4LogicalVolumeStore::DeRegister(G4LogicalVolume* pVolume)
{
GetInstance()->remove(pVolume);
for (iterator i=GetInstance()->begin(); i!=GetInstance()->end(); i++)
{
if (**i==*pVolume)
{
GetInstance()->erase(i);
break;
}
}
}
// Return ptr to Store, setting if necessary
@@ -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: G4PVParameterised.cc,v 1.3 2000/11/01 15:39:35 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-01 $
//
// $Id: G4PVParameterised.cc,v 1.3.4.1 2001/06/28 19:08:30 gunter Exp $
// GEANT4 tag $Name: $
//
//
// class G4PVParameterised
@@ -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: G4PVPlacement.cc,v 1.3 2000/11/20 17:31:34 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-01 $
//
// $Id: G4PVPlacement.cc,v 1.3.4.1 2001/06/28 19:08:30 gunter Exp $
// GEANT4 tag $Name: $
//
//
// class G4PVPlacement Implementation
+23 -7
View File
@@ -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: G4PVReplica.cc,v 1.2 1999/12/15 14:49:53 gunter Exp $
// GEANT4 tag $Name: geant4-03-01 $
//
// $Id: G4PVReplica.cc,v 1.2.4.1 2001/06/28 19:08:30 gunter Exp $
// GEANT4 tag $Name: $
//
//
// class G4PVReplica Implementation
@@ -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: G4PhysicalVolumeStore.cc,v 1.5 2000/11/01 15:39:35 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-01 $
//
// $Id: G4PhysicalVolumeStore.cc,v 1.6.2.1 2001/06/28 19:08:31 gunter Exp $
// GEANT4 tag $Name: $
//
// G4PhysicalVolumeStore
//
@@ -20,14 +36,20 @@
// Protected constructor: Construct underlying container with
// initial size of 100 entries
G4PhysicalVolumeStore::G4PhysicalVolumeStore() : G4RWTPtrOrderedVector<G4VPhysicalVolume>(100)
G4PhysicalVolumeStore::G4PhysicalVolumeStore()
: G4std::vector<G4VPhysicalVolume*>()
{
reserve(100);
}
// Destructor
G4PhysicalVolumeStore::~G4PhysicalVolumeStore()
{
while (!isEmpty()) removeFirst();
while (!empty())
{
// delete front();
erase(begin());
}
}
// Static class variable
@@ -36,13 +58,20 @@ G4PhysicalVolumeStore* G4PhysicalVolumeStore::fgInstance = 0;
// Add Solid to container
void G4PhysicalVolumeStore::Register(G4VPhysicalVolume* pVolume)
{
GetInstance()->insert(pVolume);
GetInstance()->push_back(pVolume);
}
// Remove Solid from container
void G4PhysicalVolumeStore::DeRegister(G4VPhysicalVolume* pVolume)
{
GetInstance()->remove(pVolume);
for (iterator i=GetInstance()->begin(); i!=GetInstance()->end(); i++)
{
if (**i==*pVolume)
{
GetInstance()->erase(i);
break;
}
}
}
// Return ptr to Store, setting if necessary
@@ -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: G4SmartVoxelHeader.cc,v 1.7 2000/11/20 17:31:34 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-01 $
//
// $Id: G4SmartVoxelHeader.cc,v 1.11.2.1 2001/06/28 19:08:31 gunter Exp $
// GEANT4 tag $Name: $
//
//
// class G4SmartVoxelHeader
@@ -16,6 +32,7 @@
// Define G4GEOMETRY_VOXELDEBUG for debugging information on G4cout
//
// History:
// 18.04.01 Migrated to STL vector - G.C.
// 12.02.99 Introduction of new quality/smartless: max for (slices/candid) S.G.
// 11.02.99 Voxels at lower levels are now built for collapsed slices S.G.
// 21.07.95 Full implementation, supporting non divided physical volumes
@@ -41,7 +58,7 @@
// or parametric)
G4SmartVoxelHeader::G4SmartVoxelHeader(G4LogicalVolume* pVolume,
const G4int pSlice) :
G4int pSlice) :
fminEquivalent(pSlice),
fmaxEquivalent(pSlice)
{
@@ -66,7 +83,7 @@ G4SmartVoxelHeader::G4SmartVoxelHeader(G4LogicalVolume* pVolume,
G4SmartVoxelHeader::G4SmartVoxelHeader(G4LogicalVolume* pVolume,
const G4VoxelLimits& pLimits,
const G4VolumeNosVector* pCandidates,
const G4int pSlice) :
G4int pSlice) :
fminEquivalent(pSlice),
fmaxEquivalent(pSlice)
@@ -75,9 +92,9 @@ G4SmartVoxelHeader::G4SmartVoxelHeader(G4LogicalVolume* pVolume,
G4cout << "**** G4SmartVoxelHeader::G4SmartVoxelHeader" << G4endl
<< " Limits " << pLimits << G4endl
<< " Candidate #s = " ;
for (G4int i=0;i<pCandidates->entries();i++)
for (G4int i=0;i<pCandidates->size();i++)
{
G4cout << pCandidates->at(i) << " ";
G4cout << (*pCandidates)[i] << " ";
}
G4cout << G4endl;
#endif
@@ -159,10 +176,11 @@ void G4SmartVoxelHeader::BuildVoxels(G4LogicalVolume* pVolume)
G4VoxelLimits limits; // Create `unlimited' limits object
G4int nDaughters=pVolume->GetNoDaughters();
G4VolumeNosVector targetList(nDaughters);
G4VolumeNosVector targetList;
targetList.reserve(nDaughters);
for (G4int i=0;i<nDaughters;i++)
{
targetList.insert(i);
targetList.push_back(i);
}
BuildVoxelsWithinLimits(pVolume,limits,&targetList);
}
@@ -190,11 +208,12 @@ void G4SmartVoxelHeader::BuildReplicaVoxels(G4LogicalVolume* pVolume)
if (consuming==false)
{
G4VoxelLimits limits; // Create `unlimited' limits object
G4VolumeNosVector targetList(nReplicas);
G4VolumeNosVector targetList;
targetList.reserve(nReplicas);
for (G4int i=0;i<nReplicas;i++)
{
targetList.insert(i);
}
{
targetList.push_back(i);
}
G4ProxyVector* pSlices=BuildNodes(pVolume,limits,&targetList,axis);
faxis=axis;
@@ -273,13 +292,14 @@ void G4SmartVoxelHeader::BuildReplicaVoxels(G4LogicalVolume* pVolume)
//
// o Modifies fslices `in place'
// o faxis,fminExtent,fmaxExtent NOT modified
void G4SmartVoxelHeader::BuildConsumedNodes(const G4int nReplicas)
void G4SmartVoxelHeader::BuildConsumedNodes(G4int nReplicas)
{
G4int nNode,nVol;
G4SmartVoxelNode *pNode;
G4SmartVoxelProxy *pProxyNode;
// Create and fill nodes in temporary G4NodeVector (on stack)
G4NodeVector nodeList(nReplicas);
G4NodeVector nodeList;
nodeList.reserve(nReplicas);
for (nNode=0;nNode<nReplicas;nNode++)
{
pNode=new G4SmartVoxelNode(nNode);
@@ -287,11 +307,11 @@ void G4SmartVoxelHeader::BuildConsumedNodes(const G4int nReplicas)
{
G4Exception("G4SmartVoxelHeader::BuildConsumedNodes Node allocation failed");
}
nodeList.insert(pNode);
nodeList.push_back(pNode);
}
for (nVol=0;nVol<nReplicas;nVol++)
{
nodeList(nVol)->Insert(nVol); // Insert replication of number
nodeList[nVol]->Insert(nVol); // Insert replication of number
// identical to voxel number
}
@@ -299,12 +319,12 @@ void G4SmartVoxelHeader::BuildConsumedNodes(const G4int nReplicas)
fslices.clear();
for (nNode=0;nNode<nReplicas;nNode++)
{
pProxyNode=new G4SmartVoxelProxy(nodeList(nNode));
pProxyNode=new G4SmartVoxelProxy(nodeList[nNode]);
if (!pProxyNode)
{
G4Exception("G4SmartVoxelHeader::BuildConsumedNodes Proxy Node allocation failed");
}
fslices.insert(pProxyNode);
fslices.push_back(pProxyNode);
}
}
@@ -359,12 +379,29 @@ void G4SmartVoxelHeader::BuildVoxelsWithinLimits(G4LogicalVolume* pVolume,
if (pTestSlices)
{
maxNode=pTestSlices->entries();
maxNode=pTestSlices->size();
for (node=0;node<maxNode;node++)
{
delete pTestSlices->operator()(node)->GetNode();
delete (*pTestSlices)[node]->GetNode();
}
pTestSlices->clearAndDestroy();
// Destroy pTestSlices and all its contents
G4SmartVoxelProxy* tmpProx;
while (pTestSlices->size()>0)
{
tmpProx = pTestSlices->back();
pTestSlices->pop_back();
for (G4ProxyVector::iterator
i=pTestSlices->begin();
i!=pTestSlices->end(); i++)
{
if (*i==tmpProx)
{
pTestSlices->erase(i);
i--;
}
}
if ( tmpProx ) delete tmpProx;
}
delete pTestSlices;
}
}
@@ -426,12 +463,12 @@ G4SmartVoxelHeader::~G4SmartVoxelHeader()
G4SmartVoxelProxy *lastProxy=0;
G4SmartVoxelNode *dyingNode,*lastNode=0;
G4SmartVoxelHeader *dyingHeader,*lastHeader=0;
maxNode=fslices.entries();
maxNode=fslices.size();
for (node=0;node<maxNode;node++)
{
if (fslices(node)->IsHeader())
if (fslices[node]->IsHeader())
{
dyingHeader=fslices(node)->GetHeader();
dyingHeader=fslices[node]->GetHeader();
if (lastHeader!=dyingHeader)
{
lastHeader=dyingHeader;
@@ -441,7 +478,7 @@ G4SmartVoxelHeader::~G4SmartVoxelHeader()
}
else
{
dyingNode=fslices(node)->GetNode();
dyingNode=fslices[node]->GetNode();
if (dyingNode!=lastNode)
{
lastNode=dyingNode;
@@ -454,9 +491,9 @@ G4SmartVoxelHeader::~G4SmartVoxelHeader()
// Delete proxies
for (proxy=0;proxy<maxNode;proxy++)
{
if (fslices(proxy)!=lastProxy)
if (fslices[proxy]!=lastProxy)
{
lastProxy=fslices(proxy);
lastProxy=fslices[proxy];
delete lastProxy;
}
}
@@ -481,18 +518,18 @@ G4SmartVoxelHeader::~G4SmartVoxelHeader()
void G4SmartVoxelHeader::BuildEquivalentSliceNos()
{
G4int sliceNo,minNo,maxNo,equivNo;
G4int maxNode=fslices.entries();
G4int maxNode=fslices.size();
G4SmartVoxelNode *startNode,*sampleNode;
for (sliceNo=0;sliceNo<maxNode;sliceNo++)
{
minNo=sliceNo;
// Get first node (see preconditions - will throw exception if a header)
startNode=fslices(minNo)->GetNode();
startNode=fslices[minNo]->GetNode();
// Find max equivalent
for (equivNo=minNo+1;equivNo<maxNode;equivNo++)
{
sampleNode=fslices(equivNo)->GetNode();
sampleNode=fslices[equivNo]->GetNode();
if (!(*startNode==*sampleNode))
{
break;
@@ -505,7 +542,7 @@ void G4SmartVoxelHeader::BuildEquivalentSliceNos()
// Set min and max nos
for (equivNo=minNo;equivNo<=maxNo;equivNo++)
{
sampleNode=fslices(equivNo)->GetNode();
sampleNode=fslices[equivNo]->GetNode();
sampleNode->SetMinEquivalentSliceNo(minNo);
sampleNode->SetMaxEquivalentSliceNo(maxNo);
}
@@ -529,12 +566,12 @@ void G4SmartVoxelHeader::BuildEquivalentSliceNos()
void G4SmartVoxelHeader::CollectEquivalentNodes()
{
G4int sliceNo,maxNo,equivNo;
G4int maxNode=fslices.entries();
G4int maxNode=fslices.size();
G4SmartVoxelNode *equivNode;
G4SmartVoxelProxy *equivProxy;
for (sliceNo=0;sliceNo<maxNode;sliceNo++)
{
equivProxy=fslices(sliceNo);
equivProxy=fslices[sliceNo];
// Asuumption: (see preconditions) all slices are nodes
equivNode=equivProxy->GetNode();
maxNo=equivNode->GetMaxEquivalentSliceNo();
@@ -548,9 +585,9 @@ void G4SmartVoxelHeader::CollectEquivalentNodes()
#endif
for (equivNo=sliceNo+1;equivNo<=maxNo;equivNo++)
{
delete fslices(equivNo)->GetNode();
delete fslices(equivNo);
fslices(equivNo)=equivProxy;
delete fslices[equivNo]->GetNode();
delete fslices[equivNo];
fslices[equivNo]=equivProxy;
}
sliceNo=maxNo;
}
@@ -571,12 +608,12 @@ void G4SmartVoxelHeader::CollectEquivalentNodes()
void G4SmartVoxelHeader::CollectEquivalentHeaders()
{
G4int sliceNo,maxNo,equivNo;
G4int maxNode=fslices.entries();
G4int maxNode=fslices.size();
G4SmartVoxelHeader *equivHeader,*sampleHeader;
G4SmartVoxelProxy *equivProxy;
for (sliceNo=0;sliceNo<maxNode;sliceNo++)
{
equivProxy=fslices(sliceNo);
equivProxy=fslices[sliceNo];
if (equivProxy->IsHeader())
{
equivHeader=equivProxy->GetHeader();
@@ -594,7 +631,7 @@ void G4SmartVoxelHeader::CollectEquivalentHeaders()
for (equivNo=sliceNo+1;equivNo<=maxNo;equivNo++)
{
sampleHeader=fslices(equivNo)->GetHeader();
sampleHeader=fslices[equivNo]->GetHeader();
if (*sampleHeader==*equivHeader)
{
// Dlete sampleHeader + proxy and replace with equivHeader/Proxy
@@ -603,13 +640,13 @@ void G4SmartVoxelHeader::CollectEquivalentHeaders()
#endif
delete sampleHeader;
delete fslices(equivNo);
fslices(equivNo)=equivProxy;
delete fslices[equivNo];
fslices[equivNo]=equivProxy;
}
else
{
// Not equal. Set this header to be the current header for comparisons
equivProxy=fslices(equivNo);
equivProxy=fslices[equivNo];
equivHeader=equivProxy->GetHeader();
}
@@ -652,7 +689,7 @@ G4ProxyVector* G4SmartVoxelHeader::BuildNodes(G4LogicalVolume* pVolume,
G4int nVol,nNode,targetVolNo;
G4VoxelLimits noLimits;
nCandidates=pCandidates->entries();
nCandidates=pCandidates->size();
#ifdef G4GEOMETRY_VOXELDEBUG
G4cout << "**** G4SmartVoxelHeader::BuildNodes" << G4endl
<< " Limits = " << pLimits << G4endl
@@ -668,8 +705,8 @@ G4ProxyVector* G4SmartVoxelHeader::BuildNodes(G4LogicalVolume* pVolume,
outerSolid->CalculateExtent(pAxis,noLimits,origin,motherMinExtent,motherMaxExtent);
};
G4VolumeExtentVector minExtents(nCandidates);
G4VolumeExtentVector maxExtents(nCandidates);
G4VolumeExtentVector minExtents(nCandidates,0.);
G4VolumeExtentVector maxExtents(nCandidates,0.);
if (pVolume->GetNoDaughters()==1 &&
pVolume->GetDaughter(0)->IsReplicated()==true)
@@ -699,7 +736,7 @@ G4ProxyVector* G4SmartVoxelHeader::BuildNodes(G4LogicalVolume* pVolume,
// Compute extents
for (nVol=0;nVol<nCandidates;nVol++)
{
targetVolNo=pCandidates->operator()(nVol);
targetVolNo=(*pCandidates)[nVol];
if (replicated==false)
{
pDaughter=pVolume->GetDaughter(targetVolNo);
@@ -729,8 +766,8 @@ G4ProxyVector* G4SmartVoxelHeader::BuildNodes(G4LogicalVolume* pVolume,
if(!targetSolid->CalculateExtent(pAxis,pLimits,targetTransform,targetMinExtent,targetMaxExtent)){
targetSolid->CalculateExtent(pAxis,noLimits,targetTransform,targetMinExtent,targetMaxExtent);
};
minExtents(nVol)=targetMinExtent;
maxExtents(nVol)=targetMaxExtent;
minExtents[nVol]=targetMinExtent;
maxExtents[nVol]=targetMaxExtent;
// Check not entirely outside mother when processing toplevel nodes
if (!pLimits.IsLimited()&&((targetMaxExtent<=motherMinExtent)||(targetMinExtent>=motherMaxExtent)))
{
@@ -748,9 +785,9 @@ G4ProxyVector* G4SmartVoxelHeader::BuildNodes(G4LogicalVolume* pVolume,
{
G4double width;
const G4int kStraddlePercent=5;
width=maxExtents(nVol)-minExtents(nVol);
if (((motherMinExtent-minExtents(nVol))*100/width>kStraddlePercent)
||((maxExtents(nVol)-motherMaxExtent)*100/width>kStraddlePercent))
width=maxExtents[nVol]-minExtents[nVol];
if (((motherMinExtent-minExtents[nVol])*100/width>kStraddlePercent)
||((maxExtents[nVol]-motherMaxExtent)*100/width>kStraddlePercent))
{
G4cout << "**** G4SmartVoxelHeader::BuildNodes" << G4endl
<< " WARNING : Daughter # " << nVol
@@ -771,10 +808,10 @@ G4ProxyVector* G4SmartVoxelHeader::BuildNodes(G4LogicalVolume* pVolume,
G4double currentWidth;
for (nVol=0;nVol<nCandidates;nVol++)
{
currentWidth=maxExtents(nVol)-minExtents(nVol);
currentWidth=maxExtents[nVol]-minExtents[nVol];
if (currentWidth<minWidth&&
maxExtents(nVol)>=pLimits.GetMinExtent(pAxis)&&
minExtents(nVol)<=pLimits.GetMaxExtent(pAxis))
maxExtents[nVol]>=pLimits.GetMinExtent(pAxis)&&
minExtents[nVol]<=pLimits.GetMaxExtent(pAxis))
{
minWidth=currentWidth;
}
@@ -819,9 +856,8 @@ G4int noNodes = ((noNodesSmart-noNodesExactI)>=0.5) ?
G4double nodeWidth=(motherMaxExtent-motherMinExtent)/noNodes;
// Create G4VoxelNodes. Will Add proxies before setting fslices
G4NodeVector *nodeList;
nodeList= new G4NodeVector(noNodes);
G4NodeVector* nodeList = new G4NodeVector();
nodeList->reserve(noNodes);
if (!nodeList)
{
@@ -835,7 +871,7 @@ G4int noNodes = ((noNodesSmart-noNodesExactI)>=0.5) ?
{
G4Exception("G4SmartVoxelHeader::BuildNodes Node allocation failed");
}
nodeList->insert(pNode);
nodeList->push_back(pNode);
}
// All nodes created (empty)
@@ -843,8 +879,8 @@ G4int noNodes = ((noNodesSmart-noNodesExactI)>=0.5) ?
for (nVol=0;nVol<nCandidates;nVol++)
{
G4int nodeNo,minContainingNode,maxContainingNode;
minContainingNode=G4int ((minExtents(nVol)-motherMinExtent)/nodeWidth);
maxContainingNode=G4int ((maxExtents(nVol)-motherMinExtent)/nodeWidth);
minContainingNode=G4int ((minExtents[nVol]-motherMinExtent)/nodeWidth);
maxContainingNode=G4int ((maxExtents[nVol]-motherMinExtent)/nodeWidth);
// Only add nodes that are inside the limits of the axis
if (maxContainingNode>=0&&minContainingNode<noNodes)
@@ -863,7 +899,7 @@ G4int noNodes = ((noNodesSmart-noNodesExactI)>=0.5) ?
for (nodeNo=minContainingNode;nodeNo<=maxContainingNode;nodeNo++)
{
nodeList->operator()(nodeNo)->Insert(pCandidates->operator()(nVol));
(*nodeList)[nodeNo]->Insert((*pCandidates)[nVol]);
}
}
}
@@ -873,7 +909,8 @@ G4int noNodes = ((noNodesSmart-noNodesExactI)>=0.5) ?
// nodeList *itself* - not the contents)
G4ProxyVector *proxyList;
proxyList=new G4ProxyVector(noNodes);
proxyList=new G4ProxyVector();
proxyList->reserve(noNodes);
if (!proxyList)
{
@@ -884,12 +921,12 @@ G4int noNodes = ((noNodesSmart-noNodesExactI)>=0.5) ?
for (nNode=0;nNode<noNodes;nNode++)
{
G4SmartVoxelProxy *pProxyNode;
pProxyNode=new G4SmartVoxelProxy(nodeList->operator()(nNode));
pProxyNode=new G4SmartVoxelProxy((*nodeList)[nNode]);
if (!pProxyNode)
{
G4Exception("G4SmartVoxelHeader::BuildNodes Proxy Node allocation failed");
}
proxyList->insert(pProxyNode);
proxyList->push_back(pProxyNode);
}
delete nodeList;
return proxyList;
@@ -920,14 +957,14 @@ G4double G4SmartVoxelHeader::CalculateQuality(G4ProxyVector *pSlice)
G4int noContained,maxContained=0;
G4SmartVoxelNode *node;
nNodes=pSlice->entries();
nNodes=pSlice->size();
for (G4int i=0;i<nNodes;i++)
{
if (pSlice->operator()(i)->IsNode())
if ((*pSlice)[i]->IsNode())
{
// Definitely a node. Add info to running totals
node=pSlice->operator()(i)->GetNode();
node=(*pSlice)[i]->GetNode();
noContained=node->GetNoContained();
if (noContained)
{
@@ -980,7 +1017,7 @@ void G4SmartVoxelHeader::RefineNodes(G4LogicalVolume* pVolume,
G4VoxelLimits pLimits)
{
G4int refinedDepth=0,minVolumes;
G4int maxNode=fslices.entries();
G4int maxNode=fslices.size();
if (pLimits.IsXLimited())
{
refinedDepth++;
@@ -1023,21 +1060,22 @@ void G4SmartVoxelHeader::RefineNodes(G4LogicalVolume* pVolume,
for (targetNo=0;targetNo<maxNode;targetNo++)
{
targetNodeProxy=fslices(targetNo);
targetNodeProxy=fslices[targetNo];
// Assume all slices are nodes (see preconditions)
targetNode=targetNodeProxy->GetNode();
if (targetNode->GetNoContained()>=minVolumes)
{
noContainedDaughters=targetNode->GetNoContained();
targetList = new G4VolumeNosVector(noContainedDaughters);
targetList = new G4VolumeNosVector();
targetList->reserve(noContainedDaughters);
if (!targetList)
{
G4Exception("G4SmartVoxelHeader::RefineNodes - Target volume no List new failed");
}
for (i=0;i<noContainedDaughters;i++)
{
targetList->insert(targetNode->GetVolume(i));
targetList->push_back(targetNode->GetVolume(i));
}
minNo=targetNode->GetMinEquivalentSliceNo();
maxNo=targetNode->GetMaxEquivalentSliceNo();
@@ -1052,9 +1090,9 @@ void G4SmartVoxelHeader::RefineNodes(G4LogicalVolume* pVolume,
lastProxy=0;
for (replaceNo=minNo;replaceNo<=maxNo;replaceNo++)
{
if (lastProxy!=fslices(replaceNo))
if (lastProxy!=fslices[replaceNo])
{
lastProxy=fslices(replaceNo);
lastProxy=fslices[replaceNo];
delete lastProxy;
}
}
@@ -1079,7 +1117,7 @@ void G4SmartVoxelHeader::RefineNodes(G4LogicalVolume* pVolume,
for (replaceNo=minNo;replaceNo<=maxNo;replaceNo++)
{
fslices(replaceNo)=replaceHeaderProxy;
fslices[replaceNo]=replaceHeaderProxy;
}
// Finished replacing current `equivalent' group
delete targetList;
@@ -1101,13 +1139,13 @@ G4bool G4SmartVoxelHeader::AllSlicesEqual() const
{
G4int noSlices;
G4SmartVoxelProxy *refProxy;
noSlices=fslices.entries();
noSlices=fslices.size();
if (noSlices>1)
{
refProxy=fslices(0);
refProxy=fslices[0];
for (G4int i=1;i<noSlices;i++)
{
if (refProxy!=fslices(i))
if (refProxy!=fslices[i])
{
return false;
}
@@ -1119,25 +1157,25 @@ G4bool G4SmartVoxelHeader::AllSlicesEqual() const
// Output for debugging
G4std::ostream& operator << (G4std::ostream&s, const G4SmartVoxelHeader& h)
{
s << "Axis = " << h.faxis << G4endl;
s << "Axis = " << G4int(h.faxis) << G4endl;
G4SmartVoxelProxy *collectNode=0,*collectHead=0;
G4int collectNodeNo=0;
G4int collectHeadNo=0;
size_t i,j;
G4bool haveHeaders=false;
for (i=0;i<h.fslices.entries();i++)
for (i=0;i<h.fslices.size();i++)
{
s << "Slice #" << i << " = ";
if (h.fslices(i)->IsNode())
if (h.fslices[i]->IsNode())
{
if (h.fslices(i)!=collectNode)
if (h.fslices[i]!=collectNode)
{
s << "{";
for (G4int j=0;j<h.fslices(i)->GetNode()->GetNoContained();j++)
{ s << " " << h.fslices(i)->GetNode()->GetVolume(j); }
for (G4int j=0;j<h.fslices[i]->GetNode()->GetNoContained();j++)
{ s << " " << h.fslices[i]->GetNode()->GetVolume(j); }
s << " }" << G4endl;
collectNode=h.fslices(i);
collectNode=h.fslices[i];
collectNodeNo=i;
}
else
@@ -1148,10 +1186,10 @@ G4std::ostream& operator << (G4std::ostream&s, const G4SmartVoxelHeader& h)
else
{
haveHeaders=true;
if (h.fslices(i)!=collectHead)
if (h.fslices[i]!=collectHead)
{
s << "Header" << G4endl;
collectHead=h.fslices(i);
collectHead=h.fslices[i];
collectHeadNo=i;
}
else
@@ -1164,17 +1202,17 @@ G4std::ostream& operator << (G4std::ostream&s, const G4SmartVoxelHeader& h)
if (haveHeaders)
{
collectHead=0;
for (j=0;j<h.fslices.entries();j++)
for (j=0;j<h.fslices.size();j++)
{
if (h.fslices(j)->IsHeader())
if (h.fslices[j]->IsHeader())
{
s << "Header at Slice #" << j << " = ";
if (h.fslices(j)!=collectHead)
if (h.fslices[j]!=collectHead)
{
s << G4endl
<< (*(h.fslices(j)->GetHeader()));
collectHead=h.fslices(j);
<< (*(h.fslices[j]->GetHeader()));
collectHead=h.fslices[j];
collectHeadNo=j;
}
else
@@ -1186,4 +1224,3 @@ G4std::ostream& operator << (G4std::ostream&s, const G4SmartVoxelHeader& h)
}
return s;
}
@@ -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: G4SmartVoxelNode.cc,v 1.2 1999/12/15 14:49:53 gunter Exp $
// GEANT4 tag $Name: geant4-03-01 $
//
// $Id: G4SmartVoxelNode.cc,v 1.2.4.1 2001/06/28 19:08:31 gunter Exp $
// GEANT4 tag $Name: $
//
// Class G4SmartVoxelNode
//
+40 -12
View File
@@ -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: G4SolidStore.cc,v 1.5 2000/09/11 11:09:57 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-01 $
//
// $Id: G4SolidStore.cc,v 1.6.2.1 2001/06/28 19:08:31 gunter Exp $
// GEANT4 tag $Name: $
//
// G4SolidStore
//
@@ -20,15 +36,20 @@
// Protected constructor: Construct underlying container with
// initial size of 100 entries
G4SolidStore::G4SolidStore() : G4RWTPtrOrderedVector<G4VSolid>(100)
G4SolidStore::G4SolidStore()
: G4std::vector<G4VSolid*>()
{
reserve(100);
}
// Destructor
G4SolidStore::~G4SolidStore()
{
while (!isEmpty()) removeFirst();
// clearAndDestroy();
while (!empty())
{
// delete front();
erase(begin());
}
}
// Static class variable
@@ -37,13 +58,20 @@ G4SolidStore* G4SolidStore::fgInstance = 0;
// Add Solid to container
void G4SolidStore::Register(G4VSolid* pSolid)
{
GetInstance()->insert(pSolid);
GetInstance()->push_back(pSolid);
}
// Remove Solid from container
void G4SolidStore::DeRegister(G4VSolid* pSolid)
{
GetInstance()->remove(pSolid);
for (iterator i=GetInstance()->begin(); i!=GetInstance()->end(); i++)
{
if (**i==*pSolid)
{
GetInstance()->erase(i);
break;
}
}
}
// Return ptr to Store, setting if necessary
@@ -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: G4VPVParameterisation.cc,v 1.2 1999/12/15 14:49:54 gunter Exp $
// GEANT4 tag $Name: geant4-03-01 $
//
// $Id: G4VPVParameterisation.cc,v 1.2.4.1 2001/06/28 19:08:32 gunter Exp $
// GEANT4 tag $Name: $
//
// Default implementations for Parameterisations that do not
// parameterise solid and/or material
@@ -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: G4VPhysicalVolume.cc,v 1.3 1999/12/15 14:49:54 gunter Exp $
// GEANT4 tag $Name: geant4-03-01 $
//
// $Id: G4VPhysicalVolume.cc,v 1.3.4.1 2001/06/28 19:08:32 gunter Exp $
// GEANT4 tag $Name: $
//
//
// class G4VPhysicalVolume Implementation
+60 -44
View File
@@ -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
@@ -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: G4VoxelLimits.cc,v 1.3 2000/11/01 15:39:36 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-01 $
//
// $Id: G4VoxelLimits.cc,v 1.3.4.1 2001/06/28 19:08:32 gunter Exp $
// GEANT4 tag $Name: $
//
// class G4VoxelLimits
//