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
%
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% This matlab source code was originally     %
% developed as part of "DIAMOND" at          %
% Los Alamos National Laboratory. It may     %
% be copied, modified, and distributed in    %
% any form, provided:                        %
%  a) This notice accompanies the files and  %
%     appears near the top of all source     %
%     code files.                            %
%  b) No payment or commercial services are  %
%     received in exchange for the code.     %
%                                            %
% Original copyright is reserved by the      %
% Regents of the University of California,   %
% in addition to Scott W. Doebling, Phillip  %
% J. Cornwell, Erik G. Straser, and Charles  %
% R. Farrar.                                 %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%
% 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
