zoneSubSet.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) 2021 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::zoneSubSet
28
29Description
30 Intermediate tool for handling \c cellZones
31 for function objects (e.g. \c momentumError)
32 wherein the sub-mesh option is available.
33
34Usage
35 Minimal example by using \c system/controlDict.functions:
36 \verbatim
37 <functionObject>
38 {
39 // Mandatory and optional entries
40 ...
41
42 // Inherited entries
43 cellZones ( <cellZone1> <cellZone2> ... <cellZoneN> );
44 nLayers <label>;
45 }
46 \endverbatim
47
48 where the entries mean:
49 \table
50 Property | Description | Type | Reqd | Deflt
51 cellZones | Names of cellZones | wordRes | no | -
52 nLayers | Number of cell layers around cellZones | label | no | 0
53 \endtable
54
55See also
56 - Foam::functionObjects::momentumError
57 - Foam::functionObjects::div
58
59SourceFiles
60 zoneSubSet.C
61 zoneSubSetTemplates.C
62
63\*---------------------------------------------------------------------------*/
64
65#ifndef Foam_zoneSubSet_H
66#define Foam_zoneSubSet_H
67
68#include "fvMeshSubset.H"
69
70// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
71
72namespace Foam
73{
74namespace Detail
75{
76
77/*---------------------------------------------------------------------------*\
78 Class zoneSubSet Declaration
79\*---------------------------------------------------------------------------*/
80
81class zoneSubSet
82{
83 // Private Data
84
85 //- Subsetting engine
86 fvMeshSubset subsetter_;
87
88 //- Matcher for zones
89 wordRes zoneMatcher_;
90
91 //- Number of layers around zones
92 label nLayers_;
93
94 //- The halo cells
95 bitSet haloCells_;
96
97
98 // Private Members Functions
99
100 //- Initialise the sub-mesh
101 bool correct();
102
103 //- No copy construct
104 zoneSubSet(const zoneSubSet&) = delete;
105
106 //- No copy assignment
107 void operator=(const zoneSubSet&) = delete;
108
109
110public:
111
112 //- Runtime type information
113 TypeName("zoneSubSet");
114
115
116 // Constructors
117
118 //- Construct from components
120 (
121 const fvMesh& mesh,
122 const wordRes& zoneSelector,
123 const label nZoneLayers = 0
124 );
125
126 //- Construct from mesh and dictionary
128 (
129 const fvMesh& mesh,
131 );
132
133
134 //- Destructor
135 virtual ~zoneSubSet() = default;
136
137
138 // Member Functions
139
140 // Access
141
142 //- The entire base mesh
143 const fvMesh& baseMesh() const noexcept
144 {
145 return subsetter_.baseMesh();
146 }
147
148 //- The mesh subsetter
149 const fvMeshSubset& subsetter() const
150 {
151 return subsetter_;
153
154 //- The mesh subsetter
156 {
157 return subsetter_;
158 }
159
160 //- True if sub-mesh is expected to be used
161 bool useSubMesh() const noexcept
162 {
163 return !zoneMatcher_.empty();
164 }
165
166 //- Return the current zones selector
167 const wordRes& zones() const noexcept
168 {
169 return zoneMatcher_;
170 }
171
172 //- Return number of layers around cell zones
173 label nLayers() const noexcept
174 {
175 return nLayers_;
176 }
177
179 // Fields
180
181 //- Map from the sub-mesh to original cell zones
182 template<class Type>
186 ) const;
187};
188
189
190// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
191
192} // End namespace Detail
193} // End namespace Foam
194
195// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
196
197#ifdef NoRepository
198 #include "zoneSubSetTemplates.C"
199#endif
201// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
202#endif
203
204// ************************************************************************* //
label nLayers() const noexcept
Return number of layers around cell zones.
Definition: zoneSubSet.H:190
tmp< GeometricField< Type, fvPatchField, volMesh > > mapToZone(const GeometricField< Type, fvPatchField, volMesh > &subVolField) const
Map from the sub-mesh to original cell zones.
TypeName("zoneSubSet")
Runtime type information.
const fvMesh & baseMesh() const noexcept
The entire base mesh.
Definition: zoneSubSet.H:160
virtual ~zoneSubSet()=default
Destructor.
bool useSubMesh() const noexcept
True if sub-mesh is expected to be used.
Definition: zoneSubSet.H:178
const fvMeshSubset & subsetter() const
The mesh subsetter.
Definition: zoneSubSet.H:166
fvMeshSubset & subsetter()
The mesh subsetter.
Definition: zoneSubSet.H:172
const wordRes & zones() const noexcept
Return the current zones selector.
Definition: zoneSubSet.H:184
Generic GeometricField class.
bool empty() const noexcept
True if the UList is empty (ie, size() is zero)
Definition: UListI.H:427
A bitSet stores bits (elements with only two states) in packed internal format and supports a variety...
Definition: bitSet.H:66
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
Holds a reference to the original mesh (the baseMesh) and optionally to a subset of that mesh (the su...
Definition: fvMeshSubset.H:80
const fvMesh & baseMesh() const noexcept
Original mesh.
Definition: fvMeshSubsetI.H:30
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:91
A class for managing temporary objects.
Definition: tmp.H:65
A List of wordRe with additional matching capabilities.
Definition: wordRes.H:54
Intermediate tool for handling cellZones for function objects (e.g. momentumError) wherein the sub-me...
dynamicFvMesh & mesh
Namespace for OpenFOAM.
const direction noexcept
Definition: Scalar.H:223
dictionary dict
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition: typeInfo.H:73