28 #ifndef _CHAINCON_SIMPLSET_H_ 29 #define _CHAINCON_SIMPLSET_H_ 39 #include "chomp/system/config.h" 50 template <
class CellT>
85 int_t
add (
const CellT &c);
92 bool check (
const CellT &c)
const;
137 chomp::homology::hashedset<CellT>
cells;
150 template <
class CellT>
157 template <
class CellT>
164 template <
class CellT>
172 chomp::homology::sbug <<
"WARNING: Assigning a simplicial " 173 "set to one with " <<
refCount <<
" references.\n";
181 template <
class CellT>
186 chomp::homology::sbug <<
"WARNING: A simplicial set " 187 "with " <<
refCount <<
" references deleted.\n";
192 template <
class CellT>
193 inline bool tSimplSet<CellT>::operator ==
199 template <
class CellT>
205 chomp::homology::sbug <<
"WARNING: Swapping " 206 "simplicial sets with " <<
refCount <<
" + " <<
215 template <
class CellT>
221 template <
class CellT>
225 int degenerate = cell. degenerate ();
231 template <
class CellT>
234 return cells. getnumber (cell);
237 template <
class CellT>
240 return (
cells. getnumber (cell) >= 0);
243 template <
class CellT>
249 template <
class CellT>
255 template <
class CellT>
259 if ((n < 0) || (n >= size))
260 throw "Wrong number of a cell in a simplicial set.";
264 template <
class CellT>
268 for (int_t i = 0; i < prevSize; ++ i)
270 const CellT &cell (
cells [i]);
271 if (cell. dim () != dim)
274 for (
int j = 0; j <=
dim; ++ j)
280 template <
class CellT>
289 template <
class CellT>
293 for (int_t cur = 0; cur <
cells.
size (); ++ cur)
295 const CellT &cell (
cells [cur]);
297 if ((dim < minDim) || (dim >= maxDim))
299 for (
int j = 0; j <=
dim; ++ j)
305 template <
class CellT>
312 for (int_t cur = prevSize - 1; cur >= 0; -- cur)
314 if (
cells [cur]. degenerate ())
315 cells. removenum (cur);
320 template <
class CellT>
327 template <
class CellT>
333 chomp::homology::sbug <<
"WARNING: Negative number " 334 "of references (" <<
refCount <<
") to a " 335 "simplicial set encountered.\n";
343 template <
class CellT>
344 std::ostream &operator << (std::ostream &out, const tSimplSet<CellT> &s)
347 for (int_t i = 0; i <
size; ++ i)
349 out << s [i] <<
"\n";
355 template <
class CellT>
358 chomp::homology::ignorecomments (in);
363 chomp::homology::ignorecomments (in);
372 #endif // _CHAINCON_SIMPLSET_H_ chomp::homology::hashedset< CellT > cells
The set of all the cells in the complex.
int_t refCount
Reference counter.
int_t size() const
Returns the number of cells in the simplicial set.
tSimplSet< CellT > & operator=(const tSimplSet< CellT > &s)
The assignment operator.
int dim() const
Returns the dimension of the highest-dimensional non-degenerate cell in the simplicial set...
const CellT & operator[](int_t n) const
Returns the given cell in the simplicial set.
int_t addDegenerate(int minDim, int maxDim)
Adds degenerate cells for all cells whose dimension falls within the given range, including minDim...
CellT value_type
The type of elements in the filtered complex perceived as a standard-type aggregate.
bool operator==(const tSimplSet< CellT > &s) const
The equality operator.
int_t getNumber(const CellT &c) const
Finds a cell in the complex.
int_t addFaces()
Adds faces of all the cells in the set.
bool empty() const
Returns the information on whether the complex is empty or not.
int_t delRef()
Subtracts 1 from the reference counter.
void swap(tSimplSet< CellT > &s)
Swaps the data between two simplicial sets.
~tSimplSet()
The destructor.
int_t normalize()
Normalizes the set of cells, that is, removes degenerate cells.
int dimension
The highest dimension of a non-degenerate cell.
tSimplSet()
The default constructor of an empty set.
CellT CellType
The type of the vertex.
int_t add(const CellT &c)
Adds a cell to the complex.
std::istream & operator>>(std::istream &in, tSimplSet< CellT > &s)
Reads a simplicial set from an input stream using oeprator >> for cells.
int_t addRef()
Adds 1 to the reference counter.
bool check(const CellT &c) const
Checks if a cell is in the complex.