queso-0.51.1
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, const EnvOptionsValues *alternativeOptionsValues)
 Default constructor. More...
 
 BaseEnvironment (const BaseEnvironment &obj)
 Copy constructor. It should not be used be the user. More...
 
virtual ~BaseEnvironment ()
 Destructor. More...
 
Set methods
BaseEnvironmentoperator= (const BaseEnvironment &rhs)
 Assignment operator. It should not be used be the user. 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
 
po::variables_map & allOptionsMap () const
 
void scanInputFileForMyOptions (const po::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) const
 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...
 
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
 
po::options_description * m_allOptionsDesc
 
po::variables_map * m_allOptionsMap
 
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
 
EnvOptionsValues m_alternativeOptionsValues
 
EnvironmentOptionsm_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 187 of file Environment.h.

Constructor & Destructor Documentation

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

Default constructor.

Definition at line 130 of file Environment.C.

References m_alternativeOptionsValues, and m_optionsInputFileName.

133  :
134  m_fullEnvIsReady (false),
135  m_worldRank (-1),
136  m_fullComm (NULL),
137  m_fullRank (-1),
138  m_fullCommSize (1),
141  m_allOptionsDesc (NULL),
142  m_allOptionsMap (NULL),
143  m_subComm (NULL),
144  m_subRank (-1),
145  m_subCommSize (1),
146  m_selfComm (NULL),
147  m_inter0Comm (NULL),
148  m_inter0Rank (-1),
149  m_inter0CommSize (1),
150  m_subDisplayFile (NULL),
151  m_rngObject (NULL),
152  m_basicPdfs (NULL),
155  m_optionsObj (NULL)
156 {
157  if (passedOptionsInputFileName) m_optionsInputFileName = passedOptionsInputFileName;
158  if (alternativeOptionsValues ) m_alternativeOptionsValues = *alternativeOptionsValues;
159 }
po::options_description * m_allOptionsDesc
Definition: Environment.h:363
std::string m_optionsInputFileName
Definition: Environment.h:361
std::ofstream * m_subDisplayFile
Definition: Environment.h:380
po::variables_map * m_allOptionsMap
Definition: Environment.h:364
BasicPdfsBase * m_basicPdfs
Definition: Environment.h:382
EnvironmentOptions * m_optionsObj
Definition: Environment.h:387
EnvOptionsValues m_alternativeOptionsValues
Definition: Environment.h:386
QUESO::BaseEnvironment::BaseEnvironment ( const BaseEnvironment obj)

Copy constructor. It should not be used be the user.

Definition at line 161 of file Environment.C.

References UQ_FATAL_TEST_MACRO, QUESO::UQ_INVALID_INTERNAL_STATE_RC, and worldRank().

162 {
164  obj.worldRank(),
165  "BaseEnvironment::constructor(), copy",
166  "code should not execute through here");
167 }
const int UQ_INVALID_INTERNAL_STATE_RC
Definition: Defines.h:82
#define UQ_FATAL_TEST_MACRO(test, givenRank, where, what)
Definition: Defines.h:223
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 169 of file Environment.C.

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

170 {
171  //if (m_subDisplayFile) {
172  // *m_subDisplayFile << "Entering BaseEnvironment::destructor()"
173  // << std::endl;
174  //}
175 
176  struct timeval timevalNow;
177  /*int iRC = 0;*/
178  /*iRC = */gettimeofday(&timevalNow, NULL);
179 
180  if( this->displayVerbosity() > 0 )
181  {
182  if (m_subDisplayFile) {
183  *m_subDisplayFile << "Ending run at " << ctime(&timevalNow.tv_sec)
184  << "Total run time = " << timevalNow.tv_sec - m_timevalBegin.tv_sec
185  << " seconds"
186  << std::endl;
187  }
188 
189  if (m_fullRank == 0) {
190  std::cout << "Ending run at " << ctime(&timevalNow.tv_sec)
191  << "Total run time = " << timevalNow.tv_sec - m_timevalBegin.tv_sec
192  << " seconds"
193  << std::endl;
194  }
195  }
196 
197  if (m_optionsObj) delete m_optionsObj;
198  if (m_allOptionsMap) {
199  delete m_allOptionsMap;
200  delete m_allOptionsDesc;
201  }
202 
203  if (m_basicPdfs) delete m_basicPdfs;
204  if (m_rngObject) delete m_rngObject;
205 
206  //if (m_subDisplayFile) {
207  // *m_subDisplayFile << "Leaving BaseEnvironment::destructor()"
208  // << std::endl;
209  //}
210 
212  if (m_inter0Comm ) delete m_inter0Comm;
213  if (m_selfComm ) delete m_selfComm;
214  if (m_subComm ) delete m_subComm;
215  if (m_fullComm ) delete m_fullComm;
216 }
po::options_description * m_allOptionsDesc
Definition: Environment.h:363
struct timeval m_timevalBegin
Definition: Environment.h:383
std::ofstream * m_subDisplayFile
Definition: Environment.h:380
po::variables_map * m_allOptionsMap
Definition: Environment.h:364
BasicPdfsBase * m_basicPdfs
Definition: Environment.h:382
EnvironmentOptions * m_optionsObj
Definition: Environment.h:387
unsigned int displayVerbosity() const
Definition: Environment.C:436

Member Function Documentation

po::variables_map & QUESO::BaseEnvironment::allOptionsMap ( ) const

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

Definition at line 368 of file Environment.C.

References m_allOptionsMap, m_worldRank, and UQ_FATAL_TEST_MACRO.

Referenced by QUESO::InfiniteDimensionalMCMCSamplerOptions::getMyOptionValues(), QUESO::EnvironmentOptions::getMyOptionValues(), QUESO::MLSamplingOptions::getMyOptionValues(), QUESO::StatisticalForwardProblemOptions::getMyOptionValues(), QUESO::StatisticalInverseProblemOptions::getMyOptionValues(), QUESO::MonteCarloSGOptions::getMyOptionValues(), QUESO::MetropolisHastingsSGOptions::getMyOptionValues(), and QUESO::MLSamplingLevelOptions::getMyOptionValues().

369 {
371  m_worldRank,
372  "BaseEnvironment::allOptionsMap()",
373  "m_allOptionsMap variable is NULL");
374  return *m_allOptionsMap;
375 }
po::variables_map * m_allOptionsMap
Definition: Environment.h:364
#define UQ_FATAL_TEST_MACRO(test, givenRank, where, what)
Definition: Defines.h:223
const BasicPdfsBase * QUESO::BaseEnvironment::basicPdfs ( ) const

Access to Basic PDFs.

Definition at line 485 of file Environment.C.

References m_basicPdfs.

486 {
487  return m_basicPdfs;
488 }
BasicPdfsBase * m_basicPdfs
Definition: Environment.h:382
unsigned int QUESO::BaseEnvironment::checkingLevel ( ) const

Access function to private attribute m_checkingLevel.

Definition at line 456 of file Environment.C.

References QUESO::EnvOptionsValues::m_checkingLevel, m_optionsObj, QUESO::EnvironmentOptions::m_ov, m_worldRank, and UQ_FATAL_TEST_MACRO.

Referenced by QUESO::GslMatrix::inverse().

457 {
459  m_worldRank,
460  "BaseEnvironment::checkingLevel()",
461  "m_optionsObj variable is NULL");
463 }
EnvironmentOptions * m_optionsObj
Definition: Environment.h:387
unsigned int m_checkingLevel
Checking level.
Definition: Defines.h:149
#define UQ_FATAL_TEST_MACRO(test, givenRank, where, what)
Definition: Defines.h:223
EnvOptionsValues m_ov
Instance of EnvOptionsValues, a class with default values for QUESO environment.
void QUESO::BaseEnvironment::checkTheParallelEnvironment ( ) const
void QUESO::BaseEnvironment::closeFile ( FilePtrSetStruct filePtrSet,
const std::string &  fileType 
) const

Closes the file.

Definition at line 1117 of file Environment.C.

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

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

