28 #ifndef _CHAINCON_CELLNAMES_H_ 29 #define _CHAINCON_CELLNAMES_H_ 40 #include "chomp/system/config.h" 41 #include "chomp/struct/multitab.h" 42 #include "chomp/struct/hashsets.h" 60 template <
class CellT>
106 chomp::homology::multitable<chomp::homology::hashedset<CellT> >
125 template <
class CellT>
131 template <
class CellT>
139 template <
class CellT>
150 template <
class CellT>
156 template <
class CellT>
163 template <
class CellT>
170 template <
class CellT>
176 template <
class CellT>
185 int_t n =
cells [dim]. add (c) + 1;
188 std::ostringstream s;
193 s << static_cast<char> (
'a' + dim);
195 else if (dim < 26 * 26)
197 s << static_cast<char> (
'a' + dim / 26 - 1);
198 s << static_cast<char> (
'a' + dim % 26);
202 throw "Dimension too high for a cell name.";
208 s <<
prefix <<
"^" << dim <<
"_" << n;
214 template <
class CellT>
221 template <
class CellT>
237 template <
class CellT>
286 template <
class CellT>
292 template <
class CellT>
298 template <
class CellT>
304 template <
class CellT>
310 template <
class CellT>
322 template <
class CellT>
329 template <
class CellT>
342 template <
class CellT,
class NamesT>
343 inline typename NamesT::NameType
cells2names (
const CellT &in, NamesT &names)
350 template <
class CellT,
class NamesT>
355 int_t size = in. size ();
356 for (int_t i = 0; i < size; ++ i)
357 out. add (names (in. getCell (i)));
363 template <
class CellT,
class CoefT,
class NamesT>
368 int_t size = in. size ();
369 for (int_t i = 0; i < size; ++ i)
370 out. add (names (in. getCell (i)), in. getCoef (i));
376 template <
class Cell1T,
class Cell2T,
class Names1T,
class Names2T>
379 Names1T &names1, Names2T &names2)
383 int_t size = in. size ();
384 for (int_t i = 0; i < size; ++ i)
385 out. add (names1 (in. left (i)), names2 (in. right (i)));
391 template <
class Cell1T,
class Cell2T,
class CoefT,
392 class Names1T,
class Names2T>
395 Names1T &names1, Names2T &names2)
399 int_t size = in. size ();
400 for (int_t i = 0; i < size; ++ i)
402 out. add (names1 (in. left (i)), names2 (in. right (i)),
410 template <
class CellDomT,
class CellImgT,
class NamesDomT,
class NamesImgT>
413 NamesDomT &names1, NamesImgT &names2)
416 typename NamesImgT::NameType> out;
417 int_t size = in. size ();
418 for (int_t i = 0; i < size; ++ i)
419 out. add (names1 (in [i]),
cells2names (in (i), names2));
425 template <
class CellDomT,
class CellImgT,
class CoefT,
426 class NamesDomT,
class NamesImgT>
427 inline tLinMap<
typename NamesDomT::NameType,
typename NamesImgT::NameType,
429 NamesDomT &names1, NamesImgT &names2)
431 tLinMap<
typename NamesDomT::NameType,
typename NamesImgT::NameType,
433 int_t size = in. size ();
434 for (int_t i = 0; i < size; ++ i)
435 out. add (names1 (in [i]),
cells2names (in (i), names2));
440 #endif // _CHAINCON_CELLNAMES_H_ CellT CellType
The type of a cell identifier.
std::string operator()(const CellT &c)
Returns the name of the given cell.
A linear map for coefficients in an arbitrary commutative ring.
int maxDim() const
Returns the smallest strict upper bound for the dimensions of named cells.
void swap(tCellOwnNames< CellT > &s)
Swaps the data with another object.
void setPrefix(const std::string &s)
Sets the prefix for cell names.
void setPrefix(const std::string &s)
Dummy setPrefix procedure.
void swap(tCellNames< CellT > &s)
Swaps the data with another object.
int maxDim() const
Returns the smallest strict upper bound for the dimensions of named cells.
A combinatorial chain, that is, a chain with Z_2 coefficients.
tCellNames()
The default constructor of an empty object.
A chain with coefficients in an arbitrary ring.
std::string NameType
The type of the name of a cell.
int nSets
The number of sets of encountered cells, indexed by their dimension.
std::string prefix
A prefix for cell names (use none for alphabetic names).
A class whose instances can be used to generate names of cells with subsequent numbers, in each dimension separately.
A combinatorial linear map (for coefficients in Z_2).
A tensor of chains with coefficients in an arbitrary commutative ring.
A class for providing the cells as their names.
tCellNames< CellT > & operator=(const tCellNames< CellT > &s)
The assignment operator.
Combinatorial tensor of cells.
A combinatorial tensor (for coefficients in Z_2).
tCellOwnNames()
The default constructor of an empty object.
Hashing keys for std::string.
void setPostfix(const std::string &s)
Sets the postfix for cell names.
NamesT::NameType cells2names(const CellT &in, NamesT &names)
Returns the name of a cell according to the given naming object.
std::string postfix
A postfix for cell names.
A chain with coefficients in an arbitrary commutative ring.
int maxCellDim1
The maximal dimension of the encountered cells plus 1.
bool operator==(const tCellNames< CellT > &s) const
The equality operator.
~tCellNames()
The destructor.
CellT operator()(const CellT &c)
Returns the name of the given cell.
void setPostfix(const std::string &s)
Dummy setPostfix procedure.
CellT NameType
The type of the name of a cell.
A combinatorial linear map.
chomp::homology::multitable< chomp::homology::hashedset< CellT > > cells
An array of sets of cells whose names have been requested.
CellT CellType
The type of a cell identifier.