queso-0.53.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_require_msg(asserted, msg)
Definition: asserts.h:69
#define queso_deprecated()
Definition: Defines.h:120
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 1020 of file Environment.C.

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

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

1023 {
1024  std::string fileType(inputFileType);
1025 #ifdef QUESO_HAS_HDF5
1026  // Do nothing
1027 #else
1028  if (fileType == UQ_FILE_EXTENSION_FOR_HDF_FORMAT) {
1029  if (m_subDisplayFile) {
1030  *this->subDisplayFile() << "WARNING in BaseEnvironment::closeFile()"
1031  << ": file format '" << UQ_FILE_EXTENSION_FOR_HDF_FORMAT
1032  << "' has been requested, but this QUESO library has not been built with 'hdf5'"
1033  << ". Code will therefore process the file format '" << UQ_FILE_EXTENSION_FOR_HDF_FORMAT
1034  << "' instead..."
1035  << std::endl;
1036  }
1037  if (this->subRank() == 0) {
1038  std::cerr << "WARNING in BaseEnvironment::closeFile()"
1039  << ": file format '" << UQ_FILE_EXTENSION_FOR_HDF_FORMAT
1040  << "' has been requested, but this QUESO library has not been built with 'hdf5'"
1041  << ". Code will therefore process the file format '" << UQ_FILE_EXTENSION_FOR_HDF_FORMAT
1042  << "' instead..."
1043  << std::endl;
1044  }
1046  }
1047 #endif
1048 
1049  if (fileType == UQ_FILE_EXTENSION_FOR_MATLAB_FORMAT) {
1050  //filePtrSet.ofsVar->close(); // close() crashes on Mac; need to use delete(); why? prudenci 2010/June
1051  delete filePtrSet.ofsVar;
1052  filePtrSet.ofsVar = NULL;
1053 
1054  //filePtrSet.ifsVar->close();
1055  delete filePtrSet.ifsVar;
1056  filePtrSet.ifsVar = NULL;
1057  }
1058 #ifdef QUESO_HAS_HDF5
1059  else if (fileType == UQ_FILE_EXTENSION_FOR_HDF_FORMAT) {
1060  H5Fclose(filePtrSet.h5Var);
1061  }
1062 #endif
1063  else {
1064  queso_error_msg("invalid file type");
1065  }
1066 
1067  return;
1068 }
int subRank() const
Access function for sub-rank.
Definition: Environment.C:241
#define UQ_FILE_EXTENSION_FOR_HDF_FORMAT
Definition: Defines.h:90
#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_MATLAB_FORMAT
Definition: Defines.h:89
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
unsigned int m_displayVerbosity
Verbosity.
#define queso_require_msg(asserted, msg)
Definition: asserts.h:69
bool QUESO::BaseEnvironment::exceptionalCircumstance ( ) const

Decides whether there is an exceptional circumstance.

Definition at line 1078 of file Environment.C.

References m_exceptionalCircumstance.

1079 {
1081 }
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 834 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, and UQ_FILE_EXTENSION_FOR_MATLAB_FORMAT.

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

