The ChainCon Software (Release 0.03)
Public Types | Public Member Functions | Private Attributes | List of all members
tSimplex< VertexT, EmptyT > Class Template Reference

A simplex with vertices of arbitrary type. More...

#include <simplex.h>

Public Types

typedef VertexT VertexType
 The type of the vertex. More...
 
typedef EmptyT EmptyType
 The type of the empty cell existence decision class. More...
 

Public Member Functions

 tSimplex ()
 The default constructor of an empty simplex. More...
 
template<class VertexArray >
 tSimplex (int dimension, const VertexArray &vertices)
 The constructor of a simplex from an array of vertices. More...
 
 tSimplex (const tSimplex< VertexT, EmptyT > &s)
 The copy constructor. More...
 
 tSimplex (const tSimplex< VertexT, EmptyT > &s, int n)
 The constructor of the n-th face of a simplex (if n >= 0) or the k-th degeneracy operator (if n = -1 - k < 0). More...
 
tSimplex< VertexT, EmptyT > & operator= (const tSimplex< VertexT, EmptyT > &s)
 The assignment operator. More...
 
 ~tSimplex ()
 The destructor. More...
 
int dim () const
 Returns the dimension of the simplex. More...
 
const VertexT & operator[] (int n) const
 Returns the n-th vertex of the simplex. More...
 
int boundaryLength () const
 Returns the length of the boundary of the simplex. More...
 
int boundaryCoef (int n) const
 Returns the n-th coefficient in the boundary of the simplex. More...
 
int degenerate () const
 Checks if the simplex is degenerate, that is, if it has two identical vertices one after another. More...
 
bool operator== (const tSimplex< VertexT, EmptyT > &s) const
 The equality operator. More...
 
void swap (tSimplex< VertexT, EmptyT > &s)
 Swaps the data between two simplices. More...
 

Private Attributes

int dimension
 The dimension of the simplex. More...
 
VertexT * vertices
 An array of vertices of the simplex. More...
 

Detailed Description

template<class VertexT, class EmptyT>
class tSimplex< VertexT, EmptyT >

A simplex with vertices of arbitrary type.

Note that the vertex type must have hash key functions (defined in chomp/struct/hashsets.h for most built-in integers, defined in chaincon/stringhash.h for std::string, or your own). The empty cell existence decision class must provide a static function "exists" that returns true if the empty cell must be taken into consideration or false otherwise. Important: The vertices are assumed to be given in the ascending order; otherwise the operator == may give false negatives!

Definition at line 59 of file simplex.h.

Member Typedef Documentation

◆ EmptyType

template<class VertexT, class EmptyT>
typedef EmptyT tSimplex< VertexT, EmptyT >::EmptyType

The type of the empty cell existence decision class.

Definition at line 66 of file simplex.h.

◆ VertexType

template<class VertexT, class EmptyT>
typedef VertexT tSimplex< VertexT, EmptyT >::VertexType

The type of the vertex.

Definition at line 63 of file simplex.h.

Constructor & Destructor Documentation

◆ tSimplex() [1/4]

template<class VertexT , class EmptyT >
tSimplex< VertexT, EmptyT >::tSimplex ( )
inline

The default constructor of an empty simplex.

Definition at line 127 of file simplex.h.

◆ tSimplex() [2/4]

template<class VertexT , class EmptyT >
template<class VertexArray >
tSimplex< VertexT, EmptyT >::tSimplex ( int  dimension,
const VertexArray &  vertices 
)
inline

The constructor of a simplex from an array of vertices.

Definition at line 135 of file simplex.h.

References tSimplex< VertexT, EmptyT >::dimension.

◆ tSimplex() [3/4]

template<class VertexT , class EmptyT >
tSimplex< VertexT, EmptyT >::tSimplex ( const tSimplex< VertexT, EmptyT > &  s)
inline

The copy constructor.

Definition at line 156 of file simplex.h.

References tSimplex< VertexT, EmptyT >::dimension, and tSimplex< VertexT, EmptyT >::vertices.

◆ tSimplex() [4/4]

