TTK
Loading...
Searching...
No Matches
core
base
ftrGraph
FTRCommon.h
Go to the documentation of this file.
1
2
//
7
8
#pragma once
9
10
#include "
FTRDataTypes.h
"
11
12
#include <
Debug.h
>
13
14
#include <iostream>
15
#include <numeric>
16
#include <vector>
17
18
namespace
ttk
{
19
namespace
ftr {
20
// Compute parameters (global)
21
struct
Params
{
22
bool
singleSweep
=
false
;
23
bool
segm
=
true
;
24
bool
normalize
=
true
;
25
bool
advStats
=
true
;
26
int
samplingLvl
= 0;
27
28
int
threadNumber
= 1;
29
int
debugLevel
= 1;
30
31
void
printSelf
() {
32
Debug
dbg{};
33
dbg.
setDebugMsgPrefix
(
"FTRGraph"
);
34
dbg.setDebugLevel(
debugLevel
);
35
dbg.printMsg(std::vector<std::vector<std::string>>{
36
{
"#Threads"
, std::to_string(
threadNumber
)},
37
{
"Debug level"
, std::to_string(
debugLevel
)},
38
{
"Segmentation"
, std::to_string(
segm
)},
39
{
"Sampling level"
, std::to_string(
samplingLvl
)},
40
});
41
}
42
};
43
47
class
Allocable
:
virtual
public
Debug
{
48
protected
:
50
idVertex
nbElmt_
= nullVertex;
51
52
public
:
53
void
setNumberOfElmt
(
const
idVertex
nbVerts) {
54
nbElmt_
= nbVerts;
55
}
56
57
template
<
typename
type>
58
void
fillVector
(std::vector<type> &vect,
const
type &elmt) {
59
const
std::size_t nbIt = vect.size();
60
#ifdef TTK_ENABLE_OPENMP
61
#pragma omp parallel for schedule(dynamic)
62
#endif
63
for
(std::size_t i = 0; i < nbIt; i++) {
64
vect[i] = elmt;
65
}
66
}
67
68
virtual
void
alloc
() = 0;
69
70
virtual
void
init
() = 0;
71
};
72
73
}
// namespace ftr
74
}
// namespace ttk
Debug.h
FTRDataTypes.h
ttk::Debug
Minimalist debugging class.
Definition
Debug.h:88
ttk::Debug::setDebugMsgPrefix
void setDebugMsgPrefix(const std::string &prefix)
Definition
Debug.h:364
ttk::ftr::Allocable
Definition
FTRCommon.h:47
ttk::ftr::Allocable::setNumberOfElmt
void setNumberOfElmt(const idVertex nbVerts)
Definition
FTRCommon.h:53
ttk::ftr::Allocable::alloc
virtual void alloc()=0
ttk::ftr::Allocable::fillVector
void fillVector(std::vector< type > &vect, const type &elmt)
Definition
FTRCommon.h:58
ttk::ftr::Allocable::init
virtual void init()=0
ttk::ftr::Allocable::nbElmt_
idVertex nbElmt_
Allocation may depends on the number of vertices.
Definition
FTRCommon.h:50
ttk::ftr::idVertex
SimplexId idVertex
Vertex index in scalars_.
Definition
FTRDataTypes.h:29
ttk
The Topology ToolKit.
Definition
AbstractTriangulation.h:51
ttk::ftr::Params
Definition
FTRCommon.h:21
ttk::ftr::Params::samplingLvl
int samplingLvl
Definition
FTRCommon.h:26
ttk::ftr::Params::segm
bool segm
Definition
FTRCommon.h:23
ttk::ftr::Params::printSelf
void printSelf()
Definition
FTRCommon.h:31
ttk::ftr::Params::threadNumber
int threadNumber
Definition
FTRCommon.h:28
ttk::ftr::Params::normalize
bool normalize
Definition
FTRCommon.h:24
ttk::ftr::Params::debugLevel
int debugLevel
Definition
FTRCommon.h:29
ttk::ftr::Params::advStats
bool advStats
Definition
FTRCommon.h:25
ttk::ftr::Params::singleSweep
bool singleSweep
Definition
FTRCommon.h:22
Generated on Thu Sep 26 2024 06:50:18 for TTK by
1.9.8