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 -------------------------------------------------------------------------------
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 "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 {
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 
94 Foam::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 
109 bool 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 
124 bool 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 // ************************************************************************* //
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::geometricSurfacePatch
Identifies a surface patch/zone by name and index, with geometric type.
Definition: geometricSurfacePatch.H:53
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::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::surfacePatch::size
label size() const noexcept
Return size of this patch in the face list.
Definition: surfacePatch.H:120
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
os
OBJstream os(runTime.globalPath()/outputName)
Foam::geometricSurfacePatch::write
void write(Ostream &os) const
Definition: geometricSurfacePatch.C:97
Foam::surfacePatch
A 'patch' on surface as subset of triSurface.
Definition: surfacePatch.H:54
Foam::surfZone
A surface zone on a MeshedSurface.
Definition: surfZone.H:56
Foam::token::SPACE
Space [isspace].
Definition: token.H:125
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::geometricSurfacePatch::geometricType
const word & geometricType() const noexcept
The geometric type of the patch/zone.
Definition: geometricSurfacePatch.H:173
Foam::surfacePatch::write
void write(Ostream &os) const
Write dictionary, includes surrounding braces.
Definition: surfacePatch.C:79
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::surfacePatch::surfacePatch
surfacePatch()
Default construct, with zero start, size, index=-1.
Definition: surfacePatch.C:35
Foam::surfacePatch::start
label start() const noexcept
Return start label of this patch in the face list.
Definition: surfacePatch.H:108
surfacePatch.H