comparison +sbp/InterpAWW.m @ 784:085fc0fe537f feature/grids

Merge with feature/interpolation
author Jonatan Werpers <jonatan@werpers.com>
date Tue, 24 Jul 2018 20:17:25 -0700
parents 3c3280ebabb3
children
comparison
equal deleted inserted replaced
780:e7a6744499fa 784:085fc0fe537f
1 classdef InterpAWW < sbp.InterpOps
2 properties
3
4 % Interpolation operators
5 IC2F
6 IF2C
7
8 % Orders used on coarse and fine sides
9 order_C
10 order_F
11
12 % Grid points, refinement ratio.
13 ratio
14 m_C
15 m_F
16
17 % Boundary accuracy of IC2F and IF2C.
18 acc_C2F
19 acc_F2C
20 end
21
22 methods
23 % accOp : String, 'C2F' or 'F2C'. Specifies which of the operators
24 % should have higher accuracy.
25 function obj = InterpAWW(m_C,m_F,order_C,order_F,accOp)
26 assertIsMember(accOp, {'C2F','F2C'});
27
28 ratio = (m_F-1)/(m_C-1);
29 h_C = 1;
30
31 assert(order_C == order_F,...
32 'Error: Different orders of accuracy not available');
33
34 switch ratio
35 case 2
36 switch order_C
37 case 2
38 [IC2F,IF2C] = sbp.implementations.intOpAWW_orders_2to2_ratio2to1(m_C, h_C, accOp);
39 case 4
40 [IC2F,IF2C] = sbp.implementations.intOpAWW_orders_4to4_ratio2to1(m_C, h_C, accOp);
41 case 6
42 [IC2F,IF2C] = sbp.implementations.intOpAWW_orders_6to6_ratio2to1(m_C, h_C, accOp);
43 case 8
44 [IC2F,IF2C] = sbp.implementations.intOpAWW_orders_8to8_ratio2to1(m_C, h_C, accOp);
45 otherwise
46 error(['Order ' num2str(order_C) ' not available.']);
47 end
48 otherwise
49 error(['Grid ratio ' num2str(ratio) ' not available']);
50 end
51
52 obj.IC2F = IC2F;
53 obj.IF2C = IF2C;
54 obj.order_C = order_C;
55 obj.order_F = order_F;
56 obj.ratio = ratio;
57 obj.m_C = m_C;
58 obj.m_F = m_F;
59
60 end
61
62 function str = string(obj)
63 str = [class(obj) '_orders' num2str(obj.order_F) 'to'...
64 num2str(obj.order_C) '_ratio' num2str(obj.ratio) 'to1'];
65 end
66
67 end
68 end