File indexing completed on 2025-01-18 09:58:55
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 inline G4double G4Physics2DVector::Value(G4double x, G4double y) const
0032 {
0033 std::size_t idx = 0;
0034 std::size_t idy = 0;
0035 return Value(x, y, idx, idy);
0036 }
0037
0038 inline void G4Physics2DVector::PutX(std::size_t idx, G4double val)
0039 {
0040 xVector[idx] = val;
0041 }
0042
0043 inline void G4Physics2DVector::PutY(std::size_t idy, G4double val)
0044 {
0045 yVector[idy] = val;
0046 }
0047
0048 inline void G4Physics2DVector::PutValue(std::size_t idx, std::size_t idy,
0049 G4double val)
0050 {
0051 (*(value[idy]))[idx] = val;
0052 }
0053
0054 inline G4double G4Physics2DVector::GetX(std::size_t index) const
0055 {
0056 return xVector[index];
0057 }
0058
0059 inline G4double G4Physics2DVector::GetY(std::size_t index) const
0060 {
0061 return yVector[index];
0062 }
0063
0064 inline G4double G4Physics2DVector::GetValue(std::size_t idx,
0065 std::size_t idy) const
0066 {
0067 return (*(value[idy]))[idx];
0068 }
0069
0070 inline G4double G4Physics2DVector::FindLinearX(G4double rand, G4double y) const
0071 {
0072 std::size_t idy = 0;
0073 return FindLinearX(rand, y, idy);
0074 }
0075
0076 inline std::size_t G4Physics2DVector::GetLengthX() const
0077 {
0078 return numberOfXNodes;
0079 }
0080
0081 inline std::size_t G4Physics2DVector::GetLengthY() const
0082 {
0083 return numberOfYNodes;
0084 }
0085
0086 inline G4PhysicsVectorType G4Physics2DVector::GetType() const { return type; }
0087
0088 inline void G4Physics2DVector::SetBicubicInterpolation(G4bool val)
0089 {
0090 useBicubic = val;
0091 }
0092
0093 inline std::size_t G4Physics2DVector::FindBin(const G4double z,
0094 const G4PV2DDataVector& v,
0095 const std::size_t idx,
0096 const std::size_t idxmax) const
0097 {
0098 std::size_t id = idx;
0099 if(z <= v[1])
0100 {
0101 id = 0;
0102 }
0103 else if(z >= v[idxmax])
0104 {
0105 id = idxmax;
0106 }
0107 else if(idx > idxmax || z < v[idx] || z > v[idx + 1])
0108 {
0109 id = std::lower_bound(v.begin(), v.end(), z) - v.begin() - 1;
0110 }
0111 return id;
0112 }
0113
0114 inline std::size_t G4Physics2DVector::FindBinLocationX(
0115 const G4double x, const std::size_t idx) const
0116 {
0117 return FindBin(x, xVector, idx, numberOfXNodes - 2);
0118 }
0119
0120 inline std::size_t G4Physics2DVector::FindBinLocationY(
0121 const G4double y, const std::size_t idy) const
0122 {
0123 return FindBin(y, yVector, idy, numberOfYNodes - 2);
0124 }
0125
0126 inline void G4Physics2DVector::SetVerboseLevel(G4int val)
0127 {
0128 verboseLevel = val;
0129 }
0130
0131 inline G4double G4Physics2DVector::DerivativeX(std::size_t idx, std::size_t idy,
0132 G4double fac) const
0133 {
0134 std::size_t i1 = idx;
0135 if(i1 > 0)
0136 {
0137 --i1;
0138 }
0139 std::size_t i2 = idx;
0140 if(i2 + 1 < numberOfXNodes)
0141 {
0142 ++i2;
0143 }
0144 return fac * (GetValue(i2, idy) - GetValue(i1, idy)) / (GetX(i2) - GetX(i1));
0145 }
0146
0147 inline G4double G4Physics2DVector::DerivativeY(std::size_t idx, std::size_t idy,
0148 G4double fac) const
0149 {
0150 std::size_t i1 = idy;
0151 if(i1 > 0)
0152 {
0153 --i1;
0154 }
0155 std::size_t i2 = idy;
0156 if(i2 + 1 < numberOfYNodes)
0157 {
0158 ++i2;
0159 }
0160 return fac * (GetValue(idx, i2) - GetValue(idx, i1)) / (GetY(i2) - GetY(i1));
0161 }
0162
0163 inline G4double G4Physics2DVector::DerivativeXY(std::size_t idx,
0164 std::size_t idy,
0165 G4double fac) const
0166 {
0167 std::size_t i1 = idx;
0168 if(i1 > 0)
0169 {
0170 --i1;
0171 }
0172 std::size_t i2 = idx;
0173 if(i2 + 1 < numberOfXNodes)
0174 {
0175 ++i2;
0176 }
0177 std::size_t j1 = idy;
0178 if(j1 > 0)
0179 {
0180 --j1;
0181 }
0182 std::size_t j2 = idy;
0183 if(j2 + 1 < numberOfYNodes)
0184 {
0185 ++j2;
0186 }
0187 return fac *
0188 (GetValue(i2, j2) - GetValue(i1, j2) - GetValue(i2, j1) +
0189 GetValue(i1, j1)) /
0190 ((GetX(i2) - GetX(i1)) * (GetY(j2) - GetY(j1)));
0191 }