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

Function removeFile

src/functionObjects/utilities/abort/abort.C:72–129  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

70// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
71
72void Foam::functionObjects::abort::removeFile() const
73{
74 bool hasAbort = isFile(abortFile_);
75 reduce(hasAbort, orOp<bool>());
76
77 if (hasAbort && Pstream::master())
78 {
79 // Cleanup ABORT file (on master only)
80 rm(abortFile_);
81 }
82}
83
84
85// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
86
87Foam::functionObjects::abort::abort
88(
89 const word& name,
90 const Time& runTime,
91 const dictionary& dict
92)
93:
94 functionObject(name),
95 time_(runTime),
96 abortFile_("$FOAM_CASE/" + name),
97 action_(nextWrite)
98{
99 abortFile_.expand();
100 read(dict);
101
102 // Remove any old files from previous runs
103 removeFile();
104}
105
106
107// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
108
109Foam::functionObjects::abort::~abort()
110{}
111
112
113// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
114
115bool Foam::functionObjects::abort::read(const dictionary& dict)
116{
117 if (dict.found("action"))
118 {
119 action_ = actionTypeNames_.read(dict.lookup("action"));
120 }
121 else
122 {
123 action_ = nextWrite;
124 }
125
126 if (dict.readIfPresent("file", abortFile_))
127 {
128 abortFile_.expand();
129 }

Callers 1

endFunction · 0.85

Calls 2

functionObjectClass · 0.85
isFileFunction · 0.50

Tested by

no test coverage detected