Changeset 2612
- Timestamp:
- 11/05/09 11:16:55 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk/src/m/classes/public/mesh/findsegments.m
r2082 r2612 21 21 count=1; 22 22 23 %loop over the segments 23 24 for i=1:num_segments, 25 26 %get current element on boundary 24 27 el1=pos(i); 28 29 %get elements connected to el1 25 30 els2=elementconnectivity(el1,find(elementconnectivity(el1,:))); 31 32 %el1 is connected to 2 other elements 26 33 if length(els2)>1, 34 35 %get nodes of el1 36 nods1=md.elements(el1,:); 37 38 %find the common vertices to the two elements connected to el1 (1 or 2) 27 39 flag=intersect(md.elements(els2(1),:),md.elements(els2(2),:)); 28 nods1=md.elements(el1,:); 29 nods1(find(nods1==flag))=[]; 40 41 %get the vertices on the boundary and build segment 42 nods1(find(ismember(nods1,flag)))=[]; 30 43 segments(count,:)=[nods1 el1]; 31 44 45 %swap segment grids if necessary 32 46 ord1=find(nods1(1)==md.elements(el1,:)); 33 47 ord2=find(nods1(2)==md.elements(el1,:)); 34 35 %swap segment grids if necessary36 48 if ( (ord1==1 & ord2==2) | (ord1==2 & ord2==3) | (ord1==3 & ord2==1) ), 37 49 temp=segments(count,1); … … 41 53 segments(count,1:2)=fliplr(segments(count,1:2)); 42 54 count=count+1; 55 56 %el1 is connected to only one element 43 57 else 58 %get nodes of el1 44 59 nods1=md.elements(el1,:); 60 61 %find the vertex the el1 to not share with els2 45 62 flag=setdiff(nods1,md.elements(els2,:)); 63 46 64 for j=1:3, 47 65 nods=nods1; nods(j)=[]; 48 66 if any(ismember(flag,nods)), 67 49 68 segments(count,:)=[nods el1]; 69 70 %swap segment grids if necessary 50 71 ord1=find(nods(1)==md.elements(el1,:)); 51 72 ord2=find(nods(2)==md.elements(el1,:));
Note:
See TracChangeset
for help on using the changeset viewer.