Changeset 2919


Ignore:
Timestamp:
01/27/10 10:54:26 (15 years ago)
Author:
Eric.Larour
Message:

some better displaying

File:
1 edited

Legend:

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

    r2918 r2919  
    1 flags=zeros(md.numberofgrids,1);
     1function flags=flagedges(partition,adjacencymatrix);
     2%FLAGEDGES return a vector of boolean flags that indicate whether a node is on the edge of a partition.
     3%          needs partition vector and adjacencymatrix in inputs.
     4%
     5%
     6%         Usage: flags=flagedges(partition,adjacencymatrix);
     7%
    28
    3 for i=1:md.numberofgrids,
     9%number of grids
     10numberofgrids=length(partition);
    411
     12%initialize flags
     13flags=zeros(numberofgrids,1);
     14
     15%go through grids, and figure out which grid is connected to a grid belonging to another partition, flag it.
     16for i=1:numberofgrids,
     17
     18        %some feedback
     19        if i==1,
     20                fprintf('    progress report: %5.2f %s',i/numberofgrids*100,'%');
     21        elseif mod(i,1000),
     22                fprintf('\b\b\b\b\b\b\b');
     23                fprintf('%5.2f %s',i/numberofgrids*100,'%');
     24        end
     25
     26        %already flag, move on
    527        if flags(i),
    628                continue;
    729        end
    8         if mod(i,100),
    9                 disp([num2str(i) 'vs' num2str(md.numberofgrids)]);
    10         end
    11 
    12         grids=adj_mat(i,:);
    13         grids=find(grids);
    1430       
    15         part_i=maptab(i,2);
    16         part_connected=maptab(grids,2);
     31        grids=adjacencymatrix(i,:); grids=find(grids);
     32       
     33        part_i=partition(i);
     34        part_connected=partition(grids);
    1735
    1836        index=find(part_i~=part_connected);
     
    2038                grids_on_edge=grids(index);
    2139                flags(grids_on_edge)=1;
    22                 %flags(i)=1;
     40                %flags(i)=1; do not flag i, otherwise, edges are doubled, results in ugly plots.
    2341        end
    24 
    2542end
Note: See TracChangeset for help on using the changeset viewer.