queso-0.55.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...
 
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...
 
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
 
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 193 of file Environment.h.

Constructor & Destructor Documentation

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

Default constructor.

Definition at line 136 of file Environment.C.

References m_optionsInputFileName.

139  :
140  m_fullEnvIsReady (false),
141  m_worldRank (-1),
142  m_fullComm (NULL),
143  m_fullRank (-1),
144  m_fullCommSize (1),
147  m_allOptionsDesc (NULL),
148  m_allOptionsMap (NULL),
149  m_subComm (NULL),
150  m_subRank (-1),
151  m_subCommSize (1),
152  m_selfComm (NULL),
153  m_inter0Comm (NULL),
154  m_inter0Rank (-1),
155  m_inter0CommSize (1),
156  m_subDisplayFile (NULL),
157  m_rngObject (NULL),
158  m_basicPdfs (NULL),
160  m_optionsObj (alternativeOptionsValues)
161 {
162  if (passedOptionsInputFileName) m_optionsInputFileName = passedOptionsInputFileName;
163 }
BasicPdfsBase * m_basicPdfs
Definition: Environment.h:379
boost::program_options::variables_map * m_allOptionsMap
Definition: Environment.h:361
std::string m_optionsInputFileName
Definition: Environment.h:358
EnvOptionsValues * m_optionsObj
Definition: Environment.h:383
boost::program_options::options_description * m_allOptionsDesc
Definition: Environment.h:360
std::ofstream * m_subDisplayFile
Definition: Environment.h:377
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 165 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.

166 {
167  //if (m_subDisplayFile) {
168  // *m_subDisplayFile << "Entering BaseEnvironment::destructor()"
169  // << std::endl;
170  //}
171 
172  struct timeval timevalNow;
173  /*int iRC = 0;*/
174  /*iRC = */gettimeofday(&timevalNow, NULL);
175 
176  if( this->displayVerbosity() > 0 )
177  {
178  if (m_subDisplayFile) {
179  *m_subDisplayFile << "Ending run at " << ctime(&timevalNow.tv_sec)
180  << "Total run time = " << timevalNow.tv_sec - m_timevalBegin.tv_sec
181  << " seconds"
182  << std::endl;
183  }
184 
185  if (m_fullRank == 0) {
186  std::cout << "Ending run at " << ctime(&timevalNow.tv_sec)
187  << "Total run time = " << timevalNow.tv_sec - m_timevalBegin.tv_sec
188  << " seconds"
189  << std::endl;
190  }
191  }
192 
193  if (m_allOptionsMap) {
194  delete m_allOptionsMap;
195  delete m_allOptionsDesc;
196  }
197 
198  if (m_basicPdfs) delete m_basicPdfs;
199  if (m_rngObject) delete m_rngObject;
200 
201  //if (m_subDisplayFile) {
202  // *m_subDisplayFile << "Leaving BaseEnvironment::destructor()"
203  // << std::endl;
204  //}
205 
207  if (m_inter0Comm ) delete m_inter0Comm;
208  if (m_selfComm ) delete m_selfComm;
209  if (m_subComm ) delete m_subComm;
210  if (m_fullComm ) delete m_fullComm;
211 }
unsigned int displayVerbosity() const
Definition: Environment.C:400
BasicPdfsBase * m_basicPdfs
Definition: Environment.h:379
boost::program_options::variables_map * m_allOptionsMap
Definition: Environment.h:361
boost::program_options::options_description * m_allOptionsDesc
Definition: Environment.h:360
struct timeval m_timevalBegin
Definition: Environment.h:380
std::ofstream * m_subDisplayFile
Definition: Environment.h:377

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 340 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().

341 {
343 
344  queso_require_msg(m_allOptionsMap, "m_allOptionsMap variable is NULL");
345  return *m_allOptionsMap;
346 }
boost::program_options::variables_map * m_allOptionsMap
Definition: Environment.h:361
#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 440 of file Environment.C.

References m_basicPdfs.

441 {
442  return m_basicPdfs;
443 }
BasicPdfsBase * m_basicPdfs
Definition: Environment.h:379
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 1034 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().

1037 {
1038  std::string fileType(inputFileType);
1039 #ifdef QUESO_HAS_HDF5
1040  // Do nothing
1041 #else
1042  if (fileType == UQ_FILE_EXTENSION_FOR_HDF_FORMAT) {
1043  if (m_subDisplayFile) {
1044  *this->subDisplayFile() << "WARNING in BaseEnvironment::closeFile()"
1045  << ": file format '" << UQ_FILE_EXTENSION_FOR_HDF_FORMAT
1046  << "' has been requested, but this QUESO library has not been built with 'hdf5'"
1047  << ". Code will therefore process the file format '" << UQ_FILE_EXTENSION_FOR_HDF_FORMAT
1048  << "' instead..."
1049  << std::endl;
1050  }
1051  if (this->subRank() == 0) {
1052  std::cerr << "WARNING in BaseEnvironment::closeFile()"
1053  << ": file format '" << UQ_FILE_EXTENSION_FOR_HDF_FORMAT
1054  << "' has been requested, but this QUESO library has not been built with 'hdf5'"
1055  << ". Code will therefore process the file format '" << UQ_FILE_EXTENSION_FOR_HDF_FORMAT
1056  << "' instead..."
1057  << std::endl;
1058  }
1060  }
1061 #endif
1062 
1063  if ((fileType == UQ_FILE_EXTENSION_FOR_MATLAB_FORMAT) ||
1064  (fileType == UQ_FILE_EXTENSION_FOR_TXT_FORMAT)) {
1065  //filePtrSet.ofsVar->close(); // close() crashes on Mac; need to use delete(); why? prudenci 2010/June
1066  delete filePtrSet.ofsVar;
1067  filePtrSet.ofsVar = NULL;
1068 
1069  //filePtrSet.ifsVar->close();
1070  delete filePtrSet.ifsVar;
1071  filePtrSet.ifsVar = NULL;
1072  }
1073 #ifdef QUESO_HAS_HDF5
1074  else if (fileType == UQ_FILE_EXTENSION_FOR_HDF_FORMAT) {
1075  H5Fclose(filePtrSet.h5Var);
1076  }
1077 #endif
1078  else {
1079  queso_error_msg("invalid file type");
1080  }
1081 
1082  return;
1083 }
#define UQ_FILE_EXTENSION_FOR_MATLAB_FORMAT
Definition: Defines.h:102
#define UQ_FILE_EXTENSION_FOR_TXT_FORMAT
Definition: Defines.h:103
int subRank() const
Access function for sub-rank.
Definition: Environment.C:245
#define queso_error_msg(msg)
Definition: asserts.h:47
std::ofstream * subDisplayFile() const
Access function for m_subDisplayFile (displays file on stream).
Definition: Environment.C:278
#define UQ_FILE_EXTENSION_FOR_HDF_FORMAT
Definition: Defines.h:104
std::ofstream * m_subDisplayFile
Definition: Environment.h:377
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 400 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::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::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::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(), 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().

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

