queso-0.51.1
Protected Attributes | List of all members
QUESO::SampledVectorCdf< V, M > Class Template Reference

A class for handling sampled vector CDFs. More...

#include <SampledVectorCdf.h>

Inheritance diagram for QUESO::SampledVectorCdf< V, M >:
Inheritance graph
[legend]
Collaboration diagram for QUESO::SampledVectorCdf< V, M >:
Collaboration graph
[legend]

Public Member Functions

Constructor/Destructor methods
 SampledVectorCdf (const char *prefix, const ArrayOfOneDGrids< V, M > &oneDGrids, const ArrayOfOneDTables< V, M > &cdfValues)
 Default constructor. More...
 
 ~SampledVectorCdf ()
 Destructor. More...
 
Mathematical methods
void values (const V &paramValues, V &cdfVec) const
 TODO: Returns the values of the vector CDF at each element of paramValues. More...
 
const BaseScalarCdf< double > & cdf (unsigned int rowId) const
 Returns a scalar CDF stored at row rowId of the vector CDF. More...
 
I/O methods
void print (std::ostream &os) const
 Prints the vector CDF (values of the grid points and of the CDF at such grid points). More...
 
void subWriteContents (const std::string &varNamePrefix, const std::string &fileName, const std::string &fileType, const std::set< unsigned int > &allowedSubEnvIds) const
 Writes the CDF of an allowed sub-environment to a file. More...
 
- Public Member Functions inherited from QUESO::BaseVectorCdf< V, M >
 BaseVectorCdf (const char *prefix, const VectorSet< V, M > &pdfSupport)
 Default constructor. More...
 
virtual ~BaseVectorCdf ()
 Virtual destructor. More...
 
const VectorSet< V, M > & pdfSupport () const
 Returns the image set (support) of the PDF; access to protected attribute m_pdfSupport. More...
 

Protected Attributes

DistArray< SampledScalarCdf
< double > * > 
m_cdfs
 
- Protected Attributes inherited from QUESO::BaseVectorCdf< V, M >
const BaseEnvironmentm_env
 
std::string m_prefix
 
const VectorSet< V, M > & m_pdfSupport
 

Detailed Description

template<class V, class M>
class QUESO::SampledVectorCdf< V, M >

A class for handling sampled vector CDFs.

This class implements a sampled vector cumulative distribution function (CDF), given the grid points where it will be sampled and it returns its values.

Definition at line 48 of file SampledVectorCdf.h.

Constructor & Destructor Documentation

template<class V , class M >
QUESO::SampledVectorCdf< V, M >::SampledVectorCdf ( const char *  prefix,
const ArrayOfOneDGrids< V, M > &  oneDGrids,
const ArrayOfOneDTables< V, M > &  cdfValues 
)

Default constructor.

Instantiates an object of the class given a prefix and the grid points where it will be sampled/evaluated.

Definition at line 31 of file SampledVectorCdf.C.

References QUESO::BaseEnvironment::displayVerbosity(), QUESO::ArrayOfOneDGrids< V, M >::grid(), QUESO::SampledVectorCdf< V, M >::m_cdfs, QUESO::BaseVectorCdf< V, M >::m_env, QUESO::BaseVectorCdf< V, M >::m_prefix, QUESO::ArrayOfOneDTables< V, M >::oneDTable(), and QUESO::BaseEnvironment::subDisplayFile().

35  :
36  BaseVectorCdf<V,M>(prefix,oneDGrids.rowSpace()),
37  m_cdfs(m_pdfSupport.vectorSpace().map(),1)
38 {
39  if ((m_env.subDisplayFile()) && (m_env.displayVerbosity() >= 5)) {
40  *m_env.subDisplayFile() << "Entering SampledVectorCdf<V,M>::constructor()"
41  << ": prefix = " << m_prefix
42  << std::endl;
43  }
44 
45  char strI[65];
46  for (unsigned int i = 0; i < (unsigned int) m_cdfs.MyLength(); ++i) {
47  sprintf(strI,"%u_",i);
48  m_cdfs(i,0) = new SampledScalarCdf<double>(m_env,
49  ((std::string)(m_prefix)+strI).c_str(),
50  oneDGrids.grid(i),
51  cdfValues.oneDTable(i));
52  }
53 
54  if ((m_env.subDisplayFile()) && (m_env.displayVerbosity() >= 5)) {
55  *m_env.subDisplayFile() << "Leaving SampledVectorCdf<V,M>::constructor()"
56  << ": prefix = " << m_prefix
57  << std::endl;
58  }
59 }
const VectorSet< V, M > & m_pdfSupport
Definition: VectorCdf.h:103
std::string m_prefix
Definition: VectorCdf.h:102
const BaseEnvironment & m_env
Definition: VectorCdf.h:101
std::ofstream * subDisplayFile() const
Access function for m_subDisplayFile (displays file on stream).
Definition: Environment.C:305
DistArray< SampledScalarCdf< double > * > m_cdfs
unsigned int displayVerbosity() const
Definition: Environment.C:436
template<class V , class M >
QUESO::SampledVectorCdf< V, M >::~SampledVectorCdf ( )

