36#ifndef _CHOMP_SIMPLICES_SIMPLEX_H_
37#define _CHOMP_SIMPLICES_SIMPLEX_H_
116 static const char *
name ();
168 for (
int i = 0; i <= d; ++ i)
169 table [i] =
tab [i + 1];
176 throw "Negative dimension of a simplex.";
177 tab =
new int [d + 2];
179 throw "Not enough memory for a simplex.";
181 for (
int i = 0; i <= d; ++ i)
188 int d = s.
dim () - 1;
190 throw "Undefined boundary simplex.";
191 tab =
new int [d + 2];
193 throw "Not enough memory for a boundary simplex.";
196 for (i = 1; i <= n; ++ i)
198 for (i = n + 1; i < d + 2; ++ i)
210 tab =
new int [d + 2];
212 throw "Not enough memory to copy a simplex.";
213 for (
int i = 0; i < d + 2; ++ i)
228 else if (d ==
dim ())
230 for (
int i = 0; i < d + 2; ++ i)
237 tab =
new int [d + 2];
239 throw "Not enough memory to assign a simplex.";
240 for (
int i = 0; i < d + 2; ++ i)
252 return static_cast<int_t> (
tab [1]) << 2;
255 return ((
static_cast<int_t> (
tab [1])
256 ^ 0x55555555u) << 16) ^
258 ^ 0xAAAA00AAu) << 4);
262 return ((
static_cast<int_t> (
tab [1]) ^
263 0x55555555u) << 16) ^
282 return static_cast<int_t> (
tab [1]) << 2;
285 return ((
static_cast<int_t> (
tab [1]) ^
292 return ((
static_cast<int_t> (
tab [d + 1]) ^
293 0x55555555u) << 13) ^
296 ((
static_cast<int_t> (
tab [d - 1]) ^
316 for (
int i = 1; i < sd + 2; ++ i)
317 if (s. tab [i] != t. tab [i])
334 return (d ? (d + 1) : 0);
368 for (
int i = 2; i < d + 2; ++ i)
369 out <<
',' << s. tab [i];
383 throw "Cannot read a simplex: No opening parenthesis.";
392 while (in && (in. peek () != closing))
397 throw "Unable to read a vertex of a simplex.";
401 if (in. peek () ==
',')
409 throw "Too many vertices of a simplex.";
414 throw "A repeated vertex in a simplex detected.";
This class defines a simplex as a geometric cell that can be used as a member of a geometric complex.
static const int MaxDim
The maximal dimension of a simplex.
Simplex()
The default constructor of the empty simplex.
static const char * name()
The singular name of the objects represented by this class.
int * tab
The array that keeps the vertices of the simplex.
friend std::ostream & operator<<(std::ostream &out, const Simplex &s)
Writes a simplex to the output stream in the text format.
int dim() const
Returns the dimension of the simplex.
Simplex & operator=(const Simplex &s)
The assignment operator.
friend int operator==(const Simplex &s, const Simplex &t)
The operator == that compares whether the two simplices are the same, that is, have the same vertices...
int_t hashkey2() const
The second hashing key required by the hashing set template.
static const char * pluralname()
The plural name of the objects represented by this class.
~Simplex()
The destructor.
int_t hashkey1() const
The first hashing key required by the hashing set template.
void vertices(int *table) const
Retrieves the vertices of the simplex to the given array.
The class that defines a geometric complex - a set of cells (cubes, simplices, etc).
This is a template for a set of objects of the given type.
This file contains some precompiler definitions which indicate the operating system and/or compiler u...
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 defines a class "integer" which represents the ring of integers or the field of integers mo...
hashedset< simplex > SetOfSimplices
A class for representing a set of simplices.
hashedset< simplex > simplices
An alternative name for a set of simplices [deprecated].
int closingparenthesis(int ch)
Returns the matching closing parenthesis for the given opening one or EOF if none.
gcomplex< simplex, integer > simplicialcomplex
A lower-case name for a simplicial complex [deprecated].
std::ostream & operator<<(std::ostream &out, const bincube< Dim, twoPower > &b)
int_t hashkey2(const hashNumber< Number > &n)
The second hashing key.
int boundarylength(const tCellBase< coordtype > &q)
Returns the length of the boundary of a cell.
tCellBase< coordtype > boundarycell(const tCellBase< coordtype > &q, int i, bool onlyexisting)
Computes the i-th boundary element of a cell.
Simplex simplex
A lower-case name for a simplex [deprecated].
bool operator!=(const typename bincube< Dim, twoPower >::neighborhood_iterator &x1, const typename bincube< Dim, twoPower >::neighborhood_iterator &x2)
std::istream & operator>>(std::istream &in, bincube< Dim, twoPower > &b)
int_t hashkey1(const hashNumber< Number > &n)
The first hashing key.
bool operator==(const typename bincube< Dim, twoPower >::neighborhood_iterator &x1, const typename bincube< Dim, twoPower >::neighborhood_iterator &x2)
void ignorecomments(std::istream &in)
Ignores white characters (spaces, tabulators, CRs and LFs), as well as comments from the input text f...
gcomplex< simplex, integer > SimplicialComplex
A class for representing a simplicial complex.
int sortelements(type *tab, int n)
A simple template that sorts an array using the bubble sort method, removes repeated elements and ret...
int boundarycoef(const tCellBase< coordtype > &q, int i)
Returns the i-th coefficient in the boundary of a cell.
This namespace contains the entire CHomP library interface.
This file contains some useful functions related to the text input/output procedures.