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-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::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  // Private Data
61 
62  //- Name of patch
63  word name_;
64 
65  //- Index of patch in boundary
66  label index_;
67 
68  //- Optional physical type
69  mutable word physicalType_;
70 
71  //- Optional groups patch belongs to
72  wordList inGroups_;
73 
74 
75 public:
76 
77  // Constructors
78 
79  //- Construct from components
81  (
82  const word& name,
83  const label index,
84  const word& physicalType = word::null,
85  const wordList& inGroups = wordList()
86  );
87 
88  //- Construct from dictionary
90  (
91  const word& name,
92  const dictionary&,
93  const label index
94  );
95 
96  //- Construct from geometric patch, resetting the index
98  (
99  const patchIdentifier&,
100  const label index
101  );
102 
103 
104  //- Destructor
105  virtual ~patchIdentifier();
106 
107 
108  // Member Functions
109 
110  //- Return name
111  const word& name() const
112  {
113  return name_;
114  }
115 
116  //- Return name for modification
117  word& name()
118  {
119  return name_;
120  }
121 
122  //- Return the optional physical type of the patch
123  const word& physicalType() const
124  {
125  return physicalType_;
126  }
127 
128  //- Return the optional physical type of the patch for modification
129  word& physicalType()
130  {
131  return physicalType_;
132  }
133 
134  //- Return the index of this patch in the boundaryMesh
135  label index() const
136  {
137  return index_;
138  }
139 
140  //- Return the index of this patch in the boundaryMesh for modification
141  label& index()
142  {
143  return index_;
144  }
145 
146  //- Return the optional groups patch belongs to
147  const wordList& inGroups() const
148  {
149  return inGroups_;
150  }
151 
152  //- Return the optional groups patch belongs to for modification
153  wordList& inGroups()
154  {
155  return inGroups_;
156  }
157 
158  //- Test if in group
159  bool inGroup(const word&) const;
160 
161  //- Write patchIdentifier as a dictionary
162  void write(Ostream&) const;
163 
164 
165  // Ostream Operator
166 
167  friend Ostream& operator<<(Ostream&, const patchIdentifier&);
168 };
169 
170 
171 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
172 
173 } // End namespace Foam
174 
175 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
176 
177 #endif
178 
179 // ************************************************************************* //
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
const word & name() const
Return name.
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:158
Identifies patch by name, patch index and physical type.
bool inGroup(const word &) const
Test if in group.
const wordList & inGroups() const
Return the 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
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:53
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.