PhoenixGraph  01.0.0
Set of tools to simplify graph manipulation
Loading...
Searching...
No Matches
PNTreeLight< T, U, N > Class Template Reference

Describes only the PNTreeClass tree, without the size. More...

#include <PNTreeLight.h>

Public Member Functions

bool addElement (T *posData, U *data)
 Add an element in the PNTreeLightNode.
 
const U * getCloserData (T *posData) const
 Get the closer data from the given position.
 
const U * getCloserDataDist (T &distFromCloserData, T *posData) const
 Get the closer data from the given position.
 
const U * getLastData (T *posData) const
 Get the data of the last node in the N tree.
 
PNTreeLightoperator= (const PNTreeLight< T, U, N > &other)
 Definition of equal operator of PNTreeLight.
 
 PNTreeLight ()
 Default constructeur of PNTreeLight.
 
 PNTreeLight (T pos[N], T size[N], T sizeLimit=1e-5)
 Default constructeur of PNTreeLight.
 
bool saveGnuplotData (const std::string &fileName)
 Saves the PNTreeLight into a txt file for gnuplot.
 
bool saveGnuplotData (std::ofstream &fs, T height)
 Saves the PNTreeLight into a txt file for gnuplot.
 
void setLimitSize (T limitSize)
 Set the limit size of the PNTreeLight cells.
 
void setPosition (T pos[N])
 Set the position of the PNTreeLight.
 
void setSize (T size[N])
 Set the size of the PNTreeLight.
 
virtual ~PNTreeLight ()
 Destructeur of PNTreeLight.
 

Protected Member Functions

void copyPNTreeLight (const PNTreeLight< T, U, N > &other)
 Copy function of PNTreeLight.
 

Private Member Functions

void initialisationPNTreeLight (T pos[N], T size[N], T sizeLimit)
 Initialisation function of the class PNTreeLight.
 
 PNTreeLight (const PNTreeLight< T, U, N > &other)
 Copy constructor of PNTreeLight.
 

Private Attributes

PNTreeLightNode< T, U, N > p_node
 Table of the children of the current node.
 
p_pos [N]
 Position of the hyper cube.
 
p_size [N]
 Size of the hyper cube.
 
p_sizeLimit
 Size limit of the cells.
 

Detailed Description

template<typename T, typename U, unsigned char N>
class PNTreeLight< T, U, N >

Describes only the PNTreeClass tree, without the size.

Definition at line 14 of file PNTreeLight.h.

Constructor & Destructor Documentation

◆ PNTreeLight() [1/3]

template<typename T, typename U, unsigned char N>
PNTreeLight< T, U, N >::PNTreeLight ( )

Default constructeur of PNTreeLight.

Definition at line 16 of file PNTreeLight_impl.h.

16 {
17 p_sizeLimit = 1e-5;
18}
Describes only the PNTreeClass tree, without the size.
Definition PNTreeLight.h:14
T p_sizeLimit
Size limit of the cells.
Definition PNTreeLight.h:45

References p_sizeLimit.

Referenced by copyPNTreeLight(), operator=(), and PNTreeLight().

+ Here is the caller graph for this function:

◆ PNTreeLight() [2/3]

template<typename T, typename U, unsigned char N>
PNTreeLight< T, U, N >::PNTreeLight ( T pos[N],
T size[N],
T sizeLimit = 1e-5 )

Default constructeur of PNTreeLight.

Parameters
pos: position of the PNTreeLight
size: size of the PNTreeLight
sizeLimit: size limit of the cells

Definition at line 26 of file PNTreeLight_impl.h.

26 {
28}
void initialisationPNTreeLight(T pos[N], T size[N], T sizeLimit)
Initialisation function of the class PNTreeLight.

References initialisationPNTreeLight().

+ Here is the call graph for this function:

◆ ~PNTreeLight()

template<typename T, typename U, unsigned char N>
PNTreeLight< T, U, N >::~PNTreeLight ( )
virtual

Destructeur of PNTreeLight.

Definition at line 40 of file PNTreeLight_impl.h.

40 {
41 p_node.clear();
42}
PNTreeLightNode< T, U, N > p_node
Table of the children of the current node.
Definition PNTreeLight.h:47

