You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: postprocess.m
    path of file: ./repos/Isogeometric-Analysis/projects/j2_plasticity/3d_rectangular_bar_in_tension
    
    the code of the file until where you have to start completion: %--------------------------------------------------------------------------
%  Author: Isaac J. Lee (ijlee2@ices.utexas.edu)
%  
%  
%  Summary:
%  
%  This routine plots the 3D specimen after deformation.
%  
%  
%  Instructions:
%  
%  Use the terminal to run the driver file with this command:
%  
%      ./matbg.sh driver_postprocess.m output
%  
%  Note that,
%  
%      path_to_assembly_directory is the path to the assembly files directory
%      path_to_results_directory is the
    
function postprocess(path_to_assembly_directory, path_to_results_directory, path_to_outputs_directory, time_index)
    close all;
    
    % Load the global assembly file
    load(sprintf('%sfile_assembly_global', path_to_assembly_directory), ...
         'numPatches', ...
         'numNodesBeforePatch', ...
         'numDOFsPerNode', ...
         'GN_array');
    
    % Load the results file
    load(sprintf('%sfile_results_time%06.0f', path_to_results_directory, time_index), ...
         'u', 'ID_array');
    
    
    
    %----------------------------------------------------------------------
    % ---------------------------------------------------------------------
    %   Begin: Loop over patches
    % ---------------------------------------------------------------------
    %----------------------------------------------------------------------
    for p = 1 : numPatches
        % Load the patch assembly file
        load(sprintf('%sfile_assembly_patch%d', path_to_assembly_directory, p), ...
             'elementType', ...
             'p1', ...
             'p2', ...
             'p3', ...
             'nodes', ...
             'numNodesPerElement', ...
             'bezierExtractions1', ...
             'bezierExtractions2', ...
             'bezierExtractions3', ...
             'numElements1', ...
             'numElements2', ...
             'numElements3', ...
             'IEN_array');
        
        
        switch (lower(elementType))
            case {'bspline', 'b-spline'}
                elementType = 0;
                
            case 'nurbs'
                elementType = 1;
                
        end
        
        % Some useful constants
        constant_p1p1 = p1 + 1;
        constant_p2p1 = p2 + 1;
        constant_p3p1 = p3 + 1;
        
        
        %------------------------------------------------------------------
        %  Build the LM array
        %------------------------------------------------------------------
        LM_array = build_lm_array(IEN_array, ID_array, GN_array, numNodesBeforePatch(p));
        
        
        %------------------------------------------------------------------
        %  Set parameters for plotting
        %------------------------------------------------------------------
        % Number of points where the fields are evaluated
        numPointsPerElementCoordinate = 9;
        
        % Points on the Bernstein domain
        t = linspace(0, 1, numPointsPerElementCoordinate)';
        
        % Evaluate the Bernstein polynomials
        Bernstein1_der0 = zeros(constant_p1p1, numPointsPerElementCoordinate);
        Bernstein2_der0 = zeros(constant_p2p1, numPointsPerElementCoordinate);
        Bernstein3_der0 = zeros(constant_p3p1, numPointsPerElementCoordinate);
        
        for j = 1 : numPointsPerElementCoordinate
            Bernstein1_der0(:, j) = eval_1d_bernstein(t(j), p1);
            Bernstein2_der0(:, j) = eval_1d_bernstein(t(j), p2);
            Bernstein3_der0(:, j) = eval_1d_bernstein(t(j), p3);
        end