/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2026 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
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 .
Class
Foam::boundSphere
Description
The smallest sphere enclosing a given set of points
SourceFiles
boundSphereI.H
boundSphereTemplates.C
\*---------------------------------------------------------------------------*/
#ifndef boundSphere_H
#define boundSphere_H
#include "point.H"
#include "nil.H"
#include "randomGenerator.H"
#include "RemoteData.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Forward declaration of friend functions and operators
class boundSphere;
bool operator==(const boundSphere&, const boundSphere&);
bool operator!=(const boundSphere&, const boundSphere&);
Istream& operator>>(Istream&, boundSphere&);
Ostream& operator<<(Ostream&, const boundSphere&);
/*---------------------------------------------------------------------------*\
Class boundSphere Declaration
\*---------------------------------------------------------------------------*/
class boundSphere
{
// Private Data
//- The centre
point c_;
//- The radius squared
scalar rSqr_;
// Private Type Definitions
//- For a given List type, return the corresponding UList-type
template
using PointUList =
typename std::conditional
<
std::is_base_of, PointList>::value,
UList,
typename std::conditional
<
std::is_base_of, PointList>::value,
UIndirectList,
nil
>::type
>::type;
// Private Classes
//- A structure to manage a fixed set of local points and a growing
// list of added remote points and provides indexing into these sets
// as if they were in a single contiguous list. It is used when
// constructing global bound spheres. A global bound sphere is
// calculated by first constructing the local bound sphere and then
// synchronising the limiting set of outermost points. These points
// are then added to the list and the process is repeated until
// no more points are added and all processes arrive at the same
// set of boundary points.
template
class LocalAndRemotePoints
{
const PointList& locals_;
DynamicList> remotes_;
HashTable