-
Notifications
You must be signed in to change notification settings - Fork 36
/
test2s_h.c
106 lines (73 loc) · 2.42 KB
/
test2s_h.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
// gcc -Wall -Wextra test2s_h.c -Xlinker -rpath=../lib
// -L ../lib -ljigsaw -o test2s_h
// Use MARCHE to set "gradient-limits" on mesh-spacing data
//
// ensures: |GRAD(h)| <= slope_limit(x),
//
// via a "fast-marching" solver for the Hamilton-Jacobi eq.
# include "../inc/lib_jigsaw.h"
# include "print.h"
# include "stdio.h"
int test2s_h (int _verb)
{
int _retv = 0;
/*-------------------------------- setup JIGSAW types */
jigsaw_jig_t _jjig ;
jigsaw_init_jig_t(&_jjig) ;
jigsaw_msh_t _hfun ;
jigsaw_init_msh_t(&_hfun) ;
/*-------------------------------- setup JIGSAW hfun. */
real_t PI = 3.14159265358979323846 ;
real_t _radii[3] = {+1., +1., +1.
} ;
real_t _hfun_xgrid[3] = {
-1.0 * PI, 0.0 * PI, +1.0 * PI
} ;
real_t _hfun_ygrid[3] = {
-0.5 * PI, 0.0 * PI, +0.5 * PI
} ;
fp32_t _hfun_value[9] = {
2.f, 2.f, 2.f, 2.f, 1.f, 2.f, 2.f,
2.f, 2.f
} ;
fp32_t _hfun_slope[9] = {
.4f, .4f, .4f, .4f, .1f, .4f, .4f,
.4f, .4f
} ;
_hfun._flags =
JIGSAW_ELLIPSOID_GRID ;
_hfun._radii._data = &_radii[0] ;
_hfun._radii._size = +3 ;
_hfun._xgrid._data = &_hfun_xgrid[0] ;
_hfun._xgrid._size = +3 ;
_hfun._ygrid._data = &_hfun_ygrid[0] ;
_hfun._ygrid._size = +3 ;
_hfun._value._data = &_hfun_value[0] ;
_hfun._value._size = +9 ;
_hfun._slope._data = &_hfun_slope[0] ;
_hfun._slope._size = +9 ;
/*-------------------------------- build MARCHE hfun. */
_jjig._verbosity = _verb;
_retv = marche (
& _jjig , // the config. opts
& _hfun ) ; // the spacing h(x)
/*-------------------------------- print MARCHE hfun. */
if (_verb > 0 )
{
printf("\n VALUE: \n\n") ;
for (size_t _ipos = +0;
_ipos != _hfun._value._size ;
++_ipos )
{
printf("%1.4f\n",
_hfun._value._data[_ipos]
) ;
}
}
printf (
"[2s_h] MARCHE returned code : %d \n", _retv) ;
return _retv ;
}
# ifndef __SKIP_MAIN__
int main () { return test2s_h(1) ; }
# endif//__SKIP_MAIN__