boundaryPatch.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 OpenFOAM Foundation
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 \*---------------------------------------------------------------------------*/
27 
28 #include "boundaryPatch.H"
29 #include "dictionary.H"
30 #include "Ostream.H"
31 
32 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
33 
35 (
36  const word& name,
37  const label index,
38  const label size,
39  const label start,
40  const word& physicalType
41 )
42 :
43  patchIdentifier(name, index, physicalType),
44  size_(size),
45  start_(start)
46 {}
47 
48 
50 (
51  const word& name,
52  const dictionary& dict,
53  const label index
54 )
55 :
56  patchIdentifier(name, dict, index),
57  size_(dict.get<label>("nFaces")),
58  start_(dict.get<label>("startFace"))
59 {}
60 
61 
63 :
64  patchIdentifier(p.name(), p.index(), p.physicalType()),
65  size_(p.size()),
66  start_(p.start())
67 {}
68 
69 
71 :
72  patchIdentifier(p.name(), index, p.physicalType()),
73  size_(p.size()),
74  start_(p.start())
75 {}
76 
77 
79 {
80  return autoPtr<boundaryPatch>::New(*this);
81 }
82 
83 
84 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
85 
87 {}
88 
89 
90 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
91 
93 {
95  os.writeEntry("nFaces", size_);
96  os.writeEntry("startFace", start_);
97 }
98 
99 
100 // * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
101 
103 {
104  p.write(os);
105  os.check(FUNCTION_NAME);
106  return os;
107 }
108 
109 
110 // ************************************************************************* //
Foam::autoPtr::New
static autoPtr< T > New(Args &&... args)
Construct autoPtr of T with forwarding arguments.
p
volScalarField & p
Definition: createFieldRefs.H:8
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:62
boundaryPatch.H
Foam::boundaryPatch
Like polyPatch but without reference to mesh. patchIdentifier::index is not used. Used in boundaryMes...
Definition: boundaryPatch.H:59
Foam::patchIdentifier
Identifies a patch by name, patch index and physical type.
Definition: patchIdentifier.H:57
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:62
Foam::boundaryPatch::clone
autoPtr< boundaryPatch > clone() const
Clone.
Definition: boundaryPatch.C:78
Foam::name
word name(const complex &c)
Return string representation of complex.
Definition: complex.C:76
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::IOstream::check
virtual bool check(const char *operation) const
Check IOstream status for given operation.
Definition: IOstream.C:51
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:121
Foam::boundaryPatch::boundaryPatch
boundaryPatch(const word &name, const label index, const label size, const label start, const word &physicalType=word::null)
Construct from components.
Definition: boundaryPatch.C:35
Ostream.H
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
Foam::boundaryPatch::~boundaryPatch
~boundaryPatch()
Destructor.
Definition: boundaryPatch.C:86
Foam::start
label ListType::const_reference const label start
Definition: ListOps.H:408
Foam::boundaryPatch::write
virtual void write(Ostream &) const
Write dictionary.
Definition: boundaryPatch.C:92
dictionary.H
FUNCTION_NAME
#define FUNCTION_NAME
Definition: messageStream.H:261
Foam::Ostream::writeEntry
Ostream & writeEntry(const keyType &key, const T &value)
Write a keyword/value entry.
Definition: Ostream.H:219
Foam::patchIdentifier::write
void write(Ostream &os) const
Write patchIdentifier as a dictionary.
Definition: patchIdentifier.C:85
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::operator<<
Ostream & operator<<(Ostream &, const boundaryPatch &)
Definition: boundaryPatch.C:102