The Original CHomP Software
Public Member Functions | Private Attributes | List of all members
chomp::homology::mvcellmap< cell, euclidom, element > Class Template Reference

This class represents a multivalued map whose domain is a geometric complex. More...

#include <gcomplex.h>

Public Member Functions

 mvcellmap (gcomplex< cell, euclidom > *_g=0)
 The constructor of a map with its domain. More...
 
 mvcellmap (gcomplex< cell, euclidom > &_g)
 The constructor of a map with its domain. More...
 
 mvcellmap (const mvcellmap< cell, euclidom, element > &m)
 The copy constructor. More...
 
mvcellmapoperator= (const mvcellmap< cell, euclidom, element > &m)
 The assignment operator. More...
 
 ~mvcellmap ()
 The destructor. More...
 
int dim () const
 Returns the dimension of the domain of the map. More...
 
const hashedset< cell > & get (int d) const
 Returns the given level of the geometric complex. More...
 
const gcomplex< cell, euclidom > & getdomain () const
 Returns a reference of the domain cell complex of the map. More...
 
const hashedset< element > & operator() (const cell &c) const
 Returns the image of a given cell. More...
 
void add (int d, const cell &c, const hashedset< element > &set)
 Adds a set to the image of a given cell, provided the dimension of the cell is known. More...
 
void add (const cell &c, const hashedset< element > &set)
 Adds a set to the image of a given cell. More...
 
void add (int d, int_t n, const hashedset< element > &set)
 Adds a set to the image of a given cell, provided the dimension and number of the cell is known. More...
 
void add (int d, const cell &c, const element &e)
 Adds an element to the image of a given cell, provided the dimension of the cell is known. More...
 
void add (const cell &c, const element &e)
 Adds an element to the image of a given cell. More...
 
void add (int d, int_t n, const element &e)
 Adds an element to the image of a given cell, provided the dimension and number of the cell is known. More...
 

Private Attributes

gcomplex< cell, euclidom > * g
 A pointer to the domain of the map. More...
 
multitable< hashedset< element > > * images
 The array of images of the elements of each dimension. More...
 
int dimension
 The dimension of the domain of the map. More...
 

Detailed Description

template<class cell, class euclidom, class element>
class chomp::homology::mvcellmap< cell, euclidom, element >

This class represents a multivalued map whose domain is a geometric complex.

Definition at line 1529 of file gcomplex.h.

Constructor & Destructor Documentation

◆ mvcellmap() [1/3]

template<class cell , class euclidom , class element >
chomp::homology::mvcellmap< cell, euclidom, element >::mvcellmap ( gcomplex< cell, euclidom > *  _g = 0)
inline

The constructor of a map with its domain.

The domain of the map must exist during the existence of the map and its dimension must not increase.

Definition at line 1601 of file gcomplex.h.

1603{
1604 g = _g;
1605 if (!g || (g -> dim () < 0))
1606 {
1607 images = NULL;
1608 dimension = -1;
1609 return;
1610 }
1611 dimension = g -> dim ();
1612 images = new multitable <hashedset<element> > [dimension + 1];
1613 if (!images)
1614 throw "Cannot create a multivalued cellular map.";
1615 return;
1616} /* mvcellmap<cell,euclidom,element>::mvcellmap */
int dim() const
Returns the dimension of the domain of the map.
Definition: gcomplex.h:1687
gcomplex< cell, euclidom > * g
A pointer to the domain of the map.
Definition: gcomplex.h:1588
int dimension
The dimension of the domain of the map.
Definition: gcomplex.h:1594
multitable< hashedset< element > > * images
The array of images of the elements of each dimension.
Definition: gcomplex.h:1591

◆ mvcellmap() [2/3]

template<class cell , class euclidom , class element >
chomp::homology::mvcellmap< cell, euclidom, element >::mvcellmap ( gcomplex< cell, euclidom > &  _g)
inline

The constructor of a map with its domain.

The domain of the map must exist during the existence of the map and its dimension must not increase.

Definition at line 1619 of file gcomplex.h.

1621{
1622 g = &_g;
1623 if (!g || (g -> dim () < 0))
1624 {
1625 images = NULL;
1626 dimension = -1;
1627 return;
1628 }
1629 dimension = g -> dim ();
1630 images = new multitable <hashedset<element> > [dimension + 1];
1631 if (!images)
1632 throw "Cannot create a multivalued cellular map.";
1633 return;
1634} /* mvcellmap<cell,euclidom,element>::mvcellmap */

