initial upload
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -30,3 +30,5 @@
|
|||||||
*.exe
|
*.exe
|
||||||
*.out
|
*.out
|
||||||
*.app
|
*.app
|
||||||
|
|
||||||
|
.DS_Store
|
||||||
232
fmm_2d_grid/fmm_2d_grid.cpp
Normal file
232
fmm_2d_grid/fmm_2d_grid.cpp
Normal file
@@ -0,0 +1,232 @@
|
|||||||
|
#include "iostream"
|
||||||
|
#include "cmath"
|
||||||
|
#include "vector"
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
struct point_2d
|
||||||
|
{
|
||||||
|
double x, y;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct source : point_2d
|
||||||
|
{
|
||||||
|
double rad;
|
||||||
|
double slow;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct grid_point : point_2d
|
||||||
|
{
|
||||||
|
int tag = 0; //0 = far away, 1 = close, 2 = active
|
||||||
|
double time = 1e+30;
|
||||||
|
double syn_time = 1e+30; //synthetic direct arrive time (only for error test)
|
||||||
|
double slow;
|
||||||
|
grid_point* neighbor[4] = {NULL,NULL,NULL,NULL}; //up down left right
|
||||||
|
};
|
||||||
|
typedef vector<grid_point> grid_point_array;
|
||||||
|
typedef vector<grid_point*> ptr_grid_point_array;
|
||||||
|
|
||||||
|
void update_heap(ptr_grid_point_array& a, int i, int n)
|
||||||
|
{
|
||||||
|
int iMax = i,
|
||||||
|
iLeft = 2 * i + 1,
|
||||||
|
iRight = 2 * (i + 1);
|
||||||
|
if (iLeft < n && a[iMax]->time < a[iLeft]->time) {
|
||||||
|
iMax = iLeft;
|
||||||
|
}
|
||||||
|
if (iRight < n && a[iMax]->time < a[iRight]->time) {
|
||||||
|
iMax = iRight;
|
||||||
|
}
|
||||||
|
if (iMax != i) {
|
||||||
|
grid_point* tmp = a[iMax];
|
||||||
|
a[iMax] = a[i];
|
||||||
|
a[i] = tmp;
|
||||||
|
update_heap(a, iMax, n);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
void heap_sort(ptr_grid_point_array& a, int n)
|
||||||
|
{
|
||||||
|
for (int i = (n - 1) / 2; i >= 0; i--) {
|
||||||
|
update_heap(a, i, n);
|
||||||
|
}
|
||||||
|
for (int i = n - 1; i > 0; --i) {
|
||||||
|
|
||||||
|
grid_point* tmp = a[i];
|
||||||
|
a[i] = a[0];
|
||||||
|
a[0] = tmp;
|
||||||
|
update_heap(a, 0, i);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
double dis_point_2d(point_2d a, point_2d b)
|
||||||
|
{
|
||||||
|
return sqrt((a.x-b.x)*(a.x-b.x) + (a.y-b.y)*(a.y-b.y));
|
||||||
|
}
|
||||||
|
|
||||||
|
void local_update(grid_point* point_ptr, double delta_h)
|
||||||
|
{
|
||||||
|
//solve a quadratic equation to get the trial time
|
||||||
|
/*
|
||||||
|
double a = 0, b = 0, c = -1.0 * pow(delta_h,2) * pow(point_ptr->slow,2);
|
||||||
|
for (int i = 0; i < 4; i++)
|
||||||
|
{
|
||||||
|
if (point_ptr->neighbor[i] != NULL && point_ptr->neighbor[i]->tag == 2)
|
||||||
|
{
|
||||||
|
a += 1.0;
|
||||||
|
b += -2.0*point_ptr->neighbor[i]->time;
|
||||||
|
c += pow(point_ptr->neighbor[i]->time,2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
// a second order upwind difference scheme
|
||||||
|
|
||||||
|
double a = 0, b = 0, c = -4.0 * pow(delta_h,2) * pow(point_ptr->slow,2);
|
||||||
|
for (int i = 0; i < 4; i++)
|
||||||
|
{
|
||||||
|
if (point_ptr->neighbor[i] != NULL && point_ptr->neighbor[i]->tag == 2)
|
||||||
|
{
|
||||||
|
a += 4.0;
|
||||||
|
b += -8.0*point_ptr->neighbor[i]->time;
|
||||||
|
c += 4.0*pow(point_ptr->neighbor[i]->time,2);
|
||||||
|
if (point_ptr->neighbor[i]->neighbor[i] != NULL && point_ptr->neighbor[i]->neighbor[i]->tag == 2)
|
||||||
|
{
|
||||||
|
a += 5.0;
|
||||||
|
b += -16.0*point_ptr->neighbor[i]->time + 6.0*point_ptr->neighbor[i]->neighbor[i]->time;
|
||||||
|
c += 12.0*pow(point_ptr->neighbor[i]->time,2) - 8.0*point_ptr->neighbor[i]->time*point_ptr->neighbor[i]->neighbor[i]->time
|
||||||
|
+ pow(point_ptr->neighbor[i]->neighbor[i]->time,2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
double delta = b*b - 4.0*a*c; //in a upwind scheme, delta is always bigger than zero
|
||||||
|
point_ptr->time = min(point_ptr->time, 0.5*(sqrt(delta) - b)/a);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
void abnormal_slowness(grid_point_array& grid_recall, double ab_slow,double xmin, double xmax, double ymin, double ymax)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < grid_recall.size(); i++)
|
||||||
|
{
|
||||||
|
if (grid_recall[i].x >= xmin && grid_recall[i].x <= xmax && grid_recall[i].y >= ymin && grid_recall[i].y <= ymax)
|
||||||
|
{
|
||||||
|
grid_recall[i].slow = ab_slow;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(int argc, char const *argv[])
|
||||||
|
{
|
||||||
|
//set grid parameters
|
||||||
|
int xnum = 201;
|
||||||
|
int ynum = 101;
|
||||||
|
double xmin = 0;
|
||||||
|
double ymin = 0;
|
||||||
|
double dh = 5;
|
||||||
|
|
||||||
|
//set source parameters
|
||||||
|
source init_source;
|
||||||
|
init_source.x = 50;
|
||||||
|
init_source.y = 250;
|
||||||
|
init_source.rad = 25;
|
||||||
|
init_source.slow = 1.0;
|
||||||
|
|
||||||
|
//initialize grid
|
||||||
|
grid_point_array grid_2d;
|
||||||
|
grid_2d.resize(xnum*ynum);
|
||||||
|
//down-left corner to up-right corner
|
||||||
|
for (int i = 0; i < ynum; i++)
|
||||||
|
{
|
||||||
|
for (int j = 0; j < xnum; j++)
|
||||||
|
{
|
||||||
|
grid_2d[i*xnum+j].x = xmin + dh*j;
|
||||||
|
grid_2d[i*xnum+j].y = ymin + dh*i;
|
||||||
|
grid_2d[i*xnum+j].slow = init_source.slow;
|
||||||
|
|
||||||
|
if (i <= ynum-2) grid_2d[i*xnum+j].neighbor[0] = &grid_2d[(i+1)*xnum+j]; //up
|
||||||
|
if (i >= 1) grid_2d[i*xnum+j].neighbor[1] = &grid_2d[(i-1)*xnum+j]; //down
|
||||||
|
if (j >= 1) grid_2d[i*xnum+j].neighbor[2] = &grid_2d[i*xnum+j-1]; //left
|
||||||
|
if (j <= xnum-2) grid_2d[i*xnum+j].neighbor[3] = &grid_2d[i*xnum+j+1]; //right
|
||||||
|
|
||||||
|
//calculate synthetic direct arrive time
|
||||||
|
grid_2d[i*xnum+j].syn_time = dis_point_2d(grid_2d[i*xnum+j], init_source) * init_source.slow;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//add abnormal slowness here
|
||||||
|
//abnormal_slowness(grid_2d,2.0,250,500,0,500);
|
||||||
|
//abnormal_slowness(grid_2d,4.0,800,1000,0,500);
|
||||||
|
//abnormal_slowness(grid_2d,1e+30,200,250,0,250);
|
||||||
|
//abnormal_slowness(grid_2d,1e+30,500,550,250,500);
|
||||||
|
//abnormal_slowness(grid_2d,1e+30,800,850,0,250);
|
||||||
|
|
||||||
|
ptr_grid_point_array close_node_ptr;
|
||||||
|
//initialize source nodes and close nodes;
|
||||||
|
for (int i = 0; i < xnum*ynum; i++)
|
||||||
|
{
|
||||||
|
if (dis_point_2d(grid_2d[i],init_source) <= init_source.rad)
|
||||||
|
{
|
||||||
|
grid_2d[i].tag = 2;
|
||||||
|
grid_2d[i].time = dis_point_2d(grid_2d[i],init_source) * init_source.slow;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < xnum*ynum; i++)
|
||||||
|
{
|
||||||
|
if (grid_2d[i].tag == 2)
|
||||||
|
{
|
||||||
|
for (int j = 0; j < 4; j++)
|
||||||
|
{
|
||||||
|
if (grid_2d[i].neighbor[j] != NULL && grid_2d[i].neighbor[j]->tag == 0)
|
||||||
|
{
|
||||||
|
grid_2d[i].neighbor[j]->tag = 1;
|
||||||
|
close_node_ptr.push_back(grid_2d[i].neighbor[j]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//calculate trial time for all close nodes
|
||||||
|
for (int i = 0; i < close_node_ptr.size(); i++)
|
||||||
|
{
|
||||||
|
local_update(close_node_ptr[i], dh);
|
||||||
|
}
|
||||||
|
|
||||||
|
//marching forward and updating the close nodes set
|
||||||
|
while (!close_node_ptr.empty())
|
||||||
|
{
|
||||||
|
// heap sort close nodes pointers to put the node first that has smallest time
|
||||||
|
heap_sort(close_node_ptr,close_node_ptr.size());
|
||||||
|
|
||||||
|
//change the first node's tag to 2 and update it's neighbor's time if it is not active
|
||||||
|
close_node_ptr[0]->tag = 2;
|
||||||
|
for (int i = 0; i < 4; i++)
|
||||||
|
{
|
||||||
|
if (close_node_ptr[0]->neighbor[i] != NULL && close_node_ptr[0]->neighbor[i]->tag == 0)
|
||||||
|
{
|
||||||
|
close_node_ptr[0]->neighbor[i]->tag = 1;
|
||||||
|
local_update(close_node_ptr[0]->neighbor[i], dh);
|
||||||
|
close_node_ptr.push_back(close_node_ptr[0]->neighbor[i]);
|
||||||
|
}
|
||||||
|
else if (close_node_ptr[0]->neighbor[i] != NULL && close_node_ptr[0]->neighbor[i]->tag == 1)
|
||||||
|
{
|
||||||
|
local_update(close_node_ptr[0]->neighbor[i], dh);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
close_node_ptr.erase(close_node_ptr.begin());
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < xnum*ynum; i++)
|
||||||
|
{
|
||||||
|
if (grid_2d[i].time > 1e+10)
|
||||||
|
{
|
||||||
|
cout << grid_2d[i].x << " " << grid_2d[i].y << " " << grid_2d[i].tag << " " << grid_2d[i].syn_time << " nan " << grid_2d[i].time - grid_2d[i].syn_time << endl;
|
||||||
|
}
|
||||||
|
else cout << grid_2d[i].x << " " << grid_2d[i].y << " " << grid_2d[i].tag << " " << grid_2d[i].syn_time << " " << grid_2d[i].time << " " << grid_2d[i].time - grid_2d[i].syn_time << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
1092
fmm_2d_grid/out.eps
Normal file
1092
fmm_2d_grid/out.eps
Normal file
File diff suppressed because it is too large
Load Diff
BIN
fmm_2d_grid/out.nc
Normal file
BIN
fmm_2d_grid/out.nc
Normal file
Binary file not shown.
BIN
fmm_2d_grid/out.png
Normal file
BIN
fmm_2d_grid/out.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 25 KiB |
20301
fmm_2d_grid/out.txt
Normal file
20301
fmm_2d_grid/out.txt
Normal file
File diff suppressed because it is too large
Load Diff
9
fmm_2d_grid/run.sh
Executable file
9
fmm_2d_grid/run.sh
Executable file
@@ -0,0 +1,9 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
g++-9 fmm_2d_grid.cpp -o fmm_2d_grid -O2
|
||||||
|
|
||||||
|
./fmm_2d_grid > out.txt
|
||||||
|
|
||||||
|
xyz2grd out.txt -Gout.nc -R0/1000/0/500 -I5/5 -i0,1,5
|
||||||
|
|
||||||
|
ncview out.nc
|
||||||
34846
fmm_2d_triangle/cube_mesh.1.ele
Normal file
34846
fmm_2d_triangle/cube_mesh.1.ele
Normal file
File diff suppressed because it is too large
Load Diff
52709
fmm_2d_triangle/cube_mesh.1.msh
Normal file
52709
fmm_2d_triangle/cube_mesh.1.msh
Normal file
File diff suppressed because it is too large
Load Diff
17858
fmm_2d_triangle/cube_mesh.1.node
Normal file
17858
fmm_2d_triangle/cube_mesh.1.node
Normal file
File diff suppressed because it is too large
Load Diff
870
fmm_2d_triangle/cube_mesh.1.poly
Normal file
870
fmm_2d_triangle/cube_mesh.1.poly
Normal file
@@ -0,0 +1,870 @@
|
|||||||
|
0 2 0 1
|
||||||
|
866 1
|
||||||
|
0 1 9228 1
|
||||||
|
1 4083 2 1
|
||||||
|
2 28 3 1
|
||||||
|
3 7400 4 1
|
||||||
|
4 5 10453 1
|
||||||
|
5 12484 6 1
|
||||||
|
6 14038 7 1
|
||||||
|
7 17047 8 1
|
||||||
|
8 9 17724 1
|
||||||
|
9 10 16200 1
|
||||||
|
10 11 15088 1
|
||||||
|
11 9615 12 1
|
||||||
|
12 7557 13 1
|
||||||
|
13 2617 14 1
|
||||||
|
14 15 10578 1
|
||||||
|
15 0 13754 1
|
||||||
|
16 16 7748 1
|
||||||
|
17 17 14318 1
|
||||||
|
18 18 2053 1
|
||||||
|
19 21 14679 1
|
||||||
|
20 22 60 1
|
||||||
|
21 25 36 1
|
||||||
|
22 28 25 1
|
||||||
|
23 36 22 1
|
||||||
|
24 55 49 1
|
||||||
|
25 60 55 1
|
||||||
|
26 57 4601 1
|
||||||
|
27 49 2 1
|
||||||
|
28 63 8132 1
|
||||||
|
29 99 1964 1
|
||||||
|
30 105 3622 1
|
||||||
|
31 106 226 1
|
||||||
|
32 107 116 1
|
||||||
|
33 108 110 1
|
||||||
|
34 110 3 1
|
||||||
|
35 116 108 1
|
||||||
|
36 122 126 1
|
||||||
|
37 126 107 1
|
||||||
|
38 226 122 1
|
||||||
|
39 250 3605 1
|
||||||
|
40 252 254 1
|
||||||
|
41 254 106 1
|
||||||
|
42 173 3694 1
|
||||||
|
43 481 1374 1
|
||||||
|
44 597 1502 1
|
||||||
|
45 615 3722 1
|
||||||
|
46 516 2521 1
|
||||||
|
47 757 2337 1
|
||||||
|
48 990 1259 1
|
||||||
|
49 839 1854 1
|
||||||
|
50 1065 1222 1
|
||||||
|
51 1066 1067 1
|
||||||
|
52 1067 173 1
|
||||||
|
53 1074 1066 1
|
||||||
|
54 1110 3808 1
|
||||||
|
55 1222 1074 1
|
||||||
|
56 1218 1224 1
|
||||||
|
57 1224 1065 1
|
||||||
|
58 1259 1468 1
|
||||||
|
59 1374 1218 1
|
||||||
|
60 1392 1503 1
|
||||||
|
61 1468 1110 1
|
||||||
|
62 1502 1392 1
|
||||||
|
63 1503 615 1
|
||||||
|
64 1514 1666 1
|
||||||
|
65 1494 1810 1
|
||||||
|
66 1651 1719 1
|
||||||
|
67 1666 1651 1
|
||||||
|
68 1544 3792 1
|
||||||
|
69 1640 1754 1
|
||||||
|
70 1701 481 1
|
||||||
|
71 1719 597 1
|
||||||
|
72 1754 1701 1
|
||||||
|
73 1764 1640 1
|
||||||
|
74 1810 1764 1
|
||||||
|
75 1813 1814 1
|
||||||
|
76 1662 1818 1
|
||||||
|
77 1818 1514 1
|
||||||
|
78 1807 2017 1
|
||||||
|
79 1844 3813 1
|
||||||
|
80 1751 2165 1
|
||||||
|
81 1852 1919 1
|
||||||
|
82 1814 1494 1
|
||||||
|
83 1854 1852 1
|
||||||
|
84 1878 1946 1
|
||||||
|
85 1919 1751 1
|
||||||
|
86 1946 839 1
|
||||||
|
87 1964 1662 1
|
||||||
|
88 1931 3285 1
|
||||||
|
89 2017 1878 1
|
||||||
|
90 2019 2021 1
|
||||||
|
91 2053 1813 1
|
||||||
|
92 1928 2639 1
|
||||||
|
93 2021 1807 1
|
||||||
|
94 1929 2429 1
|
||||||
|
95 2078 2256 1
|
||||||
|
96 2045 2317 1
|
||||||
|
97 1957 3810 1
|
||||||
|
98 2149 2168 1
|
||||||
|
99 2153 2255 1
|
||||||
|
100 2080 2619 1
|
||||||
|
101 2165 1957 1
|
||||||
|
102 2166 3935 1
|
||||||
|
103 2168 99 1
|
||||||
|
104 2255 1544 1
|
||||||
|
105 2275 2348 1
|
||||||
|
106 2256 2153 1
|
||||||
|
107 2195 2341 1
|
||||||
|
108 2337 2195 1
|
||||||
|
109 2341 2080 1
|
||||||
|
110 2348 2045 1
|
||||||
|
111 2266 2483 1
|
||||||
|
112 2317 2266 1
|
||||||
|
113 2353 2547 1
|
||||||
|
114 2382 3836 1
|
||||||
|
115 2415 2550 1
|
||||||
|
116 2429 2149 1
|
||||||
|
117 2435 2492 1
|
||||||
|
118 2479 5934 1
|
||||||
|
119 2478 3063 1
|
||||||
|
120 2483 516 1
|
||||||
|
121 2492 1929 1
|
||||||
|
122 2471 2514 1
|
||||||
|
123 2514 2078 1
|
||||||
|
124 2517 2610 1
|
||||||
|
125 2484 2855 1
|
||||||
|
126 2520 2680 1
|
||||||
|
127 2521 2520 1
|
||||||
|
128 2547 2382 1
|
||||||
|
129 2550 2353 1
|
||||||
|
130 2589 2517 1
|
||||||
|
131 2610 2616 1
|
||||||
|
132 2616 14 1
|
||||||
|
133 2617 2471 1
|
||||||
|
134 2619 2589 1
|
||||||
|
135 2639 2435 1
|
||||||
|
136 2663 2415 1
|
||||||
|
137 2665 4330 1
|
||||||
|
138 2680 2484 1
|
||||||
|
139 2682 2713 1
|
||||||
|
140 2713 1928 1
|
||||||
|
141 2716 2854 1
|
||||||
|
142 2855 2716 1
|
||||||
|
143 2915 5526 1
|
||||||
|
144 2923 3067 1
|
||||||
|
145 3063 2923 1
|
||||||
|
146 3067 2915 1
|
||||||
|
147 3109 3475 1
|
||||||
|
148 3014 7852 1
|
||||||
|
149 3140 3468 1
|
||||||
|
150 3284 3289 1
|
||||||
|
151 3289 2665 1
|
||||||
|
152 3411 7371 1
|
||||||
|
153 3406 3462 1
|
||||||
|
154 3355 3477 1
|
||||||
|
155 3462 3140 1
|
||||||
|
156 3468 3355 1
|
||||||
|
157 3477 1931 1
|
||||||
|
158 3605 252 1
|
||||||
|
159 3614 3617 1
|
||||||
|
160 3617 250 1
|
||||||
|
161 3622 3614 1
|
||||||
|
162 3703 3716 1
|
||||||
|
163 3694 3703 1
|
||||||
|
164 3707 990 1
|
||||||
|
165 3716 3707 1
|
||||||
|
166 1391 3721 1
|
||||||
|
167 3721 105 1
|
||||||
|
168 3792 2019 1
|
||||||
|
169 3805 757 1
|
||||||
|
170 3808 3805 1
|
||||||
|
171 3810 1844 1
|
||||||
|
172 3836 18 1
|
||||||
|
173 3862 4051 1
|
||||||
|
174 3935 2663 1
|
||||||
|
175 3944 3951 1
|
||||||
|
176 3951 3994 1
|
||||||
|
177 3994 2166 1
|
||||||
|
178 4034 4912 1
|
||||||
|
179 4015 4018 1
|
||||||
|
180 4051 4062 1
|
||||||
|
181 4056 4737 1
|
||||||
|
182 4049 4713 1
|
||||||
|
183 4062 3944 1
|
||||||
|
184 4071 4739 1
|
||||||
|
185 4083 4071 1
|
||||||
|
186 4020 6856 1
|
||||||
|
187 4072 5477 1
|
||||||
|
188 4211 5985 1
|
||||||
|
189 3285 3284 1
|
||||||
|
190 4330 2682 1
|
||||||
|
191 3412 4374 1
|
||||||
|
192 4374 3109 1
|
||||||
|
193 3475 3406 1
|
||||||
|
194 3722 1391 1
|
||||||
|
195 3813 2275 1
|
||||||
|
196 4578 4639 1
|
||||||
|
197 4018 3862 1
|
||||||
|
198 4601 4602 1
|
||||||
|
199 4602 4015 1
|
||||||
|
200 4598 4625 1
|
||||||
|
201 4606 4612 1
|
||||||
|
202 4612 4614 1
|
||||||
|
203 4614 57 1
|
||||||
|
204 4625 4606 1
|
||||||
|
205 4630 4632 1
|
||||||
|
206 4632 4598 1
|
||||||
|
207 4639 4630 1
|
||||||
|
208 4647 8026 1
|
||||||
|
209 4657 6078 1
|
||||||
|
210 4144 4720 1
|
||||||
|
211 4713 4144 1
|
||||||
|
212 4720 4056 1
|
||||||
|
213 4725 4833 1
|
||||||
|
214 4732 4805 1
|
||||||
|
215 4737 4732 1
|
||||||
|
216 4739 4049 1
|
||||||
|
217 4805 4725 1
|
||||||
|
218 4810 4840 1
|
||||||
|
219 4840 4034 1
|
||||||
|
220 4851 6342 1
|
||||||
|
221 4852 6337 1
|
||||||
|
222 4896 4910 1
|
||||||
|
223 4912 4896 1
|
||||||
|
224 5070 6070 1
|
||||||
|
225 5222 5368 1
|
||||||
|
226 5235 5484 1
|
||||||
|
227 5279 5365 1
|
||||||
|
228 5349 5399 1
|
||||||
|
229 5365 7351 1
|
||||||
|
230 5368 5279 1
|
||||||
|
231 5382 5401 1
|
||||||
|
232 5401 5480 1
|
||||||
|
233 5404 5481 1
|
||||||
|
234 5399 5382 1
|
||||||
|
235 5437 5349 1
|
||||||
|
236 5456 8126 1
|
||||||
|
237 5472 5492 1
|
||||||
|
238 5236 7312 1
|
||||||
|
239 5477 8825 1
|
||||||
|
240 5480 4072 1
|
||||||
|
241 5481 5437 1
|
||||||
|
242 5484 7360 1
|
||||||
|
243 3407 8860 1
|
||||||
|
244 4446 5893 1
|
||||||
|
245 5845 5881 1
|
||||||
|
246 5867 7999 1
|
||||||
|
247 5881 5867 1
|
||||||
|
248 5766 5975 1
|
||||||
|
249 5864 5979 1
|
||||||
|
250 5898 5908 1
|
||||||
|
251 5908 5845 1
|
||||||
|
252 5924 5974 1
|
||||||
|
253 5934 5898 1
|
||||||
|
254 5975 5924 1
|
||||||
|
255 5974 13 1
|
||||||
|
256 5979 5766 1
|
||||||
|
257 5985 2479 1
|
||||||
|
258 6051 10567 1
|
||||||
|
259 6066 6068 1
|
||||||
|
260 6070 6066 1
|
||||||
|
261 6078 8044 1
|
||||||
|
262 4910 4852 1
|
||||||
|
263 6104 6331 1
|
||||||
|
264 6331 4851 1
|
||||||
|
265 6337 6104 1
|
||||||
|
266 6339 6567 1
|
||||||
|
267 6330 6515 1
|
||||||
|
268 6515 6339 1
|
||||||
|
269 6563 6650 1
|
||||||
|
270 6567 6563 1
|
||||||
|
271 6540 7189 1
|
||||||
|
272 6725 10590 1
|
||||||
|
273 6728 6642 1
|
||||||
|
274 6851 8114 1
|
||||||
|
275 6822 9398 1
|
||||||
|
276 6846 8218 1
|
||||||
|
277 6857 4020 1
|
||||||
|
278 6913 9147 1
|
||||||
|
279 7069 8176 1
|
||||||
|
280 6642 6846 1
|
||||||
|
281 7106 7142 1
|
||||||
|
282 7142 6728 1
|
||||||
|
283 7173 7190 1
|
||||||
|
284 7189 7173 1
|
||||||
|
285 7190 6913 1
|
||||||
|
286 7216 11681 1
|
||||||
|
287 7312 7318 1
|
||||||
|
288 7318 5222 1
|
||||||
|
289 7351 5070 1
|
||||||
|
290 7360 5404 1
|
||||||
|
291 5492 5235 1
|
||||||
|
292 5526 4211 1
|
||||||
|
293 7371 3412 1
|
||||||
|
294 7379 5547 1
|
||||||
|
295 5549 8852 1
|
||||||
|
296 5547 3411 1
|
||||||
|
297 7390 7421 1
|
||||||
|
298 7400 7379 1
|
||||||
|
299 7393 7415 1
|
||||||
|
300 7415 4 1
|
||||||
|
301 7421 7393 1
|
||||||
|
302 7461 9459 1
|
||||||
|
303 5960 7655 1
|
||||||
|
304 7501 7675 1
|
||||||
|
305 7608 7640 1
|
||||||
|
306 7613 7608 1
|
||||||
|
307 7537 7693 1
|
||||||
|
308 7580 9471 1
|
||||||
|
309 7555 8950 1
|
||||||
|
310 7640 7501 1
|
||||||
|
311 7655 7613 1
|
||||||
|
312 7559 7677 1
|
||||||
|
313 7658 7662 1
|
||||||
|
314 7662 5960 1
|
||||||
|
315 7672 7783 1
|
||||||
|
316 7674 7717 1
|
||||||
|
317 7675 7674 1
|
||||||
|
318 7677 7658 1
|
||||||
|
319 7679 7559 1
|
||||||
|
320 7693 7679 1
|
||||||
|
321 7690 7741 1
|
||||||
|
322 7713 7537 1
|
||||||
|
323 7717 7672 1
|
||||||
|
324 7741 7713 1
|
||||||
|
325 7729 10757 1
|
||||||
|
326 7758 7799 1
|
||||||
|
327 7749 7902 1
|
||||||
|
328 7763 7876 1
|
||||||
|
329 7765 7815 1
|
||||||
|
330 7783 7758 1
|
||||||
|
331 7748 7690 1
|
||||||
|
332 7792 16 1
|
||||||
|
333 7799 3014 1
|
||||||
|
334 7815 7792 1
|
||||||
|
335 7823 7861 1
|
||||||
|
336 7829 7860 1
|
||||||
|
337 7833 7865 1
|
||||||
|
338 7850 7823 1
|
||||||
|
339 7852 7850 1
|
||||||
|
340 7842 9448 1
|
||||||
|
341 7860 7461 1
|
||||||
|
342 7861 7829 1
|
||||||
|
343 7865 7765 1
|
||||||
|
344 7876 7833 1
|
||||||
|
345 7878 7880 1
|
||||||
|
346 7880 7763 1
|
||||||
|
347 7890 7894 1
|
||||||
|
348 7894 7878 1
|
||||||
|
349 7902 7890 1
|
||||||
|
350 7906 11705 1
|
||||||
|
351 7923 10730 1
|
||||||
|
352 7969 7749 1
|
||||||
|
353 7999 4446 1
|
||||||
|
354 8019 10571 1
|
||||||
|
355 8026 4657 1
|
||||||
|
356 8032 8035 1
|
||||||
|
357 8035 4647 1
|
||||||
|
358 8044 4578 1
|
||||||
|
359 6342 6330 1
|
||||||
|
360 8114 5456 1
|
||||||
|
361 8119 5472 1
|
||||||
|
362 8126 8119 1
|
||||||
|
363 6971 8152 1
|
||||||
|
364 8131 8140 1
|
||||||
|
365 8132 8131 1
|
||||||
|
366 8140 6971 1
|
||||||
|
367 8147 8164 1
|
||||||
|
368 8152 8147 1
|
||||||
|
369 8164 7069 1
|
||||||
|
370 8172 9115 1
|
||||||
|
371 8171 8184 1
|
||||||
|
372 8176 8171 1
|
||||||
|
373 8184 8172 1
|
||||||
|
374 6650 63 1
|
||||||
|
375 6856 6851 1
|
||||||
|
376 8218 6857 1
|
||||||
|
377 8282 10622 1
|
||||||
|
378 8541 8725 1
|
||||||
|
379 8562 9257 1
|
||||||
|
380 8635 9409 1
|
||||||
|
381 8665 10635 1
|
||||||
|
382 8688 9406 1
|
||||||
|
383 8694 9386 1
|
||||||
|
384 8690 9390 1
|
||||||
|
385 8725 8694 1
|
||||||
|
386 8728 9216 1
|
||||||
|
387 7208 10641 1
|
||||||
|
388 8519 9423 1
|
||||||
|
389 8825 5236 1
|
||||||
|
390 8849 7390 1
|
||||||
|
391 8852 8849 1
|
||||||
|
392 8845 8858 1
|
||||||
|
393 8854 8856 1
|
||||||
|
394 8856 5549 1
|
||||||
|
395 8858 8854 1
|
||||||
|
396 8860 8845 1
|
||||||
|
397 8963 8991 1
|
||||||
|
398 8950 7580 1
|
||||||
|
399 8991 12 1
|
||||||
|
400 7557 7555 1
|
||||||
|
401 8187 9399 1
|
||||||
|
402 8251 9140 1
|
||||||
|
403 9140 6725 1
|
||||||
|
404 9147 8251 1
|
||||||
|
405 9198 9230 1
|
||||||
|
406 9214 9217 1
|
||||||
|
407 8732 10597 1
|
||||||
|
408 9223 9225 1
|
||||||
|
409 9216 8732 1
|
||||||
|
410 9228 9214 1
|
||||||
|
411 9230 9223 1
|
||||||
|
412 9233 9246 1
|
||||||
|
413 9225 1 1
|
||||||
|
414 9246 9198 1
|
||||||
|
415 9257 9233 1
|
||||||
|
416 9264 9258 1
|
||||||
|
417 9258 8562 1
|
||||||
|
418 9181 13741 1
|
||||||
|
419 8483 9326 1
|
||||||
|
420 9286 9327 1
|
||||||
|
421 9312 9328 1
|
||||||
|
422 9326 9312 1
|
||||||
|
423 9327 8483 1
|
||||||
|
424 9328 9181 1
|
||||||
|
425 9349 13758 1
|
||||||
|
426 9386 8635 1
|
||||||
|
427 9398 8688 1
|
||||||
|
428 9399 6822 1
|
||||||
|
429 9409 8690 1
|
||||||
|
430 7224 6540 1
|
||||||
|
431 9423 7224 1
|
||||||
|
432 9435 10651 1
|
||||||
|
433 9444 3407 1
|
||||||
|
434 9448 9444 1
|
||||||
|
435 9455 7842 1
|
||||||
|
436 9459 9455 1
|
||||||
|
437 9471 8963 1
|
||||||
|
438 9500 13560 1
|
||||||
|
439 9502 10837 1
|
||||||
|
440 9003 10761 1
|
||||||
|
441 9529 9687 1
|
||||||
|
442 9568 9659 1
|
||||||
|
443 9615 9568 1
|
||||||
|
444 9659 9529 1
|
||||||
|
445 9684 9722 1
|
||||||
|
446 9687 9684 1
|
||||||
|
447 9722 9003 1
|
||||||
|
448 9746 10817 1
|
||||||
|
449 9749 10816 1
|
||||||
|
450 9575 15193 1
|
||||||
|
451 9963 14502 1
|
||||||
|
452 9961 10385 1
|
||||||
|
453 10127 15170 1
|
||||||
|
454 10145 10485 1
|
||||||
|
455 10326 10401 1
|
||||||
|
456 10328 10377 1
|
||||||
|
457 10329 10362 1
|
||||||
|
458 10311 14488 1
|
||||||
|
459 10205 10395 1
|
||||||
|
460 10362 9961 1
|
||||||
|
461 10236 10525 1
|
||||||
|
462 10325 10463 1
|
||||||
|
463 10377 10329 1
|
||||||
|
464 10385 10325 1
|
||||||
|
465 10390 10456 1
|
||||||
|
466 10401 10410 1
|
||||||
|
467 10395 10429 1
|
||||||
|
468 10393 10205 1
|
||||||
|
469 10410 10328 1
|
||||||
|
470 10381 10452 1
|
||||||
|
471 10405 10326 1
|
||||||
|
472 10370 10481 1
|
||||||
|
473 10429 10390 1
|
||||||
|
474 10431 10458 1
|
||||||
|
475 10452 10405 1
|
||||||
|
476 10456 10431 1
|
||||||
|
477 10458 7729 1
|
||||||
|
478 10461 10747 1
|
||||||
|
479 10463 10393 1
|
||||||
|
480 10453 10519 1
|
||||||
|
481 10445 10504 1
|
||||||
|
482 10478 11661 1
|
||||||
|
483 10481 10478 1
|
||||||
|
484 10485 10445 1
|
||||||
|
485 10504 10370 1
|
||||||
|
486 10508 10510 1
|
||||||
|
487 10510 10145 1
|
||||||
|
488 10519 10381 1
|
||||||
|
489 10525 10508 1
|
||||||
|
490 9097 8019 1
|
||||||
|
491 10567 9097 1
|
||||||
|
492 10571 10579 1
|
||||||
|
493 10573 11672 1
|
||||||
|
494 6068 6051 1
|
||||||
|
495 10578 10573 1
|
||||||
|
496 10579 15 1
|
||||||
|
497 9115 8187 1
|
||||||
|
498 10590 7106 1
|
||||||
|
499 10597 8541 1
|
||||||
|
500 10622 9286 1
|
||||||
|
501 9358 13746 1
|
||||||
|
502 9390 8282 1
|
||||||
|
503 10635 9264 1
|
||||||
|
504 9406 8665 1
|
||||||
|
505 9425 8519 1
|
||||||
|
506 10641 9425 1
|
||||||
|
507 10651 7208 1
|
||||||
|
508 10730 7969 1
|
||||||
|
509 10731 7923 1
|
||||||
|
510 10738 11709 1
|
||||||
|
511 10747 10738 1
|
||||||
|
512 10462 10753 1
|
||||||
|
513 10753 10461 1
|
||||||
|
514 10757 10462 1
|
||||||
|
515 10761 9749 1
|
||||||
|
516 10813 10823 1
|
||||||
|
517 10817 10813 1
|
||||||
|
518 10816 9746 1
|
||||||
|
519 10823 9502 1
|
||||||
|
520 10831 11819 1
|
||||||
|
521 10833 11789 1
|
||||||
|
522 10835 11780 1
|
||||||
|
523 11101 15198 1
|
||||||
|
524 11175 12099 1
|
||||||
|
525 11661 5 1
|
||||||
|
526 11672 8032 1
|
||||||
|
527 10629 13740 1
|
||||||
|
528 11681 9435 1
|
||||||
|
529 9375 11692 1
|
||||||
|
530 11692 7216 1
|
||||||
|
531 11705 10731 1
|
||||||
|
532 11709 7906 1
|
||||||
|
533 11780 10833 1
|
||||||
|
534 11786 11809 1
|
||||||
|
535 11789 11786 1
|
||||||
|
536 11809 10831 1
|
||||||
|
537 11814 13553 1
|
||||||
|
538 11816 11834 1
|
||||||
|
539 11819 11816 1
|
||||||
|
540 10837 10835 1
|
||||||
|
541 11884 15184 1
|
||||||
|
542 12087 14539 1
|
||||||
|
543 12093 12103 1
|
||||||
|
544 11264 14556 1
|
||||||
|
545 12099 12093 1
|
||||||
|
546 12103 12087 1
|
||||||
|
547 12112 12116 1
|
||||||
|
548 12116 11175 1
|
||||||
|
549 12201 15223 1
|
||||||
|
550 12461 14598 1
|
||||||
|
551 12178 12511 1
|
||||||
|
552 12484 12178 1
|
||||||
|
553 12511 12461 1
|
||||||
|
554 12585 14339 1
|
||||||
|
555 12557 14347 1
|
||||||
|
556 12594 13023 1
|
||||||
|
557 12733 12841 1
|
||||||
|
558 12623 12837 1
|
||||||
|
559 12743 12989 1
|
||||||
|
560 12836 13122 1
|
||||||
|
561 12837 17 1
|
||||||
|
562 12841 12623 1
|
||||||
|
563 12935 12937 1
|
||||||
|
564 12937 12733 1
|
||||||
|
565 12979 15044 1
|
||||||
|
566 13035 13089 1
|
||||||
|
567 13058 14362 1
|
||||||
|
568 12989 13035 1
|
||||||
|
569 12924 13135 1
|
||||||
|
570 13109 14353 1
|
||||||
|
571 13115 15112 1
|
||||||
|
572 13122 12743 1
|
||||||
|
573 13135 12594 1
|
||||||
|
574 12939 13414 1
|
||||||
|
575 13141 12848 1
|
||||||
|
576 13236 15132 1
|
||||||
|
577 13290 13432 1
|
||||||
|
578 13184 15127 1
|
||||||
|
579 13179 13370 1
|
||||||
|
580 13221 13367 1
|
||||||
|
581 13367 12939 1
|
||||||
|
582 13326 15125 1
|
||||||
|
583 13370 13221 1
|
||||||
|
584 13402 13422 1
|
||||||
|
585 13432 13402 1
|
||||||
|
586 13414 13326 1
|
||||||
|
587 13422 13179 1
|
||||||
|
588 13429 13470 1
|
||||||
|
589 13444 13454 1
|
||||||
|
590 13454 13290 1
|
||||||
|
591 13470 13444 1
|
||||||
|
592 13474 13476 1
|
||||||
|
593 13536 13561 1
|
||||||
|
594 13561 9500 1
|
||||||
|
595 13698 13702 1
|
||||||
|
596 13702 10236 1
|
||||||
|
597 13714 14506 1
|
||||||
|
598 13716 13752 1
|
||||||
|
599 13741 10629 1
|
||||||
|
600 13740 9358 1
|
||||||
|
601 13746 13716 1
|
||||||
|
602 13752 0 1
|
||||||
|
603 13754 13714 1
|
||||||
|
604 13758 9375 1
|
||||||
|
605 11834 11814 1
|
||||||
|
606 12109 14534 1
|
||||||
|
607 13893 15983 1
|
||||||
|
608 13923 14635 1
|
||||||
|
609 13926 14597 1
|
||||||
|
610 14020 14145 1
|
||||||
|
611 14031 15232 1
|
||||||
|
612 14038 14031 1
|
||||||
|
613 14068 16079 1
|
||||||
|
614 14049 14144 1
|
||||||
|
615 14092 15388 1
|
||||||
|
616 14103 15243 1
|
||||||
|
617 14095 14149 1
|
||||||
|
618 14105 14183 1
|
||||||
|
619 14145 14095 1
|
||||||
|
620 14149 21 1
|
||||||
|
621 14171 15649 1
|
||||||
|
622 14137 17266 1
|
||||||
|
623 14169 14177 1
|
||||||
|
624 14177 7 1
|
||||||
|
625 14186 15616 1
|
||||||
|
626 14217 14266 1
|
||||||
|
627 14318 12836 1
|
||||||
|
628 13023 12935 1
|
||||||
|
629 14339 14049 1
|
||||||
|
630 14347 13141 1
|
||||||
|
631 14353 13115 1
|
||||||
|
632 12848 13058 1
|
||||||
|
633 14362 12924 1
|
||||||
|
634 13346 15133 1
|
||||||
|
635 14395 15081 1
|
||||||
|
636 14394 15070 1
|
||||||
|
637 13476 13429 1
|
||||||
|
638 13553 13536 1
|
||||||
|
639 13560 13474 1
|
||||||
|
640 14489 14493 1
|
||||||
|
641 14488 14489 1
|
||||||
|
642 14493 9963 1
|
||||||
|
643 13692 15964 1
|
||||||
|
644 14502 13698 1
|
||||||
|
645 13724 9349 1
|
||||||
|
646 14506 13724 1
|
||||||
|
647 14539 12109 1
|
||||||
|
648 14534 9575 1
|
||||||
|
649 14556 12112 1
|
||||||
|
650 14557 14559 1
|
||||||
|
651 14559 11264 1
|
||||||
|
652 13915 15220 1
|
||||||
|
653 14597 12201 1
|
||||||
|
654 14598 13926 1
|
||||||
|
655 14618 14643 1
|
||||||
|
656 14635 14618 1
|
||||||
|
657 14643 6 1
|
||||||
|
658 14144 14020 1
|
||||||
|
659 14183 14169 1
|
||||||
|
660 14205 15238 1
|
||||||
|
661 14679 14217 1
|
||||||
|
662 14282 15862 1
|
||||||
|
663 14842 15939 1
|
||||||
|
664 14900 15894 1
|
||||||
|
665 14943 15831 1
|
||||||
|
666 14266 14186 1
|
||||||
|
667 14972 14974 1
|
||||||
|
668 14974 13109 1
|
||||||
|
669 15044 14972 1
|
||||||
|
670 14414 15092 1
|
||||||
|
671 15069 15086 1
|
||||||
|
672 15068 15091 1
|
||||||
|
673 15082 15098 1
|
||||||
|
674 15091 15104 1
|
||||||
|
675 15081 15069 1
|
||||||
|
676 15088 15082 1
|
||||||
|
677 15098 14414 1
|
||||||
|
678 15086 11 1
|
||||||
|
679 15092 15068 1
|
||||||
|
680 15104 12979 1
|
||||||
|
681 15112 12557 1
|
||||||
|
682 15125 13184 1
|
||||||
|
683 15127 13346 1
|
||||||
|
684 15132 14394 1
|
||||||
|
685 15133 13236 1
|
||||||
|
686 15167 15173 1
|
||||||
|
687 15173 10127 1
|
||||||
|
688 15170 13692 1
|
||||||
|
689 15184 15167 1
|
||||||
|
690 15190 15971 1
|
||||||
|
691 15198 14557 1
|
||||||
|
692 15199 15201 1
|
||||||
|
693 15201 11101 1
|
||||||
|
694 15220 13893 1
|
||||||
|
695 15223 13915 1
|
||||||
|
696 15232 13923 1
|
||||||
|
697 15238 14105 1
|
||||||
|
698 15243 14205 1
|
||||||
|
699 15250 15314 1
|
||||||
|
700 15248 15252 1
|
||||||
|
701 15252 14103 1
|
||||||
|
702 15313 15352 1
|
||||||
|
703 15314 15248 1
|
||||||
|
704 15352 15250 1
|
||||||
|
705 15388 15313 1
|
||||||
|
706 15392 15464 1
|
||||||
|
707 15393 15416 1
|
||||||
|
708 15396 15397 1
|
||||||
|
709 15397 14092 1
|
||||||
|
710 15416 15396 1
|
||||||
|
711 15451 15460 1
|
||||||
|
712 15460 15393 1
|
||||||
|
713 15464 15451 1
|
||||||
|
714 15472 16050 1
|
||||||
|
715 15505 16040 1
|
||||||
|
716 14953 15590 1
|
||||||
|
717 15590 14171 1
|
||||||
|
718 15616 14953 1
|
||||||
|
719 15604 15672 1
|
||||||
|
720 15642 15659 1
|
||||||
|
721 15649 15642 1
|
||||||
|
722 15659 15604 1
|
||||||
|
723 15667 16386 1
|
||||||
|
724 15666 16193 1
|
||||||
|
725 15788 17833 1
|
||||||
|
726 15746 16309 1
|
||||||
|
727 15831 14282 1
|
||||||
|
728 15813 15893 1
|
||||||
|
729 15862 16304 1
|
||||||
|
730 15894 14943 1
|
||||||
|
731 15893 15746 1
|
||||||
|
732 15904 17836 1
|
||||||
|
733 15932 16497 1
|
||||||
|
734 15939 15932 1
|
||||||
|
735 15070 14395 1
|
||||||
|
736 15964 10311 1
|
||||||
|
737 15193 15190 1
|
||||||
|
738 15983 15199 1
|
||||||
|
739 16040 15392 1
|
||||||
|
740 16050 15505 1
|
||||||
|
741 16069 16077 1
|
||||||
|
742 16077 15472 1
|
||||||
|
743 16079 16069 1
|
||||||
|
744 16087 16712 1
|
||||||
|
745 16096 16711 1
|
||||||
|
746 16108 16506 1
|
||||||
|
747 16127 16130 1
|
||||||
|
748 16130 14068 1
|
||||||
|
749 16178 16183 1
|
||||||
|
750 16191 16318 1
|
||||||
|
751 16183 15666 1
|
||||||
|
752 16193 16325 1
|
||||||
|
753 16200 16178 1
|
||||||
|
754 15672 15667 1
|
||||||
|
755 15852 16252 1
|
||||||
|
756 16225 16244 1
|
||||||
|
757 16244 15852 1
|
||||||
|
758 16238 16265 1
|
||||||
|
759 16241 16238 1
|
||||||
|
760 16252 16241 1
|
||||||
|
761 16111 17181 1
|
||||||
|
762 16265 14137 1
|
||||||
|
763 16304 15813 1
|
||||||
|
764 16309 15904 1
|
||||||
|
765 16318 16320 1
|
||||||
|
766 16320 14842 1
|
||||||
|
767 16325 16191 1
|
||||||
|
768 15971 11884 1
|
||||||
|
769 16386 10 1
|
||||||
|
770 16497 14900 1
|
||||||
|
771 16506 16127 1
|
||||||
|
772 16509 16510 1
|
||||||
|
773 16510 16108 1
|
||||||
|
774 16634 16654 1
|
||||||
|
775 16643 16656 1
|
||||||
|
776 16654 16643 1
|
||||||
|
777 16656 16096 1
|
||||||
|
778 16688 16705 1
|
||||||
|
779 16705 16634 1
|
||||||
|
780 16711 16509 1
|
||||||
|
781 16712 16688 1
|
||||||
|
782 16721 16781 1
|
||||||
|
783 16720 16755 1
|
||||||
|
784 16744 16754 1
|
||||||
|
785 16754 16087 1
|
||||||
|
786 16755 16744 1
|
||||||
|
787 16762 16763 1
|
||||||
|
788 16763 16720 1
|
||||||
|
789 16781 16762 1
|
||||||
|
790 16790 16942 1
|
||||||
|
791 16796 17467 1
|
||||||
|
792 16813 16904 1
|
||||||
|
793 16904 16721 1
|
||||||
|
794 16878 17017 1
|
||||||
|
795 16942 16813 1
|
||||||
|
796 16943 16957 1
|
||||||
|
797 16957 16790 1
|
||||||
|
798 16966 17045 1
|
||||||
|
799 16987 17016 1
|
||||||
|
800 17016 16966 1
|
||||||
|
801 17017 16987 1
|
||||||
|
802 17020 17049 1
|
||||||
|
803 17045 17020 1
|
||||||
|
804 17047 16943 1
|
||||||
|
805 17049 8 1
|
||||||
|
806 16863 17568 1
|
||||||
|
807 17083 17597 1
|
||||||
|
808 17126 17184 1
|
||||||
|
809 17181 17126 1
|
||||||
|
810 17184 17083 1
|
||||||
|
811 17171 17690 1
|
||||||
|
812 17168 17295 1
|
||||||
|
813 17229 17267 1
|
||||||
|
814 17265 17168 1
|
||||||
|
815 17267 17265 1
|
||||||
|
816 17266 17229 1
|
||||||
|
817 17283 17317 1
|
||||||
|
818 17290 17283 1
|
||||||
|
819 17295 17290 1
|
||||||
|
820 17317 17367 1
|
||||||
|
821 17330 17653 1
|
||||||
|
822 17347 17688 1
|
||||||
|
823 17367 17171 1
|
||||||
|
824 17435 17704 1
|
||||||
|
825 17451 17700 1
|
||||||
|
826 17454 16878 1
|
||||||
|
827 17467 17451 1
|
||||||
|
828 17464 17492 1
|
||||||
|
829 17149 17507 1
|
||||||
|
830 17492 17511 1
|
||||||
|
831 17499 17707 1
|
||||||
|
832 17500 17502 1
|
||||||
|
833 17502 17464 1
|
||||||
|
834 17507 16796 1
|
||||||
|
835 17511 17149 1
|
||||||
|
836 17526 17716 1
|
||||||
|
837 17545 17565 1
|
||||||
|
838 17558 17526 1
|
||||||
|
839 17565 17558 1
|
||||||
|
840 17568 17545 1
|
||||||
|
841 17576 17578 1
|
||||||
|
842 17578 16863 1
|
||||||
|
843 17597 17576 1
|
||||||
|
844 17639 17641 1
|
||||||
|
845 17641 17642 1
|
||||||
|
846 17642 16111 1
|
||||||
|
847 17653 17639 1
|
||||||
|
848 17688 17330 1
|
||||||
|
849 17363 17752 1
|
||||||
|
850 17690 17363 1
|
||||||
|
851 17700 17435 1
|
||||||
|
852 17704 17454 1
|
||||||
|
853 17707 17500 1
|
||||||
|
854 17711 17725 1
|
||||||
|
855 17716 17711 1
|
||||||
|
856 17725 9 1
|
||||||
|
857 17752 17347 1
|
||||||
|
858 17724 17499 1
|
||||||
|
859 2854 2478 1
|
||||||
|
860 4833 4810 1
|
||||||
|
861 5893 5864 1
|
||||||
|
862 9217 8728 1
|
||||||
|
863 13089 12585 1
|
||||||
|
864 17836 15788 1
|
||||||
|
865 17833 16225 1
|
||||||
|
0
|
||||||
|
# Generated by triangle -pq30a20 cube_mesh.poly
|
||||||
141161
fmm_2d_triangle/cube_mesh.1_linear.msh
Normal file
141161
fmm_2d_triangle/cube_mesh.1_linear.msh
Normal file
File diff suppressed because it is too large
Load Diff
35
fmm_2d_triangle/cube_mesh.poly
Normal file
35
fmm_2d_triangle/cube_mesh.poly
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
16 2 0 1
|
||||||
|
0 0 0 1
|
||||||
|
1 200 0 1
|
||||||
|
2 200 400 1
|
||||||
|
3 250 400 1
|
||||||
|
4 250 0 1
|
||||||
|
5 800 0 1
|
||||||
|
6 800 400 1
|
||||||
|
7 850 400 1
|
||||||
|
8 850 0 1
|
||||||
|
9 1000 0 1
|
||||||
|
10 1000 500 1
|
||||||
|
11 550 500 1
|
||||||
|
12 550 100 1
|
||||||
|
13 500 100 1
|
||||||
|
14 500 500 1
|
||||||
|
15 0 500 1
|
||||||
|
16 0 1
|
||||||
|
0 0 1 1
|
||||||
|
1 1 2 1
|
||||||
|
2 2 3 1
|
||||||
|
3 3 4 1
|
||||||
|
4 4 5 1
|
||||||
|
5 5 6 1
|
||||||
|
6 6 7 1
|
||||||
|
7 7 8 1
|
||||||
|
8 8 9 1
|
||||||
|
9 9 10 1
|
||||||
|
10 10 11 1
|
||||||
|
11 11 12 1
|
||||||
|
12 12 13 1
|
||||||
|
13 13 14 1
|
||||||
|
14 14 15 1
|
||||||
|
15 15 0 1
|
||||||
|
0
|
||||||
580
fmm_2d_triangle/fmm_2d_triangle.cpp
Normal file
580
fmm_2d_triangle/fmm_2d_triangle.cpp
Normal file
@@ -0,0 +1,580 @@
|
|||||||
|
#include "iostream"
|
||||||
|
#include "fstream"
|
||||||
|
#include "sstream"
|
||||||
|
#include "string.h"
|
||||||
|
#include "cmath"
|
||||||
|
#include "vector"
|
||||||
|
#include "iomanip"
|
||||||
|
#include "algorithm"
|
||||||
|
#include "ctime"
|
||||||
|
|
||||||
|
#include "gctl/gctl_stream.h"
|
||||||
|
#include "gctl/gctl_heapsort.h"
|
||||||
|
#include "gctl/gctl_geometry2d.h"
|
||||||
|
#include "gctl/gctl_triangle_io.h"
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
struct vertex;
|
||||||
|
struct ele;
|
||||||
|
|
||||||
|
struct source : public gctl::point2d_c
|
||||||
|
{
|
||||||
|
double rad;
|
||||||
|
double slow;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct vertex : public gctl::vertex2d_c
|
||||||
|
{
|
||||||
|
int tag = 0; //0 = far away, 1 = close, 2 = active
|
||||||
|
double slow; // slow are constant within a element. a mean value must be set in local update
|
||||||
|
double time = 1e+30;
|
||||||
|
double syn_time = 1e+30; //synthetic direct arrive time (only for error test)
|
||||||
|
vector<vertex*> v_neigh; //neighbor vertex unknown amount
|
||||||
|
vector<ele*> e_neigh; //neighbor element unknown amount
|
||||||
|
vector<int> ve_order; // 此顶点在相接三角形中的顶点序号(0、1或者2),与e_neigh中的三角形一一对应,应该能提高计算效率
|
||||||
|
};
|
||||||
|
|
||||||
|
struct ele
|
||||||
|
{
|
||||||
|
int id, tag = 0; //0 = not calculated, 1 = already calculated
|
||||||
|
vertex* vec_ptr[3];
|
||||||
|
double slow;
|
||||||
|
double area;
|
||||||
|
double edge_l[3];
|
||||||
|
};
|
||||||
|
|
||||||
|
double local_update_triangle(double area, double length_ab, double length_ac,
|
||||||
|
double length_bc, double a_time, double b_time, double slow)
|
||||||
|
{
|
||||||
|
///< 沿边ac或bc传播的走时值
|
||||||
|
double direct_time = GCTL_MIN(a_time + slow*length_ac,
|
||||||
|
b_time + slow*length_bc);
|
||||||
|
|
||||||
|
double u = b_time - a_time;
|
||||||
|
double w = slow*slow*length_ab*length_ab - u*u;
|
||||||
|
if (w < 0) return direct_time;
|
||||||
|
|
||||||
|
w = sqrt(w);
|
||||||
|
double rho0 = 2.0*area/length_ab;
|
||||||
|
double ksi0 = sqrt(length_ac*length_ac - rho0*rho0)/length_ab;
|
||||||
|
double ksi = ksi0 - u*rho0/(length_ab*w);
|
||||||
|
|
||||||
|
if (ksi >= 1 || ksi <= 0) return direct_time;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
double trial_time = a_time + u*ksi0 + w*rho0/length_ab;
|
||||||
|
if (trial_time > a_time && trial_time > b_time)
|
||||||
|
return GCTL_MIN(trial_time, direct_time);
|
||||||
|
else return direct_time;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void local_update(vertex* vert_ptr)
|
||||||
|
{
|
||||||
|
int j;
|
||||||
|
double time1, time2;
|
||||||
|
// loop over all neighboring triangles. If any one have two known vertice, update time
|
||||||
|
for (int i = 0; i < vert_ptr->e_neigh.size(); i++)
|
||||||
|
{
|
||||||
|
if (vert_ptr->e_neigh[i]->tag == 0)
|
||||||
|
{
|
||||||
|
j = vert_ptr->ve_order[i];
|
||||||
|
if (vert_ptr->e_neigh[i]->vec_ptr[(j+1)%3]->tag == 2 &&
|
||||||
|
vert_ptr->e_neigh[i]->vec_ptr[(j+2)%3]->tag == 2)
|
||||||
|
{
|
||||||
|
time1 = vert_ptr->e_neigh[i]->vec_ptr[(j+1)%3]->time;
|
||||||
|
time2 = vert_ptr->e_neigh[i]->vec_ptr[(j+2)%3]->time;
|
||||||
|
|
||||||
|
if (time1 <= time2)
|
||||||
|
vert_ptr->time = GCTL_MIN(vert_ptr->time, local_update_triangle(
|
||||||
|
vert_ptr->e_neigh[i]->area, vert_ptr->e_neigh[i]->edge_l[j],
|
||||||
|
vert_ptr->e_neigh[i]->edge_l[(j+2)%3], vert_ptr->e_neigh[i]->edge_l[(j+1)%3],
|
||||||
|
time1, time2, vert_ptr->e_neigh[i]->slow));
|
||||||
|
else
|
||||||
|
vert_ptr->time = GCTL_MIN(vert_ptr->time, local_update_triangle(
|
||||||
|
vert_ptr->e_neigh[i]->area, vert_ptr->e_neigh[i]->edge_l[j],
|
||||||
|
vert_ptr->e_neigh[i]->edge_l[(j+1)%3], vert_ptr->e_neigh[i]->edge_l[(j+2)%3],
|
||||||
|
time2, time1, vert_ptr->e_neigh[i]->slow));
|
||||||
|
vert_ptr->e_neigh[i]->tag = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
class FMM_2D_TRIANGLE
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
FMM_2D_TRIANGLE(){}
|
||||||
|
~FMM_2D_TRIANGLE(){}
|
||||||
|
// read mesh files generated by triangle
|
||||||
|
int ReadFiles(char* filename);
|
||||||
|
// output a Gmsh (.msh) file
|
||||||
|
int OutMsh(char* filename, bool tag);
|
||||||
|
// initialize node slowness. slowness of the source will be used if default slowness is zero.
|
||||||
|
void InitNodeSlowness(double default_slow = 0.0);
|
||||||
|
// add abnormal slowness
|
||||||
|
void SetRectangeSlowness(double ab_slow,double xmin,double xmax,double ymin,double ymax);
|
||||||
|
// initialize triangle's slowness
|
||||||
|
void InitEleSlowness();
|
||||||
|
// calculate synthetic direct arrive time and fmm time
|
||||||
|
void CalculateSolution();
|
||||||
|
// set source parameters
|
||||||
|
int set_init_source(double x,double y,double r,double s);
|
||||||
|
private:
|
||||||
|
int node_num_, ele_num_;
|
||||||
|
vector<vertex> nodes_;
|
||||||
|
vector<ele> elements_;
|
||||||
|
|
||||||
|
vector<vertex*> nodes_ptr_;
|
||||||
|
source init_source_;
|
||||||
|
};
|
||||||
|
|
||||||
|
int FMM_2D_TRIANGLE::ReadFiles(char* filename)
|
||||||
|
{
|
||||||
|
ifstream infile;
|
||||||
|
string temp_str;
|
||||||
|
stringstream temp_ss;
|
||||||
|
|
||||||
|
char full_name[1024];
|
||||||
|
//read node file first
|
||||||
|
strcpy(full_name,filename);
|
||||||
|
strcat(full_name,".node");
|
||||||
|
infile.open(full_name);
|
||||||
|
if (!infile)
|
||||||
|
{
|
||||||
|
cerr << "file open error: " << full_name << endl;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
clog << "reading node file:\t" << full_name;
|
||||||
|
|
||||||
|
getline(infile,temp_str);
|
||||||
|
temp_ss = gctl::str2ss(temp_str);
|
||||||
|
temp_ss >> node_num_;
|
||||||
|
|
||||||
|
nodes_.resize(node_num_);
|
||||||
|
for (int i = 0; i < node_num_; i++)
|
||||||
|
{
|
||||||
|
getline(infile,temp_str);
|
||||||
|
temp_ss = gctl::str2ss(temp_str);
|
||||||
|
temp_ss >> nodes_[i].id >> nodes_[i].x >> nodes_[i].y;
|
||||||
|
}
|
||||||
|
infile.close();
|
||||||
|
|
||||||
|
clog << " ... done!" << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
//read element file
|
||||||
|
int tmp_ids[3];
|
||||||
|
strcpy(full_name,filename);
|
||||||
|
strcat(full_name,".ele");
|
||||||
|
infile.open(full_name);
|
||||||
|
if (!infile)
|
||||||
|
{
|
||||||
|
cerr << "file open error: " << full_name << endl;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
clog << "reading element file:\t" << full_name;
|
||||||
|
|
||||||
|
getline(infile,temp_str);
|
||||||
|
temp_ss = gctl::str2ss(temp_str);
|
||||||
|
temp_ss >> ele_num_;
|
||||||
|
|
||||||
|
elements_.resize(ele_num_);
|
||||||
|
for (int i = 0; i < ele_num_; i++)
|
||||||
|
{
|
||||||
|
getline(infile,temp_str);
|
||||||
|
temp_ss = gctl::str2ss(temp_str);
|
||||||
|
temp_ss >> elements_[i].id >> tmp_ids[0] >> tmp_ids[1] >> tmp_ids[2];
|
||||||
|
elements_[i].vec_ptr[0] = &nodes_[tmp_ids[0]];
|
||||||
|
elements_[i].vec_ptr[1] = &nodes_[tmp_ids[1]];
|
||||||
|
elements_[i].vec_ptr[2] = &nodes_[tmp_ids[2]];
|
||||||
|
}
|
||||||
|
infile.close();
|
||||||
|
|
||||||
|
clog << " ... done!" << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
// reorder the vertice sequence to anti-clockwise
|
||||||
|
gctl::point2d_c v01, v02;
|
||||||
|
vertex *tmp_ptr;
|
||||||
|
for (int i = 0; i < ele_num_; i++)
|
||||||
|
{
|
||||||
|
v01.x = elements_[i].vec_ptr[1]->x - elements_[i].vec_ptr[0]->x;
|
||||||
|
v01.y = elements_[i].vec_ptr[1]->y - elements_[i].vec_ptr[0]->y;
|
||||||
|
|
||||||
|
v02.x = elements_[i].vec_ptr[2]->x - elements_[i].vec_ptr[0]->x;
|
||||||
|
v02.y = elements_[i].vec_ptr[2]->y - elements_[i].vec_ptr[0]->y;
|
||||||
|
|
||||||
|
if (v01.x*v02.y - v01.y*v02.x < 0)
|
||||||
|
{
|
||||||
|
tmp_ptr = elements_[i].vec_ptr[1];
|
||||||
|
elements_[i].vec_ptr[1] = elements_[i].vec_ptr[2];
|
||||||
|
elements_[i].vec_ptr[2] = tmp_ptr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//sort neighboring vertice and triangles for a vertex
|
||||||
|
double p;
|
||||||
|
for (int i = 0; i < ele_num_; i++)
|
||||||
|
{
|
||||||
|
for (int j = 0; j < 3; j++)
|
||||||
|
{
|
||||||
|
// opposite edge length of vertex j
|
||||||
|
elements_[i].edge_l[j] = gctl::geometry2d::distance(elements_[i].vec_ptr[(j+1)%3], elements_[i].vec_ptr[(j+2)%3]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// calculate triangle's area
|
||||||
|
p = 0.5*(elements_[i].edge_l[0] + elements_[i].edge_l[1] + elements_[i].edge_l[2]);
|
||||||
|
elements_[i].area = sqrt(p*(p-elements_[i].edge_l[0])*(p-elements_[i].edge_l[1])*(p-elements_[i].edge_l[2]));
|
||||||
|
|
||||||
|
for (int j = 0; j < 3; j++)
|
||||||
|
{
|
||||||
|
// add current element to each vertex element's neighboring list
|
||||||
|
elements_[i].vec_ptr[j]->e_neigh.push_back(&elements_[i]);
|
||||||
|
elements_[i].vec_ptr[j]->ve_order.push_back(j);
|
||||||
|
// add the other two vertice to current vertex's node neighboring list
|
||||||
|
// this operation will create duplicate enters for nodes's neighbors
|
||||||
|
elements_[i].vec_ptr[j]->v_neigh.push_back(elements_[i].vec_ptr[(j+1)%3]);
|
||||||
|
elements_[i].vec_ptr[j]->v_neigh.push_back(elements_[i].vec_ptr[(j+2)%3]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// remove duplicate enters for neighboring vertice
|
||||||
|
vector<vertex*>::iterator pos;
|
||||||
|
for (int i = 0; i < node_num_; i++)
|
||||||
|
{
|
||||||
|
sort(nodes_[i].v_neigh.begin(),nodes_[i].v_neigh.end()); //对顶点序列由小到大排序
|
||||||
|
pos = unique(nodes_[i].v_neigh.begin(),nodes_[i].v_neigh.end()); //获取重复序列开始的位置
|
||||||
|
nodes_[i].v_neigh.erase(pos,nodes_[i].v_neigh.end()); //删除重复点
|
||||||
|
}
|
||||||
|
|
||||||
|
//output statistics to screen
|
||||||
|
clog << "node number:\t" << node_num_ << endl;
|
||||||
|
clog << "element number:\t" << ele_num_ << endl;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int FMM_2D_TRIANGLE::OutMsh(char* filename, bool tag)
|
||||||
|
{
|
||||||
|
ofstream outfile;
|
||||||
|
if (tag)
|
||||||
|
strcat(filename,"_linear.msh");
|
||||||
|
else
|
||||||
|
strcat(filename,".msh");
|
||||||
|
|
||||||
|
outfile.open(filename);
|
||||||
|
if (!outfile)
|
||||||
|
{
|
||||||
|
cerr << "file open error: " << filename << endl;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
else clog << "writing .msh file:\t" << filename << endl;
|
||||||
|
|
||||||
|
outfile<<"$MeshFormat"<<endl<<"2.2 0 8"<<endl<<"$EndMeshFormat"<<endl<<"$Nodes"<<endl<<node_num_<<endl;
|
||||||
|
// set the first vertex index to 1 to avoid a display bug in Gmsh
|
||||||
|
for (int i = 0; i < node_num_; i++)
|
||||||
|
{
|
||||||
|
outfile << nodes_[i].id + 1 << " " << setprecision(16) << nodes_[i].x << " " << nodes_[i].y << " 0" << endl;
|
||||||
|
}
|
||||||
|
outfile<<"$EndNodes"<<endl;
|
||||||
|
outfile<<"$Elements"<<endl<<ele_num_<<endl;
|
||||||
|
for (int i = 0; i < ele_num_; i++)
|
||||||
|
{
|
||||||
|
outfile << elements_[i].id + 1 <<" 2 1 0";
|
||||||
|
for (int j = 0; j < 3; j++)
|
||||||
|
outfile << " " << elements_[i].vec_ptr[j]->id + 1;
|
||||||
|
outfile << endl;
|
||||||
|
}
|
||||||
|
outfile << "$EndElements"<< endl;
|
||||||
|
if (tag)
|
||||||
|
{
|
||||||
|
int tmp_node_num = 0;
|
||||||
|
for (int i = 0; i < node_num_; i++)
|
||||||
|
{
|
||||||
|
if (nodes_[i].time < 1e+10)
|
||||||
|
tmp_node_num++;
|
||||||
|
}
|
||||||
|
outfile <<"$NodeData"<< endl;
|
||||||
|
outfile<<1<<endl<<"\"fmm arrive time (ms)\""<<endl<<1<<endl<<0.0<<endl
|
||||||
|
<<3<<endl<<0<<endl<<1<<endl<<tmp_node_num<<endl;
|
||||||
|
for (int i = 0; i < node_num_; i++)
|
||||||
|
{
|
||||||
|
if (nodes_[i].time < 1e+10)
|
||||||
|
{
|
||||||
|
outfile << nodes_[i].id + 1 << " " << setprecision(16) << nodes_[i].time << endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
outfile<<"$EndNodeData"<< endl;
|
||||||
|
|
||||||
|
outfile <<"$NodeData"<< endl;
|
||||||
|
outfile<<1<<endl<<"\"synthetic time (ms)\""<<endl<<1<<endl<<0.0<<endl
|
||||||
|
<<3<<endl<<0<<endl<<1<<endl<<tmp_node_num<<endl;
|
||||||
|
for (int i = 0; i < node_num_; i++)
|
||||||
|
{
|
||||||
|
if (nodes_[i].time < 1e+10) // this condition seems unnecessary, we will keep it here until we know better
|
||||||
|
{
|
||||||
|
outfile << nodes_[i].id + 1 << " " << setprecision(16) << nodes_[i].syn_time << endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
outfile<<"$EndNodeData"<< endl;
|
||||||
|
|
||||||
|
// 这里我们顺带统计一下误差的平均值和标准差
|
||||||
|
vector<double> tmp_err(tmp_node_num, 0.0);
|
||||||
|
double mean_err = 0.0;
|
||||||
|
outfile <<"$NodeData"<< endl;
|
||||||
|
outfile<<1<<endl<<"\"fmm - synthetic time (ms)\""<<endl<<1<<endl<<0.0<<endl
|
||||||
|
<<3<<endl<<0<<endl<<1<<endl<<tmp_node_num<<endl;
|
||||||
|
for (int i = 0; i < node_num_; i++)
|
||||||
|
{
|
||||||
|
if (nodes_[i].time < 1e+10)
|
||||||
|
{
|
||||||
|
tmp_err[i] = nodes_[i].time - nodes_[i].syn_time;
|
||||||
|
mean_err += tmp_err[i];
|
||||||
|
|
||||||
|
outfile << nodes_[i].id + 1 << " " << setprecision(16) << tmp_err[i] << endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
outfile<<"$EndNodeData"<< endl;
|
||||||
|
|
||||||
|
mean_err /= 1.0*tmp_node_num;
|
||||||
|
double rms_err = 0.0;
|
||||||
|
for (int i = 0; i < tmp_node_num; i++)
|
||||||
|
{
|
||||||
|
rms_err += pow(tmp_err[i] - mean_err,2);
|
||||||
|
}
|
||||||
|
clog << "mean error = " << mean_err << endl;
|
||||||
|
clog << "rms of error= " << sqrt(rms_err/tmp_node_num) << endl;
|
||||||
|
|
||||||
|
outfile <<"$ElementData"<< endl;
|
||||||
|
outfile<<1<<endl<<"\"model slowness (s/m)\""<<endl<<1<<endl<<0.0<<endl
|
||||||
|
<<3<<endl<<0<<endl<<1<<endl<<ele_num_<<endl;
|
||||||
|
for (int i = 0; i < ele_num_; i++)
|
||||||
|
{
|
||||||
|
outfile << elements_[i].id + 1 << " " << setprecision(16) << elements_[i].slow << endl;
|
||||||
|
}
|
||||||
|
outfile<<"$EndElementData"<< endl;
|
||||||
|
}
|
||||||
|
outfile.close();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void FMM_2D_TRIANGLE::InitNodeSlowness(double default_slow)
|
||||||
|
{
|
||||||
|
// if no background slowness is given.
|
||||||
|
// set all node's slowness as the same as source's slowness.
|
||||||
|
if (default_slow == 0.0)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < node_num_; i++)
|
||||||
|
{
|
||||||
|
nodes_[i].slow = init_source_.slow;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for (int i = 0; i < node_num_; i++)
|
||||||
|
{
|
||||||
|
nodes_[i].slow = default_slow;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// set slowness within a rectangular area.
|
||||||
|
void FMM_2D_TRIANGLE::SetRectangeSlowness(double ab_slow,double xmin,double xmax,double ymin,double ymax)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < node_num_; i++)
|
||||||
|
{
|
||||||
|
if (nodes_[i].x >= xmin && nodes_[i].x <= xmax &&
|
||||||
|
nodes_[i].y >= ymin && nodes_[i].y <= ymax)
|
||||||
|
{
|
||||||
|
nodes_[i].slow = ab_slow;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// set element's slowness as the mean value of three vertice's slowness.
|
||||||
|
void FMM_2D_TRIANGLE::InitEleSlowness()
|
||||||
|
{
|
||||||
|
for (int i = 0; i < ele_num_; i++)
|
||||||
|
{
|
||||||
|
elements_[i].slow = (elements_[i].vec_ptr[0]->slow + elements_[i].vec_ptr[1]->slow + elements_[i].vec_ptr[2]->slow)/3.0;
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
void FMM_2D_TRIANGLE::CalculateSolution()
|
||||||
|
{
|
||||||
|
time_t start_time, stop_time;
|
||||||
|
start_time = time(NULL);
|
||||||
|
clog << "calculating first arrive time ... ";
|
||||||
|
|
||||||
|
//calculate synthetic direct arrival time for all nodes
|
||||||
|
//this calculation is only valid for testing when there is no abnormal slowness or obstacles.
|
||||||
|
for (int i = 0; i < node_num_; i++)
|
||||||
|
{
|
||||||
|
nodes_[i].syn_time = gctl::geometry2d::distance(&nodes_[i], &init_source_) * init_source_.slow;
|
||||||
|
}
|
||||||
|
|
||||||
|
//initialize source nodes and close nodes
|
||||||
|
//set a vertex's tag as 'active' if it is inside the initial radius
|
||||||
|
//and calculate node's time as direct arrival time
|
||||||
|
for (int i = 0; i < node_num_; i++)
|
||||||
|
{
|
||||||
|
if (gctl::geometry2d::distance(&nodes_[i], &init_source_) <= init_source_.rad)
|
||||||
|
{
|
||||||
|
nodes_[i].tag = 2;
|
||||||
|
nodes_[i].time = gctl::geometry2d::distance(&nodes_[i], &init_source_) * init_source_.slow;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//set all close vertice's tag to 'close' and add them to wave front list
|
||||||
|
for (int i = 0; i < node_num_; i++)
|
||||||
|
{
|
||||||
|
if (nodes_[i].tag == 2)
|
||||||
|
{
|
||||||
|
for (int j = 0; j < nodes_[i].v_neigh.size(); j++)
|
||||||
|
{
|
||||||
|
if (nodes_[i].v_neigh[j]->tag == 0)
|
||||||
|
{
|
||||||
|
nodes_[i].v_neigh[j]->tag = 1;
|
||||||
|
nodes_ptr_.push_back(nodes_[i].v_neigh[j]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//assign initial tags for elements
|
||||||
|
//set an element as calculated only if all its three vectice are activated.
|
||||||
|
for (int i = 0; i < ele_num_; i++)
|
||||||
|
{
|
||||||
|
if (elements_[i].vec_ptr[0]->tag == 2 &&
|
||||||
|
elements_[i].vec_ptr[1]->tag == 2 &&
|
||||||
|
elements_[i].vec_ptr[2]->tag == 2)
|
||||||
|
{
|
||||||
|
elements_[i].tag = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//calculate trial time for all close nodes
|
||||||
|
for (int i = 0; i < nodes_ptr_.size(); i++)
|
||||||
|
{
|
||||||
|
local_update(nodes_ptr_[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
gctl::heap_sort<vertex*> time_sorter;
|
||||||
|
//marching forward and updating the close nodes set
|
||||||
|
while (!nodes_ptr_.empty())
|
||||||
|
{
|
||||||
|
// heap sort close nodes pointers to put a node at the first place if it has the smallest time
|
||||||
|
time_sorter.execute(&nodes_ptr_, [](vector<vertex*> *a, int l_id, int r_id)->bool{
|
||||||
|
if (a->at(l_id)->time < a->at(r_id)->time) return true;
|
||||||
|
else return false;
|
||||||
|
});
|
||||||
|
|
||||||
|
//change the first node's tag to 2 and update it's neighbor's time if it is not active (tag != 2)
|
||||||
|
//this step is needed as a vertex may possess smaller time once it's neighbor time is updated.
|
||||||
|
nodes_ptr_[0]->tag = 2;
|
||||||
|
for (int i = 0; i < nodes_ptr_[0]->v_neigh.size(); i++)
|
||||||
|
{
|
||||||
|
// if a neighboring node is not added to the wave front list.
|
||||||
|
// Add it to the list and update it's time
|
||||||
|
if (nodes_ptr_[0]->v_neigh[i]->tag == 0)
|
||||||
|
{
|
||||||
|
nodes_ptr_[0]->v_neigh[i]->tag = 1;
|
||||||
|
local_update(nodes_ptr_[0]->v_neigh[i]);
|
||||||
|
nodes_ptr_.push_back(nodes_ptr_[0]->v_neigh[i]);
|
||||||
|
}
|
||||||
|
// already in the wave front list, update it's time
|
||||||
|
else if (nodes_ptr_[0]->v_neigh[i]->tag == 1)
|
||||||
|
{
|
||||||
|
local_update(nodes_ptr_[0]->v_neigh[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// remove the first node from the wave front list
|
||||||
|
nodes_ptr_.erase(nodes_ptr_.begin());
|
||||||
|
}
|
||||||
|
|
||||||
|
stop_time = time(NULL);
|
||||||
|
clog << stop_time - start_time << " s" << endl;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
int FMM_2D_TRIANGLE::set_init_source(double x, double y, double r, double s)
|
||||||
|
{
|
||||||
|
if (s <=0 || r <= 0)
|
||||||
|
{
|
||||||
|
cerr << "source initialization error!" << endl;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
init_source_.x = x; init_source_.y = y;
|
||||||
|
init_source_.slow = s; init_source_.rad = r;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*******************************************main function here*****************************/
|
||||||
|
// argv[1] -> running mode
|
||||||
|
// argv[2] -> name of the input triangle file
|
||||||
|
// argv[3] -> source parameter
|
||||||
|
// argv[4] -> abnormal slownesses separated by commas
|
||||||
|
|
||||||
|
int main(int argc, char* argv[])
|
||||||
|
{
|
||||||
|
FMM_2D_TRIANGLE instance;
|
||||||
|
if (!strcmp(argv[1],"convert"))
|
||||||
|
{
|
||||||
|
if(!instance.ReadFiles(argv[2]))
|
||||||
|
instance.OutMsh(argv[2],false);
|
||||||
|
}
|
||||||
|
else if (!strcmp(argv[1],"calculate"))
|
||||||
|
{
|
||||||
|
double s_x, s_y, s_rad, s_slow;
|
||||||
|
if (4 != sscanf(argv[3], "%lf/%lf/%lf/%lf", &s_x, &s_y, &s_rad, &s_slow))
|
||||||
|
{
|
||||||
|
cerr << "wrong source parameter." << endl;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(instance.set_init_source(s_x, s_y, s_rad, s_slow)) return 0;
|
||||||
|
if(instance.ReadFiles(argv[2])) return 0;
|
||||||
|
//set node slowness here
|
||||||
|
instance.InitNodeSlowness();
|
||||||
|
|
||||||
|
//add abnormal slowness
|
||||||
|
double ab_slow, ab_xmin, ab_xmax, ab_ymin, ab_ymax;
|
||||||
|
string all_ab_para, old_ab_para;
|
||||||
|
string tmp_str;
|
||||||
|
if (argc >= 5)
|
||||||
|
{
|
||||||
|
old_ab_para = argv[4];
|
||||||
|
gctl::replace_all(all_ab_para, old_ab_para, ",", " ");
|
||||||
|
stringstream tmp_ss = gctl::str2ss(all_ab_para);
|
||||||
|
while (tmp_ss >> tmp_str)
|
||||||
|
{
|
||||||
|
if (5 != sscanf(tmp_str.c_str(), "%lf/%lf/%lf/%lf/%lf",
|
||||||
|
&ab_slow, &ab_xmin, &ab_xmax, &ab_ymin, &ab_ymax))
|
||||||
|
{
|
||||||
|
cerr << "wrong source parameter." << endl;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
instance.SetRectangeSlowness(ab_slow, ab_xmin, ab_xmax, ab_ymin, ab_ymax);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// set element slowness here
|
||||||
|
instance.InitEleSlowness();
|
||||||
|
instance.CalculateSolution();
|
||||||
|
if(instance.OutMsh(argv[2],true)) return 0;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
10
fmm_2d_triangle/get_mesh.sh
Executable file
10
fmm_2d_triangle/get_mesh.sh
Executable file
@@ -0,0 +1,10 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# get triangular mesh with the minimal internal angle set to 30 degrees and the maximal area equals 50
|
||||||
|
#triangle -pq30a50 cube_mesh.poly
|
||||||
|
triangle -pq30a20 cube_mesh.poly
|
||||||
|
# display the mesh using showme (the native triangle software visualization tool)
|
||||||
|
#triangle-showme -b cube_mesh.1
|
||||||
|
# convert to Gmsh (.msh) file and display
|
||||||
|
#./fmm_2d_triangle convert cube_mesh.1 && open -a Gmsh cube_mesh.1.msh
|
||||||
|
./fmm_2d_triangle convert cube_mesh.1 && open -a Gmsh cube_mesh.1.msh
|
||||||
11
fmm_2d_triangle/routine1.sh
Executable file
11
fmm_2d_triangle/routine1.sh
Executable file
@@ -0,0 +1,11 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# compile
|
||||||
|
# g++-9 fmm_2d_triangle.cpp -o fmm_2d_triangle -I/usr/local/include -L/usr/local/lib -lgctl
|
||||||
|
|
||||||
|
# get triangular mesh with the minimal internal angle set to 30 degrees and the maximal area equals 50
|
||||||
|
#triangle -pq30a50 simple_mesh.poly
|
||||||
|
# convert to Gmsh (.msh) file and display
|
||||||
|
#./fmm_2d_triangle convert simple_mesh.1 && open -a Gmsh simple_mesh.1.msh
|
||||||
|
# calculate fmm time
|
||||||
|
./fmm_2d_triangle calculate cube_mesh.1 50/50/30/1.0 && open -a Gmsh cube_mesh.1_linear.msh
|
||||||
15848
fmm_2d_triangle/simple_mesh.1.ele
Normal file
15848
fmm_2d_triangle/simple_mesh.1.ele
Normal file
File diff suppressed because it is too large
Load Diff
23957
fmm_2d_triangle/simple_mesh.1.msh
Normal file
23957
fmm_2d_triangle/simple_mesh.1.msh
Normal file
File diff suppressed because it is too large
Load Diff
8104
fmm_2d_triangle/simple_mesh.1.node
Normal file
8104
fmm_2d_triangle/simple_mesh.1.node
Normal file
File diff suppressed because it is too large
Load Diff
360
fmm_2d_triangle/simple_mesh.1.poly
Normal file
360
fmm_2d_triangle/simple_mesh.1.poly
Normal file
@@ -0,0 +1,360 @@
|
|||||||
|
0 2 0 1
|
||||||
|
356 1
|
||||||
|
0 1 5015 1
|
||||||
|
1 2 4780 1
|
||||||
|
2 3 6485 1
|
||||||
|
3 0 8090 1
|
||||||
|
4 4 1943 1
|
||||||
|
5 5 4119 1
|
||||||
|
6 7 7782 1
|
||||||
|
7 10 4359 1
|
||||||
|
8 12 736 1
|
||||||
|
9 28 7799 1
|
||||||
|
10 81 8083 1
|
||||||
|
11 203 642 1
|
||||||
|
12 215 483 1
|
||||||
|
13 251 7 1
|
||||||
|
14 436 803 1
|
||||||
|
15 443 582 1
|
||||||
|
16 441 733 1
|
||||||
|
17 474 475 1
|
||||||
|
18 483 251 1
|
||||||
|
19 475 12 1
|
||||||
|
20 205 4220 1
|
||||||
|
21 486 751 1
|
||||||
|
22 642 486 1
|
||||||
|
23 645 904 1
|
||||||
|
24 461 441 1
|
||||||
|
25 731 7797 1
|
||||||
|
26 733 731 1
|
||||||
|
27 736 461 1
|
||||||
|
28 751 215 1
|
||||||
|
29 803 474 1
|
||||||
|
30 802 804 1
|
||||||
|
31 804 436 1
|
||||||
|
32 856 858 1
|
||||||
|
33 858 203 1
|
||||||
|
34 838 1046 1
|
||||||
|
35 845 7801 1
|
||||||
|
36 904 856 1
|
||||||
|
37 239 3636 1
|
||||||
|
38 582 845 1
|
||||||
|
39 874 2077 1
|
||||||
|
40 1046 874 1
|
||||||
|
41 1421 7636 1
|
||||||
|
42 1546 3727 1
|
||||||
|
43 1659 2844 1
|
||||||
|
44 1669 2298 1
|
||||||
|
45 2077 4 1
|
||||||
|
46 1943 2445 1
|
||||||
|
47 2074 2449 1
|
||||||
|
48 2175 4572 1
|
||||||
|
49 2411 3273 1
|
||||||
|
50 2445 1669 1
|
||||||
|
51 2298 2074 1
|
||||||
|
52 2449 1659 1
|
||||||
|
53 2452 2852 1
|
||||||
|
54 2653 2793 1
|
||||||
|
55 2656 2776 1
|
||||||
|
56 2776 3037 1
|
||||||
|
57 2799 3271 1
|
||||||
|
58 2844 2452 1
|
||||||
|
59 2852 1546 1
|
||||||
|
60 2868 7743 1
|
||||||
|
61 2624 4565 1
|
||||||
|
62 2614 4035 1
|
||||||
|
63 3007 3470 1
|
||||||
|
64 3037 239 1
|
||||||
|
65 2793 3050 1
|
||||||
|
66 3046 3052 1
|
||||||
|
67 3050 2656 1
|
||||||
|
68 3052 2653 1
|
||||||
|
69 1236 4739 1
|
||||||
|
70 927 5007 1
|
||||||
|
71 2995 3436 1
|
||||||
|
72 3229 3634 1
|
||||||
|
73 3231 3872 1
|
||||||
|
74 3237 3639 1
|
||||||
|
75 3271 3046 1
|
||||||
|
76 2877 7754 1
|
||||||
|
77 3407 4688 1
|
||||||
|
78 3415 4403 1
|
||||||
|
79 3435 3438 1
|
||||||
|
80 3438 2995 1
|
||||||
|
81 3456 3877 1
|
||||||
|
82 3470 3456 1
|
||||||
|
83 3055 3502 1
|
||||||
|
84 3273 3055 1
|
||||||
|
85 3502 2799 1
|
||||||
|
86 3503 5256 1
|
||||||
|
87 3064 3726 1
|
||||||
|
88 3634 205 1
|
||||||
|
89 3339 4774 1
|
||||||
|
90 3436 3229 1
|
||||||
|
91 3636 3237 1
|
||||||
|
92 3639 3231 1
|
||||||
|
93 3727 3064 1
|
||||||
|
94 3726 2877 1
|
||||||
|
95 3784 4545 1
|
||||||
|
96 3836 3856 1
|
||||||
|
97 3843 3861 1
|
||||||
|
98 3861 2614 1
|
||||||
|
99 3642 3871 1
|
||||||
|
100 3871 3007 1
|
||||||
|
101 3872 3642 1
|
||||||
|
102 3877 4224 1
|
||||||
|
103 3856 3843 1
|
||||||
|
104 3848 3836 1
|
||||||
|
105 4035 3435 1
|
||||||
|
106 3583 4043 1
|
||||||
|
107 4043 3339 1
|
||||||
|
108 4079 4084 1
|
||||||
|
109 4093 4079 1
|
||||||
|
110 4096 5380 1
|
||||||
|
111 4098 5113 1
|
||||||
|
112 4105 7943 1
|
||||||
|
113 4113 7939 1
|
||||||
|
114 4119 4093 1
|
||||||
|
115 4120 5 1
|
||||||
|
116 4220 3583 1
|
||||||
|
117 4224 2175 1
|
||||||
|
118 4237 4578 1
|
||||||
|
119 4084 4237 1
|
||||||
|
120 4306 7948 1
|
||||||
|
121 4334 4353 1
|
||||||
|
122 4343 4334 1
|
||||||
|
123 4349 4358 1
|
||||||
|
124 4353 4349 1
|
||||||
|
125 4358 10 1
|
||||||
|
126 4374 4691 1
|
||||||
|
127 4389 4697 1
|
||||||
|
128 4393 4394 1
|
||||||
|
129 4403 4393 1
|
||||||
|
130 4425 4710 1
|
||||||
|
131 4438 4439 1
|
||||||
|
132 4439 4113 1
|
||||||
|
133 4359 4521 1
|
||||||
|
134 4366 4788 1
|
||||||
|
135 4537 4687 1
|
||||||
|
136 4545 4537 1
|
||||||
|
137 4546 4548 1
|
||||||
|
138 4548 3784 1
|
||||||
|
139 4553 4374 1
|
||||||
|
140 4394 3407 1
|
||||||
|
141 4565 3848 1
|
||||||
|
142 4572 4425 1
|
||||||
|
143 4578 3503 1
|
||||||
|
144 4623 5019 1
|
||||||
|
145 4625 5010 1
|
||||||
|
146 4642 4663 1
|
||||||
|
147 4651 4842 1
|
||||||
|
148 4656 4662 1
|
||||||
|
149 4663 4656 1
|
||||||
|
150 4662 4623 1
|
||||||
|
151 4670 4751 1
|
||||||
|
152 4673 4749 1
|
||||||
|
153 4521 645 1
|
||||||
|
154 4533 927 1
|
||||||
|
155 4687 4366 1
|
||||||
|
156 4688 4553 1
|
||||||
|
157 4694 4696 1
|
||||||
|
158 4696 4389 1
|
||||||
|
159 4697 4546 1
|
||||||
|
160 4703 4786 1
|
||||||
|
161 4710 3415 1
|
||||||
|
162 4738 4741 1
|
||||||
|
163 4739 4651 1
|
||||||
|
164 4741 1236 1
|
||||||
|
165 4749 4306 1
|
||||||
|
166 4751 4673 1
|
||||||
|
167 4757 4758 1
|
||||||
|
168 4758 4670 1
|
||||||
|
169 4768 5018 1
|
||||||
|
170 4774 4533 1
|
||||||
|
171 4691 4781 1
|
||||||
|
172 4780 4694 1
|
||||||
|
173 4781 2 1
|
||||||
|
174 4786 2624 1
|
||||||
|
175 4788 4703 1
|
||||||
|
176 4793 4853 1
|
||||||
|
177 4794 4852 1
|
||||||
|
178 4842 4642 1
|
||||||
|
179 4845 5130 1
|
||||||
|
180 4852 2411 1
|
||||||
|
181 4853 4794 1
|
||||||
|
182 5004 5124 1
|
||||||
|
183 5007 5004 1
|
||||||
|
184 5010 4738 1
|
||||||
|
185 5015 4757 1
|
||||||
|
186 5016 4844 1
|
||||||
|
187 4844 1 1
|
||||||
|
188 5018 5016 1
|
||||||
|
189 5041 5140 1
|
||||||
|
190 4967 5119 1
|
||||||
|
191 4977 5209 1
|
||||||
|
192 4973 5098 1
|
||||||
|
193 5098 4098 1
|
||||||
|
194 5109 5315 1
|
||||||
|
195 5118 5212 1
|
||||||
|
196 5120 5222 1
|
||||||
|
197 5119 5118 1
|
||||||
|
198 5124 4625 1
|
||||||
|
199 5019 4845 1
|
||||||
|
200 5130 4768 1
|
||||||
|
201 5131 5132 1
|
||||||
|
202 5132 4793 1
|
||||||
|
203 5140 5258 1
|
||||||
|
204 5209 4973 1
|
||||||
|
205 5212 4977 1
|
||||||
|
206 5222 4967 1
|
||||||
|
207 5256 5131 1
|
||||||
|
208 5113 5369 1
|
||||||
|
209 5315 5120 1
|
||||||
|
210 5252 8026 1
|
||||||
|
211 5258 4105 1
|
||||||
|
212 5369 5041 1
|
||||||
|
213 5373 5109 1
|
||||||
|
214 5318 7974 1
|
||||||
|
215 5325 5705 1
|
||||||
|
216 5380 5373 1
|
||||||
|
217 5564 5703 1
|
||||||
|
218 5703 4096 1
|
||||||
|
219 5705 5564 1
|
||||||
|
220 5567 5752 1
|
||||||
|
221 5752 5325 1
|
||||||
|
222 5776 5794 1
|
||||||
|
223 5762 6600 1
|
||||||
|
224 5878 5809 1
|
||||||
|
225 5809 5318 1
|
||||||
|
226 5794 5878 1
|
||||||
|
227 5644 5776 1
|
||||||
|
228 5971 8012 1
|
||||||
|
229 6201 6435 1
|
||||||
|
230 5848 6471 1
|
||||||
|
231 6235 8022 1
|
||||||
|
232 6270 6494 1
|
||||||
|
233 6200 6474 1
|
||||||
|
234 6328 6679 1
|
||||||
|
235 6348 6347 1
|
||||||
|
236 6347 6235 1
|
||||||
|
237 6364 6521 1
|
||||||
|
238 6369 6408 1
|
||||||
|
239 6382 6390 1
|
||||||
|
240 6390 5762 1
|
||||||
|
241 6402 6448 1
|
||||||
|
242 6317 6594 1
|
||||||
|
243 6408 6382 1
|
||||||
|
244 6432 6439 1
|
||||||
|
245 6434 6437 1
|
||||||
|
246 6437 6201 1
|
||||||
|
247 6435 6432 1
|
||||||
|
248 6439 6402 1
|
||||||
|
249 6442 6486 1
|
||||||
|
250 6448 6442 1
|
||||||
|
251 6447 6459 1
|
||||||
|
252 6452 6481 1
|
||||||
|
253 6457 6462 1
|
||||||
|
254 6459 6452 1
|
||||||
|
255 6462 6447 1
|
||||||
|
256 6406 8035 1
|
||||||
|
257 6370 6518 1
|
||||||
|
258 6471 6348 1
|
||||||
|
259 6481 5848 1
|
||||||
|
260 6485 6457 1
|
||||||
|
261 6486 3 1
|
||||||
|
262 6494 6498 1
|
||||||
|
263 6498 6317 1
|
||||||
|
264 6501 6503 1
|
||||||
|
265 6503 6270 1
|
||||||
|
266 6518 6369 1
|
||||||
|
267 6521 6370 1
|
||||||
|
268 6525 6670 1
|
||||||
|
269 6528 8036 1
|
||||||
|
270 6474 6434 1
|
||||||
|
271 6564 6666 1
|
||||||
|
272 6569 6595 1
|
||||||
|
273 6594 6564 1
|
||||||
|
274 6595 6406 1
|
||||||
|
275 6600 6569 1
|
||||||
|
276 6670 6528 1
|
||||||
|
277 6674 6675 1
|
||||||
|
278 6675 6525 1
|
||||||
|
279 6666 5971 1
|
||||||
|
280 6679 6674 1
|
||||||
|
281 6751 7046 1
|
||||||
|
282 6831 7042 1
|
||||||
|
283 6791 7491 1
|
||||||
|
284 6953 6972 1
|
||||||
|
285 6972 6328 1
|
||||||
|
286 6979 7044 1
|
||||||
|
287 7042 6953 1
|
||||||
|
288 7044 6831 1
|
||||||
|
289 7046 6979 1
|
||||||
|
290 6879 7406 1
|
||||||
|
291 7218 7239 1
|
||||||
|
292 7232 7243 1
|
||||||
|
293 7239 7232 1
|
||||||
|
294 7243 6879 1
|
||||||
|
295 7225 7402 1
|
||||||
|
296 7247 7673 1
|
||||||
|
297 7249 8070 1
|
||||||
|
298 7331 7564 1
|
||||||
|
299 7336 7553 1
|
||||||
|
300 7402 7218 1
|
||||||
|
301 7406 7249 1
|
||||||
|
302 7491 7225 1
|
||||||
|
303 7549 7550 1
|
||||||
|
304 7550 6791 1
|
||||||
|
305 7553 7549 1
|
||||||
|
306 7557 7607 1
|
||||||
|
307 7559 8067 1
|
||||||
|
308 7564 7557 1
|
||||||
|
309 7571 7716 1
|
||||||
|
310 7607 7336 1
|
||||||
|
311 7615 7675 1
|
||||||
|
312 7627 7637 1
|
||||||
|
313 7636 7627 1
|
||||||
|
314 7673 7559 1
|
||||||
|
315 7675 7331 1
|
||||||
|
316 7637 7571 1
|
||||||
|
317 7683 8078 1
|
||||||
|
318 7641 7719 1
|
||||||
|
319 7716 7615 1
|
||||||
|
320 7719 1421 1
|
||||||
|
321 7732 7720 1
|
||||||
|
322 7720 7683 1
|
||||||
|
323 7743 7732 1
|
||||||
|
324 7739 7748 1
|
||||||
|
325 7748 2868 1
|
||||||
|
326 7754 7739 1
|
||||||
|
327 7767 7774 1
|
||||||
|
328 7774 28 1
|
||||||
|
329 127 81 1
|
||||||
|
330 7782 127 1
|
||||||
|
331 7797 443 1
|
||||||
|
332 7799 802 1
|
||||||
|
333 7801 838 1
|
||||||
|
334 7939 4120 1
|
||||||
|
335 7943 4438 1
|
||||||
|
336 7948 4343 1
|
||||||
|
337 7974 5567 1
|
||||||
|
338 8007 8010 1
|
||||||
|
339 8010 6200 1
|
||||||
|
340 8012 8007 1
|
||||||
|
341 6330 5252 1
|
||||||
|
342 8022 6330 1
|
||||||
|
343 8026 5644 1
|
||||||
|
344 8035 6501 1
|
||||||
|
345 8036 6364 1
|
||||||
|
346 7314 8062 1
|
||||||
|
347 8054 8089 1
|
||||||
|
348 8062 8054 1
|
||||||
|
349 7316 7314 1
|
||||||
|
350 8067 0 1
|
||||||
|
351 8070 7247 1
|
||||||
|
352 8078 7641 1
|
||||||
|
353 8083 7767 1
|
||||||
|
354 8089 6751 1
|
||||||
|
355 8090 7316 1
|
||||||
|
0
|
||||||
|
# Generated by triangle -pq30a50 simple_mesh.poly
|
||||||
64149
fmm_2d_triangle/simple_mesh.1_linear.msh
Normal file
64149
fmm_2d_triangle/simple_mesh.1_linear.msh
Normal file
File diff suppressed because it is too large
Load Diff
11
fmm_2d_triangle/simple_mesh.poly
Normal file
11
fmm_2d_triangle/simple_mesh.poly
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
4 2 0 1
|
||||||
|
0 0 0 1
|
||||||
|
1 1000 0 1
|
||||||
|
2 1000 500 1
|
||||||
|
3 0 500 1
|
||||||
|
4 0 1
|
||||||
|
0 0 1 1
|
||||||
|
1 1 2 1
|
||||||
|
2 2 3 1
|
||||||
|
3 3 0 1
|
||||||
|
0
|
||||||
317
fmm_3d_block/fmm_3d_block.cpp
Normal file
317
fmm_3d_block/fmm_3d_block.cpp
Normal file
@@ -0,0 +1,317 @@
|
|||||||
|
#include "iostream"
|
||||||
|
#include "cmath"
|
||||||
|
#include "vector"
|
||||||
|
#include "fstream"
|
||||||
|
#include "iomanip"
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
struct point_3d
|
||||||
|
{
|
||||||
|
double x, y, z;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct source : point_3d
|
||||||
|
{
|
||||||
|
double rad;
|
||||||
|
double slow;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct grid_point : point_3d
|
||||||
|
{
|
||||||
|
int tag = 0; //0 = far away, 1 = close, 2 = active
|
||||||
|
double time = 1e+30;
|
||||||
|
double syn_time = 1e+30; //synthetic direct arrive time (only for error test)
|
||||||
|
double slow;
|
||||||
|
grid_point* neighbor[6] = {NULL,NULL,NULL,NULL,NULL,NULL}; //up down left right in out
|
||||||
|
};
|
||||||
|
typedef vector<grid_point> grid_point_array;
|
||||||
|
typedef vector<grid_point*> ptr_grid_point_array;
|
||||||
|
|
||||||
|
void update_heap(ptr_grid_point_array& a, int i, int n)
|
||||||
|
{
|
||||||
|
int iMax = i,
|
||||||
|
iLeft = 2 * i + 1,
|
||||||
|
iRight = 2 * (i + 1);
|
||||||
|
if (iLeft < n && a[iMax]->time < a[iLeft]->time) {
|
||||||
|
iMax = iLeft;
|
||||||
|
}
|
||||||
|
if (iRight < n && a[iMax]->time < a[iRight]->time) {
|
||||||
|
iMax = iRight;
|
||||||
|
}
|
||||||
|
if (iMax != i) {
|
||||||
|
grid_point* tmp = a[iMax];
|
||||||
|
a[iMax] = a[i];
|
||||||
|
a[i] = tmp;
|
||||||
|
update_heap(a, iMax, n);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
void heap_sort(ptr_grid_point_array& a, int n)
|
||||||
|
{
|
||||||
|
for (int i = (n - 1) / 2; i >= 0; i--) {
|
||||||
|
update_heap(a, i, n);
|
||||||
|
}
|
||||||
|
for (int i = n - 1; i > 0; --i) {
|
||||||
|
|
||||||
|
grid_point* tmp = a[i];
|
||||||
|
a[i] = a[0];
|
||||||
|
a[0] = tmp;
|
||||||
|
update_heap(a, 0, i);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
double dis_point_3d(point_3d a, point_3d b)
|
||||||
|
{
|
||||||
|
return sqrt((a.x-b.x)*(a.x-b.x) + (a.y-b.y)*(a.y-b.y) + (a.z-b.z)*(a.z-b.z));
|
||||||
|
}
|
||||||
|
|
||||||
|
void local_update(grid_point* point_ptr, double delta_h)
|
||||||
|
{
|
||||||
|
//solve a quadratic equation to get the trial time
|
||||||
|
/*
|
||||||
|
double a = 0, b = 0, c = -1.0 * pow(delta_h,2) * pow(point_ptr->slow,2);
|
||||||
|
for (int i = 0; i < 6; i++)
|
||||||
|
{
|
||||||
|
if (point_ptr->neighbor[i] != NULL && point_ptr->neighbor[i]->tag == 2)
|
||||||
|
{
|
||||||
|
a += 1.0;
|
||||||
|
b += -2.0*point_ptr->neighbor[i]->time;
|
||||||
|
c += pow(point_ptr->neighbor[i]->time,2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
// a second order upwind difference scheme
|
||||||
|
|
||||||
|
double a = 0, b = 0, c = -4.0 * pow(delta_h,2) * pow(point_ptr->slow,2);
|
||||||
|
for (int i = 0; i < 6; i++)
|
||||||
|
{
|
||||||
|
if (point_ptr->neighbor[i] != NULL && point_ptr->neighbor[i]->tag == 2)
|
||||||
|
{
|
||||||
|
a += 4.0;
|
||||||
|
b += -8.0*point_ptr->neighbor[i]->time;
|
||||||
|
c += 4.0*pow(point_ptr->neighbor[i]->time,2);
|
||||||
|
if (point_ptr->neighbor[i]->neighbor[i] != NULL && point_ptr->neighbor[i]->neighbor[i]->tag == 2)
|
||||||
|
{
|
||||||
|
a += 5.0;
|
||||||
|
b += -16.0*point_ptr->neighbor[i]->time + 6.0*point_ptr->neighbor[i]->neighbor[i]->time;
|
||||||
|
c += 12.0*pow(point_ptr->neighbor[i]->time,2) - 8.0*point_ptr->neighbor[i]->time*point_ptr->neighbor[i]->neighbor[i]->time
|
||||||
|
+ pow(point_ptr->neighbor[i]->neighbor[i]->time,2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
double delta = b*b - 4.0*a*c; //in a upwind scheme, delta is always bigger than zero
|
||||||
|
point_ptr->time = min(point_ptr->time, 0.5*(sqrt(delta) - b)/a);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
void abnormal_slowness(grid_point_array& grid_recall, double ab_slow,double xmin, double xmax, double ymin, double ymax, double zmin, double zmax)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < grid_recall.size(); i++)
|
||||||
|
{
|
||||||
|
if (grid_recall[i].x >= xmin && grid_recall[i].x <= xmax &&
|
||||||
|
grid_recall[i].y >= ymin && grid_recall[i].y <= ymax &&
|
||||||
|
grid_recall[i].z >= zmin && grid_recall[i].z <= zmax)
|
||||||
|
{
|
||||||
|
grid_recall[i].slow = ab_slow;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(int argc, char const *argv[])
|
||||||
|
{
|
||||||
|
//set grid parameters
|
||||||
|
int xnum = 101;
|
||||||
|
int ynum = 51;
|
||||||
|
int znum = 51;
|
||||||
|
double xmin = 0;
|
||||||
|
double ymin = 0;
|
||||||
|
double zmin = 0;
|
||||||
|
double dh = 10;
|
||||||
|
|
||||||
|
//set source parameters
|
||||||
|
source init_source;
|
||||||
|
init_source.x = 50;
|
||||||
|
init_source.y = 250;
|
||||||
|
init_source.z = 250;
|
||||||
|
init_source.rad = 30;
|
||||||
|
init_source.slow = 1.0;
|
||||||
|
|
||||||
|
//output name
|
||||||
|
char ofilename[1024] = "out.msh";
|
||||||
|
|
||||||
|
//initialize grid
|
||||||
|
grid_point_array grid_3d;
|
||||||
|
grid_3d.resize(xnum*ynum*znum);
|
||||||
|
//down-left corner to up-right corner
|
||||||
|
for (int k = 0; k < znum; k++)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < ynum; i++)
|
||||||
|
{
|
||||||
|
for (int j = 0; j < xnum; j++)
|
||||||
|
{
|
||||||
|
|
||||||
|
grid_3d[i*xnum+j+k*xnum*ynum].x = xmin + dh*j;
|
||||||
|
grid_3d[i*xnum+j+k*xnum*ynum].y = ymin + dh*i;
|
||||||
|
grid_3d[i*xnum+j+k*xnum*ynum].z = zmin + dh*k;
|
||||||
|
grid_3d[i*xnum+j+k*xnum*ynum].slow = init_source.slow;
|
||||||
|
|
||||||
|
if (k <= znum-2) grid_3d[i*xnum+j+k*xnum*ynum].neighbor[0] = &grid_3d[i*xnum+j+(k+1)*xnum*ynum];
|
||||||
|
if (k >= 1) grid_3d[i*xnum+j+k*xnum*ynum].neighbor[1] = &grid_3d[i*xnum+j+(k-1)*xnum*ynum];
|
||||||
|
if (j >= 1) grid_3d[i*xnum+j+k*xnum*ynum].neighbor[2] = &grid_3d[i*xnum+j-1+k*xnum*ynum]; //left
|
||||||
|
if (j <= xnum-2) grid_3d[i*xnum+j+k*xnum*ynum].neighbor[3] = &grid_3d[i*xnum+j+1+k*xnum*ynum]; //right
|
||||||
|
if (i <= ynum-2) grid_3d[i*xnum+j+k*xnum*ynum].neighbor[4] = &grid_3d[(i+1)*xnum+j+k*xnum*ynum]; //up
|
||||||
|
if (i >= 1) grid_3d[i*xnum+j+k*xnum*ynum].neighbor[5] = &grid_3d[(i-1)*xnum+j+k*xnum*ynum]; //down
|
||||||
|
|
||||||
|
//calculate synthetic direct arrive time
|
||||||
|
grid_3d[i*xnum+j+k*xnum*ynum].syn_time = dis_point_3d(grid_3d[i*xnum+j+k*xnum*ynum], init_source) * init_source.slow;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//add abnormal slowness here
|
||||||
|
//abnormal_slowness(grid_3d,1e+30,200,250,0,500,0,250);
|
||||||
|
//abnormal_slowness(grid_3d,1e+30,500,550,0,500,250,500);
|
||||||
|
//abnormal_slowness(grid_3d,1e+30,800,850,0,500,0,250);
|
||||||
|
|
||||||
|
ptr_grid_point_array close_node_ptr;
|
||||||
|
//initialize source nodes and close nodes;
|
||||||
|
for (int i = 0; i < xnum*ynum*znum; i++)
|
||||||
|
{
|
||||||
|
if (dis_point_3d(grid_3d[i],init_source) <= init_source.rad)
|
||||||
|
{
|
||||||
|
grid_3d[i].tag = 2;
|
||||||
|
grid_3d[i].time = dis_point_3d(grid_3d[i],init_source) * init_source.slow;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < xnum*ynum*znum; i++)
|
||||||
|
{
|
||||||
|
if (grid_3d[i].tag == 2)
|
||||||
|
{
|
||||||
|
for (int j = 0; j < 6; j++)
|
||||||
|
{
|
||||||
|
if (grid_3d[i].neighbor[j] != NULL && grid_3d[i].neighbor[j]->tag == 0)
|
||||||
|
{
|
||||||
|
grid_3d[i].neighbor[j]->tag = 1;
|
||||||
|
close_node_ptr.push_back(grid_3d[i].neighbor[j]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//calculate trial time for all close nodes
|
||||||
|
for (int i = 0; i < close_node_ptr.size(); i++)
|
||||||
|
{
|
||||||
|
local_update(close_node_ptr[i], dh);
|
||||||
|
}
|
||||||
|
|
||||||
|
//marching forward and updating the close nodes set
|
||||||
|
while (!close_node_ptr.empty())
|
||||||
|
{
|
||||||
|
// heap sort close nodes pointers to put the node first that has smallest time
|
||||||
|
heap_sort(close_node_ptr,close_node_ptr.size());
|
||||||
|
|
||||||
|
//change the first node's tag to 2 and update it's neighbor's time if it is not active
|
||||||
|
close_node_ptr[0]->tag = 2;
|
||||||
|
for (int i = 0; i < 6; i++)
|
||||||
|
{
|
||||||
|
if (close_node_ptr[0]->neighbor[i] != NULL && close_node_ptr[0]->neighbor[i]->tag == 0)
|
||||||
|
{
|
||||||
|
close_node_ptr[0]->neighbor[i]->tag = 1;
|
||||||
|
local_update(close_node_ptr[0]->neighbor[i], dh);
|
||||||
|
close_node_ptr.push_back(close_node_ptr[0]->neighbor[i]);
|
||||||
|
}
|
||||||
|
else if (close_node_ptr[0]->neighbor[i] != NULL && close_node_ptr[0]->neighbor[i]->tag == 1)
|
||||||
|
{
|
||||||
|
local_update(close_node_ptr[0]->neighbor[i], dh);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
close_node_ptr.erase(close_node_ptr.begin());
|
||||||
|
}
|
||||||
|
|
||||||
|
//output Gmsh(.msh) file
|
||||||
|
ofstream outfile;
|
||||||
|
outfile.open(ofilename);
|
||||||
|
if (!outfile)
|
||||||
|
{
|
||||||
|
cerr << "file open error: " << ofilename << endl;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
outfile<<"$MeshFormat"<<endl<<"2.2 0 8"<<endl<<"$EndMeshFormat"<<endl<<"$Nodes"<<endl<<xnum*ynum*znum<<endl;
|
||||||
|
// set the first vertex index to 1 to avoid a display bug in Gmsh
|
||||||
|
for (int i = 0; i < xnum*ynum*znum; i++)
|
||||||
|
{
|
||||||
|
outfile << i + 1 << " " << setprecision(16) << grid_3d[i].x << " " << grid_3d[i].y << " " << grid_3d[i].z << endl;
|
||||||
|
}
|
||||||
|
outfile<<"$EndNodes"<<endl;
|
||||||
|
|
||||||
|
outfile<<"$Elements"<<endl<< (xnum-1)*(ynum-1)*(znum-1) <<endl;
|
||||||
|
for (int k = 0; k < znum-1; k++)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < ynum-1; i++)
|
||||||
|
{
|
||||||
|
for (int j = 0; j < xnum-1; j++)
|
||||||
|
{
|
||||||
|
outfile << 1 + j + i*(xnum-1) + k*(xnum-1)*(ynum-1) <<" 5 1 0 ";
|
||||||
|
outfile << 1 + j + i*xnum + k*xnum*ynum << " "
|
||||||
|
<< 1 + j + i*xnum + k*xnum*ynum + 1 << " "
|
||||||
|
<< 1 + j + (i+1)*xnum + k*xnum*ynum + 1 << " "
|
||||||
|
<< 1 + j + (i+1)*xnum + k*xnum*ynum << " "
|
||||||
|
<< 1 + j + i*xnum + (k+1)*xnum*ynum << " "
|
||||||
|
<< 1 + j + i*xnum + (k+1)*xnum*ynum + 1 << " "
|
||||||
|
<< 1 + j + (i+1)*xnum + (k+1)*xnum*ynum + 1 << " "
|
||||||
|
<< 1 + j + (i+1)*xnum + (k+1)*xnum*ynum << endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
outfile << "$EndElements"<< endl;
|
||||||
|
|
||||||
|
int tmp_node_num = 0;
|
||||||
|
for (int i = 0; i < xnum*ynum*znum; i++)
|
||||||
|
{
|
||||||
|
if (grid_3d[i].time < 1e+10)
|
||||||
|
tmp_node_num++;
|
||||||
|
}
|
||||||
|
outfile <<"$NodeData"<< endl;
|
||||||
|
outfile<<1<<endl<<"\"fmm arrive time (ms)\""<<endl<<1<<endl<<0.0<<endl
|
||||||
|
<<3<<endl<<0<<endl<<1<<endl<<tmp_node_num<<endl;
|
||||||
|
for (int i = 0; i < xnum*ynum*znum; i++)
|
||||||
|
{
|
||||||
|
if (grid_3d[i].time < 1e+10)
|
||||||
|
{
|
||||||
|
outfile << i + 1 << " " << setprecision(16) << grid_3d[i].time << endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
outfile<<"$EndNodeData"<< endl;
|
||||||
|
|
||||||
|
outfile <<"$NodeData"<< endl;
|
||||||
|
outfile<<1<<endl<<"\"fmm - synthetic time (ms)\""<<endl<<1<<endl<<0.0<<endl
|
||||||
|
<<3<<endl<<0<<endl<<1<<endl<<tmp_node_num<<endl;
|
||||||
|
for (int i = 0; i < xnum*ynum*znum; i++)
|
||||||
|
{
|
||||||
|
if (grid_3d[i].time < 1e+10)
|
||||||
|
{
|
||||||
|
outfile << i + 1 << " " << setprecision(16) << grid_3d[i].time - grid_3d[i].syn_time << endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
outfile<<"$EndNodeData"<< endl;
|
||||||
|
|
||||||
|
outfile <<"$NodeData"<< endl;
|
||||||
|
outfile<<1<<endl<<"\"node tag\""<<endl<<1<<endl<<0.0<<endl
|
||||||
|
<<3<<endl<<0<<endl<<1<<endl<<xnum*ynum*znum<<endl;
|
||||||
|
for (int i = 0; i < xnum*ynum*znum; i++)
|
||||||
|
{
|
||||||
|
outfile << i + 1 << " " << setprecision(16) << grid_3d[i].tag << endl;
|
||||||
|
}
|
||||||
|
outfile<<"$EndNodeData"<< endl;
|
||||||
|
|
||||||
|
outfile.close();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
1300843
fmm_3d_block/out.msh
Normal file
1300843
fmm_3d_block/out.msh
Normal file
File diff suppressed because it is too large
Load Diff
7
fmm_3d_block/run.sh
Executable file
7
fmm_3d_block/run.sh
Executable file
@@ -0,0 +1,7 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
g++-9 fmm_3d_block.cpp -o fmm_3d_block -O2
|
||||||
|
|
||||||
|
./fmm_3d_block
|
||||||
|
|
||||||
|
open -a Gmsh out.msh
|
||||||
Reference in New Issue
Block a user