Destructor.

Definition at line 62 of file SampledVectorCdf.C.

63 {
64  for (unsigned int i = 0; i < (unsigned int) m_cdfs.MyLength(); ++i) {
65  if (m_cdfs(i,0)) delete m_cdfs(i,0);
66  }
67 }
DistArray< SampledScalarCdf< double > * > m_cdfs

Member Function Documentation

template<class V , class M >
const BaseScalarCdf< double > & QUESO::SampledVectorCdf< V, M >::cdf ( unsigned int  rowId) const
virtual

Returns a scalar CDF stored at row rowId of the vector CDF.

Implements QUESO::BaseVectorCdf< V, M >.

Definition at line 84 of file SampledVectorCdf.C.

References UQ_FATAL_TEST_MACRO.

85 {
86  UQ_FATAL_TEST_MACRO(rowId >= m_pdfSupport.vectorSpace().dimLocal(),
87  m_env.worldRank(),
88  "SampledVectorCdf<T>::cdf()",
89  "rowId is out of range");
90 
91  SampledVectorCdf<V,M>* tmp = const_cast<SampledVectorCdf<V,M>*>(this);
92  return *(tmp->m_cdfs(rowId,0));
93 
94 }
const VectorSet< V, M > & m_pdfSupport
Definition: VectorCdf.h:103
int worldRank() const
Returns the process world rank.
Definition: Environment.C:235
const BaseEnvironment & m_env
Definition: VectorCdf.h:101
#define UQ_FATAL_TEST_MACRO(test, givenRank, where, what)
Definition: Defines.h:223
template<class V , class M >
void QUESO::SampledVectorCdf< V, M >::print ( std::ostream &  os) const
virtual

Prints the vector CDF (values of the grid points and of the CDF at such grid points).

Implements QUESO::BaseVectorCdf< V, M >.

Definition at line 98 of file SampledVectorCdf.C.

References QUESO::SampledVectorCdf< V, M >::m_cdfs.

99 {
100  SampledVectorCdf<V,M>* tmp = const_cast<SampledVectorCdf<V,M>*>(this);
101  for (unsigned int i = 0; i < (unsigned int) m_cdfs.MyLength(); ++i) {
102  os << (*tmp->m_cdfs(i,0))
103  << std::endl;
104  }
105 
106  return;
107 }
DistArray< SampledScalarCdf< double > * > m_cdfs
template<class V , class M >
void QUESO::SampledVectorCdf< V, M >::subWriteContents ( const std::string &  varNamePrefix,
const std::string &  fileName,
const std::string &  fileType,
const std::set< unsigned int > &  allowedSubEnvIds 
) const
virtual

Writes the CDF of an allowed sub-environment to a file.

Reimplemented from QUESO::BaseVectorCdf< V, M >.

Definition at line 111 of file SampledVectorCdf.C.

References UQ_FATAL_TEST_MACRO.

116 {
118  m_env.worldRank(),
119  "SampledVectorCdf<V,M>::subWriteContents()",
120  "unexpected subRank");
121 
122  SampledVectorCdf<V,M>* tmp = const_cast<SampledVectorCdf<V,M>*>(this);
123  char compId[16+1];
124  for (unsigned int i = 0; i < (unsigned int) m_cdfs.MyLength(); ++i) {
125  sprintf(compId,"%d",i);
126  tmp->m_cdfs(i,0)->subWriteContents(varNamePrefix+"comp"+compId,fileName,fileType,allowedSubEnvIds);
127  }
128 
129  return;
130 }
int subRank() const
Access function for sub-rank.
Definition: Environment.C:263
int worldRank() const
Returns the process world rank.
Definition: Environment.C:235
const BaseEnvironment & m_env
Definition: VectorCdf.h:101
DistArray< SampledScalarCdf< double > * > m_cdfs
#define UQ_FATAL_TEST_MACRO(test, givenRank, where, what)
Definition: Defines.h:223
template<class V , class M >
void QUESO::SampledVectorCdf< V, M >::values ( const V &  paramValues,
V &  cdfVec 
) const
virtual

TODO: Returns the values of the vector CDF at each element of paramValues.

Todo:
: implement me!

Implements QUESO::BaseVectorCdf< V, M >.

Definition at line 71 of file SampledVectorCdf.C.

References UQ_FATAL_TEST_MACRO.

74 {
76  m_env.worldRank(),
77  "SampledVectorCdf<V,M>::cdfVec()",
78  "incomplete code");
79  return;
80 }
int worldRank() const
Returns the process world rank.
Definition: Environment.C:235
const BaseEnvironment & m_env
Definition: VectorCdf.h:101
#define UQ_FATAL_TEST_MACRO(test, givenRank, where, what)
Definition: Defines.h:223

Member Data Documentation

template<class V, class M>
DistArray<SampledScalarCdf<double>*> QUESO::SampledVectorCdf< V, M >::m_cdfs
protected

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

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