Skip to content

Commit

Permalink
Merge branch 'Projection' of https://github.com/CHLNDDEV/OceanMesh2D
Browse files Browse the repository at this point in the history
…into Projection
  • Loading branch information
WPringle committed Jan 28, 2019
2 parents b099b62 + b813c80 commit b05a3d9
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
21 changes: 14 additions & 7 deletions @geodata/geodata.m
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
addOptional(p,'fp',defval);
addOptional(p,'outer',defval);
addOptional(p,'weirs',defval);
addOptional(p,'inner',defval);
addOptional(p,'mainland',defval);
addOptional(p,'boubox',defval);
addOptional(p,'window',defval);
Expand Down Expand Up @@ -110,6 +111,11 @@
if obj.mainland(1) ~=0
obj.mainland = inp.(fields{i});
end
case('inner')
obj.inner = inp.(fields{i});
if obj.inner(1) ~=0
obj.inner = inp.(fields{i});
end
case('boubox')
obj.boubox = inp.(fields{i}) ;
case('window')
Expand Down Expand Up @@ -259,20 +265,21 @@
% Handle the case for user defined mesh boundary information

% make sure it has equal spacing of h0/2
if isempty(obj.outer)
error('Outer segment is required to mesh!');
if obj.outer(1)==0
warning('Warning: creating outer polygon from bbox!')
obj.outer = obj.boubox;
end
[la,lo]=my_interpm(obj.outer(:,2),obj.outer(:,1),gridspace/2);
obj.outer = []; obj.outer(:,1) = lo; obj.outer(:,2) = la;


% for mainland
if ~isempty(obj.mainland)
if obj.mainland(1)~=0
[la,lo]=my_interpm(obj.mainland(:,2),obj.mainland(:,1),gridspace/2);
obj.mainland = [];
obj.mainland(:,1) = lo; obj.mainland(:,2) = la;
else
error('Mainland segment is required to mesh!');
warning('Warning: No mainland segment was passed!');
end

% kjr Oct. 27 2018, add the weir faux islands to the inner geometry
Expand All @@ -288,7 +295,7 @@
obj.inner = [obj.inner ; NaN NaN ; tmp ] ;
end
% for islands
if ~isempty(obj.inner)
if obj.inner(1)~=0
[la,lo]=my_interpm(obj.inner(:,2),obj.inner(:,1),gridspace/2);
obj.inner = [];
obj.inner(:,1) = lo; obj.inner(:,2) = la;
Expand Down Expand Up @@ -526,11 +533,11 @@ function plot(obj,type,projection)
obj.boubox(1:end-1,2),'cross',45,0.05);
m_plot(long,lati,'.','Color','white')
end
if ~isempty(obj.mainland)
if obj.mainland(1)~=0
h1 = m_plot(obj.mainland(:,1),obj.mainland(:,2),...
'r-','linewi',1); hold on;
end
if ~isempty(obj.inner)
if obj.inner(1)~=0
h2 = m_plot(obj.inner(:,1),obj.inner(:,2),...
'g-','linewi',1); hold on;
end
Expand Down
2 changes: 1 addition & 1 deletion @meshgen/meshgen.m
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@
if isa(arg,'geodata')
obj.outer{ee} = obj.bou{ee}.outer;
obj.inner{ee} = obj.bou{ee}.inner;
if ~isempty(obj.inner{ee})
if obj.inner{ee}(1)~=0
obj.outer{ee} = [obj.outer{ee};
obj.inner{ee}];
end
Expand Down

0 comments on commit b05a3d9

Please sign in to comment.