Decides whether there is an exceptional circumstance.

Definition at line 1093 of file Environment.C.

References m_exceptionalCircumstance.

1094 {
1096 }
const MpiComm & QUESO::BaseEnvironment::fullComm ( ) const

Access function for MpiComm full communicator.

Definition at line 232 of file Environment.C.

References m_fullComm, and queso_require_msg.

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

233 {
234  queso_require_msg(m_fullComm, "m_fullComm variable is NULL");
235  return *m_fullComm;
236 }
#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 214 of file Environment.C.

References m_fullEnvIsReady.

215 {
216  return m_fullEnvIsReady;
217 }
int QUESO::BaseEnvironment::fullRank ( ) const
std::string QUESO::BaseEnvironment::identifyingString ( ) const

Access function to private attribute m_identifyingString: identifying string.

Definition at line 452 of file Environment.C.

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

453 {
455 }
EnvOptionsValues * m_optionsObj
Definition: Environment.h:383
std::string m_identifyingString
Identifying string.
const MpiComm & QUESO::BaseEnvironment::inter0Comm ( ) const

Access function for MpiComm inter0-communicator.

Definition at line 271 of file Environment.C.

References m_inter0Comm, and queso_require_msg.

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

272 {
273  queso_require_msg(m_inter0Comm, "m_inter0Comm variable is NULL");
274  return *m_inter0Comm;
275 }
#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 292 of file Environment.C.

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

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

293 {
294  queso_require_msg(m_optionsObj, "m_optionsObj variable is NULL");
296 }
EnvOptionsValues * m_optionsObj
Definition: Environment.h:383
#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 846 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().

851 {
852  std::string fileType(inputFileType);
853 #ifdef QUESO_HAS_HDF5
854  // Do nothing
855 #else
856  if (fileType == UQ_FILE_EXTENSION_FOR_HDF_FORMAT) {
857  if (m_subDisplayFile) {
858  *this->subDisplayFile() << "WARNING in BaseEnvironment::openInputFile()"
859  << ": file format '" << UQ_FILE_EXTENSION_FOR_HDF_FORMAT
860  << "' has been requested, but this QUESO library has not been built with 'hdf5'"
861  << ". Code will therefore process the file format '" << UQ_FILE_EXTENSION_FOR_HDF_FORMAT
862  << "' instead..."
863  << std::endl;
864  }
865  if (this->subRank() == 0) {
866  std::cerr << "WARNING in BaseEnvironment::openInputFile()"
867  << ": file format '" << UQ_FILE_EXTENSION_FOR_HDF_FORMAT
868  << "' has been requested, but this QUESO library has not been built with 'hdf5'"
869  << ". Code will therefore process the file format '" << UQ_FILE_EXTENSION_FOR_HDF_FORMAT
870  << "' instead..."
871  << std::endl;
872  }
874  }
875 #endif
876 
877  bool returnValue = true;
878  filePtrSet.ifsVar = NULL;
879  if ((baseFileName == UQ_ENV_FILENAME_FOR_NO_INPUT_FILE) ||
880  (allowedSubEnvIds.find(this->subId()) == allowedSubEnvIds.end() )) {
881  if ((m_subDisplayFile) && (this->displayVerbosity() >= 10)) {
882  *this->subDisplayFile() << "In BaseEnvironment::openInputFile()"
883  << ": no input file opened with base name '" << baseFileName << "." << fileType
884  << "'"
885  << std::endl;
886  }
887  returnValue = false;
888  }
889  else {
891  // Open file
893  if ((m_subDisplayFile) && (this->displayVerbosity() >= 10)) {
894  *this->subDisplayFile() << "In BaseEnvironment::openInputFile()"
895  << ": opening input file with base name '" << baseFileName << "." << fileType
896  << "'"
897  << std::endl;
898  }
899  if (this->subRank() == 0) {
901  // Verify parent directory exists (for cases when a user
902  // specifies a relative path for the desired output file). prudenci 2010/06/26
904  // std::cout << "checking " << baseFileName+"."+fileType << std::endl;
905  int irtrn = CheckFilePath((baseFileName+"."+fileType).c_str());
906  queso_require_greater_equal_msg(irtrn, 0, "unable to verify input path");
907 
908  if ((fileType == UQ_FILE_EXTENSION_FOR_MATLAB_FORMAT) ||
909  (fileType == UQ_FILE_EXTENSION_FOR_TXT_FORMAT)) {
910  filePtrSet.ifsVar = new std::ifstream((baseFileName+"."+fileType).c_str(),
911  std::ofstream::in);
912  if ((filePtrSet.ifsVar == NULL) || (filePtrSet.ifsVar->is_open() == false)) {
913  std::cerr << "In BaseEnvironment::openInputFile()"
914  << ": failed to open input file with base name '" << baseFileName << "." << fileType
915  << "'"
916  << std::endl;
917  }
918  queso_require_msg(!((filePtrSet.ifsVar == NULL) || (filePtrSet.ifsVar->is_open() == false)), "file with fileName could not be found");
919  }
920 #ifdef QUESO_HAS_HDF5
921  else if (fileType == UQ_FILE_EXTENSION_FOR_HDF_FORMAT) {
922  filePtrSet.h5Var = H5Fopen((baseFileName+"."+fileType).c_str(),
923  H5F_ACC_RDONLY,
924  H5P_DEFAULT);
925  }
926 #endif
927  else {
928  queso_error_msg("invalid file type");
929  }
930  }
931  else {
932  returnValue = false;
933  }
934  //this->subComm().Barrier(); // prudenci-2011-01-17
935  }
936 
937  return returnValue;
938 }
#define UQ_FILE_EXTENSION_FOR_MATLAB_FORMAT
Definition: Defines.h:102
unsigned int displayVerbosity() const
Definition: Environment.C:400
#define UQ_FILE_EXTENSION_FOR_TXT_FORMAT
Definition: Defines.h:103
int subRank() const
Access function for sub-rank.
Definition: Environment.C:245
#define queso_error_msg(msg)
Definition: asserts.h:47
#define queso_require_msg(asserted, msg)
Definition: asserts.h:69
#define queso_require_greater_equal_msg(expr1, expr2, msg)
Definition: asserts.h:90
#define UQ_ENV_FILENAME_FOR_NO_INPUT_FILE
std::ofstream * subDisplayFile() const
Access function for m_subDisplayFile (displays file on stream).
Definition: Environment.C:278
#define UQ_FILE_EXTENSION_FOR_HDF_FORMAT
Definition: Defines.h:104
int CheckFilePath(const char *path)
std::ofstream * m_subDisplayFile
Definition: Environment.h:377
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 471 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().

