diff --git a/bh_tree_mpi/datastructures/Body.cpp b/bh_tree_mpi/datastructures/Body.cpp index 37dd95e4ea273c400b05f09c413910c3e9e51ba9..f0558c8950982856b226e53236fc5345cb44f123 100644 --- a/bh_tree_mpi/datastructures/Body.cpp +++ b/bh_tree_mpi/datastructures/Body.cpp @@ -116,6 +116,19 @@ namespace nbody { return this->position[index]; } + double Body::getMass() { + return this->weight; + } + + void Body::setPosition(int index, double value) { + this->position[index] = value; + } + + void Body::setMass(double value) { + this->weight = value; + } + + void Body::print() { cout << this->position[0] << " " << this->position[1] << " " << this->position[2] << endl; } diff --git a/bh_tree_mpi/datastructures/Body.hpp b/bh_tree_mpi/datastructures/Body.hpp index 9e22e400de2ec41b81f40221bc664eb912723c95..09b023e02c35777e3536c1ec74af7a711d3c07ac 100644 --- a/bh_tree_mpi/datastructures/Body.hpp +++ b/bh_tree_mpi/datastructures/Body.hpp @@ -1,6 +1,7 @@ #ifndef BODY_HPP #define BODY_HPP + namespace nbody { static const double timestep = 1.0; class Derivative; @@ -21,6 +22,9 @@ namespace nbody { Body(double positionX, double positionY, double positionZ, double velocityX, double velocityY, double velocityZ, double weight); virtual ~Body(); virtual double getPosition(int index); + virtual double getMass(); + virtual void setPosition(int index, double value); + virtual void setMass(double value); virtual void integrate(); virtual void print(); }; diff --git a/bh_tree_mpi/datastructures/TreeNode.cpp b/bh_tree_mpi/datastructures/TreeNode.cpp index 026230a58f7c1f70fe25691c90fc564b0fa890b3..7af400e307fb37f019bada0e249dc2e9266a85fd 100644 --- a/bh_tree_mpi/datastructures/TreeNode.cpp +++ b/bh_tree_mpi/datastructures/TreeNode.cpp @@ -133,6 +133,12 @@ namespace nbody { return true; } + void TreeNode::update() { + if (this->leaf) { + + } + } + void TreeNode::print() { this->bb.print(); for (vector::iterator it = this->bodies.begin(); it != this->bodies.end(); it++) { diff --git a/bh_tree_mpi/datastructures/TreeNode.hpp b/bh_tree_mpi/datastructures/TreeNode.hpp index 73d1124695015bc2d5c53d3875946c510b9f80ce..ee48bf7fd710f36d72a70ea9733ea496569463df 100644 --- a/bh_tree_mpi/datastructures/TreeNode.hpp +++ b/bh_tree_mpi/datastructures/TreeNode.hpp @@ -24,6 +24,7 @@ namespace nbody { TreeNode* afterSubtree; bool leaf; Tree* tree; + Body representative; public: TreeNode(Tree* tree); virtual ~TreeNode(); @@ -35,6 +36,7 @@ namespace nbody { virtual void insertBefore(TreeNode* node); virtual void insertAfter(TreeNode* node); virtual void unlink(); + virtual void update(); virtual bool isCorrect(); virtual void print(); };