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 | Copyright (C) 2011-2016 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_(readLabel(dict.lookup("nFaces"))),
82  start_(readLabel(dict.lookup("startFace")))
83 {}
84 
85 
87 :
89  size_(sp.size()),
90  start_(sp.start())
91 {}
92 
93 
94 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
95 
97 {
98  os << nl
99  << static_cast<const geometricSurfacePatch&>(*this) << endl
100  << size() << tab << start();
101 }
102 
104 {
105  os << nl << name() << nl << token::BEGIN_BLOCK << nl;
106 
108 
109  os << " nFaces " << size() << ';' << nl
110  << " startFace " << start() << ';' << nl
111  << token::END_BLOCK << endl;
112 }
113 
114 
115 // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
116 
118 {
119  return !(*this == p);
120 }
121 
122 
124 {
125  return
126  (
127  (geometricType() == p.geometricType())
128  && (size() == p.size())
129  && (start() == p.start())
130  );
131 }
132 
133 
134 // * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
135 
137 {
138  p.write(os);
139  os.check("Ostream& operator<<(Ostream& f, const surfacePatch& p");
140  return os;
141 }
142 
143 
144 // ************************************************************************* //
bool operator==(const surfacePatch &) const
compare.
Definition: surfacePatch.C:123
label start() const
Return start label of this patch in the polyMesh face list.
Definition: surfacePatch.H:109
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:59
const word & name() const
Return name.
static const char tab
Definition: Ostream.H:261
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
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:253
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:103
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:53
static const char nl
Definition: Ostream.H:262
defineTypeNameAndDebug(combustionModel, 0)
void write(Ostream &) const
Write.
Definition: surfacePatch.C:96
label size() const
Return size of this patch in the polyMesh face list.
Definition: surfacePatch.H:121
Ostream & operator<<(Ostream &, const ensightPart &)
bool operator!=(const surfacePatch &) const
Definition: surfacePatch.C:117
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:576