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

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