Commit 7c04bbb5 authored by Pierre Cazenave's avatar Pierre Cazenave

Change the default behaviour to not plot the grids which have been read in

parent e0a4f7fe
function [Mobj] = add_obc_nodes_list(Mobj,Nlist,ObcName,ObcType)
function [Mobj] = add_obc_nodes_list(Mobj,Nlist,ObcName,ObcType,plotFig)
% Add a set of obc nodes comprising a single obc boundary to Mesh structure
% Using a list of nodes
......@@ -13,6 +13,7 @@ function [Mobj] = add_obc_nodes_list(Mobj,Nlist,ObcName,ObcType)
% Nlist = List of nodes
% ObcName = Name of the Open Boundary
% ObcType = FVCOM Flag for OBC Type
% plotFig = [optional] show a figure of the mesh (1 = yes)
%
% OUTPUT:
% Mobj = Matlab mesh object with an additional obc nodelist
......@@ -26,6 +27,7 @@ function [Mobj] = add_obc_nodes_list(Mobj,Nlist,ObcName,ObcType)
%
%
% Revision history:
% 2012-11-26 Add ability to turn off the figures.
%
%==========================================================================
subname = 'add_obc_nodes';
......@@ -35,6 +37,10 @@ if(ftbverbose)
fprintf(['begin : ' subname '\n'])
end
% Do we want a figure showing how we're getting along?
if nargin == 4
plotFig = 0;
end
%--------------------------------------------------------------------------
% Get a unique list and make sure they are in the range of node numbers
......@@ -49,24 +55,25 @@ end
%--------------------------------------------------------------------------
% Plot the mesh
%--------------------------------------------------------------------------
if plotFig == 1
if strcmpi(Mobj.nativeCoords(1:3), 'car')
x = Mobj.x;
y = Mobj.y;
else
x = Mobj.lon;
y = Mobj.lat;
end
if strcmpi(Mobj.nativeCoords(1:3), 'car')
x = Mobj.x;
y = Mobj.y;
else
x = Mobj.lon;
y = Mobj.lat;
figure
patch('Vertices',[x,y],'Faces',Mobj.tri,...
'Cdata',Mobj.h,'edgecolor','k','facecolor','interp');
hold on;
whos Nlist
plot(x(Nlist),y(Nlist),'ro');
axis('equal','tight')
title('open boundary nodes');
end
figure
patch('Vertices',[x,y],'Faces',Mobj.tri,...
'Cdata',Mobj.h,'edgecolor','k','facecolor','interp');
hold on;
whos Nlist
plot(x(Nlist),y(Nlist),'ro');
axis('equal','tight')
title('open boundary nodes');
% add to mesh object
npts = numel(Nlist);
Mobj.nObs = Mobj.nObs + 1;
......
function [Mobj] = add_sponge_nodes_list(Mobj,SpongeList,SpongeName,SpongeRadius,SpongeCoeff)
function [Mobj] = add_sponge_nodes_list(Mobj,SpongeList,SpongeName,SpongeRadius,SpongeCoeff,plotFig)
% Add a set of sponge nodes comprising a single sponge layer to Mesh structure
%
......@@ -13,6 +13,7 @@ function [Mobj] = add_sponge_nodes_list(Mobj,SpongeList,SpongeName,SpongeRadius
% SpongeName = Name of the Sponge Layer
% SpongeRadius = Radius of influence of the Sponge Layer
% SpongeCoeff = Sponge damping coefficient
% plotFig = [optional] show a figure of the mesh (1 = yes)
%
% OUTPUT:
% Mobj = Matlab mesh object with an additional sponge nodelist
......@@ -25,32 +26,38 @@ function [Mobj] = add_sponge_nodes_list(Mobj,SpongeList,SpongeName,SpongeRadius
% Pierre Cazenave (Plymouth Marine Laboratory)
%
% Revision history
% Modifed from add_sponge_nodes to read in nodes from a supplied list.
% Modifed from add_sponge_nodes to read in nodes from a supplied list.
% 2012-11-26 Add ability to turn off the figures.
%
%==============================================================================
subname = 'add_sponge_nodes';
fprintf('\n')
fprintf(['begin : ' subname '\n'])
% Do we want a figure showing how we're getting along?
if nargin == 5
plotFig = 0;
end
%------------------------------------------------------------------------------
% Plot the mesh
%------------------------------------------------------------------------------
if plotFig == 1
if(lower(Mobj.nativeCoords(1:3)) == 'car')
x = Mobj.x;
y = Mobj.y;
else
x = Mobj.lon;
y = Mobj.lat;
end;
if(lower(Mobj.nativeCoords(1:3)) == 'car')
x = Mobj.x;
y = Mobj.y;
else
x = Mobj.lon;
y = Mobj.lat;
end;
figure
patch('Vertices',[x,y],'Faces',Mobj.tri,...
'Cdata',Mobj.h,'edgecolor','k','facecolor','interp');
hold on;
plot(x(SpongeList),y(SpongeList),'wx')
axis('equal','tight')
figure
patch('Vertices',[x,y],'Faces',Mobj.tri,...
'Cdata',Mobj.h,'edgecolor','k','facecolor','interp');
hold on;
plot(x(SpongeList),y(SpongeList),'wx')
axis('equal','tight')
end
npts = size(SpongeList,2);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment