boundSphere.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2022 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 Description
25  Functions for constructing bounding spheres of lists of points
26 
27 SourceFiles
28  boundSphere.C
29  boundSphereTemplates.C
30 
31 \*---------------------------------------------------------------------------*/
32 
33 #ifndef boundSphere_H
34 #define boundSphere_H
35 
36 #include "point.H"
37 #include "Random.H"
38 
39 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
40 
41 namespace Foam
42 {
43 
44 //- Return whether or not the given sphere is valid
45 inline bool isValidBoundSphere(const Tuple2<point, scalar>& sphere);
46 
47 //- Compute a sphere of four points or less where every point intersects the
48 // sphere's surface
49 template<class PointField>
51 (
52  const PointField& ps,
53  const FixedList<label, 4>& pis,
54  const label nPs
55 );
56 
57 //- Compute a bounding sphere of four points or less
58 template<class PointField>
60 (
61  const PointField& ps,
62  const FixedList<label, 4>& pis,
63  const label nPs
64 );
65 
66 //- Compute a bounding sphere for an arbitrary number of points recursively
67 // using Weizl's algorithm
68 template<class PointField>
70 (
71  const PointField& ps,
72  List<label>& pis,
73  const label nPs,
74  FixedList<label, 4>& boundaryPis,
75  const label nBoundaryPs
76 );
77 
78 //- Compute a bounding sphere for an arbitrary number of points, and given an
79 // engine with which to randomise Weizl's algorithm
80 template<class PointField>
82 
83 //- Compute a bounding sphere for an arbitrary number of points
84 template<class PointField>
86 
87 } // End namespace Foam
88 
89 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
90 
91 #ifdef NoRepository
92  #include "boundSphereTemplates.C"
93 #endif
94 
95 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
96 
97 #endif
98 
99 // ************************************************************************* //
Random number generator.
Definition: Random.H:58
A 2-tuple for storing two objects of different types.
Definition: Tuple2.H:63
Namespace for OpenFOAM.
bool isValidBoundSphere(const Tuple2< point, scalar > &sphere)
Return whether or not the given sphere is valid.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
Tuple2< point, scalar > intersectBoundSphere(const PointField &ps, const FixedList< label, 4 > &pis, const label nPs)
Compute a sphere of four points or less where every point intersects the.
Tuple2< point, scalar > boundSphere(const PointField &ps, Random &rndGen)
Compute a bounding sphere for an arbitrary number of points, and given an.
Tuple2< point, scalar > trivialBoundSphere(const PointField &ps, const FixedList< label, 4 > &pis, const label nPs)
Compute a bounding sphere of four points or less.
Tuple2< point, scalar > weizlBoundSphere(const PointField &ps, List< label > &pis, const label nPs, FixedList< label, 4 > &boundaryPis, const label nBoundaryPs)
Compute a bounding sphere for an arbitrary number of points recursively.
Random rndGen(label(0))