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-2019 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 #include "word.H"
33 
34 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
35 
36 namespace Foam
37 {
38  defineTypeNameAndDebug(surfacePatch, 0);
39 }
40 
41 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
42 
44 :
45  geometricSurfacePatch(word::null, word::null, -1),
46  size_(0),
47  start_(0)
48 {}
49 
50 
52 :
53  geometricSurfacePatch(word::null, word::null, index),
54  size_(0),
55  start_(0)
56 {}
57 
58 
60 (
61  const word& geometricType,
62  const word& name,
63  const label size,
64  const label start,
65  const label index
66 )
67 :
68  geometricSurfacePatch(geometricType, name, index),
69  size_(size),
70  start_(start)
71 {}
72 
73 
75 :
76  geometricSurfacePatch(is, index),
77  size_(0),
78  start_(0)
79 {
80  is >> size_ >> start_;
81 }
82 
83 
85 (
86  const word& name,
87  const dictionary& dict,
88  const label index
89 )
90 :
92  size_(dict.get<label>("nFaces")),
93  start_(dict.get<label>("startFace"))
94 {}
95 
96 
98 :
100  size_(sp.size()),
101  start_(sp.start())
102 {}
103 
104 
105 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
106 
108 {
109  os << nl
110  << static_cast<const geometricSurfacePatch&>(*this) << endl
111  << size() << tab << start();
112 }
113 
115 {
116  os << nl << name() << nl << token::BEGIN_BLOCK << nl;
117 
119 
120  os << " nFaces " << size() << ';' << nl
121  << " startFace " << start() << ';' << nl
122  << token::END_BLOCK << endl;
123 }
124 
125 
126 // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
127 
128 Foam::surfacePatch::operator Foam::surfZone() const
129 {
130  return surfZone
131  (
132  this->name(),
133  this->size(),
134  this->start(),
135  this->index(),
136  this->geometricType()
137  );
138 }
139 
140 
142 {
143  return !(*this == p);
144 }
145 
146 
148 {
149  return
150  (
151  (geometricType() == p.geometricType())
152  && (size() == p.size())
153  && (start() == p.start())
154  );
155 }
156 
157 
158 // * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
159 
161 {
162  p.write(os);
163  os.check(FUNCTION_NAME);
164  return os;
165 }
166 
167 
168 // ************************************************************************* //
p
volScalarField & p
Definition: createFieldRefs.H:8
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:60
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:337
Foam::dictionary::get
T get(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Definition: dictionaryTemplates.C:81
Foam::surfacePatch::writeDict
void writeDict(Ostream &) const
Write dictionary.
Definition: surfacePatch.C:114
Foam::surfacePatch::write
void write(Ostream &) const
Write.
Definition: surfacePatch.C:107
Foam::label
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:62
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:61
surfZone.H
Foam::name
word name(const complex &c)
Return string representation of complex.
Definition: complex.C:76
Foam::token::END_BLOCK
End block [isseparator].
Definition: token.H:122
dict
dictionary dict
Definition: searchingEngine.H:14
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::surfacePatch
'Patch' on surface as subset of triSurface.
Definition: surfacePatch.H:60
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::token::BEGIN_BLOCK
Begin block [isseparator].
Definition: token.H:121
Foam::surfacePatch::operator!=
bool operator!=(const surfacePatch &) const
Compare.
Definition: surfacePatch.C:141
Foam::tab
constexpr char tab
Definition: Ostream.H:371
Foam::nl
constexpr char nl
Definition: Ostream.H:372
Foam::surfZone
A surface zone on a MeshedSurface.
Definition: surfZone.H:65
Foam::start
label ListType::const_reference const label start
Definition: ListOps.H:408
dictionary.H
FUNCTION_NAME
#define FUNCTION_NAME
Definition: messageStream.H:261
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
word.H
Foam::geometricSurfacePatch::writeDict
void writeDict(Ostream &os) const
Write dictionary.
Definition: geometricSurfacePatch.C:153
Foam::surfacePatch::surfacePatch
surfacePatch()
Construct null.
Definition: surfacePatch.C:43
Foam::defineTypeNameAndDebug
defineTypeNameAndDebug(combustionModel, 0)
Foam::operator<<
Ostream & operator<<(Ostream &, const boundaryPatch &)
Definition: boundaryPatch.C:102
surfacePatch.H
Foam::surfacePatch::operator==
bool operator==(const surfacePatch &) const
Compare.
Definition: surfacePatch.C:147