OpenFOAM: API Guide
v2112
The open source CFD toolbox
probesGrouping.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 "
probes.H
"
29
#include "
volFields.H
"
30
#include "
surfaceFields.H
"
31
#include "
IOobjectList.H
"
32
#include "
stringListOps.H
"
33
34
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
35
36
void
Foam::probes::clearFieldGroups
()
37
{
38
scalarFields_
.
clear
();
39
vectorFields_
.clear();
40
sphericalTensorFields_
.clear();
41
symmTensorFields_
.clear();
42
tensorFields_
.clear();
43
44
surfaceScalarFields_
.
clear
();
45
surfaceVectorFields_
.clear();
46
surfaceSphericalTensorFields_
.clear();
47
surfaceSymmTensorFields_
.clear();
48
surfaceTensorFields_
.clear();
49
}
50
51
52
Foam::label
Foam::probes::classifyFields
()
53
{
54
label nFields = 0;
55
clearFieldGroups();
56
57
HashTable<wordHashSet>
available =
58
(
59
loadFromFiles_
60
?
IOobjectList
(mesh_, mesh_.time().timeName()).classes(fieldSelection_)
61
: mesh_.classes(fieldSelection_)
62
);
63
64
forAllConstIters
(available, iter)
65
{
66
const
word
& fieldType = iter.key();
67
const
wordList
fieldNames
= iter.val().sortedToc();
68
69
const
label
count
=
fieldNames
.size();
// pre-filtered, so non-empty
70
71
if
(fieldType == volScalarField::typeName)
72
{
73
scalarFields_.
append
(
fieldNames
);
74
nFields +=
count
;
75
}
76
else
if
(fieldType == volVectorField::typeName)
77
{
78
vectorFields_.append(
fieldNames
);
79
nFields +=
count
;
80
}
81
else
if
(fieldType == volSphericalTensorField::typeName)
82
{
83
sphericalTensorFields_.append(
fieldNames
);
84
nFields +=
count
;
85
}
86
else
if
(fieldType == volSymmTensorField::typeName)
87
{
88
symmTensorFields_.append(
fieldNames
);
89
nFields +=
count
;
90
}
91
else
if
(fieldType == volTensorField::typeName)
92
{
93
tensorFields_.append(
fieldNames
);
94
nFields +=
count
;
95
}
96
else
if
(fieldType == surfaceScalarField::typeName)
97
{
98
surfaceScalarFields_.append(
fieldNames
);
99
nFields +=
count
;
100
}
101
else
if
(fieldType == surfaceVectorField::typeName)
102
{
103
surfaceVectorFields_.append(
fieldNames
);
104
nFields +=
count
;
105
}
106
else
if
(fieldType == surfaceSphericalTensorField::typeName)
107
{
108
surfaceSphericalTensorFields_.append(
fieldNames
);
109
nFields +=
count
;
110
}
111
else
if
(fieldType == surfaceSymmTensorField::typeName)
112
{
113
surfaceSymmTensorFields_.append(
fieldNames
);
114
nFields +=
count
;
115
}
116
else
if
(fieldType == surfaceTensorField::typeName)
117
{
118
surfaceTensorFields_.append(
fieldNames
);
119
nFields +=
count
;
120
}
121
}
122
123
return
nFields;
124
}
125
126
127
// ************************************************************************* //
volFields.H
Foam::probes::sphericalTensorFields_
fieldGroup< sphericalTensor > sphericalTensorFields_
Definition:
probes.H:166
Foam::probes::symmTensorFields_
fieldGroup< symmTensor > symmTensorFields_
Definition:
probes.H:167
Foam::word
A class for handling words, derived from Foam::string.
Definition:
word.H:65
Foam::probes::tensorFields_
fieldGroup< tensor > tensorFields_
Definition:
probes.H:168
Foam::probes::scalarFields_
fieldGroup< scalar > scalarFields_
Categorized scalar/vector/tensor vol fields.
Definition:
probes.H:164
Foam::probes::clearFieldGroups
void clearFieldGroups()
Clear old field groups.
Definition:
probesGrouping.C:36
Foam::List::append
void append(const T &val)
Append an element at the end of the list.
Definition:
ListI.H:175
IOobjectList.H
surfaceFields.H
Foam::surfaceFields.
Foam::probes::surfaceVectorFields_
fieldGroup< vector > surfaceVectorFields_
Definition:
probes.H:172
probes.H
Foam::DynamicList::clear
void clear() noexcept
Clear the addressed list, i.e. set the size to zero.
Definition:
DynamicListI.H:391
Foam::probes::surfaceSphericalTensorFields_
fieldGroup< sphericalTensor > surfaceSphericalTensorFields_
Definition:
probes.H:173
fieldNames
const wordRes fieldNames(propsDict.getOrDefault< wordRes >("fields", wordRes()))
Foam::probes::surfaceSymmTensorFields_
fieldGroup< symmTensor > surfaceSymmTensorFields_
Definition:
probes.H:174
Foam::IOobjectList
List of IOobjects with searching and retrieving facilities.
Definition:
IOobjectList.H:55
Foam::probes::vectorFields_
fieldGroup< vector > vectorFields_
Definition:
probes.H:165
Foam::HashTable
A HashTable similar to std::unordered_map.
Definition:
HashTable.H:105
Foam::probes::surfaceScalarFields_
fieldGroup< scalar > surfaceScalarFields_
Categorized scalar/vector/tensor surf fields.
Definition:
probes.H:171
Foam::probes::classifyFields
label classifyFields()
Classify field types, returns the number of fields.
Definition:
probesGrouping.C:52
Foam::probes::surfaceTensorFields_
fieldGroup< tensor > surfaceTensorFields_
Definition:
probes.H:175
forAllConstIters
forAllConstIters(mixture.phases(), phase)
Definition:
pEqn.H:28
Foam::BitOps::count
unsigned int count(const UList< bool > &bools, const bool val=true)
Count number of 'true' entries.
Definition:
BitOps.H:77
Foam::List< word >
stringListOps.H
Operations on lists of strings.
src
sampling
probes
probesGrouping.C
Generated by
1.8.17
OPENFOAM® is a registered
trademark
of OpenCFD Ltd.