Skip to content

Commit

Permalink
Merge pull request #976 from julien-tierny/unifiedMergeTree
Browse files Browse the repository at this point in the history
Explicit names for FTM and FTR computations
  • Loading branch information
julien-tierny authored Oct 4, 2023
2 parents 92aee47 + 24ae49c commit 5a2b3d0
Show file tree
Hide file tree
Showing 39 changed files with 160 additions and 150 deletions.
11 changes: 0 additions & 11 deletions core/vtk/ttkFTMTree/ttk.module

This file was deleted.

10 changes: 0 additions & 10 deletions core/vtk/ttkFTRGraph/ttk.module

This file was deleted.

2 changes: 1 addition & 1 deletion core/vtk/ttkHarmonicField/ttkHarmonicField.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
///
/// \sa ttkScalarFieldCriticalPoints
/// \sa ttkIntegralLines
/// \sa ttkFTMTree
/// \sa ttkMergeAndContourTree
/// \sa ttkIdentifiers
/// \sa ttk::HarmonicField
///
Expand Down
File renamed without changes.
11 changes: 11 additions & 0 deletions core/vtk/ttkMergeAndContourTree/ttk.module
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
NAME
ttkMergeAndContourTree
SOURCES
ttkMergeAndContourTree.cpp
HEADERS
ttkMergeAndContourTree.h
ttkMergeAndContourStructures.h
ttkMergeAndContourTreeUtils.h
DEPENDS
ftmTree
ttkAlgorithm
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,9 @@ namespace ttk {

#ifndef TTK_ENABLE_KAMIKAZE
if(!arr) {
std::cerr << "[ttkFTMTree] Error, unable to allocate " << fieldName
<< " the program will likely crash" << std::endl;
std::cerr << "[ttkMergeAndContourTree] Error, unable to allocate "
<< fieldName << " the program will likely crash"
<< std::endl;
}
#endif
return arr;
Expand Down Expand Up @@ -341,8 +342,8 @@ namespace ttk {

// Empty node
#ifndef TTK_ENABLE_KAMIKAZE
std::cerr << "[ttkFTMTree]: node without arcs:" << node->getVertexId()
<< std::endl;
std::cerr << "[ttkMergeAndContourTree]: node without arcs:"
<< node->getVertexId() << std::endl;
#endif
return nullSuperArc;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <ttkFTMTree.h>
#include <ttkMacros.h>
#include <ttkMergeAndContourTree.h>
#include <ttkUtils.h>

// VTK includes
Expand All @@ -13,23 +13,25 @@
#include <vtkUnstructuredGrid.h>
#include <vtkVersion.h> // for VTK_VERSION_CHECK via ParaView 5.8.1

vtkStandardNewMacro(ttkFTMTree);
vtkStandardNewMacro(ttkMergeAndContourTree);

ttkFTMTree::ttkFTMTree() {
this->setDebugMsgPrefix("FTMTree");
ttkMergeAndContourTree::ttkMergeAndContourTree() {
this->setDebugMsgPrefix("MergeAndContourTree");
SetNumberOfInputPorts(1);
SetNumberOfOutputPorts(3);
}

int ttkFTMTree::FillInputPortInformation(int port, vtkInformation *info) {
int ttkMergeAndContourTree::FillInputPortInformation(int port,
vtkInformation *info) {
if(port == 0) {
info->Set(vtkAlgorithm::INPUT_REQUIRED_DATA_TYPE(), "vtkDataSet");
return 1;
}
return 0;
}

int ttkFTMTree::FillOutputPortInformation(int port, vtkInformation *info) {
int ttkMergeAndContourTree::FillOutputPortInformation(int port,
vtkInformation *info) {
if(port == 0 || port == 1) {
info->Set(vtkDataObject::DATA_TYPE_NAME(), "vtkUnstructuredGrid");
return 1;
Expand All @@ -40,9 +42,9 @@ int ttkFTMTree::FillOutputPortInformation(int port, vtkInformation *info) {
return 0;
}

int ttkFTMTree::RequestData(vtkInformation *ttkNotUsed(request),
vtkInformationVector **inputVector,
vtkInformationVector *outputVector) {
int ttkMergeAndContourTree::RequestData(vtkInformation *ttkNotUsed(request),
vtkInformationVector **inputVector,
vtkInformationVector *outputVector) {

const auto input = vtkDataSet::GetData(inputVector[0]);
auto outputSkeletonNodes = vtkUnstructuredGrid::GetData(outputVector, 0);
Expand Down Expand Up @@ -209,11 +211,12 @@ int ttkFTMTree::RequestData(vtkInformation *ttkNotUsed(request),
return 1;
}

int ttkFTMTree::addCompleteSkeletonArc(const ttk::ftm::idSuperArc arcId,
const int cc,
vtkPoints *points,
vtkUnstructuredGrid *skeletonArcs,
ttk::ftm::ArcData &arcData) {
int ttkMergeAndContourTree::addCompleteSkeletonArc(
const ttk::ftm::idSuperArc arcId,
const int cc,
vtkPoints *points,
vtkUnstructuredGrid *skeletonArcs,
ttk::ftm::ArcData &arcData) {
auto tree = ftmTree_[cc].tree.getTree(GetTreeType());
vtkDataArray *idMapper = connected_components_[cc]->GetPointData()->GetArray(
ttk::VertexScalarFieldName);
Expand Down Expand Up @@ -279,11 +282,12 @@ int ttkFTMTree::addCompleteSkeletonArc(const ttk::ftm::idSuperArc arcId,
return 1;
}

int ttkFTMTree::addDirectSkeletonArc(const ttk::ftm::idSuperArc arcId,
const int cc,
vtkPoints *points,
vtkUnstructuredGrid *skeletonArcs,
ttk::ftm::ArcData &arcData) {
int ttkMergeAndContourTree::addDirectSkeletonArc(
const ttk::ftm::idSuperArc arcId,
const int cc,
vtkPoints *points,
vtkUnstructuredGrid *skeletonArcs,
ttk::ftm::ArcData &arcData) {
auto tree = ftmTree_[cc].tree.getTree(GetTreeType());
vtkDataArray *idMapper = connected_components_[cc]->GetPointData()->GetArray(
ttk::VertexScalarFieldName);
Expand Down Expand Up @@ -330,11 +334,12 @@ int ttkFTMTree::addDirectSkeletonArc(const ttk::ftm::idSuperArc arcId,
return 1;
}

int ttkFTMTree::addSampledSkeletonArc(const ttk::ftm::idSuperArc arcId,
const int cc,
vtkPoints *points,
vtkUnstructuredGrid *skeletonArcs,
ttk::ftm::ArcData &arcData) {
int ttkMergeAndContourTree::addSampledSkeletonArc(
const ttk::ftm::idSuperArc arcId,
const int cc,
vtkPoints *points,
vtkUnstructuredGrid *skeletonArcs,
ttk::ftm::ArcData &arcData) {
auto tree = ftmTree_[cc].tree.getTree(GetTreeType());
vtkDataArray *idMapper = connected_components_[cc]->GetPointData()->GetArray(
ttk::VertexScalarFieldName);
Expand Down Expand Up @@ -429,7 +434,7 @@ int ttkFTMTree::addSampledSkeletonArc(const ttk::ftm::idSuperArc arcId,
return 1;
}

int ttkFTMTree::getOffsets() {
int ttkMergeAndContourTree::getOffsets() {
// should be called after getScalars for inputScalars_ needs to be filled

offsets_.resize(nbCC_);
Expand All @@ -456,7 +461,7 @@ int ttkFTMTree::getOffsets() {
return 1;
}

int ttkFTMTree::getScalars() {
int ttkMergeAndContourTree::getScalars() {
inputScalars_.resize(nbCC_);
for(int cc = 0; cc < nbCC_; cc++) {
inputScalars_[cc]
Expand All @@ -475,7 +480,7 @@ int ttkFTMTree::getScalars() {
return 1;
}

int ttkFTMTree::getSegmentation(vtkDataSet *outputSegmentation) {
int ttkMergeAndContourTree::getSegmentation(vtkDataSet *outputSegmentation) {
ttk::ftm::VertData vertData;
vertData.init(ftmTree_, params_);

Expand All @@ -501,7 +506,8 @@ int ttkFTMTree::getSegmentation(vtkDataSet *outputSegmentation) {
return 1;
}

int ttkFTMTree::getSkeletonArcs(vtkUnstructuredGrid *outputSkeletonArcs) {
int ttkMergeAndContourTree::getSkeletonArcs(
vtkUnstructuredGrid *outputSkeletonArcs) {
vtkNew<vtkUnstructuredGrid> skeletonArcs{};
vtkNew<vtkPoints> const points{};

Expand Down Expand Up @@ -549,7 +555,8 @@ int ttkFTMTree::getSkeletonArcs(vtkUnstructuredGrid *outputSkeletonArcs) {
return 1;
}

int ttkFTMTree::getSkeletonNodes(vtkUnstructuredGrid *outputSkeletonNodes) {
int ttkMergeAndContourTree::getSkeletonNodes(
vtkUnstructuredGrid *outputSkeletonNodes) {
vtkNew<vtkUnstructuredGrid> skeletonNodes{};
vtkNew<vtkPoints> points{};

Expand Down Expand Up @@ -601,7 +608,7 @@ int ttkFTMTree::getSkeletonNodes(vtkUnstructuredGrid *outputSkeletonNodes) {
}

#ifdef TTK_ENABLE_FTM_TREE_STATS_TIME
void ttkFTMTree::printCSVStats() {
void ttkMergeAndContourTree::printCSVStats() {
using namespace ttk;

for(auto &t : ftmTree_) {
Expand All @@ -624,7 +631,8 @@ void ttkFTMTree::printCSVStats() {
}
}

void ttkFTMTree::printCSVTree(const ttk::ftm::FTMTree_MT *const tree) const {
void ttkMergeAndContourTree::printCSVTree(
const ttk::ftm::FTMTree_MT *const tree) const {
using namespace ttk::ftm;

const idSuperArc nbArc = tree->getNumberOfLeaves();
Expand All @@ -644,7 +652,7 @@ void ttkFTMTree::printCSVTree(const ttk::ftm::FTMTree_MT *const tree) const {
}
#endif

int ttkFTMTree::preconditionTriangulation() {
int ttkMergeAndContourTree::preconditionTriangulation() {
triangulation_.resize(nbCC_);
ftmTree_ = std::vector<ttk::ftm::LocalFTM>(nbCC_);

Expand Down Expand Up @@ -676,7 +684,7 @@ int ttkFTMTree::preconditionTriangulation() {

// protected

void ttkFTMTree::identify(vtkDataSet *ds) const {
void ttkMergeAndContourTree::identify(vtkDataSet *ds) const {
vtkNew<ttkSimplexIdTypeArray> identifiers{};
const auto nbPoints = ds->GetNumberOfPoints();
identifiers->SetName(ttk::VertexScalarFieldName);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
/// \ingroup vtk
/// \class ttkFTMTree
/// \class ttkMergeAndContourTree
/// \author Charles Gueunet <charles.gueunet@kitware.com>
/// \date June 2017.
///
/// \sa ttk::ftm::FTMTree
///
/// \brief TTK VTK-filter for the computation of merge and contour trees.
/// \brief TTK filter for the computation of the Merge And Contour (MAC) trees.
///
/// The computation of the Merge / Contour tree done by this package is done in
/// parallel if TTK_ENABLE_OPENMP is set to ON, using a task based approach
Expand Down Expand Up @@ -81,21 +81,22 @@
#include <vtkSmartPointer.h>

// VTK module
#include <ttkFTMTreeModule.h>
#include <ttkMergeAndContourTreeModule.h>

// ttk code includes
#include <FTMTree.h>
#include <ttkAlgorithm.h>
#include <ttkFTMStructures.h>
#include <ttkMergeAndContourStructures.h>

class vtkDataSet;

class TTKFTMTREE_EXPORT ttkFTMTree : public ttkAlgorithm {
class TTKMERGEANDCONTOURTREE_EXPORT ttkMergeAndContourTree
: public ttkAlgorithm {

public:
static ttkFTMTree *New();
static ttkMergeAndContourTree *New();

vtkTypeMacro(ttkFTMTree, ttkAlgorithm);
vtkTypeMacro(ttkMergeAndContourTree, ttkAlgorithm);

/// @brief the offset array to use for simulation of simplicity
/// @{
Expand Down Expand Up @@ -196,7 +197,7 @@ class TTKFTMTREE_EXPORT ttkFTMTree : public ttkAlgorithm {
#endif

protected:
ttkFTMTree();
ttkMergeAndContourTree();

// vtkDataSetAlgorithm methods
int FillInputPortInformation(int port, vtkInformation *info) override;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/// \ingroup vtk
/// \class ttk::ttkFTMTreeUtils
/// \class ttk::ttkMergeAndContourTreeUtils
/// \author Mathieu Pont (mathieu.pont@lip6.fr)
/// \date 2021.
///
/// Utils function for manipulating FTMTree class
/// Utils function for manipulating MergeAndContourTree class

#pragma once

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
NAME
ttkFTRGraph
ttkMergeAndContourTree
DEPENDS
ttkAlgorithm
2 changes: 1 addition & 1 deletion core/vtk/ttkMergeTreeClustering/ttk.module
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ DEPENDS
ftmTree
planarGraphLayout
ttkPlanarGraphLayout
ttkFTMTree
ttkMergeAndContourTree
ttkAlgorithm
2 changes: 1 addition & 1 deletion core/vtk/ttkMergeTreeClustering/ttkMergeTreeClustering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include <FTMTreeUtils.h>
#include <MergeTreeUtils.h>
#include <MergeTreeVisualization.h>
#include <ttkFTMTreeUtils.h>
#include <ttkMergeAndContourTreeUtils.h>
#include <ttkMergeTreeClustering.h>
#include <ttkMergeTreeVisualization.h>

Expand Down
2 changes: 1 addition & 1 deletion core/vtk/ttkMergeTreeDistanceMatrix/ttk.module
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ HEADERS
ttkMergeTreeDistanceMatrix.h
DEPENDS
mergeTreeDistanceMatrix
ttkFTMTree
ttkMergeAndContourTree
ttkAlgorithm
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include <ttkFTMTreeUtils.h>
#include <ttkMergeAndContourTreeUtils.h>
#include <ttkMergeTreeDistanceMatrix.h>
#include <ttkUtils.h>

Expand Down
2 changes: 1 addition & 1 deletion core/vtk/ttkMergeTreePrincipalGeodesics/ttk.module
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ HEADERS
ttkMergeTreePrincipalGeodesics.h
DEPENDS
mergeTreePrincipalGeodesics
ttkFTMTree
ttkMergeAndContourTree
ttkPlanarGraphLayout
ttkAlgorithm
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include <ttkFTMTreeUtils.h>
#include <ttkMergeAndContourTreeUtils.h>
#include <ttkMergeTreePrincipalGeodesics.h>

#include <vtkInformation.h>
Expand Down
2 changes: 1 addition & 1 deletion core/vtk/ttkMergeTreePrincipalGeodesicsDecoding/ttk.module
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ HEADERS
ttkMergeTreePrincipalGeodesicsDecoding.h
DEPENDS
mergeTreePrincipalGeodesicsDecoding
ttkFTMTree
ttkMergeAndContourTree
ttkPlanarGraphLayout
ttkAlgorithm
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include <ttkFTMTreeUtils.h>
#include <ttkMergeAndContourTreeUtils.h>
#include <ttkMergeTreePrincipalGeodesicsDecoding.h>

#include <vtkInformation.h>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include <ttkMergeTreeTemporalReductionDecoding.h>

#include <ttkFTMTreeUtils.h>
#include <ttkMergeAndContourTreeUtils.h>
#include <ttkMergeTreeVisualization.h>

#include <vtkInformation.h>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include <ttkMergeTreeTemporalReductionEncoding.h>

#include <ttkFTMTreeUtils.h>
#include <ttkMergeAndContourTreeUtils.h>
#include <ttkMergeTreeVisualization.h>

#include <vtkInformation.h>
Expand Down
Loading

0 comments on commit 5a2b3d0

Please sign in to comment.