Skip to content

Commit

Permalink
Merge pull request #12870 from KratosMultiphysics/core/fix-octree-bin…
Browse files Browse the repository at this point in the history
…ary-cell-

[Core] Fix `GetLeavesInBoundingBoxNormalized`, where coordinates were not properly computed
  • Loading branch information
loumalouomega authored Nov 26, 2024
2 parents 5ab2fa0 + 5571d62 commit 55ec898
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions kratos/spatial_containers/octree_binary.h
Original file line number Diff line number Diff line change
Expand Up @@ -376,17 +376,15 @@ namespace Kratos {

double low[3];
double high[3];
child->GetMinPoint(low);
child->GetMaxPoint(high);
if (Collides(coord1, coord2, low, high))
child->GetMinPointNormalized(low);
child->GetMaxPointNormalized(high);
if (Collides(coord1, coord2, low, high)) {
cells_stack.push_back(cell->pGetChild(i));
}
}
} else
leaves.push_back(cell);
}


return;
}


Expand All @@ -400,6 +398,15 @@ namespace Kratos {
(Low2[2] <= High1[2]);
}

bool Collides(const double* Low1, const double* High1, const double* Low2, const double* High2) const
{
return (Low1[0] <= High2[0]) &&
(Low1[1] <= High2[1]) &&
(Low1[2] <= High2[2]) &&
(Low2[0] <= High1[0]) &&
(Low2[1] <= High1[1]) &&
(Low2[2] <= High1[2]);
}

int GetAllLeavesVector(std::vector<cell_type*>& all_leaves) const {
std::vector<cell_type*> cells_stack;
Expand Down Expand Up @@ -1153,6 +1160,4 @@ namespace Kratos {

///@} addtogroup block

} // namespace Kratos.


} // namespace Kratos.

0 comments on commit 55ec898

Please sign in to comment.