Mercurial > repos > public > sbplib
comparison +sbp/D1Nonequidistant.m @ 1300:196123459178
Merge in feature/boundary_optimized_grids
author | Vidar Stiernström <vidar.stiernstrom@it.uu.se> |
---|---|
date | Wed, 08 Jul 2020 18:22:54 +0200 |
parents | 38653d26225c |
children | 8978521b0f06 |
comparison
equal
deleted
inserted
replaced
1250:8ec777fb473e | 1300:196123459178 |
---|---|
17 | 17 |
18 default_arg('option','Accurate'); | 18 default_arg('option','Accurate'); |
19 % 'Accurate' operators are optimized for accuracy | 19 % 'Accurate' operators are optimized for accuracy |
20 % 'Minimal' operators have the smallest possible boundary | 20 % 'Minimal' operators have the smallest possible boundary |
21 % closure | 21 % closure |
22 | |
23 x_l = lim{1}; | |
24 x_r = lim{2}; | |
25 L = x_r-x_l; | |
26 | |
27 switch option | 22 switch option |
28 | 23 |
29 case {'Accurate','accurate','A'} | 24 case {'Accurate','accurate','A'} |
30 | 25 [x,h] = sbp.util.accurateBoundaryOptimizedGrid(lim,m,order); |
31 if order == 4 | 26 if order == 4 |
32 [obj.D1,obj.H,obj.x,obj.h] = ... | 27 [obj.D1,obj.H] = ... |
33 sbp.implementations.d1_noneq_4(m,L); | 28 sbp.implementations.d1_noneq_4(m,h); |
34 elseif order == 6 | 29 elseif order == 6 |
35 [obj.D1,obj.H,obj.x,obj.h] = ... | 30 [obj.D1,obj.H] = ... |
36 sbp.implementations.d1_noneq_6(m,L); | 31 sbp.implementations.d1_noneq_6(m,h); |
37 elseif order == 8 | 32 elseif order == 8 |
38 [obj.D1,obj.H,obj.x,obj.h] = ... | 33 [obj.D1,obj.H] = ... |
39 sbp.implementations.d1_noneq_8(m,L); | 34 sbp.implementations.d1_noneq_8(m,h); |
40 elseif order == 10 | 35 elseif order == 10 |
41 [obj.D1,obj.H,obj.x,obj.h] = ... | 36 [obj.D1,obj.H] = ... |
42 sbp.implementations.d1_noneq_10(m,L); | 37 sbp.implementations.d1_noneq_10(m,h); |
43 elseif order == 12 | 38 elseif order == 12 |
44 [obj.D1,obj.H,obj.x,obj.h] = ... | 39 [obj.D1,obj.H] = ... |
45 sbp.implementations.d1_noneq_12(m,L); | 40 sbp.implementations.d1_noneq_12(m,h); |
46 else | 41 else |
47 error('Invalid operator order %d.',order); | 42 error('Invalid operator order %d.',order); |
48 end | 43 end |
49 | 44 |
50 case {'Minimal','minimal','M'} | 45 case {'Minimal','minimal','M'} |
51 | 46 [x,h] = sbp.util.minimalBoundaryOptimizedGrid(lim,m,order); |
52 if order == 4 | 47 if order == 4 |
53 [obj.D1,obj.H,obj.x,obj.h] = ... | 48 [obj.D1,obj.H] = ... |
54 sbp.implementations.d1_noneq_minimal_4(m,L); | 49 sbp.implementations.d1_noneq_minimal_4(m,h); |
55 elseif order == 6 | 50 elseif order == 6 |
56 [obj.D1,obj.H,obj.x,obj.h] = ... | 51 [obj.D1,obj.H] = ... |
57 sbp.implementations.d1_noneq_minimal_6(m,L); | 52 sbp.implementations.d1_noneq_minimal_6(m,h); |
58 elseif order == 8 | 53 elseif order == 8 |
59 [obj.D1,obj.H,obj.x,obj.h] = ... | 54 [obj.D1,obj.H] = ... |
60 sbp.implementations.d1_noneq_minimal_8(m,L); | 55 sbp.implementations.d1_noneq_minimal_8(m,h); |
61 elseif order == 10 | 56 elseif order == 10 |
62 [obj.D1,obj.H,obj.x,obj.h] = ... | 57 [obj.D1,obj.H] = ... |
63 sbp.implementations.d1_noneq_minimal_10(m,L); | 58 sbp.implementations.d1_noneq_minimal_10(m,h); |
64 elseif order == 12 | 59 elseif order == 12 |
65 [obj.D1,obj.H,obj.x,obj.h] = ... | 60 [obj.D1,obj.H] = ... |
66 sbp.implementations.d1_noneq_minimal_12(m,L); | 61 sbp.implementations.d1_noneq_minimal_12(m,h); |
67 else | 62 else |
68 error('Invalid operator order %d.',order); | 63 error('Invalid operator order %d.',order); |
69 end | 64 end |
70 | 65 |
71 end | 66 end |
72 | 67 obj.h = h; |
73 obj.x = obj.x + x_l; | 68 obj.x = x; |
74 | 69 |
75 obj.e_l = sparse(m,1); | 70 obj.e_l = sparse(m,1); |
76 obj.e_r = sparse(m,1); | 71 obj.e_r = sparse(m,1); |
77 obj.e_l(1) = 1; | 72 obj.e_l(1) = 1; |
78 obj.e_r(m) = 1; | 73 obj.e_r(m) = 1; |