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>
82 template <
class V,
class M>
88 return *m_minPositions;
91 template <
class V,
class M>
97 return *m_maxPositions;
100 template <
class V,
class M>
104 const V& minPositionsVec,
105 const V& maxPositionsVec)
107 if (m_sizes == NULL) m_sizes =
new V(sizesVec);
108 else *m_sizes = sizesVec;
110 if (m_minPositions == NULL) m_minPositions =
new V(minPositionsVec);
111 else *m_minPositions = minPositionsVec;
113 if (m_maxPositions == NULL) m_maxPositions =
new V(maxPositionsVec);
114 else *m_maxPositions = maxPositionsVec;
117 for (
unsigned int i = 0; i < (
unsigned int) m_oneDGrids.MyLength(); ++i) {
118 sprintf(strI,
"%u_",i);
120 (m_prefix+strI).c_str(),
121 (
unsigned int) sizesVec[i],
129 template <
class V,
class M>
136 return *(tmp->m_oneDGrids(rowId,0));
140 template <
class V,
class M>
145 for (
unsigned int i = 0; i < (
unsigned int) m_oneDGrids.MyLength(); ++i) {
Class to accommodate arrays of one-dimensional grid.
const V & maxPositions() const
Returns an array with the maximum position of each grid.
void print(std::ostream &os) const
Prints the values of the array of grids (points).
ArrayOfOneDGrids(const char *prefix, const VectorSpace< V, M > &rowSpace)
Default constructor.
DistArray< BaseOneDGrid< double > * > m_oneDGrids
#define queso_require_msg(asserted, msg)
#define queso_require_less_msg(expr1, expr2, msg)
Class for accommodating uniform one-dimensional grids.
const VectorSpace< V, M > & rowSpace() const
Returns the (vector) space to which the row belongs to.
const BaseOneDGrid< double > & grid(unsigned int rowId) const
Returns the grid stored in the rowId-th position of the array of grids.
const V & minPositions() const
Returns an array with the minimum position of each grid.
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.
const V & sizes() const
Returns an array with the sizes of the grids.
A class representing a vector space.