Forward compatibility: flex
[foam-extend-3.2.git] / src / finiteVolume / fvMesh / fvPatches / constraint / ggi / ggiFvPatch.H
blob05e2bb29a2a0bdb2aabfd6ac81e3a5e633decee4
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | foam-extend: Open Source CFD
4    \\    /   O peration     | Version:     3.2
5     \\  /    A nd           | Web:         http://www.foam-extend.org
6      \\/     M anipulation  | For copyright notice see file Copyright
7 -------------------------------------------------------------------------------
8 License
9     This file is part of foam-extend.
11     foam-extend 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 3 of the License, or (at your
14     option) any later version.
16     foam-extend is distributed in the hope that it will be useful, but
17     WITHOUT ANY WARRANTY; without even the implied warranty of
18     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
19     General Public License for more details.
21     You should have received a copy of the GNU General Public License
22     along with foam-extend.  If not, see <http://www.gnu.org/licenses/>.
24 Class
25     ggiFvPatch
27 Description
28     Generalized grid interface patch.
30 Author
31     Hrvoje Jasak, Wikki Ltd.  All rights reserved
33 SourceFiles
34     ggiFvPatch.C
36 \*---------------------------------------------------------------------------*/
38 #ifndef ggiFvPatch_H
39 #define ggiFvPatch_H
41 #include "coupledFvPatch.H"
42 #include "ggiLduInterface.H"
43 #include "ggiPolyPatch.H"
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47 namespace Foam
50 /*---------------------------------------------------------------------------*\
51                          Class ggiFvPatch Declaration
52 \*---------------------------------------------------------------------------*/
54 class ggiFvPatch
56     public coupledFvPatch,
57     public ggiLduInterface
59     // Private Data
61         //- Reference to polyPatch
62         const ggiPolyPatch& ggiPolyPatch_;
65 protected:
67     // Protected Member functions
69         //- Make patch weighting factors
70         virtual void makeWeights(scalarField&) const;
72         //- Make patch face - neighbour cell distances
73         virtual void makeDeltaCoeffs(scalarField&) const;
75         //- Make patch face non-orthogonality correction vectors
76         virtual void makeCorrVecs(vectorField&) const;
79 public:
81     //- Runtime type information
82     TypeName(ggiPolyPatch::typeName_());
85     // Constructors
87         //- Construct from components
88         ggiFvPatch(const polyPatch& patch, const fvBoundaryMesh& bm)
89         :
90             coupledFvPatch(patch, bm),
91             ggiPolyPatch_(refCast<const ggiPolyPatch>(patch))
92         {}
95     // Destructor
97         virtual ~ggiFvPatch();
100     // Member functions
102         // Access
104             //- Return shadow patch
105             const ggiFvPatch& shadow() const;
107             //- Use bridging to fix overlap error in interpolation
108             bool bridgeOverlap() const
109             {
110                 return ggiPolyPatch_.bridgeOverlap();
111             }
113             //- Return delta (P to N) vectors across coupled patch
114             virtual tmp<vectorField> delta() const;
117         // Interpolation
119             //- Interpolate face field
120             template<class Type>
121             tmp<Field<Type> > interpolate(const Field<Type>& pf) const
122             {
123                 return ggiPolyPatch_.interpolate(pf);
124             }
126             template<class Type>
127             tmp<Field<Type> > interpolate(const tmp<Field<Type> >& tpf) const
128             {
129                 return ggiPolyPatch_.interpolate(tpf);
130             }
132             //- Bridge interpolated face field for uncovered faces
133             template<class Type>
134             void bridge
135             (
136                 const Field<Type>& bridgeField,
137                 Field<Type>& ff
138             ) const
139             {
140                 return ggiPolyPatch_.bridge(bridgeField, ff);
141             }
144         // Interface transfer functions
146             //- Is this the master side?
147             virtual bool master() const;
149             //- Is this the fine level?
150             virtual bool fineLevel() const;
152             //- Return shadow patch index
153             virtual label shadowIndex() const;
155             //- Return shadow interface
156             virtual const ggiLduInterface& shadowInterface() const;
158             //- Return zone size
159             virtual label zoneSize() const;
161             //- Return zone addressing
162             virtual const labelList& zoneAddressing() const;
164             //- Return addressing.  Master side returns own addressing and
165             //  slave side returns addressing from master
166             virtual const labelListList& addressing() const;
168             //- Is the patch localised on a single processor
169             virtual bool localParallel() const;
171             //- Return weights.  Master side returns own weights and
172             //  slave side returns weights from master
173             virtual const scalarListList& weights() const;
175             //- Return face transformation tensor
176             virtual const tensorField& forwardT() const
177             {
178                 return coupledFvPatch::forwardT();
179             }
181             //- Return neighbour-cell transformation tensor
182             virtual const tensorField& reverseT() const
183             {
184                 return coupledFvPatch::reverseT();
185             }
187             //- Return the values of the given internal data adjacent to
188             //  the interface as a field
189             virtual tmp<labelField> interfaceInternalField
190             (
191                 const unallocLabelList& internalData
192             ) const;
194             //- Initialise interface data transfer
195             virtual void initTransfer
196             (
197                 const Pstream::commsTypes commsType,
198                 const unallocLabelList& interfaceData
199             ) const;
201             //- Transfer and return neighbour field
202             virtual tmp<labelField> transfer
203             (
204                 const Pstream::commsTypes commsType,
205                 const unallocLabelList& interfaceData
206             ) const;
208             //- Initialise transfer of internal field adjacent to the interface
209             virtual void initInternalFieldTransfer
210             (
211                 const Pstream::commsTypes commsType,
212                 const unallocLabelList& iF
213             ) const;
215             //- Return neighbour field
216             virtual tmp<labelField> internalFieldTransfer
217             (
218                 const Pstream::commsTypes commsType,
219                 const unallocLabelList& internalData
220             ) const;
224 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
226 } // End namespace Foam
228 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
230 #endif
232 // ************************************************************************* //