queso-0.51.1
Private Member Functions | Private Attributes | List of all members
QUESO::StatisticalForwardProblem< P_V, P_M, Q_V, Q_M > Class Template Reference

This templated class represents a Statistical Forward Problem. More...

#include <StatisticalForwardProblem.h>

Collaboration diagram for QUESO::StatisticalForwardProblem< P_V, P_M, Q_V, Q_M >:
Collaboration graph
[legend]

Public Member Functions

Constructor/Destructor methods
 StatisticalForwardProblem (const char *prefix, const SfpOptionsValues *alternativeOptionsValues, const BaseVectorRV< P_V, P_M > &paramRv, const BaseVectorFunction< P_V, P_M, Q_V, Q_M > &qoiFunction, GenericVectorRV< Q_V, Q_M > &qoiRv)
 Constructor. More...
 
 ~StatisticalForwardProblem ()
 Destructor. More...
 
Statistical methods
bool computeSolutionFlag () const
 Whether or not compute the solution. More...
 
void solveWithMonteCarlo (const McOptionsValues *alternativeOptionsValues)
 Solves the problem through Monte Carlo algorithm. More...
 
const GenericVectorRV< Q_V, Q_M > & qoiRv () const
 Returns the QoI RV; access to private attribute m_qoiRv. More...
 
const BaseVectorSequence< Q_V,
Q_M > & 
getParamChain () const
 Returns the parameter chain; access to private attribute m_paramChain. More...
 

Private Member Functions

void commonConstructor ()
 TODO: Common constructor. More...
 

Private Attributes

const BaseEnvironmentm_env
 
const BaseVectorRV< P_V, P_M > & m_paramRv
 
const BaseVectorFunction< P_V,
P_M, Q_V, Q_M > & 
m_qoiFunction
 
GenericVectorRV< Q_V, Q_M > & m_qoiRv
 
BaseVectorSequence< Q_V, Q_M > * m_paramChain
 
BaseVectorSequence< Q_V, Q_M > * m_qoiChain
 
MonteCarloSG< P_V, P_M, Q_V,
Q_M > * 
m_mcSeqGenerator
 
BaseVectorRealizer< Q_V, Q_M > * m_solutionRealizer
 
BaseJointPdf< Q_V, Q_M > * m_solutionPdf
 
SfpOptionsValues m_alternativeOptionsValues
 
StatisticalForwardProblemOptionsm_optionsObj
 

I/O methods

void print (std::ostream &os) const
 TODO: Prints the sequence. More...
 
std::ostream & operator<< (std::ostream &os, const StatisticalForwardProblem< P_V, P_M, Q_V, Q_M > &obj)
 

Detailed Description

template<class P_V, class P_M, class Q_V, class Q_M>
class QUESO::StatisticalForwardProblem< P_V, P_M, Q_V, Q_M >

This templated class represents a Statistical Forward Problem.

This templated class represents a statistical forward problem. It is templated on the types 'P_V' and 'Q_V' of vectors and types 'P_M' and 'Q_M' of matrices, where 'P_' stands for 'parameter' and 'Q_' stands for 'quantities of interest'. Conceptually, a statistical forward problem has two input entities and one output entity.
The input entities of a statistical forward problem are:

  1. the input (parameter) RV, an instance of class 'BaseVectorRV<P_V,P_M>', and
  2. the QoI function, an instance of class 'BaseVectorFunction<P_V,P_M,Q_V,Q_M>'.

Let $ q() $ denote the mathematical QoI function and $ x $ denote a vector of parameters. The QoI function object stores the routine that computes $ q(x) $ and whatever data necessary by such routine. See file 'libs/basic/inc/VectorFunction.h' for more details.
The output entity of a statistical forward problem is:

  1. the QoI RV, another instance of class 'BaseVectorRV<P_V,P_M>'.

The QoI RV stores the solution according to the Bayesian approach. The solution of a SPF is computed by calling 'solveWithMonteCarlo()'. More operations, with different methods, will be available in the future.
The solution process might demand extra objects to be passed through the chosen solution operation interface. This distinction is important: this class separates 'what the problem is' from 'how the problem is solved'. Upon return from a solution operation, the QoI RV is available through the operation 'qoiRv()'. Such QoI RV is able to provide:

  1. a vector realizer through the operation 'qoiRv().realizer()', which returns an instance of the class 'BaseVectorRealizer<Q_V,Q_M>'.

Definition at line 77 of file StatisticalForwardProblem.h.

Constructor & Destructor Documentation

template<class P_V , class P_M , class Q_V , class Q_M >
QUESO::StatisticalForwardProblem< P_V, P_M, Q_V, Q_M >::StatisticalForwardProblem ( const char *  prefix,
const SfpOptionsValues alternativeOptionsValues,
const BaseVectorRV< P_V, P_M > &  paramRv,
const BaseVectorFunction< P_V, P_M, Q_V, Q_M > &  qoiFunction,
GenericVectorRV< Q_V, Q_M > &  qoiRv 
)

Constructor.

Requirements: 1) the image set of the vector random variable 'paramRv' and the domain set of the QoI function 'qoiFunction' should belong to vector spaces of equal dimensions and 2) the image set of the QoI function 'qoiFunction' and the image set of the vector random variable 'qoiRv' should belong to vector spaces of equal dimensions. If the requirements are satisfied, the constructor then reads input options that begin with the string '<prefix>fp_'. Options reading is handled by class 'StatisticalForwardProblemOptions'. If no options input file is provided, the construction assigns alternativeOptionsValues to the options of the SFP.

Parameters
prefixThe prefix
alternativeOptionsValuesOptions (if no input file)
paramRvThe input RV
qoiFunctionThe QoI function
qoiRvThe QoI RV

Definition at line 34 of file StatisticalForwardProblem.C.

References UQ_FATAL_TEST_MACRO.

40  :
41  m_env (paramRv.env()),
42  m_paramRv (paramRv),
43  m_qoiFunction (qoiFunction),
44  m_qoiRv (qoiRv),
45  m_paramChain (NULL),
46  m_qoiChain (NULL),
47  m_mcSeqGenerator (NULL),
48  m_solutionRealizer (NULL),
49 #ifdef UQ_ALSO_COMPUTE_MDFS_WITHOUT_KDE
50  m_subMdfGrids (NULL),
51  m_subMdfValues (NULL),
52 #endif
53 #ifdef QUESO_COMPUTES_EXTRA_POST_PROCESSING_STATISTICS
54  m_subSolutionMdf (NULL),
55  m_subCdfGrids (NULL),
56  m_subCdfValues (NULL),
57  m_subSolutionCdf (NULL),
58  m_unifiedCdfGrids (NULL),
59  m_unifiedCdfValues (NULL),
60  m_unifiedSolutionCdf (NULL),
61 #endif
62  m_solutionPdf (NULL),
64  m_optionsObj (NULL)
65 {
66  if (m_env.subDisplayFile()) {
67  *m_env.subDisplayFile() << "Entering StatisticalForwardProblem<P_V,P_M,Q_V,Q_M>::constructor()"
68  << ": prefix = " << prefix
69  << ", alternativeOptionsValues = " << alternativeOptionsValues
70  << ", m_env.optionsInputFileName() = " << m_env.optionsInputFileName()
71  << std::endl;
72  }
73 
74  if (alternativeOptionsValues) m_alternativeOptionsValues = *alternativeOptionsValues;
75  if (m_env.optionsInputFileName() == "") {
76  m_optionsObj = new StatisticalForwardProblemOptions(m_env,prefix,m_alternativeOptionsValues);
77  }
78  else {
79  m_optionsObj = new StatisticalForwardProblemOptions(m_env,prefix);
81  }
82 
83  UQ_FATAL_TEST_MACRO(paramRv.imageSet().vectorSpace().dimLocal() != qoiFunction.domainSet().vectorSpace().dimLocal(),
84  m_env.worldRank(),
85  "StatisticalForwardProblem<P_V,P_M>::constructor()",
86  "'paramRv' and 'qoiFunction' are related to vector spaces of different dimensions");
87 
88  UQ_FATAL_TEST_MACRO(qoiFunction.imageSet().vectorSpace().dimLocal() != qoiRv.imageSet().vectorSpace().dimLocal(),
89  m_env.worldRank(),
90  "StatisticalForwardProblem<P_V,P_M>::constructor()",
91  "'qoiFunction' and 'qoiRv' are related to vector spaces of different dimensions");
92 
93  if (m_env.subDisplayFile()) {
94  *m_env.subDisplayFile() << "Leaving StatisticalForwardProblem<P_V,P_M,Q_V,Q_M>::constructor()"
95  << ": prefix = " << m_optionsObj->m_prefix
96  << std::endl;
97  }
98 }
unsigned int dimLocal() const
Definition: VectorSpace.C:199
void scanOptionsValues()
It scans the option values from the options input file.
StatisticalForwardProblemOptions * m_optionsObj
int worldRank() const
Returns the process world rank.
Definition: Environment.C:235
std::ofstream * subDisplayFile() const
Access function for m_subDisplayFile (displays file on stream).
Definition: Environment.C:305
const BaseVectorFunction< P_V, P_M, Q_V, Q_M > & m_qoiFunction
BaseVectorSequence< Q_V, Q_M > * m_paramChain
std::string optionsInputFileName() const
Access to the attribute m_optionsInputFileName, which stores the name of the input file passed by the...
Definition: Environment.C:341
GenericVectorRV< Q_V, Q_M > & m_qoiRv
const BaseEnvironment & env() const
QUESO environment; access to private attribute m_env.
Definition: VectorRV.C:72
BaseJointPdf< Q_V, Q_M > * m_solutionPdf
MonteCarloSG< P_V, P_M, Q_V, Q_M > * m_mcSeqGenerator
const VectorSet< V, M > & imageSet() const
Image set of the vector RV; access to private attribute m_imageSet.
Definition: VectorRV.C:79
BaseVectorRealizer< Q_V, Q_M > * m_solutionRealizer
const BaseVectorRV< P_V, P_M > & m_paramRv
virtual const VectorSpace< V, M > & vectorSpace() const =0
Vector space to which this set belongs to. See template specialization.
#define UQ_FATAL_TEST_MACRO(test, givenRank, where, what)
Definition: Defines.h:223
BaseVectorSequence< Q_V, Q_M > * m_qoiChain
template<class P_V , class P_M , class Q_V , class Q_M >
QUESO::StatisticalForwardProblem< P_V, P_M, Q_V, Q_M >::~StatisticalForwardProblem ( )

Destructor.

Definition at line 102 of file StatisticalForwardProblem.C.

103 {
104  if (m_solutionPdf ) delete m_solutionPdf;
105 
106 #ifdef QUESO_COMPUTES_EXTRA_POST_PROCESSING_STATISTICS
107  if (m_unifiedSolutionCdf) delete m_unifiedSolutionCdf;
108  if (m_unifiedCdfValues ) delete m_unifiedCdfValues;
109  if (m_unifiedCdfGrids ) delete m_unifiedCdfGrids;
110 
111  if (m_subSolutionCdf ) delete m_subSolutionCdf;
112  if (m_subCdfValues ) delete m_subCdfValues;
113  if (m_subCdfGrids ) delete m_subCdfGrids;
114 
115  if (m_subSolutionMdf ) delete m_subSolutionMdf;
116 #endif
117 #ifdef UQ_ALSO_COMPUTE_MDFS_WITHOUT_KDE
118  if (m_subMdfValues ) delete m_subMdfValues;
119  if (m_subMdfGrids ) delete m_subMdfGrids;
120 #endif
122 
123  if (m_mcSeqGenerator ) delete m_mcSeqGenerator;
124 
125  if (m_qoiChain) {
126  m_qoiChain->clear();
127  delete m_qoiChain;
128  }
129 
130  if (m_paramChain) {
131  m_paramChain->clear();
132  delete m_paramChain;
133  }
134 
135  if (m_optionsObj ) delete m_optionsObj;
136 }
void clear()
Reset the values and the size of the sequence of vectors.
StatisticalForwardProblemOptions * m_optionsObj
BaseVectorSequence< Q_V, Q_M > * m_paramChain
BaseJointPdf< Q_V, Q_M > * m_solutionPdf
MonteCarloSG< P_V, P_M, Q_V, Q_M > * m_mcSeqGenerator
BaseVectorRealizer< Q_V, Q_M > * m_solutionRealizer
BaseVectorSequence< Q_V, Q_M > * m_qoiChain

Member Function Documentation

template<class P_V, class P_M, class Q_V, class Q_M>
void QUESO::StatisticalForwardProblem< P_V, P_M, Q_V, Q_M >::commonConstructor ( )
private

TODO: Common constructor.

Todo:
: implement me!
template<class P_V , class P_M , class Q_V , class Q_M >
bool QUESO::StatisticalForwardProblem< P_V, P_M, Q_V, Q_M >::computeSolutionFlag ( ) const

Whether or not compute the solution.

Definition at line 141 of file StatisticalForwardProblem.C.

template<class P_V , class P_M , class Q_V , class Q_M >
const BaseVectorSequence< Q_V, Q_M > & QUESO::StatisticalForwardProblem< P_V, P_M, Q_V, Q_M >::getParamChain ( ) const

Returns the parameter chain; access to private attribute m_paramChain.

Definition at line 402 of file StatisticalForwardProblem.C.

References UQ_FATAL_TEST_MACRO.

