boundaryPatch.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-2018 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 "boundaryPatch.H"
27 #include "dictionary.H"
28 #include "Ostream.H"
29 
30 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
31 
33 (
34  const word& name,
35  const label index,
36  const label size,
37  const label start,
38  const word& physicalType
39 )
40 :
41  patchIdentifier(name, index, physicalType),
42  size_(size),
43  start_(start)
44 {}
45 
46 
48 (
49  const word& name,
50  const dictionary& dict,
51  const label index
52 )
53 :
54  patchIdentifier(name, dict, index),
55  size_(readLabel(dict.lookup("nFaces"))),
56  start_(readLabel(dict.lookup("startFace")))
57 {}
58 
59 
61 :
62  patchIdentifier(p.name(), p.index(), p.physicalType()),
63  size_(p.size()),
64  start_(p.start())
65 {}
66 
67 
69 :
70  patchIdentifier(p.name(), index, p.physicalType()),
71  size_(p.size()),
72  start_(p.start())
73 {}
74 
75 
77 {
78  return autoPtr<boundaryPatch>(new boundaryPatch(*this));
79 }
80 
81 
82 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
83 
85 {}
86 
87 
88 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
89 
91 {
93  os.writeKeyword("nFaces") << size_ << token::END_STATEMENT << nl;
94  os.writeKeyword("startFace") << start_ << token::END_STATEMENT << nl;
95 }
96 
97 
98 // * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
99 
101 {
102  p.write(os);
103  os.check("Ostream& operator<<(Ostream& f, const boundaryPatch&)");
104  return os;
105 }
106 
107 
108 // ************************************************************************* //
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
Like polyPatch but without reference to mesh. patchIdentifier::index is not used. Used in boundaryMes...
Definition: boundaryPatch.H:57
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
Identifies patch by name, patch index and physical type.
~boundaryPatch()
Destructor.
Definition: boundaryPatch.C:84
virtual void write(Ostream &) const
Write dictionary.
Definition: boundaryPatch.C:90
A class for handling words, derived from string.
Definition: word.H:59
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:265
Ostream & writeKeyword(const keyType &)
Write the keyword followed by an appropriate indentation.
Definition: Ostream.C:54
boundaryPatch(const word &name, const label index, const label size, const label start, const word &physicalType=word::null)
Construct from components.
Definition: boundaryPatch.C:33
void write(Ostream &) const
Write patchIdentifier as a dictionary.
Ostream & operator<<(Ostream &, const ensightPart &)
autoPtr< boundaryPatch > clone() const
Clone.
Definition: boundaryPatch.C:76
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:52
volScalarField & p
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
Definition: dictionary.C:576