477 {
478  std::string fileType(inputFileType);
479 #ifdef QUESO_HAS_HDF5
480  // Do nothing
481 #else
482  if (fileType == UQ_FILE_EXTENSION_FOR_HDF_FORMAT) {
483  if (m_subDisplayFile) {
484  *this->subDisplayFile() << "WARNING in BaseEnvironment::openOutputFile()"
485  << ": file format '" << UQ_FILE_EXTENSION_FOR_HDF_FORMAT
486  << "' has been requested, but this QUESO library has not been built with 'hdf5'"
487  << ". Code will therefore process the file format '" << UQ_FILE_EXTENSION_FOR_HDF_FORMAT
488  << "' instead..."
489  << std::endl;
490  }
491  if (this->subRank() == 0) {
492  std::cerr << "WARNING in BaseEnvironment::openOutputFile()"
493  << ": file format '" << UQ_FILE_EXTENSION_FOR_HDF_FORMAT
494  << "' has been requested, but this QUESO library has not been built with 'hdf5'"
495  << ". Code will therefore process the file format '" << UQ_FILE_EXTENSION_FOR_HDF_FORMAT
496  << "' instead..."
497  << std::endl;
498  }
500  }
501 #endif
502 
503  bool returnValue = true;
504  filePtrSet.ofsVar = NULL;
505  if ((baseFileName == UQ_ENV_FILENAME_FOR_NO_OUTPUT_FILE) ||
506  (allowedSubEnvIds.find(this->subId()) == allowedSubEnvIds.end() )) {
507  if ((m_subDisplayFile) && (this->displayVerbosity() > 10)) { // output debug
508  *this->subDisplayFile() << "In BaseEnvironment::openOutputFile()"
509  << ", subId = " << this->subId()
510  << ": no output file opened with base name '" << baseFileName << "." << fileType
511  << "'"
512  << ", writeOver = " << writeOver
513  << std::endl;
514  }
515  returnValue = false;
516  }
517  else {
519  // Open file
521  if ((m_subDisplayFile) && (this->displayVerbosity() > 10)) { // output debug
522  *this->subDisplayFile() << "In BaseEnvironment::openOutputFile()"
523  << ", subId = " << this->subId()
524  << ": opening output file with base name '" << baseFileName << "." << fileType
525  << "'"
526  << ", writeOver = " << writeOver
527  << std::endl;
528  }
529 
530  if (this->subRank() == 0) {
531 #if 0
532  std::cout << "In BaseEnvironment::openOutputFile()"
533  << ": opening output file with base name '" << baseFileName << "." << fileType
534  << "'"
535  << ", writeOver = " << writeOver
536  << std::endl;
537 #endif
538 
540  // Verify parent directory exists (for cases when a user
541  // specifies a relative path for the desired output file).
543  // std::cout << "checking " << baseFileName+"_sub"+this->subIdString()+"."+fileType << std::endl;
544  if ((m_subDisplayFile) && (this->displayVerbosity() > 10)) { // output debug
545  *this->subDisplayFile() << "In BaseEnvironment::openOutputFile()"
546  << ", subId = " << this->subId()
547  << ", trying to open output file with base name '" << baseFileName << "." << fileType
548  << "'"
549  << ", writeOver = " << writeOver
550  << ": calling CheckFilePath()..."
551  << std::endl;
552  }
553  int irtrn = CheckFilePath((baseFileName+"_sub"+this->subIdString()+"."+fileType).c_str());
554  if ((m_subDisplayFile) && (this->displayVerbosity() > 10)) { // output debug
555  *this->subDisplayFile() << "In BaseEnvironment::openOutputFile()"
556  << ", subId = " << this->subId()
557  << ", trying to open output file with base name '" << baseFileName << "." << fileType
558  << "'"
559  << ", writeOver = " << writeOver
560  << ": returned from CheckFilePath() with irtrn = " << irtrn
561  << std::endl;
562  }
563  queso_require_greater_equal_msg(irtrn, 0, "unable to verify output path");
564 
565  if (writeOver) {
567  // Write over an eventual pre-existing file
569  if ((fileType == UQ_FILE_EXTENSION_FOR_MATLAB_FORMAT) ||
570  (fileType == UQ_FILE_EXTENSION_FOR_TXT_FORMAT)) {
571  filePtrSet.ofsVar = new std::ofstream((baseFileName+"_sub"+this->subIdString()+"."+fileType).c_str(),
572  std::ofstream::out | std::ofstream::trunc);
573  }
574  else if (fileType == UQ_FILE_EXTENSION_FOR_HDF_FORMAT) {
575  queso_error_msg("hdf file type not supported yet");
576  }
577  else {
578  queso_error_msg("invalid file type");
579  }
580  if ((m_subDisplayFile) && (this->displayVerbosity() > 10)) { // output debug
581  *this->subDisplayFile() << "In BaseEnvironment::openOutputFile()"
582  << ": just opened output file with base name '" << baseFileName << "." << fileType
583  << "'"
584  << ", writeOver = " << writeOver
585  << ", options 'out|trunc'"
586  << ", osfvar = " << filePtrSet.ofsVar
587  << std::endl;
588  }
589  }
590  else {
592  // Write at the end of an eventual pre-existing file
594  if ((fileType == UQ_FILE_EXTENSION_FOR_MATLAB_FORMAT) ||
595  (fileType == UQ_FILE_EXTENSION_FOR_TXT_FORMAT)) {
596 #if 0
597  filePtrSet.ofsVar = new std::ofstream((baseFileName+"_sub"+this->subIdString()+"."+fileType).c_str(),
598  std::ofstream::in);
599  std::cout << "filePtrSet.ofsVar(1) = " << filePtrSet.ofsVar << std::endl;
600  if (filePtrSet.ofsVar) std::cout << "filePtrSet.ofsVar(1)->is_open() = " << filePtrSet.ofsVar->is_open() << std::endl;
601  if (filePtrSet.ofsVar) delete filePtrSet.ofsVar;
602 #endif
603  // 'm' and Ranger nodes behave differently on ofstream constructor... prudenci 2010/03/05
604  filePtrSet.ofsVar = new std::ofstream((baseFileName+"_sub"+this->subIdString()+"."+fileType).c_str(),
605  std::ofstream::out /*| std::ofstream::in*/ | std::ofstream::app);
606  }
607 #ifdef QUESO_HAS_HDF5
608  else if (fileType == UQ_FILE_EXTENSION_FOR_HDF_FORMAT) {
609  std::string fullFileName =
610  baseFileName+"_sub"+this->subIdString()+"."+fileType;
611 
612  // Use H5F_ACC_EXCL because not overwriting, so fail on existing file
613  filePtrSet.h5Var = H5Fcreate(fullFileName.c_str(),
614  H5F_ACC_EXCL,
615  H5P_DEFAULT,
616  H5P_DEFAULT);
617 
619  filePtrSet.h5Var, 0,
620  "error opening file `" << fullFileName << "`");
621  }
622 #endif
623  else {
624  queso_error_msg("invalid file type");
625  }
626  if ((m_subDisplayFile) && (this->displayVerbosity() > 10)) { // output debug
627  *this->subDisplayFile() << "In BaseEnvironment::openOutputFile()"
628  << ": just opened output file with base name '" << baseFileName << "." << fileType
629  << "'"
630  << ", writeOver = " << writeOver
631  << ", options 'out|in|app'"
632  << ", osfvar = " << filePtrSet.ofsVar
633  << std::endl;
634  }
635 
636  if (fileType == UQ_FILE_EXTENSION_FOR_MATLAB_FORMAT) {
637  //std::cout << "filePtrSet.ofsVar(2) = " << filePtrSet.ofsVar << std::endl;
638  //if (filePtrSet.ofsVar) std::cout << "filePtrSet.ofsVar(2)->is_open() = " << filePtrSet.ofsVar->is_open() << std::endl;
639  if ((filePtrSet.ofsVar == NULL ) ||
640  (filePtrSet.ofsVar->is_open() == false)) {
641  //std::cout << "Retrying 1..." << std::endl;
642  delete filePtrSet.ofsVar;
643  filePtrSet.ofsVar = new std::ofstream((baseFileName+"_sub"+this->subIdString()+"."+fileType).c_str(),
644  std::ofstream::out | std::ofstream::trunc);
645  if ((m_subDisplayFile) && (this->displayVerbosity() > 10)) { // output debug
646  *this->subDisplayFile() << "In BaseEnvironment::openOutputFile()"
647  << ": just opened output file with base name '" << baseFileName << "." << fileType
648  << "'"
649  << ", writeOver = " << writeOver
650  << ", options 'out|trunc'"
651  << ", osfvar = " << filePtrSet.ofsVar
652  << std::endl;
653  }
654  }
655  } // only for matlab formats
656  }
657 
658  // Check the file actually opened
659  if ((fileType == UQ_FILE_EXTENSION_FOR_MATLAB_FORMAT) ||
660  (fileType == UQ_FILE_EXTENSION_FOR_TXT_FORMAT)) {
662  (filePtrSet.ofsVar && filePtrSet.ofsVar->is_open()),
663  "failed to open output file");
664  }
665  }
666  else {
667  returnValue = false;
668  }
669  //this->subComm().Barrier(); // prudenci-2011-01-17
670  }
671 
672  return returnValue;
673 }
#define UQ_FILE_EXTENSION_FOR_MATLAB_FORMAT
Definition: Defines.h:102
unsigned int displayVerbosity() const
Definition: Environment.C:400
#define UQ_ENV_FILENAME_FOR_NO_OUTPUT_FILE
#define UQ_FILE_EXTENSION_FOR_TXT_FORMAT
Definition: Defines.h:103
int subRank() const
Access function for sub-rank.
Definition: Environment.C:245
#define queso_error_msg(msg)
Definition: asserts.h:47
#define queso_require_msg(asserted, msg)
Definition: asserts.h:69
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:305
#define queso_require_greater_equal_msg(expr1, expr2, msg)
Definition: asserts.h:90
std::ofstream * subDisplayFile() const
Access function for m_subDisplayFile (displays file on stream).
Definition: Environment.C:278
#define UQ_FILE_EXTENSION_FOR_HDF_FORMAT
Definition: Defines.h:104
unsigned int subId() const
Access function to the number of each sub-environment Id: m_subId.
Definition: Environment.C:299
int CheckFilePath(const char *path)
std::ofstream * m_subDisplayFile
Definition: Environment.h:377
bool QUESO::BaseEnvironment::openUnifiedInputFile ( const std::string &  fileName,
const std::string &  fileType,
FilePtrSetStruct filePtrSet 
) const

