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 -------------------------------------------------------------------------------
10 License
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 
26 Class
27  Foam::boundaryRegion
28 
29 Description
30  The boundaryRegion persistent data saved as a Map<dictionary>.
31 
32  The meshReader supports boundaryRegion information.
33 
34  The <tt>constant/boundaryRegion</tt> file is an \c IOMap<dictionary>
35  that is used to save the information persistently.
36  It contains the boundaryRegion information of the following form:
37 
38  \verbatim
39  (
40  INT
41  {
42  BoundaryType WORD;
43  Label WORD;
44  }
45  ...
46  )
47  \endverbatim
48 
49 SourceFiles
50  boundaryRegion.C
51 
52 \*---------------------------------------------------------------------------*/
53 
54 #ifndef boundaryRegion_H
55 #define boundaryRegion_H
56 
57 #include "polyMesh.H"
58 #include "Map.H"
59 #include "dictionary.H"
60 #include "labelList.H"
61 #include "wordList.H"
62 #include "wordRes.H"
63 
64 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
65 
66 namespace Foam
67 {
68 
69 /*---------------------------------------------------------------------------*\
70  Class boundaryRegion Declaration
71 \*---------------------------------------------------------------------------*/
72 
73 class boundaryRegion
74 :
75  public Map<dictionary>
76 {
77  // Private Member Functions
78 
79  //- No copy construct
80  boundaryRegion(const boundaryRegion&) = delete;
81 
82 
83 public:
84 
85  // Constructors
86 
87  //- Construct null
89 
90  //- Construct read from registry, name. instance
92  (
93  const objectRegistry&,
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  //- Append to the end, return index
106  label append(const dictionary&);
107 
108  //- Return index corresponding to patch 'name'
109  // returns -1 if not found
110  label findIndex(const word& name) const;
111 
112  //- Return a Map of (id => name)
113  Map<word> names() const;
114 
115  //- Return a Map of (id => names) selected by patterns
116  Map<word> names(const wordRes& patterns) const;
117 
118  //- Return a Map of (id => type)
119  Map<word> boundaryTypes() const;
120 
121  //- Return BoundaryType corresponding to patch 'name'
122  word boundaryType(const word& name) const;
123 
124  //- Read constant/boundaryRegion
125  void readDict
126  (
127  const objectRegistry&,
128  const word& name = "boundaryRegion",
129  const fileName& instance = "constant"
130  );
131 
132  //- Write constant/boundaryRegion for later reuse
133  void writeDict
134  (
135  const objectRegistry&,
136  const word& name = "boundaryRegion",
137  const fileName& instance = "constant"
138  ) const;
139 
140 
141  // Member Operators
142 
143  //- Assignment
144  void operator=(const boundaryRegion&);
145 
146  //- Assign from Map<dictionary>
147  void operator=(const Map<dictionary>&);
148 
149 
150  // Friend Functions
151 
152  //- Rename regions
153  // each dictionary entry is a single word:
154  // \verbatim
155  // newPatchName originalName;
156  // \endverbatim
157  void rename(const dictionary&);
158 };
159 
160 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
161 
162 } // End namespace Foam
163 
164 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
165 
166 #endif
167 
168 // ************************************************************************* //
wordRes.H
Foam::boundaryRegion::boundaryTypes
Map< word > boundaryTypes() const
Return a Map of (id => type)
Definition: boundaryRegion.C:118
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::fileName
A class for handling file names.
Definition: fileName.H:73
Foam::boundaryRegion::boundaryType
word boundaryType(const word &name) const
Return BoundaryType corresponding to patch 'name'.
Definition: boundaryRegion.C:154
Foam::boundaryRegion::rename
void rename(const dictionary &)
Rename regions.
Definition: boundaryRegion.C:250
Foam::boundaryRegion
The boundaryRegion persistent data saved as a Map<dictionary>.
Definition: boundaryRegion.H:72
Foam::Map
A HashTable to objects of type <T> with a label key.
Definition: lumpedPointController.H:69
Foam::boundaryRegion::~boundaryRegion
~boundaryRegion()=default
Destructor.
polyMesh.H
wordList.H
Foam::objectRegistry
Registry of regIOobjects.
Definition: objectRegistry.H:60
Map.H
Foam::boundaryRegion::operator=
void operator=(const boundaryRegion &)
Assignment.
Definition: boundaryRegion.C:236
labelList.H
Foam::boundaryRegion::readDict
void readDict(const objectRegistry &, const word &name="boundaryRegion", const fileName &instance="constant")
Read constant/boundaryRegion.
Definition: boundaryRegion.C:169
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
Foam::boundaryRegion::findIndex
label findIndex(const word &name) const
Return index corresponding to patch 'name'.
Definition: boundaryRegion.C:135
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
dictionary.H
Foam::wordRes
A List of wordRe with additional matching capabilities.
Definition: wordRes.H:51
Foam::boundaryRegion::writeDict
void writeDict(const objectRegistry &, const word &name="boundaryRegion", const fileName &instance="constant") const
Write constant/boundaryRegion for later reuse.
Definition: boundaryRegion.C:203
Foam::name
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
Definition: exprTraits.C:59
Foam::boundaryRegion::names
Map< word > names() const
Return a Map of (id => name)
Definition: boundaryRegion.C:72
Foam::boundaryRegion::append
label append(const dictionary &)
Append to the end, return index.
Definition: boundaryRegion.C:56
Foam::boundaryRegion::boundaryRegion
boundaryRegion()
Construct null.
Definition: boundaryRegion.C:35