Geant4  v4-10.4-release
 모두 클래스 네임스페이스들 파일들 함수 변수 타입정의 열거형 타입 열거형 멤버 Friends 매크로 그룹들 페이지들
G4IStore.hh
이 파일의 문서화 페이지로 가기
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 102994 2017-03-07 16:31:28Z 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 #ifdef G4MULTITHREADED
149  static G4Mutex IStoreMutex;
150 #endif
151 
152 };
153 
154 #endif
void Clear()
Definition: G4IStore.cc:66
void AddImportanceGeometryCell(G4double importance, const G4GeometryCell &gCell)
Definition: G4IStore.cc:107
G4GeometryCellImportance fGeometryCelli
Definition: G4IStore.hh:142
G4IStore()
Definition: G4IStore.cc:52
#define G4ThreadLocal
Definition: tls.hh:69
~G4IStore()
Definition: G4IStore.cc:63
static constexpr double m
Definition: G4SIunits.hh:129
G4GeometryCellImportance::const_iterator fCurrentIterator
Definition: G4IStore.hh:144
void Error(const G4String &m) const
Definition: G4IStore.cc:226
double G4double
Definition: G4Types.hh:76
bool G4bool
Definition: G4Types.hh:79
void SetInternalIterator(const G4GeometryCell &gCell) const
Definition: G4IStore.cc:102
static G4ThreadLocal G4IStore * fInstance
Definition: G4IStore.hh:146
virtual const G4VPhysicalVolume & GetWorldVolume() const
Definition: G4IStore.cc:87
const G4VPhysicalVolume * fWorldVolume
Definition: G4IStore.hh:139
void SetParallelWorldVolume(G4String paraName)
Definition: G4IStore.cc:79
virtual G4bool IsKnown(const G4GeometryCell &gCell) const
Definition: G4IStore.cc:197
G4bool IsInWorld(const G4VPhysicalVolume &) const
Definition: G4IStore.cc:213
int G4int
Definition: G4Types.hh:78
static G4IStore * GetInstance()
Definition: G4IStore.cc:236
void ChangeImportance(G4double importance, const G4GeometryCell &gCell)
Definition: G4IStore.cc:131
void SetWorldVolume()
Definition: G4IStore.cc:71
std::map< G4GeometryCell, G4double, G4GeometryCellComp > G4GeometryCellImportance
virtual const G4VPhysicalVolume * GetParallelWorldVolumePointer() const
Definition: G4IStore.cc:97
virtual G4double GetImportance(const G4GeometryCell &gCell) const
Definition: G4IStore.cc:174
std::mutex G4Mutex
Definition: G4Threading.hh:84