Changeset 5442 for issm/trunk/src/m/classes/public/modelextract.m
- Timestamp:
- 08/20/10 09:05:55 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk/src/m/classes/public/modelextract.m
r5433 r5442 148 148 if size(md2.edges,2)>1, %do not use ~isnan because there are some NaNs... 149 149 %renumber first two columns 150 md2.edges(:,1)=Pgrid(md2.edges(:,1)); 151 md2.edges(:,2)=Pgrid(md2.edges(:,2)); 152 md2.edges(:,3)=Pelem(md2.edges(:,3)); 153 %remove column where the first element is not in the domain 154 md2.edges=md2.edges(find(md2.edges(:,1) & md2.edges(:,2) & md2.edges(:,3)),:); 155 %now we must renumber the second column and put NaN if the element is not in the domain 156 A=md2.edges(:,4); 157 A(find(~isnan(A)))=Pelem(A(find(~isnan(A)))); 158 A(find(A==0))=NaN; 159 md2.edges(:,4)=A; clear A; 160 end 161 150 pos=find(~isnan(md2.edges(:,4))); 151 md2.edges(: ,1)=Pgrid(md2.edges(:,1)); 152 md2.edges(: ,2)=Pgrid(md2.edges(:,2)); 153 md2.edges(: ,3)=Pelem(md2.edges(:,3)); 154 md2.edges(pos,4)=Pelem(md2.edges(pos,4)); 155 %remove edges when the 2 vertices are not in the domain. 156 md2.edges=md2.edges(find(md2.edges(:,1) & md2.edges(:,2)),:); 157 %Replace all zeros by NaN in the last two columns; 158 pos=find(md2.edges(:,3)==0); 159 md2.edges(pos,3)=NaN; 160 pos=find(md2.edges(:,4)==0); 161 md2.edges(pos,4)=NaN; 162 %Invert NaN of the third column with last column 163 pos=find(isnan(md2.edges(:,3))); 164 md2.edges(pos,3)=md2.edges(pos,4); 165 md2.edges(pos,4)=NaN; 166 %Finally remove edges that do not belong to any element 167 pos=find(isnan(md2.edges(:,3)) & isnan(md2.edges(:,4))); 168 md2.edges(pos,:)=[]; 169 end 162 170 163 171 %Penalties
Note:
See TracChangeset
for help on using the changeset viewer.