initial commit for version 1.6.x patch release
[OpenFOAM-1.6.x.git] / src / finiteVolume / fields / fvPatchFields / constraint / processor / processorFvPatchField.H
blob922b11c40d061f737be144a9cd1099569823a6e2
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::processorFvPatchField
28 Description
29     Foam::processorFvPatchField
31 SourceFiles
32     processorFvPatchField.C
34 \*---------------------------------------------------------------------------*/
36 #ifndef processorFvPatchField_H
37 #define processorFvPatchField_H
39 #include "coupledFvPatchField.H"
40 #include "processorLduInterfaceField.H"
41 #include "processorFvPatch.H"
43 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45 namespace Foam
48 /*---------------------------------------------------------------------------*\
49                       Class processorFvPatch Declaration
50 \*---------------------------------------------------------------------------*/
52 template<class Type>
53 class processorFvPatchField
55     public processorLduInterfaceField,
56     public coupledFvPatchField<Type>
58     // Private data
60         //- Local reference cast into the processor patch
61         const processorFvPatch& procPatch_;
64 public:
66     //- Runtime type information
67     TypeName(processorFvPatch::typeName_());
70     // Constructors
72         //- Construct from patch and internal field
73         processorFvPatchField
74         (
75             const fvPatch&,
76             const DimensionedField<Type, volMesh>&
77         );
79         //- Construct from patch and internal field and patch field
80         processorFvPatchField
81         (
82             const fvPatch&,
83             const DimensionedField<Type, volMesh>&,
84             const Field<Type>&
85         );
87         //- Construct from patch, internal field and dictionary
88         processorFvPatchField
89         (
90             const fvPatch&,
91             const DimensionedField<Type, volMesh>&,
92             const dictionary&
93         );
95         //- Construct by mapping given processorFvPatchField onto a new patch
96         processorFvPatchField
97         (
98             const processorFvPatchField<Type>&,
99             const fvPatch&,
100             const DimensionedField<Type, volMesh>&,
101             const fvPatchFieldMapper&
102         );
104         //- Construct as copy
105         processorFvPatchField(const processorFvPatchField<Type>&);
107         //- Construct and return a clone
108         virtual tmp<fvPatchField<Type> > clone() const
109         {
110             return tmp<fvPatchField<Type> >
111             (
112                 new processorFvPatchField<Type>(*this)
113             );
114         }
116         //- Construct as copy setting internal field reference
117         processorFvPatchField
118         (
119             const processorFvPatchField<Type>&,
120             const DimensionedField<Type, volMesh>&
121         );
123         //- Construct and return a clone setting internal field reference
124         virtual tmp<fvPatchField<Type> > clone
125         (
126             const DimensionedField<Type, volMesh>& iF
127         ) const
128         {
129             return tmp<fvPatchField<Type> >
130             (
131                 new processorFvPatchField<Type>(*this, iF)
132             );
133         }
136     // Destructor
138         ~processorFvPatchField();
141     // Member functions
143         // Access
145             //- Return true if running parallel
146             virtual bool coupled() const
147             {
148                 if (Pstream::parRun())
149                 {
150                     return true;
151                 }
152                 else
153                 {
154                     return false;
155                 }
156             }
158             //- Return neighbour field given internal field
159             tmp<Field<Type> > patchNeighbourField() const;
162         // Evaluation functions
164             //- Initialise the evaluation of the patch field
165             virtual void initEvaluate(const Pstream::commsTypes commsType);
167             //- Evaluate the patch field
168             virtual void evaluate(const Pstream::commsTypes commsType);
170             //- Return patch-normal gradient
171             virtual tmp<Field<Type> > snGrad() const;
173             //- Initialise neighbour matrix update
174             virtual void initInterfaceMatrixUpdate
175             (
176                 const scalarField& psiInternal,
177                 scalarField& result,
178                 const lduMatrix& m,
179                 const scalarField& coeffs,
180                 const direction cmpt,
181                 const Pstream::commsTypes commsType
182             ) const;
184             //- Update result field based on interface functionality
185             virtual void updateInterfaceMatrix
186             (
187                 const scalarField& psiInternal,
188                 scalarField& result,
189                 const lduMatrix& m,
190                 const scalarField& coeffs,
191                 const direction cmpt,
192                 const Pstream::commsTypes commsType
193             ) const;
195         //- Processor coupled interface functions
197             //- Return processor number
198             virtual int myProcNo() const
199             {
200                 return procPatch_.myProcNo();
201             }
203             //- Return neigbour processor number
204             virtual int neighbProcNo() const
205             {
206                 return procPatch_.neighbProcNo();
207             }
209             //- Does the patch field perform the transfromation
210             virtual bool doTransform() const
211             {
212                 return !(procPatch_.parallel() || pTraits<Type>::rank == 0);
213             }
215             //- Return face transformation tensor
216             virtual const tensorField& forwardT() const
217             {
218                 return procPatch_.forwardT();
219             }
221             //- Return rank of component for transform
222             virtual int rank() const
223             {
224                 return pTraits<Type>::rank;
225             }
229 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
231 } // End namespace Foam
233 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
235 #ifdef NoRepository
236 #   include "processorFvPatchField.C"
237 #endif
239 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
241 #endif
243 // ************************************************************************* //