Changeset 22931


Ignore:
Timestamp:
07/13/18 14:16:01 (7 years ago)
Author:
Eric.Larour
Message:

CHG: allow 3d contours

File:
1 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/m/exp/contourlevelzero.m

    r21824 r22931  
    1616x=md.mesh.x;
    1717y=md.mesh.y;
     18if isfield(md.mesh,'z'),
     19        z=md.mesh.z;
     20else
     21        z=zeros(md.mesh.numberofvertices,1);
     22end
    1823index=md.mesh.elements;
    1924
     
    8287y1=zeros(numelems,1);
    8388y2=zeros(numelems,1);
     89z1=zeros(numelems,1);
     90z2=zeros(numelems,1);
     91
    8492edge_l=zeros(numelems,2);
    8593
     
    96104                y1(j)=y(Seg1(poselem(j),1))+weight1*(y(Seg1(poselem(j),2))-y(Seg1(poselem(j),1)));
    97105                y2(j)=y(Seg2(poselem(j),1))+weight2*(y(Seg2(poselem(j),2))-y(Seg2(poselem(j),1)));
     106                z1(j)=z(Seg1(poselem(j),1))+weight1*(z(Seg1(poselem(j),2))-z(Seg1(poselem(j),1)));
     107                z2(j)=z(Seg2(poselem(j),1))+weight2*(z(Seg2(poselem(j),2))-z(Seg2(poselem(j),1)));
     108
    98109                edge_l(j,1)=Seg1_num(poselem(j));
    99110                edge_l(j,2)=Seg2_num(poselem(j));
     
    105116                y1(j)=y(Seg1(poselem(j),1))+weight1*(y(Seg1(poselem(j),2))-y(Seg1(poselem(j),1)));
    106117                y2(j)=y(Seg3(poselem(j),1))+weight3*(y(Seg3(poselem(j),2))-y(Seg3(poselem(j),1)));
     118                z1(j)=z(Seg1(poselem(j),1))+weight1*(z(Seg1(poselem(j),2))-z(Seg1(poselem(j),1)));
     119                z2(j)=z(Seg3(poselem(j),1))+weight3*(z(Seg3(poselem(j),2))-z(Seg3(poselem(j),1)));
     120
    107121                edge_l(j,1)=Seg1_num(poselem(j));
    108122                edge_l(j,2)=Seg3_num(poselem(j));
     
    114128                y1(j)=y(Seg2(poselem(j),1))+weight2*(y(Seg2(poselem(j),2))-y(Seg2(poselem(j),1)));
    115129                y2(j)=y(Seg3(poselem(j),1))+weight3*(y(Seg3(poselem(j),2))-y(Seg3(poselem(j),1)));
     130                z1(j)=z(Seg2(poselem(j),1))+weight2*(z(Seg2(poselem(j),2))-z(Seg2(poselem(j),1)));
     131                z2(j)=z(Seg3(poselem(j),1))+weight3*(z(Seg3(poselem(j),2))-z(Seg3(poselem(j),1)));
     132
    116133                edge_l(j,1)=Seg2_num(poselem(j));
    117134                edge_l(j,2)=Seg3_num(poselem(j));
     
    130147        %take the right edge of the second segment and connect it to the next segments if any
    131148        e1=edge_l(1,1);   e2=edge_l(1,2);
    132         xc=[x1(1);x2(1)]; yc=[y1(1);y2(1)];
     149        xc=[x1(1);x2(1)]; yc=[y1(1);y2(1)]; zc=[z1(1);z2(1)];
     150
    133151
    134152        %erase the lines corresponding to this edge
     
    136154        x1(1)=[]; x2(1)=[];
    137155        y1(1)=[]; y2(1)=[];
     156        z1(1)=[]; z2(1)=[];
    138157
    139158        [ro1,co1]=find(edge_l==e1);
     
    142161
    143162                if co1==1,
    144                         xc=[x2(ro1);xc]; yc=[y2(ro1);yc];
     163                        xc=[x2(ro1);xc]; yc=[y2(ro1);yc];zc=[z2(ro1);zc];
    145164
    146165                        %next edge:
     
    148167
    149168                else
    150                         xc=[x1(ro1);xc]; yc=[y1(ro1);yc];
     169                        xc=[x1(ro1);xc]; yc=[y1(ro1);yc];zc=[z1(ro1);zc];
    151170
    152171                        %next edge:
     
    158177                x1(ro1)=[]; x2(ro1)=[];
    159178                y1(ro1)=[]; y2(ro1)=[];
     179                z1(ro1)=[]; z2(ro1)=[];
    160180
    161181                %next connection
     
    169189
    170190                if co2==1,
    171                         xc=[xc;x2(ro2)]; yc=[yc;y2(ro2)];
     191                        xc=[xc;x2(ro2)]; yc=[yc;y2(ro2)];zc=[zc;z2(ro2)];
    172192
    173193                        %next edge:
    174194                        e2=edge_l(ro2,2);
    175195                else
    176                         xc=[xc;x1(ro2)]; yc=[yc;y1(ro2)];
     196                        xc=[xc;x1(ro2)]; yc=[yc;y1(ro2)]; zc=[zc;z1(ro2)];
    177197
    178198                        %next edge:
     
    184204                x1(ro2)=[]; x2(ro2)=[];
    185205                y1(ro2)=[]; y2(ro2)=[];
     206                z1(ro2)=[]; z2(ro2)=[];
    186207
    187208                %next connection
     
    192213        contours(end+1).x=xc;
    193214        contours(end).y=yc;
     215        contours(end).z=zc;
    194216        contours(end).name='';
    195217        contours(end).nods=length(xc);
Note: See TracChangeset for help on using the changeset viewer.