The Original CHomP Software
Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Private Attributes | Friends | List of all members
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>

Public Types

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

Public Member Functions

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

Static Public Member Functions

static const char * name ()
 Returns the name of the objects represented by this class. More...
 
static const char * pluralname ()
 Returns the plural name of the objects represented by this class. More...
 

Static Public Attributes

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

Private Attributes

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

Friends

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

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 71 of file cubefix.h.

Member Typedef Documentation

◆ CellType

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 78 of file cubefix.h.

◆ CoordType

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

The type of coordinates of a cube.

Definition at line 75 of file cubefix.h.

◆ PointBase

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 84 of file cubefix.h.

Constructor & Destructor Documentation

◆ tCubeFix() [1/4]

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

The default constructor.

Definition at line 141 of file cubefix.h.

142{
143 return;
144} /* tCubeFix::tCubeFix */

◆ tCubeFix() [2/4]

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 147 of file cubefix.h.

149{
150 if (dim && ((dim != dimfix) || (dim < 0)))
151 throw "Wrong dimension of a fixed-dim cube.";
152 PointBase::wrapcopy (tab, c, dimfix);
153 return;
154} /* tCubeFix::tCubeFix */
coordtype tab[dimfix]
A table with the coordinates of the minimal vertex of the cube.
Definition: cubefix.h:134
int dim() const
Returns the dimension of the cube.
Definition: cubefix.h:181
static void wrapcopy(coordtype *dest, const coordtype *src, int dim)
Copies the coordinates and wraps them if necessary.
Definition: pointbas.h:322

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

◆ tCubeFix() [3/4]

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 157 of file cubefix.h.

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

◆ tCubeFix() [4/4]

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

The copy constructor.

Definition at line 163 of file cubefix.h.

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

Member Function Documentation

◆ coord()

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 196 of file cubefix.h.

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

◆ dim()

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

Returns the dimension of the cube.

Definition at line 181 of file cubefix.h.

182{
183 return dimfix;
184} /* tCubeFix::dim */

◆ hashkey1()

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

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

Definition at line 204 of file cubefix.h.

205{
206 switch (dimfix)
207 {
208 case 1:
209 return static_cast<int_t> (tab [0]) << 12;
210 case 2:
211 return ((static_cast<int_t> (tab [0])) << 18) +
212 ((static_cast<int_t> (tab [1])) << 6);
213 default:
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);
217 }
218} /* tCubeFix::hashkey1 */
int int_t
Index type for indexing arrays, counting cubes, etc.
Definition: config.h:115

◆ hashkey2()

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

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

Definition at line 227 of file cubefix.h.

228{
229 switch (dimfix)
230 {
231 case 1:
232 return static_cast<int_t> (tab [0]) << 3;
233 case 2:
234 return (static_cast<int_t> (tab [0]) >> 1) +
235 (static_cast<int_t> (tab [1]) << 13);
236 default:
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);
240 }
241} /* tCubeFix::hashkey2 */

◆ name()

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 250 of file cubefix.h.

251{
252 return "cube";
253} /* tCubeFix::name */

◆ operator=()

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 172 of file cubefix.h.

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

◆ pluralname()

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 256 of file cubefix.h.

257{
258 return "cubes";
259} /* tCubeFix::pluralname */

Friends And Related Function Documentation

◆ operator==

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 123 of file cubefix.h.

125 {
126 return thesame (c1. tab, c2. tab, dimfix);
127 }
int thesame(const coordtype *c1, const coordtype *c2, int dim)
Compare two points. Returns true iff they have the same coordinates.
Definition: pointset.h:98

◆ tCellFix< dimfix, coordtype >

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

Definition at line 123 of file cubefix.h.

Member Data Documentation

◆ MaxDim

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 81 of file cubefix.h.

◆ tab

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

A table with the coordinates of the minimal vertex of the cube.

Definition at line 134 of file cubefix.h.


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