176 return originalMesh->prepareInterpolation(point, wrapped_point, index0_lo, index0_hi, index1_lo, index1_hi, flags);
197 ->
typename std::remove_reference<
decltype(data[0])>::type {
198 typedef typename std::remove_reference<
decltype(data[0])>::type DataT;
200 size_t index0, index0_hi, index1, index1_hi;
202 if (!prepareInterpolation(point, p, index0, index0_hi, index1, index1_hi, flags))
203 return NaN<
decltype(data[0])>();
205 Vec<2> pa = fullMesh.at(index0, index1);
207 size_t step0 = (p.c0 < pa.c0)?
208 (index0 == 0)? 0 : -1 :
209 (index0_hi == fullMesh.axis[0]->size())? 0 : 1;
210 size_t step1 = (p.c1 < pa.c1)?
211 (index1 == 0)? 0 : -1 :
212 (index1_hi == fullMesh.axis[1]->size())? 0 : 1;
214 size_t index_aa = index(index0, index1), index_ab, index_ba, index_bb;
216 typename std::remove_const<DataT>::type data_aa = data[index_aa], data_ab, data_ba, data_bb;
218 if (step0 == 0 && step1 == 0) {
219 index_ab = index_ba = index_bb = index_aa;
220 data_ab = data_ba = data_bb = data_aa;
222 index_ab = index(index0, index1+step1);
223 index_ba = index(index0+step0, index1);
224 index_bb = index(index0+step0, index1+step1);
225 data_ab = (index_ab != Element::UNKNOWN_ELEMENT_INDEX)? data[index_ab] : data_aa;
226 data_ba = (index_ba != Element::UNKNOWN_ELEMENT_INDEX)? data[index_ba] : data_aa;
227 data_bb = (index_bb != Element::UNKNOWN_ELEMENT_INDEX)? data[index_bb] : data_ab + data_ba - data_aa;
230 Vec<2> pb = fullMesh.at(index0+step0, index1+step1);
231 if (step0 == 0) pb.c0 += 1.;
232 if (step1 == 0) pb.c1 += 1.;
234 return flags.postprocess(point,
235 interpolation::bilinear(pa.c0, pb.c0, pa.c1, pb.c1,
236 data_aa, data_ba, data_bb, data_ab, p.c0, p.c1));
247 ->
typename std::remove_reference<
decltype(data[0])>::type {
249 std::size_t index0_lo, index0_hi, index1_lo, index1_hi;
251 if (!originalMesh->prepareInterpolation(point, wrapped_point, index0_lo, index0_hi, index1_lo, index1_hi, flags))
252 return NaN<
decltype(data[0])>();
254 return flags.postprocess(point, data[this->index(index0_lo, index1_lo)]);