geometricSurfacePatch.C
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 \*---------------------------------------------------------------------------*/
28 
29 #include "geometricSurfacePatch.H"
30 #include "dictionary.H"
31 
32 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
33 
34 namespace Foam
35 {
36  defineTypeNameAndDebug(geometricSurfacePatch, 0);
37 }
38 
40 
41 
42 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
43 
45 :
46  geometricType_(emptyType),
47  name_("patch"),
48  index_(0)
49 {}
50 
51 
53 :
54  geometricType_(emptyType),
55  name_("patch"),
56  index_(index)
57 {}
58 
59 
61 (
62  const word& name,
63  const label index,
64  const word& geometricType
65 )
66 :
67  geometricType_(geometricType),
68  name_(name),
69  index_(index)
70 {
71  if (geometricType_.empty())
72  {
73  geometricType_ = emptyType;
74  }
75 }
76 
77 
79 (
80  const word& geometricType,
81  const word& name,
82  const label index
83 )
84 :
85  geometricType_(geometricType),
86  name_(name),
87  index_(index)
88 {
89  if (geometricType_.empty())
90  {
91  geometricType_ = emptyType;
92  }
93 }
94 
95 
97 (
98  const surfZoneIdentifier& ident
99 )
100 :
101  geometricType_(ident.geometricType()),
102  name_(ident.name()),
103  index_(ident.index())
104 {
105  if (geometricType_.empty())
106  {
107  geometricType_ = emptyType;
108  }
109 }
110 
111 
113 (
114  Istream& is,
115  const label index
116 )
117 :
118  geometricType_(is),
119  name_(is),
120  index_(index)
121 {
122  if (geometricType_.empty())
123  {
124  geometricType_ = emptyType;
125  }
126 }
127 
128 
130 (
131  const word& name,
132  const dictionary& dict,
133  const label index
134 )
135 :
136  geometricType_(emptyType),
137  name_(name),
138  index_(index)
139 {
140  dict.readIfPresent("geometricType", geometricType_);
141 }
142 
143 
144 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
145 
147 {
148  os << nl << name_
149  << nl << geometricType_;
150 }
151 
152 
154 {
155  os.writeEntry("geometricType", geometricType_);
156 }
157 
158 
159 // * * * * * * * * * * * * * * * Global Operators * * * * * * * * * * * * * //
160 
161 bool Foam::operator==
162 (
163  const geometricSurfacePatch& a,
164  const geometricSurfacePatch& b
165 )
166 {
167  return
168  (
169  (a.geometricType() == b.geometricType())
170  && (a.name() == b.name())
171  );
172 }
173 
174 
175 bool Foam::operator!=
176 (
177  const geometricSurfacePatch& a,
178  const geometricSurfacePatch& b
179 )
180 {
181  return !(a == b);
182 }
183 
184 
185 // * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
186 
188 {
189  is >> p.name_ >> p.geometricType_;
190  return is;
191 }
192 
193 
195 {
196  p.write(os);
197  os.check(FUNCTION_NAME);
198  return os;
199 }
200 
201 
202 // ************************************************************************* //
p
volScalarField & p
Definition: createFieldRefs.H:8
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:62
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::dimensioned::name
const word & name() const
Return const reference to name.
Definition: dimensionedType.C:376
Foam::operator>>
Istream & operator>>(Istream &, directionInfo &)
Definition: directionInfo.C:228
Foam::surfZoneIdentifier::index
label index() const
Return the index of this patch/zone in the surface mesh.
Definition: surfZoneIdentifier.H:143
geometricSurfacePatch.H
Foam::surfZoneIdentifier
Identifies a surface patch/zone by name, patch index and geometricType.
Definition: surfZoneIdentifier.H:58
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::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::name
word name(const complex &c)
Return string representation of complex.
Definition: complex.C:76
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::IOstream::check
virtual bool check(const char *operation) const
Check IOstream status for given operation.
Definition: IOstream.C:51
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::surfZoneIdentifier::geometricType
const word & geometricType() const
Return the geometric type of the patch/zone.
Definition: surfZoneIdentifier.H:131
Foam::nl
constexpr char nl
Definition: Ostream.H:372
Foam::geometricSurfacePatch::emptyType
static const word emptyType
The name for an 'empty' type.
Definition: geometricSurfacePatch.H:78
dictionary.H
FUNCTION_NAME
#define FUNCTION_NAME
Definition: messageStream.H:261
Foam::Ostream::writeEntry
Ostream & writeEntry(const keyType &key, const T &value)
Write a keyword/value entry.
Definition: Ostream.H:219
Foam::surfZoneIdentifier::name
const word & name() const
Return name.
Definition: surfZoneIdentifier.H:119
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::geometricSurfacePatch::writeDict
void writeDict(Ostream &os) const
Write dictionary.
Definition: geometricSurfacePatch.C:153
Foam::defineTypeNameAndDebug
defineTypeNameAndDebug(combustionModel, 0)
Foam::geometricSurfacePatch::name
const word & name() const
Return name.
Definition: geometricSurfacePatch.H:138
Foam::operator<<
Ostream & operator<<(Ostream &, const boundaryPatch &)
Definition: boundaryPatch.C:102
Foam::dictionary::readIfPresent
bool readIfPresent(const word &keyword, T &val, enum keyType::option matchOpt=keyType::REGEX) const
Definition: dictionaryTemplates.C:417