Skip to content

Commit

Permalink
correct format
Browse files Browse the repository at this point in the history
  • Loading branch information
thom-dani committed Jan 6, 2025
1 parent 6963af5 commit 441bc77
Show file tree
Hide file tree
Showing 22 changed files with 157 additions and 167 deletions.
15 changes: 9 additions & 6 deletions core/base/approximateTopology/ApproximateTopology.h
Original file line number Diff line number Diff line change
Expand Up @@ -1067,10 +1067,12 @@ 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 @@ -1113,12 +1115,13 @@ 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
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: 3 additions & 4 deletions core/base/discreteMorseSandwich/DiscreteMorseSandwich.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,9 @@ 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: 25 additions & 26 deletions core/base/discreteMorseSandwich/DiscreteMorseSandwich.h
Original file line number Diff line number Diff line change
Expand Up @@ -699,32 +699,31 @@ 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,8 +41,9 @@ 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 Down
78 changes: 39 additions & 39 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);
jt_.setValence(v, downval);
st_.setValence(v, upval);

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

if(!upval) {
st_.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: 8 additions & 14 deletions core/base/implicitTriangulation/ImplicitTriangulation.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,33 +110,29 @@ 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 @@ -159,12 +155,10 @@ 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
4 changes: 2 additions & 2 deletions core/base/integralLines/IntegralLines.h
Original file line number Diff line number Diff line change
Expand Up @@ -713,8 +713,8 @@ int ttk::IntegralLines::execute(triangulationType *triangulation) {
int const taskNumber = (int)seedNumber_ / chunkSize_;
#ifdef TTK_ENABLE_OPENMP4
#ifdef TTK_ENABLE_MPI
#pragma omp parallel shared( \
ttk::intgl::finishedElement_, toSend_, ttk::intgl::addedElement_) \
#pragma omp parallel shared( \
ttk::intgl::finishedElement_, toSend_, ttk::intgl::addedElement_) \
num_threads(threadNumber_)
{
#else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ namespace ttk {
const IT nVertices = triangulation->getNumberOfVertices();
#ifdef TTK_ENABLE_OPENMP
#pragma omp parallel for num_threads( \
this->threadNumber_) if(nAuthorizedExtremaIndices > 1000)
this->threadNumber_) if(nAuthorizedExtremaIndices > 1000)
#endif // TTK_ENABLE_OPENMP
for(IT i = 0; i < nAuthorizedExtremaIndices; i++)
authorizationMask[authorizedExtremaIndices[i]] = -2;
Expand Down
2 changes: 1 addition & 1 deletion core/base/lowestCommonAncestor/LowestCommonAncestor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ int ttk::LowestCommonAncestor::RMQuery(const int &i, const int &j) const {
// Position of the min in the blocs between the bloc of i and j
min_pos[1] = ((blocJ - blocI) > 1)
? blocMinimumPosition_[blocMinimumValueRMQ_.query(
blocI + 1, blocJ - 1)]
blocI + 1, blocJ - 1)]
: INT_MAX;
// Position of the min in the bloc containing the jth case
min_pos[2]
Expand Down
8 changes: 4 additions & 4 deletions core/base/mandatoryCriticalPoints/MandatoryCriticalPoints.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -469,8 +469,8 @@ int MandatoryCriticalPoints::computePlanarLayout(

for(int i = 0; i < numberOfPoints; i++) {
std::stringstream msg;
msg << " (" << i << ") :" << " x = " << xCoord[i]
<< " y = " << yCoord[i];
msg << " (" << i << ") :"
<< " x = " << xCoord[i] << " y = " << yCoord[i];
this->printMsg(msg.str(), debug::Priority::DETAIL);
}

Expand Down Expand Up @@ -703,8 +703,8 @@ int MandatoryCriticalPoints::enumerateMandatoryExtrema(
for(size_t i = 0; i < mandatoryExtremum.size(); i++) {
std::stringstream msg;
msg << " -> " << pt << " (" << std::setw(3) << std::right << i << ") ";
msg << " \t" << "Vertex " << std::setw(9) << std::left
<< mandatoryExtremum[i];
msg << " \t"
<< "Vertex " << std::setw(9) << std::left << mandatoryExtremum[i];
msg << " \tInterval [ " << std::setw(12) << std::right
<< criticalInterval[i].first << " ; " << std::setprecision(9)
<< std::setw(11) << std::left << criticalInterval[i].second << " ]";
Expand Down
Loading

0 comments on commit 441bc77

Please sign in to comment.