MCPcopy Create free account
hub / github.com/OpenFOAM/OpenFOAM-dev / writeObject

Function writeObject

src/OpenFOAM/db/regIOobject/regIOobjectWrite.C:36–165  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

34// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
35
36bool Foam::regIOobject::writeObject
37(
38 IOstream::streamFormat fmt,
39 IOstream::versionNumber ver,
40 IOstream::compressionType cmp,
41 const bool valid
42) const
43{
44 if (!good())
45 {
46 SeriousErrorInFunction
47 << "bad object " << name()
48 << endl;
49
50 return false;
51 }
52
53 if (instance().empty())
54 {
55 SeriousErrorInFunction
56 << "instance undefined for object " << name()
57 << endl;
58
59 return false;
60 }
61
62
63
64 //- uncomment this if you want to write global objects on master only
65 //bool isGlobal = global();
66 bool isGlobal = false;
67
68 if (instance() == time().timeName())
69 {
70 // Mark as written to local directory
71 isGlobal = false;
72 }
73 else if
74 (
75 instance() != time().system()
76 && instance() != time().caseSystem()
77 && instance() != time().constant()
78 && instance() != time().caseConstant()
79 )
80 {
81 // Update instance
82 const_cast<regIOobject&>(*this).instance() = time().timeName();
83
84 // Mark as written to local directory
85 isGlobal = false;
86 }
87
88 if (OFstream::debug)
89 {
90 if (isGlobal)
91 {
92 Pout<< "regIOobject::write() : "
93 << "writing (global) file " << objectPath();

Callers 2

writeFunction · 0.70
writeTimeDictFunction · 0.50

Calls 5

fileHandlerFunction · 0.85
nameFunction · 0.50
emptyMethod · 0.45
sizeMethod · 0.45
lastMethod · 0.45

Tested by

no test coverage detected