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);
39  addToRunTimeSelectionTable(polyPatch, genericPolyPatch, dictionary);
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 * * * * * * * * * * * * * * * //
117 
119 {}
120 
121 
122 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
123 
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 // ************************************************************************* //
Foam::addToRunTimeSelectionTable
addToRunTimeSelectionTable(decompositionMethod, kahipDecomp, dictionary)
Foam::entry
A keyword and a list of tokens is an 'entry'.
Definition: entry.H:67
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
Foam::genericPolyPatch
Substitute for unknown patches. Used for postprocessing when only basic polyPatch info is needed or i...
Definition: genericPolyPatch.H:57
Foam::glTF::key
auto key(const Type &t) -> typename std::enable_if< std::is_enum< Type >::value, typename std::underlying_type< Type >::type >::type
Definition: foamGltfBase.H:108
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
os
OBJstream os(runTime.globalPath()/outputName)
addToRunTimeSelectionTable.H
Macros for easy insertion into run-time selection tables.
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::UList< label >
Foam::constant::electromagnetic::e
const dimensionedScalar e
Elementary charge.
Definition: createFields.H:11
Foam::Ostream::writeEntry
Ostream & writeEntry(const keyType &key, const T &value)
Write a keyword/value entry.
Definition: Ostream.H:236
Foam::name
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
Definition: exprTraits.C:59
Foam::patchIdentifier::write
void write(Ostream &os) const
Definition: patchIdentifier.C:96
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::defineTypeNameAndDebug
defineTypeNameAndDebug(combustionModel, 0)
genericPolyPatch.H
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