queso-0.54.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 132 of file Environment.C.

References m_optionsInputFileName.

135  :
136  m_fullEnvIsReady (false),
137  m_worldRank (-1),
138  m_fullComm (NULL),
139  m_fullRank (-1),
140  m_fullCommSize (1),
143  m_allOptionsDesc (NULL),
144  m_allOptionsMap (NULL),
145  m_subComm (NULL),
146  m_subRank (-1),
147  m_subCommSize (1),
148  m_selfComm (NULL),
149  m_inter0Comm (NULL),
150  m_inter0Rank (-1),
151  m_inter0CommSize (1),
152  m_subDisplayFile (NULL),
153  m_rngObject (NULL),
154  m_basicPdfs (NULL),
156  m_optionsObj (alternativeOptionsValues)
157 {
158  if (passedOptionsInputFileName) m_optionsInputFileName = passedOptionsInputFileName;
159 }
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 161 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.

162 {
163  //if (m_subDisplayFile) {
164  // *m_subDisplayFile << "Entering BaseEnvironment::destructor()"
165  // << std::endl;
166  //}
167 
168  struct timeval timevalNow;
169  /*int iRC = 0;*/
170  /*iRC = */gettimeofday(&timevalNow, NULL);
171 
172  if( this->displayVerbosity() > 0 )
173  {
174  if (m_subDisplayFile) {
175  *m_subDisplayFile << "Ending run at " << ctime(&timevalNow.tv_sec)
176  << "Total run time = " << timevalNow.tv_sec - m_timevalBegin.tv_sec
177  << " seconds"
178  << std::endl;
179  }
180 
181  if (m_fullRank == 0) {
182  std::cout << "Ending run at " << ctime(&timevalNow.tv_sec)
183  << "Total run time = " << timevalNow.tv_sec - m_timevalBegin.tv_sec
184  << " seconds"
185  << std::endl;
186  }
187  }
188 
189  if (m_allOptionsMap) {
190  delete m_allOptionsMap;
191  delete m_allOptionsDesc;
192  }
193 
194  if (m_basicPdfs) delete m_basicPdfs;
195  if (m_rngObject) delete m_rngObject;
196 
197  //if (m_subDisplayFile) {
198  // *m_subDisplayFile << "Leaving BaseEnvironment::destructor()"
199  // << std::endl;
200  //}
201 
203  if (m_inter0Comm ) delete m_inter0Comm;
204  if (m_selfComm ) delete m_selfComm;
205  if (m_subComm ) delete m_subComm;
206  if (m_fullComm ) delete m_fullComm;
207 }
unsigned int displayVerbosity() const
Definition: Environment.C:396
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 336 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().

337 {
339 
340  queso_require_msg(m_allOptionsMap, "m_allOptionsMap variable is NULL");
341  return *m_allOptionsMap;
342 }
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 436 of file Environment.C.

References m_basicPdfs.

437 {
438  return m_basicPdfs;
439 }
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 1026 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().

1029 {
1030  std::string fileType(inputFileType);
1031 #ifdef QUESO_HAS_HDF5
1032  // Do nothing
1033 #else
1034  if (fileType == UQ_FILE_EXTENSION_FOR_HDF_FORMAT) {
1035  if (m_subDisplayFile) {
1036  *this->subDisplayFile() << "WARNING in BaseEnvironment::closeFile()"
1037  << ": file format '" << UQ_FILE_EXTENSION_FOR_HDF_FORMAT
1038  << "' has been requested, but this QUESO library has not been built with 'hdf5'"
1039  << ". Code will therefore process the file format '" << UQ_FILE_EXTENSION_FOR_HDF_FORMAT
1040  << "' instead..."
1041  << std::endl;
1042  }
1043  if (this->subRank() == 0) {
1044  std::cerr << "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  }
1052  }
1053 #endif
1054 
1055  if ((fileType == UQ_FILE_EXTENSION_FOR_MATLAB_FORMAT) ||
1056  (fileType == UQ_FILE_EXTENSION_FOR_TXT_FORMAT)) {
1057  //filePtrSet.ofsVar->close(); // close() crashes on Mac; need to use delete(); why? prudenci 2010/June
1058  delete filePtrSet.ofsVar;
1059  filePtrSet.ofsVar = NULL;
1060 
1061  //filePtrSet.ifsVar->close();
1062  delete filePtrSet.ifsVar;
1063  filePtrSet.ifsVar = NULL;
1064  }
1065 #ifdef QUESO_HAS_HDF5
1066  else if (fileType == UQ_FILE_EXTENSION_FOR_HDF_FORMAT) {
1067  H5Fclose(filePtrSet.h5Var);
1068  }
1069 #endif
1070  else {
1071  queso_error_msg("invalid file type");
1072  }
1073 
1074  return;
1075 }
#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:241
#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:274
#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 396 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().

397 {
398  queso_require_msg(m_optionsObj, "m_optionsObj variable is NULL");
400 }
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 1085 of file Environment.C.

References m_exceptionalCircumstance.

1086 {
1088 }
const MpiComm & QUESO::BaseEnvironment::fullComm ( ) const

Access function for MpiComm full communicator.

Definition at line 228 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().

229 {
230  queso_require_msg(m_fullComm, "m_fullComm variable is NULL");
231  return *m_fullComm;
232 }
#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 210 of file Environment.C.

References m_fullEnvIsReady.

211 {
212  return m_fullEnvIsReady;
213 }
int QUESO::BaseEnvironment::fullRank ( ) const
std::string QUESO::BaseEnvironment::identifyingString ( ) const

Access function to private attribute m_identifyingString: identifying string.

Definition at line 448 of file Environment.C.

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

449 {
451 }
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 267 of file Environment.C.

References m_inter0Comm, and queso_require_msg.

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

268 {
269  queso_require_msg(m_inter0Comm, "m_inter0Comm variable is NULL");
270  return *m_inter0Comm;
271 }
#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 288 of file Environment.C.

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

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

289 {
290  queso_require_msg(m_optionsObj, "m_optionsObj variable is NULL");
292 }
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 838 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().

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

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

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

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

308 {
310  return m_optionsInputFileName;
311  }
312  else {
313  return "";
314  }
315 }
std::string m_optionsInputFileName
Definition: Environment.h:358
std::string QUESO::BaseEnvironment::platformName ( ) const

