Skip to content
Snippets Groups Projects
Commit 5f7333fc authored by Armin Damon Riess's avatar Armin Damon Riess
Browse files

nodes can now access root

parent 76bda61d
No related branches found
No related tags found
No related merge requests found
......@@ -17,7 +17,7 @@ Node::Node() {
}
*/
Node::Node(Node* parent, double* masses, double* particles, unsigned nParticles, unsigned depth, double size, double center[3], unsigned* localParticles, unsigned nLocalParticles) {
Node::Node(Node* root, Node* parent, double* masses, double* particles, unsigned nParticles, unsigned depth, double size, double center[3], unsigned* localParticles, unsigned nLocalParticles) {
parent_ = parent;
particles_ = particles;
nParticles_ = nParticles;
......
......@@ -7,7 +7,7 @@ public:
Node() = default;
// whoever creates the node is responsible for deciding which particles are in which octant and for allocating the localParticles array
// node will write to localParticles array
Node(Node* parent, double* masses, double* particles, unsigned nParticles, unsigned depth, double size, double center[3], unsigned* localParticles, unsigned nLocalParticles);
Node(Node* root, Node* parent, double* masses, double* particles, unsigned nParticles, unsigned depth, double size, double center[3], unsigned* localParticles, unsigned nLocalParticles);
// destuctor
~Node();
// copy constructor
......
......@@ -13,7 +13,7 @@ Tree::Tree(double* masses, double* particles, double* forces, unsigned nParticle
for (unsigned i=0; i < nParticles_; ++i) localParticles_[i] = i;
root_ = new Node();
*root_ = Node(root_, masses_, particles_, nParticles_, 0, size_, center_, localParticles_, nParticles_);
*root_ = Node(root_, root_, masses_, particles_, nParticles_, 0, size_, center_, localParticles_, nParticles_);
}
Tree::~Tree() {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment