tecplotWriter.H
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-2020 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 Class
25  Foam::tecplotWriter
26 
27 Description
28  Write binary tecplot files using tecio.
29 
30 SourceFiles
31  tecplotWriter.C
32  tecplotWriterTemplates.C
33 
34 \*---------------------------------------------------------------------------*/
35 
36 #ifndef tecplotWriter_H
37 #define tecplotWriter_H
38 
39 #include "TECIO.h"
40 #include "Time.H"
41 #include "indirectPrimitivePatch.H"
42 #include "volFields.H"
43 #include "surfaceFields.H"
44 
45 using namespace Foam;
46 
47 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
48 
49 namespace Foam
50 {
51 
52 class fvMesh;
53 
54 /*---------------------------------------------------------------------------*\
55  Class tecplotWriter Declaration
56 \*---------------------------------------------------------------------------*/
57 
58 class tecplotWriter
59 {
60  const Time& runTime_;
61 
62 public:
63 
64  // Constructors
65 
66  //- Construct from components
67  tecplotWriter(const Time&);
68 
69 
70  // Member Functions
71 
72  void writeInit
73  (
74  const word& name,
75  const string& varNames,
76  const fileName&,
77  INTEGER4 tecplotFileType
78  ) const;
79 
80  //- Write mesh as polyhedral zone
82  (
83  const word& zoneName,
84  const INTEGER4 strandID,
85  const fvMesh& mesh,
86  const List<INTEGER4>& varLocArray,
87  INTEGER4 nFaceNodes
88  ) const;
89 
90  //- Write surface as polygonal zone
92  (
93  const word& zoneName,
94  const INTEGER4 strandID,
95  const indirectPrimitivePatch& pp,
96  const List<INTEGER4>& varLocArray
97  ) const;
98 
99  //- Write unordered data (or rather 1D ordered)
100  void writeOrderedZone
101  (
102  const word& zoneName,
103  INTEGER4 strandID,
104  const label n,
105  const List<INTEGER4>& varLocArray
106  ) const;
107 
108  //- Write mesh
109  void writeConnectivity(const fvMesh& mesh) const;
110 
111  //- Write surface
112  void writeConnectivity(const indirectPrimitivePatch& pp) const;
113 
114  void writeEnd() const;
115 
116  //- Write generic Field
117  template<class Type>
118  void writeField(const Field<Type>& fld) const;
119 
120 
121  //- Get either fvPatchField or patchInternalField
122  template<class Type>
124  (
125  const bool nearCellValue,
127  const label patchi
128  ) const;
129 
130  //- Get mixed field: fvsPatchField for boundary faces and
131  // internalField for internal faces.
132  template<class Type>
134  (
136  const labelList& faceLabels
137  ) const;
138 
139  template<class GeoField>
140  static wordList getNames(const PtrList<GeoField>&);
141 
142  template<class Type>
143  static void getTecplotNames
144  (
145  const wordList& names,
146  const INTEGER4 loc,
147  string& varNames,
148  DynamicList<INTEGER4>& varLocation
149  );
150 
151  template<class GeoField>
152  static void getTecplotNames
153  (
154  const PtrList<GeoField>& flds,
155  const INTEGER4 loc,
156  string& varNames,
157  DynamicList<INTEGER4>& varLocation
158  );
159 
160 };
161 
162 
163 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
164 
165 } // End namespace Foam
166 
167 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
168 
169 #ifdef NoRepository
170  #include "tecplotWriterTemplates.C"
171 #endif
172 
173 
174 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
175 
176 #endif
177 
178 // ************************************************************************* //
Foam::surfaceFields.
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
A class for handling file names.
Definition: fileName.H:79
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: HashTable.H:59
Generic GeometricField class.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:68
static wordList getNames(const PtrList< GeoField > &)
void writeConnectivity(const fvMesh &mesh) const
Write mesh.
static void getTecplotNames(const wordList &names, const INTEGER4 loc, string &varNames, DynamicList< INTEGER4 > &varLocation)
A list of faces which address into the list of points.
void writeField(const Field< Type > &fld) const
Write generic Field.
dynamicFvMesh & mesh
gmvFile<< "tracers "<< particles.size()<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().x()<< ' ';}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().y()<< ' ';}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().z()<< ' ';}gmvFile<< nl;forAll(lagrangianScalarNames, i){ const word &name=lagrangianScalarNames[i];IOField< scalar > fld(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects...
Definition: DynamicList.H:56
Pre-declare SubField and related Field type.
Definition: Field.H:56
A class for handling words, derived from string.
Definition: word.H:59
tmp< Field< Type > > getFaceField(const GeometricField< Type, fvsPatchField, surfaceMesh > &, const labelList &faceLabels) const
Get mixed field: fvsPatchField for boundary faces and.
void writePolyhedralZone(const word &zoneName, const INTEGER4 strandID, const fvMesh &mesh, const List< INTEGER4 > &varLocArray, INTEGER4 nFaceNodes) const
Write mesh as polyhedral zone.
Write binary tecplot files using tecio.
Definition: tecplotWriter.H:57
void writeEnd() const
word name(const complex &)
Return a string representation of a complex.
Definition: complex.C:47
tmp< Field< Type > > getPatchField(const bool nearCellValue, const GeometricField< Type, fvPatchField, volMesh > &vfld, const label patchi) const
Get either fvPatchField or patchInternalField.
void writeInit(const word &name, const string &varNames, const fileName &, INTEGER4 tecplotFileType) const
void writePolygonalZone(const word &zoneName, const INTEGER4 strandID, const indirectPrimitivePatch &pp, const List< INTEGER4 > &varLocArray) const
Write surface as polygonal zone.
label patchi
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
Definition: List.H:70
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
void writeOrderedZone(const word &zoneName, INTEGER4 strandID, const label n, const List< INTEGER4 > &varLocArray) const
Write unordered data (or rather 1D ordered)
label n
A class for managing temporary objects.
Definition: PtrList.H:53
tecplotWriter(const Time &)
Construct from components.
Namespace for OpenFOAM.