Geant4  v4-10.4-release
 모두 클래스 네임스페이스들 파일들 함수 변수 타입정의 열거형 타입 열거형 멤버 Friends 매크로 그룹들 페이지들
G4RegionStore.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: G4RegionStore.hh 103096 2017-03-15 15:21:33Z gcosmo $
28 //
29 // class G4RegionStore
30 //
31 // Class description:
32 //
33 // Container for all regiong, with functionality derived from
34 // std::vector<T>. The class is a `singleton', in that only
35 // one can exist, and access is provided via the static method
36 // G4RegionStore::GetInstance().
37 //
38 // All regions should be registered with G4RegionStore, and removed on their
39 // destruction. The underlying container initially has a capacity of 20.
40 //
41 // If much additional functionality is added, should consider containment
42 // instead of inheritance for std::vector<T>
43 //
44 // Member data:
45 //
46 // static G4RegionStore*
47 // - Pointer to the single G4RegionStore
48 
49 // History:
50 // 18.09.02 G.Cosmo Initial version
51 // --------------------------------------------------------------------
52 #ifndef G4REGIONSTORE_HH
53 #define G4REGIONSTORE_HH
54 
55 #include <vector>
56 #include "G4Types.hh"
57 #include "G4String.hh"
58 #include "G4VStoreNotifier.hh"
59 
60 class G4Region;
61 class G4VPhysicalVolume;
62 
63 class G4RegionStore : public std::vector<G4Region*>
64 {
65  public: // with description
66 
67  static void Register(G4Region* pRegion);
68  // Add the region to the collection.
69  static void DeRegister(G4Region* pRegion);
70  // Remove the region from the collection.
71  static G4RegionStore* GetInstance();
72  // Get a ptr to the unique G4RegionStore, creating it if necessary.
73  static void SetNotifier(G4VStoreNotifier* pNotifier);
74  // Assign a notifier for allocation/deallocation of regions.
75  static void Clean();
76  // Delete all regions from the store except for the world region.
77 
78  G4bool IsModified() const;
79  // Loops through all regions to verify if a region has been
80  // modified. It returns TRUE if just one region is modified.
81  void ResetRegionModified();
82  // Loops through all regions to reset flag for modification
83  // to FALSE. Used by the run manager to notify that the
84  // physics table has been updated.
85 
86  void UpdateMaterialList(G4VPhysicalVolume* currentWorld=0);
87  // Forces recomputation of material lists in all regions
88  // in the store.
89 
90  G4Region* GetRegion(const G4String& name, G4bool verbose=true) const;
91  // Returns a region through its name specification.
92 
93  G4Region* FindOrCreateRegion(const G4String& name);
94  // Returns a region through its name specification, if it exists.
95  // If it does not exist it will allocate one delegating ownership
96  // to the client.
97 
98  public: // without description
99 
100  void SetWorldVolume();
101  // Set a world volume pointer to a region that belongs to it.
102  // Scan over all world volumes.
103  // This method should be exclusively used by G4RunManagerKernel.
104 
105  protected:
106 
107  G4RegionStore();
108  // Protected singleton constructor.
109  virtual ~G4RegionStore();
110  // Destructor: takes care to delete allocated regions.
111 
112  private:
113 
117 };
118 
119 #endif
const XML_Char * name
Definition: expat.h:151
static G4ThreadLocal G4VStoreNotifier * fgNotifier
void SetWorldVolume()
#define G4ThreadLocal
Definition: tls.hh:69
void UpdateMaterialList(G4VPhysicalVolume *currentWorld=0)
G4Region * GetRegion(const G4String &name, G4bool verbose=true) const
bool G4bool
Definition: G4Types.hh:79
virtual ~G4RegionStore()
static void SetNotifier(G4VStoreNotifier *pNotifier)
static void Register(G4Region *pRegion)
G4bool IsModified() const
static G4ThreadLocal G4bool locked
static G4RegionStore * fgInstance
static G4RegionStore * GetInstance()
static void DeRegister(G4Region *pRegion)
void ResetRegionModified()
static void Clean()
G4Region * FindOrCreateRegion(const G4String &name)