Changeset 3006


Ignore:
Timestamp:
02/10/10 11:42:27 (15 years ago)
Author:
jschierm
Message:

Update adjacency_matrix.m with cool new progress bar.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk/src/m/partition/adjacency_matrix.m

    r2915 r3006  
    2828disp('Creating unique sorted vertex list.');
    2929vlist=unique(nonzeros(elem_con));
     30fprintf('  Found %d vertices numbered from %d to %d.\n',...
     31        length(vlist),vlist(1),vlist(end));
    3032
    3133%%  create edge list and vertex weights
     
    4446%  loop over elements
    4547
     48fprintf('  Processing %d elements with a maximum of %d vertices.\n',...
     49        size(elem_con,1),size(elem_con,2));
     50hwbar=waitbar(0);
    4651for i=1:size(elem_con,1)
    4752    elem=nonzeros(elem_con(i,:));
     
    125130            error(['Unrecognized element of length' length(elem) '.']);
    126131    end
    127 end
    128 
    129 disp(sprintf('Total area=%f; min area=%f, max area=%f, ratio=%f.',...
    130              asum,amin,amax,amax/amin));
    131 disp(sprintf('Total volume=%f; min volume=%f, max volume=%f, ratio=%f.',...
    132              vsum,vmin,vmax,vmax/vmin));
    133 disp(sprintf('Total weight=%f; min weight=%f, max weight=%f, ratio=%f.',...
    134              sum(vwgt),min(vwgt),max(vwgt),max(vwgt)/min(vwgt)));
     132    if (i/100 == floor(i/100))
     133%         fprintf('  %d elements processed.\n',i);
     134        waitbar(i/size(elem_con,1),hwbar,sprintf('%d elements processed.',i));
     135    end
     136end
     137fprintf('  %d total elements processed.\n\n',i);
     138waitbar(1,hwbar,sprintf('%d total elements processed.',i));
     139close(hwbar)
     140
     141if (asum > 0)
     142    fprintf('Total area=%f; min area=%f, max area=%f, ratio=%f.\n',...
     143            asum,amin,amax,amax/amin);
     144end
     145if (vsum > 0)
     146    fprintf('Total volume=%f; min volume=%f, max volume=%f, ratio=%f.\n',...
     147            vsum,vmin,vmax,vmax/vmin);
     148end
     149fprintf('Total weight=%f; min weight=%f, max weight=%f, ratio=%f.\n',...
     150        sum(vwgt),min(vwgt),max(vwgt),max(vwgt)/min(vwgt));
    135151
    136152elist=elist(1:nedge,:);
     
    144160%%  create adjacency matrix and make symmetric
    145161
    146 disp('Creating adjacency matrix.');
    147162adj_mat=sparse(elist(:,1),elist(:,2),1,length(vlist),length(vlist));
    148163adj_mat=double(adj_mat | adj_mat');
Note: See TracChangeset for help on using the changeset viewer.