Opens the unified input file.

Definition at line 941 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.

945 {
946  std::string fileType(inputFileType);
947 #ifdef QUESO_HAS_HDF5
948  // Do nothing
949 #else
950  if (fileType == UQ_FILE_EXTENSION_FOR_HDF_FORMAT) {
951  if (m_subDisplayFile) {
952  *this->subDisplayFile() << "WARNING in BaseEnvironment::openUnifiedInputFile()"
953  << ": file format '" << UQ_FILE_EXTENSION_FOR_HDF_FORMAT
954  << "' has been requested, but this QUESO library has not been built with 'hdf5'"
955  << ". Code will therefore process the file format '" << UQ_FILE_EXTENSION_FOR_HDF_FORMAT
956  << "' instead..."
957  << std::endl;
958  }
959  if (this->subRank() == 0) {
960  std::cerr << "WARNING in BaseEnvironment::openUnifiedInputFile()"
961  << ": file format '" << UQ_FILE_EXTENSION_FOR_HDF_FORMAT
962  << "' has been requested, but this QUESO library has not been built with 'hdf5'"
963  << ". Code will therefore process the file format '" << UQ_FILE_EXTENSION_FOR_HDF_FORMAT
964  << "' instead..."
965  << std::endl;
966  }
968  }
969 #endif
970 
971  bool returnValue = true;
972  filePtrSet.ifsVar = NULL;
973  if (baseFileName == UQ_ENV_FILENAME_FOR_NO_INPUT_FILE) {
974  if ((m_subDisplayFile) && (this->displayVerbosity() >= 10)) {
975  *this->subDisplayFile() << "In BaseEnvironment::openUnifiedInputFile()"
976  << ": no input file opened with base name '" << baseFileName << "." << fileType
977  << "'"
978  << std::endl;
979  }
980  returnValue = false;
981  }
982  else {
984  // Open file
986  if ((m_subDisplayFile) && (this->displayVerbosity() >= 10)) {
987  *this->subDisplayFile() << "In BaseEnvironment::openUnifiedInputFile()"
988  << ": opening input file with base name '" << baseFileName << "." << fileType
989  << "'"
990  << std::endl;
991  }
992  if (this->subRank() == 0) { // Needed ???????? prudenci 2010-11-11
994  // Verify parent directory exists (for cases when a user
995  // specifies a relative path for the desired output file). prudenci 2010/06/26
997  // std::cout << "checking " << baseFileName+"."+fileType << std::endl;
998  int irtrn = CheckFilePath((baseFileName+"."+fileType).c_str());
999  queso_require_greater_equal_msg(irtrn, 0, "unable to verify input path");
1000 
1001  if ((fileType == UQ_FILE_EXTENSION_FOR_MATLAB_FORMAT) ||
1002  (fileType == UQ_FILE_EXTENSION_FOR_TXT_FORMAT)) {
1003  filePtrSet.ifsVar = new std::ifstream((baseFileName+"."+fileType).c_str(),
1004  std::ofstream::in);
1005  if ((filePtrSet.ifsVar == NULL) || (filePtrSet.ifsVar->is_open() == false)) {
1006  std::cerr << "In BaseEnvironment::openUnifiedInputFile()"
1007  << ": failed to open input file with base name '" << baseFileName << "." << fileType
1008  << "'"
1009  << std::endl;
1010  }
1011  queso_require_msg(!((filePtrSet.ifsVar == NULL) || (filePtrSet.ifsVar->is_open() == false)), "file with fileName could not be found");
1012  }
1013 #ifdef QUESO_HAS_HDF5
1014  else if (fileType == UQ_FILE_EXTENSION_FOR_HDF_FORMAT) {
1015  filePtrSet.h5Var = H5Fopen((baseFileName+"."+fileType).c_str(),
1016  H5F_ACC_RDONLY,
1017  H5P_DEFAULT);
1018  }
1019 #endif
1020  else {
1021  queso_error_msg("invalid file type");
1022  }
1023  }
1024  //else {
1025  // returnValue = false;
1026  //}
1027  //this->subComm().Barrier();
1028  }
1029 
1030  return returnValue;
1031 }
#define UQ_FILE_EXTENSION_FOR_MATLAB_FORMAT
Definition: Defines.h:102
unsigned int displayVerbosity() const
Definition: Environment.C:400
#define UQ_FILE_EXTENSION_FOR_TXT_FORMAT
Definition: Defines.h:103
int subRank() const
Access function for sub-rank.
Definition: Environment.C:245
#define queso_error_msg(msg)
Definition: asserts.h:47
#define queso_require_msg(asserted, msg)
Definition: asserts.h:69
#define queso_require_greater_equal_msg(expr1, expr2, msg)
Definition: asserts.h:90
#define UQ_ENV_FILENAME_FOR_NO_INPUT_FILE
std::ofstream * subDisplayFile() const
Access function for m_subDisplayFile (displays file on stream).
Definition: Environment.C:278
#define UQ_FILE_EXTENSION_FOR_HDF_FORMAT
Definition: Defines.h:104
int CheckFilePath(const char *path)
std::ofstream * m_subDisplayFile
Definition: Environment.h:377
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 676 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.

