Geant4  10.02.p02
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 88801 2015-03-10 14:38:27Z 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(const 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(const G4String& ParallelWorldName);
79  // initialise the importance store for the given geometry
80 
81  ~G4IStore();
82  // destruct
83 
84 public: // with description
85 
86  virtual G4double GetImportance(const G4GeometryCell &gCell) const;
87  // derive an importance value of a "cell" addressed 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 
147 };
148 
149 #endif
void SetParallelWorldVolume(G4String paraName)
Definition: G4IStore.cc:75
const G4VPhysicalVolume * fWorldVolume
Definition: G4IStore.hh:139
~G4IStore()
Definition: G4IStore.cc:59
G4bool IsInWorld(const G4VPhysicalVolume &) const
Definition: G4IStore.cc:187
void ChangeImportance(G4double importance, const G4GeometryCell &gCell)
Definition: G4IStore.cc:127
void SetWorldVolume()
Definition: G4IStore.cc:67
G4GeometryCellImportance::const_iterator fCurrentIterator
Definition: G4IStore.hh:144
#define G4ThreadLocal
Definition: tls.hh:89
G4IStore()
Definition: G4IStore.cc:48
int G4int
Definition: G4Types.hh:78
virtual const G4VPhysicalVolume * GetParallelWorldVolumePointer() const
Definition: G4IStore.cc:93
static G4ThreadLocal G4IStore * fInstance
Definition: G4IStore.hh:146
virtual G4bool IsKnown(const G4GeometryCell &gCell) const
Definition: G4IStore.cc:177
virtual G4double GetImportance(const G4GeometryCell &gCell) const
Definition: G4IStore.cc:162
bool G4bool
Definition: G4Types.hh:79
void SetInternalIterator(const G4GeometryCell &gCell) const
Definition: G4IStore.cc:98
virtual const G4VPhysicalVolume & GetWorldVolume() const
Definition: G4IStore.cc:83
void AddImportanceGeometryCell(G4double importance, const G4GeometryCell &gCell)
Definition: G4IStore.cc:103
G4GeometryCellImportance fGeometryCelli
Definition: G4IStore.hh:142
std::map< G4GeometryCell, G4double, G4GeometryCellComp > G4GeometryCellImportance
static G4IStore * GetInstance()
Definition: G4IStore.cc:210
void Error(const G4String &m) const
Definition: G4IStore.cc:200
static const double m
Definition: G4SIunits.hh:128
double G4double
Definition: G4Types.hh:76
void Clear()
Definition: G4IStore.cc:62