function haxes = plotdam(xfp,yfp,DI,xlab,ylab,zlab,cutoff,haxes,ndamplttp,idamugeom,Bars,Nodes,icontlab,zcont,clabfntsz,clablnsz)
%
%  Name: plotdam
% 
%  Usage: 
%
% 
%   Description:
%     Draws a plot of the damage variable DI
%
%   inputs:
%	yfp(j,i) = y coordinate of the (j,i) element of DI
%	xfp(j,i) = x coordinate of the (j,i) element of DI
%	DI(j,i)  = Value of the function at x=xfp(j,i) and y=yfp(j,i)
%	haxes    = handle of the axes to use to make the chart
%	xlab, ylab, zlab = label strings for axes x, y, z
%	cutoff   = 'critical' value of DI -- bars where DI > cutoff 
%		    will be colored red (only used when cutoff > 0)
%
%	ndamplttp = 1 for contour, 2 for filled contour, 3 for 3-D bar chart, 4 for surface plot
%	idamugeom = flag to plot undamaged geom
%	Bars, Nodes = DIAMOND geometry matrices
%	icontlab  = flag to label contour lines
% 	zcont = vector of magnitudes at which contour lines are to be drawn

%  Version SWD970115
%
%  Author(s): Scott W. Doebling, doebling@lanl.gov
%
%  Institution: Los Alamos National Laboratory,
%		ESA-EA
%
%  Copyright (c) 1997, The Regents of the University
%     	of California. (See top level of code for
%	full copyright statement.)


if ~exist('haxes')
	haxes = axes;
elseif ~ishandle(haxes),
	haxes = axes;
end

axes(haxes);

hold off

cla

if ndamplttp == 1,

  if idamugeom == 1,  
     drawbars(Bars,Nodes,0,haxes,[1 1 0],'-')
     hold on
   end

   cs = contour(xfp,yfp,DI);
   
  % zcont,'color','r','linewidth',clablnsz 
   
   if icontlab == 1,

      %extclbl(cs,'color','r','linewidth',clablnsz,'fontsize',clabfntsz);

   end

elseif ndamplttp == 2,

   cs = contourf(xfp,yfp,DI);

   if icontlab == 1,

      %extclbl(cs,'fontsize',clabfntsz);

   end

   if idamugeom == 1,  
     hold on
     drawbars(Bars,Nodes,0,haxes,[1 1 0],'-')
   end

elseif ndamplttp == 3,

  if idamugeom == 1,  
     drawbars(Bars,Nodes,0,haxes,[1 1 0],'-')
     hold on
   end

   haxes = bar3D(xfp,yfp,DI,xlab,ylab,zlab,cutoff,haxes);

elseif ndamplttp == 4,

  if idamugeom == 1,  
     drawbars(Bars,Nodes,0,haxes,[1 1 0],'-')
     hold on
   end

   surf(xfp,yfp,DI)

end

hold off

set(haxes,'Xlim',[min(min(xfp)) max(max(xfp))]*1.1,'Ylim',[min(min(yfp)) max(max(yfp))]*1.1)

if exist('xlab'),
   xlabel(xlab),ylabel(ylab),zlabel(zlab)
end

axis('equal')	

drawnow

return


