surfZoneIdentifier.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2019 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 \*---------------------------------------------------------------------------*/
25 
26 #include "surfZoneIdentifier.H"
27 #include "dictionary.H"
28 
29 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
30 
32 :
33  name_(word::null),
34  index_(0),
35  geometricType_(word::null)
36 {}
37 
38 
40 (
41  const word& name,
42  const label index,
43  const word& geometricType
44 )
45 :
46  name_(name),
47  index_(index),
48  geometricType_(geometricType)
49 {}
50 
51 
53 (
54  const word& name,
55  const dictionary& dict,
56  const label index
57 )
58 :
59  name_(name),
60  index_(index)
61 {
62  dict.readIfPresent("geometricType", geometricType_);
63 }
64 
65 
67 (
68  const surfZoneIdentifier& p,
69  const label index
70 )
71 :
72  name_(p.name()),
73  index_(index),
74  geometricType_(p.geometricType())
75 {}
76 
77 
78 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
79 
81 {}
82 
83 
84 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
85 
86 
88 {
89  if (geometricType_.size())
90  {
91  writeEntry(os, "geometricType", geometricType_);
92  }
93 }
94 
95 
96 // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
97 
98 // bool Foam::surfZoneIdentifier::operator!=
99 // (
100 // const surfZoneIdentifier& p
101 // ) const
102 // {
103 // return !(*this == p);
104 // }
105 //
106 //
107 // bool Foam::surfZoneIdentifier::operator==
108 // (
109 // const surfZoneIdentifier& p
110 // ) const
111 // {
112 // return geometricType() == p.geometricType() && name() == p.name();
113 // }
114 
115 
116 // * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
117 
118 // Foam::Istream& Foam::operator>>(Istream& is, surfZoneIdentifier& p)
119 // {
120 // is >> p.name_ >> p.geometricType_;
121 //
122 // return is;
123 // }
124 
125 
127 {
128  p.write(os);
129  os.check
130  (
131  "Ostream& operator<<(Ostream&, const surfZoneIdentifier&)"
132  );
133  return os;
134 }
135 
136 
137 // ************************************************************************* //
virtual bool check(const char *operation) const
Check IOstream status for given operation.
Definition: IOstream.C:92
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:57
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:162
virtual bool write(const bool write=true) const
Write using setting from DB.
An identifier for a surface zone on a meshed surface.
surfZoneIdentifier()
Construct null.
virtual ~surfZoneIdentifier()
Destructor.
void write(Ostream &) const
Write surfZoneIdentifier as a dictionary.
A class for handling words, derived from string.
Definition: word.H:62
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
word name(const bool)
Return a word representation of a bool.
Definition: boolIO.C:39
void writeEntry(Ostream &os, const HashTable< T, Key, Hash > &ht)
Definition: HashTableIO.C:96
Ostream & operator<<(Ostream &os, const fvConstraints &constraints)
dictionary dict
volScalarField & p