foamVtkOutputOptions.C
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) 2016-2017 OpenCFD Ltd.
9 -------------------------------------------------------------------------------
10 License
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 
26 \*---------------------------------------------------------------------------*/
27 
28 #include "foamVtkOutputOptions.H"
29 
30 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
31 
34 {
35  if (on)
36  {
37  switch (fmtType_)
38  {
40  fmtType_ = formatType::INLINE_ASCII;
41  break;
42 
44  fmtType_ = formatType::APPEND_BASE64;
45  break;
46 
48  fmtType_ = formatType::LEGACY_ASCII;
49  break;
50 
51  default: // No change
52  break;
53  }
54  }
55  else
56  {
57  switch (fmtType_)
58  {
60  fmtType_ = formatType::INLINE_BASE64;
61  break;
62 
64  fmtType_ = formatType::APPEND_BINARY;
65  break;
66 
68  fmtType_ = formatType::LEGACY_BINARY;
69  break;
70 
71  default: // No change
72  break;
73  }
74  }
75 
76  return *this;
77 }
78 
79 
82 {
83  if (on)
84  {
85  switch (fmtType_)
86  {
89  fmtType_ = formatType::APPEND_BASE64;
90  break;
91 
94  fmtType_ = formatType::APPEND_BINARY;
95  break;
96 
97  default: // No change
98  break;
99  }
100  }
101  else
102  {
103  switch (fmtType_)
104  {
106  fmtType_ = formatType::INLINE_ASCII;
107  break;
108 
110  fmtType_ = formatType::INLINE_BASE64;
111  break;
112 
113  default: // No change
114  break;
115  }
116  }
117 
118  return *this;
119 }
120 
121 
124 {
125  if (on)
126  {
127  switch (fmtType_)
128  {
131  fmtType_ = formatType::LEGACY_ASCII;
132  break;
133 
136  fmtType_ = formatType::LEGACY_BINARY;
137  break;
138 
139  default: // no change
140  break;
141  }
142  }
143  else
144  {
145  switch (fmtType_)
146  {
148  fmtType_ = formatType::INLINE_ASCII;
149  break;
150 
152  fmtType_ = formatType::INLINE_BASE64;
153  break;
154 
155  default: // no change
156  break;
157  }
158  }
159 
160  return *this;
161 }
162 
163 
166 {
167  precision_ = prec;
168  return *this;
169 }
170 
171 
173 {
174  switch (fmtType_)
175  {
176  case formatType::INLINE_ASCII: return "xml ascii";
177  case formatType::INLINE_BASE64: return "xml base64";
178  case formatType::APPEND_BASE64: return "xml-append base64";
179  case formatType::APPEND_BINARY: return "xml-append binary";
180  case formatType::LEGACY_ASCII: return "legacy ascii";
181  case formatType::LEGACY_BINARY: return "legacy binary";
182  }
183 
184  return "";
185 }
186 
187 
188 // ************************************************************************* //
Foam::vtk::outputOptions
Encapsulated combinations of output format options. This is primarily useful when defining the output...
Definition: foamVtkOutputOptions.H:59
Foam::vtk::outputOptions::description
string description() const
A text description about the output option selected.
Definition: foamVtkOutputOptions.C:172
Foam::vtk::formatType::INLINE_ASCII
XML inline ASCII, asciiFormatter.
Foam::vtk::outputOptions::precision
unsigned precision() const
Return the ASCII write precision.
Definition: foamVtkOutputOptionsI.H:126
Foam::vtk::outputOptions::legacy
bool legacy() const
True if writer uses legacy file format.
Definition: foamVtkOutputOptionsI.H:88
Foam::string
A class for handling character strings derived from std::string.
Definition: string.H:73
Foam::vtk::formatType::LEGACY_ASCII
Legacy ASCII, legacyAsciiFormatter.
Foam::vtk::formatType::APPEND_BASE64
XML append base64, appendBase64Formatter.
Foam::vtk::outputOptions::ascii
bool ascii() const
True if output format is ASCII.
Definition: foamVtkOutputOptionsI.H:120
Foam::vtk::outputOptions::append
bool append() const
True if output format uses an append mode.
Definition: foamVtkOutputOptionsI.H:104
Foam::vtk::formatType::INLINE_BASE64
XML inline base64, base64Formatter.
foamVtkOutputOptions.H
Foam::vtk::formatType::LEGACY_BINARY
Legacy raw binary, legacyRawFormatter.
Foam::vtk::formatType::APPEND_BINARY
XML append raw binary, appendRawFormatter.