%
%  Name:   plotflex
%
%  Usage:  plotflex
%
%

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


%
%  Get the values from the uicontrols
%


if iopDOF == 1, DOFvec = respDOF_u; elseif iopDOF ==2, DOFvec = refDOF_u; end


%
%  Form the Flexibility Shapes
%

if nflexload == 1,	% UNIFORM LOAD

   loadvec = ones(size(Flex_u,1),1);
   Flexshp_u = Flex_u * loadvec * iflexsgn;
   Flexshp_d = Flex_d * loadvec * iflexsgn;
   fxmethstr = 'Uniform Load';

elseif nflexload == 2,	% MULTI-POINT LOAD

   Flexshp_u = diag(Flex_u) * iflexsgn;
   Flexshp_d = diag(Flex_d) * iflexsgn;
   fxmethstr = 'Multi-Pt Load';

elseif nflexload == 3,  % SINGLE POINT LOAD

   loadvec = zeros(size(Flex_u,1),1);
   loadvec(iflexdof) = 1;
   Flexshp_u = Flex_u * loadvec * iflexsgn;
   Flexshp_d = Flex_d * loadvec * iflexsgn;
   fxmethstr = 'Single Pt Load';

end

%
%  Generate the plot vector
%

if iflextype == 1,
   	flexplt = Flexshp_d - Flexshp_u;
	zlab = 'Flexibility Change';
elseif iflextype == 2,
	flexplt = Flexshp_u;
	zlab = 'Undamaged Flexibility';
elseif iflextype == 3,
	flexplt = Flexshp_d;
	zlab = 'Damaged Flexibility';
end

%
%  Set plot parameters
%


inodal = 1; % Damage Indicator is Nodal quantity

colormap cool

if ~isempty(Bars),
   ngrad = 4; % Number of increments for color gradient shading
   ptdambar(Nodes,Bars,flexplt,haxes,inodal,ngrad);
elseif ~isempty(Shells),
   ngrad = 4;  % Number of divisions in each direction for shell elements
   ptdamshl(Nodes,[],Shells,flexplt,haxes,inodal,ngrad);
else
   errordlg('ERROR: No Bar or Shell Geometry Defined')
end

damscale(hlegax,flexplt);

axes(haxes)
damtitstr = damtitle(['Flexibility Method -',zlab],pathname_u,filename_u,...
   pathname_d,filename_d,[fxmethstr,', ','Modes: ',num2str(mode_anal)]);
title(['Flexibility Method -',zlab])
rotate3d on