1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
7 -------------------------------------------------------------------------------
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
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 \*---------------------------------------------------------------------------*/
27 #include "processorPointPatchField.H"
28 #include "transformField.H"
29 #include "processorPolyPatch.H"
31 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
36 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
39 processorPointPatchField<Type>::processorPointPatchField
42 const DimensionedField<Type, pointMesh>& iF
45 coupledPointPatchField<Type>(p, iF),
46 procPatch_(refCast<const processorPointPatch>(p))
51 processorPointPatchField<Type>::processorPointPatchField
54 const DimensionedField<Type, pointMesh>& iF,
55 const dictionary& dict
58 coupledPointPatchField<Type>(p, iF, dict),
59 procPatch_(refCast<const processorPointPatch>(p))
64 processorPointPatchField<Type>::processorPointPatchField
66 const processorPointPatchField<Type>& ptf,
68 const DimensionedField<Type, pointMesh>& iF,
69 const pointPatchFieldMapper& mapper
72 coupledPointPatchField<Type>(ptf, p, iF, mapper),
73 procPatch_(refCast<const processorPointPatch>(ptf.patch()))
78 processorPointPatchField<Type>::processorPointPatchField
80 const processorPointPatchField<Type>& ptf,
81 const DimensionedField<Type, pointMesh>& iF
84 coupledPointPatchField<Type>(ptf, iF),
85 procPatch_(refCast<const processorPointPatch>(ptf.patch()))
89 // * * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * //
92 processorPointPatchField<Type>::~processorPointPatchField()
96 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
99 void processorPointPatchField<Type>::initSwapAdd(Field<Type>& pField) const
101 if (Pstream::parRun())
103 // Get internal field into my point order
104 Field<Type> pf(this->patchInternalField(pField));
109 procPatch_.neighbProcNo(),
110 reinterpret_cast<const char*>(pf.begin()),
118 void processorPointPatchField<Type>::swapAdd(Field<Type>& pField) const
120 if (Pstream::parRun())
122 Field<Type> pnf(this->size());
127 procPatch_.neighbProcNo(),
128 reinterpret_cast<char*>(pnf.begin()),
134 const processorPolyPatch& ppp = procPatch_.procPolyPatch();
135 const tensorField& forwardT = ppp.forwardT();
137 if (forwardT.size() == 1)
139 transform(pnf, forwardT[0], pnf);
143 const labelList& nonGlobalPatchPoints =
144 procPatch_.nonGlobalPatchPoints();
145 const labelListList& pointFaces = ppp.pointFaces();
147 forAll(nonGlobalPatchPoints, pfi)
151 forwardT[pointFaces[nonGlobalPatchPoints[pfi]][0]],
158 addToInternalField(pField, pnf);
163 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
165 } // End namespace Foam
167 // ************************************************************************* //