Mercurial > repos > public > sbplib
comparison +sbp/D4Lonely.m @ 330:25b01643e438 feature/beams
Added a string method to OpSet.
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Thu, 29 Sep 2016 12:56:37 +0200 |
parents | 31d6698c1edf |
children |
comparison
equal
deleted
inserted
replaced
329:bf801c3709be | 330:25b01643e438 |
---|---|
10 e_l, e_r % Left and right boundary operator | 10 e_l, e_r % Left and right boundary operator |
11 d1_l, d1_r % Left and right boundary first derivative | 11 d1_l, d1_r % Left and right boundary first derivative |
12 d2_l, d2_r % Left and right boundary second derivative | 12 d2_l, d2_r % Left and right boundary second derivative |
13 d3_l, d3_r % Left and right boundary third derivative | 13 d3_l, d3_r % Left and right boundary third derivative |
14 borrowing % Struct with borrowing limits for different norm matrices | 14 borrowing % Struct with borrowing limits for different norm matrices |
15 opt | |
16 order | |
15 end | 17 end |
16 | 18 |
17 methods | 19 methods |
18 function obj = D4Lonely(m, lim, order, opt) | 20 function obj = D4Lonely(m, lim, order, opt) |
19 default_arg('opt', '') | 21 default_arg('opt', '') |
22 | |
23 obj.opt = opt; | |
24 obj.order = order; | |
20 | 25 |
21 x_l = lim{1}; | 26 x_l = lim{1}; |
22 x_r = lim{2}; | 27 x_r = lim{2}; |
23 L = x_r-x_l; | 28 L = x_r-x_l; |
24 obj.h = L/(m-1); | 29 obj.h = L/(m-1); |
25 obj.x = linspace(x_l, x_r,m)'; | 30 obj.x = linspace(x_l, x_r,m)'; |
26 | 31 |
27 if order == 2 | 32 if order == 2 |
28 [H, HI, D1, D2, D4, e_l, e_r, M4, d2_l, d2_r, d3_l, d3_r, d1_l, d1_r] = ... | 33 switch opt |
29 sbp.implementations.d4_variable_2(m, obj.h); | 34 case '' |
30 obj.borrowing.N.S2 = 1.2500; | 35 [H, HI, D1, D2, D4, e_l, e_r, M4, d2_l, d2_r, d3_l, d3_r, d1_l, d1_r] = ... |
31 obj.borrowing.N.S3 = 0.4000; | 36 sbp.implementations.d4_variable_2(m, obj.h); |
37 obj.borrowing.N.S2 = 1.2500; | |
38 obj.borrowing.N.S3 = 0.4000; | |
39 otherwise | |
40 error('Invalid operator option.'); | |
41 end | |
32 | 42 |
33 elseif order == 4 | 43 elseif order == 4 |
34 switch opt | 44 switch opt |
35 case 'min_boundary_points' | 45 case 'min_boundary_points' |
36 [H, HI, D4, e_l, e_r, M4, d2_l, d2_r, d3_l, d3_r, d1_l, d1_r] = ... | 46 [H, HI, D4, e_l, e_r, M4, d2_l, d2_r, d3_l, d3_r, d1_l, d1_r] = ... |
37 sbp.implementations.d4_lonely_4_min_boundary_points(m, obj.h); | 47 sbp.implementations.d4_lonely_4_min_boundary_points(m, obj.h); |
38 obj.borrowing.N.S2 = 0.6244; | 48 obj.borrowing.N.S2 = 0.6244; |
39 obj.borrowing.N.S3 = 1.3961; | 49 obj.borrowing.N.S3 = 1.3961; |
40 otherwise | 50 case '' |
41 [H, HI, D1, D2, D4, e_l, e_r, M4, d2_l, d2_r, d3_l, d3_r, d1_l, d1_r] = ... | 51 [H, HI, D1, D2, D4, e_l, e_r, M4, d2_l, d2_r, d3_l, d3_r, d1_l, d1_r] = ... |
42 sbp.implementations.d4_variable_4(m, obj.h); | 52 sbp.implementations.d4_variable_4(m, obj.h); |
43 obj.borrowing.N.S2 = 0.5055; | 53 obj.borrowing.N.S2 = 0.5055; |
44 obj.borrowing.N.S3 = 0.9290; | 54 obj.borrowing.N.S3 = 0.9290; |
55 otherwise | |
56 error('Invalid operator option.'); | |
45 end | 57 end |
46 | 58 |
47 elseif order == 6 | 59 elseif order == 6 |
48 switch opt | 60 switch opt |
49 case '2' | 61 case '2' |
59 case 'min_boundary_points' | 71 case 'min_boundary_points' |
60 [H, HI, D4, e_l, e_r, M4, d2_l, d2_r, d3_l, d3_r, d1_l, d1_r] = ... | 72 [H, HI, D4, e_l, e_r, M4, d2_l, d2_r, d3_l, d3_r, d1_l, d1_r] = ... |
61 sbp.implementations.d4_lonely_6_min_boundary_points(m, obj.h); | 73 sbp.implementations.d4_lonely_6_min_boundary_points(m, obj.h); |
62 obj.borrowing.N.S2 = 0.3569; | 74 obj.borrowing.N.S2 = 0.3569; |
63 obj.borrowing.N.S3 = 0.1908; | 75 obj.borrowing.N.S3 = 0.1908; |
64 otherwise | 76 case '' |
65 [H, HI, D1, D2, D4, e_l, e_r, M4, d2_l, d2_r, d3_l, d3_r, d1_l, d1_r] = ... | 77 [H, HI, D1, D2, D4, e_l, e_r, M4, d2_l, d2_r, d3_l, d3_r, d1_l, d1_r] = ... |
66 sbp.implementations.d4_variable_6(m, obj.h); | 78 sbp.implementations.d4_variable_6(m, obj.h); |
67 obj.borrowing.N.S2 = 0.3259; | 79 obj.borrowing.N.S2 = 0.3259; |
68 obj.borrowing.N.S3 = 0.1580; | 80 obj.borrowing.N.S3 = 0.1580; |
81 otherwise | |
82 error('Invalid operator option.'); | |
69 end | 83 end |
70 | 84 |
71 elseif order == 8 | 85 elseif order == 8 |
72 switch opt | 86 switch opt |
73 case 'min_boundary_points' | 87 case 'min_boundary_points' |
74 [H, HI, D4, e_l, e_r, M4, d2_l, d2_r, d3_l, d3_r, d1_l, d1_r] = ... | 88 [H, HI, D4, e_l, e_r, M4, d2_l, d2_r, d3_l, d3_r, d1_l, d1_r] = ... |
75 sbp.implementations.d4_lonely_8_min_boundary_points(m, obj.h); | 89 sbp.implementations.d4_lonely_8_min_boundary_points(m, obj.h); |
76 obj.borrowing.N.S2 = 0.2804; | 90 obj.borrowing.N.S2 = 0.2804; |
77 obj.borrowing.N.S3 = 0.0740; | 91 obj.borrowing.N.S3 = 0.0740; |
78 otherwise | 92 case '' |
79 [H, HI, D4, e_l, e_r, M4, d2_l, d2_r, d3_l, d3_r, d1_l, d1_r] = ... | 93 [H, HI, D4, e_l, e_r, M4, d2_l, d2_r, d3_l, d3_r, d1_l, d1_r] = ... |
80 sbp.implementations.d4_lonely_8_higher_boundary_order(m, obj.h); | 94 sbp.implementations.d4_lonely_8_higher_boundary_order(m, obj.h); |
81 obj.borrowing.N.S2 = 0.2475; | 95 obj.borrowing.N.S2 = 0.2475; |
82 obj.borrowing.N.S3 = 0.0401; | 96 obj.borrowing.N.S3 = 0.0401; |
97 otherwise | |
98 error('Invalid operator option.'); | |
83 end | 99 end |
84 else | 100 else |
85 error('Invalid operator order.'); | 101 error('Invalid operator order.'); |
86 end | 102 end |
87 | 103 |
98 obj.d2_l = d2_l; | 114 obj.d2_l = d2_l; |
99 obj.d2_r = d2_r; | 115 obj.d2_r = d2_r; |
100 obj.d3_l = d3_l; | 116 obj.d3_l = d3_l; |
101 obj.d3_r = d3_r; | 117 obj.d3_r = d3_r; |
102 end | 118 end |
119 | |
120 function str = string(obj) | |
121 str = [class(obj) '_' num2str(obj.order) '_' obj.opt]; | |
122 end | |
103 end | 123 end |
104 end | 124 end |