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-2018 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  os.writeKeyword("geometricType") << geometricType_
93  }
94 }
95 
96 
97 // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
98 
99 // bool Foam::surfZoneIdentifier::operator!=
100 // (
101 // const surfZoneIdentifier& p
102 // ) const
103 // {
104 // return !(*this == p);
105 // }
106 //
107 //
108 // bool Foam::surfZoneIdentifier::operator==
109 // (
110 // const surfZoneIdentifier& p
111 // ) const
112 // {
113 // return geometricType() == p.geometricType() && name() == p.name();
114 // }
115 
116 
117 // * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
118 
119 // Foam::Istream& Foam::operator>>(Istream& is, surfZoneIdentifier& p)
120 // {
121 // is >> p.name_ >> p.geometricType_;
122 //
123 // return is;
124 // }
125 
126 
128 {
129  p.write(os);
130  os.check
131  (
132  "Ostream& operator<<(Ostream&, const surfZoneIdentifier&)"
133  );
134  return os;
135 }
136 
137 
138 // ************************************************************************* //
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
An identifier for a surface zone on a meshed surface.
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
virtual bool check(const char *operation) const
Check IOstream status for given operation.
Definition: IOstream.C:92
const word & name() const
Return name.
virtual ~surfZoneIdentifier()
Destructor.
const word & geometricType() const
Return the geometric type of the zone.
surfZoneIdentifier()
Construct null.
A class for handling words, derived from string.
Definition: word.H:59
void write(Ostream &) const
Write surfZoneIdentifier as a dictionary.
bool readIfPresent(const word &, T &, bool recursive=false, bool patternMatch=true) const
Find an entry if present, and assign to T.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:53
static const char nl
Definition: Ostream.H:265
Ostream & writeKeyword(const keyType &)
Write the keyword followed by an appropriate indentation.
Definition: Ostream.C:54
Ostream & operator<<(Ostream &, const ensightPart &)