1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-2008 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 "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<Type>
79 procMesh_.boundary()[patchi],
80 DimensionedField<Type, pointMesh>::null()
86 // Add the global patch
89 boundaryAddressing_.size(),
90 new globalPointPatchField<Type>
92 procMesh_.boundary().globalPatch(),
93 DimensionedField<Type, pointMesh>::null()
97 // Create the field for the processor
98 return tmp<GeometricField<Type, pointPatchField, pointMesh> >
100 new GeometricField<Type, pointPatchField, pointMesh>
105 procMesh_().time().timeName(),
119 template<class GeoField>
120 void pointFieldDecomposer::decomposeFields
122 const PtrList<GeoField>& fields
125 forAll (fields, fieldI)
127 decomposeField(fields[fieldI])().write();
132 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
134 } // End namespace Foam
136 // ************************************************************************* //