Skip to content

Commit

Permalink
Merge branch 'dev' of https://github.com/topology-tool-kit/ttk into sdf
Browse files Browse the repository at this point in the history
  • Loading branch information
julien-tierny committed Jun 27, 2024
2 parents dc09123 + 2035bd7 commit b03fd09
Show file tree
Hide file tree
Showing 68 changed files with 8,180 additions and 151 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ jobs:
shell: bash
run: |
conda install -c conda-forge "qt>=5.12" boost eigen spectralib zfp \
scikit-learn openmp graphviz websocketpp
scikit-learn llvm-openmp graphviz websocketpp clangxx
- name: Remove hosted Python
shell: bash
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ jobs:
shell: bash
run: |
conda install -c conda-forge boost glew eigen spectralib zfp \
scikit-learn openmp graphviz ninja websocketpp sccache=0.4.2 python=3.10 zlib qhull
scikit-learn graphviz ninja websocketpp sccache=0.4.2 python=3.10 zlib qhull llvm-openmp clangxx
# add sccache to PATH
echo "$CONDA_ROOT/bin" >> $GITHUB_PATH
# add TTK & ParaView install folders to PATH
Expand Down
1 change: 1 addition & 0 deletions CMake/Print.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ function(ttk_print_summary)
message(STATUS "TTK_ENABLE_SHARED_BASE_LIBRARIES: ${TTK_ENABLE_SHARED_BASE_LIBRARIES}")
message(STATUS "TTK_ENABLE_SPECTRA: ${TTK_ENABLE_SPECTRA}")
message(STATUS "TTK_ENABLE_SQLITE3: ${TTK_ENABLE_SQLITE3}")
message(STATUS "TTK_ENABLE_TORCH: ${TTK_ENABLE_TORCH}")
message(STATUS "TTK_ENABLE_WEBSOCKETPP: ${TTK_ENABLE_WEBSOCKETPP}")
message(STATUS "TTK_ENABLE_ZFP: ${TTK_ENABLE_ZFP}")
message(STATUS "TTK_ENABLE_ZLIB: ${TTK_ENABLE_ZLIB}")
Expand Down
9 changes: 9 additions & 0 deletions CMake/config.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,15 @@ endif()

# optional packages

find_package(Torch QUIET)
if(TORCH_FOUND)
option(TTK_ENABLE_TORCH "Enable Torch support" ON)
message(STATUS "Found Torch ${TORCH_VERSION} (${TORCH_LIBRARIES})")
else()
option(TTK_ENABLE_TORCH "Enable Torch support" OFF)
message(STATUS "Torch not found, disabling Torch support in TTK.")
endif()

find_package(ZLIB QUIET)
if(ZLIB_FOUND)
option(TTK_ENABLE_ZLIB "Enable Zlib support" ON)
Expand Down
2 changes: 1 addition & 1 deletion CMake/merge_tree_preprocess.xml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ panel_visibility="advanced">
</PropertyWidgetDecorator>
</Hints>
<Documentation>

When merging a saddle point that was already merged to other saddle points before, this option allows to consider not the saddle point itself but the farthest saddle among the ones that were already merge to it before. "Farthest" means here the saddle with lowest value for join tree and highest value for split tree.
</Documentation>
<BooleanDomain name="bool"/>
</IntVectorProperty>
Expand Down
4 changes: 4 additions & 0 deletions core/base/TTKBaseConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ if (@TTK_ENABLE_QHULL@ AND @Qhull_FOUND@)
find_dependency(Qhull REQUIRED)
endif()

if (@TTK_ENABLE_TORCH@ AND TORCH_FOUND)
find_dependency(Torch REQUIRED)
endif()

if (@TTK_ENABLE_ZFP@ AND NOT @TTK_ENABLE_SHARED_BASE_LIBRARIES@)
set(ZFP_DIR "@ZFP_DIR@" CACHE PATH "Use TTK ZFP dir" FORCE)
find_dependency(ZFP REQUIRED @ZFP_DIR@)
Expand Down
38 changes: 22 additions & 16 deletions core/base/ftmTree/FTMTreeUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,8 @@ namespace ttk {
}

