43 surroundingPoints[1][0] += 1;
44 surroundingPoints[2][1] += 1;
45 surroundingPoints[3][0] += 1; surroundingPoints[3][1] += 1;
47 V resNeighbor[DataDim];
48 for (
unsigned i=0; i<DataDim; ++i) {
51 for (
auto point : surroundingPoints) {
54 f(cell.neighbor(point), resNeighbor);
55 for (
unsigned i = 0; i < DataDim; ++i) {
56 result[i] += weight * resNeighbor[i];
71 V resNeighbor[DataDim];
72 for (
unsigned i=0; i<DataDim; ++i) {
75 f(cell.neighbor(pointA), resNeighbor);
76 for (
unsigned i = 0; i < DataDim; ++i) {
77 result[i] += (1 - lc[0] - lc[1]) * resNeighbor[i];
79 f(cell.neighbor(pointB), resNeighbor);
80 for (
unsigned i = 0; i < DataDim; ++i) {
81 result[i] += lc[0] * resNeighbor[i];
83 f(cell.neighbor(pointC), resNeighbor);
84 for (
unsigned i = 0; i < DataDim; ++i) {
85 result[i] += lc[1] * resNeighbor[i];
95 const V alpha = ((distance - pointB) * (pointA - pointB)) / refDistanceSq;
96 V resNeighbor[DataDim];
97 for (
unsigned i=0; i<DataDim; ++i) {
100 f(cell.neighbor(pointA), resNeighbor);
101 for (
unsigned i = 0; i < DataDim; ++i) {
102 result[i] += alpha * resNeighbor[i];
104 f(cell.neighbor(pointB), resNeighbor);
105 for (
unsigned i = 0; i < DataDim; ++i) {
106 result[i] += (1 - alpha) * resNeighbor[i];
125 if constexpr (NEIGHBORS == 1111) {
129 else if constexpr (NEIGHBORS == 1110) {
133 interpolate2d_help<DataDim,CELL,RESULT,F,V>(cell, result, distance, f, pointA, pointB, pointC);
134 }
else if constexpr (NEIGHBORS == 1101) {
138 interpolate2d_help<DataDim,CELL,RESULT,F,V>(cell, result, distance, f, pointA, pointB, pointC);
139 }
else if constexpr (NEIGHBORS == 1011) {
143 interpolate2d_help<DataDim,CELL,RESULT,F,V>(cell, result, distance, f, pointA, pointB, pointC);
144 }
else if constexpr (NEIGHBORS == 111) {
148 interpolate2d_help<DataDim,CELL,RESULT,F,V>(cell, result, distance, f, pointA, pointB, pointC);
150 else if constexpr (NEIGHBORS == 1100) {
154 }
else if constexpr (NEIGHBORS == 11) {
158 }
else if constexpr (NEIGHBORS == 1010) {
162 }
else if constexpr (NEIGHBORS == 101) {
166 }
else if constexpr (NEIGHBORS == 1001) {
170 }
else if constexpr (NEIGHBORS == 110) {
176 else if constexpr (NEIGHBORS == 1) {
178 f(cell.neighbor(point), result);
179 }
else if constexpr (NEIGHBORS == 10) {
181 f(cell.neighbor(point), result);
182 }
else if constexpr (NEIGHBORS == 100) {
184 f(cell.neighbor(point), result);
185 }
else if constexpr (NEIGHBORS == 1000) {
187 f(cell.neighbor(point), result);
190 throw std::invalid_argument(
"Invalid NEIGHBORS");
void interpolate2d(CELL &cell, RESULT &result, const Vector< V, 2 > distance, F f) any_platform
Bilinear interpolation between four neighboring mesh points.
void interpolate2d_help(CELL &cell, RESULT &result, const Vector< V, 2 > distance, F f, Vector< int, 2 > pointA, Vector< int, 2 > pointB, Vector< int, 2 > pointC) any_platform
Linear interpolation between three points.