Skip to content

Commit

Permalink
small local fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
askhamwhat committed Jan 6, 2025
1 parent a395c7b commit 7503c39
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 16 deletions.
13 changes: 7 additions & 6 deletions chunkie/chunkerfunc.m
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@
tsplits = [ta;tb];
end

tsplits = sort(unique(tsplits),'ascend');
tsplits = sort(uniquetol(tsplits,eps),'ascend');
lab = length(tsplits);
if (lab-1 > nchmax)
error(['CHUNKERFUNC: nchmax exceeded in chunkerfunc on initial splits.\n ',...
Expand Down Expand Up @@ -184,14 +184,15 @@

maxiter_res=nchmax-nch;

xmin = Inf;
xmax = -Inf;
ymin = Inf;
ymax = -Inf;

rad_curr = 0;
for ijk = 1:maxiter_res

% loop through all existing chunks, if resolved store, if not split
xmin = Inf;
xmax = -Inf;
ymin = Inf;
ymax = -Inf;

ifdone=1;
for ich=1:nchnew
Expand Down Expand Up @@ -224,7 +225,7 @@

resol_speed_test = err1>eps;
if nout < 2
resol_speed_test = err1>eps*k;
resol_speed_test = err1*(b-a) > eps*k;
end

xmax = max(xmax,max(r(1,:)));
Expand Down
15 changes: 8 additions & 7 deletions chunkie/chunkerkernevalmat.m
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
function mat = chunkerkernevalmat(chnkr,kern,targobj,opts)
function [mat,varargout] = chunkerkernevalmat(chnkr,kern,targobj,opts)
%CHUNKERKERNEVALMAT compute the matrix which maps density values on
% the chunk geometry to the value of the convolution of the given
% integral kernel with the density at the specified target points
Expand Down Expand Up @@ -138,8 +138,6 @@
optsadap = [];
optsadap.eps = eps;



if forcesmooth
mat = chunkerkernevalmat_smooth(chnkr,ftmp,opdims,targinfo, ...
[],optssmooth);
Expand All @@ -165,11 +163,14 @@

% smooth for sufficiently far, adaptive otherwise

% TODO: change to chunkerkerneval system, need routine to generate
% upsampling matrix.
rho = 1.8;
optsflag = []; optsflag.rho = rho;
flag = flagnear_rectangle(chnkr,targinfo.r,optsflag);

npoly = chnkr.k*2;
nlegnew = chnk.ellipse_oversample(rho,npoly,eps);
nlegnew = max(nlegnew,chnkr.k);

optsflag = []; optsflag.fac = fac;
flag = flagnear(chnkr,targinfo.r,optsflag);
spmat = chunkerkernevalmat_adap(chnkr,ftmp,opdims, ...
targinfo,flag,optsadap);

Expand Down
14 changes: 11 additions & 3 deletions chunkie/chunkermat.m
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,9 @@

% mark off the near and self interactions
for ich = 1:chnkr.nch
for jch = [ich,chnkr.adj(1,ich),chnkr.adj(2,ich)]
jlist = [ich,chnkr.adj(1,ich),chnkr.adj(2,ich)];
jlist = jlist(jlist > 0);
for jch = jlist
flag((jch - 1)*chnkr.k+(1:chnkr.k), ich) = 0;
end
end
Expand Down Expand Up @@ -453,6 +455,7 @@
npt_all = horzcat(chnkobj.echnks.npt);
[~,nv] = size(chnkobj.verts);
ngl = chnkrs(1).k;
rcipsav = cell(nv,1);

for ivert=1:nv
clist = chnkobj.vstruc{ivert}{1};
Expand Down Expand Up @@ -500,10 +503,11 @@
optsrcip.nonsmoothonly = false;
optsrcip.corrections = false;

R = chnk.rcip.Rcompchunk(chnkrs,iedgechunks,kern,ndim, ...
[R,rcipsav{ivert}] = chnk.rcip.Rcompchunk(chnkrs,iedgechunks,kern,ndim, ...
Pbc,PWbc,nsub,starL,circL,starS,circS,ilist,starL1,circL1,...
sbclmat,sbcrmat,lvmat,rvmat,u,optsrcip);

rcipsav{ivert}.starind = starind;

sysmat_tmp = inv(R) - eye(2*ngl*nedge*ndim);
if (~nonsmoothonly)

Expand Down Expand Up @@ -561,6 +565,10 @@
vsysmat = [vsysmat;sysmat_tmp(:)];
end
end

if nargout > 2
varargout{2} = rcipsav;
end

end

Expand Down

0 comments on commit 7503c39

Please sign in to comment.