template<class VertexT , class EmptyT >
tSimplex< VertexT, EmptyT >::tSimplex ( const tSimplex< VertexT, EmptyT > &  s,
int  n 
)
inline

The constructor of the n-th face of a simplex (if n >= 0) or the k-th degeneracy operator (if n = -1 - k < 0).

Definition at line 166 of file simplex.h.

References tSimplex< VertexT, EmptyT >::dimension, and tSimplex< VertexT, EmptyT >::vertices.

◆ ~tSimplex()

template<class VertexT , class EmptyT >
tSimplex< VertexT, EmptyT >::~tSimplex ( )
inline

The destructor.

Definition at line 208 of file simplex.h.

References tSimplex< VertexT, EmptyT >::vertices.

Member Function Documentation

◆ boundaryCoef()

template<class VertexT , class EmptyT >
int tSimplex< VertexT, EmptyT >::boundaryCoef ( int  n) const
inline

Returns the n-th coefficient in the boundary of the simplex.

Definition at line 237 of file simplex.h.

◆ boundaryLength()

template<class VertexT , class EmptyT >
int tSimplex< VertexT, EmptyT >::boundaryLength ( ) const
inline

Returns the length of the boundary of the simplex.

Definition at line 228 of file simplex.h.

References tSimplex< VertexT, EmptyT >::dimension.

◆ degenerate()

template<class VertexT , class EmptyT >
int tSimplex< VertexT, EmptyT >::degenerate ( ) const
inline

Checks if the simplex is degenerate, that is, if it has two identical vertices one after another.

If this is the case then returns the position of the second vertex. Returns 0 if the simplex is not degenerate.

Definition at line 243 of file simplex.h.

References tSimplex< VertexT, EmptyT >::dimension, and tSimplex< VertexT, EmptyT >::vertices.

◆ dim()

template<class VertexT , class EmptyT >
int tSimplex< VertexT, EmptyT >::dim ( ) const
inline

Returns the dimension of the simplex.

Definition at line 216 of file simplex.h.

References tSimplex< VertexT, EmptyT >::dimension.

Referenced by hashkey1(), hashkey2(), and operator<<().

◆ operator=()

template<class VertexT , class EmptyT >
tSimplex< VertexT, EmptyT > & tSimplex< VertexT, EmptyT >::operator= ( const tSimplex< VertexT, EmptyT > &  s)
inline

The assignment operator.

Definition at line 192 of file simplex.h.

References tSimplex< VertexT, EmptyT >::dimension, and tSimplex< VertexT, EmptyT >::vertices.

◆ operator==()

template<class VertexT , class EmptyT >
bool tSimplex< VertexT, EmptyT >::operator== ( const tSimplex< VertexT, EmptyT > &  s) const
inline

The equality operator.

Verifies if the vertices are the same and in the same order. Note that this may result in false negatives if the vertices are stored in various orders.

Definition at line 255 of file simplex.h.

References tSimplex< VertexT, EmptyT >::dimension, and tSimplex< VertexT, EmptyT >::vertices.

◆ operator[]()

template<class VertexT , class EmptyT >
const VertexT & tSimplex< VertexT, EmptyT >::operator[] ( int  n) const
inline

Returns the n-th vertex of the simplex.

Definition at line 222 of file simplex.h.

References tSimplex< VertexT, EmptyT >::vertices.

◆ swap()

template<class VertexT , class EmptyT >
void tSimplex< VertexT, EmptyT >::swap ( tSimplex< VertexT, EmptyT > &  s)
inline

Swaps the data between two simplices.

Definition at line 268 of file simplex.h.

References tSimplex< VertexT, EmptyT >::dimension, and tSimplex< VertexT, EmptyT >::vertices.

Member Data Documentation

◆ dimension

template<class VertexT, class EmptyT>
int tSimplex< VertexT, EmptyT >::dimension
private

◆ vertices

template<class VertexT, class EmptyT>
VertexT* tSimplex< VertexT, EmptyT >::vertices
private

The documentation for this class was generated from the following file: