source: issm/oecreview/Archive/16133-16554/ISSM-16487-16488.diff

Last change on this file was 16556, checked in by Mathieu Morlighem, 11 years ago

NEW: added Archive/16133-16554

File size: 2.5 KB
  • ../trunk-jpl/src/m/plot/processmesh.m

     
    2020        return;
    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
    31         else
    32                 x=md.mesh.long;
    33                 y=md.mesh.lat;
    34         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
    3542
    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;
    43         end
     43if isprop(md.mesh,'elements2d'), elements2d=md.mesh.elements2d; end
     44elements=md.mesh.elements;
    4445
    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);
     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,
    5051                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
    5752        else
    58                 error(['dim = ' num2str(md.mesh.dimension) ' not supported yet']);
     53                is2d=0;
    5954        end
     55else
     56        error(['dim = ' num2str(md.mesh.dimension) ' not supported yet']);
     57end
    6058
    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;
     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');
    7163        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
    7471%units
Note: See TracBrowser for help on using the repository browser.