1120 {
1121  std::string fileType(inputFileType);
1122 #ifdef QUESO_HAS_HDF5
1123  // Do nothing
1124 #else
1125  if (fileType == UQ_FILE_EXTENSION_FOR_HDF_FORMAT) {
1126  if (m_subDisplayFile) {
1127  *this->subDisplayFile() << "WARNING in BaseEnvironment::closeFile()"
1128  << ": file format '" << UQ_FILE_EXTENSION_FOR_HDF_FORMAT
1129  << "' has been requested, but this QUESO library has not been built with 'hdf5'"
1130  << ". Code will therefore process the file format '" << UQ_FILE_EXTENSION_FOR_HDF_FORMAT
1131  << "' instead..."
1132  << std::endl;
1133  }
1134  if (this->subRank() == 0) {
1135  std::cerr << "WARNING in BaseEnvironment::closeFile()"
1136  << ": file format '" << UQ_FILE_EXTENSION_FOR_HDF_FORMAT
1137  << "' has been requested, but this QUESO library has not been built with 'hdf5'"
1138  << ". Code will therefore process the file format '" << UQ_FILE_EXTENSION_FOR_HDF_FORMAT
1139  << "' instead..."
1140  << std::endl;
1141  }
1143  }
1144 #endif
1145 
1146  if (fileType == UQ_FILE_EXTENSION_FOR_MATLAB_FORMAT) {
1147  //filePtrSet.ofsVar->close(); // close() crashes on Mac; need to use delete(); why? prudenci 2010/June
1148  delete filePtrSet.ofsVar;
1149  filePtrSet.ofsVar = NULL;
1150 
1151  //filePtrSet.ifsVar->close();
1152  delete filePtrSet.ifsVar;
1153  filePtrSet.ifsVar = NULL;
1154  }
1155 #ifdef QUESO_HAS_HDF5
1156  else if (fileType == UQ_FILE_EXTENSION_FOR_HDF_FORMAT) {
1157  H5Fclose(filePtrSet.h5Var);
1158  }
1159 #endif
1160  else {
1161  UQ_FATAL_TEST_MACRO(true,
1162  m_worldRank,
1163  "BaseEnvironment::closeFile()",
1164  "invalid file type");
1165  }
1166 
1167  return;
1168 }
int subRank() const
Access function for sub-rank.
Definition: Environment.C:263
#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
std::ofstream * m_subDisplayFile
Definition: Environment.h:380
#define UQ_FILE_EXTENSION_FOR_HDF_FORMAT
Definition: Defines.h:90
#define UQ_FATAL_TEST_MACRO(test, givenRank, where, what)
Definition: Defines.h:223
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 436 of file Environment.C.

References QUESO::EnvOptionsValues::m_displayVerbosity, m_optionsObj, QUESO::EnvironmentOptions::m_ov, m_worldRank, and UQ_FATAL_TEST_MACRO.

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::GslVector::cwSetBeta(), QUESO::GslMatrix::determinant(), QUESO::ExponentialMatrixCovarianceFunction< P_V, P_M, Q_V, Q_M >::ExponentialMatrixCovarianceFunction(), QUESO::ExponentialScalarCovarianceFunction< V, M >::ExponentialScalarCovarianceFunction(), QUESO::FiniteDistribution::FiniteDistribution(), QUESO::FullEnvironment::FullEnvironment(), 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::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::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(), 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::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().

437 {
439  m_worldRank,
440  "BaseEnvironment::displayVerbosity()",
441  "m_optionsObj variable is NULL");
443 }
EnvironmentOptions * m_optionsObj
Definition: Environment.h:387
#define UQ_FATAL_TEST_MACRO(test, givenRank, where, what)
Definition: Defines.h:223
unsigned int m_displayVerbosity
Verbosity.
Definition: Defines.h:143
EnvOptionsValues m_ov
Instance of EnvOptionsValues, a class with default values for QUESO environment.
bool QUESO::BaseEnvironment::exceptionalCircumstance ( ) const

Decides whether there is an exceptional circumstance.

Definition at line 1178 of file Environment.C.

References m_exceptionalCircumstance.

1179 {
1181 }
const MpiComm & QUESO::BaseEnvironment::fullComm ( ) const

Access function for MpiComm full communicator.

Definition at line 247 of file Environment.C.

References m_fullComm, m_worldRank, and UQ_FATAL_TEST_MACRO.

Referenced by QUESO::EnvironmentOptions::getMyOptionValues(), and QUESO::MiscCheckTheParallelEnvironment().

248 {
250  m_worldRank,
251  "BaseEnvironment::fullComm()",
252  "m_fullComm variable is NULL");
253  return *m_fullComm;
254 }
#define UQ_FATAL_TEST_MACRO(test, givenRank, where, what)
Definition: Defines.h:223
bool QUESO::BaseEnvironment::fullEnvIsReady ( ) const

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

Definition at line 229 of file Environment.C.

References m_fullEnvIsReady.

230 {
231  return m_fullEnvIsReady;
232 }
int QUESO::BaseEnvironment::fullRank ( ) const
std::string QUESO::BaseEnvironment::identifyingString ( ) const

Access function to private attribute m_identifyingString: identifying string.

Definition at line 497 of file Environment.C.

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

498 {
500 }
EnvironmentOptions * m_optionsObj
Definition: Environment.h:387
std::string m_identifyingString
Identifying string.
Definition: Defines.h:163
EnvOptionsValues m_ov
Instance of EnvOptionsValues, a class with default values for QUESO environment.
const MpiComm & QUESO::BaseEnvironment::inter0Comm ( ) const

Access function for MpiComm inter0-communicator.

Definition at line 295 of file Environment.C.

References m_inter0Comm, m_worldRank, and UQ_FATAL_TEST_MACRO.

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

296 {
298  m_worldRank,
299  "BaseEnvironment::inter0Comm()",
300  "m_inter0Comm variable is NULL");
301  return *m_inter0Comm;
302 }
#define UQ_FATAL_TEST_MACRO(test, givenRank, where, what)
Definition: Defines.h:223
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 319 of file Environment.C.

References QUESO::EnvOptionsValues::m_numSubEnvironments, m_optionsObj, QUESO::EnvironmentOptions::m_ov, m_worldRank, and UQ_FATAL_TEST_MACRO.

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

320 {
322  m_worldRank,
323  "BaseEnvironment::numSubEnvironments()",
324  "m_optionsObj variable is NULL");
326 }
unsigned int m_numSubEnvironments
Number of sub-environments.
Definition: Defines.h:128
EnvironmentOptions * m_optionsObj
Definition: Environment.h:387
#define UQ_FATAL_TEST_MACRO(test, givenRank, where, what)
Definition: Defines.h:223
EnvOptionsValues m_ov
Instance of EnvOptionsValues, a class with default values for QUESO environment.
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 913 of file Environment.C.

References QUESO::CheckFilePath(), displayVerbosity(), QUESO::FilePtrSetStruct::ifsVar, m_subDisplayFile, m_worldRank, subDisplayFile(), subRank(), UQ_ENV_FILENAME_FOR_NO_INPUT_FILE, UQ_FATAL_TEST_MACRO, UQ_FILE_EXTENSION_FOR_HDF_FORMAT, UQ_FILE_EXTENSION_FOR_MATLAB_FORMAT, and worldRank().

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

