Changeset 2395


Ignore:
Timestamp:
10/08/09 09:32:40 (15 years ago)
Author:
Mathieu Morlighem
Message:

now use pairoptions in setelementstype

File:
1 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk/src/m/classes/public/recover_areas.m

    r1338 r2395  
    77%      [hutterflag macayealflag pattynflag stokesflag filltype]=recover_areas(md,varargin);
    88
    9         %initialize elementstype
    10         hutterflag=zeros(md.numberofelements,1);
    11         macayealflag=zeros(md.numberofelements,1);
    12         pattynflag=zeros(md.numberofelements,1);
    13         stokesflag=zeros(md.numberofelements,1);
    14         filltype='none';
     9        %go through varargin, extract options and plug them into subtype options, by order of appearance
     10        options=pairoptions(varargin{:});
     11        options=deleteduplicates(options,1);
    1512
    16         %make sure length(varargin) is even
    17         if mod(length(varargin),2),
    18                 error('recover_elementstype_options error message: an even number of options is necessary');
    19         end
     13        %recover elements distribution
     14        hutterflag  =BuildFlag(md,getfieldvalue(options,'hutter',''));
     15        macayealflag=BuildFlag(md,getfieldvalue(options,'macayeal',''));
     16        pattynflag  =BuildFlag(md,getfieldvalue(options,'pattyn',''));
     17        stokesflag  =BuildFlag(md,getfieldvalue(options,'stokes',''));
     18        hutterflag  =BuildFlag(md,getfieldvalue(options,'hutter',''));
     19        filltype    =getfieldvalue(options,'fill','none');
    2020
    21         %go through varargin, extract options and plug them into subtype options, by order of appearance
    22         for i=1:length(varargin)/2,
    23 
    24                 optionstring=varargin{2*i-1};
    25                 optionvalue=varargin{2*i};
    26 
    27                 if strcmpi(optionstring,'hutter'),
    28                         hutterflag=BuildFlag(md,optionvalue);
    29                 elseif strcmpi(optionstring,'macayeal'),
    30                         macayealflag=BuildFlag(md,optionvalue);
    31                 elseif strcmpi(optionstring,'pattyn'),
    32                         pattynflag=BuildFlag(md,optionvalue);
    33                 elseif strcmpi(optionstring,'stokes'),
    34                         stokesflag=BuildFlag(md,optionvalue);
    35                 elseif strcmpi(optionstring,'fill'),
    36                         filltype=optionvalue;
    37                 else
    38                         error('elementstype_options error message: bad elementstype options');
    39                 end
    40         end
    4121end %end function
    4222
Note: See TracChangeset for help on using the changeset viewer.