31 #if defined(CubicalComplex_RECURSES)
32 #error Recursive header files inclusion detected in CubicalComplex.h
33 #else // defined(CubicalComplex_RECURSES)
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;
560 template <
typename TDigitalSet >
763 template <
class InputIterator>
764 void insert( InputIterator first, InputIterator last );
824 template <
typename CellConstIterator>
838 template <
typename CellConstIterator>
893 template <
typename CellConstIterator>
906 template <
typename CellConstIterator>
923 template <
typename CellOutputIterator>
924 void faces( CellOutputIterator& outIt,
const Cell& aCell,
925 bool hintClosed =
false )
const;
943 template <
typename CellOutputIterator>
945 bool hintClosed =
false )
const;
960 template <
typename CellMapIteratorOutputIterator>
978 template <
typename CellOutputIterator>
980 bool hintOpen =
false )
const;
998 template <
typename CellOutputIterator>
1000 bool hintOpen =
false )
const;
1015 template <
typename CellMapIteratorOutputIterator>
1192 bool hintClosed =
false )
const;
1312 template <
typename TKSpace,
1313 typename TCellContainer >
1327 template <
typename TKSpace,
typename TCellContainer>
1337 #include "DGtal/topology/CubicalComplex.ih"
1342 #endif // !defined CubicalComplex_h
1344 #undef CubicalComplex_RECURSES
1345 #endif // else defined(CubicalComplex_RECURSES)
BOOST_STATIC_ASSERT((boost::is_same< typename TKSpace::Cell, typename CellContainer::key_type >::value))
ConstIterator(ConstAlias< CubicalComplex > cc, Dimension d)
KSpace::Space Space
Type of the digital space.
CellMapConstIterator myIt
BOOST_STATIC_ASSERT(IsPairAssociativeContainer< TCellContainer >::value)
CellMapIterator end(Dimension d)
static constexpr const Dimension dimension
bool belongs(Dimension d, const PreCell &aCell) const
CellMap::iterator CellMapIterator
Iterator for visiting type CellMap.
bool belongs(const PreCell &aCell) const
KForm< Calculus, order, duality > operator-(const KForm< Calculus, order, duality > &form_a, const KForm< Calculus, order, duality > &form_b)
CellMapIterator findCell(Dimension d, const Cell &aCell)
Aim: This class encapsulates its parameter class so that to indicate to the user that the object/poin...
boost::uint32_t uint32_t
unsigned 32-bit integer.
void swap(CubicalComplex &other)
KSpace::Integer Integer
Type for integers in the space.
std::pair< ConstIterator, ConstIterator > equal_range(const Cell &aCell) const
CellMapIterator begin(Dimension d)
CubicalComplex(ConstAlias< KSpace > aK)
Cells cellBoundary(const Cell &aCell, bool hintClosed=false) const
void directFacesIterators(CellMapIteratorOutputIterator &outIt, const Cell &aCell)
Cell const & dereference() const
CubicalCellData(uint32_t d)
BOOST_STATIC_CONSTANT(uint32_t, USER1=0x80000000)
User flag for a cell.
void coFaces(CellOutputIterator &outIt, const Cell &aCell, bool hintOpen=false) const
const CellMap & getCells(const Dimension d) const
AnyCellCollection< Cell > Cells
bool equal(const Iterator &other) const
SequenceCategory Category
Aim: This concept describes a cellular grid space in nD. In these spaces obtained by cartesian produc...
ConstIterator begin() const
bool isCellInterior(const Cell &aCell) const
std::pair< Iterator, bool > insert(const Cell &aCell)
DGtal::uint32_t Dimension
void eraseCells(CellMapIterator it, CellMapIterator itE)
CellMap::const_iterator CellMapConstIterator
Const iterator for visiting type CellMap.
bool operator<=(PointVector< ptDim, LeftEuclideanRing, LeftContainer > const &lhs, PointVector< ptDim, RightEuclideanRing, RightContainer > const &rhs)
Comparison operator on Points/Vectors (LesserOrEqualThan).
Iterator()
Default iterator. Invalid.
BOOST_STATIC_CONSTANT(uint32_t, REMOVED=0x10000000)
Flag Used to indicate in a cell data that this cell has been (virtually) removed.
CubicalComplex closure(const CubicalComplex &S, bool hintClosed=false) const
void insertCell(const Cell &aCell, const Data &data=Data())
void faces(CellOutputIterator &outIt, const Cell &aCell, bool hintClosed=false) const
void fillData(Dimension d, Data data=Data())
ConstIterator find(const Cell &aCell) const
bool operator!=(PointVector< ptDim, LeftEuclideanRing, LeftContainer > const &lhs, PointVector< ptDim, RightEuclideanRing, RightContainer > const &rhs)
Difference operator on Points/Vectors.
CellContainer::mapped_type Data
Type of data associated to each cell.
void erase(Iterator first, Iterator last)
CellMap & getCells(const Dimension d)
void insert(InputIterator first, InputIterator last)
TCellContainer CellContainer
Type for storing cells, an associative container Cell -> Data.
Size erase(const Cell &aCell)
CellType
Possible cell types within a complex.
boost::iterator_facade< ConstIterator, Cell const, std::forward_iterator_tag > Base
Dimension dimension() const
const KSpace * myKSpace
The Khalimsky space in which lives the cubical complex.
bool belongs(Dimension d, const Cell &aCell) const
CellContainer::size_type size_type
void selfDisplay(std::ostream &out) const
void insertCell(Dimension d, const Cell &aCell, const Data &data=Data())
void getInteriorAndBoundary(CubicalComplex &intcc, CubicalComplex &bdcc, bool hintClosed=false) const
Size count(const Cell &aCell) const
void directCoFacesIterators(CellMapIteratorOutputIterator &outIt, const Cell &aCell)
CubicalComplex< TKSpace, TCellContainer > & operator-=(CubicalComplex< TKSpace, TCellContainer > &, const CubicalComplex< TKSpace, TCellContainer > &)
CubicalComplex< TKSpace, TCellContainer > & operator&=(CubicalComplex< TKSpace, TCellContainer > &, const CubicalComplex< TKSpace, TCellContainer > &)
void construct(const TDigitalSet &set)
TKSpace KSpace
Type of the cellular grid space.
CellMapConstIterator begin(Dimension d) const
const CubicalComplex * myCC
CubicalComplex< TKSpace, TCellContainer > Self
NumberTraits< Integer >::UnsignedVersion Size
Type used to represent sizes in the digital space.
ConstIterator()
Default iterator. Invalid.
CellMapIterator findCell(const Cell &aCell)
CubicalComplex & operator=(const CubicalComplex &other)
DGtal is the top-level namespace which contains all DGtal functions and types.
Size eraseCells(CellConstIterator it, CellConstIterator itE)
CubicalComplex< TKSpace, TCellContainer > operator~(const CubicalComplex< TKSpace, TCellContainer > &)
CubicalComplex interior() const
bool equal(const ConstIterator &other) const
Size eraseCell(Dimension d, const Cell &aCell)
Iterator find(const Cell &aCell)
void insertCells(CellConstIterator it, CellConstIterator itE, const Data &data=Data())
KSpace::Cell Cell
Type for a cell in the space.
bool operator>=(PointVector< ptDim, LeftEuclideanRing, LeftContainer > const &lhs, PointVector< ptDim, RightEuclideanRing, RightContainer > const &rhs)
Comparison operator on Points/Vectors (GreaterOrEqualThan).
bool belongs(const Cell &aCell) const
CubicalComplex link(const CubicalComplex &S, bool hintClosed=false, bool hintOpen=false) const
Base::reference Reference
Size eraseCells(Dimension d, CellConstIterator it, CellConstIterator itE)
Cell::PreCell PreCell
Type for a precell in the space.
CubicalComplex< TKSpace, TCellContainer > & operator|=(CubicalComplex< TKSpace, TCellContainer > &, const CubicalComplex< TKSpace, TCellContainer > &)
CubicalComplex< TKSpace, TCellContainer > operator|(const CubicalComplex< TKSpace, TCellContainer > &, const CubicalComplex< TKSpace, TCellContainer > &)
void eraseCell(CellMapIterator it)
friend class boost::iterator_core_access
const KSpace & space() const
CellType computeCellType(const Cell &c, CellMapIterator &it_cell_up, Dimension n=dimension)
bool operator()(const CellMapIterator &it1, const CellMapIterator &it2) const
BOOST_CONCEPT_ASSERT((concepts::CCellularGridSpaceND< TKSpace >))
Iterator insert(Iterator position, const Cell &aCell)
std::pair< Iterator, Iterator > equal_range(const Cell &aCell)
Size nbCells(Dimension d) const
Aim: Defines the concept describing an Associative Container of the STL (https://www....
BOOST_STATIC_CONSTANT(uint32_t, VALUE=0x0fffffff)
Value for a cell.
ConstIterator const_iterator
KSpace::Cells Cells
Type for a sequence of cells in the space.
Defines default container traits for arbitrary types.
std::ostream & operator<<(std::ostream &out, const ClosedIntegerHalfPlane< TSpace > &object)
Base::difference_type DifferenceType
std::vector< CellMap > myCells
KSpace::DirIterator DirIterator
Type for iterating over cell directions.
Dimension dim(const Cell &aCell) const
Data & operator[](const Cell &aCell)
void directCoFaces(CellOutputIterator &outIt, const Cell &aCell, bool hintOpen=false) const
typename PreCellularGridSpace::DirIterator DirIterator
void directFaces(CellOutputIterator &outIt, const Cell &aCell, bool hintClosed=false) const
CellMapConstIterator findCell(Dimension d, const Cell &aCell) const
CubicalComplex< TKSpace, TCellContainer > operator&(const CubicalComplex< TKSpace, TCellContainer > &, const CubicalComplex< TKSpace, TCellContainer > &)
CellMapConstIterator myItEnd
BOOST_STATIC_CONSTANT(uint32_t, FIXED=0x40000000)
Flag Used to indicate in a cell data that this cell is fixed.
CellContainer CellMap
Type for storing cells, an associative container Cell -> Data.
Iterator(Alias< CubicalComplex > cc, Dimension d, CellMapIterator it)
friend class boost::iterator_core_access
KSpace::Size Size
Type for a number of elements.
Base::difference_type DifferenceType
ConstIterator(ConstAlias< CubicalComplex > cc, Dimension d, CellMapConstIterator it)
CubicalComplex< TKSpace, TCellContainer > & operator^=(CubicalComplex< TKSpace, TCellContainer > &, const CubicalComplex< TKSpace, TCellContainer > &)
Iterator(Alias< CubicalComplex > cc, Dimension d)
Dimension dimension() const
static const Dimension dimension
The dimension of the embedding space.
CubicalComplex boundary(bool hintClosed=false) const
Size eraseCell(const Cell &aCell)
Aim: This class encapsulates its parameter class so that to indicate to the user that the object/poin...
KForm< Calculus, order, duality > operator*(const typename Calculus::Scalar &scalar, const KForm< Calculus, order, duality > &form)
TInteger Integer
Arithmetic ring induced by (+,-,*) and Integer numbers.
void fillData(Data data=Data())
BOOST_STATIC_ASSERT((boost::is_base_of< CubicalCellData, Data >::value))
Cell const & const_reference
BOOST_CONCEPT_ASSERT((concepts::CSTLAssociativeContainer< TCellContainer >))
CubicalComplex< TKSpace, TCellContainer > operator^(const 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.
KSpace::Point Point
Type for a point in the digital space.
CubicalComplex(const CubicalComplex &other)
ConstIterator end() const
Cells cellCoBoundary(const Cell &aCell, bool hintOpen=false) const
Aim: This class represents an arbitrary cubical complex living in some Khalimsky space....
boost::iterator_facade< Iterator, Cell const, std::forward_iterator_tag > Base
bool isCellBoundary(const Cell &aCell) const
CellMapConstIterator end(Dimension d) const
Cell const * const_pointer
CellMapConstIterator findCell(const Cell &aCell) const
CubicalComplex star(const CubicalComplex &S, bool hintOpen=false) const
Cell const & dereference() const
void erase(Iterator position)
BOOST_STATIC_CONSTANT(uint32_t, COLLAPSIBLE=0x20000000)
Flag Used to indicate in a cell data that this cell is collapsible.
void insertCells(Dimension d, CellConstIterator it, CellConstIterator itE, const Data &data=Data())
Base::reference Reference
std::string className() const
bool operator()(const Cell &aCell) const
CellContainer::difference_type difference_type