5
5
// based on the Program) you indicate your acceptance of this statement,
6
6
// and all its terms.
7
7
//
8
- // $Id: G4SmartVoxelHeader.cc,v 2.1 1998/11/11 11:38 :22 japost Exp $
9
- // GEANT4 tag $Name: geant4-00 $
8
+ // $Id: G4SmartVoxelHeader.cc,v 1.3 1999/02/15 10:54 :22 japost Exp $
9
+ // GEANT4 tag $Name: geommng-01-00-02 $
10
10
//
11
11
//
12
12
// class G4SmartVoxelHeader
16
16
// Define G4GEOMETRY_VOXELDEBUG for debugging information on G4cout
17
17
//
18
18
// History:
19
+ // 12.02.99 Introduction of new quality/smartless: max for (slices/candid) S.G.
20
+ // 11.02.99 Voxels at lower levels are now built for collapsed slices S.G.
19
21
// 21.07.95 Full implementation, supporting non divided physical volumes
20
22
// 14.07.95 Initial version - stubb definitions only
21
23
@@ -409,7 +411,7 @@ void G4SmartVoxelHeader::BuildVoxelsWithinLimits(G4LogicalVolume* pVolume,
409
411
BuildEquivalentSliceNos ();
410
412
CollectEquivalentNodes (); // Collect common nodes
411
413
RefineNodes (pVolume,pLimits); // Refine nodes creating headers
412
- CollectEquivalentHeaders (); // Collect any common headers
414
+ // No common headers can exist because collapsed by construction
413
415
}
414
416
415
417
// Destructor - Delete all proxies and underlying objects
@@ -779,10 +781,23 @@ G4ProxyVector* G4SmartVoxelHeader::BuildNodes(G4LogicalVolume* pVolume,
779
781
//
780
782
// mother width/half min daughter width +1
781
783
G4double noNodesExactD=((motherMaxExtent-motherMinExtent)*2.0 /minWidth)+1.0 ;
782
- G4int noNodesExactI=G4int (noNodesExactD);
783
784
784
- G4int noNodes=((noNodesExactD-noNodesExactI)>=0.5 ) ? noNodesExactI+1 : noNodesExactI;
785
+ // Compare with "smartless quality", i.e. the average number of slices used per
786
+ // contained volume:
785
787
788
+ G4double smartlessComputed = noNodesExactD / nCandidates;
789
+
790
+ G4double smartlessUser = pVolume->GetSmartless ();
791
+
792
+ G4double smartless = (smartlessComputed <= smartlessUser) ?
793
+ smartlessComputed : smartlessUser ;
794
+
795
+ G4double noNodesSmart = smartless * nCandidates;
796
+
797
+ G4int noNodesExactI = G4int (noNodesSmart);
798
+
799
+ G4int noNodes = ((noNodesSmart-noNodesExactI)>=0.5 ) ?
800
+ noNodesExactI + 1 : noNodesExactI ;
786
801
//
787
802
//
788
803
@@ -1043,10 +1058,8 @@ void G4SmartVoxelHeader::RefineNodes(G4LogicalVolume* pVolume,
1043
1058
delete targetNode;
1044
1059
1045
1060
// Create new headers + proxies and replace in fslices
1046
- for (replaceNo=minNo;replaceNo<=maxNo;replaceNo++)
1047
- {
1048
1061
newLimits=pLimits;
1049
- newLimits.AddLimit (faxis,fminExtent+sliceWidth*replaceNo ,fminExtent+sliceWidth*(replaceNo +1 ));
1062
+ newLimits.AddLimit (faxis,fminExtent+sliceWidth*minNo ,fminExtent+sliceWidth*(maxNo +1 ));
1050
1063
replaceHeader=new G4SmartVoxelHeader (pVolume,newLimits,targetList,replaceNo);
1051
1064
if (!replaceHeader)
1052
1065
{
@@ -1059,6 +1072,9 @@ void G4SmartVoxelHeader::RefineNodes(G4LogicalVolume* pVolume,
1059
1072
{
1060
1073
G4Exception (" G4SmartVoxelHeader::RefineNodes - Refined VoxelProxy new failed" );
1061
1074
}
1075
+ for (replaceNo=minNo;replaceNo<=maxNo;replaceNo++)
1076
+ {
1077
+
1062
1078
fslices (replaceNo)=replaceHeaderProxy;
1063
1079
}
1064
1080
// Finished replacing current `equivalent' group
0 commit comments