The neighborhood of a cube. More...
#include <bincube.h>
Public Member Functions | |
neighborhood_iterator (bincube< Dim, twoPower > *bcub=0, int n=-1, int inicur=-1) | |
The default constructor. | |
neighborhood_iterator & | operator++ () |
The preincrement operator. | |
neighborhood_iterator & | operator++ (int) |
The postincrement operator. | |
operator int () const | |
Conversion to the number of the neighbor cube (temp!). | |
Protected Attributes | |
bincube< Dim, twoPower > * | b |
Conversion to a cube iterator. | |
int | coord [Dim] |
The coordinates of the middle cube in the neighborhood. | |
int | ncoord [Dim] |
The coordinates of the current neighbor. | |
int | curnum |
The number of the current neighbor in the binary cube. | |
int | cur |
The neighbor counter (up to max_neighbors). |
The neighborhood of a cube.
Definition at line 201 of file bincube.h.
chomp::homology::bincube< Dim, twoPower >::neighborhood_iterator::neighborhood_iterator | ( | bincube< Dim, twoPower > * | bcub = 0 , |
|
int | n = -1 , |
|||
int | inicur = -1 | |||
) | [inline] |
The default constructor.
Definition at line 714 of file bincube.h.
References chomp::homology::bincube< Dim, twoPower >::num2coord().
chomp::homology::bincube< Dim, twoPower >::neighborhood_iterator::operator int | ( | ) | const [inline] |
Conversion to the number of the neighbor cube (temp!).
Reimplemented from chomp::homology::bincube< Dim, twoPower >::iterator.
Definition at line 769 of file bincube.h.
References chomp::homology::bincube< Dim, twoPower >::neighborhood_iterator::curnum.
{ return curnum; } /* bincube::neighborhood_iterator::operator int */
bincube< Dim, twoPower >::neighborhood_iterator & chomp::homology::bincube< Dim, twoPower >::neighborhood_iterator::operator++ | ( | ) | [inline] |
The preincrement operator.
Searches for the next cube in the neighborhood.
Reimplemented from chomp::homology::bincube< Dim, twoPower >::iterator.
Definition at line 729 of file bincube.h.
References chomp::homology::bincube< Dim, twoPower >::neighborhood_iterator::b, chomp::homology::bit2neighborAlg(), chomp::homology::bincube< Dim, twoPower >::check(), chomp::homology::bincube< Dim, twoPower >::iterator::coord(), chomp::homology::bincube< Dim, twoPower >::coord2num(), chomp::homology::bincube< Dim, twoPower >::neighborhood_iterator::cur, chomp::homology::bincube< Dim, twoPower >::neighborhood_iterator::curnum, and chomp::homology::bincube< Dim, twoPower >::neighborhood_iterator::ncoord.
{ if (!b || (cur >= bincube<Dim,twoPower>::max_neighbors)) return *this; while (1) { ++ cur; if (cur >= bincube<Dim,twoPower>::max_neighbors) { for (int i = 0; i < Dim; ++ i) ncoord [i] = 0; curnum = -1; return *this; } bit2neighborAlg (cur, coord, ncoord, Dim); try { curnum = b -> coord2num (ncoord); if (b -> check (curnum)) return *this; } catch (...) { } } return *this; } /* bincube::iterator::operator ++ */
bincube< Dim, twoPower >::neighborhood_iterator & chomp::homology::bincube< Dim, twoPower >::neighborhood_iterator::operator++ | ( | int | ) | [inline] |
The postincrement operator.
Reimplemented from chomp::homology::bincube< Dim, twoPower >::iterator.
Definition at line 759 of file bincube.h.
References chomp::homology::bincube< Dim, twoPower >::neighborhood_iterator::b, and chomp::homology::bincube< Dim, twoPower >::neighborhood_iterator::cur.
{ if (!b || (cur >= bincube<Dim,twoPower>::maxcount)) return *this; neighborhood_iterator prev = *this; ++ (*this); return prev; } /* bincube::neighborhood_iterator::operator ++ */
bincube<Dim,twoPower>* chomp::homology::bincube< Dim, twoPower >::neighborhood_iterator::b [protected] |
Conversion to a cube iterator.
Operator == to compare two neighborhood iterators. The binary cube in which the neighborhood is contained.
Reimplemented from chomp::homology::bincube< Dim, twoPower >::iterator.
Definition at line 228 of file bincube.h.
Referenced by chomp::homology::bincube< Dim, twoPower >::neighborhood_iterator::operator++().
int chomp::homology::bincube< Dim, twoPower >::neighborhood_iterator::coord[Dim] [protected] |
int chomp::homology::bincube< Dim, twoPower >::neighborhood_iterator::cur [protected] |
The neighbor counter (up to max_neighbors).
Definition at line 240 of file bincube.h.
Referenced by chomp::homology::bincube< Dim, twoPower >::neighborhood_iterator::operator++().
int chomp::homology::bincube< Dim, twoPower >::neighborhood_iterator::curnum [protected] |
The number of the current neighbor in the binary cube.
Definition at line 237 of file bincube.h.
Referenced by chomp::homology::bincube< Dim, twoPower >::neighborhood_iterator::operator int(), and chomp::homology::bincube< Dim, twoPower >::neighborhood_iterator::operator++().
int chomp::homology::bincube< Dim, twoPower >::neighborhood_iterator::ncoord[Dim] [protected] |
The coordinates of the current neighbor.
Definition at line 234 of file bincube.h.
Referenced by chomp::homology::bincube< Dim, twoPower >::neighborhood_iterator::operator++().