◆ mvcellmap() [3/3]

template<class cell , class euclidom , class element >
chomp::homology::mvcellmap< cell, euclidom, element >::mvcellmap ( const mvcellmap< cell, euclidom, element > &  m)

The copy constructor.

Definition at line 1637 of file gcomplex.h.

1639{
1640 g = m. g;
1641 if (!g || (g -> dim () < 0))
1642 {
1643 images = NULL;
1644 dimension = -1;
1645 return;
1646 }
1647 dimension = g -> dim ();
1648 images = new multitable <hashedset<element> > [dimension + 1];
1649 if (!images)
1650 throw "Unable to construct a copy of a multivalued "
1651 "cellular map.";
1652 for (int i = 0; i < dimension + 1; ++ i)
1653 images [i] = m. images [i];
1654 return;
1655} /* mvcellmap<cell,euclidom,element>::mvcellmap */

◆ ~mvcellmap()

template<class cell , class euclidom , class element >
chomp::homology::mvcellmap< cell, euclidom, element >::~mvcellmap
inline

The destructor.

Definition at line 1679 of file gcomplex.h.

1680{
1681 if (images)
1682 delete [] images;
1683 return;
1684} /* mvcellmap<cell,euclidom,element>::~mvcellmap */

Member Function Documentation

◆ add() [1/6]

template<class cell , class euclidom , class element >
void chomp::homology::mvcellmap< cell, euclidom, element >::add ( const cell &  c,
const element &  e 
)
inline

Adds an element to the image of a given cell.

Definition at line 1765 of file gcomplex.h.

1767{
1768 add (c. dim (), c, e);
1769 return;
1770} /* mvcellmap<cell,euclidom,element>::add */
void add(int d, const cell &c, const hashedset< element > &set)
Adds a set to the image of a given cell, provided the dimension of the cell is known.
Definition: gcomplex.h:1721

◆ add() [2/6]

template<class cell , class euclidom , class element >
void chomp::homology::mvcellmap< cell, euclidom, element >::add ( const cell &  c,
const hashedset< element > &  set 
)
inline

Adds a set to the image of a given cell.

Definition at line 1734 of file gcomplex.h.

1736{
1737 add (c. dim (), c, set);
1738 return;
1739} /* mvcellmap<cell,euclidom,element>::add */

◆ add() [3/6]

template<class cell , class euclidom , class element >
void chomp::homology::mvcellmap< cell, euclidom, element >::add ( int  d,
const cell &  c,
const element &  e 
)
inline

Adds an element to the image of a given cell, provided the dimension of the cell is known.

Definition at line 1752 of file gcomplex.h.

1754{
1755 if ((d < 0) || (d > dimension))
1756 throw "Wrong dimension for adding a cell to a map.";
1757 if (!g -> check (c))
1758 // throw "The cell does not belong to the domain of the map.";
1759 g -> add (c);
1760 images [d] [(*g) [d]. getnumber (c)]. add (e);
1761 return;
1762} /* mvcellmap<cell,euclidom,element>::add */

◆ add() [4/6]

template<class cell , class euclidom , class element >
void chomp::homology::mvcellmap< cell, euclidom, element >::add ( int  d,
const cell &  c,
const hashedset< element > &  set 
)
inline

Adds a set to the image of a given cell, provided the dimension of the cell is known.

Definition at line 1721 of file gcomplex.h.

1723{
1724 if ((d < 0) || (d > dimension))
1725 throw "Wrong dimension for adding a cell to a map.";
1726 if (!g -> check (c))
1727 // throw "The cell does not belong to the domain of the map.";
1728 g -> add (c);
1729 images [d] [(*g) [d]. getnumber (c)]. add (set);
1730 return;
1731} /* mvcellmap<cell,euclidom,element>::add */

◆ add() [5/6]

template<class cell , class euclidom , class element >
void chomp::homology::mvcellmap< cell, euclidom, element >::add ( int  d,
int_t  n,
const element &  e 
)
inline

Adds an element to the image of a given cell, provided the dimension and number of the cell is known.

Definition at line 1773 of file gcomplex.h.

