Skip to content
Snippets Groups Projects
Commit 0f4bd471 authored by Paul Heinzlreiter's avatar Paul Heinzlreiter
Browse files

* node representation

parent 1fb38c2f
Branches
No related merge requests found
......@@ -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;
}
......
#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();
};
......
......@@ -133,6 +133,12 @@ namespace nbody {
return true;
}
void TreeNode::update() {
if (this->leaf) {
}
}
void TreeNode::print() {
this->bb.print();
for (vector<Body>::iterator it = this->bodies.begin(); it != this->bodies.end(); it++) {
......
......@@ -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();
};
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment