mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
BUG: AABBTree - corrected addressing. Fixes #2028
This commit is contained in:
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2015 OpenFOAM Foundation
|
Copyright (C) 2015 OpenFOAM Foundation
|
||||||
Copyright (C) 2016-2017 OpenCFD Ltd.
|
Copyright (C) 2016-2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -396,22 +396,43 @@ Foam::AABBTree<Type>::AABBTree
|
|||||||
// transfer flattened tree to persistent storage
|
// transfer flattened tree to persistent storage
|
||||||
DynamicList<treeBoundBox> boundBoxes(2*bbs.size());
|
DynamicList<treeBoundBox> boundBoxes(2*bbs.size());
|
||||||
DynamicList<labelList> addressing(2*addr.size());
|
DynamicList<labelList> addressing(2*addr.size());
|
||||||
|
|
||||||
forAll(nodes, nodeI)
|
forAll(nodes, nodeI)
|
||||||
{
|
{
|
||||||
if (nodes[nodeI].first() < 0)
|
if (nodes[nodeI].first() < 0)
|
||||||
{
|
{
|
||||||
boundBoxes.append(bbs[nodeI].first());
|
boundBoxes.append(bbs[nodeI].first());
|
||||||
addressing.append(addr[nodeI + 1]);
|
addressing.append(addr[-(nodes[nodeI].first() + 1)]);
|
||||||
}
|
}
|
||||||
if (nodes[nodeI].second() < 0)
|
if (nodes[nodeI].second() < 0)
|
||||||
{
|
{
|
||||||
boundBoxes.append(bbs[nodeI].second());
|
boundBoxes.append(bbs[nodeI].second());
|
||||||
addressing.append(addr[nodeI + 1]);
|
addressing.append(addr[-(nodes[nodeI].second() + 1)]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
boundBoxes_.transfer(boundBoxes);
|
boundBoxes_.transfer(boundBoxes);
|
||||||
addressing_.transfer(addressing);
|
addressing_.transfer(addressing);
|
||||||
|
|
||||||
|
|
||||||
|
if (0)
|
||||||
|
{
|
||||||
|
bitSet checked(objects.size());
|
||||||
|
for (const auto& box : addressing_)
|
||||||
|
{
|
||||||
|
for (const auto& id : box)
|
||||||
|
{
|
||||||
|
checked.set(id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const label unsetSize = checked.count(false);
|
||||||
|
|
||||||
|
if (unsetSize)
|
||||||
|
{
|
||||||
|
Info<< "*** Problem: IDs not set: " << unsetSize << endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -142,8 +142,7 @@ public:
|
|||||||
AABBTree();
|
AABBTree();
|
||||||
|
|
||||||
//- Construct from components
|
//- Construct from components
|
||||||
// equalBinSize: divide into equal number of elements or
|
// equalBinSize: divide into equal number of elements or equal span
|
||||||
// equal span
|
|
||||||
AABBTree
|
AABBTree
|
||||||
(
|
(
|
||||||
const UList<Type>& objects,
|
const UList<Type>& objects,
|
||||||
@ -171,7 +170,7 @@ public:
|
|||||||
bool pointInside(const point& pt) const;
|
bool pointInside(const point& pt) const;
|
||||||
|
|
||||||
//- Determine whether a bounding box overlaps the tree bounding
|
//- Determine whether a bounding box overlaps the tree bounding
|
||||||
// boxes
|
//- boxes
|
||||||
bool overlaps(const boundBox& bbIn) const;
|
bool overlaps(const boundBox& bbIn) const;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user