geometricSurfacePatch.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 "geometricSurfacePatch.H"
27 #include "dictionary.H"
28 
29 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
30 
31 namespace Foam
32 {
33 
34 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
35 
36 defineTypeNameAndDebug(geometricSurfacePatch, 0);
37 
38 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
39 
40 // Construct null
42 :
43  geometricType_("empty"),
44  name_("patch"),
45  index_(0)
46 {}
47 
48 
49 // Construct from components
51 (
52  const word& geometricType,
53  const word& name,
54  const label index
55 )
56 :
57  geometricType_(geometricType),
58  name_(name),
59  index_(index)
60 
61 {
62  if (geometricType_.empty())
63  {
64  geometricType_ = "empty";
65  }
66 }
67 
68 
69 // Construct from Istream
71 :
72  geometricType_(is),
73  name_(is),
74  index_(index)
75 {
76  if (geometricType_.empty())
77  {
78  geometricType_ = "empty";
79  }
80 }
81 
82 
83 // Construct from dictionary
85 (
86  const word& name,
87  const dictionary& dict,
88  const label index
89 )
90 :
91  geometricType_(dict.lookup("geometricType")),
92  name_(name),
93  index_(index)
94 {
95  if (geometricType_.empty())
96  {
97  geometricType_ = "empty";
98  }
99 }
100 
101 
102 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
103 
104 // Write
106 {
107  os << nl << name_
108  << nl << geometricType_;
109 }
110 
111 
113 {
114  os << " geometricType " << geometricType_ << ';' << nl;
115 }
116 
117 
118 // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
119 
121  const
122 {
123  return !(*this == p);
124 }
125 
126 
128  const
129 {
130  return
131  (
132  (geometricType() == p.geometricType())
133  && (name() == p.name())
134  );
135 }
136 
137 
138 // * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
139 
141 {
142  is >> gp.name_ >> gp.geometricType_;
143 
144  return is;
145 }
146 
147 
149 {
150  gp.write(os);
151  os.check
152  (
153  "Ostream& operator<<(Ostream& f, const geometricSurfacePatch& gp)"
154  );
155  return os;
156 }
157 
158 
159 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
160 
161 } // End namespace Foam
162 
163 // ************************************************************************* //
friend Istream & operator>>(Istream &, geometricSurfacePatch &)
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
const word & name() const
Return name.
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:156
virtual bool check(const char *operation) const
Check IOstream status for given operation.
Definition: IOstream.C:92
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
const word & geometricType() const
Return the type of the patch.
geometricSurfacePatch()
Construct null.
friend Ostream & operator<<(Ostream &, const geometricSurfacePatch &)
A class for handling words, derived from string.
Definition: word.H:59
void write(Ostream &) const
Write.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:54
static const char nl
Definition: Ostream.H:260
defineTypeNameAndDebug(combustionModel, 0)
The geometricSurfacePatch is like patchIdentifier but for surfaces. Holds type, name and index...
bool operator==(const geometricSurfacePatch &) const
compare.
volScalarField & p
bool operator!=(const geometricSurfacePatch &) const
void writeDict(Ostream &) const
Write dictionary.
Namespace for OpenFOAM.
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
Definition: dictionary.C:844