Initial commit for version 2.0.x patch release
[OpenFOAM-2.0.x.git] / src / finiteVolume / fvMesh / extendedStencil / cellToFace / extendedUpwindCellToFaceStencil.H
blob0e35b9f5d317d71576abe737ae7cecbc38494ece
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::extendedUpwindCellToFaceStencil
27 Description
28     Creates upwind stencil by shifting a centred stencil to upwind and downwind
29     faces and optionally removing all non-(up/down)wind faces ('pureUpwind').
31     Note: the minOpposedness parameter is to decide which upwind and
32     downwind faces to combine the stencils from. If myArea is the
33     local area and upwindArea
34     the area of the possible upwind candidate it will be included if
35         (upwindArea & myArea)/magSqr(myArea) > minOpposedness
36     so this includes both cosine and area. WIP.
38 SourceFiles
39     extendedUpwindCellToFaceStencil.C
40     extendedUpwindCellToFaceStencilTemplates.C
42 \*---------------------------------------------------------------------------*/
44 #ifndef extendedUpwindCellToFaceStencil_H
45 #define extendedUpwindCellToFaceStencil_H
47 #include "extendedCellToFaceStencil.H"
49 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
51 namespace Foam
54 class cellToFaceStencil;
56 /*---------------------------------------------------------------------------*\
57                Class extendedUpwindCellToFaceStencil Declaration
58 \*---------------------------------------------------------------------------*/
60 class extendedUpwindCellToFaceStencil
62     public extendedCellToFaceStencil
64     // Private data
66         //- Does stencil contain upwind points only
67         const bool pureUpwind_;
69         //- Swap map for getting neigbouring data
70         autoPtr<mapDistribute> ownMapPtr_;
71         autoPtr<mapDistribute> neiMapPtr_;
73         //- Per face the stencil.
74         labelListList ownStencil_;
75         labelListList neiStencil_;
79     // Private Member Functions
81         //- Find most 'opposite' faces of cell
82         void selectOppositeFaces
83         (
84             const boolList& nonEmptyFace,
85             const scalar minOpposedness,
86             const label faceI,
87             const label cellI,
88             DynamicList<label>& oppositeFaces
89         ) const;
91         //- Transport (centred) face stencil to 'opposite' face.
92         void transportStencil
93         (
94             const boolList& nonEmptyFace,
95             const labelListList& faceStencil,
96             const scalar minOpposedness,
97             const label faceI,
98             const label cellI,
99             const bool stencilHasNeighbour,
101             DynamicList<label>& oppositeFaces,
102             labelHashSet& faceStencilSet,
103             labelList& transportedStencil
104         ) const;
106         //- Transport (centred) face stencil to 'opposite' faces.
107         void transportStencils
108         (
109             const labelListList& faceStencil,
110             const scalar minOpposedness,
111             labelListList& ownStencil,
112             labelListList& neiStencil
113         );
116         //- Disallow default bitwise copy construct
117         extendedUpwindCellToFaceStencil(const extendedUpwindCellToFaceStencil&);
119         //- Disallow default bitwise assignment
120         void operator=(const extendedUpwindCellToFaceStencil&);
123 public:
125     // Constructors
127         //- Construct from mesh and uncompacted centred face stencil.
128         //  Transports facestencil to create owner and neighbour versions.
129         //  pureUpwind to remove any remaining downwind cells.
130         extendedUpwindCellToFaceStencil
131         (
132             const cellToFaceStencil&,
133             const bool pureUpwind,
134             const scalar minOpposedness
135         );
137         //- Construct from mesh and uncompacted centred face stencil. Splits
138         //  stencil into owner and neighbour (so always pure upwind)
139         extendedUpwindCellToFaceStencil
140         (
141             const cellToFaceStencil&
142         );
145     // Member Functions
147         bool pureUpwind() const
148         {
149             return pureUpwind_;
150         }
152         //- Return reference to the parallel distribution map
153         const mapDistribute& ownMap() const
154         {
155             return ownMapPtr_();
156         }
158         //- Return reference to the parallel distribution map
159         const mapDistribute& neiMap() const
160         {
161             return neiMapPtr_();
162         }
164         //- Return reference to the stencil
165         const labelListList& ownStencil() const
166         {
167             return ownStencil_;
168         }
170         //- Return reference to the stencil
171         const labelListList& neiStencil() const
172         {
173             return neiStencil_;
174         }
176         //- Sum vol field contributions to create face values
177         template<class Type>
178         tmp<GeometricField<Type, fvsPatchField, surfaceMesh> > weightedSum
179         (
180             const surfaceScalarField& phi,
181             const GeometricField<Type, fvPatchField, volMesh>& fld,
182             const List<List<scalar> >& ownWeights,
183             const List<List<scalar> >& neiWeights
184         ) const;
189 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
191 } // End namespace Foam
193 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
195 #ifdef NoRepository
196 #   include "extendedUpwindCellToFaceStencilTemplates.C"
197 #endif
199 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
201 #endif
203 // ************************************************************************* //