File indexing completed on 2025-01-18 09:16:36
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036 inline
0037 G4String FastAerosol::GetName() const
0038 {
0039 return(fName);
0040 }
0041
0042 inline
0043 G4VSolid* FastAerosol::GetBulk() const
0044 {
0045 return(fCloud);
0046 }
0047
0048 inline
0049 G4double FastAerosol::GetRadius() const
0050 {
0051 return(fR);
0052 }
0053
0054 inline
0055 G4double FastAerosol::GetAvgNumDens() const
0056 {
0057 return(fAvgNumDens);
0058 }
0059
0060 inline
0061 G4int FastAerosol::GetNumDroplets() const
0062 {
0063 return((int)(fAvgNumDens*GetCubicVolume()));
0064 }
0065
0066
0067
0068 inline
0069 G4double FastAerosol::GetXHalfLength() const
0070 {
0071 return(fDx);
0072 }
0073
0074 inline
0075 G4double FastAerosol::GetYHalfLength() const
0076 {
0077 return(fDy);
0078 }
0079
0080 inline
0081 G4double FastAerosol::GetZHalfLength() const
0082 {
0083 return(fDz);
0084 }
0085
0086 inline
0087 void FastAerosol::GetBoundingLimits(G4ThreeVector &pMin, G4ThreeVector &pMax) const
0088 {
0089 pMin.setX(-fDx); pMax.setX(fDx);
0090 pMin.setY(-fDy); pMax.setY(fDy);
0091 pMin.setZ(-fDz); pMax.setZ(fDz);
0092 }
0093
0094 inline
0095 G4double FastAerosol::GetCubicVolume() const
0096 {
0097 return(fCloud->GetCubicVolume());
0098 }
0099
0100
0101
0102 inline
0103 G4double FastAerosol::DistanceToCloud(const G4ThreeVector &p) {
0104 if (fCloud->Inside(p)==kOutside)
0105 {
0106 return(fCloud->DistanceToIn(p));
0107 }
0108 else
0109 {
0110 return(0);
0111 }
0112 }
0113
0114
0115 inline
0116 G4double FastAerosol::DistanceToCloud(const G4ThreeVector &p, const G4ThreeVector &v) {
0117 if (fCloud->Inside(p)==kInside)
0118 {
0119 return(0);
0120 }
0121 else
0122 {
0123 return(fCloud->DistanceToIn(p,v));
0124 }
0125 }
0126
0127
0128
0129
0130 inline
0131 long FastAerosol::GetSeed() {
0132 return(fSeed);
0133 }
0134
0135 inline
0136 void FastAerosol::SetSeed(long seedIn) {
0137 fSeed = seedIn;
0138 }
0139
0140
0141
0142 inline
0143 G4int FastAerosol::GetPreSphereR() {
0144 return(fPreSphereR);
0145 }
0146
0147 inline
0148 void FastAerosol::SetPreSphereR(G4int preSphereRIn) {
0149 fPreSphereR = preSphereRIn;
0150 }
0151
0152
0153
0154 inline
0155 std::function<G4double (G4ThreeVector)> FastAerosol::GetDistribution() {
0156 return(fDistribution);
0157 }
0158
0159
0160
0161
0162 inline
0163 G4int FastAerosol::GetNumPlacementTries()
0164 {
0165 return(fNumNewPointTries);
0166 }
0167
0168 inline
0169 void FastAerosol::SetNumPlacementTries(G4int numTries)
0170 {
0171 fNumNewPointTries = numTries;
0172 }
0173
0174
0175 inline
0176 G4double FastAerosol::GetDropletsPerVoxel()
0177 {
0178 return(fDropletsPerVoxel);
0179 }
0180
0181 inline
0182 void FastAerosol::SetDropletsPerVoxel(G4double newDropletsPerVoxel)
0183 {
0184 if (newDropletsPerVoxel >= std::pow(4.0*std::sqrt(2),-1.0))
0185 {
0186 fDropletsPerVoxel = newDropletsPerVoxel;
0187 InitializeGrid();
0188 }
0189 else
0190 {
0191 std::ostringstream message;
0192 message << "Invalid droplets/voxel for cloud: " << GetName() << "!" << G4endl
0193 << " For grid pitch to be larger than radius (currently assumed),"
0194 << " droplets/voxel must be greater than or equal to 1/(4*sqrt(2))"
0195 << " newDropletsPerVoxel = " << newDropletsPerVoxel;
0196 G4Exception("FastAerosol::SetDropletsPerVoxel()", "GeomSolids0002",
0197 FatalErrorInArgument, message);
0198 }
0199 }
0200
0201
0202 inline
0203 void FastAerosol::PrintPopulationReport() {
0204 G4cout << "Total grids: " << fNumGridCells << G4endl;
0205 G4cout << "Droplets created: " << fNumDroplets << G4endl;
0206 G4cout << "Average Number density: " << fAvgNumDens << G4endl;
0207 G4cout << "Droplets expected: " << GetNumDroplets() << G4endl;
0208 }
0209
0210
0211
0212
0213
0214
0215
0216 inline
0217 bool FastAerosol::GetGrid(const G4ThreeVector &p, int &xGrid, int &yGrid, int &zGrid) {
0218 xGrid = (int)floorl((p.x() + fDx) / fGridPitch);
0219 yGrid = (int)floorl((p.y() + fDy) / fGridPitch);
0220 zGrid = (int)floorl((p.z() + fDz) / fGridPitch);
0221 return(!AnyIndexOutOfBounds(xGrid, yGrid, zGrid));
0222 }
0223
0224
0225 inline
0226 bool FastAerosol::AnyIndexOutOfBounds(G4int xGrid, G4int yGrid, G4int zGrid) {
0227 return ((xGrid < 0) || (xGrid >= fNx) ||
0228 (yGrid < 0) || (yGrid >= fNy) ||
0229 (zGrid < 0) || (zGrid >= fNz));
0230 }
0231
0232
0233 inline
0234 unsigned int FastAerosol::GetGridIndex(unsigned int xi, unsigned int yi, unsigned int zi) {
0235 return(zi*fNxy + yi*fNx + xi);
0236 }
0237
0238
0239 inline
0240 G4ThreeVector FastAerosol::GetIndexCoord(G4int index) {
0241 G4int x = index % fNx;
0242 G4int y = ( (index -x)/fNx ) % fNy;
0243 G4int z = (index -x -fNx*y )/(fNx*fNy);
0244 return(G4ThreeVector(x,y,z));
0245 }
0246
0247
0248 inline
0249 std::pair<G4int, G4int> FastAerosol::GetMinMaxSide(G4int i, G4int numGrids) {
0250 return(std::make_pair((i == 0) ? 0 : (i-1),
0251 (i == (numGrids-1)) ? i : (i+1)));
0252 }