681 {
682  std::string fileType(inputFileType);
683 #ifdef QUESO_HAS_HDF5
684  // Do nothing
685 #else
686  if (fileType == UQ_FILE_EXTENSION_FOR_HDF_FORMAT) {
687  if (m_subDisplayFile) {
688  *this->subDisplayFile() << "WARNING in BaseEnvironment::openUnifiedOutputFile()"
689  << ": file format '" << UQ_FILE_EXTENSION_FOR_HDF_FORMAT
690  << "' has been requested, but this QUESO library has not been built with 'hdf5'"
691  << ". Code will therefore process the file format '" << UQ_FILE_EXTENSION_FOR_HDF_FORMAT
692  << "' instead..."
693  << std::endl;
694  }
695  if (this->subRank() == 0) {
696  std::cerr << "WARNING in BaseEnvironment::openUnifiedOutputFile()"
697  << ": file format '" << UQ_FILE_EXTENSION_FOR_HDF_FORMAT
698  << "' has been requested, but this QUESO library has not been built with 'hdf5'"
699  << ". Code will therefore process the file format '" << UQ_FILE_EXTENSION_FOR_HDF_FORMAT
700  << "' instead..."
701  << std::endl;
702  }
704  }
705 #endif
706 
707  bool returnValue = true;
708  filePtrSet.ofsVar = NULL;
709  if (baseFileName == ".") {
710  if ((m_subDisplayFile) && (this->displayVerbosity() > 10)) { // output debug
711  *this->subDisplayFile() << "In BaseEnvironment::openUnifiedOutputFile()"
712  << ": no unified output file opened with base name '" << baseFileName << "." << fileType
713  << "'"
714  << ", writeOver = " << writeOver
715  << std::endl;
716  }
717  returnValue = false;
718  }
719  else {
721  // Open file
723  if ((m_subDisplayFile) && (this->displayVerbosity() > 10)) { // output debug
724  *this->subDisplayFile() << "In BaseEnvironment::openUnifiedOutputFile()"
725  << ": opening unified output file with base name '" << baseFileName << "." << fileType
726  << "'"
727  << ", writeOver = " << writeOver
728  << std::endl;
729  }
730 
731 
732  //if ((this->subRank () == 0) &&
733  // (this->inter0Rank() == 0)) {
734 #if 0
735  std::cout << "In BaseEnvironment::openUnifiedOutputFile()"
736  << ": opening output file with base name '" << baseFileName << "." << fileType
737  << "'"
738  << ", writeOver = " << writeOver
739  << std::endl;
740 #endif
741  // Verify parent directory exists (for cases when a user
743  // specifies a relative path for the desired output file). prudenci 2010/06/26
745  // std::cout << "checking " << baseFileName+"."+fileType << std::endl;
746  int irtrn = CheckFilePath((baseFileName+"."+fileType).c_str());
747  queso_require_greater_equal_msg(irtrn, 0, "unable to verify output path");
748 
749  if (writeOver) {
751  // Write over an eventual pre-existing file
753  if ((fileType == UQ_FILE_EXTENSION_FOR_MATLAB_FORMAT) ||
754  (fileType == UQ_FILE_EXTENSION_FOR_TXT_FORMAT)) {
755  filePtrSet.ofsVar = new std::ofstream((baseFileName+"."+fileType).c_str(),
756  std::ofstream::out | std::ofstream::trunc);
757  }
758 #ifdef QUESO_HAS_HDF5
759  else if (fileType == UQ_FILE_EXTENSION_FOR_HDF_FORMAT) {
760  filePtrSet.h5Var = H5Fcreate((baseFileName+"."+fileType).c_str(),
761  H5F_ACC_TRUNC,
762  H5P_DEFAULT,
763  H5P_DEFAULT);
764  }
765 #endif
766  else {
767  queso_error_msg("invalid file type");
768  }
769  if ((m_subDisplayFile) && (this->displayVerbosity() > 10)) { // output debug
770  *this->subDisplayFile() << "In BaseEnvironment::openUnifiedOutputFile()"
771  << ": just opened output file with base name '" << baseFileName << "." << fileType
772  << "'"
773  << ", writeOver = " << writeOver
774  << ", options 'out|trunc'"
775  << ", osfvar = " << filePtrSet.ofsVar
776  << std::endl;
777  }
778  }
779  else {
781  // Write at the end of an eventual pre-existing file
782  // 'm' and Ranger nodes behave differently on ofstream constructor... prudenci 2010/03/05
784  if ((fileType == UQ_FILE_EXTENSION_FOR_MATLAB_FORMAT) ||
785  (fileType == UQ_FILE_EXTENSION_FOR_TXT_FORMAT)) {
786  filePtrSet.ofsVar = new std::ofstream((baseFileName+"."+fileType).c_str(),
787  std::ofstream::out /*| std::ofstream::in*/ | std::ofstream::app);
788  }
789 #ifdef QUESO_HAS_HDF5
790  else if (fileType == UQ_FILE_EXTENSION_FOR_HDF_FORMAT) {
791  filePtrSet.h5Var = H5Fcreate((baseFileName+"."+fileType).c_str(), // TEMPORARY - FIX ME
792  H5F_ACC_TRUNC,
793  H5P_DEFAULT,
794  H5P_DEFAULT);
795 
796  // m_worldRank,
797  // "BaseEnvironment::openUnifiedOutputFile(), writeOver=false",
798  // "hdf file type not supported yet");
799  }
800 #endif
801  else {
802  queso_error_msg("invalid file type");
803  }
804  if ((m_subDisplayFile) && (this->displayVerbosity() > 10)) { // output debug
805  *this->subDisplayFile() << "In BaseEnvironment::openUnifiedOutputFile()"
806  << ": just opened output file with base name '" << baseFileName << "." << fileType
807  << "'"
808  << ", writeOver = " << writeOver
809  << ", options 'out|in|app'"
810  << ", osfvar = " << filePtrSet.ofsVar
811  << std::endl;
812  }
813  if ((filePtrSet.ofsVar == NULL ) ||
814  (filePtrSet.ofsVar->is_open() == false)) {
815 #if 0
816  std::cout << "Retrying 2..." << std::endl;
817 #endif
818  delete filePtrSet.ofsVar;
819  filePtrSet.ofsVar = new std::ofstream((baseFileName+"."+fileType).c_str(),
820  std::ofstream::out | std::ofstream::trunc);
821  if ((m_subDisplayFile) && (this->displayVerbosity() > 10)) { // output debug
822  *this->subDisplayFile() << "In BaseEnvironment::openUnifiedOutputFile()"
823  << ": just opened output file with base name '" << baseFileName << "." << fileType
824  << "'"
825  << ", writeOver = " << writeOver
826  << ", options 'out|trunc'"
827  << ", osfvar = " << filePtrSet.ofsVar
828  << std::endl;
829  }
830  }
831  }
832  if (filePtrSet.ofsVar == NULL) {
833  std::cerr << "In BaseEnvironment::openUnifiedOutputFile()"
834  << ": failed to open unified output file with base name '" << baseFileName << "." << fileType
835  << "'"
836  << std::endl;
837  }
838  queso_require_msg((filePtrSet.ofsVar && filePtrSet.ofsVar->is_open()), "failed to open output file");
839  //}
840  }
841 
842  return returnValue;
843 }
#define UQ_FILE_EXTENSION_FOR_MATLAB_FORMAT
Definition: Defines.h:102
unsigned int displayVerbosity() const
Definition: Environment.C:400
#define UQ_FILE_EXTENSION_FOR_TXT_FORMAT
Definition: Defines.h:103
int subRank() const
Access function for sub-rank.
Definition: Environment.C:245
#define queso_error_msg(msg)
Definition: asserts.h:47
#define queso_require_msg(asserted, msg)
Definition: asserts.h:69
#define queso_require_greater_equal_msg(expr1, expr2, msg)
Definition: asserts.h:90
std::ofstream * subDisplayFile() const
Access function for m_subDisplayFile (displays file on stream).
Definition: Environment.C:278
#define UQ_FILE_EXTENSION_FOR_HDF_FORMAT
Definition: Defines.h:104
int CheckFilePath(const char *path)
std::ofstream * m_subDisplayFile
Definition: Environment.h:377
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 311 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().

