23 return y0 + ((x - x0) / (x1 - x0)) * (y1 - y0);
28 std::vector< double > &val_grid,
32 auto upper = std::upper_bound(init_grid.begin(), init_grid.end(), x);
34 static_cast< size_t >(std::distance(init_grid.begin(), upper));
44 if(position < init_grid.size())
48 val_grid[position - 1],
56 return val_grid[position - 1];
73 double x1x0, y1y0, x1x, y1y, yy0, xx0;
80 return 1.0 / (x1x0 * y1y0) *
81 (q_00 * x1x * y1y + q_10 * xx0 * y1y + q_01 * x1x * yy0 +
88 inline std::pair< double, double >
90 std::vector< std::vector< std::pair< double, double > > > &init_grid_AB,
95 int x_min = (int)std::floor(x);
96 int x_max = x_min + 1;
97 int y_min = (int)std::floor(y);
98 int y_max = y_min + 1;
101 if(x_min == x_max && y_min == y_max)
104 return std::make_pair(init_grid_AB[x_min + 128][y_min + 128].first,
105 init_grid_AB[x_min + 128][y_min + 128].second);
109 double a_interpolated =
111 init_grid_AB[x_max + 128][y_min + 128].first,
112 init_grid_AB[x_min + 128][y_max + 128].first,
113 init_grid_AB[x_max + 128][y_max + 128].first,
121 double b_interpolated =
123 init_grid_AB[x_max + 128][y_min + 128].second,
124 init_grid_AB[x_min + 128][y_max + 128].second,
125 init_grid_AB[x_max + 128][y_max + 128].second,
133 return std::make_pair(a_interpolated, b_interpolated);
138 std::vector< double > &grid_L,
139 std::vector< std::vector< std::pair< double, double > > >
145 init_grid_L.assign(size_L, 0);
146 grid_L.assign(size_L, 0);
148 int size_tabAB = 66049;
149 init_grid_AB.assign(size_col,
150 std::vector< std::pair< double, double > >(
151 size_row, std::make_pair(0.0, 0.0)));
155 for(
int cpt = 0; cpt < size_L; cpt++)
156 grid_L[cpt] =
L_data[cpt];
160 for(
size_t i = 0; i < init_grid_L.size(); i++)
162 init_grid_L[i] = i * 0.001;
166 for(
int cpt2 = 0; cpt2 < size_tabAB; cpt2++)
180 std::vector< double > &init_grid_L,
181 std::vector< double > &grid_L,
182 std::vector< std::vector< std::pair< double, double > > > &init_grid_AB)
186 lab2000hl[1] = me_a_b.first;
187 lab2000hl[2] = me_a_b.second;