-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathns_crdDomain.m
More file actions
26 lines (22 loc) · 879 Bytes
/
ns_crdDomain.m
File metadata and controls
26 lines (22 loc) · 879 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
%% Compute new vertex coordinates that is outside of box
% Box shape is now parallelogram so any vertex outside the boundary should
% be positioned inside the box using periodic boundary condition.
function vrtxN=ns_crdDomain(vrtx,rg,gmp)
vrtxN=vrtx;
for ii=1:size(vrtxN,1)
% Adjust y coordinate
if vrtxN(ii,rg.vf(3))>gmp.bs
vrtxN(ii,rg.vf(3))=vrtxN(ii,rg.vf(3))-gmp.bs;
vrtxN(ii,rg.vi(3))=vrtxN(ii,rg.vi(3))-gmp.bs*gmp.sstn;
elseif vrtxN(ii,rg.vf(3))<0
vrtxN(ii,rg.vf(3))=vrtxN(ii,rg.vf(3))+gmp.bs;
vrtxN(ii,rg.vi(3))=vrtxN(ii,rg.vi(3))+gmp.bs*gmp.sstn;
end
% Adjust x coordinate
if vrtxN(ii,rg.vi(3))>gmp.bs+gmp.sstn*vrtxN(ii,rg.vf(3))
vrtxN(ii,rg.vi(3))=vrtxN(ii,rg.vi(3))-gmp.bs;
elseif vrtxN(ii,rg.vi(3))<gmp.sstn*vrtxN(ii,rg.vf(3))
vrtxN(ii,rg.vi(3))=vrtxN(ii,rg.vi(3))+gmp.bs;
end
end
end