queso-0.56.0
Protected Attributes | List of all members
QUESO::BaseEnvironment Class Referenceabstract

This (virtual) class sets up the environment underlying the use of the QUESO library by an executable. More...

#include <Environment.h>

Inheritance diagram for QUESO::BaseEnvironment:
Inheritance graph
[legend]
Collaboration diagram for QUESO::BaseEnvironment:
Collaboration graph
[legend]

Public Member Functions

Constructor/Destructor methods
 BaseEnvironment (const char *passedOptionsInputFileName, EnvOptionsValues *alternativeOptionsValues)
 Default constructor. More...
 
 BaseEnvironment (const std::string &passedOptionsInputFileName, EnvOptionsValues *alternativeOptionsValues)
 
virtual ~BaseEnvironment ()
 Destructor. More...
 
Environment, Communicator and Options Input File methods
bool fullEnvIsReady () const
 Returns whether the full environment class is ready (constructor has successfully been called). More...
 
int worldRank () const
 Returns the process world rank. More...
 
int fullRank () const
 Returns the process full rank. More...
 
const MpiCommfullComm () const
 Access function for MpiComm full communicator. More...
 
RawType_MPI_Group subGroup () const
 Access function for sub-group. More...
 
int subRank () const
 Access function for sub-rank. More...
 
const MpiCommsubComm () const
 Access function for MpiComm sub communicator. More...
 
const MpiCommselfComm () const
 Access function for MpiComm self-communicator. More...
 
int inter0Rank () const
 Returns the process inter0 rank. More...
 
const MpiComminter0Comm () const
 Access function for MpiComm inter0-communicator. More...
 
std::ofstream * subDisplayFile () const
 Access function for m_subDisplayFile (displays file on stream). More...
 
std::string subDisplayFileName () const
 Access function for m_subDisplayFileName (displays filename on stream). More...
 
unsigned int numSubEnvironments () const
 Access function to the number of sub-environments. More...
 
unsigned int subId () const
 Access function to the number of each sub-environment Id: m_subId. More...
 
const std::string & subIdString () const
 Access to the attribute m_subIdString; which stores the string for the sub-environment, and it will be used, for instance, to create the output files for each sub-environment. More...
 
void checkTheParallelEnvironment () const
 
std::string optionsInputFileName () const
 Access to the attribute m_optionsInputFileName, which stores the name of the input file passed by the user to QUESO. More...
 
void setOptionsInputFileAccessState (bool newState) const
 
boost::program_options::variables_map & allOptionsMap () const
 
void scanInputFileForMyOptions (const boost::program_options::options_description &optionsDesc) const
 This method scans the input file provided by the user to QUESO. More...
 
unsigned int displayVerbosity () const
 
unsigned int syncVerbosity () const
 Access function to private attribute m_syncVerbosity. More...
 
unsigned int checkingLevel () const
 Access function to private attribute m_checkingLevel. More...
 
const RngBaserngObject () const
 Access to the RNG object. More...
 
void resetSeed (int newSeedOption)
 Reset RNG seed. More...
 
int seed () const
 Access to the RNG seed. More...
 
const BasicPdfsBasebasicPdfs () const
 Access to Basic PDFs. More...
 
std::string platformName () const
 Access to the platform name. More...
 
std::string identifyingString () const
 Access function to private attribute m_identifyingString: identifying string. More...
 
void resetIdentifyingString (const std::string &newString)
 Reset private attribute m_identifyingString with the value newString. More...
 
bool isThereInputFile () const
 //TODO Not implemented? it is called in examples/validationCycle/tests_old/results_5_25/uqTgaEx4.h. More...
 
