38 const triangulationType *triangulation,
39 std::vector<std::tuple<int, double, double>> &surfaceValues,
40 std::array<const long, 2> &surfaceDim,
41 const xDataType *
const tableXValues,
42 const yDataType *
const tableYValues,
43 const size_t nTableValues,
44 std::vector<std::vector<double>> &inputPoints) {
45 unsigned int const noPoints = nTableValues;
46 inputPoints = std::vector<std::vector<double>>(
47 noPoints, std::vector<double>(3, 0.0));
53 std::vector<std::array<int, 4>> quadPoints(noPoints);
54 for(
unsigned int i = 0; i < noPoints; ++i) {
56 for(
unsigned int j = 0; j < surfaceDim[0]; ++j)
57 if(std::get<1>(surfaceValues[j * surfaceDim[1]]) < tableXValues[i])
59 for(
unsigned int j = 0; j < surfaceDim[1]; ++j)
60 if(std::get<2>(surfaceValues[j]) < tableYValues[i])
62 quadPoints[i][0] = i0 * surfaceDim[1] + i1 + 1;
63 quadPoints[i][1] = i0 * surfaceDim[1] + i1;
64 quadPoints[i][2] = (i0 + 1) * surfaceDim[1] + i1 + 1;
65 quadPoints[i][3] = (i0 + 1) * surfaceDim[1] + i1;
69 std::vector<std::array<double, 4>> coef(noPoints);
70 for(
unsigned int i = 0; i < noPoints; ++i) {
71 std::vector<std::array<double, 2>> points(4);
72 for(
unsigned int j = 0; j < 4; ++j) {
73 points[j][0] = std::get<1>(surfaceValues[quadPoints[i][j]]);
74 points[j][1] = std::get<2>(surfaceValues[quadPoints[i][j]]);
78 std::array<double, 3> tableValues{
static_cast<double>(tableXValues[i]),
79 static_cast<double>(tableYValues[i]),
81 std::array<std::array<double, 3>, 3> trianglePoints;
82 std::array<int, 3> indexes;
83 std::array<double, 2> mid{(points[3][0] - points[1][0]) / 2.0,
84 (points[0][1] - points[1][1]) / 2.0};
85 if(tableXValues[i] > points[1][0] + mid[0]) {
88 if(tableYValues[i] > points[1][1] + mid[1])
95 if(tableYValues[i] > points[1][1] + mid[1])
101 for(
unsigned int j = 0; j < 3; ++j) {
102 for(
unsigned int k = 0; k < 2; ++k)
103 trianglePoints[j][k] = points[indexes[j]][k];
104 trianglePoints[j][2] = 0;
108 tableValues.data(), trianglePoints[0].data(),
109 trianglePoints[1].data(), coef[i][indexes[2]]);
111 tableValues.data(), trianglePoints[0].data(),
112 trianglePoints[2].data(), coef[i][indexes[1]]);
114 tableValues.data(), trianglePoints[1].data(),
115 trianglePoints[2].data(), coef[i][indexes[0]]);
118 = coef[i][indexes[2]] + coef[i][indexes[1]] + coef[i][indexes[0]];
119 for(
unsigned int j = 0; j < 3; ++j)
120 coef[i][indexes[j]] /= sumArea;
123 for(
unsigned int k = 0; k < 4; ++k) {
124 float surfacePoint[3];
125 triangulation->getVertexPoint(
126 std::get<0>(surfaceValues[quadPoints[i][k]]), surfacePoint[0],
127 surfacePoint[1], surfacePoint[2]);
128 for(
unsigned int j = 0; j < 3; ++j)
129 inputPoints[i][j] += coef[i][k] * surfacePoint[j];