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

Function exists

src/OpenFOAM/db/Time/findInstance.C:38–78  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

36// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
37
38bool Foam::Time::exists(IOobject& io)
39{
40 // Generate filename for object
41 fileName objPath(fileHandler().objectPath(io, word::null));
42
43 // Test for either directory or a (valid) file & IOobject
44 bool ok;
45 if (io.name().empty())
46 {
47 ok = fileHandler().isDir(objPath);
48 }
49 else
50 {
51 ok =
52 fileHandler().isFile(objPath)
53 && io.typeHeaderOk<IOList<label>>(false);// object with local scope
54 }
55
56 if (!ok)
57 {
58 // Re-test with raw objectPath. This is for backwards
59 // compatibility
60 fileName originalPath(io.objectPath());
61 if (originalPath != objPath)
62 {
63 // Test for either directory or a (valid) file & IOobject
64 if (io.name().empty())
65 {
66 ok = fileHandler().isDir(originalPath);
67 }
68 else
69 {
70 ok =
71 fileHandler().isFile(originalPath)
72 && io.typeHeaderOk<IOList<label>>(false);
73 }
74 }
75 }
76
77 return ok;
78}
79
80
81Foam::word Foam::Time::findInstance

Callers 2

findInstance.CFile · 0.70
upToDateFunction · 0.50

Calls 3

fileHandlerFunction · 0.85
emptyMethod · 0.45
nameMethod · 0.45

Tested by

no test coverage detected