Access to the platform name.

Definition at line 442 of file Environment.C.

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

443 {
445 }
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 454 of file Environment.C.

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

455 {
456  m_optionsObj->m_identifyingString = newString;
457  return;
458 }
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 429 of file Environment.C.

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

430 {
431  m_rngObject->resetSeed(newSeedOption);
432  return;
433 }
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 345 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().

346 {
348 
349 #ifdef UQ_USES_COMMAND_LINE_OPTIONS
350  // If you want to use command line options, the following line does *not* work outside 'main.C',
351  // e.g., in the constructor of FullEnvironment:
352  // Line: boost::program_options::store(boost::program_options::parse_command_line(argc, argv, *m_allOptionsDesc), *m_allOptionsMap);
353  //
354  // Instead, put the following three lines *immediately after* instantianting the UQ environment
355  // variable "FullEnvironment* env":
356  // Line 1: boost::program_options::store(boost::program_options::parse_command_line(argc, argv, env->allOptionsDesc()), env->allOptionsMap());
357  // Line 2: boost::program_options::notify(env->allOptionsMap());
358  // Line 3: env->getMyOptionValues();
359 #endif
360 
361 #ifdef QUESO_MEMORY_DEBUGGING
362  std::cout << "Entering BaseEnv::scanInputFileForMyOptions()" << std::endl;
363 #endif
364 
365  queso_require_msg(m_allOptionsDesc, "m_allOptionsDesc variable is NULL");
366  m_allOptionsDesc->add(optionsDesc);
367  //if (m_subDisplayFile) {
368  // *m_subDisplayFile << *m_allOptionsDesc
369  // << std::endl;
370  //}
371 
372  queso_require_not_equal_to_msg(m_optionsInputFileName, "", "m_optionsInputFileName is 'nothing'");
373  //std::ifstream ifs(m_optionsInputFileName.c_str());
374  std::ifstream* ifs = new std::ifstream(m_optionsInputFileName.c_str());
375 #ifdef QUESO_MEMORY_DEBUGGING
376  std::cout << "in BaseEnv::scanInputFileForMyOptions(), before store(a)" << std::endl;
377 #endif
378 
379  queso_require_msg(m_allOptionsMap, "m_allOptionsMap variable is NULL");
380  boost::program_options::store(boost::program_options::parse_config_file(*ifs, *m_allOptionsDesc, true), *m_allOptionsMap);
381 #ifdef QUESO_MEMORY_DEBUGGING
382  std::cout << "in BaseEnv::scanInputFileForMyOptions(), after store(a)" << std::endl;
383 #endif
384  boost::program_options::notify(*m_allOptionsMap);
385 
386  //ifs.close();
387  delete ifs;
388 #ifdef QUESO_MEMORY_DEBUGGING
389  std::cout << "Leaving BaseEnv::scanInputFileForMyOptions()" << std::endl;
390 #endif
391 
392  return;
393 }
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 423 of file Environment.C.

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

424 {
425  return m_rngObject->seed();
426 }
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 254 of file Environment.C.

References m_selfComm, and queso_require_msg.

255 {
256  queso_require_msg(m_selfComm, "m_selfComm variable is NULL");
257  return *m_selfComm;
258 }
#define queso_require_msg(asserted, msg)
Definition: asserts.h:69
void QUESO::BaseEnvironment::setExceptionalCircumstance ( bool  value) const

Set an exceptional circumstance.

Definition at line 1078 of file Environment.C.

References m_exceptionalCircumstance.

1079 {
1080  m_exceptionalCircumstance = value;
1081  return;
1082 }
void QUESO::BaseEnvironment::setOptionsInputFileAccessState ( bool  newState) const

Definition at line 318 of file Environment.C.

References m_optionsInputFileAccessState.

319 {
321 
322  return;
323 }
const MpiComm & QUESO::BaseEnvironment::subComm ( ) const

Access function for MpiComm sub communicator.

Definition at line 247 of file Environment.C.

References m_subComm, and queso_require_msg.

Referenced by QUESO::MiscCheckTheParallelEnvironment().

248 {
249  queso_require_msg(m_subComm, "m_subComm variable is NULL");
250  return *m_subComm;
251 }
#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 274 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().

275 {
276  return m_subDisplayFile;
277 }
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 280 of file Environment.C.

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

281 {
282  if (m_optionsObj == NULL) return ".";
283 
285 }
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 235 of file Environment.C.

References m_subGroup.

236 {
237  return m_subGroup;
238 }
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 301 of file Environment.C.

References m_subIdString.

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

302 {
303  return m_subIdString;
304 }
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 403 of file Environment.C.

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

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

404 {
405  queso_require_msg(m_optionsObj, "m_optionsObj variable is NULL");
407 }
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 461 of file Environment.C.

462 {
463  return m_timevalBegin;
464 }
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:10:52 for queso-0.54.0 by  doxygen 1.8.5