1775{
1776 if ((d < 0) || (d > dimension))
1777 throw "Wrong dimension for adding an element to the image.";
1778 images [d] [n]. add (set);
1779 return;
1780} /* mvcellmap<cell,euclidom,element>::add */

◆ add() [6/6]

template<class cell , class euclidom , class element >
void chomp::homology::mvcellmap< cell, euclidom, element >::add ( int  d,
int_t  n,
const hashedset< element > &  set 
)
inline

Adds a set to the image of a given cell, provided the dimension and number of the cell is known.

Definition at line 1742 of file gcomplex.h.

1744{
1745 if ((d < 0) || (d > dimension))
1746 throw "Wrong dimension for adding an element to the image.";
1747 images [d] [n]. add (set);
1748 return;
1749} /* mvcellmap<cell,euclidom,element>::add */

◆ dim()

template<class cell , class euclidom , class element >
int chomp::homology::mvcellmap< cell, euclidom, element >::dim

Returns the dimension of the domain of the map.

Definition at line 1687 of file gcomplex.h.

1688{
1689 return dimension;
1690} /* mvcellmap<cell,euclidom,element>::dim */

◆ get()

template<class cell , class euclidom , class element >
const hashedset< cell > & chomp::homology::mvcellmap< cell, euclidom, element >::get ( int  d) const

Returns the given level of the geometric complex.

Definition at line 1693 of file gcomplex.h.

1694{
1695 if ((d < 0) || (d > dimension))
1696 throw "Wrong dimension to retrieve from mvcellmap.";
1697 return (*g) [d];
1698} /* mvcellmap<cell,euclidom,element>::get */

◆ getdomain()

template<class cell , class euclidom , class element >
const gcomplex< cell, euclidom > & chomp::homology::mvcellmap< cell, euclidom, element >::getdomain

Returns a reference of the domain cell complex of the map.

Definition at line 1701 of file gcomplex.h.

1703{
1704 return *g;
1705} /* mvcellmap<cell,euclidom,element>::getdomain */

◆ operator()()

template<class cell , class euclidom , class element >
const hashedset< element > & chomp::homology::mvcellmap< cell, euclidom, element >::operator() ( const cell &  c) const

Returns the image of a given cell.

Definition at line 1708 of file gcomplex.h.

1710{
1711 int d = c. dim ();
1712 if (d > dimension)
1713 throw "Trying to get the image of a cell of dim too high.";
1714 int_t n = (*g) [d]. getnumber (c);
1715 if (n < 0)
1716 throw "Trying to get the image of a cell not in the domain.";
1717 return images [d] [n];
1718} /* mvcellmap<cell,euclidom,element>::operator () */
int int_t
Index type for indexing arrays, counting cubes, etc.
Definition: config.h:115

◆ operator=()

template<class cell , class euclidom , class element >
mvcellmap< cell, euclidom, element > & chomp::homology::mvcellmap< cell, euclidom, element >::operator= ( const mvcellmap< cell, euclidom, element > &  m)

The assignment operator.

Definition at line 1658 of file gcomplex.h.

1660{
1661 if (images)
1662 delete [] images;
1663 g = m. g;
1664 dimension = m. dimension;
1665 if (!g || (dimension < 0))
1666 {
1667 images = NULL;
1668 return *this;
1669 }
1670 images = new multitable <hashedset<element> > [dimension + 1];
1671 if (!images)
1672 throw "Cannot copy a multivalued cellular map.";
1673 for (int i = 0; i < dimension + 1; ++ i)
1674 images [i] = m. images [i];
1675 return *this;
1676} /* mvcellmap<cell,euclidom,element>::operator = */

Member Data Documentation

◆ dimension

template<class cell , class euclidom , class element >
int chomp::homology::mvcellmap< cell, euclidom, element >::dimension
private

The dimension of the domain of the map.

Definition at line 1594 of file gcomplex.h.

◆ g

template<class cell , class euclidom , class element >
gcomplex<cell,euclidom>* chomp::homology::mvcellmap< cell, euclidom, element >::g
private

A pointer to the domain of the map.

Definition at line 1588 of file gcomplex.h.

◆ images

template<class cell , class euclidom , class element >
multitable<hashedset<element> >* chomp::homology::mvcellmap< cell, euclidom, element >::images
private

The array of images of the elements of each dimension.

Definition at line 1591 of file gcomplex.h.


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