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-2021 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 
41 Foam::surfacePatch::surfacePatch(const label index)
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.size() == b.size())
118  && (a.start() == b.start())
119  && (a.geometricType() == b.geometricType())
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 
136 Foam::Ostream& Foam::operator<<(Ostream& os, const surfacePatch& obj)
137 {
138  os << static_cast<const geometricSurfacePatch&>(obj) << token::SPACE
139  << obj.size() << token::SPACE
140  << obj.start();
141 
143  return os;
144 }
145 
146 
147 // ************************************************************************* //
List< ReturnType > get(const UPtrList< T > &list, const AccessOp &aop)
List of values generated by applying the access operation to each list item.
dictionary dict
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
virtual bool check(const char *operation) const
Check IOstream status for given operation.
Definition: IOstream.C:45
A surface zone on a MeshedSurface.
Definition: surfZone.H:52
Ostream & writeEntry(const keyType &key, const T &value)
Write a keyword/value entry.
Definition: Ostream.H:321
void write(Ostream &os) const
Write dictionary, includes surrounding braces.
Definition: surfacePatch.C:72
A &#39;patch&#39; on surface as subset of triSurface.
Definition: surfacePatch.H:50
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
Definition: exprTraits.C:127
const dimensionedScalar b
Wien displacement law constant: default SI units: [m.K].
Definition: createFields.H:27
A class for handling words, derived from Foam::string.
Definition: word.H:63
virtual Ostream & endBlock()
Write end block group.
Definition: Ostream.C:108
Space [isspace].
Definition: token.H:131
surfacePatch()
Default construct, with zero start, size, index=-1.
Definition: surfacePatch.C:28
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:56
OBJstream os(runTime.globalPath()/outputName)
#define FUNCTION_NAME
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
Definition: boundaryPatch.C:77
Identifies a surface patch/zone by name and index, with geometric type.
virtual Ostream & beginBlock(const keyType &kw)
Write begin block group with the given name.
Definition: Ostream.C:90
void write(Ostream &os) const
Write (geometricType) dictionary entry (without surrounding braces)