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 | Copyright (C) 2011 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 
41 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
42 
43 namespace Foam
44 {
45 
46 // Forward declaration of friend functions and operators
47 
48 class cell;
49 bool operator==(const cell&, const cell&);
50 inline bool operator!=(const cell&, const cell&);
51 
52 
53 /*---------------------------------------------------------------------------*\
54  Class cell Declaration
55 \*---------------------------------------------------------------------------*/
56 
57 class cell
58 :
59  public labelList
60 {
61 
62 public:
63 
64  // Static data members
65 
66  static const char* const typeName;
67 
68 
69  // Constructors
70 
71  //- Construct null
72  inline cell();
73 
74  //- Construct given size
75  explicit inline cell(label);
76 
77  //- Construct from list of labels
78  explicit inline cell(const labelUList&);
79 
80  //- Construct by transferring the parameter contents
81  explicit inline cell(const Xfer<labelList>&);
82 
83  //- Construct from Istream
84  inline cell(Istream&);
85 
86 
87  // Member Functions
88 
89  //- Return number of faces
90  inline label nFaces() const;
91 
92  //- Return labels of cell vertices
93  labelList labels(const faceUList&) const;
94 
95  //- Return the cell vertices
96  pointField points(const faceUList&, const pointField&) const;
97 
98  //- Return cell edges
99  edgeList edges(const faceUList&) const;
100 
101  //- Return index of opposite face
103  (
104  const label masterFaceLabel,
105  const faceUList& meshFaces
106  ) const;
107 
108  //- Return opposite face oriented the same way as the master face
110  (
111  const label masterFaceLabel,
112  const faceUList& meshFaces
113  ) const;
114 
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 
131  // Friend Operators
132 
133  friend bool operator==(const cell&, const cell&);
134  friend bool operator!=(const cell&, const cell&);
135 };
136 
137 
138 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
139 
140 } // End namespace Foam
141 
142 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
143 
144 #include "cellI.H"
145 
146 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
147 
148 #endif
149 
150 // ************************************************************************* //
Class containing opposite face for a prismatic cell with addressing and a possibility of failure...
Definition: oppositeFace.H:49
tmp< fvMatrix< Type > > operator==(const fvMatrix< Type > &, const fvMatrix< Type > &)
edgeList edges(const faceUList &) const
Return cell edges.
Definition: cell.C:120
A cell is defined as a list of faces with extra functionality.
Definition: cell.H:56
scalar mag(const pointField &, const faceUList &) const
Returns cell volume.
Definition: cell.C:239
oppositeFace opposingFace(const label masterFaceLabel, const faceUList &meshFaces) const
Return opposite face oriented the same way as the master face.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
A simple container for copying or transferring objects of type <T>.
Definition: Xfer.H:85
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
friend bool operator==(const cell &, const cell &)
Namespace for OpenFOAM.
friend bool operator!=(const cell &, const cell &)
bool operator!=(const particle &, const particle &)
Definition: particle.C:147
static const char *const typeName
Definition: cell.H:65
label opposingFaceLabel(const label masterFaceLabel, const faceUList &meshFaces) const
Return index of opposite face.
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
label nFaces() const
Return number of faces.
Definition: cellI.H:65
point centre(const pointField &, const faceUList &) const
Returns cell centre.
Definition: cell.C:173
cell()
Construct null.
Definition: cellI.H:31
labelList labels(const faceUList &) const
Return labels of cell vertices.
Definition: cell.C:35
pointField points(const faceUList &, const pointField &) const
Return the cell vertices.
Definition: cell.C:102