Loading...
Searching...
No Matches
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\*---------------------------------------------------------------------------*/
29#include "surfacePatch.H"
30#include "surfZone.H"
31#include "dictionary.H"
32
33// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
40
41Foam::surfacePatch::surfacePatch(const label index)
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)
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{
81 os.beginBlock(name());
82
84
85 os.writeEntry("nFaces", size());
86 os.writeEntry("startFace", start());
87
88 os.endBlock();
89}
90
91
92// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
93
94Foam::surfacePatch::operator Foam::surfZone() const
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)
130 return !(a == b);
131}
132
133
134// * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * * //
135
136Foam::Ostream& Foam::operator<<(Ostream& os, const surfacePatch& obj)
137{
139 << obj.size() << token::SPACE
140 << obj.start();
141
142 os.check(FUNCTION_NAME);
143 return os;
144}
145
146
147// ************************************************************************* //
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition Ostream.H:59
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition dictionary.H:133
Identifies a surface patch/zone by name and index, with geometric type.
const word & geometricType() const noexcept
The geometric type of the patch/zone.
void write(Ostream &os) const
Write (geometricType) dictionary entry (without surrounding braces).
label index() const noexcept
The index of this patch/zone in the surface mesh.
const word & name() const noexcept
The patch/zone name.
geometricSurfacePatch(const geometricSurfacePatch &)=default
Copy construct.
A surface zone on a MeshedSurface.
Definition surfZone.H:55
A 'patch' on surface as subset of triSurface.
surfacePatch()
Default construct, with zero start, size, index=-1.
void write(Ostream &os) const
Write dictionary, includes surrounding braces.
label size() const noexcept
Return size of this patch in the face list.
label start() const noexcept
Return start label of this patch in the face list.
surfacePatch(const surfacePatch &)=default
Copy construct.
@ SPACE
Space [isspace].
Definition token.H:144
A class for handling words, derived from Foam::string.
Definition word.H:66
OBJstream os(runTime.globalPath()/outputName)
auto & name
#define FUNCTION_NAME
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces).
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
Definition exprTraits.C:127
dictionary dict
volScalarField & b