03 March 2022 09:41:32 PM
PWL_INTERP_2D_SCATTERED_TEST:
C version
Test the PWL_INTERP_2D_SCATTERED library.
The R8LIB library is needed.
This test also needs the TEST_INTERP_2D library.
TEST01
R8TRIS2 computes the Delaunay triangulation of
a set of nodes in 2D.
TRIANGULATION_ORDER3_PRINT
Information defining a triangulation.
The number of nodes is 9
Node coordinates
Row: 0 1
Col
0: 0 0
1: 0 1
2: 0.2 0.5
3: 0.3 0.6
4: 0.4 0.5
5: 0.6 0.4
6: 0.6 0.5
7: 1 0
8: 1 1
The number of triangles is 12
Sets of three nodes are used as vertices of
the triangles. For each triangle, the nodes
are listed in counterclockwise order.
Triangle nodes
Row: 0 1 2
Col
0: 1 0 2
1: 2 0 4
2: 1 2 3
3: 3 2 4
4: 5 6 4
5: 4 0 5
6: 6 3 4
7: 8 3 6
8: 5 0 7
9: 6 5 7
10: 6 7 8
11: 1 3 8
On each side of a given triangle, there is either
another triangle, or a piece of the convex hull.
For each triangle, we list the indices of the three
neighbors, or (if negative) the codes of the
segments of the convex hull.
Triangle neighbors
Row: 0 1 2
Col
0: -28 2 3
1: 1 6 4
2: 1 4 12
3: 3 2 7
4: 10 7 6
5: 2 9 5
6: 8 4 5
7: 12 7 11
8: 6 -34 10
9: 5 9 11
10: 10 -38 8
11: 3 8 -3
The number of boundary points is 4
The segments that make up the convex hull can be
determined from the negative entries of the triangle
neighbor list.
# Tri Side N1 N2
1 9 2 0 7
2 11 2 7 8
3 12 3 8 1
4 1 1 1 0
TEST02
PWL_INTERP_2D_SCATTERED_VALUE evaluates a
piecewise linear interpolant to scattered data.
TRIANGULATION_ORDER3_PRINT
Information defining a triangulation.
The number of nodes is 9
Node coordinates
Row: 0 1
Col
0: 0 0
1: 0 1
2: 0.2 0.5
3: 0.3 0.6
4: 0.4 0.5
5: 0.6 0.4
6: 0.6 0.5
7: 1 0
8: 1 1
The number of triangles is 12
Sets of three nodes are used as vertices of
the triangles. For each triangle, the nodes
are listed in counterclockwise order.
Triangle nodes
Row: 0 1 2
Col
0: 1 0 2
1: 2 0 4
2: 1 2 3
3: 3 2 4
4: 5 6 4
5: 4 0 5
6: 6 3 4
7: 8 3 6
8: 5 0 7
9: 6 5 7
10: 6 7 8
11: 1 3 8
On each side of a given triangle, there is either
another triangle, or a piece of the convex hull.
For each triangle, we list the indices of the three
neighbors, or (if negative) the codes of the
segments of the convex hull.
Triangle neighbors
Row: 0 1 2
Col
0: -28 1 2
1: 0 5 3
2: 0 3 11
3: 2 1 6
4: 9 6 5
5: 1 8 4
6: 7 3 4
7: 11 6 10
8: 5 -34 9
9: 4 8 10
10: 9 -38 7
11: 2 7 -3
The number of boundary points is 4
The segments that make up the convex hull can be
determined from the negative entries of the triangle
neighbor list.
# Tri Side N1 N2
1 9 2 0 7
2 11 2 7 8
3 12 3 8 1
4 1 1 1 0
K Xi(K) Yi(K) Zi(K) Z(X,Y)
0 -0.2500 -0.2500 -0.7500 -0.7500
1 -0.2500 0.0000 -0.2500 -0.2500
2 -0.2500 0.2500 0.2500 0.2500
3 -0.2500 0.5000 0.7500 0.7500
4 -0.2500 0.7500 1.2500 1.2500
5 0.0000 -0.2500 -0.5000 -0.5000
6 0.0000 0.0000 0.0000 0.0000
7 0.0000 0.2500 0.5000 0.5000
8 0.0000 0.5000 1.0000 1.0000
9 0.0000 0.7500 1.5000 1.5000
10 0.2500 -0.2500 -0.2500 -0.2500
11 0.2500 0.0000 0.2500 0.2500
12 0.2500 0.2500 0.7500 0.7500
13 0.2500 0.5000 1.2500 1.2500
14 0.2500 0.7500 1.7500 1.7500
15 0.5000 -0.2500 -0.0000 0.0000
16 0.5000 0.0000 0.5000 0.5000
17 0.5000 0.2500 1.0000 1.0000
18 0.5000 0.5000 1.5000 1.5000
19 0.5000 0.7500 2.0000 2.0000
20 0.7500 -0.2500 0.2500 0.2500
21 0.7500 0.0000 0.7500 0.7500
22 0.7500 0.2500 1.2500 1.2500
23 0.7500 0.5000 1.7500 1.7500
24 0.7500 0.7500 2.2500 2.2500
TEST03
PWL_INTERP_2D_SCATTERED_VALUE evaluates a
piecewise linear interpolant to scattered data.
Here, we use grid number 2
with 33 scattered points in the unit square
on problem 1
RMS error is 0.0646687
K Xi(K) Yi(K) Zi(K) Z(X,Y)
0 0.1000 0.1000 0.9857 0.9857
1 0.1000 0.3000 0.8957 0.9716
2 0.1000 0.5000 0.5653 0.5182
3 0.1000 0.7000 0.3714 0.3412
4 0.1000 0.9000 0.2618 0.2805
5 0.3000 0.1000 0.9258 0.9610
6 0.3000 0.3000 0.9385 0.9836
7 0.3000 0.5000 0.6485 0.4690
8 0.3000 0.7000 0.3716 0.2576
9 0.3000 0.9000 0.1794 0.2174
10 0.5000 0.1000 0.5476 0.4855
11 0.5000 0.3000 0.6090 0.5210
12 0.5000 0.5000 0.4525 0.3258
13 0.5000 0.7000 0.2178 0.1080
14 0.5000 0.9000 0.1380 0.1166
15 0.7000 0.1000 0.3886 0.3614
16 0.7000 0.3000 0.5806 0.6136
17 0.7000 0.5000 0.4127 0.3994
18 0.7000 0.7000 0.1619 0.1503
19 0.7000 0.9000 0.1021 0.1021
20 0.9000 0.1000 0.2848 0.2372
21 0.9000 0.3000 0.4360 0.4569
22 0.9000 0.5000 0.2846 0.2904
23 0.9000 0.7000 0.1079 0.0910
24 0.9000 0.9000 0.0583 0.0563
TEST03
PWL_INTERP_2D_SCATTERED_VALUE evaluates a
piecewise linear interpolant to scattered data.
Here, we use grid number 2
with 33 scattered points in the unit square
on problem 2
RMS error is 0.02106
K Xi(K) Yi(K) Zi(K) Z(X,Y)
0 0.1000 0.10