Loading...
Searching...
No Matches
boundaryRegion.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 OpenFOAM Foundation
9 Copyright (C) 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::boundaryRegion
29
30Description
31 The boundaryRegion persistent data saved as a Map<dictionary>.
32
33 The meshReader supports boundaryRegion information.
34
35 The <tt>constant/boundaryRegion</tt> file is an \c IOMap<dictionary>
36 that is used to save the information persistently.
37 It contains the boundaryRegion information of the following form:
38
39 \verbatim
40 (
41 INT
42 {
43 BoundaryType WORD;
44 Label WORD;
45 }
46 ...
47 )
48 \endverbatim
49
50SourceFiles
51 boundaryRegion.C
52
53\*---------------------------------------------------------------------------*/
54
55#ifndef Foam_boundaryRegion_H
56#define Foam_boundaryRegion_H
57
58#include "Map.H"
59#include "dictionary.H"
60#include "labelList.H"
61#include "wordRes.H"
62
63// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
64
65namespace Foam
66{
67
68// Forward Declarations
69class objectRegistry;
71/*---------------------------------------------------------------------------*\
72 Class boundaryRegion Declaration
73\*---------------------------------------------------------------------------*/
74
76:
77 public Map<dictionary>
78{
79public:
80
81 //- No copy construct
82 boundaryRegion(const boundaryRegion&) = delete;
83
84
85 // Constructors
86
87 //- Default construct
88 boundaryRegion() noexcept = default;
89
90 //- Read construct from registry, name, instance
91 explicit boundaryRegion
92 (
93 const objectRegistry& obr,
94 const word& name = "boundaryRegion",
95 const fileName& instance = "constant"
96 );
97
98
99 //- Destructor
100 ~boundaryRegion() = default;
101
102
103 // Member Functions
104
105 //- Add to the end, return index
106 label push_back(const dictionary& dict);
107
108 //- The max table index, -1 if empty
109 label maxIndex() const;
110
111 //- The index corresponding to entry with 'Label' of given name,
112 //- or -1 if not found
113 label findIndex(const word& name) const;
114
115 //- The 'Label' name corresponding to id,
116 //- or boundaryRegion_ID if not otherwise defined
117 word name(const label id) const;
118
119 //- Return the extracted Map of (id => name)
120 Map<word> names() const;
121
122 //- Return the extracted Map of (id => names) selected by patterns
123 Map<word> names(const wordRes& patterns) const;
124
125 //- Return the extracted Map of (id => type)
126 Map<word> boundaryTypes() const;
127
128 //- Return BoundaryType corresponding to patch 'name',
129 //- "patch" if not found
130 word boundaryType(const word& name) const;
131
132
133 //- Read constant/boundaryRegion
134 void readDict
135 (
136 const objectRegistry& obr,
137 const word& name = "boundaryRegion",
138 const fileName& instance = "constant"
139 );
140
141 //- Write constant/boundaryRegion for later reuse
142 void writeDict
143 (
144 const objectRegistry& obr,
145 const word& name = "boundaryRegion",
146 const fileName& instance = "constant"
147 ) const;
148
149
150 // Member Operators
151
152 //- Copy assignment
153 void operator=(const boundaryRegion&);
154
155 //- Assign from Map<dictionary>
156 void operator=(const Map<dictionary>&);
157
158
159 // Friend Functions
160
161 //- Rename regions
162 // each dictionary entry is a single word:
163 // \verbatim
164 // newPatchName originalName;
165 // \endverbatim
166 void rename(const dictionary&);
167
168
169 // Housekeeping
170
171 //- Add to the end, return index
172 label append(const dictionary& dict) { return push_back(dict); }
173};
174
175
176// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
177
178} // End namespace Foam
179
180// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
181
182#endif
183
184// ************************************************************************* //
friend Ostream & operator(Ostream &, const HashTable< dictionary, label, Hash > &tbl)
constexpr Map() noexcept=default
word boundaryType(const word &name) const
Return BoundaryType corresponding to patch 'name', "patch" if not found.
label findIndex(const word &name) const
The index corresponding to entry with 'Label' of given name, or -1 if not found.
label maxIndex() const
The max table index, -1 if empty.
boundaryRegion() noexcept=default
Default construct.
void readDict(const objectRegistry &obr, const word &name="boundaryRegion", const fileName &instance="constant")
Read constant/boundaryRegion.
word name(const label id) const
The 'Label' name corresponding to id, or boundaryRegion_ID if not otherwise defined.
Map< word > boundaryTypes() const
Return the extracted Map of (id => type).
Map< word > names() const
Return the extracted Map of (id => name).
void writeDict(const objectRegistry &obr, const word &name="boundaryRegion", const fileName &instance="constant") const
Write constant/boundaryRegion for later reuse.
label push_back(const dictionary &dict)
Add to the end, return index.
label append(const dictionary &dict)
Add to the end, return index.
boundaryRegion(const boundaryRegion &)=delete
No copy construct.
void rename(const dictionary &)
Rename regions.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition dictionary.H:133
A class for handling file names.
Definition fileName.H:75
Registry of regIOobjects.
A List of wordRe with additional matching capabilities.
Definition wordRes.H:56
A class for handling words, derived from Foam::string.
Definition word.H:66
Namespace for OpenFOAM.
const direction noexcept
Definition scalarImpl.H:265
dictionary dict