triPoints.H
Go to the documentation of this file.
1/*---------------------------------------------------------------------------*\
2 ========= |
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4 \\ / O peration |
5 \\ / A nd | www.openfoam.com
6 \\/ M anipulation |
7-------------------------------------------------------------------------------
8 Copyright (C) 2015 OpenFOAM Foundation
9 Copyright (C) 2017-2020 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
12 This file is part of OpenFOAM.
13
14 OpenFOAM is free software: you can redistribute it and/or modify it
15 under the terms of the GNU General Public License as published by
16 the Free Software Foundation, either version 3 of the License, or
17 (at your option) any later version.
18
19 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 for more details.
23
24 You should have received a copy of the GNU General Public License
25 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26
27Class
28 Foam::triPoints
29
30Description
31 Triangle storage. Null constructable (unfortunately triangle<point, point>
32 is not)
33
34SourceFiles
35
36\*---------------------------------------------------------------------------*/
37
38#ifndef triPoints_H
39#define triPoints_H
40
41#include "FixedList.H"
42#include "treeBoundBox.H"
43
44// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45
46namespace Foam
47{
48
49/*---------------------------------------------------------------------------*\
50 Class triPoints Declaration
51\*---------------------------------------------------------------------------*/
53class triPoints
54:
55 public FixedList<point, 3>
56{
57public:
58
59 // Constructors
60
61 //- Default construct
62 inline triPoints()
63 {}
64
65 //- Construct from points
66 inline triPoints
67 (
68 const point& a,
69 const point& b,
70 const point& c
71 )
72 {
73 operator[](0) = a;
74 operator[](1) = b;
75 operator[](2) = c;
76 }
77
78 //- Copy construct from subset of points
79 inline triPoints
80 (
81 const UList<point>& points,
82 const FixedList<label, 3>& indices
83 )
84 :
85 FixedList<point, 3>(points, indices)
86 {}
87
88
89 // Member Functions
90
91 //- Calculate the bounding box
92 inline treeBoundBox bounds() const
93 {
94 treeBoundBox bb(operator[](0));
95 for (label i = 1; i < size(); ++i)
96 {
97 bb.add(operator[](i));
98 }
99 return bb;
100 }
101};
102
103
104// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
105
106} // End namespace Foam
107
108// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
109
110#endif
111
112// ************************************************************************* //
A 1D vector of objects of type <T> with a fixed length <N>.
Definition: FixedList.H:81
static constexpr label size() noexcept
Return the number of elements in the FixedList.
Definition: FixedList.H:416
point & operator[](const label i)
Return element of FixedList.
Definition: FixedListI.H:412
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
Definition: UList.H:94
void add(const boundBox &bb)
Extend to include the second box.
Definition: boundBoxI.H:191
Standard boundBox with extra functionality for use in octree.
Definition: treeBoundBox.H:89
Triangle storage. Null constructable (unfortunately triangle<point, point> is not)
Definition: triPoints.H:55
triPoints()
Default construct.
Definition: triPoints.H:61
treeBoundBox bounds() const
Calculate the bounding box.
Definition: triPoints.H:91
triPoints(const UList< point > &points, const FixedList< label, 3 > &indices)
Copy construct from subset of points.
Definition: triPoints.H:79
triPoints(const point &a, const point &b, const point &c)
Construct from points.
Definition: triPoints.H:66
const pointField & points
Namespace for OpenFOAM.
volScalarField & b
Definition: createFields.H:27