Skip to content

Commit be4d785

Browse files
committed
add more kernel name options
1 parent 6146af3 commit be4d785

File tree

5 files changed

+63
-25
lines changed

5 files changed

+63
-25
lines changed

chunkie/+chnk/+axissymhelm2d/kern.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@
139139
end
140140
end
141141

142-
case {'sdiff'}
142+
case {'sdiff', 's_diff'}
143143
ifdiff = 1;
144144
submat = chnk.axissymhelm2d.green(zk, src, targ, origin, ifdiff);
145145

@@ -204,7 +204,7 @@
204204

205205
submat = submat1-submat2;
206206

207-
case {'dpdiff', 'dprimediff'}
207+
case {'dpdiff', 'dp_diff', 'dprimediff', 'dprime_diff'}
208208
targnorm = targinfo.n(:,:);
209209
srcnorm = srcinfo.n(:,:);
210210
ifdiff = 1;

chunkie/+chnk/+elast2d/kern.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@
8787
kron(rdotv./r2,[1 0; 0 1]));
8888
mat = term1+term2;
8989

90-
case {'sgrad'}
90+
case {'sgrad', 'sg'}
9191
mat = zeros(4*m,2*n);
9292
tmp = beta*x./r2;
9393
mat(1:4:end,1:2:end) = tmp;
@@ -139,7 +139,7 @@
139139
term1 = eta*(kron(rdotv./r2,[2 0; 0 2]));
140140
mat = -(term1+term2);
141141

142-
case {'daltgrad'}
142+
case {'daltgrad', 'daltg'}
143143
dirx = s.n(1,:); dirx = dirx(:).';
144144
diry = s.n(2,:); diry = diry(:).';
145145
rdotv = x.*dirx + y.*diry;

chunkie/+chnk/+helm1d/kern.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@
252252
submat(1:1:1*nt,2:2:2*ns) = coef(2)*submatsp;
253253

254254
% Gradient correpsonding to transmission rep
255-
case {'trans_rep_grad','trg'}
255+
case {'trans_rep_grad','trg','trans_rep_g'}
256256
coef = ones(2,1);
257257
if(nargin == 5); coef = varargin{1}; end;
258258

chunkie/+chnk/+helm2d/kern.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,7 @@
475475
submat(1:1:1*nt,2:2:2*ns) = coef(2)*submatsp;
476476

477477
% Gradient correpsonding to transmission rep
478-
case {'trans_rep_grad','trg'}
478+
case {'trans_rep_grad','trg','trans_rep_g'}
479479
coef = ones(2,1);
480480
if(nargin == 5); coef = varargin{1}; end;
481481

@@ -500,7 +500,7 @@
500500

501501

502502
% Gradient correpsonding to transmission rep (difference)
503-
case {'trans_rep_grad_diff','trg_diff'}
503+
case {'trans_rep_grad_diff','trg_diff','trans_rep_g_diff'}
504504
coef = ones(2,1);
505505
if(nargin == 5); coef = varargin{1}; end;
506506

chunkie/+chnk/+lap2d/kern.m

Lines changed: 56 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -18,25 +18,40 @@
1818