403 {
404 
405  // Make sure this runs after the forward propagation
406  // only then we obtain the actual realizations of the parameters
408  m_env.worldRank(),
409  (std::string)("StatisticalForwardProblem<V,M,V,M>::getParamChain()"),
410  "m_paramChain is NULL");
411 
412  return *m_paramChain;
413 
414 }
int worldRank() const
Returns the process world rank.
Definition: Environment.C:235
BaseVectorSequence< Q_V, Q_M > * m_paramChain
#define UQ_FATAL_TEST_MACRO(test, givenRank, where, what)
Definition: Defines.h:223
template<class P_V , class P_M , class Q_V , class Q_M >
void QUESO::StatisticalForwardProblem< P_V, P_M, Q_V, Q_M >::print ( std::ostream &  os) const

TODO: Prints the sequence.

Todo:
: implement me!

Definition at line 418 of file StatisticalForwardProblem.C.

419 {
420  return;
421 }
template<class P_V , class P_M , class Q_V , class Q_M >
const GenericVectorRV< Q_V, Q_M > & QUESO::StatisticalForwardProblem< P_V, P_M, Q_V, Q_M >::qoiRv ( ) const

Returns the QoI RV; access to private attribute m_qoiRv.

Definition at line 373 of file StatisticalForwardProblem.C.

374 {
375  return m_qoiRv;
376 }
GenericVectorRV< Q_V, Q_M > & m_qoiRv
template<class P_V , class P_M , class Q_V , class Q_M >
void QUESO::StatisticalForwardProblem< P_V, P_M, Q_V, Q_M >::solveWithMonteCarlo ( const McOptionsValues alternativeOptionsValues)

Solves the problem through Monte Carlo algorithm.

  Requirements: none at this moment. If the requirements are satisfied, this operation checks
 the member flag 'm_computeSolution' (one of the options read from the input file during 
 construction). If the flag is 'false', the operation returns immediately, computing nothing.
 If the flag is 'true', the operation sets the member variable 'm_qoiRv' accordingly. 
 The operation:
  1. instantiates 'SequenceOfVectors<P_V,P_M>' (the input sequence of vectors),
  2. instantiates 'SequenceOfVectors<Q_V,Q_M>' (the output sequence of vectors),
  3. instantiates 'MonteCarloSG<P_V,P_M,Q_V,Q_M>' (the Monte Carlo algorithm),
  4. populates the output sequence with the Monte Carlo algorithm,
  5. sets the realizer of 'm_qoiRv' with the contents of the output sequence, and

Definition at line 148 of file StatisticalForwardProblem.C.

References QUESO::ComputeCovCorrMatricesBetweenVectorSequences(), QUESO::BaseVectorCdf< V, M >::m_prefix, QUESO::FilePtrSetStruct::ofsVar, QUESO::SequenceOfVectors< V, M >::subUniformlySampledCdf(), QUESO::SequenceOfVectors< V, M >::unifiedUniformlySampledCdf(), UQ_FATAL_TEST_MACRO, and UQ_FILE_EXTENSION_FOR_MATLAB_FORMAT.

