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

chomp::homology::tCubeFix< dimfix, coordtype > Class Template Reference

This class defines a hypercube in R^n with edges parallel to the axes and with size 1 in each direction. More...

#include <cubefix.h>

List of all members.

Public Types

typedef coordtype CoordType
 The type of coordinates of a cube.
typedef tCellFix< dimfix,
coordtype > 
CellType
 The type of a cell related to this cube type.
typedef tWrapBase< coordtype > PointBase
 The point base (for wrapping and tabulating coordinates).

Public Member Functions

 tCubeFix ()
 The default constructor.
 tCubeFix (const coordtype *c, int dim=0)
 The constructor of a cube from a table of coordinates.
 tCubeFix (int number, int dim)
 The constructor of a cube from a number (invalid in this class).
 tCubeFix (const tCubeFix< dimfix, coordtype > &c)
 The copy constructor.
tCubeFix< dimfix, coordtype > & operator= (const tCubeFix< dimfix, coordtype > &c)
 The assignment operator.
int dim () const
 Returns the dimension of the cube.
coordtype * coord (coordtype *c) const
 Fills out the coordinate table with the cube's coordinates.
int_t hashkey1 () const
 Returns hashing key no. 1 required by the hashing set template.
int_t hashkey2 () const
 Returns hashing key no. 2 required by the hashing set template.

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 Public Attributes

static const int MaxDim = 512
 The maximal dimension of a cube (unused).

Private Attributes

coordtype tab [dimfix]
 A table with the coordinates of the minimal vertex of the cube.

Friends

class tCellFix< dimfix, coordtype >
int operator== (const tCubeFix< dimfix, coordtype > &c1, const tCubeFix< dimfix, coordtype > &c2)
 The operator == for cubes.

Detailed Description

template<int dimfix, class coordtype>
class chomp::homology::tCubeFix< dimfix, coordtype >

This class defines a hypercube in R^n with edges parallel to the axes and with size 1 in each direction.

This implementation assumes that the embedding space dimension is known at time of compilation.

Definition at line 72 of file cubefix.h.


Member Typedef Documentation

template<int dimfix, class coordtype>
typedef tCellFix<dimfix,coordtype> chomp::homology::tCubeFix< dimfix, coordtype >::CellType

The type of a cell related to this cube type.

Definition at line 79 of file cubefix.h.

template<int dimfix, class coordtype>
typedef coordtype chomp::homology::tCubeFix< dimfix, coordtype >::CoordType

The type of coordinates of a cube.

Definition at line 76 of file cubefix.h.

template<int dimfix, class coordtype>
typedef tWrapBase<coordtype> chomp::homology::tCubeFix< dimfix, coordtype >::PointBase

The point base (for wrapping and tabulating coordinates).

Definition at line 85 of file cubefix.h.


Constructor & Destructor Documentation

template<int dimfix, class coordtype >
chomp::homology::tCubeFix< dimfix, coordtype >::tCubeFix (  )  [inline]

The default constructor.

Definition at line 142 of file cubefix.h.

{
        return;
} /* tCubeFix::tCubeFix */

template<int dimfix, class coordtype>
chomp::homology::tCubeFix< dimfix, coordtype >::tCubeFix ( const coordtype *  c,
int  dim = 0 
) [inline]

The constructor of a cube from a table of coordinates.

Definition at line 149 of file cubefix.h.

References chomp::homology::tPointBase< coordtype >::wrapcopy().

{
        if (dim && ((dim != dimfix) || (dim < 0)))
                throw "Wrong dimension of a fixed-dim cube.";
        PointBase::wrapcopy (tab, c, dimfix);
        return;
} /* tCubeFix::tCubeFix */

template<int dimfix, class coordtype>
chomp::homology::tCubeFix< dimfix, coordtype >::tCubeFix ( int  number,
int  dim 
) [inline]

The constructor of a cube from a number (invalid in this class).

Definition at line 158 of file cubefix.h.

{
        throw "Unable to construct a cube from a number.";
} /* tCubeFix::tCubeFix */

template<int dimfix, class coordtype>
chomp::homology::tCubeFix< dimfix, coordtype >::tCubeFix ( const tCubeFix< dimfix, coordtype > &  c  )  [inline]

The copy constructor.

Definition at line 165 of file cubefix.h.

