The ChainCon Software (Release 0.03)
cubcell.h
Go to the documentation of this file.
1 /////////////////////////////////////////////////////////////////////////////
2 ///
3 /// \file
4 ///
5 /// A cubical cell.
6 ///
7 /////////////////////////////////////////////////////////////////////////////
8 
9 // Copyright (C) 2009-2016 by Pawel Pilarczyk.
10 //
11 // This file is part of my research software package. This is free software:
12 // you can redistribute it and/or modify it under the terms of the GNU
13 // General Public License as published by the Free Software Foundation,
14 // either version 3 of the License, or (at your option) any later version.
15 //
16 // This software is distributed in the hope that it will be useful,
17 // but WITHOUT ANY WARRANTY; without even the implied warranty of
18 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 // GNU General Public License for more details.
20 //
21 // You should have received a copy of the GNU General Public License
22 // along with this software; see the file "license.txt". If not,
23 // please, see <http://www.gnu.org/licenses/>.
24 
25 // Started on March 24, 2009. Last revision: February 6, 2016.
26 
27 
28 #ifndef _CHAINCON_CUBCELL_H_
29 #define _CHAINCON_CUBCELL_H_
30 
31 
32 // include relevant local header files
33 //#include "chaincon/emptycell.h"
34 //#include "chaincon/wrapping.h"
35 
36 // include selected header files from the CHomP library
37 #include "chomp/system/config.h"
38 #include "chomp/struct/hashsets.h"
39 #include "chomp/cubes/pointbas.h"
40 #include "chomp/system/textfile.h"
41 
42 // include some standard C++ header files
43 #include <istream>
44 #include <ostream>
45 #include <algorithm>
46 #include <vector>
47 
48 
49 // --------------------------------------------------
50 // ------------------ cubical cell ------------------
51 // --------------------------------------------------
52 
53 /// An elementary cubical cell with vertex coordinates of integer type.
54 /// Note that unless using the most standard built-in integers,
55 /// the vertex coordinate integer type must have hash key functions
56 /// (hashkey1 and hashkey2, see e.g. those in chomp/struct/hashsets.h).
57 /// The wrapping class must provide a static function "wrap" for wrapping
58 /// the coordinates, separately at each dimension.
59 /// The empty cell existence decision class must provide a static function
60 /// "exists" that returns true if the empty cell must be taken
61 /// into consideration or false otherwise.
62 template <class CoordT, class WrapT, class EmptyT>
63 class tCubCell
64 {
65 public:
66  /// The type of coordinates.
67  typedef CoordT CoordType;
68 
69  /// The type of the coord wrapping class.
70  typedef WrapT WrapType;
71 
72  /// The type of the empty cell existence decision class.
73  typedef EmptyT EmptyType;
74 
75  /// The default constructor of an empty cube.
76  tCubCell ();
77 
78  /// The constructor of a full cube from an array of coordinates.
79  template <class CoordArray>
80  tCubCell (int dimension, const CoordArray &coordinates);
81 
82  /// The constructor of a full cube from two arrays of coordinates.
83  template <class CoordArray>
84  tCubCell (int dimension, const CoordArray &left,
85  const CoordArray &right);
86 
87  /// The copy constructor.
89 
90  /// The constructor of the n-th boundary cube.
91  tCubCell (const tCubCell<CoordT,WrapT,EmptyT> &c, int n);
92 
93  /// The constructor of the n-th component of the Alexander-Whitney
94  /// diagonal, either the left one (if side = 0), or the right one
95  /// (if side = 1).
96  tCubCell (const tCubCell<CoordT,WrapT,EmptyT> &c, int n, int side);
97 
98  /// The assignment operator.
101 
102  /// The destructor.
103  ~tCubCell ();
104 
105  /// Returns the dimension of the embedding space.
106  int spaceDim () const;
107 
108  /// Returns the dimension of the elementary cube.
109  int dim () const;
110 
111  /// Returns the n-th left coordinate of the elementary cube.
112  const CoordT left (int n) const;
113 
114  /// Returns the n-th right coordinate of the elementary cube.
115  const CoordT right (int n) const;
116 
117  /// Returns the length of the boundary of the elementary cube.
118  int boundaryLength () const;
119 
120  /// Returns the n-th coefficient in the boundary of the cube.
121  int boundaryCoef (int n) const;
122 
123  /// Returns the number of terms in the Alexander-Whitneney diagonal.
124  int diagonalLength () const;
125 
126  /// Returns hashing key no. 1, based on the internal data.
127  int_t hashkey1 () const;
128 
129  /// Return shashing key no. 2, based on the internal data
130  int_t hashkey2 () const;
131 
132  /// Returns true if and only if the cubes are the same.
133  bool operator == (const tCubCell<CoordT,WrapT,EmptyT> &s) const;
134 
135  /// Swaps the data between two cubical cells.
137 
138 protected:
139  /// The number that defines the left corner of the elementary cube.
140  /// The dimension of the embedding space is stored in high bits
141  /// of this number.
142  /// As an exception, the empty cell has this number set to 0.
143  int_t n1;
144 
145  /// The number that defines the right corner of the elementary cube.
146  /// The dimension of the cubical cell is stored in the high bits
147  /// of this number.
148  /// As an exception, the empty cell has this number set to 0.
149  int_t n2;
150 
151 }; /* class tCubCell */
152 
153 // --------------------------------------------------
154 
155 template <class CoordT, class WrapT, class EmptyT>
157 {
158  return;
159 } /* tCubCell::tCubCell */
160 
161 template <class CoordT, class WrapT, class EmptyT>
162 template <class CoordArray>
164  const CoordArray &coordinates): n1 (0), n2 (0)
165 {
166  // if the embedding space dimension is not positive
167  // then create the empty cubical cell
168  if (dimension <= 0)
169  return;
170 
171  // if the requested dimension is too high then throw an error message
172  if (dimension >= chomp::homology::MaxBasDim)
173  throw "Too high cubical cell dimension requested.";
174 
175  // compute the number that represents the left corner of the cell
176  CoordT c [chomp::homology::MaxBasDim];
177  for (int i = 0; i < dimension; ++ i)
178  c [i] = coordinates [i];
179  WrapT::wrap (c, dimension);
180  n1 = chomp::homology::tPointBase<CoordT>::number (c, dimension);
181  n1 |= dimension << chomp::homology::NumBits;
182 
183  // compute the number that represents the right corner of the cell
184  for (int i = 0; i < dimension; ++ i)
185  ++ (c [i]);
186  WrapT::wrap (c, dimension);
187  n2 = chomp::homology::tPointBase<CoordT>::number (c, dimension);
188  n2 |= dimension << chomp::homology::NumBits;
189 
190  return;
191 } /* tCubCell::tCubCell */
192 
193 template <class CoordT, class WrapT, class EmptyT>
194 template <class CoordArray>
196  const CoordArray &left, const CoordArray &right): n1 (0), n2 (0)
197 {
198  // if the embedding space dimension is not positive
199  // then create the empty cubical cell
200  if (dimension <= 0)
201  return;
202 
203  // if the requested dimension is too high then throw an error message
204  if (dimension >= chomp::homology::MaxBasDim)
205  throw "Too high cubical cell dimension requested.";
206 
207  // compute the dimension of the cell
208  int cellDimension = 0;
209  for (int i = 0; i < dimension; ++ i)
210  {
211  if (left [i] != right [i])
212  ++ cellDimension;
213  }
214 
215  // compute the number that represents the left corner of the cell
216  CoordT c [chomp::homology::MaxBasDim];
217  for (int i = 0; i < dimension; ++ i)
218  c [i] = left [i];
219  WrapT::wrap (c, dimension);
220  n1 = chomp::homology::tPointBase<CoordT>::number (c, dimension);
221  n1 |= dimension << chomp::homology::NumBits;
222 
223  // compute the number that represents the right corner of the cell
224  for (int i = 0; i < dimension; ++ i)
225  c [i] = right [i];
226  WrapT::wrap (c, dimension);
227  n2 = chomp::homology::tPointBase<CoordT>::number (c, dimension);
228  n2 |= cellDimension << chomp::homology::NumBits;
229 
230  return;
231 } /* tCubCell::tCubCell */
232 
233 template <class CoordT, class WrapT, class EmptyT>
236  n1 (c. n1), n2 (c. n2)
237 {
238  return;
239 } /* tCubCell::tCubCell */
240 
241 template <class CoordT, class WrapT, class EmptyT>
244 {
245  using chomp::homology::sbug;
246 
247  // determine the dimension of the cell
248  int cellDimension = c. dim ();
249 
250  // if the dimension of the cell is zero then the result should be empty
251  if (!cellDimension)
252  {
253  n1 = 0;
254  n2 = 0;
255  return;
256  }
257 
258  // determine the dimension of the embedding space
259  int spaceDimension = c. spaceDim ();
260 
261  // prepare arrays for the coordinates of the corners of the cell
262  CoordT newLeft [chomp::homology::MaxBasDim];
263  CoordT newRight [chomp::homology::MaxBasDim];
264  for (int i = 0; i < spaceDimension; ++ i)
265  {
266  newLeft [i] = c. left (i);
267  newRight [i] = c. right (i);
268  }
269 
270  // if this is the first set of cells then squeeze rightwards
271  bool squeezeRight = (n < cellDimension);
272  int nn ((n >= cellDimension) ? (n - cellDimension) : n);
273  int counter = 0;
274  bool squeezed = false;
275  for (int i = 0; i < spaceDimension; ++ i)
276  {
277  if (newLeft [i] != newRight [i])
278  {
279  if (nn == counter)
280  {
281  if (squeezeRight)
282  newLeft [i] = newRight [i];
283  else
284  newRight [i] = newLeft [i];
285  squeezed = true;
286  break;
287  }
288  ++ counter;
289  }
290  }
291  if (!squeezed)
292  {
293  sbug << "DEBUG: c = " << c << ".\n";
294  sbug << "DEBUG: cellDimension = " << cellDimension << ".\n";
295  sbug << "DEBUG: spaceDimension = " << spaceDimension << ".\n";
296  sbug << "DEBUG: squeezeRight = " <<
297  (squeezeRight ? "true" : "false") << ".\n";
298  sbug << "DEBUG: n = " << n << ".\n";
299  sbug << "DEBUG: nn = " << nn << ".\n";
300  throw "Wrong boundary element requested.";
301  }
302  n1 = chomp::homology::tPointBase<CoordT>::number
303  (newLeft, spaceDimension);
304  n1 |= spaceDimension << chomp::homology::NumBits;
305  n2 = chomp::homology::tPointBase<CoordT>::number
306  (newRight, spaceDimension);
307  n2 |= (cellDimension - 1) << chomp::homology::NumBits;
308  return;
309 } /* tCubCell::tCubCell */
310 
311 /// The version of the AW diagonal. For testing only.
312 static int diagVersion = 0;
313 
314 template <class CoordT, class WrapT, class EmptyT>
316  (const tCubCell<CoordT,WrapT,EmptyT> &c, int n, int side)
317 {
318  int cellDimension = c. dim ();
319  if (cellDimension != 2)
320  throw "AW diagonal supported for cubes only in dim 2.";
321  CoordT newLeft [chomp::homology::MaxBasDim];
322  CoordT newRight [chomp::homology::MaxBasDim];
323  int spaceDimension = c. spaceDim ();
324  int indices [2];
325  int index = 0;
326  for (int i = 0; i < spaceDimension; ++ i)
327  {
328  newLeft [i] = c. left (i);
329  newRight [i] = c. right (i);
330  if (newLeft [i] != newRight [i])
331  indices [index ++] = i;
332  }
333 
334  if (diagVersion == 1)
335  {
336 
337  if (side == 0)
338  {
339  switch (n)
340  {
341  case 0:
342  newRight [indices [0]] = newLeft [indices [0]];
343  newLeft [indices [1]] = newRight [indices [1]];
344  break;
345  case 1:
346  break;
347  case 2:
348  case 3:
349  newLeft [indices [0]] = newRight [indices [0]];
350  break;
351  case 4:
352  newLeft [indices [1]] = newRight [indices [1]];
353  break;
354  case 5:
355  newRight [indices [0]] = newLeft [indices [0]];
356  break;
357  }
358  }
359  else
360  {
361  switch (n)
362  {
363  case 0:
364  break;
365  case 1:
366  newRight [indices [0]] = newLeft [indices [0]];
367  newRight [indices [1]] = newLeft [indices [1]];
368  break;
369  case 2:
370  newLeft [indices [1]] = newRight [indices [1]];
371  break;
372  default:
373  newRight [indices [0]] = newLeft [indices [0]];
374  break;
375  }
376  }
377 
378  }
379 
380  else if (diagVersion == 2)
381  {
382 
383  if (side == 0)
384  {
385  switch (n)
386  {
387  case 0:
388  newRight [indices [1]] = newLeft [indices [1]];
389  break;
390  case 1:
391  newLeft [indices [0]] = newRight [indices [0]];
392  break;
393  case 2:
394  newRight [indices [0]] = newLeft [indices [0]];
395  break;
396  }
397  }
398  else
399  {
400  switch (n)
401  {
402  case 0:
403  case 1:
404  newLeft [indices [0]] = newRight [indices [0]];
405  break;
406  case 2:
407  newLeft [indices [1]] = newRight [indices [1]];
408  break;
409  }
410  }
411 
412  }
413 
414  else if (diagVersion == 3)
415  {
416 
417  if (side == 0)
418  {
419  switch (n)
420  {
421  case 0:
422  case 1:
423  newRight [indices [1]] = newLeft [indices [1]];
424  break;
425  case 2:
426  newLeft [indices [0]] = newRight [indices [0]];
427  break;
428  }
429  }
430  else
431  {
432  switch (n)
433  {
434  case 0:
435  newLeft [indices [0]] = newRight [indices [0]];
436  break;
437  case 1:
438  case 2:
439  newLeft [indices [1]] = newRight [indices [1]];
440  break;
441  }
442  }
443 
444  }
445 
446  else
447  throw "Undefined version of A-W diagonal requested.\n";
448 
449  int newDimension = 0;
450  for (int i = 0; i < spaceDimension; ++ i)
451  {
452  if (newLeft [i] != newRight [i])
453  ++ newDimension;
454  }
455  n1 = chomp::homology::tPointBase<CoordT>::number
456  (newLeft, spaceDimension);
457  n1 |= spaceDimension << chomp::homology::NumBits;
458  n2 = chomp::homology::tPointBase<CoordT>::number
459  (newRight, spaceDimension);
460  n2 |= newDimension << chomp::homology::NumBits;
461  return;
462 } /* tCubCell::tCubCell */
463 
464 template <class CoordT, class WrapT, class EmptyT>
468 {
469  n1 = c. n1;
470  n2 = c. n2;
471  return *this;
472 } /* tCubCell::operator = */
473 
474 template <class CoordT, class WrapT, class EmptyT>
476 {
477  return;
478 } /* tCubCell::~tCubCell */
479 
480 template <class CoordT, class WrapT, class EmptyT>
482 {
483  return (n1 >> chomp::homology::NumBits);
484 } /* tCubCell::spaceDim */
485 
486 template <class CoordT, class WrapT, class EmptyT>
488 {
489  if ((n1 == 0) && (n2 == 0))
490  return -1;
491  return (n2 >> chomp::homology::NumBits);
492 } /* tCubCell::dim */
493 
494 template <class CoordT, class WrapT, class EmptyT>
495 inline const CoordT tCubCell<CoordT,WrapT,EmptyT>::left (int n) const
496 {
497  return chomp::homology::tPointBase<CoordT>::coord
498  (n1 & chomp::homology::NumMask, spaceDim ()) [n];
499 } /* tCubCell::left */
500 
501 template <class CoordT, class WrapT, class EmptyT>
502 inline const CoordT tCubCell<CoordT,WrapT,EmptyT>::right (int n) const
503 {
504  return chomp::homology::tPointBase<CoordT>::coord
505  (n2 & chomp::homology::NumMask, spaceDim ()) [n];
506 } /* tCubCell::right */
507 
508 template <class CoordT, class WrapT, class EmptyT>
510 {
511  int dimension = dim ();
512  if (EmptyT::exists ())
513  return (dimension > 0) ? (dimension << 1) : (dimension + 1);
514  else
515  return dimension << 1;
516 } /* tCubCell::boundaryLength */
517 
518 template <class CoordT, class WrapT, class EmptyT>
520 {
521  if (!n)
522  return 1;
523  int dimension = dim ();
524  if (n >= dimension)
525  n -= dimension - 1;
526  return (n & 1) ? -1 : 1;
527 } /* tCubCell::boundaryCoef */
528 
529 template <class CoordT, class WrapT, class EmptyT>
531 {
532  if (dim () != 2)
533  throw "A-W diagonal supported only in dim 2.";
534  return 3; //6;
535 } /* tCubCell::diagonalLength */
536 
537 template <class CoordT, class WrapT, class EmptyT>
539 {
540  return ((n1 ^ 0x55555555u) << 21) ^ ((n1 ^ 0xAAAAAAAAu) << 9) ^
541  ((n2 ^ 0xAAAAAAAAu) >> 1);
542 } /* tCubCell::hashkey1 */
543 
544 template <class CoordT, class WrapT, class EmptyT>
546 {
547  return ((n2 ^ 0xAAAAAAAAu) << 22) ^ ((n2 ^ 0x55555555u) << 10) ^
548  (n1 ^ 0x55555555u);
549 } /* tCubCell::hashkey2 */
550 
551 template <class CoordT, class WrapT, class EmptyT>
552 inline bool tCubCell<CoordT,WrapT,EmptyT>::operator ==
554 {
555  return (n1 == s. n1) && (n2 == s. n2);
556 } /* tCubCell::operator == */
557 
558 template <class CoordT, class WrapT, class EmptyT>
561 {
562  std::swap (n1, s. n1);
563  std::swap (n2, s. n2);
564  return;
565 } /* tCubCell::swap */
566 
567 // --------------------------------------------------
568 
569 /// Generates a hashing key no. 1 for a cubical cell,
570 /// composed of hashing keys for the coordinates.
571 /// This key is to be used in a hashed set.
572 template <class CoordT, class WrapT, class EmptyT>
574 {
575  return c. hashkey1 ();
576 /*
577 // using chomp::homology::hashkey1;
578  using ::hashkey1;
579  int d = c. spaceDim ();
580  if (d <= 0)
581  return 0;
582  else if (d == 1)
583  return hashkey1 (c. left (0)) << 2;
584  else if (d == 2)
585  {
586  return (((hashkey1 (c. left (0)) & 0x65555555u) << 10) ^
587  ((hashkey1 (c. right (1)) & 0xAAAAAAAAu)));
588  }
589  else if (d == 3)
590  {
591  return (((hashkey1 (c. left (0)) & 0x65555555u) << 10) ^
592  ((hashkey1 (c. right (1)) & 0xAAAAAAAAu) << 2) ^
593  ((hashkey1 (c. left (2)) & 0xA5294252u) >> 1));
594  }
595  else
596  {
597  return (((hashkey1 (c. left ((d >> 2) + 1)) & 0x65555555u) << 16) ^
598  ((hashkey1 (c. right (d >> 3)) & 0x52942529u) << 10) ^
599  ((hashkey1 (c. right (d >> 1)) & 0xAAAAAAAAu) << 4) ^
600  ((hashkey1 (c. left (d - 1)) & 0xA5294252u) >> 1));
601  }
602 */
603 } /* hashkey1 */
604 
605 /// Generates a hashing key no. 2 for a cubical cell,
606 /// composed of hashing keys for the coordinates.
607 /// This key is to be used in a hashed set.
608 template <class CoordT, class WrapT, class EmptyT>
610 {
611  return c. hashkey2 ();
612 /*
613 // using chomp::homology::hashkey2;
614  using ::hashkey2;
615  int d = c. spaceDim ();
616  if (d <= 0)
617  return 0;
618  else if (d == 1)
619  return hashkey2 (c. right (0)) << 4;
620  else if (d == 2)
621  {
622  return (((hashkey2 (c. right (0)) & 0xAAAAAAAAu) >> 1) ^
623  ((hashkey2 (c. left (1)) & 0x55555555u) << 7));
624  }
625  else if (d == 3)
626  {
627  return (((hashkey2 (c. right (2)) & 0x55555555u) << 9) ^
628  ((hashkey2 (c. right (0)) & 0xAAAAAAAAu) << 3) ^
629  ((hashkey2 (c. left (1)) & 0xA5294A52u) >> 1));
630  }
631  else
632  {
633  return (((hashkey2 (c. right (d - 2)) & 0x55555555u) << 11) ^
634  ((hashkey1 (c. left ((d >> 3) + 1)) & 0x52942529u) << 19) ^
635  ((hashkey2 (c. right (d >> 2)) & 0xAAAAAAAAu) << 5) ^
636  ((hashkey2 (c. left ((d >> 1) + 1)) & 0xA5294A52u) >> 1));
637  }
638 */
639 } /* hashkey2 */
640 
641 // --------------------------------------------------
642 
643 /// Writes an elementary cube in the text mode to an output stream
644 /// as the cartesian product of elementary intervals.
645 template <class CoordT, class WrapT, class EmptyT>
646 std::ostream &operator << (std::ostream &out,
648 {
649  int dim = c. spaceDim ();
650  out << '[';
651  for (int i = 0; i < dim; ++ i)
652  {
653  if (i)
654  out << "]x[";
655  CoordT left = c. left (i);
656  CoordT right = c. right (i);
657  out << left;
658  if (left != right)
659  out << ',' << right;
660  }
661  out << ']';
662  return out;
663 } /* operator << */
664 
665 /// Reads an elementary cube from the input stream in the text format.
666 /// Skips all the comments and spaces in the input stream
667 /// before checking for an opening parenthesis or bracket.
668 /// Then reads the cartesian product that defines the cube.
669 /// If no elementary cube is found in the input then the cube
670 /// is not modified.
671 template <class CoordT, class WrapT, class EmptyT>
672 std::istream &operator >> (std::istream &in,
674 {
675  using chomp::homology::ignorecomments;
676 
677  // ignore any comments, spaces, tabs and new-line characters
678  ignorecomments (in);
679 
680  // check for an opening parenthesis of bracket
681  if ((in. peek () != '[') && (in. peek () != '('))
682  return in;
683 
684  // read the opening parenthesis or bracket if found
685  int ch = in. get ();
686  ignorecomments (in);
687 
688  // consider the case of the empty cubical cell or the empty cube
689  if ((in. peek () == ']') || (in. peek () == ')'))
690  {
691  in. get ();
692  const CoordT *null = 0;
693  c = tCubCell<CoordT,WrapT,EmptyT> (-1, null, null);
694  return in;
695  }
696 
697  int spaceDim = 0;
698 
699  // read a full cube with coordinates in parentheses
700  if (ch == '(')
701  {
702  CoordT coordinates [chomp::homology::MaxBasDim];
703  while (1)
704  {
705  // read a consecutive coordinate of the cube
706  CoordT &coordinate = coordinates [spaceDim];
707  coordinate = 0;
708  in >> coordinate;
709  ignorecomments (in);
710  ++ spaceDim;
711 
712  // read the separator if any
713  if (in. peek () == ',')
714  {
715  ch = in. get ();
716  ignorecomments (in);
717  }
718 
719  // if this is a closing parenthesis then finish
720  if (in. peek () == ')')
721  {
723  coordinates);
724  return in;
725  }
726  }
727  }
728 
729  // prepare arrays for the left and right endpoints of the cell
730  CoordT leftArray [chomp::homology::MaxBasDim];
731  CoordT rightArray [chomp::homology::MaxBasDim];
732 
733  // read the cartesian product of intervals
734  while (1)
735  {
736  CoordT &left = leftArray [spaceDim];
737  CoordT &right = rightArray [spaceDim];
738  left = 0;
739  right = 0;
740  in >> left;
741  ignorecomments (in);
742  if (in. peek () == ']')
743  right = left;
744  else if (in. get () == ',')
745  {
746  in >> right;
747  ignorecomments (in);
748  }
749  else
750  throw "Can't read a cubical cell.";
751  in. get ();
752  ignorecomments (in);
753  ++ spaceDim;
754  if (in. peek () != 'x')
755  break;
756  in. get ();
757  ignorecomments (in);
758  if (in. get () != '[')
759  throw "An interval expected for a cubical cell.";
760  if (spaceDim >= chomp::homology::MaxBasDim)
761  throw "Too high dimension of a cubical cell.";
762  }
763 
764  // define the cubical cell
765  c = tCubCell<CoordT,WrapT,EmptyT> (spaceDim, leftArray, rightArray);
766 
767  return in;
768 } /* operator >> */
769 
770 
771 #endif // _CHAINCON_CUBCELL_H_
772 
WrapT WrapType
The type of the coord wrapping class.
Definition: cubcell.h:70
std::ostream & operator<<(std::ostream &out, const tCubCell< CoordT, WrapT, EmptyT > &c)
Writes an elementary cube in the text mode to an output stream as the cartesian product of elementary...
Definition: cubcell.h:646
int boundaryCoef(int n) const
Returns the n-th coefficient in the boundary of the cube.
Definition: cubcell.h:519
int_t n1
The number that defines the left corner of the elementary cube.
Definition: cubcell.h:143
bool operator==(const tCubCell< CoordT, WrapT, EmptyT > &s) const
Returns true if and only if the cubes are the same.
Definition: cubcell.h:553
int dim() const
Returns the dimension of the elementary cube.
Definition: cubcell.h:487
int boundaryLength() const
Returns the length of the boundary of the elementary cube.
Definition: cubcell.h:509
tCubCell()
The default constructor of an empty cube.
Definition: cubcell.h:156
int spaceDim() const
Returns the dimension of the embedding space.
Definition: cubcell.h:481
const CoordT left(int n) const
Returns the n-th left coordinate of the elementary cube.
Definition: cubcell.h:495
int_t hashkey2() const
Return shashing key no. 2, based on the internal data.
Definition: cubcell.h:545
void swap(tCubCell< CoordT, WrapT, EmptyT > &s)
Swaps the data between two cubical cells.
Definition: cubcell.h:560
int_t n2
The number that defines the right corner of the elementary cube.
Definition: cubcell.h:149
static int diagVersion
The version of the AW diagonal. For testing only.
Definition: cubcell.h:312
const CoordT right(int n) const
Returns the n-th right coordinate of the elementary cube.
Definition: cubcell.h:502
EmptyT EmptyType
The type of the empty cell existence decision class.
Definition: cubcell.h:73
int diagonalLength() const
Returns the number of terms in the Alexander-Whitneney diagonal.
Definition: cubcell.h:530
An elementary cubical cell with vertex coordinates of integer type.
Definition: cubcell.h:63
~tCubCell()
The destructor.
Definition: cubcell.h:475
std::istream & operator>>(std::istream &in, tCubCell< CoordT, WrapT, EmptyT > &c)
Reads an elementary cube from the input stream in the text format.
Definition: cubcell.h:672
CoordT CoordType
The type of coordinates.
Definition: cubcell.h:67
int_t hashkey1() const
Returns hashing key no. 1, based on the internal data.
Definition: cubcell.h:538