foamVtkBase64Layer.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) 2017 OpenCFD Ltd.
9-------------------------------------------------------------------------------
10License
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
26Class
27 Foam::vtk::foamVtkBase64Layer
28
29Description
30 Base-64 encoded output layer - normally only used indirectly by formatters.
31
32\*---------------------------------------------------------------------------*/
33
34#ifndef Foam_vtk_base64Layer_H
35#define Foam_vtk_base64Layer_H
36
37#include "foamVtkFormatter.H"
38#include "base64Layer.H"
39
40// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
41
42namespace Foam
43{
44namespace vtk
45{
46
47/*---------------------------------------------------------------------------*\
48 Class vtk::foamVtkBase64Layer Declaration
49\*---------------------------------------------------------------------------*/
52:
53 public vtk::formatter,
54 protected Foam::base64Layer
55{
56 // Private Data Members
57
58 static const char* encoding_;
59
60
61protected:
62
63 // Protected Member Functions
64
65 //- Write
66 void write(const char* s, std::streamsize n);
67
68 //- No copy construct
70
71 //- No copy assignment
72 void operator=(const foamVtkBase64Layer&) = delete;
73
74
75 // Constructors
76
77 //- Construct and attach to an output stream
78 explicit foamVtkBase64Layer(std::ostream& os);
79
80public:
81
82 //- Destructor. Closes/flushes the underlying layer
83 virtual ~foamVtkBase64Layer();
84
85
86 // Member Functions
87
88 //- Name for the XML append encoding ("base64").
89 virtual const char* encoding() const;
90
91 //- Write leading size for binary output
92 // \return True - format uses this information
93 virtual bool writeSize(const uint64_t numbytes);
94
95 virtual void write(const uint8_t val);
96 virtual void write(const label val);
97 virtual void write(const float val);
98 virtual void write(const double val);
99
100 //- End the encoding sequence (padding the final characters with '=')
101 virtual void flush();
102
103 //- The encoded length for base64 encoded output.
104 virtual std::size_t encodedLength(std::size_t n) const;
105};
106
107
108// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
109
110} // End namespace vtk
111} // End namespace Foam
112
113// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
114
115#endif
116
117// ************************************************************************* //
label n
An output filter layer to write base-64 encoded content.
Definition: base64Layer.H:56
Base-64 encoded output layer - normally only used indirectly by formatters.
virtual bool writeSize(const uint64_t numbytes)
Write leading size for binary output.
void operator=(const foamVtkBase64Layer &)=delete
No copy assignment.
foamVtkBase64Layer(const foamVtkBase64Layer &)=delete
No copy construct.
virtual ~foamVtkBase64Layer()
Destructor. Closes/flushes the underlying layer.
virtual void flush()
End the encoding sequence (padding the final characters with '=')
virtual std::size_t encodedLength(std::size_t n) const
The encoded length for base64 encoded output.
virtual const char * encoding() const
Name for the XML append encoding ("base64").
Abstract class for a VTK output stream formatter.
std::ostream & os() noexcept
Access to the underlying output stream.
gmvFile<< "tracers "<< particles.size()<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().x()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().y()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){ word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
Namespace for OpenFOAM.
runTime write()