surfZone.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-2012 OpenFOAM Foundation
9  Copyright (C) 2018-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 "surfZone.H"
30 #include "dictionary.H"
31 #include "word.H"
32 
33 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
34 
35 namespace Foam
36 {
37  defineTypeNameAndDebug(surfZone, 0);
38 }
39 
40 
41 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
42 
44 :
46  size_(0),
47  start_(0)
48 {}
49 
50 
52 :
53  surfZoneIdentifier(name, 0, word::null),
54  size_(size),
55  start_(0)
56 {}
57 
58 
60 (
61  const word& name,
62  const label size,
63  const label start,
64  const label index,
65  const word& geometricType
66 )
67 :
68  surfZoneIdentifier(name, index, geometricType),
69  size_(size),
70  start_(start)
71 {}
72 
73 
75 :
77  size_(0),
78  start_(0)
79 {
80  word name(is);
81  dictionary dict(is);
82 
83  operator=(surfZone(name, dict, index));
84 }
85 
86 
88 (
89  const word& name,
90  const dictionary& dict,
91  const label index
92 )
93 :
94  surfZoneIdentifier(name, dict, index),
95  size_(dict.get<label>("nFaces")),
96  start_(dict.get<label>("startFace"))
97 {}
98 
99 
101 :
102  surfZoneIdentifier(zone, zone.index()),
103  size_(zone.size()),
104  start_(zone.start())
105 {}
106 
107 
109 :
110  surfZoneIdentifier(zone, index),
111  size_(zone.size()),
112  start_(zone.start())
113 {}
114 
115 
116 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
117 
119 {
120  writeDict(os);
121 }
122 
123 
125 {
126  os.beginBlock(name());
127 
129  os.writeEntry("nFaces", size());
130  os.writeEntry("startFace", start());
131 
132  os.endBlock();
133 }
134 
135 
136 // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
137 
138 bool Foam::surfZone::operator!=(const surfZone& rhs) const
139 {
140  return !(*this == rhs);
141 }
142 
143 
144 bool Foam::surfZone::operator==(const surfZone& rhs) const
145 {
146  return
147  (
148  size() == rhs.size()
149  && start() == rhs.start()
150  && geometricType() == rhs.geometricType()
151  );
152 }
153 
154 
155 // * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
156 
158 {
159  zone = surfZone(is, 0);
160 
161  is.check(FUNCTION_NAME);
162  return is;
163 }
164 
165 
167 {
168  zone.write(os);
169  os.check(FUNCTION_NAME);
170  return os;
171 }
172 
173 
174 // ************************************************************************* //
Foam::surfZoneIdentifier::write
void write(Ostream &os) const
Write identifier as a dictionary.
Definition: surfZoneIdentifier.C:97
Foam::surfZone::start
label start() const
Return start label of this zone in the face list.
Definition: surfZone.H:138
Foam::surfZone::writeDict
void writeDict(Ostream &) const
Write dictionary.
Definition: surfZone.C:124
Foam::surfZone::surfZone
surfZone()
Construct null with zero start, size, index.
Definition: surfZone.C:43
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:62
Foam::surfZone::write
void write(Ostream &) const
Write.
Definition: surfZone.C:118
Foam::zone
Base class for mesh zones.
Definition: zone.H:63
Foam::operator>>
Istream & operator>>(Istream &, directionInfo &)
Definition: directionInfo.C:228
Foam::Ostream::beginBlock
virtual Ostream & beginBlock(const keyType &kw)
Write begin block group with the given name.
Definition: Ostream.C:91
Foam::dictionary::get
T get(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Definition: dictionaryTemplates.C:81
Foam::surfZoneIdentifier::index
label index() const
Return the index of this patch/zone in the surface mesh.
Definition: surfZoneIdentifier.H:143
Foam::surfZoneIdentifier
Identifies a surface patch/zone by name, patch index and geometricType.
Definition: surfZoneIdentifier.H:58
Foam::zone::write
virtual void write(Ostream &os) const
Write.
Definition: zone.C:234
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::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:61
surfZone.H
Foam::name
word name(const complex &c)
Return string representation of complex.
Definition: complex.C:76
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::Ostream::endBlock
virtual Ostream & endBlock()
Write end block group.
Definition: Ostream.C:109
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::surfZone::size
label size() const
Return size of this zone in the face list.
Definition: surfZone.H:150
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::surfZoneIdentifier::geometricType
const word & geometricType() const
Return the geometric type of the patch/zone.
Definition: surfZoneIdentifier.H:131
Foam::surfZone::operator!=
bool operator!=(const surfZone &) const
Definition: surfZone.C:138
Foam::surfZone::operator==
bool operator==(const surfZone &) const
compare.
Definition: surfZone.C:144
Foam::surfZone
A surface zone on a MeshedSurface.
Definition: surfZone.H:65
Foam::start
label ListType::const_reference const label start
Definition: ListOps.H:408
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
word.H
Foam::defineTypeNameAndDebug
defineTypeNameAndDebug(combustionModel, 0)
Foam::operator<<
Ostream & operator<<(Ostream &, const boundaryPatch &)
Definition: boundaryPatch.C:102