genericPolyPatch.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-2012 OpenFOAM Foundation
9  Copyright (C) 2016 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::genericPolyPatch
29 
30 Description
31  Substitute for unknown patches.
32  Used for postprocessing when only basic polyPatch info is needed
33  or if the real patch type is unavailable.
34 
35 Note
36  Storage is not optimal. It stores all face centres and cells on all
37  processors to keep the addressing calculation simple.
38 
39 SourceFiles
40  genericPolyPatch.C
41 
42 \*---------------------------------------------------------------------------*/
43 
44 #ifndef genericPolyPatch_H
45 #define genericPolyPatch_H
46 
47 #include "polyPatch.H"
48 
49 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
50 
51 namespace Foam
52 {
53 
54 /*---------------------------------------------------------------------------*\
55  Class genericPolyPatch Declaration
56 \*---------------------------------------------------------------------------*/
57 
58 class genericPolyPatch
59 :
60  public polyPatch
61 {
62  // Private data
63 
64  const word actualTypeName_;
65  dictionary dict_;
66 
67 public:
68 
69  //- Runtime type information
70  TypeName("genericPatch");
71 
72 
73  // Constructors
74 
75  //- Construct from components
77  (
78  const word& name,
79  const label size,
80  const label start,
81  const label index,
82  const polyBoundaryMesh& bm,
83  const word& patchType
84  );
85 
86  //- Construct from dictionary
88  (
89  const word& name,
90  const dictionary& dict,
91  const label index,
92  const polyBoundaryMesh& bm,
93  const word& patchType
94  );
95 
96  //- Construct as copy, resetting the boundary mesh
98  (
99  const genericPolyPatch&,
100  const polyBoundaryMesh&
101  );
102 
103  //- Construct given the original patch and resetting the
104  // face list and boundary mesh information
106  (
107  const genericPolyPatch& pp,
108  const polyBoundaryMesh& bm,
109  const label index,
110  const label newSize,
111  const label newStart
112  );
113 
114  //- Construct given the original patch and a map
116  (
117  const genericPolyPatch& pp,
118  const polyBoundaryMesh& bm,
119  const label index,
120  const labelUList& mapAddressing,
121  const label newStart
122  );
123 
124  //- Construct and return a clone, resetting the boundary mesh
125  virtual autoPtr<polyPatch> clone(const polyBoundaryMesh& bm) const
126  {
127  return autoPtr<polyPatch>(new genericPolyPatch(*this, bm));
128  }
129 
130  //- Construct and return a clone, resetting the face list
131  // and boundary mesh
133  (
134  const polyBoundaryMesh& bm,
135  const label index,
136  const label newSize,
137  const label newStart
138  ) const
139  {
140  return autoPtr<polyPatch>
141  (
142  new genericPolyPatch(*this, bm, index, newSize, newStart)
143  );
144  }
145 
146  //- Construct and return a clone, resetting the face list
147  // and boundary mesh
149  (
150  const polyBoundaryMesh& bm,
151  const label index,
152  const labelUList& mapAddressing,
153  const label newStart
154  ) const
155  {
156  return autoPtr<polyPatch>
157  (
158  new genericPolyPatch(*this, bm, index, mapAddressing, newStart)
159  );
160  }
161 
162 
163  //- Destructor
165 
166 
167  // Member functions
168 
169  //- Return the actual type
170  const word& actualType() const;
171 
172  //- Write the polyPatch data as a dictionary
173  virtual void write(Ostream&) const;
174 };
175 
176 
177 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
178 
179 } // End namespace Foam
180 
181 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
182 
183 #endif
184 
185 // ************************************************************************* //
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::polyBoundaryMesh
A polyBoundaryMesh is a polyPatch list with additional search methods and registered IO.
Definition: polyBoundaryMesh.H:63
polyPatch.H
Foam::genericPolyPatch::TypeName
TypeName("genericPatch")
Runtime type information.
Foam::genericPolyPatch
Substitute for unknown patches. Used for postprocessing when only basic polyPatch info is needed or i...
Definition: genericPolyPatch.H:57
Foam::genericPolyPatch::genericPolyPatch
genericPolyPatch(const word &name, const label size, const label start, const label index, const polyBoundaryMesh &bm, const word &patchType)
Construct from components.
Definition: genericPolyPatch.C:46
Foam::polyPatch
A patch is a list of labels that address the faces in the global face list.
Definition: polyPatch.H:68
Foam::genericPolyPatch::actualType
const word & actualType() const
Return the actual type.
Definition: genericPolyPatch.C:124
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::patchIdentifier::index
label index() const noexcept
The index of this patch in the boundaryMesh.
Definition: patchIdentifier.H:147
Foam::polyPatch::start
label start() const
Return start label of this patch in the polyMesh face list.
Definition: polyPatch.H:361
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
Foam::genericPolyPatch::clone
virtual autoPtr< polyPatch > clone(const polyBoundaryMesh &bm) const
Construct and return a clone, resetting the boundary mesh.
Definition: genericPolyPatch.H:124
Foam::UList< label >
Foam::patchIdentifier::name
const word & name() const noexcept
The patch name.
Definition: patchIdentifier.H:135
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::genericPolyPatch::write
virtual void write(Ostream &) const
Write the polyPatch data as a dictionary.
Definition: genericPolyPatch.C:130
Foam::genericPolyPatch::~genericPolyPatch
~genericPolyPatch()
Destructor.
Definition: genericPolyPatch.C:118