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 | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011-2016 OpenFOAM Foundation
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 \*---------------------------------------------------------------------------*/
27 
28 #include "pointFieldDecomposer.H"
30 
31 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
32 
33 template<class Type>
36 (
37  const GeometricField<Type, pointPatchField, pointMesh>& field
38 ) const
39 {
40  // Create and map the internal field values
41  Field<Type> internalField(field.primitiveField(), pointAddressing_);
42 
43  // Create a list of pointers for the patchFields
44  PtrList<pointPatchField<Type>> patchFields(boundaryAddressing_.size());
45 
46  // Create and map the patch field values
47  forAll(boundaryAddressing_, patchi)
48  {
49  if (patchFieldDecomposerPtrs_[patchi])
50  {
51  patchFields.set
52  (
53  patchi,
55  (
56  field.boundaryField()[boundaryAddressing_[patchi]],
57  procMesh_.boundary()[patchi],
59  *patchFieldDecomposerPtrs_[patchi]
60  )
61  );
62  }
63  else
64  {
65  patchFields.set
66  (
67  patchi,
68  new processorPointPatchField<Type>
69  (
70  procMesh_.boundary()[patchi],
72  )
73  );
74  }
75  }
76 
77  // Create the field for the processor
78  return tmp<GeometricField<Type, pointPatchField, pointMesh>>
79  (
80  new GeometricField<Type, pointPatchField, pointMesh>
81  (
82  IOobject
83  (
84  field.name(),
85  procMesh_().time().timeName(),
86  procMesh_(),
89  false
90  ),
91  procMesh_,
92  field.dimensions(),
93  internalField,
94  patchFields
95  )
96  );
97 }
98 
99 
100 template<class GeoField>
102 (
103  const PtrList<GeoField>& fields
104 ) const
105 {
106  forAll(fields, fieldi)
107  {
108  decomposeField(fields[fieldi])().write();
109  }
110 }
111 
112 
113 // ************************************************************************* //
Foam::IOobject::NO_WRITE
Definition: IOobject.H:130
Foam::pointMesh::boundary
const pointBoundaryMesh & boundary() const
Return reference to boundary mesh.
Definition: pointMesh.H:108
Foam::pointFieldDecomposer::decomposeFields
void decomposeFields(const PtrList< GeoField > &fields) const
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:61
Foam::Time::timeName
static word timeName(const scalar t, const int precision=precision_)
Definition: Time.C:780
Foam::DimensionedField::null
static const DimensionedField< Type, GeoMesh > & null()
Return a NullObjectRef DimensionedField.
Definition: DimensionedFieldI.H:33
Foam::IOobject::time
const Time & time() const
Return time.
Definition: IOobject.C:463
forAll
#define forAll(list, i)
Loop across all elements in list.
Definition: stdFoam.H:296
Foam::pointFieldDecomposer::decomposeField
tmp< GeometricField< Type, pointPatchField, pointMesh > > decomposeField(const GeometricField< Type, pointPatchField, pointMesh > &) const
Decompose point field.
field
rDeltaTY field()
Foam::pointPatchField::New
static autoPtr< pointPatchField< Type > > New(const word &, const pointPatch &, const DimensionedField< Type, pointMesh > &)
Return a pointer to a new patchField created on freestore given.
Definition: pointPatchFieldNew.C:94
processorPointPatchFields.H
pointFieldDecomposer.H
Foam::vtk::write
void write(vtk::formatter &fmt, const Type &val, const label n=1)
Component-wise write of a value (N times)
Definition: foamVtkOutputTemplates.C:35
Foam::IOobject::NO_READ
Definition: IOobject.H:123
fields
multivariateSurfaceInterpolationScheme< scalar >::fieldTable fields
Definition: createFields.H:97