Changeset 2919
- Timestamp:
- 01/27/10 10:54:26 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk/src/m/partition/flagedges.m
r2918 r2919 1 flags=zeros(md.numberofgrids,1); 1 function 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 % 2 8 3 for i=1:md.numberofgrids, 9 %number of grids 10 numberofgrids=length(partition); 4 11 12 %initialize flags 13 flags=zeros(numberofgrids,1); 14 15 %go through grids, and figure out which grid is connected to a grid belonging to another partition, flag it. 16 for 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 5 27 if flags(i), 6 28 continue; 7 29 end 8 if mod(i,100),9 disp([num2str(i) 'vs' num2str(md.numberofgrids)]);10 end11 12 grids=adj_mat(i,:);13 grids=find(grids);14 30 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); 17 35 18 36 index=find(part_i~=part_connected); … … 20 38 grids_on_edge=grids(index); 21 39 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. 23 41 end 24 25 42 end
Note:
See TracChangeset
for help on using the changeset viewer.