boundaryPatch.H
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) 2020-2023 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 Class
28  Foam::boundaryPatch
29 
30 Description
31  Like polyPatch but without reference to mesh.
32  Used in boundaryMesh to hold data on patches.
33  The patchIdentifier::index is set, but not used.
34 
35 SourceFiles
36  boundaryPatch.C
37 
38 \*---------------------------------------------------------------------------*/
39 
40 #ifndef Foam_boundaryPatch_H
41 #define Foam_boundaryPatch_H
42 
43 #include "patchIdentifier.H"
44 #include "labelRange.H"
45 #include "autoPtr.H"
46 
47 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
48 
49 namespace Foam
50 {
51 
52 /*---------------------------------------------------------------------------*\
53  Class boundaryPatch Declaration
54 \*---------------------------------------------------------------------------*/
55 
56 class boundaryPatch
57 :
58  public patchIdentifier
59 {
60  // Private Data
61 
62  //- The size of the patch
63  label size_;
64 
65  //- Start label of the patch
66  label start_;
67 
68 public:
69 
70  // Generated Methods: copy construct, copy assignment
71 
72 
73  // Constructors
74 
75  //- Construct from components
77  (
78  const word& name,
79  const label index,
80  const label size,
81  const label start,
83  );
84 
85  //- Construct from dictionary
87  (
88  const word& name,
89  const dictionary& dict,
90  const label index
91  );
92 
93  //- Copy construct, resetting the index
94  boundaryPatch(const boundaryPatch& p, const label index);
95 
96 
97  //- Clone
99  {
100  return autoPtr<boundaryPatch>::New(*this);
101  }
102 
103 
104  // Member Functions
106  //- The start of the patch
107  label start() const noexcept { return start_; }
108 
109  //- The start of the patch (modifiable)
110  label& start() noexcept { return start_; }
111 
112  //- The size of the patch
113  label size() const noexcept { return size_; }
114 
115  //- The size of the patch (modifiable)
116  label& size() noexcept { return size_; }
117 
118  //- Return start/size range of this patch
119  labelRange range() const noexcept
120  {
121  return labelRange(start_, size_);
122  }
123 
124 
125  //- Write dictionary entries (without surrounding braces)
126  virtual void write(Ostream& os) const;
127 };
128 
129 
130 // Global Operators
132 //- Write boundaryPatch as dictionary entries (without surrounding braces)
134 
135 
136 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
137 
138 } // End namespace Foam
139 
140 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
141 
142 #endif
143 
144 // ************************************************************************* //
dictionary dict
Like polyPatch but without reference to mesh. Used in boundaryMesh to hold data on patches...
Definition: boundaryPatch.H:51
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
Identifies a patch by name and index, with optional physical type and group information.
A range or interval of labels defined by a start and a size.
Definition: labelRange.H:52
labelRange range() const noexcept
Return start/size range of this patch.
autoPtr< boundaryPatch > clone() const
Clone.
A class for handling words, derived from Foam::string.
Definition: word.H:63
static const word null
An empty word.
Definition: word.H:84
const word & name() const noexcept
The patch name.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:56
const direction noexcept
Definition: Scalar.H:258
const word & physicalType() const noexcept
The (optional) physical type of the patch.
OBJstream os(runTime.globalPath()/outputName)
boundaryPatch(const word &name, const label index, const label size, const label start, const word &physicalType=word::null)
Construct from components.
Definition: boundaryPatch.C:29
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
Definition: boundaryPatch.C:77
virtual void write(Ostream &os) const
Write dictionary entries (without surrounding braces)
Definition: boundaryPatch.C:66
Pointer management similar to std::unique_ptr, with some additional methods and type checking...
Definition: HashPtrTable.H:48
label index() const noexcept
The index of this patch in the boundaryMesh.
volScalarField & p
static autoPtr< T > New(Args &&... args)
Construct autoPtr with forwarding arguments.
Definition: autoPtr.H:178
label start() const noexcept
The start of the patch.
label size() const noexcept
The size of the patch.
Namespace for OpenFOAM.