TimeI.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) 2020-2023 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 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
29 
30 inline Foam::Time::Time
31 (
32  const word& ctrlDictName,
33  const argList& args,
34  const bool enableFunctionObjects,
35  const bool enableLibs,
36  IOobjectOption::readOption rOpt // (default: READ_MODIFIED)
37 )
38 :
39  Foam::Time
40  (
41  ctrlDictName,
42  args,
43  "system",
44  "constant",
45  enableFunctionObjects,
46  enableLibs,
47  rOpt
48  )
49 {}
50 
51 
52 inline Foam::Time::Time
53 (
54  const word& ctrlDictName,
55  const fileName& rootPath,
56  const fileName& caseName,
57  const bool enableFunctionObjects,
58  const bool enableLibs,
59  IOobjectOption::readOption rOpt // (default: READ_MODIFIED)
60 )
61 :
62  Foam::Time
63  (
64  ctrlDictName,
65  rootPath,
66  caseName,
67  "system",
68  "constant",
69  enableFunctionObjects,
70  enableLibs,
71  rOpt
72 )
73 {}
74 
75 
76 inline Foam::Time::Time
77 (
78  const dictionary& dict,
79  const fileName& rootPath,
80  const fileName& caseName,
81  const bool enableFunctionObjects,
82  const bool enableLibs,
83  IOobjectOption::readOption rOpt // (default: READ_MODIFIED)
84 )
85 :
86  Foam::Time
87  (
88  dict,
89  rootPath,
90  caseName,
91  "system",
92  "constant",
93  enableFunctionObjects,
94  enableLibs,
95  rOpt
96  )
97 {}
98 
99 
100 inline Foam::Time::Time
101 (
102  const fileName& rootPath,
103  const fileName& caseName,
104  const bool enableFunctionObjects,
105  const bool enableLibs
106 )
107 :
108  Foam::Time
109  (
110  rootPath,
111  caseName,
112  "system",
113  "constant",
114  enableFunctionObjects,
115  enableLibs
116  )
117 {}
118 
119 
120 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
121 
124 {
125  return writeStreamOption_;
126 }
127 
128 
131 {
132  return writeStreamOption_.format();
133 }
134 
135 
138 {
139  auto old(writeStreamOption_.format(fmt));
140  if (writeStreamOption_.format() != IOstreamOption::ASCII)
141  {
142  // Disable output compression for non-ASCII
143  writeStreamOption_.compression(IOstreamOption::UNCOMPRESSED);
144  }
145  return old;
146 }
147 
148 
151 {
152  return writeStreamOption_.compression();
153 }
154 
155 
158 {
159  return writeStreamOption_.version();
160 }
161 
162 
163 // ************************************************************************* //
dictionary dict
A class for handling file names.
Definition: fileName.H:72
compressionType
Compression treatment (UNCOMPRESSED | COMPRESSED)
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
"ascii" (normal default)
IOstreamOption writeStreamOption() const noexcept
Get write stream option (format, compression, version)
Definition: TimeI.H:116
A simple container for options an IOstream can normally have.
Time(const word &ctrlDictName, const argList &args, const bool enableFunctionObjects=true, const bool enableLibs=true, IOobjectOption::readOption rOpt=IOobjectOption::READ_MODIFIED)
Construct from argument list, reading from specified control dictionary name.
Definition: TimeI.H:24
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:69
IOstreamOption::versionNumber writeVersion() const noexcept
Get the write stream version.
Definition: TimeI.H:150
A class for handling words, derived from Foam::string.
Definition: word.H:63
Extract command arguments and options from the supplied argc and argv parameters. ...
Definition: argList.H:118
Representation of a major/minor version number.
const direction noexcept
Definition: Scalar.H:258
IOstreamOption::compressionType writeCompression() const noexcept
Get the write stream compression.
Definition: TimeI.H:143
streamFormat
Data format (ascii | binary)
IOstreamOption::streamFormat writeFormat() const noexcept
Get write stream format.
Definition: TimeI.H:123
Foam::argList args(argc, argv)
Namespace for OpenFOAM.
readOption
Enumeration defining read preferences.