Initial commit for version 2.0.x patch release
[OpenFOAM-2.0.x.git] / src / finiteVolume / fvMesh / extendedStencil / cellToFace / extendedCentredCellToFaceStencil.H
blobed081c46c313cb44f9910f8b2fd0540720c76f84
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 2008-2010 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
13     the Free Software Foundation, either version 3 of the License, or
14     (at your 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, see <http://www.gnu.org/licenses/>.
24 Class
25     Foam::extendedCentredCellToFaceStencil
27 Description
29 SourceFiles
30     extendedCentredCellToFaceStencil.C
32 \*---------------------------------------------------------------------------*/
34 #ifndef extendedCentredCellToFaceStencil_H
35 #define extendedCentredCellToFaceStencil_H
37 #include "extendedCellToFaceStencil.H"
39 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
41 namespace Foam
44 class cellToFaceStencil;
46 /*---------------------------------------------------------------------------*\
47               Class extendedCentredCellToFaceStencil Declaration
48 \*---------------------------------------------------------------------------*/
50 class extendedCentredCellToFaceStencil
52     public extendedCellToFaceStencil
54     // Private data
56         //- Swap map for getting neigbouring data
57         autoPtr<mapDistribute> mapPtr_;
59         //- Per face the stencil.
60         labelListList stencil_;
63     // Private Member Functions
65         //- Disallow default bitwise copy construct
66         extendedCentredCellToFaceStencil
67         (
68             const extendedCentredCellToFaceStencil&
69         );
71         //- Disallow default bitwise assignment
72         void operator=(const extendedCentredCellToFaceStencil&);
75 public:
77     // Constructors
79         //- Construct from uncompacted face stencil
80         explicit extendedCentredCellToFaceStencil(const cellToFaceStencil&);
83     // Member Functions
85         //- Return reference to the parallel distribution map
86         const mapDistribute& map() const
87         {
88             return mapPtr_();
89         }
91         //- Return reference to the stencil
92         const labelListList& stencil() const
93         {
94             return stencil_;
95         }
97         //- After removing elements from the stencil adapt the schedule (map).
98         void compact();
100         //- Use map to get the data into stencil order
101         template<class T>
102         void collectData
103         (
104             const GeometricField<T, fvPatchField, volMesh>& fld,
105             List<List<T> >& stencilFld
106         ) const
107         {
108             extendedCellToFaceStencil::collectData
109             (
110                 map(),
111                 stencil(),
112                 fld,
113                 stencilFld
114             );
115         }
117         //- Sum vol field contributions to create face values
118         template<class Type>
119         tmp<GeometricField<Type, fvsPatchField, surfaceMesh> > weightedSum
120         (
121             const GeometricField<Type, fvPatchField, volMesh>& fld,
122             const List<List<scalar> >& stencilWeights
123         ) const
124         {
125             return extendedCellToFaceStencil::weightedSum
126             (
127                 map(),
128                 stencil(),
129                 fld,
130                 stencilWeights
131             );
132         }
137 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
139 } // End namespace Foam
141 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
143 #endif
145 // ************************************************************************* //