Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Private Attributes | Static Private Attributes

chomp::homology::tCube2l< tCube > Class Template Reference

A (hyper)cube with additional information about the layer number. More...

#include <twolayer.h>

List of all members.

Public Types

typedef theLayerType LayerType
 The type for keeping the layer number.
typedef tCube CubeType
 The type for keeping the cube at the given layer.
typedef tCube::CoordType CoordType
 The type of the coordinates.
typedef tCell2l< typename
tCube::CellType > 
CellType
 The type of a cell related to this cube type.
typedef tCube::PointBase PointBase
 The point base (for wrapping and tabulating coordinates).

Public Member Functions

 tCube2l ()
 The default constructor.
 tCube2l (const tCube &_q, const LayerType &_l)
 The constructor of a cube at a given layer.
 tCube2l (const CoordType *coord, int dim)
 The constructor from a table of coordinates.
 tCube2l (const CoordType *coord, int dim, const LayerType &_l)
 The constructor from a table of coordinates and a layer.
 tCube2l (int_t number, int dim)
 The constructor from a number (if valid for the base class).
 tCube2l (const tCube2l &c)
 The copy constructor.
tCube2loperator= (const tCube2l &c)
 The assignment operator.
int dim () const
 Returns the dimension of the cube.
template<class intType >
intType * coord (intType *c) const
 Fills out the coordinate table with the cube's coordinates.
int_t hashkey1 () const
 Returns the hash key no. 1 required by the hashing set template.
int_t hashkey2 () const
 Returns the hash key no. 2 required by the hashing set template.
const LayerTypelayer () const
 Returns the layer number.
const tCube & cube () const
 Returns the cube without the layer.
void layer (const typename tCube2l< tCube >::LayerType &newlayer)
 Sets the layer number.

Static Public Member Functions

static const char * name ()
 Returns the name of the objects represented by this class.
static const char * pluralname ()
 Returns the plural name of the objects represented by this class.
static void setlayers (const hashedset< tCube > &X, const hashedset< tCube > &A)
 Defines the set of cubes at layer 1 (X).
static const hashedset< tCube > & layer1 ()
 Returns the set of cubes at layer 1.
static const hashedset< tCube > & layer1b ()
 Returns the set of cubes at the boundary of layer 1.
static const hashedset< tCube > & layer0 ()
 Returns the set of cubes at layer 0 which are neighbors of cubes at layer 1 by the identification of layers.

Static Public Attributes

static const int MaxDim = tCube::MaxDim
 The maximal dimension of a cube.

Private Attributes

tCube q
 The actual cube at the given layer.
LayerType l
 The layer to which the cube belongs.

Static Private Attributes

static hashedset< tCube > layer1set
 The set of full-dimensional cubes at layer 1.
static hashedset< tCube > layer1boundary
 The set of full-dimensional cubes at layer 1 adjacent to cubes at layer 0.
static hashedset< tCube > layer0set
 The set of full-dimensional cubes at layer 0 which are adjacent to the cubes at layer 1.

Detailed Description

template<class tCube>
class chomp::homology::tCube2l< tCube >

A (hyper)cube with additional information about the layer number.

By default, the layer number is zero, unless set otherwise.

Definition at line 80 of file twolayer.h.


Member Typedef Documentation

template<class tCube>
typedef tCell2l<typename tCube::CellType> chomp::homology::tCube2l< tCube >::CellType

The type of a cell related to this cube type.

Definition at line 93 of file twolayer.h.

template<class tCube>
typedef tCube::CoordType chomp::homology::tCube2l< tCube >::CoordType

The type of the coordinates.

Definition at line 90 of file twolayer.h.

template<class tCube>
typedef tCube chomp::homology::tCube2l< tCube >::CubeType

The type for keeping the cube at the given layer.

Definition at line 87 of file twolayer.h.

template<class tCube>
typedef theLayerType chomp::homology::tCube2l< tCube >::LayerType

The type for keeping the layer number.

Definition at line 84 of file twolayer.h.

template<class tCube>
typedef tCube::PointBase chomp::homology::tCube2l< tCube >::PointBase

The point base (for wrapping and tabulating coordinates).

Definition at line 99 of file twolayer.h.


Constructor & Destructor Documentation

template<class tCube >
chomp::homology::tCube2l< tCube >::tCube2l (  )  [inline]

The default constructor.

Definition at line 204 of file twolayer.h.

                               : q (), l (0)
{
        return;
} /* tCube2l */

template<class tCube >
chomp::homology::tCube2l< tCube >::tCube2l ( const tCube &  _q,
const LayerType _l 
) [inline]

The constructor of a cube at a given layer.

Definition at line 210 of file twolayer.h.

: q (_q), l (_l)
{
        return;
} /* tCube2l */

