Mercurial > repos > public > sbplib
annotate +sbp/InterpAWW.m @ 840:d8d71f652917 feature/grids
Close feature/grids after merge to default
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Tue, 18 Sep 2018 15:58:12 +0200 |
parents | 3c3280ebabb3 |
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 InterpAWW < 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 |
c923fe6197ff
Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
17 % Boundary accuracy of IC2F and IF2C. |
c923fe6197ff
Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
18 acc_C2F |
c923fe6197ff
Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
19 acc_F2C |
c923fe6197ff
Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
20 end |
c923fe6197ff
Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
21 |
c923fe6197ff
Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
22 methods |
c923fe6197ff
Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
23 % accOp : String, 'C2F' or 'F2C'. Specifies which of the operators |
c923fe6197ff
Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
24 % should have higher accuracy. |
c923fe6197ff
Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
25 function obj = InterpAWW(m_C,m_F,order_C,order_F,accOp) |
782
3c3280ebabb3
Add assertions on string input accOp
Jonatan Werpers <jonatan@werpers.com>
parents:
608
diff
changeset
|
26 assertIsMember(accOp, {'C2F','F2C'}); |
608
c923fe6197ff
Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
27 |
c923fe6197ff
Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
28 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
|
29 h_C = 1; |
c923fe6197ff
Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
30 |
c923fe6197ff
Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
31 assert(order_C == order_F,... |
c923fe6197ff
Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
32 '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
|
33 |
c923fe6197ff
Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
34 switch ratio |
c923fe6197ff
Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
35 case 2 |
c923fe6197ff
Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
36 switch order_C |
c923fe6197ff
Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
37 case 2 |
c923fe6197ff
Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
38 [IC2F,IF2C] = sbp.implementations.intOpAWW_orders_2to2_ratio2to1(m_C, h_C, accOp); |
c923fe6197ff
Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
39 case 4 |
c923fe6197ff
Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
40 [IC2F,IF2C] = sbp.implementations.intOpAWW_orders_4to4_ratio2to1(m_C, h_C, accOp); |
c923fe6197ff
Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
41 case 6 |
c923fe6197ff
Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
42 [IC2F,IF2C] = sbp.implementations.intOpAWW_orders_6to6_ratio2to1(m_C, h_C, accOp); |
c923fe6197ff
Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
43 case 8 |
c923fe6197ff
Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
44 [IC2F,IF2C] = sbp.implementations.intOpAWW_orders_8to8_ratio2to1(m_C, h_C, accOp); |
c923fe6197ff
Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
45 otherwise |
c923fe6197ff
Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
46 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
|
47 end |
c923fe6197ff
Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
48 otherwise |
c923fe6197ff
Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
49 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
|
50 end |
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 obj.IC2F = IC2F; |
c923fe6197ff
Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
53 obj.IF2C = IF2C; |
c923fe6197ff
Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
54 obj.order_C = order_C; |
c923fe6197ff
Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
55 obj.order_F = order_F; |
c923fe6197ff
Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
56 obj.ratio = ratio; |
c923fe6197ff
Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
57 obj.m_C = m_C; |
c923fe6197ff
Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
58 obj.m_F = m_F; |
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 |
c923fe6197ff
Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
62 function str = string(obj) |
c923fe6197ff
Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
63 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
|
64 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
|
65 end |
c923fe6197ff
Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
66 |
c923fe6197ff
Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
67 end |
c923fe6197ff
Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
68 end |