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

Function readHeader

src/OpenFOAM/db/IOobject/IOobjectReadHeader.C:31–133  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

29// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
30
31bool Foam::IOobject::readHeader(Istream& is)
32{
33 if (IOobject::debug)
34 {
35 InfoInFunction << "Reading header for file " << is.name() << endl;
36 }
37
38 // Check Istream not already bad
39 if (!is.good())
40 {
41 if (rOpt_ == MUST_READ || rOpt_ == MUST_READ_IF_MODIFIED)
42 {
43 FatalIOErrorInFunction(is)
44 << " stream not open for reading essential object from file "
45 << is.name()
46 << exit(FatalIOError);
47 }
48
49 if (IOobject::debug)
50 {
51 SeriousIOErrorInFunction(is)
52 << " stream not open for reading from file "
53 << is.name() << endl;
54 }
55
56 return false;
57 }
58
59 token firstToken(is);
60
61 if
62 (
63 is.good()
64 && firstToken.isWord()
65 && firstToken.wordToken() == "FoamFile"
66 )
67 {
68 dictionary headerDict(is);
69
70 is.version(headerDict.lookup("version"));
71 is.format(headerDict.lookup("format"));
72 headerClassName_ = word(headerDict.lookup("class"));
73
74 const word headerObject(headerDict.lookup("object"));
75 if (IOobject::debug && headerObject != name())
76 {
77 IOWarningInFunction(is)
78 << " object renamed from "
79 << name() << " to " << headerObject
80 << " for file " << is.name() << endl;
81 }
82
83 // The note entry is optional
84 headerDict.readIfPresent("note", note_);
85 }
86 else
87 {
88 IOWarningInFunction(is)

Callers 1

readFunction · 0.50

Calls 12

wordClass · 0.85
isWordMethod · 0.80
versionMethod · 0.80
lookupMethod · 0.80
formatMethod · 0.80
readIfPresentMethod · 0.80
writeHeaderFunction · 0.70
exitFunction · 0.50
nameFunction · 0.50
nameMethod · 0.45
goodMethod · 0.45
lineNumberMethod · 0.45

Tested by

no test coverage detected