1
0

Node.h 723 B

12345678910111213141516171819202122232425
  1. #include <vector>
  2. /*
  3. Node class for the Barnes-Hut tree. The choice of pointers as opposed
  4. to references is driven by the necessity to interact with Numpy arrays
  5. using ctypes.
  6. */
  7. class Node{
  8. private:
  9. double COM[3]; // Center of mass
  10. double m; // Mass of the node
  11. double size; // Size of box, equal for all dimensions
  12. std::vector<Node*> children;
  13. public:
  14. double g[3]; // Gravitational acceleration on the node
  15. // Constructors
  16. Node(const std::vector<Node*> &pBodies, const double pSize,
  17. const double px, const double py, const double pz);
  18. Node(const double* pr_vec, const double pm);
  19. // Methods
  20. void treeWalk(const Node &node, const double thetamax, const double soft);
  21. };