Skip to content

Commit

Permalink
fixes bugs in interior and moves inregion to new method.
Browse files Browse the repository at this point in the history
fixes bug for nested regions that was not detected by earlier tests
  • Loading branch information
askhamwhat committed Oct 19, 2024
1 parent 4fb848d commit 00984db
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 21 deletions.
33 changes: 19 additions & 14 deletions chunkie/chunkgraphinregion.m
Original file line number Diff line number Diff line change
Expand Up @@ -77,33 +77,38 @@
end

nr = numel(cg.regions);

for ir = 1:nr
ncomp = numel(cg.regions{ir});
intmp = zeros(npts,1);
chnkrscomp(ncomp) = chunker(p,t,w);
for ic = 1:ncomp
edgelist = cg.regions{ir}{ic};
nedge = numel(edgelist);
chnkrs(nedge) = chunker(p,t,w);
for ie = 1:nedge
eid = edgelist(ie);
if eid > 0
if ir == 1
chnkrs(ie) = cg.echnks(eid);
else
chnkrs(ie) = reverse(cg.echnks(eid));
end
chnkrs(ie) = cg.echnks(eid);
else
if ir == 1
chnkrs(ie) = reverse(cg.echnks(-eid));
else
chnkrs(ie) = cg.echnks(-eid);
end
chnkrs(ie) = sort(reverse(cg.echnks(-eid)));
end
end
intmp = intmp + reshape(chunkerinterior(merge(chnkrs(1:nedge)),ptsobj,opts),npts,1);
nchs = [chnkrs(1:nedge).nch];
ladr = cumsum([1, nchs(:).']);
chnkrtmp = merge(chnkrs(1:nedge));
chnkrtmp.adj(1,1) = ladr(end)-1;
chnkrtmp.adj(2,end) = 1;
for jj = 1:(nedge-1)
ich1 = ladr(jj+1)-1; ich2 = ladr(jj+1);
chnkrtmp.adj(1,ich2) = ich1;
chnkrtmp.adj(2,ich1) = ich2;
end
if ir ~= 1
chnkrtmp = reverse(chnkrtmp);
end
chnkrscomp(ic) = chnkrtmp;
end

intmp = intmp > 0;
intmp = reshape(chunkerinterior(merge(chnkrscomp(1:ncomp)),ptsobj,opts),npts,1);
if ir == 1
ids(~intmp) = ir;
else
Expand Down
9 changes: 2 additions & 7 deletions devtools/test/mixedbcTest.m
Original file line number Diff line number Diff line change
Expand Up @@ -93,14 +93,9 @@
targets = zeros(2,length(xxtarg(:)));
targets(1,:) = xxtarg(:); targets(2,:) = yytarg(:);

start = tic; in1 = chunkerinterior(merge(cgrph.echnks(edir)),{xtarg,ytarg});
in2 = chunkerinterior(reverse(merge(cgrph.echnks(eneu))),{xtarg,ytarg});
t1 = toc(start);
in = in1 & ~in2;
out = ~in;

ids= chunkgraphinregion(cgrph,{xtarg,ytarg});
nnz(in-(ids==2))
in = ids == 2;
in2 = ids == 3;

fprintf('%5.2e s : time to find points in domain\n',t1)

Expand Down

0 comments on commit 00984db

Please sign in to comment.