OpenFOAM: API Guide
v2112
The open source CFD toolbox
particleDistributionTemplates.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) 2016 OpenCFD Ltd.
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 "
IOField.H
"
29
30
template
<
class
Type>
31
bool
Foam::functionObjects::particleDistribution::processField
32
(
33
const
objectRegistry
& obr,
34
const
label fieldi,
35
const
List
<
DynamicList<label>
>& addr
36
)
37
{
38
const
word
& fieldName = nameVsBinWidth_[fieldi].first();
39
const
scalar binWidth = nameVsBinWidth_[fieldi].second();
40
41
if
(obr.
foundObject
<
IOField<Type>
>(fieldName))
42
{
43
const
IOField<Type>
&
field
=
44
obr.
lookupObject
<
IOField<Type>
>(fieldName);
45
46
if
(addr.size())
47
{
48
forAll
(addr, i)
49
{
50
const
Field<Type>
subField(
field
, addr[i]);
51
for
(
direction
d = 0; d < pTraits<Type>::nComponents; ++d)
52
{
53
generateDistribution
54
(
55
fieldName,
56
subField.
component
(d),
57
binWidth,
58
i
59
);
60
}
61
}
62
}
63
else
64
{
65
for
(
direction
d = 0; d < pTraits<Type>::nComponents; ++d)
66
{
67
const
word
fName = fieldName +
pTraits<Type>::componentNames
[d];
68
generateDistribution(fName,
field
.component(d), binWidth);
69
}
70
}
71
72
return
true
;
73
}
74
75
return
false
;
76
}
77
78
79
// ************************************************************************* //
Foam::word
A class for handling words, derived from Foam::string.
Definition:
word.H:65
Foam::IOField
A primitive field of type <T> with automated input and output.
Definition:
foamVtkLagrangianWriter.H:61
Foam::DynamicList< label >
Foam::objectRegistry::foundObject
bool foundObject(const word &name, const bool recursive=false) const
Is the named Type found?
Definition:
objectRegistryTemplates.C:379
forAll
#define forAll(list, i)
Loop across all elements in list.
Definition:
stdFoam.H:296
Foam::objectRegistry
Registry of regIOobjects.
Definition:
objectRegistry.H:60
Foam::Field
Generic templated field type.
Definition:
Field.H:63
Foam::functionObjects::particleDistribution::processField
bool processField(const objectRegistry &obr, const label fieldi, const List< DynamicList< label >> &addr)
Definition:
particleDistributionTemplates.C:32
field
rDeltaTY field()
Foam::objectRegistry::lookupObject
const Type & lookupObject(const word &name, const bool recursive=false) const
Definition:
objectRegistryTemplates.C:434
Foam::Field::component
tmp< Field< cmptType > > component(const direction) const
Return a component field of the field.
Definition:
Field.C:539
IOField.H
Foam::List
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition:
BitOps.H:63
Foam::pTraits
A traits class, which is primarily used for primitives.
Definition:
pTraits.H:56
Foam::direction
uint8_t direction
Definition:
direction.H:52
src
functionObjects
field
particleDistribution
particleDistributionTemplates.C
Generated by
1.8.17
OPENFOAM® is a registered
trademark
of OpenCFD Ltd.