00001 /*---------------------------------------------------------------------------*\ 00002 ========= | 00003 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox 00004 \\ / O peration | 00005 \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd. 00006 \\/ M anipulation | 00007 ------------------------------------------------------------------------------- 00008 License 00009 This file is part of OpenFOAM. 00010 00011 OpenFOAM is free software: you can redistribute it and/or modify it 00012 under the terms of the GNU General Public License as published by 00013 the Free Software Foundation, either version 3 of the License, or 00014 (at your option) any later version. 00015 00016 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT 00017 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00018 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 00019 for more details. 00020 00021 You should have received a copy of the GNU General Public License 00022 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. 00023 00024 Class 00025 Foam::cell 00026 00027 Description 00028 A cell is defined as a list of faces with extra functionality 00029 00030 SourceFiles 00031 cellI.H 00032 00033 \*---------------------------------------------------------------------------*/ 00034 00035 #ifndef cell_H 00036 #define cell_H 00037 00038 #include <OpenFOAM/faceList.H> 00039 #include <OpenFOAM/oppositeFace.H> 00040 00041 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00042 00043 namespace Foam 00044 { 00045 00046 // Forward declaration of friend functions and operators 00047 00048 class cell; 00049 bool operator==(const cell&, const cell&); 00050 inline bool operator!=(const cell&, const cell&); 00051 00052 00053 /*---------------------------------------------------------------------------*\ 00054 Class cell Declaration 00055 \*---------------------------------------------------------------------------*/ 00056 00057 class cell 00058 : 00059 public labelList 00060 { 00061 00062 public: 00063 00064 // Static data members 00065 00066 static const char* const typeName; 00067 00068 00069 // Constructors 00070 00071 //- Construct null 00072 inline cell(); 00073 00074 //- Construct given size 00075 explicit inline cell(label); 00076 00077 //- Construct from list of labels 00078 explicit inline cell(const UList<label>&); 00079 00080 //- Construct by transferring the parameter contents 00081 explicit inline cell(const Xfer<labelList>&); 00082 00083 //- Construct from Istream 00084 inline cell(Istream&); 00085 00086 00087 // Member Functions 00088 00089 //- Return number of faces 00090 inline label nFaces() const; 00091 00092 //- Return labels of cell vertices 00093 labelList labels(const unallocFaceList&) const; 00094 00095 //- Return the cell vertices 00096 pointField points(const unallocFaceList&, const pointField&) const; 00097 00098 //- Return cell edges 00099 edgeList edges(const unallocFaceList&) const; 00100 00101 //- Return index of opposite face 00102 label opposingFaceLabel 00103 ( 00104 const label masterFaceLabel, 00105 const unallocFaceList& meshFaces 00106 ) const; 00107 00108 //- Return opposite face oriented the same way as the master face 00109 oppositeFace opposingFace 00110 ( 00111 const label masterFaceLabel, 00112 const unallocFaceList& meshFaces 00113 ) const; 00114 00115 00116 // Instructions for centre and mag: 00117 // When one wants to access the cell centre and magnitude, the 00118 // functionality on the mesh level should be used in preference to the 00119 // functions provided here. They do not rely to the functionality 00120 // implemented here, provide additional checking and are more efficient. 00121 // The cell::centre and cell::mag functions may be removed in the 00122 // future. 00123 00124 //- Returns cell centre 00125 point centre(const pointField&, const unallocFaceList&) const; 00126 00127 //- Returns cell volume 00128 scalar mag(const pointField&, const unallocFaceList&) const; 00129 00130 00131 // Friend Operators 00132 00133 friend bool operator==(const cell&, const cell&); 00134 friend bool operator!=(const cell&, const cell&); 00135 }; 00136 00137 00138 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00139 00140 } // End namespace Foam 00141 00142 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00143 00144 #include <OpenFOAM/cellI.H> 00145 00146 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00147 00148 #endif 00149 00150 // ************************ vim: set sw=4 sts=4 et: ************************ //