struct timeval timevalBegin () const
 Used to save the time when the combo `QUESO+user's application' started to run. More...
 
I/O methods
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. More...
 
bool openUnifiedOutputFile (const std::string &fileName, const std::string &fileType, bool writeOver, FilePtrSetStruct &filePtrSet) const
 Opens a unified output file, that will contain data from all sub-environments. More...
 
bool openInputFile (const std::string &fileName, const std::string &fileType, const std::set< unsigned int > &allowedSubEnvIds, FilePtrSetStruct &filePtrSet) const
 Opens an input file. More...
 
bool openUnifiedInputFile (const std::string &fileName, const std::string &fileType, FilePtrSetStruct &filePtrSet) const
 Opens the unified input file. More...
 
void closeFile (FilePtrSetStruct &filePtrSet, const std::string &fileType) const
 Closes the file. More...
 
void setExceptionalCircumstance (bool value) const
 Set an exceptional circumstance. More...
 
bool exceptionalCircumstance () const
 Decides whether there is an exceptional circumstance. More...
 
const GetPotinput () const
 The GetPot input file parser. More...
 
virtual void print (std::ostream &os) const =0
 

Protected Attributes

bool m_fullEnvIsReady
 
int m_worldRank
 
MpiCommm_fullComm
 
int m_fullRank
 
int m_fullCommSize
 
RawType_MPI_Group m_fullGroup
 
std::string m_optionsInputFileName
 
bool m_optionsInputFileAccessState
 
boost::program_options::options_description * m_allOptionsDesc
 
boost::program_options::variables_map * m_allOptionsMap
 
ScopedPtr< GetPot >::Type m_input
 
unsigned int m_subId
 
std::string m_subIdString
 
RawType_MPI_Group m_subGroup
 
MpiCommm_subComm
 
int m_subRank
 
int m_subCommSize
 
MpiCommm_selfComm
 
RawType_MPI_Group m_inter0Group
 
MpiCommm_inter0Comm
 
int m_inter0Rank
 
int m_inter0CommSize
 
std::ofstream * m_subDisplayFile
 
RngBasem_rngObject
 
BasicPdfsBasem_basicPdfs
 
struct timeval m_timevalBegin
 
bool m_exceptionalCircumstance
 
EnvOptionsValuesm_optionsObj
 

Detailed Description

This (virtual) class sets up the environment underlying the use of the QUESO library by an executable.

This class sets up the environment underlying the use of the QUESO library by an executable. It:
  1. assigns rank numbers, other than the world rank, to nodes participating in a parallel job,
  2. provides communicators for generating a sequence of vectors in a distributed way,
  3. provides functionality to read options from the 'options input file' (whose name is passed in the constructor of this environment class),
  4. opens output files for messages that would otherwise be written to the screen (one output file per allowed rank is opened and allowed ranks can be specified through the 'options input file').

    This class is virtual. It is inherited by 'EmptyEnvironment' and 'FullEnvironment'.
    The QUESO environment class is instantiated at the application level, right after 'MPI_Init(&argc,&argv)'.
    The QUESO environment is required by reference by many constructors in the QUESO library,
    and is available by reference from many classes as well.
    

    Throughout QUESO, there are five classes whose constructors check options in the 'options input file':
    
    1. BaseEnvironment
    2. StatisticalInverseProblem
    3. StatisticalForwardProblem
    4. MetropolisHastingsSG ('SG' stands for 'sequence generator')
    5. MonteCarloSG
    These classes rely on 'options classes' to read their options from the input file.
    The options classes are, respectively:
    
    1. EnvironmentOptions
    2. StatisticalInverseProblemOptions
    3. StatisticalForwardProblemOptions
    4. MetropolisHastingsSGOptions
    5. MonteCarloSGOptions

    The last two classes also rely on SequenceStatisticalOptions for reading the options specifying which statistics have to be computed on the sequences of vectors

    involved.

    The QUESO environment class manages five types of communicators. Let:
    
    1. 'W >= 1' be the size of whole world communicator involved in a parallel run;
    2. 'N >= 1' be the size of the communicator passed to the QUESO environment constructor;
    3. 'S >= 1' be the number of statistical problems a QUESO environment will be handling at the same time, in parallel.

    Usually 'W'='N', but such equality is not necessary. The number 'S' is equal to the QUESO environment option 'm_numSubEnvironments', and is equal to 1 by default. The number 'N' must be a multiple of 'S', otherwise the QUESO class prints a fatal error message and MPI aborts. The five types of communicators that QUESO manages are referred to as:

    1. world = MPI_WORLD_COMM, of size W;
    2. full = communicator passed to the constructor of BaseEnvironment, of size N and usually equal to the world communicator;
    3. sub = communicator of size N/S that contains the number of MPI nodes necessary to solve a statistical inverse problem or a statistical forward problem.
    4. self = MPI_SELF_COMM, of size 1;
    5. inter0 = communicator of size S formed by all MPI nodes that have 'sub' rank 0 in their respective 'sub' communicators.

    So, any given node has potentially five different ranks. Of course, if the user is solving just one statistical problem with just one MPI node, then all ranks are equal to zero.


    In the QUESO library terminology, one might refer to a QUESO "full" environment composed of
    

    'S' QUESO "sub" environments. Each sub environment is assigned a "sub" id varying from 0 (zero) to S-1. Each sub environment is able to generate a statistical inverse problem and/or a statistical forward problem. That is, each sub environment is able to handle a "sub" Markov chain (a sequence) of vectors and/or a "sub" Monte Carlo sequence of output vectors. The "sub" sequences can be seen as forming a "unified" sequence in a distributed way. Indeed, the virtual class 'VectorSequence' provides "sub" and "unified" statistical operations.

    A QUESO "sub" environment eventually prints messages to its own output file. In order for that to happen, the requirements are:

    1. option 'm_subDisplayFileName', a string, must be different than the default value ".";
    2. option 'm_subDisplayAllowedSet', a set of sub ids, must contain the id of the sub environment wanting to write a message to the output file;
    3. the previous requirement is automatically satisfied if the option 'm_subDisplayAllowAll', a boolean, is set to 1 (the default value is 0);
    4. the processor wanting to write a message to the output file must have sub rank 0 (zero).

    If all requirements are satisfied, then QUESO will generate a file with name '<m_subDisplayFileName>_sub<sub id>.txt'. For instance, if 'm_subDisplayFileName' is 'pROblem_775_' then a node of sub rank 0 in sub environment 17 will write a message to the file 'pROblem_775_sub17.txt'.

Definition at line 197 of file Environment.h.

Constructor & Destructor Documentation

QUESO::BaseEnvironment::BaseEnvironment ( const char *  passedOptionsInputFileName,
EnvOptionsValues alternativeOptionsValues 
)

Default constructor.

Definition at line 141 of file Environment.C.

References m_optionsInputFileName.

144  :
145  m_fullEnvIsReady (false),
146  m_worldRank (-1),
147  m_fullComm (NULL),
148  m_fullRank (-1),
149  m_fullCommSize (1),
152 #ifndef DISABLE_BOOST_PROGRAM_OPTIONS
153  m_allOptionsDesc (NULL),
154  m_allOptionsMap (NULL),
155 #endif // DISABLE_BOOST_PROGRAM_OPTIONS
156  m_input (new GetPot),
157  m_subComm (NULL),
158  m_subRank (-1),
159  m_subCommSize (1),
160  m_selfComm (NULL),
161  m_inter0Comm (NULL),
162  m_inter0Rank (-1),
163  m_inter0CommSize (1),
164  m_subDisplayFile (NULL),
165  m_rngObject (NULL),
166  m_basicPdfs (NULL),
168  m_optionsObj (alternativeOptionsValues)
169 {
170  if (passedOptionsInputFileName) m_optionsInputFileName = passedOptionsInputFileName;
171 }
std::string m_optionsInputFileName
Definition: Environment.h:374
EnvOptionsValues * m_optionsObj
Definition: Environment.h:402
boost::program_options::variables_map * m_allOptionsMap
Definition: Environment.h:378
std::ofstream * m_subDisplayFile
Definition: Environment.h:396
boost::program_options::options_description * m_allOptionsDesc
Definition: Environment.h:377
Definition: getpot.h:152
ScopedPtr< GetPot >::Type m_input
Definition: Environment.h:380
BasicPdfsBase * m_basicPdfs
Definition: Environment.h:398
QUESO::BaseEnvironment::BaseEnvironment ( const std::string &  passedOptionsInputFileName,
EnvOptionsValues alternativeOptionsValues 
)

Definition at line 173 of file Environment.C.

176  :
177  m_fullEnvIsReady (false),
178  m_worldRank (-1),
179  m_fullComm (NULL),
180  m_fullRank (-1),
181  m_fullCommSize (1),
182  m_optionsInputFileName (passedOptionsInputFileName),
184 #ifndef DISABLE_BOOST_PROGRAM_OPTIONS
185  m_allOptionsDesc (NULL),
186  m_allOptionsMap (NULL),
187 #endif // DISABLE_BOOST_PROGRAM_OPTIONS
188  m_input (new GetPot),
189  m_subComm (NULL),
190  m_subRank (-1),
191  m_subCommSize (1),
192  m_selfComm (NULL),
193  m_inter0Comm (NULL),
194  m_inter0Rank (-1),
195  m_inter0CommSize (1),
196  m_subDisplayFile (NULL),
197  m_rngObject (NULL),
198  m_basicPdfs (NULL),
200  m_optionsObj (alternativeOptionsValues)
201 {
202 }
std::string m_optionsInputFileName
Definition: Environment.h:374
EnvOptionsValues * m_optionsObj
Definition: Environment.h:402
boost::program_options::variables_map * m_allOptionsMap
Definition: Environment.h:378
std::ofstream * m_subDisplayFile
Definition: Environment.h:396
boost::program_options::options_description * m_allOptionsDesc
Definition: Environment.h:377
Definition: getpot.h:152
ScopedPtr< GetPot >::Type m_input
Definition: Environment.h:380
BasicPdfsBase * m_basicPdfs
Definition: Environment.h:398
QUESO::BaseEnvironment::~BaseEnvironment ( )
virtual

Destructor.

It deallocates memory and does other cleanup for the class object and its class members when the object is destroyed. It displays the total run time of the combo QUESO + application using the function gettimeofday() from a struct timeval (as specified in <sys/time.h>).

Definition at line 205 of file Environment.C.

References displayVerbosity(), m_allOptionsDesc, m_allOptionsMap, m_basicPdfs, m_fullComm, m_fullRank, m_inter0Comm, m_rngObject, m_selfComm, m_subComm, m_subDisplayFile, and m_timevalBegin.

206 {
207  //if (m_subDisplayFile) {
208  // *m_subDisplayFile << "Entering BaseEnvironment::destructor()"
209  // << std::endl;
210  //}
211 
212  struct timeval timevalNow;
213  /*int iRC = 0;*/
214  /*iRC = */gettimeofday(&timevalNow, NULL);
215 
216  if( this->displayVerbosity() > 0 )
217  {
218  if (m_subDisplayFile) {
219  *m_subDisplayFile << "Ending run at " << ctime(&timevalNow.tv_sec)
220  << "Total run time = " << timevalNow.tv_sec - m_timevalBegin.tv_sec
221  << " seconds"
222  << std::endl;
223  }
224 
225  if (m_fullRank == 0) {
226  std::cout << "Ending run at " << ctime(&timevalNow.tv_sec)
227  << "Total run time = " << timevalNow.tv_sec - m_timevalBegin.tv_sec
228  << " seconds"
229  << std::endl;
230  }
231  }
232 
233 #ifndef DISABLE_BOOST_PROGRAM_OPTIONS
234  if (m_allOptionsMap) {
235  delete m_allOptionsMap;
236  delete m_allOptionsDesc;
237  }
238 #endif // DISABLE_BOOST_PROGRAM_OPTIONS
239 
240  if (m_basicPdfs) delete m_basicPdfs;
241  if (m_rngObject) delete m_rngObject;
242 
243  //if (m_subDisplayFile) {
244  // *m_subDisplayFile << "Leaving BaseEnvironment::destructor()"
245  // << std::endl;
246  //}
247 
249  if (m_inter0Comm ) delete m_inter0Comm;
250  if (m_selfComm ) delete m_selfComm;
251  if (m_subComm ) delete m_subComm;
252  if (m_fullComm ) delete m_fullComm;
253 }
struct timeval m_timevalBegin
Definition: Environment.h:399
boost::program_options::variables_map * m_allOptionsMap
Definition: Environment.h:378
std::ofstream * m_subDisplayFile
Definition: Environment.h:396
boost::program_options::options_description * m_allOptionsDesc
Definition: Environment.h:377
unsigned int displayVerbosity() const
Definition: Environment.C:449
BasicPdfsBase * m_basicPdfs
Definition: Environment.h:398

Member Function Documentation

boost::program_options::variables_map & QUESO::BaseEnvironment::allOptionsMap ( ) const

Access function to private attribute m_allOptionsMap. It is an instance of boost::program_options::variables_map(), which allows concrete variables to map which store variables in real map.

Definition at line 385 of file Environment.C.

References m_allOptionsMap, queso_deprecated, and queso_require_msg.

Referenced by QUESO::ExperimentModelOptions::getMyOptionValues(), QUESO::SimulationModelOptions::getMyOptionValues(), QUESO::GpmsaComputerModelOptions::getMyOptionValues(), QUESO::StatisticalForwardProblemOptions::getMyOptionValues(), QUESO::StatisticalInverseProblemOptions::getMyOptionValues(), QUESO::MonteCarloSGOptions::getMyOptionValues(), QUESO::EnvironmentOptions::getMyOptionValues(), and QUESO::MetropolisHastingsSGOptions::getMyOptionValues().

386 {
388 
389  queso_require_msg(m_allOptionsMap, "m_allOptionsMap variable is NULL");
390  return *m_allOptionsMap;
391 }
boost::program_options::variables_map * m_allOptionsMap
Definition: Environment.h:378
#define queso_deprecated()
Definition: Defines.h:134
#define queso_require_msg(asserted, msg)
Definition: asserts.h:69
const BasicPdfsBase * QUESO::BaseEnvironment::basicPdfs ( ) const

Access to Basic PDFs.

Definition at line 489 of file Environment.C.

References m_basicPdfs.

490 {
491  return m_basicPdfs;
492 }
BasicPdfsBase * m_basicPdfs
Definition: Environment.h:398
unsigned int QUESO::BaseEnvironment::checkingLevel ( ) const
void QUESO::BaseEnvironment::checkTheParallelEnvironment ( ) const
void QUESO::BaseEnvironment::closeFile ( FilePtrSetStruct filePtrSet,
const std::string &  fileType 
) const

Closes the file.

Definition at line 1083 of file Environment.C.

References QUESO::FilePtrSetStruct::ifsVar, m_subDisplayFile, QUESO::FilePtrSetStruct::ofsVar, queso_error_msg, subDisplayFile(), subRank(), UQ_FILE_EXTENSION_FOR_HDF_FORMAT, UQ_FILE_EXTENSION_FOR_MATLAB_FORMAT, and UQ_FILE_EXTENSION_FOR_TXT_FORMAT.

Referenced by QUESO::GslVector::subReadContents(), QUESO::GslMatrix::subReadContents(), QUESO::GslVector::subWriteContents(), and QUESO::GslMatrix::subWriteContents().

1086 {
1087  std::string fileType(inputFileType);
1088 #ifdef QUESO_HAS_HDF5
1089  // Do nothing
1090 #else
1091  if (fileType == UQ_FILE_EXTENSION_FOR_HDF_FORMAT) {
1092  if (m_subDisplayFile) {
1093  *this->subDisplayFile() << "WARNING in BaseEnvironment::closeFile()"
1094  << ": file format '" << UQ_FILE_EXTENSION_FOR_HDF_FORMAT
1095  << "' has been requested, but this QUESO library has not been built with 'hdf5'"
1096  << ". Code will therefore process the file format '" << UQ_FILE_EXTENSION_FOR_HDF_FORMAT
1097  << "' instead..."
1098  << std::endl;
1099  }
1100  if (this->subRank() == 0) {
1101  std::cerr << "WARNING in BaseEnvironment::closeFile()"
1102  << ": file format '" << UQ_FILE_EXTENSION_FOR_HDF_FORMAT
1103  << "' has been requested, but this QUESO library has not been built with 'hdf5'"
1104  << ". Code will therefore process the file format '" << UQ_FILE_EXTENSION_FOR_HDF_FORMAT
1105  << "' instead..."
1106  << std::endl;
1107  }
1109  }
1110 #endif
1111 
1112  if ((fileType == UQ_FILE_EXTENSION_FOR_MATLAB_FORMAT) ||
1113  (fileType == UQ_FILE_EXTENSION_FOR_TXT_FORMAT)) {
1114  //filePtrSet.ofsVar->close(); // close() crashes on Mac; need to use delete(); why? prudenci 2010/June
1115  delete filePtrSet.ofsVar;
1116  filePtrSet.ofsVar = NULL;
1117 
1118  //filePtrSet.ifsVar->close();
1119  delete filePtrSet.ifsVar;
1120  filePtrSet.ifsVar = NULL;
1121  }
1122 #ifdef QUESO_HAS_HDF5
1123  else if (fileType == UQ_FILE_EXTENSION_FOR_HDF_FORMAT) {
1124  H5Fclose(filePtrSet.h5Var);
1125  }
1126 #endif
1127  else {
1128  queso_error_msg("invalid file type");
1129  }
1130 
1131  return;
1132 }
std::ofstream * subDisplayFile() const
Access function for m_subDisplayFile (displays file on stream).
Definition: Environment.C:320
int subRank() const
Access function for sub-rank.
Definition: Environment.C:287
std::ofstream * m_subDisplayFile
Definition: Environment.h:396
#define UQ_FILE_EXTENSION_FOR_HDF_FORMAT
Definition: Defines.h:104
#define UQ_FILE_EXTENSION_FOR_TXT_FORMAT
Definition: Defines.h:103
#define UQ_FILE_EXTENSION_FOR_MATLAB_FORMAT
Definition: Defines.h:102
#define queso_error_msg(msg)
Definition: asserts.h:47
unsigned int QUESO::BaseEnvironment::displayVerbosity ( ) const

Access function to private attribute m_displayVerbosity. It manages how much information will be release during the use of the QUESO library.

Definition at line 449 of file Environment.C.

References QUESO::EnvOptionsValues::m_displayVerbosity, m_optionsObj, and queso_require_msg.

Referenced by QUESO::AsciiTable< V, M >::AsciiTable(), QUESO::BaseJointPdf< V, M >::BaseJointPdf(), QUESO::BaseMatrixCovarianceFunction< P_V, P_M, Q_V, Q_M >::BaseMatrixCovarianceFunction(), QUESO::BaseOneDGrid< T >::BaseOneDGrid(), QUESO::BaseScalarCdf< T >::BaseScalarCdf(), QUESO::BaseScalarCovarianceFunction< V, M >::BaseScalarCovarianceFunction(), QUESO::BaseVectorCdf< V, M >::BaseVectorCdf(), QUESO::BaseVectorMdf< V, M >::BaseVectorMdf(), QUESO::BaseVectorRealizer< V, M >::BaseVectorRealizer(), QUESO::BaseVectorRV< V, M >::BaseVectorRV(), QUESO::BetaJointPdf< V, M >::BetaJointPdf(), QUESO::BetaVectorRealizer< V, M >::BetaVectorRealizer(), QUESO::BetaVectorRV< V, M >::BetaVectorRV(), QUESO::ConcatenatedVectorRealizer< V, M >::ConcatenatedVectorRealizer(), QUESO::ConcatenatedVectorRV< V, M >::ConcatenatedVectorRV(), QUESO::FullEnvironment::construct(), QUESO::GslVector::cwSetBeta(), QUESO::GslMatrix::determinant(), QUESO::ExperimentModel< S_V, S_M, D_V, D_M >::ExperimentModel(), QUESO::ExperimentStorage< S_V, S_M, D_V, D_M >::ExperimentStorage(), QUESO::ExponentialMatrixCovarianceFunction< P_V, P_M, Q_V, Q_M >::ExponentialMatrixCovarianceFunction(), QUESO::ExponentialScalarCovarianceFunction< V, M >::ExponentialScalarCovarianceFunction(), QUESO::FiniteDistribution::FiniteDistribution(), QUESO::GammaJointPdf< V, M >::GammaJointPdf(), QUESO::GammaVectorRealizer< V, M >::GammaVectorRealizer(), QUESO::GammaVectorRV< V, M >::GammaVectorRV(), QUESO::GaussianJointPdf< V, M >::GaussianJointPdf(), QUESO::GaussianVectorCdf< V, M >::GaussianVectorCdf(), QUESO::GaussianVectorMdf< V, M >::GaussianVectorMdf(), QUESO::GaussianVectorRealizer< V, M >::GaussianVectorRealizer(), QUESO::GaussianVectorRV< V, M >::GaussianVectorRV(), QUESO::GcmExperimentInfo< S_V, S_M, D_V, D_M, P_V, P_M >::GcmExperimentInfo(), QUESO::GcmJointInfo< S_V, S_M, D_V, D_M, P_V, P_M, Q_V, Q_M >::GcmJointInfo(), QUESO::GcmSimulationInfo< S_V, S_M, P_V, P_M, Q_V, Q_M >::GcmSimulationInfo(), QUESO::GcmSimulationTildeInfo< S_V, S_M, P_V, P_M, Q_V, Q_M >::GcmSimulationTildeInfo(), QUESO::GcmTotalInfo< S_V, S_M, D_V, D_M, P_V, P_M, Q_V, Q_M >::GcmTotalInfo(), QUESO::GcmZInfo< S_V, S_M, D_V, D_M, P_V, P_M, Q_V, Q_M >::GcmZInfo(), QUESO::GenericMatrixCovarianceFunction< P_V, P_M, Q_V, Q_M >::GenericMatrixCovarianceFunction(), QUESO::GenericScalarCovarianceFunction< V, M >::GenericScalarCovarianceFunction(), QUESO::GenericVectorRealizer< V, M >::GenericVectorRealizer(), QUESO::GenericVectorRV< V, M >::GenericVectorRV(), QUESO::GpmsaComputerModel< S_V, S_M, D_V, D_M, P_V, P_M, Q_V, Q_M >::GpmsaComputerModel(), QUESO::HessianCovMatricesTKGroup< V, M >::HessianCovMatricesTKGroup(), QUESO::horizontalDistance(), QUESO::GslMatrix::inverse(), QUESO::InverseGammaJointPdf< V, M >::InverseGammaJointPdf(), QUESO::InverseGammaVectorRealizer< V, M >::InverseGammaVectorRealizer(), QUESO::InverseGammaVectorRV< V, M >::InverseGammaVectorRV(), QUESO::GslMatrix::invertMultiply(), QUESO::InvLogitGaussianVectorRV< V, M >::InvLogitGaussianVectorRV(), QUESO::JeffreysJointPdf< V, M >::JeffreysJointPdf(), QUESO::JeffreysVectorRealizer< V, M >::JeffreysVectorRealizer(), QUESO::JeffreysVectorRV< V, M >::JeffreysVectorRV(), QUESO::GslMatrix::lnDeterminant(), QUESO::LogNormalJointPdf< V, M >::LogNormalJointPdf(), QUESO::LogNormalVectorRealizer< V, M >::LogNormalVectorRealizer(), QUESO::LogNormalVectorRV< V, M >::LogNormalVectorRV(), QUESO::MetropolisAdjustedLangevinTK< V, M >::MetropolisAdjustedLangevinTK(), openInputFile(), openOutputFile(), openUnifiedInputFile(), openUnifiedOutputFile(), QUESO::PoweredJointPdf< V, M >::PoweredJointPdf(), QUESO::GslMatrix::rank(), QUESO::SampledScalarCdf< T >::SampledScalarCdf(), QUESO::SampledVectorCdf< V, M >::SampledVectorCdf(), QUESO::SampledVectorMdf< V, M >::SampledVectorMdf(), QUESO::ScaledCovMatrixTKGroup< V, M >::ScaledCovMatrixTKGroup(), QUESO::EnvironmentOptions::scanOptionsValues(), QUESO::SequentialVectorRealizer< V, M >::SequentialVectorRealizer(), QUESO::SimulationModel< S_V, S_M, P_V, P_M, Q_V, Q_M >::SimulationModel(), QUESO::SimulationStorage< S_V, S_M, P_V, P_M, Q_V, Q_M >::SimulationStorage(), QUESO::StdOneDGrid< T >::StdOneDGrid(), QUESO::StdScalarCdf< T >::StdScalarCdf(), QUESO::GslMatrix::svdSolve(), QUESO::TransformedScaledCovMatrixTKGroup< V, M >::TransformedScaledCovMatrixTKGroup(), QUESO::UniformJointPdf< V, M >::UniformJointPdf(), QUESO::UniformOneDGrid< T >::UniformOneDGrid(), QUESO::UniformVectorRealizer< V, M >::UniformVectorRealizer(), QUESO::UniformVectorRV< V, M >::UniformVectorRV(), QUESO::VectorSet< V, M >::VectorSet(), QUESO::VectorSpace< V, M >::VectorSpace(), QUESO::VectorSubset< V, M >::VectorSubset(), QUESO::WignerJointPdf< V, M >::WignerJointPdf(), QUESO::WignerVectorRealizer< V, M >::WignerVectorRealizer(), QUESO::WignerVectorRV< V, M >::WignerVectorRV(), and ~BaseEnvironment().

450 {
451  queso_require_msg(m_optionsObj, "m_optionsObj variable is NULL");
453 }
EnvOptionsValues * m_optionsObj
Definition: Environment.h:402
unsigned int m_displayVerbosity
Verbosity.
#define queso_require_msg(asserted, msg)
Definition: asserts.h:69
bool QUESO::BaseEnvironment::exceptionalCircumstance ( ) const

Decides whether there is an exceptional circumstance.

Definition at line 1142 of file Environment.C.

References m_exceptionalCircumstance.

1143 {
1145 }
const MpiComm & QUESO::BaseEnvironment::fullComm ( ) const

Access function for MpiComm full communicator.

Definition at line 274 of file Environment.C.

References m_fullComm, and queso_require_msg.

Referenced by QUESO::FullEnvironment::construct(), QUESO::EnvironmentOptions::getMyOptionValues(), QUESO::MiscCheckTheParallelEnvironment(), and QUESO::InterpolationSurrogateIOASCII< V, M >::read().

275 {
276  queso_require_msg(m_fullComm, "m_fullComm variable is NULL");
277  return *m_fullComm;
278 }
#define queso_require_msg(asserted, msg)
Definition: asserts.h:69
bool QUESO::BaseEnvironment::fullEnvIsReady ( ) const

Returns whether the full environment class is ready (constructor has successfully been called).

Definition at line 256 of file Environment.C.

References m_fullEnvIsReady.

257 {
258  return m_fullEnvIsReady;
259 }
int QUESO::BaseEnvironment::fullRank ( ) const
std::string QUESO::BaseEnvironment::identifyingString ( ) const

Access function to private attribute m_identifyingString: identifying string.

Definition at line 501 of file Environment.C.

References QUESO::EnvOptionsValues::m_identifyingString, and m_optionsObj.

502 {
504 }
EnvOptionsValues * m_optionsObj
Definition: Environment.h:402
std::string m_identifyingString
Identifying string.
const GetPot & QUESO::BaseEnvironment::input ( ) const
const MpiComm & QUESO::BaseEnvironment::inter0Comm ( ) const

Access function for MpiComm inter0-communicator.

Definition at line 313 of file Environment.C.

References m_inter0Comm, and queso_require_msg.

Referenced by QUESO::ComputeCovCorrBetweenScalarSequences(), and QUESO::ComputeCovCorrMatricesBetweenVectorSequences().

314 {
315  queso_require_msg(m_inter0Comm, "m_inter0Comm variable is NULL");
316  return *m_inter0Comm;
317 }
#define queso_require_msg(asserted, msg)
Definition: asserts.h:69
int QUESO::BaseEnvironment::inter0Rank ( ) const
bool QUESO::BaseEnvironment::isThereInputFile ( ) const

//TODO Not implemented? it is called in examples/validationCycle/tests_old/results_5_25/uqTgaEx4.h.

unsigned int QUESO::BaseEnvironment::numSubEnvironments ( ) const

Access function to the number of sub-environments.

Definition at line 334 of file Environment.C.

References QUESO::EnvOptionsValues::m_numSubEnvironments, m_optionsObj, and queso_require_msg.

Referenced by QUESO::ComputeUnifiedGaussian2dKde(), and QUESO::MiscCheckTheParallelEnvironment().

335 {
336  queso_require_msg(m_optionsObj, "m_optionsObj variable is NULL");
338 }
EnvOptionsValues * m_optionsObj
Definition: Environment.h:402
#define queso_require_msg(asserted, msg)
Definition: asserts.h:69
bool QUESO::BaseEnvironment::openInputFile ( const std::string &  fileName,
const std::string &  fileType,
const std::set< unsigned int > &  allowedSubEnvIds,
FilePtrSetStruct filePtrSet 
) const

Opens an input file.

Definition at line 895 of file Environment.C.

References QUESO::CheckFilePath(), displayVerbosity(), QUESO::FilePtrSetStruct::ifsVar, m_subDisplayFile, queso_error_msg, queso_require_greater_equal_msg, queso_require_msg, subDisplayFile(), subRank(), UQ_ENV_FILENAME_FOR_NO_INPUT_FILE, UQ_FILE_EXTENSION_FOR_HDF_FORMAT, UQ_FILE_EXTENSION_FOR_MATLAB_FORMAT, and UQ_FILE_EXTENSION_FOR_TXT_FORMAT.

Referenced by QUESO::GslVector::subReadContents(), and QUESO::GslMatrix::subReadContents().

900 {
901  std::string fileType(inputFileType);
902 #ifdef QUESO_HAS_HDF5
903  // Do nothing
904 #else
905  if (fileType == UQ_FILE_EXTENSION_FOR_HDF_FORMAT) {
906  if (m_subDisplayFile) {
907  *this->subDisplayFile() << "WARNING in BaseEnvironment::openInputFile()"
908  << ": file format '" << UQ_FILE_EXTENSION_FOR_HDF_FORMAT
909  << "' has been requested, but this QUESO library has not been built with 'hdf5'"
910  << ". Code will therefore process the file format '" << UQ_FILE_EXTENSION_FOR_HDF_FORMAT
911  << "' instead..."
912  << std::endl;
913  }
914  if (this->subRank() == 0) {
915  std::cerr << "WARNING in BaseEnvironment::openInputFile()"
916  << ": file format '" << UQ_FILE_EXTENSION_FOR_HDF_FORMAT
917  << "' has been requested, but this QUESO library has not been built with 'hdf5'"
918  << ". Code will therefore process the file format '" << UQ_FILE_EXTENSION_FOR_HDF_FORMAT
919  << "' instead..."
920  << std::endl;
921  }
923  }
924 #endif
925 
926  bool returnValue = true;
927  filePtrSet.ifsVar = NULL;
928  if ((baseFileName == UQ_ENV_FILENAME_FOR_NO_INPUT_FILE) ||
929  (allowedSubEnvIds.find(this->subId()) == allowedSubEnvIds.end() )) {
930  if ((m_subDisplayFile) && (this->displayVerbosity() >= 10)) {
931  *this->subDisplayFile() << "In BaseEnvironment::openInputFile()"
932  << ": no input file opened with base name '" << baseFileName << "." << fileType
933  << "'"
934  << std::endl;
935  }
936  returnValue = false;
937  }
938  else {
940  // Open file
942  if ((m_subDisplayFile) && (this->displayVerbosity() >= 10)) {
943  *this->subDisplayFile() << "In BaseEnvironment::openInputFile()"
944  << ": opening input file with base name '" << baseFileName << "." << fileType
945  << "'"
946  << std::endl;
947  }
948  if (this->subRank() == 0) {
950  // Verify parent directory exists (for cases when a user
951  // specifies a relative path for the desired output file). prudenci 2010/06/26
953  // std::cout << "checking " << baseFileName+"."+fileType << std::endl;
954  int irtrn = CheckFilePath((baseFileName+"."+fileType).c_str());
955  queso_require_greater_equal_msg(irtrn, 0, "unable to verify input path");
956 
957  if ((fileType == UQ_FILE_EXTENSION_FOR_MATLAB_FORMAT) ||
958  (fileType == UQ_FILE_EXTENSION_FOR_TXT_FORMAT)) {
959  filePtrSet.ifsVar = new std::ifstream((baseFileName+"."+fileType).c_str(),
960  std::ofstream::in);
961  if ((filePtrSet.ifsVar == NULL) || (filePtrSet.ifsVar->is_open() == false)) {
962  std::cerr << "In BaseEnvironment::openInputFile()"
963  << ": failed to open input file with base name '" << baseFileName << "." << fileType
964  << "'"
965  << std::endl;
966  }
967  queso_require_msg(!((filePtrSet.ifsVar == NULL) || (filePtrSet.ifsVar->is_open() == false)), "file with fileName could not be found");
968  }
969 #ifdef QUESO_HAS_HDF5
970  else if (fileType == UQ_FILE_EXTENSION_FOR_HDF_FORMAT) {
971  filePtrSet.h5Var = H5Fopen((baseFileName+"."+fileType).c_str(),
972  H5F_ACC_RDONLY,
973  H5P_DEFAULT);
974  }
975 #endif
976  else {
977  queso_error_msg("invalid file type");
978  }
979  }
980  else {
981  returnValue = false;
982  }
983  //this->subComm().Barrier(); // prudenci-2011-01-17
984  }
985 
986  return returnValue;
987 }
#define UQ_ENV_FILENAME_FOR_NO_INPUT_FILE
std::ofstream * subDisplayFile() const
Access function for m_subDisplayFile (displays file on stream).
Definition: Environment.C:320
#define queso_require_greater_equal_msg(expr1, expr2, msg)
Definition: asserts.h:78
int subRank() const
Access function for sub-rank.
Definition: Environment.C:287
int CheckFilePath(const char *path)
std::ofstream * m_subDisplayFile
Definition: Environment.h:396
#define UQ_FILE_EXTENSION_FOR_HDF_FORMAT
Definition: Defines.h:104
#define UQ_FILE_EXTENSION_FOR_TXT_FORMAT
Definition: Defines.h:103
unsigned int displayVerbosity() const
Definition: Environment.C:449
#define UQ_FILE_EXTENSION_FOR_MATLAB_FORMAT
Definition: Defines.h:102
#define queso_require_msg(asserted, msg)
Definition: asserts.h:69
#define queso_error_msg(msg)
Definition: asserts.h:47
bool QUESO::BaseEnvironment::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 at line 520 of file Environment.C.

References QUESO::CheckFilePath(), displayVerbosity(), m_subDisplayFile, QUESO::FilePtrSetStruct::ofsVar, queso_error_msg, queso_require_greater_equal_msg, queso_require_msg, subDisplayFile(), subId(), subIdString(), subRank(), UQ_ENV_FILENAME_FOR_NO_OUTPUT_FILE, UQ_FILE_EXTENSION_FOR_HDF_FORMAT, UQ_FILE_EXTENSION_FOR_MATLAB_FORMAT, and UQ_FILE_EXTENSION_FOR_TXT_FORMAT.

Referenced by QUESO::GpmsaComputerModel< S_V, S_M, D_V, D_M, P_V, P_M, Q_V, Q_M >::GpmsaComputerModel(), QUESO::GslVector::subWriteContents(), and QUESO::GslMatrix::subWriteContents().

526 {
527  std::string fileType(inputFileType);
528 #ifdef QUESO_HAS_HDF5
529  // Do nothing
530 #else
531  if (fileType == UQ_FILE_EXTENSION_FOR_HDF_FORMAT) {
532  if (m_subDisplayFile) {
533  *this->subDisplayFile() << "WARNING in BaseEnvironment::openOutputFile()"
534  << ": file format '" << UQ_FILE_EXTENSION_FOR_HDF_FORMAT
535  << "' has been requested, but this QUESO library has not been built with 'hdf5'"
536  << ". Code will therefore process the file format '" << UQ_FILE_EXTENSION_FOR_HDF_FORMAT
537  << "' instead..."
538  << std::endl;
539  }
540  if (this->subRank() == 0) {
541  std::cerr << "WARNING in BaseEnvironment::openOutputFile()"
542  << ": file format '" << UQ_FILE_EXTENSION_FOR_HDF_FORMAT
543  << "' has been requested, but this QUESO library has not been built with 'hdf5'"
544  << ". Code will therefore process the file format '" << UQ_FILE_EXTENSION_FOR_HDF_FORMAT
545  << "' instead..."
546  << std::endl;
547  }
549  }
550 #endif
551 
552  bool returnValue = true;
553  filePtrSet.ofsVar = NULL;
554  if ((baseFileName == UQ_ENV_FILENAME_FOR_NO_OUTPUT_FILE) ||
555  (allowedSubEnvIds.find(this->subId()) == allowedSubEnvIds.end() )) {
556  if ((m_subDisplayFile) && (this->displayVerbosity() > 10)) { // output debug
557  *this->subDisplayFile() << "In BaseEnvironment::openOutputFile()"
558  << ", subId = " << this->subId()
559  << ": no output file opened with base name '" << baseFileName << "." << fileType
560  << "'"
561  << ", writeOver = " << writeOver
562  << std::endl;
563  }
564  returnValue = false;
565  }
566  else {
568  // Open file
570  if ((m_subDisplayFile) && (this->displayVerbosity() > 10)) { // output debug
571  *this->subDisplayFile() << "In BaseEnvironment::openOutputFile()"
572  << ", subId = " << this->subId()
573  << ": opening output file with base name '" << baseFileName << "." << fileType
574  << "'"
575  << ", writeOver = " << writeOver
576  << std::endl;
577  }
578 
579  if (this->subRank() == 0) {
580 #if 0
581  std::cout << "In BaseEnvironment::openOutputFile()"
582  << ": opening output file with base name '" << baseFileName << "." << fileType
583  << "'"
584  << ", writeOver = " << writeOver
585  << std::endl;
586 #endif
587 
589  // Verify parent directory exists (for cases when a user
590  // specifies a relative path for the desired output file).
592  // std::cout << "checking " << baseFileName+"_sub"+this->subIdString()+"."+fileType << std::endl;
593  if ((m_subDisplayFile) && (this->displayVerbosity() > 10)) { // output debug
594  *this->subDisplayFile() << "In BaseEnvironment::openOutputFile()"
595  << ", subId = " << this->subId()
596  << ", trying to open output file with base name '" << baseFileName << "." << fileType
597  << "'"
598  << ", writeOver = " << writeOver
599  << ": calling CheckFilePath()..."
600  << std::endl;
601  }
602  int irtrn = CheckFilePath((baseFileName+"_sub"+this->subIdString()+"."+fileType).c_str());
603  if ((m_subDisplayFile) && (this->displayVerbosity() > 10)) { // output debug
604  *this->subDisplayFile() << "In BaseEnvironment::openOutputFile()"
605  << ", subId = " << this->subId()
606  << ", trying to open output file with base name '" << baseFileName << "." << fileType
607  << "'"
608  << ", writeOver = " << writeOver
609  << ": returned from CheckFilePath() with irtrn = " << irtrn
610  << std::endl;
611  }
612  queso_require_greater_equal_msg(irtrn, 0, "unable to verify output path");
613 
614  if (writeOver) {
616  // Write over an eventual pre-existing file
618  if ((fileType == UQ_FILE_EXTENSION_FOR_MATLAB_FORMAT) ||
619  (fileType == UQ_FILE_EXTENSION_FOR_TXT_FORMAT)) {
620  filePtrSet.ofsVar = new std::ofstream((baseFileName+"_sub"+this->subIdString()+"."+fileType).c_str(),
621  std::ofstream::out | std::ofstream::trunc);
622  }
623  else if (fileType == UQ_FILE_EXTENSION_FOR_HDF_FORMAT) {
624  queso_error_msg("hdf file type not supported yet");
625  }
626  else {
627  queso_error_msg("invalid file type");
628  }
629  if ((m_subDisplayFile) && (this->displayVerbosity() > 10)) { // output debug
630  *this->subDisplayFile() << "In BaseEnvironment::openOutputFile()"
631  << ": just opened output file with base name '" << baseFileName << "." << fileType
632  << "'"
633  << ", writeOver = " << writeOver
634  << ", options 'out|trunc'"
635  << ", osfvar = " << filePtrSet.ofsVar
636  << std::endl;
637  }
638  }
639  else {
641  // Write at the end of an eventual pre-existing file
643  if ((fileType == UQ_FILE_EXTENSION_FOR_MATLAB_FORMAT) ||
644  (fileType == UQ_FILE_EXTENSION_FOR_TXT_FORMAT)) {
645 #if 0
646  filePtrSet.ofsVar = new std::ofstream((baseFileName+"_sub"+this->subIdString()+"."+fileType).c_str(),
647  std::ofstream::in);
648  std::cout << "filePtrSet.ofsVar(1) = " << filePtrSet.ofsVar << std::endl;
649  if (filePtrSet.ofsVar) std::cout << "filePtrSet.ofsVar(1)->is_open() = " << filePtrSet.ofsVar->is_open() << std::endl;
650  if (filePtrSet.ofsVar) delete filePtrSet.ofsVar;
651 #endif
652  // 'm' and Ranger nodes behave differently on ofstream constructor... prudenci 2010/03/05
653  filePtrSet.ofsVar = new std::ofstream((baseFileName+"_sub"+this->subIdString()+"."+fileType).c_str(),
654  std::ofstream::out /*| std::ofstream::in*/ | std::ofstream::app);
655  }
656 #ifdef QUESO_HAS_HDF5
657  else if (fileType == UQ_FILE_EXTENSION_FOR_HDF_FORMAT) {
658  std::string fullFileName =
659  baseFileName+"_sub"+this->subIdString()+"."+fileType;
660 
661  // Use H5F_ACC_EXCL because not overwriting, so fail on existing file
662  filePtrSet.h5Var = H5Fcreate(fullFileName.c_str(),
663  H5F_ACC_EXCL,
664  H5P_DEFAULT,
665  H5P_DEFAULT);
666 
668  filePtrSet.h5Var, 0,
669  "error opening file `" << fullFileName << "`");
670  }
671 #endif
672  else {
673  queso_error_msg("invalid file type");
674  }
675  if ((m_subDisplayFile) && (this->displayVerbosity() > 10)) { // output debug
676  *this->subDisplayFile() << "In BaseEnvironment::openOutputFile()"
677  << ": just opened output file with base name '" << baseFileName << "." << fileType
678  << "'"
679  << ", writeOver = " << writeOver
680  << ", options 'out|in|app'"
681  << ", osfvar = " << filePtrSet.ofsVar
682  << std::endl;
683  }
684 
685  if (fileType == UQ_FILE_EXTENSION_FOR_MATLAB_FORMAT) {
686  //std::cout << "filePtrSet.ofsVar(2) = " << filePtrSet.ofsVar << std::endl;
687  //if (filePtrSet.ofsVar) std::cout << "filePtrSet.ofsVar(2)->is_open() = " << filePtrSet.ofsVar->is_open() << std::endl;
688  if ((filePtrSet.ofsVar == NULL ) ||
689  (filePtrSet.ofsVar->is_open() == false)) {
690  //std::cout << "Retrying 1..." << std::endl;
691  delete filePtrSet.ofsVar;
692  filePtrSet.ofsVar = new std::ofstream((baseFileName+"_sub"+this->subIdString()+"."+fileType).c_str(),
693  std::ofstream::out | std::ofstream::trunc);
694  if ((m_subDisplayFile) && (this->displayVerbosity() > 10)) { // output debug
695  *this->subDisplayFile() << "In BaseEnvironment::openOutputFile()"
696  << ": just opened output file with base name '" << baseFileName << "." << fileType
697  << "'"
698  << ", writeOver = " << writeOver
699  << ", options 'out|trunc'"
700  << ", osfvar = " << filePtrSet.ofsVar
701  << std::endl;
702  }
703  }
704  } // only for matlab formats
705  }
706 
707  // Check the file actually opened
708  if ((fileType == UQ_FILE_EXTENSION_FOR_MATLAB_FORMAT) ||
709  (fileType == UQ_FILE_EXTENSION_FOR_TXT_FORMAT)) {
711  (filePtrSet.ofsVar && filePtrSet.ofsVar->is_open()),
712  "failed to open output file");
713  }
714  }
715  else {
716  returnValue = false;
717  }
718  //this->subComm().Barrier(); // prudenci-2011-01-17
719  }
720 
721  return returnValue;
722 }
std::ofstream * subDisplayFile() const
Access function for m_subDisplayFile (displays file on stream).
Definition: Environment.C:320
#define queso_require_greater_equal_msg(expr1, expr2, msg)
Definition: asserts.h:78
int subRank() const
Access function for sub-rank.
Definition: Environment.C:287
int CheckFilePath(const char *path)
std::ofstream * m_subDisplayFile
Definition: Environment.h:396
#define UQ_FILE_EXTENSION_FOR_HDF_FORMAT
Definition: Defines.h:104
#define UQ_FILE_EXTENSION_FOR_TXT_FORMAT
Definition: Defines.h:103
unsigned int subId() const
Access function to the number of each sub-environment Id: m_subId.
Definition: Environment.C:341
const std::string & subIdString() const
Access to the attribute m_subIdString; which stores the string for the sub-environment, and it will be used, for instance, to create the output files for each sub-environment.
Definition: Environment.C:347
unsigned int displayVerbosity() const
Definition: Environment.C:449
#define UQ_FILE_EXTENSION_FOR_MATLAB_FORMAT
Definition: Defines.h:102
#define queso_require_msg(asserted, msg)
Definition: asserts.h:69
#define queso_error_msg(msg)
Definition: asserts.h:47
#define UQ_ENV_FILENAME_FOR_NO_OUTPUT_FILE
bool QUESO::BaseEnvironment::openUnifiedInputFile ( const std::string &  fileName,
const std::string &  fileType,
FilePtrSetStruct filePtrSet 
) const

Opens the unified input file.

Definition at line 990 of file Environment.C.

References QUESO::CheckFilePath(), displayVerbosity(), QUESO::FilePtrSetStruct::ifsVar, m_subDisplayFile, queso_error_msg, queso_require_greater_equal_msg, queso_require_msg, subDisplayFile(), subRank(), UQ_ENV_FILENAME_FOR_NO_INPUT_FILE, UQ_FILE_EXTENSION_FOR_HDF_FORMAT, UQ_FILE_EXTENSION_FOR_MATLAB_FORMAT, and UQ_FILE_EXTENSION_FOR_TXT_FORMAT.

994 {
995  std::string fileType(inputFileType);
996 #ifdef QUESO_HAS_HDF5
997  // Do nothing
998 #else
999  if (fileType == UQ_FILE_EXTENSION_FOR_HDF_FORMAT) {
1000  if (m_subDisplayFile) {
1001  *this->subDisplayFile() << "WARNING in BaseEnvironment::openUnifiedInputFile()"
1002  << ": file format '" << UQ_FILE_EXTENSION_FOR_HDF_FORMAT
1003  << "' has been requested, but this QUESO library has not been built with 'hdf5'"
1004  << ". Code will therefore process the file format '" << UQ_FILE_EXTENSION_FOR_HDF_FORMAT
1005  << "' instead..."
1006  << std::endl;
1007  }
1008  if (this->subRank() == 0) {
1009  std::cerr << "WARNING in BaseEnvironment::openUnifiedInputFile()"
1010  << ": file format '" << UQ_FILE_EXTENSION_FOR_HDF_FORMAT
1011  << "' has been requested, but this QUESO library has not been built with 'hdf5'"
1012  << ". Code will therefore process the file format '" << UQ_FILE_EXTENSION_FOR_HDF_FORMAT
1013  << "' instead..."
1014  << std::endl;
1015  }
1017  }
1018 #endif
1019 
1020  bool returnValue = true;
1021  filePtrSet.ifsVar = NULL;
1022  if (baseFileName == UQ_ENV_FILENAME_FOR_NO_INPUT_FILE) {
1023  if ((m_subDisplayFile) && (this->displayVerbosity() >= 10)) {
1024  *this->subDisplayFile() << "In BaseEnvironment::openUnifiedInputFile()"
1025  << ": no input file opened with base name '" << baseFileName << "." << fileType
1026  << "'"
1027  << std::endl;
1028  }
1029  returnValue = false;
1030  }
1031  else {
1033  // Open file
1035  if ((m_subDisplayFile) && (this->displayVerbosity() >= 10)) {
1036  *this->subDisplayFile() << "In BaseEnvironment::openUnifiedInputFile()"
1037  << ": opening input file with base name '" << baseFileName << "." << fileType
1038  << "'"
1039  << std::endl;
1040  }
1041  if (this->subRank() == 0) { // Needed ???????? prudenci 2010-11-11
1043  // Verify parent directory exists (for cases when a user
1044  // specifies a relative path for the desired output file). prudenci 2010/06/26
1046  // std::cout << "checking " << baseFileName+"."+fileType << std::endl;
1047  int irtrn = CheckFilePath((baseFileName+"."+fileType).c_str());
1048  queso_require_greater_equal_msg(irtrn, 0, "unable to verify input path");
1049 
1050  if ((fileType == UQ_FILE_EXTENSION_FOR_MATLAB_FORMAT) ||
1051  (fileType == UQ_FILE_EXTENSION_FOR_TXT_FORMAT)) {
1052  filePtrSet.ifsVar = new std::ifstream((baseFileName+"."+fileType).c_str(),
1053  std::ofstream::in);
1054  if ((filePtrSet.ifsVar == NULL) || (filePtrSet.ifsVar->is_open() == false)) {
1055  std::cerr << "In BaseEnvironment::openUnifiedInputFile()"
1056  << ": failed to open input file with base name '" << baseFileName << "." << fileType
1057  << "'"
1058  << std::endl;
1059  }
1060  queso_require_msg(!((filePtrSet.ifsVar == NULL) || (filePtrSet.ifsVar->is_open() == false)), "file with fileName could not be found");
1061  }
1062 #ifdef QUESO_HAS_HDF5
1063  else if (fileType == UQ_FILE_EXTENSION_FOR_HDF_FORMAT) {
1064  filePtrSet.h5Var = H5Fopen((baseFileName+"."+fileType).c_str(),
1065  H5F_ACC_RDONLY,
1066  H5P_DEFAULT);
1067  }
1068 #endif
1069  else {
1070  queso_error_msg("invalid file type");
1071  }
1072  }
1073  //else {
1074  // returnValue = false;
1075  //}
1076  //this->subComm().Barrier();
1077  }
1078 
1079  return returnValue;
1080 }
#define UQ_ENV_FILENAME_FOR_NO_INPUT_FILE
std::ofstream * subDisplayFile() const
Access function for m_subDisplayFile (displays file on stream).
Definition: Environment.C:320
#define queso_require_greater_equal_msg(expr1, expr2, msg)
Definition: asserts.h:78
int subRank() const
Access function for sub-rank.
Definition: Environment.C:287
int CheckFilePath(const char *path)
std::ofstream * m_subDisplayFile
Definition: Environment.h:396
#define UQ_FILE_EXTENSION_FOR_HDF_FORMAT
Definition: Defines.h:104
#define UQ_FILE_EXTENSION_FOR_TXT_FORMAT
Definition: Defines.h:103
unsigned int displayVerbosity() const
Definition: Environment.C:449
#define UQ_FILE_EXTENSION_FOR_MATLAB_FORMAT
Definition: Defines.h:102
#define queso_require_msg(asserted, msg)
Definition: asserts.h:69
#define queso_error_msg(msg)
Definition: asserts.h:47
bool QUESO::BaseEnvironment::openUnifiedOutputFile ( const std::string &  fileName,
const std::string &  fileType,
bool  writeOver,
FilePtrSetStruct filePtrSet 
) const

Opens a unified output file, that will contain data from all sub-environments.

Definition at line 725 of file Environment.C.

References QUESO::CheckFilePath(), displayVerbosity(), m_subDisplayFile, QUESO::FilePtrSetStruct::ofsVar, queso_error_msg, queso_require_greater_equal_msg, queso_require_msg, subDisplayFile(), subRank(), UQ_FILE_EXTENSION_FOR_HDF_FORMAT, UQ_FILE_EXTENSION_FOR_MATLAB_FORMAT, and UQ_FILE_EXTENSION_FOR_TXT_FORMAT.

730 {
731  std::string fileType(inputFileType);
732 #ifdef QUESO_HAS_HDF5
733  // Do nothing
734 #else
735  if (fileType == UQ_FILE_EXTENSION_FOR_HDF_FORMAT) {
736  if (m_subDisplayFile) {
737  *this->subDisplayFile() << "WARNING in BaseEnvironment::openUnifiedOutputFile()"
738  << ": file format '" << UQ_FILE_EXTENSION_FOR_HDF_FORMAT
739  << "' has been requested, but this QUESO library has not been built with 'hdf5'"
740  << ". Code will therefore process the file format '" << UQ_FILE_EXTENSION_FOR_HDF_FORMAT
741  << "' instead..."
742  << std::endl;
743  }
744  if (this->subRank() == 0) {
745  std::cerr << "WARNING in BaseEnvironment::openUnifiedOutputFile()"
746  << ": file format '" << UQ_FILE_EXTENSION_FOR_HDF_FORMAT
747  << "' has been requested, but this QUESO library has not been built with 'hdf5'"
748  << ". Code will therefore process the file format '" << UQ_FILE_EXTENSION_FOR_HDF_FORMAT
749  << "' instead..."
750  << std::endl;
751  }
753  }
754 #endif
755 
756  bool returnValue = true;
757  filePtrSet.ofsVar = NULL;
758  if (baseFileName == ".") {
759  if ((m_subDisplayFile) && (this->displayVerbosity() > 10)) { // output debug
760  *this->subDisplayFile() << "In BaseEnvironment::openUnifiedOutputFile()"
761  << ": no unified output file opened with base name '" << baseFileName << "." << fileType
762  << "'"
763  << ", writeOver = " << writeOver
764  << std::endl;
765  }
766  returnValue = false;
767  }
768  else {
770  // Open file
772  if ((m_subDisplayFile) && (this->displayVerbosity() > 10)) { // output debug
773  *this->subDisplayFile() << "In BaseEnvironment::openUnifiedOutputFile()"
774  << ": opening unified output file with base name '" << baseFileName << "." << fileType
775  << "'"
776  << ", writeOver = " << writeOver
777  << std::endl;
778  }
779 
780 
781  //if ((this->subRank () == 0) &&
782  // (this->inter0Rank() == 0)) {
783 #if 0
784  std::cout << "In BaseEnvironment::openUnifiedOutputFile()"
785  << ": opening output file with base name '" << baseFileName << "." << fileType
786  << "'"
787  << ", writeOver = " << writeOver
788  << std::endl;
789 #endif
790  // Verify parent directory exists (for cases when a user
792  // specifies a relative path for the desired output file). prudenci 2010/06/26
794  // std::cout << "checking " << baseFileName+"."+fileType << std::endl;
795  int irtrn = CheckFilePath((baseFileName+"."+fileType).c_str());
796  queso_require_greater_equal_msg(irtrn, 0, "unable to verify output path");
797 
798  if (writeOver) {
800  // Write over an eventual pre-existing file
802  if ((fileType == UQ_FILE_EXTENSION_FOR_MATLAB_FORMAT) ||
803  (fileType == UQ_FILE_EXTENSION_FOR_TXT_FORMAT)) {
804  filePtrSet.ofsVar = new std::ofstream((baseFileName+"."+fileType).c_str(),
805  std::ofstream::out | std::ofstream::trunc);
806  }
807 #ifdef QUESO_HAS_HDF5
808  else if (fileType == UQ_FILE_EXTENSION_FOR_HDF_FORMAT) {
809  filePtrSet.h5Var = H5Fcreate((baseFileName+"."+fileType).c_str(),
810  H5F_ACC_TRUNC,
811  H5P_DEFAULT,
812  H5P_DEFAULT);
813  }
814 #endif
815  else {
816  queso_error_msg("invalid file type");
817  }
818  if ((m_subDisplayFile) && (this->displayVerbosity() > 10)) { // output debug
819  *this->subDisplayFile() << "In BaseEnvironment::openUnifiedOutputFile()"
820  << ": just opened output file with base name '" << baseFileName << "." << fileType
821  << "'"
822  << ", writeOver = " << writeOver
823  << ", options 'out|trunc'"
824  << ", osfvar = " << filePtrSet.ofsVar
825  << std::endl;
826  }
827  }
828  else {
830  // Write at the end of an eventual pre-existing file
831  // 'm' and Ranger nodes behave differently on ofstream constructor... prudenci 2010/03/05
833  if ((fileType == UQ_FILE_EXTENSION_FOR_MATLAB_FORMAT) ||
834  (fileType == UQ_FILE_EXTENSION_FOR_TXT_FORMAT)) {
835  filePtrSet.ofsVar = new std::ofstream((baseFileName+"."+fileType).c_str(),
836  std::ofstream::out /*| std::ofstream::in*/ | std::ofstream::app);
837  }
838 #ifdef QUESO_HAS_HDF5
839  else if (fileType == UQ_FILE_EXTENSION_FOR_HDF_FORMAT) {
840  filePtrSet.h5Var = H5Fcreate((baseFileName+"."+fileType).c_str(), // TEMPORARY - FIX ME
841  H5F_ACC_TRUNC,
842  H5P_DEFAULT,
843  H5P_DEFAULT);
844 
845  // m_worldRank,
846  // "BaseEnvironment::openUnifiedOutputFile(), writeOver=false",
847  // "hdf file type not supported yet");
848  }
849 #endif
850  else {
851  queso_error_msg("invalid file type");
852  }
853  if ((m_subDisplayFile) && (this->displayVerbosity() > 10)) { // output debug
854  *this->subDisplayFile() << "In BaseEnvironment::openUnifiedOutputFile()"
855  << ": just opened output file with base name '" << baseFileName << "." << fileType
856  << "'"
857  << ", writeOver = " << writeOver
858  << ", options 'out|in|app'"
859  << ", osfvar = " << filePtrSet.ofsVar
860  << std::endl;
861  }
862  if ((filePtrSet.ofsVar == NULL ) ||
863  (filePtrSet.ofsVar->is_open() == false)) {
864 #if 0
865  std::cout << "Retrying 2..." << std::endl;
866 #endif
867  delete filePtrSet.ofsVar;
868  filePtrSet.ofsVar = new std::ofstream((baseFileName+"."+fileType).c_str(),
869  std::ofstream::out | std::ofstream::trunc);
870  if ((m_subDisplayFile) && (this->displayVerbosity() > 10)) { // output debug
871  *this->subDisplayFile() << "In BaseEnvironment::openUnifiedOutputFile()"
872  << ": just opened output file with base name '" << baseFileName << "." << fileType
873  << "'"
874  << ", writeOver = " << writeOver
875  << ", options 'out|trunc'"
876  << ", osfvar = " << filePtrSet.ofsVar
877  << std::endl;
878  }
879  }
880  }
881  if (filePtrSet.ofsVar == NULL) {
882  std::cerr << "In BaseEnvironment::openUnifiedOutputFile()"
883  << ": failed to open unified output file with base name '" << baseFileName << "." << fileType
884  << "'"
885  << std::endl;
886  }
887  queso_require_msg((filePtrSet.ofsVar && filePtrSet.ofsVar->is_open()), "failed to open output file");
888  //}
889  }
890 
891  return returnValue;
892 }
std::ofstream * subDisplayFile() const
Access function for m_subDisplayFile (displays file on stream).
Definition: Environment.C:320
#define queso_require_greater_equal_msg(expr1, expr2, msg)
Definition: asserts.h:78
int subRank() const
Access function for sub-rank.
Definition: Environment.C:287
int CheckFilePath(const char *path)
std::ofstream * m_subDisplayFile
Definition: Environment.h:396
#define UQ_FILE_EXTENSION_FOR_HDF_FORMAT
Definition: Defines.h:104
#define UQ_FILE_EXTENSION_FOR_TXT_FORMAT
Definition: Defines.h:103
unsigned int displayVerbosity() const
Definition: Environment.C:449
#define UQ_FILE_EXTENSION_FOR_MATLAB_FORMAT
Definition: Defines.h:102
#define queso_require_msg(asserted, msg)
Definition: asserts.h:69
#define queso_error_msg(msg)
Definition: asserts.h:47
std::string QUESO::BaseEnvironment::optionsInputFileName ( ) const

Access to the attribute m_optionsInputFileName, which stores the name of the input file passed by the user to QUESO.

Definition at line 353 of file Environment.C.

References m_optionsInputFileAccessState, and m_optionsInputFileName.

Referenced by QUESO::EnvironmentOptions::EnvironmentOptions(), QUESO::ExperimentModel< S_V, S_M, D_V, D_M >::ExperimentModel(), QUESO::ExperimentModelOptions::ExperimentModelOptions(), QUESO::GpmsaComputerModel< S_V, S_M, D_V, D_M, P_V, P_M, Q_V, Q_M >::GpmsaComputerModel(), QUESO::GpmsaComputerModelOptions::GpmsaComputerModelOptions(), QUESO::GPMSAFactory< V, M >::GPMSAFactory(), QUESO::GPMSAOptions::GPMSAOptions(), QUESO::InfiniteDimensionalMCMCSamplerOptions::InfiniteDimensionalMCMCSamplerOptions(), QUESO::MetropolisHastingsSGOptions::MetropolisHastingsSGOptions(), QUESO::MonteCarloSGOptions::MonteCarloSGOptions(), QUESO::MLSamplingLevelOptions::scanOptionsValues(), QUESO::SimulationModel< S_V, S_M, P_V, P_M, Q_V, Q_M >::SimulationModel(), QUESO::SimulationModelOptions::SimulationModelOptions(), QUESO::StatisticalForwardProblemOptions::StatisticalForwardProblemOptions(), QUESO::StatisticalInverseProblem< P_V, P_M >::StatisticalInverseProblem(), and QUESO::StatisticalInverseProblemOptions::StatisticalInverseProblemOptions().

354 {
356  return m_optionsInputFileName;
357  }
358  else {
359  return "";
360  }
361 }
std::string m_optionsInputFileName
Definition: Environment.h:374
std::string QUESO::BaseEnvironment::platformName ( ) const

Access to the platform name.

Definition at line 495 of file Environment.C.

References m_optionsObj, and QUESO::EnvOptionsValues::m_platformName.

496 {
498 }
EnvOptionsValues * m_optionsObj
Definition: Environment.h:402
std::string m_platformName
Platform name.
virtual void QUESO::BaseEnvironment::print ( std::ostream &  os) const
pure virtual
void QUESO::BaseEnvironment::resetIdentifyingString ( const std::string &  newString)

Reset private attribute m_identifyingString with the value newString.

Definition at line 507 of file Environment.C.

References QUESO::EnvOptionsValues::m_identifyingString, and m_optionsObj.

508 {
509  m_optionsObj->m_identifyingString = newString;
510  return;
511 }
EnvOptionsValues * m_optionsObj
Definition: Environment.h:402
std::string m_identifyingString
Identifying string.
void QUESO::BaseEnvironment::resetSeed ( int  newSeedOption)

Reset RNG seed.

Definition at line 482 of file Environment.C.

References m_rngObject, and QUESO::RngBase::resetSeed().

483 {
484  m_rngObject->resetSeed(newSeedOption);
485  return;
486 }
virtual void resetSeed(int newSeed)
Resets the seed with value newSeed.
Definition: RngBase.C:48
const RngBase * QUESO::BaseEnvironment::rngObject ( ) const
void QUESO::BaseEnvironment::scanInputFileForMyOptions ( const boost::program_options::options_description &  optionsDesc) const

This method scans the input file provided by the user to QUESO.

It checks if no input file is passed and updates the private attribute m_allOptionsDesc, which keeps all the options.

Definition at line 396 of file Environment.C.

References m_allOptionsDesc, m_allOptionsMap, m_optionsInputFileName, queso_deprecated, queso_require_msg, and queso_require_not_equal_to_msg.

Referenced by QUESO::ExperimentModelOptions::scanOptionsValues(), QUESO::SimulationModelOptions::scanOptionsValues(), QUESO::GpmsaComputerModelOptions::scanOptionsValues(), QUESO::StatisticalForwardProblemOptions::scanOptionsValues(), QUESO::StatisticalInverseProblemOptions::scanOptionsValues(), QUESO::MonteCarloSGOptions::scanOptionsValues(), QUESO::EnvironmentOptions::scanOptionsValues(), and QUESO::MetropolisHastingsSGOptions::scanOptionsValues().

397 {
399 
400 #ifdef UQ_USES_COMMAND_LINE_OPTIONS
401  // If you want to use command line options, the following line does *not* work outside 'main.C',
402  // e.g., in the constructor of FullEnvironment:
403  // Line: boost::program_options::store(boost::program_options::parse_command_line(argc, argv, *m_allOptionsDesc), *m_allOptionsMap);
404  //
405  // Instead, put the following three lines *immediately after* instantianting the UQ environment
406  // variable "FullEnvironment* env":
407  // Line 1: boost::program_options::store(boost::program_options::parse_command_line(argc, argv, env->allOptionsDesc()), env->allOptionsMap());
408  // Line 2: boost::program_options::notify(env->allOptionsMap());
409  // Line 3: env->getMyOptionValues();
410 #endif
411 
412 #ifdef QUESO_MEMORY_DEBUGGING
413  std::cout << "Entering BaseEnv::scanInputFileForMyOptions()" << std::endl;
414 #endif
415 
416  queso_require_msg(m_allOptionsDesc, "m_allOptionsDesc variable is NULL");
417  m_allOptionsDesc->add(optionsDesc);
418  //if (m_subDisplayFile) {
419  // *m_subDisplayFile << *m_allOptionsDesc
420  // << std::endl;
421  //}
422 
424  std::string("m_optionsInputFileName is 'nothing'"));
425  //std::ifstream ifs(m_optionsInputFileName.c_str());
426  std::ifstream* ifs = new std::ifstream(m_optionsInputFileName.c_str());
427 #ifdef QUESO_MEMORY_DEBUGGING
428  std::cout << "in BaseEnv::scanInputFileForMyOptions(), before store(a)" << std::endl;
429 #endif
430 
431  queso_require_msg(m_allOptionsMap, "m_allOptionsMap variable is NULL");
432  boost::program_options::store(boost::program_options::parse_config_file(*ifs, *m_allOptionsDesc, true), *m_allOptionsMap);
433 #ifdef QUESO_MEMORY_DEBUGGING
434  std::cout << "in BaseEnv::scanInputFileForMyOptions(), after store(a)" << std::endl;
435 #endif
436  boost::program_options::notify(*m_allOptionsMap);
437 
438  //ifs.close();
439  delete ifs;
440 #ifdef QUESO_MEMORY_DEBUGGING
441  std::cout << "Leaving BaseEnv::scanInputFileForMyOptions()" << std::endl;
442 #endif
443 
444  return;
445 }
std::string m_optionsInputFileName
Definition: Environment.h:374
boost::program_options::variables_map * m_allOptionsMap
Definition: Environment.h:378
boost::program_options::options_description * m_allOptionsDesc
Definition: Environment.h:377
#define queso_deprecated()
Definition: Defines.h:134
#define queso_require_not_equal_to_msg(expr1, expr2, msg)
Definition: asserts.h:74
#define queso_require_msg(asserted, msg)
Definition: asserts.h:69
int QUESO::BaseEnvironment::seed ( ) const

Access to the RNG seed.

Definition at line 476 of file Environment.C.

References m_rngObject, and QUESO::RngBase::seed().

477 {
478  return m_rngObject->seed();
479 }
int seed() const
Sets the seed.
Definition: RngBase.C:42
const MpiComm & QUESO::BaseEnvironment::selfComm ( ) const

Access function for MpiComm self-communicator.

Definition at line 300 of file Environment.C.

References m_selfComm, and queso_require_msg.

301 {
302  queso_require_msg(m_selfComm, "m_selfComm variable is NULL");
303  return *m_selfComm;
304 }
#define queso_require_msg(asserted, msg)
Definition: asserts.h:69
void QUESO::BaseEnvironment::setExceptionalCircumstance ( bool  value) const

Set an exceptional circumstance.

Definition at line 1135 of file Environment.C.

References m_exceptionalCircumstance.

1136 {
1137  m_exceptionalCircumstance = value;
1138  return;
1139 }
void QUESO::BaseEnvironment::setOptionsInputFileAccessState ( bool  newState) const

Definition at line 364 of file Environment.C.

References m_optionsInputFileAccessState.

365 {
367 
368  return;
369 }
const MpiComm & QUESO::BaseEnvironment::subComm ( ) const

Access function for MpiComm sub communicator.

Definition at line 293 of file Environment.C.

References m_subComm, and queso_require_msg.

Referenced by QUESO::MiscCheckTheParallelEnvironment().

294 {
295  queso_require_msg(m_subComm, "m_subComm variable is NULL");
296  return *m_subComm;
297 }
#define queso_require_msg(asserted, msg)
Definition: asserts.h:69
std::ofstream * QUESO::BaseEnvironment::subDisplayFile ( ) const

Access function for m_subDisplayFile (displays file on stream).

Definition at line 320 of file Environment.C.

References m_subDisplayFile.

Referenced by QUESO::AsciiTable< V, M >::AsciiTable(), QUESO::BaseJointPdf< V, M >::BaseJointPdf(), QUESO::BaseMatrixCovarianceFunction< P_V, P_M, Q_V, Q_M >::BaseMatrixCovarianceFunction(), QUESO::BaseOneDGrid< T >::BaseOneDGrid(), QUESO::BaseScalarCdf< T >::BaseScalarCdf(), QUESO::BaseScalarCovarianceFunction< V, M >::BaseScalarCovarianceFunction(), QUESO::BaseVectorCdf< V, M >::BaseVectorCdf(), QUESO::BaseVectorMdf< V, M >::BaseVectorMdf(), QUESO::BaseVectorRealizer< V, M >::BaseVectorRealizer(), QUESO::BaseVectorRV< V, M >::BaseVectorRV(), QUESO::BetaJointPdf< V, M >::BetaJointPdf(), QUESO::BetaVectorRealizer< V, M >::BetaVectorRealizer(), QUESO::BetaVectorRV< V, M >::BetaVectorRV(), QUESO::GPMSAOptions::checkOptions(), QUESO::MLSamplingOptions::checkOptions(), QUESO::MLSamplingLevelOptions::checkOptions(), closeFile(), QUESO::ComputeConditionalGaussianVectorRV(), QUESO::ConcatenatedVectorRealizer< V, M >::ConcatenatedVectorRealizer(), QUESO::ConcatenatedVectorRV< V, M >::ConcatenatedVectorRV(), QUESO::GslVector::cwSetBeta(), QUESO::GslMatrix::determinant(), QUESO::EnvironmentOptions::EnvironmentOptions(), QUESO::ExperimentModel< S_V, S_M, D_V, D_M >::ExperimentModel(), QUESO::ExperimentModelOptions::ExperimentModelOptions(), QUESO::ExperimentStorage< S_V, S_M, D_V, D_M >::ExperimentStorage(), QUESO::ExponentialMatrixCovarianceFunction< P_V, P_M, Q_V, Q_M >::ExponentialMatrixCovarianceFunction(), QUESO::ExponentialScalarCovarianceFunction< V, M >::ExponentialScalarCovarianceFunction(), QUESO::FiniteDistribution::FiniteDistribution(), QUESO::GammaJointPdf< V, M >::GammaJointPdf(), QUESO::GammaVectorRealizer< V, M >::GammaVectorRealizer(), QUESO::GammaVectorRV< V, M >::GammaVectorRV(), QUESO::GaussianJointPdf< V, M >::GaussianJointPdf(), QUESO::GaussianVectorCdf< V, M >::GaussianVectorCdf(), QUESO::GaussianVectorMdf< V, M >::GaussianVectorMdf(), QUESO::GaussianVectorRealizer< V, M >::GaussianVectorRealizer(), QUESO::GaussianVectorRV< V, M >::GaussianVectorRV(), QUESO::GcmExperimentInfo< S_V, S_M, D_V, D_M, P_V, P_M >::GcmExperimentInfo(), QUESO::GcmJointInfo< S_V, S_M, D_V, D_M, P_V, P_M, Q_V, Q_M >::GcmJointInfo(), QUESO::GcmJointTildeInfo< S_V, S_M, D_V, D_M, P_V, P_M, Q_V, Q_M >::GcmJointTildeInfo(), QUESO::GcmSimulationInfo< S_V, S_M, P_V, P_M, Q_V, Q_M >::GcmSimulationInfo(), QUESO::GcmSimulationTildeInfo< S_V, S_M, P_V, P_M, Q_V, Q_M >::GcmSimulationTildeInfo(), QUESO::GcmTotalInfo< S_V, S_M, D_V, D_M, P_V, P_M, Q_V, Q_M >::GcmTotalInfo(), QUESO::GcmZInfo< S_V, S_M, D_V, D_M, P_V, P_M, Q_V, Q_M >::GcmZInfo(), QUESO::GcmZTildeInfo< S_V, S_M, D_V, D_M, P_V, P_M, Q_V, Q_M >::GcmZTildeInfo(), QUESO::GenericMatrixCovarianceFunction< P_V, P_M, Q_V, Q_M >::GenericMatrixCovarianceFunction(), QUESO::GenericScalarCovarianceFunction< V, M >::GenericScalarCovarianceFunction(), QUESO::GenericVectorRealizer< V, M >::GenericVectorRealizer(), QUESO::GenericVectorRV< V, M >::GenericVectorRV(), QUESO::ExperimentModelOptions::getMyOptionValues(), QUESO::SimulationModelOptions::getMyOptionValues(), QUESO::GpmsaComputerModelOptions::getMyOptionValues(), QUESO::StatisticalForwardProblemOptions::getMyOptionValues(), QUESO::StatisticalInverseProblemOptions::getMyOptionValues(), QUESO::MonteCarloSGOptions::getMyOptionValues(), QUESO::MetropolisHastingsSGOptions::getMyOptionValues(), QUESO::GpmsaComputerModel< S_V, S_M, D_V, D_M, P_V, P_M, Q_V, Q_M >::GpmsaComputerModel(), QUESO::GpmsaComputerModelOptions::GpmsaComputerModelOptions(), QUESO::HessianCovMatricesTKGroup< V, M >::HessianCovMatricesTKGroup(), QUESO::horizontalDistance(), QUESO::GslMatrix::inverse(), QUESO::InverseGammaJointPdf< V, M >::InverseGammaJointPdf(), QUESO::InverseGammaVectorRealizer< V, M >::InverseGammaVectorRealizer(), QUESO::InverseGammaVectorRV< V, M >::InverseGammaVectorRV(), QUESO::GslMatrix::invertMultiply(), QUESO::InvLogitGaussianVectorRV< V, M >::InvLogitGaussianVectorRV(), QUESO::JeffreysJointPdf< V, M >::JeffreysJointPdf(), QUESO::JeffreysVectorRealizer< V, M >::JeffreysVectorRealizer(), QUESO::JeffreysVectorRV< V, M >::JeffreysVectorRV(), QUESO::GslMatrix::lnDeterminant(), QUESO::LogNormalJointPdf< V, M >::LogNormalJointPdf(), QUESO::LogNormalVectorRealizer< V, M >::LogNormalVectorRealizer(), QUESO::LogNormalVectorRV< V, M >::LogNormalVectorRV(), QUESO::MetropolisAdjustedLangevinTK< V, M >::MetropolisAdjustedLangevinTK(), QUESO::MetropolisHastingsSG< P_V, P_M >::MetropolisHastingsSG(), QUESO::MetropolisHastingsSGOptions::MetropolisHastingsSGOptions(), QUESO::MLSampling< P_V, P_M >::MLSampling(), QUESO::ModelValidation< P_V, P_M, Q_V, Q_M >::ModelValidation(), QUESO::MonteCarloSGOptions::MonteCarloSGOptions(), openInputFile(), openOutputFile(), openUnifiedInputFile(), openUnifiedOutputFile(), QUESO::PoweredJointPdf< V, M >::PoweredJointPdf(), QUESO::GslMatrix::rank(), QUESO::SampledScalarCdf< T >::SampledScalarCdf(), QUESO::SampledVectorCdf< V, M >::SampledVectorCdf(), QUESO::SampledVectorMdf< V, M >::SampledVectorMdf(), QUESO::ScaledCovMatrixTKGroup< V, M >::ScaledCovMatrixTKGroup(), QUESO::ExperimentModelOptions::scanOptionsValues(), QUESO::SimulationModelOptions::scanOptionsValues(), QUESO::GpmsaComputerModelOptions::scanOptionsValues(), QUESO::StatisticalForwardProblemOptions::scanOptionsValues(), QUESO::StatisticalInverseProblemOptions::scanOptionsValues(), QUESO::MonteCarloSGOptions::scanOptionsValues(), QUESO::MetropolisHastingsSGOptions::scanOptionsValues(), QUESO::SequentialVectorRealizer< V, M >::SequentialVectorRealizer(), QUESO::SimulationModel< S_V, S_M, P_V, P_M, Q_V, Q_M >::SimulationModel(), QUESO::SimulationModelOptions::SimulationModelOptions(), QUESO::SimulationStorage< S_V, S_M, P_V, P_M, Q_V, Q_M >::SimulationStorage(), QUESO::StatisticalForwardProblemOptions::StatisticalForwardProblemOptions(), QUESO::StatisticalInverseProblem< P_V, P_M >::StatisticalInverseProblem(), QUESO::StatisticalInverseProblemOptions::StatisticalInverseProblemOptions(), QUESO::StdOneDGrid< T >::StdOneDGrid(), QUESO::StdScalarCdf< T >::StdScalarCdf(), QUESO::GslVector::subReadContents(), QUESO::GslMatrix::subReadContents(), QUESO::GslMatrix::svdSolve(), QUESO::TransformedScaledCovMatrixTKGroup< V, M >::TransformedScaledCovMatrixTKGroup(), QUESO::UniformJointPdf< V, M >::UniformJointPdf(), QUESO::UniformOneDGrid< T >::UniformOneDGrid(), QUESO::UniformVectorRealizer< V, M >::UniformVectorRealizer(), QUESO::UniformVectorRV< V, M >::UniformVectorRV(), QUESO::ValidationCycle< P_V, P_M, Q_V, Q_M >::ValidationCycle(), QUESO::VectorSet< V, M >::VectorSet(), QUESO::VectorSpace< V, M >::VectorSpace(), QUESO::VectorSubset< V, M >::VectorSubset(), QUESO::WignerJointPdf< V, M >::WignerJointPdf(), QUESO::WignerVectorRealizer< V, M >::WignerVectorRealizer(), and QUESO::WignerVectorRV< V, M >::WignerVectorRV().

321 {
322  return m_subDisplayFile;
323 }
std::ofstream * m_subDisplayFile
Definition: Environment.h:396
std::string QUESO::BaseEnvironment::subDisplayFileName ( ) const

Access function for m_subDisplayFileName (displays filename on stream).

Definition at line 326 of file Environment.C.

References m_optionsObj, and QUESO::EnvOptionsValues::m_subDisplayFileName.

327 {
328  if (m_optionsObj == NULL) return ".";
329 
331 }
EnvOptionsValues * m_optionsObj
Definition: Environment.h:402
std::string m_subDisplayFileName
Output filename for sub-screen writing.
RawType_MPI_Group QUESO::BaseEnvironment::subGroup ( ) const

Access function for sub-group.

Definition at line 281 of file Environment.C.

References m_subGroup.

282 {
283  return m_subGroup;
284 }
RawType_MPI_Group m_subGroup
Definition: Environment.h:384
unsigned int QUESO::BaseEnvironment::subId ( ) const
const std::string & QUESO::BaseEnvironment::subIdString ( ) const

Access to the attribute m_subIdString; which stores the string for the sub-environment, and it will be used, for instance, to create the output files for each sub-environment.

Definition at line 347 of file Environment.C.

References m_subIdString.

Referenced by openOutputFile(), QUESO::Sampled1D1DFunction::printForMatlab(), QUESO::GslVector::subWriteContents(), and QUESO::GslMatrix::subWriteContents().

348 {
349  return m_subIdString;
350 }
std::string m_subIdString
Definition: Environment.h:383
int QUESO::BaseEnvironment::subRank ( ) const
unsigned int QUESO::BaseEnvironment::syncVerbosity ( ) const

Access function to private attribute m_syncVerbosity.

Definition at line 456 of file Environment.C.

References m_optionsObj, QUESO::EnvOptionsValues::m_syncVerbosity, and queso_require_msg.

Referenced by QUESO::MpiComm::syncPrintDebugMsg().

457 {
458  queso_require_msg(m_optionsObj, "m_optionsObj variable is NULL");
460 }
EnvOptionsValues * m_optionsObj
Definition: Environment.h:402
unsigned int m_syncVerbosity
Synchronized verbosity.
#define queso_require_msg(asserted, msg)
Definition: asserts.h:69
struct timeval QUESO::BaseEnvironment::timevalBegin ( ) const

Used to save the time when the combo `QUESO+user's application' started to run.

