queso-0.53.0
GcmSimulationInfo.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 <queso/GcmSimulationInfo.h>
26 #include <queso/GslVector.h>
27 #include <queso/GslMatrix.h>
28 
29 namespace QUESO {
30 
31 template <class S_V,class S_M,class P_V,class P_M,class Q_V,class Q_M>
33  const GpmsaComputerModelOptions& gcmOptionsObj,
34  bool allOutputsAreScalar,
35  const SimulationStorage<S_V,S_M,P_V,P_M,Q_V,Q_M>& simulationStorage,
36  const SimulationModel <S_V,S_M,P_V,P_M,Q_V,Q_M>& simulationModel)
37  :
38  m_env (simulationStorage.env()),
39  m_simulationStorage (simulationStorage),
40  m_simulationModel (simulationModel),
41  m_paper_p_x (simulationStorage.scenarioSpace().dimLocal()),
42  m_paper_xs_asterisks_standard (simulationModel.xs_asterisks_standard()),
43  m_paper_ts_asterisks_standard (simulationModel.ts_asterisks_standard()),
44  m_paper_p_t (simulationStorage.parameterSpace().dimLocal()),
45  m_paper_m (simulationStorage.numSimulations()),
46  m_paper_n_eta (simulationStorage.outputSpace().dimLocal()),
47  m_paper_p_eta (simulationModel.numBasis()),
48  m_paper_m_space (m_env, "paper_m_", m_paper_m, NULL),
49  m_1lambdaEtaDim (1), // '1' in paper
50  m_1lambdaEtaSpace (m_env, "1lambdaEta_", m_1lambdaEtaDim, NULL),
51  m_1lambdaEtaMins (m_env,m_1lambdaEtaSpace.map(),0.),
52  m_1lambdaEtaMaxs (m_env,m_1lambdaEtaSpace.map(),+INFINITY),
53  m_1lambdaEtaDomain ("1lambdaEta_",m_1lambdaEtaSpace,m_1lambdaEtaMins,m_1lambdaEtaMaxs),
54  m_1lambdaEtaGammaAVec (m_env,m_1lambdaEtaSpace.map(),simulationModel.optionsObj().m_ov.m_a_eta),
55  m_1lambdaEtaGammaBVec (m_env,m_1lambdaEtaSpace.map(),1./simulationModel.optionsObj().m_ov.m_b_eta), // Yes, 1./...
56  m_1lambdaEtaPriorRv ("1lambdaEta_",m_1lambdaEtaDomain,m_1lambdaEtaGammaAVec,m_1lambdaEtaGammaBVec),
57  m_like_previous1 (m_1lambdaEtaSpace.zeroVector()),
58  m_tmp_1lambdaEtaVec (m_1lambdaEtaSpace.zeroVector()),
59  m_2lambdaWDim (m_paper_p_eta), // 'p_eta' in paper
60  m_2lambdaWSpace (m_env, "2lambdaW_", m_2lambdaWDim, NULL),
61  m_2lambdaWMins (m_env,m_2lambdaWSpace.map(),0.),
62  m_2lambdaWMaxs (m_env,m_2lambdaWSpace.map(),+INFINITY),
63  m_2lambdaWDomain ("2lambdaW_",m_2lambdaWSpace,m_2lambdaWMins,m_2lambdaWMaxs),
64  m_2lambdaWGammaAVec (m_env,m_2lambdaWSpace.map(),simulationModel.optionsObj().m_ov.m_a_w),
65  m_2lambdaWGammaBVec (m_env,m_2lambdaWSpace.map(),1./simulationModel.optionsObj().m_ov.m_b_w), // Yes, 1./...
66  m_2lambdaWPriorRv ("2lambdaW_",m_2lambdaWDomain,m_2lambdaWGammaAVec,m_2lambdaWGammaBVec),
67  m_like_previous2 (m_2lambdaWSpace.zeroVector()),
68  m_tmp_2lambdaWVec (m_2lambdaWSpace.zeroVector()),
69  m_3rhoWDim (m_paper_p_eta * (m_paper_p_x + m_paper_p_t)), // 'p_eta * (p_x + p_t)' in paper
70  m_3rhoWSpace (m_env, "3rhoW_", m_3rhoWDim, NULL),
71  m_3rhoWMins (m_env,m_3rhoWSpace.map(),0.),
72  m_3rhoWMaxs (m_env,m_3rhoWSpace.map(),1.),
73  m_3rhoWDomain ("3rhoW_",m_3rhoWSpace,m_3rhoWMins,m_3rhoWMaxs),
74  m_3rhoWBetaAVec (m_env,m_3rhoWSpace.map(),simulationModel.optionsObj().m_ov.m_a_rho_w),
75  m_3rhoWBetaBVec (m_env,m_3rhoWSpace.map(),simulationModel.optionsObj().m_ov.m_b_rho_w),
76  m_3rhoWPriorRv ("3rhoW_",m_3rhoWDomain,m_3rhoWBetaAVec,m_3rhoWBetaBVec),
77  m_like_previous3 (m_3rhoWSpace.zeroVector()),
78  m_tmp_3rhoWVec (m_3rhoWSpace.zeroVector()),
79  m_4lambdaSDim (m_paper_p_eta), // 'p_eta' in paper
80  m_4lambdaSSpace (m_env, "4lambdaS_", m_4lambdaSDim, NULL),
81  m_4lambdaSMins (m_env,m_4lambdaSSpace.map(),0.),
82  m_4lambdaSMaxs (m_env,m_4lambdaSSpace.map(),+INFINITY),
83  m_4lambdaSDomain ("4lambdaS_",m_4lambdaSSpace,m_4lambdaSMins,m_4lambdaSMaxs),
84  m_4lambdaSGammaAVec (m_env,m_4lambdaSSpace.map(),simulationModel.optionsObj().m_ov.m_a_s),
85  m_4lambdaSGammaBVec (m_env,m_4lambdaSSpace.map(),1./simulationModel.optionsObj().m_ov.m_b_s), // Yes, 1./...
86  m_4lambdaSPriorRv ("4lambdaS_",m_4lambdaSDomain,m_4lambdaSGammaAVec,m_4lambdaSGammaBVec),
87  m_like_previous4 (m_4lambdaSSpace.zeroVector()),
88  m_tmp_4lambdaSVec (m_4lambdaSSpace.zeroVector()),
89  m_eta_size (m_paper_m*m_paper_n_eta),
90  m_eta_space (m_env, "eta_", m_eta_size, NULL),
91  m_w_size (m_paper_m*m_paper_p_eta),
92  m_w_space (m_env, "w_", m_w_size, NULL),
93  m_unique_w_space (m_env, "unique_w_", m_paper_p_eta, NULL),
94  m_Zvec_hat_w (m_w_space.zeroVector()),
95  m_rho_w_space (m_env, "rho_w_", m_paper_p_x+m_paper_p_t, NULL),
96  m_tmp_rho_w_vec (m_rho_w_space.zeroVector()),
97  m_Rmat_w_is (m_paper_p_eta, (Q_M*) NULL), // to be deleted on destructor
98  m_Smat_w_is (m_paper_p_eta, (Q_M*) NULL), // to be deleted on destructor
99  m_Smat_w (m_w_space.zeroVector()),
100  m_Smat_w_hat (m_w_space.zeroVector()),
101  m_Rmat_w_hat_w_asterisk_is (m_paper_p_eta, (Q_M*) NULL), // to be deleted on destructor
102  m_Smat_w_hat_w_asterisk_is (m_paper_p_eta, (Q_M*) NULL), // to be deleted on destructor
103  m_Smat_w_hat_w_asterisk (m_env,m_w_space.map(), m_paper_p_eta),
104  m_Smat_w_hat_w_asterisk_t (m_env,m_unique_w_space.map(),m_w_size),
105  m_Smat_w_asterisk_w_asterisk (m_unique_w_space.zeroVector()),
106  m_Kmat (simulationModel.Kmat()),
107  m_Kmat_eta (simulationModel.Kmat_eta()),
108  m_Kmat_rank (std::min(m_Kmat.numRowsGlobal(),m_Kmat.numCols())), // Might be smaller
109  m_Kt_K (NULL), // to be deleted on destructor
110  m_Kt_K_inv (NULL), // to be deleted on destructor
111  m_a_eta_modifier (0.),
112  m_b_eta_modifier (0.),
113  m_predW_counter (MiscUintDebugMessage(0,NULL)),
114  m_predW_summingRVs_unique_w_meanVec (m_unique_w_space.zeroVector()),
115  m_predW_summingRVs_mean_of_unique_w_covMatrices (m_unique_w_space.zeroVector()),
116  m_predW_summingRVs_covMatrix_of_unique_w_means (m_unique_w_space.zeroVector()),
117  m_predW_summingRVs_corrMatrix_of_unique_w_means (m_unique_w_space.zeroVector())
118 {
119  if ((m_env.subDisplayFile()) && (m_env.displayVerbosity() >= 2)) {
120  *m_env.subDisplayFile() << "Entering GcmSimulationInfo<S_V,S_M,P_V,P_M,Q_V,Q_M>::constructor()"
121  << ": key-debug"
122  << ", some entities just created (not yet populated)"
123  << ", m_Zvec_hat_w.sizeLocal() = " << m_Zvec_hat_w.sizeLocal()
124  << ", m_Smat_w.numRowsLocal() = " << m_Smat_w.numRowsLocal()
125  << ", m_Smat_w.numCols() = " << m_Smat_w.numCols()
126  << std::endl;
127  }
128 
129  std::set<unsigned int> tmpSet;
130  tmpSet.insert(m_env.subId());
131 
132  //********************************************************************************
133  // Print information
134  //********************************************************************************
135  unsigned int m_Kmat_rank = m_Kmat.rank(0.,1.e-8 ); // todo: should be an option
136  unsigned int kRank14 = m_Kmat.rank(0.,1.e-14);
137  if ((m_env.subDisplayFile()) && (m_env.displayVerbosity() >= 3)) {
138  *m_env.subDisplayFile() << "In GcmSimulationInfo<S_V,S_M,P_V,P_M,Q_V,Q_M>::constructor()"
139  << ": m_Kmat.numRowsLocal() = " << m_Kmat.numRowsLocal()
140  << ", m_Kmat.numCols() = " << m_Kmat.numCols()
141  << ", m_Kmat.rank(0.,1.e-8) = " << m_Kmat_rank
142  << ", m_Kmat.rank(0.,1.e-14) = " << kRank14
143  << std::endl;
144  }
145  if (gcmOptionsObj.m_ov.m_dataOutputAllowedSet.find(m_env.subId()) != gcmOptionsObj.m_ov.m_dataOutputAllowedSet.end()) {
146  m_Kmat.subWriteContents("K",
147  "mat_K",
148  "m",
149  tmpSet);
150  }
151 
152  Q_V etaVec_transformed(simulationModel.etaVec_transformed("Gp.h.004"));
153  if ((m_env.subDisplayFile()) && (m_env.displayVerbosity() >= 3)) {
154  *m_env.subDisplayFile() << "In GcmSimulationInfo<S_V,S_M,P_V,P_M,Q_V,Q_M>::constructor()"
155  << ": m_Zvec_hat_w.sizeLocal() = " << m_Zvec_hat_w.sizeLocal()
156  << ", etaVec_transformed.sizeLocal() = " << etaVec_transformed.sizeLocal()
157  << std::endl;
158  }
159 
160  if (allOutputsAreScalar) {
161  m_Zvec_hat_w = etaVec_transformed;
162  }
163  else {
164  //********************************************************************************
165  // Form 'K^T' matrix
166  //********************************************************************************
167  Q_M Kt(m_env,m_w_space.map(),m_eta_size);
168  Kt.fillWithTranspose(0,0,m_Kmat,true,true);
169  if ((m_env.subDisplayFile()) && (m_env.displayVerbosity() >= 3)) {
170  *m_env.subDisplayFile() << "In GcmSimulationInfo<S_V,S_M,P_V,P_M,Q_V,Q_M>::constructor()"
171  << ": Kt.numRowsLocal() = " << Kt.numRowsLocal()
172  << ", Kt.numCols() = " << Kt.numCols()
173  << std::endl;
174  }
175 
176  //********************************************************************************
177  // Compute 'K^T K' matrix, and its inverse
178  //********************************************************************************
179  m_Kt_K = new Q_M(m_w_space.zeroVector()); // to be deleted on destructor
180  if ((m_env.subDisplayFile()) && (m_env.displayVerbosity() >= 2)) {
181  *m_env.subDisplayFile() << "In GcmSimulationInfo<S_V,S_M,P_V,P_M,Q_V,Q_M>::constructor()"
182  << ": key-debug"
183  << ", m_Kt_K just created (not yet populated)"
184  << ", numRowsLocal() = " << m_Kt_K->numRowsLocal()
185  << ", numCols() = " << m_Kt_K->numCols()
186  << std::endl;
187  }
188  m_Kt_K_inv = new Q_M(m_w_space.zeroVector()); // to be deleted on destructor
189  if ((m_env.subDisplayFile()) && (m_env.displayVerbosity() >= 2)) {
190  *m_env.subDisplayFile() << "In GcmSimulationInfo<S_V,S_M,P_V,P_M,Q_V,Q_M>::constructor()"
191  << ": key-debug"
192  << ", m_Kt_K_inv just created (not yet populated)"
193  << ", numRowsLocal() = " << m_Kt_K_inv->numRowsLocal()
194  << ", numCols() = " << m_Kt_K_inv->numCols()
195  << std::endl;
196  }
197 
198  *m_Kt_K = Kt * m_Kmat;
199  if ((m_env.subDisplayFile()) && (m_env.displayVerbosity() >= 3)) {
200  m_Kt_K->setPrintHorizontally(false);
201  *m_env.subDisplayFile() << "In GcmSimulationInfo<S_V,S_M,P_V,P_M,Q_V,Q_M>::constructor()"
202  << ": finished computing 'm_Kt_K'"
203  //<< "\n m_Kt_K =\n" << m_Kt_K
204  << std::endl;
205  }
206  if (gcmOptionsObj.m_ov.m_dataOutputAllowedSet.find(m_env.subId()) != gcmOptionsObj.m_ov.m_dataOutputAllowedSet.end()) {
207  m_Kt_K->subWriteContents("Kt_K",
208  "mat_Kt_K",
209  "m",
210  tmpSet);
211  }
212 
213  if (m_env.displayVerbosity() >= 4) {
214  double ktKLnDeterminant = m_Kt_K->lnDeterminant();
215  unsigned int ktKRank = m_Kt_K->rank(0.,1.e-8 ); // todo: should be an option
216  unsigned int ktKRank14 = m_Kt_K->rank(0.,1.e-14);
217  if ((m_env.subDisplayFile()) && (m_env.displayVerbosity() >= 3)) {
218  *m_env.subDisplayFile() << "In GcmSimulationInfo<S_V,S_M,P_V,P_M,Q_V,Q_M>::constructor()"
219  << ": m_Kt_K->numRowsLocal() = " << m_Kt_K->numRowsLocal()
220  << ", m_Kt_K->numCols() = " << m_Kt_K->numCols()
221  << ", m_Kt_K->lnDeterminant() = " << ktKLnDeterminant
222  << ", m_Kt_K->rank(0.,1.e-8) = " << ktKRank
223  << ", m_Kt_K->rank(0.,1.e-14) = " << ktKRank14
224  << std::endl;
225  }
226  }
227 
228  *m_Kt_K_inv = m_Kt_K->inverse(); // inversion savings
229 
230  if ((m_env.subDisplayFile()) && (m_env.displayVerbosity() >= 3)) {
231  m_Kt_K_inv->setPrintHorizontally(false);
232  *m_env.subDisplayFile() << "In GcmSimulationInfo<S_V,S_M,P_V,P_M,Q_V,Q_M>::constructor()"
233  << ": finished computing 'm_Kt_K_inv'"
234  //<< "\n m_Kt_K_inv =\n" << m_Kt_K_inv
235  << std::endl;
236  }
237  if (gcmOptionsObj.m_ov.m_dataOutputAllowedSet.find(m_env.subId()) != gcmOptionsObj.m_ov.m_dataOutputAllowedSet.end()) {
238  m_Kt_K_inv->subWriteContents("Kt_K_inv",
239  "mat_Kt_K_inv",
240  "m",
241  tmpSet);
242  }
243 
244  if (m_env.displayVerbosity() >= 4) {
245  double ktKInvLnDeterminant = m_Kt_K_inv->lnDeterminant();
246  unsigned int ktKInvRank = m_Kt_K_inv->rank(0.,1.e-8 ); // todo: should be an option
247  unsigned int ktKInvRank14 = m_Kt_K_inv->rank(0.,1.e-14);
248  if (m_env.subDisplayFile()) {
249  *m_env.subDisplayFile() << "In GcmSimulationInfo<S_V,S_M,P_V,P_M,Q_V,Q_M>::constructor()"
250  << ": m_Kt_K_inv->numRowsLocal() = " << m_Kt_K_inv->numRowsLocal()
251  << ", m_Kt_K_inv->numCols() = " << m_Kt_K_inv->numCols()
252  << ", m_Kt_K_inv->lnDeterminant() = " << ktKInvLnDeterminant
253  << ", m_Kt_K_inv->rank(0.,1.e-8) = " << ktKInvRank
254  << ", m_Kt_K_inv->rank(0.,1.e-14) = " << ktKInvRank14
255  << std::endl;
256  }
257  }
258 
259  //********************************************************************************
260  // Compute exponent modifiers
261  //********************************************************************************
262  m_a_eta_modifier = ((double) m_paper_m) * ((double) (m_paper_n_eta - m_paper_p_eta)) / 2.;
263  if ((m_env.subDisplayFile()) && (m_env.displayVerbosity() >= 3)) {
264  *m_env.subDisplayFile() << "In GcmSimulationInfo<S_V,S_M,P_V,P_M,Q_V,Q_M>::constructor()"
265  << ": m_a_eta_modifier = " << m_a_eta_modifier
266  << std::endl;
267  }
268 
269  if ((m_env.subDisplayFile()) && (m_env.displayVerbosity() >= 3)) {
270  *m_env.subDisplayFile() << "In GcmSimulationInfo<S_V,S_M,P_V,P_M,Q_V,Q_M>::constructor()"
271  << ": m_Kt_K_inv->numRowsLocal() = " << m_Kt_K_inv->numRowsLocal()
272  << ", m_Kt_K_inv->numCols() = " << m_Kt_K_inv->numCols()
273  << ", Kt.numRowsLocal() = " << Kt.numRowsLocal()
274  << ", Kt.numCols() = " << Kt.numCols()
275  << std::endl;
276  }
277 
278  m_Zvec_hat_w = (*m_Kt_K_inv) * (Kt * etaVec_transformed);
279  if (gcmOptionsObj.m_ov.m_dataOutputAllowedSet.find(m_env.subId()) != gcmOptionsObj.m_ov.m_dataOutputAllowedSet.end()) {
280  m_Zvec_hat_w.subWriteContents("Zvec_hat_w",
281  "vec_Zvec_hat_w",
282  "m",
283  tmpSet);
284  }
285  Q_V tmpVec1(etaVec_transformed - (m_Kmat * m_Zvec_hat_w));
286  m_b_eta_modifier = scalarProduct(etaVec_transformed,tmpVec1) / 2.;
287 
288  if ((m_env.subDisplayFile()) && (m_env.displayVerbosity() >= 3)) {
289  *m_env.subDisplayFile() << "In GcmSimulationInfo<S_V,S_M,P_V,P_M,Q_V,Q_M>::constructor()"
290  << ": m_b_eta_modifier = " << m_b_eta_modifier
291  << std::endl;
292  }
293  } // if (allOutputsAreScalar)
294 
295  //********************************************************************************
296  // Instantiate Smat spaces
297  //********************************************************************************
298  unsigned int sumDims = 0;
299  for (unsigned int i = 0; i < m_Smat_w_is.size(); ++i) {
300  m_Rmat_w_is[i] = new Q_M(m_paper_m_space.zeroVector()); // to be deleted on destructor
301  m_Smat_w_is[i] = new Q_M(m_paper_m_space.zeroVector()); // to be deleted on destructor
302  sumDims += m_paper_m_space.dimLocal();
303  }
304  if ((m_env.subDisplayFile()) && (m_env.displayVerbosity() >= 3)) {
305  *m_env.subDisplayFile() << "In GcmSimulationInfo<S_V,S_M,P_V,P_M,Q_V,Q_M>::constructor()"
306  << ": finished instantiating m_Smat_w_is"
307  << std::endl;
308  }
309  queso_require_equal_to_msg(sumDims, m_w_size, "'sumDims' and 'm_w_size' should be equal");
310 
311  unsigned int sumNumRows = 0;
312  unsigned int sumNumCols = 0;
313  for (unsigned int i = 0; i < m_Smat_w_hat_w_asterisk_is.size(); ++i) {
314  m_Rmat_w_hat_w_asterisk_is[i] = new Q_M(m_env, m_paper_m_space.map(), (unsigned int) 1); // to be deleted on destructor; Yes, only 1 column
315  m_Smat_w_hat_w_asterisk_is[i] = new Q_M(m_env, m_paper_m_space.map(), (unsigned int) 1); // to be deleted on destructor; Yes, only 1 column
316  sumNumRows += m_paper_m_space.dimLocal();
317  sumNumCols += 1; // m_paper_p_eta;
318  }
319  if ((m_env.subDisplayFile()) && (m_env.displayVerbosity() >= 3)) {
320  *m_env.subDisplayFile() << "In GcmSimulationInfo<S_V,S_M,P_V,P_M,Q_V,Q_M>::constructor()"
321  << ": finished instantiating the m_Smat_w_hat_w_asterisk_i matrices"
322  << std::endl;
323  }
324  queso_require_equal_to_msg(sumNumRows, m_w_size, "'sumNumRows' and 'm_w_size' should be equal");
325  queso_require_equal_to_msg(sumNumCols, (m_paper_p_eta), "'sumNumCols' and 'm_paper_p_eta*m_paper_p_eta' should be equal");
326 
327  //********************************************************************************
328  // Display information
329  //********************************************************************************
330  if ((m_env.subDisplayFile()) && (m_env.displayVerbosity() >= 2)) {
331  *m_env.subDisplayFile() << "KEY In GcmSimulationInfo<S_V,S_M,P_V,P_M,Q_V,Q_M>::constructor()"
332  << "\n KEY m_paper_p_x = " << m_paper_p_x
333  << "\n KEY m_paper_p_t = " << m_paper_p_t
334  << "\n KEY m_paper_m = " << m_paper_m
335  << "\n KEY m_paper_n_eta = " << m_paper_n_eta
336  << "\n KEY m_paper_p_eta = " << m_paper_p_eta
337  << "\n KEY m_1lambdaEtaDim = " << m_1lambdaEtaDim
338  << ", m_1lambdaEtaGammaAVec = " << m_1lambdaEtaGammaAVec
339  << ", m_1lambdaEtaGammaBVec = " << m_1lambdaEtaGammaBVec
340  << "\n KEY m_2lambdaWDim = " << m_2lambdaWDim
341  << ", m_2lambdaWGammaAVec = " << m_2lambdaWGammaAVec
342  << ", m_2lambdaWGammaBVec = " << m_2lambdaWGammaBVec
343  << "\n KEY m_3rhoWDim = " << m_3rhoWDim
344  << ", m_3rhoWBetaAVec = " << m_3rhoWBetaAVec
345  << ", m_3rhoWBetaBVec = " << m_3rhoWBetaBVec
346  << "\n KEY m_4lambdaSDim = " << m_4lambdaSDim
347  << ", m_4lambdaSGammaAVec = " << m_4lambdaSGammaAVec
348  << ", m_4lambdaSGammaBVec = " << m_4lambdaSGammaBVec
349  << "\n KEY full 'eta' vector size = " << m_paper_m * m_paper_n_eta // = simulationModel.etaVec_transformed("Gp.h.001").sizeLocal()
350  << std::endl;
351  }
352 
353  //********************************************************************************
354  // Make checks
355  //********************************************************************************
356  queso_require_equal_to_msg(simulationModel.etaVec_transformed("Gp.h.002").sizeLocal(), m_eta_size, "incompatible calculations for 'eta' vector size");
357 
358  queso_require_equal_to_msg(m_paper_p_x, simulationStorage.scenarioSpace().dimLocal(), "'m_paper_p_x' and 'simulationStorage.scenarioSpace().dimLocal()' should be equal");
359 
360  if ((m_env.subDisplayFile()) && (m_env.displayVerbosity() >= 2)) {
361  *m_env.subDisplayFile() << "Leaving GcmSimulationInfo<S_V,S_M,P_V,P_M,Q_V,Q_M>::constructor()"
362  << std::endl;
363  }
364 }
365 
366 template <class S_V,class S_M,class P_V,class P_M,class Q_V,class Q_M>
368 {
369  for (unsigned int i = 0; i < m_Smat_w_hat_w_asterisk_is.size(); ++i) {
370  delete m_Smat_w_hat_w_asterisk_is[i]; // to be deleted on destructor
371  m_Smat_w_hat_w_asterisk_is[i] = NULL;
372  delete m_Rmat_w_hat_w_asterisk_is[i]; // to be deleted on destructor
373  m_Rmat_w_hat_w_asterisk_is[i] = NULL;
374  }
375 
376  for (unsigned int i = 0; i < m_Smat_w_is.size(); ++i) {
377  delete m_Smat_w_is[i]; // to be deleted on destructor
378  m_Smat_w_is[i] = NULL;
379  delete m_Rmat_w_is[i]; // to be deleted on destructor
380  m_Rmat_w_is[i] = NULL;
381  }
382 
383  delete m_Kt_K_inv; // to be deleted on destructor
384  delete m_Kt_K; // to be deleted on destructor
385 }
386 
387 } // End namespace QUESO
388 
unsigned int displayVerbosity() const
Definition: Environment.C:396
unsigned int dimLocal() const
Definition: VectorSpace.C:170
const Map & map() const
Map.
Definition: VectorSpace.C:157
std::vector< Q_M * > m_Rmat_w_is
std::vector< Q_M * > m_Smat_w_hat_w_asterisk_is
const VectorSpace< S_V, S_M > & scenarioSpace() const
std::set< unsigned int > m_dataOutputAllowedSet
const V & zeroVector() const
Returns a vector filled with zeros.
Definition: VectorSpace.C:189
#define queso_require_equal_to_msg(expr1, expr2, msg)
Definition: asserts.h:85
GcmSimulationInfo(const GpmsaComputerModelOptions &gcmOptionsObj, bool allOutputsAreScalar, const SimulationStorage< S_V, S_M, P_V, P_M, Q_V, Q_M > &simulationStorage, const SimulationModel< S_V, S_M, P_V, P_M, Q_V, Q_M > &simulationModel)
double scalarProduct(const GslVector &x, const GslVector &y)
Definition: GslVector.C:1150
std::ofstream * subDisplayFile() const
Access function for m_subDisplayFile (displays file on stream).
Definition: Environment.C:274
unsigned int MiscUintDebugMessage(unsigned int value, const char *message)
std::vector< Q_M * > m_Smat_w_is
VectorSpace< P_V, P_M > m_paper_m_space
VectorSpace< Q_V, Q_M > m_w_space
unsigned int subId() const
Access function to the number of each sub-environment Id: m_subId.
Definition: Environment.C:295
std::vector< Q_M * > m_Rmat_w_hat_w_asterisk_is
const Q_V & etaVec_transformed(const std::string &debugString) const
const BaseEnvironment & m_env

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