1
/***************************************************************************
2
* blitz/array/domain.h Declaration of the RectDomain class
4
* Copyright (C) 1997-2001 Todd Veldhuizen <tveldhui@oonumerics.org>
6
* This program is free software; you can redistribute it and/or
7
* modify it under the terms of the GNU General Public License
8
* as published by the Free Software Foundation; either version 2
9
* of the License, or (at your option) any later version.
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
16
* Suggestions: blitz-dev@oonumerics.org
17
* Bugs: blitz-bugs@oonumerics.org
19
* For more information, please see the Blitz++ Home Page:
20
* http://oonumerics.org/blitz/
22
****************************************************************************/
72
94
TinyVector<int,N_rank> lbound_, ubound_;
98
* StridedDomain added by Julian Cummings
101
class StridedDomain {
104
StridedDomain(const TinyVector<int,N_rank>& lbound,
105
const TinyVector<int,N_rank>& ubound,
106
const TinyVector<int,N_rank>& stride)
107
: lbound_(lbound), ubound_(ubound), stride_(stride)
110
// NEEDS_WORK: better constructors
111
// StridedDomain(Range, Range, ...)
112
// StridedDomain with any combination of Range and int
114
const TinyVector<int,N_rank>& lbound() const
117
int lbound(int i) const
118
{ return lbound_(i); }
120
const TinyVector<int,N_rank>& ubound() const
123
int ubound(int i) const
124
{ return ubound_(i); }
126
const TinyVector<int,N_rank>& stride() const
129
int stride(int i) const
130
{ return stride_(i); }
132
Range operator[](int rank) const
133
{ return Range(lbound_(rank), ubound_(rank), stride_(rank)); }
135
void shrink(int amount)
137
lbound_ += amount * stride_;
138
ubound_ -= amount * stride_;
141
void shrink(int dim, int amount)
143
lbound_(dim) += amount * stride_(dim);
144
ubound_(dim) -= amount * stride_(dim);
147
void expand(int amount)
149
lbound_ -= amount * stride_;
150
ubound_ += amount * stride_;
153
void expand(int dim, int amount)
155
lbound_(dim) -= amount * stride_(dim);
156
ubound_(dim) += amount * stride_(dim);
160
TinyVector<int,N_rank> lbound_, ubound_, stride_;
75
164
template<int N_rank>
76
165
inline RectDomain<N_rank> strip(const TinyVector<int,N_rank>& startPosition,
77
166
int stripDimension, int ubound)