lagrangianFieldDecomposerTemplates.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-2017 OpenFOAM Foundation
9  Copyright (C) 2022 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 
30 #include "IOobjectList.H"
31 
32 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
33 
34 template<class Type>
37 (
38  const word& cloudName,
39  const IOField<Type>& field
40 ) const
41 {
42  // Create the field for the processor
44  (
45  IOobject
46  (
47  field.name(),
48  procMesh_.time().timeName(),
50  procMesh_,
54  ),
55  // Mapping internal field values
56  Field<Type>(field, particleIndices_)
57  );
58 }
59 
60 
61 template<class Type>
64 (
65  const word& cloudName,
66  const CompactIOField<Field<Type>, Type>& field
67 ) const
68 {
69  // Create the field for the processor
71  (
72  IOobject
73  (
74  field.name(),
75  procMesh_.time().timeName(),
77  procMesh_,
81  ),
82  // Mapping internal field values
83  Field<Field<Type>>(field, particleIndices_)
84  );
85 }
86 
87 
88 template<class GeoField>
90 (
91  const word& cloudName,
93 ) const
94 {
95  const bool existsOnProc = (particleIndices_.size() > 0);
96 
97  for (const GeoField& fld : fields)
98  {
99  decomposeField(cloudName, fld)().write(existsOnProc);
100  }
101 }
102 
103 
104 template<class GeoField>
106 (
107  const word& cloudName,
108  const PtrList<GeoField>& fields
109 ) const
110 {
111  const bool existsOnProc = (particleIndices_.size() > 0);
112 
113  for (const GeoField& fld : fields)
114  {
115  decomposeFieldField(cloudName, fld)().write(existsOnProc);
116  }
117 }
118 
119 
120 // ************************************************************************* //
rDeltaTY field()
void decomposeFieldFields(const word &cloudName, const PtrList< GeoField > &fields) const
tmp< IOField< Type > > decomposeField(const word &cloudName, const IOField< Type > &field) const
Decompose volume field.
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tf1, const word &name, const dimensionSet &dimensions, const bool initCopy=false)
Global function forwards to reuseTmpDimensionedField::New.
Ignore writing from objectRegistry::writeObject()
multivariateSurfaceInterpolationScheme< scalar >::fieldTable fields
Definition: createFields.H:97
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
const word cloudName(propsDict.get< word >("cloud"))
A class for handling words, derived from Foam::string.
Definition: word.H:63
const Time & time() const noexcept
Return time registry.
static word timeName(const scalar t, const int precision=precision_)
Return a time name for the given scalar time value formatted with the given precision.
Definition: Time.C:714
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
void decomposeFields(const word &cloudName, const PtrList< GeoField > &fields) const
A Field of objects of type <T> with automated input and output using a compact storage. Behaves like IOField except when binary output in case it writes a CompactListList.
Nothing to be read.
A class for managing temporary objects.
Definition: HashPtrTable.H:50
tmp< CompactIOField< Field< Type >, Type > > decomposeFieldField(const word &cloudName, const CompactIOField< Field< Type >, Type > &field) const
Defines the attributes of an object for which implicit objectRegistry management is supported...
Definition: IOobject.H:172
A primitive field of type <T> with automated input and output.
Do not request registration (bool: false)
static const word prefix
The prefix to local: lagrangian.
Definition: cloud.H:79