Changeset 2398
- Timestamp:
- 10/08/09 10:49:39 (15 years ago)
- 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),1 function bool=exist(pairoptions,field), 2 2 %EXIST - check if the option exist 3 3 % 4 4 % Usage: 5 % bool=exist(pairoptions, optioname)5 % bool=exist(pairoptions,field) 6 6 7 7 %some argument checking: … … 10 10 error('exist error message: bad usage'); 11 11 end 12 13 if ~ischar(optioname), 14 error('exist error message: optioname should be a string'); 12 if ~ischar(field), 13 error('exist error message: field should be a string'); 15 14 end 16 15 17 16 %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 17 bool=ismember(field,pairoptions.list(:,1)); -
issm/trunk/src/m/classes/public/mesh/meshyams.m
r2396 r2398 24 24 options=pairoptions(varargin{:}); 25 25 options=deleteduplicates(options,1); 26 if ~exist(options,'domainoutline'),27 error('meshyams error message: no ''domainoutline'' was provided');28 end29 if ~exist(options,'velocities'),30 error('meshyams error message: no ''velocities'' was provided');31 end32 26 33 27 %recover some fields 34 28 disp('MeshYams Options:') 35 domainoutline=getfieldvalue (options,'domainoutline');29 domainoutline=getfieldvalueerr(options,'domainoutline'); 36 30 disp(sprintf(' %-15s: ''%s''','DomainOutline',domainoutline)); 37 31 groundeddomain=getfieldvalue(options,'groundeddomain','N/A'); 38 32 disp(sprintf(' %-15s: ''%s''','GroundedDomain',groundeddomain)); 39 velocities=getfieldvalue (options,'velocities');33 velocities=getfieldvalueerr(options,'velocities'); 40 34 disp(sprintf(' %-15s: ''%s''','Velocities',velocities)); 41 35 resolution=getfieldvalue(options,'resolution',5000); -
issm/trunk/src/m/classes/public/process_solve_options.m
r2298 r2398 5 5 % options=process_solve_options(options) 6 6 % 7 % See also: SOLVE ,RECOVER_SOLVE_OPTIONS7 % See also: SOLVE 8 8 9 9 %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 10 analysis_type=getfieldvalueerr(options,'analysis_type'); 21 11 22 12 %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 13 sub_analysis_type=getfieldvalue(options,'sub_analysis_type','none'); 34 14 35 15 %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 16 outoptions.batch=getfieldvalue(options,'batch','no'); 47 17 48 18 %check solution type is supported … … 51 21 else 52 22 %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']); 54 24 end 55 25 if ~ismemberi(sub_analysis_type,{'steady','transient','none','horiz','adjoint','gradient','inverse','vert',''}), … … 57 27 else 58 28 %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']); 60 30 end 61 31 62 32 % 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; 33 outoptions.qmudir=getfieldvalue(options,'qmudir','qmu'); % qmudir =['qmu_' datestr(now,'yyyymmdd_HHMMSS')]; 34 outoptions.qmufile=getfieldvalue(options,'qmufile','qmu');% qmufile cannot be changed unless cielo_ice_script.sh is also changed 35 outoptions.ivar=getfieldvalue(options,'ivar',1); 36 outoptions.iresp=getfieldvalue(options,'iresp',1); 37 outoptions.imethod=getfieldvalue(options,'imethod',1); 38 outoptions.iparams=getfieldvalue(options,'iparams',1); 39 outoptions.runmpi=getfieldvalue(options,'runmpi',false); -
issm/trunk/src/m/classes/public/solve.m
r2330 r2398 18 18 19 19 %recover options 20 options= optionlist2cell(varargin{:});20 options=pairoptions(varargin{:}); 21 21 22 22 %add default options
Note:
See TracChangeset
for help on using the changeset viewer.