1919
% normal derivative of single layer
2020
case {'sp', 'sprime'}
21+
if ~isfield(targinfo,'n')
22+
targnorm = chnk.normal2d(targinfo);
23+
else
24+
targnorm = targinfo.n;
25+
end
2126
[~,grad] = chnk.lap2d.green(src,targ,true);
22-
nx = repmat((targinfo.n(1,:)).',1,ns);
23-
ny = repmat((targinfo.n(2,:)).',1,ns);
27+
nx = repmat((targnorm(1,:)).',1,ns);
28+
ny = repmat((targnorm(2,:)).',1,ns);
2429

2530
submat = (grad(:,:,1).*nx + grad(:,:,2).*ny);
2631

2732
% Tangential derivative of single layer
2833
case {'stau'}
34+
if ~isfield(targinfo,'n')
35+
targnorm = chnk.normal2d(targinfo);
36+
else
37+
targnorm = targinfo.n;
38+
end
2939
[~,grad] = chnk.lap2d.green(src,targ,true);
30-
nx = repmat((targinfo.n(1,:)).',1,ns);
31-
ny = repmat((targinfo.n(2,:)).',1,ns);
40+
nx = repmat((targnorm(1,:)).',1,ns);
41+
ny = repmat((targnorm(2,:)).',1,ns);
3242

3343
submat = (-grad(:,:,1).*ny + grad(:,:,2).*nx);
3444

3545
% Hilbert transform (two times the adjoint of stau)
3646
case {'hilb'}
47+
if ~isfield(srcinfo,'n')
48+
srcnorm = chnk.normal2d(srcinfo);
49+
else
50+
srcnorm = srcinfo.n;
51+
end
3752
[~,grad] = chnk.lap2d.green(src,targ,true);
38-
nx = repmat((srcinfo.n(1,:)),nt,1);
39-
ny = repmat((srcinfo.n(2,:)),nt,1);
53+
nx = repmat((srcnorm(1,:)),nt,1);
54+
ny = repmat((srcnorm(2,:)),nt,1);
4055

4156
submat = 2*(grad(:,:,1).*ny - grad(:,:,2).*nx);
4257

@@ -47,20 +62,33 @@
4762

4863
% gradient of double layer
4964
case {'dgrad','dg'}
65+
if ~isfield(srcinfo,'n')
66+
srcnorm = chnk.normal2d(srcinfo);
67+
else
68+
srcnorm = srcinfo.n;
69+
end
5070
[~,~,hess] = chnk.lap2d.green(src,targ,true);
51-
submat = -(hess(:,:,1:2).*srcinfo.n(1,:)+hess(:,:,2:3).*srcinfo.n(2,:));
71+
submat = -(hess(:,:,1:2).*srcnorm(1,:)+hess(:,:,2:3).*srcnorm(2,:));
5272
submat = reshape(permute(submat,[3,1,2]),2*nt,ns);
5373

5474
% normal derivative of double layer
5575
case {'dprime','dp'}
56-
targnorm = targinfo.n(:,:);
57-
srcnorm = srcinfo.n(:,:);
58-
[~,~,hess] = chnk.lap2d.green(src,targ);
59-
nxsrc = repmat(srcnorm(1,:),nt,1);
60-
nysrc = repmat(srcnorm(2,:),nt,1);
61-
nxtarg = repmat((targnorm(1,:)).',1,ns);
62-
nytarg = repmat((targnorm(2,:)).',1,ns);
63-
submat = -(hess(:,:,1).*nxsrc.*nxtarg + hess(:,:,2).*(nysrc.*nxtarg+nxsrc.*nytarg)...
76+
if ~isfield(targinfo,'n')
77+
targnorm = chnk.normal2d(targinfo);
78+
else
79+
targnorm = targinfo.n;
80+
end
81+
if ~isfield(srcinfo,'n')
82+
srcnorm = chnk.normal2d(srcinfo);
83+
else
84+
srcnorm = srcinfo.n;
85+
end
86+
[~,~,hess] = chnk.lap2d.green(src,targ);
87+
nxsrc = repmat(srcnorm(1,:),nt,1);
88+
nysrc = repmat(srcnorm(2,:),nt,1);
89+
nxtarg = repmat((targnorm(1,:)).',1,ns);
90+
nytarg = repmat((targnorm(2,:)).',1,ns);
91+
submat = -(hess(:,:,1).*nxsrc.*nxtarg + hess(:,:,2).*(nysrc.*nxtarg+nxsrc.*nytarg)...
6492
+ hess(:,:,3).*nysrc.*nytarg);
6593

6694
% single layer
@@ -69,19 +97,29 @@
6997

7098
% combined field
7199
case {'c', 'combined'}
100+
if ~isfield(srcinfo,'n')
101+
srcnorm = chnk.normal2d(srcinfo);
102+
else
103+
srcnorm = srcinfo.n;
104+
end
72105
coef = ones(2,1);
73106
if(nargin == 4); coef = varargin{1}; end
74107
[s,grad] = chnk.lap2d.green(src,targ);
75-
nx = repmat(srcinfo.n(1,:),nt,1);
76-
ny = repmat(srcinfo.n(2,:),nt,1);
108+
nx = repmat(srcnorm(1,:),nt,1);
109+
ny = repmat(srcnorm(2,:),nt,1);
77110
submat = -coef(1)*(grad(:,:,1).*nx + grad(:,:,2).*ny) + coef(2)*s;
78111

79112
% gradient of combined field
80113
case {'cgrad', 'cg'}
114+
if ~isfield(srcinfo,'n')
115+
srcnorm = chnk.normal2d(srcinfo);
116+
else
117+
srcnorm = srcinfo.n;
118+
end
81119
coef = ones(2,1);
82120
if(nargin == 4); coef = varargin{1}; end
83121
[~,grad,hess] = chnk.lap2d.green(src,targ,true);
84-
submat = -(hess(:,:,1:2).*srcinfo.n(1,:)+hess(:,:,2:3).*srcinfo.n(2,:));
122+
submat = -(hess(:,:,1:2).*srcnorm(1,:)+hess(:,:,2:3).*srcnorm(2,:));
85123
submat = coef(1)*reshape(permute(submat,[3,1,2]),2*nt,ns);
86124
submat = submat+coef(2)*reshape(permute(grad,[3,1,2]),2*nt,ns);
87125

0 commit comments

Comments
 (0)