comparison +sbp/InterpOpsMC.m @ 927:4291731570bb feature/utux2D

Rename AWW OP. Make Interpolation operator classes take grid points as arguments. Remove LaplCurv.interpolationOperators. Introduce default struct in LaplCurv.interface.
author Martin Almquist <malmquist@stanford.edu>
date Mon, 03 Dec 2018 14:53:52 -0800
parents
children ed8c98c4d479
comparison
equal deleted inserted replaced
926:60a3bc79835a 927:4291731570bb
1 classdef InterpOpsMC < sbp.InterpOps
2 properties
3
4 % Structs of interpolation operators, fields .good and .bad
5 % Here .good and .bad are the same, but this makes them fit in the
6 % OP (order-preserving) framework.
7 Iu2v
8 Iv2u
9 end
10
11 methods
12 % x_u, x_v -- vectors of the coordinate that varies along the boundary
13 % order_u, order_v -- order of accuracy in the different blocks
14 function obj = InterpOpsMC(x_u, x_v, order_u, order_v)
15
16 assert(order_u == order_v,...
17 'InterpOpsMC: Different orders of accuracy not available');
18
19 switch order_u
20 case 2
21 intOpSet = @sbp.implementations.intOpMC_orders_2to2_ratio2to1;
22 case 4
23 intOpSet = @sbp.implementations.intOpMC_orders_4to4_ratio2to1;
24 case 6
25 intOpSet = @sbp.implementations.intOpMC_orders_6to6_ratio2to1;
26 case 8
27 intOpSet = @sbp.implementations.intOpMC_orders_8to8_ratio2to1;
28 otherwise
29 error('InterpOpsMC: Order of accuracy %d not available.', order_u);
30 end
31
32 m_u = length(x_u) - 1;
33 m_v = length(x_v) - 1;
34
35 Iu2v = struct;
36 Iv2u = struct;
37
38 if m_u/m_v == 2
39 % Block u is fine, v is coarse
40 m_C = m_v;
41 [Iv2u.good, Iu2v.bad] = intOpSet(m_C+1);
42 Iv2u.bad = Iv2u.good;
43 Iu2v.good = Iu2v.bad;
44
45 elseif m_v/m_u == 2
46 % Block v is fine, u is coarse
47 m_C = m_u;
48 [Iu2v.good, Iv2u.bad] = intOpSet(m_C+1);
49 Iu2v.bad = Iu2v.good;
50 Iv2u.good = Iv2u.bad;
51 else
52 error('InterpOpsMC: Interpolation operators for grid ratio %f have not yet been constructed', m_u/m_v);
53 end
54
55 obj.Iu2v = Iu2v;
56 obj.Iv2u = Iv2u;
57
58 end
59
60 function str = string(obj)
61 str = [class(obj)];
62 end
63
64 end
65 end