int FTMTree_MT::getNumberOfLeavesFromTree() {
auto leaves = this->getLeaves();
std::vector<idNode> leaves;
this->getLeavesFromTree(leaves);
return leaves.size();
}

Expand Down Expand Up @@ -249,7 +250,6 @@ namespace ttk {
std::stringstream ss;
ss << "problem, there is " << noRoot << " root(s)";
printErr(ss.str());
this->printTree2();
this->printTree();
}
if(this->isNodeAlone(nodeId))
Expand Down Expand Up @@ -431,6 +431,25 @@ namespace ttk {
ss << std::endl;
}

std::stringstream FTMTree_MT::printSubTree(idNode subRoot) {
std::stringstream ss;
ss << "Nodes----------" << std::endl;
std::queue<idNode> queue;
queue.push(subRoot);
while(!queue.empty()) {
idNode node = queue.front();
queue.pop();

printNodeSS(node, ss);

std::vector<idNode> children;
this->getChildren(node, children);
for(idNode child : children)
queue.push(child);
}
return ss;
}

std::stringstream FTMTree_MT::printTree(bool doPrint) {
std::stringstream ss;
std::vector<idNode> allRoots;
Expand All @@ -440,20 +459,7 @@ namespace ttk {
for(unsigned int i = 0; i < allRoots.size(); ++i) {
if(allRoots.size() != 1)
ss << i << " _ ";
ss << "Nodes----------" << std::endl;
std::queue<idNode> queue;
queue.push(allRoots[i]);
while(!queue.empty()) {
idNode const node = queue.front();
queue.pop();

printNodeSS(node, ss);

std::vector<idNode> children;
this->getChildren(node, children);
for(idNode const child : children)
queue.push(child);
}
ss << this->printSubTree(allRoots[i]).str();
}
if(allRoots.size() == 0)
for(unsigned int i = 0; i < this->getNumberOfNodes(); ++i)
Expand Down
2 changes: 2 additions & 0 deletions core/base/ftmTree/FTMTree_MT.h
Original file line number Diff line number Diff line change
Expand Up @@ -775,6 +775,8 @@ namespace ttk {
template <class dataType>
std::stringstream printMergedRoot(bool doPrint = true);

std::stringstream printSubTree(idNode subRoot);

std::stringstream printTree(bool doPrint = true);

std::stringstream printTreeStats(bool doPrint = true);
Expand Down
5 changes: 0 additions & 5 deletions core/base/ftmTreePP/FTMTreePPUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,6 @@ namespace ttk {
std::vector<std::tuple<SimplexId, SimplexId, dataType>> pairs;
getPersistencePairs<dataType>(tree, pairs);
for(auto pair : pairs) {
if(tree->getNode(std::get<0>(pair))->getOrigin() < std::get<0>(pair)
and tree->getNode(std::get<0>(pair))->getOrigin() >= 0)
tree->getNode(tree->getNode(std::get<0>(pair))->getOrigin())
->setOrigin(std::get<1>(pair));

tree->getNode(std::get<0>(pair))->setOrigin(std::get<1>(pair));
tree->getNode(std::get<1>(pair))->setOrigin(std::get<0>(pair));
}
Expand Down
20 changes: 20 additions & 0 deletions core/base/mergeTreeAutoencoder/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
ttk_add_base_library(mergeTreeAutoencoder
SOURCES
MergeTreeAutoencoder.cpp
MergeTreeAutoencoderUtils.cpp
MergeTreeTorchUtils.cpp
HEADERS
MergeTreeAutoencoder.h
MergeTreeAutoencoderUtils.h
MergeTreeTorchUtils.h
DEPENDS
mergeTreePrincipalGeodesics
geometry
)

if(TTK_ENABLE_TORCH)
target_include_directories(mergeTreeAutoencoder PUBLIC ${TORCH_INCLUDE_DIRS})
target_compile_options(mergeTreeAutoencoder PUBLIC "${TORCH_CXX_FLAGS}")
target_link_libraries(mergeTreeAutoencoder PUBLIC "${TORCH_LIBRARIES}")
target_compile_definitions(mergeTreeAutoencoder PUBLIC TTK_ENABLE_TORCH)
endif()
Loading

0 comments on commit b03fd09

Please sign in to comment.