fieldToCell.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) 2011-2015 OpenFOAM Foundation
9 Copyright (C) 2018-2020 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
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
27Class
28 Foam::fieldToCell
29
30Description
31 A \c topoSetCellSource to select cells based on \c volScalarField values,
32 i.e. select cells with given field value of >= min and <= max.
33
34 Operands:
35 \table
36 Operand | Type | Location
37 input | volScalarField | $FOAM_CASE/<time>/<inpField>
38 output | cellSet | $FOAM_CASE/constant/polyMesh/sets/<set>
39 \endtable
40
41Usage
42 Minimal example by using \c system/topoSetDict.actions:
43 \verbatim
44 {
45 // Mandatory (inherited) entries
46 name <name>;
47 type cellSet;
48 action <action>;
49
50 // Mandatory entries
51 source fieldToCell;
52 field <fieldName>;
53 min <minFieldValue>;
54 max <maxFieldValue>;
55 }
56 \endverbatim
57
58 where the entries mean:
59 \table
60 Property | Description | Type | Req'd | Dflt
61 name | Name of cellSet | word | yes | -
62 type | Type name: cellSet | word | yes | -
63 action | Action applied on cells - see below | word | yes | -
64 source | Source name: fieldToCell | word | yes | -
65 field | Name of volScalarField to use | word | yes | -
66 min | The min value for the subset | scalar | yes | -
67 max | The max value for the subset | scalar | yes | -
68 \endtable
69
70 Options for the \c action entry:
71 \verbatim
72 new | Create a new cellSet from selected cells
73 add | Add selected cells into this cellSet
74 subtract | Remove selected cells from this cellSet
75 \endverbatim
76
77See also
78 - Foam::topoSetSource
79 - Foam::topoSetCellSource
80
81SourceFiles
82 fieldToCell.C
83
84\*---------------------------------------------------------------------------*/
85
86#ifndef fieldToCell_H
87#define fieldToCell_H
88
89#include "topoSetCellSource.H"
90#include "scalarField.H"
91
92// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
93
94namespace Foam
95{
96
97/*---------------------------------------------------------------------------*\
98 Class fieldToCell Declaration
99\*---------------------------------------------------------------------------*/
100
101class fieldToCell
102:
103 public topoSetCellSource
104{
105 // Private Data
106
107 //- Add usage string
108 static addToUsageTable usage_;
109
110 //- Name of volScalarField, volVectorField
111 word fieldName_;
112
113 //- Min to subset field values with
114 scalar min_;
115
116 //- Max to subset field values with
117 scalar max_;
118
119
120 // Private Member Functions
121
122 //- Depending on field values add to or delete from cellSet.
123 void applyToSet
124 (
125 const topoSetSource::setAction action,
126 const scalarField& field,
127 topoSet& set
128 ) const;
129
130
131public:
132
133 //- Runtime type information
134 TypeName("fieldToCell");
135
136
137 // Constructors
138
139 //- Construct from components
141 (
142 const polyMesh& mesh,
143 const word& fieldName,
144 const scalar min,
145 const scalar max
146 );
147
148 //- Construct from dictionary
149 fieldToCell(const polyMesh& mesh, const dictionary& dict);
150
151 //- Construct from Istream
152 fieldToCell(const polyMesh& mesh, Istream& is);
153
154
155 //- Destructor
156 virtual ~fieldToCell() = default;
157
158
159 // Member Functions
161 virtual void applyToSet
162 (
163 const topoSetSource::setAction action,
164 topoSet& set
165 ) const;
166};
167
168
169// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
170
171} // End namespace Foam
172
173// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
174
175#endif
176
177// ************************************************************************* //
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:64
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
A topoSetCellSource to select cells based on volScalarField values, i.e. select cells with given fiel...
Definition: fieldToCell.H:163
virtual ~fieldToCell()=default
Destructor.
fieldToCell(const polyMesh &mesh, const word &fieldName, const scalar min, const scalar max)
Construct from components.
Definition: fieldToCell.C:123
TypeName("fieldToCell")
Runtime type information.
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:81
The topoSetCellSource is a intermediate class for handling topoSet sources for selecting cells.
Class with constructor to add usage string to table.
setAction
Enumeration defining various actions.
const polyMesh & mesh() const noexcept
Reference to the mesh.
General set of labels of mesh quantity (points, cells, faces).
Definition: topoSet.H:67
A class for handling words, derived from Foam::string.
Definition: word.H:68
rDeltaTY field()
Namespace for OpenFOAM.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
Definition: hashSets.C:47
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
Definition: hashSets.C:33
dictionary dict
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition: typeInfo.H:73