TTK
Loading...
Searching...
No Matches
core
base
common
BaseClass.cpp
Go to the documentation of this file.
1
#include <
BaseClass.h
>
2
3
#ifdef TTK_ENABLE_OPENMP
4
COMMON_EXPORTS
int
ttk::globalThreadNumber_
= omp_get_max_threads();
5
#else
6
COMMON_EXPORTS
int
ttk::globalThreadNumber_
= 1;
7
#endif
8
9
COMMON_EXPORTS
int
ttk::MPIrank_
= -1;
10
COMMON_EXPORTS
int
ttk::MPIsize_
= -1;
11
#ifdef TTK_ENABLE_MPI
12
COMMON_EXPORTS
MPI_Comm ttk::MPIcomm_;
13
#endif
14
15
using namespace
ttk
;
16
17
BaseClass::BaseClass
() : lastObject_{false}, wrapper_{nullptr} {
18
threadNumber_
=
ttk::globalThreadNumber_
;
19
20
#ifdef TTK_ENABLE_MPI
21
if
(
ttk::MPIrank_
== -1) {
22
int
flag;
23
MPI_Initialized(&flag);
24
if
(flag) {
25
MPI_Comm_rank(MPI_COMM_WORLD, &
ttk::MPIrank_
);
26
MPI_Comm_size(MPI_COMM_WORLD, &
ttk::MPIsize_
);
27
MPI_Comm_dup(MPI_COMM_WORLD, &ttk::MPIcomm_);
28
}
else
{
29
ttk::MPIrank_
= 0;
30
ttk::MPIsize_
= 0;
31
}
32
}
33
#endif
// TTK_ENABLE_MPI
34
}
35
36
int
BaseClass::setWrapper
(
const
Wrapper
*wrapper) {
37
wrapper_
=
const_cast<
Wrapper
*
>
(wrapper);
38
39
// dynamic_cast is impossible because the Wrapper class is incomplete
40
setThreadNumber
(
reinterpret_cast<
BaseClass
*
>
(
wrapper_
)->
threadNumber_
);
41
return
0;
42
}
BaseClass.h
COMMON_EXPORTS
#define COMMON_EXPORTS
Definition
BaseClass.h:31
ttk::BaseClass
TTK base package.
Definition
BaseClass.h:70
ttk::BaseClass::setWrapper
virtual int setWrapper(const Wrapper *wrapper)
Definition
BaseClass.cpp:36
ttk::BaseClass::threadNumber_
int threadNumber_
Definition
BaseClass.h:95
ttk::BaseClass::BaseClass
BaseClass()
Definition
BaseClass.cpp:17
ttk::BaseClass::setThreadNumber
virtual int setThreadNumber(const int threadNumber)
Definition
BaseClass.h:80
ttk::BaseClass::wrapper_
Wrapper * wrapper_
Definition
BaseClass.h:96
ttk::Wrapper
Wrapper class to wrap ttk code.
Definition
Wrapper.h:14
ttk
The Topology ToolKit.
Definition
AbstractTriangulation.h:51
ttk::MPIsize_
COMMON_EXPORTS int MPIsize_
Definition
BaseClass.cpp:10
ttk::globalThreadNumber_
COMMON_EXPORTS int globalThreadNumber_
Definition
BaseClass.cpp:6
ttk::MPIrank_
COMMON_EXPORTS int MPIrank_
Definition
BaseClass.cpp:9
Generated on Thu Sep 26 2024 06:50:17 for TTK by
1.9.8