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 | Copyright (C) 2011 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  // Private Member Functions
76 
77  //- Disallow default bitwise copy construct
79 
80 
81 public:
82 
83  // Constructors
84 
85  //- Construct null
87 
88  //- Construct read from registry, name. instance
90  (
91  const objectRegistry&,
92  const word& name = "boundaryRegion",
93  const fileName& instance = "constant"
94  );
95 
96 
97  //- Destructor
99 
100 
101  // Member Functions
102 
103  //- Append to the end, return index
104  label append(const dictionary&);
105 
106  //- Return index corresponding to patch 'name'
107  // returns -1 if not found
108  label findIndex(const word& name) const;
109 
110  //- Return a Map of (id => name)
111  Map<word> names() const;
112 
113  //- Return a Map of (id => names) selected by patterns
114  Map<word> names(const UList<wordRe>& patterns) const;
115 
116  //- Return a Map of (id => type)
117  Map<word> boundaryTypes() const;
118 
119  //- Return BoundaryType corresponding to patch 'name'
120  word boundaryType(const word& name) const;
121 
122  //- Read constant/boundaryRegion
123  void readDict
124  (
125  const objectRegistry&,
126  const word& name = "boundaryRegion",
127  const fileName& instance = "constant"
128  );
129 
130  //- Write constant/boundaryRegion for later reuse
131  void writeDict
132  (
133  const objectRegistry&,
134  const word& name = "boundaryRegion",
135  const fileName& instance = "constant"
136  ) const;
137 
138 
139  // Member Operators
140 
141  //- Assignment
142  void operator=(const boundaryRegion&);
143 
144  //- Assign from Map<dictionary>
145  void operator=(const Map<dictionary>&);
146 
147 
148  // Friend Functions
149 
150  //- Rename regions
151  // each dictionary entry is a single word:
152  // \verbatim
153  // newPatchName originalName;
154  // \endverbatim
155  void rename(const dictionary&);
156 };
157 
158 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
159 
160 } // End namespace Foam
161 
162 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
163 
164 #endif
165 
166 // ************************************************************************* //
~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:69
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
label append(const dictionary &)
Append to the end, return index.
Map< word > boundaryTypes() const
Return a Map of (id => type)
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 > names() const
Return a Map of (id => name)
A class for handling words, derived from string.
Definition: word.H:59
void writeDict(const objectRegistry &, const word &name="boundaryRegion", const fileName &instance="constant") const
Write constant/boundaryRegion for later reuse.
word boundaryType(const word &name) const
Return BoundaryType corresponding to patch &#39;name&#39;.
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
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