Loading...
Searching...
No Matches
faFaceZone.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) 2025 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::faFaceZone
28
29Description
30 A subset of finite-area face elements.
31
32SourceFiles
33 faFaceZone.C
34
35\*---------------------------------------------------------------------------*/
36
37#ifndef Foam_faFaceZone_H
38#define Foam_faFaceZone_H
39
40#include "zone.H"
41#include "faFaceZoneMeshFwd.H"
42
43// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
44
45namespace Foam
46{
47
48// Forward Declarations
49class faFaceZone;
52/*---------------------------------------------------------------------------*\
53 Class faFaceZone Declaration
54\*---------------------------------------------------------------------------*/
55
56class faFaceZone
57:
58 public zone
59{
60 // Private Data
61
62 //- Reference to zone list
63 const faFaceZoneMesh& zoneMesh_;
64
65
66public:
67
68 // Static Data Members
69
70 //- The name associated with the zone-labels dictionary entry
71 static constexpr const char* labelsName() { return "faceLabels"; }
72
73
74 //- Runtime type information
75 TypeName("faFaceZone");
77
78 // Constructors
79
80 //- No copy construct
81 faFaceZone(const faFaceZone&) = delete;
82
83 //- Construct an empty zone - name="", index=0
84 explicit faFaceZone(const faFaceZoneMesh& zm);
85
86 //- Construct an empty zone with specified name and index
88 (
89 const word& name,
90 const label index,
91 const faFaceZoneMesh& zm
92 );
93
94 //- Construct from components
96 (
97 const word& name,
98 const labelUList& addr,
99 const label index,
100 const faFaceZoneMesh& zm
101 );
102
103 //- Construct from components, transferring addressing
105 (
106 const word& name,
107 labelList&& addr,
108 const label index,
109 const faFaceZoneMesh& zm
110 );
111
112 //- Construct from dictionary
114 (
115 const word& name,
116 const dictionary& dict,
117 const label index,
118 const faFaceZoneMesh& zm
119 );
120
121 //- Copy construct with a new mesh reference
123 (
124 const faFaceZone& originalZone,
125 const faFaceZoneMesh& zm,
127 const label newIndex = -1
128 );
129
130 //- Construct empty with original zone information (name, index, groups)
131 //- and mesh reference.
133 (
134 const faFaceZone& originalZone,
136 const faFaceZoneMesh& zm,
138 const label newIndex = -1
139 );
140
141 //- Construct empty with original zone information (name, groups),
142 //- resetting the index and zone mesh reference.
144 (
145 const faFaceZone& originalZone,
148 const label index,
150 );
151
152 //- Construct with original zone information (name, groups),
153 //- resetting the face list, the index and zone mesh reference.
155 (
156 const faFaceZone& originalZone,
157 const labelUList& addr,
159 const label index,
160 const faFaceZoneMesh& zm
161 );
163 //- Construct with original zone information (name, groups),
164 //- resetting the face list, the index and zone mesh reference.
166 (
167 const faFaceZone& originalZone,
168 labelList&& addr,
170 const label index,
171 const faFaceZoneMesh& zm
172 );
173
174
175 //- Construct and return a clone, resetting the zone mesh
177 (
178 const faFaceZoneMesh& zm,
180 const label newIndex = -1
181 ) const
182 {
183 return autoPtr<faFaceZone>::New(*this, zm, newIndex);
184 }
185
186 //- Construct and return a clone,
187 //- resetting the face list and zone mesh
189 (
190 const labelUList& addr,
192 const label index,
193 const faFaceZoneMesh& zm
194 ) const
195 {
196 return autoPtr<faFaceZone>::New(*this, addr, index, zm);
197 }
198
199
200 //- Destructor
201 virtual ~faFaceZone() = default;
202
203
204 // Member Functions
205
206 //- The maximum index the zone may contain == mesh nFaces()
207 label max_index() const noexcept;
208
209 //- Return reference to the zone mesh
210 const faFaceZoneMesh& zoneMesh() const noexcept { return zoneMesh_; }
211
212 //- The addressing (face IDs) used for the zone
213 using zone::addressing;
214
215 //- The local index of the given mesh face, -1 if not in the zone
216 label whichFace(const label meshFaceID) const
217 {
218 return zone::localID(meshFaceID);
219 }
220
221
222 // Checks
223
224 //- Check zone definition. Return true if in error.
225 virtual bool checkDefinition(const bool report = false) const
226 {
227 return zone::checkDefinition(max_index(), report);
228 }
229
230 //- Check whether zone is synchronised across coupled boundaries.
231 // \return True if any errors.
232 virtual bool checkParallelSync(const bool report = false) const
233 {
234 return false;
235 }
236
237
238 // Assign addressing
239
240 //- Move reset addressing from another zone
241 virtual void resetAddressing(faFaceZone&& zn);
242
243 //- Copy reset addressing from another zone
244 virtual void resetAddressing(const faFaceZone& zn);
245
246 //- Copy assign addressing
247 virtual void resetAddressing(const labelUList& addr);
248
249 //- Move assign addressing
250 virtual void resetAddressing(labelList&& addr);
251
252 //- Assign addressing, clearing demand-driven data
253 void operator=(const faFaceZone& zn);
254
255 //- Assign addressing, clearing demand-driven data
256 void operator=(const labelUList& addr);
257
258 //- Move assign addressing, clearing demand-driven data
259 void operator=(labelList&& addr);
260
261
262 // I-O
263
264 //- Write (dictionary entries)
265 virtual void write(Ostream& os) const;
266
267 //- Ostream Operator
268 friend Ostream& operator<<(Ostream& os, const faFaceZone& zn);
269};
270
271
272// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
273
274} // End namespace Foam
275
276// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
277
278#endif
279
280// ************************************************************************* //
autoPtr< List< label > > clone() const
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition Ostream.H:59
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition autoPtr.H:65
static autoPtr< T > New(Args &&... args)
Construct autoPtr with forwarding arguments.
Definition autoPtr.H:178
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition dictionary.H:133
A subset of finite-area face elements.
Definition faFaceZone.H:54
faFaceZone(const faFaceZone &originalZone, const labelUList &addr, const label index, const faFaceZoneMesh &zm)
Construct with original zone information (name, groups), resetting the face list, the index and zone ...
virtual autoPtr< faFaceZone > clone(const faFaceZoneMesh &zm, const label newIndex=-1) const
Construct and return a clone, resetting the zone mesh.
Definition faFaceZone.H:202
label whichFace(const label meshFaceID) const
The local index of the given mesh face, -1 if not in the zone.
Definition faFaceZone.H:253
virtual void resetAddressing(const faFaceZone &zn)
Copy reset addressing from another zone.
faFaceZone(const word &name, const labelUList &addr, const label index, const faFaceZoneMesh &zm)
Construct from components.
faFaceZone(const faFaceZone &originalZone, Foam::zero, const label index, const faFaceZoneMesh &zm)
Construct empty with original zone information (name, groups), resetting the index and zone mesh refe...
void operator=(labelList &&addr)
Move assign addressing, clearing demand-driven data.
faFaceZone(const faFaceZone &originalZone, Foam::zero, const faFaceZoneMesh &zm, const label newIndex=-1)
Construct empty with original zone information (name, index, groups) and mesh reference.
virtual autoPtr< faFaceZone > clone(const labelUList &addr, const label index, const faFaceZoneMesh &zm) const
Construct and return a clone, resetting the face list and zone mesh.
Definition faFaceZone.H:216
TypeName("faFaceZone")
Runtime type information.
virtual bool checkDefinition(const bool report=false) const
Check zone definition. Return true if in error.
Definition faFaceZone.H:264
static constexpr const char * labelsName()
The name associated with the zone-labels dictionary entry.
Definition faFaceZone.H:70
virtual void write(Ostream &os) const
Write (dictionary entries).
void operator=(const labelUList &addr)
Assign addressing, clearing demand-driven data.
virtual bool checkParallelSync(const bool report=false) const
Check whether zone is synchronised across coupled boundaries.
Definition faFaceZone.H:274
faFaceZone(const faFaceZone &originalZone, labelList &&addr, const label index, const faFaceZoneMesh &zm)
Construct with original zone information (name, groups), resetting the face list, the index and zone ...
faFaceZone(const word &name, labelList &&addr, const label index, const faFaceZoneMesh &zm)
Construct from components, transferring addressing.
void operator=(const faFaceZone &zn)
Assign addressing, clearing demand-driven data.
faFaceZone(const faFaceZone &)=delete
No copy construct.
faFaceZone(const word &name, const label index, const faFaceZoneMesh &zm)
Construct an empty zone with specified name and index.
virtual ~faFaceZone()=default
Destructor.
faFaceZone(const word &name, const dictionary &dict, const label index, const faFaceZoneMesh &zm)
Construct from dictionary.
faFaceZone(const faFaceZone &originalZone, const faFaceZoneMesh &zm, const label newIndex=-1)
Copy construct with a new mesh reference.
label max_index() const noexcept
The maximum index the zone may contain == mesh nFaces().
virtual void resetAddressing(const labelUList &addr)
Copy assign addressing.
friend Ostream & operator<<(Ostream &os, const faFaceZone &zn)
Ostream Operator.
faFaceZone(const faFaceZoneMesh &zm)
Construct an empty zone - name="", index=0.
virtual void resetAddressing(faFaceZone &&zn)
Move reset addressing from another zone.
const faFaceZoneMesh & zoneMesh() const noexcept
Return reference to the zone mesh.
Definition faFaceZone.H:243
virtual void resetAddressing(labelList &&addr)
Move assign addressing.
A class for handling words, derived from Foam::string.
Definition word.H:66
A class representing the concept of 0 (zero) that can be used to avoid manipulating objects known to ...
Definition zero.H:58
label index() const noexcept
The index of this zone in the zone list.
virtual bool checkDefinition(const bool report=false) const =0
Check zone definition. Return true if in error.
label localID(const label globalID) const
Lookup local address in zone for given global index.
Definition zone.C:149
zone()
Default construct: empty zone with name="", index=0.
Definition zone.C:37
const labelList & addressing() const noexcept
The addressing used by the zone.
Definition zone.H:182
OBJstream os(runTime.globalPath()/outputName)
Namespace for OpenFOAM.
List< label > labelList
A List of labels.
Definition List.H:62
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces).
ZoneMesh< faFaceZone, faMesh > faFaceZoneMesh
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
runTime write()
dictionary dict
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition typeInfo.H:68