11#ifndef NDINDEX_INLINES_H
12#define NDINDEX_INLINES_H
24 for (
unsigned i=0; i<
Dim; ++i)
34 for (
unsigned d=0;d<
Dim;++d)
35 r[d] = p[d].intersect( i[d] );
43template<
unsigned D1,
unsigned D2>
49 for (
unsigned d1=0; d1<D1; ++d1)
51 for (
unsigned d2=0; d2<D2; ++d2)
52 if ( i1[d1].sameBase( i2[d2] ) )
55 ret[d1] = ret[d1].
plugBase( i2[d2] );
70 unsigned s = p[0].length();
71 for (
unsigned int d=1; d<
Dim; ++d)
78template <
unsigned Dim>
83 for (
unsigned int d=0; (d<
Dim)&&touch ; ++d)
84 touch = touch && p[d].touches(
a.p[d]);
90template <
unsigned Dim>
95 for (
unsigned int d=0; (d<
Dim)&&cont ; ++d)
96 cont = cont && p[d].contains(
a.p[d]);
102template <
unsigned Dim>
107 for (
unsigned int d=0; (d<
Dim)&&cont ; ++d)
108 cont = cont && p[d].containsAllPoints(
a.p[d]);
114template<
unsigned Dim>
119 for (
unsigned d=0; d<
Dim; ++d)
120 r = r || p[d].empty();
126template<
unsigned Dim>
129 unsigned d,
double a)
const
135 return p[d].
split(l[d],r[d],
a);
138template<
unsigned Dim>
146 return p[d].
split(l[d],r[d]);
151template<
unsigned Dim>
155 unsigned int max_dim = 0;
156 unsigned int max_length = 0;
157 for (
unsigned int d=0; d<
Dim; ++d)
158 if ( p[d].length() > max_length ) {
160 max_length = p[d].length();
162 return split(l,r,max_dim);
167template<
unsigned Dim>
171 PInsist(
Dim==1,
"Number of arguments does not match NDIndex dimension!!");
175template<
unsigned Dim>
179 PInsist(
Dim==2,
"Number of arguments does not match NDIndex dimension!!");
184template<
unsigned Dim>
188 PInsist(
Dim==3,
"Number of arguments does not match NDIndex dimension!!");
194template<
unsigned Dim>
199 PInsist(
Dim==4,
"Number of arguments does not match NDIndex dimension!!");
206template<
unsigned Dim>
211 PInsist(
Dim==5,
"Number of arguments does not match NDIndex dimension!!");
219template<
unsigned Dim>
224 PInsist(
Dim==6,
"Number of arguments does not match NDIndex dimension!!");
286template<
unsigned D1,
unsigned D2>
289 for (
unsigned i = 0; i < D1; i++)
292 for (
unsigned j = 0; j < D2; j++)
294 if (i1[i].
id() == i2[j].
id())
297 if (!(i1[i] == i2[j]))
NDIndex< D1 > plugBase(const NDIndex< D1 > &i1, const NDIndex< D2 > &i2)
bool isStencil(const NDIndex< D1 > &i1, const NDIndex< D2 > &i2)
bool touches(const NDIndex< Dim > &) const
NDIndex< Dim > plugBase(const NDIndex< D > &i) const
bool contains(const NDIndex< Dim > &a) const
NDIndex< Dim > intersect(const NDIndex< Dim > &) const
bool split(NDIndex< Dim > &l, NDIndex< Dim > &r, unsigned d, double a) const
bool containsAllPoints(const NDIndex< Dim > &b) const