Geant4-11
G4Region.icc
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// G4Region inline implementation
27//
28// 19.09.02, G.Cosmo - Created
29// --------------------------------------------------------------------
30
31// ********************************************************************
32// Equality operator, defined by address only
33// ********************************************************************
34//
35inline
36G4bool G4Region::operator==(const G4Region& rg) const
37{
38 return (this==&rg) ? true : false;
39}
40
41// ********************************************************************
42// GetInstanceID
43// ********************************************************************
44//
45inline
46G4int G4Region::GetInstanceID() const
47{
48 return instanceID;
49}
50
51// ********************************************************************
52// GetName
53// ********************************************************************
54//
55inline
56const G4String& G4Region::GetName() const
57{
58 return fName;
59}
60
61// ********************************************************************
62// RegionModified
63// ********************************************************************
64//
65inline
66void G4Region::RegionModified(G4bool flag)
67{
68 fRegionMod = flag;
69}
70
71// ********************************************************************
72// IsModified
73// ********************************************************************
74//
75inline
76G4bool G4Region::IsModified() const
77{
78 return fRegionMod;
79}
80
81// ********************************************************************
82// SetProductionCuts
83// ********************************************************************
84//
85inline
86void G4Region::SetProductionCuts(G4ProductionCuts* cut)
87{
88 fCut = cut;
89 fRegionMod = true;
90}
91
92// ********************************************************************
93// GetProductionCuts
94// ********************************************************************
95//
96inline
97G4ProductionCuts* G4Region::GetProductionCuts() const
98{
99 return fCut;
100}
101
102// ********************************************************************
103// GetLogicalVolumeIterator
104// ********************************************************************
105//
106inline
107std::vector<G4LogicalVolume*>::iterator
108G4Region::GetRootLogicalVolumeIterator()
109{
110 return G4RootLVList::iterator(fRootVolumes.begin());
111}
112
113// ********************************************************************
114// GetMaterialIterator
115// ********************************************************************
116//
117inline
118std::vector<G4Material*>::const_iterator
119G4Region::GetMaterialIterator() const
120{
121 return fMaterials.cbegin();
122}
123
124// ********************************************************************
125// GetNumberOfMaterials
126// ********************************************************************
127//
128inline
129size_t G4Region::GetNumberOfMaterials() const
130{
131 return fMaterials.size();
132}
133
134// ********************************************************************
135// GetNumberOfRootVolumes
136// ********************************************************************
137//
138inline
139size_t G4Region::GetNumberOfRootVolumes() const
140{
141 return fRootVolumes.size();
142}
143
144// ********************************************************************
145// SetUserInformation
146// ********************************************************************
147//
148inline
149void G4Region::SetUserInformation(G4VUserRegionInformation* ui)
150{
151 fUserInfo = ui;
152}
153
154// ********************************************************************
155// GetUserInformation
156// ********************************************************************
157//
158inline
159G4VUserRegionInformation* G4Region::GetUserInformation() const
160{
161 return fUserInfo;
162}
163
164// ********************************************************************
165// SetUserLimits
166// ********************************************************************
167//
168inline
169void G4Region::SetUserLimits(G4UserLimits* ul)
170{
171 fUserLimits = ul;
172}
173
174// ********************************************************************
175// GetUserLimits
176// ********************************************************************
177//
178inline
179G4UserLimits* G4Region::GetUserLimits() const
180{
181 return fUserLimits;
182}
183
184// ********************************************************************
185// ClearMap
186// ********************************************************************
187//
188inline
189void G4Region::ClearMap()
190{
191 if(!(fMaterialCoupleMap.empty()))
192 {
193 auto b = fMaterialCoupleMap.cbegin();
194 auto e = fMaterialCoupleMap.cend();
195 fMaterialCoupleMap.erase(b,e);
196 }
197}
198
199// ********************************************************************
200// RegisterMateralCouplePair
201// ********************************************************************
202//
203inline
204void G4Region::RegisterMaterialCouplePair(G4Material* mat,
205 G4MaterialCutsCouple* couple)
206{
207 fMaterialCoupleMap.insert(G4MaterialCouplePair(mat,couple));
208}
209
210// ********************************************************************
211// FindCouple
212// ********************************************************************
213//
214inline
215G4MaterialCutsCouple* G4Region::FindCouple(G4Material* mat)
216{
217 auto c = fMaterialCoupleMap.find(mat);
218 G4MaterialCutsCouple* couple = nullptr;
219 if(c!=fMaterialCoupleMap.cend()) couple = (*c).second;
220 return couple;
221}
222
223// ********************************************************************
224// GetFieldManager
225// ********************************************************************
226//
227inline
228G4FieldManager* G4Region::GetFieldManager() const
229{
230 return fFieldManager;
231}
232
233// ********************************************************************
234// SetFieldManager
235// ********************************************************************
236//
237inline
238void G4Region::SetFieldManager(G4FieldManager* fm)
239{
240 fFieldManager = fm;
241}
242
243// ********************************************************************
244// GetWorldPhysical
245// ********************************************************************
246//
247inline
248G4VPhysicalVolume* G4Region::GetWorldPhysical() const
249{
250 return fWorldPhys;
251}
252
253// ********************************************************************
254// AddMaterial
255// ********************************************************************
256//
257inline
258void G4Region::AddMaterial(G4Material* aMaterial)
259{
260 auto pos = std::find(fMaterials.cbegin(),fMaterials.cend(),aMaterial);
261 if (pos == fMaterials.cend())
262 {
263 fMaterials.push_back(aMaterial);
264 fRegionMod = true;
265 }
266}
267
268// ********************************************************************
269// UsedInMassGeometry
270// ********************************************************************
271//
272inline
273void G4Region::UsedInMassGeometry(G4bool val)
274{
275 fInMassGeometry = val;
276}
277
278// ********************************************************************
279// UsedInParallelGeometry
280// ********************************************************************
281//
282inline
283void G4Region::UsedInParallelGeometry(G4bool val)
284{
285 fInParallelGeometry = val;
286}
287
288// ********************************************************************
289// IsInMassGeometry
290// ********************************************************************
291//
292inline
293G4bool G4Region::IsInMassGeometry() const
294{
295 return fInMassGeometry;
296}
297
298// ********************************************************************
299// IsInParallelGeometry
300// ********************************************************************
301//
302inline
303G4bool G4Region::IsInParallelGeometry() const
304{
305 return fInParallelGeometry;
306}