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 | Copyright (C) 2011-2013 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 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&,
92  const label index
93  );
94 
95  //- Construct from geometric patch, resetting the index
97  (
98  const patchIdentifier&,
99  const label index
100  );
101 
102 
103  //- Destructor
104  virtual ~patchIdentifier();
105 
106 
107  // Member Functions
108 
109  //- Return name
110  const word& name() const
111  {
112  return name_;
113  }
114 
115  //- Return name for modification
116  word& name()
117  {
118  return name_;
119  }
120 
121  //- Return the optional physical type of the patch
122  const word& physicalType() const
123  {
124  return physicalType_;
125  }
126 
127  //- Return the optional physical type of the patch for modification
128  word& physicalType()
129  {
130  return physicalType_;
131  }
132 
133  //- Return the index of this patch in the boundaryMesh
134  label index() const
135  {
136  return index_;
137  }
138 
139  //- Return the index of this patch in the boundaryMesh for modification
140  label& index()
141  {
142  return index_;
143  }
144 
145  //- Return the optional groups patch belongs to
146  const wordList& inGroups() const
147  {
148  return inGroups_;
149  }
150 
151  //- Return the optional groups patch belongs to for modification
152  wordList& inGroups()
153  {
154  return inGroups_;
155  }
156 
157  //- Test if in group
158  bool inGroup(const word&) const;
159 
160  //- Write patchIdentifier as a dictionary
161  void write(Ostream&) const;
162 
163 
164  // Ostream Operator
165 
166  friend Ostream& operator<<(Ostream&, const patchIdentifier&);
167 };
168 
169 
170 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
171 
172 } // End namespace Foam
173 
174 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
175 
176 #endif
177 
178 // ************************************************************************* //
const word & name() const
Return name.
label index() const
Return the index of this patch in the boundaryMesh.
A class for handling words, derived from string.
Definition: word.H:59
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
virtual ~patchIdentifier()
Destructor.
Identifies patch by name, patch index and physical type.
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
Ostream & operator<<(Ostream &, const edgeMesh &)
Definition: edgeMeshIO.C:133
Namespace for OpenFOAM.
void write(Ostream &) const
Write patchIdentifier as a dictionary.
patchIdentifier(const word &name, const label index, const word &physicalType=word::null, const wordList &inGroups=wordList())
Construct from components.
const word & physicalType() const
Return the optional physical type of the patch.
List< word > wordList
A List of words.
Definition: fileName.H:54
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:53
bool inGroup(const word &) const
Test if in group.
friend Ostream & operator<<(Ostream &, const patchIdentifier &)
static const word null
An empty word.
Definition: word.H:77
const wordList & inGroups() const
Return the optional groups patch belongs to.