searchableSurfaceToCell.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-2020 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::searchableSurfaceToCell
28 
29 Description
30  A \c topoSetCellSource to select cells whose cell
31  centre enclosed by a given \c searchableSurface.
32 
33  Operands:
34  \table
35  Operand | Type | Location
36  input | triSurface | $FOAM_CASE/constant/triSurface/<file>
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 searchableSurfaceToCell;
51  surfaceType <surfaceTypeName>;
52 
53  // Optional entries
54  surfaceName <surfaceName>;
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: searchableSurfaceToCell | word | yes | -
65  surfaceType | The searchable surface type | word | yes | -
66  surfaceName | Name for the IOobject | word | no | mesh-name
67  \endtable
68 
69  Options for the \c action entry:
70  \verbatim
71  new | Create a new cellSet from selected cells
72  add | Add selected cells into this cellSet
73  subtract | Remove selected cells from this cellSet
74  \endverbatim
75 
76 See also
77  - Foam::topoSetSource
78  - Foam::topoSetCellSource
79 
80 SourceFiles
81  searchableSurfaceToCell.C
82 
83 \*---------------------------------------------------------------------------*/
84 
85 #ifndef searchableSurfaceToCell_H
86 #define searchableSurfaceToCell_H
87 
88 #include "topoSetCellSource.H"
89 #include "searchableSurface.H"
90 
91 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
92 
93 namespace Foam
94 {
95 
96 /*---------------------------------------------------------------------------*\
97  Class searchableSurfaceToCell Declaration
98 \*---------------------------------------------------------------------------*/
99 
100 class searchableSurfaceToCell
101 :
102  public topoSetCellSource
103 {
104  // Private Data
105 
106  //- Add usage string
107  static addToUsageTable usage_;
108 
109  //- The searchableSurface
110  autoPtr<searchableSurface> surf_;
111 
112 
113  // Private Member Functions
114 
115  void combine(topoSet& set, const bool add) const;
116 
117 
118 protected:
119 
120  // Protected Member Functions
121 
122  //- Retrieve surface name from dictionary entry
123  static word getSurfaceName
124  (
125  const dictionary& dict,
126  const word& defaultName
127  );
128 
129 
130 public:
131 
132  //- Runtime type information
133  TypeName("searchableSurfaceToCell");
134 
135 
136  // Constructors
137 
138  //- Construct surface-type from dictionary
140  (
141  const word& surfaceType,
142  const polyMesh& mesh,
143  const dictionary& dict
144  );
145 
146  //- Construct from dictionary
148  (
149  const polyMesh& mesh,
150  const dictionary& dict
151  );
152 
153 
154  //- Destructor
155  virtual ~searchableSurfaceToCell() = default;
156 
157 
158  // Member Functions
159 
160  virtual void applyToSet
161  (
162  const topoSetSource::setAction action,
163  topoSet& set
164  ) const;
165 };
166 
167 
168 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
169 
170 } // End namespace Foam
171 
172 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
173 
174 #endif
175 
176 // ************************************************************************* //
Foam::BitOps::set
void set(List< bool > &bools, const labelRange &range)
Set the specified range 'on' in a boolList.
Definition: BitOps.C:37
Foam::searchableSurfaceToCell::searchableSurfaceToCell
searchableSurfaceToCell(const word &surfaceType, const polyMesh &mesh, const dictionary &dict)
Construct surface-type from dictionary.
Definition: searchableSurfaceToCell.C:118
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
searchableSurface.H
Foam::combine
Definition: FaceCellWave.C:57
Foam::topoSetSource::addToUsageTable
Class with constructor to add usage string to table.
Definition: topoSetSource.H:129
Foam::topoSetSource::setAction
setAction
Enumeration defining the valid actions.
Definition: topoSetSource.H:100
Foam::searchableSurfaceToCell::TypeName
TypeName("searchableSurfaceToCell")
Runtime type information.
Foam::polyMesh
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:77
Foam::searchableSurfaceToCell::getSurfaceName
static word getSurfaceName(const dictionary &dict, const word &defaultName)
Retrieve surface name from dictionary entry.
Definition: searchableSurfaceToCell.C:72
Foam::searchableSurfaceToCell::~searchableSurfaceToCell
virtual ~searchableSurfaceToCell()=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::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
Foam::searchableSurfaceToCell::applyToSet
virtual void applyToSet(const topoSetSource::setAction action, topoSet &set) const
Apply specified action to the topoSet.
Definition: searchableSurfaceToCell.C:174
Foam::topoSetCellSource
The topoSetCellSource is a intermediate class for handling topoSet sources for selecting cells.
Definition: topoSetCellSource.H:54
Foam::searchableSurfaceToCell
A topoSetCellSource to select cells whose cell centre enclosed by a given searchableSurface.
Definition: searchableSurfaceToCell.H:153
Foam::topoSetSource::mesh
const polyMesh & mesh() const noexcept
Reference to the mesh.
Definition: topoSetSource.H:342