This class defines a hypercube in R^n with edges parallel to the axes and with size 1 in each direction. More...
#include <cubevar.h>
Public Types | |
typedef coordtype | CoordType |
The type of coordinates of a cube. | |
typedef tCellVar< 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 | |
tCubeVar () | |
The default constructor. | |
tCubeVar (const coordtype *c, int dim) | |
The constructor from a table of coordinates. | |
tCubeVar (int number, int dim) | |
The constructor from a number (invalid in this class). | |
tCubeVar (const tCubeVar< coordtype > &c) | |
The copy constructor. | |
tCubeVar< coordtype > & | operator= (const tCubeVar< coordtype > &c) |
The assignment operator. | |
~tCubeVar () | |
The destructor. | |
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 = 50 |
The maximal dimension of a cube. | |
Private Member Functions | |
coordtype * | initialize (int dim) |
Initializes the data for a cube of a given dimension > 0. | |
Private Attributes | |
coordtype * | tab |
The table containing the coordinates of the cube, as well as its dimension (at tab [0]). | |
Friends | |
class | tCellVar< coordtype > |
int | operator== (const tCubeVar< coordtype > &c1, const tCubeVar< coordtype > &c2) |
The operator == for cubes. |
This class defines a hypercube in R^n with edges parallel to the axes and with size 1 in each direction.
In this implementation, an array is allocated for the coordinates of the minimal vertex of a cube.
Definition at line 72 of file cubevar.h.
typedef tCellVar<coordtype> chomp::homology::tCubeVar< coordtype >::CellType |
typedef coordtype chomp::homology::tCubeVar< coordtype >::CoordType |
typedef tWrapBase<coordtype> chomp::homology::tCubeVar< coordtype >::PointBase |
chomp::homology::tCubeVar< coordtype >::tCubeVar | ( | ) | [inline] |
The default constructor.
Definition at line 167 of file cubevar.h.
References chomp::homology::tCubeVar< coordtype >::tab.
{ tab = NULL; return; } /* tCubeVar::tCubeVar */
chomp::homology::tCubeVar< coordtype >::tCubeVar | ( | const coordtype * | c, | |
int | dim | |||
) | [inline] |
The constructor from a table of coordinates.
Definition at line 174 of file cubevar.h.
References chomp::homology::tCubeVar< coordtype >::initialize(), chomp::homology::tCubeVar< coordtype >::tab, and chomp::homology::tPointBase< coordtype >::wrapcopy().
{ if (d < 0) throw "Negative dimension of a cube."; if (d) PointBase::wrapcopy (initialize (d), c, d); else tab = NULL; return; } /* tCubeVar::tCubeVar */
chomp::homology::tCubeVar< coordtype >::tCubeVar | ( | int | number, | |
int | dim | |||
) | [inline] |
chomp::homology::tCubeVar< coordtype >::tCubeVar | ( | const tCubeVar< coordtype > & | c | ) | [inline] |
The copy constructor.
Definition at line 192 of file cubevar.h.
References chomp::homology::copycoord(), chomp::homology::tCubeVar< coordtype >::dim(), chomp::homology::tCubeVar< coordtype >::initialize(), and chomp::homology::tCubeVar< coordtype >::tab.
chomp::homology::tCubeVar< coordtype >::~tCubeVar< coordtype > | ( | ) | [inline] |
The destructor.
coordtype * chomp::homology::tCubeVar< coordtype >::coord | ( | coordtype * | c | ) | const [inline] |
Fills out the coordinate table with the cube's coordinates.
Definition at line 251 of file cubevar.h.
References chomp::homology::tCubeVar< coordtype >::tab.
int chomp::homology::tCubeVar< coordtype >::dim | ( | ) | const [inline] |
Returns the dimension of the cube.
Definition at line 234 of file cubevar.h.
References chomp::homology::tCubeVar< coordtype >::tab.
Referenced by chomp::homology::tCubeVar< coordtype >::hashkey1(), chomp::homology::tCubeVar< coordtype >::hashkey2(), and chomp::homology::tCubeVar< coordtype >::tCubeVar().
int_t chomp::homology::tCubeVar< coordtype >::hashkey1 | ( | ) | const [inline] |
Returns hashing key no. 1 required by the hashing set template.
Definition at line 261 of file cubevar.h.
References chomp::homology::tCubeVar< coordtype >::dim(), and chomp::homology::tCubeVar< coordtype >::tab.
{ int d = dim (); switch (d) { case 0: return 0; 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); } } /* tCubeVar::hashkey1 */
int_t chomp::homology::tCubeVar< coordtype >::hashkey2 | ( | ) | const [inline] |
Returns hashing key no. 2 required by the hashing set template.
Definition at line 281 of file cubevar.h.
References chomp::homology::tCubeVar< coordtype >::dim(), and chomp::homology::tCubeVar< coordtype >::tab.
{ int d = dim (); switch (d) { case 0: return 1; 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 [d - 1])) << 20) + ((static_cast<int_t> (tab [d - 2])) << 9) + ((static_cast<int_t> (tab [d - 3])) >> 1); } } /* tCubeVar::hashkey2 */
coordtype * chomp::homology::tCubeVar< coordtype >::initialize | ( | int | dim | ) | [inline, private] |
Initializes the data for a cube of a given dimension > 0.
Returns the pointer to the coordinates table (i.e. tab + 1).
Definition at line 155 of file cubevar.h.
References chomp::homology::tCubeVar< coordtype >::tab.
Referenced by chomp::homology::tCubeVar< coordtype >::tCubeVar().
const char * chomp::homology::tCubeVar< coordtype >::name | ( | ) | [inline, static] |
tCubeVar< coordtype > & chomp::homology::tCubeVar< coordtype >::operator= | ( | const tCubeVar< coordtype > & | c | ) | [inline] |
The assignment operator.
Definition at line 206 of file cubevar.h.
References chomp::homology::copycoord().
const char * chomp::homology::tCubeVar< coordtype >::pluralname | ( | ) | [inline, static] |
friend class tCellVar< coordtype > [friend] |
const int chomp::homology::tCubeVar< coordtype >::MaxDim = 50 [static] |
coordtype* chomp::homology::tCubeVar< coordtype >::tab [private] |
The table containing the coordinates of the cube, as well as its dimension (at tab [0]).
Definition at line 144 of file cubevar.h.
Referenced by chomp::homology::tCubeVar< coordtype >::coord(), chomp::homology::tCubeVar< coordtype >::dim(), chomp::homology::tCubeVar< coordtype >::hashkey1(), chomp::homology::tCubeVar< coordtype >::hashkey2(), chomp::homology::tCubeVar< coordtype >::initialize(), and chomp::homology::tCubeVar< coordtype >::tCubeVar().