tetPoints.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) 2011-2012 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::tetPoints
29
30Description
31 Tet storage. Null constructable (unfortunately tetrahedron<point, point>
32 is not)
33
34SourceFiles
35
36\*---------------------------------------------------------------------------*/
37
38#ifndef tetPoints_H
39#define tetPoints_H
40
41#include "tetrahedron.H"
42#include "FixedList.H"
43#include "treeBoundBox.H"
44
45// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46
47namespace Foam
48{
49
50/*---------------------------------------------------------------------------*\
51 Class tetPoints Declaration
52\*---------------------------------------------------------------------------*/
54class tetPoints
55:
56 public FixedList<point, 4>
57{
58public:
59
60 // Constructors
61
62 //- Default construct
63 inline tetPoints()
64 {}
65
66 //- Construct from four points
67 inline tetPoints
68 (
69 const point& a,
70 const point& b,
71 const point& c,
72 const point& d
73 )
74 {
75 operator[](0) = a;
76 operator[](1) = b;
77 operator[](2) = c;
78 operator[](3) = d;
79 }
80
81 //- Copy construct from subset of points
82 inline tetPoints
83 (
84 const UList<point>& points,
85 const FixedList<label, 4>& indices
86 )
87 :
88 FixedList<point, 4>(points, indices)
89 {}
90
91
92 // Member Functions
93
94 //- Return the tetrahedron
95 inline tetPointRef tet() const
96 {
97 return tetPointRef
98 (
99 operator[](0),
100 operator[](1),
101 operator[](2),
102 operator[](3)
103 );
104 }
105
106 //- Calculate the bounding box
107 inline treeBoundBox bounds() const
108 {
109 treeBoundBox bb(operator[](0));
110 for (label i = 1; i < size(); ++i)
111 {
112 bb.add(operator[](i));
113 }
114 return bb;
115 }
116};
117
118
119// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
120
121} // End namespace Foam
122
123// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
124
125#endif
126
127// ************************************************************************* //
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
Tet storage. Null constructable (unfortunately tetrahedron<point, point> is not)
Definition: tetPoints.H:56
tetPoints(const UList< point > &points, const FixedList< label, 4 > &indices)
Copy construct from subset of points.
Definition: tetPoints.H:82
treeBoundBox bounds() const
Calculate the bounding box.
Definition: tetPoints.H:106
tetPointRef tet() const
Return the tetrahedron.
Definition: tetPoints.H:94
tetPoints()
Default construct.
Definition: tetPoints.H:62
tetPoints(const point &a, const point &b, const point &c, const point &d)
Construct from four points.
Definition: tetPoints.H:67
A tetrahedron primitive.
Definition: tetrahedron.H:87
Standard boundBox with extra functionality for use in octree.
Definition: treeBoundBox.H:89
const pointField & points
Namespace for OpenFOAM.
tetrahedron< point, const point & > tetPointRef
A tetrahedron using referred points.
Definition: tetPointRef.H:47
volScalarField & b
Definition: createFields.H:27