Geant4  10.02.p01
G4BlockingList.hh
Go to the documentation of this file.
1 //
2 // ********************************************************************
3 // * License and Disclaimer *
4 // * *
5 // * The Geant4 software is copyright of the Copyright Holders of *
6 // * the Geant4 Collaboration. It is provided under the terms and *
7 // * conditions of the Geant4 Software License, included in the file *
8 // * LICENSE and available at http://cern.ch/geant4/license . These *
9 // * include a list of copyright holders. *
10 // * *
11 // * Neither the authors of this software system, nor their employing *
12 // * institutes,nor the agencies providing financial support for this *
13 // * work make any representation or warranty, express or implied, *
14 // * regarding this software system or assume any liability for its *
15 // * use. Please see the license in the file LICENSE and URL above *
16 // * for the full disclaimer and the limitation of liability. *
17 // * *
18 // * This code implementation is the result of the scientific and *
19 // * technical work of the GEANT4 collaboration. *
20 // * By using, copying, modifying or distributing the software (or *
21 // * any work based on the software) you agree to acknowledge its *
22 // * use in resulting scientific publications, and indicate your *
23 // * acceptance of all terms of the Geant4 Software license. *
24 // ********************************************************************
25 //
26 //
27 // $Id: G4BlockingList.hh 66356 2012-12-18 09:02:32Z gcosmo $
28 //
29 // class G4BlockingList
30 //
31 // Class description:
32 //
33 // A utility class responsible for (efficiently) maintaining a List
34 // of blocked volume numbers, with rapid `reset' operations.
35 //
36 // Notes:
37 //
38 // Implemented via a ValVector of ints: a tag value is used to set
39 // the indices of blocked volumes. On reset the current tag value is
40 // increased, so that the ValVector must only be zeroed when the
41 // numerical range of the tag is used.
42 
43 // History:
44 //
45 // 24.7.96 P.Kent Separated from G4Navigator
46 // --------------------------------------------------------------------
47 #ifndef G4BLOCKINGLIST_HH
48 #define G4BLOCKINGLIST_HH
49 
50 #include "G4Types.hh"
51 #include <vector>
52 
53 const G4int kBlockingListMaxDefault = 500; // Block up to 511 daughters
54  // initially
56 const G4int kBlockTagNoMax = 2147483647; // 2^31-1 maximum tag no may reach
57 
59 {
60  public: // with description
61 
63  G4int stride=kBlockingListStride);
64  // Create empty blocking List of default size and `stride' resize count.
65 
67  // Destructor. No operations.
68 
69  void Reset();
70  // Efficiently `Reset' the blocking List, so that no volumes
71  // are blocked [Advance tag number and only fully clear List
72  // if tag max reached]
73 
74  void FullyReset();
75  // Clear the blocking List and reset tag value [slow].
76 
77  void Enlarge(const G4int nv);
78  // Enlarges blocking List if current size < nv, in units of stride.
79  // Clears the new part of the List.
80 
81  G4int Length() const;
82  // Returns the current length of the List. Note a length of 16
83  // means volumes of indices between 0 & 15 inclusive may be blocked.
84 
85  void BlockVolume(const G4int v);
86  // Block the volume number v.
87  // Requires: 0<=v<Length().
88 
89  G4bool IsBlocked(const G4int v) const;
90  // Return true if the volume number v is blocked, else false.
91  // Requires: 0 <= v < Length().
92 
93  private:
94 
96  // Current blocked volume tag number.
97 
98  std::vector<G4int> fBlockingList;
99  // Blocked volumes: Elements with indices
100  // corresponding to blocked volume set to fBlockTagNo.
101 
102 };
103 
104 #include "G4BlockingList.icc"
105 
106 #endif
int G4int
Definition: G4Types.hh:78
bool G4bool
Definition: G4Types.hh:79
G4int Length() const
void BlockVolume(const G4int v)
G4bool IsBlocked(const G4int v) const
const G4int kBlockTagNoMax
const G4int kBlockingListStride
G4BlockingList(G4int maxDefault=kBlockingListMaxDefault, G4int stride=kBlockingListStride)
const G4int kBlockingListMaxDefault
std::vector< G4int > fBlockingList
void Enlarge(const G4int nv)