Mercurial > repos > public > sbplib
annotate +sbp/InterpAWW.m @ 911:f7306f03f77a feature/utux2D
Improve comments and names. Change InterfaceOptions.union to merge.
author | Martin Almquist <malmquist@stanford.edu> |
---|---|
date | Sat, 24 Nov 2018 15:43:34 -0800 |
parents | c923fe6197ff |
children | 3c3280ebabb3 |
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) |
c923fe6197ff
Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
26 |
c923fe6197ff
Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
27 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
|
28 h_C = 1; |
c923fe6197ff
Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
29 |
c923fe6197ff
Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
30 assert(order_C == order_F,... |
c923fe6197ff
Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
31 '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
|
32 |
c923fe6197ff
Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
33 switch ratio |
c923fe6197ff
Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
34 case 2 |
c923fe6197ff
Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
35 switch order_C |
c923fe6197ff
Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
36 case 2 |
c923fe6197ff
Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
37 [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
|
38 case 4 |
c923fe6197ff
Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
39 [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
|
40 case 6 |
c923fe6197ff
Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
41 [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
|
42 case 8 |
c923fe6197ff
Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
43 [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
|
44 otherwise |
c923fe6197ff
Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
45 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
|
46 end |
c923fe6197ff
Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
47 otherwise |
c923fe6197ff
Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
48 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
|
49 end |
c923fe6197ff
Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
50 |
c923fe6197ff
Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
51 obj.IC2F = IC2F; |
c923fe6197ff
Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
52 obj.IF2C = IF2C; |
c923fe6197ff
Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
53 obj.order_C = order_C; |
c923fe6197ff
Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
54 obj.order_F = order_F; |
c923fe6197ff
Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
55 obj.ratio = ratio; |
c923fe6197ff
Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
56 obj.m_C = m_C; |
c923fe6197ff
Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
57 obj.m_F = m_F; |
c923fe6197ff
Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
58 |
c923fe6197ff
Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
59 end |
c923fe6197ff
Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
60 |
c923fe6197ff
Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
61 function str = string(obj) |
c923fe6197ff
Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
62 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
|
63 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
|
64 end |
c923fe6197ff
Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
65 |
c923fe6197ff
Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
66 end |
c923fe6197ff
Add inerpolation operator classes and implementations for MC and AWW.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
67 end |