template<class tCube >
chomp::homology::tCube2l< tCube >::tCube2l ( const CoordType coord,
int  dim 
) [inline]

The constructor from a table of coordinates.

Definition at line 217 of file twolayer.h.

                                                              :
        q (coord, dim), l (layer1set. check (q) ? 1 : 0)
{
        return;
} /* tCube2l */

template<class tCube >
chomp::homology::tCube2l< tCube >::tCube2l ( const CoordType coord,
int  dim,
const LayerType _l 
) [inline]

The constructor from a table of coordinates and a layer.

Definition at line 224 of file twolayer.h.

                            : q (coord, dim), l (_l)
{
        return;
} /* tCube2l */

template<class tCube >
chomp::homology::tCube2l< tCube >::tCube2l ( int_t  number,
int  dim 
) [inline]

The constructor from a number (if valid for the base class).

Definition at line 231 of file twolayer.h.

: q (number, dim), l (layer1set. check (q) ? 1 : 0)
{
        return;
} /* tCube2l */

template<class tCube >
chomp::homology::tCube2l< tCube >::tCube2l ( const tCube2l< tCube > &  c  )  [inline]

The copy constructor.

Definition at line 238 of file twolayer.h.

                                               : q (c. q), l (c. l)
{
        return;
} /* tCube2l */


Member Function Documentation

template<class tCube >
template<class intType >
intType * chomp::homology::tCube2l< tCube >::coord ( intType *  c  )  const [inline]

Fills out the coordinate table with the cube's coordinates.

Definition at line 259 of file twolayer.h.

References chomp::homology::tCube2l< tCube >::q.

{
        return q. coord (c);
} /* coord */

template<class tCube >
const tCube & chomp::homology::tCube2l< tCube >::cube (  )  const [inline]

Returns the cube without the layer.

Definition at line 289 of file twolayer.h.

References chomp::homology::tCube2l< tCube >::q.

{
        return q;
} /* cube */

template<class tCube >
int chomp::homology::tCube2l< tCube >::dim (  )  const [inline]

Returns the dimension of the cube.

Definition at line 252 of file twolayer.h.

References chomp::homology::tCube2l< tCube >::q.

Referenced by chomp::homology::tCube2l< tCube >::setlayers().

{
        return q. dim ();
} /* dim */

template<class tCube >
int_t chomp::homology::tCube2l< tCube >::hashkey1 (  )  const [inline]

Returns the hash key no. 1 required by the hashing set template.

Definition at line 265 of file twolayer.h.

References chomp::homology::tCube2l< tCube >::q.

{
        return q. hashkey1 ();
} /* hashkey1 */

template<class tCube >
int_t chomp::homology::tCube2l< tCube >::hashkey2 (  )  const [inline]

Returns the hash key no. 2 required by the hashing set template.

Definition at line 271 of file twolayer.h.

References chomp::homology::tCube2l< tCube >::l, and chomp::homology::tCube2l< tCube >::q.

{
        return q. hashkey2 () ^ l;
} /* hashkey2 */

template<class tCube >
const tCube2l< tCube >::LayerType & chomp::homology::tCube2l< tCube >::layer (  )  const [inline]

Returns the layer number.

Definition at line 295 of file twolayer.h.

References chomp::homology::tCube2l< tCube >::l.

{
        return l;
} /* layer */

template<class tCube >
void chomp::homology::tCube2l< tCube >::layer ( const typename tCube2l< tCube >::LayerType newlayer  )  [inline]

Sets the layer number.

Definition at line 303 of file twolayer.h.

{
        l = newlayer;
        return;
} /* layer */

template<class tCube >
const hashedset< tCube > & chomp::homology::tCube2l< tCube >::layer0 (  )  [inline, static]

Returns the set of cubes at layer 0 which are neighbors of cubes at layer 1 by the identification of layers.

Definition at line 368 of file twolayer.h.

References chomp::homology::tCube2l< tCube >::layer0set.

Referenced by chomp::homology::getneighbors_generate(), and chomp::homology::getneighbors_scan().

{
        return layer0set;
} /* layer0 */

template<class tCube >
const hashedset< tCube > & chomp::homology::tCube2l< tCube >::layer1 (  )  [inline, static]

Returns the set of cubes at layer 1.

Definition at line 356 of file twolayer.h.

References chomp::homology::tCube2l< tCube >::layer1set.

Referenced by chomp::homology::getneighbors_generate().

{
        return layer1set;
} /* layer1 */

template<class tCube >
const hashedset< tCube > & chomp::homology::tCube2l< tCube >::layer1b (  )  [inline, static]

Returns the set of cubes at the boundary of layer 1.

Definition at line 362 of file twolayer.h.