918 {
919  std::string fileType(inputFileType);
920 #ifdef QUESO_HAS_HDF5
921  // Do nothing
922 #else
923  if (fileType == UQ_FILE_EXTENSION_FOR_HDF_FORMAT) {
924  if (m_subDisplayFile) {
925  *this->subDisplayFile() << "WARNING in BaseEnvironment::openInputFile()"
926  << ": file format '" << UQ_FILE_EXTENSION_FOR_HDF_FORMAT
927  << "' has been requested, but this QUESO library has not been built with 'hdf5'"
928  << ". Code will therefore process the file format '" << UQ_FILE_EXTENSION_FOR_HDF_FORMAT
929  << "' instead..."
930  << std::endl;
931  }
932  if (this->subRank() == 0) {
933  std::cerr << "WARNING in BaseEnvironment::openInputFile()"
934  << ": file format '" << UQ_FILE_EXTENSION_FOR_HDF_FORMAT
935  << "' has been requested, but this QUESO library has not been built with 'hdf5'"
936  << ". Code will therefore process the file format '" << UQ_FILE_EXTENSION_FOR_HDF_FORMAT
937  << "' instead..."
938  << std::endl;
939  }
941  }
942 #endif
943 
944  bool returnValue = true;
945  filePtrSet.ifsVar = NULL;
946  if ((baseFileName == UQ_ENV_FILENAME_FOR_NO_INPUT_FILE) ||
947  (allowedSubEnvIds.find(this->subId()) == allowedSubEnvIds.end() )) {
948  if ((m_subDisplayFile) && (this->displayVerbosity() >= 10)) {
949  *this->subDisplayFile() << "In BaseEnvironment::openInputFile()"
950  << ": no input file opened with base name '" << baseFileName << "." << fileType
951  << "'"
952  << std::endl;
953  }
954  returnValue = false;
955  }
956  else {
958  // Open file
960  if ((m_subDisplayFile) && (this->displayVerbosity() >= 10)) {
961  *this->subDisplayFile() << "In BaseEnvironment::openInputFile()"
962  << ": opening input file with base name '" << baseFileName << "." << fileType
963  << "'"
964  << std::endl;
965  }
966  if (this->subRank() == 0) {
968  // Verify parent directory exists (for cases when a user
969  // specifies a relative path for the desired output file). prudenci 2010/06/26
971  // std::cout << "checking " << baseFileName+"."+fileType << std::endl;
972  int irtrn = CheckFilePath((baseFileName+"."+fileType).c_str());
973  UQ_FATAL_TEST_MACRO(irtrn < 0,
974  m_worldRank,
975  "BaseEnvironment::openInputFile()",
976  "unable to verify input path");
977 
978  if (fileType == UQ_FILE_EXTENSION_FOR_MATLAB_FORMAT) {
979  filePtrSet.ifsVar = new std::ifstream((baseFileName+"."+fileType).c_str(),
980  std::ofstream::in);
981  if ((filePtrSet.ifsVar == NULL) || (filePtrSet.ifsVar->is_open() == false)) {
982  std::cerr << "In BaseEnvironment::openInputFile()"
983  << ": failed to open input file with base name '" << baseFileName << "." << fileType
984  << "'"
985  << std::endl;
986  }
987  UQ_FATAL_TEST_MACRO((filePtrSet.ifsVar == NULL) || (filePtrSet.ifsVar->is_open() == false),
988  this->worldRank(),
989  "BaseEnvironment::openInputFile()",
990  "file with fileName could not be found");
991  }
992 #ifdef QUESO_HAS_HDF5
993  else if (fileType == UQ_FILE_EXTENSION_FOR_HDF_FORMAT) {
994  filePtrSet.h5Var = H5Fopen((baseFileName+"."+fileType).c_str(),
995  H5F_ACC_RDONLY,
996  H5P_DEFAULT);
997  }
998 #endif
999  else {
1000  UQ_FATAL_TEST_MACRO(true,
1001  m_worldRank,
1002  "BaseEnvironment::openInputFile()",
1003  "invalid file type");
1004  }
1005  }
1006  else {
1007  returnValue = false;
1008  }
1009  //this->subComm().Barrier(); // prudenci-2011-01-17
1010  }
1011 
1012  return returnValue;
1013 }
#define UQ_ENV_FILENAME_FOR_NO_INPUT_FILE
int subRank() const
Access function for sub-rank.
Definition: Environment.C:263
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
std::ofstream * m_subDisplayFile
Definition: Environment.h:380
#define UQ_FILE_EXTENSION_FOR_HDF_FORMAT
Definition: Defines.h:90
int CheckFilePath(const char *path)
unsigned int displayVerbosity() const
Definition: Environment.C:436
#define UQ_FATAL_TEST_MACRO(test, givenRank, where, what)
Definition: Defines.h:223
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 516 of file Environment.C.

References QUESO::CheckFilePath(), displayVerbosity(), m_subDisplayFile, m_worldRank, QUESO::FilePtrSetStruct::ofsVar, subDisplayFile(), subId(), subIdString(), subRank(), UQ_ENV_FILENAME_FOR_NO_OUTPUT_FILE, UQ_FATAL_TEST_MACRO, UQ_FILE_EXTENSION_FOR_HDF_FORMAT, UQ_FILE_EXTENSION_FOR_MATLAB_FORMAT, and worldRank().

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

522 {
523  std::string fileType(inputFileType);
524 #ifdef QUESO_HAS_HDF5
525  // Do nothing
526 #else
527  if (fileType == UQ_FILE_EXTENSION_FOR_HDF_FORMAT) {
528  if (m_subDisplayFile) {
529  *this->subDisplayFile() << "WARNING in BaseEnvironment::openOutputFile()"
530  << ": file format '" << UQ_FILE_EXTENSION_FOR_HDF_FORMAT
531  << "' has been requested, but this QUESO library has not been built with 'hdf5'"
532  << ". Code will therefore process the file format '" << UQ_FILE_EXTENSION_FOR_HDF_FORMAT
533  << "' instead..."
534  << std::endl;
535  }
536  if (this->subRank() == 0) {
537  std::cerr << "WARNING in BaseEnvironment::openOutputFile()"
538  << ": file format '" << UQ_FILE_EXTENSION_FOR_HDF_FORMAT
539  << "' has been requested, but this QUESO library has not been built with 'hdf5'"
540  << ". Code will therefore process the file format '" << UQ_FILE_EXTENSION_FOR_HDF_FORMAT
541  << "' instead..."
542  << std::endl;
543  }
545  }
546 #endif
547 
548  bool returnValue = true;
549  filePtrSet.ofsVar = NULL;
550  if ((baseFileName == UQ_ENV_FILENAME_FOR_NO_OUTPUT_FILE) ||
551  (allowedSubEnvIds.find(this->subId()) == allowedSubEnvIds.end() )) {
552  if ((m_subDisplayFile) && (this->displayVerbosity() > 10)) { // output debug
553  *this->subDisplayFile() << "In BaseEnvironment::openOutputFile()"
554  << ", subId = " << this->subId()
555  << ": no output file opened with base name '" << baseFileName << "." << fileType
556  << "'"
557  << ", writeOver = " << writeOver
558  << std::endl;
559  }
560  returnValue = false;
561  }
562  else {
564  // Open file
566  if ((m_subDisplayFile) && (this->displayVerbosity() > 10)) { // output debug
567  *this->subDisplayFile() << "In BaseEnvironment::openOutputFile()"
568  << ", subId = " << this->subId()
569  << ": opening output file with base name '" << baseFileName << "." << fileType
570  << "'"
571  << ", writeOver = " << writeOver
572  << std::endl;
573  }
574 
575  if (this->subRank() == 0) {
576 #if 0
577  std::cout << "In BaseEnvironment::openOutputFile()"
578  << ": opening output file with base name '" << baseFileName << "." << fileType
579  << "'"
580  << ", writeOver = " << writeOver
581  << std::endl;
582 #endif
583 
585  // Verify parent directory exists (for cases when a user
586  // specifies a relative path for the desired output file).
588  // std::cout << "checking " << baseFileName+"_sub"+this->subIdString()+"."+fileType << std::endl;
589  if ((m_subDisplayFile) && (this->displayVerbosity() > 10)) { // output debug
590  *this->subDisplayFile() << "In BaseEnvironment::openOutputFile()"
591  << ", subId = " << this->subId()
592  << ", trying to open output file with base name '" << baseFileName << "." << fileType
593  << "'"
594  << ", writeOver = " << writeOver
595  << ": calling CheckFilePath()..."
596  << std::endl;
597  }
598  int irtrn = CheckFilePath((baseFileName+"_sub"+this->subIdString()+"."+fileType).c_str());
599  if ((m_subDisplayFile) && (this->displayVerbosity() > 10)) { // output debug
600  *this->subDisplayFile() << "In BaseEnvironment::openOutputFile()"
601  << ", subId = " << this->subId()
602  << ", trying to open output file with base name '" << baseFileName << "." << fileType
603  << "'"
604  << ", writeOver = " << writeOver
605  << ": returned from CheckFilePath() with irtrn = " << irtrn
606  << std::endl;
607  }
608  UQ_FATAL_TEST_MACRO(irtrn < 0,
609  m_worldRank,
610  "BaseEnvironment::openOutputFile()",
611  "unable to verify output path");
612 
613  if (writeOver) {
615  // Write over an eventual pre-existing file
617  if (fileType == UQ_FILE_EXTENSION_FOR_MATLAB_FORMAT) {
618  filePtrSet.ofsVar = new std::ofstream((baseFileName+"_sub"+this->subIdString()+"."+fileType).c_str(),
619  std::ofstream::out | std::ofstream::trunc);
620  }
621  else if (fileType == UQ_FILE_EXTENSION_FOR_HDF_FORMAT) {
622  UQ_FATAL_TEST_MACRO(true,
623  m_worldRank,
624  "BaseEnvironment::openOutputFile(), writeOver=true",
625  "hdf file type not supported yet");
626  }
627  else {
628  UQ_FATAL_TEST_MACRO(true,
629  m_worldRank,
630  "BaseEnvironment::openOutputFile(), writeOver=true",
631  "invalid file type");
632  }
633  if ((m_subDisplayFile) && (this->displayVerbosity() > 10)) { // output debug
634  *this->subDisplayFile() << "In BaseEnvironment::openOutputFile()"
635  << ": just opened output file with base name '" << baseFileName << "." << fileType
636  << "'"
637  << ", writeOver = " << writeOver
638  << ", options 'out|trunc'"
639  << ", osfvar = " << filePtrSet.ofsVar
640  << std::endl;
641  }
642  }
643  else {
645  // Write at the end of an eventual pre-existing file
647  if (fileType == UQ_FILE_EXTENSION_FOR_MATLAB_FORMAT) {
648 #if 0
649  filePtrSet.ofsVar = new std::ofstream((baseFileName+"_sub"+this->subIdString()+"."+fileType).c_str(),
650  std::ofstream::in);
651  std::cout << "filePtrSet.ofsVar(1) = " << filePtrSet.ofsVar << std::endl;
652  if (filePtrSet.ofsVar) std::cout << "filePtrSet.ofsVar(1)->is_open() = " << filePtrSet.ofsVar->is_open() << std::endl;
653  if (filePtrSet.ofsVar) delete filePtrSet.ofsVar;
654 #endif
655  // 'm' and Ranger nodes behave differently on ofstream constructor... prudenci 2010/03/05
656  filePtrSet.ofsVar = new std::ofstream((baseFileName+"_sub"+this->subIdString()+"."+fileType).c_str(),
657  std::ofstream::out /*| std::ofstream::in*/ | std::ofstream::app);
658  }
659  else if (fileType == UQ_FILE_EXTENSION_FOR_HDF_FORMAT) {
660  UQ_FATAL_TEST_MACRO(true,
661  m_worldRank,
662  "BaseEnvironment::openOutputFile(), writeOver=false",
663  "hdf file type not supported yet");
664  }
665  else {
666  UQ_FATAL_TEST_MACRO(true,
667  m_worldRank,
668  "BaseEnvironment::openOutputFile(), writeOver=false",
669  "invalid file type");
670  }
671  if ((m_subDisplayFile) && (this->displayVerbosity() > 10)) { // output debug
672  *this->subDisplayFile() << "In BaseEnvironment::openOutputFile()"
673  << ": just opened output file with base name '" << baseFileName << "." << fileType
674  << "'"
675  << ", writeOver = " << writeOver
676  << ", options 'out|in|app'"
677  << ", osfvar = " << filePtrSet.ofsVar
678  << std::endl;
679  }
680 
681  if (fileType == UQ_FILE_EXTENSION_FOR_MATLAB_FORMAT) {
682  //std::cout << "filePtrSet.ofsVar(2) = " << filePtrSet.ofsVar << std::endl;
683  //if (filePtrSet.ofsVar) std::cout << "filePtrSet.ofsVar(2)->is_open() = " << filePtrSet.ofsVar->is_open() << std::endl;
684  if ((filePtrSet.ofsVar == NULL ) ||
685  (filePtrSet.ofsVar->is_open() == false)) {
686  //std::cout << "Retrying 1..." << std::endl;
687  delete filePtrSet.ofsVar;
688  filePtrSet.ofsVar = new std::ofstream((baseFileName+"_sub"+this->subIdString()+"."+fileType).c_str(),
689  std::ofstream::out | std::ofstream::trunc);
690  if ((m_subDisplayFile) && (this->displayVerbosity() > 10)) { // output debug
691  *this->subDisplayFile() << "In BaseEnvironment::openOutputFile()"
692  << ": just opened output file with base name '" << baseFileName << "." << fileType
693  << "'"
694  << ", writeOver = " << writeOver
695  << ", options 'out|trunc'"
696  << ", osfvar = " << filePtrSet.ofsVar
697  << std::endl;
698  }
699  }
700  } // only for matlab formats
701  }
702  if (filePtrSet.ofsVar != NULL) {
703  if ((m_subDisplayFile) && (this->displayVerbosity() > 10)) { // output debug
704  *this->subDisplayFile() << "In BaseEnvironment::openOutputFile()"
705  << ", subId = " << this->subId()
706  << ": succeeded on opening output file with base name '" << baseFileName << "." << fileType
707  << "'"
708  << ", writeOver = " << writeOver
709  << std::endl;
710  }
711  }
712  else {
713  std::cerr << "In BaseEnvironment::openOutputFile()"
714  << ": failed to open output file with base name '" << baseFileName << "." << fileType
715  << "'"
716  << std::endl;
717  }
718  UQ_FATAL_TEST_MACRO((filePtrSet.ofsVar && filePtrSet.ofsVar->is_open()) == false,
719  this->worldRank(),
720  "openOutputFile()",
721  "failed to open output file");
722  }
723  else {
724  returnValue = false;
725  }
726  //this->subComm().Barrier(); // prudenci-2011-01-17
727  }
728 
729  return returnValue;
730 }
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:335
int subRank() const
Access function for sub-rank.
Definition: Environment.C:263
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
std::ofstream * m_subDisplayFile
Definition: Environment.h:380
#define UQ_ENV_FILENAME_FOR_NO_OUTPUT_FILE
#define UQ_FILE_EXTENSION_FOR_HDF_FORMAT
Definition: Defines.h:90
int CheckFilePath(const char *path)
unsigned int displayVerbosity() const
Definition: Environment.C:436
#define UQ_FATAL_TEST_MACRO(test, givenRank, where, what)
Definition: Defines.h:223
unsigned int subId() const
Access function to the number of each sub-environment Id: m_subId.
Definition: Environment.C:329
bool QUESO::BaseEnvironment::openUnifiedInputFile ( const std::string &  fileName,
const std::string &  fileType,
FilePtrSetStruct filePtrSet 
) const

Opens the unified input file.

Definition at line 1016 of file Environment.C.

References QUESO::CheckFilePath(), displayVerbosity(), QUESO::FilePtrSetStruct::ifsVar, m_subDisplayFile, m_worldRank, subDisplayFile(), subRank(), UQ_ENV_FILENAME_FOR_NO_INPUT_FILE, UQ_FATAL_TEST_MACRO, UQ_FILE_EXTENSION_FOR_HDF_FORMAT, UQ_FILE_EXTENSION_FOR_MATLAB_FORMAT, and worldRank().

