Mercurial > repos > public > sbplib
comparison +sbp/InterpMC.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 |
comparison
equal
deleted
inserted
replaced
607:0546de4b31a2 | 608:c923fe6197ff |
---|---|
1 classdef InterpMC < 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 end | |
17 | |
18 methods | |
19 function obj = InterpMC(m_C,m_F,order_C,order_F) | |
20 | |
21 ratio = (m_F-1)/(m_C-1); | |
22 | |
23 assert(order_C == order_F,... | |
24 'Error: Different orders of accuracy not available'); | |
25 | |
26 switch ratio | |
27 case 2 | |
28 switch order_C | |
29 case 2 | |
30 [IC2F,IF2C] = sbp.implementations.intOpMC_orders_2to2_ratio2to1(m_C); | |
31 case 4 | |
32 [IC2F,IF2C] = sbp.implementations.intOpMC_orders_4to4_ratio2to1(m_C); | |
33 case 6 | |
34 [IC2F,IF2C] = sbp.implementations.intOpMC_orders_6to6_ratio2to1(m_C); | |
35 case 8 | |
36 [IC2F,IF2C] = sbp.implementations.intOpMC_orders_8to8_ratio2to1(m_C); | |
37 otherwise | |
38 error(['Order ' num2str(order_C) ' not available.']); | |
39 end | |
40 otherwise | |
41 error(['Grid ratio ' num2str(ratio) ' not available']); | |
42 end | |
43 | |
44 obj.IC2F = IC2F; | |
45 obj.IF2C = IF2C; | |
46 obj.order_C = order_C; | |
47 obj.order_F = order_F; | |
48 obj.ratio = ratio; | |
49 obj.m_C = m_C; | |
50 obj.m_F = m_F; | |
51 | |
52 | |
53 end | |
54 | |
55 function str = string(obj) | |
56 str = [class(obj) '_orders' num2str(obj.order_F) 'to'... | |
57 num2str(obj.order_C) '_ratio' num2str(obj.ratio) 'to1']; | |
58 end | |
59 | |
60 end | |
61 end |