Skip to content

Commit

Permalink
clang-formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
julien-tierny committed Jun 7, 2024
1 parent 1461cfe commit 1dbee0c
Show file tree
Hide file tree
Showing 24 changed files with 101 additions and 77 deletions.
4 changes: 3 additions & 1 deletion core/base/arrayPreconditioning/ArrayPreconditioning.h
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,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
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
18 changes: 12 additions & 6 deletions core/base/common/welcomeMsg.inl
Original file line number Diff line number Diff line change
Expand Up @@ -13,31 +13,37 @@ printMsg(
debug::LineMode::NEW,
stream);
printMsg(debug::output::BOLD
//+ "|_ _|_ _| |/ / / /__\\ \\ |___ \\ / _ " "\\___ \\|___ /"
+ "|_ _|_ _| |/ / / /__\\ \\ |___ \\ / _ \\___ \\| || |"
//+ "|_ _|_ _| |/ / / /__\\ \\ |___ \\ / _ "
//"\\___ \\|___ /"
+ "|_ _|_ _| |/ / / /__\\ \\ |___ \\ / _ "
"\\___ \\| || |"
+ debug::output::ENDCOLOR,
debug::Priority::PERFORMANCE,
debug::LineMode::NEW,
stream);
printMsg(
debug::output::BOLD
//+ " | | | | | ' / | |/ __| | __) | | | |__) | |_ \\"
//+ " | | | | | ' / | |/ __| | __) | | | |__) | |_
//\\"
+ " | | | | | ' / | |/ __| | __) | | | |__) | || |_"
+ debug::output::ENDCOLOR,
debug::Priority::PERFORMANCE,
debug::LineMode::NEW,
stream);
printMsg(
debug::output::BOLD
// + " | | | | | . \\ | | (__| | / __/| |_| / __/ ___) |"
// + " | | | | | . \\ | | (__| | / __/| |_| / __/
// ___) |"
+ " | | | | | . \\ | | (__| | / __/| |_| / __/|__ _|"
+ debug::output::ENDCOLOR,
debug::Priority::PERFORMANCE,
debug::LineMode::NEW,
stream);
printMsg(debug::output::BOLD
// + " |_| |_| |_|\\_\\ | |\\___| | " "|_____|\\___/_____|____/"
+ " |_| |_| |_|\\_\\ | |\\___| | |_____|\\___/_____| |_|"
// + " |_| |_| |_|\\_\\ | |\\___| | "
// "|_____|\\___/_____|____/"
+ " |_| |_| |_|\\_\\ | |\\___| | "
"|_____|\\___/_____| |_|"
+ debug::output::ENDCOLOR,
debug::Priority::PERFORMANCE,
debug::LineMode::NEW,
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 @@ -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
8 changes: 3 additions & 5 deletions core/base/implicitTriangulation/ImplicitTriangulation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2969,11 +2969,9 @@ int ttk::ImplicitTriangulation::preconditionDistributedCells() {
localBBox_z_max{this->localGridOffset_[2]};

#ifdef TTK_ENABLE_OPENMP
#pragma omp parallel for reduction( \
min \
: localBBox_x_min, localBBox_y_min, localBBox_z_min) \
reduction(max \
: localBBox_x_max, localBBox_y_max, localBBox_z_max)
#pragma omp parallel for reduction( \
min : localBBox_x_min, localBBox_y_min, localBBox_z_min) \
reduction(max : localBBox_x_max, localBBox_y_max, localBBox_z_max)
#endif
for(SimplexId lcid = 0; lcid < nLocCells; ++lcid) {
// only keep non-ghost cells
Expand Down
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
8 changes: 5 additions & 3 deletions core/base/integralLines/IntegralLines.h
Original file line number Diff line number Diff line change
Expand Up @@ -708,8 +708,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 Expand Up @@ -865,7 +865,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
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
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
3 changes: 1 addition & 2 deletions core/base/mergeTreeClustering/MergeTreeClustering.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
/// href="https://topology-tool-kit.github.io/examples/mergeTreeWAE/">Merge
/// Tree Wasserstein Auto-Encoder example</a> \n


#define treesMatchingVector \
std::vector<std::vector<std::tuple<ftm::idNode, ftm::idNode, double>>>
#define matchingVectorType std::vector<treesMatchingVector>
Expand Down Expand Up @@ -275,7 +274,7 @@ namespace ttk {
#ifdef TTK_ENABLE_OPENMP4
#pragma omp parallel for schedule(dynamic) \
shared(centroids, centroids2, oldCentroids_, oldCentroids2_) \
num_threads(this->threadNumber_) if(parallelize_)
num_threads(this->threadNumber_) if(parallelize_)
#endif
for(unsigned int i = 0; i < centroids.size(); ++i) {
std::vector<std::tuple<ftm::idNode, ftm::idNode, double>> matching,
Expand Down
4 changes: 2 additions & 2 deletions core/base/mergeTreeClustering/MergeTreeDistance.h
Original file line number Diff line number Diff line change
Expand Up @@ -930,7 +930,7 @@ namespace ttk {
#ifdef TTK_ENABLE_OPENMP4
#pragma omp task firstprivate(taskQueue, nodeT) UNTIED() \
shared(treeTable, forestTable, treeBackTable, forestBackTable, \
treeChildDone, treeNodeDone) if(isTree1)
treeChildDone, treeNodeDone) if(isTree1)
{
#endif
ftm::FTMTree_MT *treeT = (isTree1) ? tree1 : tree2;
Expand Down Expand Up @@ -1084,7 +1084,7 @@ namespace ttk {
#ifdef TTK_ENABLE_OPENMP4
#pragma omp task firstprivate(nodeT) UNTIED() \
shared(treeTable, forestTable, treeBackTable, forestBackTable, \
treeChildDone, treeNodeDone)
treeChildDone, treeNodeDone)
{
#endif
while((int)nodeT != -1) {
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
Original file line number Diff line number Diff line change
Expand Up @@ -677,11 +677,9 @@ int PeriodicImplicitTriangulation::preconditionDistributedCells() {
localBBox_z_max{this->localGridOffset_[2]};
const auto &dims{this->metaGrid_->getGridDimensions()};
#ifdef TTK_ENABLE_OPENMP
#pragma omp parallel for reduction( \
min \
: localBBox_x_min, localBBox_y_min, localBBox_z_min) \
reduction(max \
: localBBox_x_max, localBBox_y_max, localBBox_z_max)
#pragma omp parallel for reduction( \
min : localBBox_x_min, localBBox_y_min, localBBox_z_min) \
reduction(max : localBBox_x_max, localBBox_y_max, localBBox_z_max)
#endif
for(SimplexId lcid = 0; lcid < nLocCells; ++lcid) {
// only keep non-ghost cells
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,28 +113,32 @@ 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;

SimplexId getTetrahedronNeighborNumber(const SimplexId &tetId) const;

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 &ttkNotUsed(triangleId)) const override {
Expand All @@ -157,7 +161,8 @@ namespace ttk {

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

SimplexId getTriangleNeighborNumber(const SimplexId &triangleId) const;

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++) {
double const delta_lim = delta_lim_;
Expand Down Expand Up @@ -88,7 +89,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
Loading

0 comments on commit 1dbee0c

Please sign in to comment.