Changeset 2398


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

use pairoptions in solve options

Location:
issm/trunk/src/m/classes
Files:
1 added
1 deleted
4 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk/src/m/classes/@pairoptions/exist.m

    r2373 r2398  
    1 function bool=exist(pairoptions,optioname),
     1function bool=exist(pairoptions,field),
    22%EXIST - check if the option exist
    33%
    44%   Usage:
    5 %      bool=exist(pairoptions,optioname)
     5%      bool=exist(pairoptions,field)
    66
    77%some argument checking:
     
    1010        error('exist error message: bad usage');
    1111end
    12 
    13 if ~ischar(optioname),
    14         error('exist error message: optioname should be a string');
     12if ~ischar(field),
     13        error('exist error message: field should be a string');
    1514end
    1615
    1716%Recover option
    18 bool=0;
    19 for i=1:size(pairoptions.list,1),
    20         if strcmpi(pairoptions.list{i,1},optioname)
    21                 bool=1;
    22                 return
    23         end
    24 end
    25 
     17bool=ismember(field,pairoptions.list(:,1));
  • issm/trunk/src/m/classes/public/mesh/meshyams.m

    r2396 r2398  
    2424options=pairoptions(varargin{:});
    2525options=deleteduplicates(options,1);
    26 if ~exist(options,'domainoutline'),
    27         error('meshyams error message: no ''domainoutline'' was provided');
    28 end
    29 if ~exist(options,'velocities'),
    30         error('meshyams error message: no ''velocities'' was provided');
    31 end
    3226
    3327%recover some fields
    3428disp('MeshYams Options:')
    35 domainoutline=getfieldvalue(options,'domainoutline');
     29domainoutline=getfieldvalueerr(options,'domainoutline');
    3630disp(sprintf('   %-15s: ''%s''','DomainOutline',domainoutline));
    3731groundeddomain=getfieldvalue(options,'groundeddomain','N/A');
    3832disp(sprintf('   %-15s: ''%s''','GroundedDomain',groundeddomain));
    39 velocities=getfieldvalue(options,'velocities');
     33velocities=getfieldvalueerr(options,'velocities');
    4034disp(sprintf('   %-15s: ''%s''','Velocities',velocities));
    4135resolution=getfieldvalue(options,'resolution',5000);
  • issm/trunk/src/m/classes/public/process_solve_options.m

    r2298 r2398  
    55%      options=process_solve_options(options)
    66%
    7 %   See also: SOLVE,RECOVER_SOLVE_OPTIONS
     7%   See also: SOLVE
    88
    99%analysis_type: check on this option, error out otherwise
    10 found=0;
    11 for i=1:size(options,1),
    12         if strcmpi(options{i,1},'analysis_type'),
    13                 analysis_type=options{i,2};
    14                 found=1;
    15                 break
    16         end
    17 end
    18 if ~found,
    19         error('recover_solve_options error message: no ''analysis_type'' was provided');
    20 end
     10analysis_type=getfieldvalueerr(options,'analysis_type');
    2111
    2212%sub_analysis_type: check on it, not mandatory
    23 found=0;
    24 for i=1:size(options,1),
    25         if strcmpi(options{i,1},'sub_analysis_type'),
    26                 sub_analysis_type=options{i,2};
    27                 found=1;
    28                 break
    29         end
    30 end
    31 if ~found
    32         sub_analysis_type='none';
    33 end
     13sub_analysis_type=getfieldvalue(options,'sub_analysis_type','none');
    3414
    3515%batch mode for launching jobs.
    36 found=0;
    37 for i=1:size(options,1),
    38         if strcmpi(options{i,1},'batch'),
    39                 batch=options{i,2};
    40                 found=1;
    41                 break
    42         end
    43 end
    44 if ~found
    45         batch='no';
    46 end
     16outoptions.batch=getfieldvalue(options,'batch','no');
    4717
    4818%check solution type is supported
     
    5121else
    5222        %convert to enum
    53         analysis_type=eval([upper(analysis_type(1)) lower(analysis_type(2:end)) 'AnalysisEnum']);
     23        outoptions.analysis_type=eval([upper(analysis_type(1)) lower(analysis_type(2:end)) 'AnalysisEnum']);
    5424end
    5525if ~ismemberi(sub_analysis_type,{'steady','transient','none','horiz','adjoint','gradient','inverse','vert',''}),
     
    5727else
    5828        %convert to enum
    59         sub_analysis_type=eval([upper(sub_analysis_type(1)) lower(sub_analysis_type(2:end)) 'AnalysisEnum']);
     29        outoptions.sub_analysis_type=eval([upper(sub_analysis_type(1)) lower(sub_analysis_type(2:end)) 'AnalysisEnum']);
    6030end
    6131
    6232%  process qmu arguments
    63 
    64 %first, the defaults
    65 qmudir ='qmu';% qmudir =['qmu_' datestr(now,'yyyymmdd_HHMMSS')];
    66 qmufile='qmu';%  qmufile can not be changed unless cielo_ice_script.sh is also changed
    67 ivar   =1;
    68 iresp  =1;
    69 imethod=1;
    70 iparams=1;
    71 runmpi =false;
    72 
    73 for i=1:size(options,1),
    74         switch options{i,1},
    75         case 'qmudir'
    76                 qmudir=options{i,2};
    77         case 'qmufile'
    78                 qmufile=options{i,2};
    79         case 'ivar'
    80                 ivar=options{i,2};
    81         case 'iresp'
    82                 iresp=options{i,2};
    83         case 'imethod'
    84                 imethod=options{i,2};
    85         case 'iparams'
    86                 iparams=options{i,2};
    87         case 'overwrite'
    88                 outoptions.overwrite=options{i,2};
    89         case 'outfiles'
    90                 outoptions.outfiles=options{i,2};
    91         case 'rstfile'
    92                 outoptions.rstfile=options{i,2};
    93         case 'rundakota'
    94                 outoptions.rundakota=options{i,2};
    95         case 'runmpi'
    96                 runmpi=options{i,2};
    97         otherwise
    98                 %nothing
    99         end
    100 end
    101 
    102 %setup final options structure
    103 outoptions.analysis_type=analysis_type;
    104 outoptions.sub_analysis_type=sub_analysis_type;
    105 outoptions.qmudir=qmudir;
    106 outoptions.qmufile=qmufile;
    107 outoptions.ivar=ivar;
    108 outoptions.iresp=iresp;
    109 outoptions.imethod=imethod;
    110 outoptions.iparams=iparams;
    111 outoptions.runmpi=runmpi;
    112 outoptions.batch=batch;
     33outoptions.qmudir=getfieldvalue(options,'qmudir','qmu');  % qmudir =['qmu_' datestr(now,'yyyymmdd_HHMMSS')];
     34outoptions.qmufile=getfieldvalue(options,'qmufile','qmu');% qmufile cannot be changed unless cielo_ice_script.sh is also changed
     35outoptions.ivar=getfieldvalue(options,'ivar',1);
     36outoptions.iresp=getfieldvalue(options,'iresp',1);
     37outoptions.imethod=getfieldvalue(options,'imethod',1);
     38outoptions.iparams=getfieldvalue(options,'iparams',1);
     39outoptions.runmpi=getfieldvalue(options,'runmpi',false);
  • issm/trunk/src/m/classes/public/solve.m

    r2330 r2398  
    1818
    1919%recover options
    20 options=optionlist2cell(varargin{:});
     20options=pairoptions(varargin{:});
    2121
    2222%add default options
Note: See TracChangeset for help on using the changeset viewer.