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-2022 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 NO_READ
43  Do not read
44  - \par MUST_READ
45  Object must be read from Istream on construction. \n
46  Error if Istream does not exist or cannot be read.
47  Does not check timestamp or re-read.
48  - \par MUST_READ_IF_MODIFIED
49  Object must be read from Istream on construction. \n
50  Error if Istream does not exist or cannot be read. If object is
51  registered its timestamp will be checked every timestep and possibly
52  re-read.
53  - \par READ_IF_PRESENT
54  Read object from Istream, but only if Istream exists. \n
55  Error only if Istream exists but cannot be read.
56  Does not check timestamp or re-read.
57 
58  \par Write options
59 
60  Define what is done on object destruction and explicit writes:
61  - \par NO_WRITE
62  No automatic writing, but can be written explicitly
63  - \par AUTO_WRITE
64  Object is written automatically when requested to by the
65  objectRegistry.
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 Foam_IOobject_H
99 #define Foam_IOobject_H
100 
101 #include "fileName.H"
102 #include "typeInfo.H"
103 #include "autoPtr.H"
104 #include "InfoProxy.H"
105 #include "Enum.H"
106 #include "IOobjectOption.H"
107 #include "IOstreamOption.H"
108 
109 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
110 
111 namespace Foam
112 {
113 
114 // Forward Declarations
115 class Time;
116 class dictionary;
117 class objectRegistry;
118 
119 /*---------------------------------------------------------------------------*\
120  Class IOobject Declaration
121 \*---------------------------------------------------------------------------*/
122 
123 class IOobject
124 :
125  public IOobjectOption
126 {
127 public:
128 
129  // Public Data Types
130 
131  //- Enumeration defining the valid states of an IOobject
132  enum objectState : char
133  {
134  GOOD,
135  BAD
136  };
137 
138  //- Enumeration defining the file checking options
139  enum fileCheckTypes : char
140  {
141  timeStamp,
143  inotify,
145  };
146 
147  //- Names for the fileCheckTypes
148  static const Enum<fileCheckTypes> fileCheckTypesNames;
149 
150 
151 private:
152 
153  // Static Data Members
154 
155  //- Use an output file banner, enabled by default
156  static bool bannerEnabled_;
157 
158 
159  // Private Data (NB: byte-flags first for better alignment)
160 
161  //- The IOobject state
162  objectState objState_;
163 
164  //- The sizeof (label) in bytes, possibly read from the header
165  unsigned char sizeofLabel_;
167  //- The sizeof (scalar) in bytes, possibly read from the header
168  unsigned char sizeofScalar_;
169 
170  //- Name
171  word name_;
172 
173  //- Class name read from header
174  word headerClassName_;
175 
176  //- Optional note
177  string note_;
178 
179  //- Instance path component
180  fileName instance_;
181 
182  //- Local path component
183  fileName local_;
184 
185  //- Reference to the objectRegistry
186  const objectRegistry& db_;
187 
189 protected:
191  // Protected Member Functions
192 
193  //- Helper: write content for FoamFile IOobject header
194  //- with optional meta information.
195  static void writeHeaderContent
196  (
198  const IOobject& io,
199  const word& objectType,
200  const dictionary* metaDataDict = nullptr
201  );
202 
203  //- Helper: write dictionary content for FoamFile header
204  //- with optional meta information.
205  static void writeHeaderContent
206  (
207  dictionary& dict,
208  const IOobject& io,
209  const word& objectType,
210  IOstreamOption streamOpt,
211  const dictionary* metaDataDict = nullptr
212  );
213 
214  //- Set the object state to bad
215  void setBad(const string& s);
216 
217 
218 public:
219 
220  //- Declare type-name, virtual type (with debug switch)
221  TypeName("IOobject");
222 
223 
224  // Static Data
225 
226  //- Character for scoping object names (':' or '_')
227  // Change with caution.
228  static char scopeSeparator;
229 
230  //- Type of file modification checking
232 
233  //- Time skew (seconds) for file modification checks
234  static float fileModificationSkew;
235 
236  //- Max number of times to poll for file modification changes
237  static int maxFileModificationPolls;
238 
239 
240  // Static Functions
241 
242  //- Status of output file banner
243  static bool bannerEnabled() noexcept
244  {
245  return bannerEnabled_;
246  }
247 
248  //- Enable/disable output file banner
249  // \return the previous value
250  static bool bannerEnabled(bool on) noexcept
251  {
252  bool old(bannerEnabled_);
253  bannerEnabled_ = on;
254  return old;
255  }
256 
257  //- Split path into instance, local, name components
258  //
259  // The splitting behaviour is as follows:
260  // \verbatim
261  // input | instance | local | name
262  // ----------- | ---------- | ----- | ----
263  // a | | | a
264  // a/b | a | | b
265  // a/b/c/d | a | b/c | d
266  // /a/b/c | /a/b | | c
267  // ./a/b/c | PWD/a/b | | c
268  // ../a/b/c | PWD/../a/b | | c
269  // a/b/ | ERROR | |
270  // \endverbatim
271  // where PWD is the Foam::cwd() current working directory
272  static bool fileNameComponents
273  (
274  const fileName& path,
275  fileName& instance,
276  fileName& local,
277  word& name
278  );
279 
280  //- Create dot-delimited name.group string
281  // An empty group is ignored.
282  template<class StringType>
283  static inline word groupName(StringType base, const word& group);
284 
285  //- Return group (extension part of name)
286  static word group(const word& name);
287 
288  //- Return member (name without the extension)
289  static word member(const word& name);
290 
291  //- Create scope:name or scope_name string
292  // An empty scope is ignored.
293  static inline word scopedName
294  (
295  const std::string& scope,
296  const word& name
297  );
298 
299  //- Return the IOobject, but also consider an alternative file name.
300  //
301  // \param io The expected IOobject to use
302  // \param altFile Alternative fileName (ignored if empty).
303  // \param ioName The alternative name for the IOobject when
304  // the altFile resolves to a directory.
305  //
306  // \note If the alternative fileName is a non-empty string,
307  // it defines the location but uses all other properties of the
308  // expected IOobject.
309  // The location may be an absolute or a relative path.
310  // If it corresponds to a directory, the name of the
311  // expected IOobject will be used in its resolution.
312  // This expected name can provided via the ioName parameter.
314  (
315  const IOobject& io,
316  const fileName& altFile,
317  const word& ioName = ""
318  );
319 
320 
321  // Generated Methods
322 
323  //- Copy construct
324  IOobject(const IOobject&) = default;
325 
326  //- Destructor
327  virtual ~IOobject() = default;
328 
329 
330  // Constructors
332  //- Construct from name, instance, registry, io options
333  // (default: NO_READ, NO_WRITE, register, non-global)
334  IOobject
335  (
336  const word& name,
337  const fileName& instance,
338  const objectRegistry& registry,
340  );
342  //- Construct from name, instance, local, registry, io options
343  // (default: NO_READ, NO_WRITE, register, non-global)
344  IOobject
345  (
346  const word& name,
347  const fileName& instance,
348  const fileName& local,
349  const objectRegistry& registry,
351  );
352 
353  //- Construct from path, registry, io options.
354  // (default: NO_READ, NO_WRITE, register, non-global)
355  //
356  // Uses fileNameComponents() to split path into components.
357  // A path that starts with a '/' is regarded as a file system path.
358  // Paths starting with either './' or '../' are relative to
359  // current working directory (and replaced with absolute equivalents).
360  // All other paths are considered to be relative to the case.
361  IOobject
362  (
363  const fileName& path,
364  const objectRegistry& registry,
366  );
367 
368  //- Construct from name, instance, registry, io options
369  inline IOobject
370  (
371  const word& name,
372  const fileName& instance,
373  const objectRegistry& registry,
376  bool registerObject = true,
377  bool globalObject = false
378  );
379 
380  //- Construct from name, instance, local, registry, io options
381  inline IOobject
382  (
383  const word& name,
384  const fileName& instance,
385  const fileName& local,
386  const objectRegistry& registry,
389  bool registerObject = true,
390  bool globalObject = false
391  );
392 
393  //- Construct from path, registry, io options.
394  // Uses fileNameComponents() to split path into components.
395  // A path that starts with a '/' is regarded as a file system path.
396  // Paths starting with either './' or '../' are relative to
397  // current working directory (and replaced with absolute equivalents).
398  // All other paths are considered to be relative to the case.
399  inline IOobject
400  (
401  const fileName& path,
402  const objectRegistry& registry,
405  bool registerObject = true,
406  bool globalObject = false
407  );
408 
409  //- Copy construct, resetting registry
410  IOobject(const IOobject& io, const objectRegistry& registry);
411 
412  //- Copy construct, resetting name
413  IOobject(const IOobject& io, const word& name);
414 
415  //- Copy construct, resetting name and local component
416  inline IOobject
417  (
418  const IOobject& io,
419  const word& name,
420  const fileName& local
421  );
422 
423  //- Copy construct, resetting read/write options
424  inline IOobject
425  (
426  const IOobject& io,
429  );
430 
431 
432  //- Clone
433  autoPtr<IOobject> clone() const
434  {
435  return autoPtr<IOobject>::New(*this);
436  }
437 
438  //- Clone resetting registry
439  autoPtr<IOobject> clone(const objectRegistry& registry) const
440  {
441  return autoPtr<IOobject>::New(*this, registry);
442  }
443 
444 
445  // Member Functions
446 
447  // General Access
448 
449  //- Return the local objectRegistry
450  const objectRegistry& db() const noexcept;
451 
452  //- Return Time associated with the objectRegistry
453  const Time& time() const;
454 
455  //- Return the object name
456  inline const word& name() const noexcept;
457 
458  //- Return name of the class name read from header
459  inline const word& headerClassName() const noexcept;
460 
461  //- Return non-constant access to the class name read from header
462  inline word& headerClassName() noexcept;
463 
464  //- Return the optional note
465  inline const string& note() const noexcept;
466 
467  //- Modifiable access to the optional note
468  inline string& note() noexcept;
469 
470  //- Rename the object
471  virtual void rename(const word& newName)
472  {
473  name_ = newName;
474  }
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  //- True if headerClassName() is non-empty (after reading)
486  inline bool hasHeaderClass() const noexcept;
487 
488  //- Check if headerClassName() equals Type::typeName
489  template<class Type>
490  inline bool isHeaderClass() const;
491 
492  //- Same as isHeaderClass()
493  template<class Type>
494  bool isHeaderClassName() const { return isHeaderClass<Type>(); }
495 
496 
497  // Meta-data
498 
499  //- Return pointer to meta-data (if any) or nullptr
500  virtual const dictionary* findMetaData() const noexcept;
501 
502 
503  // Path components
504 
505  //- Return group (extension part of name)
506  inline word group() const;
507 
508  //- Return member (name without the extension)
509  inline word member() const;
510 
511  //- Return the Time::rootPath()
512  const fileName& rootPath() const;
513 
514  //- Return the Time::caseName()
515  const fileName& caseName() const;
516 
517  //- Read access to instance path component
518  inline const fileName& instance() const noexcept;
519 
520  //- Write access to instance path component
521  inline fileName& instance() noexcept;
522 
523  //- Read access to local path component
524  inline const fileName& local() const noexcept;
525 
526  //- The complete path
527  fileName path() const;
528 
529  //- The complete path with alternative instance and local
530  fileName path
531  (
532  const word& instance,
533  const fileName& local = fileName::null
534  ) const;
535 
536  //- The complete path + object name
537  inline fileName objectPath() const;
538 
539  //- The object path relative to the root
540  fileName objectRelPath() const;
541 
542  //- Redirect to fileHandler filePath, searching locally.
543  // When search is false, simply use the current instance,
544  // otherwise search previous instances.
545  fileName localFilePath
546  (
547  const word& typeName,
548  const bool search=true
549  ) const;
550 
551  //- Redirect to fileHandler filePath, searching up if in parallel.
552  // When search is false, simply use the current instance,
553  // otherwise search previous instances.
554  fileName globalFilePath
555  (
556  const word& typeName,
557  const bool search=true
558  ) const;
559 
560 
561  // Reading
562 
563  //- Parse 'FoamFile' header contents and set the IOobject
564  //- characteristics and return the stream characteristics.
565  IOstreamOption parseHeader(const dictionary& headerDict);
566 
567  //- Read header ('FoamFile' dictionary) and set the
568  //- IOobject and stream characteristics.
569  bool readHeader(Istream& is);
571  //- Read header (the 'FoamFile' dictionary) and set the
572  //- IOobject and stream characteristics.
573  // Saves the header content in the given dictionary.
574  bool readHeader(dictionary& headerDict, Istream& is);
575 
576  //- Read header (uses typeFilePath to find file) and check its info.
577  // Optionally checks headerClassName against the type-name.
578  // When search is false, simply use the current instance,
579  // otherwise search previous instances.
580  template<class Type>
581  bool typeHeaderOk
582  (
583  const bool checkType = true,
584  const bool search = true,
585  const bool verbose = true
586  );
587 
588  //- Helper: warn that type does not support re-reading
589  template<class Type>
590  void warnNoRereading() const;
591 
592 
593  // Writing
594 
595  //- Write the standard OpenFOAM file/dictionary banner
596  // Optionally without editor syntax hint (eg, for logs)
597  static Ostream& writeBanner(Ostream& os, const bool noSyntaxHint=false);
598 
599  //- Write the standard file section divider
600  static Ostream& writeDivider(Ostream& os);
601 
602  //- Write the standard end file divider
603  static Ostream& writeEndDivider(Ostream& os);
604 
605  //- Write header with current type()
606  bool writeHeader(Ostream& os) const;
607 
608  //- Write header with override of type
609  bool writeHeader(Ostream& os, const word& objectType) const;
610 
611  //- Write header into a dictionary with current type()
612  //- and given output format
613  void writeHeader(dictionary& dict, IOstreamOption streamOpt) const;
614 
615  //- Write header into a dictionary with override of type
616  //- and given output format
617  void writeHeader
618  (
619  dictionary& dict,
620  const word& objectType,
621  IOstreamOption streamOpt
622  ) const;
623 
624 
625  // Error Handling
627  //- Did last readHeader() succeed?
628  inline bool good() const noexcept;
629 
630  //- Did last readHeader() fail?
631  inline bool bad() const noexcept;
632 
633 
634  // Info
635 
636  //- Return info proxy, for printing information to a stream
637  InfoProxy<IOobject> info() const
638  {
639  return *this;
640  }
641 
642 
643  // Member Operators
644 
645  //- Copy assignment, copies all values (except the registry)
646  void operator=(const IOobject& io);
647 };
648 
649 
650 //- Specialization for \c void always returns true (no headerClassName check).
651 template<>
652 inline bool IOobject::isHeaderClass<void>() const
653 {
654  return true;
655 }
656 
657 
658 template<>
659 Ostream& operator<<(Ostream& os, const InfoProxy<IOobject>& ip);
660 
661 
662 //- Template function for obtaining global vs. local status
663 template<class T>
664 inline bool typeGlobal()
665 {
666  return false;
667 }
668 
669 
670 //- Template function for obtaining local or global filePath
671 template<class T>
672 inline fileName typeFilePath(const IOobject& io, const bool search = true)
673 {
674  return
675  (
676  typeGlobal<T>()
677  ? io.globalFilePath(T::typeName, search)
678  : io.localFilePath(T::typeName, search)
679  );
680 }
681 
682 
683 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
684 
685 } // End namespace Foam
686 
687 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
688 
689 #include "IOobjectI.H"
690 
691 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
692 
693 #ifdef NoRepository
694 # include "IOobjectTemplates.C"
695 #endif
696 
697 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
698 
699 #endif
700 
701 // ************************************************************************* //
constexpr IOobjectOption(readOption rOpt=readOption::NO_READ, writeOption wOpt=writeOption::NO_WRITE, registerOption registerObject=registerOption::REGISTER, bool globalObject=false) noexcept
Default construct (NO_READ, NO_WRITE, register, non-global) or construct with specified options...
writeOption
Enumeration defining write preferences.
dictionary dict
autoPtr< IOobject > clone() const
Clone.
Definition: IOobject.H:570
static bool fileNameComponents(const fileName &path, fileName &instance, fileName &local, word &name)
Split path into instance, local, name components.
Definition: IOobject.C:140
A class for handling file names.
Definition: fileName.H:71
bool typeGlobal()
Template function for obtaining global vs. local status.
Definition: IOobject.H:898
fileName globalFilePath(const word &typeName, const bool search=true) const
Redirect to fileHandler filePath, searching up if in parallel.
Definition: IOobject.C:534
static float fileModificationSkew
Time skew (seconds) for file modification checks.
Definition: IOobject.H:318
void operator=(const IOobject &io)
Copy assignment, copies all values (except the registry)
Definition: IOobject.C:565
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:120
virtual const dictionary * findMetaData() const noexcept
Return pointer to meta-data (if any) or nullptr.
const word & name() const noexcept
Return the object name.
Definition: IOobjectI.H:150
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
virtual void rename(const word &newName)
Rename the object.
Definition: IOobject.H:626
static Ostream & writeDivider(Ostream &os)
Write the standard file section divider.
const string & note() const noexcept
Return the optional note.
Definition: IOobjectI.H:180
word member() const
Return member (name without the extension)
Definition: IOobjectI.H:162
void setBad(const string &s)
Set the object state to bad.
Definition: IOobject.C:544
A simple container for options an IOstream can normally have.
bool bad() const noexcept
Did last readHeader() fail?
Definition: IOobjectI.H:253
word group() const
Return group (extension part of name)
Definition: IOobjectI.H:156
bool good() const noexcept
Did last readHeader() succeed?
Definition: IOobjectI.H:247
Ignore writing from objectRegistry::writeObject()
bool writeHeader(Ostream &os) const
Write header with current type()
fileName objectPath() const
The complete path + object name.
Definition: IOobjectI.H:239
IOstreamOption parseHeader(const dictionary &headerDict)
Parse &#39;FoamFile&#39; header contents and set the IOobject characteristics and return the stream character...
fileName path() const
The complete path.
Definition: IOobject.C:465
bool hasHeaderClass() const noexcept
True if headerClassName() is non-empty (after reading)
Definition: IOobjectI.H:206
bool globalObject() const noexcept
True if object is treated the same for all processors.
static word groupName(StringType base, const word &group)
Create dot-delimited name.group string.
fileName typeFilePath(const IOobject &io, const bool search=true)
Template function for obtaining local or global filePath.
Definition: IOobject.H:908
static word scopedName(const std::string &scope, const word &name)
Create scope:name or scope_name string.
Definition: IOobjectI.H:40
IOobject io("surfaceFilmProperties", mesh.time().constant(), mesh, IOobject::READ_IF_PRESENT, IOobject::NO_WRITE, false)
A class for handling words, derived from Foam::string.
Definition: word.H:63
fileCheckTypes
Enumeration defining the file checking options.
Definition: IOobject.H:186
static int maxFileModificationPolls
Max number of times to poll for file modification changes.
Definition: IOobject.H:323
const objectRegistry & db() const noexcept
Return the local objectRegistry.
Definition: IOobject.C:441
fileName localFilePath(const word &typeName, const bool search=true) const
Redirect to fileHandler filePath, searching locally.
Definition: IOobject.C:523
virtual ~IOobject()=default
Destructor.
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.
static Ostream & writeEndDivider(Ostream &os)
Write the standard end file divider.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:55
const direction noexcept
Definition: Scalar.H:258
static const Enum< fileCheckTypes > fileCheckTypesNames
Names for the fileCheckTypes.
Definition: IOobject.H:197
OBJstream os(runTime.globalPath()/outputName)
static fileCheckTypes fileModificationChecking
Type of file modification checking.
Definition: IOobject.H:313
static bool bannerEnabled() noexcept
Status of output file banner.
Definition: IOobject.H:331
const fileName & instance() const noexcept
Read access to instance path component.
Definition: IOobjectI.H:221
static char scopeSeparator
Character for scoping object names (&#39;:&#39; or &#39;_&#39;)
Definition: IOobject.H:308
unsigned labelByteSize() const noexcept
The sizeof (label) in bytes, possibly read from the header.
Definition: IOobjectI.H:192
static void writeHeaderContent(Ostream &os, const IOobject &io, const word &objectType, const dictionary *metaDataDict=nullptr)
Helper: write content for FoamFile IOobject header with optional meta information.
const fileName & rootPath() const
Return the Time::rootPath()
Definition: IOobject.C:453
const word & headerClassName() const noexcept
Return name of the class name read from header.
Definition: IOobjectI.H:168
A helper class for outputting values to Ostream.
Definition: ensightCells.H:43
bool isHeaderClassName() const
Same as isHeaderClass()
Definition: IOobject.H:659
const Time & time() const
Return Time associated with the objectRegistry.
Definition: IOobject.C:447
IOobject(const IOobject &)=default
Copy construct.
A simple container of IOobject preferences. Can also be used for general handling of read/no-read/rea...
TypeName("IOobject")
Declare type-name, virtual type (with debug switch)
fileName objectRelPath() const
The object path relative to the root.
Definition: IOobject.C:499
bool registerObject() const noexcept
Should objects created with this IOobject be registered?
static Ostream & writeBanner(Ostream &os, const bool noSyntaxHint=false)
Write the standard OpenFOAM file/dictionary banner.
fileName search(const word &file, const fileName &directory)
Recursively search the given directory for the file.
Definition: fileName.C:640
Pointer management similar to std::unique_ptr, with some additional methods and type checking...
Definition: HashPtrTable.H:48
InfoProxy< IOobject > info() const
Return info proxy, for printing information to a stream.
Definition: IOobject.H:865
Registry of regIOobjects.
static autoPtr< T > New(Args &&... args)
Construct autoPtr with forwarding arguments.
Definition: autoPtr.H:178
objectState
Enumeration defining the valid states of an IOobject.
Definition: IOobject.H:177
const fileName & local() const noexcept
Read access to local path component.
Definition: IOobjectI.H:233
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))
bool readHeader(Istream &is)
Read header (&#39;FoamFile&#39; dictionary) and set the IOobject and stream characteristics.
Defines the attributes of an object for which implicit objectRegistry management is supported...
Definition: IOobject.H:166
const fileName & caseName() const
Return the Time::caseName()
Definition: IOobject.C:459
void warnNoRereading() const
Helper: warn that type does not support re-reading.
Namespace for OpenFOAM.
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:231
bool isHeaderClass() const
Check if headerClassName() equals Type::typeName.
Definition: IOobjectI.H:213
unsigned scalarByteSize() const noexcept
The sizeof (scalar) in bytes, possibly read from the header.
Definition: IOobjectI.H:198
readOption
Enumeration defining read preferences.