1020 {
1021  std::string fileType(inputFileType);
1022 #ifdef QUESO_HAS_HDF5
1023  // Do nothing
1024 #else
1025  if (fileType == UQ_FILE_EXTENSION_FOR_HDF_FORMAT) {
1026  if (m_subDisplayFile) {
1027  *this->subDisplayFile() << "WARNING in BaseEnvironment::openUnifiedInputFile()"
1028  << ": file format '" << UQ_FILE_EXTENSION_FOR_HDF_FORMAT
1029  << "' has been requested, but this QUESO library has not been built with 'hdf5'"
1030  << ". Code will therefore process the file format '" << UQ_FILE_EXTENSION_FOR_HDF_FORMAT
1031  << "' instead..."
1032  << std::endl;
1033  }
1034  if (this->subRank() == 0) {
1035  std::cerr << "WARNING in BaseEnvironment::openUnifiedInputFile()"
1036  << ": file format '" << UQ_FILE_EXTENSION_FOR_HDF_FORMAT
1037  << "' has been requested, but this QUESO library has not been built with 'hdf5'"
1038  << ". Code will therefore process the file format '" << UQ_FILE_EXTENSION_FOR_HDF_FORMAT
1039  << "' instead..."
1040  << std::endl;
1041  }
1043  }
1044 #endif
1045 
1046  bool returnValue = true;
1047  filePtrSet.ifsVar = NULL;
1048  if (baseFileName == UQ_ENV_FILENAME_FOR_NO_INPUT_FILE) {
1049  if ((m_subDisplayFile) && (this->displayVerbosity() >= 10)) {
1050  *this->subDisplayFile() << "In BaseEnvironment::openUnifiedInputFile()"
1051  << ": no input file opened with base name '" << baseFileName << "." << fileType
1052  << "'"
1053  << std::endl;
1054  }
1055  returnValue = false;
1056  }
1057  else {
1059  // Open file
1061  if ((m_subDisplayFile) && (this->displayVerbosity() >= 10)) {
1062  *this->subDisplayFile() << "In BaseEnvironment::openUnifiedInputFile()"
1063  << ": opening input file with base name '" << baseFileName << "." << fileType
1064  << "'"
1065  << std::endl;
1066  }
1067  if (this->subRank() == 0) { // Needed ???????? prudenci 2010-11-11
1069  // Verify parent directory exists (for cases when a user
1070  // specifies a relative path for the desired output file). prudenci 2010/06/26
1072  // std::cout << "checking " << baseFileName+"."+fileType << std::endl;
1073  int irtrn = CheckFilePath((baseFileName+"."+fileType).c_str());
1074  UQ_FATAL_TEST_MACRO(irtrn < 0,
1075  m_worldRank,
1076  "BaseEnvironment::openUnifiedInputFile()",
1077  "unable to verify input path");
1078 
1079  if (fileType == UQ_FILE_EXTENSION_FOR_MATLAB_FORMAT) {
1080  filePtrSet.ifsVar = new std::ifstream((baseFileName+"."+fileType).c_str(),
1081  std::ofstream::in);
1082  if ((filePtrSet.ifsVar == NULL) || (filePtrSet.ifsVar->is_open() == false)) {
1083  std::cerr << "In BaseEnvironment::openUnifiedInputFile()"
1084  << ": failed to open input file with base name '" << baseFileName << "." << fileType
1085  << "'"
1086  << std::endl;
1087  }
1088  UQ_FATAL_TEST_MACRO((filePtrSet.ifsVar == NULL) || (filePtrSet.ifsVar->is_open() == false),
1089  this->worldRank(),
1090  "BaseEnvironment::openUnifiedInputFile()",
1091  "file with fileName could not be found");
1092  }
1093 #ifdef QUESO_HAS_HDF5
1094  else if (fileType == UQ_FILE_EXTENSION_FOR_HDF_FORMAT) {
1095  filePtrSet.h5Var = H5Fopen((baseFileName+"."+fileType).c_str(),
1096  H5F_ACC_RDONLY,
1097  H5P_DEFAULT);
1098  }
1099 #endif
1100  else {
1101  UQ_FATAL_TEST_MACRO(true,
1102  m_worldRank,
1103  "BaseEnvironment::openUnifiedInputFile()",
1104  "invalid file type");
1105  }
1106  }
1107  //else {
1108  // returnValue = false;
1109  //}
1110  //this->subComm().Barrier();
1111  }
1112 
1113  return returnValue;
1114 }
#define UQ_ENV_FILENAME_FOR_NO_INPUT_FILE
int subRank() const
Access function for sub-rank.
Definition: Environment.C:263
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
std::ofstream * m_subDisplayFile
Definition: Environment.h:380
#define UQ_FILE_EXTENSION_FOR_HDF_FORMAT
Definition: Defines.h:90
int CheckFilePath(const char *path)
unsigned int displayVerbosity() const
Definition: Environment.C:436
#define UQ_FATAL_TEST_MACRO(test, givenRank, where, what)
Definition: Defines.h:223
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 733 of file Environment.C.

References QUESO::CheckFilePath(), displayVerbosity(), m_subDisplayFile, m_worldRank, QUESO::FilePtrSetStruct::ofsVar, subDisplayFile(), subRank(), UQ_FATAL_TEST_MACRO, UQ_FILE_EXTENSION_FOR_HDF_FORMAT, UQ_FILE_EXTENSION_FOR_MATLAB_FORMAT, and worldRank().

738 {
739  std::string fileType(inputFileType);
740 #ifdef QUESO_HAS_HDF5
741  // Do nothing
742 #else
743  if (fileType == UQ_FILE_EXTENSION_FOR_HDF_FORMAT) {
744  if (m_subDisplayFile) {
745  *this->subDisplayFile() << "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  }
752  if (this->subRank() == 0) {
753  std::cerr << "WARNING in BaseEnvironment::openUnifiedOutputFile()"
754  << ": file format '" << UQ_FILE_EXTENSION_FOR_HDF_FORMAT
755  << "' has been requested, but this QUESO library has not been built with 'hdf5'"
756  << ". Code will therefore process the file format '" << UQ_FILE_EXTENSION_FOR_HDF_FORMAT
757  << "' instead..."
758  << std::endl;
759  }
761  }
762 #endif
763 
764  bool returnValue = true;
765  filePtrSet.ofsVar = NULL;
766  if (baseFileName == ".") {
767  if ((m_subDisplayFile) && (this->displayVerbosity() > 10)) { // output debug
768  *this->subDisplayFile() << "In BaseEnvironment::openUnifiedOutputFile()"
769  << ": no unified output file opened with base name '" << baseFileName << "." << fileType
770  << "'"
771  << ", writeOver = " << writeOver
772  << std::endl;
773  }
774  returnValue = false;
775  }
776  else {
778  // Open file
780  if ((m_subDisplayFile) && (this->displayVerbosity() > 10)) { // output debug
781  *this->subDisplayFile() << "In BaseEnvironment::openUnifiedOutputFile()"
782  << ": opening unified output file with base name '" << baseFileName << "." << fileType
783  << "'"
784  << ", writeOver = " << writeOver
785  << std::endl;
786  }
787 
788 
789  //if ((this->subRank () == 0) &&
790  // (this->inter0Rank() == 0)) {
791 #if 0
792  std::cout << "In BaseEnvironment::openUnifiedOutputFile()"
793  << ": opening output file with base name '" << baseFileName << "." << fileType
794  << "'"
795  << ", writeOver = " << writeOver
796  << std::endl;
797 #endif
798  // Verify parent directory exists (for cases when a user
800  // specifies a relative path for the desired output file). prudenci 2010/06/26
802  // std::cout << "checking " << baseFileName+"."+fileType << std::endl;
803  int irtrn = CheckFilePath((baseFileName+"."+fileType).c_str());
804  UQ_FATAL_TEST_MACRO(irtrn < 0,
805  m_worldRank,
806  "BaseEnvironment::openUnifiedOutputFile()",
807  "unable to verify output path");
808 
809  if (writeOver) {
811  // Write over an eventual pre-existing file
813  if (fileType == UQ_FILE_EXTENSION_FOR_MATLAB_FORMAT) {
814  filePtrSet.ofsVar = new std::ofstream((baseFileName+"."+fileType).c_str(),
815  std::ofstream::out | std::ofstream::trunc);
816  }
817 #ifdef QUESO_HAS_HDF5
818  else if (fileType == UQ_FILE_EXTENSION_FOR_HDF_FORMAT) {
819  filePtrSet.h5Var = H5Fcreate((baseFileName+"."+fileType).c_str(),
820  H5F_ACC_TRUNC,
821  H5P_DEFAULT,
822  H5P_DEFAULT);
823  }
824 #endif
825  else {
826  UQ_FATAL_TEST_MACRO(true,
827  m_worldRank,
828  "BaseEnvironment::openUnifiedOutputFile(), writeOver=true",
829  "invalid file type");
830  }
831  if ((m_subDisplayFile) && (this->displayVerbosity() > 10)) { // output debug
832  *this->subDisplayFile() << "In BaseEnvironment::openUnifiedOutputFile()"
833  << ": just opened output file with base name '" << baseFileName << "." << fileType
834  << "'"
835  << ", writeOver = " << writeOver
836  << ", options 'out|trunc'"
837  << ", osfvar = " << filePtrSet.ofsVar
838  << std::endl;
839  }
840  }
841  else {
843  // Write at the end of an eventual pre-existing file
844  // 'm' and Ranger nodes behave differently on ofstream constructor... prudenci 2010/03/05
846  if (fileType == UQ_FILE_EXTENSION_FOR_MATLAB_FORMAT) {
847  filePtrSet.ofsVar = new std::ofstream((baseFileName+"."+fileType).c_str(),
848  std::ofstream::out /*| std::ofstream::in*/ | std::ofstream::app);
849  }
850 #ifdef QUESO_HAS_HDF5
851  else if (fileType == UQ_FILE_EXTENSION_FOR_HDF_FORMAT) {
852  filePtrSet.h5Var = H5Fcreate((baseFileName+"."+fileType).c_str(), // TEMPORARY - FIX ME
853  H5F_ACC_TRUNC,
854  H5P_DEFAULT,
855  H5P_DEFAULT);
856  //UQ_FATAL_TEST_MACRO(true,
857  // m_worldRank,
858  // "BaseEnvironment::openUnifiedOutputFile(), writeOver=false",
859  // "hdf file type not supported yet");
860  }
861 #endif
862  else {
863  UQ_FATAL_TEST_MACRO(true,
864  m_worldRank,
865  "BaseEnvironment::openUnifiedOutputFile(), writeOver=false",
866  "invalid file type");
867  }
868  if ((m_subDisplayFile) && (this->displayVerbosity() > 10)) { // output debug
869  *this->subDisplayFile() << "In BaseEnvironment::openUnifiedOutputFile()"
870  << ": just opened output file with base name '" << baseFileName << "." << fileType
871  << "'"
872  << ", writeOver = " << writeOver
873  << ", options 'out|in|app'"
874  << ", osfvar = " << filePtrSet.ofsVar
875  << std::endl;
876  }
877  if ((filePtrSet.ofsVar == NULL ) ||
878  (filePtrSet.ofsVar->is_open() == false)) {
879 #if 0
880  std::cout << "Retrying 2..." << std::endl;
881 #endif
882  delete filePtrSet.ofsVar;
883  filePtrSet.ofsVar = new std::ofstream((baseFileName+"."+fileType).c_str(),
884  std::ofstream::out | std::ofstream::trunc);
885  if ((m_subDisplayFile) && (this->displayVerbosity() > 10)) { // output debug
886  *this->subDisplayFile() << "In BaseEnvironment::openUnifiedOutputFile()"
887  << ": just opened output file with base name '" << baseFileName << "." << fileType
888  << "'"
889  << ", writeOver = " << writeOver
890  << ", options 'out|trunc'"
891  << ", osfvar = " << filePtrSet.ofsVar
892  << std::endl;
893  }
894  }
895  }
896  if (filePtrSet.ofsVar == NULL) {
897  std::cerr << "In BaseEnvironment::openUnifiedOutputFile()"
898  << ": failed to open unified output file with base name '" << baseFileName << "." << fileType
899  << "'"
900  << std::endl;
901  }
902  UQ_FATAL_TEST_MACRO((filePtrSet.ofsVar && filePtrSet.ofsVar->is_open()) == false,
903  this->worldRank(),
904  "openUnifiedOutputFile()",
905  "failed to open output file");
906  //}
907  }
908 
909  return returnValue;
910 }
int subRank() const
Access function for sub-rank.
Definition: Environment.C:263
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
std::ofstream * m_subDisplayFile
Definition: Environment.h:380
#define UQ_FILE_EXTENSION_FOR_HDF_FORMAT
Definition: Defines.h:90
int CheckFilePath(const char *path)
unsigned int displayVerbosity() const
Definition: Environment.C:436
#define UQ_FATAL_TEST_MACRO(test, givenRank, where, what)
Definition: Defines.h:223
BaseEnvironment & QUESO::BaseEnvironment::operator= ( const BaseEnvironment rhs)

Assignment operator. It should not be used be the user.

Definition at line 219 of file Environment.C.

References UQ_FATAL_TEST_MACRO, QUESO::UQ_INVALID_INTERNAL_STATE_RC, and worldRank().

220 {
222  rhs.worldRank(),
223  "BaseEnvironment::operator=()",
224  "code should not execute through here");
225  return *this;
226 }
const int UQ_INVALID_INTERNAL_STATE_RC
Definition: Defines.h:82
#define UQ_FATAL_TEST_MACRO(test, givenRank, where, what)
Definition: Defines.h:223
std::string QUESO::BaseEnvironment::optionsInputFileName ( ) const
std::string QUESO::BaseEnvironment::platformName ( ) const

