nbrToCell.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 OpenFOAM Foundation
9  Copyright (C) 2018-2020 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::nbrToCell
29 
30 Description
31  A \c topoSetCellSource to select cells with \c N or less number
32  of neighbouring cells (i.e. number of internal or coupled faces).
33 
34  Operands:
35  \table
36  Operand | Type | Location
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 nbrToCell;
51  neighbours <number>;
52  }
53  \endverbatim
54 
55  where the entries mean:
56  \table
57  Property | Description | Type | Req'd | Dflt
58  name | Name of cellSet | word | yes | -
59  type | Type name: cellSet | word | yes | -
60  action | Action applied on cells - see below | word | yes | -
61  source | Source name: nbrToCell | word | yes | -
62  neighbours | Maximum number of neighbour cells | label | yes | -
63  \endtable
64 
65  Options for the \c action entry:
66  \verbatim
67  new | Create a new cellSet from selected cells
68  add | Add selected cells into this cellSet
69  subtract | Remove selected cells from this cellSet
70  \endverbatim
71 
72 See also
73  - Foam::topoSetSource
74  - Foam::topoSetCellSource
75  - Foam::haloToCell
76 
77 SourceFiles
78  nbrToCell.C
79 
80 \*---------------------------------------------------------------------------*/
81 
82 #ifndef nbrToCell_H
83 #define nbrToCell_H
84 
85 #include "topoSetCellSource.H"
86 
87 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
88 
89 namespace Foam
90 {
91 
92 /*---------------------------------------------------------------------------*\
93  Class nbrToCell Declaration
94 \*---------------------------------------------------------------------------*/
95 
96 class nbrToCell
97 :
98  public topoSetCellSource
99 {
100  // Private Data
101 
102  //- Add usage string
103  static addToUsageTable usage_;
104 
105  //- Number of internal faces on cell
106  label minNbrs_;
107 
108 
109  // Private Member Functions
110 
111  void combine(topoSet& set, const bool add) const;
112 
113 
114 public:
115 
116  //- Runtime type information
117  TypeName("nbrToCell");
118 
119 
120  // Constructors
121 
122  //- Construct from components
123  nbrToCell(const polyMesh& mesh, const label minNbrs);
124 
125  //- Construct from dictionary
126  nbrToCell(const polyMesh& mesh, const dictionary& dict);
127 
128  //- Construct from Istream
129  nbrToCell(const polyMesh& mesh, Istream& is);
130 
131 
132  //- Destructor
133  virtual ~nbrToCell() = default;
134 
135 
136  // Member Functions
137 
138  virtual void applyToSet
139  (
140  const topoSetSource::setAction action,
141  topoSet& set
142  ) const;
143 };
144 
145 
146 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
147 
148 } // End namespace Foam
149 
150 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
151 
152 #endif
153 
154 // ************************************************************************* //
Foam::BitOps::set
void set(List< bool > &bools, const labelRange &range)
Set the specified range 'on' in a boolList.
Definition: BitOps.C:37
Foam::nbrToCell::nbrToCell
nbrToCell(const polyMesh &mesh, const label minNbrs)
Construct from components.
Definition: nbrToCell.C:123
Foam::nbrToCell::applyToSet
virtual void applyToSet(const topoSetSource::setAction action, topoSet &set) const
Apply specified action to the topoSet.
Definition: nbrToCell.C:157
Foam::combine
Definition: FaceCellWave.C:57
Foam::topoSetSource::setAction
setAction
Enumeration defining the valid actions.
Definition: topoSetSource.H:100
Foam::nbrToCell::~nbrToCell
virtual ~nbrToCell()=default
Destructor.
Foam::polyMesh
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:77
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:61
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::nbrToCell
A topoSetCellSource to select cells with N or less number of neighbouring cells (i....
Definition: nbrToCell.H:139
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::nbrToCell::TypeName
TypeName("nbrToCell")
Runtime type information.