Loading...
Searching...
No Matches
regionsToCell.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) 2016-2018 OpenCFD Ltd.
9-------------------------------------------------------------------------------
10License
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
26Class
27 Foam::regionsToCell
28
29Description
30 TopoSetSource. Select cells belonging to topological connected region
31 (that contains given points)
32
33 In dictionary input:
34
35 // optional name of cellSet delimiting search
36 set c0;
37
38 //- Number of cell layers to erode mesh to detect holes in the mesh
39 // Set to 0 if not used.
40 nErode 3;
41
42 // points inside region to select
43 insidePoints ((1 2 3));
44
45
46SourceFiles
47 regionsToCell.C
48
49\*---------------------------------------------------------------------------*/
50
51#ifndef regionsToCell_H
52#define regionsToCell_H
53
54#include "topoSetCellSource.H"
55#include "boolList.H"
56
57// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
58
59namespace Foam
60{
61
62// Forward declarations
63class regionSplit;
64
65/*---------------------------------------------------------------------------*\
66 Class regionsToCell Declaration
67\*---------------------------------------------------------------------------*/
68
69class regionsToCell
70:
72{
73
74 // Private data
75
76 //- Add usage string
77 static addToUsageTable usage_;
78
79 //- Name of cellSet to keep to
80 const word setName_;
81
82 //- Coordinate(s) that is inside connected region
83 const pointField insidePoints_;
84
85 //- Number of layers to erode
86 const label nErode_;
87
88
89 // Private Member Functions
90
91 //- Mark faces inbetween selected and unselected elements
92 void markRegionFaces
93 (
94 const boolList& selectedCell,
95 boolList& regionFace
96 ) const;
97
98 //- Determine for every disconnected region in the mesh whether
99 // it contains a locationInMesh
100 boolList findRegions
101 (
102 const bool verbose,
103 const boolList& selectedCell,
104 const regionSplit& cellRegion
105 ) const;
106
107 //- Unselect regions not containing a locationInMesh
108 void unselectOutsideRegions(boolList& selectedCell) const;
109
110 //- Unselect one layer of cells from selectedCell
111 void shrinkRegions(boolList& selectedCell) const;
112
113 //- Erode a given number of layers from selectedCell. Remove any
114 // region that gets disconnected that way.
115 void erode(boolList& selectedCell) const;
116
117 void combine(topoSet& set, const bool add) const;
118
119
120public:
121
122 //- Runtime type information
123 TypeName("regionsToCell");
124
125 // Constructors
126
127 //- Construct from components
129 (
130 const polyMesh& mesh,
131 const word& setName,
133 const label nErode
134 );
135
136 //- Construct from dictionary
137 regionsToCell(const polyMesh& mesh, const dictionary& dict);
138
139 //- Construct from Istream
140 regionsToCell(const polyMesh& mesh, Istream& is);
142
143 //- Destructor
144 virtual ~regionsToCell() = default;
145
146
147 // Member Functions
148
149 virtual void applyToSet
150 (
151 const topoSetSource::setAction action,
152 topoSet& set
153 ) const;
154
155};
156
157
158// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
159
160} // End namespace Foam
161
162// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
163
164#endif
165
166// ************************************************************************* //
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition Istream.H:60
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition dictionary.H:133
Mesh consisting of general polyhedral cells.
Definition polyMesh.H:79
This class separates the mesh into distinct unconnected regions, each of which is then given a label ...
virtual ~regionsToCell()=default
Destructor.
TypeName("regionsToCell")
Runtime type information.
virtual void applyToSet(const topoSetSource::setAction action, topoSet &set) const
Apply specified action to the topoSet.
regionsToCell(const polyMesh &mesh, const word &setName, const pointField &insidePoints, const label nErode)
Construct from components.
topoSetCellSource(const polyMesh &mesh)
Construct from mesh.
Class with constructor to add usage string to table.
setAction
Enumeration defining various actions.
bool verbose() const noexcept
Get output verbosity.
const polyMesh & mesh() const noexcept
Reference to the mesh.
General set of labels of mesh quantity (points, cells, faces).
Definition topoSet.H:63
A class for handling words, derived from Foam::string.
Definition word.H:66
Namespace for OpenFOAM.
void add(DimensionedField< scalar, GeoMesh > &result, const dimensioned< scalar > &dt1, const DimensionedField< scalar, GeoMesh > &f2)
List< bool > boolList
A List of bools.
Definition List.H:60
vectorField pointField
pointField is a vectorField.
nErode
insidePoints((1 2 3))
dictionary dict
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition typeInfo.H:68