FreeFOAM The Cross-Platform CFD Toolkit
Hosted by SourceForge:
Get FreeFOAM at SourceForge.net.
            Fast, secure and Free Open Source software downloads

cellToFaceStencil.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-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::cellToFaceStencil
00026 
00027 Description
00028     baseclass for extended cell-to-facel stencils (face values from
00029     neighbouring cells)
00030 
00031 SourceFiles
00032     faceStencil.C
00033 
00034 \*---------------------------------------------------------------------------*/
00035 
00036 #ifndef cellToFaceStencil_H
00037 #define cellToFaceStencil_H
00038 
00039 #include <OpenFOAM/globalIndex.H>
00040 #include <OpenFOAM/boolList.H>
00041 #include <OpenFOAM/HashSet.H>
00042 #include <OpenFOAM/indirectPrimitivePatch.H>
00043 
00044 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00045 
00046 namespace Foam
00047 {
00048 
00049 class polyMesh;
00050 
00051 /*---------------------------------------------------------------------------*\
00052                            Class cellToFaceStencil Declaration
00053 \*---------------------------------------------------------------------------*/
00054 
00055 class cellToFaceStencil
00056 :
00057     public labelListList
00058 {
00059     // Private data
00060 
00061         const polyMesh& mesh_;
00062 
00063         //- Global numbering for cells and boundary faces
00064         const globalIndex globalNumbering_;
00065 
00066 
00067     // Private Member Functions
00068 
00069         //- Disallow default bitwise copy construct
00070         cellToFaceStencil(const cellToFaceStencil&);
00071 
00072         //- Disallow default bitwise assignment
00073         void operator=(const cellToFaceStencil&);
00074 
00075 
00076 protected:
00077 
00078         //- Merge two lists.
00079         static void merge
00080         (
00081             const label,
00082             const label,
00083             const labelList&,
00084             labelList&
00085         );
00086 
00087         //- Merge two lists.
00088         static void merge(const label, const labelList&, labelList&);
00089 
00090         //- Valid boundary faces (not empty and not coupled)
00091         void validBoundaryFaces(boolList& isValidBFace) const;
00092 
00093         //- Return patch of all coupled faces.
00094         autoPtr<indirectPrimitivePatch> allCoupledFacesPatch() const;
00095 
00096         //- Combine operator for labelLists
00097         class unionEqOp
00098         {
00099             public:
00100             void operator()( labelList& x, const labelList& y ) const;
00101         };
00102 
00103         //- Collect cell neighbours of faces in global numbering
00104         void insertFaceCells
00105         (
00106             const label exclude0,
00107             const label exclude1,
00108             const boolList& nonEmptyFace,
00109             const labelList& faceLabels,
00110             labelHashSet& globals
00111         ) const;
00112 
00113         //- Collect cell neighbours of faces in global numbering
00114         labelList calcFaceCells
00115         (
00116             const boolList& nonEmptyFace,
00117             const labelList& faceLabels,
00118             labelHashSet& globals
00119         ) const;
00120 
00121 
00122         //- Collect cell neighbours into extended stencil
00123         void calcFaceStencil
00124         (
00125             const labelListList& globalCellCells,
00126             labelListList& faceStencil
00127         ) const;
00128 
00129 
00130 public:
00131 
00132     // Constructors
00133 
00134         //- Construct from mesh
00135         explicit cellToFaceStencil(const polyMesh&);
00136 
00137 
00138     // Member Functions
00139 
00140         const polyMesh& mesh() const
00141         {
00142             return mesh_;
00143         }
00144 
00145         //- Global numbering for cells and boundary faces
00146         const globalIndex& globalNumbering() const
00147         {
00148             return globalNumbering_;
00149         }
00150 
00151         //- Work-around for C++ Standard Core Language Defect 391
00152         const cellToFaceStencil& by_ref() const
00153         {
00154             return *this;
00155         }
00156 
00157 };
00158 
00159 
00160 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00161 
00162 } // End namespace Foam
00163 
00164 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00165 
00166 #endif
00167 
00168 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines