surfacePatch.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-2016 OpenFOAM Foundation
9 Copyright (C) 2016-2021 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 "surfacePatch.H"
30#include "surfZone.H"
31#include "dictionary.H"
32
33// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
34
36:
37 surfacePatch(-1)
38{}
39
40
42:
43 geometricSurfacePatch(word::null, index, word::null),
44 size_(0),
45 start_(0)
46{}
47
48
50(
51 const word& name,
52 const label size,
53 const label start,
54 const label index,
55 const word& geometricType
56)
57:
58 geometricSurfacePatch(name, index, geometricType),
59 size_(size),
60 start_(start)
61{}
62
63
65(
66 const word& name,
67 const dictionary& dict,
68 const label index
69)
70:
72 size_(dict.get<label>("nFaces")),
73 start_(dict.get<label>("startFace"))
74{}
75
76
77// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
78
80{
82
84
85 os.writeEntry("nFaces", size());
86 os.writeEntry("startFace", start());
87
88 os.endBlock();
89}
90
91
92// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
93
95{
96 return surfZone
97 (
98 this->name(),
99 this->size(),
100 this->start(),
101 this->index(),
102 this->geometricType()
103 );
104}
105
106
107// * * * * * * * * * * * * * * * Global Operators * * * * * * * * * * * * * //
108
109bool Foam::operator==
110(
111 const surfacePatch& a,
112 const surfacePatch& b
113)
114{
115 return
116 (
117 (a.size() == b.size())
118 && (a.start() == b.start())
119 && (a.geometricType() == b.geometricType())
120 );
121}
122
123
124bool Foam::operator!=
125(
126 const surfacePatch& a,
127 const surfacePatch& b
128)
129{
130 return !(a == b);
131}
132
133
134// * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * * //
135
137{
138 os << static_cast<const geometricSurfacePatch&>(obj) << token::SPACE
139 << obj.size() << token::SPACE
140 << obj.start();
141
143 return os;
144}
145
146
147// ************************************************************************* //
virtual bool check(const char *operation) const
Check IOstream status for given operation.
Definition: IOstream.C:58
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
friend Ostream & operator(Ostream &, const faMatrix< Type > &)
virtual bool write()
Write the output fields.
Identifies a surface patch/zone by name and index, with geometric type.
const word & geometricType() const noexcept
The geometric type of the patch/zone.
A surface zone on a MeshedSurface.
Definition: surfZone.H:59
A 'patch' on surface as subset of triSurface.
Definition: surfacePatch.H:57
surfacePatch()
Default construct, with zero start, size, index=-1.
Definition: surfacePatch.C:35
label size() const noexcept
Return size of this patch in the face list.
Definition: surfacePatch.H:120
label start() const noexcept
Return start label of this patch in the face list.
Definition: surfacePatch.H:108
@ SPACE
Space [isspace].
Definition: token.H:125
A class for handling words, derived from Foam::string.
Definition: word.H:68
OBJstream os(runTime.globalPath()/outputName)
#define FUNCTION_NAME
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
Definition: boundaryPatch.C:83
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