Skip to content

Commit dfc7edb

Browse files
committed
fixing some typos and missing list prunes
Typos in grad2DPeriodic and grad3DPeriodic fixed bfore removing those files. Just a sanity check. In addition, removing repeated rows in addBC2D and addScalar2D to speed up these codes. addBC2D will be removed. Again, having a better code before removing it just in case we need to get back to it in the future.
1 parent 7a2648c commit dfc7edb

4 files changed

Lines changed: 14 additions & 5 deletions

File tree

src/matlab/addBC2D.m

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,15 @@
8282
[rr,~,~] = find(Abcr);
8383
[rb,~,~] = find(Abcb);
8484
[rt,~,~] = find(Abct);
85+
rl = unique(rl);
86+
rr = unique(rr);
87+
rb = unique(rb);
88+
rt = unique(rt);
8589

8690
% remove rows of A associated to boundary
8791
Abc = Abcl + Abcr + Abct + Abcb;
8892
[rowsbc,~,~] = find(Abc);
93+
rowsbc = unique(rowsbc);
8994
[rows,cols,s] = find(A(rowsbc,:));
9095
A = A - sparse(rows, cols, s, size(A,1), size(A,2));
9196
% update matrix A with boundary information

src/matlab/addScalarBC2D.m

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,8 @@
106106
if ~isempty(qrl)
107107
[rl,~,~] = find(Abcl);
108108
[rr,~,~] = find(Abcr);
109+
rl = unique(rl);
110+
rr = unique(rr);
109111
% remove rows of A associated to boundary
110112
Abc1 = Abcl + Abcr;
111113
[rowsbc1,~,~] = find(Abc1);
@@ -120,6 +122,8 @@
120122
if ~isempty(qbt)
121123
[rb,~,~] = find(Abcb);
122124
[rt,~,~] = find(Abct);
125+
rb = unique(rb);
126+
rt = unique(rt);
123127
% remove rows of A associated to boundary
124128
Abc2 = Abct + Abcb;
125129
[rowsbc2,~,~] = find(Abc2);

src/matlab/grad2DPeriodic.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
% ----------------------------------------------------------------------------
1717
%
1818

19-
Gx = gradPer(k, m, dx);
20-
Gy = gradPer(k, n, dy);
19+
Gx = gradPeriodic(k, m, dx);
20+
Gy = gradPeriodic(k, n, dy);
2121

2222
Im = speye(m, m);
2323
In = speye(n, n);

src/matlab/grad3DPeriodic.m

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@
2222
In = speye(n, n);
2323
Io = speye(o, o);
2424

25-
Gx = gradPer(k, m, dx);
26-
Gy = gradPer(k, n, dy);
27-
Gz = gradPer(k, o, dz);
25+
Gx = gradPeriodic(k, m, dx);
26+
Gy = gradPeriodic(k, n, dy);
27+
Gz = gradPeriodic(k, o, dz);
2828

2929
Sx = kron(kron(Io, In), Gx);
3030
Sy = kron(kron(Io, Gy), Im);

0 commit comments

Comments
 (0)