Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Patch changes to mesh2dgen and Make_f15 utility functions #272

Merged
merged 3 commits into from
Jan 18, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion utilities/Make_f15.m
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@
% dynamicwaterlevelcorrection control
f15dat.controllist(2).type = 'dynamicWaterLevelCorrection';
f15dat.controllist(2).var(1).name = [f15dat.controllist(2).type 'FileName'];
f15dat.controllist(2).var(1).val = 'offset.63';
f15dat.controllist(2).var(1).val = 'null';
f15dat.controllist(2).var(2).name = [f15dat.controllist(2).type 'Multiplier'];
f15dat.controllist(2).var(2).val = 1.0;
f15dat.controllist(2).var(3).name = [f15dat.controllist(2).type 'RampStart'];
Expand Down
2 changes: 1 addition & 1 deletion utilities/Make_offset63.m
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
obj.offset63.num_times = length(time_vector);
obj.offset63.time_interval = round(...
seconds(time_vector(end) - time_vector(1))/ ...
(length(time_vector)-1)...
max(length(time_vector)-1,1)...
);
obj.offset63.default_val = 0;
obj.offset63.offset_nodes = offset_nodes;
Expand Down
20 changes: 16 additions & 4 deletions utilities/mesh2dgen.m
Original file line number Diff line number Diff line change
@@ -1,17 +1,29 @@
function mfp = mesh2dgen( polygon, fh )
% mfp = mesh2dgen( polygon, fh )
function mfp = mesh2dgen( polygon, fh, kind, iter)
% mfp = mesh2dgen( polygon, fh, kind, iter)
% Generates a mesh using mesh2d based on a nan-delimited polygon on wgs84
% lat-lon coordinates and the oceanmesh2D edgefx class, fh
% We make the assumption that floodplain domain is relatively small so that
% projection is not that important..
% kind: 'delaunay' (default) or 'delfront' method for mesh generation
% iter: maximum allowable iterations (default is 100)
%
% This section of the code used `mesh2d` by DR. Darren Engwirda
% https://github.com/dengwirda/mesh2d

opts.iter = 100;
opts.kind = 'delaunay';
if nargin < 3 || isempty(kind)
opts.kind = 'delaunay';
else
opts.kind = kind;
end
if nargin < 4 || isempty(iter)
opts.iter = 100;
else
opts.iter = iter;
end
opts.ref1 = 'preserve';

[node,edge] = getnan2(polygon);

if isa(fh,'edgefx')
fh.F.Values = fh.F.Values/111e3;
hfun = @(p)fh.F(p);
Expand Down