Mercurial > repos > public > sbplib
comparison +sbp/InterpOpsOP.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 InterpOpsOP < sbp.InterpOps | |
2 properties | |
3 | |
4 % Structs of interpolation operators, fields .good and .bad | |
5 Iu2v | |
6 Iv2u | |
7 end | |
8 | |
9 methods | |
10 % x_u, x_v -- vectors of the coordinate that varies along the boundary | |
11 % order_u, order_v -- order of accuracy in the different blocks | |
12 function obj = InterpOpsOP(x_u, x_v, order_u, order_v) | |
13 | |
14 assert(order_u == order_v,... | |
15 'InterpOpsOP: Different orders of accuracy not available'); | |
16 | |
17 switch order_u | |
18 case 2 | |
19 intOpSet = @sbp.implementations.intOpOP_orders_2to2_ratio2to1; | |
20 case 4 | |
21 intOpSet = @sbp.implementations.intOpOP_orders_4to4_ratio2to1; | |
22 case 6 | |
23 intOpSet = @sbp.implementations.intOpOP_orders_6to6_ratio2to1; | |
24 case 8 | |
25 intOpSet = @sbp.implementations.intOpOP_orders_8to8_ratio2to1; | |
26 otherwise | |
27 error('InterpOpsOP: Order of accuracy %d not available.', order_u); | |
28 end | |
29 | |
30 m_u = length(x_u) - 1; | |
31 m_v = length(x_v) - 1; | |
32 | |
33 Iu2v = struct; | |
34 Iv2u = struct; | |
35 | |
36 if m_u/m_v == 2 | |
37 % Block u is fine, v is coarse | |
38 m_C = m_v; | |
39 [Iv2u.good, Iu2v.bad] = intOpSet(m_C+1, 1, 'C2F'); | |
40 [Iv2u.bad, Iu2v.good] = intOpSet(m_C+1, 1, 'F2C'); | |
41 | |
42 elseif m_v/m_u == 2 | |
43 % Block v is fine, u is coarse | |
44 m_C = m_u; | |
45 [Iu2v.good, Iv2u.bad] = intOpSet(m_C+1, 1, 'C2F'); | |
46 [Iu2v.bad, Iv2u.good] = intOpSet(m_C+1, 1, 'F2C'); | |
47 else | |
48 error('InterpOpsOP: Interpolation operators for grid ratio %f have not yet been constructed', m_u/m_v); | |
49 end | |
50 | |
51 obj.Iu2v = Iu2v; | |
52 obj.Iv2u = Iv2u; | |
53 | |
54 end | |
55 | |
56 function str = string(obj) | |
57 str = [class(obj)]; | |
58 end | |
59 | |
60 end | |
61 end |