TTK
Loading...
Searching...
No Matches
ArrayPreconditioning.h
Go to the documentation of this file.
1
9
10#pragma once
11
12// ttk common includes
13#include <Debug.h>
14
15#include <vector>
16namespace ttk {
17
22 class ArrayPreconditioning : virtual public Debug {
23
24 public:
26
27 template <typename DT, typename GVGID, typename GVR, typename GVLID>
29 const DT *scalarArray,
30 const GVGID &getVertexGlobalId,
31 const GVR &getVertexRank,
32 const GVLID &getVertexLocalId,
33 const size_t nVerts,
34 const int burstSize,
35 std::vector<int> neighbors
36 = {}) const { // start global timer
37 ttk::Timer globalTimer;
38
39 // print horizontal separator
40 this->printMsg(ttk::debug::Separator::L1); // L1 is the '=' separator
41 // print input parameters in table format
42 this->printMsg({
43 {"#Threads", std::to_string(this->threadNumber_)},
44 {"#Vertices", std::to_string(nVerts)},
45 });
47
48// -----------------------------------------------------------------------
49// Computing order Array
50// -----------------------------------------------------------------------
51#ifdef TTK_ENABLE_MPI
52 if(ttk::isRunningWithMPI()) {
53 ttk::produceOrdering<DT>(orderArray, scalarArray, getVertexGlobalId,
54 getVertexRank, getVertexLocalId, nVerts,
55 burstSize, neighbors);
56 }
57#else
58 this->printMsg("MPI not enabled!");
59 TTK_FORCE_USE(orderArray);
60 TTK_FORCE_USE(scalarArray);
61 TTK_FORCE_USE(getVertexGlobalId);
62 TTK_FORCE_USE(getVertexRank);
63 TTK_FORCE_USE(getVertexLocalId);
64 TTK_FORCE_USE(burstSize);
65 TTK_FORCE_USE(neighbors);
66 return 0;
67#endif
68
69 // ---------------------------------------------------------------------
70 // print global performance
71 // ---------------------------------------------------------------------
72 {
73 this->printMsg(ttk::debug::Separator::L2); // horizontal '-' separator
74 this->printMsg(
75 "Complete", 1, globalTimer.getElapsedTime() // global progress, time
76 );
77 this->printMsg(ttk::debug::Separator::L1); // horizontal '=' separator
78 }
79
80 return 1; // return success
81 }
82
83 protected:
84 bool GlobalOrder{false};
85 }; // ArrayPreconditioning class
86
87} // namespace ttk
#define TTK_FORCE_USE(x)
Force the compiler to use the function/method parameter.
Definition: BaseClass.h:57
int processScalarArray(ttk::SimplexId *orderArray, const DT *scalarArray, const GVGID &getVertexGlobalId, const GVR &getVertexRank, const GVLID &getVertexLocalId, const size_t nVerts, const int burstSize, std::vector< int > neighbors={}) const
int threadNumber_
Definition: BaseClass.h:95
Minimalist debugging class.
Definition: Debug.h:88
int printMsg(const std::string &msg, const debug::Priority &priority=debug::Priority::INFO, const debug::LineMode &lineMode=debug::LineMode::NEW, std::ostream &stream=std::cout) const
Definition: Debug.h:118
double getElapsedTime()
Definition: Timer.h:15
The Topology ToolKit.
int SimplexId
Identifier type for simplices of any dimension.
Definition: DataTypes.h:22