31 #if defined(CubicalComplex_RECURSES)
32 #error Recursive header files inclusion detected in CubicalComplex.h
35 #define CubicalComplex_RECURSES
37 #if !defined CubicalComplex_h
39 #define CubicalComplex_h
47 #include <boost/type_traits.hpp>
48 #include <boost/iterator/iterator_facade.hpp>
49 #include "DGtal/base/Common.h"
50 #include "DGtal/base/ConstAlias.h"
51 #include "DGtal/base/Alias.h"
52 #include "DGtal/base/ContainerTraits.h"
53 #include "DGtal/base/CSTLAssociativeContainer.h"
54 #include "DGtal/topology/CCellularGridSpaceND.h"
83 template <
typename TKSpace,
typename TCellContainer >
86 template <
typename TKSpace,
typename TCellContainer >
90 template <
typename TKSpace,
typename TCellContainer >
94 template <
typename TKSpace,
typename TCellContainer >
98 template <
typename TKSpace,
typename TCellContainer >
102 template <
typename TKSpace,
typename TCellContainer >
106 template <
typename TKSpace,
typename TCellContainer >
110 template <
typename TKSpace,
typename TCellContainer >
114 template <
typename TKSpace,
typename TCellContainer >
119 template <
typename TKSpace,
typename TCellContainer >
122 template <
typename TKSpace,
typename TCellContainer >
126 template <
typename TKSpace,
typename TCellContainer >
130 template <
typename TKSpace,
typename TCellContainer >
134 template <
typename TKSpace,
typename TCellContainer >
138 template <
typename TKSpace,
typename TCellContainer >
173 template <
typename TKSpace,
174 typename TCellContainer =
typename TKSpace::template CellMap< CubicalCellData >::Type >
190 template <
typename K,
typename C >
193 template <
typename K,
typename C >
196 template <
typename K,
typename C >
199 template <
typename K,
typename C >
202 template <
typename K,
typename C >
205 template <
typename K,
typename C >
208 template <
typename K,
typename C >
211 template <
typename K,
typename C >
214 template <
typename K,
typename C >
217 template <
typename K,
typename C >
220 template <
typename K,
typename C >
223 template <
typename K,
typename C >
226 template <
typename K,
typename C >
229 template <
typename K,
typename C >
235 typedef typename CellContainer::mapped_type
Data;
238 BOOST_STATIC_ASSERT (( boost::is_same< typename TKSpace::Cell, typename CellContainer::key_type >::value ));
295 uint32_t v1 = it1->second.data & VALUE;
296 uint32_t v2 = it2->second.data & VALUE;
298 || ( ( v1 == v2 ) && ( it1->first < it2->first ) );
307 :
public boost::iterator_facade< ConstIterator, Cell const,
308 std::forward_iterator_tag >
313 std::forward_iterator_tag >
Base;
315 typedef typename Base::value_type
Value;
412 :
public boost::iterator_facade< Iterator, Cell const,
413 std::forward_iterator_tag >
418 std::forward_iterator_tag >
Base;
420 typedef typename Base::value_type
Value;
561 template <
typename TDigitalSet >
764 template <
class InputIterator>
765 void insert( InputIterator first, InputIterator last );
825 template <
typename CellConstIterator>
839 template <
typename CellConstIterator>
903 template <
typename CellConstIterator>
916 template <
typename CellConstIterator>
933 template <
typename CellOutputIterator>
934 void faces( CellOutputIterator& outIt,
const Cell& aCell,
935 bool hintClosed =
false )
const;
953 template <
typename CellOutputIterator>
955 bool hintClosed =
false )
const;
970 template <
typename CellMapIteratorOutputIterator>
988 template <
typename CellOutputIterator>
990 bool hintOpen =
false )
const;
1008 template <
typename CellOutputIterator>
1010 bool hintOpen =
false )
const;
1025 template <
typename CellMapIteratorOutputIterator>
1202 bool hintClosed =
false )
const;
1322 template <
typename TKSpace,
1323 typename TCellContainer >
1337 template <
typename TKSpace,
typename TCellContainer>
1347 #include "DGtal/topology/CubicalComplex.ih"
1354 #undef CubicalComplex_RECURSES
Aim: This class encapsulates its parameter class so that to indicate to the user that the object/poin...
Aim: This class encapsulates its parameter class so that to indicate to the user that the object/poin...
Aim: This class represents an arbitrary cubical complex living in some Khalimsky space....
CellMapConstIterator findCell(const Cell &aCell) const
Cell const * const_pointer
CellMap & getCells(const Dimension d)
ConstIterator find(const Cell &aCell) const
KSpace::Integer Integer
Type for integers in the space.
Iterator insert(Iterator position, const Cell &aCell)
Cell::PreCell PreCell
Type for a precell in the space.
CubicalComplex closure(const CubicalComplex &S, bool hintClosed=false) const
CellMapIterator findCell(const Cell &aCell)
bool isCellBoundary(const Cell &aCell) const
Cells cellCoBoundary(const Cell &aCell, bool hintOpen=false) const
TCellContainer CellContainer
Type for storing cells, an associative container Cell -> Data.
void directCoFaces(CellOutputIterator &outIt, const Cell &aCell, bool hintOpen=false) const
bool isCellInterior(const Cell &aCell) const
BOOST_STATIC_CONSTANT(uint32_t, COLLAPSIBLE=0x20000000)
Flag Used to indicate in a cell data that this cell is collapsible.
ConstIterator end() const
void construct(const TDigitalSet &set)
BOOST_STATIC_ASSERT((boost::is_same< typename TKSpace::Cell, typename CellContainer::key_type >::value))
CubicalComplex & operator=(const CubicalComplex &other)
TKSpace KSpace
Type of the cellular grid space.
Size eraseCell(const Cell &aCell)
BOOST_STATIC_CONSTANT(uint32_t, VALUE=0x0fffffff)
Value for a cell.
Size eraseCells(Dimension d, CellConstIterator it, CellConstIterator itE)
BOOST_CONCEPT_ASSERT((concepts::CCellularGridSpaceND< TKSpace >))
const KSpace & space() const
bool belongs(Dimension d, const PreCell &aCell) const
KSpace::Space Space
Type of the digital space.
CellType computeCellType(const Cell &c, CellMapIterator &it_cell_up, Dimension n=dimension)
const KSpace * myKSpace
The Khalimsky space in which lives the cubical complex.
CellContainer::size_type size_type
KSpace::Cell Cell
Type for a cell in the space.
CellMapIterator begin(Dimension d)
std::string className() const
std::pair< Iterator, Iterator > equal_range(const Cell &aCell)
void getInteriorAndBoundary(CubicalComplex &intcc, CubicalComplex &bdcc, bool hintClosed=false) const
void insertCell(Dimension d, const Cell &aCell, const Data &data=Data())
void insertCells(CellConstIterator it, CellConstIterator itE, const Data &data=Data())
CubicalComplex< TKSpace, TCellContainer > Self
Cell const & const_reference
BOOST_CONCEPT_ASSERT((concepts::CSTLAssociativeContainer< TCellContainer >))
Cells cellBoundary(const Cell &aCell, bool hintClosed=false) const
BOOST_STATIC_ASSERT(IsPairAssociativeContainer< TCellContainer >::value)
CellMapConstIterator begin(Dimension d) const
ConstIterator const_iterator
BOOST_STATIC_CONSTANT(uint32_t, REMOVED=0x10000000)
Flag Used to indicate in a cell data that this cell has been (virtually) removed.
bool belongs(const PreCell &aCell) const
void eraseCells(CellMapIterator it, CellMapIterator itE)
CellMapConstIterator end(Dimension d) const
KSpace::Size Size
Type for a number of elements.
CubicalComplex boundary(bool hintClosed=false) const
CubicalComplex link(const CubicalComplex &S, bool hintClosed=false, bool hintOpen=false) const
CubicalComplex star(const CubicalComplex &S, bool hintOpen=false) const
void directFacesIterators(CellMapIteratorOutputIterator &outIt, const Cell &aCell)
std::vector< CellMap > myCells
KSpace::Point Point
Type for a point in the digital space.
BOOST_STATIC_ASSERT((boost::is_base_of< CubicalCellData, Data >::value))
void erase(Iterator position)
Size erase(const Cell &aCell)
CellMapIterator end(Dimension d)
void swap(CubicalComplex &other)
void directFaces(CellOutputIterator &outIt, const Cell &aCell, bool hintClosed=false) const
void coFaces(CellOutputIterator &outIt, const Cell &aCell, bool hintOpen=false) const
Size nbCells(Dimension d) const
CubicalComplex interior() const
Size count(const Cell &aCell) const
CellContainer::difference_type difference_type
void insertCells(Dimension d, CellConstIterator it, CellConstIterator itE, const Data &data=Data())
void insert(InputIterator first, InputIterator last)
KSpace::Cells Cells
Type for a sequence of cells in the space.
bool operator()(const Cell &aCell) const
KSpace::DirIterator DirIterator
Type for iterating over cell directions.
Size eraseCells(CellConstIterator it, CellConstIterator itE)
BOOST_STATIC_CONSTANT(uint32_t, FIXED=0x40000000)
Flag Used to indicate in a cell data that this cell is fixed.
bool belongs(const Cell &aCell) const
CellMapConstIterator findCell(Dimension d, const Cell &aCell) const
Dimension dim(const Cell &aCell) const
void selfDisplay(std::ostream &out) const
void insertCell(const Cell &aCell, const Data &data=Data())
CellMap::iterator CellMapIterator
Iterator for visiting type CellMap.
void erase(Iterator first, Iterator last)
void fillData(Data data=Data())
Data & operator[](const Cell &aCell)
const CellMap & getCells(const Dimension d) const
void eraseCell(CellMapIterator it)
static const Dimension dimension
The dimension of the embedding space.
void fillData(Dimension d, Data data=Data())
CellContainer::mapped_type Data
Type of data associated to each cell.
CellType
Possible cell types within a complex.
ConstIterator begin() const
CubicalComplex(ConstAlias< KSpace > aK)
CellContainer CellMap
Type for storing cells, an associative container Cell -> Data.
void directCoFacesIterators(CellMapIteratorOutputIterator &outIt, const Cell &aCell)
std::pair< Iterator, bool > insert(const Cell &aCell)
std::pair< ConstIterator, ConstIterator > equal_range(const Cell &aCell) const
CellMap::const_iterator CellMapConstIterator
Const iterator for visiting type CellMap.
CubicalComplex(const CubicalComplex &other)
BOOST_STATIC_CONSTANT(uint32_t, USER1=0x80000000)
User flag for a cell.
Size eraseCell(Dimension d, const Cell &aCell)
CellMapIterator findCell(Dimension d, const Cell &aCell)
bool belongs(Dimension d, const Cell &aCell) const
Iterator find(const Cell &aCell)
void faces(CellOutputIterator &outIt, const Cell &aCell, bool hintClosed=false) const
TInteger Integer
Arithmetic ring induced by (+,-,*) and Integer numbers.
NumberTraits< Integer >::UnsignedVersion Size
Type used to represent sizes in the digital space.
typename PreCellularGridSpace::DirIterator DirIterator
AnyCellCollection< Cell > Cells
DGtal is the top-level namespace which contains all DGtal functions and types.
bool operator>=(PointVector< ptDim, LeftEuclideanRing, LeftContainer > const &lhs, PointVector< ptDim, RightEuclideanRing, RightContainer > const &rhs)
Comparison operator on Points/Vectors (GreaterOrEqualThan).
CubicalComplex< TKSpace, TCellContainer > & operator^=(CubicalComplex< TKSpace, TCellContainer > &, const CubicalComplex< TKSpace, TCellContainer > &)
bool operator==(PointVector< ptDim, LeftEuclideanRing, LeftContainer > const &lhs, PointVector< ptDim, RightEuclideanRing, RightContainer > const &rhs)
Equality operator between two Points/Vectors.
boost::uint32_t uint32_t
unsigned 32-bit integer.
CubicalComplex< TKSpace, TCellContainer > & operator&=(CubicalComplex< TKSpace, TCellContainer > &, const CubicalComplex< TKSpace, TCellContainer > &)
bool operator!=(PointVector< ptDim, LeftEuclideanRing, LeftContainer > const &lhs, PointVector< ptDim, RightEuclideanRing, RightContainer > const &rhs)
Difference operator on Points/Vectors.
std::ostream & operator<<(std::ostream &out, const ATu0v1< TKSpace, TLinearAlgebra > &object)
CubicalComplex< TKSpace, TCellContainer > operator~(const CubicalComplex< TKSpace, TCellContainer > &)
bool operator<=(PointVector< ptDim, LeftEuclideanRing, LeftContainer > const &lhs, PointVector< ptDim, RightEuclideanRing, RightContainer > const &rhs)
Comparison operator on Points/Vectors (LesserOrEqualThan).
DGtal::uint32_t Dimension
CubicalComplex< TKSpace, TCellContainer > operator^(const CubicalComplex< TKSpace, TCellContainer > &, const CubicalComplex< TKSpace, TCellContainer > &)
KForm< Calculus, order, duality > operator*(const typename Calculus::Scalar &scalar, const KForm< Calculus, order, duality > &form)
CubicalComplex< TKSpace, TCellContainer > & operator|=(CubicalComplex< TKSpace, TCellContainer > &, const CubicalComplex< TKSpace, TCellContainer > &)
KForm< Calculus, order, duality > operator-(const KForm< Calculus, order, duality > &form_a, const KForm< Calculus, order, duality > &form_b)
CubicalComplex< TKSpace, TCellContainer > operator&(const CubicalComplex< TKSpace, TCellContainer > &, const CubicalComplex< TKSpace, TCellContainer > &)
CubicalComplex< TKSpace, TCellContainer > operator|(const CubicalComplex< TKSpace, TCellContainer > &, const CubicalComplex< TKSpace, TCellContainer > &)
CubicalComplex< TKSpace, TCellContainer > & operator-=(CubicalComplex< TKSpace, TCellContainer > &, const CubicalComplex< TKSpace, TCellContainer > &)
SequenceCategory Category
Defines default container traits for arbitrary types.
CubicalCellData(uint32_t d)
CellMapConstIterator myIt
boost::iterator_facade< ConstIterator, Cell const, std::forward_iterator_tag > Base
Base::reference Reference
CellMapConstIterator myItEnd
const CubicalComplex * myCC
Dimension dimension() const
friend class boost::iterator_core_access
ConstIterator()
Default iterator. Invalid.
Cell const & dereference() const
Base::difference_type DifferenceType
bool equal(const ConstIterator &other) const
ConstIterator(ConstAlias< CubicalComplex > cc, Dimension d, CellMapConstIterator it)
ConstIterator(ConstAlias< CubicalComplex > cc, Dimension d)
bool operator()(const CellMapIterator &it1, const CellMapIterator &it2) const
Cell const & dereference() const
Iterator(Alias< CubicalComplex > cc, Dimension d, CellMapIterator it)
bool equal(const Iterator &other) const
boost::iterator_facade< Iterator, Cell const, std::forward_iterator_tag > Base
Iterator(Alias< CubicalComplex > cc, Dimension d)
Iterator()
Default iterator. Invalid.
Base::reference Reference
friend class boost::iterator_core_access
Base::difference_type DifferenceType
Dimension dimension() const
Aim: This concept describes a cellular grid space in nD. In these spaces obtained by cartesian produc...
Aim: Defines the concept describing an Associative Container of the STL (https://www....