Access to the platform name.

Definition at line 491 of file Environment.C.

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

492 {
494 }
std::string m_platformName
Platform name.
Definition: Defines.h:160
EnvironmentOptions * m_optionsObj
Definition: Environment.h:387
EnvOptionsValues m_ov
Instance of EnvOptionsValues, a class with default values for QUESO environment.
virtual void QUESO::BaseEnvironment::print ( std::ostream &  os) const
pure virtual
void QUESO::BaseEnvironment::resetIdentifyingString ( const std::string &  newString) const

Reset private attribute m_identifyingString with the value newString.

Definition at line 503 of file Environment.C.

504 {
506  return;
507 }
EnvironmentOptions * m_optionsObj
Definition: Environment.h:387
std::string m_identifyingString
Identifying string.
Definition: Defines.h:163
EnvOptionsValues m_ov
Instance of EnvOptionsValues, a class with default values for QUESO environment.
void QUESO::BaseEnvironment::resetSeed ( int  newSeedOption)

Reset RNG seed.

Definition at line 478 of file Environment.C.

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

479 {
480  m_rngObject->resetSeed(newSeedOption);
481  return;
482 }
virtual void resetSeed(int newSeed)
Resets the seed with value newSeed.
Definition: RngBase.C:60
const RngBase * QUESO::BaseEnvironment::rngObject ( ) const
void QUESO::BaseEnvironment::scanInputFileForMyOptions ( const po::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 378 of file Environment.C.

References m_allOptionsDesc, m_allOptionsMap, m_optionsInputFileName, m_worldRank, and UQ_FATAL_TEST_MACRO.

Referenced by QUESO::InfiniteDimensionalMCMCSamplerOptions::scanOptionsValues(), QUESO::EnvironmentOptions::scanOptionsValues(), QUESO::MLSamplingOptions::scanOptionsValues(), QUESO::StatisticalForwardProblemOptions::scanOptionsValues(), QUESO::StatisticalInverseProblemOptions::scanOptionsValues(), QUESO::MLSamplingLevelOptions::scanOptionsValues(), QUESO::MonteCarloSGOptions::scanOptionsValues(), and QUESO::MetropolisHastingsSGOptions::scanOptionsValues().

379 {
380 #ifdef UQ_USES_COMMAND_LINE_OPTIONS
381  // If you want to use command line options, the following line does *not* work outside 'main.C',
382  // e.g., in the constructor of FullEnvironment:
383  // Line: po::store(po::parse_command_line(argc, argv, *m_allOptionsDesc), *m_allOptionsMap);
384  //
385  // Instead, put the following three lines *immediately after* instantianting the UQ environment
386  // variable "FullEnvironment* env":
387  // Line 1: po::store(po::parse_command_line(argc, argv, env->allOptionsDesc()), env->allOptionsMap());
388  // Line 2: po::notify(env->allOptionsMap());
389  // Line 3: env->getMyOptionValues();
390 #endif
391 
392 #ifdef QUESO_MEMORY_DEBUGGING
393  std::cout << "Entering BaseEnv::scanInputFileForMyOptions()" << std::endl;
394 #endif
395 
397  m_worldRank,
398  "BaseEnvironment::scanInputFileForMyOptions()",
399  "m_allOptionsDesc variable is NULL");
400  m_allOptionsDesc->add(optionsDesc);
401  //if (m_subDisplayFile) {
402  // *m_subDisplayFile << *m_allOptionsDesc
403  // << std::endl;
404  //}
405 
407  m_worldRank,
408  "BaseEnvironment::scanInputFileForMyOptions()",
409  "m_optionsInputFileName is 'nothing'");
410  //std::ifstream ifs(m_optionsInputFileName.c_str());
411  std::ifstream* ifs = new std::ifstream(m_optionsInputFileName.c_str());
412 #ifdef QUESO_MEMORY_DEBUGGING
413  std::cout << "in BaseEnv::scanInputFileForMyOptions(), before store(a)" << std::endl;
414 #endif
415 
417  m_worldRank,
418  "BaseEnvironment::scanInputFileForMyOptions()",
419  "m_allOptionsMap variable is NULL");
420  po::store(po::parse_config_file(*ifs, *m_allOptionsDesc, true), *m_allOptionsMap);
421 #ifdef QUESO_MEMORY_DEBUGGING
422  std::cout << "in BaseEnv::scanInputFileForMyOptions(), after store(a)" << std::endl;
423 #endif
424  po::notify(*m_allOptionsMap);
425 
426  //ifs.close();
427  delete ifs;
428 #ifdef QUESO_MEMORY_DEBUGGING
429  std::cout << "Leaving BaseEnv::scanInputFileForMyOptions()" << std::endl;
430 #endif
431 
432  return;
433 }
po::options_description * m_allOptionsDesc
Definition: Environment.h:363
std::string m_optionsInputFileName
Definition: Environment.h:361
po::variables_map * m_allOptionsMap
Definition: Environment.h:364
#define UQ_FATAL_TEST_MACRO(test, givenRank, where, what)
Definition: Defines.h:223
int QUESO::BaseEnvironment::seed ( ) const

