pointFieldDecomposerFields.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  Copyright (C) 2021 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 \*---------------------------------------------------------------------------*/
28 
29 #include "pointFieldDecomposer.H"
31 
32 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
33 
34 template<class Type>
37 (
39 ) const
40 {
41  // Create and map the internal field values
42  Field<Type> internalField(field.primitiveField(), pointAddressing_);
43 
44  // Create a list of pointers for the patchFields
45  PtrList<pointPatchField<Type>> patchFields(boundaryAddressing_.size());
46 
47  // Create and map the patch field values
48  forAll(boundaryAddressing_, patchi)
49  {
50  if (patchFieldDecomposerPtrs_.set(patchi))
51  {
52  patchFields.set
53  (
54  patchi,
56  (
57  field.boundaryField()[boundaryAddressing_[patchi]],
58  procMesh_.boundary()[patchi],
60  patchFieldDecomposerPtrs_[patchi]
61  )
62  );
63  }
64  else
65  {
66  patchFields.set
67  (
68  patchi,
70  (
71  procMesh_.boundary()[patchi],
73  )
74  );
75  }
76  }
77 
78  // Create the field for the processor
79  return
81  (
82  IOobject
83  (
84  field.name(),
85  procMesh_().time().timeName(),
86  procMesh_(),
87  IOobject::NO_READ,
88  IOobject::NO_WRITE,
89  false
90  ),
91  procMesh_,
92  field.dimensions(),
93  internalField,
94  patchFields
95  );
96 }
97 
98 
99 template<class GeoField>
101 (
103 ) const
104 {
105  for (const auto& fld : fields)
106  {
107  decomposeField(fld)().write();
108  }
109 }
110 
111 
112 // ************************************************************************* //
Foam::IOobject
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition: IOobject.H:169
Foam::pointFieldDecomposer::decomposeFields
void decomposeFields(const PtrList< GeoField > &fields) const
Decompose list of fields.
Definition: pointFieldDecomposerFields.C:101
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:61
Foam::pointPatchField
Abstract base class for point-mesh patch fields.
Definition: pointMVCWeight.H:60
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.
Foam::Field
Generic templated field type.
Definition: Field.H:63
field
rDeltaTY field()
Foam::PtrList
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
Definition: List.H:59
fld
gmvFile<< "tracers "<< particles.size()<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().x()<< ' ';}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().y()<< ' ';}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().z()<< ' ';}gmvFile<< nl;for(const word &name :lagrangianScalarNames){ IOField< scalar > fld(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
Definition: gmvOutputLagrangian.H:23
processorPointPatchFields.H
Foam::processorPointPatchField
Foam::processorPointPatchField.
Definition: processorPointPatchField.H:52
Foam::New
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tdf1, const word &name, const dimensionSet &dimensions)
Global function forwards to reuseTmpDimensionedField::New.
Definition: DimensionedFieldReuseFunctions.H:105
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:36
Foam::GeometricField
Generic GeometricField class.
Definition: areaFieldsFwd.H:53
fields
multivariateSurfaceInterpolationScheme< scalar >::fieldTable fields
Definition: createFields.H:97
Foam::DimensionedField
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Definition: DimensionedField.H:54