function [DI,DIdof] = reduceDI(DI, DIdof, saveDOF)
%
% Function: reduceDI.m
% 
% Usage: [DI,DIdof] = reduceDI(DI, DIdof, saveDOF)
% 
% Description:
%    Reduces the damage indicator matrix DI with [node dir] in DIdof
%	to save only the DOF with directions in saveDOF
%

% Version SWD970114
%
% 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.

%
% Form vector of Damage Indicators to keep
%

keepvec = [];

for i = 1:size(DIdof,1),

    if ~isempty(find(DIdof(i,2)==saveDOF)), 

	keepvec = [keepvec;i];

    end

end

%
%  Reduce DI and DIdof to the indices listed in keepvec
%

DI = DI(keepvec,keepvec);

DIdof = DIdof(keepvec,:);

return
