initial commit for version 1.5.x patch release
[OpenFOAM-1.5.x.git] / src / OpenFOAM / fields / pointPatchFields / constraint / processor / processorPointPatchField.H
blobbd37e060824dc60ecf624eff6d768eec7a4ee766
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 1991-2008 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::processorPointPatchField
28 Description
29     Foam::processorPointPatchField
31 SourceFiles
32     processorPointPatchField.C
34 \*---------------------------------------------------------------------------*/
36 #ifndef processorPointPatchField_H
37 #define processorPointPatchField_H
39 #include "coupledPointPatchField.H"
40 #include "processorPointPatch.H"
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
44 namespace Foam
47 /*---------------------------------------------------------------------------*\
48                  Class processorPointPatchField Declaration
49 \*---------------------------------------------------------------------------*/
51 template<class Type>
52 class processorPointPatchField
54     public coupledPointPatchField<Type>
56     // Private data
58         //- Local reference to processor patch
59         const processorPointPatch& procPatch_;
62 public:
64     //- Runtime type information
65     TypeName(processorPointPatch::typeName_());
68     // Constructors
70         //- Construct from patch and internal field
71         processorPointPatchField
72         (
73             const pointPatch&,
74             const DimensionedField<Type, pointMesh>&
75         );
77         //- Construct from patch, internal field and dictionary
78         processorPointPatchField
79         (
80             const pointPatch&,
81             const DimensionedField<Type, pointMesh>&,
82             const dictionary&
83         );
85         //- Construct by mapping given patchField<Type> onto a new patch
86         processorPointPatchField
87         (
88             const processorPointPatchField<Type>&,
89             const pointPatch&,
90             const DimensionedField<Type, pointMesh>&,
91             const pointPatchFieldMapper&
92         );
94         //- Construct and return a clone
95         virtual autoPtr<pointPatchField<Type> > clone() const
96         {
97             return autoPtr<pointPatchField<Type> >
98             (
99                 new processorPointPatchField<Type>
100                 (
101                     *this
102                 )
103             );
104         }
106         //- Construct as copy setting internal field reference
107         processorPointPatchField
108         (
109             const processorPointPatchField<Type>&,
110             const DimensionedField<Type, pointMesh>&
111         );
113         //- Construct and return a clone setting internal field reference
114         virtual autoPtr<pointPatchField<Type> > clone
115         (
116             const DimensionedField<Type, pointMesh>& iF
117         ) const
118         {
119             return autoPtr<pointPatchField<Type> >
120             (
121                 new processorPointPatchField<Type>
122                 (
123                     *this,
124                     iF
125                 )
126             );
127         }
130     // Destructor
132         ~processorPointPatchField();
135     // Member functions
137         // Access
139             //- Return true if running parallel
140             virtual bool coupled() const
141             {
142                 if (Pstream::parRun())
143                 {
144                     return true;
145                 }
146                 else
147                 {
148                     return false;
149                 }
150             }
152             //- Does the patch field perform the transfromation
153             virtual bool doTransform() const
154             {
155                 return
156                    !(
157                         procPatch_.procPolyPatch().parallel()
158                      || pTraits<Type>::rank == 0
159                     );
160             }
163         // Evaluation functions
165             //- Evaluate the patch field
166             virtual void evaluate
167             (
168                 const Pstream::commsTypes commsType=Pstream::blocking
169             )
170             {}
172             //- Initialise swap of patch point values
173             virtual void initSwapAdd(Field<Type>&) const;
175             //- Complete swap of patch point values and add to local values
176             virtual void swapAdd(Field<Type>&) const;
180 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
182 } // End namespace Foam
184 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
186 #ifdef NoRepository
187 #    include "processorPointPatchField.C"
188 #endif
190 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
192 #endif
194 // ************************************************************************* //