Mercurial > repos > public > sbplib
comparison +sbp/InterpAWW.m @ 608:c923fe6197ff feature/interpolation
Add inerpolation operator classes and implementations for MC and AWW.
author | Martin Almquist <malmquist@stanford.edu> |
---|---|
date | Sat, 14 Oct 2017 22:32:25 -0700 |
parents | |
children | 3c3280ebabb3 |
comparison
equal
deleted
inserted
replaced
607:0546de4b31a2 | 608:c923fe6197ff |
---|---|
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 | |
27 ratio = (m_F-1)/(m_C-1); | |
28 h_C = 1; | |
29 | |
30 assert(order_C == order_F,... | |
31 'Error: Different orders of accuracy not available'); | |
32 | |
33 switch ratio | |
34 case 2 | |
35 switch order_C | |
36 case 2 | |
37 [IC2F,IF2C] = sbp.implementations.intOpAWW_orders_2to2_ratio2to1(m_C, h_C, accOp); | |
38 case 4 | |
39 [IC2F,IF2C] = sbp.implementations.intOpAWW_orders_4to4_ratio2to1(m_C, h_C, accOp); | |
40 case 6 | |
41 [IC2F,IF2C] = sbp.implementations.intOpAWW_orders_6to6_ratio2to1(m_C, h_C, accOp); | |
42 case 8 | |
43 [IC2F,IF2C] = sbp.implementations.intOpAWW_orders_8to8_ratio2to1(m_C, h_C, accOp); | |
44 otherwise | |
45 error(['Order ' num2str(order_C) ' not available.']); | |
46 end | |
47 otherwise | |
48 error(['Grid ratio ' num2str(ratio) ' not available']); | |
49 end | |
50 | |
51 obj.IC2F = IC2F; | |
52 obj.IF2C = IF2C; | |
53 obj.order_C = order_C; | |
54 obj.order_F = order_F; | |
55 obj.ratio = ratio; | |
56 obj.m_C = m_C; | |
57 obj.m_F = m_F; | |
58 | |
59 end | |
60 | |
61 function str = string(obj) | |
62 str = [class(obj) '_orders' num2str(obj.order_F) 'to'... | |
63 num2str(obj.order_C) '_ratio' num2str(obj.ratio) 'to1']; | |
64 end | |
65 | |
66 end | |
67 end |