surfacePatch.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 \*---------------------------------------------------------------------------*/
25 
26 #include "surfacePatch.H"
27 #include "dictionary.H"
28 #include "word.H"
29 
30 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
31 
32 namespace Foam
33 {
34  defineTypeNameAndDebug(surfacePatch, 0);
35 }
36 
37 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
38 
40 :
41  geometricSurfacePatch("", "", -1),
42  size_(0),
43  start_(0)
44 {}
45 
46 
48 (
49  const word& geometricType,
50  const word& name,
51  const label size,
52  const label start,
53  const label index
54 )
55 :
56  geometricSurfacePatch(geometricType, name, index),
57  size_(size),
58  start_(start)
59 {}
60 
61 
63 :
64  geometricSurfacePatch(is, index),
65  size_(0),
66  start_(0)
67 {
68  size_ = readLabel(is);
69  start_ = readLabel(is);
70 }
71 
72 
74 (
75  const word& name,
76  const dictionary& dict,
77  const label index
78 )
79 :
80  geometricSurfacePatch(name, dict, index),
81  size_(dict.lookup<label>("nFaces")),
82  start_(dict.lookup<label>("startFace"))
83 {}
84 
85 
86 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
87 
89 {
90  os << nl
91  << static_cast<const geometricSurfacePatch&>(*this) << endl
92  << size() << tab << start();
93 }
94 
96 {
97  os << nl << name() << nl << token::BEGIN_BLOCK << nl;
98 
100 
101  os << " nFaces " << size() << ';' << nl
102  << " startFace " << start() << ';' << nl
103  << token::END_BLOCK << endl;
104 }
105 
106 
107 // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
108 
110 {
111  return !(*this == p);
112 }
113 
114 
116 {
117  return
118  (
119  (geometricType() == p.geometricType())
120  && (size() == p.size())
121  && (start() == p.start())
122  );
123 }
124 
125 
126 // * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
127 
129 {
130  p.write(os);
131  os.check("Ostream& operator<<(Ostream& f, const surfacePatch& p");
132  return os;
133 }
134 
135 
136 // ************************************************************************* //
bool operator==(const surfacePatch &) const
compare.
Definition: surfacePatch.C:115
label start() const
Return start label of this patch in the polyMesh face list.
Definition: surfacePatch.H:107
const word & name() const
Return name.
static const char tab
Definition: Ostream.H:259
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:156
virtual bool check(const char *operation) const
Check IOstream status for given operation.
Definition: IOstream.C:92
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
const word & geometricType() const
Return the type of the patch.
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:251
geometricSurfacePatch()
Construct null.
&#39;Patch&#39; on surface as subset of triSurface.
Definition: surfacePatch.H:58
A class for handling words, derived from string.
Definition: word.H:59
void writeDict(Ostream &) const
Write dictionary.
Definition: surfacePatch.C:95
surfacePatch()
Construct null.
Definition: surfacePatch.C:39
label readLabel(Istream &is)
Definition: label.H:64
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:54
static const char nl
Definition: Ostream.H:260
defineTypeNameAndDebug(combustionModel, 0)
void write(Ostream &) const
Write.
Definition: surfacePatch.C:88
label size() const
Return size of this patch in the polyMesh face list.
Definition: surfacePatch.H:119
Ostream & operator<<(Ostream &, const ensightPart &)
bool operator!=(const surfacePatch &) const
Definition: surfacePatch.C:109
The geometricSurfacePatch is like patchIdentifier but for surfaces. Holds type, name and index...
volScalarField & p
void writeDict(Ostream &) const
Write dictionary.
Namespace for OpenFOAM.
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
Definition: dictionary.C:864