surfZoneIdentifier.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) 2016-2019 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 "surfZoneIdentifier.H"
30 #include "dictionary.H"
31 
32 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
33 
35 
36 
37 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
38 
40 :
41  name_(),
42  index_(0),
43  geometricType_()
44 {}
45 
46 
48 :
49  name_(),
50  index_(index),
51  geometricType_()
52 {}
53 
54 
56 (
57  const word& name,
58  const label index,
59  const word& geometricType
60 )
61 :
62  name_(name),
63  index_(index),
64  geometricType_(geometricType)
65 {}
66 
67 
69 (
70  const word& name,
71  const dictionary& dict,
72  const label index
73 )
74 :
75  name_(name),
76  index_(index),
77  geometricType_()
78 {
79  dict.readIfPresent("geometricType", geometricType_);
80 }
81 
82 
84 (
85  const surfZoneIdentifier& p,
86  const label index
87 )
88 :
89  name_(p.name()),
90  index_(index),
91  geometricType_(p.geometricType())
92 {}
93 
94 
95 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
96 
98 {
99  if (geometricType_.size())
100  {
101  os.writeEntry("geometricType", geometricType_);
102  }
103 }
104 
105 
106 // * * * * * * * * * * * * * * * Global Operators * * * * * * * * * * * * * //
107 
109 {
110  return
111  (
112  (a.index() == b.index())
113  && (a.name() == b.name())
114  && (a.geometricType() == b.geometricType())
115  );
116 }
117 
118 
120 {
121  return !(a == b);
122 }
123 
124 
125 // * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
126 
128 {
129  is >> obj.name() >> obj.geometricType();
130  return is;
131 }
132 
133 
135 {
136  // Newlines to separate, since that is what triSurface currently expects
137  os << nl << obj.name() << nl << obj.geometricType();
138  os.check(FUNCTION_NAME);
139  return os;
140 }
141 
142 
143 // ************************************************************************* //
Foam::surfZoneIdentifier::write
void write(Ostream &os) const
Write identifier as a dictionary.
Definition: surfZoneIdentifier.C:97
p
volScalarField & p
Definition: createFieldRefs.H:8
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:62
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
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::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::surfZoneIdentifier::surfZoneIdentifier
surfZoneIdentifier()
Construct null, with index zero.
Definition: surfZoneIdentifier.C:39
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
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::surfZoneIdentifier::emptyType
static const word emptyType
The name for an 'empty' type.
Definition: surfZoneIdentifier.H:77
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