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 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 Class
28  Foam::fieldToCell
29 
30 Description
31  A topoSetCellSource to select cells based on field values.
32 
33  \heading Dictionary parameters
34  \table
35  Property | Description | Required | Default
36  field | The (scalar, vector) field to use | yes |
37  min | The min value for the subset | yes |
38  max | The max value for the subset | yes |
39  \endtable
40 
41 SourceFiles
42  fieldToCell.C
43 
44 \*---------------------------------------------------------------------------*/
45 
46 #ifndef fieldToCell_H
47 #define fieldToCell_H
48 
49 #include "topoSetCellSource.H"
50 #include "scalarField.H"
51 
52 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
53 
54 namespace Foam
55 {
56 
57 /*---------------------------------------------------------------------------*\
58  Class fieldToCell Declaration
59 \*---------------------------------------------------------------------------*/
60 
61 class fieldToCell
62 :
63  public topoSetCellSource
64 {
65 
66  // Private data
67 
68  //- Add usage string
69  static addToUsageTable usage_;
70 
71 
72  //- Name of volScalarField, volVectorField
73  word fieldName_;
74 
75  //- Min to subset field values with
76  scalar min_;
77 
78  //- Max to subset field values with
79  scalar max_;
80 
81 
82  // Private Member Functions
83 
84  //- Depending on field values add to or delete from cellSet.
85  void applyToSet
86  (
87  const topoSetSource::setAction action,
88  const scalarField& field,
89  topoSet& set
90  ) const;
91 
92 public:
93 
94  //- Runtime type information
95  TypeName("fieldToCell");
96 
97  // Constructors
98 
99  //- Construct from components
101  (
102  const polyMesh& mesh,
103  const word& fieldName,
104  const scalar min,
105  const scalar max
106  );
107 
108  //- Construct from dictionary
109  fieldToCell(const polyMesh& mesh, const dictionary& dict);
110 
111  //- Construct from Istream
112  fieldToCell(const polyMesh& mesh, Istream& is);
113 
114 
115  //- Destructor
116  virtual ~fieldToCell() = default;
117 
118 
119  // Member Functions
120 
121  virtual void applyToSet
122  (
123  const topoSetSource::setAction action,
124  topoSet& set
125  ) const;
126 
127 };
128 
129 
130 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
131 
132 } // End namespace Foam
133 
134 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
135 
136 #endif
137 
138 // ************************************************************************* //
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:62
Foam::fieldToCell::~fieldToCell
virtual ~fieldToCell()=default
Destructor.
scalarField.H
Foam::fieldToCell::fieldToCell
fieldToCell(const polyMesh &mesh, const word &fieldName, const scalar min, const scalar max)
Construct from components.
Definition: fieldToCell.C:123
Foam::topoSetSource::setAction
setAction
Enumeration defining the valid actions.
Definition: topoSetSource.H:99
Foam::topoSetSource::mesh
const polyMesh & mesh() const
Reference to the mesh.
Definition: topoSetSource.H:333
Foam::fieldToCell
A topoSetCellSource to select cells based on field values.
Definition: fieldToCell.H:80
Foam::min
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
Definition: hashSets.C:33
Foam::polyMesh
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:77
Foam::Field< scalar >
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:61
field
rDeltaTY field()
Foam::topoSet
General set of labels of mesh quantity (points, cells, faces).
Definition: topoSet.H:66
topoSetCellSource.H
Foam::max
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
Definition: hashSets.C:47
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:121
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::topoSetCellSource
Base class of a topoSet source for selecting cells.
Definition: topoSetCellSource.H:50
Foam::fieldToCell::TypeName
TypeName("fieldToCell")
Runtime type information.