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

extendedCellToFaceStencil.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::extendedCellToFaceStencil
00027 
00028 Description
00029     Calculates/constains the extended cell-to-face stencil.
00030 
00031     The stencil is a list of indices into either cells or boundary faces
00032     in a compact way. (element 0 is owner, 1 is neighbour). The index numbering
00033     is
00034     - cells first
00035     - then all (non-empty patch) boundary faces
00036 
00037     When used in evaluation is a two stage process:
00038     - collect the data (cell data and non-empty boundaries) into a
00039     single field
00040     - (parallel) distribute the field
00041     - sum the weights*field.
00042 
00043 SourceFiles
00044     extendedCellToFaceStencil.C
00045     extendedCellToFaceStencilTemplates.C
00046 
00047 \*---------------------------------------------------------------------------*/
00048 
00049 #ifndef extendedCellToFaceStencil_H
00050 #define extendedCellToFaceStencil_H
00051 
00052 #include "mapDistribute.H"
00053 #include "volFields.H"
00054 #include "surfaceFields.H"
00055 
00056 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00057 
00058 namespace Foam
00059 {
00060 
00061 class globalIndex;
00062 
00063 /*---------------------------------------------------------------------------*\
00064                            Class extendedCellToFaceStencil Declaration
00065 \*---------------------------------------------------------------------------*/
00066 
00067 class extendedCellToFaceStencil
00068 {
00069 protected:
00070 
00071     // Protected data
00072 
00073         const polyMesh& mesh_;
00074 
00075 
00076     // Protected Member Functions
00077 
00078 
00079 
00080 private:
00081 
00082     // Private Member Functions
00083 
00084         //- Disallow default bitwise copy construct
00085         extendedCellToFaceStencil(const extendedCellToFaceStencil&);
00086 
00087         //- Disallow default bitwise assignment
00088         void operator=(const extendedCellToFaceStencil&);
00089 
00090 
00091 protected:
00092 
00093         //- Write some statistics about stencil
00094         static void writeStencilStats
00095         (
00096             Ostream& os,
00097             const labelListList& stencil,
00098             const mapDistribute& map
00099         );
00100 
00101 public:
00102 
00103     // Declare name of the class and its debug switch
00104     ClassName("extendedCellToFaceStencil");
00105 
00106 
00107     // Constructors
00108 
00109         //- Construct from mesh
00110         explicit extendedCellToFaceStencil(const polyMesh&);
00111 
00112 
00113     // Member Functions
00114 
00115         //- Calculate distribute map
00116         static autoPtr<mapDistribute> calcDistributeMap
00117         (
00118             const polyMesh& mesh,
00119             const globalIndex& globalNumbering,
00120             labelListList& faceStencil
00121         );
00122 
00123         //- Use map to get the data into stencil order
00124         template<class T>
00125         static void collectData
00126         (
00127             const mapDistribute& map,
00128             const labelListList& stencil,
00129             const GeometricField<T, fvPatchField, volMesh>& fld,
00130             List<List<T> >& stencilFld
00131         );
00132 
00133         //- Sum vol field contributions to create face values
00134         template<class Type>
00135         static tmp<GeometricField<Type, fvsPatchField, surfaceMesh> >
00136         weightedSum
00137         (
00138             const mapDistribute& map,
00139             const labelListList& stencil,
00140             const GeometricField<Type, fvPatchField, volMesh>& fld,
00141             const List<List<scalar> >& stencilWeights
00142         );
00143 };
00144 
00145 
00146 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00147 
00148 } // End namespace Foam
00149 
00150 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00151 
00152 #ifdef NoRepository
00153 #   include "extendedCellToFaceStencilTemplates.C"
00154 #endif
00155 
00156 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00157 
00158 #endif
00159 
00160 // ************************************************************************* //
Copyright © 2000-2009 OpenCFD Ltd