geometricSurfacePatch.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  Copyright (C) 2017 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 Class
28  Foam::geometricSurfacePatch
29 
30 Description
31  The geometricSurfacePatch is like patchIdentifier but for surfaces.
32  Holds type, name and index.
33 
34 SourceFiles
35  geometricSurfacePatch.C
36 
37 \*---------------------------------------------------------------------------*/
38 
39 #ifndef geometricSurfacePatch_H
40 #define geometricSurfacePatch_H
41 
42 #include "typeInfo.H"
43 #include "surfZoneIdentifier.H"
44 
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46 
47 namespace Foam
48 {
49 
50 // Forward declarations
51 class dictionary;
52 class geometricSurfacePatch;
53 
54 Istream& operator>>(Istream& is, geometricSurfacePatch& p);
55 Ostream& operator<<(Ostream& os, const geometricSurfacePatch& p);
56 
57 /*---------------------------------------------------------------------------*\
58  Class geometricSurfacePatch Declaration
59 \*---------------------------------------------------------------------------*/
60 
62 {
63  // Private Data
64 
65  //- Type name of patch
66  word geometricType_;
67 
68  //- Name of patch
69  word name_;
70 
71  //- Index of patch in boundary
72  label index_;
73 
74 public:
75 
76  // Public Data
77 
78  //- The name for an 'empty' type
79  static const word emptyType;
80 
81  //- Helper to convert identifier types as an operation
82  struct fromIdentifier
83  {
85  const
86  {
87  return geometricSurfacePatch(ident);
88  }
89  };
90 
91 
92  //- Runtime type information
93  ClassName("geometricSurfacePatch");
94 
95 
96  // Constructors
97 
98  //- Construct null
100 
101  //- Construct null with specified index
102  explicit geometricSurfacePatch(const label index);
103 
104  //- Construct from components
106  (
107  const word& name,
108  const label index,
109  const word& geometricType = word::null
110  );
111 
112  //- Construct from components
114  (
115  const word& geometricType,
116  const word& name,
117  const label index
118  );
119 
120  //- Implicit conversion from surfZoneIdentifier, which has similar
121  //- information but in a different order
123 
124  //- Construct from dictionary
126  (
127  const word& name,
128  const dictionary& dict,
129  const label index
130  );
131 
132  //- Construct from Istream
134 
135 
136  // Member Functions
137 
138  //- Return name
139  const word& name() const
140  {
141  return name_;
142  }
143 
144  //- Return name
145  word& name()
146  {
147  return name_;
148  }
149 
150  //- Return the geometric type of the patch
151  const word& geometricType() const
152  {
153  return geometricType_;
154  }
155 
156  //- Return the geometric type of the patch for modification
158  {
159  return geometricType_;
160  }
161 
162  //- Return the index of this patch in the surface mesh
163  label index() const
164  {
165  return index_;
166  }
167 
168  //- Return the index of this patch in the surface mesh for modification
169  label& index()
170  {
171  return index_;
172  }
173 
174  //- Write
175  void write(Ostream& os) const;
176 
177  //- Write dictionary
178  void writeDict(Ostream& os) const;
179 
180 
181  // Ostream Operator
182 
184  friend Ostream& operator<<(Ostream& os, const geometricSurfacePatch& p);
185 };
186 
187 
188 // Global Operators
189 
190 //- Compare patches for equality
191 bool operator==(const geometricSurfacePatch& a, const geometricSurfacePatch& b);
192 
193 //- Compare patches for inequality
194 bool operator!=(const geometricSurfacePatch& a, const geometricSurfacePatch& b);
195 
196 
197 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
198 
199 } // End namespace Foam
200 
201 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
202 
203 #endif
204 
205 // ************************************************************************* //
Foam::geometricSurfacePatch::index
label index() const
Return the index of this patch in the surface mesh.
Definition: geometricSurfacePatch.H:162
Foam::geometricSurfacePatch::name
word & name()
Return name.
Definition: geometricSurfacePatch.H:144
p
volScalarField & p
Definition: createFieldRefs.H:8
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:62
typeInfo.H
Foam::geometricSurfacePatch
The geometricSurfacePatch is like patchIdentifier but for surfaces. Holds type, name and index.
Definition: geometricSurfacePatch.H:60
Foam::geometricSurfacePatch::geometricSurfacePatch
geometricSurfacePatch()
Construct null.
Definition: geometricSurfacePatch.C:44
Foam::operator>>
Istream & operator>>(Istream &, directionInfo &)
Definition: directionInfo.C:228
surfZoneIdentifier.H
Foam::surfZoneIdentifier
Identifies a surface patch/zone by name, patch index and geometricType.
Definition: surfZoneIdentifier.H:58
Foam::operator!=
bool operator!=(const eddy &a, const eddy &b)
Definition: eddy.H:235
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::constant::physicoChemical::b
const dimensionedScalar b
Wien displacement law constant: default SI units: [m.K].
Definition: createFields.H:27
Foam::operator==
tmp< faMatrix< Type > > operator==(const faMatrix< Type > &, const faMatrix< Type > &)
Foam::geometricSurfacePatch::geometricType
const word & geometricType() const
Return the geometric type of the patch.
Definition: geometricSurfacePatch.H:150
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:61
Foam::geometricSurfacePatch::operator<<
friend Ostream & operator<<(Ostream &os, const geometricSurfacePatch &p)
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::geometricSurfacePatch::write
void write(Ostream &os) const
Write.
Definition: geometricSurfacePatch.C:146
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::geometricSurfacePatch::fromIdentifier::operator()
geometricSurfacePatch operator()(const surfZoneIdentifier &ident) const
Definition: geometricSurfacePatch.H:83
Foam::geometricSurfacePatch::ClassName
ClassName("geometricSurfacePatch")
Runtime type information.
Foam::geometricSurfacePatch::index
label & index()
Return the index of this patch in the surface mesh for modification.
Definition: geometricSurfacePatch.H:168
Foam::geometricSurfacePatch::fromIdentifier
Helper to convert identifier types as an operation.
Definition: geometricSurfacePatch.H:81
Foam::geometricSurfacePatch::emptyType
static const word emptyType
The name for an 'empty' type.
Definition: geometricSurfacePatch.H:78
Foam::word::null
static const word null
An empty word.
Definition: word.H:77
Foam::geometricSurfacePatch::operator>>
friend Istream & operator>>(Istream &is, geometricSurfacePatch &p)
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::geometricSurfacePatch::geometricType
word & geometricType()
Return the geometric type of the patch for modification.
Definition: geometricSurfacePatch.H:156
Foam::geometricSurfacePatch::writeDict
void writeDict(Ostream &os) const
Write dictionary.
Definition: geometricSurfacePatch.C:153
Foam::geometricSurfacePatch::name
const word & name() const
Return name.
Definition: geometricSurfacePatch.H:138
Foam::operator<<
Ostream & operator<<(Ostream &, const boundaryPatch &)
Definition: boundaryPatch.C:102