From 575da8387255753db4c468d9738fda8e150c2d17 Mon Sep 17 00:00:00 2001
From: "armindamon.riess" <armindamon.riess@uzh.ch>
Date: Wed, 7 Dec 2022 12:45:18 +0100
Subject: [PATCH] tree no longer used to update positions

---
 lib/node.cpp | 12 ++++++++----
 lib/tree.cpp |  8 --------
 lib/tree.hpp |  4 ----
 3 files changed, 8 insertions(+), 16 deletions(-)

diff --git a/lib/node.cpp b/lib/node.cpp
index 23f2b9b..b7ce061 100644
--- a/lib/node.cpp
+++ b/lib/node.cpp
@@ -36,6 +36,7 @@ Node::Node(Node* root, Node* parent, double* masses, double* particles, unsigned
     }
 
     // allocate children
+    // check if child contains no particles, in that case set child to nullptr
     // TODO
 }
 
@@ -63,11 +64,14 @@ Node& Node::operator=(const Node& other) {
 
 double* Node::calculateForce(unsigned particle) {
     // calculate theta
-    double lambda = std::sqrt((center_[0] - particles_[3*particle + 0])*(center_[0] - particles_[3*particle + 0])
-                            + (center_[1] - particles_[3*particle + 1])*(center_[1] - particles_[3*particle + 1])
-                            + (center_[2] - particles_[3*particle + 2])*(center_[2] - particles_[3*particle + 2]));
+    double px = particles_[3*particle + 0];
+    double py = particles_[3*particle + 1];
+    double pz = particles_[3*particle + 2];
+    double lambda = std::sqrt((center_[0] - px)*(center_[0] - px)
+                            + (center_[1] - py)*(center_[1] - py)
+                            + (center_[2] - pz)*(center_[2] - pz));
     double theta = size_/lambda;
-    // if angle too large, calculate force on particle from children
+    // if angle too large, call this function for every child. If a child is a nullptr, calculate force on particle from particles in this node
     // else calculate force on particle from particles in this node
     if (theta > theta0_) {
         // TODO
diff --git a/lib/tree.cpp b/lib/tree.cpp
index 61ccfa1..15a4f9b 100644
--- a/lib/tree.cpp
+++ b/lib/tree.cpp
@@ -27,12 +27,4 @@ void Tree::calculateForce(unsigned particle) {
 
 void Tree::update() {
     // TODO
-}
-
-void Tree::drift(double dt) {
-    // TODO
-}
-
-void Tree::kick(double dt) {
-    // TODO
 }
\ No newline at end of file
diff --git a/lib/tree.hpp b/lib/tree.hpp
index 261647d..deca6eb 100644
--- a/lib/tree.hpp
+++ b/lib/tree.hpp
@@ -14,10 +14,6 @@ public:
     void calculateForce(unsigned particle);
     // update tree: visit each node, check if it needs to be split or merged (for example if a particle has left the region)
     void update();
-    // drift tree: visit each node, update positions
-    void drift(double dt);
-    // kick tree: visit each node, update velocities
-    void kick(double dt);
 private:
     Node* root_;
     double* masses_;
-- 
GitLab