34#ifndef _CAPD_HOMENGIN_CUBISET_H_
35#define _CAPD_HOMENGIN_CUBISET_H_
54 CubicalSet (
const int *left_coords,
const int *right_coords,
55 int dim = EMBEDDING_DIM,
const int *space_wrapping = 0);
69 bool quiet =
false)
const;
73 int Add (
const int *coords);
77 int Delete (
const int *coords);
81 bool Contains (
const int *coords)
const;
91 int BitMask (
const int *coords)
const;
94 bool Inside (
const int *coords);
119 const int *right_coords,
int dim,
const int *space_wrapping)
122 throw "Non-positive dimension of a cubical complex.";
126 this ->
wrapping = space_wrapping ?
new int [
dim] : 0;
128 for (
int i = 0; i <
dim; ++ i)
131 sizes [i] = right_coords [i] - left_coords [i];
133 throw "Non-positive size of a cubical complex.";
144 for (
int i = 0; i <
dim; ++ i)
152 throw "Wrong buffer size in a cubical complex.";
174 for (
int i = 0; i <
dim; ++ i)
194 for (
int i = 0; i <
dim; ++ i)
208 int offset = (coords [0] -
minimal [0]) >> 3;
209 int multiply = ((
sizes [0] + 31) >> 5) << 2;
210 for (
int i = 1; i <
dim; ++ i)
212 offset += multiply * (coords [i] -
minimal [i]);
213 multiply *=
sizes [i];
220 return 1 << ((coords [0] -
minimal [0]) & 0x07);
225 for (
int i = 0; i <
dim; ++ i)
263 const char *engine,
bool quiet)
const
273 const char *engine = 0,
bool quiet =
false)
This file defines a top-level interface to a homology computation procedure of full cubical sets repr...
This class stores a full cubical set and implements some basic operations on such a set,...
int * sizes
The sizes of the binary data in the buffer.
int * wrapping
The space wrapping in each direction, if defined.
unsigned char * buffer
The binary buffer for storing the cubes.
int * minimal
The coordinates of the minimal vertex of the buffer box.
int bufsize
The actual size of the buffer.
int dim
The dimension of the embedding space.
~CubicalSet()
The destructor.
int Add(const int *coords)
Adds a cube to the set unless the cube is outside the box.
bool Inside(const int *coords)
Verifies whether the cube is within the bounding box.
CubicalSet(const int *left_coords, const int *right_coords, int dim=EMBEDDING_DIM, const int *space_wrapping=0)
The only constructor allowed: Creates an empty cubical bitmap of the given size.
void ComputeBettiNumbers(const CubicalSet &s, int *result, const char *engine=0, bool quiet=false)
Computes the Betti numbers of a full cubical set represented by an object of the class "CubicalSet".
CubicalSet & operator=(const CubicalSet &c)
The assignment operator.
void ComputeBettiNumbers(int *result, const char *engine=0, bool quiet=false) const
Computes the Betti numbers of the cubical set.
bool Contains(const int *coords) const
Verifies whether the given cube is contained in the cubical set.
void Clear()
Clears the bitmap and makes the cubical set empty.
int Delete(const int *coords)
Deletes a cube from the set.
int BitMask(const int *coords) const
Computes the mask for the bit in the right word.
int ByteOffset(const int *coords) const
Computes the right word offset in the buffer.