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.5 ] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

Diff markup

Differences between /examples/advanced/fastAerosol/include/FastAerosol.icc (Version 11.3.0) and /examples/advanced/fastAerosol/include/FastAerosol.icc (Version 9.6.p1)


  1 //                                                  1 
  2 // *******************************************    
  3 // * License and Disclaimer                       
  4 // *                                              
  5 // * The  Geant4 software  is  copyright of th    
  6 // * the Geant4 Collaboration.  It is provided    
  7 // * conditions of the Geant4 Software License    
  8 // * LICENSE and available at  http://cern.ch/    
  9 // * include a list of copyright holders.         
 10 // *                                              
 11 // * Neither the authors of this software syst    
 12 // * institutes,nor the agencies providing fin    
 13 // * work  make  any representation or  warran    
 14 // * regarding  this  software system or assum    
 15 // * use.  Please see the license in the file     
 16 // * for the full disclaimer and the limitatio    
 17 // *                                              
 18 // * This  code  implementation is the result     
 19 // * technical work of the GEANT4 collaboratio    
 20 // * By using,  copying,  modifying or  distri    
 21 // * any work based  on the software)  you  ag    
 22 // * use  in  resulting  scientific  publicati    
 23 // * acceptance of all terms of the Geant4 Sof    
 24 // *******************************************    
 25                                                   
 26 // -------------------------------------------    
 27 // GEANT 4 inline definitions file                
 28 //                                                
 29 // FastAerosol.icc                                
 30 //                                                
 31 // Implementation of inline methods of FastAer    
 32 //                                                
 33 // Author: A.Knaian (ara@nklabs.com), N.MacFad    
 34 // -------------------------------------------    
 35                                                   
 36 inline                                            
 37 G4String FastAerosol::GetName() const             
 38 {                                                 
 39   return(fName);                                  
 40 }                                                 
 41                                                   
 42 inline                                            
 43 G4VSolid* FastAerosol::GetBulk() const            
 44 {                                                 
 45   return(fCloud);                                 
 46 }                                                 
 47                                                   
 48 inline                                            
 49 G4double FastAerosol::GetRadius() const           
 50 {                                                 
 51   return(fR);                                     
 52 }                                                 
 53                                                   
 54 inline                                            
 55 G4double FastAerosol::GetAvgNumDens() const       
 56 {                                                 
 57   return(fAvgNumDens);                            
 58 }                                                 
 59                                                   
 60 inline                                            
 61 G4int FastAerosol::GetNumDroplets() const         
 62 {                                                 
 63   return((int)(fAvgNumDens*GetCubicVolume()));    
 64 }                                                 
 65                                                   
 66                                                   
 67                                                   
 68 inline                                            
 69 G4double FastAerosol::GetXHalfLength() const      
 70 {                                                 
 71   return(fDx);                                    
 72 }                                                 
 73                                                   
 74 inline                                            
 75 G4double FastAerosol::GetYHalfLength() const      
 76 {                                                 
 77   return(fDy);                                    
 78 }                                                 
 79                                                   
 80 inline                                            
 81 G4double FastAerosol::GetZHalfLength() const      
 82 {                                                 
 83   return(fDz);                                    
 84 }                                                 
 85                                                   
 86 inline                                            
 87 void FastAerosol::GetBoundingLimits(G4ThreeVec    
 88 {                                                 
 89   pMin.setX(-fDx); pMax.setX(fDx);                
 90   pMin.setY(-fDy); pMax.setY(fDy);                
 91   pMin.setZ(-fDz); pMax.setZ(fDz);                
 92 }                                                 
 93                                                   
 94 inline                                            
 95 G4double FastAerosol::GetCubicVolume() const      
 96 {                                                 
 97   return(fCloud->GetCubicVolume());               
 98 }                                                 
 99                                                   
100                                                   
101 // Find the absolute distance to the cloud bul    
102 inline                                            
103 G4double FastAerosol::DistanceToCloud(const G4    
104   if (fCloud->Inside(p)==kOutside)                
105   {                                               
106     return(fCloud->DistanceToIn(p));              
107   }                                               
108   else                                            
109   {                                               
110     return(0);                                    
111   }                                               
112 }                                                 
113                                                   
114 // Find the distance to the cloud bulk from p     
115 inline                                            
116 G4double FastAerosol::DistanceToCloud(const G4    
117   if (fCloud->Inside(p)==kInside)                 
118   {                                               
119     return(0);                                    
120   }                                               
121   else                                            
122   {                                               
123     return(fCloud->DistanceToIn(p,v));            
124   }                                               
125 }                                                 
126                                                   
127                                                   
128 // Get and set the base of the random seed use    
129 // For a given seed and a given geometry, the     
130 inline                                            
131 long FastAerosol::GetSeed() {                     
132   return(fSeed);                                  
133 }                                                 
134                                                   
135 inline                                            
136 void FastAerosol::SetSeed(long seedIn) {          
137   fSeed = seedIn;                                 
138 }                                                 
139                                                   
140                                                   
141 // Get and set the maximum radius of the voxel    
142 inline                                            
143 G4int FastAerosol::GetPreSphereR() {              
144   return(fPreSphereR);                            
145 }                                                 
146                                                   
147 inline                                            
148 void FastAerosol::SetPreSphereR(G4int preSpher    
149   fPreSphereR = preSphereRIn;                     
150 }                                                 
151                                                   
152                                                   
153 // Get the droplet distribution function          
154 inline                                            
155 std::function<G4double (G4ThreeVector)> FastAe    
156   return(fDistribution);                          
157 }                                                 
158                                                   
159                                                   
160 // Get and set the maximum number of droplet p    
161 // Skip placement if attempting to place a sin    
162 inline                                            
163 G4int FastAerosol::GetNumPlacementTries()         
164 {                                                 
165   return(fNumNewPointTries);                      
166 }                                                 
167                                                   
168 inline                                            
169 void FastAerosol::SetNumPlacementTries(G4int n    
170 {                                                 
171   fNumNewPointTries = numTries;                   
172 }                                                 
173                                                   
174 // Get and set the expected number of droplets    
175 inline                                            
176 G4double FastAerosol::GetDropletsPerVoxel()       
177 {                                                 
178   return(fDropletsPerVoxel);                      
179 }                                                 
180                                                   
181 inline                                            
182 void FastAerosol::SetDropletsPerVoxel(G4double    
183 {                                                 
184   if (newDropletsPerVoxel >= std::pow(4.0*std:    
185   {                                               
186     fDropletsPerVoxel = newDropletsPerVoxel;      
187     InitializeGrid();                             
188   }                                               
189   else                                            
190   {                                               
191     std::ostringstream message;                   
192     message << "Invalid droplets/voxel for clo    
193         << "    For grid pitch to be larger th    
194         << "    droplets/voxel must be greater    
195         << "        newDropletsPerVoxel = " <<    
196     G4Exception("FastAerosol::SetDropletsPerVo    
197           FatalErrorInArgument, message);         
198   }                                               
199 }                                                 
200                                                   
201                                                   
202 inline                                            
203 void FastAerosol::PrintPopulationReport() {       
204   G4cout << "Total grids: " << fNumGridCells <    
205   G4cout << "Droplets created: " << fNumDrople    
206   G4cout << "Average Number density: " << fAvg    
207   G4cout << "Droplets expected: " << GetNumDro    
208 }                                                 
209                                                   
210                                                   
211 // =======                                        
212 // Private                                        
213 // =======                                        
214 // Find the grid associated with a point.  Ret    
215 // false if it is out of bounds.                  
216 inline                                            
217 bool FastAerosol::GetGrid(const G4ThreeVector     
218   xGrid = (int)floorl((p.x() + fDx) / fGridPit    
219   yGrid = (int)floorl((p.y() + fDy) / fGridPit    
220   zGrid = (int)floorl((p.z() + fDz) / fGridPit    
221   return(!AnyIndexOutOfBounds(xGrid, yGrid, zG    
222 }                                                 
223                                                   
224 // Return true if any grid index given is out     
225 inline                                            
226 bool FastAerosol::AnyIndexOutOfBounds(G4int xG    
227   return ((xGrid < 0) || (xGrid >= fNx) ||        
228       (yGrid < 0) || (yGrid >= fNy) ||            
229       (zGrid < 0) || (zGrid >= fNz));             
230 }                                                 
231                                                   
232 // Create index for grid                          
233 inline                                            
234 unsigned int FastAerosol::GetGridIndex(unsigne    
235   return(zi*fNxy + yi*fNx + xi);                  
236 }                                                 
237                                                   
238 // Create get coordinates of index                
239 inline                                            
240 G4ThreeVector FastAerosol::GetIndexCoord(G4int    
241   G4int x = index % fNx;                          
242   G4int y = ( (index -x)/fNx ) % fNy;             
243   G4int z = (index -x -fNx*y )/(fNx*fNy);         
244   return(G4ThreeVector(x,y,z));                   
245 }                                                 
246                                                   
247 // find lower and upper grid boundary             
248 inline                                            
249 std::pair<G4int, G4int> FastAerosol::GetMinMax    
250   return(std::make_pair((i == 0) ? 0 : (i-1),     
251                (i == (numGrids-1)) ? i : (i+1)    
252 }