Public Member Functions | Protected Attributes

chomp::homology::bincube< Dim, twoPower >::neighborhood_iterator Class Reference

The neighborhood of a cube. More...

#include <bincube.h>

Inheritance diagram for chomp::homology::bincube< Dim, twoPower >::neighborhood_iterator:
chomp::homology::bincube< Dim, twoPower >::iterator

List of all members.

Public Member Functions

 neighborhood_iterator (bincube< Dim, twoPower > *bcub=0, int n=-1, int inicur=-1)
 The default constructor.
neighborhood_iteratoroperator++ ()
 The preincrement operator.
neighborhood_iteratoroperator++ (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).

Detailed Description

template<int Dim, int twoPower>
class chomp::homology::bincube< Dim, twoPower >::neighborhood_iterator

The neighborhood of a cube.

Definition at line 201 of file bincube.h.


Constructor & Destructor Documentation

template<int Dim, int twoPower>
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().

                                                          :
        b (bcub), curnum (-1), cur (inicur)
{
        if (b && (num >= 0))
                b -> num2coord (num, coord);
        if (num == bincube<Dim,twoPower>::max_neighbors)
        {
                for (int i = 0; i < Dim; ++ i)
                        ncoord [i] = 0;
        }
        return;
} /* bincube::neighborhood_iterator::neighborhood_iterator */


Member Function Documentation

template<int Dim, int twoPower>
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 */

template<int Dim, int twoPower>
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 ++ */

template<int Dim, int twoPower>
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 ++ */


Member Data Documentation

template<int Dim, int twoPower>
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++().

template<int Dim, int twoPower>
int chomp::homology::bincube< Dim, twoPower >::neighborhood_iterator::coord[Dim] [protected]

The coordinates of the middle cube in the neighborhood.

Definition at line 231 of file bincube.h.

template<int Dim, int twoPower>
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++().

template<int Dim, int twoPower>
int chomp::homology::bincube< Dim, twoPower >::neighborhood_iterator::curnum [protected]
template<int Dim, int twoPower>
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++().


The documentation for this class was generated from the following file: