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-------------------------------------------------------------------------------
11License
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
42Foam::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:
73 size_(dict.get<label>("nFaces")),
74 start_(dict.get<label>("startFace"))
75{}
76
77
78Foam::surfZone::surfZone(const surfZone& zone, const label index)
79:
81{
83}
84
85
86// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
87
89{
91
93 os.writeEntry("nFaces", size());
94 os.writeEntry("startFace", start());
95
96 os.endBlock();
97}
98
99
100// * * * * * * * * * * * * * * * Global Operators * * * * * * * * * * * * * //
101
102bool 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
113bool 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
130 return is;
131}
132
133
135{
136 obj.write(os);
137
139 return os;
140}
141
142
143// ************************************************************************* //
virtual bool check(const char *operation) const
Check IOstream status for given operation.
Definition: IOstream.C:58
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:64
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:62
virtual Ostream & endBlock()
Write end block group.
Definition: Ostream.C:105
Ostream & writeEntry(const keyType &key, const T &value)
Write a keyword/value entry.
Definition: Ostream.H:239
virtual Ostream & beginBlock(const keyType &kw)
Write begin block group with the given name.
Definition: Ostream.C:87
void size(const label n)
Older name for setAddressableSize.
Definition: UList.H:114
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
virtual bool write()
Write the output fields.
Identifies a surface patch/zone by name and index, with optional geometric type.
label index() const
The index of this patch/zone in the surface mesh.
const word & geometricType() const
The geometric type of the patch/zone.
A surface zone on a MeshedSurface.
Definition: surfZone.H:59
surfZone()
Default construct, with zero start, size, index.
Definition: surfZone.C:34
label start() const
The start label of this zone in the face list.
Definition: surfZone.H:128
void write(Ostream &os) const
Write dictionary, includes surrounding braces.
Definition: surfZone.C:88
label size() const
The size of this zone in the face list.
Definition: surfZone.H:140
A class for handling words, derived from Foam::string.
Definition: word.H:68
Base class for mesh zones.
Definition: zone.H:67
OBJstream os(runTime.globalPath()/outputName)
#define FUNCTION_NAME
bool operator!=(const eddy &a, const eddy &b)
Definition: eddy.H:239
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
Definition: boundaryPatch.C:83
tmp< faMatrix< Type > > operator==(const faMatrix< Type > &, const faMatrix< Type > &)
Istream & operator>>(Istream &, directionInfo &)
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
Definition: exprTraits.C:59
dictionary dict
volScalarField & b
Definition: createFields.H:27