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-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 "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.geometricType() == b.geometricType())
118  && (a.size() == b.size())
119  && (a.start() == b.start())
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 
142  os.check(FUNCTION_NAME);
143  return os;
144 }
145 
146 
147 // * * * * * * * * * * * * * * * Housekeeping * * * * * * * * * * * * * * * //
148 
150 (
151  const word& geometricType,
152  const word& name,
153  const label size,
154  const label start,
155  const label index
156 )
157 :
158  surfacePatch(name, size, start, index, geometricType)
159 {}
160 
161 
162 // ************************************************************************* //
Foam::surfacePatch::size
label size() const
Return size of this patch in the face list.
Definition: surfacePatch.H:120
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:62
Foam::geometricSurfacePatch
The geometricSurfacePatch is like patchIdentifier but for surfaces. Holds type, name and index.
Definition: geometricSurfacePatch.H:52
Foam::surfacePatch::start
label start() const
Return start label of this patch in the face list.
Definition: surfacePatch.H:108
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:81
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::geometricSurfacePatch::geometricType
const word & geometricType() const
The geometric type of the patch/zone.
Definition: geometricSurfacePatch.H:156
surfZone.H
Foam::name
word name(const complex &c)
Return string representation of complex.
Definition: complex.C:76
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:51
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:121
Foam::geometricSurfacePatch::write
void write(Ostream &os) const
Definition: geometricSurfacePatch.C:122
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:118
dictionary.H
FUNCTION_NAME
#define FUNCTION_NAME
Definition: messageStream.H:265
Foam::Ostream::writeEntry
Ostream & writeEntry(const keyType &key, const T &value)
Write a keyword/value entry.
Definition: Ostream.H:232
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
surfacePatch.H