OpenFOAM logo
The Open Source CFD Toolbox
  Source Guide OpenCFD Solutions Contact OpenFOAM

cell.H

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------------*\
00002   =========                 |
00003   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
00004    \\    /   O peration     |
00005     \\  /    A nd           | Copyright (C) 1991-2009 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 the
00013     Free Software Foundation; either version 2 of the License, or (at your
00014     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, write to the Free Software Foundation,
00023     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
00024 
00025 Class
00026     Foam::cell
00027 
00028 Description
00029     A cell is defined as a list of faces with extra functionality
00030 
00031 SourceFiles
00032     cellI.H
00033 
00034 \*---------------------------------------------------------------------------*/
00035 
00036 #ifndef cell_H
00037 #define cell_H
00038 
00039 #include "faceList.H"
00040 #include "oppositeFace.H"
00041 
00042 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00043 
00044 namespace Foam
00045 {
00046 
00047 // Forward declaration of friend functions and operators
00048 
00049 class cell;
00050 bool operator==(const cell&, const cell&);
00051 inline bool operator!=(const cell&, const cell&);
00052 
00053 
00054 /*---------------------------------------------------------------------------*\
00055                            Class cell Declaration
00056 \*---------------------------------------------------------------------------*/
00057 
00058 class cell
00059 :
00060     public labelList
00061 {
00062 
00063 public:
00064 
00065     // Static data members
00066 
00067         static const char* const typeName;
00068 
00069 
00070     // Constructors
00071 
00072         //- Construct null
00073         inline cell();
00074 
00075         //- Construct given size
00076         explicit inline cell(label);
00077 
00078         //- Construct from list of labels
00079         explicit inline cell(const UList<label>&);
00080 
00081         //- Construct by transferring the parameter contents
00082         explicit inline cell(const Xfer<labelList>&);
00083 
00084         //- Construct from Istream
00085         inline cell(Istream&);
00086 
00087 
00088     // Member Functions
00089 
00090         //- Return number of faces
00091         inline label nFaces() const;
00092 
00093         //- Return labels of cell vertices
00094         labelList labels(const unallocFaceList&) const;
00095 
00096         //- Return the cell vertices
00097         pointField points(const unallocFaceList&, const pointField&) const;
00098 
00099         //- Return cell edges
00100         edgeList edges(const unallocFaceList&) const;
00101 
00102         //- Return index of opposite face
00103         label opposingFaceLabel
00104         (
00105             const label masterFaceLabel,
00106             const unallocFaceList& meshFaces
00107         ) const;
00108 
00109         //- Return opposite face oriented the same way as the master face
00110         oppositeFace opposingFace
00111         (
00112             const label masterFaceLabel,
00113             const unallocFaceList& meshFaces
00114         ) const;
00115 
00116 
00117         // Instructions for centre and mag:
00118         // When one wants to access the cell centre and magnitude, the
00119         // functionality on the mesh level should be used in preference to the
00120         // functions provided here. They do not rely to the functionality
00121         // implemented here, provide additional checking and are more efficient.
00122         // The cell::centre and cell::mag functions may be removed in the
00123         // future.
00124 
00125         //- Returns cell centre
00126         point centre(const pointField&, const unallocFaceList&) const;
00127 
00128         //- Returns cell volume
00129         scalar mag(const pointField&, const unallocFaceList&) const;
00130 
00131 
00132     // Friend Operators
00133 
00134         friend bool operator==(const cell&, const cell&);
00135         friend bool operator!=(const cell&, const cell&);
00136 };
00137 
00138 
00139 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00140 
00141 } // End namespace Foam
00142 
00143 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00144 
00145 #include "cellI.H"
00146 
00147 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00148 
00149 #endif
00150 
00151 // ************************************************************************* //
Copyright © 2000-2009 OpenCFD Ltd