reportFields.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) 2018 OpenCFD Ltd.
9-------------------------------------------------------------------------------
10License
11 This file is part of OpenFOAM.
12
13 OpenFOAM is free software: you can redistribute it and/or modify it
14 under the terms of the GNU General Public License as published by
15 the Free Software Foundation, either version 3 of the License, or
16 (at your option) any later version.
17
18 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 for more details.
22
23 You should have received a copy of the GNU General Public License
24 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25
26Class
27 Foam::foamToVtkReportFields
28
29Description
30 Collection of simple static methods for reporting field names
31 by category, which is used by foamToVTK.
32
33\*---------------------------------------------------------------------------*/
34
35#ifndef foamToVtkReportFields_H
36#define foamToVtkReportFields_H
37
38#include "UPtrList.H"
39#include "Ostream.H"
40#include "areaFields.H"
41#include "volFields.H"
42#include "pointFields.H"
43#include "IOobjectList.H"
44
45// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46
47namespace Foam
48{
49
50/*---------------------------------------------------------------------------*\
51 Class foamToVtkReportFields Declaration
52\*---------------------------------------------------------------------------*/
55{
56 template<class GeoField>
57 static void print
58 (
59 const char* msg,
60 Ostream& os,
61 const UPtrList<const GeoField>& flds
62 )
63 {
64 if (flds.size())
65 {
66 os << msg;
67 for (const GeoField& fld : flds)
68 {
69 os << ' ' << fld.name();
70 }
71 os << endl;
72 }
73 }
74
76 static void print
77 (
78 const char* msg,
79 Ostream& os,
80 const wordList& fieldNames
81 )
82 {
83 if (fieldNames.size())
84 {
85 os << msg;
86 for (const word& fieldName : fieldNames)
87 {
88 os << ' ' << fieldName;
89 }
90 os << endl;
91 }
92 }
93
94
95 template<class FieldType>
96 static void print
97 (
98 const char* msg,
99 Ostream& os,
100 const IOobjectList& objects
101 )
102 {
103 print(msg, os, objects.sortedNames<FieldType>());
104 }
105
106
107 //- Supported volume field types
108 static void volume(Ostream& os, const IOobjectList& objects)
109 {
110 print<volScalarField>
111 (
112 " volScalar :", os, objects
113 );
114 print<volVectorField>
115 (
116 " volVector :", os, objects
117 );
118 print<volSphericalTensorField>
119 (
120 " volSphTensor :", os, objects
121 );
122 print<volSymmTensorField>
123 (
124 " volSymTensor :", os, objects
125 );
126 print<volTensorField>
127 (
128 " volTensor :", os, objects
129 );
130 }
131
132
133 //- Supported dimensioned field types
134 static void internal(Ostream& os, const IOobjectList& objects)
135 {
136 print<volScalarField::Internal>
137 (
138 " volScalar:Internal :", os, objects
139 );
140 print<volVectorField::Internal>
141 (
142 " volVector:Internal :", os, objects
143 );
144 print<volSphericalTensorField::Internal>
145 (
146 " volSphTensor:Internal :", os, objects
147 );
148 print<volSymmTensorField::Internal>
149 (
150 " volSymTensor:Internal :", os, objects
151 );
152 print<volTensorField::Internal>
153 (
154 " volTensor:Internal :", os, objects
155 );
156 }
157
158
159 //- Supported point field types
160 static void point(Ostream& os, const IOobjectList& objects)
161 {
162 }
163
164
165 //- Supported area field types
166 static void area(Ostream& os, const IOobjectList& objects)
167 {
168 print<areaScalarField>
169 (
170 " areaScalar :", os, objects
171 );
172 print<areaVectorField>
173 (
174 " areaVector :", os, objects
175 );
176 print<areaSphericalTensorField>
177 (
178 " areaSphTensor :", os, objects
179 );
180 print<areaSymmTensorField>
181 (
182 " areaSymTensor :", os, objects
183 );
184 print<areaTensorField>
185 (
186 " areaTensor :", os, objects
187 );
188 }
189
190};
191
192
193// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
194
195} // End namespace Foam
196
197// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
198
199#endif
200
201// ************************************************************************* //
Info<< nl<< "Wrote faMesh in vtk format: "<< writer.output().name()<< nl;}{ vtk::lineWriter writer(aMesh.points(), aMesh.edges(), fileName(aMesh.mesh().time().globalPath()/"finiteArea-edges"));writer.writeGeometry();writer.beginCellData(4);writer.writeProcIDs();{ Field< scalar > fld(faMeshTools::flattenEdgeField(aMesh.magLe(), true))
List of IOobjects with searching and retrieving facilities.
Definition: IOobjectList.H:59
wordList sortedNames() const
The sorted names of the IOobjects.
Definition: IOobjectList.C:383
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:62
void size(const label n)
Older name for setAddressableSize.
Definition: UList.H:114
A list of pointers to objects of type <T>, without allocation/deallocation management of the pointers...
Definition: UPtrList.H:71
label size() const noexcept
The number of elements in the list.
Definition: UPtrListI.H:106
A class for handling words, derived from Foam::string.
Definition: word.H:68
OBJstream os(runTime.globalPath()/outputName)
Namespace for OpenFOAM.
vector point
Point is a vector.
Definition: point.H:43
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:372
Collection of simple static methods for reporting field names by category, which is used by foamToVTK...
Definition: reportFields.H:54
static void point(Ostream &os, const IOobjectList &objects)
Supported point field types.
Definition: reportFields.H:159
static void area(Ostream &os, const IOobjectList &objects)
Supported area field types.
Definition: reportFields.H:165
static void internal(Ostream &os, const IOobjectList &objects)
Supported dimensioned field types.
Definition: reportFields.H:133
static void volume(Ostream &os, const IOobjectList &objects)
Supported volume field types.
Definition: reportFields.H:107
static void print(const char *msg, Ostream &os, const IOobjectList &objects)
Definition: reportFields.H:96
static void print(const char *msg, Ostream &os, const UPtrList< const GeoField > &flds)
Definition: reportFields.H:57
static void print(const char *msg, Ostream &os, const wordList &fieldNames)
Definition: reportFields.H:76