Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#ifndef TREE_NODE_HPP
#define TREE_NODE_HPP
#include "Body.hpp"
#include "Box.hpp"
#include "Tree.hpp"
#include "BarnesHutTree.hpp"
#include <cstdlib>
#include <vector>
namespace nbody {
using namespace std;
class Node {
friend class Tree;
friend class BarnesHutTree;
protected:
Box bb;
vector<Body> bodies;
Node* prev;
Node* next;
Node* nextSibling;
Node* prevSibling;
Node* parent;
Node* afterSubtree;
bool leaf;
Tree* tree;
Body representative;
public:
Node(Tree* tree);
virtual ~Node();
virtual bool isSplitable();
virtual void extendBBforBodies();
virtual void extendBBtoCube();
virtual Box getBB();
virtual void setBB(Box bb);
virtual vector<Body> getBodies();
virtual void insertBefore(Node* node);
virtual void insertAfter(Node* node);
virtual void unlink();
virtual void update();
virtual double getL();
virtual bool isCorrect();
virtual void print(int parallelId);
virtual bool sufficientForBody(Body body);
virtual bool sufficientForBox(Box box);
virtual void setBodies(vector<Body> bodies);
virtual void extractLocalBodiesTo(vector<Body>& bodies);
};
}
#endif