source: issm/trunk/src/m/qmu/process_qmu_options.m@ 13975

Last change on this file since 13975 was 13975, checked in by Mathieu Morlighem, 12 years ago

merged trunk-jpl and trunk for revision 13974

File size: 2.3 KB
Line 
1function outoptions=process_qmu_options(options)
2%PROCESS_QMU_OPTIONS - set up default options for qmu phase
3%
4% Usage:
5% options=process_qmu_options(options)
6%
7% See also: QMU,RECOVER_QMU_OPTIONS
8
9%analysis_type: check on this option, error out otherwise
10found=0;
11for i=1:size(options,1),
12 if strcmpi(options{i,1},'analysis_type'),
13 analysis_type=options{i,2};
14 found=1;
15 end
16end
17if ~found,
18 error('recover_qmu_options error message: no ''analysis_type'' was provided');
19end
20
21%package: is there one? default to ''JPL''
22found=0;
23for i=1:size(options,1),
24 if strcmpi(options{i,1},'package'),
25 package=options{i,2};
26 found=1;
27 end
28end
29if ~found,
30 disp('recover_qmu_options info message: no ''package'' was provided, defaulting to ''JPL''');
31 options(end+1,:)={'package' 'JPL'};
32 package='JPL';
33end
34
35if ~ischar(package),
36 error(['process_qmu_options error message: package ' package ' not supported yet']);
37end
38
39%check solution type is supported
40if ~(strcmpi(analysis_type,'control') | ...
41 strcmpi(analysis_type,'diagnostic') | ...
42 strcmpi(analysis_type,'prognostic') | ...
43 strcmpi(analysis_type,'thermal') | ...
44 strcmpi(analysis_type,'parameters') | ...
45 strcmpi(analysis_type,'transient') ),
46 error(['process_qmu_options error message: analysis_type ' analysis_type ' not supported yet!']);
47end
48
49% process qmu arguments
50
51%first, the defaults
52qmudir ='qmu';% qmudir =['qmu_' datestr(now,'yyyymmdd_HHMMSS')];
53qmufile='qmu';
54ivar =1;
55iresp =1;
56imethod=1;
57iparams=1;
58runmpi =false;
59
60for i=1:size(options,1),
61 switch options{i,1},
62 case 'qmudir'
63 qmudir=options{i,2};
64 case 'qmufile'
65 qmufile=options{i,2};
66 case 'ivar'
67 ivar=options{i,2};
68 case 'iresp'
69 iresp=options{i,2};
70 case 'imethod'
71 imethod=options{i,2};
72 case 'iparams'
73 iparams=options{i,2};
74 case 'overwrite'
75 outoptions.overwrite=options{i,2};
76 case 'keep'
77 outoptions.keep=options{i,2};
78 case 'outfiles'
79 outoptions.outfiles=options{i,2};
80 case 'rstfile'
81 outoptions.rstfile=options{i,2};
82 case 'rundakota'
83 outoptions.rundakota=options{i,2};
84 case 'runmpi'
85 runmpi=options{i,2};
86 otherwise
87 %nothing
88 end
89end
90
91%setup final options structure
92outoptions.analysis_type=analysis_type;
93outoptions.package=package;
94outoptions.qmudir=qmudir;
95outoptions.qmufile=qmufile;
96outoptions.ivar=ivar;
97outoptions.iresp=iresp;
98outoptions.imethod=imethod;
99outoptions.iparams=iparams;
100outoptions.runmpi=runmpi;
Note: See TracBrowser for help on using the repository browser.