1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright held by original author
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 "pointFieldDecomposer.H"
28 #include "processorPointPatchFields.H"
29 #include "globalPointPatchFields.H"
31 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
36 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
39 tmp<GeometricField<Type, pointPatchField, pointMesh> >
40 pointFieldDecomposer::decomposeField
42 const GeometricField<Type, pointPatchField, pointMesh>& field
45 // Create and map the internal field values
46 Field<Type> internalField(field.internalField(), pointAddressing_);
48 // Create a list of pointers for the patchFields including one extra
49 // for the global patch
50 PtrList<pointPatchField<Type> > patchFields
52 boundaryAddressing_.size() + 1
55 // Create and map the patch field values
56 forAll (boundaryAddressing_, patchi)
58 if (patchFieldDecomposerPtrs_[patchi])
63 pointPatchField<Type>::New
65 field.boundaryField()[boundaryAddressing_[patchi]],
66 procMesh_.boundary()[patchi],
67 DimensionedField<Type, pointMesh>::null(),
68 *patchFieldDecomposerPtrs_[patchi]
77 new ProcessorPointPatchField
87 procMesh_.boundary()[patchi],
88 DimensionedField<Type, pointMesh>::null()
94 // Add the global patch
97 boundaryAddressing_.size(),
98 new GlobalPointPatchField
108 procMesh_.boundary().globalPatch(),
109 DimensionedField<Type, pointMesh>::null()
113 // Create the field for the processor
114 return tmp<GeometricField<Type, pointPatchField, pointMesh> >
116 new GeometricField<Type, pointPatchField, pointMesh>
121 procMesh_().time().timeName(),
135 template<class GeoField>
136 void pointFieldDecomposer::decomposeFields
138 const PtrList<GeoField>& fields
141 forAll (fields, fieldI)
143 decomposeField(fields[fieldI])().write();
148 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
150 } // End namespace Foam
152 // ************************************************************************* //