34#ifndef _CHOMP_HOMOLOGY_CUBIRED1_H_
35#define _CHOMP_HOMOLOGY_CUBIRED1_H_
77template <
class tCube,
class tCubeSet>
113template <
class tCube,
class tVerify>
120 int_t prev = cset. size () + other. size ();
123 if (maincset. empty () && cset. empty ())
125 if (!other. empty ())
134 int dim = (cset. empty ()) ? maincset [0]. dim () :
143 static int_t _maxneighbors = 0;
145 if (maxneighbors != _maxneighbors)
147 _maxneighbors = maxneighbors;
148 buffer. reset (
new unsigned char [(maxneighbors + 7) >> 3]);
149 b. define (buffer. get (), maxneighbors);
160 for (
int_t i = 0; i < other. size (); ++ i)
164 if (!quiet && !(count % 373))
165 scon << std::setw (10) << count <<
166 "\b\b\b\b\b\b\b\b\b\b";
169 if (keep. check (other [i]))
173 b. clearall (maxneighbors);
188 if (!verify (other [i], other))
199 queue. remove (other [i]);
208 sseq <<
'0' << other [i] <<
'\n';
209 other. removenum (i);
221 for (
int_t i = 0; i < cset. size (); ++ i)
224 if (!quiet && !(count % 373))
225 scon << std::setw (10) << count <<
226 "\b\b\b\b\b\b\b\b\b\b";
230 if (keep. check (cset [i]))
234 b. clearall (maxneighbors);
255 queue. remove (cset [i]);
267 sseq <<
'0' << cset [i] <<
'\n';
278 while (!queue. empty ())
281 if (!quiet && !(count % 373))
282 scon << std::setw (10) << count <<
283 "\b\b\b\b\b\b\b\b\b\b";
288 queue. removenum (0);
291 b. clearall (maxneighbors);
295 throw "A cube from 'keep' found in a reduction queue!";
296 if (maincset. check (c))
297 throw "A cube from 'maincset' found in a reduction queue!";
300 if (other. check (c))
313 if (!verify (c, other))
331 sseq <<
'0' << c <<
'\n';
365 sseq <<
'0' << c <<
'\n';
375 return prev - cset. size () - other. size ();
389template <
class tCube,
class tVerify>
391 const tVerify &verify,
bool quiet =
false)
394 if (cset. empty () || other. empty ())
398 int_t prev = cset. size ();
401 int dim = cset [0]. dim ();
408 static int_t _maxneighbors = 0;
410 if (maxneighbors != _maxneighbors)
412 _maxneighbors = maxneighbors;
413 buffer. reset (
new unsigned char [(maxneighbors + 7) >> 3]);
414 b. define (buffer. get (), maxneighbors);
425 for (
int_t i = 0; i < cset. size (); ++ i)
429 if (!quiet && !(count % 373))
430 scon << std::setw (10) << count <<
431 "\b\b\b\b\b\b\b\b\b\b";
434 const tCube &c = cset [i];
437 b. clearall (maxneighbors);
440 if (!
acyclic (c, dim, other, &b, maxneighbors))
444 if (!verify (c, cset, other))
451 b. clearall (maxneighbors);
456 sseq <<
"L\n" <<
'2' << c <<
'\n';
468 while (!queue. empty ())
471 if (!quiet && !(count % 373))
472 scon << std::setw (10) << count <<
473 "\b\b\b\b\b\b\b\b\b\b";
477 const tCube c = queue [0];
478 queue. removenum (0);
481 b. clearall (maxneighbors);
484 if (!
acyclic (c, dim, other, &b, maxneighbors))
488 if (!verify (c, cset, other))
492 b. clearall (maxneighbors);
497 sseq <<
"L\n" <<
'2' << c <<
'\n';
507 return prev - cset. size ();
An auto_array template that mimics selected behaviors of the std::auto_ptr template,...
This file contains functions generated using Binary Decision Diagrams for checking the acyclicity of ...
This file contains the definition of a bitfield class which works an array of bits.
This file includes header files with various definitions of cubical cells and defines the standard ty...
This file contains classes and functions related to algebraic chain complexes and chain maps,...
This class defines a bit field that is part of some larger array or that uses an allocated piece of m...
An auto_array template that mimics selected behaviors of the std::auto_ptr template,...
This class can be used for iterating point's neighbors.
This file contains some precompiler definitions which indicate the operating system and/or compiler u...
This file contains procedures for the verification of acyclicity of full cubical sets,...
This file includes header files with various definitions of full cubes and defines the standard types...
This file contains some procedures defined for cubical maps.
This file contains a definition of a general geometric complex which represents a polyhedron.
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...
This file contains the definition of a tabulated set of configurations of full cubical neighborhood u...
int_t cubexpand(hashedset< tCube > &cset, hashedset< tCube > &other, const tVerify &verify, bool quiet=false)
Expands the set 'other' towards 'cset' without changing the homology of (cset + other,...
void addcubeneighbors(const tCube &q, int dim, const tCubeSet &cubset, bitfield *b, hashedset< tCube > &neighbors, hashedset< tCube > &queue, const hashedset< tCube > ¬these)
A small helper function which adds neighbors of the given cube to the given set.
int_t cubreducequiet(const hashedset< tCube > &maincset, hashedset< tCube > &cset, hashedset< tCube > &other, const hashedset< tCube > &keep, const tVerify &verify, bool quiet=true)
Reduces a pair of sets of cubes for relative homology computation.
outputstream sseq
An auxiliary stream which captures sequences of processed data.
int MaxBddDim
The maximal dimension for which binary decision diagrams are used.
int_t getneighbors(const tCube &q, BitField *bits, const tCubeSet1 &theset, tCubeSet2 *neighbors, int_t limit)
Gets neighbors of the given cube from the given set and indicates them in the bit field provided.
bool acyclic(int dim, BitField &b)
Checks whether this cube's nieghbors form an acyclic set.
bool acyclic_rel(const tCube &q, int dim, const tSet1 &cset, const tSet2 &other, BitField *b, int_t maxneighbors, hashedset< tCube > *neighbors_main, hashedset< tCube > *neighbors_other)
Verifies whether a cube from the other set can be removed.
setunion< set1type, set2type > makesetunion(const set1type &set1, const set2type &set2)
Creates an object which represents the union of two sets.
int_t getmaxneighbors(int dim)
Returns the maximal number of neighbors of a cube: 3^dim - 1.
tNeighbors< coordinate > neighbors
The neighbors class with the default type of coordinates.
outputstream scon
The console output stream to which one should put all the junk that spoils the log file,...
This namespace contains the entire CHomP library interface.
This file contains various procedures relating to neighborhoods of cubes in full cubical sets.
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 the definition of the container "setunion".
This file contains the definition of a class which stores tabulated configuration of full cubical nei...
This file contains some useful functions related to the text input/output procedures.