Access to the RNG seed.

Definition at line 472 of file Environment.C.

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

473 {
474  return m_rngObject->seed();
475 }
int seed() const
Sets the seed.
Definition: RngBase.C:54
const MpiComm & QUESO::BaseEnvironment::selfComm ( ) const

Access function for MpiComm self-communicator.

Definition at line 279 of file Environment.C.

References m_selfComm, m_worldRank, and UQ_FATAL_TEST_MACRO.

280 {
282  m_worldRank,
283  "BaseEnvironment::selfComm()",
284  "m_selfComm variable is NULL");
285  return *m_selfComm;
286 }
#define UQ_FATAL_TEST_MACRO(test, givenRank, where, what)
Definition: Defines.h:223
void QUESO::BaseEnvironment::setExceptionalCircumstance ( bool  value) const

Set an exceptional circumstance.

Definition at line 1171 of file Environment.C.

References m_exceptionalCircumstance.

1172 {
1173  m_exceptionalCircumstance = value;
1174  return;
1175 }
void QUESO::BaseEnvironment::setOptionsInputFileAccessState ( bool  newState) const

Definition at line 352 of file Environment.C.

References m_optionsInputFileAccessState.

353 {
355 
356  return;
357 }
const MpiComm & QUESO::BaseEnvironment::subComm ( ) const

Access function for MpiComm sub communicator.

Definition at line 269 of file Environment.C.

References m_subComm, m_worldRank, and UQ_FATAL_TEST_MACRO.

Referenced by QUESO::MiscCheckTheParallelEnvironment().

270 {
272  m_worldRank,
273  "BaseEnvironment::subComm()",
274  "m_subComm variable is NULL");
275  return *m_subComm;
276 }
#define UQ_FATAL_TEST_MACRO(test, givenRank, where, what)
Definition: Defines.h:223
std::ofstream * QUESO::BaseEnvironment::subDisplayFile ( ) const

Access function for m_subDisplayFile (displays file on stream).

Definition at line 305 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(), closeFile(), QUESO::ComputeConditionalGaussianVectorRV(), QUESO::ConcatenatedVectorRealizer< V, M >::ConcatenatedVectorRealizer(), QUESO::ConcatenatedVectorRV< V, M >::ConcatenatedVectorRV(), QUESO::GslVector::cwSetBeta(), QUESO::GslMatrix::determinant(), QUESO::EnvironmentOptions::EnvironmentOptions(), 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::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::InfiniteDimensionalMCMCSamplerOptions::getMyOptionValues(), QUESO::MLSamplingOptions::getMyOptionValues(), QUESO::StatisticalForwardProblemOptions::getMyOptionValues(), QUESO::StatisticalInverseProblemOptions::getMyOptionValues(), QUESO::MonteCarloSGOptions::getMyOptionValues(), QUESO::MetropolisHastingsSGOptions::getMyOptionValues(), QUESO::MLSamplingLevelOptions::getMyOptionValues(), 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::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::InfiniteDimensionalMCMCSamplerOptions::scanOptionsValues(), QUESO::MLSamplingOptions::scanOptionsValues(), QUESO::StatisticalForwardProblemOptions::scanOptionsValues(), QUESO::StatisticalInverseProblemOptions::scanOptionsValues(), QUESO::MLSamplingLevelOptions::scanOptionsValues(), QUESO::MonteCarloSGOptions::scanOptionsValues(), QUESO::MetropolisHastingsSGOptions::scanOptionsValues(), QUESO::SequentialVectorRealizer< V, M >::SequentialVectorRealizer(), 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().

306 {
307  return m_subDisplayFile;
308 }
std::ofstream * m_subDisplayFile
Definition: Environment.h:380
std::string QUESO::BaseEnvironment::subDisplayFileName ( ) const

Access function for m_subDisplayFileName (displays filename on stream).

Definition at line 311 of file Environment.C.

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

312 {
313  if (m_optionsObj == NULL) return ".";
314 
316 }
EnvironmentOptions * m_optionsObj
Definition: Environment.h:387
std::string m_subDisplayFileName
Output filename for sub-screen writing.
Definition: Defines.h:131
EnvOptionsValues m_ov
Instance of EnvOptionsValues, a class with default values for QUESO environment.
RawType_MPI_Group QUESO::BaseEnvironment::subGroup ( ) const

Access function for sub-group.

Definition at line 257 of file Environment.C.

References m_subGroup.

258 {
259  return m_subGroup;
260 }
RawType_MPI_Group m_subGroup
Definition: Environment.h:368
unsigned int QUESO::BaseEnvironment::subId ( ) const

Access function to the number of each sub-environment Id: m_subId.

Definition at line 329 of file Environment.C.

References m_subId.

Referenced by QUESO::MetropolisHastingsSGOptions::getMyOptionValues(), QUESO::MLSamplingLevelOptions::getMyOptionValues(), openOutputFile(), and QUESO::MpiComm::syncPrintDebugMsg().

330 {
331  return m_subId;
332 }
unsigned int m_subId
Definition: Environment.h:366
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 335 of file Environment.C.

References m_subIdString.

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

336 {
337  return m_subIdString;
338 }
std::string m_subIdString
Definition: Environment.h:367
int QUESO::BaseEnvironment::subRank ( ) const
unsigned int QUESO::BaseEnvironment::syncVerbosity ( ) const

Access function to private attribute m_syncVerbosity.

Definition at line 446 of file Environment.C.

References m_optionsObj, QUESO::EnvironmentOptions::m_ov, QUESO::EnvOptionsValues::m_syncVerbosity, m_worldRank, and UQ_FATAL_TEST_MACRO.

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

447 {
449  m_worldRank,
450  "BaseEnvironment::displayVerbosity()",
451  "m_optionsObj variable is NULL");
453 }
unsigned int m_syncVerbosity
Synchronized verbosity.
Definition: Defines.h:146
EnvironmentOptions * m_optionsObj
Definition: Environment.h:387
#define UQ_FATAL_TEST_MACRO(test, givenRank, where, what)
Definition: Defines.h:223
EnvOptionsValues m_ov
Instance of EnvOptionsValues, a class with default values for QUESO environment.
struct timeval QUESO::BaseEnvironment::timevalBegin ( ) const

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

Definition at line 510 of file Environment.C.

511 {
512  return m_timevalBegin;
513 }
struct timeval m_timevalBegin
Definition: Environment.h:383
int QUESO::BaseEnvironment::worldRank ( ) const

Returns the process world rank.

Definition at line 235 of file Environment.C.

References m_worldRank.

