20 #ifndef MIRTK_EdgeConnectivity_H 21 #define MIRTK_EdgeConnectivity_H 23 #include "mirtk/SparseMatrix.h" 25 #include "vtkDataSet.h" 56 mirtkReadOnlyAttributeMacro(
int, Maximum);
120 if (n == 0)
return 0;
121 if (n < 0 || n == _Maximum) {
122 if (_Layout == CCS) {
129 if (_Layout == CCS) {
130 for (
int i =
_Col[ptId], j =
_Col[ptId+1]; i != j; ++i) {
131 if (
_Data[i] > n)
break;
135 for (
int i =
_Row[ptId], j =
_Row[ptId+1]; i != j; ++i) {
136 if (
_Data[i] > n)
break;
155 if (_Layout == CCS) {
160 }
else if (n < 0 || n == _Maximum) {
161 if (_Layout == CCS) {
163 end =
_Row + _Col[ptId + 1];
166 end =
_Col + _Row[ptId + 1];
169 if (_Layout == CCS) {
171 int j =
_Col[ptId+1];
172 begin = end =
_Row + i;
173 while (i != j && *end <= n) ++i, ++end;
176 int j =
_Row[ptId+1];
177 begin = end =
_Col + i;
178 while (i != j && *end <= n) ++i, ++end;
189 numNbrPts = end - nbrPtIds;
209 #endif // MIRTK_EdgeConnectivity_H int NumberOfPoints() const
Number of nodes.
EdgeConnectivity(vtkDataSet *=nullptr, int n=3, const EdgeTable *=nullptr)
Construct edge-connectivity table for given dataset.
void GetAdjacentPoints(int, int &, const int *&) const
Access list of adjacent (i.e. 1-connected) nodes (thread-safe)
int NumberOfConnectedPoints(int, int n=-1) const
Get number of nodes with edge-connectivity less or equal to n.
virtual ~EdgeConnectivity()
Destructor.
int NumberOfAdjacentPoints(int) const
Get number of adjacent nodes, i.e., nodes with edge-connectivity equal one.
EdgeConnectivity & operator=(const EdgeConnectivity &)
Assignment operator.
void Initialize(vtkDataSet *, int n=3, const EdgeTable *=nullptr)
Initialize edge-connectivity table from given dataset.
EntryType * _Data
Non-zero entries.
virtual void Clear()
Clear edge-connectivity table.
void GetConnectedPoints(int, int &, const int *&, int n=-1) const
Access list of nodes with edge-connectivity less or equal to n (thread-safe)