839 {
840  std::string fileType(inputFileType);
841 #ifdef QUESO_HAS_HDF5
842  // Do nothing
843 #else
844  if (fileType == UQ_FILE_EXTENSION_FOR_HDF_FORMAT) {
845  if (m_subDisplayFile) {
846  *this->subDisplayFile() << "WARNING in BaseEnvironment::openInputFile()"
847  << ": file format '" << UQ_FILE_EXTENSION_FOR_HDF_FORMAT
848  << "' has been requested, but this QUESO library has not been built with 'hdf5'"
849  << ". Code will therefore process the file format '" << UQ_FILE_EXTENSION_FOR_HDF_FORMAT
850  << "' instead..."
851  << std::endl;
852  }
853  if (this->subRank() == 0) {
854  std::cerr << "WARNING in BaseEnvironment::openInputFile()"
855  << ": file format '" << UQ_FILE_EXTENSION_FOR_HDF_FORMAT
856  << "' has been requested, but this QUESO library has not been built with 'hdf5'"
857  << ". Code will therefore process the file format '" << UQ_FILE_EXTENSION_FOR_HDF_FORMAT
858  << "' instead..."
859  << std::endl;
860  }
862  }
863 #endif
864 
865  bool returnValue = true;
866  filePtrSet.ifsVar = NULL;
867  if ((baseFileName == UQ_ENV_FILENAME_FOR_NO_INPUT_FILE) ||
868  (allowedSubEnvIds.find(this->subId()) == allowedSubEnvIds.end() )) {
869  if ((m_subDisplayFile) && (this->displayVerbosity() >= 10)) {
870  *this->subDisplayFile() << "In BaseEnvironment::openInputFile()"
871  << ": no input file opened with base name '" << baseFileName << "." << fileType
872  << "'"
873  << std::endl;
874  }
875  returnValue = false;
876  }
877  else {
879  // Open file
881  if ((m_subDisplayFile) && (this->displayVerbosity() >= 10)) {
882  *this->subDisplayFile() << "In BaseEnvironment::openInputFile()"
883  << ": opening input file with base name '" << baseFileName << "." << fileType
884  << "'"
885  << std::endl;
886  }
887  if (this->subRank() == 0) {
889  // Verify parent directory exists (for cases when a user
890  // specifies a relative path for the desired output file). prudenci 2010/06/26
892  // std::cout << "checking " << baseFileName+"."+fileType << std::endl;
893  int irtrn = CheckFilePath((baseFileName+"."+fileType).c_str());
894  queso_require_greater_equal_msg(irtrn, 0, "unable to verify input path");
895 
896  if (fileType == UQ_FILE_EXTENSION_FOR_MATLAB_FORMAT) {
897  filePtrSet.ifsVar = new std::ifstream((baseFileName+"."+fileType).c_str(),
898  std::ofstream::in);
899  if ((filePtrSet.ifsVar == NULL) || (filePtrSet.ifsVar->is_open() == false)) {
900  std::cerr << "In BaseEnvironment::openInputFile()"
901  << ": failed to open input file with base name '" << baseFileName << "." << fileType
902  << "'"
903  << std::endl;
904  }
905  queso_require_msg(!((filePtrSet.ifsVar == NULL) || (filePtrSet.ifsVar->is_open() == false)), "file with fileName could not be found");
906  }
907 #ifdef QUESO_HAS_HDF5
908  else if (fileType == UQ_FILE_EXTENSION_FOR_HDF_FORMAT) {
909  filePtrSet.h5Var = H5Fopen((baseFileName+"."+fileType).c_str(),
910  H5F_ACC_RDONLY,
911  H5P_DEFAULT);
912  }
913 #endif
914  else {
915  queso_error_msg("invalid file type");
916  }
917  }
918  else {
919  returnValue = false;
920  }
921  //this->subComm().Barrier(); // prudenci-2011-01-17
922  }
923 
924  return returnValue;
925 }
unsigned int displayVerbosity() const
Definition: Environment.C:396
int subRank() const
Access function for sub-rank.
Definition: Environment.C:241
#define UQ_FILE_EXTENSION_FOR_HDF_FORMAT
Definition: Defines.h:90
#define queso_error_msg(msg)
Definition: asserts.h:47
#define queso_require_msg(asserted, msg)
Definition: asserts.h:69
std::ofstream * subDisplayFile() const
Access function for m_subDisplayFile (displays file on stream).
Definition: Environment.C:274
int CheckFilePath(const char *path)
#define UQ_FILE_EXTENSION_FOR_MATLAB_FORMAT
Definition: Defines.h:89
std::ofstream * m_subDisplayFile
Definition: Environment.h:377
#define queso_require_greater_equal_msg(expr1, expr2, msg)
Definition: asserts.h:90
#define UQ_ENV_FILENAME_FOR_NO_INPUT_FILE
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, and UQ_FILE_EXTENSION_FOR_MATLAB_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  filePtrSet.ofsVar = new std::ofstream((baseFileName+"_sub"+this->subIdString()+"."+fileType).c_str(),
567  std::ofstream::out | std::ofstream::trunc);
568  }
569  else if (fileType == UQ_FILE_EXTENSION_FOR_HDF_FORMAT) {
570  queso_error_msg("hdf file type not supported yet");
571  }
572  else {
573  queso_error_msg("invalid file type");
574  }
575  if ((m_subDisplayFile) && (this->displayVerbosity() > 10)) { // output debug
576  *this->subDisplayFile() << "In BaseEnvironment::openOutputFile()"
577  << ": just opened output file with base name '" << baseFileName << "." << fileType
578  << "'"
579  << ", writeOver = " << writeOver
580  << ", options 'out|trunc'"
581  << ", osfvar = " << filePtrSet.ofsVar
582  << std::endl;
583  }
584  }
585  else {
587  // Write at the end of an eventual pre-existing file
589  if (fileType == UQ_FILE_EXTENSION_FOR_MATLAB_FORMAT) {
590 #if 0
591  filePtrSet.ofsVar = new std::ofstream((baseFileName+"_sub"+this->subIdString()+"."+fileType).c_str(),
592  std::ofstream::in);
593  std::cout << "filePtrSet.ofsVar(1) = " << filePtrSet.ofsVar << std::endl;
594  if (filePtrSet.ofsVar) std::cout << "filePtrSet.ofsVar(1)->is_open() = " << filePtrSet.ofsVar->is_open() << std::endl;
595  if (filePtrSet.ofsVar) delete filePtrSet.ofsVar;
596 #endif
597  // 'm' and Ranger nodes behave differently on ofstream constructor... prudenci 2010/03/05
598  filePtrSet.ofsVar = new std::ofstream((baseFileName+"_sub"+this->subIdString()+"."+fileType).c_str(),
599  std::ofstream::out /*| std::ofstream::in*/ | std::ofstream::app);
600  }
601  else if (fileType == UQ_FILE_EXTENSION_FOR_HDF_FORMAT) {
602  queso_error_msg("hdf file type not supported yet");
603  }
604  else {
605  queso_error_msg("invalid file type");
606  }
607  if ((m_subDisplayFile) && (this->displayVerbosity() > 10)) { // output debug
608  *this->subDisplayFile() << "In BaseEnvironment::openOutputFile()"
609  << ": just opened output file with base name '" << baseFileName << "." << fileType
610  << "'"
611  << ", writeOver = " << writeOver
612  << ", options 'out|in|app'"
613  << ", osfvar = " << filePtrSet.ofsVar
614  << std::endl;
615  }
616 
617  if (fileType == UQ_FILE_EXTENSION_FOR_MATLAB_FORMAT) {
618  //std::cout << "filePtrSet.ofsVar(2) = " << filePtrSet.ofsVar << std::endl;
619  //if (filePtrSet.ofsVar) std::cout << "filePtrSet.ofsVar(2)->is_open() = " << filePtrSet.ofsVar->is_open() << std::endl;
620  if ((filePtrSet.ofsVar == NULL ) ||
621  (filePtrSet.ofsVar->is_open() == false)) {
622  //std::cout << "Retrying 1..." << std::endl;
623  delete filePtrSet.ofsVar;
624  filePtrSet.ofsVar = new std::ofstream((baseFileName+"_sub"+this->subIdString()+"."+fileType).c_str(),
625  std::ofstream::out | std::ofstream::trunc);
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|trunc'"
632  << ", osfvar = " << filePtrSet.ofsVar
633  << std::endl;
634  }
635  }
636  } // only for matlab formats
637  }
638  if (filePtrSet.ofsVar != NULL) {
639  if ((m_subDisplayFile) && (this->displayVerbosity() > 10)) { // output debug
640  *this->subDisplayFile() << "In BaseEnvironment::openOutputFile()"
641  << ", subId = " << this->subId()
642  << ": succeeded on opening output file with base name '" << baseFileName << "." << fileType
643  << "'"
644  << ", writeOver = " << writeOver
645  << std::endl;
646  }
647  }
648  else {
649  std::cerr << "In BaseEnvironment::openOutputFile()"
650  << ": failed to open output file with base name '" << baseFileName << "." << fileType
651  << "'"
652  << std::endl;
653  }
654  queso_require_msg((filePtrSet.ofsVar && filePtrSet.ofsVar->is_open()), "failed to open output file");
655  }
656  else {
657  returnValue = false;
658  }
659  //this->subComm().Barrier(); // prudenci-2011-01-17
660  }
661 
662  return returnValue;
663 }
unsigned int displayVerbosity() const
Definition: Environment.C:396
int subRank() const
Access function for sub-rank.
Definition: Environment.C:241
#define UQ_FILE_EXTENSION_FOR_HDF_FORMAT
Definition: Defines.h:90
#define queso_error_msg(msg)
Definition: asserts.h:47
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_msg(asserted, msg)
Definition: asserts.h:69
std::ofstream * subDisplayFile() const
Access function for m_subDisplayFile (displays file on stream).
Definition: Environment.C:274
int CheckFilePath(const char *path)
#define UQ_FILE_EXTENSION_FOR_MATLAB_FORMAT
Definition: Defines.h:89
unsigned int subId() const
Access function to the number of each sub-environment Id: m_subId.
Definition: Environment.C:295
std::ofstream * m_subDisplayFile
Definition: Environment.h:377
#define queso_require_greater_equal_msg(expr1, expr2, msg)
Definition: asserts.h:90
#define UQ_ENV_FILENAME_FOR_NO_OUTPUT_FILE
bool QUESO::BaseEnvironment::openUnifiedInputFile ( const std::string &  fileName,
const std::string &  fileType,
FilePtrSetStruct filePtrSet 
) const

Opens the unified input file.

Definition at line 928 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, and UQ_FILE_EXTENSION_FOR_MATLAB_FORMAT.

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

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

References m_exceptionalCircumstance.

1072 {
1073  m_exceptionalCircumstance = value;
1074  return;
1075 }
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 }
unsigned int m_syncVerbosity
Synchronized verbosity.
EnvOptionsValues * m_optionsObj
Definition: Environment.h:383
#define queso_require_msg(asserted, msg)
Definition: asserts.h:69
struct timeval QUESO::BaseEnvironment::timevalBegin ( ) const

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

Definition at line 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 QUESO::FullEnvironment::FullEnvironment(), and worldRank().


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

Generated on Thu Jun 11 2015 13:52:34 for queso-0.53.0 by  doxygen 1.8.5