/*---------------------------------------------------------------------------*\ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2019-2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. OpenFOAM is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. OpenFOAM is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenFOAM. If not, see . \*---------------------------------------------------------------------------*/ #include "dynamicIndexedOctree.H" #include "line.H" #include "OFstream.H" #include "ListOps.H" // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // template void Foam::dynamicIndexedOctree::divide ( const labelUList& indices, const treeBoundBox& bb, FixedList, 8>& dividedIndices ) const { const label presize = (indices.size()/8); for (direction octant = 0; octant < 8; ++octant) { const treeBoundBox subBbs(bb.subBbox(octant)); auto& contains = dividedIndices[octant]; contains.clear(); contains.reserve_nocopy(presize); for (const label index : indices) { if (shapes_.overlaps(index, subBbs)) { contains.append(index); } } } } template Foam::dynamicIndexedOctreeBase::node Foam::dynamicIndexedOctree::divide ( const treeBoundBox& bb, label contentIndex, const label parentNodeIndex, const label octantToBeDivided ) { if ( bb.min().x() >= bb.max().x() || bb.min().y() >= bb.max().y() || bb.min().z() >= bb.max().z() ) { FatalErrorInFunction << "Badly formed bounding box:" << bb << abort(FatalError); } // Divide the indices into 8 (possibly empty) subsets. // Replace current contentIndex with the first (non-empty) subset. // Append the rest. const DynamicList