patchSummaryTemplates.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 \*---------------------------------------------------------------------------*/
25 
26 #include "patchSummaryTemplates.H"
27 #include "genericPatchField.H"
28 #include "IOmanip.H"
29 
30 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
31 
32 template<class PatchField>
33 Foam::word Foam::patchFieldType(const PatchField& pf)
34 {
35  if (isA<genericPatchField>(pf))
36  {
37  return refCast<const genericPatchField>(pf).actualTypeName();
38  }
39  else
40  {
41  return pf.type();
42  }
43 }
44 
45 
46 template<class GeoField>
48 (
49  PtrList<GeoField>& fieldList,
50  const IOobject& obj,
51  const label fieldi,
52  const typename GeoField::Mesh& mesh
53 )
54 {
55  if (obj.headerClassName() == GeoField::typeName)
56  {
57  fieldList.set
58  (
59  fieldi,
60  new GeoField(obj, mesh)
61  );
62  Info<< " " << GeoField::typeName << tab << obj.name() << endl;
63  }
64 }
65 
66 
67 template<class GeoField>
69 (
70  const PtrList<GeoField>& fieldList,
71  const label patchi
72 )
73 {
74  forAll(fieldList, fieldi)
75  {
76  if (fieldList.set(fieldi))
77  {
78  Info<< " " << pTraits<typename GeoField::value_type>::typeName
79  << tab << tab
80  << fieldList[fieldi].name() << tab << tab
81  << patchFieldType(fieldList[fieldi].boundaryField()[patchi])
82  << nl;
83  }
84  }
85 }
86 
87 
88 template<class GeoField>
90 (
91  const PtrList<GeoField>& fieldList,
92  const label patchi,
93  HashTable<word>& fieldToType
94 )
95 {
96  forAll(fieldList, fieldi)
97  {
98  if (fieldList.set(fieldi))
99  {
100  fieldToType.insert
101  (
102  fieldList[fieldi].name(),
103  patchFieldType(fieldList[fieldi].boundaryField()[patchi])
104  );
105  }
106  }
107 }
108 
109 
110 // ************************************************************************* //
void addToFieldList(PtrList< GeoField > &fieldList, const IOobject &obj, const label fieldi, const typename GeoField::Mesh &mesh)
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:434
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:59
static const char tab
Definition: Ostream.H:259
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:251
void collectFieldList(const PtrList< GeoField > &fieldList, const label patchi, HashTable< word > &fieldToType)
A class for handling words, derived from string.
Definition: word.H:59
Istream and Ostream manipulators taking arguments.
static const char nl
Definition: Ostream.H:260
word name(const complex &)
Return a string representation of a complex.
Definition: complex.C:47
messageStream Info
word patchFieldType(const PatchField &pf)
void outputFieldList(const PtrList< GeoField > &fieldList, const label patchi)