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 -------------------------------------------------------------------------------
11 License
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 
27 Class
28  Foam::triPoints
29 
30 Description
31  Triangle storage. Null constructable (unfortunately triangle<point, point>
32  is not)
33 
34 SourceFiles
35 
36 \*---------------------------------------------------------------------------*/
37 
38 #ifndef triPoints_H
39 #define triPoints_H
40 
41 #include "FixedList.H"
42 #include "treeBoundBox.H"
43 
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45 
46 namespace Foam
47 {
48 
49 /*---------------------------------------------------------------------------*\
50  Class triPoints Declaration
51 \*---------------------------------------------------------------------------*/
52 
53 class triPoints
54 :
55  public FixedList<point, 3>
56 {
57 public:
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 // ************************************************************************* //
Foam::treeBoundBox
Standard boundBox with extra functionality for use in octree.
Definition: treeBoundBox.H:82
Foam::FixedList< point, 3 >::size
static constexpr label size() noexcept
Definition: FixedList.H:412
Foam::triPoints::bounds
treeBoundBox bounds() const
Definition: triPoints.H:87
Foam::triPoints
Triangle storage. Null constructable (unfortunately triangle<point, point> is not)
Definition: triPoints.H:48
Foam::constant::physicoChemical::b
const dimensionedScalar b
Definition: createFields.H:27
treeBoundBox.H
Foam
Definition: atmBoundaryLayer.C:26
Foam::FixedList< point, 3 >::operator[]
T & operator[](const label i)
Definition: FixedListI.H:405
Foam::triPoints::triPoints
triPoints()
Definition: triPoints.H:57
Foam::Vector< scalar >
Foam::FixedList
A 1D vector of objects of type <T> with a fixed length <N>.
Definition: HashTable.H:100
Foam::UList
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
Definition: HashTable.H:99
points
const pointField & points
Definition: gmvOutputHeader.H:1
Foam::constant::universal::c
const dimensionedScalar c
FixedList.H
Foam::boundBox::add
void add(const boundBox &bb)
Definition: boundBoxI.H:184