queso-0.53.0
Private Attributes | List of all members
QUESO::ArrayOfOneDGrids< V, M > Class Template Reference

Class to accommodate arrays of one-dimensional grid. More...

#include <ArrayOfOneDGrids.h>

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

Public Member Functions

Constructor/Destructor methods
 ArrayOfOneDGrids (const char *prefix, const VectorSpace< V, M > &rowSpace)
 Default constructor. More...
 
 ~ArrayOfOneDGrids ()
 Destructor. More...
 
Property methods
const VectorSpace< V, M > & rowSpace () const
 Returns the (vector) space to which the row belongs to. More...
 
const V & sizes () const
 Returns an array with the sizes of the grids. More...
 
const V & minPositions () const
 Returns an array with the minimum position of each grid. More...
 
const V & maxPositions () const
 Returns an array with the maximum position of each grid. More...
 
Math methods
void setUniformGrids (const V &sizesVec, const V &minPositionsVec, const V &maxPositionsVec)
 Sets an array of uniform grids. More...
 
Accessor methods
const BaseOneDGrid< double > & grid (unsigned int rowId) const
 Returns the grid stored in the rowId-th position of the array of grids. More...
 

Private Attributes

const BaseEnvironmentm_env
 
std::string m_prefix
 
const VectorSpace< V, M > & m_rowSpace
 
DistArray< BaseOneDGrid
< double > * > 
m_oneDGrids
 
V * m_sizes
 
V * m_minPositions
 
V * m_maxPositions
 

I/O methods

void print (std::ostream &os) const
 Prints the values of the array of grids (points). More...
 
std::ostream & operator<< (std::ostream &os, const ArrayOfOneDGrids< V, M > &obj)
 

Detailed Description

template<class V = GslVector, class M = GslMatrix>
class QUESO::ArrayOfOneDGrids< V, M >

Class to accommodate arrays of one-dimensional grid.

Arrays of one-dimensional grids are necessary in the calculation, for instance, of CDFs and MDF of vector functions (refer to BaseVectorCdf, BaseVectorMdf, and derived classes).

Definition at line 47 of file ArrayOfOneDGrids.h.

Constructor & Destructor Documentation

template<class V , class M >
QUESO::ArrayOfOneDGrids< V, M >::ArrayOfOneDGrids ( const char *  prefix,
const VectorSpace< V, M > &  rowSpace 
)

Default constructor.

Definition at line 35 of file ArrayOfOneDGrids.C.

References QUESO::ArrayOfOneDGrids< V, M >::m_oneDGrids.

38  :
39  m_env (rowSpace.env() ),
40  m_prefix ((std::string)(prefix)+""),
42  m_oneDGrids (m_rowSpace.map(),1),
43  m_sizes (NULL),
44  m_minPositions(NULL),
45  m_maxPositions(NULL)
46 {
47  for (unsigned int i = 0; i < (unsigned int) m_oneDGrids.MyLength(); ++i) {
48  m_oneDGrids(i,0) = NULL;
49  }
50 }
const BaseEnvironment & m_env
const VectorSpace< V, M > & m_rowSpace
DistArray< BaseOneDGrid< double > * > m_oneDGrids
const VectorSpace< V, M > & rowSpace() const
Returns the (vector) space to which the row belongs to.
template<class V , class M >
QUESO::ArrayOfOneDGrids< V, M >::~ArrayOfOneDGrids ( )

Destructor.

Definition at line 54 of file ArrayOfOneDGrids.C.

55 {
56  if (m_maxPositions) delete m_maxPositions;
57  if (m_minPositions) delete m_minPositions;
58  if (m_sizes ) delete m_sizes;
59 
60  for (unsigned int i = 0; i < (unsigned int) m_oneDGrids.MyLength(); ++i) {
61  if (m_oneDGrids(i,0)) delete m_oneDGrids(i,0);
62  }
63 }
DistArray< BaseOneDGrid< double > * > m_oneDGrids

Member Function Documentation

template<class V , class M >
const BaseOneDGrid< double > & QUESO::ArrayOfOneDGrids< V, M >::grid ( unsigned int  rowId) const

Returns the grid stored in the rowId-th position of the array of grids.

Definition at line 131 of file ArrayOfOneDGrids.C.

References queso_require_less_msg.

Referenced by QUESO::SampledVectorCdf< V, M >::SampledVectorCdf().

132 {
133  queso_require_less_msg(rowId, m_rowSpace.dimLocal(), "rowId is out of range");
134 
135  ArrayOfOneDGrids<V,M>* tmp = const_cast<ArrayOfOneDGrids<V,M>*>(this);
136  return *(tmp->m_oneDGrids(rowId,0));
137 }
const VectorSpace< V, M > & m_rowSpace
#define queso_require_less_msg(expr1, expr2, msg)
Definition: asserts.h:87
template<class V , class M >
const V & QUESO::ArrayOfOneDGrids< V, M >::maxPositions ( ) const

Returns an array with the maximum position of each grid.

Definition at line 93 of file ArrayOfOneDGrids.C.

References queso_require_msg.

94 {
95  queso_require_msg(m_maxPositions, "maxPositions is still NULL");
96 
97  return *m_maxPositions;
98 }
#define queso_require_msg(asserted, msg)
Definition: asserts.h:69
template<class V , class M >
const V & QUESO::ArrayOfOneDGrids< V, M >::minPositions ( ) const

