TTK
|
TTK DiscreteMorseSandwich processing package. More...
#include <DiscreteMorseSandwich.h>
Classes | |
struct | EdgeSimplex |
Simplex adaptation for edges More... | |
struct | GeneratorType |
Type for exporting persistent generators. More... | |
struct | PersistencePair |
Persistence pair struct as exported by DiscreteGradient. More... | |
struct | Simplex |
Ad-hoc struct for sorting simplices. More... | |
struct | TetraSimplex |
Simplex adaptation for tetrahedra More... | |
struct | TriangleSimplex |
Simplex adaptation for triangles More... | |
Public Member Functions | |
DiscreteMorseSandwich () | |
void | preconditionTriangulation (AbstractTriangulation *const data) |
void | setInputOffsets (const SimplexId *const offsets) |
void | setComputeMinSad (const bool data) |
void | setComputeSadSad (const bool data) |
void | setComputeSadMax (const bool data) |
template<typename triangulationType > | |
int | buildGradient (const void *const scalars, const size_t scalarsMTime, const SimplexId *const offsets, const triangulationType &triangulation) |
void | setGradient (ttk::dcg::DiscreteGradient &&dg) |
Ugly hack to avoid a call to buildGradient() | |
ttk::dcg::DiscreteGradient && | getGradient () |
template<typename triangulationType > | |
SimplexId | getCellGreaterVertex (const dcg::Cell &c, const triangulationType &triangulation) |
const std::vector< std::vector< SimplexId > > & | get2SaddlesChildren () const |
template<typename triangulationType > | |
int | computePersistencePairs (std::vector< PersistencePair > &pairs, const SimplexId *const offsets, const triangulationType &triangulation, const bool ignoreBoundary, const bool compute2SaddlesChildren=false) |
Compute the persistence pairs from the discrete gradient. | |
![]() | |
Debug () | |
~Debug () override | |
virtual int | setDebugLevel (const int &debugLevel) |
int | setWrapper (const Wrapper *wrapper) override |
int | printMsg (const std::string &msg, const debug::Priority &priority=debug::Priority::INFO, const debug::LineMode &lineMode=debug::LineMode::NEW, std::ostream &stream=std::cout) const |
int | printMsg (const std::vector< std::string > &msgs, const debug::Priority &priority=debug::Priority::INFO, const debug::LineMode &lineMode=debug::LineMode::NEW, std::ostream &stream=std::cout) const |
int | printErr (const std::string &msg, const debug::LineMode &lineMode=debug::LineMode::NEW, std::ostream &stream=std::cerr) const |
int | printWrn (const std::string &msg, const debug::LineMode &lineMode=debug::LineMode::NEW, std::ostream &stream=std::cerr) const |
int | printMsg (const std::string &msg, const double &progress, const double &time, const int &threads, const double &memory, const debug::LineMode &lineMode=debug::LineMode::NEW, const debug::Priority &priority=debug::Priority::PERFORMANCE, std::ostream &stream=std::cout) const |
int | printMsg (const std::string &msg, const double &progress, const double &time, const debug::LineMode &lineMode=debug::LineMode::NEW, const debug::Priority &priority=debug::Priority::PERFORMANCE, std::ostream &stream=std::cout) const |
int | printMsg (const std::string &msg, const double &progress, const double &time, const int &threads, const debug::LineMode &lineMode=debug::LineMode::NEW, const debug::Priority &priority=debug::Priority::PERFORMANCE, std::ostream &stream=std::cout) const |
int | printMsg (const std::string &msg, const double &progress, const debug::LineMode &lineMode=debug::LineMode::NEW, const debug::Priority &priority=debug::Priority::PERFORMANCE, std::ostream &stream=std::cout) const |
int | printMsg (const std::string &msg, const double &progress, const debug::Priority &priority, const debug::LineMode &lineMode=debug::LineMode::NEW, std::ostream &stream=std::cout) const |
int | printMsg (const std::vector< std::vector< std::string > > &rows, const debug::Priority &priority=debug::Priority::INFO, const bool hasHeader=true, const debug::LineMode &lineMode=debug::LineMode::NEW, std::ostream &stream=std::cout) const |
int | printMsg (const debug::Separator &separator, const debug::LineMode &lineMode=debug::LineMode::NEW, const debug::Priority &priority=debug::Priority::INFO, std::ostream &stream=std::cout) const |
int | printMsg (const debug::Separator &separator, const debug::Priority &priority, const debug::LineMode &lineMode=debug::LineMode::NEW, std::ostream &stream=std::cout) const |
int | printMsg (const std::string &msg, const debug::Separator &separator, const debug::LineMode &lineMode=debug::LineMode::NEW, const debug::Priority &priority=debug::Priority::INFO, std::ostream &stream=std::cout) const |
void | setDebugMsgPrefix (const std::string &prefix) |
![]() | |
BaseClass () | |
virtual | ~BaseClass ()=default |
int | getThreadNumber () const |
virtual int | setThreadNumber (const int threadNumber) |
Protected Types | |
using | tripletType = std::array< SimplexId, 3 > |
Triplet type for persistence pairs. | |
Protected Member Functions | |
template<typename triangulationType > | |
std::vector< std::vector< SimplexId > > | getSaddle1ToMinima (const std::vector< SimplexId > &criticalEdges, const triangulationType &triangulation) const |
Follow the descending 1-separatrices to compute the saddles -> minima association. | |
template<typename triangulationType , typename GFS , typename GFSN , typename OB > | |
std::vector< std::vector< SimplexId > > | getSaddle2ToMaxima (const std::vector< SimplexId > &criticalCells, const GFS &getFaceStar, const GFSN &getFaceStarNumber, const OB &isOnBoundary, const triangulationType &triangulation) const |
Follow the ascending 1-separatrices to compute the saddles -> maxima association. | |
template<typename triangulationType > | |
void | getMinSaddlePairs (std::vector< PersistencePair > &pairs, std::vector< bool > &pairedMinima, std::vector< bool > &paired1Saddles, const std::vector< SimplexId > &criticalEdges, const std::vector< SimplexId > &critEdgesOrder, const SimplexId *const offsets, const triangulationType &triangulation) const |
Compute the pairs of dimension 0. | |
template<typename triangulationType > | |
void | getMaxSaddlePairs (std::vector< PersistencePair > &pairs, std::vector< bool > &pairedMaxima, std::vector< bool > &pairedSaddles, const std::vector< SimplexId > &criticalSaddles, const std::vector< SimplexId > &critSaddlesOrder, const std::vector< SimplexId > &critMaxsOrder, const triangulationType &triangulation) const |
Compute the pairs of dimension dim - 1. | |
template<typename triangulationType > | |
void | getSaddleSaddlePairs (std::vector< PersistencePair > &pairs, std::vector< bool > &paired1Saddles, std::vector< bool > &paired2Saddles, const bool exportBoundaries, std::vector< GeneratorType > &boundaries, const std::vector< SimplexId > &critical1Saddles, const std::vector< SimplexId > &critical2Saddles, const std::vector< SimplexId > &crit1SaddlesOrder, const triangulationType &triangulation) const |
Compute the saddle-saddle pairs (in 3D) | |
template<typename triangulationType > | |
void | extractCriticalCells (std::array< std::vector< SimplexId >, 4 > &criticalCellsByDim, std::array< std::vector< SimplexId >, 4 > &critCellsOrder, const SimplexId *const offsets, const triangulationType &triangulation, const bool sortEdges) const |
Extract & sort critical cell from the DiscreteGradient. | |
void | displayStats (const std::vector< PersistencePair > &pairs, const std::array< std::vector< SimplexId >, 4 > &criticalCellsByDim, const std::vector< bool > &pairedMinima, const std::vector< bool > &paired1Saddles, const std::vector< bool > &paired2Saddles, const std::vector< bool > &pairedMaxima) const |
Print number of pairs, critical cells per dimension & unpaired cells. | |
void | tripletsToPersistencePairs (std::vector< PersistencePair > &pairs, std::vector< bool > &pairedExtrema, std::vector< bool > &pairedSaddles, std::vector< SimplexId > &reps, std::vector< tripletType > &triplets, const SimplexId *const saddlesOrder, const SimplexId *const extremaOrder, const SimplexId pairDim) const |
Compute persistence pairs from triplets. | |
template<typename triangulationType , typename Container > | |
SimplexId | eliminateBoundariesSandwich (const SimplexId s2, std::vector< bool > &onBoundary, std::vector< Container > &s2Boundaries, const std::vector< SimplexId > &s2Mapping, const std::vector< SimplexId > &s1Mapping, std::vector< SimplexId > &partners, std::vector< Lock > &s1Locks, std::vector< Lock > &s2Locks, const triangulationType &triangulation) const |
Detect 1-saddles paired to a given 2-saddle. | |
template<typename triangulationType > | |
void | alloc (const triangulationType &triangulation) |
void | clear () |
![]() | |
int | printMsgInternal (const std::string &msg, const std::string &right, const std::string &filler, const debug::Priority &priority=debug::Priority::INFO, const debug::LineMode &lineMode=debug::LineMode::NEW, std::ostream &stream=std::cout) const |
int | printMsgInternal (const std::string &msg, const debug::Priority &priority, const debug::LineMode &lineMode, std::ostream &stream=std::cout) const |
int | welcomeMsg (std::ostream &stream) |
Protected Attributes | |
dcg::DiscreteGradient | dg_ {} |
std::vector< SimplexId > | firstRepMin_ {} |
std::vector< SimplexId > | firstRepMax_ {} |
std::vector< SimplexId > | edgeTrianglePartner_ {} |
std::vector< SimplexId > | s2Mapping_ {} |
std::vector< SimplexId > | s1Mapping_ {} |
std::vector< EdgeSimplex > | critEdges_ {} |
std::array< std::vector< bool >, 4 > | pairedCritCells_ {} |
std::vector< bool > | onBoundary_ {} |
std::array< std::vector< SimplexId >, 4 > | critCellsOrder_ {} |
std::vector< std::vector< SimplexId > > | s2Children_ {} |
bool | ComputeMinSad {true} |
bool | ComputeSadSad {true} |
bool | ComputeSadMax {true} |
bool | Compute2SaddlesChildren {false} |
![]() | |
int | debugLevel_ |
std::string | debugMsgPrefix_ |
std::string | debugMsgNamePrefix_ |
![]() | |
bool | lastObject_ |
int | threadNumber_ |
Wrapper * | wrapper_ |
Additional Inherited Members | |
![]() | |
static COMMON_EXPORTS debug::LineMode | lastLineMode = ttk::debug::LineMode::NEW |
TTK DiscreteMorseSandwich processing package.
DiscreteMorseSandwich computes a Persistence Diagram by using the Discrete Morse-Theory DiscreteGradient algorithms.
Related publication
"Discrete Morse Sandwich: Fast Computation of Persistence Diagrams for
Scalar Data -- An Algorithm and A Benchmark"
Pierre Guillou, Jules Vidal, Julien Tierny
IEEE Transactions on Visualization and Computer Graphics, 2023.
arXiv:2206.13932, 2023.
Definition at line 30 of file DiscreteMorseSandwich.h.
|
protected |
Triplet type for persistence pairs.
[0]: saddle cell id [1]: extremum 1 cell id [2]: extremum 2 cell id
Definition at line 297 of file DiscreteMorseSandwich.h.
ttk::DiscreteMorseSandwich::DiscreteMorseSandwich | ( | ) |
Definition at line 3 of file DiscreteMorseSandwich.cpp.
|
inlineprotected |
Definition at line 430 of file DiscreteMorseSandwich.h.
|
inline |
Definition at line 69 of file DiscreteMorseSandwich.h.
|
inlineprotected |
Definition at line 492 of file DiscreteMorseSandwich.h.
int ttk::DiscreteMorseSandwich::computePersistencePairs | ( | std::vector< PersistencePair > & | pairs, |
const SimplexId *const | offsets, | ||
const triangulationType & | triangulation, | ||
const bool | ignoreBoundary, | ||
const bool | compute2SaddlesChildren = false |
||
) |
Compute the persistence pairs from the discrete gradient.
[out] | pairs | Output persistence pairs |
[in] | offsets | Order field |
[in] | triangulation | Preconditionned triangulation |
[in] | ignoreBoundary | Ignore the boundary component |
[in] | compute2SaddlesChildren | Extract links between 2-saddles |
Definition at line 1151 of file DiscreteMorseSandwich.h.
|
protected |
Print number of pairs, critical cells per dimension & unpaired cells.
[in] | pairs | Computed persistence pairs |
[in] | criticalCellsByDim | Store critical cells ids per dimension |
[in] | pairedMinima | If minima are paired |
[in] | paired1Saddles | If 1-saddles are paired |
[in] | paired2Saddles | If 2-saddles are paired |
[in] | pairedMaxima | If maxima are paired |
Definition at line 117 of file DiscreteMorseSandwich.cpp.
|
protected |
Detect 1-saddles paired to a given 2-saddle.
Adapted version of ttk::PersistentSimplexPairs::eliminateBoundaries()
[in] | s2 | Input 2-saddle (critical triangle) |
[in,out] | onBoundary | Propagation mask |
[in,out] | s2Boundaries | Boundaries storage (compact) |
[in] | s1Mapping | From edge id to 1-saddle compact id in s1Locks |
[in] | s2Mapping | From triangle id to compact id in s2Boundaries and s2Locks |
[in] | partners | Get 2-saddles paired to 1-saddles on boundary |
[in] | s1Locks | Vector of locks over 1-saddles |
[in] | s2Locks | Vector of locks over 2-saddles |
[in] | triangulation | Simplicial complex |
Definition at line 763 of file DiscreteMorseSandwich.h.
|
protected |
Extract & sort critical cell from the DiscreteGradient.
[out] | criticalCellsByDim | Store critical cells ids per dimension |
[out] | critCellsOrder | Filtration order on critical cells |
[in] | offsets | Vertex offset field |
[in] | triangulation | Triangulation |
[in] | sortEdges | Sort all edges vs. only 1-saddles |
Definition at line 1039 of file DiscreteMorseSandwich.h.
|
inline |
Definition at line 108 of file DiscreteMorseSandwich.h.
|
inline |
Definition at line 102 of file DiscreteMorseSandwich.h.
|
inline |
Definition at line 96 of file DiscreteMorseSandwich.h.
|
protected |
Compute the pairs of dimension dim - 1.
[out] | pairs | Output persistence pairs |
[in] | pairedMaxima | If maxima are paired |
[in] | pairedSaddles | If 2-saddles (or 1-saddles in 2D) are paired |
[in] | criticalSaddles | List of 2-saddles (or 1-saddles in 2D) |
[in] | critSaddlesOrder | Filtration order on critical saddles |
[in] | critMaxsOrder | Filtration order on maxima |
[in] | triangulation | Triangulation |
Definition at line 671 of file DiscreteMorseSandwich.h.
|
protected |
Compute the pairs of dimension 0.
[out] | pairs | Output persistence pairs |
[in] | pairedMinima | If minima are paired |
[in] | paired1Saddles | If 1-saddles (or maxima in 1D) are paired |
[in] | criticalEdges | List of 1-saddles (or maxima in 1D) |
[in] | critEdgesOrder | Filtration order on critical edges |
[in] | offsets | Vertex offset field |
[in] | triangulation | Triangulation |
Definition at line 624 of file DiscreteMorseSandwich.h.
|
protected |
Follow the descending 1-separatrices to compute the saddles -> minima association.
[in] | criticalEdges | Critical edges identifiers |
[in] | triangulation | Triangulation |
Definition at line 527 of file DiscreteMorseSandwich.h.
|
protected |
Follow the ascending 1-separatrices to compute the saddles -> maxima association.
[in] | criticalCells | Critical cells identifiers |
[in] | getFaceStar | Either getEdgeStar (in 2D) or getTriangleStar (in 3D) |
[in] | getFaceStarNumber | Either getEdgeStarNumber (in 2D) or getTriangleStarNumber (in 3D) |
[in] | isOnBoundary | Either isEdgeOnBoundary (in 2D) or isTriangleOnBoundary (in 3D) |
[in] | triangulation | Triangulation |
Definition at line 570 of file DiscreteMorseSandwich.h.
|
protected |
Compute the saddle-saddle pairs (in 3D)
[out] | pairs | Output persistence pairs |
[in] | paired1Saddles | If 1-saddles are paired |
[in] | paired2Saddles | If 2-saddles are paired |
[in] | exportBoundaries | If 2-saddles boundaries must be exported |
[out] | boundaries | Vector of 2-saddles boundaries |
[in] | critical1Saddles | Full list of 1-saddles |
[in] | critical2Saddles | Full list of 2-saddles |
[in] | crit1SaddlesOrder | Filtration order on 1-saddles |
[in] | triangulation | Triangulation |
Definition at line 912 of file DiscreteMorseSandwich.h.
|
inline |
Definition at line 50 of file DiscreteMorseSandwich.h.
|
inline |
Definition at line 58 of file DiscreteMorseSandwich.h.
|
inline |
Definition at line 64 of file DiscreteMorseSandwich.h.
|
inline |
Definition at line 61 of file DiscreteMorseSandwich.h.
|
inline |
Ugly hack to avoid a call to buildGradient()
An externally computed gradient can be retrofitted into this class using move semantics with setGradient(). The internal gradient can be fetched back with getGradient() once the persistence pairs are computed . c.f. ttk::MorseSmaleComplex::returnSaddleConnectors
[in] | dg | External gradient instance |
Definition at line 91 of file DiscreteMorseSandwich.h.
|
inline |
Definition at line 54 of file DiscreteMorseSandwich.h.
|
protected |
Compute persistence pairs from triplets.
[out] | pairs | Store generated persistence pairs |
[in,out] | pairedExtrema | If critical extrema are paired |
[in,out] | pairedSaddles | If critical saddles are paired |
[in,out] | reps | Extrema representatives |
[in] | triplets | Input triplets (saddle, extremum, extremum) |
[in] | saddlesOrder | Order on saddles |
[in] | extremaOrder | Order on extrema |
[in] | pairDim | Pair birth simplex dimension |
Definition at line 7 of file DiscreteMorseSandwich.cpp.
|
protected |
Definition at line 521 of file DiscreteMorseSandwich.h.
|
protected |
Definition at line 518 of file DiscreteMorseSandwich.h.
|
protected |
Definition at line 520 of file DiscreteMorseSandwich.h.
|
protected |
Definition at line 519 of file DiscreteMorseSandwich.h.
|
mutableprotected |
Definition at line 515 of file DiscreteMorseSandwich.h.
|
mutableprotected |
Definition at line 512 of file DiscreteMorseSandwich.h.
|
protected |
Definition at line 507 of file DiscreteMorseSandwich.h.
|
protected |
Definition at line 511 of file DiscreteMorseSandwich.h.
|
protected |
Definition at line 510 of file DiscreteMorseSandwich.h.
|
mutableprotected |
Definition at line 510 of file DiscreteMorseSandwich.h.
|
mutableprotected |
Definition at line 514 of file DiscreteMorseSandwich.h.
|
mutableprotected |
Definition at line 513 of file DiscreteMorseSandwich.h.
|
protected |
Definition at line 511 of file DiscreteMorseSandwich.h.
|
mutableprotected |
Definition at line 516 of file DiscreteMorseSandwich.h.
|
protected |
Definition at line 511 of file DiscreteMorseSandwich.h.