312 {
314  return m_optionsInputFileName;
315  }
316  else {
317  return "";
318  }
319 }
std::string m_optionsInputFileName
Definition: Environment.h:358
std::string QUESO::BaseEnvironment::platformName ( ) const

Access to the platform name.

Definition at line 446 of file Environment.C.

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

447 {
449 }
EnvOptionsValues * m_optionsObj
Definition: Environment.h:383
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 458 of file Environment.C.

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

459 {
460  m_optionsObj->m_identifyingString = newString;
461  return;
462 }
EnvOptionsValues * m_optionsObj
Definition: Environment.h:383
std::string m_identifyingString
Identifying string.
void QUESO::BaseEnvironment::resetSeed ( int  newSeedOption)

Reset RNG seed.

Definition at line 433 of file Environment.C.

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

434 {
435  m_rngObject->resetSeed(newSeedOption);
436  return;
437 }
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 349 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().

350 {
352 
353 #ifdef UQ_USES_COMMAND_LINE_OPTIONS
354  // If you want to use command line options, the following line does *not* work outside 'main.C',
355  // e.g., in the constructor of FullEnvironment:
356  // Line: boost::program_options::store(boost::program_options::parse_command_line(argc, argv, *m_allOptionsDesc), *m_allOptionsMap);
357  //
358  // Instead, put the following three lines *immediately after* instantianting the UQ environment
359  // variable "FullEnvironment* env":
360  // Line 1: boost::program_options::store(boost::program_options::parse_command_line(argc, argv, env->allOptionsDesc()), env->allOptionsMap());
361  // Line 2: boost::program_options::notify(env->allOptionsMap());
362  // Line 3: env->getMyOptionValues();
363 #endif
364 
365 #ifdef QUESO_MEMORY_DEBUGGING
366  std::cout << "Entering BaseEnv::scanInputFileForMyOptions()" << std::endl;
367 #endif
368 
369  queso_require_msg(m_allOptionsDesc, "m_allOptionsDesc variable is NULL");
370  m_allOptionsDesc->add(optionsDesc);
371  //if (m_subDisplayFile) {
372  // *m_subDisplayFile << *m_allOptionsDesc
373  // << std::endl;
374  //}
375 
376  queso_require_not_equal_to_msg(m_optionsInputFileName, "", "m_optionsInputFileName is 'nothing'");
377  //std::ifstream ifs(m_optionsInputFileName.c_str());
378  std::ifstream* ifs = new std::ifstream(m_optionsInputFileName.c_str());
379 #ifdef QUESO_MEMORY_DEBUGGING
380  std::cout << "in BaseEnv::scanInputFileForMyOptions(), before store(a)" << std::endl;
381 #endif
382 
383  queso_require_msg(m_allOptionsMap, "m_allOptionsMap variable is NULL");
384  boost::program_options::store(boost::program_options::parse_config_file(*ifs, *m_allOptionsDesc, true), *m_allOptionsMap);
385 #ifdef QUESO_MEMORY_DEBUGGING
386  std::cout << "in BaseEnv::scanInputFileForMyOptions(), after store(a)" << std::endl;
387 #endif
388  boost::program_options::notify(*m_allOptionsMap);
389 
390  //ifs.close();
391  delete ifs;
392 #ifdef QUESO_MEMORY_DEBUGGING
393  std::cout << "Leaving BaseEnv::scanInputFileForMyOptions()" << std::endl;
394 #endif
395 
396  return;
397 }
boost::program_options::variables_map * m_allOptionsMap
Definition: Environment.h:361
std::string m_optionsInputFileName
Definition: Environment.h:358
#define queso_require_not_equal_to_msg(expr1, expr2, msg)
Definition: asserts.h:86
#define queso_deprecated()
Definition: Defines.h:134
#define queso_require_msg(asserted, msg)
Definition: asserts.h:69
boost::program_options::options_description * m_allOptionsDesc
Definition: Environment.h:360
int QUESO::BaseEnvironment::seed ( ) const

