queso-0.53.0
GpmsaComputerModelOptions.C
Go to the documentation of this file.
1 //-----------------------------------------------------------------------bl-
2 //--------------------------------------------------------------------------
3 //
4 // QUESO - a library to support the Quantification of Uncertainty
5 // for Estimation, Simulation and Optimization
6 //
7 // Copyright (C) 2008-2015 The PECOS Development Team
8 //
9 // This library is free software; you can redistribute it and/or
10 // modify it under the terms of the Version 2.1 GNU Lesser General
11 // Public License as published by the Free Software Foundation.
12 //
13 // This library is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 // Lesser General Public License for more details.
17 //
18 // You should have received a copy of the GNU Lesser General Public
19 // License along with this library; if not, write to the Free Software
20 // Foundation, Inc. 51 Franklin Street, Fifth Floor,
21 // Boston, MA 02110-1301 USA
22 //
23 //-----------------------------------------------------------------------el-
24 
25 #include <boost/program_options.hpp>
26 
27 #include <queso/GpmsaComputerModelOptions.h>
28 #include <queso/Miscellaneous.h>
29 
30 namespace QUESO {
31 
33  :
34  m_prefix ("gcm_"),
35  m_checkAgainstPreviousSample (UQ_GCM_CHECK_AGAINST_PREVIOUS_SAMPLE_ODV ),
36  m_dataOutputFileName (UQ_GCM_DATA_OUTPUT_FILE_NAME_ODV ),
37  m_dataOutputAllowAll (UQ_GCM_DATA_OUTPUT_ALLOW_ALL_ODV ),
38  //m_dataOutputAllowedSet (),
39  m_priorSeqNumSamples (UQ_GCM_PRIOR_SEQ_NUM_SAMPLES_ODV ),
40  m_priorSeqDataOutputFileName (UQ_GCM_PRIOR_SEQ_DATA_OUTPUT_FILE_NAME_ODV ),
41  m_priorSeqDataOutputFileType (UQ_GCM_PRIOR_SEQ_DATA_OUTPUT_FILE_TYPE_ODV ),
42  m_priorSeqDataOutputAllowAll (UQ_GCM_PRIOR_SEQ_DATA_OUTPUT_ALLOW_ALL_ODV ),
43  //m_priorSeqDataOutputAllowedSet (),
44  m_nuggetValueForBtWyB (UQ_GCM_NUGGET_VALUE_FOR_BT_WY_B_ODV ),
45  m_nuggetValueForBtWyBInv (UQ_GCM_NUGGET_VALUE_FOR_BT_WY_B_INV_ODV ),
46  m_formCMatrix (UQ_GCM_FORM_C_MATRIX_ODV ),
47  m_useTildeLogicForRankDefficientC(UQ_GCM_USE_TILDE_LOGIC_FOR_RANK_DEFFICIENT_C_ODV),
48  m_predLag (UQ_GCM_PRED_LAG_ODV ),
49  m_predVUsBySamplingRVs (UQ_GCM_PRED_VUS_BY_SAMPLING_RVS_ODV ),
50  m_predVUsBySummingRVs (UQ_GCM_PRED_VUS_BY_SUMMING_RVS_ODV ),
51  m_predVUsAtKeyPoints (UQ_GCM_PRED_VUS_AT_KEY_POINTS_ODV ),
52  m_predWsBySamplingRVs (UQ_GCM_PRED_WS_BY_SAMPLING_RVS_ODV ),
53  m_predWsBySummingRVs (UQ_GCM_PRED_WS_BY_SUMMING_RVS_ODV ),
54  m_predWsAtKeyPoints (UQ_GCM_PRED_WS_AT_KEY_POINTS_ODV ),
55  m_parser(NULL),
56  m_option_help (m_prefix + "help" ),
57  m_option_checkAgainstPreviousSample (m_prefix + "checkAgainstPreviousSample" ),
58  m_option_dataOutputFileName (m_prefix + "dataOutputFileName" ),
59  m_option_dataOutputAllowAll (m_prefix + "dataOutputAllowAll" ),
60  m_option_dataOutputAllowedSet (m_prefix + "dataOutputAllowedSet" ),
61  m_option_priorSeqNumSamples (m_prefix + "priorSeqNumSamples" ),
62  m_option_priorSeqDataOutputFileName (m_prefix + "priorSeqDataOutputFileName" ),
63  m_option_priorSeqDataOutputFileType (m_prefix + "priorSeqDataOutputFileType" ),
64  m_option_priorSeqDataOutputAllowAll (m_prefix + "priorSeqDataOutputAllowAll" ),
65  m_option_priorSeqDataOutputAllowedSet (m_prefix + "priorSeqDataOutputAllowedSet" ),
66  m_option_nuggetValueForBtWyB (m_prefix + "nuggetValueForBtWyB" ),
67  m_option_nuggetValueForBtWyBInv (m_prefix + "nuggetValueForBtWyBInv" ),
68  m_option_formCMatrix (m_prefix + "formCMatrix" ),
69  m_option_useTildeLogicForRankDefficientC(m_prefix + "useTildeLogicForRankDefficientC"),
70  m_option_predLag (m_prefix + "predLag" ),
71  m_option_predVUsBySamplingRVs (m_prefix + "predVUsBySamplingRVs" ),
72  m_option_predVUsBySummingRVs (m_prefix + "predVUsBySummingRVs" ),
73  m_option_predVUsAtKeyPoints (m_prefix + "predVUsAtKeyPoints" ),
74  m_option_predWsBySamplingRVs (m_prefix + "predWsBySamplingRVs" ),
75  m_option_predWsBySummingRVs (m_prefix + "predWsBySummingRVs" ),
76  m_option_predWsAtKeyPoints (m_prefix + "predWsAtKeyPoints" )
77 {
78 }
79 
81  prefix)
82  :
83  m_prefix ((std::string)(prefix) + "gcm_"),
84  m_checkAgainstPreviousSample (UQ_GCM_CHECK_AGAINST_PREVIOUS_SAMPLE_ODV ),
85  m_dataOutputFileName (UQ_GCM_DATA_OUTPUT_FILE_NAME_ODV ),
86  m_dataOutputAllowAll (UQ_GCM_DATA_OUTPUT_ALLOW_ALL_ODV ),
87  //m_dataOutputAllowedSet (),
88  m_priorSeqNumSamples (UQ_GCM_PRIOR_SEQ_NUM_SAMPLES_ODV ),
89  m_priorSeqDataOutputFileName (UQ_GCM_PRIOR_SEQ_DATA_OUTPUT_FILE_NAME_ODV ),
90  m_priorSeqDataOutputFileType (UQ_GCM_PRIOR_SEQ_DATA_OUTPUT_FILE_TYPE_ODV ),
91  m_priorSeqDataOutputAllowAll (UQ_GCM_PRIOR_SEQ_DATA_OUTPUT_ALLOW_ALL_ODV ),
92  //m_priorSeqDataOutputAllowedSet (),
93  m_nuggetValueForBtWyB (UQ_GCM_NUGGET_VALUE_FOR_BT_WY_B_ODV ),
94  m_nuggetValueForBtWyBInv (UQ_GCM_NUGGET_VALUE_FOR_BT_WY_B_INV_ODV ),
95  m_formCMatrix (UQ_GCM_FORM_C_MATRIX_ODV ),
96  m_useTildeLogicForRankDefficientC(UQ_GCM_USE_TILDE_LOGIC_FOR_RANK_DEFFICIENT_C_ODV),
97  m_predLag (UQ_GCM_PRED_LAG_ODV ),
98  m_predVUsBySamplingRVs (UQ_GCM_PRED_VUS_BY_SAMPLING_RVS_ODV ),
99  m_predVUsBySummingRVs (UQ_GCM_PRED_VUS_BY_SUMMING_RVS_ODV ),
100  m_predVUsAtKeyPoints (UQ_GCM_PRED_VUS_AT_KEY_POINTS_ODV ),
101  m_predWsBySamplingRVs (UQ_GCM_PRED_WS_BY_SAMPLING_RVS_ODV ),
102  m_predWsBySummingRVs (UQ_GCM_PRED_WS_BY_SUMMING_RVS_ODV ),
103  m_predWsAtKeyPoints (UQ_GCM_PRED_WS_AT_KEY_POINTS_ODV ),
104  m_parser(new BoostInputOptionsParser(env->optionsInputFileName())),
105  m_option_help (m_prefix + "help" ),
106  m_option_checkAgainstPreviousSample (m_prefix + "checkAgainstPreviousSample" ),
107  m_option_dataOutputFileName (m_prefix + "dataOutputFileName" ),
108  m_option_dataOutputAllowAll (m_prefix + "dataOutputAllowAll" ),
109  m_option_dataOutputAllowedSet (m_prefix + "dataOutputAllowedSet" ),
110  m_option_priorSeqNumSamples (m_prefix + "priorSeqNumSamples" ),
111  m_option_priorSeqDataOutputFileName (m_prefix + "priorSeqDataOutputFileName" ),
112  m_option_priorSeqDataOutputFileType (m_prefix + "priorSeqDataOutputFileType" ),
113  m_option_priorSeqDataOutputAllowAll (m_prefix + "priorSeqDataOutputAllowAll" ),
114  m_option_priorSeqDataOutputAllowedSet (m_prefix + "priorSeqDataOutputAllowedSet" ),
115  m_option_nuggetValueForBtWyB (m_prefix + "nuggetValueForBtWyB" ),
116  m_option_nuggetValueForBtWyBInv (m_prefix + "nuggetValueForBtWyBInv" ),
117  m_option_formCMatrix (m_prefix + "formCMatrix" ),
118  m_option_useTildeLogicForRankDefficientC(m_prefix + "useTildeLogicForRankDefficientC"),
119  m_option_predLag (m_prefix + "predLag" ),
120  m_option_predVUsBySamplingRVs (m_prefix + "predVUsBySamplingRVs" ),
121  m_option_predVUsBySummingRVs (m_prefix + "predVUsBySummingRVs" ),
122  m_option_predVUsAtKeyPoints (m_prefix + "predVUsAtKeyPoints" ),
123  m_option_predWsBySamplingRVs (m_prefix + "predWsBySamplingRVs" ),
124  m_option_predWsBySummingRVs (m_prefix + "predWsBySummingRVs" ),
125  m_option_predWsAtKeyPoints (m_prefix + "predWsAtKeyPoints" )
126 {
127  m_parser->registerOption(m_option_help.c_str(), "produce help message for mixed inverse problem");
129  m_parser->registerOption<std::string >(m_option_dataOutputFileName, UQ_GCM_DATA_OUTPUT_FILE_NAME_ODV , "name of data output file" );
131  m_parser->registerOption<std::string >(m_option_dataOutputAllowedSet, UQ_GCM_DATA_OUTPUT_ALLOWED_SET_ODV , "subEnvs that will write to data output file" );
133  m_parser->registerOption<std::string >(m_option_priorSeqDataOutputFileName, UQ_GCM_PRIOR_SEQ_DATA_OUTPUT_FILE_NAME_ODV , "prior sequence data output filename" );
134  m_parser->registerOption<std::string >(m_option_priorSeqDataOutputFileType, UQ_GCM_PRIOR_SEQ_DATA_OUTPUT_FILE_TYPE_ODV , "prior sequence data output filetype" );
136  m_parser->registerOption<std::string >(m_option_priorSeqDataOutputAllowedSet, UQ_GCM_PRIOR_SEQ_DATA_OUTPUT_ALLOWED_SET_ODV , "subEnvs that will write to data output file" );
137  m_parser->registerOption<double >(m_option_nuggetValueForBtWyB, UQ_GCM_NUGGET_VALUE_FOR_BT_WY_B_ODV , "nugget value for Bt_Wy_W matrix" );
138  m_parser->registerOption<double >(m_option_nuggetValueForBtWyBInv, UQ_GCM_NUGGET_VALUE_FOR_BT_WY_B_INV_ODV , "nugget value for Bt_Wy_W inverse matrix" );
141  m_parser->registerOption<unsigned int>(m_option_predLag, UQ_GCM_PRED_LAG_ODV , "predLag" );
148 
150 
164  m_parser->getOption<unsigned int>(m_option_predLag, m_predLag);
171 }
172 
174 {
175 }
176 
178 {
179  this->copy(src);
180 }
181 
184 {
185  this->copy(rhs);
186  return *this;
187 }
188 
189 // void
190 // GcmOptionsValues::defineOptions()
191 // {
192 // (*m_optionsDescription).add_options()
193 // (m_option_help.c_str(), "produce help message for mixed inverse problem")
194 // (m_option_checkAgainstPreviousSample.c_str(), boost::program_options::value<bool >()->default_value(UQ_GCM_CHECK_AGAINST_PREVIOUS_SAMPLE_ODV ), "check against previous sample" )
195 // (m_option_dataOutputFileName.c_str(), boost::program_options::value<std::string >()->default_value(UQ_GCM_DATA_OUTPUT_FILE_NAME_ODV ), "name of data output file" )
196 // (m_option_dataOutputAllowAll.c_str(), boost::program_options::value<bool >()->default_value(UQ_GCM_DATA_OUTPUT_ALLOW_ALL_ODV ), "allow all or not" )
197 // (m_option_dataOutputAllowedSet.c_str(), boost::program_options::value<std::string >()->default_value(UQ_GCM_DATA_OUTPUT_ALLOWED_SET_ODV ), "subEnvs that will write to data output file" )
198 // (m_option_priorSeqNumSamples.c_str(), boost::program_options::value<unsigned int>()->default_value(UQ_GCM_PRIOR_SEQ_NUM_SAMPLES_ODV ), "prior sequence size" )
199 // (m_option_priorSeqDataOutputFileName.c_str(), boost::program_options::value<std::string >()->default_value(UQ_GCM_PRIOR_SEQ_DATA_OUTPUT_FILE_NAME_ODV ), "prior sequence data output filename" )
200 // (m_option_priorSeqDataOutputFileType.c_str(), boost::program_options::value<std::string >()->default_value(UQ_GCM_PRIOR_SEQ_DATA_OUTPUT_FILE_TYPE_ODV ), "prior sequence data output filetype" )
201 // (m_option_priorSeqDataOutputAllowAll.c_str(), boost::program_options::value<bool >()->default_value(UQ_GCM_PRIOR_SEQ_DATA_OUTPUT_ALLOW_ALL_ODV ), "allow all or not" )
202 // (m_option_priorSeqDataOutputAllowedSet.c_str(), boost::program_options::value<std::string >()->default_value(UQ_GCM_PRIOR_SEQ_DATA_OUTPUT_ALLOWED_SET_ODV ), "subEnvs that will write to data output file" )
203 // (m_option_nuggetValueForBtWyB.c_str(), boost::program_options::value<double >()->default_value(UQ_GCM_NUGGET_VALUE_FOR_BT_WY_B_ODV ), "nugget value for Bt_Wy_W matrix" )
204 // (m_option_nuggetValueForBtWyBInv.c_str(), boost::program_options::value<double >()->default_value(UQ_GCM_NUGGET_VALUE_FOR_BT_WY_B_INV_ODV ), "nugget value for Bt_Wy_W inverse matrix" )
205 // (m_option_formCMatrix.c_str(), boost::program_options::value<double >()->default_value(UQ_GCM_FORM_C_MATRIX_ODV ), "form C matrix" )
206 // (m_option_useTildeLogicForRankDefficientC.c_str(), boost::program_options::value<bool >()->default_value(UQ_GCM_USE_TILDE_LOGIC_FOR_RANK_DEFFICIENT_C_ODV), "use tilde logic for rank defficient C" )
207 // (m_option_predLag.c_str(), boost::program_options::value<unsigned int>()->default_value(UQ_GCM_PRED_LAG_ODV ), "predLag" )
208 // (m_option_predVUsBySamplingRVs.c_str(), boost::program_options::value<bool >()->default_value(UQ_GCM_PRED_VUS_BY_SAMPLING_RVS_ODV ), "predVUsBySamplingRVs" )
209 // (m_option_predVUsBySummingRVs.c_str(), boost::program_options::value<bool >()->default_value(UQ_GCM_PRED_VUS_BY_SUMMING_RVS_ODV ), "predVUsBySummingRVs" )
210 // (m_option_predVUsAtKeyPoints.c_str(), boost::program_options::value<bool >()->default_value(UQ_GCM_PRED_VUS_AT_KEY_POINTS_ODV ), "predVUsAtKeyPoints" )
211 // (m_option_predWsBySamplingRVs.c_str(), boost::program_options::value<bool >()->default_value(UQ_GCM_PRED_WS_BY_SAMPLING_RVS_ODV ), "predWsBySamplingRVs" )
212 // (m_option_predWsBySummingRVs.c_str(), boost::program_options::value<bool >()->default_value(UQ_GCM_PRED_WS_BY_SUMMING_RVS_ODV ), "predWsBySummingRVs" )
213 // (m_option_predWsAtKeyPoints.c_str(), boost::program_options::value<bool >()->default_value(UQ_GCM_PRED_WS_AT_KEY_POINTS_ODV ), "predWsAtKeyPoints" )
214 // ;
215 // }
216 //
217 // void
218 // GcmOptionsValues::getOptionValues()
219 // {
220 // if ((*m_optionsMap).count(m_option_help)) {
221 // if (m_env->subDisplayFile()) {
222 // *m_env->subDisplayFile() << (*m_optionsDescription)
223 // << std::endl;
224 // }
225 // }
226 //
227 // if ((*m_optionsMap).count(m_option_checkAgainstPreviousSample)) {
228 // m_checkAgainstPreviousSample = ((const boost::program_options::variable_value&) (*m_optionsMap)[m_option_checkAgainstPreviousSample]).as<bool>();
229 // }
230 //
231 // if ((*m_optionsMap).count(m_option_dataOutputFileName)) {
232 // m_dataOutputFileName = ((const boost::program_options::variable_value&) (*m_optionsMap)[m_option_dataOutputFileName]).as<std::string>();
233 // }
234 //
235 // if ((*m_optionsMap).count(m_option_dataOutputAllowAll)) {
236 // m_dataOutputAllowAll = ((const boost::program_options::variable_value&) (*m_optionsMap)[m_option_dataOutputAllowAll]).as<bool>();
237 // }
238 //
239 // if (m_dataOutputAllowAll) {
240 // m_dataOutputAllowedSet.insert(m_env->subId());
241 // }
242 // else if ((*m_optionsMap).count(m_option_dataOutputAllowedSet)) {
243 // m_dataOutputAllowedSet.clear();
244 // std::vector<double> tmpAllow(0,0.);
245 // std::string inputString = (*m_optionsMap)[m_option_dataOutputAllowedSet].as<std::string>();
246 // MiscReadDoublesFromString(inputString,tmpAllow);
247 //
248 // if (tmpAllow.size() > 0) {
249 // for (unsigned int i = 0; i < tmpAllow.size(); ++i) {
250 // m_dataOutputAllowedSet.insert((unsigned int) tmpAllow[i]);
251 // }
252 // }
253 // }
254 //
255 // //std::cout << "In GpmsaComputerModelOptions::getMyOptionValues(), m_option_priorSeqNumSamples = " << m_option_priorSeqNumSamples << "___" << std::endl;
256 // if ((*m_optionsMap).count(m_option_priorSeqNumSamples)) {
257 // //std::cout << "In GpmsaComputerModelOptions::getMyOptionValues(), going to read m_option_priorSeqNumSamples..." << std::endl;
258 // m_priorSeqNumSamples = ((const boost::program_options::variable_value&) (*m_optionsMap)[m_option_priorSeqNumSamples]).as<unsigned int>();
259 // //std::cout << "In GpmsaComputerModelOptions::getMyOptionValues(), just read m_option_priorSeqNumSamples = " << m_priorSeqNumSamples << std::endl;
260 // }
261 //
262 // if ((*m_optionsMap).count(m_option_priorSeqDataOutputFileName)) {
263 // m_priorSeqDataOutputFileName = ((const boost::program_options::variable_value&) (*m_optionsMap)[m_option_priorSeqDataOutputFileName]).as<std::string>();
264 // }
265 //
266 // if ((*m_optionsMap).count(m_option_priorSeqDataOutputFileType)) {
267 // m_priorSeqDataOutputFileType = ((const boost::program_options::variable_value&) (*m_optionsMap)[m_option_priorSeqDataOutputFileType]).as<std::string>();
268 // }
269 //
270 // if ((*m_optionsMap).count(m_option_priorSeqDataOutputAllowAll)) {
271 // m_priorSeqDataOutputAllowAll = ((const boost::program_options::variable_value&) (*m_optionsMap)[m_option_priorSeqDataOutputAllowAll]).as<bool>();
272 // }
273 //
274 // if (m_priorSeqDataOutputAllowAll) {
275 // m_priorSeqDataOutputAllowedSet.insert(m_env->subId());
276 // }
277 // else if ((*m_optionsMap).count(m_option_priorSeqDataOutputAllowedSet)) {
278 // m_priorSeqDataOutputAllowedSet.clear();
279 // std::vector<double> tmpAllow(0,0.);
280 // std::string inputString = (*m_optionsMap)[m_option_priorSeqDataOutputAllowedSet].as<std::string>();
281 // MiscReadDoublesFromString(inputString,tmpAllow);
282 //
283 // if (tmpAllow.size() > 0) {
284 // for (unsigned int i = 0; i < tmpAllow.size(); ++i) {
285 // m_priorSeqDataOutputAllowedSet.insert((unsigned int) tmpAllow[i]);
286 // }
287 // }
288 // }
289 //
290 // if ((*m_optionsMap).count(m_option_nuggetValueForBtWyB)) {
291 // m_nuggetValueForBtWyB = ((const boost::program_options::variable_value&) (*m_optionsMap)[m_option_nuggetValueForBtWyB]).as<double>();
292 // }
293 //
294 // if ((*m_optionsMap).count(m_option_nuggetValueForBtWyBInv)) {
295 // m_nuggetValueForBtWyBInv = ((const boost::program_options::variable_value&) (*m_optionsMap)[m_option_nuggetValueForBtWyBInv]).as<double>();
296 // }
297 //
298 // if ((*m_optionsMap).count(m_option_formCMatrix)) {
299 // m_formCMatrix = ((const boost::program_options::variable_value&) (*m_optionsMap)[m_option_formCMatrix]).as<double>();
300 // }
301 //
302 // if ((*m_optionsMap).count(m_option_useTildeLogicForRankDefficientC)) {
303 // m_useTildeLogicForRankDefficientC = ((const boost::program_options::variable_value&) (*m_optionsMap)[m_option_useTildeLogicForRankDefficientC]).as<bool>();
304 // }
305 //
306 // if ((*m_optionsMap).count(m_option_predLag)) {
307 // m_predLag = ((const boost::program_options::variable_value&) (*m_optionsMap)[m_option_predLag]).as<unsigned int>();
308 // }
309 //
310 // if ((*m_optionsMap).count(m_option_predVUsBySamplingRVs)) {
311 // m_predVUsBySamplingRVs = ((const boost::program_options::variable_value&) (*m_optionsMap)[m_option_predVUsBySamplingRVs]).as<bool>();
312 // }
313 //
314 // if ((*m_optionsMap).count(m_option_predVUsBySummingRVs)) {
315 // m_predVUsBySummingRVs = ((const boost::program_options::variable_value&) (*m_optionsMap)[m_option_predVUsBySummingRVs]).as<bool>();
316 // }
317 //
318 // if ((*m_optionsMap).count(m_option_predVUsAtKeyPoints)) {
319 // m_predVUsAtKeyPoints = ((const boost::program_options::variable_value&) (*m_optionsMap)[m_option_predVUsAtKeyPoints]).as<bool>();
320 // }
321 //
322 // if ((*m_optionsMap).count(m_option_predWsBySamplingRVs)) {
323 // m_predWsBySamplingRVs = ((const boost::program_options::variable_value&) (*m_optionsMap)[m_option_predWsBySamplingRVs]).as<bool>();
324 // }
325 //
326 // if ((*m_optionsMap).count(m_option_predWsBySummingRVs)) {
327 // m_predWsBySummingRVs = ((const boost::program_options::variable_value&) (*m_optionsMap)[m_option_predWsBySummingRVs]).as<bool>();
328 // }
329 //
330 // if ((*m_optionsMap).count(m_option_predWsAtKeyPoints)) {
331 // m_predWsAtKeyPoints = ((const boost::program_options::variable_value&) (*m_optionsMap)[m_option_predWsAtKeyPoints]).as<bool>();
332 // }
333 // }
334 
335 void
337 {
351  m_predLag = src.m_predLag;
358 
359  return;
360 }
361 
363  const BaseEnvironment& env,
364  const char* prefix)
365  :
366  m_ov (),
367  m_prefix ((std::string)(prefix) + "gcm_"),
368  m_env (env),
369  m_optionsDesc (new boost::program_options::options_description("Mixed Inverse Problem options")),
370  m_option_help (m_prefix + "help" ),
371  m_option_checkAgainstPreviousSample (m_prefix + "checkAgainstPreviousSample" ),
372  m_option_dataOutputFileName (m_prefix + "dataOutputFileName" ),
373  m_option_dataOutputAllowAll (m_prefix + "dataOutputAllowAll" ),
374  m_option_dataOutputAllowedSet (m_prefix + "dataOutputAllowedSet" ),
375  m_option_priorSeqNumSamples (m_prefix + "priorSeqNumSamples" ),
376  m_option_priorSeqDataOutputFileName (m_prefix + "priorSeqDataOutputFileName" ),
377  m_option_priorSeqDataOutputFileType (m_prefix + "priorSeqDataOutputFileType" ),
378  m_option_priorSeqDataOutputAllowAll (m_prefix + "priorSeqDataOutputAllowAll" ),
379  m_option_priorSeqDataOutputAllowedSet (m_prefix + "priorSeqDataOutputAllowedSet" ),
380  m_option_nuggetValueForBtWyB (m_prefix + "nuggetValueForBtWyB" ),
381  m_option_nuggetValueForBtWyBInv (m_prefix + "nuggetValueForBtWyBInv" ),
382  m_option_formCMatrix (m_prefix + "formCMatrix" ),
383  m_option_useTildeLogicForRankDefficientC(m_prefix + "useTildeLogicForRankDefficientC"),
384  m_option_predLag (m_prefix + "predLag" ),
385  m_option_predVUsBySamplingRVs (m_prefix + "predVUsBySamplingRVs" ),
386  m_option_predVUsBySummingRVs (m_prefix + "predVUsBySummingRVs" ),
387  m_option_predVUsAtKeyPoints (m_prefix + "predVUsAtKeyPoints" ),
388  m_option_predWsBySamplingRVs (m_prefix + "predWsBySamplingRVs" ),
389  m_option_predWsBySummingRVs (m_prefix + "predWsBySummingRVs" ),
390  m_option_predWsAtKeyPoints (m_prefix + "predWsAtKeyPoints" )
391 {
393  queso_require_not_equal_to_msg(m_env.optionsInputFileName(), "", "this constructor is incompatible with the abscense of an options input file");
394 }
395 
397  const BaseEnvironment& env,
398  const char* prefix,
399  const GcmOptionsValues& alternativeOptionsValues)
400  :
401  m_ov (alternativeOptionsValues),
402  m_prefix ((std::string)(prefix) + "gcm_"),
403  m_env (env),
404  m_optionsDesc (NULL),
405  m_option_help (m_prefix + "help" ),
406  m_option_checkAgainstPreviousSample (m_prefix + "checkAgainstPreviousSample" ),
407  m_option_dataOutputFileName (m_prefix + "dataOutputFileName" ),
408  m_option_dataOutputAllowAll (m_prefix + "dataOutputAllowAll" ),
409  m_option_dataOutputAllowedSet (m_prefix + "dataOutputAllowedSet" ),
410  m_option_priorSeqNumSamples (m_prefix + "priorSeqNumSamples" ),
411  m_option_priorSeqDataOutputFileName (m_prefix + "priorSeqDataOutputFileName" ),
412  m_option_priorSeqDataOutputFileType (m_prefix + "priorSeqDataOutputFileType" ),
413  m_option_priorSeqDataOutputAllowAll (m_prefix + "priorSeqDataOutputAllowAll" ),
414  m_option_priorSeqDataOutputAllowedSet (m_prefix + "priorSeqDataOutputAllowedSet" ),
415  m_option_nuggetValueForBtWyB (m_prefix + "nuggetValueForBtWyB" ),
416  m_option_nuggetValueForBtWyBInv (m_prefix + "nuggetValueForBtWyBInv" ),
417  m_option_formCMatrix (m_prefix + "formCMatrix" ),
418  m_option_useTildeLogicForRankDefficientC(m_prefix + "useTildeLogicForRankDefficientC"),
419  m_option_predLag (m_prefix + "predLag" ),
420  m_option_predVUsBySamplingRVs (m_prefix + "predVUsBySamplingRVs" ),
421  m_option_predVUsBySummingRVs (m_prefix + "predVUsBySummingRVs" ),
422  m_option_predVUsAtKeyPoints (m_prefix + "predVUsAtKeyPoints" ),
423  m_option_predWsBySamplingRVs (m_prefix + "predWsBySamplingRVs" ),
424  m_option_predWsBySummingRVs (m_prefix + "predWsBySummingRVs" ),
425  m_option_predWsAtKeyPoints (m_prefix + "predWsAtKeyPoints" )
426 {
428  queso_require_equal_to_msg(m_env.optionsInputFileName(), "", "this constructor is incompatible with the existence of an options input file");
429 
430  if (m_env.subDisplayFile() != NULL) {
431  *m_env.subDisplayFile() << "In GpmsaComputerModelOptions::constructor(2)"
432  << ": after setting values of options with prefix '" << m_prefix
433  << "', state of object is:"
434  << "\n" << *this
435  << std::endl;
436  }
437 }
438 
440 {
442 
443  if (m_optionsDesc) delete m_optionsDesc;
444 }
445 
446 void
448 {
450  queso_require_msg(m_optionsDesc, "m_optionsDesc variable is NULL");
451 
454  //std::cout << "scan 000\n"
455  // << std::endl;
457  //std::cout << "scan 001\n"
458  // << std::endl;
459 
460  if (m_env.subDisplayFile() != NULL) {
461  *m_env.subDisplayFile() << "In GpmsaComputerModelOptions::scanOptionsValues()"
462  << ": after reading values of options with prefix '" << m_prefix
463  << "', state of object is:"
464  << "\n" << *this
465  << std::endl;
466  }
467 
468  return;
469 }
470 
471 void
472 GpmsaComputerModelOptions::defineMyOptions(boost::program_options::options_description& optionsDesc) const
473 {
475 
476  optionsDesc.add_options()
477  (m_option_help.c_str(), "produce help message for mixed inverse problem")
478  (m_option_checkAgainstPreviousSample.c_str(), boost::program_options::value<bool >()->default_value(UQ_GCM_CHECK_AGAINST_PREVIOUS_SAMPLE_ODV ), "check against previous sample" )
479  (m_option_dataOutputFileName.c_str(), boost::program_options::value<std::string >()->default_value(UQ_GCM_DATA_OUTPUT_FILE_NAME_ODV ), "name of data output file" )
480  (m_option_dataOutputAllowAll.c_str(), boost::program_options::value<bool >()->default_value(UQ_GCM_DATA_OUTPUT_ALLOW_ALL_ODV ), "allow all or not" )
481  (m_option_dataOutputAllowedSet.c_str(), boost::program_options::value<std::string >()->default_value(UQ_GCM_DATA_OUTPUT_ALLOWED_SET_ODV ), "subEnvs that will write to data output file" )
482  (m_option_priorSeqNumSamples.c_str(), boost::program_options::value<unsigned int>()->default_value(UQ_GCM_PRIOR_SEQ_NUM_SAMPLES_ODV ), "prior sequence size" )
483  (m_option_priorSeqDataOutputFileName.c_str(), boost::program_options::value<std::string >()->default_value(UQ_GCM_PRIOR_SEQ_DATA_OUTPUT_FILE_NAME_ODV ), "prior sequence data output filename" )
484  (m_option_priorSeqDataOutputFileType.c_str(), boost::program_options::value<std::string >()->default_value(UQ_GCM_PRIOR_SEQ_DATA_OUTPUT_FILE_TYPE_ODV ), "prior sequence data output filetype" )
485  (m_option_priorSeqDataOutputAllowAll.c_str(), boost::program_options::value<bool >()->default_value(UQ_GCM_PRIOR_SEQ_DATA_OUTPUT_ALLOW_ALL_ODV ), "allow all or not" )
486  (m_option_priorSeqDataOutputAllowedSet.c_str(), boost::program_options::value<std::string >()->default_value(UQ_GCM_PRIOR_SEQ_DATA_OUTPUT_ALLOWED_SET_ODV ), "subEnvs that will write to data output file" )
487  (m_option_nuggetValueForBtWyB.c_str(), boost::program_options::value<double >()->default_value(UQ_GCM_NUGGET_VALUE_FOR_BT_WY_B_ODV ), "nugget value for Bt_Wy_W matrix" )
488  (m_option_nuggetValueForBtWyBInv.c_str(), boost::program_options::value<double >()->default_value(UQ_GCM_NUGGET_VALUE_FOR_BT_WY_B_INV_ODV ), "nugget value for Bt_Wy_W inverse matrix" )
489  (m_option_formCMatrix.c_str(), boost::program_options::value<double >()->default_value(UQ_GCM_FORM_C_MATRIX_ODV ), "form C matrix" )
490  (m_option_useTildeLogicForRankDefficientC.c_str(), boost::program_options::value<bool >()->default_value(UQ_GCM_USE_TILDE_LOGIC_FOR_RANK_DEFFICIENT_C_ODV), "use tilde logic for rank defficient C" )
491  (m_option_predLag.c_str(), boost::program_options::value<unsigned int>()->default_value(UQ_GCM_PRED_LAG_ODV ), "predLag" )
492  (m_option_predVUsBySamplingRVs.c_str(), boost::program_options::value<bool >()->default_value(UQ_GCM_PRED_VUS_BY_SAMPLING_RVS_ODV ), "predVUsBySamplingRVs" )
493  (m_option_predVUsBySummingRVs.c_str(), boost::program_options::value<bool >()->default_value(UQ_GCM_PRED_VUS_BY_SUMMING_RVS_ODV ), "predVUsBySummingRVs" )
494  (m_option_predVUsAtKeyPoints.c_str(), boost::program_options::value<bool >()->default_value(UQ_GCM_PRED_VUS_AT_KEY_POINTS_ODV ), "predVUsAtKeyPoints" )
495  (m_option_predWsBySamplingRVs.c_str(), boost::program_options::value<bool >()->default_value(UQ_GCM_PRED_WS_BY_SAMPLING_RVS_ODV ), "predWsBySamplingRVs" )
496  (m_option_predWsBySummingRVs.c_str(), boost::program_options::value<bool >()->default_value(UQ_GCM_PRED_WS_BY_SUMMING_RVS_ODV ), "predWsBySummingRVs" )
497  (m_option_predWsAtKeyPoints.c_str(), boost::program_options::value<bool >()->default_value(UQ_GCM_PRED_WS_AT_KEY_POINTS_ODV ), "predWsAtKeyPoints" )
498  ;
499 
500  return;
501 }
502 
503 void
504 GpmsaComputerModelOptions::getMyOptionValues(boost::program_options::options_description& optionsDesc)
505 {
507 
508  if (m_env.allOptionsMap().count(m_option_help)) {
509  if (m_env.subDisplayFile()) {
510  *m_env.subDisplayFile() << optionsDesc
511  << std::endl;
512  }
513  }
514 
516  m_ov.m_checkAgainstPreviousSample = ((const boost::program_options::variable_value&) m_env.allOptionsMap()[m_option_checkAgainstPreviousSample]).as<bool>();
517  }
518 
520  m_ov.m_dataOutputFileName = ((const boost::program_options::variable_value&) m_env.allOptionsMap()[m_option_dataOutputFileName]).as<std::string>();
521  }
522 
524  m_ov.m_dataOutputAllowAll = ((const boost::program_options::variable_value&) m_env.allOptionsMap()[m_option_dataOutputAllowAll]).as<bool>();
525  }
526 
529  }
532  std::vector<double> tmpAllow(0,0.);
533  std::string inputString = m_env.allOptionsMap()[m_option_dataOutputAllowedSet].as<std::string>();
534  MiscReadDoublesFromString(inputString,tmpAllow);
535 
536  if (tmpAllow.size() > 0) {
537  for (unsigned int i = 0; i < tmpAllow.size(); ++i) {
538  m_ov.m_dataOutputAllowedSet.insert((unsigned int) tmpAllow[i]);
539  }
540  }
541  }
542 
543  //std::cout << "In GpmsaComputerModelOptions::getMyOptionValues(), m_option_priorSeqNumSamples = " << m_option_priorSeqNumSamples << "___" << std::endl;
545  //std::cout << "In GpmsaComputerModelOptions::getMyOptionValues(), going to read m_option_priorSeqNumSamples..." << std::endl;
546  m_ov.m_priorSeqNumSamples = ((const boost::program_options::variable_value&) m_env.allOptionsMap()[m_option_priorSeqNumSamples]).as<unsigned int>();
547  //std::cout << "In GpmsaComputerModelOptions::getMyOptionValues(), just read m_option_priorSeqNumSamples = " << m_ov.m_priorSeqNumSamples << std::endl;
548  }
549 
551  m_ov.m_priorSeqDataOutputFileName = ((const boost::program_options::variable_value&) m_env.allOptionsMap()[m_option_priorSeqDataOutputFileName]).as<std::string>();
552  }
553 
555  m_ov.m_priorSeqDataOutputFileType = ((const boost::program_options::variable_value&) m_env.allOptionsMap()[m_option_priorSeqDataOutputFileType]).as<std::string>();
556  }
557 
559  m_ov.m_priorSeqDataOutputAllowAll = ((const boost::program_options::variable_value&) m_env.allOptionsMap()[m_option_priorSeqDataOutputAllowAll]).as<bool>();
560  }
561 
564  }
567  std::vector<double> tmpAllow(0,0.);
568  std::string inputString = m_env.allOptionsMap()[m_option_priorSeqDataOutputAllowedSet].as<std::string>();
569  MiscReadDoublesFromString(inputString,tmpAllow);
570 
571  if (tmpAllow.size() > 0) {
572  for (unsigned int i = 0; i < tmpAllow.size(); ++i) {
573  m_ov.m_priorSeqDataOutputAllowedSet.insert((unsigned int) tmpAllow[i]);
574  }
575  }
576  }
577 
579  m_ov.m_nuggetValueForBtWyB = ((const boost::program_options::variable_value&) m_env.allOptionsMap()[m_option_nuggetValueForBtWyB]).as<double>();
580  }
581 
583  m_ov.m_nuggetValueForBtWyBInv = ((const boost::program_options::variable_value&) m_env.allOptionsMap()[m_option_nuggetValueForBtWyBInv]).as<double>();
584  }
585 
587  m_ov.m_formCMatrix = ((const boost::program_options::variable_value&) m_env.allOptionsMap()[m_option_formCMatrix]).as<double>();
588  }
589 
591  m_ov.m_useTildeLogicForRankDefficientC = ((const boost::program_options::variable_value&) m_env.allOptionsMap()[m_option_useTildeLogicForRankDefficientC]).as<bool>();
592  }
593 
594  if (m_env.allOptionsMap().count(m_option_predLag)) {
595  m_ov.m_predLag = ((const boost::program_options::variable_value&) m_env.allOptionsMap()[m_option_predLag]).as<unsigned int>();
596  }
597 
599  m_ov.m_predVUsBySamplingRVs = ((const boost::program_options::variable_value&) m_env.allOptionsMap()[m_option_predVUsBySamplingRVs]).as<bool>();
600  }
601 
603  m_ov.m_predVUsBySummingRVs = ((const boost::program_options::variable_value&) m_env.allOptionsMap()[m_option_predVUsBySummingRVs]).as<bool>();
604  }
605 
607  m_ov.m_predVUsAtKeyPoints = ((const boost::program_options::variable_value&) m_env.allOptionsMap()[m_option_predVUsAtKeyPoints]).as<bool>();
608  }
609 
611  m_ov.m_predWsBySamplingRVs = ((const boost::program_options::variable_value&) m_env.allOptionsMap()[m_option_predWsBySamplingRVs]).as<bool>();
612  }
613 
615  m_ov.m_predWsBySummingRVs = ((const boost::program_options::variable_value&) m_env.allOptionsMap()[m_option_predWsBySummingRVs]).as<bool>();
616  }
617 
619  m_ov.m_predWsAtKeyPoints = ((const boost::program_options::variable_value&) m_env.allOptionsMap()[m_option_predWsAtKeyPoints]).as<bool>();
620  }
621 
622  return;
623 }
624 
625 void
626 GpmsaComputerModelOptions::print(std::ostream& os) const
627 {
629 
633  << "\n" << m_option_dataOutputAllowedSet << " = ";
634  for (std::set<unsigned int>::iterator setIt = m_ov.m_dataOutputAllowedSet.begin(); setIt != m_ov.m_dataOutputAllowedSet.end(); ++setIt) {
635  os << *setIt << " ";
636  }
637  os << "\n" << m_option_priorSeqNumSamples << " = " << m_ov.m_priorSeqNumSamples
641  << "\n" << m_option_priorSeqDataOutputAllowedSet << " = ";
642  for (std::set<unsigned int>::iterator setIt = m_ov.m_priorSeqDataOutputAllowedSet.begin(); setIt != m_ov.m_priorSeqDataOutputAllowedSet.end(); ++setIt) {
643  os << *setIt << " ";
644  }
647  << "\n" << m_option_formCMatrix << " = " << m_ov.m_formCMatrix
649  << "\n" << m_option_predLag << " = " << m_ov.m_predLag
656  << std::endl;
657 
658  return;
659 }
660 
661 std::ostream& operator<<(std::ostream& os, const GpmsaComputerModelOptions& obj)
662 {
664 
665  obj.print(os);
666 
667  return os;
668 }
669 
670 } // End namespace QUESO
GpmsaComputerModelOptions(const BaseEnvironment &env, const char *prefix)
#define UQ_GCM_PRIOR_SEQ_DATA_OUTPUT_ALLOW_ALL_ODV
#define UQ_GCM_NUGGET_VALUE_FOR_BT_WY_B_INV_ODV
#define UQ_GCM_PRED_VUS_BY_SAMPLING_RVS_ODV
#define UQ_GCM_PRED_VUS_BY_SUMMING_RVS_ODV
void scanInputFileForMyOptions(const boost::program_options::options_description &optionsDesc) const
This method scans the input file provided by the user to QUESO.
Definition: Environment.C:345
#define UQ_GCM_USE_TILDE_LOGIC_FOR_RANK_DEFFICIENT_C_ODV
#define UQ_GCM_DATA_OUTPUT_ALLOWED_SET_ODV
boost::program_options::options_description * m_optionsDesc
#define UQ_GCM_PRED_LAG_ODV
#define UQ_GCM_FORM_C_MATRIX_ODV
#define queso_require_not_equal_to_msg(expr1, expr2, msg)
Definition: asserts.h:86
#define UQ_GCM_PRIOR_SEQ_DATA_OUTPUT_FILE_NAME_ODV
void copy(const GcmOptionsValues &src)
#define UQ_GCM_PRED_WS_BY_SAMPLING_RVS_ODV
std::ostream & operator<<(std::ostream &os, const BaseEnvironment &obj)
#define UQ_GCM_PRIOR_SEQ_NUM_SAMPLES_ODV
std::set< unsigned int > m_dataOutputAllowedSet
boost::program_options::variables_map & allOptionsMap() const
Definition: Environment.C:336
#define UQ_GCM_PRED_VUS_AT_KEY_POINTS_ODV
#define UQ_GCM_DATA_OUTPUT_FILE_NAME_ODV
#define UQ_GCM_PRIOR_SEQ_DATA_OUTPUT_FILE_TYPE_ODV
#define queso_require_equal_to_msg(expr1, expr2, msg)
Definition: asserts.h:85
#define UQ_GCM_NUGGET_VALUE_FOR_BT_WY_B_ODV
#define UQ_GCM_PRIOR_SEQ_DATA_OUTPUT_ALLOWED_SET_ODV
GcmOptionsValues & operator=(const GcmOptionsValues &rhs)
std::string optionsInputFileName() const
Access to the attribute m_optionsInputFileName, which stores the name of the input file passed by the...
Definition: Environment.C:307
void scanInputFile()
This is the method that parses the input file.
#define queso_require_msg(asserted, msg)
Definition: asserts.h:69
void getMyOptionValues(boost::program_options::options_description &optionsDesc)
std::ofstream * subDisplayFile() const
Access function for m_subDisplayFile (displays file on stream).
Definition: Environment.C:274
This (virtual) class sets up the environment underlying the use of the QUESO library by an executable...
Definition: Environment.h:193
#define UQ_GCM_DATA_OUTPUT_ALLOW_ALL_ODV
#define UQ_GCM_CHECK_AGAINST_PREVIOUS_SAMPLE_ODV
unsigned int subId() const
Access function to the number of each sub-environment Id: m_subId.
Definition: Environment.C:295
void registerOption(std::string name, T defaultValue, std::string description)
Call this to register an option with the parser.
std::string m_option_useTildeLogicForRankDefficientC
std::set< unsigned int > m_priorSeqDataOutputAllowedSet
#define UQ_GCM_PRED_WS_BY_SUMMING_RVS_ODV
void MiscReadDoublesFromString(const std::string &inputString, std::vector< double > &outputDoubles)
Definition: Miscellaneous.C:40
#define queso_deprecated()
Definition: Defines.h:120
void defineMyOptions(boost::program_options::options_description &optionsDesc) const
void print(std::ostream &os) const
#define UQ_GCM_PRED_WS_AT_KEY_POINTS_ODV
BoostInputOptionsParser * m_parser
void getOption(std::string &name, T &value)
Get option name from the parser and set value to the parsed value.

Generated on Thu Jun 11 2015 13:52:32 for queso-0.53.0 by  doxygen 1.8.5