29 #ifndef _CHAINCON_AWDIAGCUBS_H_ 30 #define _CHAINCON_AWDIAGCUBS_H_ 38 #include "chomp/system/config.h" 39 #include "chomp/cubes/pointbas.h" 62 template <
class CoordT,
class WrapT,
class EmptyT>
74 throw "Trying to use a version of A-W diagonal " 75 "implemented for 2-dim cubes only.";
79 int dim = c. spaceDim ();
80 CoordT coord [4] [chomp::homology::MaxBasDim];
82 for (
int i = 0; i < dim; ++ i)
84 coord [0] [i] = c. left (i);
85 coord [3] [i] = c. right (i);
86 if (coord [0] [i] != coord [3] [i])
88 coord [1] [i] = index ? coord [3] [i] :
90 coord [2] [i] = index ? coord [0] [i] :
96 coord [1] [i] = coord [0 ][i];
97 coord [2] [i] = coord [0] [i];
103 for (
int i = 0; i < 4; ++ i)
105 num [i] = chomp::homology::tPointBase<CoordT>::number
112 numbers [0] = num [0];
113 numbers [1] = num [1];
114 numbers [2] = num [3];
115 std::sort (numbers, numbers + 3);
116 s. add (SimplexType (2, numbers));
117 numbers [0] = num [0];
118 numbers [1] = num [2];
119 numbers [2] = num [3];
120 std::sort (numbers, numbers + 3);
121 s. add (SimplexType (2, numbers));
129 int_t size = simplTensor. size ();
130 for (int_t n = 0; n < size; ++ n)
135 for (
int side = 0; side < 2; ++ side)
137 sim [side] = side ? simplTensor. right (n) :
138 simplTensor. left (n);
140 if ((sim [0]. dim () != 1) || (sim [1]. dim () != 1))
145 for (
int side = 0; side < 2; ++ side)
147 for (
int v = 0; v < 2; ++ v)
149 int_t n = sim [side] [v];
151 while (num [index] != n)
153 vert [side] [v] = index;
155 if (vert [side] [0] > vert [side] [1])
156 std::swap (vert [side] [0], vert [side] [1]);
161 for (
int side = 0; side < 2; ++ side)
163 if ((vert [side] [0] == 0) && (vert [side] [1] == 3))
165 cc [side]. add (CubeType (dim,
166 coord [0], coord [1]));
167 cc [side]. add (CubeType (dim,
168 coord [1], coord [3]));
172 cc [side]. add (CubeType (dim,
173 coord [vert [side] [0]],
174 coord [vert [side] [1]]));
179 for (int_t i = 0; i < cc [0]. size (); ++ i)
181 for (int_t j = 0; j < cc [1]. size (); ++ j)
183 t. add (cc [0]. getCell (i),
184 cc [1]. getCell (j));
195 template <
class CoordT,
class WrapT,
class EmptyT,
class CoefT>
200 throw "Trying to use a version of A-W diagonal " 201 "that was not implemented.";
206 #endif // _CHAINCON_AWDIAGCUBS_H_ void AWdiagonal(const tCubCell< CoordT, WrapT, EmptyT > &c, tCombTensor< tCubCell< CoordT, WrapT, EmptyT >, tCubCell< CoordT, WrapT, EmptyT > > &t)
Computes the Alexander-Whitney diagonal of a cubical cell using a simplicial subdivision of the cell...
A simplex with vertices of arbitrary type.
A combinatorial chain, that is, a chain with Z_2 coefficients.
A tensor of chains with coefficients in an arbitrary commutative ring.
Combinatorial tensor of cells.
A combinatorial tensor (for coefficients in Z_2).
A chain with coefficients in an arbitrary commutative ring.
A simplex class with arbitrary vertices.
Alexander-Whitney diagonal of a chain.
A simplicial version of the Alexander-Whitney diagonal.
An elementary cubical cell with vertex coordinates of integer type.