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