Geant4  10.00.p03
G4IStore.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: G4IStore.hh 77780 2013-11-28 07:50:59Z gcosmo $
28 //
29 // ----------------------------------------------------------------------
30 // Class G4IStore
31 //
32 // Class description:
33 //
34 // An implementation of a "importance store" with the interface
35 // G4VIStore. See description in G4VIStore.
36 // This implementation uses G4GeometryCellImportance as the container
37 // to store the "cells" together with the importance values.
38 // Giving a cell the importance 0 is allowed as
39 // a flagging that no biasing should happen between this
40 // cell and it's neighbors
41 // If a cell is not known by the importance store no biasing
42 // should be applied between this cell and it's nighbors.
43 
44 // Author: Michael Dressel (Michael.Dressel@cern.ch)
45 //
46 // Alex Howard (alexander.howard@cern.ch):
47 // Changed class to a `singleton', with access via the static method
48 // G4IStore::GetInstance().
49 //
50 // Member data:
51 //
52 // static G4IStore* fInstance
53 // - Ptr to the unique instance of class
54 // ----------------------------------------------------------------------
55 #ifndef G4IStore_hh
56 #define G4IStore_hh G4IStore_hh
57 
58 #include "G4VIStore.hh"
61 
62 class G4IStore : public G4VIStore
63 {
64 
65 public:
66 
67  // static G4ThreadLocal G4IStore* GetInstance();
68  static G4IStore* GetInstance();
69  // Return ptr to singleton instance of the class.
70  // static G4ThreadLocal G4IStore* GetInstance(G4String ParallelWorldName);
71  static G4IStore* GetInstance(G4String ParallelWorldName);
72  // Return ptr to singleton instance of the class.
73 
74 protected:
75 
76  explicit G4IStore();
77  // initialise the importance store for the given geometry
78  explicit G4IStore(G4String ParallelWorldName);
79  // initialise the importance store for the given geometry
80 
81 public: // with description
82 
83  virtual ~G4IStore();
84  // destruct
85 
86  virtual G4double GetImportance(const G4GeometryCell &gCell) const;
87  // derive a importance value of a "cell" addresed by a G4GeometryCell
88  // from the store.
89 
90  virtual G4bool IsKnown(const G4GeometryCell &gCell) const;
91  // returns true if the gCell is in the store, else false
92 
93  void Clear();
94 
95  void SetWorldVolume();
96  // set a reference to the world volume of the
97  // "importance" geometry
98 
99  void SetParallelWorldVolume(G4String paraName);
100  // set a reference to the parallel world volume of the
101  // "importance" geometry
102 
103  virtual const G4VPhysicalVolume& GetWorldVolume() const;
104  // return a reference to the world volume of the
105  // "importance" geometry
106 
107  // virtual const G4VPhysicalVolume& GetParallelWorldVolume() const;
108  // // return a reference to the world volume of the
109  // // "importance" geometry
110  virtual const G4VPhysicalVolume* GetParallelWorldVolumePointer() const;
111  // return a pointer to the world volume of the
112  // "importance" geometry
113 
114  void AddImportanceGeometryCell(G4double importance,
115  const G4GeometryCell &gCell);
116  void AddImportanceGeometryCell(G4double importance,
117  const G4VPhysicalVolume &,
118  G4int aRepNum = 0);
119  // Add a "cell" together with a importance value to the store.
120 
121  void ChangeImportance(G4double importance,
122  const G4GeometryCell &gCell);
123  void ChangeImportance(G4double importance,
124  const G4VPhysicalVolume &,
125  G4int aRepNum = 0);
126  // Change a importance value of a "cell".
127 
129  G4int aRepNum = 0) const ;
130 
131 private:
132 
133  G4bool IsInWorld(const G4VPhysicalVolume &) const;
134  void SetInternalIterator(const G4GeometryCell &gCell) const;
135  void Error(const G4String &m) const;
136 
137 private:
138 
140  // const G4VPhysicalVolume* fParallelWorldVolume;
141  // G4bool fParaFlag;
143 
144  mutable G4GeometryCellImportance::const_iterator fCurrentIterator;
145 
146  // static G4ThreadLocal G4IStore* fInstance;
148 
149 };
150 
151 #endif
void SetParallelWorldVolume(G4String paraName)
Definition: G4IStore.cc:76
const G4VPhysicalVolume * fWorldVolume
Definition: G4IStore.hh:139
virtual ~G4IStore()
Definition: G4IStore.cc:60
G4bool IsInWorld(const G4VPhysicalVolume &) const
Definition: G4IStore.cc:188
void ChangeImportance(G4double importance, const G4GeometryCell &gCell)
Definition: G4IStore.cc:128
void SetWorldVolume()
Definition: G4IStore.cc:68
G4GeometryCellImportance::const_iterator fCurrentIterator
Definition: G4IStore.hh:144
G4IStore()
Definition: G4IStore.cc:49
int G4int
Definition: G4Types.hh:78
virtual const G4VPhysicalVolume * GetParallelWorldVolumePointer() const
Definition: G4IStore.cc:94
virtual G4bool IsKnown(const G4GeometryCell &gCell) const
Definition: G4IStore.cc:178
virtual G4double GetImportance(const G4GeometryCell &gCell) const
Definition: G4IStore.cc:163
bool G4bool
Definition: G4Types.hh:79
void SetInternalIterator(const G4GeometryCell &gCell) const
Definition: G4IStore.cc:99
virtual const G4VPhysicalVolume & GetWorldVolume() const
Definition: G4IStore.cc:84
void AddImportanceGeometryCell(G4double importance, const G4GeometryCell &gCell)
Definition: G4IStore.cc:104
G4GeometryCellImportance fGeometryCelli
Definition: G4IStore.hh:142
std::map< G4GeometryCell, G4double, G4GeometryCellComp > G4GeometryCellImportance
static G4IStore * GetInstance()
Definition: G4IStore.cc:211
void Error(const G4String &m) const
Definition: G4IStore.cc:201
static const double m
Definition: G4SIunits.hh:110
double G4double
Definition: G4Types.hh:76
void Clear()
Definition: G4IStore.cc:63
static G4IStore * fInstance
Definition: G4IStore.hh:147