27 #ifndef SCHNEK_SUBGRID_HPP_ 28 #define SCHNEK_SUBGRID_HPP_ 43 typedef BaseGrid BaseGridType;
46 BaseGridType *baseGrid;
54 typename DomainType::iterator it;
55 BaseGridType *baseGrid;
58 : it(it_), baseGrid(baseGrid_), element(&baseGrid->get(*it)) {}
63 T& operator*() {
return *element;}
67 element = &baseGrid->get(*it);
71 {
return (it==SI.it) && (baseGrid == SI.baseGrid); }
74 {
return (it!=SI.it) || (baseGrid != SI.baseGrid); }
79 typename DomainType::iterator it;
80 const BaseGridType *baseGrid;
83 : it(it_), baseGrid(baseGrid_), element(&baseGrid->get(*it)) {}
88 const T& operator*() {
return *element;}
92 element = &baseGrid->get(*it);
96 {
return (it==SI.it) && (baseGrid == SI.baseGrid); }
98 {
return (it!=SI.it) || (baseGrid != SI.baseGrid); }
105 void resize(
const IndexType &low_,
const IndexType &high_);
107 SCHNEK_INLINE T &
get(
const IndexType &index)
110 return baseGrid->get(baseGrid->check(index, domain.
getLo(), domain.
getHi()));
113 SCHNEK_INLINE
const T &
get(
const IndexType &index)
const 116 return baseGrid->get(baseGrid->check(index, domain.
getLo(), domain.
getHi()));
120 const IndexType& getLo()
const {
return domain.
getLo(); }
122 const IndexType& getHi()
const {
return domain.
getHi(); }
124 const IndexType& getDims()
const {
return dims; }
127 int getLo(
int k)
const {
return domain.
getLo()[k]; }
129 int getHi(
int k)
const {
return domain.
getHi()[k]; }
131 int getDims(
int k)
const {
return dims[k]; }
139 void setBaseGrid(BaseGridType &baseGrid_) { baseGrid = &baseGrid_; }
150 typename BaseGrid::value_type,
152 CheckingPolicy<BaseGrid::Rank>,
154 typename BaseGrid::value_type,
163 typename BaseGrid::value_type,
165 CheckingPolicy<BaseGrid::Rank>,
167 typename BaseGrid::value_type,
174 enum {Rank = BaseGrid::Rank};
175 typedef typename BaseGrid::value_type value_type;
178 typedef BaseGrid BaseGridType;
192 SubGrid(
const IndexType &size, BaseGridType &baseGrid_);
206 SubGrid(
const IndexType &low,
const IndexType &high, BaseGridType &baseGrid_);
220 SubGrid(
const RangeType &range, BaseGridType &baseGrid_);
229 #endif // SCHNEK_SUBGRID_HPP_
Definition: subgrid.hpp:52
SCHNEK_INLINE const LimitType & getLo() const
Return rectangle minimum.
Definition: range.hpp:74
The generic base class for the Grid class template.
Definition: grid.hpp:61
Definition: gridcheck.hpp:39
Definition: subgrid.hpp:40
Definition: subgrid.hpp:147
iterator end()
Creates an iterator pointing to a position after the end of the rectangle.
Definition: range.hpp:357
iterator begin()
Creates an iterator pointing to the beginning of the rectangle.
Definition: range.hpp:352
SCHNEK_INLINE const LimitType & getHi() const
Return rectangle maximum.
Definition: range.hpp:76
Definition: subgrid.hpp:77