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

Last change on this file since 6568 was 6568, checked in by jschierm, 14 years ago

Added keep option for qmudir (part 1 of 2).

File size: 3.2 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%sub_analysis_type: check on it, not mandatory
40found=0;
41for i=1:size(options,1),
42 if strcmpi(options{i,1},'sub_analysis_type'),
43 sub_analysis_type=options{i,2};
44 found=1;
45 end
46end
47if ~found
48 if ~strcmpi(analysis_type,'thermal'),
49 sub_analysis_type='none';
50 else
51 disp('recover_qmu_options info message: no ''sub_analysis_type'' was provided, defaulting to ''steady''');
52 sub_analysis_type='steady';
53 end
54end
55
56%check solution type is supported
57if ~(strcmpi(analysis_type,'control') | ...
58 strcmpi(analysis_type,'diagnostic') | ...
59 strcmpi(analysis_type,'prognostic') | ...
60 strcmpi(analysis_type,'thermal') | ...
61 strcmpi(analysis_type,'parameters') | ...
62 strcmpi(analysis_type,'mesh') | ...
63 strcmpi(analysis_type,'mesh2grid') | ...
64 strcmpi(analysis_type,'transient') ),
65 error(['process_qmu_options error message: analysis_type ' analysis_type ' not supported yet!']);
66end
67if ~(strcmpi(sub_analysis_type,'none') | ...
68 strcmpi(sub_analysis_type,'steady') | ...
69 strcmpi(sub_analysis_type,'horiz') | ...
70 strcmpi(sub_analysis_type,'vert') | ...
71 strcmpi(sub_analysis_type,'') | ...
72 strcmpi(sub_analysis_type,'transient') ),
73 error(['process_qmu_options error message: sub_analysis_type ' sub_analysis_type ' not supported yet!']);
74end
75
76
77
78% process qmu arguments
79
80%first, the defaults
81qmudir ='qmu';% qmudir =['qmu_' datestr(now,'yyyymmdd_HHMMSS')];
82qmufile='qmu';
83ivar =1;
84iresp =1;
85imethod=1;
86iparams=1;
87runmpi =false;
88
89for i=1:size(options,1),
90 switch options{i,1},
91 case 'qmudir'
92 qmudir=options{i,2};
93 case 'qmufile'
94 qmufile=options{i,2};
95 case 'ivar'
96 ivar=options{i,2};
97 case 'iresp'
98 iresp=options{i,2};
99 case 'imethod'
100 imethod=options{i,2};
101 case 'iparams'
102 iparams=options{i,2};
103 case 'overwrite'
104 outoptions.overwrite=options{i,2};
105 case 'keep'
106 outoptions.keep=options{i,2};
107 case 'outfiles'
108 outoptions.outfiles=options{i,2};
109 case 'rstfile'
110 outoptions.rstfile=options{i,2};
111 case 'rundakota'
112 outoptions.rundakota=options{i,2};
113 case 'runmpi'
114 runmpi=options{i,2};
115 otherwise
116 %nothing
117 end
118end
119
120%setup final options structure
121outoptions.analysis_type=analysis_type;
122outoptions.package=package;
123outoptions.sub_analysis_type=sub_analysis_type;
124outoptions.qmudir=qmudir;
125outoptions.qmufile=qmufile;
126outoptions.ivar=ivar;
127outoptions.iresp=iresp;
128outoptions.imethod=imethod;
129outoptions.iparams=iparams;
130outoptions.runmpi=runmpi;
131
Note: See TracBrowser for help on using the repository browser.