FreeFOAM The Cross-Platform CFD Toolkit
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) 1991-2010 OpenCFD Ltd.
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 <OpenFOAM/faceList.H>
39 #include <OpenFOAM/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 UList<label>&);
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 unallocFaceList&) const;
94 
95  //- Return the cell vertices
96  pointField points(const unallocFaceList&, const pointField&) const;
97 
98  //- Return cell edges
99  edgeList edges(const unallocFaceList&) const;
100 
101  //- Return index of opposite face
102  label opposingFaceLabel
103  (
104  const label masterFaceLabel,
105  const unallocFaceList& meshFaces
106  ) const;
107 
108  //- Return opposite face oriented the same way as the master face
110  (
111  const label masterFaceLabel,
112  const unallocFaceList& 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 unallocFaceList&) const;
126 
127  //- Returns cell volume
128  scalar mag(const pointField&, const unallocFaceList&) 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 <OpenFOAM/cellI.H>
145 
146 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
147 
148 #endif
149 
150 // ************************ vim: set sw=4 sts=4 et: ************************ //