pointFieldDecomposerDecomposeFields.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
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.
15 
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.
20 
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/>.
23 
24 \*---------------------------------------------------------------------------*/
25 
26 #include "pointFieldDecomposer.H"
28 
29 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
30 
31 template<class Type>
34 (
36 ) const
37 {
38  // Create and map the internal field values
39  Field<Type> internalField(field.internalField(), pointAddressing_);
40 
41  // Create a list of pointers for the patchFields
42  PtrList<pointPatchField<Type> > patchFields(boundaryAddressing_.size());
43 
44  // Create and map the patch field values
45  forAll(boundaryAddressing_, patchi)
46  {
47  if (patchFieldDecomposerPtrs_[patchi])
48  {
49  patchFields.set
50  (
51  patchi,
53  (
54  field.boundaryField()[boundaryAddressing_[patchi]],
55  procMesh_.boundary()[patchi],
57  *patchFieldDecomposerPtrs_[patchi]
58  )
59  );
60  }
61  else
62  {
63  patchFields.set
64  (
65  patchi,
67  (
68  procMesh_.boundary()[patchi],
70  )
71  );
72  }
73  }
74 
75  // Create the field for the processor
77  (
79  (
80  IOobject
81  (
82  field.name(),
83  procMesh_().time().timeName(),
84  procMesh_(),
85  IOobject::NO_READ,
86  IOobject::NO_WRITE,
87  false
88  ),
89  procMesh_,
90  field.dimensions(),
92  patchFields
93  )
94  );
95 }
96 
97 
98 template<class GeoField>
100 (
102 ) const
103 {
104  forAll(fields, fieldI)
105  {
106  decomposeField(fields[fieldI])().write();
107  }
108 }
109 
110 
111 // ************************************************************************* //
Foam::IOobject
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
Definition: IOobject.H:91
Foam::pointFieldDecomposer::decomposeFields
void decomposeFields(const PtrList< GeoField > &fields) const
Definition: pointFieldDecomposerDecomposeFields.C:100
forAll
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:406
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:118
fields
Info<< "Creating field dpdt\n"<< endl;volScalarField dpdt(IOobject("dpdt", runTime.timeName(), mesh), mesh, dimensionedScalar("dpdt", p.dimensions()/dimTime, 0));Info<< "Creating field kinetic energy K\n"<< endl;volScalarField K("K", 0.5 *magSqr(U));volScalarField p_rgh(IOobject("p_rgh", runTime.timeName(), mesh, IOobject::MUST_READ, IOobject::AUTO_WRITE), mesh);p_rgh=p - rho *gh;mesh.setFluxRequired(p_rgh.name());multivariateSurfaceInterpolationScheme< scalar >::fieldTable fields
Definition: createFields.H:127
Foam::GeometricField::boundaryField
GeometricBoundaryField & boundaryField()
Return reference to GeometricBoundaryField.
Definition: GeometricField.C:735
Foam::pointPatchField
Abstract base class for point-mesh patch fields.
Definition: pointMVCWeight.H:58
Foam::pointFieldDecomposer::decomposeField
tmp< GeometricField< Type, pointPatchField, pointMesh > > decomposeField(const GeometricField< Type, pointPatchField, pointMesh > &) const
Decompose point field.
Foam::PtrList::set
bool set(const label) const
Is element set.
Foam::Field< Type >
Foam::GeometricField::internalField
InternalField & internalField()
Return internal field.
Definition: GeometricField.C:724
Foam::PtrList
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
Definition: List.H:61
pointFieldDecomposer.H
processorPointPatchFields.H
Foam::processorPointPatchField
Foam::processorPointPatchField.
Definition: processorPointPatchField.H:50
internalField
conserve internalField()+
patchi
label patchi
Definition: getPatchFieldScalar.H:1
timeName
word timeName
Definition: getTimeIndex.H:3
Foam::GeometricField
Generic GeometricField class.
Definition: surfaceFieldsFwd.H:52
write
Tcoeff write()
Foam::DimensionedField
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Definition: DimensionedField.H:51