Skip to content
Snippets Groups Projects
Commit 32fd64cc authored by Armin Damon Riess's avatar Armin Damon Riess
Browse files

remove max depth

parent 2fb0bc58
No related branches found
No related tags found
No related merge requests found
......@@ -57,16 +57,6 @@ void Node::update(List localParticles, unsigned nLocalParticles) {
updateMassAndCOM();
isLeaf_ = true;
if (depth_ >= maxDepth_) {
// if the node contains less than minNParticles, it is a leaf
// std::cout << "max depth reached, nLocalParticles = " << nLocalParticles << std::endl;
for (unsigned i=0; i<8; ++i) {
delete children_[i];
children_[i] = nullptr;
}
return;
}
for (unsigned i=0; i<8; ++i) {
if (children_[i] != nullptr) {
// if child is not a nullptr and particleDivision[i] contains too few particles, delete the child
......@@ -86,7 +76,7 @@ void Node::update(List localParticles, unsigned nLocalParticles) {
double childSize = size_/2;
Vector childCenter(3);
for (unsigned j=0; j<3; ++j) {
childCenter[j] = center_[j] + (i & (1 << (2-j)) ? childSize : -childSize);
childCenter[j] = center_[j] + (i & (1 << j) ? childSize : -childSize);
}
children_[i] = new Node(mass_, positions_, nParticles_, softening_, depth_+1,
childSize, childCenter, childParticles_[i], childParticles_[i].size());
......@@ -225,15 +215,15 @@ unsigned Node::getOctant(unsigned particle) {
double px = positions_[3*particle + 0];
double py = positions_[3*particle + 1];
double pz = positions_[3*particle + 2];
if (px < center_[0]) {
if (px < center_[2]) {
if (py < center_[1]) {
if (pz < center_[2]) {
if (pz < center_[0]) {
return 0;
} else {
return 1;
}
} else {
if (pz < center_[2]) {
if (pz < center_[0]) {
return 2;
} else {
return 3;
......@@ -241,13 +231,13 @@ unsigned Node::getOctant(unsigned particle) {
}
} else {
if (py < center_[1]) {
if (pz < center_[2]) {
if (pz < center_[0]) {
return 4;
} else {
return 5;
}
} else {
if (pz < center_[2]) {
if (pz < center_[0]) {
return 6;
} else {
return 7;
......
......@@ -60,8 +60,7 @@ private:
double totalMass_;
const double theta0_ = 0.0;
const double minNParticles_ = 32;
const double maxDepth_ = 24;
const double minNParticles_ = 8;
bool isLeaf_;
};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment