patchIdentifier.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-2020 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::patchIdentifier
26 
27 Description
28  Identifies patch by name, patch index and physical type
29 
30 SourceFiles
31  patchIdentifier.C
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef patchIdentifier_H
36 #define patchIdentifier_H
37 
38 #include "wordList.H"
39 #include "label.H"
40 
41 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
42 
43 namespace Foam
44 {
45 
46 class dictionary;
47 
48 // Forward declaration of friend functions and operators
49 
50 class patchIdentifier;
51 Ostream& operator<<(Ostream&, const patchIdentifier&);
52 
53 
54 /*---------------------------------------------------------------------------*\
55  Class patchIdentifier Declaration
56 \*---------------------------------------------------------------------------*/
57 
58 class patchIdentifier
59 {
60 protected:
61 
62  // Protected Data
63 
64  //- Name of patch
65  word name_;
66 
67  //- Index of patch in boundary
68  label index_;
69 
70  //- Optional physical type
72 
73  //- Optional groups patch belongs to
75 
76 
77 public:
78 
79  // Constructors
80 
81  //- Construct from components
83  (
84  const word& name,
85  const label index,
86  const word& physicalType = word::null,
87  const wordList& inGroups = wordList()
88  );
89 
90  //- Construct from dictionary
92  (
93  const word& name,
94  const dictionary&,
95  const label index
96  );
97 
98  //- Construct from geometric patch, resetting the index
100  (
101  const patchIdentifier&,
102  const label index
103  );
104 
105 
106  //- Destructor
107  virtual ~patchIdentifier();
108 
109 
110  // Member Functions
111 
112  //- Return name
113  const word& name() const
114  {
115  return name_;
116  }
117 
118  //- Return the index of this patch in the boundaryMesh
119  label index() const
120  {
121  return index_;
122  }
123 
124  //- Return the optional physical type of the patch
125  const word& physicalType() const
126  {
127  return physicalType_;
128  }
129 
130  //- Return the optional physical type of the patch for modification
131  word& physicalType()
132  {
133  return physicalType_;
134  }
135 
136  //- Return the optional groups patch belongs to
137  const wordList& inGroups() const
138  {
139  return inGroups_;
140  }
141 
142  //- Return the optional groups patch belongs to for modification
143  wordList& inGroups()
144  {
145  return inGroups_;
146  }
147 
148  //- Test if in group
149  bool inGroup(const word&) const;
150 
151  //- Write patchIdentifier as a dictionary
152  void write(Ostream&) const;
153 
154 
155  // Ostream Operator
156 
157  friend Ostream& operator<<(Ostream&, const patchIdentifier&);
158 };
159 
160 
161 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
162 
163 } // End namespace Foam
164 
165 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
166 
167 #endif
168 
169 // ************************************************************************* //
const word & name() const
Return name.
word physicalType_
Optional physical type.
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:156
Identifies patch by name, patch index and physical type.
bool inGroup(const word &) const
Test if in group.
word name_
Name of patch.
const wordList & inGroups() const
Return the optional groups patch belongs to.
wordList inGroups_
Optional groups patch belongs to.
patchIdentifier(const word &name, const label index, const word &physicalType=word::null, const wordList &inGroups=wordList())
Construct from components.
friend Ostream & operator<<(Ostream &, const patchIdentifier &)
A class for handling words, derived from string.
Definition: word.H:59
static const word null
An empty word.
Definition: word.H:77
label index_
Index of patch in boundary.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:54
const word & physicalType() const
Return the optional physical type of the patch.
virtual ~patchIdentifier()
Destructor.
void write(Ostream &) const
Write patchIdentifier as a dictionary.
List< word > wordList
A List of words.
Definition: fileName.H:54
label index() const
Return the index of this patch in the boundaryMesh.
Ostream & operator<<(Ostream &, const ensightPart &)
Namespace for OpenFOAM.