Skip to content

Commit

Permalink
Updates to examples and utlilies
Browse files Browse the repository at this point in the history
- Examples to include the projection necessary commands
- utlilies, correct setProj to make sure del is set when using plot with zero projection.
  • Loading branch information
WPringle committed Jan 28, 2019
1 parent d56dd72 commit b099b62
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 8 deletions.
3 changes: 1 addition & 2 deletions @meshgen/meshgen.m
Original file line number Diff line number Diff line change
Expand Up @@ -262,8 +262,7 @@
obj.nscreen = inp.(fields{i});
obj.plot_on = 1;
else
obj.nscreen = 5;
obj.plot_on = 1; % plot the mesh by default
obj.nscreen = 5; % default
end
case('itmax')
obj.itmax= inp.(fields{i});
Expand Down
2 changes: 1 addition & 1 deletion @msh/msh.m
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ function write(obj,fname,type)
% This deletes any elements straddling the -180/180
% boundary for plotting purposes
xt = [obj.p(obj.t(:,1),1) obj.p(obj.t(:,2),1) ...
obj.p(obj.t(:,3),1) obj.p(obj.t(:,1),1)];
obj.p(obj.t(:,3),1) obj.p(obj.t(:,1),1)];
dxt = diff(xt,[],2);
obj.t(abs(dxt(:,1)) > 180 | abs(dxt(:,2)) > 180 | ...
abs(dxt(:,2)) > 180,:) = [];
Expand Down
2 changes: 1 addition & 1 deletion Example_5_JBAY.m
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
'g',grade);
%% STEP 4: Pass your edgefx class object along with some meshing options and
% build the mesh...
mshopts = meshgen('ef',fh,'bou',gdat,'plot_on',1);
mshopts = meshgen('ef',fh,'bou',gdat,'plot_on',1,'proj','utm');
% now build the mesh with your options and the edge function.
mshopts = mshopts.build;
%% STEP 5: Plot it and save the msh file
Expand Down
4 changes: 2 additions & 2 deletions Example_6_GBAY.m
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
% Example_6_GBAY: Mesh the Galveston bay (GBAY) region in
% high resolution.

clearvars; clc;

addpath(genpath('utilities/'))
Expand All @@ -20,6 +19,7 @@
'dem',demfile,...
'bbox',bbox,...
'h0',min_el);
gdat = gdat.close([-94.8,29.5]);
load ECGC_Thalwegs.mat % Load the Channel thalweg data
%% STEP 3: create an edge function class
fh = edgefx('geodata',gdat,...
Expand All @@ -30,7 +30,7 @@
'max_el',max_el);
%% STEP 4: Pass your edgefx class object along with some meshing options and
% build the mesh...
mshopts = meshgen('ef',fh,'bou',gdat,'plot_on',1);
mshopts = meshgen('ef',fh,'bou',gdat,'plot_on',1,'proj','lambert');
% now build the mesh with your options and the edge function.
mshopts = mshopts.build;
%% STEP 5: Plot it and write a triangulation fort.14 compliant file to disk.
Expand Down
2 changes: 1 addition & 1 deletion utilities/Calc_f13_inpoly.m
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
function obj = Calc_f13_inpoly(obj,attribute,polys,cfvals,inverse,Cf_val_on_mesh)
% obj = Calc_f13_inpoly(obj,attribute,polys,cfvals,Cf_val_on_mesh)
% obj = Calc_f13_inpoly(obj,attribute,polys,cfvals,inverse,Cf_val_on_mesh)
% Input a msh class object with bathy data and get back the specified
% attribute in a f13 structure of the obj
%
Expand Down
7 changes: 7 additions & 0 deletions utilities/ExtractSubDomain.m
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,13 @@
if nargin == 2
keep_inverse = 0;
end
if size(bou,1) == 2
bou = [bou(1,1) bou(2,1);
bou(1,1) bou(2,2); ...
bou(1,2) bou(2,2);
bou(1,2) bou(2,1); ...
bou(1,1) bou(2,1)];
end
bxy1 = p(t(:,1),:); bxy2 = p(t(:,2),:); bxy3 = p(t(:,3),:);
in1 = inpoly(bxy1,bou); in2 = inpoly(bxy2,bou); in3 = inpoly(bxy3,bou);
in = in1 & in2 & in3;
Expand Down
4 changes: 3 additions & 1 deletion utilities/setProj.m
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
if proj == 0
% normal geographic coordinates
m_proj('equi','lat',[lat_mi lat_ma],'long',[lon_mi lon_ma]) ;
del = 1;
else
if startsWith(projtype,'ste','IgnoreCase',true)
% Special treatment of Stereographic projection
Expand All @@ -31,7 +32,8 @@
startsWith(projtype,'azi','IgnoreCase',true) || ...
startsWith(projtype,'sat','IgnoreCase',true)
% Azimuthal type projections
m_proj(projtype,'lat',lat_mea,'long',lon_mea);
m_proj(projtype,'lat',lat_mea,'long',lon_mea,...
'radius',50);
m_proj('get') ;
del = 1;
elseif startsWith(projtype,'obl','IgnoreCase',true)
Expand Down

0 comments on commit b099b62

Please sign in to comment.