Tips and Tricks for the CHomP Software
This page contains some hints how to use and tweak the CHomP software.
Some of the remarks may be quite specialized.
The information gathered at this page usually answers
various questions raised by the users.
The default type of coordinates
The default type of coordinates of cubes and cubical cells
in the CHomP software is short int,
as defined at the beginning of the file
cubes/pointset.h as the type coordinate.
This restricts the range
of the coordinates of cubes to 16-bit signed integers.
This type can be changed if necessary, and the change requires
the recompilation of all the code.
Types of cubes and cubical cells
There are three different types of cubes and cubical cells
defined in the CHomP library, all are templates which take
the type of coordinates as an argument.
The types are:
- tCubeBase<coordtype> defined in the file
cubes/cubebase.h – this type uses hashing tables
for storing the coordinates of all the cubes that appear in the program,
and each cube is identified by a single 32-bit integer number in which
some bits are reserved for the dimension of the cube (6 by default)
and the remaining bits are used to store the cube's number (26 by default),
thus imposing the limit on the total number of cubes
and their maximal dimension (see const int DimBits
in the file cubes/pointbas.h); this strategy saves
a lot of memory while working with multiple sets of cubes
which share the same elements
- tCubeFix<dim,coordtype> defined in the file
cubes/cubefix.h – with the dimension known at compilation time;
each cube stores its own array of coordinates which is of fixed size
- tCubeVar<coordtype> defined in the file
cubes/cubevar.h – with the array of coordinates allocated
dynamically at program's run
Cubical cells also have three different template types which correspond
to each of these types of full cubes, and are defined in the files
cubes/cellbase.h,
cubes/cellfix.h,
and
cubes/cellvar.h, respectively.
The default type of cubes and cubical cells
The default type of cubes and cubical cells is defined in 4 places
in the code, and can be changed if needed, but the change must be done
to the 4 places at the same time, or some programs will not compile
otherwise. Here is a summary:
- typedef tCubeBase<coordinate> Cube;
at the beginning of cubes/cube.h
- typedef tCellBase<coordinate> CubicalCell;
at the beginning of cubes/cell.h
- typedef tCube2l<tCubeBase<coordinate> > Cube2l;
at the end of cubes/twolayer.h
- typedef tCell2l<tCellBase<coordinate> >
CubicalCell2l;
at the end of cubes/twolayer.h
In all these definitions, one can replace
tCubeBase
and
tCellBase with
tCubeVar and
tCellVar,
respectively. Unfortunately, the template
tCubeFix cannot be
used, because it requires the knowledge of the dimension of cubes
at compile time.