initial commit for version 1.6.x patch release
[OpenFOAM-1.6.x.git] / src / finiteVolume / fvMesh / extendedStencil / cellToFace / extendedCellToFaceStencil.H
blobbb0e92d11fc8d2dc6aa4e55758f8ff0c0c9b08f9
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
9     This file is part of OpenFOAM.
11     OpenFOAM is free software; you can redistribute it and/or modify it
12     under the terms of the GNU General Public License as published by the
13     Free Software Foundation; either version 2 of the License, or (at your
14     option) any later version.
16     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
19     for more details.
21     You should have received a copy of the GNU General Public License
22     along with OpenFOAM; if not, write to the Free Software Foundation,
23     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 Class
26     Foam::extendedCellToFaceStencil
28 Description
29     Calculates/constains the extended cell-to-face stencil.
31     The stencil is a list of indices into either cells or boundary faces
32     in a compact way. (element 0 is owner, 1 is neighbour). The index numbering
33     is
34     - cells first
35     - then all (non-empty patch) boundary faces
37     When used in evaluation is a two stage process:
38     - collect the data (cell data and non-empty boundaries) into a
39     single field
40     - (parallel) distribute the field
41     - sum the weights*field.
43 SourceFiles
44     extendedCellToFaceStencil.C
45     extendedCellToFaceStencilTemplates.C
47 \*---------------------------------------------------------------------------*/
49 #ifndef extendedCellToFaceStencil_H
50 #define extendedCellToFaceStencil_H
52 #include "mapDistribute.H"
53 #include "volFields.H"
54 #include "surfaceFields.H"
56 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
58 namespace Foam
61 class globalIndex;
63 /*---------------------------------------------------------------------------*\
64                            Class extendedCellToFaceStencil Declaration
65 \*---------------------------------------------------------------------------*/
67 class extendedCellToFaceStencil
69 protected:
71     // Protected data
73         const polyMesh& mesh_;
76     // Protected Member Functions
80 private:
82     // Private Member Functions
84         //- Disallow default bitwise copy construct
85         extendedCellToFaceStencil(const extendedCellToFaceStencil&);
87         //- Disallow default bitwise assignment
88         void operator=(const extendedCellToFaceStencil&);
91 protected:
93         //- Write some statistics about stencil
94         static void writeStencilStats
95         (
96             Ostream& os,
97             const labelListList& stencil,
98             const mapDistribute& map
99         );
101 public:
103     // Declare name of the class and its debug switch
104     ClassName("extendedCellToFaceStencil");
107     // Constructors
109         //- Construct from mesh
110         explicit extendedCellToFaceStencil(const polyMesh&);
113     // Member Functions
115         //- Calculate distribute map
116         static autoPtr<mapDistribute> calcDistributeMap
117         (
118             const polyMesh& mesh,
119             const globalIndex& globalNumbering,
120             labelListList& faceStencil
121         );
123         //- Use map to get the data into stencil order
124         template<class T>
125         static void collectData
126         (
127             const mapDistribute& map,
128             const labelListList& stencil,
129             const GeometricField<T, fvPatchField, volMesh>& fld,
130             List<List<T> >& stencilFld
131         );
133         //- Sum vol field contributions to create face values
134         template<class Type>
135         static tmp<GeometricField<Type, fvsPatchField, surfaceMesh> >
136         weightedSum
137         (
138             const mapDistribute& map,
139             const labelListList& stencil,
140             const GeometricField<Type, fvPatchField, volMesh>& fld,
141             const List<List<scalar> >& stencilWeights
142         );
146 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
148 } // End namespace Foam
150 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
152 #ifdef NoRepository
153 #   include "extendedCellToFaceStencilTemplates.C"
154 #endif
156 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
158 #endif
160 // ************************************************************************* //