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
53
#ifndef TREE_HPP
#define TREE_HPP
#include <vector>
#include <cstdlib>
#include <string>
#include <pthread.h>
#include <stack>
#include "Body.hpp"
#include "Box.hpp"
namespace nbody {
using namespace std;
class Node;
class Simulation;
class Tree {
friend class Node;
friend class PthreadSimulation;
friend class ContinuousPthreadSimulation;
protected:
Node* nodes;
unsigned int maxLeafBodies;
int parallelId;
Simulation* simulation;
public:
Tree(int parallelId);
virtual ~Tree();
virtual void setSimulation(Simulation* simulation);
virtual void clean();
virtual void build(vector<Body> bodies) = 0;
virtual void build(vector<Body> bodies, Box domain) = 0;
virtual int numberOfChildren() = 0;
virtual unsigned long numberOfNodes();
virtual bool isCorrect();
virtual void accumulateForceOnto(Body& body);
virtual void computeForces();
virtual vector<Body> extractLocalBodies();
virtual vector<Body> copyRefinements(Box domain);
virtual void rebuild(Box domain);
virtual void rebuild(Box domain, vector<Body> bodies);
virtual void rebuild();
virtual Box getRootBB();
virtual void print(int parallelId);
virtual Box advance();
virtual Box getLocalBB();
};
}
#endif