IOobject.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) 2011-2017 OpenFOAM Foundation
9  Copyright (C) 2016-2021 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 Class
28  Foam::IOobject
29 
30 Description
31  Defines the attributes of an object for which implicit
32  objectRegistry management is supported, and provides the infrastructure
33  for performing stream I/O.
34 
35  An IOobject is constructed with an object name, a class name, an instance
36  path, a reference to a objectRegistry, and parameters determining its
37  storage status.
38 
39  \par Read options
40 
41  Define what is done on object construction and explicit reads:
42  - \par MUST_READ
43  Object must be read from Istream on construction. \n
44  Error if Istream does not exist or can't be read.
45  Does not check timestamp or re-read.
46  - \par MUST_READ_IF_MODIFIED
47  Object must be read from Istream on construction. \n
48  Error if Istream does not exist or can't be read. If object is
49  registered its timestamp will be checked every timestep and possibly
50  re-read.
51  - \par READ_IF_PRESENT
52  Read object from Istream if Istream exists, otherwise don't. \n
53  Error only if Istream exists but can't be read.
54  Does not check timestamp or re-read.
55  - \par NO_READ
56  Don't read
57 
58  \par Write options
59 
60  Define what is done on object destruction and explicit writes:
61  - \par AUTO_WRITE
62  Object is written automatically when requested to by the
63  objectRegistry.
64  - \par NO_WRITE
65  No automatic write on destruction but can be written explicitly
66 
67  When serializing, the IOobject characteristics are typically written
68  as a \c FoamFile header, which is a sub-dictionary with the following
69  type of content:
70 
71  \table
72  Property | Description | Type | Reqd | Deflt
73  version | The base format version | float | no | 2.0
74  format | The stream format (ascii/binary) | word | yes |
75  arch | The architecture string | string | no |
76  note | Descriptive note about the object | string | no |
77  location | The relative location of the object | string | no |
78  class | The type of the object | word | yes |
79  object | The name of the object | word | yes |
80  \endtable
81 
82 Note
83  Specifying registered does not result in the IOobject itself being
84  registered. It is only serves as guidance for a regIOobject using it.
85 
86 See also
87  Foam::objectRegistry
88  Foam::regIOobject
89 
90 SourceFiles
91  IOobject.C
92  IOobjectReadHeader.C
93  IOobjectWriteHeader.C
94  IOobjectPrint.C
95 
96 \*---------------------------------------------------------------------------*/
97 
98 #ifndef IOobject_H
99 #define IOobject_H
100 
101 #include "fileName.H"
102 #include "typeInfo.H"
103 #include "autoPtr.H"
104 #include "IOstreamOption.H"
105 #include "InfoProxy.H"
106 #include "Enum.H"
107 
108 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
109 
110 namespace Foam
111 {
112 
113 // Forward Declarations
114 class Time;
115 class dictionary;
116 class objectRegistry;
117 
118 /*---------------------------------------------------------------------------*\
119  Class IOobject Declaration
120 \*---------------------------------------------------------------------------*/
121 
122 class IOobject
123 {
124 public:
125 
126  // Public Data Types
127 
128  //- Enumeration defining the valid states of an IOobject
129  enum objectState : char
130  {
131  GOOD,
132  BAD
133  };
134 
135  //- Enumeration defining the read options
136  enum readOption : char
137  {
138  MUST_READ,
141  NO_READ
142  };
143 
144  //- Enumeration defining the write options
145  enum writeOption : char
146  {
147  AUTO_WRITE = 0,
148  NO_WRITE = 1
149  };
150 
151  //- Enumeration defining the file checking options
152  enum fileCheckTypes : char
153  {
154  timeStamp,
156  inotify,
158  };
159 
160  //- Names for the fileCheckTypes
161  static const Enum<fileCheckTypes> fileCheckTypesNames;
162 
163 
164 private:
165 
166  // Static Data Members
167 
168  //- Use an output file banner, enabled by default
169  static bool bannerEnabled_;
170 
171 
172  // Private Data
173 
174  //- Name
175  word name_;
176 
177  //- Class name read from header
178  word headerClassName_;
179 
180  //- Optional note
181  string note_;
182 
183  //- Instance path component
184  fileName instance_;
185 
186  //- Local path component
187  fileName local_;
188 
189  //- Read option
190  readOption rOpt_;
191 
192  //- Write option
193  writeOption wOpt_;
194 
195  //- Should object created with this IOobject be registered?
196  bool registerObject_;
197 
198  //- Is object same for all processors?
199  bool globalObject_;
200 
201  //- IOobject state
202  objectState objState_;
203 
204  //- The sizeof (label) in bytes, possibly read from the header
205  unsigned char sizeofLabel_;
206 
207  //- The sizeof (scalar) in bytes, possibly read from the header
208  unsigned char sizeofScalar_;
209 
210  //- Reference to the objectRegistry
211  const objectRegistry& db_;
212 
213 
214 protected:
215 
216  // Protected Member Functions
217 
218  //- Helper: write content for FoamFile IOobject header
219  //- with optional meta information.
220  static void writeHeaderContent
221  (
222  Ostream& os,
223  const IOobject& io,
224  const word& objectType,
225  const dictionary* metaDataDict = nullptr
226  );
227 
228  //- Helper: write dictionary content for FoamFile header
229  //- with optional meta information.
230  static void writeHeaderContent
231  (
232  dictionary& dict,
233  const IOobject& io,
234  const word& objectType,
235  IOstreamOption streamOpt,
236  const dictionary* metaDataDict = nullptr
237  );
238 
239  //- Set the object state to bad
240  void setBad(const string& s);
241 
242 
243 public:
244 
245  //- Declare type-name, virtual type (with debug switch)
246  TypeName("IOobject");
247 
248 
249  // Static Data
250 
251  //- Character for scoping object names (':' or '_')
252  // Change with caution.
253  static char scopeSeparator;
254 
255  //- Type of file modification checking
257 
258  //- Time skew (seconds) for file modification checks
259  static float fileModificationSkew;
260 
261  //- Max number of times to poll for file modification changes
262  static int maxFileModificationPolls;
263 
264 
265  // Static Functions
266 
267  //- Status of output file banner
268  static bool bannerEnabled() noexcept
269  {
270  return bannerEnabled_;
271  }
272 
273  //- Enable/disable an output file banner
274  // \return the previous value
275  static bool bannerEnabled(bool on) noexcept
276  {
277  bool old(bannerEnabled_);
278  bannerEnabled_ = on;
279  return old;
280  }
281 
282  //- Split path into instance, local, name components
283  //
284  // The splitting behaviour is as follows:
285  // \verbatim
286  // input | instance | local | name
287  // ----------- | ---------- | ----- | ----
288  // a | | | a
289  // a/b | a | | b
290  // a/b/c/d | a | b/c | d
291  // /a/b/c | /a/b | | c
292  // ./a/b/c | PWD/a/b | | c
293  // ../a/b/c | PWD/../a/b | | c
294  // a/b/ | ERROR | |
295  // \endverbatim
296  // where PWD is the Foam::cwd() current working directory
297  static bool fileNameComponents
298  (
299  const fileName& path,
301  fileName& local,
302  word& name
303  );
304 
305  //- Create dot-delimited name.group string
306  // An empty group is ignored.
307  template<class StringType>
308  static inline word groupName(StringType base, const word& group);
309 
310  //- Return group (extension part of name)
311  static word group(const word& name);
312 
313  //- Return member (name without the extension)
314  static word member(const word& name);
315 
316  //- Create scope:name or scope_name string
317  // An empty scope is ignored.
318  static inline word scopedName
319  (
320  const std::string& scope,
321  const word& name
322  );
323 
324  //- Return the IOobject, but also consider an alternative file name.
325  //
326  // \param io The expected IOobject to use
327  // \param altFile Alternative fileName (ignored if empty).
328  // \param ioName The alternative name for the IOobject when
329  // the altFile resolves to a directory.
330  //
331  // \note If the alternative fileName is a non-empty string,
332  // it defines the location but uses all other properties of the
333  // expected IOobject.
334  // The location may be an absolute or a relative path.
335  // If it corresponds to a directory, the name of the
336  // expected IOobject will be used in its resolution.
337  // This expected name can provided via the ioName parameter.
338  static IOobject selectIO
339  (
340  const IOobject& io,
341  const fileName& altFile,
342  const word& ioName = ""
343  );
344 
345 
346  // Generated Methods
347 
348  //- Copy construct
349  IOobject(const IOobject&) = default;
350 
351  //- Destructor
352  virtual ~IOobject() = default;
353 
354 
355  // Constructors
356 
357  //- Construct from name, instance, registry, io options
358  IOobject
359  (
360  const word& name,
361  const fileName& instance,
362  const objectRegistry& registry,
365  bool registerObject = true,
366  bool globalObject = false
367  );
368 
369  //- Construct from name, instance, local, registry, io options
370  IOobject
371  (
372  const word& name,
373  const fileName& instance,
374  const fileName& local,
375  const objectRegistry& registry,
378  bool registerObject = true,
379  bool globalObject = false
380  );
381 
382  //- Construct from path, registry, io options.
383  // Uses fileNameComponents() to split path into components.
384  // A path that starts with a '/' is regarded as a file system path.
385  // Paths starting with either './' or '../' are relative to
386  // current working directory (and replaced with absolute equivalents).
387  // All other paths are considered to be relative to the case.
388  IOobject
389  (
390  const fileName& path,
391  const objectRegistry& registry,
394  bool registerObject = true,
395  bool globalObject = false
396  );
397 
398  //- Copy construct, resetting registry
399  IOobject
400  (
401  const IOobject& io,
402  const objectRegistry& registry
403  );
404 
405  //- Copy construct, resetting name
406  IOobject
407  (
408  const IOobject& io,
409  const word& name
410  );
411 
412  //- Copy construct, resetting io options
413  IOobject
414  (
415  const IOobject& io,
416  readOption,
418  );
419 
420  //- Clone
421  autoPtr<IOobject> clone() const
422  {
423  return autoPtr<IOobject>::New(*this);
424  }
425 
426  //- Clone resetting registry
427  autoPtr<IOobject> clone(const objectRegistry& registry) const
428  {
429  return autoPtr<IOobject>::New(*this, registry);
430  }
431 
432 
433  // Member Functions
434 
435  // General Access
436 
437  //- Return the local objectRegistry
438  const objectRegistry& db() const noexcept;
439 
440  //- Return Time associated with the objectRegistry
441  const Time& time() const;
442 
443  //- Return name
444  inline const word& name() const noexcept;
445 
446  //- Return name of the class name read from header
447  inline const word& headerClassName() const noexcept;
448 
449  //- Return non-constant access to the class name read from header
450  inline word& headerClassName() noexcept;
451 
452  //- Return the optional note
453  inline const string& note() const noexcept;
454 
455  //- Return non-constant access to the optional note
456  inline string& note() noexcept;
457 
458  //- Rename
459  virtual void rename(const word& newName)
460  {
461  name_ = newName;
462  }
463 
464  //- Should object created with this IOobject be registered?
465  inline bool registerObject() const noexcept;
466 
467  //- Change registration preference, return previous value
468  inline bool registerObject(bool on) noexcept;
469 
470  //- Is object same for all processors?
471  inline bool globalObject() const noexcept;
472 
473  //- Change global-object status, return previous value
474  inline bool globalObject(bool on) noexcept;
475 
476  //- The sizeof (label) in bytes, possibly read from the header
477  inline unsigned labelByteSize() const noexcept;
478 
479  //- The sizeof (scalar) in bytes, possibly read from the header
480  inline unsigned scalarByteSize() const noexcept;
481 
482 
483  // Checks
484 
485  //- Test if headerClassName() equals the given class name
486  inline bool isHeaderClassName(const word& clsName) const;
487 
488  //- Test if headerClassName() equals Type::typeName
489  template<class Type>
490  inline bool isHeaderClassName() const;
491 
492 
493  // Meta-data
494 
495  //- Return pointer to meta-data (if any) or nullptr
496  virtual const dictionary* findMetaData() const noexcept;
497 
498 
499  // Read/write options
500 
501  //- The read option
502  inline readOption readOpt() const noexcept;
503 
504  //- Change the read option, return previous value
505  inline readOption readOpt(readOption opt) noexcept;
506 
507  //- The write option
508  inline writeOption writeOpt() const noexcept;
509 
510  //- Change the write option, return previous value
511  inline writeOption writeOpt(writeOption opt) noexcept;
512 
513 
514  // Path components
515 
516  //- Return group (extension part of name)
517  inline word group() const;
518 
519  //- Return member (name without the extension)
520  inline word member() const;
521 
522  const fileName& rootPath() const;
523 
524  const fileName& caseName() const;
525 
526  inline const fileName& instance() const noexcept;
527 
528  inline fileName& instance() noexcept;
529 
530  inline const fileName& local() const noexcept;
531 
532  //- The complete path
533  fileName path() const;
534 
535  //- The complete path with alternative instance and local
536  fileName path
537  (
538  const word& instance,
539  const fileName& local = fileName::null
540  ) const;
541 
542  //- The complete path + object name
543  inline fileName objectPath() const;
544 
545  //- The object path relative to the root
546  fileName objectRelPath() const;
547 
548  //- Helper for filePath that searches locally.
549  // When search is false, simply use the current instance,
550  // otherwise search previous instances.
552  (
553  const word& typeName,
554  const bool search=true
555  ) const;
556 
557  //- Helper for filePath that searches up if in parallel
558  // When search is false, simply use the current instance,
559  // otherwise search previous instances.
561  (
562  const word& typeName,
563  const bool search=true
564  ) const;
565 
566 
567  // Reading
568 
569  //- Parse 'FoamFile' header contents and set the IOobject
570  //- characteristics and return the stream characteristics.
571  IOstreamOption parseHeader(const dictionary& headerDict);
572 
573  //- Read header ('FoamFile' dictionary) and set the
574  //- IOobject and stream characteristics.
575  bool readHeader(Istream& is);
576 
577  //- Read header (the 'FoamFile' dictionary) and set the
578  //- IOobject and stream characteristics.
579  // Saves the header content in the given dictionary.
580  bool readHeader(dictionary& headerDict, Istream& is);
581 
582  //- Read header (uses typeFilePath to find file) and check its info.
583  // Optionally checks headerClassName against the type-name.
584  // When search is false, simply use the current instance,
585  // otherwise search previous instances.
586  template<class Type>
587  bool typeHeaderOk
588  (
589  const bool checkType = true,
590  const bool search = true,
591  const bool verbose = true
592  );
593 
594  //- Helper: warn that type does not support re-reading
595  template<class Type>
596  void warnNoRereading() const;
597 
598 
599  // Writing
600 
601  //- Write the standard OpenFOAM file/dictionary banner
602  // Optionally without editor syntax hint (eg, for logs)
603  static Ostream& writeBanner(Ostream& os, const bool noSyntaxHint=false);
604 
605  //- Write the standard file section divider
606  static Ostream& writeDivider(Ostream& os);
607 
608  //- Write the standard end file divider
609  static Ostream& writeEndDivider(Ostream& os);
610 
611  //- Write header with current type()
612  bool writeHeader(Ostream& os) const;
613 
614  //- Write header with override of type
615  bool writeHeader(Ostream& os, const word& objectType) const;
616 
617  //- Write header into a dictionary with current type()
618  //- and given output format
619  void writeHeader(dictionary& dict, IOstreamOption streamOpt) const;
620 
621  //- Write header into a dictionary with override of type
622  //- and given output format
623  void writeHeader
624  (
625  dictionary& dict,
626  const word& objectType,
627  IOstreamOption streamOpt
628  ) const;
629 
630 
631  // Error Handling
632 
633  inline bool good() const noexcept;
634 
635  inline bool bad() const noexcept;
636 
637 
638  // Info
639 
640  //- Return info proxy.
641  // Used to print token information to a stream
642  InfoProxy<IOobject> info() const
643  {
644  return *this;
645  }
646 
647 
648  // Member Operators
649 
650  void operator=(const IOobject& io);
651 
652 
653  // Housekeeping
654 
655  //- Access to the read option
656  // \deprecated(2021-03) - use readOpt(readOption)
657  readOption& readOpt() noexcept { return rOpt_; }
658 
659  //- Access to the write option
660  // \deprecated(2021-03) - use writeOpt(writeOption)
661  writeOption& writeOpt() noexcept { return wOpt_; }
662 
663  //- Access to the register object option
664  // \deprecated(2021-03) - use registerObject(bool)
665  bool& registerObject() noexcept { return registerObject_; }
666 
667  //- Access to the global object option
668  // \deprecated(2021-03) - use globalObject(bool)
669  bool& globalObject() noexcept { return globalObject_; }
670 };
671 
672 
673 //- Specialization for \c void always returns true (no headerClassName check).
674 template<>
675 inline bool IOobject::isHeaderClassName<void>() const
676 {
677  return true;
678 }
679 
680 
681 template<>
682 Ostream& operator<<(Ostream& os, const InfoProxy<IOobject>& ip);
683 
684 
685 //- Template function for obtaining global vs. local status
686 template<class T>
687 inline bool typeGlobal()
688 {
689  return false;
690 }
691 
692 
693 //- Template function for obtaining local or global filePath
694 template<class T>
695 inline fileName typeFilePath(const IOobject& io, const bool search = true)
696 {
697  return
698  (
699  typeGlobal<T>()
700  ? io.globalFilePath(T::typeName, search)
701  : io.localFilePath(T::typeName, search)
702  );
703 }
704 
705 
706 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
707 
708 } // End namespace Foam
709 
710 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
711 
712 #include "IOobjectI.H"
713 
714 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
715 
716 #ifdef NoRepository
717 # include "IOobjectTemplates.C"
718 #endif
719 
720 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
721 
722 #endif
723 
724 // ************************************************************************* //
Foam::IOobject::NO_WRITE
Definition: IOobject.H:195
Foam::autoPtr::New
static autoPtr< T > New(Args &&... args)
Construct autoPtr of T with forwarding arguments.
Foam::IOobject
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition: IOobject.H:169
Foam::IOobject::fileCheckTypes
fileCheckTypes
Enumeration defining the file checking options.
Definition: IOobject.H:199
Foam::Enum< fileCheckTypes >
Foam::IOobject::AUTO_WRITE
Definition: IOobject.H:194
Foam::Time
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:73
Foam::IOobject::localFilePath
fileName localFilePath(const word &typeName, const bool search=true) const
Helper for filePath that searches locally.
Definition: IOobject.C:569
Foam::IOobject::timeStamp
Definition: IOobject.H:201
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::IOobject::fileCheckTypesNames
static const Enum< fileCheckTypes > fileCheckTypesNames
Names for the fileCheckTypes.
Definition: IOobject.H:208
Foam::InfoProxy
A helper class for outputting values to Ostream.
Definition: InfoProxy.H:47
IOobjectTemplates.C
Foam::fileName
A class for handling file names.
Definition: fileName.H:73
Foam::IOobject::registerObject
bool registerObject() const noexcept
Should object created with this IOobject be registered?
Definition: IOobjectI.H:107
s
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))
Definition: gmvOutputSpray.H:25
typeInfo.H
Foam::IOobject::~IOobject
virtual ~IOobject()=default
Destructor.
Foam::IOobject::instance
const fileName & instance() const noexcept
Definition: IOobjectI.H:196
Foam::IOobject::labelByteSize
unsigned labelByteSize() const noexcept
The sizeof (label) in bytes, possibly read from the header.
Definition: IOobjectI.H:135
Foam::IOobject::writeHeaderContent
static void writeHeaderContent(Ostream &os, const IOobject &io, const word &objectType, const dictionary *metaDataDict=nullptr)
Definition: IOobjectWriteHeader.C:155
Foam::IOobject::typeHeaderOk
bool typeHeaderOk(const bool checkType=true, const bool search=true, const bool verbose=true)
Read header (uses typeFilePath to find file) and check its info.
Definition: IOobjectTemplates.C:39
InfoProxy.H
Foam::IOobject::writeEndDivider
static Ostream & writeEndDivider(Ostream &os)
Write the standard end file divider.
Definition: IOobjectWriteHeader.C:142
Foam::IOobject::rootPath
const fileName & rootPath() const
Definition: IOobject.C:499
Foam::IOobject::inotifyMaster
Definition: IOobject.H:204
Foam::IOobject::timeStampMaster
Definition: IOobject.H:202
Foam::IOobject::bannerEnabled
static bool bannerEnabled() noexcept
Status of output file banner.
Definition: IOobject.H:315
Foam::IOobject::isHeaderClassName
bool isHeaderClassName() const
Test if headerClassName() equals Type::typeName.
Definition: IOobjectI.H:156
Foam::IOobject::fileModificationChecking
static fileCheckTypes fileModificationChecking
Type of file modification checking.
Definition: IOobject.H:303
Foam::IOobject::scopeSeparator
static char scopeSeparator
Character for scoping object names (':' or '_')
Definition: IOobject.H:300
Foam::IOobject::IOobject
IOobject(const IOobject &)=default
Copy construct.
Foam::IOobject::headerClassName
const word & headerClassName() const noexcept
Return name of the class name read from header.
Definition: IOobjectI.H:83
Foam::IOobject::TypeName
TypeName("IOobject")
Declare type-name, virtual type (with debug switch)
Foam::IOobject::objectRelPath
fileName objectRelPath() const
The object path relative to the root.
Definition: IOobject.C:545
Foam::IOobject::writeOpt
writeOption writeOpt() const noexcept
The write option.
Definition: IOobjectI.H:179
Foam::IOobject::time
const Time & time() const
Return Time associated with the objectRegistry.
Definition: IOobject.C:493
Foam::IOobject::info
InfoProxy< IOobject > info() const
Return info proxy.
Definition: IOobject.H:689
Foam::IOobject::writeBanner
static Ostream & writeBanner(Ostream &os, const bool noSyntaxHint=false)
Write the standard OpenFOAM file/dictionary banner.
Definition: IOobjectWriteHeader.C:76
Foam::IOobject::inotify
Definition: IOobject.H:203
Foam::IOobject::objectState
objectState
Enumeration defining the valid states of an IOobject.
Definition: IOobject.H:176
Foam::IOobject::readHeader
bool readHeader(Istream &is)
Definition: IOobjectReadHeader.C:165
Foam::objectRegistry
Registry of regIOobjects.
Definition: objectRegistry.H:60
Foam::operator<<
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
Definition: boundaryPatch.C:83
Foam::IOobject::writeOption
writeOption
Enumeration defining the write options.
Definition: IOobject.H:192
Foam::IOobject::warnNoRereading
void warnNoRereading() const
Helper: warn that type does not support re-reading.
Definition: IOobjectTemplates.C:88
Foam::IOobject::clone
autoPtr< IOobject > clone(const objectRegistry &registry) const
Clone resetting registry.
Definition: IOobject.H:474
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:61
Foam::IOobject::local
const fileName & local() const noexcept
Definition: IOobjectI.H:208
IOstreamOption.H
Foam::IOobject::caseName
const fileName & caseName() const
Definition: IOobject.C:505
Foam::IOobject::READ_IF_PRESENT
Definition: IOobject.H:187
Foam::IOobject::globalObject
bool globalObject() const noexcept
Is object same for all processors?
Definition: IOobjectI.H:121
Foam::IOstreamOption
The IOstreamOption is a simple container for options an IOstream can normally have.
Definition: IOstreamOption.H:63
fileName.H
Foam::IOobject::clone
autoPtr< IOobject > clone() const
Clone.
Definition: IOobject.H:468
Foam::IOobject::selectIO
static IOobject selectIO(const IOobject &io, const fileName &altFile, const word &ioName="")
Return the IOobject, but also consider an alternative file name.
Definition: IOobject.C:238
Foam::IOobject::scalarByteSize
unsigned scalarByteSize() const noexcept
The sizeof (scalar) in bytes, possibly read from the header.
Definition: IOobjectI.H:141
Foam::IOobject::fileNameComponents
static bool fileNameComponents(const fileName &path, fileName &instance, fileName &local, word &name)
Split path into instance, local, name components.
Definition: IOobject.C:147
Foam::IOobject::fileModificationSkew
static float fileModificationSkew
Time skew (seconds) for file modification checks.
Definition: IOobject.H:306
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::IOobject::globalFilePath
fileName globalFilePath(const word &typeName, const bool search=true) const
Helper for filePath that searches up if in parallel.
Definition: IOobject.C:580
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
os
OBJstream os(runTime.globalPath()/outputName)
Foam::IOobject::BAD
Definition: IOobject.H:179
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::IOobject::rename
virtual void rename(const word &newName)
Rename.
Definition: IOobject.H:506
Foam::IOobject::readOpt
readOption readOpt() const noexcept
The read option.
Definition: IOobjectI.H:164
Foam::IOobject::operator=
void operator=(const IOobject &io)
Definition: IOobject.C:611
Foam::typeFilePath
fileName typeFilePath(const IOobject &io, const bool search=true)
Template function for obtaining local or global filePath.
Definition: IOobject.H:742
Foam::IOobject::findMetaData
virtual const dictionary * findMetaData() const noexcept
Return pointer to meta-data (if any) or nullptr.
Definition: IOobjectMetaData.C:33
Foam::IOobject::name
const word & name() const noexcept
Return name.
Definition: IOobjectI.H:65
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
Foam::IOobject::note
const string & note() const noexcept
Return the optional note.
Definition: IOobjectI.H:95
Foam::IOobject::GOOD
Definition: IOobject.H:178
Foam::IOobject::writeDivider
static Ostream & writeDivider(Ostream &os)
Write the standard file section divider.
Definition: IOobjectWriteHeader.C:132
IOobjectI.H
Foam::IOobject::member
word member() const
Return member (name without the extension)
Definition: IOobjectI.H:77
Foam::IOobject::parseHeader
IOstreamOption parseHeader(const dictionary &headerDict)
Definition: IOobjectReadHeader.C:35
Foam::search
fileName search(const word &file, const fileName &directory)
Recursively search the given directory for the file.
Definition: fileName.C:571
Foam::IOobject::group
word group() const
Return group (extension part of name)
Definition: IOobjectI.H:71
Foam::IOobject::MUST_READ_IF_MODIFIED
Definition: IOobject.H:186
Foam::IOobject::bad
bool bad() const noexcept
Definition: IOobjectI.H:228
Foam::typeGlobal
bool typeGlobal()
Template function for obtaining global vs. local status.
Definition: IOobject.H:734
Foam::IOobject::setBad
void setBad(const string &s)
Set the object state to bad.
Definition: IOobject.C:590
Foam::IOobject::good
bool good() const noexcept
Definition: IOobjectI.H:222
Foam::IOobject::writeHeader
bool writeHeader(Ostream &os) const
Write header with current type()
Definition: IOobjectWriteHeader.C:277
Foam::IOobject::readOption
readOption
Enumeration defining the read options.
Definition: IOobject.H:183
Foam::IOobject::groupName
static word groupName(StringType base, const word &group)
Create dot-delimited name.group string.
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::IOobject::scopedName
static word scopedName(const std::string &scope, const word &name)
Create scope:name or scope_name string.
Definition: IOobjectI.H:47
Foam::IOobject::objectPath
fileName objectPath() const
The complete path + object name.
Definition: IOobjectI.H:214
Foam::IOobject::NO_READ
Definition: IOobject.H:188
Foam::IOobject::path
fileName path() const
The complete path.
Definition: IOobject.C:511
Foam::IOobject::MUST_READ
Definition: IOobject.H:185
Foam::IOobject::db
const objectRegistry & db() const noexcept
Return the local objectRegistry.
Definition: IOobject.C:487
Foam::IOobject::maxFileModificationPolls
static int maxFileModificationPolls
Max number of times to poll for file modification changes.
Definition: IOobject.H:309
autoPtr.H
Enum.H