{
        for (int i = 0; i < dimfix; ++ i)
                tab [i] = c. tab [i];
        return;
} /* tCubeFix::tCubeFix */


Member Function Documentation

template<int dimfix, class coordtype>
coordtype * chomp::homology::tCubeFix< dimfix, coordtype >::coord ( coordtype *  c  )  const [inline]

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

Definition at line 197 of file cubefix.h.

References chomp::homology::tCubeFix< dimfix, coordtype >::tab.

{
        for (int i = 0; i < dimfix; ++ i)
                c [i] = tab [i];
        return c;
} /* tCubeFix::coord */

template<int dimfix, class coordtype >
int chomp::homology::tCubeFix< dimfix, coordtype >::dim (  )  const [inline]

Returns the dimension of the cube.

Definition at line 182 of file cubefix.h.

{
        return dimfix;
} /* tCubeFix::dim */

template<int dimfix, class coordtype >
int_t chomp::homology::tCubeFix< dimfix, coordtype >::hashkey1 (  )  const [inline]

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

Definition at line 205 of file cubefix.h.

References chomp::homology::tCubeFix< dimfix, coordtype >::tab.

{
        switch (dimfix)
        {
        case 1:
                return static_cast<int_t> (tab [0]) << 12;
        case 2:
                return ((static_cast<int_t> (tab [0])) << 18) +
                        ((static_cast<int_t> (tab [1])) << 6);
        default:
                return ((static_cast<int_t> (tab [0])) << 18) +
                        ((static_cast<int_t> (tab [1])) << 6) +
                        ((static_cast<int_t> (tab [2])) >> 6);
        }
} /* tCubeFix::hashkey1 */

template<int dimfix, class coordtype >
int_t chomp::homology::tCubeFix< dimfix, coordtype >::hashkey2 (  )  const [inline]

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

Definition at line 222 of file cubefix.h.

References chomp::homology::tCubeFix< dimfix, coordtype >::tab.

{
        switch (dimfix)
        {
        case 1:
                return static_cast<int_t> (tab [0]) << 3;
        case 2:
                return (static_cast<int_t> (tab [0]) >> 1) +
                        (static_cast<int_t> (tab [1]) << 13);
        default:
                return ((static_cast<int_t> (tab [dimfix - 1])) << 20) +
                        ((static_cast<int_t> (tab [dimfix - 2])) << 9) +
                        ((static_cast<int_t> (tab [dimfix - 3])) >> 1);
        }
} /* tCubeFix::hashkey2 */

template<int dimfix, class coordtype >
const char * chomp::homology::tCubeFix< dimfix, coordtype >::name (  )  [static]

Returns the name of the objects represented by this class.

Definition at line 239 of file cubefix.h.

{
        return "cube";
} /* tCubeFix::name */

template<int dimfix, class coordtype>
tCubeFix< dimfix, coordtype > & chomp::homology::tCubeFix< dimfix, coordtype >::operator= ( const tCubeFix< dimfix, coordtype > &  c  )  [inline]

The assignment operator.

Definition at line 174 of file cubefix.h.

{
        for (int i = 0; i < dimfix; ++ i)
                tab [i] = c. tab [i];
        return *this;
} /* tCubeFix::operator = */

template<int dimfix, class coordtype >
const char * chomp::homology::tCubeFix< dimfix, coordtype >::pluralname (  )  [static]

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

Definition at line 245 of file cubefix.h.

{
        return "cubes";
} /* tCubeFix::pluralname */


Friends And Related Function Documentation

template<int dimfix, class coordtype>
int operator== ( const tCubeFix< dimfix, coordtype > &  c1,
const tCubeFix< dimfix, coordtype > &  c2 
) [friend]

The operator == for cubes.

Definition at line 124 of file cubefix.h.

        {
                return thesame (c1. tab, c2. tab, dimfix);
        }

template<int dimfix, class coordtype>
friend class tCellFix< dimfix, coordtype > [friend]

Definition at line 131 of file cubefix.h.


Member Data Documentation

template<int dimfix, class coordtype>
const int chomp::homology::tCubeFix< dimfix, coordtype >::MaxDim = 512 [static]

The maximal dimension of a cube (unused).

Definition at line 82 of file cubefix.h.

template<int dimfix, class coordtype>
coordtype chomp::homology::tCubeFix< dimfix, coordtype >::tab[dimfix] [private]

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