References chomp::homology::tCube2l< tCube >::layer1boundary.

{
        return layer1boundary;
} /* layer1b */

template<class tCube >
const char * chomp::homology::tCube2l< tCube >::name (  )  [inline, static]

Returns the name of the objects represented by this class.

Definition at line 277 of file twolayer.h.

{
        return tCube::name ();
} /* name */

template<class tCube >
tCube2l< tCube > & chomp::homology::tCube2l< tCube >::operator= ( const tCube2l< tCube > &  c  )  [inline]

The assignment operator.

Definition at line 244 of file twolayer.h.

References chomp::homology::tCube2l< tCube >::l, and chomp::homology::tCube2l< tCube >::q.

{
        q = c. q;
        l = c. l;
        return *this;
} /* tCube2l */

template<class tCube >
const char * chomp::homology::tCube2l< tCube >::pluralname (  )  [inline, static]

Returns the plural name of the objects represented by this class.

Definition at line 283 of file twolayer.h.

{
        return tCube::pluralname ();
} /* pluralname */

template<class tCube >
void chomp::homology::tCube2l< tCube >::setlayers ( const hashedset< tCube > &  X,
const hashedset< tCube > &  A 
) [inline, static]

Defines the set of cubes at layer 1 (X).

All the other cubes are at layer 0, and the layers are glued along the intersection between X and A. The sets X and A must be disjoint. A should only contain the neighbors of X.

Definition at line 310 of file twolayer.h.

References chomp::homology::boundarycell(), chomp::homology::boundarylength(), chomp::homology::tCube2l< tCube >::dim(), chomp::homology::getneighbors(), chomp::homology::tCell2l< tCell >::identify(), chomp::homology::tCube2l< tCube >::layer0set, chomp::homology::tCube2l< tCube >::layer1boundary, chomp::homology::tCube2l< tCube >::layer1set, and chomp::homology::tCube2l< tCube >::q.

{
        // remember the sets at the layers' boundary
        layer0set = A;
        layer1set = X;
        hashedset<tCube> empty;
        layer1boundary = empty;

        // if the set X is empty, then there is no problem at all
        if (X. empty ())
                return;

        // determine the set at Layer 1 as neighbors of A in X,
        // and create cells at the layers' boundary for identification
        hashedset<typename tCube::CellType> idcells;
        for (int_t i = 0; i < X. size (); ++ i)
        {
                const tCube &q = X [i];
                hashedset<tCube> neighbors;
                int_t ncount = getneighbors (q, 0, layer0set, &neighbors, 0);
                if (!ncount)
                        continue;
                layer1boundary. add (q);
                for (int_t j = 0; j < ncount; ++ j)
                {
                        idcells. add (typename tCube::CellType
                                (q, neighbors [j]));
                }
        }

        // add boundaries of all the cells
        for (int_t i = 0; i < idcells. size (); ++ i)
        {
                const typename tCube::CellType &c = idcells [i];
                int bsize = boundarylength (c);
                for (int j = 0; j < bsize; ++ j)
                        idcells. add (boundarycell (c, j));
        }

        // define the identification set
        CellType::identify (idcells, layer1set [0]. dim ());
        return;
} /* setlayers */


Member Data Documentation

template<class tCube>
LayerType chomp::homology::tCube2l< tCube >::l [private]
template<class tCube>
hashedset< tCube > chomp::homology::tCube2l< tCube >::layer0set [static, private]

The set of full-dimensional cubes at layer 0 which are adjacent to the cubes at layer 1.

Definition at line 186 of file twolayer.h.

Referenced by chomp::homology::tCube2l< tCube >::layer0(), and chomp::homology::tCube2l< tCube >::setlayers().

template<class tCube>
hashedset< tCube > chomp::homology::tCube2l< tCube >::layer1boundary [static, private]

The set of full-dimensional cubes at layer 1 adjacent to cubes at layer 0.

Definition at line 182 of file twolayer.h.

Referenced by chomp::homology::tCube2l< tCube >::layer1b(), and chomp::homology::tCube2l< tCube >::setlayers().

template<class tCube>
hashedset< tCube > chomp::homology::tCube2l< tCube >::layer1set [static, private]

The set of full-dimensional cubes at layer 1.

The identification takes place at the boundary of these cubes with the set defined as layer 0.

Definition at line 178 of file twolayer.h.

Referenced by chomp::homology::tCube2l< tCube >::layer1(), and chomp::homology::tCube2l< tCube >::setlayers().

template<class tCube>
const int chomp::homology::tCube2l< tCube >::MaxDim = tCube::MaxDim [static]

The maximal dimension of a cube.

Definition at line 96 of file twolayer.h.

template<class tCube>
tCube chomp::homology::tCube2l< tCube >::q [private]

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