PhoenixGraph  01.0.0
Set of tools to simplify graph manipulation
Loading...
Searching...
No Matches
PNTreeLightNode.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 __PNTREE_LIGHT_NODE_H__
8#define __PNTREE_LIGHT_NODE_H__
9
10#include <iostream>
11#include <fstream>
12
13template<typename T, typename U, unsigned char N>
14class PNTreeLightNode;
15
17
21template<typename T, typename U, unsigned char N>
23 public:
25 virtual ~PNTreeLightNode();
26
27 bool addElement(T * posData, U * data, const T pos[N], const T size[N], const T sizeLimit);
28 void clear();
29
30 bool saveGnuplotData(const std::string & fileName, T pos[N], T size[N]);
31 bool saveGnuplotData(std::ofstream & fs, T height, T pos[N], T size[N]);
32
33 const U * getData() const;
34 U * getData();
35
36 const T * getDataPos() const;
37 T * getDataPos();
38
39 const U * getLastData(const T * posData, const T pos[N], const T size[N]) const;
40 bool getCloserData(U*& closerData, T & distFromCloserData, bool * tabIsNeighbourChecked, unsigned int nbNeighbour,
41 const T * posData, const T pos[N], const T size[N]) const;
42
43 const PNTreeLightNode<T, U, N> * getChildFromPos(T childPos[N], const T * posData, const T pos[N], const T size[N]) const;
44 PNTreeLightNode<T, U, N> * getChildFromPos(T childPos[N], const T * posData, const T pos[N], const T size[N]);
45 void getIndexOfChildFromPos(unsigned char index[N], const T posData[N], const T pos[N], const T size[N]) const;
46 void getIndexOfChildFromPos(unsigned char index[N], T posData[N], T pos[N], T size[N]);
47 unsigned char getFullIndexChild(unsigned char index[N]) const;
48
51
52 const PNTreeLightNode<T, U, N> * getChild(unsigned char childId) const;
53 PNTreeLightNode<T, U, N> * getChild(unsigned char childId);
54
55 protected:
57
58 private:
60 bool split(const T pos[N], const T size[N], T sizeLimit);
62
66 U * p_data;
69};
70
71bool isNeighbourSearchFinised(const bool * tabIsNeighbourChecked, unsigned int nbNeighbour);
72
74
75
76#endif
77
bool isNeighbourSearchFinised(const bool *tabIsNeighbourChecked, unsigned int nbNeighbour)
Says is the neighbours search is finised.
Describe a Quad tree.
virtual ~PNTreeLightNode()
Destructeur of PNTreeLightNode.
void getIndexOfChildFromPos(unsigned char index[N], const T posData[N], const T pos[N], const T size[N]) const
void copyPNTreeLightNode(const PNTreeLightNode< T, U, N > &other)
Copy function of PNTreeLightNode.
PNTreeLightNode< T, U, N > * p_tableChildren
Position of the data in the hyper cube.
unsigned char getFullIndexChild(unsigned char index[N]) const
Get the full index position of a child.
PNTreeLightNode()
Default constructor of PNTreeLightNode.
const T * getDataPos() const
Returns the data position.
const PNTreeLightNode< T, U, N > * getChild(unsigned char childId) const
Returns the child of the PNTreeLightNode.
bool addElement(T *posData, U *data, const T pos[N], const T size[N], const T sizeLimit)
Add an element in the PNTreeLightNode.
bool split(const T pos[N], const T size[N], T sizeLimit)
Split the PNTreeLightNode.
void initialisationPNTreeLightNode()
Initialisation function of the class PNTreeLightNode.
void clear()
Clear the PNTreeLightNode content.
bool getCloserData(U *&closerData, T &distFromCloserData, bool *tabIsNeighbourChecked, unsigned int nbNeighbour, const T *posData, const T pos[N], const T size[N]) const
Get the closer data from the given position posData.
const U * getData() const
const PNTreeLightNode< T, U, N > * getTabChildren() const
Returns the table of children of the PNTreeLightNode.
U * p_data
Data of the node.
void getIndexOfChildFromPos(unsigned char index[N], T posData[N], T pos[N], T size[N])
bool saveGnuplotData(const std::string &fileName, T pos[N], T size[N])
Saves the PNTreeLightNode into a txt file for gnuplot.
const U * getLastData(const T *posData, const T pos[N], const T size[N]) const
Get the data of the last node in the N tree.
T * p_posData
Position of the data in the cell.
const PNTreeLightNode< T, U, N > * getChildFromPos(T childPos[N], const T *posData, const T pos[N], const T size[N]) const
Get the child of the PNTreeLightNode with a position.