Access to the RNG seed.

Definition at line 427 of file Environment.C.

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

428 {
429  return m_rngObject->seed();
430 }
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 258 of file Environment.C.

References m_selfComm, and queso_require_msg.

259 {
260  queso_require_msg(m_selfComm, "m_selfComm variable is NULL");
261  return *m_selfComm;
262 }
#define queso_require_msg(asserted, msg)
Definition: asserts.h:69
void QUESO::BaseEnvironment::setExceptionalCircumstance ( bool  value) const

Set an exceptional circumstance.

Definition at line 1086 of file Environment.C.

References m_exceptionalCircumstance.

1087 {
1088  m_exceptionalCircumstance = value;
1089  return;
1090 }
void QUESO::BaseEnvironment::setOptionsInputFileAccessState ( bool  newState) const

Definition at line 322 of file Environment.C.

References m_optionsInputFileAccessState.

323 {
325 
326  return;
327 }
const MpiComm & QUESO::BaseEnvironment::subComm ( ) const

Access function for MpiComm sub communicator.

Definition at line 251 of file Environment.C.

References m_subComm, and queso_require_msg.

Referenced by QUESO::MiscCheckTheParallelEnvironment().

252 {
253  queso_require_msg(m_subComm, "m_subComm variable is NULL");
254  return *m_subComm;
255 }
#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 278 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::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().

