#include "datastructures/BarnesHutTree.hpp"
#include "parallelization/MpiSimulation.hpp"
#include <iostream>

using namespace nbody;
using namespace std;

int main(int argc, char* argv[]) {
	BarnesHutTree tree;
	MpiSimulation simulation(argc, argv);

	if (argc == 2) {
		vector<Body> bodies = Tree::dubinskiParse(argv[1]);

		cout << bodies.size() << endl;
		tree.build(bodies);
		if (!tree.isCorrect()) {
			cout << "Tree not correct" << endl;
			return -1;
		}
		tree.print();
		tree.computeForces();
		tree.moveBodies();
		tree.rebuildTree();
		if (!tree.isCorrect()) {
			cout << "Tree not correct" << endl;
			return -1;
		}
		tree.print();
	} else {
		std::cout << "You need to specify the body input file." << endl;
	}
	return 0;
}
