Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 6 additions & 9 deletions core/base/approximateTopology/ApproximateTopology.h
Original file line number Diff line number Diff line change
Expand Up @@ -1067,12 +1067,10 @@ bool ttk::ApproximateTopology::printPolarity(
std::stringstream mymsg;
std::vector<std::pair<polarity, polarity>> &vlp
= vertexLinkPolarity[vertexId];
mymsg << "POLARITY PRINT"
<< "\n";
mymsg << "POLARITY PRINT" << "\n";
mymsg << "vertex " << vertexId << " has "
<< multiresTriangulation_.getVertexNeighborNumber(vertexId)
<< " neighbors"
<< "\n";
<< " neighbors" << "\n";
mymsg << "\tself f:" << fakeScalars[vertexId] << " s:" << scalars[vertexId]
<< " o:" << offsets[vertexId] << " m:" << monotonyOffsets[vertexId]
<< " isnew: " << (int)isNew[vertexId] << "\n";
Expand Down Expand Up @@ -1115,13 +1113,12 @@ bool ttk::ApproximateTopology::printPolarity(
mymsg << " " << i << "th: " << nId << " f:" << fakeScalars[nId]
<< " s:" << scalars[nId] << " o:" << offsets[nId]
<< " m:" << monotonyOffsets[nId] << " , pol:" << (bool)vlp[i].first
<< "(" << (bool)vlp[i].second << ")"
<< " rpol:" << (bool)rpol << " true pol:" << (bool)isUpper
<< " init " << init << " isnew: " << (int)isNew[nId] << "\n";
<< "(" << (bool)vlp[i].second << ")" << " rpol:" << (bool)rpol
<< " true pol:" << (bool)isUpper << " init " << init
<< " isnew: " << (int)isNew[nId] << "\n";
if((rpol == isUpper and !vlp2.empty())
or (isUpper != vlp[i].first and !vlp[i].second)) {
mymsg << "POLARITY ERROR "
<< "\n";
mymsg << "POLARITY ERROR " << "\n";
error = true;
}
}
Expand Down
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 @@ -253,16 +253,16 @@ int ttk::DepthImageBasedGeometryApproximation::execute(
triangleDistortions[triangleDistortionOffset++]
= isNaN(i0Depth) || isNaN(i2Depth) || isNaN(i1Depth)
? myNan
: std::max(
absDiff(i0Depth, i1Depth),
std::max(absDiff(i1Depth, i2Depth), absDiff(i0Depth, i2Depth)));
: std::max(absDiff(i0Depth, i1Depth),
std::max(absDiff(i1Depth, i2Depth),
absDiff(i0Depth, i2Depth)));

triangleDistortions[triangleDistortionOffset++]
= isNaN(i1Depth) || isNaN(i2Depth) || isNaN(i3Depth)
? myNan
: std::max(
absDiff(i1Depth, i3Depth),
std::max(absDiff(i3Depth, i2Depth), absDiff(i2Depth, i1Depth)));
: std::max(absDiff(i1Depth, i3Depth),
std::max(absDiff(i3Depth, i2Depth),
absDiff(i2Depth, i1Depth)));
}
}
}
Expand Down
7 changes: 4 additions & 3 deletions core/base/discreteMorseSandwich/DiscreteMorseSandwich.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,10 @@ void ttk::DiscreteMorseSandwich::displayStats(
std::count_if(pairs.begin(), pairs.end(),
[](const PersistencePair &a) { return a.type == 0; }))},
{" #Saddle-saddle pairs",
std::to_string(dim == 3 ? std::count_if(
pairs.begin(), pairs.end(),
[](const PersistencePair &a) { return a.type == 1; })
std::to_string(dim == 3 ? std::count_if(pairs.begin(), pairs.end(),
[](const PersistencePair &a) {
return a.type == 1;
})
: 0)},
{" #Saddle-max pairs",
std::to_string(std::count_if(
Expand Down
51 changes: 26 additions & 25 deletions core/base/discreteMorseSandwich/DiscreteMorseSandwich.h
Original file line number Diff line number Diff line change
Expand Up @@ -699,31 +699,32 @@ void ttk::DiscreteMorseSandwich::getMaxSaddlePairs(
const auto dim = this->dg_.getDimensionality();

auto saddle2ToMaxima
= dim == 3
? getSaddle2ToMaxima(
criticalSaddles,
[&triangulation](const SimplexId a, const SimplexId i, SimplexId &r) {
return triangulation.getTriangleStar(a, i, r);
},
[&triangulation](const SimplexId a) {
return triangulation.getTriangleStarNumber(a);
},
[&triangulation](const SimplexId a) {
return triangulation.isTriangleOnBoundary(a);
},
triangulation)
: getSaddle2ToMaxima(
criticalSaddles,
[&triangulation](const SimplexId a, const SimplexId i, SimplexId &r) {
return triangulation.getEdgeStar(a, i, r);
},
[&triangulation](const SimplexId a) {
return triangulation.getEdgeStarNumber(a);
},
[&triangulation](const SimplexId a) {
return triangulation.isEdgeOnBoundary(a);
},
triangulation);
= dim == 3 ? getSaddle2ToMaxima(
criticalSaddles,
[&triangulation](
const SimplexId a, const SimplexId i, SimplexId &r) {
return triangulation.getTriangleStar(a, i, r);
},
[&triangulation](const SimplexId a) {
return triangulation.getTriangleStarNumber(a);
},
[&triangulation](const SimplexId a) {
return triangulation.isTriangleOnBoundary(a);
},
triangulation)
: getSaddle2ToMaxima(
criticalSaddles,
[&triangulation](
const SimplexId a, const SimplexId i, SimplexId &r) {
return triangulation.getEdgeStar(a, i, r);
},
[&triangulation](const SimplexId a) {
return triangulation.getEdgeStarNumber(a);
},
[&triangulation](const SimplexId a) {
return triangulation.isEdgeOnBoundary(a);
},
triangulation);

Timer tmseq{};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,8 @@ int ttk::DistanceMatrixDistortion::execute(
}

#ifdef TTK_ENABLE_OPENMP
#pragma omp parallel for num_threads(this->threadNumber_) reduction(max \
: maxi) \
schedule(dynamic)
#pragma omp parallel for num_threads(this->threadNumber_) \
reduction(max : maxi) schedule(dynamic)
#endif // TTK_ENABLE_OPENMP
for(size_t i = 0; i < n; i++) {
for(size_t j = i + 1; j < n; j++) {
Expand All @@ -62,7 +61,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
86 changes: 43 additions & 43 deletions core/base/ftmTree/FTMTree_CT_Template.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,61 +100,61 @@ namespace ttk {
this->printMsg({"- final number of nodes :", nbNodes});
}
}
// clang-format on
// clang format fail to use the right indentation level
// here, but it break the code if not disabled...
// clang-format on
// clang format fail to use the right indentation level
// here, but it break the code if not disabled...

// ------------------------------------------------------------------------
// ------------------------------------------------------------------------

template <class triangulationType>
int FTMTree_CT::leafSearch(const triangulationType *mesh) {
const auto nbScalars = scalars_->size;
const auto chunkSize = getChunkSize();
const auto chunkNb = getChunkCount();
template <class triangulationType>
int FTMTree_CT::leafSearch(const triangulationType *mesh) {
const auto nbScalars = scalars_->size;
const auto chunkSize = getChunkSize();
const auto chunkNb = getChunkCount();

// Extrema extract and launch tasks
for(SimplexId chunkId = 0; chunkId < chunkNb; ++chunkId) {
// Extrema extract and launch tasks
for(SimplexId chunkId = 0; chunkId < chunkNb; ++chunkId) {
#ifdef TTK_ENABLE_OPENMP4
#pragma omp task firstprivate(chunkId)
#endif
{
const SimplexId lowerBound = chunkId * chunkSize;
const SimplexId upperBound
= std::min(nbScalars, (chunkId + 1) * chunkSize);
for(SimplexId v = lowerBound; v < upperBound; ++v) {
const auto &neighNumb = mesh->getVertexNeighborNumber(v);
valence upval = 0;
valence downval = 0;

for(valence n = 0; n < neighNumb; ++n) {
SimplexId neigh{-1};
mesh->getVertexNeighbor(v, n, neigh);
if(scalars_->isLower(neigh, v)) {
++downval;
} else {
++upval;
{
const SimplexId lowerBound = chunkId * chunkSize;
const SimplexId upperBound
= std::min(nbScalars, (chunkId + 1) * chunkSize);
for(SimplexId v = lowerBound; v < upperBound; ++v) {
const auto &neighNumb = mesh->getVertexNeighborNumber(v);
valence upval = 0;
valence downval = 0;

for(valence n = 0; n < neighNumb; ++n) {
SimplexId neigh{-1};
mesh->getVertexNeighbor(v, n, neigh);
if(scalars_->isLower(neigh, v)) {
++downval;
} else {
++upval;
}
}

jt_.setValence(v, downval);
st_.setValence(v, upval);

if(!downval) {
jt_.makeNode(v);
}

if(!upval) {
st_.makeNode(v);
}
}
}

jt_.setValence(v, downval);
st_.setValence(v, upval);

if(!downval) {
jt_.makeNode(v);
}

if(!upval) {
st_.makeNode(v);
}
}
}
}

#ifdef TTK_ENABLE_OPENMP4
#pragma omp taskwait
#endif
return 0;
}
return 0;
}

} // namespace ftm
} // namespace ftm
} // namespace ttk
22 changes: 14 additions & 8 deletions core/base/implicitTriangulation/ImplicitTriangulation.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,29 +110,33 @@ namespace ttk {

virtual int getTetrahedronEdge(const SimplexId &tetId,
const int &id,
SimplexId &edgeId) const = 0;
SimplexId &edgeId) const
= 0;

int getTetrahedronEdges(std::vector<std::vector<SimplexId>> &edges) const;

virtual int getTetrahedronTriangle(const SimplexId &tetId,
const int &id,
SimplexId &triangleId) const = 0;
SimplexId &triangleId) const
= 0;

int getTetrahedronTriangles(
std::vector<std::vector<SimplexId>> &triangles) const;

virtual int getTetrahedronNeighbor(const SimplexId &tetId,
const int &localNeighborId,
SimplexId &neighborId) const = 0;
SimplexId &neighborId) const
= 0;

virtual SimplexId
getTetrahedronNeighborNumber(const SimplexId &tetId) const = 0;
virtual SimplexId getTetrahedronNeighborNumber(const SimplexId &tetId) const
= 0;

int getTetrahedronNeighbors(std::vector<std::vector<SimplexId>> &neighbors);

virtual int getTetrahedronVertex(const SimplexId &tetId,
const int &localVertexId,
SimplexId &vertexId) const = 0;
SimplexId &vertexId) const
= 0;

SimplexId getTriangleEdgeNumberInternal(
const SimplexId & /*triangleId*/) const override {
Expand All @@ -155,10 +159,12 @@ namespace ttk {

virtual int getTriangleNeighbor(const SimplexId &triangleId,
const int &localNeighborId,
SimplexId &neighborId) const = 0;
SimplexId &neighborId) const
= 0;

virtual SimplexId
getTriangleNeighborNumber(const SimplexId &triangleId) const = 0;
getTriangleNeighborNumber(const SimplexId &triangleId) const
= 0;

int getTriangleNeighbors(std::vector<std::vector<SimplexId>> &neighbors);

Expand Down
Loading
Loading