All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
vtkWriteOps.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-2023 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::vtkWriteOps
26 
27 Description
28  VTK ASCII and binary write functions
29 
30 SourceFiles
31  vtkWriteOps.C
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef vtkWriteOps_H
36 #define vtkWriteOps_H
37 
38 #include "floatScalar.H"
39 #include "point.H"
40 #include "tensor.H"
41 #include "labelList.H"
42 #include "DynamicList.H"
43 
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45 
46 namespace Foam
47 {
48 
49 /*---------------------------------------------------------------------------*\
50  Namespace vtkWriteOps Declaration
51 \*---------------------------------------------------------------------------*/
52 
53 namespace vtkWriteOps
54 {
55  //- Swap halves of word
56  void swapWord(label& word32);
57 
58  //- Swap halves of word
59  void swapWords(const label nWords, label* words32);
60 
61  //- Cast an integer to the corresponding VTK write type. Does nothing.
62  inline label cast(const label& x);
63 
64  //- Cast a float to the corresponding VTK write type. Does nothing.
65  inline floatScalar cast(const floatScalar& x);
66 
67  //- Cast a scalar to the corresponding VTK write type. Clips to
68  // pTraits<floatScalar>::max.
69  template<class Scalar>
70  inline floatScalar cast(const Scalar& x);
71 
72  //- Write header
73  void writeHeader
74  (
75  std::ostream&,
76  const bool isBinary,
77  const std::string& title
78  );
79 
80  //- Write cell data header
82  (
83  std::ostream&,
84  const label nCells,
85  const label nFields
86  );
87 
88  //- Write point data header
90  (
91  std::ostream&,
92  const label nPoints,
93  const label nFields
94  );
95 
96  //- Write floats ascii or binary.
97  // If binary optionally in-place swaps argument
98  void write(std::ostream& os, const bool binary, List<floatScalar>& fField);
99 
100  //- Write floats ascii or binary.
101  // If binary optionally in-place swaps argument
102  void write(std::ostream&, const bool, DynamicList<floatScalar>&);
103 
104  //- Write floats ascii or binary.
105  // If binary optionally in-place swaps argument
106  void write(std::ostream&, const bool, labelList&);
107 
108  //- Write floats ascii or binary.
109  // If binary optionally in-place swaps argument
110  void write(std::ostream&, const bool, DynamicList<label>&);
111 
112  //- Append scalar to given DynamicList
113  void insert(const scalar, DynamicList<floatScalar>&);
114 
115  //- Append point to given DynamicList
116  void insert(const point&, DynamicList<floatScalar>&);
117 
118  //- Append sphericalTensor to given DynamicList
120 
121  //- Append symmTensor to given DynamicList
123 
124  //- Append tensor to given DynamicList
125  void insert(const tensor&, DynamicList<floatScalar>&);
126 
127  //- Append elements to DynamicList
128  void insert(const labelList&, DynamicList<label>&);
129 
130  //- Append elements to DynamicList
131  template<class Type>
133 
134  //- Append elements of scalarList to given DynamicList using map
135  void insert
136  (
137  const labelList& map,
138  const List<scalar>& source,
140  );
141 
142  //- Append points to given DynamicList of floats
143  void insert(const List<point>& source, DynamicList<floatScalar>&);
144 
145  //- Append points to given DynamicList of floats using map
146  void insert
147  (
148  const labelList& map,
149  const List<point>& source,
151  );
152 
153 } // End namespace vtkWriteOps
154 
155 
156 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
157 
158 } // End namespace Foam
159 
160 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
161 
162 #include "vtkWriteOpsI.H"
163 
164 #ifdef NoRepository
165  #include "vtkWriteOpsTemplates.C"
166 #endif
167 
168 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
169 
170 #endif
171 
172 // ************************************************************************* //
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
Definition: DynamicList.H:78
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: List.H:91
Templated 3D SphericalTensor derived from VectorSpace adding construction from 1 component,...
VTK ASCII and binary write functions.
#define Scalar
Definition: doubleScalar.C:33
label nPoints
void writePointDataHeader(std::ostream &, const label nPoints, const label nFields)
Write point data header.
void writeCellDataHeader(std::ostream &, const label nCells, const label nFields)
Write cell data header.
void swapWord(label &word32)
Swap halves of word.
void swapWords(const label nWords, label *words32)
Swap halves of word.
void insert(const scalar, DynamicList< floatScalar > &)
Append scalar to given DynamicList.
void write(std::ostream &os, const bool binary, List< floatScalar > &fField)
Write floats ascii or binary.
void writeHeader(std::ostream &, const bool isBinary, const std::string &title)
Write header.
label cast(const label &x)
Cast an integer to the corresponding VTK write type. Does nothing.
Namespace for OpenFOAM.
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
float floatScalar
Float precision floating point scalar type.
Definition: floatScalar.H:52