Mercurial > repos > public > sbplib
changeset 653:2351a7690e8a feature/d1_staggered
Clean up and improve comments in StaggeredVariable
author | Martin Almquist <malmquist@stanford.edu> |
---|---|
date | Mon, 04 Dec 2017 11:18:13 -0800 |
parents | be941bb0a11a |
children | 993aac771efd |
files | +scheme/Staggered1DAcousticsVariable.m |
diffstat | 1 files changed, 12 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
diff -r be941bb0a11a -r 2351a7690e8a +scheme/Staggered1DAcousticsVariable.m --- a/+scheme/Staggered1DAcousticsVariable.m Mon Dec 04 11:11:03 2017 -0800 +++ b/+scheme/Staggered1DAcousticsVariable.m Mon Dec 04 11:18:13 2017 -0800 @@ -28,11 +28,11 @@ e_primal e_dual - % System matrices + % System matrices, cell matrices of function handles A B - % + % Variable coefficient matrices evaluated at boundaries. A_l, A_r B_l, B_r end @@ -49,6 +49,7 @@ % B = [0 b % b 0] % Here we store p on the primal grid and v on the dual + % A and B are cell matrices of function handles function obj = Staggered1DAcousticsVariable(g, order, A, B) default_arg('B',{@(x)0*x, @(x)0*x+1; @(x)0*x+1, @(x)0*x}); default_arg('A',{@(x)0*x+1, @(x)0*x; @(x)0*x, @(x)0*x+1}); @@ -62,6 +63,11 @@ xl = g.getBoundary('l'); xr = g.getBoundary('r'); xlim = {xl, xr}; + obj.grid = g; + obj.grid_primal = g.grids{1}; + obj.grid_dual = g.grids{2}; + x_primal = obj.grid_primal.points(); + x_dual = obj.grid_dual.points(); % Boundary matrices obj.A_l = [A{1,1}(xl), A{1,2}(xl);.... @@ -72,12 +78,6 @@ B{2,1}(xl), B{2,2}(xl)]; obj.B_r = [B{1,1}(xr), B{1,2}(xr);.... B{2,1}(xr), B{2,2}(xr)]; - - obj.grid = g; - obj.grid_primal = g.grids{1}; - obj.grid_dual = g.grids{2}; - x_primal = obj.grid_primal.points(); - x_dual = obj.grid_dual.points(); % Get operators ops = sbp.D1StaggeredUpwind(obj.m, xlim, order); @@ -138,11 +138,11 @@ % Get boundary matrices switch boundary case 'l' - A = full(obj.A_l); - B = full(obj.B_l); + A = obj.A_l; + B = obj.B_l; case 'r' - A = full(obj.A_r); - B = full(obj.B_r); + A = obj.A_r; + B = obj.B_r; end % Diagonalize B