Loading...
Searching...
No Matches
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-2025 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
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
27Class
28 Foam::IOobject
29
30Description
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 READ_MODIFIED (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 LAZY_READ (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
82Note
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
86See also
87 Foam::objectRegistry
88 Foam::regIOobject
89
90SourceFiles
91 IOobject.C
92 IOobjectIO.C
93 IOobjectMetaData.C
94 IOobjectReadHeader.C
95 IOobjectWriteHeader.C
96
97\*---------------------------------------------------------------------------*/
98
99#ifndef Foam_IOobject_H
100#define Foam_IOobject_H
101
102#include "fileName.H"
103#include "scalarFwd.H"
104#include "typeInfo.H"
105#include "refPtr.H" // For autoPtr, refPtr, tmp, stdFoam
106#include "Enum.H"
107#include "InfoProxy.H"
108#include "IOobjectOption.H"
109#include "IOstreamOption.H"
110#include <type_traits>
111
112// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
113
114namespace Foam
115{
116
117// Forward Declarations
118class Time;
119class dictionary;
120class objectRegistry;
121class IOobject;
122
123template<>
125
126// Traits
127
128//- Trait for specifying global vs. local IOobject file types
129template<class T>
130struct is_globalIOobject : std::false_type {};
131
132//- Trait for specifying IOobject types that support the coherent format
133template<class T>
134struct is_coherentIOobject : std::false_type {};
135
136
137/*---------------------------------------------------------------------------*\
138 Class IOobject Declaration
139\*---------------------------------------------------------------------------*/
140
141class IOobject
142:
143 public IOobjectOption
144{
145public:
146
147 // Public Data Types
148
149 //- Enumeration defining the valid states of an IOobject
150 enum objectState : char
151 {
152 GOOD,
153 BAD
154 };
155
156 //- Enumeration defining the file checking options
157 //- (time-stamp | inotify) | (all | masterOnly)
158 enum fileCheckTypes : char
159 {
160 timeStamp = 1, timeStampMaster = 3,
161 inotify = 4, inotifyMaster = 6
162 };
163
164 //- Names for the fileCheckTypes
165 static const Enum<fileCheckTypes> fileCheckTypesNames;
166
167
168private:
169
170 // Static Data Members
171
172 //- Use an output file banner, enabled by default
173 static bool bannerEnabled_;
174
176 // Private Data (NB: byte-flags first for better alignment)
177
178 //- The IOobject state
179 objectState objState_;
180
181 //- The sizeof (label) in bytes, possibly read from the header
182 unsigned char sizeofLabel_;
183
184 //- The sizeof (scalar) in bytes, possibly read from the header
185 unsigned char sizeofScalar_;
186
187 //- Name
188 word name_;
189
190 //- Class name read from header
191 word headerClassName_;
192
193 //- Optional note
194 string note_;
195
196 //- Instance path component
197 fileName instance_;
198
199 //- Local path component
200 fileName local_;
202 //- Reference to the objectRegistry
203 const objectRegistry& db_;
204
205
206 // Private Member Functions
207
208 //- Construct from registry, io options. Without name, instance, local
209 IOobject(const objectRegistry& registry, IOobjectOption ioOpt);
210
211 //- Read header and check its info.
212 // Optionally checks headerClassName against the type-name.
213 // When search is false, simply use the current instance,
214 // otherwise search previous instances.
215 bool readAndCheckHeader
216 (
217 const bool isGlobal,
219 const bool checkType = true,
220 const bool search = true,
221 const bool verbose = true
222 );
223
224
225protected:
226
227 // Protected Member Functions
228
229 //- Helper: write content for FoamFile IOobject header
230 //- with optional meta information.
231 static void writeHeaderContent
232 (
233 Ostream& os,
234 const IOobject& io,
235 const word& objectType,
236 const dictionary* metaDataDict = nullptr
237 );
238
239 //- Helper: write dictionary content for FoamFile header
240 //- with optional meta information.
241 static void writeHeaderContent
242 (
244 const IOobject& io,
245 const word& objectType,
246 IOstreamOption streamOpt,
247 const dictionary* metaDataDict = nullptr
248 );
249
250 //- Set the object state to bad
251 void setBad(const string& s);
252
253
254public:
255
256 //- Declare type-name, virtual type (with debug switch)
257 TypeName("IOobject");
258
259
260 // Static Data
261
262 //- Character for scoping object names (':' or '_')
263 // Change with caution.
264 static char scopeSeparator;
265
266 //- Type of file modification checking
268
269 //- Time skew (seconds) for file modification checks
270 static float fileModificationSkew;
271
272 //- Max number of times to poll for file modification changes
273 static int maxFileModificationPolls;
274
275
276 // Static Functions
277
278 //- Status of output file banner
279 static bool bannerEnabled() noexcept
280 {
281 return bannerEnabled_;
282 }
283
284 //- Enable/disable output file banner
285 // \return the previous value
286 static bool bannerEnabled(bool on) noexcept
287 {
288 bool old(bannerEnabled_);
289 bannerEnabled_ = on;
290 return old;
291 }
292
293 //- Test fileModificationChecking for master-only
295
296 //- Split path into instance, local, name components
297 //
298 // The splitting behaviour is as follows:
299 // \verbatim
300 // input | instance | local | name
301 // ----------- | ---------- | ----- | ----
302 // a | | | a
303 // a/b | a | | b
304 // a/b/c/d | a | b/c | d
305 // /a/b/c | /a/b | | c
306 // ./a/b/c | PWD/a/b | | c
307 // ../a/b/c | PWD/../a/b | | c
308 // a/b/ | ERROR | |
309 // \endverbatim
310 // where PWD is the Foam::cwd() current working directory
311 static bool fileNameComponents
312 (
313 const fileName& path,
314 fileName& instance,
315 fileName& local,
316 word& name
317 );
318
319 //- Create dot-delimited name.group string
320 // An empty group is ignored.
321 template<class StringType>
322 static inline word groupName(StringType base, const word& group);
323
324 //- Return group (extension part of name)
325 static word group(const word& name);
326
327 //- Return member (name without the extension)
328 static word member(const word& name);
329
330 //- Create scope:name or scope_name string
331 // An empty scope is ignored.
332 static inline word scopedName
333 (
334 const std::string& scope,
335 const word& name
336 );
337
338 //- Create scope:name1:name2 or scope_name1_name2 string
339 // An empty scope is ignored.
340 static inline word scopedName
341 (
342 const std::string& scope,
343 const word& name1,
344 const word& name2
345 );
346
347 //- Return the IOobject, but also consider an alternative file name.
348 //
349 // \param io The expected IOobject to use
350 // \param altFile Alternative fileName (ignored if empty).
351 // \param ioName The alternative name for the IOobject when
352 // the altFile resolves to a directory.
353 //
354 // \note If the alternative fileName is a non-empty string,
355 // it defines the location but uses all other properties of the
356 // expected IOobject.
357 // The location may be an absolute or a relative path.
358 // If it corresponds to a directory, the name of the
359 // expected IOobject will be used in its resolution.
360 // This expected name can provided via the ioName parameter.
361 static IOobject selectIO
362 (
363 const IOobject& io,
364 const fileName& altFile,
365 const word& ioName = ""
366 );
367
369 // Generated Methods
370
371 //- Copy construct
372 IOobject(const IOobject&) = default;
373
374 //- Destructor
375 virtual ~IOobject() = default;
377
378 // Constructors
379
380 //- Construct from name, instance, registry, io options
381 // (default: NO_READ, NO_WRITE, REGISTER, non-global)
382 IOobject
383 (
384 const word& name,
385 const fileName& instance,
386 const objectRegistry& registry,
388 );
389
390 //- Construct from name, instance, local, registry, io options
391 // (default: NO_READ, NO_WRITE, REGISTER, non-global)
392 IOobject
393 (
394 const word& name,
395 const fileName& instance,
396 const fileName& local,
397 const objectRegistry& registry,
399 );
400
401 //- Construct from path, registry, io options.
402 // (default: NO_READ, NO_WRITE, REGISTER, non-global)
403 //
404 // Uses fileNameComponents() to split path into components.
405 // A path that starts with a '/' is regarded as a file system path.
406 // Paths starting with either './' or '../' are relative to
407 // current working directory (and replaced with absolute equivalents).
408 // All other paths are considered to be relative to the case.
409 IOobject
410 (
411 const fileName& path,
412 const objectRegistry& registry,
414 );
415
416 //- Construct from name, instance, registry, io options
417 inline IOobject
418 (
419 const word& name,
420 const fileName& instance,
421 const objectRegistry& registry,
424 bool registerObject = true, // == IOobjectOption::LEGACY_REGISTER
425 bool globalObject = false
426 );
427
428 //- Construct from name, instance, local, registry, io options
429 inline IOobject
431 const word& name,
432 const fileName& instance,
433 const fileName& local,
434 const objectRegistry& registry,
437 bool registerObject = true, // == IOobjectOption::LEGACY_REGISTER
438 bool globalObject = false
439 );
440
441 //- Construct from path, registry, io options.
442 // Uses fileNameComponents() to split path into components.
443 // A path that starts with a '/' is regarded as a file system path.
444 // Paths starting with either './' or '../' are relative to
445 // current working directory (and replaced with absolute equivalents).
446 // All other paths are considered to be relative to the case.
447 inline IOobject
448 (
449 const fileName& path,
450 const objectRegistry& registry,
453 bool registerObject = true, // == IOobjectOption::LEGACY_REGISTER
454 bool globalObject = false
455 );
456
457 //- Copy construct, resetting registry
458 IOobject(const IOobject& io, const objectRegistry& registry);
459
460 //- Copy construct, resetting name
461 IOobject(const IOobject& io, const word& name);
462
463 //- Copy construct, resetting name and local component
464 inline IOobject
465 (
466 const IOobject& io,
467 const word& name,
468 const fileName& local
469 );
470
471 //- Copy construct, resetting read/write options
472 inline IOobject
473 (
474 const IOobject& io,
477 );
478
479 //- Copy construct, resetting register option
480 inline IOobject
481 (
482 const IOobject& io,
484 );
485
486
487 //- Clone
488 autoPtr<IOobject> clone() const
489 {
490 return autoPtr<IOobject>::New(*this);
491 }
492
493 //- Clone resetting registry
494 autoPtr<IOobject> clone(const objectRegistry& registry) const
496 return autoPtr<IOobject>::New(*this, registry);
497 }
498
499
500 // Member Functions
501
502 // General Access
503
504 //- Return the local objectRegistry
505 const objectRegistry& db() const noexcept;
506
507 //- Return Time associated with the objectRegistry
508 const Time& time() const noexcept;
509
510 //- Return the object name
511 inline const word& name() const noexcept;
512
513 //- Return name of the class name read from header
514 inline const word& headerClassName() const noexcept;
515
516 //- Modifiable access to the class name read from header
517 inline word& headerClassName() noexcept;
518
519 //- Return the optional note
520 inline const string& note() const noexcept;
521
522 //- Modifiable access to the optional note
523 inline string& note() noexcept;
524
525 //- Rename the object
526 virtual void rename(const word& newName)
527 {
528 name_ = newName;
529 }
530
531 //- The sizeof (label) in bytes, possibly read from the header
532 inline unsigned labelByteSize() const noexcept;
533
534 //- The sizeof (scalar) in bytes, possibly read from the header
535 inline unsigned scalarByteSize() const noexcept;
536
537 //- Clear various bits (headerClassName, note, sizeof...)
538 //- that would be obtained when reading from a file.
539 // \param newName if non-null, optionally rename the IOobject
540 void resetHeader(const word& newName = word::null);
541
542
543 // Checks
544
545 //- True if headerClassName() is non-empty (after reading)
546 inline bool hasHeaderClass() const noexcept;
547
548 //- Check if headerClassName() equals the expected type.
549 //- Always true if the expected type is empty.
550 inline bool isHeaderClass(const word& expectedType) const;
551
552 //- Check if headerClassName() equals Type::typeName
553 //- Always true for a \c void type.
554 template<class Type>
555 inline bool isHeaderClass() const;
556
557
558 // Meta-data
559
560 //- Return pointer to meta-data (if any) or nullptr
561 virtual const dictionary* findMetaData() const noexcept;
562
563
564 // Path components
565
566 //- Return group (extension part of name)
567 inline word group() const;
568
569 //- Return member (name without the extension)
570 inline word member() const;
571
572 //- Return the Time::rootPath()
573 const fileName& rootPath() const noexcept;
574
575 //- Return the Time::caseName()
576 const fileName& caseName() const noexcept;
577
578 //- Return the Time::globalCaseName()
579 const fileName& globalCaseName() const noexcept;
580
581 //- Return the Time::caseName() - normal or global
583
584 //- Read access to instance path component
585 inline const fileName& instance() const noexcept;
586
587 //- Modifiable access to instance path component
588 inline fileName& instance() noexcept;
589
590 //- Return the scalar value of the instance component (or 0),
591 //- which often corresponds to a time index/value.
592 scalar instanceValue() const;
593
594 //- Read access to local path component
595 inline const fileName& local() const noexcept;
596
597 //- Modifiable access to the local path component
598 inline fileName& local() noexcept;
599
600 //- The complete path for the object (with instance, local,...).
601 fileName path() const;
602
603 //- The complete global path for the object (with instance, local,...)
604 fileName globalPath() const;
605
606 //- The complete path (normal or global) for the object
608
609 //- The complete path with alternative instance and local
611 (
612 const word& instance,
613 const fileName& local = fileName::null
614 ) const;
615
616 //- The complete global path with alternative instance and local
618 (
619 const word& instance,
620 const fileName& local = fileName::null
621 ) const;
622
623 //- The complete path (normal or global)
624 //- with alternative instance and local
626 (
628 const word& instance,
629 const fileName& local = fileName::null
630 ) const;
631
632 //- The complete path + object name
633 inline fileName objectPath() const;
634
635 //- The complete global path + object name
636 inline fileName globalObjectPath() const;
637
638 //- The complete path (normal or global) + object name
640
641 //- The complete path (normal or global) + object name
642 //- with alternative instance
644
645 //- The complete path + object name
646 //- with alternative instance
647 inline fileName objectPath(const word& instance) const;
648
649 //- The complete global path + object name
650 //- with alternative instance
651 inline fileName globalObjectPath(const word& instance) const;
652
653 //- The object path relative to the case
654 fileName objectRelPath() const;
655
656 //- Redirect to fileHandler filePath, searching locally.
658 (
659 const word& typeName,
661 const bool search=true
662 ) const;
663
664 //- Redirect to fileHandler filePath, searching up if in parallel.
666 (
667 const word& typeName,
669 const bool search=true
670 ) const;
671
672
673 // Reading
674
675 //- Parse 'FoamFile' header contents and set the IOobject
676 //- characteristics and return the stream characteristics.
677 IOstreamOption parseHeader(const dictionary& headerDict);
678
679 //- Read header ('FoamFile' dictionary) and set the
680 //- IOobject and stream characteristics.
681 bool readHeader(Istream& is);
682
683 //- Read header (the 'FoamFile' dictionary) and set the
684 //- IOobject and stream characteristics.
685 // Saves the header content in the given dictionary.
686 bool readHeader(dictionary& headerDict, Istream& is);
687
688 //- Read header (respects is_globalIOobject trait) and check its info.
689 //- A \c void type suppresses trait and type-name checks.
690 template<class Type>
691 bool typeHeaderOk
692 (
694 [[maybe_unused]] const bool checkType = true,
696 const bool search = true,
697 //! Report any check-type failures
698 const bool verbose = true
699 );
700
701 //- Forwards to single-parameter version with the specified search type.
702 //- A \c void type suppresses trait and type-name checks.
703 template<class Type, bool Searching>
704 bool typeHeaderOk
705 (
707 const bool checkType = true,
709 const bool verbose = true
710 );
711
712 //- Call localFilePath or globalFilePath for given type
713 //- depending on its is_globalIOobject trait.
714 template<class Type>
715 fileName typeFilePath(const bool search = true) const;
716
717 //- Helper: warn that type does not support re-reading
718 template<class Type>
719 void warnNoRereading() const;
720
721
722 // Writing
723
724 //- Write the standard OpenFOAM file/dictionary banner
725 // Optionally without editor syntax hint (eg, for logs)
726 static Ostream& writeBanner(Ostream& os, const bool noSyntaxHint=false);
727
728 //- Write the standard file section divider
729 static Ostream& writeDivider(Ostream& os);
730
731 //- Write the standard end file divider
733
734 //- Write header with current type()
735 bool writeHeader(Ostream& os) const;
736
737 //- Write header with override of type
738 bool writeHeader(Ostream& os, const word& objectType) const;
739
740 //- Write header into a dictionary with current type()
741 //- and given output format
742 void writeHeader(dictionary& dict, IOstreamOption streamOpt) const;
743
744 //- Write header into a dictionary with override of type
745 //- and given output format
746 void writeHeader
747 (
749 const word& objectType,
750 IOstreamOption streamOpt
751 ) const;
752
753
754 // Error Handling
755
756 //- Did last readHeader() succeed?
757 inline bool good() const noexcept;
758
759 //- Did last readHeader() fail?
760 inline bool bad() const noexcept;
761
762
763 // Info
764
765 //- Return info proxy,
766 //- for printing information to a stream
767 InfoProxy<IOobject> info() const noexcept { return *this; }
768
769
770 // Member Operators
771
772 //- Copy assignment, copies all values (except the registry)
773 void operator=(const IOobject& io);
774
775
776 // Housekeeping
777
778 //- Same as isHeaderClass()
779 template<class Type>
780 bool isHeaderClassName() const { return isHeaderClass<Type>(); }
781};
782
783
784// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
785
786} // End namespace Foam
787
788// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
789
790#include "IOobjectI.H"
791
792// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
793
794#ifdef NoRepository
795# include "IOobjectTemplates.C"
796#endif
797
798// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
799
800#endif
801
802// ************************************************************************* //
Enum is a wrapper around a list of names/values that represent particular enumeration (or int) values...
Definition Enum.H:57
A simple container of IOobject preferences. Can also be used for general handling of read/no-read/rea...
registerOption
Enumeration for use with registerObject(). Values map to bool (false/true).
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.
bool globalObject() const noexcept
True if object is treated the same for all processors.
bool registerObject() const noexcept
Should objects created with this IOobject be registered?
Layout
The layout of the case structure.
readOption
Enumeration defining read preferences.
writeOption
Enumeration defining write preferences.
@ NO_WRITE
Ignore writing from objectRegistry::writeObject().
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition IOobject.H:191
objectState
Enumeration defining the valid states of an IOobject.
Definition IOobject.H:200
const Time & time() const noexcept
Return Time associated with the objectRegistry.
Definition IOobject.C:456
bool isHeaderClass() const
Check if headerClassName() equals Type::typeName Always true for a void type.
Definition IOobjectI.H:274
const word & name() const noexcept
Return the object name.
Definition IOobjectI.H:205
const word & headerClassName() const noexcept
Return name of the class name read from header.
Definition IOobjectI.H:223
bool readHeader(Istream &is)
Read header ('FoamFile' dictionary) and set the IOobject and stream characteristics.
static bool bannerEnabled() noexcept
Status of output file banner.
Definition IOobject.H:376
bool isHeaderClassName() const
Same as isHeaderClass().
Definition IOobject.H:1058
void warnNoRereading() const
Helper: warn that type does not support re-reading.
static Ostream & writeDivider(Ostream &os)
Write the standard file section divider.
virtual const dictionary * findMetaData() const noexcept
Return pointer to meta-data (if any) or nullptr.
const fileName & rootPath() const noexcept
Return the Time::rootPath().
Definition IOobject.C:462
unsigned scalarByteSize() const noexcept
The sizeof (scalar) in bytes, possibly read from the header.
Definition IOobjectI.H:253
fileName typeFilePath(const bool search=true) const
Call localFilePath or globalFilePath for given type depending on its is_globalIOobject trait.
fileName globalObjectPath() const
The complete global path + object name.
Definition IOobjectI.H:319
bool typeHeaderOk(const bool checkType=true, const bool search=true, const bool verbose=true)
Read header (respects is_globalIOobject trait) and check its info. A void type suppresses trait and t...
static Ostream & writeEndDivider(Ostream &os)
Write the standard end file divider.
fileCheckTypes
Enumeration defining the file checking options (time-stamp | inotify) | (all | masterOnly).
Definition IOobject.H:210
static word member(const word &name)
Return member (name without the extension).
Definition IOobject.C:313
static Ostream & writeBanner(Ostream &os, const bool noSyntaxHint=false)
Write the standard OpenFOAM file/dictionary banner.
const objectRegistry & db() const noexcept
Return the local objectRegistry.
Definition IOobject.C:450
bool good() const noexcept
Did last readHeader() succeed?
Definition IOobjectI.H:354
void resetHeader(const word &newName=word::null)
Clear various bits (headerClassName, note, sizeof...) that would be obtained when reading from a file...
Definition IOobject.C:644
bool bad() const noexcept
Did last readHeader() fail?
Definition IOobjectI.H:360
InfoProxy< IOobject > info() const noexcept
Return info proxy, for printing information to a stream.
Definition IOobject.H:1041
autoPtr< IOobject > clone(const objectRegistry &registry) const
Clone resetting registry.
Definition IOobject.H:649
scalar instanceValue() const
Return the scalar value of the instance component (or 0), which often corresponds to a time index/val...
Definition IOobject.C:487
static word scopedName(const std::string &scope, const word &name)
Create scope:name or scope_name string.
Definition IOobjectI.H:50
static char scopeSeparator
Character for scoping object names (':' or '_').
Definition IOobject.H:353
static word group(const word &name)
Return group (extension part of name).
Definition IOobject.C:300
fileName globalFilePath(const word &typeName, const bool search=true) const
Redirect to fileHandler filePath, searching up if in parallel.
Definition IOobject.C:604
bool hasHeaderClass() const noexcept
True if headerClassName() is non-empty (after reading).
Definition IOobjectI.H:261
void operator=(const IOobject &io)
Copy assignment, copies all values (except the registry).
Definition IOobject.C:660
static bool fileModificationChecking_masterOnly() noexcept
Test fileModificationChecking for master-only.
Definition IOobjectI.H:23
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:256
static bool fileNameComponents(const fileName &path, fileName &instance, fileName &local, word &name)
Split path into instance, local, name components.
Definition IOobject.C:165
const fileName & local() const noexcept
Read access to local path component.
Definition IOobjectI.H:301
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.
fileName objectRelPath() const
The object path relative to the case.
Definition IOobject.C:581
fileName localFilePath(const word &typeName, const bool search=true) const
Redirect to fileHandler filePath, searching locally.
Definition IOobject.C:593
word group() const
Return group (extension part of name).
Definition IOobjectI.H:211
IOstreamOption parseHeader(const dictionary &headerDict)
Parse 'FoamFile' header contents and set the IOobject characteristics and return the stream character...
const fileName & instance() const noexcept
Read access to instance path component.
Definition IOobjectI.H:289
const fileName & globalCaseName() const noexcept
Return the Time::globalCaseName().
Definition IOobject.C:474
TypeName("IOobject")
Declare type-name, virtual type (with debug switch).
static float fileModificationSkew
Time skew (seconds) for file modification checks.
Definition IOobject.H:363
static fileCheckTypes fileModificationChecking
Type of file modification checking.
Definition IOobject.H:358
virtual void rename(const word &newName)
Rename the object.
Definition IOobject.H:697
unsigned labelByteSize() const noexcept
The sizeof (label) in bytes, possibly read from the header.
Definition IOobjectI.H:247
static const Enum< fileCheckTypes > fileCheckTypesNames
Names for the fileCheckTypes.
Definition IOobject.H:218
fileName path() const
The complete path for the object (with instance, local,...).
Definition IOobject.C:500
static word groupName(StringType base, const word &group)
Create dot-delimited name.group string.
autoPtr< IOobject > clone() const
Clone.
Definition IOobject.H:641
word member() const
Return member (name without the extension).
Definition IOobjectI.H:217
static bool bannerEnabled(bool on) noexcept
Enable/disable output file banner.
Definition IOobject.H:386
const string & note() const noexcept
Return the optional note.
Definition IOobjectI.H:235
static int maxFileModificationPolls
Max number of times to poll for file modification changes.
Definition IOobject.H:368
fileName objectPath() const
The complete path + object name.
Definition IOobjectI.H:313
bool writeHeader(Ostream &os) const
Write header with current type().
void setBad(const string &s)
Set the object state to bad.
Definition IOobject.C:625
const fileName & caseName() const noexcept
Return the Time::caseName().
Definition IOobject.C:468
fileName globalPath() const
The complete global path for the object (with instance, local,...).
Definition IOobject.C:512
A simple container for options an IOstream can normally have.
A helper class for outputting values to Ostream.
Definition InfoProxy.H:49
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition Istream.H:60
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition Ostream.H:59
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition Time.H:75
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition autoPtr.H:65
static autoPtr< T > New(Args &&... args)
Construct autoPtr with forwarding arguments.
Definition autoPtr.H:178
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition dictionary.H:133
A class for handling file names.
Definition fileName.H:75
Registry of regIOobjects.
A class for handling words, derived from Foam::string.
Definition word.H:66
fileName path(UMean.rootPath()/UMean.caseName()/"graphs"/UMean.instance())
bool local
Definition EEqn.H:20
OBJstream os(runTime.globalPath()/outputName)
const auto & io
auto & name
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 OpenFOAM.
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces).
const word GlobalIOList< Tuple2< scalar, vector > >::typeName("scalarVectorTable")
const direction noexcept
Definition scalarImpl.H:265
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
Definition exprTraits.C:127
fileName search(const word &file, const fileName &directory)
Recursively search the given directory for the file.
Definition fileName.C:642
Typedefs for float/double/scalar without requiring scalar.H.
dictionary dict
Trait for specifying IOobject types that support the coherent format.
Definition IOobject.H:181
Trait for specifying global vs. local IOobject file types.
Definition IOobject.H:175
Basic run-time type information using word as the type's name. Used to enhance the standard RTTI to c...
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition typeInfo.H:68