1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | foam-extend: Open Source CFD
4 \\ / O peration | Version: 3.2
5 \\ / A nd | Web: http://www.foam-extend.org
6 \\/ M anipulation | For copyright notice see file Copyright
7 -------------------------------------------------------------------------------
9 This file is part of foam-extend.
11 foam-extend 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 3 of the License, or (at your
14 option) any later version.
16 foam-extend is distributed in the hope that it will be useful, but
17 WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 General Public License for more details.
21 You should have received a copy of the GNU General Public License
22 along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
24 \*---------------------------------------------------------------------------*/
26 #include "pointFieldReconstructor.H"
28 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
31 Foam::tmp<Foam::GeometricField<Type, Foam::pointPatchField, Foam::pointMesh> >
32 Foam::pointFieldReconstructor::reconstructField(const IOobject& fieldIoObject)
34 // Read the field for all the processors
35 PtrList<GeometricField<Type, pointPatchField, pointMesh> > procFields
40 forAll (procMeshes_, proci)
45 new GeometricField<Type, pointPatchField, pointMesh>
50 procMeshes_[proci]().time().timeName(),
61 // Create the internalField
62 Field<Type> internalField(mesh_.size());
64 // Create the patch fields
65 PtrList<pointPatchField<Type> > patchFields(mesh_.boundary().size());
68 forAll (procMeshes_, proci)
70 const GeometricField<Type, pointPatchField, pointMesh>&
71 procField = procFields[proci];
73 // Get processor-to-global addressing for use in rmap
74 const labelList& procToGlobalAddr = pointProcAddressing_[proci];
76 // Set the cell values in the reconstructed field
79 procField.internalField(),
83 // Set the boundary patch values in the reconstructed field
84 forAll(boundaryProcAddressing_[proci], patchi)
86 // Get patch index of the original patch
87 const label curBPatch = boundaryProcAddressing_[proci][patchi];
89 // check if the boundary patch is not a processor patch
92 if (!patchFields(curBPatch))
97 pointPatchField<Type>::New
99 procField.boundaryField()[patchi],
100 mesh_.boundary()[curBPatch],
101 DimensionedField<Type, pointMesh>::null(),
102 pointPatchFieldReconstructor
104 mesh_.boundary()[curBPatch].size(),
105 procField.boundaryField()[patchi].size()
111 patchFields[curBPatch].rmap
113 procField.boundaryField()[patchi],
114 patchPointAddressing_[proci][patchi]
120 // Construct and write the field
121 // setting the internalField and patchFields
122 return tmp<GeometricField<Type, pointPatchField, pointMesh> >
124 new GeometricField<Type, pointPatchField, pointMesh>
128 fieldIoObject.name(),
129 mesh_().time().timeName(),
135 procFields[0].dimensions(),
143 // Reconstruct and write all point fields
145 void Foam::pointFieldReconstructor::reconstructFields
147 const IOobjectList& objects
152 GeometricField<Type, pointPatchField, pointMesh>::typeName
155 IOobjectList fields = objects.lookupClass(fieldClassName);
159 Info<< " Reconstructing " << fieldClassName << "s\n" << endl;
163 IOobjectList::iterator fieldIter = fields.begin();
164 fieldIter != fields.end();
168 Info<< " " << fieldIter()->name() << endl;
170 reconstructField<Type>(*fieldIter())().write();
178 // ************************************************************************* //