boundaryRegion.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 Class
25  Foam::boundaryRegion
26 
27 Description
28  The boundaryRegion persistent data saved as a Map<dictionary>.
29 
30  The meshReader supports boundaryRegion information.
31 
32  The <tt>constant/boundaryRegion</tt> file is an \c IOMap<dictionary>
33  that is used to save the information persistently.
34  It contains the boundaryRegion information of the following form:
35 
36  \verbatim
37  (
38  INT
39  {
40  BoundaryType WORD;
41  Label WORD;
42  }
43  ...
44  )
45  \endverbatim
46 
47 SourceFiles
48  boundaryRegion.C
49 
50 \*---------------------------------------------------------------------------*/
51 
52 #ifndef boundaryRegion_H
53 #define boundaryRegion_H
54 
55 #include "polyMesh.H"
56 #include "Map.H"
57 #include "dictionary.H"
58 #include "labelList.H"
59 #include "wordList.H"
60 #include "wordReList.H"
61 
62 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
63 
64 namespace Foam
65 {
66 
67 /*---------------------------------------------------------------------------*\
68  Class boundaryRegion Declaration
69 \*---------------------------------------------------------------------------*/
70 
71 class boundaryRegion
72 :
73  public Map<dictionary>
74 {
75 public:
76 
77  // Constructors
78 
79  //- Construct null
81 
82  //- Construct read from registry, name. instance
84  (
85  const objectRegistry&,
86  const word& name = "boundaryRegion",
87  const fileName& instance = "constant"
88  );
89 
90  //- Disallow default bitwise copy construction
91  boundaryRegion(const boundaryRegion&) = delete;
92 
93 
94  //- Destructor
96 
97 
98  // Member Functions
99 
100  //- Append to the end, return index
101  label append(const dictionary&);
102 
103  //- Return index corresponding to patch 'name'
104  // returns -1 if not found
105  label findIndex(const word& name) const;
106 
107  //- Return a Map of (id => name)
108  Map<word> names() const;
109 
110  //- Return a Map of (id => names) selected by patterns
111  Map<word> names(const UList<wordRe>& patterns) const;
112 
113  //- Return a Map of (id => type)
114  Map<word> boundaryTypes() const;
115 
116  //- Return BoundaryType corresponding to patch 'name'
117  word boundaryType(const word& name) const;
118 
119  //- Read constant/boundaryRegion
120  void readDict
121  (
122  const objectRegistry&,
123  const word& name = "boundaryRegion",
124  const fileName& instance = "constant"
125  );
126 
127  //- Write constant/boundaryRegion for later reuse
128  void writeDict
129  (
130  const objectRegistry&,
131  const word& name = "boundaryRegion",
132  const fileName& instance = "constant"
133  ) const;
134 
135 
136  // Member Operators
137 
138  //- Assignment
139  void operator=(const boundaryRegion&);
140 
141  //- Assign from Map<dictionary>
142  void operator=(const Map<dictionary>&);
143 
144 
145  // Friend Functions
146 
147  //- Rename regions
148  // each dictionary entry is a single word:
149  // \verbatim
150  // newPatchName originalName;
151  // \endverbatim
152  void rename(const dictionary&);
153 };
154 
155 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
156 
157 } // End namespace Foam
158 
159 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
160 
161 #endif
162 
163 // ************************************************************************* //
~boundaryRegion()
Destructor.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
A class for handling file names.
Definition: fileName.H:79
void writeDict(const objectRegistry &, const word &name="boundaryRegion", const fileName &instance="constant") const
Write constant/boundaryRegion for later reuse.
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:158
label append(const dictionary &)
Append to the end, return index.
boundaryRegion()
Construct null.
label findIndex(const word &name) const
Return index corresponding to patch &#39;name&#39;.
void rename(const dictionary &)
Rename regions.
Map< word > boundaryTypes() const
Return a Map of (id => type)
A class for handling words, derived from string.
Definition: word.H:59
Map< word > names() const
Return a Map of (id => name)
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
Definition: HashTable.H:60
word boundaryType(const word &name) const
Return BoundaryType corresponding to patch &#39;name&#39;.
void operator=(const boundaryRegion &)
Assignment.
word name(const complex &)
Return a string representation of a complex.
Definition: complex.C:47
void readDict(const objectRegistry &, const word &name="boundaryRegion", const fileName &instance="constant")
Read constant/boundaryRegion.
Registry of regIOobjects.
The boundaryRegion persistent data saved as a Map<dictionary>.
Namespace for OpenFOAM.
A HashTable to objects of type <T> with a label key.
Definition: Map.H:49