150 {
151  m_env.fullComm().Barrier();
152  m_env.fullComm().syncPrintDebugMsg("Entering StatisticalForwardProblem<P_V,P_M>::solveWithMonteCarlo()",1,3000000);
153 
154  if (m_optionsObj->m_ov.m_computeSolution == false) {
155  if ((m_env.subDisplayFile())) {
156  *m_env.subDisplayFile() << "In StatisticalForwardProblem<P_V,P_M,Q_V,Q_M>::solveWithMonteCarlo()"
157  << ": avoiding solution, as requested by user"
158  << std::endl;
159  }
160  return;
161  }
162  if ((m_env.subDisplayFile())) {
163  *m_env.subDisplayFile() << "In StatisticalForwardProblem<P_V,P_M,Q_V,Q_M>::solveWithMonteCarlo()"
164  << ": computing solution, as requested by user"
165  << std::endl;
166  }
167 
168  if (m_solutionPdf ) delete m_solutionPdf;
169 
170 #ifdef QUESO_COMPUTES_EXTRA_POST_PROCESSING_STATISTICS
171  if (m_unifiedSolutionCdf) delete m_unifiedSolutionCdf;
172  if (m_unifiedCdfValues ) delete m_unifiedCdfValues;
173  if (m_unifiedCdfGrids ) delete m_unifiedCdfGrids;
174 
175  if (m_subSolutionCdf ) delete m_subSolutionCdf;
176  if (m_subCdfValues ) delete m_subCdfValues;
177  if (m_subCdfGrids ) delete m_subCdfGrids;
178 
179  if (m_subSolutionMdf ) delete m_subSolutionMdf;
180 #endif
181 #ifdef UQ_ALSO_COMPUTE_MDFS_WITHOUT_KDE
182  if (m_subMdfValues ) delete m_subMdfValues;
183  if (m_subMdfGrids ) delete m_subMdfGrids;
184 #endif
186 
187  if (m_mcSeqGenerator ) delete m_mcSeqGenerator;
188 
189  if (m_qoiChain) {
190  m_qoiChain->clear();
191  delete m_qoiChain;
192  }
193 
194  if (m_paramChain) {
195  m_paramChain->clear();
196  delete m_paramChain;
197  }
198 
199  Q_V numEvaluationPointsVec(m_qoiRv.imageSet().vectorSpace().zeroVector());
200  numEvaluationPointsVec.cwSet(250.);
201 
202  // Compute output realizer: Monte Carlo approach
203  m_paramChain = new SequenceOfVectors<P_V,P_M>(m_paramRv.imageSet().vectorSpace(),0,m_optionsObj->m_prefix+"paramChain");
204  m_qoiChain = new SequenceOfVectors<Q_V,Q_M>(m_qoiRv.imageSet().vectorSpace(), 0,m_optionsObj->m_prefix+"qoiChain" );
205  m_mcSeqGenerator = new MonteCarloSG<P_V,P_M,Q_V,Q_M>(m_optionsObj->m_prefix.c_str(),
206  alternativeOptionsValues,
207  m_paramRv,
208  m_qoiFunction);
209  //m_qoiRv);
210  m_mcSeqGenerator->generateSequence(*m_paramChain,
211  *m_qoiChain);
212  m_solutionRealizer = new SequentialVectorRealizer<Q_V,Q_M>((m_optionsObj->m_prefix+"Qoi").c_str(),
213  *m_qoiChain);
215 
216  // Compute output mdf: uniform sampling approach
217 #ifdef UQ_ALSO_COMPUTE_MDFS_WITHOUT_KDE
218  m_subMdfGrids = new ArrayOfOneDGrids <Q_V,Q_M>((m_optionsObj->m_prefix+"QoiMdf_").c_str(),m_qoiRv.imageSet().vectorSpace());
219  m_subMdfValues = new ArrayOfOneDTables<Q_V,Q_M>((m_optionsObj->m_prefix+"QoiMdf_").c_str(),m_qoiRv.imageSet().vectorSpace());
220  m_qoiChain->subUniformlySampledMdf(numEvaluationPointsVec, // input
221  *m_subMdfGrids, // output
222  *m_subMdfValues); // output
223 
224  m_subSolutionMdf = new SampledVectorMdf<Q_V,Q_M>((m_optionsObj->m_prefix+"Qoi").c_str(),
225  *m_subMdfGrids,
226  *m_subMdfValues);
227  m_qoiRv.setMdf(*m_subSolutionMdf);
228 #endif
229 
230  // Compute output cdf: uniform sampling approach
231 #ifdef QUESO_COMPUTES_EXTRA_POST_PROCESSING_STATISTICS
232  std::string subCoreName_qoiCdf(m_optionsObj->m_prefix+ "QoiCdf_");
233  std::string uniCoreName_qoiCdf(m_optionsObj->m_prefix+"unifQoiCdf_");
234  if (m_env.numSubEnvironments() == 1) subCoreName_qoiCdf = uniCoreName_qoiCdf;
235 
236  std::string subCoreName_solutionCdf(m_optionsObj->m_prefix+ "Qoi");
237  std::string uniCoreName_solutionCdf(m_optionsObj->m_prefix+"unifQoi");
238  if (m_env.numSubEnvironments() == 1) subCoreName_solutionCdf = uniCoreName_solutionCdf;
239 
240  m_subCdfGrids = new ArrayOfOneDGrids <Q_V,Q_M>(subCoreName_qoiCdf.c_str(),m_qoiRv.imageSet().vectorSpace());
241  m_subCdfValues = new ArrayOfOneDTables<Q_V,Q_M>(subCoreName_qoiCdf.c_str(),m_qoiRv.imageSet().vectorSpace());
242  m_qoiChain->subUniformlySampledCdf(numEvaluationPointsVec, // input
243  *m_subCdfGrids, // output
244  *m_subCdfValues); // output
245 
246  m_subSolutionCdf = new SampledVectorCdf<Q_V,Q_M>(subCoreName_solutionCdf.c_str(),
247  *m_subCdfGrids,
248  *m_subCdfValues);
249  m_qoiRv.setSubCdf(*m_subSolutionCdf);
250 
251  // Compute unified cdf if necessary
252  if (m_env.numSubEnvironments() == 1) {
253  m_qoiRv.setUnifiedCdf(*m_subSolutionCdf);
254  }
255  else {
256  m_unifiedCdfGrids = new ArrayOfOneDGrids <Q_V,Q_M>(uniCoreName_qoiCdf.c_str(),m_qoiRv.imageSet().vectorSpace());
257  m_unifiedCdfValues = new ArrayOfOneDTables<Q_V,Q_M>(uniCoreName_qoiCdf.c_str(),m_qoiRv.imageSet().vectorSpace());
258  m_qoiChain->unifiedUniformlySampledCdf(numEvaluationPointsVec, // input
259  *m_unifiedCdfGrids, // output
260  *m_unifiedCdfValues); // output
261 
262  m_unifiedSolutionCdf = new SampledVectorCdf<Q_V,Q_M>(uniCoreName_solutionCdf.c_str(),
263  *m_unifiedCdfGrids,
264  *m_unifiedCdfValues);
265  m_qoiRv.setUnifiedCdf(*m_unifiedSolutionCdf);
266  }
267 #endif
268  // Compute (just unified one) covariance matrix, if requested
269  // Compute (just unified one) correlation matrix, if requested
270  P_M* pqCovarianceMatrix = NULL;
271  P_M* pqCorrelationMatrix = NULL;
273  if (m_env.subDisplayFile()) {
274  *m_env.subDisplayFile() << "In StatisticalForwardProblem<P_V,P_M,Q_V,Q_M>::solveWithMonteCarlo()"
275  << ", prefix = " << m_optionsObj->m_prefix
276  << ": instantiating cov and corr matrices"
277  << std::endl;
278  }
279  pqCovarianceMatrix = new P_M(m_env,
280  m_paramRv.imageSet().vectorSpace().map(), // number of rows
281  m_qoiRv.imageSet().vectorSpace().dimGlobal()); // number of cols
282  pqCorrelationMatrix = new P_M(m_env,
283  m_paramRv.imageSet().vectorSpace().map(), // number of rows
284  m_qoiRv.imageSet().vectorSpace().dimGlobal()); // number of cols
286  *m_qoiChain,
287  std::min(m_paramRv.realizer().subPeriod(),m_qoiRv.realizer().subPeriod()), // FIX ME: might be INFINITY
288  *pqCovarianceMatrix,
289  *pqCorrelationMatrix);
290  }
291 
292  // Write data out
293  if (m_env.subDisplayFile()) {
294  if (pqCovarianceMatrix ) {
295  *m_env.subDisplayFile() << "In StatisticalForwardProblem<P_V,P_M,Q_V,Q_M>::solveWithMonteCarlo()"
296  << ", prefix = " << m_optionsObj->m_prefix
297  << ": contents of covariance matrix are\n" << *pqCovarianceMatrix
298  << std::endl;
299  }
300  if (pqCorrelationMatrix) {
301  *m_env.subDisplayFile() << "In StatisticalForwardProblem<P_V,P_M,Q_V,Q_M>::solveWithMonteCarlo()"
302  << ", prefix = " << m_optionsObj->m_prefix
303  << ": contents of correlation matrix are\n" << *pqCorrelationMatrix
304  << std::endl;
305  }
306  }
307 
308  // Open data output file
309  if (m_env.subDisplayFile()) {
310  *m_env.subDisplayFile() << "In StatisticalForwardProblem<P_V,P_M,Q_V,Q_M>::solveWithMonteCarlo()"
311  << ", prefix = " << m_optionsObj->m_prefix
312  << ": checking necessity of opening data output file '" << m_optionsObj->m_ov.m_dataOutputFileName
313  << "'"
314  << std::endl;
315  }
316  FilePtrSetStruct filePtrSet;
318  UQ_FILE_EXTENSION_FOR_MATLAB_FORMAT, // Yes, always ".m"
320  false,
321  filePtrSet)) {
322 #ifdef UQ_ALSO_COMPUTE_MDFS_WITHOUT_KDE
323  m_qoiRv.mdf().print(*filePtrSet.ofsVar);
324 #endif
325 #ifdef QUESO_COMPUTES_EXTRA_POST_PROCESSING_STATISTICS
326  *filePtrSet.ofsVar << m_qoiRv.subCdf();
327 #endif
328 
329  //if (pqCovarianceMatrix ) *filePtrSet.ofsVar << *pqCovarianceMatrix; // FIX ME: output matrix in matlab format
330  //if (pqCorrelationMatrix) *filePtrSet.ofsVar << *pqCorrelationMatrix; // FIX ME: output matrix in matlab format
331 
332  // Write unified cdf if necessary
333 #ifdef QUESO_COMPUTES_EXTRA_POST_PROCESSING_STATISTICS
334  if (m_env.numSubEnvironments() > 1) {
335  if (m_qoiRv.imageSet().vectorSpace().numOfProcsForStorage() == 1) {
336  if (m_env.inter0Rank() == 0) {
337  *filePtrSet.ofsVar << m_qoiRv.unifiedCdf(); //*m_unifiedSolutionCdf;
338  }
339  }
340  else {
341  UQ_FATAL_TEST_MACRO(true,
342  m_env.worldRank(),
343  "StatisticalForwardProblem<P_V,P_M,Q_V,Q_M>::solveWithMonteCarlo()",
344  "unified cdf writing, parallel vectors not supported yet");
345  }
346  }
347 #endif
348  // Close data output file
350  if (m_env.subDisplayFile()) {
351  *m_env.subDisplayFile() << "In StatisticalForwardProblem<P_V,P_M,Q_V,Q_M>::solveWithMonteCarlo()"
352  << ", prefix = " << m_optionsObj->m_prefix
353  << ": closed data output file '" << m_optionsObj->m_ov.m_dataOutputFileName
354  << "'"
355  << std::endl;
356  }
357  }
358  if (m_env.subDisplayFile()) {
359  *m_env.subDisplayFile() << std::endl;
360  }
361 
362  if (pqCovarianceMatrix ) delete pqCovarianceMatrix;
363  if (pqCorrelationMatrix) delete pqCorrelationMatrix;
364 
365  m_env.fullComm().syncPrintDebugMsg("Leaving StatisticalForwardProblem<P_V,P_M>::solveWithMonteCarlo()",1,3000000);
366  m_env.fullComm().Barrier();
367 
368  return;
369 }
void clear()
Reset the values and the size of the sequence of vectors.
int inter0Rank() const
Returns the process inter0 rank.
Definition: Environment.C:289
StatisticalForwardProblemOptions * m_optionsObj
const BaseVectorCdf< V, M > & unifiedCdf() const
Finds the Cumulative Distribution Function of this vector RV, considering the unified sequence of dat...
Definition: VectorRV.C:122
int worldRank() const
Returns the process world rank.
Definition: Environment.C:235
#define UQ_FILE_EXTENSION_FOR_MATLAB_FORMAT
Definition: Defines.h:89
std::ofstream * subDisplayFile() const
Access function for m_subDisplayFile (displays file on stream).
Definition: Environment.C:305
const BaseVectorMdf< V, M > & mdf() const
Finds the Mass Density Function of this vector RV; access to private attribute m_mdf.
Definition: VectorRV.C:134
const BaseVectorFunction< P_V, P_M, Q_V, Q_M > & m_qoiFunction
const MpiComm & fullComm() const
Access function for MpiComm full communicator.
Definition: Environment.C:247
void ComputeCovCorrMatricesBetweenVectorSequences(const BaseVectorSequence< P_V, P_M > &subPSeq, const BaseVectorSequence< Q_V, Q_M > &subQSeq, unsigned int subNumSamples, P_M &pqCovMatrix, P_M &pqCorrMatrix)
BaseVectorSequence< Q_V, Q_M > * m_paramChain
void setMdf(BaseVectorMdf< V, M > &mdf)
Sets the MDF of this vector RV to Mdf.
void Barrier() const
Pause every process in *this communicator until all the processes reach this point.
Definition: MpiComm.C:143
void closeFile(FilePtrSetStruct &filePtrSet, const std::string &fileType) const
Closes the file.
Definition: Environment.C:1117
GenericVectorRV< Q_V, Q_M > & m_qoiRv
void setSubCdf(BaseVectorCdf< V, M > &subCdf)
Sets the CDF of the sub-sequence of this vector RV to subCdf.
std::set< unsigned int > m_dataOutputAllowedSet
BaseJointPdf< Q_V, Q_M > * m_solutionPdf
MonteCarloSG< P_V, P_M, Q_V, Q_M > * m_mcSeqGenerator
void syncPrintDebugMsg(const char *msg, unsigned int msgVerbosity, unsigned int numUSecs) const
Synchronizes all the processes and print debug message.
Definition: MpiComm.C:234
const VectorSet< V, M > & imageSet() const
Image set of the vector RV; access to private attribute m_imageSet.
Definition: VectorRV.C:79
BaseVectorRealizer< Q_V, Q_M > * m_solutionRealizer
unsigned int numSubEnvironments() const
Access function to the number of sub-environments.
Definition: Environment.C:319
const BaseVectorRealizer< V, M > & realizer() const
Finds a realization (sample) of the PDF of this vector RV; access to private attribute m_realizer...
Definition: VectorRV.C:98
const BaseVectorRV< P_V, P_M > & m_paramRv
virtual const VectorSpace< V, M > & vectorSpace() const =0
Vector space to which this set belongs to. See template specialization.
#define UQ_FATAL_TEST_MACRO(test, givenRank, where, what)
Definition: Defines.h:223
void setUnifiedCdf(BaseVectorCdf< V, M > &unifiedCdf)
Sets the CDF of the unified sequence of this vector RV to unifiedCdf.
void setRealizer(BaseVectorRealizer< V, M > &realizer)
Sets the realizer of this vector RV to realizer.
bool openOutputFile(const std::string &fileName, const std::string &fileType, const std::set< unsigned int > &allowedSubEnvIds, bool writeOver, FilePtrSetStruct &filePtrSet) const
Opens an output file for each sub-environment that was chosen to send data to the file...
Definition: Environment.C:516
BaseVectorSequence< Q_V, Q_M > * m_qoiChain
const BaseVectorCdf< V, M > & subCdf() const
Finds the Cumulative Distribution Function of this vector RV, considering only the sub-sequence of da...
Definition: VectorRV.C:110

