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 | Copyright (C) 2011 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
50 geometricSurfacePatch::geometricSurfacePatch
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
70 geometricSurfacePatch::geometricSurfacePatch(Istream& is, const label index)
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
84 geometricSurfacePatch::geometricSurfacePatch
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
105 void geometricSurfacePatch::write(Ostream& os) const
106 {
107  os << nl << name_
108  << nl << geometricType_;
109 }
110 
111 
112 void geometricSurfacePatch::writeDict(Ostream& os) const
113 {
114  os << " geometricType " << geometricType_ << ';' << nl;
115 }
116 
117 
118 // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
119 
120 bool Foam::geometricSurfacePatch::operator!=(const geometricSurfacePatch& p)
121  const
122 {
123  return !(*this == p);
124 }
125 
126 
127 bool Foam::geometricSurfacePatch::operator==(const geometricSurfacePatch& p)
128  const
129 {
130  return
131  (
132  (geometricType() == p.geometricType())
133  && (name() == p.name())
134  );
135 }
136 
137 
138 // * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
139 
140 Istream& operator>>(Istream& is, geometricSurfacePatch& gp)
141 {
142  is >> gp.name_ >> gp.geometricType_;
143 
144  return is;
145 }
146 
147 
148 Ostream& operator<<(Ostream& os, const geometricSurfacePatch& gp)
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 // ************************************************************************* //
Foam::geometricSurfacePatch::operator!=
bool operator!=(const geometricSurfacePatch &) const
Definition: geometricSurfacePatch.C:120
p
p
Definition: pEqn.H:62
geometricSurfacePatch.H
Foam::geometricSurfacePatch::geometricSurfacePatch
geometricSurfacePatch()
Construct null.
Definition: geometricSurfacePatch.C:41
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:59
Foam::Ostream::write
virtual Ostream & write(const token &)=0
Write next token to stream.
Foam::nl
static const char nl
Definition: Ostream.H:260
Foam::operator<<
Ostream & operator<<(Ostream &, const edgeMesh &)
Definition: edgeMeshIO.C:130
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:92
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::geometricSurfacePatch::operator==
bool operator==(const geometricSurfacePatch &) const
compare.
Definition: geometricSurfacePatch.C:127
dictionary.H
Foam::operator>>
Istream & operator>>(Istream &, edgeMesh &)
Definition: edgeMeshIO.C:141
Foam::IOstream::name_
static fileName name_
Name of the stream.
Definition: IOstream.H:217
Foam::defineTypeNameAndDebug
defineTypeNameAndDebug(combustionModel, 0)
write
Tcoeff write()
Foam::name
word name(const complex &)
Return a string representation of a complex.
Definition: complex.C:47
lookup
stressControl lookup("compactNormalStress") >> compactNormalStress