


Add a set of obc nodes comprising a single obc boundary to Mesh structure
Using a list of nodes
[Mobj] = add_obc_nodes_list(Mobj,Nlist,ObcName,ObcType)
DESCRIPTION:
Select using ginput the set of nodes comprising an obc
INPUT
Mobj = Matlab mesh object
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
EXAMPLE USAGE
Mobj = add_obc_nodes_list(Mobj,Nlist,'OpenOcean')
Author(s):
Geoff Cowles (University of Massachusetts Dartmouth)
Pierre Cazenave (Plymouth Marine Laboratory)
Revision history:
2012-11-26 Add ability to turn off the figures.
==========================================================================

0001 function [Mobj] = add_obc_nodes_list(Mobj,Nlist,ObcName,ObcType,plotFig) 0002 0003 % Add a set of obc nodes comprising a single obc boundary to Mesh structure 0004 % Using a list of nodes 0005 % 0006 % [Mobj] = add_obc_nodes_list(Mobj,Nlist,ObcName,ObcType) 0007 % 0008 % DESCRIPTION: 0009 % Select using ginput the set of nodes comprising an obc 0010 % 0011 % INPUT 0012 % Mobj = Matlab mesh object 0013 % Nlist = List of nodes 0014 % ObcName = Name of the Open Boundary 0015 % ObcType = FVCOM Flag for OBC Type 0016 % plotFig = [optional] show a figure of the mesh (1 = yes) 0017 % 0018 % OUTPUT: 0019 % Mobj = Matlab mesh object with an additional obc nodelist 0020 % 0021 % EXAMPLE USAGE 0022 % Mobj = add_obc_nodes_list(Mobj,Nlist,'OpenOcean') 0023 % 0024 % Author(s): 0025 % Geoff Cowles (University of Massachusetts Dartmouth) 0026 % Pierre Cazenave (Plymouth Marine Laboratory) 0027 % 0028 % 0029 % Revision history: 0030 % 2012-11-26 Add ability to turn off the figures. 0031 % 0032 %========================================================================== 0033 subname = 'add_obc_nodes'; 0034 global ftbverbose 0035 if(ftbverbose) 0036 fprintf('\n') 0037 fprintf(['begin : ' subname '\n']) 0038 end 0039 0040 % Do we want a figure showing how we're getting along? 0041 if nargin == 4 0042 plotFig = 0; 0043 end 0044 0045 %-------------------------------------------------------------------------- 0046 % Get a unique list and make sure they are in the range of node numbers 0047 %-------------------------------------------------------------------------- 0048 Nlist = unique(Nlist); 0049 0050 if(max(Nlist) > Mobj.nVerts); 0051 fprintf('your open boundary node number exceed the total number of nodes in the domain\n'); 0052 error('stopping...\n') 0053 end 0054 0055 %-------------------------------------------------------------------------- 0056 % Plot the mesh 0057 %-------------------------------------------------------------------------- 0058 if plotFig == 1 0059 if strcmpi(Mobj.nativeCoords(1:3), 'car') 0060 x = Mobj.x; 0061 y = Mobj.y; 0062 else 0063 x = Mobj.lon; 0064 y = Mobj.lat; 0065 end 0066 0067 figure 0068 patch('Vertices',[x,y],'Faces',Mobj.tri,... 0069 'Cdata',Mobj.h,'edgecolor','k','facecolor','interp'); 0070 hold on; 0071 whos Nlist 0072 plot(x(Nlist),y(Nlist),'ro'); 0073 axis('equal','tight') 0074 title('open boundary nodes'); 0075 end 0076 0077 % add to mesh object 0078 npts = numel(Nlist); 0079 Mobj.nObs = Mobj.nObs + 1; 0080 Mobj.nObcNodes(Mobj.nObs) = npts; 0081 Mobj.obc_nodes(Mobj.nObs,1:npts) = Nlist; 0082 Mobj.obc_name{Mobj.nObs} = ObcName; 0083 Mobj.obc_type(Mobj.nObs) = ObcType; 0084 0085 0086 if(ftbverbose) 0087 fprintf(['end : ' subname '\n']) 0088 end 0089