pointFieldDecomposerTemplates.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-2024 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 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_.set(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  (
78  field.name(),
80  procMesh_,
81  field.dimensions(),
82  // Internal field - mapped values
83  Field<Type>(field.primitiveField(), pointAddressing_),
84  // Boundary field
85  patchFields
86  );
87 }
88 
89 
90 template<class GeoField>
92 (
94 ) const
95 {
96  for (const auto& fld : fields)
97  {
98  decomposeField(fld)().write();
99  }
100 }
101 
102 
103 // ************************************************************************* //
void size(const label n)
Older name for setAddressableSize.
Definition: UList.H:116
rDeltaTY field()
static const DimensionedField< Type, GeoMesh > & null() noexcept
Return a null DimensionedField (reference to a nullObject).
multivariateSurfaceInterpolationScheme< scalar >::fieldTable fields
Definition: createFields.H:97
#define forAll(list, i)
Loop across all elements in list.
Definition: stdFoam.H:421
Abstract base class for point-mesh patch fields.
void write(vtk::formatter &fmt, const Type &val, const label n=1)
Component-wise write of a value (N times)
Generic templated field type.
Definition: Field.H:62
tmp< GeometricField< Type, pointPatchField, pointMesh > > decomposeField(const GeometricField< Type, pointPatchField, pointMesh > &) const
Decompose point field.
static tmp< GeometricField< Type, PatchField, GeoMesh > > New(const word &name, IOobjectOption::registerOption regOpt, const Mesh &mesh, const dimensionSet &dims, const word &patchFieldType=PatchField< Type >::calculatedType())
Return tmp field (NO_READ, NO_WRITE) from name, mesh, dimensions and patch type. [Takes current timeN...
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))
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers...
Definition: List.H:55
Foam::processorPointPatchField.
A class for managing temporary objects.
Definition: HashPtrTable.H:50
const pointBoundaryMesh & boundary() const noexcept
Return reference to boundary mesh.
Definition: pointMesh.H:140
Do not request registration (bool: false)
void decomposeFields(const PtrList< GeoField > &fields) const
Decompose list of fields.