Changeset 20109


Ignore:
Timestamp:
02/10/16 12:28:33 (9 years ago)
Author:
Eric.Larour
Message:

CHG: fixed issue with inner segments not being picked up within a certain tolerance.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/m/mesh/augment2dmesh.m

    r19954 r20109  
    1212options=pairoptions(varargin{:});
    1313
    14 %Offset the mesh2 elements:
     14%Offset the mesh band elements:
    1515mhband.elements=mhband.elements+mh.numberofvertices;
    1616mhband.segments(:,1:2)=mhband.segments(:,1:2)+mh.numberofvertices;
    1717mhband.segments(:,3)=mhband.segments(:,3)+mh.numberofelements;
    1818
    19 %The innner segment of md2 and the outer segments of md1 are identical. Go into  the elements of
    20 %md2 and set them to their md1 equivalent:
    21 flag=0;
    22 if flag,
    23         for i=1:length(mhband.segments),
    24                 node2=mhband.segments(i,1);
    25                 %this node2 has an equivalent on the segments  of md1:
    26                 for j=1:length(mh.segments),
    27                         node1=mh.segments(j,1);
    28                         if mhband.x(node2-mh.numberofvertices) == mh.x(node1) &&  mhband.y(node2-mh.numberofvertices) == mh.y(node1),
    29                                 %go into the mesh of md2, and replace by node1.
    30                                 pos=find(mhband.elements==node2); mhband.elements(pos)=node1;
    31                                 segs=mhband.segments(:,1:2); pos=find(segs==node2); segs(pos)=node1; mhband.segments(:,1:2)=segs;
    32                                 break;
    33                         end
     19%The innner segments of mhband and the outer segments of mh are identical. Go into  the elements of
     20%mhband and set them to their md1 equivalent:
     21tol=1; %1 meter
     22for i=1:length(mhband.segments),
     23        node2=mhband.segments(i,1);
     24        %this node2 has an equivalent on the segments  of mdh:
     25        for j=1:length(mh.segments),
     26                node1=mh.segments(j,1);
     27                %if mhband.x(node2-mh.numberofvertices) == mh.x(node1) &&  mhband.y(node2-mh.numberofvertices) == mh.y(node1),
     28                if sqrt((mhband.x(node2-mh.numberofvertices) - mh.x(node1))^2 + (mhband.y(node2-mh.numberofvertices) - mh.y(node1))^2)<tol,
     29                        %go into the mesh of mhband, and replace by node1.
     30                        pos=find(mhband.elements==node2); mhband.elements(pos)=node1;
     31                        segs=mhband.segments(:,1:2); pos=find(segs==node2); segs(pos)=node1; mhband.segments(:,1:2)=segs;
     32                        break;
    3433                end
    3534        end
    36 end     
     35end
    3736
    3837%Do the merge:
Note: See TracChangeset for help on using the changeset viewer.