source: trunk/source/geometry/management/include/G4RegionStore.hh@ 989

Last change on this file since 989 was 850, checked in by garnier, 17 years ago

geant4.8.2 beta

File size: 4.6 KB
Line 
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,v 1.10 2006/11/30 10:39:28 gcosmo Exp $
28// GEANT4 tag $Name: HEAD $
29//
30// class G4RegionStore
31//
32// Class description:
33//
34// Container for all regiong, with functionality derived from
35// std::vector<T>. The class is a `singleton', in that only
36// one can exist, and access is provided via the static method
37// G4RegionStore::GetInstance().
38//
39// All regions should be registered with G4RegionStore, and removed on their
40// destruction. The underlying container initially has a capacity of 20.
41//
42// If much additional functionality is added, should consider containment
43// instead of inheritance for std::vector<T>
44//
45// Member data:
46//
47// static G4RegionStore*
48// - Pointer to the single G4RegionStore
49
50// History:
51// 18.09.02 G.Cosmo Initial version
52// --------------------------------------------------------------------
53#ifndef G4REGIONSTORE_HH
54#define G4REGIONSTORE_HH
55
56#include <vector>
57#include "G4Types.hh"
58#include "G4String.hh"
59#include "G4VStoreNotifier.hh"
60
61class G4Region;
62class G4VPhysicalVolume;
63
64class G4RegionStore : public std::vector<G4Region*>
65{
66 public: // with description
67
68 static void Register(G4Region* pSolid);
69 // Add the region to the collection.
70 static void DeRegister(G4Region* pSolid);
71 // Remove the region from the collection.
72 static G4RegionStore* GetInstance();
73 // Get a ptr to the unique G4RegionStore, creating it if necessary.
74 static void SetNotifier(G4VStoreNotifier* pNotifier);
75 // Assign a notifier for allocation/deallocation of regions.
76 static void Clean();
77 // Delete all regions from the store except for the world region.
78
79 G4bool IsModified() const;
80 // Loops through all regions to verify if a region has been
81 // modified. It returns TRUE if just one region is modified.
82 void ResetRegionModified();
83 // Loops through all regions to reset flag for modification
84 // to FALSE. Used by the run manager to notify that the
85 // physics table has been updated.
86
87 void UpdateMaterialList(G4VPhysicalVolume* currentWorld);
88 // Forces recomputation of material lists in all regions
89 // in the store.
90
91 G4Region* GetRegion(const G4String& name, G4bool verbose=true) const;
92 // Returns a region through its name specification.
93
94 G4Region* FindOrCreateRegion(const G4String& name);
95 // Returns a region through its name specification, if it exists.
96 // If it does not exist it will allocate one delegating ownership
97 // to the client.
98
99 public: // without description
100
101 void SetWorldVolume();
102 // Set a world volume pointer to a region that belongs to it.
103 // Scan over all world volumes.
104 // This method should be exclusively used by G4RunManagerKernel.
105
106 protected:
107
108 G4RegionStore();
109 // Protected singleton constructor.
110 virtual ~G4RegionStore();
111 // Destructor: takes care to delete allocated regions.
112
113 private:
114
115 static G4RegionStore* fgInstance;
116 static G4VStoreNotifier* fgNotifier;
117 static G4bool locked;
118};
119
120#endif
Note: See TracBrowser for help on using the repository browser.