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 ensightMesh
31 
32 SourceFiles
33  writeDimFields.H
34 
35 \*---------------------------------------------------------------------------*/
36 
37 #ifndef writeDimFields_H
38 #define 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 ensightMesh& ensMesh,
52  const fvMeshSubsetProxy& proxy,
53  const IOobjectList& objects,
54  const bool nodeValues
55 )
56 {
58 
59  typedef typename
61  <
62  Type, fvPatchField, volMesh
63  >::Internal DimField;
64 
65 
66  label count = 0;
67 
68  for (const word& fieldName : objects.sortedNames<DimField>())
69  {
70  const IOobject* io = objects.findObject(fieldName);
71 
72  if
73  (
74  writeVolField<Type>
75  (
76  ensCase,
77  ensMesh,
78  proxy,
79  getZeroGradField<GeoField>(io, proxy),
80  nodeValues
81  )
82  )
83  {
84  Info<< ' ' << fieldName;
85  ++count;
86  }
87  }
88 
89  return count;
90 }
91 
92 
94 (
95  ensightCase& ensCase,
96  const ensightMesh& ensMesh,
97  const fvMeshSubsetProxy& proxy,
98  const IOobjectList& objects,
99  const bool nodeValues
100 )
101 {
102  #undef foamToEnsight_WRITE_FIELD
103  #define foamToEnsight_WRITE_FIELD(PrimitiveType) \
104  writeDimFields<PrimitiveType> \
105  ( \
106  ensCase, ensMesh, \
107  proxy, \
108  objects, \
109  nodeValues \
110  )
111 
112  label count = 0;
113  count += foamToEnsight_WRITE_FIELD(scalar);
118 
119  #undef foamToEnsight_WRITE_FIELD
120  return count;
121 }
122 
123 } // End namespace Foam
124 
125 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
126 
127 #endif
128 
129 // ************************************************************************* //
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::Tensor< scalar >
Foam::IOobject
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition: IOobject.H:104
Foam::ensightMesh
Encapsulation of volume meshes for writing in ensight format.
Definition: ensightMesh.H:68
Foam::SymmTensor< scalar >
foamToEnsight_WRITE_FIELD
#define foamToEnsight_WRITE_FIELD(PrimitiveType)
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:62
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)
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::fvMeshSubsetProxy
Simple proxy for holding a mesh, or mesh-subset. The subMeshes are currently limited to cellSet or ce...
Definition: fvMeshSubsetProxy.H:58
Foam::ensightCase
Supports writing of ensight cases as well as providing common factory methods to open new files.
Definition: ensightCase.H:63
writeVolFields.H
Read volume fields from disk and write with ensightMesh.
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 >