PhoenixGraph
01.2.3
Set of tools to simplify graph manipulation
Toggle main menu visibility
Loading...
Searching...
No Matches
PNTreeLight_impl.h
Go to the documentation of this file.
1
/***************************************
2
Auteur : Pierre Aubert
3
Mail : pierre.aubert@lapp.in2p3.fr
4
Licence : CeCILL-C
5
****************************************/
6
7
#ifndef __PNTREELIGHT_H_IMPL__
8
#define __PNTREELIGHT_H_IMPL__
9
10
#include <string.h>
11
12
#include "
PNTreeLight.h
"
13
15
template
<
typename
T,
typename
U,
unsigned
char
N>
16
PNTreeLight<T,U,N>::PNTreeLight
(){
17
p_sizeLimit
= 1e-5;
18
}
19
21
25
template
<
typename
T,
typename
U,
unsigned
char
N>
26
PNTreeLight<T,U,N>::PNTreeLight
(T pos[N], T size[N], T sizeLimit){
27
initialisationPNTreeLight
(pos, size, sizeLimit);
28
}
29
31
33
template
<
typename
T,
typename
U,
unsigned
char
N>
34
PNTreeLight<T,U,N>::PNTreeLight
(
const
PNTreeLight<T,U,N>
& other){
35
copyPNTreeLight
(other);
36
}
37
39
template
<
typename
T,
typename
U,
unsigned
char
N>
40
PNTreeLight<T,U,N>::~PNTreeLight
(){
41
p_node
.clear();
42
}
43
45
48
template
<
typename
T,
typename
U,
unsigned
char
N>
49
bool
PNTreeLight<T, U, N>::saveGnuplotData
(
const
std::string & fileName){
50
return
p_node
.saveGnuplotData(fileName,
p_pos
,
p_size
);
51
}
52
54
58
template
<
typename
T,
typename
U,
unsigned
char
N>
59
bool
PNTreeLight<T, U, N>::saveGnuplotData
(std::ofstream & fs, T height){
60
return
p_node
.saveGnuplotData(fs, height,
p_pos
,
p_size
);
61
}
62
64
66
template
<
typename
T,
typename
U,
unsigned
char
N>
67
void
PNTreeLight<T, U, N>::setPosition
(T pos[N]){
68
memcpy(
p_pos
, pos, N*
sizeof
(T));
69
}
70
72
74
template
<
typename
T,
typename
U,
unsigned
char
N>
75
void
PNTreeLight<T, U, N>::setSize
(T size[N]){
76
memcpy(
p_size
, size, N*
sizeof
(T));
77
}
78
80
82
template
<
typename
T,
typename
U,
unsigned
char
N>
83
void
PNTreeLight<T, U, N>::setLimitSize
(T limitSize){
84
p_sizeLimit
= limitSize;
85
}
86
88
92
template
<
typename
T,
typename
U,
unsigned
char
N>
93
bool
PNTreeLight<T, U, N>::addElement
(T * posData, U * data){
94
return
p_node
.addElement(posData, data,
p_pos
,
p_size
,
p_sizeLimit
);
95
}
96
98
101
template
<
typename
T,
typename
U,
unsigned
char
N>
102
const
U *
PNTreeLight<T, U, N>::getLastData
(T * posData)
const
{
103
return
p_node
.getLastData(posData,
p_pos
,
p_size
);
104
}
105
107
110
template
<
typename
T,
typename
U,
unsigned
char
N>
111
const
U *
PNTreeLight<T, U, N>::getCloserData
(T * posData)
const
{
112
unsigned
int
nbNeighbours(
PPower<3, N>::Value
);
113
bool
tabNeighbour[nbNeighbours];
114
for
(
unsigned
int
i(0u); i < nbNeighbours; ++i){
115
tabNeighbour[i] =
false
;
116
}
117
tabNeighbour[nbNeighbours/2] =
true
;
//The cell of the current node
118
U * closerData = NULL;
119
T distFromCloserData = 0.0;
120
p_node
.getCloserData(closerData, distFromCloserData, tabNeighbour, nbNeighbours, posData,
p_pos
,
p_size
);
121
return
closerData;
122
}
123
125
129
template
<
typename
T,
typename
U,
unsigned
char
N>
130
const
U *
PNTreeLight<T, U, N>::getCloserDataDist
(T & distFromCloserData, T * posData)
const
{
131
unsigned
int
nbNeighbours(
PPower<3, N>::Value
);
132
bool
tabNeighbour[nbNeighbours];
133
for
(
unsigned
int
i(0u); i < nbNeighbours; ++i){
134
tabNeighbour[i] =
false
;
135
}
136
tabNeighbour[nbNeighbours/2] =
true
;
//The cell of the current node
137
U * closerData = NULL;
138
distFromCloserData = 0.0;
139
p_node
.getCloserData(closerData, distFromCloserData, tabNeighbour, nbNeighbours, posData,
p_pos
,
p_size
);
140
return
closerData;
141
}
142
144
147
template
<
typename
T,
typename
U,
unsigned
char
N>
148
PNTreeLight<T,U,N>
&
PNTreeLight<T,U,N>::operator =
(
const
PNTreeLight<T,U,N>
& other){
149
copyPNTreeLight
(other);
150
return
*
this
;
151
}
152
154
156
template
<
typename
T,
typename
U,
unsigned
char
N>
157
void
PNTreeLight<T,U,N>::copyPNTreeLight
(
const
PNTreeLight<T,U,N>
& other){
158
159
}
160
162
166
template
<
typename
T,
typename
U,
unsigned
char
N>
167
void
PNTreeLight<T,U,N>::initialisationPNTreeLight
(T pos[N], T size[N], T sizeLimit){
168
setPosition
(pos);
169
setSize
(size);
170
p_sizeLimit
= sizeLimit;
171
}
172
173
174
175
176
177
#endif
178
179
180
PNTreeLight.h
PNTreeLight::setPosition
void setPosition(T pos[N])
Set the position of the PNTreeLight.
Definition
PNTreeLight_impl.h:67
PNTreeLight::~PNTreeLight
virtual ~PNTreeLight()
Destructeur of PNTreeLight.
Definition
PNTreeLight_impl.h:40
PNTreeLight::operator=
PNTreeLight & operator=(const PNTreeLight< T, U, N > &other)
Definition of equal operator of PNTreeLight.
Definition
PNTreeLight_impl.h:148
PNTreeLight::PNTreeLight
PNTreeLight()
Default constructeur of PNTreeLight.
Definition
PNTreeLight_impl.h:16
PNTreeLight::saveGnuplotData
bool saveGnuplotData(const std::string &fileName)
Saves the PNTreeLight into a txt file for gnuplot.
Definition
PNTreeLight_impl.h:49
PNTreeLight::p_pos
T p_pos[N]
Position of the hyper cube.
Definition
PNTreeLight.h:41
PNTreeLight::p_sizeLimit
T p_sizeLimit
Size limit of the cells.
Definition
PNTreeLight.h:45
PNTreeLight::getLastData
const U * getLastData(T *posData) const
Get the data of the last node in the N tree.
Definition
PNTreeLight_impl.h:102
PNTreeLight::copyPNTreeLight
void copyPNTreeLight(const PNTreeLight< T, U, N > &other)
Copy function of PNTreeLight.
Definition
PNTreeLight_impl.h:157
PNTreeLight::p_size
T p_size[N]
Size of the hyper cube.
Definition
PNTreeLight.h:43
PNTreeLight::p_node
PNTreeLightNode< T, U, N > p_node
Table of the children of the current node.
Definition
PNTreeLight.h:47
PNTreeLight::getCloserData
const U * getCloserData(T *posData) const
Get the closer data from the given position.
Definition
PNTreeLight_impl.h:111
PNTreeLight::setSize
void setSize(T size[N])
Set the size of the PNTreeLight.
Definition
PNTreeLight_impl.h:75
PNTreeLight::getCloserDataDist
const U * getCloserDataDist(T &distFromCloserData, T *posData) const
Get the closer data from the given position.
Definition
PNTreeLight_impl.h:130
PNTreeLight::addElement
bool addElement(T *posData, U *data)
Add an element in the PNTreeLightNode.
Definition
PNTreeLight_impl.h:93
PNTreeLight::setLimitSize
void setLimitSize(T limitSize)
Set the limit size of the PNTreeLight cells.
Definition
PNTreeLight_impl.h:83
PNTreeLight::initialisationPNTreeLight
void initialisationPNTreeLight(T pos[N], T size[N], T sizeLimit)
Initialisation function of the class PNTreeLight.
Definition
PNTreeLight_impl.h:167
PPower::Value
@ Value
Definition
pstatic_computation.h:22
src
Tree
PNTreeLight_impl.h
Generated by
1.17.0