Loading...
Searching...
No Matches
faceZoneSet.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-2017 OpenFOAM Foundation
9 Copyright (C) 2018-2024 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::faceZoneSet
29
30Description
31 Like faceSet but -reads data from faceZone -updates faceZone when writing.
32
33SourceFiles
34 faceZoneSet.C
35
36\*---------------------------------------------------------------------------*/
37
38#ifndef Foam_faceZoneSet_H
39#define Foam_faceZoneSet_H
40
41#include "faceSet.H"
42
43// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
44
45namespace Foam
46{
48/*---------------------------------------------------------------------------*\
49 Class faceZoneSet Declaration
50\*---------------------------------------------------------------------------*/
51
52class faceZoneSet
53:
54 public faceSet
55{
56 // Private Data
57
58 const polyMesh& mesh_;
59
60 labelList addressing_;
61
62 boolList flipMap_;
63
64
65 // Private Member Functions
66
67 void subset
68 (
69 const word& setName,
70 const labelUList& setAddressing,
71 const UList<bool>& setFlipMap
72 );
73
74 void addSet
75 (
76 const word& setName,
77 const labelUList& setAddressing,
78 const UList<bool>& setFlipMap
79 );
80
81 void subtractSet
82 (
83 const word& setName,
84 const labelUList& setAddressing,
85 const UList<bool>& setFlipMap
86 );
87
88
89public:
90
91 //- Runtime type information
92 TypeNameNoDebug("faceZoneSet");
93
94
95 // Constructors
96
97 //- Construct from objectRegistry and name
99 (
100 const polyMesh& mesh,
101 const word& name,
104 );
105
106 //- Construct empty (no-read) with initial labelHashSet capacity.
108 (
109 const polyMesh& mesh,
110 const word& name,
111 const label initialCapacity,
113 );
114
115 //- Copy construct (no-read) from existing set
117 (
118 const polyMesh& mesh,
119 const word& name,
120 const topoSet& set,
122 );
123
124
125 //- Destructor
126 virtual ~faceZoneSet() = default;
127
128
129 // Member Functions
130
132 {
133 return addressing_;
134 }
135
137 {
138 return addressing_;
139 }
140
142 const boolList& flipMap() const noexcept
143 {
144 return flipMap_;
145 }
146
148 {
149 return flipMap_;
150 }
151
153 //- Sort addressing and make faceSet part consistent with addressing
154 void updateSet();
155
156 //- Invert contents.
157 // Insert all members [0,maxLen) which were not in set.
158 virtual void invert(const label maxLen);
159
160 //- Subset contents. Only elements present in both sets remain.
161 virtual void subset(const labelUList& elems);
162
163 //- Subset contents. Only elements present in both sets remain.
164 virtual void subset(const topoSet& set);
165
166 //- Add given elements to the set
167 virtual void addSet(const labelUList& elems);
168
169 //- Add given elements to the set
170 virtual void addSet(const topoSet& set);
171
172 //- Subtract given elements from the set
173 virtual void subtractSet(const labelUList& elems);
174
175 //- Subtract given elements from the set
176 virtual void subtractSet(const topoSet& set);
177
178 //- Sync faceZoneSet across coupled patches.
179 virtual void sync(const polyMesh& mesh);
180
181 //- Write maxLen items with label and coordinates.
182 virtual void writeDebug
183 (
184 Ostream& os,
185 const primitiveMesh&,
186 const label maxLen
187 ) const;
188
189 //- Write faceZone using stream options
190 virtual bool writeObject
191 (
192 IOstreamOption streamOpt,
193 const bool writeOnProc
194 ) const;
195
196 //- Update any stored data for new labels
197 virtual void updateMesh(const mapPolyMesh& morphMap);
198
199 //- Return max index+1.
200 virtual label maxSize(const polyMesh& mesh) const;
201};
202
203
204// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
205
206} // End namespace Foam
207
208// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
209
210#endif
211
212// ************************************************************************* //
readOption
Enumeration defining read preferences.
@ MUST_READ
Reading required.
writeOption
Enumeration defining write preferences.
@ NO_WRITE
Ignore writing from objectRegistry::writeObject().
A simple container for options an IOstream can normally have.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition Ostream.H:59
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
Definition UList.H:89
faceSet(const IOobject &io)
Construct from IOobject. No checking.
Definition faceSet.C:41
virtual bool writeObject(IOstreamOption streamOpt, const bool writeOnProc) const
Write faceZone using stream options.
virtual void invert(const label maxLen)
Invert contents.
faceZoneSet(const polyMesh &mesh, const word &name, IOobjectOption::readOption rOpt=IOobjectOption::MUST_READ, IOobjectOption::writeOption wOpt=IOobjectOption::NO_WRITE)
Construct from objectRegistry and name.
Definition faceZoneSet.C:82
const boolList & flipMap() const noexcept
boolList & flipMap() noexcept
labelList & addressing() noexcept
virtual label maxSize(const polyMesh &mesh) const
Return max index+1.
virtual void sync(const polyMesh &mesh)
Sync faceZoneSet across coupled patches.
const labelList & addressing() const noexcept
virtual ~faceZoneSet()=default
Destructor.
virtual void writeDebug(Ostream &os, const primitiveMesh &, const label maxLen) const
Write maxLen items with label and coordinates.
virtual void updateMesh(const mapPolyMesh &morphMap)
Update any stored data for new labels.
TypeNameNoDebug("faceZoneSet")
Runtime type information.
void updateSet()
Sort addressing and make faceSet part consistent with addressing.
Definition faceZoneSet.C:45
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Mesh consisting of general polyhedral cells.
Definition polyMesh.H:79
Cell-face mesh analysis engine.
General set of labels of mesh quantity (points, cells, faces).
Definition topoSet.H:63
virtual bool set(const label id)
Set an index.
Definition topoSet.C:545
A class for handling words, derived from Foam::string.
Definition word.H:66
dynamicFvMesh & mesh
OBJstream os(runTime.globalPath()/outputName)
Namespace for OpenFOAM.
List< label > labelList
A List of labels.
Definition List.H:62
List< T > subset(const BoolListType &select, const UList< T > &input, const bool invert=false)
Extract elements of the input list when select is true.
List< bool > boolList
A List of bools.
Definition List.H:60
const direction noexcept
Definition scalarImpl.H:265
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
Definition exprTraits.C:127
UList< label > labelUList
A UList of labels.
Definition UList.H:75
#define TypeNameNoDebug(TypeNameString)
Declare a ClassNameNoDebug() with extra virtual type info.
Definition typeInfo.H:61