nearestToCell.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::nearestToCell
29
30Description
31 A \c topoSetCellSource to select cells
32 whose cell centre nearest to given points.
33
34 Operands:
35 \table
36 Operand | Type | Location
37 output | cellSet | $FOAM_CASE/constant/polyMesh/sets/<set>
38 \endtable
39
40Usage
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 nearestToCell;
51 points
52 (
53 (<p1x> <p1y> <p1z>)
54 (<p2x> <p2y> <p2z>)
55 ...
56 );
57 }
58 \endverbatim
59
60 where the entries mean:
61 \table
62 Property | Description | Type | Req'd | Dflt
63 name | Name of cellSet | word | yes | -
64 type | Type name: cellSet | word | yes | -
65 action | Action applied on cells - see below | word | yes | -
66 source | Source name: nearestToCell | word | yes | -
67 points | List of selection points | vectorList | 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 nearestToCell.C
83
84\*---------------------------------------------------------------------------*/
85
86#ifndef nearestToCell_H
87#define nearestToCell_H
88
89#include "topoSetCellSource.H"
90
91// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
92
93namespace Foam
94{
95
96/*---------------------------------------------------------------------------*\
97 Class nearestToCell Declaration
98\*---------------------------------------------------------------------------*/
99
100class nearestToCell
101:
102 public topoSetCellSource
103{
104 // Private Data
105
106 //- Add usage string
107 static addToUsageTable usage_;
108
109 //- Points to select nearest to
110 pointField points_;
111
112
113 // Private Member Functions
114
115 void combine(topoSet& set, const bool add) const;
116
117
118public:
119
120 //- Runtime type information
121 TypeName("nearestToCell");
122
123
124 // Constructors
125
126 //- Construct from components, copying points
127 nearestToCell(const polyMesh& mesh, const pointField& points);
128
129 //- Construct from components, moving points
130 nearestToCell(const polyMesh& mesh, pointField&& points);
131
132 //- Construct from dictionary
133 nearestToCell(const polyMesh& mesh, const dictionary& dict);
134
135 //- Construct from Istream
136 nearestToCell(const polyMesh& mesh, Istream& is);
137
138
139 //- Destructor
140 virtual ~nearestToCell() = default;
141
142
143 // Member Functions
144
145 virtual void applyToSet
146 (
147 const topoSetSource::setAction action,
148 topoSet& set
149 ) const;
150};
151
152
153// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
154
155} // End namespace Foam
156
157// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
158
159#endif
160
161// ************************************************************************* //
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 whose cell centre nearest to given points.
TypeName("nearestToCell")
Runtime type information.
nearestToCell(const polyMesh &mesh, const pointField &points)
Construct from components, copying points.
virtual void applyToSet(const topoSetSource::setAction action, topoSet &set) const
Apply specified action to the topoSet.
virtual ~nearestToCell()=default
Destructor.
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
const pointField & points
Namespace for OpenFOAM.
vectorField pointField
pointField is a vectorField.
Definition: pointFieldFwd.H:44
void add(FieldField< Field1, typename typeOfSum< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
dictionary dict
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition: typeInfo.H:73