Referenced by QUESO::GslVector::atLeastOneComponentBiggerOrEqualThan(), QUESO::GslVector::atLeastOneComponentBiggerThan(), QUESO::GslVector::atLeastOneComponentSmallerOrEqualThan(), QUESO::GslVector::atLeastOneComponentSmallerThan(), BaseEnvironment(), QUESO::BetaVectorRV< V, M >::BetaVectorRV(), QUESO::BoxSubset< V, M >::BoxSubset(), QUESO::GslMatrix::chol(), QUESO::ComputeConditionalGaussianVectorRV(), QUESO::ComputeCovCorrBetweenScalarSequences(), QUESO::ComputeCovCorrMatricesBetweenVectorRvs(), QUESO::ComputeCovCorrMatricesBetweenVectorSequences(), QUESO::ComputeSubGaussian2dKde(), QUESO::ComputeUnifiedGaussian2dKde(), QUESO::ConcatenatedJointPdf< V, M >::ConcatenatedJointPdf(), QUESO::GslVector::copy(), QUESO::GslMatrix::copy(), QUESO::GslVector::cwExtract(), QUESO::GslMatrix::cwExtract(), QUESO::GslVector::cwSet(), QUESO::GslMatrix::cwSet(), QUESO::GslVector::cwSetBeta(), QUESO::GslVector::cwSetConcatenated(), QUESO::GslVector::cwSetGamma(), QUESO::GslVector::cwSetInverseGamma(), QUESO::DiscreteSubset< V, M >::DiscreteSubset(), QUESO::EnvironmentOptions::EnvironmentOptions(), QUESO::ExponentialMatrixCovarianceFunction< P_V, P_M, Q_V, Q_M >::ExponentialMatrixCovarianceFunction(), QUESO::GslMatrix::fillWithBlocksDiagonally(), QUESO::GslMatrix::fillWithBlocksHorizontally(), QUESO::GslMatrix::fillWithBlocksVertically(), QUESO::GslMatrix::fillWithTensorProduct(), QUESO::GslMatrix::fillWithTranspose(), QUESO::FiniteDistribution::FiniteDistribution(), QUESO::GammaVectorRV< V, M >::GammaVectorRV(), QUESO::GaussianVectorRV< V, M >::GaussianVectorRV(), QUESO::EnvironmentOptions::getMyOptionValues(), QUESO::MLSamplingOptions::getMyOptionValues(), QUESO::MetropolisHastingsSGOptions::getMyOptionValues(), QUESO::MLSamplingLevelOptions::getMyOptionValues(), QUESO::GslMatrix::GslMatrix(), QUESO::GslVector::GslVector(), QUESO::InfiniteDimensionalMCMCSamplerOptions::InfiniteDimensionalMCMCSamplerOptions(), QUESO::InstantiateIntersection(), QUESO::GslMatrix::internalSvd(), QUESO::GslMatrix::inverse(), QUESO::InverseGammaVectorRV< V, M >::InverseGammaVectorRV(), QUESO::GslMatrix::invertMultiply(), QUESO::GslMatrix::invertMultiplyForceLU(), QUESO::InvLogitGaussianVectorRV< V, M >::InvLogitGaussianVectorRV(), QUESO::leftDiagScaling(), QUESO::LogNormalVectorRV< V, M >::LogNormalVectorRV(), QUESO::GslVector::matlabDiff(), QUESO::GslVector::matlabLinearInterpExtrap(), QUESO::GslMatrix::matlabLinearInterpExtrap(), QUESO::Matrix::Matrix(), QUESO::MetropolisHastingsSGOptions::MetropolisHastingsSGOptions(), QUESO::MiscCheckTheParallelEnvironment(), QUESO::MonteCarloSGOptions::MonteCarloSGOptions(), QUESO::GslVector::mpiAllQuantile(), QUESO::GslVector::mpiAllReduce(), QUESO::GslVector::mpiBcast(), QUESO::GslMatrix::multiply(), openInputFile(), openOutputFile(), openUnifiedInputFile(), openUnifiedOutputFile(), QUESO::GslMatrix::operator()(), QUESO::operator*(), QUESO::Matrix::operator*=(), QUESO::Vector::operator*=(), QUESO::GslVector::operator*=(), QUESO::GslMatrix::operator*=(), QUESO::Matrix::operator+=(), QUESO::Vector::operator+=(), QUESO::GslVector::operator+=(), QUESO::GslMatrix::operator+=(), QUESO::Matrix::operator-=(), QUESO::Vector::operator-=(), QUESO::GslVector::operator-=(), QUESO::GslMatrix::operator-=(), QUESO::Vector::operator/=(), QUESO::GslVector::operator/=(), QUESO::Matrix::operator=(), QUESO::Vector::operator=(), QUESO::GslVector::operator=(), operator=(), QUESO::operator==(), QUESO::rightDiagScaling(), QUESO::FiniteDistribution::sample(), QUESO::scalarProduct(), QUESO::InfiniteDimensionalMCMCSamplerOptions::scanOptionsValues(), QUESO::EnvironmentOptions::scanOptionsValues(), QUESO::StatisticalForwardProblemOptions::scanOptionsValues(), QUESO::StatisticalInverseProblemOptions::scanOptionsValues(), QUESO::MonteCarloSGOptions::scanOptionsValues(), QUESO::MetropolisHastingsSGOptions::scanOptionsValues(), QUESO::GslVector::sizeGlobal(), QUESO::GslVector::sizeLocal(), QUESO::StatisticalForwardProblemOptions::StatisticalForwardProblemOptions(), QUESO::StatisticalInverseProblem< P_V, P_M >::StatisticalInverseProblem(), QUESO::StatisticalInverseProblemOptions::StatisticalInverseProblemOptions(), QUESO::SubF1F2Gaussian2dKdeIntegral(), QUESO::GslVector::subReadContents(), QUESO::GslMatrix::subReadContents(), QUESO::GslVector::subWriteContents(), QUESO::GslMatrix::subWriteContents(), QUESO::GslMatrix::svd(), QUESO::GslMatrix::svdSolve(), QUESO::GslMatrix::transpose(), QUESO::Vector::Vector(), 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(), QUESO::GslMatrix::zeroLower(), and QUESO::GslMatrix::zeroUpper().

236 {
237  return m_worldRank;
238 }

Member Data Documentation

po::options_description* QUESO::BaseEnvironment::m_allOptionsDesc
protected
po::variables_map* QUESO::BaseEnvironment::m_allOptionsMap
protected
EnvOptionsValues QUESO::BaseEnvironment::m_alternativeOptionsValues
protected

Definition at line 386 of file Environment.h.

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

BasicPdfsBase* QUESO::BaseEnvironment::m_basicPdfs
protected
bool QUESO::BaseEnvironment::m_exceptionalCircumstance
mutableprotected

Definition at line 384 of file Environment.h.

Referenced by exceptionalCircumstance(), and setExceptionalCircumstance().

MpiComm* QUESO::BaseEnvironment::m_fullComm
protected
int QUESO::BaseEnvironment::m_fullCommSize
protected

Definition at line 358 of file Environment.h.

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

bool QUESO::BaseEnvironment::m_fullEnvIsReady
protected

Definition at line 353 of file Environment.h.

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

RawType_MPI_Group QUESO::BaseEnvironment::m_fullGroup
protected

Definition at line 359 of file Environment.h.

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

int QUESO::BaseEnvironment::m_fullRank
protected
MpiComm* QUESO::BaseEnvironment::m_inter0Comm
protected
int QUESO::BaseEnvironment::m_inter0CommSize
protected

Definition at line 378 of file Environment.h.

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

RawType_MPI_Group QUESO::BaseEnvironment::m_inter0Group
protected

Definition at line 375 of file Environment.h.

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

int QUESO::BaseEnvironment::m_inter0Rank
protected

Definition at line 377 of file Environment.h.

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

bool QUESO::BaseEnvironment::m_optionsInputFileAccessState
mutableprotected

Definition at line 362 of file Environment.h.

Referenced by optionsInputFileName(), and setOptionsInputFileAccessState().

std::string QUESO::BaseEnvironment::m_optionsInputFileName
protected
EnvironmentOptions* QUESO::BaseEnvironment::m_optionsObj
protected
RngBase* QUESO::BaseEnvironment::m_rngObject
protected
MpiComm* QUESO::BaseEnvironment::m_selfComm
protected
MpiComm* QUESO::BaseEnvironment::m_subComm
protected
int QUESO::BaseEnvironment::m_subCommSize
protected

Definition at line 371 of file Environment.h.

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

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

Definition at line 368 of file Environment.h.

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

unsigned int QUESO::BaseEnvironment::m_subId
protected

Definition at line 366 of file Environment.h.

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

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

Definition at line 367 of file Environment.h.

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

int QUESO::BaseEnvironment::m_subRank
protected

Definition at line 370 of file Environment.h.

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

struct timeval QUESO::BaseEnvironment::m_timevalBegin
protected

Definition at line 383 of file Environment.h.

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

int QUESO::BaseEnvironment::m_worldRank
protected

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

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