haloToCell.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) 2019-2021 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::haloToCell
28 
29 Description
30  A \c topoSetCellSource to select cells attached to the outside
31  of this \c cellSet, and add into/remove from this \c cellSet.
32 
33  Operands:
34  \table
35  Operand | Type | Location
36  input | cellSet | $FOAM_CASE/constant/polyMesh/sets/<set>
37  output | cellSet | $FOAM_CASE/constant/polyMesh/sets/<set>
38  \endtable
39 
40 Usage
41  Minimal example by using \c system/topoSetDict.actions:
42  \verbatim
43  {
44  // Mandatory (inherited) entries
45  name <name>;
46  type cellSet;
47  action <action>;
48 
49  // Mandatory entries
50  source haloToCell;
51 
52  // Optional entries
53  steps 1;
54  }
55  \endverbatim
56 
57  where the entries mean:
58  \table
59  Property | Description | Type | Req'd | Dflt
60  name | Name of cellSet | word | yes | -
61  type | Type name: cellSet | word | yes | -
62  action | Action applied on cells - see below | word | yes | -
63  source | Source name: haloToCell | word | yes | -
64  steps | Number of grow/shrink steps to use | label | no | 1
65  \endtable
66 
67  Options for the \c action entry:
68  \verbatim
69  add | Add selected cells into this cellSet
70  subtract | Remove selected cells from this cellSet
71  \endverbatim
72 
73 Note
74  - \c action=new is not available for \c haloToCell.
75  - When removing halo cells, this strips off
76  any cells on the boundary of the cellSet.
77 
78 See also
79  - Foam::topoSetSource
80  - Foam::topoSetCellSource
81 
82 SourceFiles
83  haloToCell.C
84 
85 \*---------------------------------------------------------------------------*/
86 
87 #ifndef haloToCell_H
88 #define haloToCell_H
89 
90 #include "topoSetCellSource.H"
91 
92 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
93 
94 namespace Foam
95 {
96 
97 /*---------------------------------------------------------------------------*\
98  Class haloToCell Declaration
99 \*---------------------------------------------------------------------------*/
100 
101 class haloToCell
102 :
103  public topoSetCellSource
104 {
105  // Private Data
106 
107  //- Add usage string
108  static addToUsageTable usage_;
109 
110  //- Number of grow/shrink steps
111  label steps_;
112 
113 
114  // Private Member Functions
115 
116  void combine(topoSet& set, const bool add) const;
117 
118 
119 public:
120 
121  //- Runtime type information
122  TypeName("haloToCell");
123 
124 
125  // Constructors
126 
127  //- Construct from components
128  explicit haloToCell(const polyMesh& mesh, const label nsteps=1);
129 
130  //- Construct from dictionary
131  haloToCell(const polyMesh& mesh, const dictionary& dict);
132 
133  //- Construct from Istream
134  haloToCell(const polyMesh& mesh, Istream& is);
135 
136 
137  //- Destructor
138  virtual ~haloToCell() = default;
139 
140 
141  // Member Functions
142 
143  //- The number of steps to grow/shrink
144  label steps() const noexcept;
145 
146  //- Set number of steps to grow/shrink, return the old value
147  label steps(const label nsteps) noexcept;
148 
149 
150  virtual void applyToSet
151  (
152  const topoSetSource::setAction action,
153  topoSet& set
154  ) const;
155 };
156 
157 
158 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
159 
160 } // End namespace Foam
161 
162 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
163 
164 #endif
165 
166 // ************************************************************************* //
Foam::BitOps::set
void set(List< bool > &bools, const labelRange &range)
Set the specified range 'on' in a boolList.
Definition: BitOps.C:37
Foam::combine
Definition: FaceCellWave.C:57
Foam::topoSetSource::addToUsageTable
Class with constructor to add usage string to table.
Definition: topoSetSource.H:129
Foam::haloToCell::applyToSet
virtual void applyToSet(const topoSetSource::setAction action, topoSet &set) const
Apply specified action to the topoSet.
Definition: haloToCell.C:230
Foam::topoSetSource::setAction
setAction
Enumeration defining the valid actions.
Definition: topoSetSource.H:100
Foam::polyMesh
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:77
Foam::haloToCell
A topoSetCellSource to select cells attached to the outside of this cellSet, and add into/remove from...
Definition: haloToCell.H:148
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:61
Foam::haloToCell::TypeName
TypeName("haloToCell")
Runtime type information.
Foam::haloToCell::~haloToCell
virtual ~haloToCell()=default
Destructor.
Foam::topoSet
General set of labels of mesh quantity (points, cells, faces).
Definition: topoSet.H:63
topoSetCellSource.H
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:123
Foam::add
void add(FieldField< Field1, typename typeOfSum< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
Definition: FieldFieldFunctions.C:939
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::topoSetSource
Base class of a source for a topoSet.
Definition: topoSetSource.H:67
Foam::topoSetCellSource
The topoSetCellSource is a intermediate class for handling topoSet sources for selecting cells.
Definition: topoSetCellSource.H:54
Foam::topoSetSource::mesh
const polyMesh & mesh() const noexcept
Reference to the mesh.
Definition: topoSetSource.H:342
Foam::haloToCell::steps
label steps() const noexcept
The number of steps to grow/shrink.
Definition: haloToCell.C:215
Foam::haloToCell::haloToCell
haloToCell(const polyMesh &mesh, const label nsteps=1)
Construct from components.
Definition: haloToCell.C:183