genericPolyPatch.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-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 \*---------------------------------------------------------------------------*/
28 
29 #include "genericPolyPatch.H"
31 
32 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
33 
34 namespace Foam
35 {
36  defineTypeNameAndDebug(genericPolyPatch, 0);
37 
38  addToRunTimeSelectionTable(polyPatch, genericPolyPatch, word);
40 }
41 
42 
43 // * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * * * * * //
44 
46 (
47  const word& name,
48  const label size,
49  const label start,
50  const label index,
51  const polyBoundaryMesh& bm,
52  const word& patchType
53 )
54 :
55  polyPatch(name, size, start, index, bm, patchType)
56 {}
57 
58 
60 (
61  const word& name,
62  const dictionary& dict,
63  const label index,
64  const polyBoundaryMesh& bm,
65  const word& patchType
66 )
67 :
68  polyPatch(name, dict, index, bm, patchType),
69  actualTypeName_(dict.get<word>("type")),
70  dict_(dict)
71 {}
72 
73 
75 (
76  const genericPolyPatch& pp,
77  const polyBoundaryMesh& bm
78 )
79 :
80  polyPatch(pp, bm),
81  actualTypeName_(pp.actualTypeName_),
82  dict_(pp.dict_)
83 {}
84 
85 
87 (
88  const genericPolyPatch& pp,
89  const polyBoundaryMesh& bm,
90  const label index,
91  const label newSize,
92  const label newStart
93 )
94 :
95  polyPatch(pp, bm, index, newSize, newStart),
96  actualTypeName_(pp.actualTypeName_),
97  dict_(pp.dict_)
98 {}
99 
100 
102 (
103  const genericPolyPatch& pp,
104  const polyBoundaryMesh& bm,
105  const label index,
106  const labelUList& mapAddressing,
107  const label newStart
108 )
109 :
110  polyPatch(pp, bm, index, mapAddressing, newStart),
111  actualTypeName_(pp.actualTypeName_),
112  dict_(pp.dict_)
113 {}
114 
115 
116 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
119 {}
120 
121 
122 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
125 {
126  return actualTypeName_;
127 }
128 
129 
131 {
132  os.writeEntry("type", actualTypeName_);
134  os.writeEntry("nFaces", size());
135  os.writeEntry("startFace", start());
136 
137  for (const entry& e : dict_)
138  {
139  const word& key = e.keyword();
140 
141  // Filter out any keywords already written by above
142  if
143  (
144  key != "type"
145  && key != "nFaces"
146  && key != "startFace"
147  && key != "physicalType"
148  && key != "inGroups"
149  )
150  {
151  e.write(os);
152  }
153  }
154 }
155 
156 
157 // ************************************************************************* //
List< ReturnType > get(const UPtrList< T > &list, const AccessOp &aop)
List of values generated by applying the access operation to each list item.
virtual void write(Ostream &) const
Write the polyPatch data as a dictionary.
dictionary dict
void write(Ostream &os) const
Write (physicalType, inGroups) dictionary entries (without surrounding braces)
const word & actualType() const
Return the actual type.
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
Ostream & writeEntry(const keyType &key, const T &value)
Write a keyword/value entry.
Definition: Ostream.H:321
Macros for easy insertion into run-time selection tables.
const dimensionedScalar e
Elementary charge.
Definition: createFields.H:11
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
Definition: exprTraits.C:127
~genericPolyPatch()
Destructor.
A class for handling words, derived from Foam::string.
Definition: word.H:63
A polyBoundaryMesh is a polyPatch list with additional search methods and registered IO...
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:56
OBJstream os(runTime.globalPath()/outputName)
defineTypeNameAndDebug(combustionModel, 0)
Substitute for unknown patches. Used for postprocessing when only basic polyPatch info is needed or i...
auto key(const Type &t) -> typename std::enable_if< std::is_enum< Type >::value, typename std::underlying_type< Type >::type >::type
Definition: foamGltfBase.H:103
genericPolyPatch(const word &name, const label size, const label start, const label index, const polyBoundaryMesh &bm, const word &patchType)
Construct from components.
A patch is a list of labels that address the faces in the global face list.
Definition: polyPatch.H:69
uindirectPrimitivePatch pp(UIndirectList< face >(mesh.faces(), faceLabels), mesh.points())
Namespace for OpenFOAM.
A keyword and a list of tokens is an &#39;entry&#39;.
Definition: entry.H:63
addToRunTimeSelectionTable(functionObject, pointHistory, dictionary)