parcelSelectionDetail.H
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) 2018 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 Class
27  Foam::Detail::parcelSelection
28 
29 Description
30  Selection of parcels based on their objectRegistry entries.
31  Normally accessed via a dictionary entry.
32 
33  Example sub-dictionary entry
34  \verbatim
35  selection
36  {
37  stride
38  {
39  // every 10th parcelId
40  action use;
41  source stride;
42  stride 10;
43  }
44  injector
45  {
46  // Only output from injectorID == 1
47  action subset;
48  source field;
49  field typeId;
50  accept (equal 1);
51  }
52  Umin
53  {
54  // Remove slow parcels
55  action subtract;
56  source field;
57  field U;
58  accept (less 1e-3);
59  }
60  diam
61  {
62  // Only particular diameter ranges
63  action subset;
64  source field;
65  field d;
66  accept (greater 1e-5) and (less 1e-3);
67  }
68  }
69  \endverbatim
70 
71  \heading Entry type
72  \table
73  Property | Description | Required | Default
74  action | all/clear/invert/ignore add/subtract/subset/use | yes |
75  source | field/stride | mostly |
76  \endtable
77 
78  \heading Stride source
79  \table
80  Property | Description | Required | Default
81  stride | The stride for the parcel id | yes |
82  \endtable
83 
84  \heading Field source
85  \table
86  Property | Description | Required | Default
87  field | The label/scalar/vector field name | yes |
88  accept | Acceptance or test criterion | yes |
89  \endtable
90 
91  The \c accept criterion has two forms:
92  -# single expression
93  - (expr)
94  -# composite expression
95  - (expr) or (expr)
96  - (expr) and (expr)
97 
98  The expressions are a (op scalar) pair that form a unary scalar
99  predicate. The \a op is one of the following:
100  - lt, less
101  - le, lessEq
102  - gt, greater
103  - ge, greaterEq
104  - eq, equal
105  - neq, notEqual
106 
107  For example,
108  \verbatim
109  accept (less 10);
110  accept (less 10) or (greater 100);
111  accept (ge 10) and (le 20);
112  \endverbatim
113 
114 See also
115  Foam::predicates::scalars
116  Foam::functionObjects::vtkCloud
117 
118 SourceFiles
119  parcelSelectionDetail.C
120 
121 \*---------------------------------------------------------------------------*/
122 
123 #ifndef parcelSelectionDetail_H
124 #define parcelSelectionDetail_H
125 
126 #include "bitSet.H"
127 #include "Enum.H"
128 #include "objectRegistry.H"
129 
130 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
131 
132 namespace Foam
133 {
134 namespace Detail
135 {
136 
137 /*---------------------------------------------------------------------------*\
138  Class Detail::parcelSelection Declaration
139 \*---------------------------------------------------------------------------*/
140 
141 class parcelSelection
142 {
143 public:
144 
145  //- Enumeration defining the valid selection actions
146  enum actionType
147  {
148  ALL,
149  CLEAR,
150  INVERT,
151  ADD,
152  SUBTRACT,
153  SUBSET,
154  USE,
155  IGNORE,
156  };
157 
158  //- Names for the actionType
159  static const Enum<actionType> actionNames;
160 
161 
162  //- Enumeration defining the valid sources
163  enum sourceType
164  {
165  FIELD,
166  STRIDE
167  };
168 
169  //- Names for the sourceType
170  static const Enum<sourceType> sourceNames;
171 
172 
173  //- Enumeration defining and/or logic
174  enum logicType { AND, OR };
175 
176  //- Names for the logicType
177  static const Enum<logicType> logicNames;
178 
179 
180 protected:
181 
182  // Protected data
183 
184  //- The filtered parcel addressing. Eg, for the current cloud.
186 
187  //- The filtered parcel addressing. Eg, for the current cloud.
189 
190 
191  // Protected Member Functions
192 
193  //- Calculate parcel selection filter.
194  // \return True if the filter is applicable
195  bool calculateFilter
196  (
197  const objectRegistry& obrTmp,
198  const bool log = true
199  );
200 
201 public:
202 
203  // Constructors
204 
205  //- Construct null
206  parcelSelection();
207 
208 
209  //- Destructor
210  virtual ~parcelSelection() = default;
211 
212 };
213 
214 
215 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
216 
217 } // End namespace Detail
218 } // End namespace Foam
219 
220 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
221 
222 #endif
223 
224 // ************************************************************************* //
Foam::Enum< actionType >
Foam::bitSet
A bitSet stores bits (elements with only two states) in packed internal format and supports a variety...
Definition: bitSet.H:64
Foam::Detail::parcelSelection::INVERT
"invert" - invert the selection
Definition: parcelSelectionDetail.H:189
Foam::Detail::parcelSelection
Selection of parcels based on their objectRegistry entries. Normally accessed via a dictionary entry.
Definition: parcelSelectionDetail.H:180
Foam::Detail::parcelSelection::sourceType
sourceType
Enumeration defining the valid sources.
Definition: parcelSelectionDetail.H:202
Foam::Detail::parcelSelection::actionNames
static const Enum< actionType > actionNames
Names for the actionType.
Definition: parcelSelectionDetail.H:198
objectRegistry.H
Foam::Detail::parcelSelection::SUBSET
"subset" - subset parcel selection
Definition: parcelSelectionDetail.H:192
Foam::Detail::parcelSelection::logicNames
static const Enum< logicType > logicNames
Names for the logicType.
Definition: parcelSelectionDetail.H:216
Foam::Detail::parcelSelection::actionType
actionType
Enumeration defining the valid selection actions.
Definition: parcelSelectionDetail.H:185
Foam::Detail::parcelSelection::parcelSelection
parcelSelection()
Construct null.
Definition: parcelSelectionDetail.C:149
bitSet.H
Foam::Detail::parcelSelection::ADD
"add" - parcel selection
Definition: parcelSelectionDetail.H:190
Foam::Detail::parcelSelection::calculateFilter
bool calculateFilter(const objectRegistry &obrTmp, const bool log=true)
Calculate parcel selection filter.
Definition: parcelSelectionDetail.C:159
Foam::objectRegistry
Registry of regIOobjects.
Definition: objectRegistry.H:60
Foam::Detail::parcelSelection::ALL
"all" - select all parcels
Definition: parcelSelectionDetail.H:187
Foam::Detail::parcelSelection::USE
"use" - same as clear + add
Definition: parcelSelectionDetail.H:193
Foam::Detail::parcelSelection::IGNORE
"ignore" - dummy no-op
Definition: parcelSelectionDetail.H:194
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:121
Foam::Detail::parcelSelection::sourceNames
static const Enum< sourceType > sourceNames
Names for the sourceType.
Definition: parcelSelectionDetail.H:209
Foam::log
dimensionedScalar log(const dimensionedScalar &ds)
Definition: dimensionedScalar.C:262
Foam::Detail::parcelSelection::AND
Definition: parcelSelectionDetail.H:213
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::Detail::parcelSelection::SUBTRACT
"subtract" - remove parcel selection
Definition: parcelSelectionDetail.H:191
Foam::Detail::parcelSelection::parcelSelect_
dictionary parcelSelect_
The filtered parcel addressing. Eg, for the current cloud.
Definition: parcelSelectionDetail.H:224
Foam::Detail::parcelSelection::logicType
logicType
Enumeration defining and/or logic.
Definition: parcelSelectionDetail.H:213
Foam::Detail::parcelSelection::STRIDE
"stride" - select based on stride (parcel id)
Definition: parcelSelectionDetail.H:205
Foam::Detail::parcelSelection::FIELD
"field" - select based on field value
Definition: parcelSelectionDetail.H:204
Foam::Detail::parcelSelection::~parcelSelection
virtual ~parcelSelection()=default
Destructor.
Foam::Detail::parcelSelection::CLEAR
"clear" - clear the selection
Definition: parcelSelectionDetail.H:188
Foam::Detail::parcelSelection::parcelAddr_
bitSet parcelAddr_
The filtered parcel addressing. Eg, for the current cloud.
Definition: parcelSelectionDetail.H:227
Foam::Detail::parcelSelection::OR
Definition: parcelSelectionDetail.H:213
Enum.H