File indexing completed on 2025-01-18 09:57:52
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 #ifndef G4AdjointInterpolator_h
0035 #define G4AdjointInterpolator_h 1
0036
0037 #include "globals.hh"
0038
0039 #include <vector>
0040
0041 class G4AdjointInterpolator
0042 {
0043 public:
0044 static G4AdjointInterpolator* GetAdjointInterpolator();
0045 static G4AdjointInterpolator* GetInstance();
0046
0047 ~G4AdjointInterpolator();
0048
0049
0050
0051 G4double LinearInterpolation(G4double& x, G4double& x1, G4double& x2,
0052 G4double& y1, G4double& y2);
0053
0054 G4double LogarithmicInterpolation(G4double& x, G4double& x1, G4double& x2,
0055 G4double& y1, G4double& y2);
0056
0057 G4double ExponentialInterpolation(G4double& x, G4double& x1, G4double& x2,
0058 G4double& y1, G4double& y2);
0059
0060 G4double Interpolation(G4double& x, G4double& x1, G4double& x2, G4double& y1,
0061 G4double& y2, G4String InterPolMethod = "Log");
0062
0063 size_t FindPosition(G4double& x, std::vector<G4double>& x_vec,
0064 size_t ind_min = 0, size_t ind_max = 0);
0065
0066 size_t FindPositionForLogVector(G4double& x, std::vector<G4double>& x_vec);
0067
0068
0069 G4double Interpolate(G4double& x, std::vector<G4double>& x_vec,
0070 std::vector<G4double>& y_vec,
0071 G4String InterPolMethod = "Log");
0072
0073 G4double InterpolateWithIndexVector(
0074 G4double& x, std::vector<G4double>& x_vec, std::vector<G4double>& y_vec,
0075 std::vector<size_t>& index_vec, G4double x0,
0076 G4double dx);
0077
0078 G4double InterpolateForLogVector(G4double& x, std::vector<G4double>& x_vec,
0079 std::vector<G4double>& y_vec);
0080
0081 G4AdjointInterpolator(G4AdjointInterpolator&) = delete;
0082 G4AdjointInterpolator& operator=(const G4AdjointInterpolator& right) = delete;
0083
0084 private:
0085 G4AdjointInterpolator();
0086
0087 static G4ThreadLocal G4AdjointInterpolator* fInstance;
0088 };
0089 #endif