Returns an array with the minimum position of each grid.

Definition at line 84 of file ArrayOfOneDGrids.C.

References queso_require_msg.

85 {
86  queso_require_msg(m_minPositions, "minPositions is still NULL");
87 
88  return *m_minPositions;
89 }
#define queso_require_msg(asserted, msg)
Definition: asserts.h:69
template<class V , class M >
void QUESO::ArrayOfOneDGrids< V, M >::print ( std::ostream &  os) const

Prints the values of the array of grids (points).

Definition at line 142 of file ArrayOfOneDGrids.C.

References QUESO::ArrayOfOneDGrids< V, M >::m_oneDGrids.

143 {
144  ArrayOfOneDGrids<V,M>* tmp = const_cast<ArrayOfOneDGrids<V,M>*>(this);
145  for (unsigned int i = 0; i < (unsigned int) m_oneDGrids.MyLength(); ++i) {
146  os << *(tmp->m_oneDGrids(i,0))
147  << std::endl;
148  }
149 
150  return;
151 }
DistArray< BaseOneDGrid< double > * > m_oneDGrids
template<class V , class M >
const VectorSpace< V, M > & QUESO::ArrayOfOneDGrids< V, M >::rowSpace ( ) const

Returns the (vector) space to which the row belongs to.

Definition at line 68 of file ArrayOfOneDGrids.C.

69 {
70  return m_rowSpace;
71 }
const VectorSpace< V, M > & m_rowSpace
template<class V , class M >
void QUESO::ArrayOfOneDGrids< V, M >::setUniformGrids ( const V &  sizesVec,
const V &  minPositionsVec,
const V &  maxPositionsVec 
)

Sets an array of uniform grids.

Definition at line 102 of file ArrayOfOneDGrids.C.

Referenced by QUESO::SequenceOfVectors< V, M >::subUniformlySampledCdf(), and QUESO::SequenceOfVectors< V, M >::unifiedUniformlySampledCdf().

106 {
107  if (m_sizes == NULL) m_sizes = new V(sizesVec);
108  else *m_sizes = sizesVec;
109 
110  if (m_minPositions == NULL) m_minPositions = new V(minPositionsVec);
111  else *m_minPositions = minPositionsVec;
112 
113  if (m_maxPositions == NULL) m_maxPositions = new V(maxPositionsVec);
114  else *m_maxPositions = maxPositionsVec;
115 
116  char strI[65];
117  for (unsigned int i = 0; i < (unsigned int) m_oneDGrids.MyLength(); ++i) {
118  sprintf(strI,"%u_",i);
119  m_oneDGrids(i,0) = new UniformOneDGrid<double>(m_env,
120  (m_prefix+strI).c_str(),
121  (unsigned int) sizesVec[i],
122  minPositionsVec[i],
123  maxPositionsVec[i]);
124  }
125 
126  return;
127 }
const BaseEnvironment & m_env
DistArray< BaseOneDGrid< double > * > m_oneDGrids
template<class V , class M >
const V & QUESO::ArrayOfOneDGrids< V, M >::sizes ( ) const

Returns an array with the sizes of the grids.

Definition at line 75 of file ArrayOfOneDGrids.C.

References queso_require_msg.

76 {
77  queso_require_msg(m_sizes, "sizes is still NULL");
78 
79  return *m_sizes;
80 }
#define queso_require_msg(asserted, msg)
Definition: asserts.h:69

Friends And Related Function Documentation

template<class V = GslVector, class M = GslMatrix>
std::ostream& operator<< ( std::ostream &  os,
const ArrayOfOneDGrids< V, M > &  obj 
)
friend

Definition at line 95 of file ArrayOfOneDGrids.h.

97  {
98  obj.print(os);
99  return os;
100  }

Member Data Documentation

template<class V = GslVector, class M = GslMatrix>
const BaseEnvironment& QUESO::ArrayOfOneDGrids< V, M >::m_env
private

Definition at line 104 of file ArrayOfOneDGrids.h.

template<class V = GslVector, class M = GslMatrix>
V* QUESO::ArrayOfOneDGrids< V, M >::m_maxPositions
private

Definition at line 111 of file ArrayOfOneDGrids.h.

template<class V = GslVector, class M = GslMatrix>
V* QUESO::ArrayOfOneDGrids< V, M >::m_minPositions
private

Definition at line 110 of file ArrayOfOneDGrids.h.

template<class V = GslVector, class M = GslMatrix>
DistArray<BaseOneDGrid<double>*> QUESO::ArrayOfOneDGrids< V, M >::m_oneDGrids
private
template<class V = GslVector, class M = GslMatrix>
std::string QUESO::ArrayOfOneDGrids< V, M >::m_prefix
private

Definition at line 105 of file ArrayOfOneDGrids.h.

template<class V = GslVector, class M = GslMatrix>
const VectorSpace<V,M>& QUESO::ArrayOfOneDGrids< V, M >::m_rowSpace
private

Definition at line 106 of file ArrayOfOneDGrids.h.

template<class V = GslVector, class M = GslMatrix>
V* QUESO::ArrayOfOneDGrids< V, M >::m_sizes
private

Definition at line 109 of file ArrayOfOneDGrids.h.


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

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