Definition at line 514 of file Environment.C.

515 {
516  return m_timevalBegin;
517 }
struct timeval m_timevalBegin
Definition: Environment.h:399
int QUESO::BaseEnvironment::worldRank ( ) const

Member Data Documentation

boost::program_options::options_description* QUESO::BaseEnvironment::m_allOptionsDesc
protected
boost::program_options::variables_map* QUESO::BaseEnvironment::m_allOptionsMap
protected
BasicPdfsBase* QUESO::BaseEnvironment::m_basicPdfs
protected

Definition at line 398 of file Environment.h.

Referenced by basicPdfs(), QUESO::FullEnvironment::construct(), and ~BaseEnvironment().

bool QUESO::BaseEnvironment::m_exceptionalCircumstance
mutableprotected

Definition at line 400 of file Environment.h.

Referenced by exceptionalCircumstance(), and setExceptionalCircumstance().

MpiComm* QUESO::BaseEnvironment::m_fullComm
protected

Definition at line 369 of file Environment.h.

Referenced by QUESO::FullEnvironment::construct(), fullComm(), and ~BaseEnvironment().

int QUESO::BaseEnvironment::m_fullCommSize
protected

Definition at line 371 of file Environment.h.

Referenced by QUESO::FullEnvironment::construct().

bool QUESO::BaseEnvironment::m_fullEnvIsReady
protected

Definition at line 366 of file Environment.h.

Referenced by QUESO::FullEnvironment::construct(), and fullEnvIsReady().

RawType_MPI_Group QUESO::BaseEnvironment::m_fullGroup
protected

Definition at line 372 of file Environment.h.

Referenced by QUESO::FullEnvironment::construct().

int QUESO::BaseEnvironment::m_fullRank
protected
ScopedPtr<GetPot>::Type QUESO::BaseEnvironment::m_input
protected

Definition at line 380 of file Environment.h.

Referenced by QUESO::FullEnvironment::construct(), and input().

MpiComm* QUESO::BaseEnvironment::m_inter0Comm
protected

Definition at line 392 of file Environment.h.

Referenced by QUESO::FullEnvironment::construct(), inter0Comm(), and ~BaseEnvironment().

int QUESO::BaseEnvironment::m_inter0CommSize
protected

Definition at line 394 of file Environment.h.

Referenced by QUESO::FullEnvironment::construct().

RawType_MPI_Group QUESO::BaseEnvironment::m_inter0Group
protected

Definition at line 391 of file Environment.h.

Referenced by QUESO::FullEnvironment::construct().

int QUESO::BaseEnvironment::m_inter0Rank
protected

Definition at line 393 of file Environment.h.

Referenced by QUESO::FullEnvironment::construct(), and inter0Rank().

bool QUESO::BaseEnvironment::m_optionsInputFileAccessState
mutableprotected

Definition at line 375 of file Environment.h.

Referenced by optionsInputFileName(), and setOptionsInputFileAccessState().

std::string QUESO::BaseEnvironment::m_optionsInputFileName
protected
EnvOptionsValues* QUESO::BaseEnvironment::m_optionsObj
protected
RngBase* QUESO::BaseEnvironment::m_rngObject
protected
MpiComm* QUESO::BaseEnvironment::m_selfComm
protected

Definition at line 389 of file Environment.h.

Referenced by QUESO::FullEnvironment::construct(), selfComm(), and ~BaseEnvironment().

MpiComm* QUESO::BaseEnvironment::m_subComm
protected

Definition at line 385 of file Environment.h.

Referenced by QUESO::FullEnvironment::construct(), subComm(), and ~BaseEnvironment().

int QUESO::BaseEnvironment::m_subCommSize
protected

Definition at line 387 of file Environment.h.

Referenced by QUESO::FullEnvironment::construct().

std::ofstream* QUESO::BaseEnvironment::m_subDisplayFile
mutableprotected
RawType_MPI_Group QUESO::BaseEnvironment::m_subGroup
protected

Definition at line 384 of file Environment.h.

Referenced by QUESO::FullEnvironment::construct(), and subGroup().

unsigned int QUESO::BaseEnvironment::m_subId
protected

Definition at line 382 of file Environment.h.

Referenced by QUESO::FullEnvironment::construct(), and subId().

std::string QUESO::BaseEnvironment::m_subIdString
protected

Definition at line 383 of file Environment.h.

Referenced by QUESO::FullEnvironment::construct(), and subIdString().

int QUESO::BaseEnvironment::m_subRank
protected

Definition at line 386 of file Environment.h.

Referenced by QUESO::FullEnvironment::construct(), and subRank().

struct timeval QUESO::BaseEnvironment::m_timevalBegin
protected

Definition at line 399 of file Environment.h.

Referenced by QUESO::FullEnvironment::construct(), and ~BaseEnvironment().

int QUESO::BaseEnvironment::m_worldRank
protected

Definition at line 367 of file Environment.h.

Referenced by worldRank().


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

Generated on Tue Nov 29 2016 10:53:13 for queso-0.56.0 by  doxygen 1.8.5