Mercurial > repos > public > sbplib
annotate +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 |
rev | line source |
---|---|
608
c923fe6197ff
Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
1 classdef InterpMC < sbp.InterpOps |
c923fe6197ff
Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
2 properties |
c923fe6197ff
Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
3 |
c923fe6197ff
Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
4 % Interpolation operators |
c923fe6197ff
Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
5 IC2F |
c923fe6197ff
Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
6 IF2C |
c923fe6197ff
Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
7 |
c923fe6197ff
Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
8 % Orders used on coarse and fine sides |
c923fe6197ff
Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
9 order_C |
c923fe6197ff
Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
10 order_F |
c923fe6197ff
Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
11 |
c923fe6197ff
Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
12 % Grid points, refinement ratio. |
c923fe6197ff
Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
13 ratio |
c923fe6197ff
Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
14 m_C |
c923fe6197ff
Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
15 m_F |
c923fe6197ff
Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
16 end |
c923fe6197ff
Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
17 |
c923fe6197ff
Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
18 methods |
c923fe6197ff
Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
19 function obj = InterpMC(m_C,m_F,order_C,order_F) |
c923fe6197ff
Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
20 |
c923fe6197ff
Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
21 ratio = (m_F-1)/(m_C-1); |
c923fe6197ff
Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
22 |
c923fe6197ff
Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
23 assert(order_C == order_F,... |
c923fe6197ff
Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
24 'Error: Different orders of accuracy not available'); |
c923fe6197ff
Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
25 |
c923fe6197ff
Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
26 switch ratio |
c923fe6197ff
Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
27 case 2 |
c923fe6197ff
Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
28 switch order_C |
c923fe6197ff
Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
29 case 2 |
c923fe6197ff
Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
30 [IC2F,IF2C] = sbp.implementations.intOpMC_orders_2to2_ratio2to1(m_C); |
c923fe6197ff
Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
31 case 4 |
c923fe6197ff
Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
32 [IC2F,IF2C] = sbp.implementations.intOpMC_orders_4to4_ratio2to1(m_C); |
c923fe6197ff
Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
33 case 6 |
c923fe6197ff
Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
34 [IC2F,IF2C] = sbp.implementations.intOpMC_orders_6to6_ratio2to1(m_C); |
c923fe6197ff
Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
35 case 8 |
c923fe6197ff
Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
36 [IC2F,IF2C] = sbp.implementations.intOpMC_orders_8to8_ratio2to1(m_C); |
c923fe6197ff
Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
37 otherwise |
c923fe6197ff
Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
38 error(['Order ' num2str(order_C) ' not available.']); |
c923fe6197ff
Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
39 end |
c923fe6197ff
Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
40 otherwise |
c923fe6197ff
Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
41 error(['Grid ratio ' num2str(ratio) ' not available']); |
c923fe6197ff
Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
42 end |
c923fe6197ff
Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
43 |
c923fe6197ff
Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
44 obj.IC2F = IC2F; |
c923fe6197ff
Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
45 obj.IF2C = IF2C; |
c923fe6197ff
Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
46 obj.order_C = order_C; |
c923fe6197ff
Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
47 obj.order_F = order_F; |
c923fe6197ff
Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
48 obj.ratio = ratio; |
c923fe6197ff
Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
49 obj.m_C = m_C; |
c923fe6197ff
Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
50 obj.m_F = m_F; |
c923fe6197ff
Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
51 |
c923fe6197ff
Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
52 |
c923fe6197ff
Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
53 end |
c923fe6197ff
Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
54 |
c923fe6197ff
Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
55 function str = string(obj) |
c923fe6197ff
Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
56 str = [class(obj) '_orders' num2str(obj.order_F) 'to'... |
c923fe6197ff
Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
57 num2str(obj.order_C) '_ratio' num2str(obj.ratio) 'to1']; |
c923fe6197ff
Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
58 end |
c923fe6197ff
Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
59 |
c923fe6197ff
Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
60 end |
c923fe6197ff
Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
61 end |