Friends And Related Function Documentation

template<class P_V, class P_M, class Q_V, class Q_M>
std::ostream& operator<< ( std::ostream &  os,
const StatisticalForwardProblem< P_V, P_M, Q_V, Q_M > &  obj 
)
friend

Definition at line 141 of file StatisticalForwardProblem.h.

142  {
143  obj.print(os);
144  return os;
145  }

Member Data Documentation

template<class P_V, class P_M, class Q_V, class Q_M>
SfpOptionsValues QUESO::StatisticalForwardProblem< P_V, P_M, Q_V, Q_M >::m_alternativeOptionsValues
private

Definition at line 167 of file StatisticalForwardProblem.h.

template<class P_V, class P_M, class Q_V, class Q_M>
const BaseEnvironment& QUESO::StatisticalForwardProblem< P_V, P_M, Q_V, Q_M >::m_env
private

Definition at line 153 of file StatisticalForwardProblem.h.

template<class P_V, class P_M, class Q_V, class Q_M>
MonteCarloSG<P_V,P_M,Q_V,Q_M>* QUESO::StatisticalForwardProblem< P_V, P_M, Q_V, Q_M >::m_mcSeqGenerator
private

Definition at line 161 of file StatisticalForwardProblem.h.

template<class P_V, class P_M, class Q_V, class Q_M>
StatisticalForwardProblemOptions* QUESO::StatisticalForwardProblem< P_V, P_M, Q_V, Q_M >::m_optionsObj
private

