BUG: UListIO: byteSize overflowing on really big faceLists
[OpenFOAM-2.0.x.git] / applications / utilities / parallelProcessing / decomposePar / pointFieldDecomposerDecomposeFields.C
blob12760da2ae9067758b137fee96cd9c4ff1bef5ec
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 2011 OpenFOAM Foundation
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
13     the Free Software Foundation, either version 3 of the License, or
14     (at your 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, see <http://www.gnu.org/licenses/>.
24 \*---------------------------------------------------------------------------*/
26 #include "pointFieldDecomposer.H"
27 #include "processorPointPatchFields.H"
29 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
31 template<class Type>
32 Foam::tmp<Foam::GeometricField<Type, Foam::pointPatchField, Foam::pointMesh> >
33 Foam::pointFieldDecomposer::decomposeField
35     const GeometricField<Type, pointPatchField, pointMesh>& field
36 ) const
38     // Create and map the internal field values
39     Field<Type> internalField(field.internalField(), pointAddressing_);
41     // Create a list of pointers for the patchFields
42     PtrList<pointPatchField<Type> > patchFields(boundaryAddressing_.size());
44     // Create and map the patch field values
45     forAll(boundaryAddressing_, patchi)
46     {
47         if (patchFieldDecomposerPtrs_[patchi])
48         {
49             patchFields.set
50             (
51                 patchi,
52                 pointPatchField<Type>::New
53                 (
54                     field.boundaryField()[boundaryAddressing_[patchi]],
55                     procMesh_.boundary()[patchi],
56                     DimensionedField<Type, pointMesh>::null(),
57                     *patchFieldDecomposerPtrs_[patchi]
58                 )
59             );
60         }
61         else
62         {
63             patchFields.set
64             (
65                 patchi,
66                 new processorPointPatchField<Type>
67                 (
68                     procMesh_.boundary()[patchi],
69                     DimensionedField<Type, pointMesh>::null()
70                 )
71             );
72         }
73     }
75     // Create the field for the processor
76     return tmp<GeometricField<Type, pointPatchField, pointMesh> >
77     (
78         new GeometricField<Type, pointPatchField, pointMesh>
79         (
80             IOobject
81             (
82                 field.name(),
83                 procMesh_().time().timeName(),
84                 procMesh_(),
85                 IOobject::NO_READ,
86                 IOobject::NO_WRITE
87             ),
88             procMesh_,
89             field.dimensions(),
90             internalField,
91             patchFields
92         )
93     );
97 template<class GeoField>
98 void Foam::pointFieldDecomposer::decomposeFields
100     const PtrList<GeoField>& fields
101 ) const
103     forAll(fields, fieldI)
104     {
105         decomposeField(fields[fieldI])().write();
106     }
110 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
112 // ************************************************************************* //