TTK
Loading...
Searching...
No Matches
BaseClass.h
Go to the documentation of this file.
1
7
8#pragma once
9
10#ifdef _WIN32
11// enable the `and` and `or` keywords on MSVC
12#include <ciso646>
13#endif // _WIN32
14
15#include <DataTypes.h>
16#include <OpenMP.h>
17#ifdef TTK_ENABLE_MPI
18#define OMPI_SKIP_MPICXX 1
19#include <mpi.h>
20#endif // TTK_ENABLE_MPI
21
22#if defined(_MSC_VER) && defined(TTK_ENABLE_SHARED_BASE_LIBRARIES)
23#if defined(common_EXPORTS)
24// building common.dll
25#define COMMON_EXPORTS __declspec(dllexport)
26// building every other .dll that include this header
27#else
28#define COMMON_EXPORTS __declspec(dllimport)
29#endif // common_EXPORTS
30#else
31#define COMMON_EXPORTS
32#endif // _MSC_VER && TTK_ENABLE_SHARED_BASE_LIBRARIES
33
47#define ttkNotUsed(x)
48
57#define TTK_FORCE_USE(x) (void)(x)
58
59namespace ttk {
60
62 COMMON_EXPORTS extern int MPIrank_;
63 COMMON_EXPORTS extern int MPIsize_;
64#ifdef TTK_ENABLE_MPI
65 COMMON_EXPORTS extern MPI_Comm MPIcomm_;
66#endif
67
68 class Wrapper;
69
70 class BaseClass {
71 public:
72 BaseClass();
73
74 virtual ~BaseClass() = default;
75
76 int getThreadNumber() const {
77 return threadNumber_;
78 }
79
80 virtual int setThreadNumber(const int threadNumber) {
81 threadNumber_ = threadNumber;
82 return 0;
83 }
91 virtual int setWrapper(const Wrapper *wrapper);
92
93 protected:
95 mutable int threadNumber_;
97#ifdef TTK_ENABLE_MPI
98 bool hasMPISupport_{false};
99#endif
100 };
101} // namespace ttk
102#include <MPIUtils.h>
#define COMMON_EXPORTS
Definition: BaseClass.h:31
TTK base package.
Definition: BaseClass.h:70
bool lastObject_
Definition: BaseClass.h:94
virtual int setWrapper(const Wrapper *wrapper)
Definition: BaseClass.cpp:36
int threadNumber_
Definition: BaseClass.h:95
int getThreadNumber() const
Definition: BaseClass.h:76
virtual int setThreadNumber(const int threadNumber)
Definition: BaseClass.h:80
virtual ~BaseClass()=default
Wrapper * wrapper_
Definition: BaseClass.h:96
Wrapper class to wrap ttk code.
Definition: Wrapper.h:14
The Topology ToolKit.
COMMON_EXPORTS int MPIsize_
Definition: BaseClass.cpp:10
COMMON_EXPORTS int globalThreadNumber_
Definition: BaseClass.cpp:6
COMMON_EXPORTS int MPIrank_
Definition: BaseClass.cpp:9