queso-0.53.0
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 = GslVector, class M = GslMatrix>
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 51 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 }
unsigned int displayVerbosity() const
Definition: Environment.C:396
DistArray< SampledScalarCdf< double > * > m_cdfs
std::string m_prefix
Definition: VectorCdf.h:99
std::ofstream * subDisplayFile() const
Access function for m_subDisplayFile (displays file on stream).
Definition: Environment.C:274
const BaseEnvironment & m_env
Definition: VectorCdf.h:98
const VectorSet< V, M > & m_pdfSupport
Definition: VectorCdf.h:100
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 81 of file SampledVectorCdf.C.

References queso_require_less_msg.

82 {
83  queso_require_less_msg(rowId, m_pdfSupport.vectorSpace().dimLocal(), "rowId is out of range");
84 
85  SampledVectorCdf<V,M>* tmp = const_cast<SampledVectorCdf<V,M>*>(this);
86  return *(tmp->m_cdfs(rowId,0));
87 
88 }
#define queso_require_less_msg(expr1, expr2, msg)
Definition: asserts.h:87
const VectorSet< V, M > & m_pdfSupport
Definition: VectorCdf.h:100
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 92 of file SampledVectorCdf.C.

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

93 {
94  SampledVectorCdf<V,M>* tmp = const_cast<SampledVectorCdf<V,M>*>(this);
95  for (unsigned int i = 0; i < (unsigned int) m_cdfs.MyLength(); ++i) {
96  os << (*tmp->m_cdfs(i,0))
97  << std::endl;
98  }
99 
100  return;
101 }
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 105 of file SampledVectorCdf.C.

References queso_require_greater_equal_msg.

110 {
111  queso_require_greater_equal_msg(m_env.subRank(), 0, "unexpected subRank");
112 
113  SampledVectorCdf<V,M>* tmp = const_cast<SampledVectorCdf<V,M>*>(this);
114  char compId[16+1];
115  for (unsigned int i = 0; i < (unsigned int) m_cdfs.MyLength(); ++i) {
116  sprintf(compId,"%d",i);
117  tmp->m_cdfs(i,0)->subWriteContents(varNamePrefix+"comp"+compId,fileName,fileType,allowedSubEnvIds);
118  }
119 
120  return;
121 }
int subRank() const
Access function for sub-rank.
Definition: Environment.C:241
DistArray< SampledScalarCdf< double > * > m_cdfs
const BaseEnvironment & m_env
Definition: VectorCdf.h:98
#define queso_require_greater_equal_msg(expr1, expr2, msg)
Definition: asserts.h:90
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 queso_error_msg.

74 {
75  queso_error_msg("incomplete code");
76  return;
77 }
#define queso_error_msg(msg)
Definition: asserts.h:47

Member Data Documentation

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

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

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