Mercurial > repos > public > sbplib
comparison +sbp/InterpOpsOP.m @ 937:ed8c98c4d479 feature/utux2D
Use only number of grid points as arguments in InterpOpsXX, instead of coordinates.
author | Martin Almquist <malmquist@stanford.edu> |
---|---|
date | Tue, 04 Dec 2018 14:06:42 -0800 |
parents | 4291731570bb |
children | 27ce3f653aa7 |
comparison
equal
deleted
inserted
replaced
936:a205264664cd | 937:ed8c98c4d479 |
---|---|
5 Iu2v | 5 Iu2v |
6 Iv2u | 6 Iv2u |
7 end | 7 end |
8 | 8 |
9 methods | 9 methods |
10 % x_u, x_v -- vectors of the coordinate that varies along the boundary | 10 % m_u, m_v -- number of grid points along the interface |
11 % order_u, order_v -- order of accuracy in the different blocks | 11 % order_u, order_v -- order of accuracy in the different blocks |
12 function obj = InterpOpsOP(x_u, x_v, order_u, order_v) | 12 function obj = InterpOpsOP(m_u, m_v, order_u, order_v) |
13 | 13 |
14 assert(order_u == order_v,... | 14 assert(order_u == order_v,... |
15 'InterpOpsOP: Different orders of accuracy not available'); | 15 'InterpOpsOP: Different orders of accuracy not available'); |
16 | 16 |
17 switch order_u | 17 switch order_u |
25 intOpSet = @sbp.implementations.intOpOP_orders_8to8_ratio2to1; | 25 intOpSet = @sbp.implementations.intOpOP_orders_8to8_ratio2to1; |
26 otherwise | 26 otherwise |
27 error('InterpOpsOP: Order of accuracy %d not available.', order_u); | 27 error('InterpOpsOP: Order of accuracy %d not available.', order_u); |
28 end | 28 end |
29 | 29 |
30 m_u = length(x_u) - 1; | |
31 m_v = length(x_v) - 1; | |
32 | |
33 Iu2v = struct; | 30 Iu2v = struct; |
34 Iv2u = struct; | 31 Iv2u = struct; |
35 | 32 |
36 if m_u/m_v == 2 | 33 if (m_u-1)/(m_v-1) == 2 |
37 % Block u is fine, v is coarse | 34 % Block u is fine, v is coarse |
38 m_C = m_v; | 35 m_C = m_v; |
39 [Iv2u.good, Iu2v.bad] = intOpSet(m_C+1, 1, 'C2F'); | 36 [Iv2u.good, Iu2v.bad] = intOpSet(m_C, 1, 'C2F'); |
40 [Iv2u.bad, Iu2v.good] = intOpSet(m_C+1, 1, 'F2C'); | 37 [Iv2u.bad, Iu2v.good] = intOpSet(m_C, 1, 'F2C'); |
41 | 38 |
42 elseif m_v/m_u == 2 | 39 elseif (m_v-1)/(m_u-1) == 2 |
43 % Block v is fine, u is coarse | 40 % Block v is fine, u is coarse |
44 m_C = m_u; | 41 m_C = m_u; |
45 [Iu2v.good, Iv2u.bad] = intOpSet(m_C+1, 1, 'C2F'); | 42 [Iu2v.good, Iv2u.bad] = intOpSet(m_C, 1, 'C2F'); |
46 [Iu2v.bad, Iv2u.good] = intOpSet(m_C+1, 1, 'F2C'); | 43 [Iu2v.bad, Iv2u.good] = intOpSet(m_C, 1, 'F2C'); |
47 else | 44 else |
48 error('InterpOpsOP: Interpolation operators for grid ratio %f have not yet been constructed', m_u/m_v); | 45 error('InterpOpsOP: Interpolation operators for grid ratio %f have not yet been constructed', (m_u-1)/(m_v-1)); |
49 end | 46 end |
50 | 47 |
51 obj.Iu2v = Iu2v; | 48 obj.Iu2v = Iu2v; |
52 obj.Iv2u = Iv2u; | 49 obj.Iv2u = Iv2u; |
53 | 50 |