Definition at line 168 of file StatisticalForwardProblem.h.

template<class P_V, class P_M, class Q_V, class Q_M>
BaseVectorSequence<Q_V,Q_M>* QUESO::StatisticalForwardProblem< P_V, P_M, Q_V, Q_M >::m_paramChain
private

Definition at line 159 of file StatisticalForwardProblem.h.

template<class P_V, class P_M, class Q_V, class Q_M>
const BaseVectorRV<P_V,P_M>& QUESO::StatisticalForwardProblem< P_V, P_M, Q_V, Q_M >::m_paramRv
private

Definition at line 155 of file StatisticalForwardProblem.h.

template<class P_V, class P_M, class Q_V, class Q_M>
BaseVectorSequence<Q_V,Q_M>* QUESO::StatisticalForwardProblem< P_V, P_M, Q_V, Q_M >::m_qoiChain
private

Definition at line 160 of file StatisticalForwardProblem.h.

template<class P_V, class P_M, class Q_V, class Q_M>
const BaseVectorFunction<P_V,P_M,Q_V,Q_M>& QUESO::StatisticalForwardProblem< P_V, P_M, Q_V, Q_M >::m_qoiFunction
private

Definition at line 156 of file StatisticalForwardProblem.h.

template<class P_V, class P_M, class Q_V, class Q_M>
GenericVectorRV<Q_V,Q_M>& QUESO::StatisticalForwardProblem< P_V, P_M, Q_V, Q_M >::m_qoiRv
private

Definition at line 157 of file StatisticalForwardProblem.h.

template<class P_V, class P_M, class Q_V, class Q_M>
BaseJointPdf<Q_V,Q_M>* QUESO::StatisticalForwardProblem< P_V, P_M, Q_V, Q_M >::m_solutionPdf
private

Definition at line 165 of file StatisticalForwardProblem.h.

template<class P_V, class P_M, class Q_V, class Q_M>
BaseVectorRealizer<Q_V,Q_M>* QUESO::StatisticalForwardProblem< P_V, P_M, Q_V, Q_M >::m_solutionRealizer
private

Definition at line 163 of file StatisticalForwardProblem.h.


The documentation for this class was generated from the following files:

Generated on Thu Apr 23 2015 19:26:18 for queso-0.51.1 by  doxygen 1.8.5