diff --git a/.gitignore b/.gitignore index d32855e..9b2e602 100644 --- a/.gitignore +++ b/.gitignore @@ -22,5 +22,13 @@ venv/ .DS_Store Thumbs.db +# C++ build artifacts +*.o +*.obj +*.exe +*.dll +*.so +*.dylib + # Other files controlpts.txt \ No newline at end of file diff --git a/lab3/Lab3 grids/cylinder-A.grid2D b/lab3/Lab3 grids/cylinder-A.grid2D new file mode 100644 index 0000000..32c3284 --- /dev/null +++ b/lab3/Lab3 grids/cylinder-A.grid2D @@ -0,0 +1,15 @@ +GRID2D_OF_POINTS3D +# Dimensions +6 2 +0 0.8 0 +8 0.8 0 +0 0 0 +8 0 0 +0 0 2 +8 0 2 +0 2 2 +8 2 2 +0 2 0 +8 2 0 +0 1.2 0 +8 1.2 0 diff --git a/lab3/Lab3 grids/sphere-A.grid2D b/lab3/Lab3 grids/sphere-A.grid2D new file mode 100644 index 0000000..9366eb0 --- /dev/null +++ b/lab3/Lab3 grids/sphere-A.grid2D @@ -0,0 +1,30 @@ +GRID2D_OF_POINTS3D +# Dimensions +4 6 +0 6.2 4 +0 8 4 +0 8 8 +0 4 8 +0 4 4 +0 5.8 4 +2 6.2 0 +2 12 0 +2 12 12 +2 0 12 +2 0 0 +2 5.8 0 +6 6.2 0 +6 12 0 +6 12 12 +6 0 12 +6 0 0 +6 5.8 0 +8 6.2 4 +8 8 4 +8 8 8 +8 4 8 +8 4 4 +8 5.8 4 + + + diff --git a/lab3/Lab3 grids/sphere-A.off b/lab3/Lab3 grids/sphere-A.off new file mode 100644 index 0000000..2c54e09 --- /dev/null +++ b/lab3/Lab3 grids/sphere-A.off @@ -0,0 +1,43 @@ +OFF +# File created from 2D grid of points. +24 15 0 +0.0 6.2 4.0 +0.0 8.0 4.0 +0.0 8.0 8.0 +0.0 4.0 8.0 +0.0 4.0 4.0 +0.0 5.8 4.0 +2.0 6.2 0.0 +2.0 12.0 0.0 +2.0 12.0 12.0 +2.0 0.0 12.0 +2.0 0.0 0.0 +2.0 5.8 0.0 +6.0 6.2 0.0 +6.0 12.0 0.0 +6.0 12.0 12.0 +6.0 0.0 12.0 +6.0 0.0 0.0 +6.0 5.8 0.0 +8.0 6.2 4.0 +8.0 8.0 4.0 +8.0 8.0 8.0 +8.0 4.0 8.0 +8.0 4.0 4.0 +8.0 5.8 4.0 + +4 0 1 7 6 +4 1 2 8 7 +4 2 3 9 8 +4 3 4 10 9 +4 4 5 11 10 +4 6 7 13 12 +4 7 8 14 13 +4 8 9 15 14 +4 9 10 16 15 +4 10 11 17 16 +4 12 13 19 18 +4 13 14 20 19 +4 14 15 21 20 +4 15 16 22 21 +4 16 17 23 22 diff --git a/lab3/Lab3 grids/torus-A.grid2D b/lab3/Lab3 grids/torus-A.grid2D new file mode 100644 index 0000000..b08398b --- /dev/null +++ b/lab3/Lab3 grids/torus-A.grid2D @@ -0,0 +1,38 @@ +GRID2D_OF_POINTS3D +6 6 +4.8 10.2 3.0 +3.0 10.2 3.0 +3.0 10.2 7.0 +7.0 10.2 7.0 +7.0 10.2 3.0 +5.2 10.2 3.0 +4.8 15.2 3.0 +3.0 17.0 3.0 +3.0 17.0 7.0 +7.0 13.0 7.0 +7.0 13.0 3.0 +5.2 14.8 3.0 +15.2 15.2 3.0 +17.0 17.0 3.0 +17.0 17.0 7.0 +13.0 13.0 7.0 +13.0 13.0 3.0 +14.8 14.8 3.0 +15.2 4.8 3.0 +17.0 3.0 3.0 +17.0 3.0 7.0 +13.0 7.0 7.0 +13.0 7.0 3.0 +14.8 5.2 3.0 +4.8 4.8 3.0 +3.0 3.0 3.0 +3.0 3.0 7.0 +7.0 7.0 7.0 +7.0 7.0 3.0 +5.2 5.2 3.0 +4.8 9.8 3.0 +3.0 9.8 3.0 +3.0 9.8 7.0 +7.0 9.8 7.0 +7.0 9.8 3.0 +5.2 9.8 3.0 diff --git a/lab3/Lab3 grids/torus-A.off b/lab3/Lab3 grids/torus-A.off new file mode 100644 index 0000000..1ddfa49 --- /dev/null +++ b/lab3/Lab3 grids/torus-A.off @@ -0,0 +1,65 @@ +OFF +# File created from 2D grid of points. +36 25 0 +4.8 10.2 3.0 +3.0 10.2 3.0 +3.0 10.2 7.0 +7.0 10.2 7.0 +7.0 10.2 3.0 +5.2 10.2 3.0 +4.8 15.2 3.0 +3.0 17.0 3.0 +3.0 17.0 7.0 +7.0 13.0 7.0 +7.0 13.0 3.0 +5.2 14.8 3.0 +15.2 15.2 3.0 +17.0 17.0 3.0 +17.0 17.0 7.0 +13.0 13.0 7.0 +13.0 13.0 3.0 +14.8 14.8 3.0 +15.2 4.8 3.0 +17.0 3.0 3.0 +17.0 3.0 7.0 +13.0 7.0 7.0 +13.0 7.0 3.0 +14.8 5.2 3.0 +4.8 4.8 3.0 +3.0 3.0 3.0 +3.0 3.0 7.0 +7.0 7.0 7.0 +7.0 7.0 3.0 +5.2 5.2 3.0 +4.8 9.8 3.0 +3.0 9.8 3.0 +3.0 9.8 7.0 +7.0 9.8 7.0 +7.0 9.8 3.0 +5.2 9.8 3.0 + +4 0 1 7 6 +4 1 2 8 7 +4 2 3 9 8 +4 3 4 10 9 +4 4 5 11 10 +4 6 7 13 12 +4 7 8 14 13 +4 8 9 15 14 +4 9 10 16 15 +4 10 11 17 16 +4 12 13 19 18 +4 13 14 20 19 +4 14 15 21 20 +4 15 16 22 21 +4 16 17 23 22 +4 18 19 25 24 +4 19 20 26 25 +4 20 21 27 26 +4 21 22 28 27 +4 22 23 29 28 +4 24 25 31 30 +4 25 26 32 31 +4 26 27 33 32 +4 27 28 34 33 +4 28 29 35 34 diff --git a/lab3/Lab3 grids/wave-A.off b/lab3/Lab3 grids/wave-A.off new file mode 100644 index 0000000..6b3d148 --- /dev/null +++ b/lab3/Lab3 grids/wave-A.off @@ -0,0 +1,57 @@ +OFF +# File created from 2D grid of points. +32 21 0 +0.0 0.0 0.0 +1.0 2.0 0.0 +2.0 2.0 0.0 +3.0 0.0 0.0 +4.0 0.0 0.0 +5.0 2.0 0.0 +6.0 2.0 0.0 +7.0 0.0 0.0 +0.0 0.0 1.0 +1.0 2.0 1.0 +2.0 2.0 1.0 +3.0 0.0 1.0 +4.0 0.0 1.0 +5.0 2.0 1.0 +6.0 2.0 1.0 +7.0 0.0 1.0 +0.0 0.0 2.0 +1.0 0.0 2.0 +2.0 0.0 2.0 +3.0 2.0 2.0 +4.0 2.0 2.0 +5.0 0.0 2.0 +6.0 0.0 2.0 +7.0 0.0 3.0 +0.0 0.0 3.0 +1.0 0.0 3.0 +2.0 0.0 3.0 +3.0 2.0 3.0 +4.0 2.0 3.0 +5.0 0.0 3.0 +6.0 0.0 3.0 +7.0 0.0 3.0 + +4 0 1 9 8 +4 1 2 10 9 +4 2 3 11 10 +4 3 4 12 11 +4 4 5 13 12 +4 5 6 14 13 +4 6 7 15 14 +4 8 9 17 16 +4 9 10 18 17 +4 10 11 19 18 +4 11 12 20 19 +4 12 13 21 20 +4 13 14 22 21 +4 14 15 23 22 +4 16 17 25 24 +4 17 18 26 25 +4 18 19 27 26 +4 19 20 28 27 +4 20 21 29 28 +4 21 22 30 29 +4 22 23 31 30 diff --git a/lab3/Lab3 simple grids/grid2D-2x3-A-subdiv-1.grid2D b/lab3/Lab3 simple grids/grid2D-2x3-A-subdiv-1.grid2D new file mode 100644 index 0000000..491c706 --- /dev/null +++ b/lab3/Lab3 simple grids/grid2D-2x3-A-subdiv-1.grid2D @@ -0,0 +1,17 @@ +GRID2D_OF_POINTS3D +3 5 +0.0 2.0 0.0 +0.5 1.5 0.0 +1.0 1.125 0.0 +1.5 1.0 0.0 +2.0 1.0 0.0 +0.0 1.5 0.5 +0.5 1.0 0.5 +1.0 0.625 0.5 +1.5 0.5 0.5 +2.0 0.5 0.5 +0.0 1.0 1.0 +0.5 0.5 1.0 +1.0 0.125 1.0 +1.5 0.0 1.0 +2.0 0.0 1.0 diff --git a/lab3/Lab3 simple grids/grid2D-2x3-A-subdiv-1.off b/lab3/Lab3 simple grids/grid2D-2x3-A-subdiv-1.off new file mode 100644 index 0000000..775a228 --- /dev/null +++ b/lab3/Lab3 simple grids/grid2D-2x3-A-subdiv-1.off @@ -0,0 +1,58 @@ +OFF +# G +# r +# i +# d +# +# s +# u +# b +# d +# i +# v +# i +# d +# e +# d +# +# i +# n +# +# 1 +# +# i +# t +# e +# r +# a +# t +# i +# o +# n +# s +# . +15 8 0 +0.0 2.0 0.0 +0.5 1.5 0.0 +1.0 1.125 0.0 +1.5 1.0 0.0 +2.0 1.0 0.0 +0.0 1.5 0.5 +0.5 1.0 0.5 +1.0 0.625 0.5 +1.5 0.5 0.5 +2.0 0.5 0.5 +0.0 1.0 1.0 +0.5 0.5 1.0 +1.0 0.125 1.0 +1.5 0.0 1.0 +2.0 0.0 1.0 + +4 0 1 6 5 +4 1 2 7 6 +4 2 3 8 7 +4 3 4 9 8 +4 5 6 11 10 +4 6 7 12 11 +4 7 8 13 12 +4 8 9 14 13 diff --git a/lab3/Lab3 simple grids/grid2D-2x3-A-subdiv-2.grid2D b/lab3/Lab3 simple grids/grid2D-2x3-A-subdiv-2.grid2D new file mode 100644 index 0000000..88cc6e7 --- /dev/null +++ b/lab3/Lab3 simple grids/grid2D-2x3-A-subdiv-2.grid2D @@ -0,0 +1,47 @@ +GRID2D_OF_POINTS3D +5 9 +0.0 2.0 0.0 +0.25 1.75 0.0 +0.5 1.515625 0.0 +0.75 1.3125 0.0 +1.0 1.15625 0.0 +1.25 1.0625 0.0 +1.5 1.015625 0.0 +1.75 1.0 0.0 +2.0 1.0 0.0 +0.0 1.75 0.25 +0.25 1.5 0.25 +0.5 1.265625 0.25 +0.75 1.0625 0.25 +1.0 0.90625 0.25 +1.25 0.8125 0.25 +1.5 0.765625 0.25 +1.75 0.75 0.25 +2.0 0.75 0.25 +0.0 1.5 0.5 +0.25 1.25 0.5 +0.5 1.015625 0.5 +0.75 0.8125 0.5 +1.0 0.65625 0.5 +1.25 0.5625 0.5 +1.5 0.515625 0.5 +1.75 0.5 0.5 +2.0 0.5 0.5 +0.0 1.25 0.75 +0.25 1.0 0.75 +0.5 0.765625 0.75 +0.75 0.5625 0.75 +1.0 0.40625 0.75 +1.25 0.3125 0.75 +1.5 0.265625 0.75 +1.75 0.25 0.75 +2.0 0.25 0.75 +0.0 1.0 1.0 +0.25 0.75 1.0 +0.5 0.515625 1.0 +0.75 0.3125 1.0 +1.0 0.15625 1.0 +1.25 0.0625 1.0 +1.5 0.015625 1.0 +1.75 0.0 1.0 +2.0 0.0 1.0 diff --git a/lab3/Lab3 simple grids/grid2D-2x3-A-subdiv-2.off b/lab3/Lab3 simple grids/grid2D-2x3-A-subdiv-2.off new file mode 100644 index 0000000..a68a10b --- /dev/null +++ b/lab3/Lab3 simple grids/grid2D-2x3-A-subdiv-2.off @@ -0,0 +1,112 @@ +OFF +# G +# r +# i +# d +# +# s +# u +# b +# d +# i +# v +# i +# d +# e +# d +# +# i +# n +# +# 2 +# +# i +# t +# e +# r +# a +# t +# i +# o +# n +# s +# . +45 32 0 +0.0 2.0 0.0 +0.25 1.75 0.0 +0.5 1.515625 0.0 +0.75 1.3125 0.0 +1.0 1.15625 0.0 +1.25 1.0625 0.0 +1.5 1.015625 0.0 +1.75 1.0 0.0 +2.0 1.0 0.0 +0.0 1.75 0.25 +0.25 1.5 0.25 +0.5 1.265625 0.25 +0.75 1.0625 0.25 +1.0 0.90625 0.25 +1.25 0.8125 0.25 +1.5 0.765625 0.25 +1.75 0.75 0.25 +2.0 0.75 0.25 +0.0 1.5 0.5 +0.25 1.25 0.5 +0.5 1.015625 0.5 +0.75 0.8125 0.5 +1.0 0.65625 0.5 +1.25 0.5625 0.5 +1.5 0.515625 0.5 +1.75 0.5 0.5 +2.0 0.5 0.5 +0.0 1.25 0.75 +0.25 1.0 0.75 +0.5 0.765625 0.75 +0.75 0.5625 0.75 +1.0 0.40625 0.75 +1.25 0.3125 0.75 +1.5 0.265625 0.75 +1.75 0.25 0.75 +2.0 0.25 0.75 +0.0 1.0 1.0 +0.25 0.75 1.0 +0.5 0.515625 1.0 +0.75 0.3125 1.0 +1.0 0.15625 1.0 +1.25 0.0625 1.0 +1.5 0.015625 1.0 +1.75 0.0 1.0 +2.0 0.0 1.0 + +4 0 1 10 9 +4 1 2 11 10 +4 2 3 12 11 +4 3 4 13 12 +4 4 5 14 13 +4 5 6 15 14 +4 6 7 16 15 +4 7 8 17 16 +4 9 10 19 18 +4 10 11 20 19 +4 11 12 21 20 +4 12 13 22 21 +4 13 14 23 22 +4 14 15 24 23 +4 15 16 25 24 +4 16 17 26 25 +4 18 19 28 27 +4 19 20 29 28 +4 20 21 30 29 +4 21 22 31 30 +4 22 23 32 31 +4 23 24 33 32 +4 24 25 34 33 +4 25 26 35 34 +4 27 28 37 36 +4 28 29 38 37 +4 29 30 39 38 +4 30 31 40 39 +4 31 32 41 40 +4 32 33 42 41 +4 33 34 43 42 +4 34 35 44 43 diff --git a/lab3/Lab3 simple grids/grid2D-2x3-A-subdiv-3.grid2D b/lab3/Lab3 simple grids/grid2D-2x3-A-subdiv-3.grid2D new file mode 100644 index 0000000..fc204f1 --- /dev/null +++ b/lab3/Lab3 simple grids/grid2D-2x3-A-subdiv-3.grid2D @@ -0,0 +1,155 @@ +GRID2D_OF_POINTS3D +9 17 +0.0 2.0 0.0 +0.125 1.875 0.0 +0.25 1.751953125 0.0 +0.375 1.6328125 0.0 +0.5 1.51953125 0.0 +0.625 1.4140625 0.0 +0.75 1.318359375 0.0 +0.875 1.234375 0.0 +1.0 1.1640625 0.0 +1.125 1.109375 0.0 +1.25 1.068359375 0.0 +1.375 1.0390625 0.0 +1.5 1.01953125 0.0 +1.625 1.0078125 0.0 +1.75 1.001953125 0.0 +1.875 1.0 0.0 +2.0 1.0 0.0 +0.0 1.875 0.125 +0.125 1.75 0.125 +0.25 1.626953125 0.125 +0.375 1.5078125 0.125 +0.5 1.39453125 0.125 +0.625 1.2890625 0.125 +0.75 1.193359375 0.125 +0.875 1.109375 0.125 +1.0 1.0390625 0.125 +1.125 0.984375 0.125 +1.25 0.943359375 0.125 +1.375 0.9140625 0.125 +1.5 0.89453125 0.125 +1.625 0.8828125 0.125 +1.75 0.876953125 0.125 +1.875 0.875 0.125 +2.0 0.875 0.125 +0.0 1.75 0.25 +0.125 1.625 0.25 +0.25 1.501953125 0.25 +0.375 1.3828125 0.25 +0.5 1.26953125 0.25 +0.625 1.1640625 0.25 +0.75 1.068359375 0.25 +0.875 0.984375 0.25 +1.0 0.9140625 0.25 +1.125 0.859375 0.25 +1.25 0.818359375 0.25 +1.375 0.7890625 0.25 +1.5 0.76953125 0.25 +1.625 0.7578125 0.25 +1.75 0.751953125 0.25 +1.875 0.75 0.25 +2.0 0.75 0.25 +0.0 1.625 0.375 +0.125 1.5 0.375 +0.25 1.376953125 0.375 +0.375 1.2578125 0.375 +0.5 1.14453125 0.375 +0.625 1.0390625 0.375 +0.75 0.943359375 0.375 +0.875 0.859375 0.375 +1.0 0.7890625 0.375 +1.125 0.734375 0.375 +1.25 0.693359375 0.375 +1.375 0.6640625 0.375 +1.5 0.64453125 0.375 +1.625 0.6328125 0.375 +1.75 0.626953125 0.375 +1.875 0.625 0.375 +2.0 0.625 0.375 +0.0 1.5 0.5 +0.125 1.375 0.5 +0.25 1.251953125 0.5 +0.375 1.1328125 0.5 +0.5 1.01953125 0.5 +0.625 0.9140625 0.5 +0.75 0.818359375 0.5 +0.875 0.734375 0.5 +1.0 0.6640625 0.5 +1.125 0.609375 0.5 +1.25 0.568359375 0.5 +1.375 0.5390625 0.5 +1.5 0.51953125 0.5 +1.625 0.5078125 0.5 +1.75 0.501953125 0.5 +1.875 0.5 0.5 +2.0 0.5 0.5 +0.0 1.375 0.625 +0.125 1.25 0.625 +0.25 1.126953125 0.625 +0.375 1.0078125 0.625 +0.5 0.89453125 0.625 +0.625 0.7890625 0.625 +0.75 0.693359375 0.625 +0.875 0.609375 0.625 +1.0 0.5390625 0.625 +1.125 0.484375 0.625 +1.25 0.443359375 0.625 +1.375 0.4140625 0.625 +1.5 0.39453125 0.625 +1.625 0.3828125 0.625 +1.75 0.376953125 0.625 +1.875 0.375 0.625 +2.0 0.375 0.625 +0.0 1.25 0.75 +0.125 1.125 0.75 +0.25 1.001953125 0.75 +0.375 0.8828125 0.75 +0.5 0.76953125 0.75 +0.625 0.6640625 0.75 +0.75 0.568359375 0.75 +0.875 0.484375 0.75 +1.0 0.4140625 0.75 +1.125 0.359375 0.75 +1.25 0.318359375 0.75 +1.375 0.2890625 0.75 +1.5 0.26953125 0.75 +1.625 0.2578125 0.75 +1.75 0.251953125 0.75 +1.875 0.25 0.75 +2.0 0.25 0.75 +0.0 1.125 0.875 +0.125 1.0 0.875 +0.25 0.876953125 0.875 +0.375 0.7578125 0.875 +0.5 0.64453125 0.875 +0.625 0.5390625 0.875 +0.75 0.443359375 0.875 +0.875 0.359375 0.875 +1.0 0.2890625 0.875 +1.125 0.234375 0.875 +1.25 0.193359375 0.875 +1.375 0.1640625 0.875 +1.5 0.14453125 0.875 +1.625 0.1328125 0.875 +1.75 0.126953125 0.875 +1.875 0.125 0.875 +2.0 0.125 0.875 +0.0 1.0 1.0 +0.125 0.875 1.0 +0.25 0.751953125 1.0 +0.375 0.6328125 1.0 +0.5 0.51953125 1.0 +0.625 0.4140625 1.0 +0.75 0.318359375 1.0 +0.875 0.234375 1.0 +1.0 0.1640625 1.0 +1.125 0.109375 1.0 +1.25 0.068359375 1.0 +1.375 0.0390625 1.0 +1.5 0.01953125 1.0 +1.625 0.0078125 1.0 +1.75 0.001953125 1.0 +1.875 0.0 1.0 +2.0 0.0 1.0 diff --git a/lab3/Lab3 simple grids/grid2D-2x3-A-subdiv-3.off b/lab3/Lab3 simple grids/grid2D-2x3-A-subdiv-3.off new file mode 100644 index 0000000..c910115 --- /dev/null +++ b/lab3/Lab3 simple grids/grid2D-2x3-A-subdiv-3.off @@ -0,0 +1,316 @@ +OFF +# G +# r +# i +# d +# +# s +# u +# b +# d +# i +# v +# i +# d +# e +# d +# +# i +# n +# +# 3 +# +# i +# t +# e +# r +# a +# t +# i +# o +# n +# s +# . +153 128 0 +0.0 2.0 0.0 +0.125 1.875 0.0 +0.25 1.751953125 0.0 +0.375 1.6328125 0.0 +0.5 1.51953125 0.0 +0.625 1.4140625 0.0 +0.75 1.318359375 0.0 +0.875 1.234375 0.0 +1.0 1.1640625 0.0 +1.125 1.109375 0.0 +1.25 1.068359375 0.0 +1.375 1.0390625 0.0 +1.5 1.01953125 0.0 +1.625 1.0078125 0.0 +1.75 1.001953125 0.0 +1.875 1.0 0.0 +2.0 1.0 0.0 +0.0 1.875 0.125 +0.125 1.75 0.125 +0.25 1.626953125 0.125 +0.375 1.5078125 0.125 +0.5 1.39453125 0.125 +0.625 1.2890625 0.125 +0.75 1.193359375 0.125 +0.875 1.109375 0.125 +1.0 1.0390625 0.125 +1.125 0.984375 0.125 +1.25 0.943359375 0.125 +1.375 0.9140625 0.125 +1.5 0.89453125 0.125 +1.625 0.8828125 0.125 +1.75 0.876953125 0.125 +1.875 0.875 0.125 +2.0 0.875 0.125 +0.0 1.75 0.25 +0.125 1.625 0.25 +0.25 1.501953125 0.25 +0.375 1.3828125 0.25 +0.5 1.26953125 0.25 +0.625 1.1640625 0.25 +0.75 1.068359375 0.25 +0.875 0.984375 0.25 +1.0 0.9140625 0.25 +1.125 0.859375 0.25 +1.25 0.818359375 0.25 +1.375 0.7890625 0.25 +1.5 0.76953125 0.25 +1.625 0.7578125 0.25 +1.75 0.751953125 0.25 +1.875 0.75 0.25 +2.0 0.75 0.25 +0.0 1.625 0.375 +0.125 1.5 0.375 +0.25 1.376953125 0.375 +0.375 1.2578125 0.375 +0.5 1.14453125 0.375 +0.625 1.0390625 0.375 +0.75 0.943359375 0.375 +0.875 0.859375 0.375 +1.0 0.7890625 0.375 +1.125 0.734375 0.375 +1.25 0.693359375 0.375 +1.375 0.6640625 0.375 +1.5 0.64453125 0.375 +1.625 0.6328125 0.375 +1.75 0.626953125 0.375 +1.875 0.625 0.375 +2.0 0.625 0.375 +0.0 1.5 0.5 +0.125 1.375 0.5 +0.25 1.251953125 0.5 +0.375 1.1328125 0.5 +0.5 1.01953125 0.5 +0.625 0.9140625 0.5 +0.75 0.818359375 0.5 +0.875 0.734375 0.5 +1.0 0.6640625 0.5 +1.125 0.609375 0.5 +1.25 0.568359375 0.5 +1.375 0.5390625 0.5 +1.5 0.51953125 0.5 +1.625 0.5078125 0.5 +1.75 0.501953125 0.5 +1.875 0.5 0.5 +2.0 0.5 0.5 +0.0 1.375 0.625 +0.125 1.25 0.625 +0.25 1.126953125 0.625 +0.375 1.0078125 0.625 +0.5 0.89453125 0.625 +0.625 0.7890625 0.625 +0.75 0.693359375 0.625 +0.875 0.609375 0.625 +1.0 0.5390625 0.625 +1.125 0.484375 0.625 +1.25 0.443359375 0.625 +1.375 0.4140625 0.625 +1.5 0.39453125 0.625 +1.625 0.3828125 0.625 +1.75 0.376953125 0.625 +1.875 0.375 0.625 +2.0 0.375 0.625 +0.0 1.25 0.75 +0.125 1.125 0.75 +0.25 1.001953125 0.75 +0.375 0.8828125 0.75 +0.5 0.76953125 0.75 +0.625 0.6640625 0.75 +0.75 0.568359375 0.75 +0.875 0.484375 0.75 +1.0 0.4140625 0.75 +1.125 0.359375 0.75 +1.25 0.318359375 0.75 +1.375 0.2890625 0.75 +1.5 0.26953125 0.75 +1.625 0.2578125 0.75 +1.75 0.251953125 0.75 +1.875 0.25 0.75 +2.0 0.25 0.75 +0.0 1.125 0.875 +0.125 1.0 0.875 +0.25 0.876953125 0.875 +0.375 0.7578125 0.875 +0.5 0.64453125 0.875 +0.625 0.5390625 0.875 +0.75 0.443359375 0.875 +0.875 0.359375 0.875 +1.0 0.2890625 0.875 +1.125 0.234375 0.875 +1.25 0.193359375 0.875 +1.375 0.1640625 0.875 +1.5 0.14453125 0.875 +1.625 0.1328125 0.875 +1.75 0.126953125 0.875 +1.875 0.125 0.875 +2.0 0.125 0.875 +0.0 1.0 1.0 +0.125 0.875 1.0 +0.25 0.751953125 1.0 +0.375 0.6328125 1.0 +0.5 0.51953125 1.0 +0.625 0.4140625 1.0 +0.75 0.318359375 1.0 +0.875 0.234375 1.0 +1.0 0.1640625 1.0 +1.125 0.109375 1.0 +1.25 0.068359375 1.0 +1.375 0.0390625 1.0 +1.5 0.01953125 1.0 +1.625 0.0078125 1.0 +1.75 0.001953125 1.0 +1.875 0.0 1.0 +2.0 0.0 1.0 + +4 0 1 18 17 +4 1 2 19 18 +4 2 3 20 19 +4 3 4 21 20 +4 4 5 22 21 +4 5 6 23 22 +4 6 7 24 23 +4 7 8 25 24 +4 8 9 26 25 +4 9 10 27 26 +4 10 11 28 27 +4 11 12 29 28 +4 12 13 30 29 +4 13 14 31 30 +4 14 15 32 31 +4 15 16 33 32 +4 17 18 35 34 +4 18 19 36 35 +4 19 20 37 36 +4 20 21 38 37 +4 21 22 39 38 +4 22 23 40 39 +4 23 24 41 40 +4 24 25 42 41 +4 25 26 43 42 +4 26 27 44 43 +4 27 28 45 44 +4 28 29 46 45 +4 29 30 47 46 +4 30 31 48 47 +4 31 32 49 48 +4 32 33 50 49 +4 34 35 52 51 +4 35 36 53 52 +4 36 37 54 53 +4 37 38 55 54 +4 38 39 56 55 +4 39 40 57 56 +4 40 41 58 57 +4 41 42 59 58 +4 42 43 60 59 +4 43 44 61 60 +4 44 45 62 61 +4 45 46 63 62 +4 46 47 64 63 +4 47 48 65 64 +4 48 49 66 65 +4 49 50 67 66 +4 51 52 69 68 +4 52 53 70 69 +4 53 54 71 70 +4 54 55 72 71 +4 55 56 73 72 +4 56 57 74 73 +4 57 58 75 74 +4 58 59 76 75 +4 59 60 77 76 +4 60 61 78 77 +4 61 62 79 78 +4 62 63 80 79 +4 63 64 81 80 +4 64 65 82 81 +4 65 66 83 82 +4 66 67 84 83 +4 68 69 86 85 +4 69 70 87 86 +4 70 71 88 87 +4 71 72 89 88 +4 72 73 90 89 +4 73 74 91 90 +4 74 75 92 91 +4 75 76 93 92 +4 76 77 94 93 +4 77 78 95 94 +4 78 79 96 95 +4 79 80 97 96 +4 80 81 98 97 +4 81 82 99 98 +4 82 83 100 99 +4 83 84 101 100 +4 85 86 103 102 +4 86 87 104 103 +4 87 88 105 104 +4 88 89 106 105 +4 89 90 107 106 +4 90 91 108 107 +4 91 92 109 108 +4 92 93 110 109 +4 93 94 111 110 +4 94 95 112 111 +4 95 96 113 112 +4 96 97 114 113 +4 97 98 115 114 +4 98 99 116 115 +4 99 100 117 116 +4 100 101 118 117 +4 102 103 120 119 +4 103 104 121 120 +4 104 105 122 121 +4 105 106 123 122 +4 106 107 124 123 +4 107 108 125 124 +4 108 109 126 125 +4 109 110 127 126 +4 110 111 128 127 +4 111 112 129 128 +4 112 113 130 129 +4 113 114 131 130 +4 114 115 132 131 +4 115 116 133 132 +4 116 117 134 133 +4 117 118 135 134 +4 119 120 137 136 +4 120 121 138 137 +4 121 122 139 138 +4 122 123 140 139 +4 123 124 141 140 +4 124 125 142 141 +4 125 126 143 142 +4 126 127 144 143 +4 127 128 145 144 +4 128 129 146 145 +4 129 130 147 146 +4 130 131 148 147 +4 131 132 149 148 +4 132 133 150 149 +4 133 134 151 150 +4 134 135 152 151 diff --git a/lab3/Lab3 simple grids/grid2D-2x3-A.grid2D b/lab3/Lab3 simple grids/grid2D-2x3-A.grid2D new file mode 100644 index 0000000..4499f7c --- /dev/null +++ b/lab3/Lab3 simple grids/grid2D-2x3-A.grid2D @@ -0,0 +1,9 @@ +GRID2D_OF_POINTS3D +# Dimensions +2 3 +0 2 0 +1 1 0 +2 1 0 +0 1 1 +1 0 1 +2 0 1 diff --git a/lab3/Lab3 simple grids/grid2D-2x3-A.off b/lab3/Lab3 simple grids/grid2D-2x3-A.off new file mode 100644 index 0000000..b18bf75 --- /dev/null +++ b/lab3/Lab3 simple grids/grid2D-2x3-A.off @@ -0,0 +1,12 @@ +OFF +# File created from 2D grid of points. +6 2 0 +0.0 2.0 0.0 +1.0 1.0 0.0 +2.0 1.0 0.0 +0.0 1.0 1.0 +1.0 0.0 1.0 +2.0 0.0 1.0 + +4 0 1 4 3 +4 1 2 5 4 diff --git a/lab3/Lab3 simple grids/grid2D-3x2-A-subdiv-1.grid2D b/lab3/Lab3 simple grids/grid2D-3x2-A-subdiv-1.grid2D new file mode 100644 index 0000000..f6442cb --- /dev/null +++ b/lab3/Lab3 simple grids/grid2D-3x2-A-subdiv-1.grid2D @@ -0,0 +1,17 @@ +GRID2D_OF_POINTS3D +5 3 +0.0 2.0 0.0 +0.5 2.0 0.0 +1.0 2.0 0.0 +0.0 1.0 0.5 +0.5 1.0 0.5 +1.0 1.0 0.5 +0.0 0.25 1.0 +0.5 0.25 1.0 +1.0 0.25 1.0 +0.0 0.0 1.5 +0.5 0.0 1.5 +1.0 0.0 1.5 +0.0 0.0 2.0 +0.5 0.0 2.0 +1.0 0.0 2.0 diff --git a/lab3/Lab3 simple grids/grid2D-3x2-A-subdiv-1.off b/lab3/Lab3 simple grids/grid2D-3x2-A-subdiv-1.off new file mode 100644 index 0000000..5ebc250 --- /dev/null +++ b/lab3/Lab3 simple grids/grid2D-3x2-A-subdiv-1.off @@ -0,0 +1,58 @@ +OFF +# G +# r +# i +# d +# +# s +# u +# b +# d +# i +# v +# i +# d +# e +# d +# +# i +# n +# +# 1 +# +# i +# t +# e +# r +# a +# t +# i +# o +# n +# s +# . +15 8 0 +0.0 2.0 0.0 +0.5 2.0 0.0 +1.0 2.0 0.0 +0.0 1.0 0.5 +0.5 1.0 0.5 +1.0 1.0 0.5 +0.0 0.25 1.0 +0.5 0.25 1.0 +1.0 0.25 1.0 +0.0 0.0 1.5 +0.5 0.0 1.5 +1.0 0.0 1.5 +0.0 0.0 2.0 +0.5 0.0 2.0 +1.0 0.0 2.0 + +4 0 1 4 3 +4 1 2 5 4 +4 3 4 7 6 +4 4 5 8 7 +4 6 7 10 9 +4 7 8 11 10 +4 9 10 13 12 +4 10 11 14 13 diff --git a/lab3/Lab3 simple grids/grid2D-3x2-A-subdiv-2.grid2D b/lab3/Lab3 simple grids/grid2D-3x2-A-subdiv-2.grid2D new file mode 100644 index 0000000..839b8b9 --- /dev/null +++ b/lab3/Lab3 simple grids/grid2D-3x2-A-subdiv-2.grid2D @@ -0,0 +1,47 @@ +GRID2D_OF_POINTS3D +9 5 +0.0 2.0 0.0 +0.25 2.0 0.0 +0.5 2.0 0.0 +0.75 2.0 0.0 +1.0 2.0 0.0 +0.0 1.5 0.25 +0.25 1.5 0.25 +0.5 1.5 0.25 +0.75 1.5 0.25 +1.0 1.5 0.25 +0.0 1.03125 0.5 +0.25 1.03125 0.5 +0.5 1.03125 0.5 +0.75 1.03125 0.5 +1.0 1.03125 0.5 +0.0 0.625 0.75 +0.25 0.625 0.75 +0.5 0.625 0.75 +0.75 0.625 0.75 +1.0 0.625 0.75 +0.0 0.3125 1.0 +0.25 0.3125 1.0 +0.5 0.3125 1.0 +0.75 0.3125 1.0 +1.0 0.3125 1.0 +0.0 0.125 1.25 +0.25 0.125 1.25 +0.5 0.125 1.25 +0.75 0.125 1.25 +1.0 0.125 1.25 +0.0 0.03125 1.5 +0.25 0.03125 1.5 +0.5 0.03125 1.5 +0.75 0.03125 1.5 +1.0 0.03125 1.5 +0.0 0.0 1.75 +0.25 0.0 1.75 +0.5 0.0 1.75 +0.75 0.0 1.75 +1.0 0.0 1.75 +0.0 0.0 2.0 +0.25 0.0 2.0 +0.5 0.0 2.0 +0.75 0.0 2.0 +1.0 0.0 2.0 diff --git a/lab3/Lab3 simple grids/grid2D-3x2-A-subdiv-2.off b/lab3/Lab3 simple grids/grid2D-3x2-A-subdiv-2.off new file mode 100644 index 0000000..7613379 --- /dev/null +++ b/lab3/Lab3 simple grids/grid2D-3x2-A-subdiv-2.off @@ -0,0 +1,112 @@ +OFF +# G +# r +# i +# d +# +# s +# u +# b +# d +# i +# v +# i +# d +# e +# d +# +# i +# n +# +# 2 +# +# i +# t +# e +# r +# a +# t +# i +# o +# n +# s +# . +45 32 0 +0.0 2.0 0.0 +0.25 2.0 0.0 +0.5 2.0 0.0 +0.75 2.0 0.0 +1.0 2.0 0.0 +0.0 1.5 0.25 +0.25 1.5 0.25 +0.5 1.5 0.25 +0.75 1.5 0.25 +1.0 1.5 0.25 +0.0 1.03125 0.5 +0.25 1.03125 0.5 +0.5 1.03125 0.5 +0.75 1.03125 0.5 +1.0 1.03125 0.5 +0.0 0.625 0.75 +0.25 0.625 0.75 +0.5 0.625 0.75 +0.75 0.625 0.75 +1.0 0.625 0.75 +0.0 0.3125 1.0 +0.25 0.3125 1.0 +0.5 0.3125 1.0 +0.75 0.3125 1.0 +1.0 0.3125 1.0 +0.0 0.125 1.25 +0.25 0.125 1.25 +0.5 0.125 1.25 +0.75 0.125 1.25 +1.0 0.125 1.25 +0.0 0.03125 1.5 +0.25 0.03125 1.5 +0.5 0.03125 1.5 +0.75 0.03125 1.5 +1.0 0.03125 1.5 +0.0 0.0 1.75 +0.25 0.0 1.75 +0.5 0.0 1.75 +0.75 0.0 1.75 +1.0 0.0 1.75 +0.0 0.0 2.0 +0.25 0.0 2.0 +0.5 0.0 2.0 +0.75 0.0 2.0 +1.0 0.0 2.0 + +4 0 1 6 5 +4 1 2 7 6 +4 2 3 8 7 +4 3 4 9 8 +4 5 6 11 10 +4 6 7 12 11 +4 7 8 13 12 +4 8 9 14 13 +4 10 11 16 15 +4 11 12 17 16 +4 12 13 18 17 +4 13 14 19 18 +4 15 16 21 20 +4 16 17 22 21 +4 17 18 23 22 +4 18 19 24 23 +4 20 21 26 25 +4 21 22 27 26 +4 22 23 28 27 +4 23 24 29 28 +4 25 26 31 30 +4 26 27 32 31 +4 27 28 33 32 +4 28 29 34 33 +4 30 31 36 35 +4 31 32 37 36 +4 32 33 38 37 +4 33 34 39 38 +4 35 36 41 40 +4 36 37 42 41 +4 37 38 43 42 +4 38 39 44 43 diff --git a/lab3/Lab3 simple grids/grid2D-3x2-A-subdiv-3.grid2D b/lab3/Lab3 simple grids/grid2D-3x2-A-subdiv-3.grid2D new file mode 100644 index 0000000..d8683ab --- /dev/null +++ b/lab3/Lab3 simple grids/grid2D-3x2-A-subdiv-3.grid2D @@ -0,0 +1,155 @@ +GRID2D_OF_POINTS3D +17 9 +0.0 2.0 0.0 +0.125 2.0 0.0 +0.25 2.0 0.0 +0.375 2.0 0.0 +0.5 2.0 0.0 +0.625 2.0 0.0 +0.75 2.0 0.0 +0.875 2.0 0.0 +1.0 2.0 0.0 +0.0 1.75 0.125 +0.125 1.75 0.125 +0.25 1.75 0.125 +0.375 1.75 0.125 +0.5 1.75 0.125 +0.625 1.75 0.125 +0.75 1.75 0.125 +0.875 1.75 0.125 +1.0 1.75 0.125 +0.0 1.50390625 0.25 +0.125 1.50390625 0.25 +0.25 1.50390625 0.25 +0.375 1.50390625 0.25 +0.5 1.50390625 0.25 +0.625 1.50390625 0.25 +0.75 1.50390625 0.25 +0.875 1.50390625 0.25 +1.0 1.50390625 0.25 +0.0 1.265625 0.375 +0.125 1.265625 0.375 +0.25 1.265625 0.375 +0.375 1.265625 0.375 +0.5 1.265625 0.375 +0.625 1.265625 0.375 +0.75 1.265625 0.375 +0.875 1.265625 0.375 +1.0 1.265625 0.375 +0.0 1.0390625 0.5 +0.125 1.0390625 0.5 +0.25 1.0390625 0.5 +0.375 1.0390625 0.5 +0.5 1.0390625 0.5 +0.625 1.0390625 0.5 +0.75 1.0390625 0.5 +0.875 1.0390625 0.5 +1.0 1.0390625 0.5 +0.0 0.828125 0.625 +0.125 0.828125 0.625 +0.25 0.828125 0.625 +0.375 0.828125 0.625 +0.5 0.828125 0.625 +0.625 0.828125 0.625 +0.75 0.828125 0.625 +0.875 0.828125 0.625 +1.0 0.828125 0.625 +0.0 0.63671875 0.75 +0.125 0.63671875 0.75 +0.25 0.63671875 0.75 +0.375 0.63671875 0.75 +0.5 0.63671875 0.75 +0.625 0.63671875 0.75 +0.75 0.63671875 0.75 +0.875 0.63671875 0.75 +1.0 0.63671875 0.75 +0.0 0.46875 0.875 +0.125 0.46875 0.875 +0.25 0.46875 0.875 +0.375 0.46875 0.875 +0.5 0.46875 0.875 +0.625 0.46875 0.875 +0.75 0.46875 0.875 +0.875 0.46875 0.875 +1.0 0.46875 0.875 +0.0 0.328125 1.0 +0.125 0.328125 1.0 +0.25 0.328125 1.0 +0.375 0.328125 1.0 +0.5 0.328125 1.0 +0.625 0.328125 1.0 +0.75 0.328125 1.0 +0.875 0.328125 1.0 +1.0 0.328125 1.0 +0.0 0.21875 1.125 +0.125 0.21875 1.125 +0.25 0.21875 1.125 +0.375 0.21875 1.125 +0.5 0.21875 1.125 +0.625 0.21875 1.125 +0.75 0.21875 1.125 +0.875 0.21875 1.125 +1.0 0.21875 1.125 +0.0 0.13671875 1.25 +0.125 0.13671875 1.25 +0.25 0.13671875 1.25 +0.375 0.13671875 1.25 +0.5 0.13671875 1.25 +0.625 0.13671875 1.25 +0.75 0.13671875 1.25 +0.875 0.13671875 1.25 +1.0 0.13671875 1.25 +0.0 0.078125 1.375 +0.125 0.078125 1.375 +0.25 0.078125 1.375 +0.375 0.078125 1.375 +0.5 0.078125 1.375 +0.625 0.078125 1.375 +0.75 0.078125 1.375 +0.875 0.078125 1.375 +1.0 0.078125 1.375 +0.0 0.0390625 1.5 +0.125 0.0390625 1.5 +0.25 0.0390625 1.5 +0.375 0.0390625 1.5 +0.5 0.0390625 1.5 +0.625 0.0390625 1.5 +0.75 0.0390625 1.5 +0.875 0.0390625 1.5 +1.0 0.0390625 1.5 +0.0 0.015625 1.625 +0.125 0.015625 1.625 +0.25 0.015625 1.625 +0.375 0.015625 1.625 +0.5 0.015625 1.625 +0.625 0.015625 1.625 +0.75 0.015625 1.625 +0.875 0.015625 1.625 +1.0 0.015625 1.625 +0.0 0.00390625 1.75 +0.125 0.00390625 1.75 +0.25 0.00390625 1.75 +0.375 0.00390625 1.75 +0.5 0.00390625 1.75 +0.625 0.00390625 1.75 +0.75 0.00390625 1.75 +0.875 0.00390625 1.75 +1.0 0.00390625 1.75 +0.0 0.0 1.875 +0.125 0.0 1.875 +0.25 0.0 1.875 +0.375 0.0 1.875 +0.5 0.0 1.875 +0.625 0.0 1.875 +0.75 0.0 1.875 +0.875 0.0 1.875 +1.0 0.0 1.875 +0.0 0.0 2.0 +0.125 0.0 2.0 +0.25 0.0 2.0 +0.375 0.0 2.0 +0.5 0.0 2.0 +0.625 0.0 2.0 +0.75 0.0 2.0 +0.875 0.0 2.0 +1.0 0.0 2.0 diff --git a/lab3/Lab3 simple grids/grid2D-3x2-A-subdiv-3.off b/lab3/Lab3 simple grids/grid2D-3x2-A-subdiv-3.off new file mode 100644 index 0000000..eb200df --- /dev/null +++ b/lab3/Lab3 simple grids/grid2D-3x2-A-subdiv-3.off @@ -0,0 +1,316 @@ +OFF +# G +# r +# i +# d +# +# s +# u +# b +# d +# i +# v +# i +# d +# e +# d +# +# i +# n +# +# 3 +# +# i +# t +# e +# r +# a +# t +# i +# o +# n +# s +# . +153 128 0 +0.0 2.0 0.0 +0.125 2.0 0.0 +0.25 2.0 0.0 +0.375 2.0 0.0 +0.5 2.0 0.0 +0.625 2.0 0.0 +0.75 2.0 0.0 +0.875 2.0 0.0 +1.0 2.0 0.0 +0.0 1.75 0.125 +0.125 1.75 0.125 +0.25 1.75 0.125 +0.375 1.75 0.125 +0.5 1.75 0.125 +0.625 1.75 0.125 +0.75 1.75 0.125 +0.875 1.75 0.125 +1.0 1.75 0.125 +0.0 1.50390625 0.25 +0.125 1.50390625 0.25 +0.25 1.50390625 0.25 +0.375 1.50390625 0.25 +0.5 1.50390625 0.25 +0.625 1.50390625 0.25 +0.75 1.50390625 0.25 +0.875 1.50390625 0.25 +1.0 1.50390625 0.25 +0.0 1.265625 0.375 +0.125 1.265625 0.375 +0.25 1.265625 0.375 +0.375 1.265625 0.375 +0.5 1.265625 0.375 +0.625 1.265625 0.375 +0.75 1.265625 0.375 +0.875 1.265625 0.375 +1.0 1.265625 0.375 +0.0 1.0390625 0.5 +0.125 1.0390625 0.5 +0.25 1.0390625 0.5 +0.375 1.0390625 0.5 +0.5 1.0390625 0.5 +0.625 1.0390625 0.5 +0.75 1.0390625 0.5 +0.875 1.0390625 0.5 +1.0 1.0390625 0.5 +0.0 0.828125 0.625 +0.125 0.828125 0.625 +0.25 0.828125 0.625 +0.375 0.828125 0.625 +0.5 0.828125 0.625 +0.625 0.828125 0.625 +0.75 0.828125 0.625 +0.875 0.828125 0.625 +1.0 0.828125 0.625 +0.0 0.63671875 0.75 +0.125 0.63671875 0.75 +0.25 0.63671875 0.75 +0.375 0.63671875 0.75 +0.5 0.63671875 0.75 +0.625 0.63671875 0.75 +0.75 0.63671875 0.75 +0.875 0.63671875 0.75 +1.0 0.63671875 0.75 +0.0 0.46875 0.875 +0.125 0.46875 0.875 +0.25 0.46875 0.875 +0.375 0.46875 0.875 +0.5 0.46875 0.875 +0.625 0.46875 0.875 +0.75 0.46875 0.875 +0.875 0.46875 0.875 +1.0 0.46875 0.875 +0.0 0.328125 1.0 +0.125 0.328125 1.0 +0.25 0.328125 1.0 +0.375 0.328125 1.0 +0.5 0.328125 1.0 +0.625 0.328125 1.0 +0.75 0.328125 1.0 +0.875 0.328125 1.0 +1.0 0.328125 1.0 +0.0 0.21875 1.125 +0.125 0.21875 1.125 +0.25 0.21875 1.125 +0.375 0.21875 1.125 +0.5 0.21875 1.125 +0.625 0.21875 1.125 +0.75 0.21875 1.125 +0.875 0.21875 1.125 +1.0 0.21875 1.125 +0.0 0.13671875 1.25 +0.125 0.13671875 1.25 +0.25 0.13671875 1.25 +0.375 0.13671875 1.25 +0.5 0.13671875 1.25 +0.625 0.13671875 1.25 +0.75 0.13671875 1.25 +0.875 0.13671875 1.25 +1.0 0.13671875 1.25 +0.0 0.078125 1.375 +0.125 0.078125 1.375 +0.25 0.078125 1.375 +0.375 0.078125 1.375 +0.5 0.078125 1.375 +0.625 0.078125 1.375 +0.75 0.078125 1.375 +0.875 0.078125 1.375 +1.0 0.078125 1.375 +0.0 0.0390625 1.5 +0.125 0.0390625 1.5 +0.25 0.0390625 1.5 +0.375 0.0390625 1.5 +0.5 0.0390625 1.5 +0.625 0.0390625 1.5 +0.75 0.0390625 1.5 +0.875 0.0390625 1.5 +1.0 0.0390625 1.5 +0.0 0.015625 1.625 +0.125 0.015625 1.625 +0.25 0.015625 1.625 +0.375 0.015625 1.625 +0.5 0.015625 1.625 +0.625 0.015625 1.625 +0.75 0.015625 1.625 +0.875 0.015625 1.625 +1.0 0.015625 1.625 +0.0 0.00390625 1.75 +0.125 0.00390625 1.75 +0.25 0.00390625 1.75 +0.375 0.00390625 1.75 +0.5 0.00390625 1.75 +0.625 0.00390625 1.75 +0.75 0.00390625 1.75 +0.875 0.00390625 1.75 +1.0 0.00390625 1.75 +0.0 0.0 1.875 +0.125 0.0 1.875 +0.25 0.0 1.875 +0.375 0.0 1.875 +0.5 0.0 1.875 +0.625 0.0 1.875 +0.75 0.0 1.875 +0.875 0.0 1.875 +1.0 0.0 1.875 +0.0 0.0 2.0 +0.125 0.0 2.0 +0.25 0.0 2.0 +0.375 0.0 2.0 +0.5 0.0 2.0 +0.625 0.0 2.0 +0.75 0.0 2.0 +0.875 0.0 2.0 +1.0 0.0 2.0 + +4 0 1 10 9 +4 1 2 11 10 +4 2 3 12 11 +4 3 4 13 12 +4 4 5 14 13 +4 5 6 15 14 +4 6 7 16 15 +4 7 8 17 16 +4 9 10 19 18 +4 10 11 20 19 +4 11 12 21 20 +4 12 13 22 21 +4 13 14 23 22 +4 14 15 24 23 +4 15 16 25 24 +4 16 17 26 25 +4 18 19 28 27 +4 19 20 29 28 +4 20 21 30 29 +4 21 22 31 30 +4 22 23 32 31 +4 23 24 33 32 +4 24 25 34 33 +4 25 26 35 34 +4 27 28 37 36 +4 28 29 38 37 +4 29 30 39 38 +4 30 31 40 39 +4 31 32 41 40 +4 32 33 42 41 +4 33 34 43 42 +4 34 35 44 43 +4 36 37 46 45 +4 37 38 47 46 +4 38 39 48 47 +4 39 40 49 48 +4 40 41 50 49 +4 41 42 51 50 +4 42 43 52 51 +4 43 44 53 52 +4 45 46 55 54 +4 46 47 56 55 +4 47 48 57 56 +4 48 49 58 57 +4 49 50 59 58 +4 50 51 60 59 +4 51 52 61 60 +4 52 53 62 61 +4 54 55 64 63 +4 55 56 65 64 +4 56 57 66 65 +4 57 58 67 66 +4 58 59 68 67 +4 59 60 69 68 +4 60 61 70 69 +4 61 62 71 70 +4 63 64 73 72 +4 64 65 74 73 +4 65 66 75 74 +4 66 67 76 75 +4 67 68 77 76 +4 68 69 78 77 +4 69 70 79 78 +4 70 71 80 79 +4 72 73 82 81 +4 73 74 83 82 +4 74 75 84 83 +4 75 76 85 84 +4 76 77 86 85 +4 77 78 87 86 +4 78 79 88 87 +4 79 80 89 88 +4 81 82 91 90 +4 82 83 92 91 +4 83 84 93 92 +4 84 85 94 93 +4 85 86 95 94 +4 86 87 96 95 +4 87 88 97 96 +4 88 89 98 97 +4 90 91 100 99 +4 91 92 101 100 +4 92 93 102 101 +4 93 94 103 102 +4 94 95 104 103 +4 95 96 105 104 +4 96 97 106 105 +4 97 98 107 106 +4 99 100 109 108 +4 100 101 110 109 +4 101 102 111 110 +4 102 103 112 111 +4 103 104 113 112 +4 104 105 114 113 +4 105 106 115 114 +4 106 107 116 115 +4 108 109 118 117 +4 109 110 119 118 +4 110 111 120 119 +4 111 112 121 120 +4 112 113 122 121 +4 113 114 123 122 +4 114 115 124 123 +4 115 116 125 124 +4 117 118 127 126 +4 118 119 128 127 +4 119 120 129 128 +4 120 121 130 129 +4 121 122 131 130 +4 122 123 132 131 +4 123 124 133 132 +4 124 125 134 133 +4 126 127 136 135 +4 127 128 137 136 +4 128 129 138 137 +4 129 130 139 138 +4 130 131 140 139 +4 131 132 141 140 +4 132 133 142 141 +4 133 134 143 142 +4 135 136 145 144 +4 136 137 146 145 +4 137 138 147 146 +4 138 139 148 147 +4 139 140 149 148 +4 140 141 150 149 +4 141 142 151 150 +4 142 143 152 151 diff --git a/lab3/Lab3 simple grids/grid2D-3x2-A.grid2D b/lab3/Lab3 simple grids/grid2D-3x2-A.grid2D new file mode 100644 index 0000000..3c2a0b2 --- /dev/null +++ b/lab3/Lab3 simple grids/grid2D-3x2-A.grid2D @@ -0,0 +1,10 @@ +GRID2D_OF_POINTS3D +# Dimensions +3 2 +0 2 0 +1 2 0 +0 0 1 +1 0 1 +0 0 2 +1 0 2 + diff --git a/lab3/Lab3 simple grids/grid2D-3x2-A.off b/lab3/Lab3 simple grids/grid2D-3x2-A.off new file mode 100644 index 0000000..efac005 --- /dev/null +++ b/lab3/Lab3 simple grids/grid2D-3x2-A.off @@ -0,0 +1,12 @@ +OFF +# File created from 2D grid of points. +6 2 0 +0.0 2.0 0.0 +1.0 2.0 0.0 +0.0 0.0 1.0 +1.0 0.0 1.0 +0.0 0.0 2.0 +1.0 0.0 2.0 + +4 0 1 3 2 +4 2 3 5 4 diff --git a/lab3/Lab3 simple grids/grid2D-3x3-A-subdiv-1.grid2D b/lab3/Lab3 simple grids/grid2D-3x3-A-subdiv-1.grid2D new file mode 100644 index 0000000..ecb4dea --- /dev/null +++ b/lab3/Lab3 simple grids/grid2D-3x3-A-subdiv-1.grid2D @@ -0,0 +1,27 @@ +GRID2D_OF_POINTS3D +5 5 +0.0 3.0 0.0 +0.5 2.5 0.0 +1.0 2.25 0.0 +1.5 2.5 0.0 +2.0 3.0 0.0 +0.0 2.0 0.5 +0.5 1.5 0.5 +1.0 1.25 0.5 +1.5 1.5 0.5 +2.0 2.0 0.5 +0.0 1.375 1.0 +0.5 0.875 1.0 +1.0 0.625 1.0 +1.5 0.875 1.0 +2.0 1.375 1.0 +0.0 1.5 1.5 +0.5 1.0 1.5 +1.0 0.75 1.5 +1.5 1.0 1.5 +2.0 1.5 1.5 +0.0 2.0 2.0 +0.5 1.5 2.0 +1.0 1.25 2.0 +1.5 1.5 2.0 +2.0 2.0 2.0 diff --git a/lab3/Lab3 simple grids/grid2D-3x3-A-subdiv-1.off b/lab3/Lab3 simple grids/grid2D-3x3-A-subdiv-1.off new file mode 100644 index 0000000..26afc11 --- /dev/null +++ b/lab3/Lab3 simple grids/grid2D-3x3-A-subdiv-1.off @@ -0,0 +1,76 @@ +OFF +# G +# r +# i +# d +# +# s +# u +# b +# d +# i +# v +# i +# d +# e +# d +# +# i +# n +# +# 1 +# +# i +# t +# e +# r +# a +# t +# i +# o +# n +# s +# . +25 16 0 +0.0 3.0 0.0 +0.5 2.5 0.0 +1.0 2.25 0.0 +1.5 2.5 0.0 +2.0 3.0 0.0 +0.0 2.0 0.5 +0.5 1.5 0.5 +1.0 1.25 0.5 +1.5 1.5 0.5 +2.0 2.0 0.5 +0.0 1.375 1.0 +0.5 0.875 1.0 +1.0 0.625 1.0 +1.5 0.875 1.0 +2.0 1.375 1.0 +0.0 1.5 1.5 +0.5 1.0 1.5 +1.0 0.75 1.5 +1.5 1.0 1.5 +2.0 1.5 1.5 +0.0 2.0 2.0 +0.5 1.5 2.0 +1.0 1.25 2.0 +1.5 1.5 2.0 +2.0 2.0 2.0 + +4 0 1 6 5 +4 1 2 7 6 +4 2 3 8 7 +4 3 4 9 8 +4 5 6 11 10 +4 6 7 12 11 +4 7 8 13 12 +4 8 9 14 13 +4 10 11 16 15 +4 11 12 17 16 +4 12 13 18 17 +4 13 14 19 18 +4 15 16 21 20 +4 16 17 22 21 +4 17 18 23 22 +4 18 19 24 23 diff --git a/lab3/Lab3 simple grids/grid2D-3x3-A-subdiv-2.grid2D b/lab3/Lab3 simple grids/grid2D-3x3-A-subdiv-2.grid2D new file mode 100644 index 0000000..c5c2a61 --- /dev/null +++ b/lab3/Lab3 simple grids/grid2D-3x3-A-subdiv-2.grid2D @@ -0,0 +1,83 @@ +GRID2D_OF_POINTS3D +9 9 +0.0 3.0 0.0 +0.25 2.75 0.0 +0.5 2.53125 0.0 +0.75 2.375 0.0 +1.0 2.3125 0.0 +1.25 2.375 0.0 +1.5 2.53125 0.0 +1.75 2.75 0.0 +2.0 3.0 0.0 +0.0 2.5 0.25 +0.25 2.25 0.25 +0.5 2.03125 0.25 +0.75 1.875 0.25 +1.0 1.8125 0.25 +1.25 1.875 0.25 +1.5 2.03125 0.25 +1.75 2.25 0.25 +2.0 2.5 0.25 +0.0 2.046875 0.5 +0.25 1.796875 0.5 +0.5 1.578125 0.5 +0.75 1.421875 0.5 +1.0 1.359375 0.5 +1.25 1.421875 0.5 +1.5 1.578125 0.5 +1.75 1.796875 0.5 +2.0 2.046875 0.5 +0.0 1.6875 0.75 +0.25 1.4375 0.75 +0.5 1.21875 0.75 +0.75 1.0625 0.75 +1.0 1.0 0.75 +1.25 1.0625 0.75 +1.5 1.21875 0.75 +1.75 1.4375 0.75 +2.0 1.6875 0.75 +0.0 1.46875 1.0 +0.25 1.21875 1.0 +0.5 1.0 1.0 +0.75 0.84375 1.0 +1.0 0.78125 1.0 +1.25 0.84375 1.0 +1.5 1.0 1.0 +1.75 1.21875 1.0 +2.0 1.46875 1.0 +0.0 1.4375 1.25 +0.25 1.1875 1.25 +0.5 0.96875 1.25 +0.75 0.8125 1.25 +1.0 0.75 1.25 +1.25 0.8125 1.25 +1.5 0.96875 1.25 +1.75 1.1875 1.25 +2.0 1.4375 1.25 +0.0 1.546875 1.5 +0.25 1.296875 1.5 +0.5 1.078125 1.5 +0.75 0.921875 1.5 +1.0 0.859375 1.5 +1.25 0.921875 1.5 +1.5 1.078125 1.5 +1.75 1.296875 1.5 +2.0 1.546875 1.5 +0.0 1.75 1.75 +0.25 1.5 1.75 +0.5 1.28125 1.75 +0.75 1.125 1.75 +1.0 1.0625 1.75 +1.25 1.125 1.75 +1.5 1.28125 1.75 +1.75 1.5 1.75 +2.0 1.75 1.75 +0.0 2.0 2.0 +0.25 1.75 2.0 +0.5 1.53125 2.0 +0.75 1.375 2.0 +1.0 1.3125 2.0 +1.25 1.375 2.0 +1.5 1.53125 2.0 +1.75 1.75 2.0 +2.0 2.0 2.0 diff --git a/lab3/Lab3 simple grids/grid2D-3x3-A-subdiv-2.off b/lab3/Lab3 simple grids/grid2D-3x3-A-subdiv-2.off new file mode 100644 index 0000000..49e9ad3 --- /dev/null +++ b/lab3/Lab3 simple grids/grid2D-3x3-A-subdiv-2.off @@ -0,0 +1,180 @@ +OFF +# G +# r +# i +# d +# +# s +# u +# b +# d +# i +# v +# i +# d +# e +# d +# +# i +# n +# +# 2 +# +# i +# t +# e +# r +# a +# t +# i +# o +# n +# s +# . +81 64 0 +0.0 3.0 0.0 +0.25 2.75 0.0 +0.5 2.53125 0.0 +0.75 2.375 0.0 +1.0 2.3125 0.0 +1.25 2.375 0.0 +1.5 2.53125 0.0 +1.75 2.75 0.0 +2.0 3.0 0.0 +0.0 2.5 0.25 +0.25 2.25 0.25 +0.5 2.03125 0.25 +0.75 1.875 0.25 +1.0 1.8125 0.25 +1.25 1.875 0.25 +1.5 2.03125 0.25 +1.75 2.25 0.25 +2.0 2.5 0.25 +0.0 2.046875 0.5 +0.25 1.796875 0.5 +0.5 1.578125 0.5 +0.75 1.421875 0.5 +1.0 1.359375 0.5 +1.25 1.421875 0.5 +1.5 1.578125 0.5 +1.75 1.796875 0.5 +2.0 2.046875 0.5 +0.0 1.6875 0.75 +0.25 1.4375 0.75 +0.5 1.21875 0.75 +0.75 1.0625 0.75 +1.0 1.0 0.75 +1.25 1.0625 0.75 +1.5 1.21875 0.75 +1.75 1.4375 0.75 +2.0 1.6875 0.75 +0.0 1.46875 1.0 +0.25 1.21875 1.0 +0.5 1.0 1.0 +0.75 0.84375 1.0 +1.0 0.78125 1.0 +1.25 0.84375 1.0 +1.5 1.0 1.0 +1.75 1.21875 1.0 +2.0 1.46875 1.0 +0.0 1.4375 1.25 +0.25 1.1875 1.25 +0.5 0.96875 1.25 +0.75 0.8125 1.25 +1.0 0.75 1.25 +1.25 0.8125 1.25 +1.5 0.96875 1.25 +1.75 1.1875 1.25 +2.0 1.4375 1.25 +0.0 1.546875 1.5 +0.25 1.296875 1.5 +0.5 1.078125 1.5 +0.75 0.921875 1.5 +1.0 0.859375 1.5 +1.25 0.921875 1.5 +1.5 1.078125 1.5 +1.75 1.296875 1.5 +2.0 1.546875 1.5 +0.0 1.75 1.75 +0.25 1.5 1.75 +0.5 1.28125 1.75 +0.75 1.125 1.75 +1.0 1.0625 1.75 +1.25 1.125 1.75 +1.5 1.28125 1.75 +1.75 1.5 1.75 +2.0 1.75 1.75 +0.0 2.0 2.0 +0.25 1.75 2.0 +0.5 1.53125 2.0 +0.75 1.375 2.0 +1.0 1.3125 2.0 +1.25 1.375 2.0 +1.5 1.53125 2.0 +1.75 1.75 2.0 +2.0 2.0 2.0 + +4 0 1 10 9 +4 1 2 11 10 +4 2 3 12 11 +4 3 4 13 12 +4 4 5 14 13 +4 5 6 15 14 +4 6 7 16 15 +4 7 8 17 16 +4 9 10 19 18 +4 10 11 20 19 +4 11 12 21 20 +4 12 13 22 21 +4 13 14 23 22 +4 14 15 24 23 +4 15 16 25 24 +4 16 17 26 25 +4 18 19 28 27 +4 19 20 29 28 +4 20 21 30 29 +4 21 22 31 30 +4 22 23 32 31 +4 23 24 33 32 +4 24 25 34 33 +4 25 26 35 34 +4 27 28 37 36 +4 28 29 38 37 +4 29 30 39 38 +4 30 31 40 39 +4 31 32 41 40 +4 32 33 42 41 +4 33 34 43 42 +4 34 35 44 43 +4 36 37 46 45 +4 37 38 47 46 +4 38 39 48 47 +4 39 40 49 48 +4 40 41 50 49 +4 41 42 51 50 +4 42 43 52 51 +4 43 44 53 52 +4 45 46 55 54 +4 46 47 56 55 +4 47 48 57 56 +4 48 49 58 57 +4 49 50 59 58 +4 50 51 60 59 +4 51 52 61 60 +4 52 53 62 61 +4 54 55 64 63 +4 55 56 65 64 +4 56 57 66 65 +4 57 58 67 66 +4 58 59 68 67 +4 59 60 69 68 +4 60 61 70 69 +4 61 62 71 70 +4 63 64 73 72 +4 64 65 74 73 +4 65 66 75 74 +4 66 67 76 75 +4 67 68 77 76 +4 68 69 78 77 +4 69 70 79 78 +4 70 71 80 79 diff --git a/lab3/Lab3 simple grids/grid2D-3x3-A-subdiv-3.grid2D b/lab3/Lab3 simple grids/grid2D-3x3-A-subdiv-3.grid2D new file mode 100644 index 0000000..70d8046 --- /dev/null +++ b/lab3/Lab3 simple grids/grid2D-3x3-A-subdiv-3.grid2D @@ -0,0 +1,291 @@ +GRID2D_OF_POINTS3D +17 17 +0.0 3.0 0.0 +0.125 2.875 0.0 +0.25 2.75390625 0.0 +0.375 2.640625 0.0 +0.5 2.5390625 0.0 +0.625 2.453125 0.0 +0.75 2.38671875 0.0 +0.875 2.34375 0.0 +1.0 2.328125 0.0 +1.125 2.34375 0.0 +1.25 2.38671875 0.0 +1.375 2.453125 0.0 +1.5 2.5390625 0.0 +1.625 2.640625 0.0 +1.75 2.75390625 0.0 +1.875 2.875 0.0 +2.0 3.0 0.0 +0.0 2.75 0.125 +0.125 2.625 0.125 +0.25 2.50390625 0.125 +0.375 2.390625 0.125 +0.5 2.2890625 0.125 +0.625 2.203125 0.125 +0.75 2.13671875 0.125 +0.875 2.09375 0.125 +1.0 2.078125 0.125 +1.125 2.09375 0.125 +1.25 2.13671875 0.125 +1.375 2.203125 0.125 +1.5 2.2890625 0.125 +1.625 2.390625 0.125 +1.75 2.50390625 0.125 +1.875 2.625 0.125 +2.0 2.75 0.125 +0.0 2.505859375 0.25 +0.125 2.380859375 0.25 +0.25 2.259765625 0.25 +0.375 2.146484375 0.25 +0.5 2.044921875 0.25 +0.625 1.958984375 0.25 +0.75 1.892578125 0.25 +0.875 1.849609375 0.25 +1.0 1.833984375 0.25 +1.125 1.849609375 0.25 +1.25 1.892578125 0.25 +1.375 1.958984375 0.25 +1.5 2.044921875 0.25 +1.625 2.146484375 0.25 +1.75 2.259765625 0.25 +1.875 2.380859375 0.25 +2.0 2.505859375 0.25 +0.0 2.2734375 0.375 +0.125 2.1484375 0.375 +0.25 2.02734375 0.375 +0.375 1.9140625 0.375 +0.5 1.8125 0.375 +0.625 1.7265625 0.375 +0.75 1.66015625 0.375 +0.875 1.6171875 0.375 +1.0 1.6015625 0.375 +1.125 1.6171875 0.375 +1.25 1.66015625 0.375 +1.375 1.7265625 0.375 +1.5 1.8125 0.375 +1.625 1.9140625 0.375 +1.75 2.02734375 0.375 +1.875 2.1484375 0.375 +2.0 2.2734375 0.375 +0.0 2.05859375 0.5 +0.125 1.93359375 0.5 +0.25 1.8125 0.5 +0.375 1.69921875 0.5 +0.5 1.59765625 0.5 +0.625 1.51171875 0.5 +0.75 1.4453125 0.5 +0.875 1.40234375 0.5 +1.0 1.38671875 0.5 +1.125 1.40234375 0.5 +1.25 1.4453125 0.5 +1.375 1.51171875 0.5 +1.5 1.59765625 0.5 +1.625 1.69921875 0.5 +1.75 1.8125 0.5 +1.875 1.93359375 0.5 +2.0 2.05859375 0.5 +0.0 1.8671875 0.625 +0.125 1.7421875 0.625 +0.25 1.62109375 0.625 +0.375 1.5078125 0.625 +0.5 1.40625 0.625 +0.625 1.3203125 0.625 +0.75 1.25390625 0.625 +0.875 1.2109375 0.625 +1.0 1.1953125 0.625 +1.125 1.2109375 0.625 +1.25 1.25390625 0.625 +1.375 1.3203125 0.625 +1.5 1.40625 0.625 +1.625 1.5078125 0.625 +1.75 1.62109375 0.625 +1.875 1.7421875 0.625 +2.0 1.8671875 0.625 +0.0 1.705078125 0.75 +0.125 1.580078125 0.75 +0.25 1.458984375 0.75 +0.375 1.345703125 0.75 +0.5 1.244140625 0.75 +0.625 1.158203125 0.75 +0.75 1.091796875 0.75 +0.875 1.048828125 0.75 +1.0 1.033203125 0.75 +1.125 1.048828125 0.75 +1.25 1.091796875 0.75 +1.375 1.158203125 0.75 +1.5 1.244140625 0.75 +1.625 1.345703125 0.75 +1.75 1.458984375 0.75 +1.875 1.580078125 0.75 +2.0 1.705078125 0.75 +0.0 1.578125 0.875 +0.125 1.453125 0.875 +0.25 1.33203125 0.875 +0.375 1.21875 0.875 +0.5 1.1171875 0.875 +0.625 1.03125 0.875 +0.75 0.96484375 0.875 +0.875 0.921875 0.875 +1.0 0.90625 0.875 +1.125 0.921875 0.875 +1.25 0.96484375 0.875 +1.375 1.03125 0.875 +1.5 1.1171875 0.875 +1.625 1.21875 0.875 +1.75 1.33203125 0.875 +1.875 1.453125 0.875 +2.0 1.578125 0.875 +0.0 1.4921875 1.0 +0.125 1.3671875 1.0 +0.25 1.24609375 1.0 +0.375 1.1328125 1.0 +0.5 1.03125 1.0 +0.625 0.9453125 1.0 +0.75 0.87890625 1.0 +0.875 0.8359375 1.0 +1.0 0.8203125 1.0 +1.125 0.8359375 1.0 +1.25 0.87890625 1.0 +1.375 0.9453125 1.0 +1.5 1.03125 1.0 +1.625 1.1328125 1.0 +1.75 1.24609375 1.0 +1.875 1.3671875 1.0 +2.0 1.4921875 1.0 +0.0 1.453125 1.125 +0.125 1.328125 1.125 +0.25 1.20703125 1.125 +0.375 1.09375 1.125 +0.5 0.9921875 1.125 +0.625 0.90625 1.125 +0.75 0.83984375 1.125 +0.875 0.796875 1.125 +1.0 0.78125 1.125 +1.125 0.796875 1.125 +1.25 0.83984375 1.125 +1.375 0.90625 1.125 +1.5 0.9921875 1.125 +1.625 1.09375 1.125 +1.75 1.20703125 1.125 +1.875 1.328125 1.125 +2.0 1.453125 1.125 +0.0 1.455078125 1.25 +0.125 1.330078125 1.25 +0.25 1.208984375 1.25 +0.375 1.095703125 1.25 +0.5 0.994140625 1.25 +0.625 0.908203125 1.25 +0.75 0.841796875 1.25 +0.875 0.798828125 1.25 +1.0 0.783203125 1.25 +1.125 0.798828125 1.25 +1.25 0.841796875 1.25 +1.375 0.908203125 1.25 +1.5 0.994140625 1.25 +1.625 1.095703125 1.25 +1.75 1.208984375 1.25 +1.875 1.330078125 1.25 +2.0 1.455078125 1.25 +0.0 1.4921875 1.375 +0.125 1.3671875 1.375 +0.25 1.24609375 1.375 +0.375 1.1328125 1.375 +0.5 1.03125 1.375 +0.625 0.9453125 1.375 +0.75 0.87890625 1.375 +0.875 0.8359375 1.375 +1.0 0.8203125 1.375 +1.125 0.8359375 1.375 +1.25 0.87890625 1.375 +1.375 0.9453125 1.375 +1.5 1.03125 1.375 +1.625 1.1328125 1.375 +1.75 1.24609375 1.375 +1.875 1.3671875 1.375 +2.0 1.4921875 1.375 +0.0 1.55859375 1.5 +0.125 1.43359375 1.5 +0.25 1.3125 1.5 +0.375 1.19921875 1.5 +0.5 1.09765625 1.5 +0.625 1.01171875 1.5 +0.75 0.9453125 1.5 +0.875 0.90234375 1.5 +1.0 0.88671875 1.5 +1.125 0.90234375 1.5 +1.25 0.9453125 1.5 +1.375 1.01171875 1.5 +1.5 1.09765625 1.5 +1.625 1.19921875 1.5 +1.75 1.3125 1.5 +1.875 1.43359375 1.5 +2.0 1.55859375 1.5 +0.0 1.6484375 1.625 +0.125 1.5234375 1.625 +0.25 1.40234375 1.625 +0.375 1.2890625 1.625 +0.5 1.1875 1.625 +0.625 1.1015625 1.625 +0.75 1.03515625 1.625 +0.875 0.9921875 1.625 +1.0 0.9765625 1.625 +1.125 0.9921875 1.625 +1.25 1.03515625 1.625 +1.375 1.1015625 1.625 +1.5 1.1875 1.625 +1.625 1.2890625 1.625 +1.75 1.40234375 1.625 +1.875 1.5234375 1.625 +2.0 1.6484375 1.625 +0.0 1.755859375 1.75 +0.125 1.630859375 1.75 +0.25 1.509765625 1.75 +0.375 1.396484375 1.75 +0.5 1.294921875 1.75 +0.625 1.208984375 1.75 +0.75 1.142578125 1.75 +0.875 1.099609375 1.75 +1.0 1.083984375 1.75 +1.125 1.099609375 1.75 +1.25 1.142578125 1.75 +1.375 1.208984375 1.75 +1.5 1.294921875 1.75 +1.625 1.396484375 1.75 +1.75 1.509765625 1.75 +1.875 1.630859375 1.75 +2.0 1.755859375 1.75 +0.0 1.875 1.875 +0.125 1.75 1.875 +0.25 1.62890625 1.875 +0.375 1.515625 1.875 +0.5 1.4140625 1.875 +0.625 1.328125 1.875 +0.75 1.26171875 1.875 +0.875 1.21875 1.875 +1.0 1.203125 1.875 +1.125 1.21875 1.875 +1.25 1.26171875 1.875 +1.375 1.328125 1.875 +1.5 1.4140625 1.875 +1.625 1.515625 1.875 +1.75 1.62890625 1.875 +1.875 1.75 1.875 +2.0 1.875 1.875 +0.0 2.0 2.0 +0.125 1.875 2.0 +0.25 1.75390625 2.0 +0.375 1.640625 2.0 +0.5 1.5390625 2.0 +0.625 1.453125 2.0 +0.75 1.38671875 2.0 +0.875 1.34375 2.0 +1.0 1.328125 2.0 +1.125 1.34375 2.0 +1.25 1.38671875 2.0 +1.375 1.453125 2.0 +1.5 1.5390625 2.0 +1.625 1.640625 2.0 +1.75 1.75390625 2.0 +1.875 1.875 2.0 +2.0 2.0 2.0 diff --git a/lab3/Lab3 simple grids/grid2D-3x3-A-subdiv-3.off b/lab3/Lab3 simple grids/grid2D-3x3-A-subdiv-3.off new file mode 100644 index 0000000..26e93d6 --- /dev/null +++ b/lab3/Lab3 simple grids/grid2D-3x3-A-subdiv-3.off @@ -0,0 +1,580 @@ +OFF +# G +# r +# i +# d +# +# s +# u +# b +# d +# i +# v +# i +# d +# e +# d +# +# i +# n +# +# 3 +# +# i +# t +# e +# r +# a +# t +# i +# o +# n +# s +# . +289 256 0 +0.0 3.0 0.0 +0.125 2.875 0.0 +0.25 2.75390625 0.0 +0.375 2.640625 0.0 +0.5 2.5390625 0.0 +0.625 2.453125 0.0 +0.75 2.38671875 0.0 +0.875 2.34375 0.0 +1.0 2.328125 0.0 +1.125 2.34375 0.0 +1.25 2.38671875 0.0 +1.375 2.453125 0.0 +1.5 2.5390625 0.0 +1.625 2.640625 0.0 +1.75 2.75390625 0.0 +1.875 2.875 0.0 +2.0 3.0 0.0 +0.0 2.75 0.125 +0.125 2.625 0.125 +0.25 2.50390625 0.125 +0.375 2.390625 0.125 +0.5 2.2890625 0.125 +0.625 2.203125 0.125 +0.75 2.13671875 0.125 +0.875 2.09375 0.125 +1.0 2.078125 0.125 +1.125 2.09375 0.125 +1.25 2.13671875 0.125 +1.375 2.203125 0.125 +1.5 2.2890625 0.125 +1.625 2.390625 0.125 +1.75 2.50390625 0.125 +1.875 2.625 0.125 +2.0 2.75 0.125 +0.0 2.505859375 0.25 +0.125 2.380859375 0.25 +0.25 2.259765625 0.25 +0.375 2.146484375 0.25 +0.5 2.044921875 0.25 +0.625 1.958984375 0.25 +0.75 1.892578125 0.25 +0.875 1.849609375 0.25 +1.0 1.833984375 0.25 +1.125 1.849609375 0.25 +1.25 1.892578125 0.25 +1.375 1.958984375 0.25 +1.5 2.044921875 0.25 +1.625 2.146484375 0.25 +1.75 2.259765625 0.25 +1.875 2.380859375 0.25 +2.0 2.505859375 0.25 +0.0 2.2734375 0.375 +0.125 2.1484375 0.375 +0.25 2.02734375 0.375 +0.375 1.9140625 0.375 +0.5 1.8125 0.375 +0.625 1.7265625 0.375 +0.75 1.66015625 0.375 +0.875 1.6171875 0.375 +1.0 1.6015625 0.375 +1.125 1.6171875 0.375 +1.25 1.66015625 0.375 +1.375 1.7265625 0.375 +1.5 1.8125 0.375 +1.625 1.9140625 0.375 +1.75 2.02734375 0.375 +1.875 2.1484375 0.375 +2.0 2.2734375 0.375 +0.0 2.05859375 0.5 +0.125 1.93359375 0.5 +0.25 1.8125 0.5 +0.375 1.69921875 0.5 +0.5 1.59765625 0.5 +0.625 1.51171875 0.5 +0.75 1.4453125 0.5 +0.875 1.40234375 0.5 +1.0 1.38671875 0.5 +1.125 1.40234375 0.5 +1.25 1.4453125 0.5 +1.375 1.51171875 0.5 +1.5 1.59765625 0.5 +1.625 1.69921875 0.5 +1.75 1.8125 0.5 +1.875 1.93359375 0.5 +2.0 2.05859375 0.5 +0.0 1.8671875 0.625 +0.125 1.7421875 0.625 +0.25 1.62109375 0.625 +0.375 1.5078125 0.625 +0.5 1.40625 0.625 +0.625 1.3203125 0.625 +0.75 1.25390625 0.625 +0.875 1.2109375 0.625 +1.0 1.1953125 0.625 +1.125 1.2109375 0.625 +1.25 1.25390625 0.625 +1.375 1.3203125 0.625 +1.5 1.40625 0.625 +1.625 1.5078125 0.625 +1.75 1.62109375 0.625 +1.875 1.7421875 0.625 +2.0 1.8671875 0.625 +0.0 1.705078125 0.75 +0.125 1.580078125 0.75 +0.25 1.458984375 0.75 +0.375 1.345703125 0.75 +0.5 1.244140625 0.75 +0.625 1.158203125 0.75 +0.75 1.091796875 0.75 +0.875 1.048828125 0.75 +1.0 1.033203125 0.75 +1.125 1.048828125 0.75 +1.25 1.091796875 0.75 +1.375 1.158203125 0.75 +1.5 1.244140625 0.75 +1.625 1.345703125 0.75 +1.75 1.458984375 0.75 +1.875 1.580078125 0.75 +2.0 1.705078125 0.75 +0.0 1.578125 0.875 +0.125 1.453125 0.875 +0.25 1.33203125 0.875 +0.375 1.21875 0.875 +0.5 1.1171875 0.875 +0.625 1.03125 0.875 +0.75 0.96484375 0.875 +0.875 0.921875 0.875 +1.0 0.90625 0.875 +1.125 0.921875 0.875 +1.25 0.96484375 0.875 +1.375 1.03125 0.875 +1.5 1.1171875 0.875 +1.625 1.21875 0.875 +1.75 1.33203125 0.875 +1.875 1.453125 0.875 +2.0 1.578125 0.875 +0.0 1.4921875 1.0 +0.125 1.3671875 1.0 +0.25 1.24609375 1.0 +0.375 1.1328125 1.0 +0.5 1.03125 1.0 +0.625 0.9453125 1.0 +0.75 0.87890625 1.0 +0.875 0.8359375 1.0 +1.0 0.8203125 1.0 +1.125 0.8359375 1.0 +1.25 0.87890625 1.0 +1.375 0.9453125 1.0 +1.5 1.03125 1.0 +1.625 1.1328125 1.0 +1.75 1.24609375 1.0 +1.875 1.3671875 1.0 +2.0 1.4921875 1.0 +0.0 1.453125 1.125 +0.125 1.328125 1.125 +0.25 1.20703125 1.125 +0.375 1.09375 1.125 +0.5 0.9921875 1.125 +0.625 0.90625 1.125 +0.75 0.83984375 1.125 +0.875 0.796875 1.125 +1.0 0.78125 1.125 +1.125 0.796875 1.125 +1.25 0.83984375 1.125 +1.375 0.90625 1.125 +1.5 0.9921875 1.125 +1.625 1.09375 1.125 +1.75 1.20703125 1.125 +1.875 1.328125 1.125 +2.0 1.453125 1.125 +0.0 1.455078125 1.25 +0.125 1.330078125 1.25 +0.25 1.208984375 1.25 +0.375 1.095703125 1.25 +0.5 0.994140625 1.25 +0.625 0.908203125 1.25 +0.75 0.841796875 1.25 +0.875 0.798828125 1.25 +1.0 0.783203125 1.25 +1.125 0.798828125 1.25 +1.25 0.841796875 1.25 +1.375 0.908203125 1.25 +1.5 0.994140625 1.25 +1.625 1.095703125 1.25 +1.75 1.208984375 1.25 +1.875 1.330078125 1.25 +2.0 1.455078125 1.25 +0.0 1.4921875 1.375 +0.125 1.3671875 1.375 +0.25 1.24609375 1.375 +0.375 1.1328125 1.375 +0.5 1.03125 1.375 +0.625 0.9453125 1.375 +0.75 0.87890625 1.375 +0.875 0.8359375 1.375 +1.0 0.8203125 1.375 +1.125 0.8359375 1.375 +1.25 0.87890625 1.375 +1.375 0.9453125 1.375 +1.5 1.03125 1.375 +1.625 1.1328125 1.375 +1.75 1.24609375 1.375 +1.875 1.3671875 1.375 +2.0 1.4921875 1.375 +0.0 1.55859375 1.5 +0.125 1.43359375 1.5 +0.25 1.3125 1.5 +0.375 1.19921875 1.5 +0.5 1.09765625 1.5 +0.625 1.01171875 1.5 +0.75 0.9453125 1.5 +0.875 0.90234375 1.5 +1.0 0.88671875 1.5 +1.125 0.90234375 1.5 +1.25 0.9453125 1.5 +1.375 1.01171875 1.5 +1.5 1.09765625 1.5 +1.625 1.19921875 1.5 +1.75 1.3125 1.5 +1.875 1.43359375 1.5 +2.0 1.55859375 1.5 +0.0 1.6484375 1.625 +0.125 1.5234375 1.625 +0.25 1.40234375 1.625 +0.375 1.2890625 1.625 +0.5 1.1875 1.625 +0.625 1.1015625 1.625 +0.75 1.03515625 1.625 +0.875 0.9921875 1.625 +1.0 0.9765625 1.625 +1.125 0.9921875 1.625 +1.25 1.03515625 1.625 +1.375 1.1015625 1.625 +1.5 1.1875 1.625 +1.625 1.2890625 1.625 +1.75 1.40234375 1.625 +1.875 1.5234375 1.625 +2.0 1.6484375 1.625 +0.0 1.755859375 1.75 +0.125 1.630859375 1.75 +0.25 1.509765625 1.75 +0.375 1.396484375 1.75 +0.5 1.294921875 1.75 +0.625 1.208984375 1.75 +0.75 1.142578125 1.75 +0.875 1.099609375 1.75 +1.0 1.083984375 1.75 +1.125 1.099609375 1.75 +1.25 1.142578125 1.75 +1.375 1.208984375 1.75 +1.5 1.294921875 1.75 +1.625 1.396484375 1.75 +1.75 1.509765625 1.75 +1.875 1.630859375 1.75 +2.0 1.755859375 1.75 +0.0 1.875 1.875 +0.125 1.75 1.875 +0.25 1.62890625 1.875 +0.375 1.515625 1.875 +0.5 1.4140625 1.875 +0.625 1.328125 1.875 +0.75 1.26171875 1.875 +0.875 1.21875 1.875 +1.0 1.203125 1.875 +1.125 1.21875 1.875 +1.25 1.26171875 1.875 +1.375 1.328125 1.875 +1.5 1.4140625 1.875 +1.625 1.515625 1.875 +1.75 1.62890625 1.875 +1.875 1.75 1.875 +2.0 1.875 1.875 +0.0 2.0 2.0 +0.125 1.875 2.0 +0.25 1.75390625 2.0 +0.375 1.640625 2.0 +0.5 1.5390625 2.0 +0.625 1.453125 2.0 +0.75 1.38671875 2.0 +0.875 1.34375 2.0 +1.0 1.328125 2.0 +1.125 1.34375 2.0 +1.25 1.38671875 2.0 +1.375 1.453125 2.0 +1.5 1.5390625 2.0 +1.625 1.640625 2.0 +1.75 1.75390625 2.0 +1.875 1.875 2.0 +2.0 2.0 2.0 + +4 0 1 18 17 +4 1 2 19 18 +4 2 3 20 19 +4 3 4 21 20 +4 4 5 22 21 +4 5 6 23 22 +4 6 7 24 23 +4 7 8 25 24 +4 8 9 26 25 +4 9 10 27 26 +4 10 11 28 27 +4 11 12 29 28 +4 12 13 30 29 +4 13 14 31 30 +4 14 15 32 31 +4 15 16 33 32 +4 17 18 35 34 +4 18 19 36 35 +4 19 20 37 36 +4 20 21 38 37 +4 21 22 39 38 +4 22 23 40 39 +4 23 24 41 40 +4 24 25 42 41 +4 25 26 43 42 +4 26 27 44 43 +4 27 28 45 44 +4 28 29 46 45 +4 29 30 47 46 +4 30 31 48 47 +4 31 32 49 48 +4 32 33 50 49 +4 34 35 52 51 +4 35 36 53 52 +4 36 37 54 53 +4 37 38 55 54 +4 38 39 56 55 +4 39 40 57 56 +4 40 41 58 57 +4 41 42 59 58 +4 42 43 60 59 +4 43 44 61 60 +4 44 45 62 61 +4 45 46 63 62 +4 46 47 64 63 +4 47 48 65 64 +4 48 49 66 65 +4 49 50 67 66 +4 51 52 69 68 +4 52 53 70 69 +4 53 54 71 70 +4 54 55 72 71 +4 55 56 73 72 +4 56 57 74 73 +4 57 58 75 74 +4 58 59 76 75 +4 59 60 77 76 +4 60 61 78 77 +4 61 62 79 78 +4 62 63 80 79 +4 63 64 81 80 +4 64 65 82 81 +4 65 66 83 82 +4 66 67 84 83 +4 68 69 86 85 +4 69 70 87 86 +4 70 71 88 87 +4 71 72 89 88 +4 72 73 90 89 +4 73 74 91 90 +4 74 75 92 91 +4 75 76 93 92 +4 76 77 94 93 +4 77 78 95 94 +4 78 79 96 95 +4 79 80 97 96 +4 80 81 98 97 +4 81 82 99 98 +4 82 83 100 99 +4 83 84 101 100 +4 85 86 103 102 +4 86 87 104 103 +4 87 88 105 104 +4 88 89 106 105 +4 89 90 107 106 +4 90 91 108 107 +4 91 92 109 108 +4 92 93 110 109 +4 93 94 111 110 +4 94 95 112 111 +4 95 96 113 112 +4 96 97 114 113 +4 97 98 115 114 +4 98 99 116 115 +4 99 100 117 116 +4 100 101 118 117 +4 102 103 120 119 +4 103 104 121 120 +4 104 105 122 121 +4 105 106 123 122 +4 106 107 124 123 +4 107 108 125 124 +4 108 109 126 125 +4 109 110 127 126 +4 110 111 128 127 +4 111 112 129 128 +4 112 113 130 129 +4 113 114 131 130 +4 114 115 132 131 +4 115 116 133 132 +4 116 117 134 133 +4 117 118 135 134 +4 119 120 137 136 +4 120 121 138 137 +4 121 122 139 138 +4 122 123 140 139 +4 123 124 141 140 +4 124 125 142 141 +4 125 126 143 142 +4 126 127 144 143 +4 127 128 145 144 +4 128 129 146 145 +4 129 130 147 146 +4 130 131 148 147 +4 131 132 149 148 +4 132 133 150 149 +4 133 134 151 150 +4 134 135 152 151 +4 136 137 154 153 +4 137 138 155 154 +4 138 139 156 155 +4 139 140 157 156 +4 140 141 158 157 +4 141 142 159 158 +4 142 143 160 159 +4 143 144 161 160 +4 144 145 162 161 +4 145 146 163 162 +4 146 147 164 163 +4 147 148 165 164 +4 148 149 166 165 +4 149 150 167 166 +4 150 151 168 167 +4 151 152 169 168 +4 153 154 171 170 +4 154 155 172 171 +4 155 156 173 172 +4 156 157 174 173 +4 157 158 175 174 +4 158 159 176 175 +4 159 160 177 176 +4 160 161 178 177 +4 161 162 179 178 +4 162 163 180 179 +4 163 164 181 180 +4 164 165 182 181 +4 165 166 183 182 +4 166 167 184 183 +4 167 168 185 184 +4 168 169 186 185 +4 170 171 188 187 +4 171 172 189 188 +4 172 173 190 189 +4 173 174 191 190 +4 174 175 192 191 +4 175 176 193 192 +4 176 177 194 193 +4 177 178 195 194 +4 178 179 196 195 +4 179 180 197 196 +4 180 181 198 197 +4 181 182 199 198 +4 182 183 200 199 +4 183 184 201 200 +4 184 185 202 201 +4 185 186 203 202 +4 187 188 205 204 +4 188 189 206 205 +4 189 190 207 206 +4 190 191 208 207 +4 191 192 209 208 +4 192 193 210 209 +4 193 194 211 210 +4 194 195 212 211 +4 195 196 213 212 +4 196 197 214 213 +4 197 198 215 214 +4 198 199 216 215 +4 199 200 217 216 +4 200 201 218 217 +4 201 202 219 218 +4 202 203 220 219 +4 204 205 222 221 +4 205 206 223 222 +4 206 207 224 223 +4 207 208 225 224 +4 208 209 226 225 +4 209 210 227 226 +4 210 211 228 227 +4 211 212 229 228 +4 212 213 230 229 +4 213 214 231 230 +4 214 215 232 231 +4 215 216 233 232 +4 216 217 234 233 +4 217 218 235 234 +4 218 219 236 235 +4 219 220 237 236 +4 221 222 239 238 +4 222 223 240 239 +4 223 224 241 240 +4 224 225 242 241 +4 225 226 243 242 +4 226 227 244 243 +4 227 228 245 244 +4 228 229 246 245 +4 229 230 247 246 +4 230 231 248 247 +4 231 232 249 248 +4 232 233 250 249 +4 233 234 251 250 +4 234 235 252 251 +4 235 236 253 252 +4 236 237 254 253 +4 238 239 256 255 +4 239 240 257 256 +4 240 241 258 257 +4 241 242 259 258 +4 242 243 260 259 +4 243 244 261 260 +4 244 245 262 261 +4 245 246 263 262 +4 246 247 264 263 +4 247 248 265 264 +4 248 249 266 265 +4 249 250 267 266 +4 250 251 268 267 +4 251 252 269 268 +4 252 253 270 269 +4 253 254 271 270 +4 255 256 273 272 +4 256 257 274 273 +4 257 258 275 274 +4 258 259 276 275 +4 259 260 277 276 +4 260 261 278 277 +4 261 262 279 278 +4 262 263 280 279 +4 263 264 281 280 +4 264 265 282 281 +4 265 266 283 282 +4 266 267 284 283 +4 267 268 285 284 +4 268 269 286 285 +4 269 270 287 286 +4 270 271 288 287 diff --git a/lab3/Lab3 simple grids/grid2D-3x3-A.grid2D b/lab3/Lab3 simple grids/grid2D-3x3-A.grid2D new file mode 100644 index 0000000..87b36e2 --- /dev/null +++ b/lab3/Lab3 simple grids/grid2D-3x3-A.grid2D @@ -0,0 +1,13 @@ +GRID2D_OF_POINTS3D +# Dimensions +3 3 +0 3 0 +1 2 0 +2 3 0 +0 1 1 +1 0 1 +2 1 1 +0 2 2 +1 1 2 +2 2 2 + diff --git a/lab3/Lab3 simple grids/grid2D-3x3-A.off b/lab3/Lab3 simple grids/grid2D-3x3-A.off new file mode 100644 index 0000000..dc6d62f --- /dev/null +++ b/lab3/Lab3 simple grids/grid2D-3x3-A.off @@ -0,0 +1,17 @@ +OFF +# File created from 2D grid of points. +9 4 0 +0.0 3.0 0.0 +1.0 2.0 0.0 +2.0 3.0 0.0 +0.0 1.0 1.0 +1.0 0.0 1.0 +2.0 1.0 1.0 +0.0 2.0 2.0 +1.0 1.0 2.0 +2.0 2.0 2.0 + +4 0 1 4 3 +4 1 2 5 4 +4 3 4 7 6 +4 4 5 8 7 diff --git a/lab3/Lab3 simple grids/plane-2x2-A-subdiv-1.grid2D b/lab3/Lab3 simple grids/plane-2x2-A-subdiv-1.grid2D new file mode 100644 index 0000000..a011507 --- /dev/null +++ b/lab3/Lab3 simple grids/plane-2x2-A-subdiv-1.grid2D @@ -0,0 +1,11 @@ +GRID2D_OF_POINTS3D +3 3 +0.0 2.0 0.0 +1.0 2.0 0.0 +2.0 2.0 0.0 +0.0 1.0 1.0 +1.0 1.0 1.0 +2.0 1.0 1.0 +0.0 0.0 2.0 +1.0 0.0 2.0 +2.0 0.0 2.0 diff --git a/lab3/Lab3 simple grids/plane-2x2-A-subdiv-1.off b/lab3/Lab3 simple grids/plane-2x2-A-subdiv-1.off new file mode 100644 index 0000000..1045abd --- /dev/null +++ b/lab3/Lab3 simple grids/plane-2x2-A-subdiv-1.off @@ -0,0 +1,48 @@ +OFF +# G +# r +# i +# d +# +# s +# u +# b +# d +# i +# v +# i +# d +# e +# d +# +# i +# n +# +# 1 +# +# i +# t +# e +# r +# a +# t +# i +# o +# n +# s +# . +9 4 0 +0.0 2.0 0.0 +1.0 2.0 0.0 +2.0 2.0 0.0 +0.0 1.0 1.0 +1.0 1.0 1.0 +2.0 1.0 1.0 +0.0 0.0 2.0 +1.0 0.0 2.0 +2.0 0.0 2.0 + +4 0 1 4 3 +4 1 2 5 4 +4 3 4 7 6 +4 4 5 8 7 diff --git a/lab3/Lab3 simple grids/plane-2x2-A-subdiv-2.grid2D b/lab3/Lab3 simple grids/plane-2x2-A-subdiv-2.grid2D new file mode 100644 index 0000000..fe68459 --- /dev/null +++ b/lab3/Lab3 simple grids/plane-2x2-A-subdiv-2.grid2D @@ -0,0 +1,27 @@ +GRID2D_OF_POINTS3D +5 5 +0.0 2.0 0.0 +0.5 2.0 0.0 +1.0 2.0 0.0 +1.5 2.0 0.0 +2.0 2.0 0.0 +0.0 1.5 0.5 +0.5 1.5 0.5 +1.0 1.5 0.5 +1.5 1.5 0.5 +2.0 1.5 0.5 +0.0 1.0 1.0 +0.5 1.0 1.0 +1.0 1.0 1.0 +1.5 1.0 1.0 +2.0 1.0 1.0 +0.0 0.5 1.5 +0.5 0.5 1.5 +1.0 0.5 1.5 +1.5 0.5 1.5 +2.0 0.5 1.5 +0.0 0.0 2.0 +0.5 0.0 2.0 +1.0 0.0 2.0 +1.5 0.0 2.0 +2.0 0.0 2.0 diff --git a/lab3/Lab3 simple grids/plane-2x2-A-subdiv-2.off b/lab3/Lab3 simple grids/plane-2x2-A-subdiv-2.off new file mode 100644 index 0000000..7d9a9b8 --- /dev/null +++ b/lab3/Lab3 simple grids/plane-2x2-A-subdiv-2.off @@ -0,0 +1,76 @@ +OFF +# G +# r +# i +# d +# +# s +# u +# b +# d +# i +# v +# i +# d +# e +# d +# +# i +# n +# +# 2 +# +# i +# t +# e +# r +# a +# t +# i +# o +# n +# s +# . +25 16 0 +0.0 2.0 0.0 +0.5 2.0 0.0 +1.0 2.0 0.0 +1.5 2.0 0.0 +2.0 2.0 0.0 +0.0 1.5 0.5 +0.5 1.5 0.5 +1.0 1.5 0.5 +1.5 1.5 0.5 +2.0 1.5 0.5 +0.0 1.0 1.0 +0.5 1.0 1.0 +1.0 1.0 1.0 +1.5 1.0 1.0 +2.0 1.0 1.0 +0.0 0.5 1.5 +0.5 0.5 1.5 +1.0 0.5 1.5 +1.5 0.5 1.5 +2.0 0.5 1.5 +0.0 0.0 2.0 +0.5 0.0 2.0 +1.0 0.0 2.0 +1.5 0.0 2.0 +2.0 0.0 2.0 + +4 0 1 6 5 +4 1 2 7 6 +4 2 3 8 7 +4 3 4 9 8 +4 5 6 11 10 +4 6 7 12 11 +4 7 8 13 12 +4 8 9 14 13 +4 10 11 16 15 +4 11 12 17 16 +4 12 13 18 17 +4 13 14 19 18 +4 15 16 21 20 +4 16 17 22 21 +4 17 18 23 22 +4 18 19 24 23 diff --git a/lab3/Lab3 simple grids/plane-2x2-A-subdiv-3.grid2D b/lab3/Lab3 simple grids/plane-2x2-A-subdiv-3.grid2D new file mode 100644 index 0000000..15a452d --- /dev/null +++ b/lab3/Lab3 simple grids/plane-2x2-A-subdiv-3.grid2D @@ -0,0 +1,83 @@ +GRID2D_OF_POINTS3D +9 9 +0.0 2.0 0.0 +0.25 2.0 0.0 +0.5 2.0 0.0 +0.75 2.0 0.0 +1.0 2.0 0.0 +1.25 2.0 0.0 +1.5 2.0 0.0 +1.75 2.0 0.0 +2.0 2.0 0.0 +0.0 1.75 0.25 +0.25 1.75 0.25 +0.5 1.75 0.25 +0.75 1.75 0.25 +1.0 1.75 0.25 +1.25 1.75 0.25 +1.5 1.75 0.25 +1.75 1.75 0.25 +2.0 1.75 0.25 +0.0 1.5 0.5 +0.25 1.5 0.5 +0.5 1.5 0.5 +0.75 1.5 0.5 +1.0 1.5 0.5 +1.25 1.5 0.5 +1.5 1.5 0.5 +1.75 1.5 0.5 +2.0 1.5 0.5 +0.0 1.25 0.75 +0.25 1.25 0.75 +0.5 1.25 0.75 +0.75 1.25 0.75 +1.0 1.25 0.75 +1.25 1.25 0.75 +1.5 1.25 0.75 +1.75 1.25 0.75 +2.0 1.25 0.75 +0.0 1.0 1.0 +0.25 1.0 1.0 +0.5 1.0 1.0 +0.75 1.0 1.0 +1.0 1.0 1.0 +1.25 1.0 1.0 +1.5 1.0 1.0 +1.75 1.0 1.0 +2.0 1.0 1.0 +0.0 0.75 1.25 +0.25 0.75 1.25 +0.5 0.75 1.25 +0.75 0.75 1.25 +1.0 0.75 1.25 +1.25 0.75 1.25 +1.5 0.75 1.25 +1.75 0.75 1.25 +2.0 0.75 1.25 +0.0 0.5 1.5 +0.25 0.5 1.5 +0.5 0.5 1.5 +0.75 0.5 1.5 +1.0 0.5 1.5 +1.25 0.5 1.5 +1.5 0.5 1.5 +1.75 0.5 1.5 +2.0 0.5 1.5 +0.0 0.25 1.75 +0.25 0.25 1.75 +0.5 0.25 1.75 +0.75 0.25 1.75 +1.0 0.25 1.75 +1.25 0.25 1.75 +1.5 0.25 1.75 +1.75 0.25 1.75 +2.0 0.25 1.75 +0.0 0.0 2.0 +0.25 0.0 2.0 +0.5 0.0 2.0 +0.75 0.0 2.0 +1.0 0.0 2.0 +1.25 0.0 2.0 +1.5 0.0 2.0 +1.75 0.0 2.0 +2.0 0.0 2.0 diff --git a/lab3/Lab3 simple grids/plane-2x2-A-subdiv-3.off b/lab3/Lab3 simple grids/plane-2x2-A-subdiv-3.off new file mode 100644 index 0000000..04f0fc2 --- /dev/null +++ b/lab3/Lab3 simple grids/plane-2x2-A-subdiv-3.off @@ -0,0 +1,180 @@ +OFF +# G +# r +# i +# d +# +# s +# u +# b +# d +# i +# v +# i +# d +# e +# d +# +# i +# n +# +# 3 +# +# i +# t +# e +# r +# a +# t +# i +# o +# n +# s +# . +81 64 0 +0.0 2.0 0.0 +0.25 2.0 0.0 +0.5 2.0 0.0 +0.75 2.0 0.0 +1.0 2.0 0.0 +1.25 2.0 0.0 +1.5 2.0 0.0 +1.75 2.0 0.0 +2.0 2.0 0.0 +0.0 1.75 0.25 +0.25 1.75 0.25 +0.5 1.75 0.25 +0.75 1.75 0.25 +1.0 1.75 0.25 +1.25 1.75 0.25 +1.5 1.75 0.25 +1.75 1.75 0.25 +2.0 1.75 0.25 +0.0 1.5 0.5 +0.25 1.5 0.5 +0.5 1.5 0.5 +0.75 1.5 0.5 +1.0 1.5 0.5 +1.25 1.5 0.5 +1.5 1.5 0.5 +1.75 1.5 0.5 +2.0 1.5 0.5 +0.0 1.25 0.75 +0.25 1.25 0.75 +0.5 1.25 0.75 +0.75 1.25 0.75 +1.0 1.25 0.75 +1.25 1.25 0.75 +1.5 1.25 0.75 +1.75 1.25 0.75 +2.0 1.25 0.75 +0.0 1.0 1.0 +0.25 1.0 1.0 +0.5 1.0 1.0 +0.75 1.0 1.0 +1.0 1.0 1.0 +1.25 1.0 1.0 +1.5 1.0 1.0 +1.75 1.0 1.0 +2.0 1.0 1.0 +0.0 0.75 1.25 +0.25 0.75 1.25 +0.5 0.75 1.25 +0.75 0.75 1.25 +1.0 0.75 1.25 +1.25 0.75 1.25 +1.5 0.75 1.25 +1.75 0.75 1.25 +2.0 0.75 1.25 +0.0 0.5 1.5 +0.25 0.5 1.5 +0.5 0.5 1.5 +0.75 0.5 1.5 +1.0 0.5 1.5 +1.25 0.5 1.5 +1.5 0.5 1.5 +1.75 0.5 1.5 +2.0 0.5 1.5 +0.0 0.25 1.75 +0.25 0.25 1.75 +0.5 0.25 1.75 +0.75 0.25 1.75 +1.0 0.25 1.75 +1.25 0.25 1.75 +1.5 0.25 1.75 +1.75 0.25 1.75 +2.0 0.25 1.75 +0.0 0.0 2.0 +0.25 0.0 2.0 +0.5 0.0 2.0 +0.75 0.0 2.0 +1.0 0.0 2.0 +1.25 0.0 2.0 +1.5 0.0 2.0 +1.75 0.0 2.0 +2.0 0.0 2.0 + +4 0 1 10 9 +4 1 2 11 10 +4 2 3 12 11 +4 3 4 13 12 +4 4 5 14 13 +4 5 6 15 14 +4 6 7 16 15 +4 7 8 17 16 +4 9 10 19 18 +4 10 11 20 19 +4 11 12 21 20 +4 12 13 22 21 +4 13 14 23 22 +4 14 15 24 23 +4 15 16 25 24 +4 16 17 26 25 +4 18 19 28 27 +4 19 20 29 28 +4 20 21 30 29 +4 21 22 31 30 +4 22 23 32 31 +4 23 24 33 32 +4 24 25 34 33 +4 25 26 35 34 +4 27 28 37 36 +4 28 29 38 37 +4 29 30 39 38 +4 30 31 40 39 +4 31 32 41 40 +4 32 33 42 41 +4 33 34 43 42 +4 34 35 44 43 +4 36 37 46 45 +4 37 38 47 46 +4 38 39 48 47 +4 39 40 49 48 +4 40 41 50 49 +4 41 42 51 50 +4 42 43 52 51 +4 43 44 53 52 +4 45 46 55 54 +4 46 47 56 55 +4 47 48 57 56 +4 48 49 58 57 +4 49 50 59 58 +4 50 51 60 59 +4 51 52 61 60 +4 52 53 62 61 +4 54 55 64 63 +4 55 56 65 64 +4 56 57 66 65 +4 57 58 67 66 +4 58 59 68 67 +4 59 60 69 68 +4 60 61 70 69 +4 61 62 71 70 +4 63 64 73 72 +4 64 65 74 73 +4 65 66 75 74 +4 66 67 76 75 +4 67 68 77 76 +4 68 69 78 77 +4 69 70 79 78 +4 70 71 80 79 diff --git a/lab3/Lab3 simple grids/plane-2x2-A.grid2D b/lab3/Lab3 simple grids/plane-2x2-A.grid2D new file mode 100644 index 0000000..3615330 --- /dev/null +++ b/lab3/Lab3 simple grids/plane-2x2-A.grid2D @@ -0,0 +1,8 @@ +GRID2D_OF_POINTS3D +# Dimensions +2 2 +0 2 0 +2 2 0 +0 0 2 +2 0 2 + diff --git a/lab3/Lab3 simple grids/plane-2x2-A.off b/lab3/Lab3 simple grids/plane-2x2-A.off new file mode 100644 index 0000000..4bdb70e --- /dev/null +++ b/lab3/Lab3 simple grids/plane-2x2-A.off @@ -0,0 +1,9 @@ +OFF +# File created from 2D grid of points. +4 1 0 +0.0 2.0 0.0 +2.0 2.0 0.0 +0.0 0.0 2.0 +2.0 0.0 2.0 + +4 0 1 3 2 diff --git a/lab3/Makefile b/lab3/Makefile new file mode 100644 index 0000000..3dc3637 --- /dev/null +++ b/lab3/Makefile @@ -0,0 +1,29 @@ +CXX = g++ +CXXFLAGS = -Wall -O2 + +TARGETS = print_grid2D grid2off test_grid2DIO subdivide_grid + +all: $(TARGETS) + +print_grid2D: print_grid2D.cpp grid2DIO.o + $(CXX) $(CXXFLAGS) -o $@ $^ + +grid2off: grid2off.cpp grid2DIO.o writeGrid2DOFF.o + $(CXX) $(CXXFLAGS) -o $@ $^ + +test_grid2DIO: test_grid2DIO.cpp grid2DIO.o + $(CXX) $(CXXFLAGS) -o $@ $^ + +subdivide_grid: subdivide_grid.cpp grid2DIO.o writeGrid2DOFF.o + $(CXX) $(CXXFLAGS) -o $@ $^ + +grid2DIO.o: grid2DIO.cpp grid2DIO.h grid2DPoints3D.h + $(CXX) $(CXXFLAGS) -c -o $@ $< + +writeGrid2DOFF.o: writeGrid2DOFF.cpp writeGrid2DOFF.h grid2DPoints3D.h + $(CXX) $(CXXFLAGS) -c -o $@ $< + +clean: + rm -f *.o $(TARGETS) + +.PHONY: all clean diff --git a/lab3/README.md b/lab3/README.md new file mode 100644 index 0000000..237e8b1 --- /dev/null +++ b/lab3/README.md @@ -0,0 +1,73 @@ +# Lab 3: Stencil-Based Grid Subdivision + +## How to Build + +### Windows + +Use Visual Studio (Developer Command Prompt) to compile the code. + +```bat +.\make.bat +``` + +> **Note:** `cl` is only available in the Developer Command Prompt, change the path of `VsDevCmd.bat` in `make.bat` first. + +### Linux / macOS — GCC via Makefile + +``` +make +``` + +This compiles all targets including `subdivide_grid`. + +## How to Run + +### Windows + +```bat +subdivide_grid.exe {num_iter} {input_file} +``` + +### Linux / macOS + +```bash +./subdivide_grid {num_iter} {input_file} +``` + +- `{num_iter}`: integer number of subdivision iterations (>= 0) +- `{input_file}`: a `.grid2D` file + +The output file is written to the same directory as the input, with the suffix +`-subdiv.grid2D` appended (replacing the `.grid2D` extension). + +### Optional `-off` flag + +```bash +./subdivide_grid -off {num_iter} {input_file} +``` + +With `-off`, the program additionally writes a Geomview `.off` file named +`{basename}-subdiv.off`. + +### Examples + +```bash +./subdivide_grid 1 "Lab3 simple grids/grid2D-2x3-A.grid2D" +./subdivide_grid 3 "Lab3 grids/wave-A.grid2D" +./subdivide_grid -off 3 "Lab3 grids/sphere-A.grid2D" +``` + +## Visualization + +Convert a `.grid2D` file to Geomview `.off` format: + +```bash +./grid2off {input.grid2D} +``` + +## AI Tools Used + +**GitHub Copilot** (via VS Code) was used for: + +- Auto generating `Makefile` and this `README.md`. + diff --git a/lab3/grid2DIO.cpp b/lab3/grid2DIO.cpp new file mode 100644 index 0000000..00b2f42 --- /dev/null +++ b/lab3/grid2DIO.cpp @@ -0,0 +1,224 @@ +// Functions to read/write a 2D grid of 3D points. + +#include "grid2DIO.h" + +#include +#include +#include +#include +#include + +const std::string GRID2D_POINTS3D_HEADER = "GRID2D_OF_POINTS3D"; + + +// ******************************************************************************** +// Internal helpers +// ******************************************************************************** + +/// Trim leading and trailing whitespace from s. +static std::string Trim(const std::string& s) { + const std::string whitespace = " \t\r\n"; + size_t start = s.find_first_not_of(whitespace); + if (start == std::string::npos) { return ""; } + size_t end = s.find_last_not_of(whitespace); + return s.substr(start, end - start + 1); +} + + +/// Throw a read error with two descriptive lines. +static void RaiseReadErrorII(int iline, + const std::string& error_line1, + const std::string& error_line2) +{ + throw std::runtime_error( + "Error reading line " + std::to_string(iline) + ": " + + error_line1 + "\n " + error_line2); +} + + +// ******************************************************************************** +// Read/Write helper predicates +// ******************************************************************************** + +bool IsHeader(const std::string& line) { + return Trim(line) == GRID2D_POINTS3D_HEADER; +} + + +bool IsCommentOrBlankLine(const std::string& line) { + std::string s = Trim(line); + if (s.empty()) { return true; } + if (s[0] == '#') { return true; } + return false; +} + + +// ******************************************************************************** +// Read functions +// ******************************************************************************** + +void ReadGrid2DPoints3D(std::istream& infile, GRID2D_POINTS3D& grid2D) { + // Read coordinates of point [i,j] in grid. + int i = 0, j = 0, iline = 1; + std::string line; + + while (std::getline(infile, line)) { + std::string trimmed = Trim(line); + + if (iline == 1) { + if (!IsHeader(trimmed)) { + RaiseReadErrorII(1, + "Incorrect file header.", + "Expected header: " + GRID2D_POINTS3D_HEADER); + } + } + else if (!IsCommentOrBlankLine(trimmed)) { + if (!grid2D.AreDimensionsSet()) { + std::istringstream iss(trimmed); + int n, m; + if (!(iss >> n >> m)) { + RaiseReadErrorII(iline, + "Incorrect grid dimensions.", + "Expecting two integers for grid dimensions."); + } + std::string extra; + if (iss >> extra) { + RaiseReadErrorII(iline, + "Incorrect grid dimensions.", + "Expecting two integers for grid dimensions."); + } + grid2D.SetDimensions(n, m); + } + else { + std::istringstream iss(trimmed); + double x, y, z; + if (!(iss >> x >> y >> z)) { + RaiseReadErrorII(iline, + "Error reading point coordinates.", + "Expecting three float coordinates for each point."); + } + + if (i >= grid2D.NumRows()) { + std::cerr << "Warning: More than " + << grid2D.NumRows() << " x " + << grid2D.NumCols() + << " points in file.\n"; + std::cerr << "Skipping remaining points after line " + << iline << ".\n"; + break; + } + + grid2D.SetCoord(i, j, x, y, z); + + j++; + if (j >= grid2D.NumCols()) { + j = 0; + i++; + } + } + } + + iline++; + } + + if (i < grid2D.NumRows()) { + throw std::runtime_error( + "Too few points in file. Expected coordinates of " + + std::to_string(grid2D.NumPoints()) + " points.\n" + + " Found coordinates of " + + std::to_string(i * grid2D.NumCols() + j) + " points.\n" + + " First missing point: [" + + std::to_string(i) + "," + std::to_string(j) + "]."); + } +} + + +void OpenReadGrid2DPoints3D(const std::string& filename, + GRID2D_POINTS3D& grid2D) +{ + try { + std::ifstream infile(filename); + if (!infile.is_open()) { + std::cerr << "Input file " << filename << " not found.\n"; + throw std::runtime_error( + "Input file " + filename + " not found."); + } + ReadGrid2DPoints3D(infile, grid2D); + } + catch (const std::out_of_range& e) { + std::cerr << "Error reading file " << filename + << ".\n " << e.what() << "\n"; + throw; + } + catch (const std::runtime_error& e) { + std::cerr << "Error reading file " << filename + << ".\n " << e.what() << "\n"; + throw; + } + catch (const std::exception& e) { + std::cerr << "Error reading file " << filename + << ".\n " << e.what() << "\n"; + throw; + } +} + + +// ******************************************************************************** +// Write functions +// ******************************************************************************** + +void WriteGrid2DPoints3D(std::ostream& outfile, + const GRID2D_POINTS3D& grid2D, + const std::vector& comment_list) +{ + // Write header + outfile << GRID2D_POINTS3D_HEADER << "\n"; + + // Write dimensions + outfile << grid2D.NumRows() << " " << grid2D.NumCols() << "\n"; + + // Write comments + for (const auto& comment : comment_list) { + outfile << "# " << comment << "\n"; + } + + // Write point coordinates + for (int irow = 0; irow < grid2D.NumRows(); irow++) { + for (int icol = 0; icol < grid2D.NumCols(); icol++) { + auto c = grid2D.Coord(irow, icol); + outfile << c[0] << " " << c[1] << " " << c[2] << "\n"; + } + } +} + + +void OpenWriteGrid2DPoints3D(const std::string& filename, + const GRID2D_POINTS3D& grid2D, + const std::vector& comment_list) +{ + try { + std::ofstream outfile(filename); + if (!outfile.is_open()) { + std::cerr << "Cannot open file " << filename + << " for writing.\n"; + throw std::runtime_error( + "Cannot open file " + filename + " for writing."); + } + WriteGrid2DPoints3D(outfile, grid2D, comment_list); + } + catch (const std::out_of_range& e) { + std::cerr << "Error writing file " << filename + << ".\n " << e.what() << "\n"; + throw; + } + catch (const std::runtime_error& e) { + std::cerr << "Error writing file " << filename + << ".\n " << e.what() << "\n"; + throw; + } + catch (const std::exception& e) { + std::cerr << "Error writing file " << filename + << ".\n " << e.what() << "\n"; + throw; + } +} diff --git a/lab3/grid2DIO.h b/lab3/grid2DIO.h new file mode 100644 index 0000000..b5dc5aa --- /dev/null +++ b/lab3/grid2DIO.h @@ -0,0 +1,38 @@ +// Functions to read/write a 2D grid of 3D points. + +#ifndef GRID2DIO_H +#define GRID2DIO_H + +#include +#include +#include + +#include "grid2DPoints3D.h" + +// Header string used in grid2D files. +extern const std::string GRID2D_POINTS3D_HEADER; + +/// Return true if line equals the grid2D file header. +bool IsHeader(const std::string& line); + +/// Return true if line is a comment line (starts with '#') or blank. +bool IsCommentOrBlankLine(const std::string& line); + +/// Read grid2D from an open input stream. +void ReadGrid2DPoints3D(std::istream& infile, GRID2D_POINTS3D& grid2D); + +/// Open filename and read grid2D from it. +void OpenReadGrid2DPoints3D(const std::string& filename, + GRID2D_POINTS3D& grid2D); + +/// Write grid2D to an open output stream. +void WriteGrid2DPoints3D(std::ostream& outfile, + const GRID2D_POINTS3D& grid2D, + const std::vector& comment_list = {}); + +/// Open filename and write grid2D to it. +void OpenWriteGrid2DPoints3D(const std::string& filename, + const GRID2D_POINTS3D& grid2D, + const std::vector& comment_list = {}); + +#endif // GRID2DIO_H diff --git a/lab3/grid2DPoints3D.h b/lab3/grid2DPoints3D.h new file mode 100644 index 0000000..bb74884 --- /dev/null +++ b/lab3/grid2DPoints3D.h @@ -0,0 +1,136 @@ +// Class representing 2D grid of points in 3D. + +#ifndef GRID2D_POINTS3D_H +#define GRID2D_POINTS3D_H + +#include +#include +#include +#include +#include + + +// ******************************************************************************** +// Class GRID2D_POINTS3D +// ******************************************************************************** + +/// A class to store a 2D grid of 3D points. +class GRID2D_POINTS3D { + +public: + + static const int DIM3 = 3; + + int num_rows; + int num_cols; + + /// coord[i][j] = {x, y, z} for grid point at row i, column j. + std::vector>> coord; + + bool are_dimensions_set; + + + GRID2D_POINTS3D() : + num_rows(0), num_cols(0), are_dimensions_set(false) {} + + + void SetDimensions(int n, int m) { + num_rows = n; + num_cols = m; + coord.assign(n, std::vector>( + m, {0.0, 0.0, 0.0})); + are_dimensions_set = true; + } + + bool AreDimensionsSet() const { + return are_dimensions_set; + } + + int NumRows() const { return num_rows; } + + int NumCols() const { return num_cols; } + + int NumPoints() const { return num_rows * num_cols; } + + int NumQuadrilaterals() const { + if (num_rows < 2 || num_cols < 2) { return 0; } + return (num_rows - 1) * (num_cols - 1); + } + + int PointDimension() const { return DIM3; } + + /// Index of point (irow, icol) in a flat array. + /// k'th point in array coord has index (k-1). + int PointIndex(int irow, int icol) const { + return irow * NumCols() + icol; + } + + /// Return false and error message if (index < 0) or (index >= iupper). + std::pair CheckIndex( + int index, int iupper, + const std::string& index_name) const + { + if (index < 0) { + return {false, + "Illegal negative " + index_name + " index " + + std::to_string(index) + "."}; + } + + if (index >= iupper) { + std::string name = index_name; + name[0] = static_cast(toupper( + static_cast(name[0]))); + return {false, + name + " " + std::to_string(index) + + " is out of bounds.\n" + + " " + name + " index should be less than " + + std::to_string(iupper) + "."}; + } + + return {true, ""}; + } + + /// Raise std::out_of_range if (index < 0) or (index >= iupper). + void CheckIndexRaiseError( + int index, int iupper, + const std::string& index_name, + const std::string& function_name) const + { + auto result = CheckIndex(index, iupper, index_name); + if (!result.first) { + throw std::out_of_range( + "Error in GRID2D_POINTS3D::" + function_name + + ". " + result.second); + } + } + + /// Return coordinates of grid point [irow][jcol]. + /// Precondition: [irow][jcol] are in appropriate bounds. + std::array Coord(int irow, int jcol) const { + return coord[irow][jcol]; + } + + /// Set coord[irow][jcol] to (x, y, z). + void SetCoord(int irow, int jcol, double x, double y, double z) { + CheckIndexRaiseError(irow, NumRows(), "Row", "SetCoord"); + CheckIndexRaiseError(jcol, NumCols(), "Column", "SetCoord"); + coord[irow][jcol] = {x, y, z}; + } + + /// Print grid in formatted mode. Mainly for debugging. + void FormattedPrint() const { + std::cout << "Grid dimensions: " << num_rows << " x " + << num_cols << "\n"; + std::cout << "Point Coordinates:\n"; + for (int i = 0; i < num_rows; i++) { + for (int j = 0; j < num_cols; j++) { + std::cout << " [" << i << "][" << j << "]: " + << coord[i][j][0] << " " + << coord[i][j][1] << " " + << coord[i][j][2] << "\n"; + } + } + } +}; + +#endif // GRID2D_POINTS3D_H diff --git a/lab3/grid2off.cpp b/lab3/grid2off.cpp new file mode 100644 index 0000000..fc681e6 --- /dev/null +++ b/lab3/grid2off.cpp @@ -0,0 +1,76 @@ +// Convert 2D grid of points to Geomview .off file of quadrilaterals. + +#include +#include + +#include "grid2DPoints3D.h" +#include "grid2DIO.h" +#include "writeGrid2DOFF.h" + + +// ********************* Functions ************************************ + +/// Replace the file extension of infilename with ".off". +std::string CreateOutFilename(const std::string& infilename) { + size_t dot_pos = infilename.rfind('.'); + std::string basename; + if (dot_pos != std::string::npos) { + basename = infilename.substr(0, dot_pos); + } + else { + basename = infilename; + } + return basename + ".off"; +} + + +void UsageMsg(const std::string& command_name) { + std::cerr << "Usage: " << command_name + << " {input filename} [{output filename}]\n"; +} + + +// ********************* Main ***************************************** + +int main(int argc, char* argv[]) { + + if (argc == 1) { + UsageMsg(argv[0]); + return 0; + } + + std::string infilename = argv[1]; + GRID2D_POINTS3D grid2D; + + try { + OpenReadGrid2DPoints3D(infilename, grid2D); + } + catch (const std::exception&) { + std::cerr << "Exiting...\n"; + return -1; + } + + std::string outfilename; + if (argc < 3) { + outfilename = CreateOutFilename(infilename); + } + else { + outfilename = argv[2]; + } + + WRITE_GRID2D_OFF writeOFF; + std::vector comments_list = + {"File created from 2D grid of points."}; + + try { + std::cout << "Writing file " << outfilename << ".\n"; + writeOFF.OpenAndWrite(outfilename, grid2D, comments_list); + } + catch (const std::exception& e) { + std::cerr << e.what() << "\n"; + std::cerr << "Exiting...\n"; + return -1; + } + + return 0; +} diff --git a/lab3/make.bat b/lab3/make.bat new file mode 100644 index 0000000..f9aab30 --- /dev/null +++ b/lab3/make.bat @@ -0,0 +1,38 @@ +@echo off +setlocal + +set "CALLER_DIR=%cd%" +set "SCRIPT_DIR=%~dp0" +set "VSDEVCMD=C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\Tools\VsDevCmd.bat" + +if /I "%~1"=="clean" goto clean + +if not exist "%VSDEVCMD%" ( + echo VsDevCmd.bat not found: + echo %VSDEVCMD% + exit /b 1 +) + +call "%VSDEVCMD%" +if errorlevel 1 exit /b 1 + +cd /d "%SCRIPT_DIR%" + +cl /EHsc /W3 /O2 /Fe:subdivide_grid.exe subdivide_grid.cpp grid2DIO.cpp writeGrid2DOFF.cpp +cl /EHsc /W3 /O2 /Fe:grid2off.exe grid2off.cpp grid2DIO.cpp writeGrid2DOFF.cpp +cl /EHsc /W3 /O2 /Fe:print_grid2D.exe print_grid2D.cpp grid2DIO.cpp +cl /EHsc /W3 /O2 /Fe:test_grid2DIO.exe test_grid2DIO.cpp grid2DIO.cpp + +cd /d "%CALLER_DIR%" +endlocal +exit /b 0 + +:clean +cd /d "%SCRIPT_DIR%" +del /q subdivide_grid.exe subdivide_grid.obj grid2DIO.obj writeGrid2DOFF.obj subdivide_grid.pdb vc140.pdb vc140.idb subdivide_grid.ilk 2>nul +del /q grid2off.exe grid2off.obj 2>nul +del /q print_grid2D.exe print_grid2D.obj 2>nul +del /q test_grid2DIO.exe test_grid2DIO.obj 2>nul +cd /d "%CALLER_DIR%" +endlocal +exit /b 0 diff --git a/lab3/print_grid2D.cpp b/lab3/print_grid2D.cpp new file mode 100644 index 0000000..c8bce8c --- /dev/null +++ b/lab3/print_grid2D.cpp @@ -0,0 +1,40 @@ +// Read and print a file with format GRID2D_POINTS3D. +// Mainly for testing. + +#include +#include + +#include "grid2DPoints3D.h" +#include "grid2DIO.h" + + +// ********************* Functions ************************************ + +void UsageMsg(const std::string& command_name) { + std::cerr << "Usage: " << command_name << " {filename}\n"; +} + + +// ********************* Main ***************************************** + +int main(int argc, char* argv[]) { + + if (argc == 1) { + UsageMsg(argv[0]); + return 0; + } + + GRID2D_POINTS3D grid2D; + + try { + OpenReadGrid2DPoints3D(argv[1], grid2D); + } + catch (const std::exception&) { + std::cerr << "Exiting...\n"; + return -1; + } + + grid2D.FormattedPrint(); + + return 0; +} diff --git a/lab3/subdivide_grid.cpp b/lab3/subdivide_grid.cpp new file mode 100644 index 0000000..4df4079 --- /dev/null +++ b/lab3/subdivide_grid.cpp @@ -0,0 +1,256 @@ +// Subdivide a 2D grid of 3D points using stencil-based subdivision. +// Usage: subdivide_grid {num_iter} {input_file} + +#include +#include +#include +#include + +#include "grid2DPoints3D.h" +#include "grid2DIO.h" +#include "writeGrid2DOFF.h" + + +// helper +// return a * p (scalar multiply). +static std::array Scale(double a, const std::array& p) { + return {a * p[0], a * p[1], a * p[2]}; +} +// return p + q (component-wise add). +static std::array Add(const std::array& p, + const std::array& q) +{ + return {p[0] + q[0], p[1] + q[1], p[2] + q[2]}; +} + +// main subdivision function + +void SubdivideI_Grid2D(const GRID2D_POINTS3D& grid2D, + GRID2D_POINTS3D& new_grid2D) +{ + const int n = grid2D.NumRows(); + const int m = grid2D.NumCols(); + const int new_n = 2 * n - 1; + const int new_m = 2 * m - 1; + + new_grid2D.SetDimensions(new_n, new_m); + + auto P = [&](int i, int j) { return grid2D.Coord(i, j); }; + + auto Set = [&](int I, int J, const std::array& v) { + new_grid2D.SetCoord(I, J, v[0], v[1], v[2]); + }; + + // (a) Face centers: new vertex (2i+1, 2j+1) + for (int i = 0; i < n - 1; i++) { + for (int j = 0; j < m - 1; j++) { + auto v = Scale(0.25, Add(Add(P(i, j), P(i, j + 1)), + Add(P(i + 1, j), P(i + 1, j + 1)))); + Set(2 * i + 1, 2 * j + 1, v); + } + } + + // (b) Horizontal edge midpoints: new vertex (2i, 2j+1) + for (int i = 0; i < n; i++) { + for (int j = 0; j < m - 1; j++) { + std::array v; + if (i == 0 || i == n - 1) { + // midpoint of edge endpoints. + v = Scale(0.5, Add(P(i, j), P(i, j + 1))); + } + else { + v = Add(Scale(6.0 / 16.0, Add(P(i, j), P(i, j + 1))), + Scale(1.0 / 16.0, Add(Add(P(i - 1, j), P(i - 1, j + 1)), + Add(P(i + 1, j), P(i + 1, j + 1))))); + } + Set(2 * i, 2 * j + 1, v); + } + } + + // (c) Vertical edge midpoints: new vertex (2i+1, 2j) + for (int i = 0; i < n - 1; i++) { + for (int j = 0; j < m; j++) { + std::array v; + if (j == 0 || j == m - 1) { + // midpoint of edge endpoints. + v = Scale(0.5, Add(P(i, j), P(i + 1, j))); + } + else { + v = Add(Scale(6.0 / 16.0, Add(P(i, j), P(i + 1, j))), + Scale(1.0 / 16.0, Add(Add(P(i, j - 1), P(i, j + 1)), + Add(P(i + 1, j - 1), P(i + 1, j + 1))))); + } + Set(2 * i + 1, 2 * j, v); + } + } + + // (d/e.iii/e.iv/e.v) Original vertices: new vertex (2i, 2j) + for (int i = 0; i < n; i++) { + for (int j = 0; j < m; j++) { + const bool on_top = (i == 0); + const bool on_bottom = (i == n - 1); + const bool on_left = (j == 0); + const bool on_right = (j == m - 1); + + std::array v; + + if ((on_top || on_bottom) && (on_left || on_right)) { + // corner (e.iii): copy directly. + v = P(i, j); + } + else if (on_left || on_right) { + // left/right boundary, non-corner (e.iv): (1/8) row-adjacent, (3/4) center. + v = Add(Scale(3.0 / 4.0, P(i, j)), + Scale(1.0 / 8.0, Add(P(i - 1, j), P(i + 1, j)))); + } + else if (on_top || on_bottom) { + // top/bottom boundary, non-corner (e.v): (1/8) column-adjacent, (3/4) center. + v = Add(Scale(3.0 / 4.0, P(i, j)), + Scale(1.0 / 8.0, Add(P(i, j - 1), P(i, j + 1)))); + } + else { + // interior vertex (d): 9/16 center, 3/32 edge neighbors, 1/64 diagonal neighbors. + v = Scale(9.0 / 16.0, P(i, j)); + v = Add(v, Scale(3.0 / 32.0, Add(Add(P(i - 1, j), P(i + 1, j)), + Add(P(i, j - 1), P(i, j + 1))))); + v = Add(v, Scale(1.0 / 64.0, Add(Add(P(i - 1, j - 1), P(i - 1, j + 1)), + Add(P(i + 1, j - 1), P(i + 1, j + 1))))); + } + Set(2 * i, 2 * j, v); + } + } +} + + +// perform num_iter subdivision by calling SubdivideI_Grid2D repeatedly +// num_iter == 0 -> a copy of grid2D +void SubdivideMulti_Grid2D(const GRID2D_POINTS3D& grid2D, + GRID2D_POINTS3D& result, + int num_iter) +{ + if (num_iter == 0) { + result = grid2D; + return; + } + + GRID2D_POINTS3D current = grid2D; + GRID2D_POINTS3D next; + + for (int iter = 0; iter < num_iter; iter++) { + SubdivideI_Grid2D(current, next); + current = next; + } + + result = current; +} + + +// io +/// construct output name +static std::string CreateOutputFilename(const std::string& infilename) { + const std::string grid2d_ext = ".grid2D"; + if (infilename.size() > grid2d_ext.size() && + infilename.substr(infilename.size() - grid2d_ext.size()) == grid2d_ext) + { + return infilename.substr(0, infilename.size() - grid2d_ext.size()) + + "-subdiv.grid2D"; + } + return infilename + "-subdiv.grid2D"; +} +static std::string CreateOffOutputFilename(const std::string& infilename) { + const std::string grid2d_ext = ".grid2D"; + if (infilename.size() > grid2d_ext.size() && + infilename.substr(infilename.size() - grid2d_ext.size()) == grid2d_ext) + { + return infilename.substr(0, infilename.size() - grid2d_ext.size()) + + "-subdiv.off"; + } + return infilename + "-subdiv.off"; +} + +void UsageMsg(const std::string& command_name) { + std::cerr << "Usage: " << command_name + << " [-off] {num_iter} {input_file}\n"; +} + +// Main +int main(int argc, char* argv[]) { + + // Parse optional -off flag. + bool write_off = false; + int arg_start = 1; + if (argc > 1 && std::string(argv[1]) == "-off") { + write_off = true; + arg_start = 2; + } + + if (argc - arg_start != 2) { + UsageMsg(argv[0]); + return 0; + } + + int num_iter; + try { + num_iter = std::stoi(argv[arg_start]); + } + catch (const std::exception&) { + std::cerr << "Error: num_iter must be an integer.\n"; + UsageMsg(argv[0]); + return -1; + } + + if (num_iter < 0) { + std::cerr << "Error: num_iter must be non-negative.\n"; + return -1; + } + + const std::string infilename = argv[arg_start + 1]; + GRID2D_POINTS3D grid2D; + + try { + OpenReadGrid2DPoints3D(infilename, grid2D); + } + catch (const std::exception&) { + std::cerr << "Exiting...\n"; + return -1; + } + + GRID2D_POINTS3D result; + SubdivideMulti_Grid2D(grid2D, result, num_iter); + + // Write grid2D output. + const std::string outfilename = CreateOutputFilename(infilename); + const std::vector comments = { + "Subdivided grid. Iterations: " + std::to_string(num_iter), + "Input: " + infilename + }; + + try { + std::cout << "Writing " << outfilename << ".\n"; + OpenWriteGrid2DPoints3D(outfilename, result, comments); + } + catch (const std::exception&) { + std::cerr << "Exiting...\n"; + return -1; + } + + // Optionally write .off output. + if (write_off) { + const std::string off_outfilename = CreateOffOutputFilename(infilename); + WRITE_GRID2D_OFF writeOFF; + const std::vector off_comments = { + "Subdivided grid in OFF format. Iterations: " + std::to_string(num_iter), + "Input: " + infilename + }; + try { + std::cout << "Writing " << off_outfilename << ".\n"; + writeOFF.OpenAndWrite(off_outfilename, result, off_comments); + } + catch (const std::exception&) { + std::cerr << "Exiting...\n"; + return -1; + } + } + + return 0; +} diff --git a/lab3/test_grid2DIO.cpp b/lab3/test_grid2DIO.cpp new file mode 100644 index 0000000..27251fe --- /dev/null +++ b/lab3/test_grid2DIO.cpp @@ -0,0 +1,53 @@ +// Test read and write functions in grid2DIO.py. +// Mainly for an example of reading and writing a GRID2D_POINTS3D array + +#include +#include + +#include "grid2DPoints3D.h" +#include "grid2DIO.h" + + +// ********************* Functions ************************************ + +void UsageMsg(const std::string& command_name) { + std::cerr << "Usage: " << command_name << " {infile} {outfile}\n"; +} + + +// ********************* Main ***************************************** + +int main(int argc, char* argv[]) { + + using namespace std; + + if (argc != 3) { + UsageMsg(argv[0]); + return 0; + } + + GRID2D_POINTS3D grid2D; + + try { + cout << "Reading " << argv[1] << "." << endl; + OpenReadGrid2DPoints3D(argv[1], grid2D); + } + catch (const exception&) { + cerr << "Exiting...\n"; + return -1; + } + + try { + cout << "Copying to file " << argv[2] << "."; + vector comment_list; + string s = string("Copy of ") + argv[1] + "."; + comment_list.push_back(s); + OpenWriteGrid2DPoints3D(argv[2], grid2D, comment_list); + } + catch (const exception&) { + cerr << "Exiting...\n"; + return -1; + } + + return 0; +} diff --git a/lab3/writeGrid2DOFF.cpp b/lab3/writeGrid2DOFF.cpp new file mode 100644 index 0000000..2980357 --- /dev/null +++ b/lab3/writeGrid2DOFF.cpp @@ -0,0 +1,107 @@ +// Functions to write grid2DPoints3D as a Geomview .off file. + +#include "writeGrid2DOFF.h" + +#include +#include +#include + + +void WRITE_GRID2D_OFF::WriteHeader(std::ostream& file) const { + file << Header() << "\n"; +} + + +void WRITE_GRID2D_OFF::WriteComment(std::ostream& file, + const std::string& msg) const +{ + file << "# " << msg << "\n"; +} + + +void WRITE_GRID2D_OFF::WriteNumElements(std::ostream& file, + const GRID2D_POINTS3D& grid2D) const +{ + file << grid2D.NumPoints() << " " + << grid2D.NumQuadrilaterals() << " 0\n"; +} + + +void WRITE_GRID2D_OFF::WritePointCoordinates(std::ostream& file, + const GRID2D_POINTS3D& grid2D) const +{ + for (int irow = 0; irow < grid2D.NumRows(); irow++) { + for (int jcol = 0; jcol < grid2D.NumCols(); jcol++) { + auto c = grid2D.Coord(irow, jcol); + file << c[0] << " " << c[1] << " " << c[2] << "\n"; + } + } +} + + +void WRITE_GRID2D_OFF::WriteQuadrilaterals(std::ostream& file, + const GRID2D_POINTS3D& grid2D) const +{ + if (grid2D.NumRows() < 2 || grid2D.NumCols() < 2) { + // Nothing to write. + return; + } + + for (int irow = 0; irow < grid2D.NumRows() - 1; irow++) { + for (int icol = 0; icol < grid2D.NumCols() - 1; icol++) { + int iv0 = grid2D.PointIndex(irow, icol); + int iv1 = iv0 + 1; + int iv2 = iv1 + grid2D.NumCols(); + int iv3 = iv0 + grid2D.NumCols(); + file << "4 " << iv0 << " " << iv1 + << " " << iv2 << " " << iv3 << "\n"; + } + } +} + + +void WRITE_GRID2D_OFF::Write(std::ostream& file, + const GRID2D_POINTS3D& grid2D, + const std::vector& comment_list) const +{ + WriteHeader(file); + for (const auto& comment : comment_list) { + WriteComment(file, comment); + } + WriteNumElements(file, grid2D); + WritePointCoordinates(file, grid2D); + file << "\n"; + WriteQuadrilaterals(file, grid2D); +} + + +void WRITE_GRID2D_OFF::OpenAndWrite( + const std::string& filename, + const GRID2D_POINTS3D& grid2D, + const std::vector& comment_list) const +{ + try { + std::ofstream outfile(filename); + if (!outfile.is_open()) { + std::cerr << "Cannot open output file " << filename << ".\n"; + throw std::runtime_error( + "Cannot open output file " + filename + " for writing."); + } + Write(outfile, grid2D, comment_list); + } + catch (const std::out_of_range& e) { + std::cerr << "Error writing file " << filename + << ".\n " << e.what() << "\n"; + throw; + } + catch (const std::runtime_error& e) { + std::cerr << "Error writing file " << filename + << ".\n " << e.what() << "\n"; + throw; + } + catch (const std::exception& e) { + std::cerr << "Error writing file " << filename + << ".\n " << e.what() << "\n"; + throw; + } +} diff --git a/lab3/writeGrid2DOFF.h b/lab3/writeGrid2DOFF.h new file mode 100644 index 0000000..695b653 --- /dev/null +++ b/lab3/writeGrid2DOFF.h @@ -0,0 +1,57 @@ +// Functions to write grid2DPoints3D as a Geomview .off file. + +#ifndef WRITE_GRID2D_OFF_H +#define WRITE_GRID2D_OFF_H + +#include +#include +#include + +#include "grid2DPoints3D.h" + + +// ******************************************************************************** +// Class WRITE_GRID2D_OFF +// ******************************************************************************** + +/// A class for writing GRID2D_POINTS3D as a Geomview .off file. +class WRITE_GRID2D_OFF { + +public: + + const std::string OFF_HEADER = "OFF"; + + WRITE_GRID2D_OFF() {} + + std::string Header() const { return OFF_HEADER; } + + /// Write the OFF file header line. + void WriteHeader(std::ostream& file) const; + + /// Write a comment line. + void WriteComment(std::ostream& file, const std::string& msg) const; + + /// Write the counts: num_points, num_quads, 0 (edges). + void WriteNumElements(std::ostream& file, + const GRID2D_POINTS3D& grid2D) const; + + /// Write the coordinates of all grid points. + void WritePointCoordinates(std::ostream& file, + const GRID2D_POINTS3D& grid2D) const; + + /// Write the grid quadrilaterals. + void WriteQuadrilaterals(std::ostream& file, + const GRID2D_POINTS3D& grid2D) const; + + /// Write grid2D to an open Geomview .off file stream. + void Write(std::ostream& file, + const GRID2D_POINTS3D& grid2D, + const std::vector& comment_list) const; + + /// Open filename and write grid2D in Geomview .off format. + void OpenAndWrite(const std::string& filename, + const GRID2D_POINTS3D& grid2D, + const std::vector& comment_list) const; +}; + +#endif // WRITE_GRID2D_OFF_H