cell.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) 2011-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 Class
25  Foam::cell
26 
27 Description
28  A cell is defined as a list of faces with extra functionality
29 
30 SourceFiles
31  cellI.H
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef cell_H
36 #define cell_H
37 
38 #include "faceList.H"
39 #include "oppositeFace.H"
40 #include "boundBox.H"
41 
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
43 
44 namespace Foam
45 {
46 
47 // Forward declaration of friend functions and operators
48 
49 class cell;
50 bool operator==(const cell&, const cell&);
51 inline bool operator!=(const cell&, const cell&);
52 
53 
54 /*---------------------------------------------------------------------------*\
55  Class cell Declaration
56 \*---------------------------------------------------------------------------*/
57 
58 class cell
59 :
60  public labelList
61 {
62 
63 public:
64 
65  // Static Data Members
66 
67  static const char* const typeName;
68 
69 
70  // Constructors
71 
72  //- Construct null
73  inline cell();
74 
75  //- Construct given size
76  explicit inline cell(label);
77 
78  //- Construct from list of labels
79  explicit inline cell(const labelUList&);
80 
81  //- Construct by transferring the parameter contents
82  explicit inline cell(labelList&&);
83 
84  //- Construct from Istream
85  inline cell(Istream&);
86 
87 
88  // Member Functions
89 
90  //- Return number of faces
91  inline label nFaces() const;
92 
93  //- Return labels of cell vertices
94  labelList labels(const faceUList&) const;
95 
96  //- Return the cell vertices
97  pointField points(const faceUList&, const pointField&) const;
98 
99  //- Return cell edges
100  edgeList edges(const faceUList&) const;
101 
102  //- Return index of opposite face
104  (
105  const label masterFaceLabel,
106  const faceUList& meshFaces
107  ) const;
108 
109  //- Return opposite face oriented the same way as the master face
111  (
112  const label masterFaceLabel,
113  const faceUList& meshFaces
114  ) const;
115 
116  // Instructions for centre and mag:
117  // When one wants to access the cell centre and magnitude, the
118  // functionality on the mesh level should be used in preference to the
119  // functions provided here. They do not rely to the functionality
120  // implemented here, provide additional checking and are more efficient.
121  // The cell::centre and cell::mag functions may be removed in the
122  // future.
123 
124  //- Returns cell centre
125  point centre(const pointField&, const faceUList&) const;
126 
127  //- Returns cell volume
128  scalar mag(const pointField&, const faceUList&) const;
129 
130  //- Returns the cell bounding box
131  boundBox bb(const pointField&, const faceUList&) const;
132 
133 
134  // Member Operators
135 
136  //- Move assignment labelList
137  inline void operator=(labelList&&);
138 
139 
140  // Friend Operators
141 
142  friend bool operator==(const cell&, const cell&);
143  friend bool operator!=(const cell&, const cell&);
144 };
145 
146 
147 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
148 
149 } // End namespace Foam
150 
151 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
152 
153 #include "cellI.H"
154 
155 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
156 
157 #endif
158 
159 // ************************************************************************* //
Class containing opposite face for a prismatic cell with addressing and a possibility of failure...
Definition: oppositeFace.H:49
friend bool operator!=(const cell &, const cell &)
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
A bounding box defined in terms of the points at its extremities.
Definition: boundBox.H:58
void operator=(labelList &&)
Move assignment labelList.
Definition: cellI.H:74
oppositeFace opposingFace(const label masterFaceLabel, const faceUList &meshFaces) const
Return opposite face oriented the same way as the master face.
label opposingFaceLabel(const label masterFaceLabel, const faceUList &meshFaces) const
Return index of opposite face.
boundBox bb(const pointField &, const faceUList &) const
Returns the cell bounding box.
Definition: cell.C:279
edgeList edges(const faceUList &) const
Return cell edges.
Definition: cell.C:120
tmp< fvMatrix< Type > > operator==(const fvMatrix< Type > &, const fvMatrix< Type > &)
point centre(const pointField &, const faceUList &) const
Returns cell centre.
Definition: cell.C:173
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:60
scalar mag(const pointField &, const faceUList &) const
Returns cell volume.
Definition: cell.C:239
labelList labels(const faceUList &) const
Return labels of cell vertices.
Definition: cell.C:35
A cell is defined as a list of faces with extra functionality.
Definition: cell.H:57
pointField points(const faceUList &, const pointField &) const
Return the cell vertices.
Definition: cell.C:102
friend bool operator==(const cell &, const cell &)
label nFaces() const
Return number of faces.
Definition: cellI.H:60
bool operator!=(const particle &, const particle &)
Definition: particle.C:1282
cell()
Construct null.
Definition: cellI.H:30
Namespace for OpenFOAM.
static const char *const typeName
Definition: cell.H:66