1 |
mlosch |
1.1 |
function [h,hx,hy]=remove_inlets(h,hx,hy) |
2 |
|
|
% |
3 |
|
|
% Remove simple inlets |
4 |
|
|
% |
5 |
|
|
% e.g. |
6 |
|
|
% [H2,Hx2,Hy2]=remove_inlets(H2,Hx2,Hy2); |
7 |
|
|
|
8 |
|
|
if size(h)~=size(hx) | size(h)~=size(hy) |
9 |
|
|
error('Arguments must all be the same size!\n'); |
10 |
|
|
end |
11 |
|
|
|
12 |
|
|
oh=h+1; |
13 |
|
|
|
14 |
|
|
while ( sum(oh(:)-h(:)) ) |
15 |
|
|
oh=h; |
16 |
|
|
|
17 |
|
|
% Find second deepest side |
18 |
|
|
hh(1,:,:,:)=hx; |
19 |
|
|
hh(2,:,:,:)=hx([2:end 1],:,:); |
20 |
|
|
hh(3,:,:,:)=hy; |
21 |
|
|
hh(4,:,:,:)=hy(:,[2:end end],:); |
22 |
|
|
hh=sort(hh); |
23 |
|
|
|
24 |
|
|
% Remove inlets |
25 |
|
|
h=squeeze(hh(2,:,:,:)); |
26 |
|
|
|
27 |
|
|
% Regenerate side walls |
28 |
|
|
hX=max(h,h([end 1:end-1],:,:)); hx=max(hx,hX); |
29 |
|
|
hY=max(h,h(:,[1 1:end-1],:)); hy=max(hy,hY); |
30 |
|
|
|
31 |
|
|
end |