279 {
280  return m_subDisplayFile;
281 }
std::ofstream * m_subDisplayFile
Definition: Environment.h:377
std::string QUESO::BaseEnvironment::subDisplayFileName ( ) const

Access function for m_subDisplayFileName (displays filename on stream).

Definition at line 284 of file Environment.C.

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

285 {
286  if (m_optionsObj == NULL) return ".";
287 
289 }
EnvOptionsValues * m_optionsObj
Definition: Environment.h:383
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 239 of file Environment.C.

References m_subGroup.

240 {
241  return m_subGroup;
242 }
RawType_MPI_Group m_subGroup
Definition: Environment.h:365
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 305 of file Environment.C.

References m_subIdString.

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

306 {
307  return m_subIdString;
308 }
std::string m_subIdString
Definition: Environment.h:364
int QUESO::BaseEnvironment::subRank ( ) const
unsigned int QUESO::BaseEnvironment::syncVerbosity ( ) const

Access function to private attribute m_syncVerbosity.

Definition at line 407 of file Environment.C.

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

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

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

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

Definition at line 465 of file Environment.C.

466 {
467  return m_timevalBegin;
468 }
struct timeval m_timevalBegin
Definition: Environment.h:380
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
bool QUESO::BaseEnvironment::m_exceptionalCircumstance
mutableprotected

Definition at line 381 of file Environment.h.

Referenced by exceptionalCircumstance(), and setExceptionalCircumstance().

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

Definition at line 355 of file Environment.h.

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

bool QUESO::BaseEnvironment::m_fullEnvIsReady
protected

Definition at line 350 of file Environment.h.

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

RawType_MPI_Group QUESO::BaseEnvironment::m_fullGroup
protected

Definition at line 356 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 375 of file Environment.h.

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

RawType_MPI_Group QUESO::BaseEnvironment::m_inter0Group
protected

Definition at line 372 of file Environment.h.

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

int QUESO::BaseEnvironment::m_inter0Rank
protected

Definition at line 374 of file Environment.h.

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

bool QUESO::BaseEnvironment::m_optionsInputFileAccessState
mutableprotected

Definition at line 359 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
MpiComm* QUESO::BaseEnvironment::m_subComm
protected
int QUESO::BaseEnvironment::m_subCommSize
protected

Definition at line 368 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 365 of file Environment.h.

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

unsigned int QUESO::BaseEnvironment::m_subId
protected

Definition at line 363 of file Environment.h.

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

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

Definition at line 364 of file Environment.h.

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

int QUESO::BaseEnvironment::m_subRank
protected

Definition at line 367 of file Environment.h.

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

struct timeval QUESO::BaseEnvironment::m_timevalBegin
protected

Definition at line 380 of file Environment.h.

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

int QUESO::BaseEnvironment::m_worldRank
protected

Definition at line 351 of file Environment.h.

Referenced by worldRank().


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

Generated on Fri Jun 17 2016 14:17:43 for queso-0.55.0 by  doxygen 1.8.5