25 gsVector<unsigned> uniformSampleCount (
const gsVector<T>& lower,
26 const gsVector<T>& upper,
30 assert( d == upper.rows() );
33 gsVector<T> span = upper - lower;
34 const T volume = span.prod();
35 const T h = math::pow(volume / (T)(numPoints), (T)(1) / (T)(d));
37 gsVector<unsigned> np(d);
41 np[i] = cast<T,unsigned>(math::ceil( span[i] / h ) );
42 GISMO_ASSERT( np[i] > 0,
"Something went wrong, number of points is zero..");
49 void uniformIntervals(
const gsVector<T>& lower,
50 const gsVector<T>& upper,
51 std::vector< std::vector<T> >& intervals,
54 const int d = lower.rows();
55 assert( d == upper.rows() );
57 gsVector<unsigned> np = uniformSampleCount( lower, upper, numIntervals );
63 for (
int i = 0; i < d; ++i)
65 int numInt = np[i] - 1;
69 const T h = (T)(1) / (T)(numInt);
71 intervals[i].resize(numInt + 1);
72 for (
int j = 0; j <= numInt; ++j)
73 intervals[i][j] = (T)(j) * h;
87 gsGridIterator<T,CUBE> pt(a, b, np.cast<
index_t>());
88 for(
index_t c = 0; pt; ++pt, ++c)
#define index_t
Definition: gsConfig.h:32
#define GISMO_ASSERT(cond, message)
Definition: gsDebug.h:89
gsMatrix< T > uniformPointGrid(const gsVector< T > &lower, const gsVector< T > &upper, int numPoints=1000)
Definition: gsPointGrid.hpp:94
gsMatrix< T > gsPointGrid(gsVector< T > const &a, gsVector< T > const &b, gsVector< unsigned > const &np)
Construct a Cartesian grid of uniform points in a hypercube, using np[i] points in direction i...
Definition: gsPointGrid.hpp:82