queso-0.53.0
|
A templated class that implements a Monte Carlo generator of samples. More...
#include <MonteCarloSG.h>
Public Member Functions | |
Constructor/Destructor methods | |
MonteCarloSG (const char *prefix, const McOptionsValues *alternativeOptionsValues, const BaseVectorRV< P_V, P_M > ¶mRv, const BaseVectorFunction< P_V, P_M, Q_V, Q_M > &qoiFunction) | |
Constructor. More... | |
~MonteCarloSG () | |
Destructor. More... | |
Statistical methods | |
void | generateSequence (BaseVectorSequence< P_V, P_M > &workingPSeq, BaseVectorSequence< Q_V, Q_M > &workingQSeq) |
Generates the QoI (output) sequence, it calls internGenerateSequence(). More... | |
Private Member Functions | |
void | internGenerateSequence (const BaseVectorRV< P_V, P_M > ¶mRv, BaseVectorSequence< P_V, P_M > &workingPSeq, BaseVectorSequence< Q_V, Q_M > &workingQSeq) |
Generates the QoI (output) sequence; it calls actualGenerateSequence(). More... | |
void | actualGenerateSequence (const BaseVectorRV< P_V, P_M > ¶mRv, BaseVectorSequence< P_V, P_M > &workingPSeq, BaseVectorSequence< Q_V, Q_M > &workingQSeq, unsigned int seqSize) |
This method actually generates the QoI sequence. More... | |
void | actualReadSequence (const BaseVectorRV< P_V, P_M > ¶mRv, const std::string &dataInputFileName, const std::string &dataInputFileType, BaseVectorSequence< P_V, P_M > &workingPSeq, BaseVectorSequence< Q_V, Q_M > &workingQSeq, unsigned int seqSize) |
Reads the sequence. More... | |
Private Attributes | |
const BaseEnvironment & | m_env |
const BaseVectorRV< P_V, P_M > & | m_paramRv |
const BaseVectorFunction< P_V, P_M, Q_V, Q_M > & | m_qoiFunction |
const VectorSpace< P_V, P_M > & | m_paramSpace |
const VectorSpace< Q_V, Q_M > & | m_qoiSpace |
const VectorFunctionSynchronizer < P_V, P_M, Q_V, Q_M > * | m_qoiFunctionSynchronizer |
unsigned int | m_numPsNotSubWritten |
unsigned int | m_numQsNotSubWritten |
const McOptionsValues * | m_optionsObj |
bool | m_userDidNotProvideOptions |
I/O methods | |
void | print (std::ostream &os) const |
Prints the sequence. More... | |
std::ostream & | operator<< (std::ostream &os, const MonteCarloSG< P_V, P_M, Q_V, Q_M > &obj) |
A templated class that implements a Monte Carlo generator of samples.
This class implements a Monte Carlo generator of samples. 'SG' stands for 'Sequence Generator'. Options reading is handled by class 'MonteCarloOptions'. If options request data to be written in the output file (MATLAB .m format only, for now), the user can check which MATLAB variables are defined and set by running 'grep zeros <OUTPUT file="" name>="">' after the solution procedures ends. The names of the variables are self explanatory.
Definition at line 52 of file MonteCarloSG.h.
QUESO::MonteCarloSG< P_V, P_M, Q_V, Q_M >::MonteCarloSG | ( | const char * | prefix, |
const McOptionsValues * | alternativeOptionsValues, | ||
const BaseVectorRV< P_V, P_M > & | paramRv, | ||
const BaseVectorFunction< P_V, P_M, Q_V, Q_M > & | qoiFunction | ||
) |
Constructor.
Requirements: 1) the image set of the vector random variable 'paramRv' and 2) the domain set of the QoI function 'qoiFunction' 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>_mc_'. For instance, if 'prefix' is 'pROblem_775_fp_', then the constructor will read all options that begin with 'pROblem_775_fp_mc_'. Options reading is handled by class 'MonteCarloOptions'.
prefix | Prefix |
alternativeOptionsValues | Options (if no input file) |
paramRv | The parameter RV |
qoiFunction | The QoI function |
Definition at line 33 of file MonteCarloSG.C.
References queso_require_equal_to_msg.
QUESO::MonteCarloSG< P_V, P_M, Q_V, Q_M >::~MonteCarloSG | ( | ) |
Destructor.
Definition at line 85 of file MonteCarloSG.C.
|
private |
This method actually generates the QoI sequence.
Requirements: 1) the vector space containing the domain set of the QoI function 'm_qoiFunction' should have dimension equal to the size of a vector in 'workingPSeq' and 2) the vector space containing the image set of the qoi function 'm_qoiFunction' should have dimension equal to the size of a vector in 'workingQSeq'. If the requirements are satisfied, this operation sets the size and the contents of 'workingPSeq' and 'workingQSeq' using the algorithm options set in the constructor.
Definition at line 334 of file MonteCarloSG.C.
References QUESO::BaseVectorSequence< V, M >::getPositionValues(), QUESO::MiscGetEllapsedSeconds(), QUESO::BaseVectorSequence< V, M >::name(), QUESO::BaseVectorRealizer< V, M >::realization(), QUESO::BaseVectorRV< V, M >::realizer(), QUESO::BaseVectorSequence< V, M >::resizeSequence(), QUESO::BaseVectorSequence< V, M >::setPositionValues(), QUESO::BaseVectorSequence< V, M >::subSequenceSize(), QUESO::BaseVectorSequence< V, M >::subWriteContents(), and QUESO::UQ_OK_RC.
|
private |
Reads the sequence.
Definition at line 476 of file MonteCarloSG.C.
References QUESO::BaseVectorRealizer< V, M >::realization(), QUESO::BaseVectorRV< V, M >::realizer(), QUESO::BaseVectorSequence< V, M >::resizeSequence(), QUESO::BaseVectorSequence< V, M >::setPositionValues(), and QUESO::BaseVectorSequence< V, M >::unifiedReadContents().
void QUESO::MonteCarloSG< P_V, P_M, Q_V, Q_M >::generateSequence | ( | BaseVectorSequence< P_V, P_M > & | workingPSeq, |
BaseVectorSequence< Q_V, Q_M > & | workingQSeq | ||
) |
Generates the QoI (output) sequence, it calls internGenerateSequence().
This method checks for a parallel environment (and uses it if available) and calls the private member function internGenerateSequence() to generate a sequence of values of the Quantity of interest (QoI).
Definition at line 96 of file MonteCarloSG.C.
References queso_require_equal_to_msg, and QUESO::BaseVectorSequence< V, M >::vectorSizeLocal().
|
private |
Generates the QoI (output) sequence; it calls actualGenerateSequence().
This method calls the private member actualGenerateSequence() to actually generate a sequence of values of the Quantity of interest (QoI). It writes both the QoI and the parameter sequences to output files. If a parallel environment is available, the user has the choice of (via the input options file) which sub-environment will write data to files. The unified sequence of data (QoI and/or Parameter sequences) of all the sub-environments (or of the single environment, in case of a serial run) is also written to files.
Definition at line 120 of file MonteCarloSG.C.
References QUESO::BaseVectorSequence< V, M >::name(), QUESO::FilePtrSetStruct::ofsVar, queso_require_equal_to_msg, QUESO::BaseVectorRV< V, M >::realizer(), QUESO::BaseVectorSequence< V, M >::setName(), QUESO::BaseVectorRealizer< V, M >::subPeriod(), QUESO::BaseVectorSequence< V, M >::subSequenceSize(), QUESO::BaseVectorSequence< V, M >::subWriteContents(), QUESO::BaseVectorSequence< V, M >::unifiedWriteContents(), UQ_FILE_EXTENSION_FOR_MATLAB_FORMAT, and UQ_MOC_SG_FILENAME_FOR_NO_FILE.
void QUESO::MonteCarloSG< P_V, P_M, Q_V, Q_M >::print | ( | std::ostream & | os | ) | const |
|
friend |
Definition at line 86 of file MonteCarloSG.h.
|
private |
Definition at line 124 of file MonteCarloSG.h.
|
private |
Definition at line 130 of file MonteCarloSG.h.
|
private |
Definition at line 131 of file MonteCarloSG.h.
|
private |
Definition at line 133 of file MonteCarloSG.h.
|
private |
Definition at line 125 of file MonteCarloSG.h.
|
private |
Definition at line 127 of file MonteCarloSG.h.
|
private |
Definition at line 126 of file MonteCarloSG.h.
|
private |
Definition at line 129 of file MonteCarloSG.h.
|
private |
Definition at line 128 of file MonteCarloSG.h.
|
private |
Definition at line 135 of file MonteCarloSG.h.