tmp update
This commit is contained in:
parent
47dd2c41b8
commit
0f94807644
14
demo.cpp
14
demo.cpp
@ -6,10 +6,10 @@
|
||||
int main(int argc, char const *argv[])
|
||||
{
|
||||
// read dem grid
|
||||
std::vector<double> topo(1002001);
|
||||
std::vector<double> topo(10201);
|
||||
|
||||
std::ifstream infile("topo2.txt");
|
||||
for (int i = 0; i < 1002001; ++i)
|
||||
std::ifstream infile("topo.txt");
|
||||
for (int i = 0; i < 10201; ++i)
|
||||
{
|
||||
infile >> topo[i];
|
||||
}
|
||||
@ -18,10 +18,10 @@ int main(int argc, char const *argv[])
|
||||
std::vector<double> err_records;
|
||||
std::vector<vertex2dc*> tin_vert;
|
||||
std::vector<triangle*> tin_ele;
|
||||
dem2tin(topo, 0, 1000, 0, 1000, 1, 1, tin_vert, tin_ele, 5.0, &err_records);
|
||||
dem2tin(topo, 0, 1000, 0, 1000, 10, 10, tin_vert, tin_ele, 1.0, &err_records);
|
||||
|
||||
// Write a log file
|
||||
std::ofstream logfile("topo2_TIN.log");
|
||||
std::ofstream logfile("topo_TIN.log");
|
||||
logfile << "# Insertion Maxi-Error\n";
|
||||
for (int i = 0; i < err_records.size(); ++i)
|
||||
{
|
||||
@ -30,7 +30,7 @@ int main(int argc, char const *argv[])
|
||||
logfile.close();
|
||||
|
||||
// Write a Gmsh's .msh file
|
||||
std::ofstream outfile("topo2_TIN.msh");
|
||||
std::ofstream outfile("topo_TIN.msh");
|
||||
outfile << "$MeshFormat" << std::endl << "2.2 0 8" << std::endl << "$EndMeshFormat "<<std::endl;
|
||||
outfile << "$Nodes" << std::endl << tin_vert.size() << std::endl;
|
||||
for (int i = 0; i < tin_vert.size(); i++)
|
||||
@ -64,7 +64,7 @@ int main(int argc, char const *argv[])
|
||||
outfile.close();
|
||||
|
||||
// write a neighbor file
|
||||
outfile.open("topo2_TIN.neigh");
|
||||
outfile.open("topo_TIN.neigh");
|
||||
outfile << tin_ele.size() << std::endl;
|
||||
for (int i = 0; i < tin_ele.size(); i++)
|
||||
{
|
||||
|
@ -161,7 +161,7 @@ struct triangle
|
||||
* \/
|
||||
* n_id (0, 1 or 2)
|
||||
*
|
||||
* fliped
|
||||
* flipped
|
||||
*
|
||||
* /|\
|
||||
* / | \
|
||||
@ -286,7 +286,7 @@ void make_delaunay(triangle *t)
|
||||
dist = (t->cx - n_vert->x) * (t->cx - n_vert->x) +
|
||||
(t->cy - n_vert->y) * (t->cy - n_vert->y);
|
||||
|
||||
if ((dist - t->cr) < -1.0*ZERO) // need to be flipped
|
||||
if ((dist - t->cr) < -1.0*ZERO) // A very restrict condition. The testing point must be really inside the circumcircle
|
||||
{
|
||||
flip_neighboring_triangles(t, n_tri, n, v);
|
||||
|
||||
@ -452,7 +452,6 @@ void dem2tin(const std::vector<double> &dem, double xmin, double xmax, double ym
|
||||
|
||||
// Prepare the DEM points
|
||||
dem_point *tmp_dem = nullptr;
|
||||
std::vector<dem_point*> cnst_dem;
|
||||
std::vector<dem_point*> dem_grid(xnum*ynum);
|
||||
std::vector<dem_point*>::iterator d_iter;
|
||||
for (int i = 0; i < ynum; ++i)
|
||||
|
@ -1 +0,0 @@
|
||||
# Insertion Maxi-Error
|
@ -1,19 +0,0 @@
|
||||
$MeshFormat
|
||||
2.2 0 8
|
||||
$EndMeshFormat
|
||||
$Nodes
|
||||
0
|
||||
$EndNodes
|
||||
$Elements
|
||||
0
|
||||
$EndElements
|
||||
$NodeData
|
||||
1
|
||||
"Topography (m)"
|
||||
1
|
||||
0
|
||||
3
|
||||
0
|
||||
1
|
||||
0
|
||||
$EndNodeData
|
@ -1 +0,0 @@
|
||||
0
|
@ -1771,10 +1771,10 @@
|
||||
1770 1.27677
|
||||
1771 1.2761
|
||||
1772 1.2757
|
||||
1773 1.2757
|
||||
1774 2.18047
|
||||
1775 1.52615
|
||||
1776 1.4891
|
||||
1773 2.18047
|
||||
1774 1.52615
|
||||
1775 1.4891
|
||||
1776 1.2757
|
||||
1777 1.27485
|
||||
1778 1.27223
|
||||
1779 1.2677
|
||||
|
56
topo_TIN.msh
56
topo_TIN.msh
@ -1778,11 +1778,11 @@ $Nodes
|
||||
1773 920 50 17.9669
|
||||
1774 540 620 75.4846
|
||||
1775 600 290 115.525
|
||||
1776 510 670 64.277
|
||||
1777 460 690 72.1859
|
||||
1778 470 680 72.4438
|
||||
1779 460 680 76.85339999999999
|
||||
1780 470 690 68.5496
|
||||
1776 460 690 72.1859
|
||||
1777 470 680 72.4438
|
||||
1778 460 680 76.85339999999999
|
||||
1779 470 690 68.5496
|
||||
1780 510 670 64.277
|
||||
1781 280 850 45.0064
|
||||
1782 430 300 46.6647
|
||||
1783 640 270 93.31440000000001
|
||||
@ -3959,7 +3959,7 @@ $Elements
|
||||
1700 2 0 403 1292 106
|
||||
1701 2 0 106 1292 1291
|
||||
1702 2 0 202 1292 403
|
||||
1703 2 0 1777 1292 202
|
||||
1703 2 0 1776 1292 202
|
||||
1704 2 0 987 65 1293
|
||||
1705 2 0 1237 279 1293
|
||||
1706 2 0 941 987 1293
|
||||
@ -4202,7 +4202,7 @@ $Elements
|
||||
1943 2 0 1396 1397 1315
|
||||
1944 2 0 913 911 1398
|
||||
1945 2 0 911 912 1401
|
||||
1946 2 0 1400 1778 1399
|
||||
1946 2 0 1400 1777 1399
|
||||
1947 2 0 202 913 1399
|
||||
1948 2 0 1398 1400 1399
|
||||
1949 2 0 911 1401 1398
|
||||
@ -5245,20 +5245,20 @@ $Elements
|
||||
2986 2 0 340 1421 1774
|
||||
2987 2 0 814 203 1775
|
||||
2988 2 0 203 1263 1775
|
||||
2989 2 0 109 1776 774
|
||||
2990 2 0 774 1776 647
|
||||
2991 2 0 647 1776 476
|
||||
2992 2 0 1292 1777 1291
|
||||
2993 2 0 1291 1777 496
|
||||
2994 2 0 1400 607 1778
|
||||
2995 2 0 1399 1779 202
|
||||
2996 2 0 202 1779 1777
|
||||
2997 2 0 1778 1779 1399
|
||||
2998 2 0 1777 1779 1778
|
||||
2999 2 0 496 1780 607
|
||||
3000 2 0 607 1780 1778
|
||||
3001 2 0 1777 1780 496
|
||||
3002 2 0 1778 1780 1777
|
||||
2989 2 0 1292 1776 1291
|
||||
2990 2 0 1291 1776 496
|
||||
2991 2 0 1400 607 1777
|
||||
2992 2 0 1399 1778 202
|
||||
2993 2 0 202 1778 1776
|
||||
2994 2 0 1777 1778 1399
|
||||
2995 2 0 1776 1778 1777
|
||||
2996 2 0 496 1779 607
|
||||
2997 2 0 607 1779 1777
|
||||
2998 2 0 1776 1779 496
|
||||
2999 2 0 1777 1779 1776
|
||||
3000 2 0 109 1780 774
|
||||
3001 2 0 774 1780 647
|
||||
3002 2 0 647 1780 476
|
||||
3003 2 0 2035 1781 126
|
||||
3004 2 0 126 1781 384
|
||||
3005 2 0 1731 1781 385
|
||||
@ -5589,8 +5589,8 @@ $Elements
|
||||
3330 2 0 778 362 1894
|
||||
3331 2 0 1105 1769 1895
|
||||
3332 2 0 1455 1333 1895
|
||||
3333 2 0 109 1896 1776
|
||||
3334 2 0 1776 1896 476
|
||||
3333 2 0 109 1896 1780
|
||||
3334 2 0 1780 1896 476
|
||||
3335 2 0 607 1896 109
|
||||
3336 2 0 476 1896 1401
|
||||
3337 2 0 657 2177 1897
|
||||
@ -8489,11 +8489,11 @@ $NodeData
|
||||
1773 17.9669
|
||||
1774 75.4846
|
||||
1775 115.525
|
||||
1776 64.277
|
||||
1777 72.1859
|
||||
1778 72.4438
|
||||
1779 76.85339999999999
|
||||
1780 68.5496
|
||||
1776 72.1859
|
||||
1777 72.4438
|
||||
1778 76.85339999999999
|
||||
1779 68.5496
|
||||
1780 64.277
|
||||
1781 45.0064
|
||||
1782 46.6647
|
||||
1783 93.31440000000001
|
||||
|
@ -226,7 +226,7 @@
|
||||
225 1384 226 337
|
||||
226 225 227 1601
|
||||
227 226 1745 2801
|
||||
228 2991 229 1958
|
||||
228 3002 229 1958
|
||||
229 228 2152 126
|
||||
230 405 3336 3335
|
||||
231 4239 4238 2672
|
||||
@ -245,7 +245,7 @@
|
||||
244 243 3097 726
|
||||
245 4122 4129 4123
|
||||
246 3233 3874 3414
|
||||
247 649 536 2999
|
||||
247 649 536 2996
|
||||
248 1126 3665 1125
|
||||
249 428 290 1003
|
||||
250 4440 4339 3471
|
||||
@ -403,7 +403,7 @@
|
||||
402 401 404 100
|
||||
403 404 401 464
|
||||
404 402 403 384
|
||||
405 230 2994 1950
|
||||
405 230 2991 1950
|
||||
406 235 407 182
|
||||
407 180 2139 406
|
||||
408 4208 2396 4209
|
||||
@ -437,7 +437,7 @@
|
||||
436 2459 1234 755
|
||||
437 1764 1763 515
|
||||
438 3851 1720 1801
|
||||
439 1410 2990 2082
|
||||
439 1410 3001 2082
|
||||
440 3502 442 2733
|
||||
441 442 3500 1905
|
||||
442 440 441 48
|
||||
@ -1697,11 +1697,11 @@
|
||||
1696 356 1697 382
|
||||
1697 3996 3994 1696
|
||||
1698 1457 738 4
|
||||
1699 1701 2993 2050
|
||||
1699 1701 2990 2050
|
||||
1700 1702 1701 3073
|
||||
1701 1700 2992 1699
|
||||
1701 1700 2989 1699
|
||||
1702 1703 1700 2095
|
||||
1703 2992 1702 2996
|
||||
1703 2989 1702 2993
|
||||
1704 1369 2307 1706
|
||||
1705 1771 1578 2306
|
||||
1706 1045 1704 1578
|
||||
@ -1944,8 +1944,8 @@
|
||||
1943 1942 2020 1940
|
||||
1944 887 1949 881
|
||||
1945 882 883 1949
|
||||
1946 2994 2997 1948
|
||||
1947 886 881 2995
|
||||
1946 2991 2994 1948
|
||||
1947 886 881 2992
|
||||
1948 1950 1946 881
|
||||
1949 1945 1950 1944
|
||||
1950 1948 1949 405
|
||||
@ -2987,20 +2987,20 @@
|
||||
2986 2008 3985 587
|
||||
2987 1462 2988 1439
|
||||
2988 1627 712 2987
|
||||
2989 3333 2990 3258
|
||||
2990 2989 2991 439
|
||||
2991 2990 3334 228
|
||||
2992 1703 2993 1701
|
||||
2993 2992 3001 1699
|
||||
2994 405 3000 1946
|
||||
2995 2997 2996 1947
|
||||
2996 2995 2998 1703
|
||||
2997 2998 2995 1946
|
||||
2998 2996 2997 3002
|
||||
2999 3001 3000 247
|
||||
3000 2999 3002 2994
|
||||
3001 3002 2999 2993
|
||||
3002 3000 3001 2998
|
||||
2989 1703 2990 1701
|
||||
2990 2989 2998 1699
|
||||
2991 405 2997 1946
|
||||
2992 2994 2993 1947
|
||||
2993 2992 2995 1703
|
||||
2994 2995 2992 1946
|
||||
2995 2993 2994 2999
|
||||
2996 2998 2997 247
|
||||
2997 2996 2999 2991
|
||||
2998 2999 2996 2990
|
||||
2999 2997 2998 2995
|
||||
3000 3333 3001 3258
|
||||
3001 3000 3002 439
|
||||
3002 3001 3334 228
|
||||
3003 3753 3004 3754
|
||||
3004 3003 3006 2355
|
||||
3005 3006 3753 2858
|
||||
@ -3256,7 +3256,7 @@
|
||||
3255 3204 3202 654
|
||||
3256 3258 3257 3335
|
||||
3257 3256 3259 649
|
||||
3258 651 3256 2989
|
||||
3258 651 3256 3000
|
||||
3259 3257 651 800
|
||||
3260 2772 2774 3262
|
||||
3261 4292 19 2774
|
||||
@ -3331,8 +3331,8 @@
|
||||
3330 2672 662 3220
|
||||
3331 2973 2972 4186
|
||||
3332 1277 4185 2972
|
||||
3333 3335 3334 2989
|
||||
3334 3333 3336 2991
|
||||
3333 3335 3334 3000
|
||||
3334 3333 3336 3002
|
||||
3335 230 3333 3256
|
||||
3336 3334 230 2153
|
||||
3337 4198 4196 3947
|
||||
|
Loading…
Reference in New Issue
Block a user