Home > swan_scripts > plot_swan_mesh.m

plot_swan_mesh

PURPOSE ^

Plot an unstructured SWAN mesh

SYNOPSIS ^

function plot_swan_mesh(bathfile,nodefile,gridfile)

DESCRIPTION ^

 Plot an unstructured SWAN mesh

 function plot_swan_mesh(bathfile,nodefile,gridfile)

 DESCRIPTION:
    plot an unstructure SWAN mesh and bathymetry

 INPUT 
   bathfile = SWAN bathymetry file
   nodefile = SWAN vertex file
   gridfile = SWAN connectivity file    

 OUTPUT:
    plot of Mesh and bathymetry

 EXAMPLE USAGE
    plot_swan_mesh('tst.bot','tst.node','tst.ele') 

 Author(s):  
    Geoff Cowles (University of Massachusetts Dartmouth)

 Revision history
   
==============================================================================

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function plot_swan_mesh(bathfile,nodefile,gridfile)
0002 % Plot an unstructured SWAN mesh
0003 %
0004 % function plot_swan_mesh(bathfile,nodefile,gridfile)
0005 %
0006 % DESCRIPTION:
0007 %    plot an unstructure SWAN mesh and bathymetry
0008 %
0009 % INPUT
0010 %   bathfile = SWAN bathymetry file
0011 %   nodefile = SWAN vertex file
0012 %   gridfile = SWAN connectivity file
0013 %
0014 % OUTPUT:
0015 %    plot of Mesh and bathymetry
0016 %
0017 % EXAMPLE USAGE
0018 %    plot_swan_mesh('tst.bot','tst.node','tst.ele')
0019 %
0020 % Author(s):
0021 %    Geoff Cowles (University of Massachusetts Dartmouth)
0022 %
0023 % Revision history
0024 %
0025 %==============================================================================
0026 
0027 subname = 'plot_swan_mesh';
0028 fprintf('\n')
0029 fprintf(['begin : ' subname '\n'])
0030 
0031 %------------------------------------------------------------------------------
0032 % read in the SWAN bathymetry, connectivity, node files
0033 %------------------------------------------------------------------------------
0034 
0035 
0036 [i,i1,i2,i3] = textread(gridfile,'%d %d %d %d','headerlines',1);
0037 tri(:,1) = i1;
0038 tri(:,2) = i2;
0039 tri(:,3) = i3;
0040 
0041 [i,x,y,type] = textread(nodefile,'%d %f %f %d\n','headerlines',1);
0042 x(:,1) = x;
0043 x(:,2) = y;
0044 
0045 [bath] = textread(bathfile,'%f\n');
0046 
0047 patch('Vertices',x,'Faces',tri,...
0048        'Cdata',bath,'edgecolor','interp','facecolor','interp');
0049 colorbar
0050 
0051 hold on
0052 bnodes = find(type==1);
0053 plot(x(bnodes,1),y(bnodes,1),'k+')
0054 obnodes = find(type==2);
0055 plot(x(obnodes,1),y(obnodes,1),'ro')
0056 
0057 
0058 fprintf(['end   : ' subname '\n'])
0059 
0060

Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005