25 #include <queso/OneDGrid.h>
26 #include <queso/UniformOneDGrid.h>
27 #include <queso/ArrayOfOneDGrids.h>
28 #include <queso/GslVector.h>
29 #include <queso/GslMatrix.h>
34 template <
class V,
class M>
39 m_env (rowSpace.env() ),
40 m_prefix ((std::string)(prefix)+
""),
41 m_rowSpace (rowSpace ),
42 m_oneDGrids (m_rowSpace.map(),1),
47 for (
unsigned int i = 0; i < (
unsigned int)
m_oneDGrids.MyLength(); ++i) {
53 template <
class V,
class M>
56 if (m_maxPositions)
delete m_maxPositions;
57 if (m_minPositions)
delete m_minPositions;
58 if (m_sizes )
delete m_sizes;
60 for (
unsigned int i = 0; i < (
unsigned int) m_oneDGrids.MyLength(); ++i) {
61 if (m_oneDGrids(i,0))
delete m_oneDGrids(i,0);
66 template <
class V,
class M>
73 template <
class V,
class M>
79 "ArrayOfOneDGrids<T>::sizes()",
80 "sizes is still NULL");
85 template <
class V,
class M>
91 "ArrayOfOneDGrids<T>::minPositions()",
92 "minPositions is still NULL");
94 return *m_minPositions;
97 template <
class V,
class M>
103 "ArrayOfOneDGrids<T>::maxPositions()",
104 "maxPositions is still NULL");
106 return *m_maxPositions;
109 template <
class V,
class M>
113 const V& minPositionsVec,
114 const V& maxPositionsVec)
116 if (m_sizes == NULL) m_sizes =
new V(sizesVec);
117 else *m_sizes = sizesVec;
119 if (m_minPositions == NULL) m_minPositions =
new V(minPositionsVec);
120 else *m_minPositions = minPositionsVec;
122 if (m_maxPositions == NULL) m_maxPositions =
new V(maxPositionsVec);
123 else *m_maxPositions = maxPositionsVec;
126 for (
unsigned int i = 0; i < (
unsigned int) m_oneDGrids.MyLength(); ++i) {
127 sprintf(strI,
"%u_",i);
129 (m_prefix+strI).c_str(),
130 (
unsigned int) sizesVec[i],
138 template <
class V,
class M>
144 "ArrayOfOneDUnformGrids<T>::grid()",
145 "rowId is out of range");
148 return *(tmp->m_oneDGrids(rowId,0));
152 template <
class V,
class M>
157 for (
unsigned int i = 0; i < (
unsigned int) m_oneDGrids.MyLength(); ++i) {
void print(std::ostream &os) const
Prints the values of the array of grids (points).
Class to accommodate arrays of one-dimensional grid.
const VectorSpace< V, M > & rowSpace() const
Returns the (vector) space to which the row belongs to.
Base class for accommodating one-dimensional grids.
void setUniformGrids(const V &sizesVec, const V &minPositionsVec, const V &maxPositionsVec)
Sets an array of uniform grids.
~ArrayOfOneDGrids()
Destructor.
Class for accommodating uniform one-dimensional grids.
const V & minPositions() const
Returns an array with the minimum position of each grid.
const V & sizes() const
Returns an array with the sizes of the grids.
DistArray< BaseOneDGrid< double > * > m_oneDGrids
A class representing a vector space.
#define UQ_FATAL_TEST_MACRO(test, givenRank, where, what)
const BaseOneDGrid< double > & grid(unsigned int rowId) const
Returns the grid stored in the rowId-th position of the array of grids.
ArrayOfOneDGrids(const char *prefix, const VectorSpace< V, M > &rowSpace)
Default constructor.
const V & maxPositions() const
Returns an array with the maximum position of each grid.