36#ifndef _CHOMP_CUBES_CUBEFIX_H_
37#define _CHOMP_CUBES_CUBEFIX_H_
58template <
int dimfix,
class coordtype>
70template <
int dimfix,
class coordtype>
108 coordtype *
coord (coordtype *c)
const;
130 friend class tCellFix<dimfix, coordtype>;
140template <
int dimfix,
class coordtype>
146template <
int dimfix,
class coordtype>
148 (
const coordtype *c,
int dim)
150 if (dim && ((dim != dimfix) || (dim < 0)))
151 throw "Wrong dimension of a fixed-dim cube.";
156template <
int dimfix,
class coordtype>
159 throw "Unable to construct a cube from a number.";
162template <
int dimfix,
class coordtype>
166 for (
int i = 0; i < dimfix; ++ i)
167 tab [i] = c. tab [i];
171template <
int dimfix,
class coordtype>
175 for (
int i = 0; i < dimfix; ++ i)
176 tab [i] = c. tab [i];
180template <
int dimfix,
class coordtype>
195template <
int dimfix,
class coordtype>
198 for (
int i = 0; i < dimfix; ++ i)
203template <
int dimfix,
class coordtype>
209 return static_cast<int_t> (tab [0]) << 12;
211 return ((
static_cast<int_t> (tab [0])) << 18) +
212 ((
static_cast<int_t> (tab [1])) << 6);
214 return ((
static_cast<int_t> (tab [0])) << 18) +
215 ((
static_cast<int_t> (tab [1])) << 6) +
216 ((
static_cast<int_t> (tab [2])) >> 6);
220template <
int dimfix,
class coordtype>
226template <
int dimfix,
class coordtype>
232 return static_cast<int_t> (tab [0]) << 3;
234 return (
static_cast<int_t> (tab [0]) >> 1) +
235 (
static_cast<int_t> (tab [1]) << 13);
237 return ((
static_cast<int_t> (tab [dimfix - 1])) << 20) +
238 ((
static_cast<int_t> (tab [dimfix - 2])) << 9) +
239 ((
static_cast<int_t> (tab [dimfix - 3])) >> 1);
243template <
int dimfix,
class coordtype>
249template <
int dimfix,
class coordtype>
255template <
int dimfix,
class coordtype>
262template <
int dim1,
int dim2,
class coordtype>
272template <
int dim1,
int dim2,
class coordtype>
277 coordtype coord [dim1 + dim2];
279 c2. coord (coord + dim1);
288template <
int dimfix,
class coordtype>
298template <
int dimfix,
class coordtype>
306template <
int dimfix,
class coordtype>
314template <
int dimfix,
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...
int_t hashkey1() const
Returns hashing key no. 1 required by the hashing set template.
tCellFix< dimfix, coordtype > CellType
The type of a cell related to this cube type.
coordtype CoordType
The type of coordinates of a cube.
tCubeFix(int number, int dim)
The constructor of a cube from a number (invalid in this class).
tWrapBase< coordtype > PointBase
The point base (for wrapping and tabulating coordinates).
coordtype * coord(coordtype *c) const
Fills out the coordinate table with the cube's coordinates.
tCubeFix(const coordtype *c, int dim=0)
The constructor of a cube from a table of coordinates.
tCubeFix(const tCubeFix< dimfix, coordtype > &c)
The copy constructor.
friend int operator==(const tCubeFix< dimfix, coordtype > &c1, const tCubeFix< dimfix, coordtype > &c2)
The operator == for cubes.
coordtype tab[dimfix]
A table with the coordinates of the minimal vertex of the cube.
int dim() const
Returns the dimension of the cube.
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 const int MaxDim
The maximal dimension of a cube (unused).
tCubeFix()
The default constructor.
int_t hashkey2() const
Returns hashing key no. 2 required by the hashing set template.
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.
int thesame(const coordtype *c1, const coordtype *c2, int dim)
Compare two points. Returns true iff they have the same coordinates.
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.
std::istream & ReadCubeFix(std::istream &in, cubetype &c, int dimfix)
Reads a cube from the input text stream.
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.