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-2020 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 
32 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
33 
35 :
37  size_(0),
38  start_(0)
39 {}
40 
41 
42 Foam::surfZone::surfZone(const word& name, const label size)
43 :
44  surfZoneIdentifier(name, 0, word::null),
45  size_(size),
46  start_(0)
47 {}
48 
49 
51 (
52  const word& name,
53  const label size,
54  const label start,
55  const label index,
56  const word& geometricType
57 )
58 :
59  surfZoneIdentifier(name, index, geometricType),
60  size_(size),
61  start_(start)
62 {}
63 
64 
66 (
67  const word& name,
68  const dictionary& dict,
69  const label index
70 )
71 :
72  surfZoneIdentifier(name, dict, index),
73  size_(dict.get<label>("nFaces")),
74  start_(dict.get<label>("startFace"))
75 {}
76 
77 
78 Foam::surfZone::surfZone(const surfZone& zone, const label index)
79 :
80  surfZone(zone)
81 {
83 }
84 
85 
86 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
87 
89 {
90  os.beginBlock(name());
91 
93  os.writeEntry("nFaces", size());
94  os.writeEntry("startFace", start());
95 
96  os.endBlock();
97 }
98 
99 
100 // * * * * * * * * * * * * * * * Global Operators * * * * * * * * * * * * * //
101 
102 bool Foam::operator==(const surfZone& a, const surfZone& b)
103 {
104  return
105  (
106  a.size() == b.size()
107  && a.start() == b.start()
108  && a.geometricType() == b.geometricType()
109  );
110 }
111 
112 
113 bool Foam::operator!=(const surfZone& a, const surfZone& b)
114 {
115  return !(a == b);
116 }
117 
118 
119 // * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
120 
122 {
123  const word name(is);
124  const dictionary dict(is);
125 
126  // Could also leave index untouched?
127  obj = surfZone(name, dict, 0);
128 
129  is.check(FUNCTION_NAME);
130  return is;
131 }
132 
133 
135 {
136  obj.write(os);
137 
139  return os;
140 }
141 
142 
143 // ************************************************************************* //
Foam::surfZoneIdentifier::write
void write(Ostream &os) const
Definition: surfZoneIdentifier.C:102
Foam::surfZone::start
label start() const
The start label of this zone in the face list.
Definition: surfZone.H:128
Foam::surfZone::surfZone
surfZone()
Default construct, with zero start, size, index.
Definition: surfZone.C:34
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::zone
Base class for mesh zones.
Definition: zone.H:63
Foam::surfZone::write
void write(Ostream &os) const
Write dictionary, includes surrounding braces.
Definition: surfZone.C:88
Foam::operator>>
Istream & operator>>(Istream &, directionInfo &)
Definition: directionInfo.C:230
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:107
Foam::surfZoneIdentifier::index
label index() const
The index of this patch/zone in the surface mesh.
Definition: surfZoneIdentifier.H:165
Foam::surfZoneIdentifier
Identifies a surface patch/zone by name and index, with optional geometric type.
Definition: surfZoneIdentifier.H:59
Foam::operator!=
bool operator!=(const eddy &a, const eddy &b)
Definition: eddy.H:239
Foam::operator<<
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
Definition: boundaryPatch.C:83
Foam::constant::physicoChemical::b
const dimensionedScalar b
Wien displacement law constant: default SI units: [m.K].
Definition: createFields.H:27
Foam::operator==
tmp< faMatrix< Type > > operator==(const faMatrix< Type > &, const faMatrix< Type > &)
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:61
surfZone.H
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:58
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
Foam::surfZone::size
label size() const
The size of this zone in the face list.
Definition: surfZone.H:140
os
OBJstream os(runTime.globalPath()/outputName)
Foam::surfZoneIdentifier::geometricType
const word & geometricType() const
The geometric type of the patch/zone.
Definition: surfZoneIdentifier.H:153
Foam::surfZone
A surface zone on a MeshedSurface.
Definition: surfZone.H:56
dictionary.H
FUNCTION_NAME
#define FUNCTION_NAME
Definition: messageStream.H:295
Foam::Ostream::writeEntry
Ostream & writeEntry(const keyType &key, const T &value)
Write a keyword/value entry.
Definition: Ostream.H:236
Foam::name
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
Definition: exprTraits.C:59
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56