The Original CHomP Software
Public Member Functions | Protected Attributes | List of all members
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

Public Member Functions

 neighborhood_iterator (bincube< Dim, twoPower > *bcub=0, int n=-1, int inicur=-1)
 The default constructor. More...
 
neighborhood_iteratoroperator++ ()
 The preincrement operator. More...
 
neighborhood_iteratoroperator++ (int)
 The postincrement operator. More...
 
 operator int () const
 Conversion to the number of the neighbor cube (temp!). More...
 
- Public Member Functions inherited from chomp::homology::bincube< Dim, twoPower >::iterator
 iterator (bincube< Dim, twoPower > *bcub=0, int num=-1)
 The default constructor. More...
 
iteratoroperator++ ()
 The preincrement operator. More...
 
iteratoroperator++ (int)
 The postincrement operator. More...
 
 operator int () const
 Conversion of an iterator to int (temporarily). More...
 
const int * coord () const
 The coordinates of the cube. More...
 
template<class intType >
intType * coord (intType *tab) const
 The coordinates of the cube. More...
 

Protected Attributes

bincube< Dim, twoPower > * b
 Conversion to a cube iterator. More...
 
int coord [Dim]
 The coordinates of the middle cube in the neighborhood. More...
 
int ncoord [Dim]
 The coordinates of the current neighbor. More...
 
int curnum
 The number of the current neighbor in the binary cube. More...
 
int cur
 The neighbor counter (up to max_neighbors). More...
 

Additional Inherited Members

- Public Types inherited from chomp::homology::bincube< Dim, twoPower >::iterator
typedef int CoordType
 The type of coordinates. More...
 
- Static Public Member Functions inherited from chomp::homology::bincube< Dim, twoPower >::iterator
static int dim ()
 The dimension of the cube. More...
 
- Public Attributes inherited from chomp::homology::bincube< Dim, twoPower >::iterator
bincube< Dim, twoPower > * b
 The binary cube in which the cube is contained. More...
 
int n
 The number of the current bit in the set. More...
 
- Static Public Attributes inherited from chomp::homology::bincube< Dim, twoPower >::iterator
static const int MaxDim = Dim
 The maximal possible dimension of the cube. More...
 

Detailed Description

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

The neighborhood of a cube.

Definition at line 203 of file bincube.h.

Constructor & Destructor Documentation

◆ neighborhood_iterator()

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 715 of file bincube.h.

716 :
717 b (bcub), curnum (-1), cur (inicur)
718{
719 if (b && (num >= 0))
720 b -> num2coord (num, coord);
721 else
722 {
723 // this zeroing operation is to avoid a compilation warning,
724 // probably it is not necessary
725 for (int i = 0; i < Dim; ++ i)
726 coord [i] = 0;
727 }
729 {
730 for (int i = 0; i < Dim; ++ i)
731 ncoord [i] = 0;
732 }
733 return;
734} /* bincube::neighborhood_iterator::neighborhood_iterator */
int curnum
The number of the current neighbor in the binary cube.
Definition: bincube.h:239
int coord[Dim]
The coordinates of the middle cube in the neighborhood.
Definition: bincube.h:233
bincube< Dim, twoPower > * b
Conversion to a cube iterator.
Definition: bincube.h:230
int ncoord[Dim]
The coordinates of the current neighbor.
Definition: bincube.h:236
int cur
The neighbor counter (up to max_neighbors).
Definition: bincube.h:242
static intType * num2coord(int number, intType *coord)
Determines the coordinates of the cube with given number.
Definition: bincube.h:503
static const int max_neighbors
The maximal possible number of neighbors of a cube.
Definition: bincube.h:200

References chomp::homology::bincube< Dim, twoPower >::neighborhood_iterator::b, chomp::homology::bincube< Dim, twoPower >::neighborhood_iterator::coord, chomp::homology::bincube< Dim, twoPower >::neighborhood_iterator::ncoord, and chomp::homology::bincube< Dim, twoPower >::num2coord().

Member Function Documentation

◆ operator int()

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

Conversion to the number of the neighbor cube (temp!).

Definition at line 778 of file bincube.h.

779{
780 return curnum;
781} /* bincube::neighborhood_iterator::operator int */

◆ operator++() [1/2]

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.

Definition at line 738 of file bincube.h.

739{
741 return *this;
742 while (1)
743 {
744 ++ cur;
746 {
747 for (int i = 0; i < Dim; ++ i)
748 ncoord [i] = 0;
749 curnum = -1;
750 return *this;
751 }
753 try
754 {
755 curnum = b -> coord2num (ncoord);
756 if (b -> check (curnum))
757 return *this;
758 }
759 catch (...)
760 {
761 }
762 }
763 return *this;
764} /* bincube::iterator::operator ++ */
static int coord2num(const intType *coord)
Determines the number of the cube with given coordinates.
Definition: bincube.h:478
bool check(int number) const
Checks if the given cube belongs to the set or not.
Definition: bincube.h:567
void bit2neighborAlg(int number, const coordinate *src, coordinate *dest, int Dim)
Definition: bincube.h:667

References chomp::homology::bit2neighborAlg(), chomp::homology::bincube< Dim, twoPower >::check(), and chomp::homology::bincube< Dim, twoPower >::coord2num().

◆ operator++() [2/2]

template<int Dim, int twoPower>
bincube< Dim, twoPower >::neighborhood_iterator & chomp::homology::bincube< Dim, twoPower >::neighborhood_iterator::operator++ ( int  )
inline

The postincrement operator.

Definition at line 768 of file bincube.h.

769{
771 return *this;
772 neighborhood_iterator prev = *this;
773 ++ (*this);
774 return prev;
775} /* bincube::neighborhood_iterator::operator ++ */
neighborhood_iterator(bincube< Dim, twoPower > *bcub=0, int n=-1, int inicur=-1)
The default constructor.
Definition: bincube.h:716
static const int maxcount
The maximal number of cubes that can be stored in the set.
Definition: bincube.h:331

Member Data Documentation

◆ b

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.

Definition at line 230 of file bincube.h.

Referenced by chomp::homology::bincube< Dim, twoPower >::neighborhood_iterator::neighborhood_iterator().

◆ coord

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 233 of file bincube.h.

Referenced by chomp::homology::bincube< Dim, twoPower >::neighborhood_iterator::neighborhood_iterator().

◆ cur

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 242 of file bincube.h.

◆ curnum

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

The number of the current neighbor in the binary cube.

Definition at line 239 of file bincube.h.

◆ ncoord

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 236 of file bincube.h.

Referenced by chomp::homology::bincube< Dim, twoPower >::neighborhood_iterator::neighborhood_iterator().


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