References p_node.

◆ PNTreeLight() [3/3]

template<typename T, typename U, unsigned char N>
PNTreeLight< T, U, N >::PNTreeLight ( const PNTreeLight< T, U, N > & other)
private

Copy constructor of PNTreeLight.

Parameters
other: class to copy

Definition at line 34 of file PNTreeLight_impl.h.

34 {
36}
void copyPNTreeLight(const PNTreeLight< T, U, N > &other)
Copy function of PNTreeLight.

References copyPNTreeLight(), and PNTreeLight().

+ Here is the call graph for this function:

Member Function Documentation

◆ addElement()

template<typename T, typename U, unsigned char N>
bool PNTreeLight< T, U, N >::addElement ( T * posData,
U * data )

Add an element in the PNTreeLightNode.

Parameters
posData: position of the data
data: pointer to the data we want to sort
Returns
true on success, false otherwise

Definition at line 93 of file PNTreeLight_impl.h.

93 {
94 return p_node.addElement(posData, data, p_pos, p_size, p_sizeLimit);
95}
T p_pos[N]
Position of the hyper cube.
Definition PNTreeLight.h:41
T p_size[N]
Size of the hyper cube.
Definition PNTreeLight.h:43

References p_node, p_pos, p_size, and p_sizeLimit.

◆ copyPNTreeLight()

template<typename T, typename U, unsigned char N>
void PNTreeLight< T, U, N >::copyPNTreeLight ( const PNTreeLight< T, U, N > & other)
protected

Copy function of PNTreeLight.

Parameters
other: class to copy

Definition at line 157 of file PNTreeLight_impl.h.

157 {
158
159}

References PNTreeLight().

Referenced by operator=(), and PNTreeLight().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getCloserData()

template<typename T, typename U, unsigned char N>
const U * PNTreeLight< T, U, N >::getCloserData ( T * posData) const

Get the closer data from the given position.

Parameters
posData: position we want the closer data
Returns
closer data from the given position

Definition at line 111 of file PNTreeLight_impl.h.

111 {
112 unsigned int nbNeighbours(PPower<3, N>::Value);
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;
121 return closerData;
122}

References p_node, p_pos, p_size, and PPower< V, N >::Value.

◆ getCloserDataDist()

template<typename T, typename U, unsigned char N>
const U * PNTreeLight< T, U, N >::getCloserDataDist ( T & distFromCloserData,
T * posData ) const

Get the closer data from the given position.

Parameters
[out]distFromCloserData: distance from the closer data
posData: position we want the closer data
Returns
closer data from the given position

Definition at line 130 of file PNTreeLight_impl.h.

130 {
131 unsigned int nbNeighbours(PPower<3, N>::Value);
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;
140 return closerData;
141}

References p_node, p_pos, p_size, and PPower< V, N >::Value.

◆ getLastData()

template<typename T, typename U, unsigned char N>
const U * PNTreeLight< T, U, N >::getLastData ( T * posData) const

Get the data of the last node in the N tree.

Parameters
posData: position of the data
Returns
data of the last node in the N tree

Definition at line 102 of file PNTreeLight_impl.h.

102 {
103 return p_node.getLastData(posData, p_pos, p_size);
104}

References p_node, p_pos, and p_size.

◆ initialisationPNTreeLight()

template<typename T, typename U, unsigned char N>
void PNTreeLight< T, U, N >::initialisationPNTreeLight ( T pos[N],
T size[N],
T sizeLimit )
private

Initialisation function of the class PNTreeLight.

Parameters
pos: position of the PNTreeLight
size: size of the PNTreeLight
sizeLimit: limit of the cell size

Definition at line 167 of file PNTreeLight_impl.h.

167 {
169 setSize(size);
171}
void setPosition(T pos[N])
Set the position of the PNTreeLight.
void setSize(T size[N])
Set the size of the PNTreeLight.

References p_sizeLimit, setPosition(), and setSize().

Referenced by PNTreeLight().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ operator=()

template<typename T, typename U, unsigned char N>
PNTreeLight< T, U, N > & PNTreeLight< T, U, N >::operator= ( const PNTreeLight< T, U, N > & other)

Definition of equal operator of PNTreeLight.

Parameters
other: class to copy
Returns
copied class

Definition at line 148 of file PNTreeLight_impl.h.

148 {
150 return *this;
151}

References copyPNTreeLight(), and PNTreeLight().

+ Here is the call graph for this function:

◆ saveGnuplotData() [1/2]

template<typename T, typename U, unsigned char N>
bool PNTreeLight< T, U, N >::saveGnuplotData ( const std::string & fileName)

Saves the PNTreeLight into a txt file for gnuplot.

Parameters
fileName: name of the text file we want to write
Returns
true on success, false otherwise

Definition at line 49 of file PNTreeLight_impl.h.

49 {
50 return p_node.saveGnuplotData(fileName, p_pos, p_size);
51}

References p_node, p_pos, and p_size.

◆ saveGnuplotData() [2/2]

template<typename T, typename U, unsigned char N>
bool PNTreeLight< T, U, N >::saveGnuplotData ( std::ofstream & fs,
T height )

Saves the PNTreeLight into a txt file for gnuplot.

Parameters
fs: text file we want to write
height: height of the quad to draw
Returns
true on success, false otherwise

Definition at line 59 of file PNTreeLight_impl.h.

59 {
60 return p_node.saveGnuplotData(fs, height, p_pos, p_size);
61}

References p_node, p_pos, and p_size.

◆ setLimitSize()

template<typename T, typename U, unsigned char N>
void PNTreeLight< T, U, N >::setLimitSize ( T limitSize)

Set the limit size of the PNTreeLight cells.

Parameters
limitSize: limit size of the PNTreeLight cells

Definition at line 83 of file PNTreeLight_impl.h.

83 {
85}

References p_sizeLimit.

◆ setPosition()

template<typename T, typename U, unsigned char N>
void PNTreeLight< T, U, N >::setPosition ( T pos[N])

Set the position of the PNTreeLight.

Parameters
pos: position of the PNTreeLight

Definition at line 67 of file PNTreeLight_impl.h.

67 {
68 memcpy(p_pos, pos, N*sizeof(T));
69}

References p_pos.

Referenced by initialisationPNTreeLight().

+ Here is the caller graph for this function:

◆ setSize()

template<typename T, typename U, unsigned char N>
void PNTreeLight< T, U, N >::setSize ( T size[N])

Set the size of the PNTreeLight.

Parameters
size: size of the PNTreeLight

Definition at line 75 of file PNTreeLight_impl.h.

75 {
76 memcpy(p_size, size, N*sizeof(T));
77}

References p_size.

Referenced by initialisationPNTreeLight().

+ Here is the caller graph for this function:

Member Data Documentation

◆ p_node

template<typename T, typename U, unsigned char N>
PNTreeLightNode<T,U,N> PNTreeLight< T, U, N >::p_node
private

Table of the children of the current node.

Definition at line 47 of file PNTreeLight.h.

Referenced by addElement(), getCloserData(), getCloserDataDist(), getLastData(), saveGnuplotData(), saveGnuplotData(), and ~PNTreeLight().

◆ p_pos

template<typename T, typename U, unsigned char N>
T PNTreeLight< T, U, N >::p_pos[N]
private

Position of the hyper cube.

Definition at line 41 of file PNTreeLight.h.

Referenced by addElement(), getCloserData(), getCloserDataDist(), getLastData(), saveGnuplotData(), saveGnuplotData(), and setPosition().

◆ p_size

template<typename T, typename U, unsigned char N>
T PNTreeLight< T, U, N >::p_size[N]
private

Size of the hyper cube.

Definition at line 43 of file PNTreeLight.h.

Referenced by addElement(), getCloserData(), getCloserDataDist(), getLastData(), saveGnuplotData(), saveGnuplotData(), and setSize().

◆ p_sizeLimit

template<typename T, typename U, unsigned char N>
T PNTreeLight< T, U, N >::p_sizeLimit
private

Size limit of the cells.

Definition at line 45 of file PNTreeLight.h.

Referenced by addElement(), initialisationPNTreeLight(), PNTreeLight(), and setLimitSize().


The documentation for this class was generated from the following files: