vtkTools.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 | Copyright (C) 2011-2014 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::vtkTools
26 
27 Description
28  Various functions for collecting and writing binary data.
29 
30 SourceFiles
31  vtkTools.C
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef vtkTools_H
36 #define vtkTools_H
37 
38 #include "floatScalar.H"
39 #include "DynamicList.H"
40 #include "volFieldsFwd.H"
41 #include "pointFieldsFwd.H"
42 #include "volPointInterpolation.H"
43 
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45 
46 namespace Foam
47 {
48 
49 /*---------------------------------------------------------------------------*\
50  Class vtkTools Declaration
51 \*---------------------------------------------------------------------------*/
52 
53 class vtkTools
54 {
55  // Private Member Functions
56 
57  // Swap halves of word.
58 
59  static void swapWord(label& word32);
60  static void swapWords(const label nWords, label* words32);
61 
62 
63 public:
64 
65  // Write ascii or binary. If binary optionally in-place swaps argument
66 
67  static void write(std::ostream&, const bool, List<floatScalar>&);
68  static void write(std::ostream&, const bool, DynamicList<floatScalar>&);
69  static void write(std::ostream&, const bool, labelList&);
70  static void write(std::ostream&, const bool, DynamicList<label>&);
71 
72 
73  // Write header
74 
75  static void writeHeader
76  (
77  std::ostream&,
78  const bool isBinary,
79  const std::string& title
80  );
81  static void writeCellDataHeader
82  (
83  std::ostream&,
84  const label nCells,
85  const label nFields
86  );
87  static void writePointDataHeader
88  (
89  std::ostream&,
90  const label nPoints,
91  const label nFields
92  );
93 
94 
95  // Convert to VTK and store
96 
97  static void insert(const scalar, DynamicList<floatScalar>&);
98  static void insert(const point&, DynamicList<floatScalar>&);
99  static void insert(const sphericalTensor&, DynamicList<floatScalar>&);
100  static void insert(const symmTensor&, DynamicList<floatScalar>&);
101  static void insert(const tensor&, DynamicList<floatScalar>&);
102 
103 
104  //- Append elements to DynamicList
105  static void insert(const labelList&, DynamicList<label>&);
106 
107  template<class Type>
108  static void insert(const List<Type>&, DynamicList<floatScalar>&);
109 };
110 
111 
112 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
113 
114 } // End namespace Foam
115 
116 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
117 
118 #ifdef NoRepository
119 # include "vtkToolsTemplates.C"
120 #endif
121 
122 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
123 
124 #endif
125 
126 // ************************************************************************* //
volFieldsFwd.H
Foam::Tensor
Templated 3D tensor derived from VectorSpace adding construction from 9 components,...
Definition: complexI.H:224
Foam::SymmTensor< scalar >
Foam::DynamicList
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
Definition: DynamicList.H:56
Foam::vtkTools
Various functions for collecting and writing binary data.
Definition: vtkTools.H:52
nPoints
label nPoints
Definition: gmvOutputHeader.H:2
Foam::vtkTools::swapWord
static void swapWord(label &word32)
Definition: vtkTools.C:55
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:59
Foam::vtkTools::writePointDataHeader
static void writePointDataHeader(std::ostream &, const label nPoints, const label nFields)
Definition: vtkTools.C:218
Foam::vtkTools::writeHeader
static void writeHeader(std::ostream &, const bool isBinary, const std::string &title)
Definition: vtkTools.C:185
Foam::vtkTools::writeCellDataHeader
static void writeCellDataHeader(std::ostream &, const label nCells, const label nFields)
Definition: vtkTools.C:206
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::SphericalTensor
Templated 3D SphericalTensor derived from VectorSpace adding construction from 1 component,...
Definition: SphericalTensor.H:51
volPointInterpolation.H
Foam::vtkTools::insert
static void insert(const scalar, DynamicList< floatScalar > &)
Definition: vtkTools.C:229
Foam::Vector< scalar >
Foam::List
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
pointFieldsFwd.H
floatScalar.H
vtkToolsTemplates.C
DynamicList.H
Foam::vtkTools::swapWords
static void swapWords(const label nWords, label *words32)
Definition: vtkTools.C:69
Foam::vtkTools::write
static void write(std::ostream &, const bool, List< floatScalar > &)
Definition: vtkTools.C:79