Import Geant4 0.1.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-08 15:09:25 +02:00
parent b97f8d0df7
commit aaa409b6ee
2922 changed files with 55107 additions and 81674 deletions
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4SmartVoxelHeader.cc,v 2.1 1998/11/11 11:38:22 japost Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4SmartVoxelHeader.cc,v 1.4 1999/06/04 17:26:37 sgiani Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
//
// class G4SmartVoxelHeader
@@ -16,6 +16,8 @@
// Define G4GEOMETRY_VOXELDEBUG for debugging information on G4cout
//
// History:
// 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
// 14.07.95 Initial version - stubb definitions only
@@ -323,6 +325,7 @@ void G4SmartVoxelHeader::BuildVoxelsWithinLimits(G4LogicalVolume* pVolume,
G4double goodSliceScore=kInfinity,testSliceScore;
EAxis goodSliceAxis,testAxis;
G4int node,maxNode,iaxis;
G4VoxelLimits noLimits;
// Try all non-limited cartesian axes
for (iaxis=0;iaxis<3;iaxis++)
@@ -402,14 +405,15 @@ void G4SmartVoxelHeader::BuildVoxelsWithinLimits(G4LogicalVolume* pVolume,
// Calculate and set min and max extents given our axis
G4VSolid* outerSolid=pVolume->GetSolid();
const G4AffineTransform origin;
outerSolid->CalculateExtent(faxis,pLimits,
origin,
fminExtent,fmaxExtent);
if(!outerSolid->CalculateExtent(faxis,pLimits,origin,fminExtent,fmaxExtent)){
outerSolid->CalculateExtent(faxis,noLimits,origin,fminExtent,fmaxExtent);
};
// Calculate equivalent nos
BuildEquivalentSliceNos();
CollectEquivalentNodes(); // Collect common nodes
RefineNodes(pVolume,pLimits); // Refine nodes creating headers
CollectEquivalentHeaders(); // Collect any common headers
// No common headers can exist because collapsed by construction
}
// Destructor - Delete all proxies and underlying objects
@@ -645,6 +649,8 @@ G4ProxyVector* G4SmartVoxelHeader::BuildNodes(G4LogicalVolume* pVolume,
G4bool replicated;
G4int nCandidates;
G4int nVol,nNode,targetVolNo;
G4VoxelLimits noLimits;
nCandidates=pCandidates->entries();
#ifdef G4GEOMETRY_VOXELDEBUG
G4cout << "**** G4SmartVoxelHeader::BuildNodes" << endl
@@ -657,9 +663,9 @@ G4ProxyVector* G4SmartVoxelHeader::BuildNodes(G4LogicalVolume* pVolume,
// NOTE: results stored locally and not preserved/reused
G4VSolid* outerSolid=pVolume->GetSolid();
const G4AffineTransform origin;
outerSolid->CalculateExtent(pAxis,pLimits,
origin,
motherMinExtent,motherMaxExtent);
if(!outerSolid->CalculateExtent(pAxis,pLimits,origin,motherMinExtent,motherMaxExtent)){
outerSolid->CalculateExtent(pAxis,noLimits,origin,motherMinExtent,motherMaxExtent);
};
G4VolumeExtentVector minExtents(nCandidates);
G4VolumeExtentVector maxExtents(nCandidates);
@@ -719,10 +725,9 @@ G4ProxyVector* G4SmartVoxelHeader::BuildNodes(G4LogicalVolume* pVolume,
}
// Calc extents
targetSolid->CalculateExtent(pAxis,pLimits,
targetTransform,
targetMinExtent,
targetMaxExtent);
if(!targetSolid->CalculateExtent(pAxis,pLimits,targetTransform,targetMinExtent,targetMaxExtent)){
targetSolid->CalculateExtent(pAxis,noLimits,targetTransform,targetMinExtent,targetMaxExtent);
};
minExtents(nVol)=targetMinExtent;
maxExtents(nVol)=targetMaxExtent;
// Check not entirely outside mother when processing toplevel nodes
@@ -779,10 +784,23 @@ G4ProxyVector* G4SmartVoxelHeader::BuildNodes(G4LogicalVolume* pVolume,
//
// mother width/half min daughter width +1
G4double noNodesExactD=((motherMaxExtent-motherMinExtent)*2.0/minWidth)+1.0;
G4int noNodesExactI=G4int (noNodesExactD);
G4int noNodes=((noNodesExactD-noNodesExactI)>=0.5) ? noNodesExactI+1 : noNodesExactI;
// Compare with "smartless quality", i.e. the average number of slices used per
// contained volume:
G4double smartlessComputed = noNodesExactD / nCandidates;
G4double smartlessUser = pVolume->GetSmartless();
G4double smartless = (smartlessComputed <= smartlessUser) ?
smartlessComputed : smartlessUser ;
G4double noNodesSmart = smartless * nCandidates;
G4int noNodesExactI = G4int(noNodesSmart);
G4int noNodes = ((noNodesSmart-noNodesExactI)>=0.5) ?
noNodesExactI + 1 : noNodesExactI ;
//
//
@@ -1043,10 +1061,8 @@ void G4SmartVoxelHeader::RefineNodes(G4LogicalVolume* pVolume,
delete targetNode;
// Create new headers + proxies and replace in fslices
for (replaceNo=minNo;replaceNo<=maxNo;replaceNo++)
{
newLimits=pLimits;
newLimits.AddLimit(faxis,fminExtent+sliceWidth*replaceNo,fminExtent+sliceWidth*(replaceNo+1));
newLimits.AddLimit(faxis,fminExtent+sliceWidth*minNo,fminExtent+sliceWidth*(maxNo+1));
replaceHeader=new G4SmartVoxelHeader(pVolume,newLimits,targetList,replaceNo);
if (!replaceHeader)
{
@@ -1059,6 +1075,9 @@ void G4SmartVoxelHeader::RefineNodes(G4LogicalVolume* pVolume,
{
G4Exception("G4SmartVoxelHeader::RefineNodes - Refined VoxelProxy new failed");
}
for (replaceNo=minNo;replaceNo<=maxNo;replaceNo++)
{
fslices(replaceNo)=replaceHeaderProxy;
}
// Finished replacing current `equivalent' group