Mercurial > repos > public > sbplib
changeset 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 | bf801c3709be |
children | ba0fee896b41 |
files | +sbp/D4Lonely.m +sbp/D4Variable.m +sbp/OpSet.m |
diffstat | 3 files changed, 38 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
diff -r bf801c3709be -r 25b01643e438 +sbp/D4Lonely.m --- a/+sbp/D4Lonely.m Wed Sep 28 16:31:06 2016 +0200 +++ b/+sbp/D4Lonely.m Thu Sep 29 12:56:37 2016 +0200 @@ -12,12 +12,17 @@ d2_l, d2_r % Left and right boundary second derivative d3_l, d3_r % Left and right boundary third derivative borrowing % Struct with borrowing limits for different norm matrices + opt + order end methods function obj = D4Lonely(m, lim, order, opt) default_arg('opt', '') + obj.opt = opt; + obj.order = order; + x_l = lim{1}; x_r = lim{2}; L = x_r-x_l; @@ -25,10 +30,15 @@ obj.x = linspace(x_l, x_r,m)'; if order == 2 - [H, HI, D1, D2, D4, e_l, e_r, M4, d2_l, d2_r, d3_l, d3_r, d1_l, d1_r] = ... - sbp.implementations.d4_variable_2(m, obj.h); - obj.borrowing.N.S2 = 1.2500; - obj.borrowing.N.S3 = 0.4000; + switch opt + case '' + [H, HI, D1, D2, D4, e_l, e_r, M4, d2_l, d2_r, d3_l, d3_r, d1_l, d1_r] = ... + sbp.implementations.d4_variable_2(m, obj.h); + obj.borrowing.N.S2 = 1.2500; + obj.borrowing.N.S3 = 0.4000; + otherwise + error('Invalid operator option.'); + end elseif order == 4 switch opt @@ -37,11 +47,13 @@ sbp.implementations.d4_lonely_4_min_boundary_points(m, obj.h); obj.borrowing.N.S2 = 0.6244; obj.borrowing.N.S3 = 1.3961; - otherwise + case '' [H, HI, D1, D2, D4, e_l, e_r, M4, d2_l, d2_r, d3_l, d3_r, d1_l, d1_r] = ... sbp.implementations.d4_variable_4(m, obj.h); obj.borrowing.N.S2 = 0.5055; obj.borrowing.N.S3 = 0.9290; + otherwise + error('Invalid operator option.'); end elseif order == 6 @@ -61,11 +73,13 @@ sbp.implementations.d4_lonely_6_min_boundary_points(m, obj.h); obj.borrowing.N.S2 = 0.3569; obj.borrowing.N.S3 = 0.1908; - otherwise + case '' [H, HI, D1, D2, D4, e_l, e_r, M4, d2_l, d2_r, d3_l, d3_r, d1_l, d1_r] = ... sbp.implementations.d4_variable_6(m, obj.h); obj.borrowing.N.S2 = 0.3259; obj.borrowing.N.S3 = 0.1580; + otherwise + error('Invalid operator option.'); end elseif order == 8 @@ -75,11 +89,13 @@ sbp.implementations.d4_lonely_8_min_boundary_points(m, obj.h); obj.borrowing.N.S2 = 0.2804; obj.borrowing.N.S3 = 0.0740; - otherwise + case '' [H, HI, D4, e_l, e_r, M4, d2_l, d2_r, d3_l, d3_r, d1_l, d1_r] = ... sbp.implementations.d4_lonely_8_higher_boundary_order(m, obj.h); obj.borrowing.N.S2 = 0.2475; obj.borrowing.N.S3 = 0.0401; + otherwise + error('Invalid operator option.'); end else error('Invalid operator order.'); @@ -100,5 +116,9 @@ obj.d3_l = d3_l; obj.d3_r = d3_r; end + + function str = string(obj) + str = [class(obj) '_' num2str(obj.order) '_' obj.opt]; + end end end \ No newline at end of file
diff -r bf801c3709be -r 25b01643e438 +sbp/D4Variable.m --- a/+sbp/D4Variable.m Wed Sep 28 16:31:06 2016 +0200 +++ b/+sbp/D4Variable.m Thu Sep 29 12:56:37 2016 +0200 @@ -16,6 +16,7 @@ d2_l, d2_r % Left and right boundary second derivative d3_l, d3_r % Left and right boundary third derivative borrowing % Struct with borrowing limits for different norm matrices + order end methods @@ -46,6 +47,7 @@ end obj.m = m; + obj.order = order; obj.H = H; obj.HI = HI; @@ -62,5 +64,9 @@ obj.d3_l = d3_l; obj.d3_r = d3_r; end + + function str = string(obj) + str = [class(obj) '_' num2str(obj.order)]; + end end end \ No newline at end of file
diff -r bf801c3709be -r 25b01643e438 +sbp/OpSet.m --- a/+sbp/OpSet.m Wed Sep 28 16:31:06 2016 +0200 +++ b/+sbp/OpSet.m Thu Sep 29 12:56:37 2016 +0200 @@ -6,4 +6,9 @@ x % Grid end + methods (Abstract) + % Returns a string representation of the type of operator. + str = string(obj) + end + end \ No newline at end of file