cell.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 OpenFOAM Foundation
9  Copyright (C) 2017 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::cell
29 
30 Description
31  A cell is defined as a list of faces with extra functionality
32 
33 SourceFiles
34  cellI.H
35  cell.C
36  oppositeCellFace.C
37 
38 \*---------------------------------------------------------------------------*/
39 
40 #ifndef cell_H
41 #define cell_H
42 
43 #include "faceList.H"
44 #include "oppositeFace.H"
45 
46 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47 
48 namespace Foam
49 {
50 
51 /*---------------------------------------------------------------------------*\
52  Class cell Declaration
53 \*---------------------------------------------------------------------------*/
54 
55 class cell
56 :
57  public labelList
58 {
59 
60 public:
61 
62  // Static data members
63 
64  static const char* const typeName;
65 
66 
67  // Constructors
68 
69  //- Construct null
70  inline cell();
71 
72  //- Construct given size, with invalid point labels (-1)
73  inline explicit cell(const label sz);
74 
75  //- Copy construct from list of labels
76  inline explicit cell(const labelUList& lst);
77 
78  //- Move construct from list of labels
79  inline explicit cell(labelList&& lst);
80 
81  //- Construct from Istream
82  inline cell(Istream& is);
83 
84 
85  // Member Functions
86 
87  //- Return number of faces
88  inline label nFaces() const;
89 
90  //- Return unordered list of cell vertices given the list of faces
91  labelList labels(const faceUList& f) const;
92 
93  //- Return the cell vertices given the list of faces and mesh points
95  (
96  const faceUList& f,
97  const UList<point>& meshPoints
98  ) const;
99 
100  //- Return cell edges
101  edgeList edges(const faceUList& f) const;
102 
103  //- Return index of opposite face
104  label opposingFaceLabel
105  (
106  const label masterFaceLabel,
107  const faceUList& meshFaces
108  ) const;
109 
110  //- Return opposite face oriented the same way as the master face
112  (
113  const label masterFaceLabel,
114  const faceUList& meshFaces
115  ) const;
116 
117 
118  // Instructions for centre and mag:
119  // When one wants to access the cell centre and magnitude, the
120  // functionality on the mesh level should be used in preference to the
121  // functions provided here. They do not rely to the functionality
122  // implemented here, provide additional checking and are more efficient.
123  // The cell::centre and cell::mag functions may be removed in the
124  // future.
125 
126  //- Returns cell centre
127  point centre(const UList<point>& p, const faceUList& f) const;
128 
129  //- Returns cell volume
130  scalar mag(const UList<point>& p, const faceUList& f) const;
131 };
132 
133 
134 // Global Operators
135 
136 //- Test if both cells are the same size and contain the same points
137 // The internal point ordering is ignored
138 bool operator==(const cell& a, const cell& b);
139 
140 //- Test if the cells differ (different size or different points)
141 inline bool operator!=(const cell& a, const cell& b);
142 
143 
144 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
145 
146 } // End namespace Foam
147 
148 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
149 
150 #include "cellI.H"
151 
152 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
153 
154 #endif
155 
156 // ************************************************************************* //
p
volScalarField & p
Definition: createFieldRefs.H:8
oppositeFace.H
Foam::cell::typeName
static const char *const typeName
Definition: cell.H:63
Foam::cell::points
pointField points(const faceUList &f, const UList< point > &meshPoints) const
Return the cell vertices given the list of faces and mesh points.
Definition: cell.C:104
Foam::cell::centre
point centre(const UList< point > &p, const faceUList &f) const
Returns cell centre.
Definition: cell.C:175
Foam::cell::cell
cell()
Construct null.
Definition: cellI.H:30
Foam::cell::edges
edgeList edges(const faceUList &f) const
Return cell edges.
Definition: cell.C:122
Foam::cell::mag
scalar mag(const UList< point > &p, const faceUList &f) const
Returns cell volume.
Definition: cell.C:241
Foam::oppositeFace
Class containing opposite face for a prismatic cell with addressing and a possibility of failure.
Definition: oppositeFace.H:51
faceList.H
Foam::operator!=
bool operator!=(const eddy &a, const eddy &b)
Definition: eddy.H:235
Foam::constant::physicoChemical::b
const dimensionedScalar b
Wien displacement law constant: default SI units: [m.K].
Definition: createFields.H:27
Foam::Field< vector >
Foam::operator==
tmp< faMatrix< Type > > operator==(const faMatrix< Type > &, const faMatrix< Type > &)
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:61
Foam::cell::opposingFace
oppositeFace opposingFace(const label masterFaceLabel, const faceUList &meshFaces) const
Return opposite face oriented the same way as the master face.
Definition: oppositeCellFace.C:114
Foam::cell::labels
labelList labels(const faceUList &f) const
Return unordered list of cell vertices given the list of faces.
Definition: cell.C:37
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::cell::nFaces
label nFaces() const
Return number of faces.
Definition: cellI.H:60
f
labelList f(nPoints)
Foam::cell::opposingFaceLabel
label opposingFaceLabel(const label masterFaceLabel, const faceUList &meshFaces) const
Return index of opposite face.
Definition: oppositeCellFace.C:39
Foam::Vector< scalar >
Foam::List< label >
Foam::UList< label >
cellI.H
Foam::cell
A cell is defined as a list of faces with extra functionality.
Definition: cell.H:54