patchIdentifier.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-2013 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::patchIdentifier
28 
29 Description
30  Identifies a patch by name, patch index and physical type
31 
32 SourceFiles
33  patchIdentifier.C
34 
35 \*---------------------------------------------------------------------------*/
36 
37 #ifndef patchIdentifier_H
38 #define patchIdentifier_H
39 
40 #include "wordList.H"
41 #include "label.H"
42 
43 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
44 
45 namespace Foam
46 {
47 
48 // Forward declarations
49 class dictionary;
50 class patchIdentifier;
51 Ostream& operator<<(Ostream& os, const patchIdentifier& p);
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 to which the patch belongs
72  wordList inGroups_;
73 
74 public:
75 
76  // Constructors
77 
78  //- Construct from components
80  (
81  const word& name,
82  const label index,
83  const word& physicalType = word::null,
84  const wordList& inGroups = wordList()
85  );
86 
87  //- Construct from dictionary
89  (
90  const word& name,
91  const dictionary& dict,
92  const label index
93  );
94 
95  //- Copy construct, resetting the index
97  (
98  const patchIdentifier& p,
99  const label index
100  );
101 
102 
103  //- Destructor
104  virtual ~patchIdentifier() = default;
105 
106 
107  // Member Functions
108 
109  //- Return the patch name
110  const word& name() const
111  {
112  return name_;
113  }
114 
115  //- Modifiable patch name
116  word& name()
117  {
118  return name_;
119  }
120 
121  //- The optional physical type of the patch
122  const word& physicalType() const
123  {
124  return physicalType_;
125  }
126 
127  //- Modifiable optional physical type of the patch
128  word& physicalType()
129  {
130  return physicalType_;
131  }
132 
133  //- The index of this patch in the boundaryMesh
134  label index() const
135  {
136  return index_;
137  }
138 
139  //- Modifiable the index of this patch in the boundaryMesh
140  label& index()
141  {
142  return index_;
143  }
144 
145  //- The optional groups that the patch belongs to
146  const wordList& inGroups() const
147  {
148  return inGroups_;
149  }
150 
151  //- Modifiable optional groups that the patch belongs to
152  wordList& inGroups()
153  {
154  return inGroups_;
155  }
156 
157  //- Check if the patch is in named group
158  bool inGroup(const word& name) const;
159 
160  //- Write patchIdentifier as a dictionary
161  void write(Ostream& os) const;
162 
163 
164  // Ostream Operator
165 
166  friend Ostream& operator<<(Ostream& os, const patchIdentifier& p);
167 };
168 
169 
170 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
171 
172 } // End namespace Foam
173 
174 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
175 
176 #endif
177 
178 // ************************************************************************* //
p
volScalarField & p
Definition: createFieldRefs.H:8
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:62
Foam::patchIdentifier::patchIdentifier
patchIdentifier(const word &name, const label index, const word &physicalType=word::null, const wordList &inGroups=wordList())
Construct from components.
Definition: patchIdentifier.C:35
Foam::patchIdentifier::index
label & index()
Modifiable the index of this patch in the boundaryMesh.
Definition: patchIdentifier.H:139
wordList.H
Foam::patchIdentifier::~patchIdentifier
virtual ~patchIdentifier()=default
Destructor.
Foam::wordList
List< word > wordList
A List of words.
Definition: fileName.H:59
Foam::patchIdentifier
Identifies a patch by name, patch index and physical type.
Definition: patchIdentifier.H:57
Foam::label
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:62
Foam::patchIdentifier::operator<<
friend Ostream & operator<<(Ostream &os, const patchIdentifier &p)
Foam::patchIdentifier::inGroups
const wordList & inGroups() const
The optional groups that the patch belongs to.
Definition: patchIdentifier.H:145
Foam::patchIdentifier::inGroup
bool inGroup(const word &name) const
Check if the patch is in named group.
Definition: patchIdentifier.C:79
Foam::patchIdentifier::physicalType
const word & physicalType() const
The optional physical type of the patch.
Definition: patchIdentifier.H:121
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:121
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::patchIdentifier::inGroups
wordList & inGroups()
Modifiable optional groups that the patch belongs to.
Definition: patchIdentifier.H:151
Foam::patchIdentifier::physicalType
word & physicalType()
Modifiable optional physical type of the patch.
Definition: patchIdentifier.H:127
label.H
Foam::List< word >
Foam::word::null
static const word null
An empty word.
Definition: word.H:77
Foam::patchIdentifier::write
void write(Ostream &os) const
Write patchIdentifier as a dictionary.
Definition: patchIdentifier.C:85
Foam::patchIdentifier::name
word & name()
Modifiable patch name.
Definition: patchIdentifier.H:115
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::patchIdentifier::name
const word & name() const
Return the patch name.
Definition: patchIdentifier.H:109
Foam::patchIdentifier::index
label index() const
The index of this patch in the boundaryMesh.
Definition: patchIdentifier.H:133
Foam::operator<<
Ostream & operator<<(Ostream &, const boundaryPatch &)
Definition: boundaryPatch.C:102