writeDimFields.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 -------------------------------------------------------------------------------
10 License
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 
26 InNamespace
27  Foam
28 
29 Description
30  Read dimensioned fields from disk and write with ensightParts
31 
32 SourceFiles
33  writeDimFields.H
34 
35 \*---------------------------------------------------------------------------*/
36 
37 #ifndef ensightParts_writeDimFields_H
38 #define ensightParts_writeDimFields_H
39 
40 #include "writeVolFields.H"
41 
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
43 
44 namespace Foam
45 {
46 
47 template<class Type>
49 (
50  ensightCase& ensCase,
51  const ensightParts& ensParts,
52  const fvMesh& mesh,
53  const IOobjectList& objects
54 )
55 {
57 
58  typedef typename
60  <
61  Type, fvPatchField, volMesh
62  >::Internal DimField;
63 
64 
65  label count = 0;
66 
67  for (const word& fieldName : objects.sortedNames<DimField>())
68  {
69  const IOobject* io = objects.findObject(fieldName);
70 
71  if
72  (
73  writeVolField<Type>
74  (
75  ensCase,
76  ensParts,
77  mesh,
78  getZeroGradField<GeoField>(io, mesh)
79  )
80  )
81  {
82  Info<< ' ' << fieldName;
83  ++count;
84  }
85  }
86 
87  return count;
88 }
89 
90 
92 (
93  ensightCase& ensCase,
94  const ensightParts& ensParts,
95  const fvMesh& mesh,
96  const IOobjectList& objects
97 )
98 {
99  #undef foamToEnsight_WRITE_FIELD
100  #define foamToEnsight_WRITE_FIELD(PrimitiveType) \
101  writeDimFields<PrimitiveType> \
102  ( \
103  ensCase, ensParts, \
104  mesh, \
105  objects \
106  )
107 
108  label count = 0;
109  count += foamToEnsight_WRITE_FIELD(scalar);
114 
115  #undef foamToEnsight_WRITE_FIELD
116  return count;
117 }
118 
119 } // End namespace Foam
120 
121 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
122 
123 #endif
124 
125 // ************************************************************************* //
Foam::fvPatchField
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
Definition: volSurfaceMapping.H:50
Foam::ensightParts
A collection of several ensightPart elements.
Definition: ensightParts.H:54
Foam::Tensor< scalar >
Foam::IOobject
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition: IOobject.H:104
Foam::SymmTensor< scalar >
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:62
writeVolFields.H
Read volume fields from disk and write with ensightParts.
Foam::volMesh
Mesh data needed to do the Finite Volume discretisation.
Definition: volMesh.H:50
Foam::IOobjectList::findObject
const IOobject * findObject(const word &objName) const
Return const pointer to the object found by name.
Definition: IOobjectList.C:270
Foam::IOobjectList::sortedNames
wordList sortedNames() const
The sorted names of the IOobjects.
Definition: IOobjectList.C:345
Foam::writeAllDimFields
label writeAllDimFields(ensightCase &ensCase, const ensightMesh &ensMesh, const fvMeshSubsetProxy &proxy, const IOobjectList &objects, const bool nodeValues)
Definition: writeDimFields.H:94
Foam::label
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:62
Foam::Info
messageStream Info
Information stream (uses stdout - output is on the master only)
foamToEnsight_WRITE_FIELD
#define foamToEnsight_WRITE_FIELD(PrimitiveType)
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
Foam::fvMesh
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:84
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::SphericalTensor< scalar >
Foam::IOobjectList
List of IOobjects with searching and retrieving facilities.
Definition: IOobjectList.H:55
Foam::ensightCase
Supports writing of ensight cases as well as providing common factory methods to open new files.
Definition: ensightCase.H:63
Foam::BitOps::count
unsigned int count(const UList< bool > &bools, const bool val=true)
Count number of 'true' entries.
Definition: BitOps.H:74
Foam::Vector< scalar >
Foam::writeDimFields
label writeDimFields(ensightCase &ensCase, const ensightMesh &ensMesh, const fvMeshSubsetProxy &proxy, const IOobjectList &objects, const bool nodeValues)
Definition: writeDimFields.H:49
Foam::GeometricField< Type, fvPatchField, volMesh >