Loading...
Searching...
No Matches
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
32SourceFiles
33 foamVtkBase64Layer.cxx
34
35\*---------------------------------------------------------------------------*/
36
37#ifndef Foam_vtk_base64Layer_H
38#define Foam_vtk_base64Layer_H
39
40#include "foamVtkFormatter.H"
41#include "base64Layer.H"
42
43// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
44
45namespace Foam
46{
47namespace vtk
48{
50/*---------------------------------------------------------------------------*\
51 Class vtk::foamVtkBase64Layer Declaration
52\*---------------------------------------------------------------------------*/
53
55:
56 public vtk::formatter,
57 protected Foam::base64Layer
58{
59 // Private Data Members
60
61 static const char* encoding_;
62
63
64protected:
65
66 // Protected Member Functions
67
68 //- Write
69 void write(const char* s, std::streamsize n);
70
71 //- No copy construct
73
74 //- No copy assignment
75 void operator=(const foamVtkBase64Layer&) = delete;
77
78 // Constructors
79
80 //- Construct and attach to an output stream
81 explicit foamVtkBase64Layer(std::ostream& os);
82
83public:
85 //- Destructor. Closes/flushes the underlying layer
86 virtual ~foamVtkBase64Layer();
87
88
89 // Member Functions
90
91 //- Name for the XML append encoding ("base64").
92 virtual const char* encoding() const;
93
94 //- Write leading size for binary output
95 // \return True - format uses this information
96 virtual bool writeSize(const uint64_t numbytes);
97
98 virtual void write(const uint8_t val);
99 virtual void write(const label val);
100 virtual void write(const float val);
101 virtual void write(const double val);
102
103 //- End the encoding sequence (padding the final characters with '=')
104 virtual void flush();
105
106 //- The encoded length for base64 encoded output.
107 virtual std::size_t encodedLength(std::size_t n) const;
111// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
112
113} // End namespace vtk
114} // End namespace Foam
115
116// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
117
118#endif
119
120// ************************************************************************* //
label n
An output filter layer to write base-64 encoded content.
Definition base64Layer.H:52
foamVtkBase64Layer(std::ostream &os)
Construct and attach to an output stream.
virtual void write(const double val)
virtual void write(const uint8_t val)
virtual ~foamVtkBase64Layer()
Destructor. Closes/flushes the underlying layer.
virtual std::size_t encodedLength(std::size_t n) const
The encoded length for base64 encoded output.
void operator=(const foamVtkBase64Layer &)=delete
No copy assignment.
virtual void write(const label val)
virtual const char * encoding() const
Name for the XML append encoding ("base64").
virtual bool writeSize(const uint64_t numbytes)
Write leading size for binary output.
virtual void write(const float val)
foamVtkBase64Layer(const foamVtkBase64Layer &)=delete
No copy construct.
virtual void flush()
End the encoding sequence (padding the final characters with '=').
void write(const char *s, std::streamsize n)
Write.
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 handling VTK output. Contains classes and functions for writing VTK file content.
Namespace for OpenFOAM.
runTime write()