Skip to content

Commit

Permalink
Merge pull request #1089 from thom-dani/critical-point-tracking
Browse files Browse the repository at this point in the history
Critical point tracking
  • Loading branch information
julien-tierny authored Feb 8, 2025
2 parents 7c38d09 + afe3a72 commit ab0369c
Show file tree
Hide file tree
Showing 25 changed files with 1,079 additions and 75 deletions.
4 changes: 3 additions & 1 deletion core/base/arrayPreconditioning/ArrayPreconditioning.h
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,9 @@ namespace ttk {
std::vector<globalOrder::vertexToSort<DT>> verticesToSort;
verticesToSort.reserve(nVerts);
#ifdef TTK_ENABLE_OPENMP
#pragma omp declare reduction (merge : std::vector<globalOrder::vertexToSort<DT>> : omp_out.insert(omp_out.end(), omp_in.begin(), omp_in.end()))
#pragma omp declare reduction( \
merge : std::vector<globalOrder::vertexToSort<DT>> : omp_out.insert( \
omp_out.end(), omp_in.begin(), omp_in.end()))
#pragma omp parallel for reduction(merge : verticesToSort) schedule(static)
#endif
for(size_t i = 0; i < nVerts; i++) {
Expand Down
1 change: 1 addition & 0 deletions core/base/assignmentSolver/AssignmentAuction.h
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,7 @@ namespace ttk {
initFirstRound();
while(not stoppingCriterion(this->costMatrix)) {
initBiddersAndGoods();

runAuctionRound(this->costMatrix);

dataType cost = getMatchingDistance(this->costMatrix);
Expand Down
6 changes: 4 additions & 2 deletions core/base/clusteringMetrics/ClusteringMetrics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,8 @@ int ttk::ClusteringMetrics::computeARI(

double sumNChooseContingency = 0;
#ifdef TTK_ENABLE_OPENMP
#pragma omp parallel for num_threads(this->threadNumber_) reduction(+:sumNChooseContingency)
#pragma omp parallel for num_threads(this->threadNumber_) \
reduction(+ : sumNChooseContingency)
#endif // TTK_ENABLE_OPENMP
for(size_t i1 = 0; i1 < nCluster1; i1++) {
for(size_t i2 = 0; i2 < nCluster2; i2++)
Expand Down Expand Up @@ -165,7 +166,8 @@ int ttk::ClusteringMetrics::computeNMI(
double mutualInfo = 0;
bool invalidCell = false;
#ifdef TTK_ENABLE_OPENMP
#pragma omp parallel for num_threads(this->threadNumber_) reduction(+:mutualInfo)
#pragma omp parallel for num_threads(this->threadNumber_) \
reduction(+ : mutualInfo)
#endif // TTK_ENABLE_OPENMP
for(size_t i1 = 0; i1 < nCluster1; i1++) {
for(size_t i2 = 0; i2 < nCluster2; i2++) {
Expand Down
2 changes: 1 addition & 1 deletion core/base/common/Os.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#include <string>
#include <vector>

//#define SINGLE_PRECISION
// #define SINGLE_PRECISION

#ifdef SINGLE_PRECISION
#define REAL_TYPE float
Expand Down
6 changes: 3 additions & 3 deletions core/base/contourAroundPoint/ContourAroundPoint.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -251,9 +251,9 @@ int ttk::ContourAroundPoint::execute() const {

// The following open-mp processing is only relevant for
// embarrassingly parallel algorithms.
//#ifdef TTK_ENABLE_OPENMP
//#pragma omp parallel for num_threads(threadNumber_)
//#endif
// #ifdef TTK_ENABLE_OPENMP
// #pragma omp parallel for num_threads(threadNumber_)
// #endif
for(size_t p = 0; p < _inpPtsNum; ++p) {
handleOneInpPt<scalarT>(
findInpFldVert(p), _inpPtsIsovals[p], _inpPtsFlags[p], _inpPtsScalars[p]);
Expand Down
6 changes: 3 additions & 3 deletions core/base/contourTreeAlignment/CTA_contourtree.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ namespace ttk {

namespace cta {

//#####################################################################################################################
// enums and structs for tree data structure
// #####################################################################################################################
// enums and structs for tree data structure

//=====================================================================================================================
// node types of a contour tree
Expand Down Expand Up @@ -174,7 +174,7 @@ namespace ttk {
int segId;
};

///#####################################################################################################################
/// #####################################################################################################################
// class for an unrooted contour tree

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ int ttk::DistanceMatrixDistortion::execute(
double totalSum = 0;

#ifdef TTK_ENABLE_OPENMP
#pragma omp parallel for num_threads(this->threadNumber_), reduction(+:totalSum)
#pragma omp parallel for num_threads(this->threadNumber_), \
reduction(+ : totalSum)
#endif // TTK_ENABLE_OPENMP
for(size_t i = 0; i < n; i++) {
double sum = 0;
Expand Down
4 changes: 3 additions & 1 deletion core/base/integralLines/IntegralLines.h
Original file line number Diff line number Diff line change
Expand Up @@ -870,7 +870,9 @@ int ttk::IntegralLines::getGlobalIdentifiers(
ttk::SimplexId intervalSize;
// Counts vertices and edges number (with and without ghosts)
#ifdef TTK_ENABLE_OPENMP4
#pragma omp parallel for reduction(+:outputVertexNumber,outputCellNumber,realCellNumber,realVertexNumber) schedule(static,1) private(intervalSize)
#pragma omp parallel for reduction(+ : outputVertexNumber, outputCellNumber, \
realCellNumber, realVertexNumber) \
schedule(static, 1) private(intervalSize)
#endif
for(int thread = 0; thread < threadNumber_; thread++) {
std::list<std::array<ttk::intgl::IntegralLine,
Expand Down
9 changes: 5 additions & 4 deletions core/base/mergeTreeAutoencoder/MergeTreeAutoencoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1280,8 +1280,9 @@ bool ttk::MergeTreeAutoencoder::forwardStep(
mtu::TorchMergeTree<float> dummyTMT;
bool reset = false;
#ifdef TTK_ENABLE_OPENMP
#pragma omp parallel for schedule(dynamic) num_threads(this->threadNumber_) \
if(parallelize_) reduction(||: reset) reduction(+:loss)
#pragma omp parallel for schedule(dynamic) \
num_threads(this->threadNumber_) if(parallelize_) reduction(|| : reset) \
reduction(+ : loss)
#endif
for(unsigned int ind = 0; ind < indexes.size(); ++ind) {
unsigned int i = indexes[ind];
Expand Down Expand Up @@ -1488,8 +1489,8 @@ float ttk::MergeTreeAutoencoder::computeLoss(
if(useDoubleInput_)
matchings2.resize(trees2.size());
#ifdef TTK_ENABLE_OPENMP
#pragma omp parallel for schedule(dynamic) num_threads(this->threadNumber_) \
if(parallelize_) reduction(+:loss)
#pragma omp parallel for schedule(dynamic) \
num_threads(this->threadNumber_) if(parallelize_) reduction(+ : loss)
#endif
for(unsigned int ind = 0; ind < indexes.size(); ++ind) {
unsigned int i = indexes[ind];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ namespace ttk {
matchings.resize(inputTrees.size());
dataType reconstructionError = 0.0;
#ifdef TTK_ENABLE_OPENMP
#pragma omp parallel for schedule(dynamic) num_threads(this->threadNumber_) reduction(+:reconstructionError)
#pragma omp parallel for schedule(dynamic) num_threads(this->threadNumber_) \
reduction(+ : reconstructionError)
#endif
for(unsigned int i = 0; i < inputTrees.size(); ++i) {
ftm::MergeTree<dataType> reconstructedTree;
Expand Down
6 changes: 4 additions & 2 deletions core/base/persistenceDiagramClustering/PDBarycenter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ void ttk::PDBarycenter::runMatching(

double local_cost = *total_cost;
#ifdef TTK_ENABLE_OPENMP
#pragma omp parallel for num_threads(threadNumber_) schedule(dynamic, 1) reduction(+:local_cost)
#pragma omp parallel for num_threads(threadNumber_) schedule(dynamic, 1) \
reduction(+ : local_cost)
#endif
for(int i = 0; i < numberOfInputs_; i++) {
PersistenceDiagramAuction auction(
Expand Down Expand Up @@ -87,7 +88,8 @@ void ttk::PDBarycenter::runMatchingAuction(
bool actual_distance) {
double local_cost = *total_cost;
#ifdef TTK_ENABLE_OPENMP
#pragma omp parallel for num_threads(threadNumber_) schedule(dynamic, 1) reduction(+:local_cost)
#pragma omp parallel for num_threads(threadNumber_) schedule(dynamic, 1) \
reduction(+ : local_cost)
#endif
for(int i = 0; i < numberOfInputs_; i++) {
PersistenceDiagramAuction auction(
Expand Down
8 changes: 4 additions & 4 deletions core/base/topologicalCompression/TopologicalCompression.h
Original file line number Diff line number Diff line change
Expand Up @@ -505,16 +505,16 @@ int ttk::TopologicalCompression::ReadFromFile(
// [fm->] Read data.
char *buf = reinterpret_cast<char *>(dest);

//#ifndef _MSC_VER
// FILE *fm = fmemopen(buf, destLen, "r+");
//#else
// #ifndef _MSC_VER
// FILE *fm = fmemopen(buf, destLen, "r+");
// #else
const std::string s = fileName + std::string(".temp");
const char *ffn = s.c_str();
FILE *ftemp = fopen(ffn, "wb");
fwrite(buf, destLen, sizeof(char), ftemp);
fclose(ftemp);
FILE *fm = fopen(ffn, "rb");
//#endif
// #endif

// Do read topology.
if(!(ZFPOnly)) {
Expand Down
10 changes: 10 additions & 0 deletions core/base/trackingFromCriticalPoints/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
ttk_add_base_library(trackingFromCriticalPoints
SOURCES
TrackingFromCriticalPoints.cpp
HEADERS
TrackingFromCriticalPoints.h
DEPENDS
assignmentSolver
persistenceDiagram
triangulation
)
Loading

0 comments on commit ab0369c

Please sign in to comment.