Ignore:
Timestamp:
10/21/13 16:37:02 (11 years ago)
Author:
Mathieu Morlighem
Message:

CHG: no need to check whether data is empty

File:
1 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/m/plot/processmesh.m

    r16477 r16488  
    2121end
    2222
    23 if ~isempty(data)
    24         %first load x,y, etc ... to speed up plot
     23%first load x,y, etc ... to speed up plot
     24if ~strcmpi(getfieldvalue(options,'coord','xy'),'latlon'),
     25        x=md.mesh.x;
     26        if isprop(md.mesh,'x2d'), x2d=md.mesh.x2d; end
     27        y=md.mesh.y;
     28        if isprop(md.mesh,'y2d'), y2d=md.mesh.y2d; end
     29else
     30        x=md.mesh.long;
     31        y=md.mesh.lat;
     32end
    2533
    26         if ~strcmpi(getfieldvalue(options,'coord','xy'),'latlon'),
    27                 x=md.mesh.x;
    28                 if isprop(md.mesh,'x2d'), x2d=md.mesh.x2d; end
    29                 y=md.mesh.y;
    30                 if isprop(md.mesh,'y2d'), y2d=md.mesh.y2d; end
     34z_field=getfieldvalue(options,'z',md.mesh.z);
     35if ischar(z_field),
     36        z=md.(z_field);
     37elseif isnumeric(z_field),
     38        z=z_field;
     39else
     40        z=md.mesh.z;
     41end
     42
     43if isprop(md.mesh,'elements2d'), elements2d=md.mesh.elements2d; end
     44elements=md.mesh.elements;
     45
     46%is it a 2d plot?
     47if (md.mesh.dimension==2);
     48        is2d=1;
     49elseif (md.mesh.dimension==3),
     50        if getfieldvalue(options,'layer',0)>=1,
     51                is2d=1;
    3152        else
    32                 x=md.mesh.long;
    33                 y=md.mesh.lat;
     53                is2d=0;
    3454        end
     55else
     56        error(['dim = ' num2str(md.mesh.dimension) ' not supported yet']);
     57end
    3558
    36         z_field=getfieldvalue(options,'z',md.mesh.z);
    37         if ischar(z_field),
    38                 z=md.(z_field);
    39         elseif isnumeric(z_field),
    40                 z=z_field;
    41         else
    42                 z=md.mesh.z;
     59%layer projection?
     60if getfieldvalue(options,'layer',0)>=1,
     61        if strcmpi(getfieldvalue(options,'coord','xy'),'latlon'),
     62                error('processmesh error message: cannot work with 3D meshes for now');
    4363        end
    44 
    45         if isprop(md.mesh,'elements2d'), elements2d=md.mesh.elements2d; end
    46         elements=md.mesh.elements;
    47 
    48         %is it a 2d plot?
    49         if (md.mesh.dimension==2);
    50                 is2d=1;
    51         elseif (md.mesh.dimension==3),
    52                 if getfieldvalue(options,'layer',0)>=1,
    53                         is2d=1;
    54                 else
    55                         is2d=0;
    56                 end
    57         else
    58                 error(['dim = ' num2str(md.mesh.dimension) ' not supported yet']);
    59         end
    60 
    61         %layer projection?
    62         if getfieldvalue(options,'layer',0)>=1,
    63                 if strcmpi(getfieldvalue(options,'coord','xy'),'latlon'),
    64                         error('processmesh error message: cannot work with 3D meshes for now');
    65                 end
    66                 %we modify the mesh temporarily to a 2d mesh from which the 3d mesh was extruded.
    67                 x=x2d;
    68                 y=y2d;
    69                 z=zeros(size(x2d));
    70                 elements=elements2d;
    71         end
     64        %we modify the mesh temporarily to a 2d mesh from which the 3d mesh was extruded.
     65        x=x2d;
     66        y=y2d;
     67        z=zeros(size(x2d));
     68        elements=elements2d;
    7269end
    7370
Note: See TracChangeset for help on using the changeset viewer.