35#ifndef _CHOMP_CUBES_CUBEVAR_H_
36#define _CHOMP_CUBES_CUBEVAR_H_
58template <
class coordtype>
70template <
class coordtype>
110 coordtype *
coord (coordtype *c)
const;
119 static const char *
name ();
131 return c2.
tab ? false :
true;
153template <
class coordtype>
156 tab =
new coordtype [d + 1];
158 throw "Not enough memory for a cube.";
165template <
class coordtype>
172template <
class coordtype>
176 throw "Negative dimension of a cube.";
184template <
class coordtype>
187 throw "Unable to construct a cube from a number.";
190template <
class coordtype>
197 initialize (c. dim ());
198 copycoord (tab + 1, c. tab + 1, c. dim ());
203template <
class coordtype>
207 if (dim () == c. dim ())
215 initialize (c. dim ());
216 copycoord (tab + 1, c. tab + 1, c. dim ());
224template <
class coordtype>
232template <
class coordtype>
235 return tab ? *tab : 0;
249template <
class coordtype>
254 for (
int i = 0; i < *tab; ++ i)
259template <
class coordtype>
268 return static_cast<int_t> (tab [0]) << 12;
270 return ((
static_cast<int_t> (tab [0])) << 18) +
271 ((
static_cast<int_t> (tab [1])) << 6);
273 return ((
static_cast<int_t> (tab [0])) << 18) +
274 ((
static_cast<int_t> (tab [1])) << 6) +
275 ((
static_cast<int_t> (tab [2])) >> 6);
279template <
class coordtype>
285template <
class coordtype>
294 return static_cast<int_t> (tab [0]) << 3;
296 return (
static_cast<int_t> (tab [0]) >> 1) +
297 (
static_cast<int_t> (tab [1]) << 13);
299 return ((
static_cast<int_t> (tab [d - 1])) << 20) +
300 ((
static_cast<int_t> (tab [d - 2])) << 9) +
301 ((
static_cast<int_t> (tab [d - 3])) >> 1);
305template <
class coordtype>
311template <
class coordtype>
317template <
class coordtype>
326template <
class coordtype>
336template <
class coordtype>
340 int dim1 = c1. dim (), dim2 = c2. dim ();
342 throw "Dimension too high to concatenate coordinates.";
345 c2. coord (coord + dim1);
354template <
class coordtype>
364template <
class coordtype>
371template <
class coordtype>
379template <
class coordtype>
This file contains the definition of a bitfield class which works an array of bits.
This is a template for a set of objects of the given type.
This class defines a multivalued map.
This class defines cubical cell in R^n with edges parallel to the axes and with size 0 or 1 in each d...
This class defines a hypercube in R^n with edges parallel to the axes and with size 1 in each directi...
static const char * pluralname()
Returns the plural name of the objects represented by this class.
coordtype * tab
The table containing the coordinates of the cube, as well as its dimension (at tab [0]).
coordtype * coord(coordtype *c) const
Fills out the coordinate table with the cube's coordinates.
tCellVar< coordtype > CellType
The type of a cell related to this cube type.
tCubeVar< coordtype > & operator=(const tCubeVar< coordtype > &c)
The assignment operator.
int_t hashkey1() const
Returns hashing key no. 1 required by the hashing set template.
int dim() const
Returns the dimension of the cube.
coordtype * initialize(int dim)
Initializes the data for a cube of a given dimension > 0.
coordtype CoordType
The type of coordinates of a cube.
friend int operator==(const tCubeVar< coordtype > &c1, const tCubeVar< coordtype > &c2)
The operator == for cubes.
tCubeVar()
The default constructor.
~tCubeVar()
The destructor.
int_t hashkey2() const
Returns hashing key no. 2 required by the hashing set template.
tWrapBase< coordtype > PointBase
The point base (for wrapping and tabulating coordinates).
static const int MaxDim
The maximal dimension of a cube.
static const char * name()
Returns the name of the objects represented by this class.
static void wrapcopy(coordtype *dest, const coordtype *src, int dim)
Copies the coordinates and wraps them if necessary.
This class is a simplified version of the point base class used only for the space wrapping support.
This file contains some precompiler definitions which indicate the operating system and/or compiler u...
This file contains the definition of some functions that are common for all types of cubes,...
int int_t
Index type for indexing arrays, counting cubes, etc.
This file contains the definition of the container "hashedset" which can be used to represent a set o...
This file defines a class "integer" which represents the ring of integers or the field of integers mo...
std::ostream & WriteCube(std::ostream &out, const cubetype &c)
Writes a cube to the output stream in the text mode.
std::ostream & operator<<(std::ostream &out, const bincube< Dim, twoPower > &b)
std::istream & ReadCubes(std::istream &in, cubsettype &s)
Reads a set of cubes and ignores the line at the beginning of the file which starts with the letter '...
int_t hashkey2(const hashNumber< Number > &n)
The second hashing key.
tCellBase< coordtype > operator*(const tCellBase< coordtype > &c1, const tCellBase< coordtype > &c2)
Computes the Cartesian product of two cells.
int thesame(const coordtype *c1, const coordtype *c2, int dim)
Compare two points. Returns true iff they have the same coordinates.
std::istream & ReadCube(std::istream &in, cubetype &c)
Reads a cube from the input text stream.
bool operator!=(const typename bincube< Dim, twoPower >::neighborhood_iterator &x1, const typename bincube< Dim, twoPower >::neighborhood_iterator &x2)
std::istream & operator>>(std::istream &in, bincube< Dim, twoPower > &b)
int_t hashkey1(const hashNumber< Number > &n)
The first hashing key.
void copycoord(coordtype *destination, const coordtype *source, int dim)
Copies the coordinates of one point to another.
std::istream & ReadCubicalMap(std::istream &in, mvmap< tCube, tCube > &m)
Reads a combinatorial cubical multivalued map from an input text stream.
This namespace contains the entire CHomP library interface.
This file contains the definition of a point base class which is used for indexing all the points (n-...
This file contains the definition of a set of n-dimensional points with integer coordinates and sever...
This file contains some useful functions related to the text input/output procedures.