()
| 70 | // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // |
| 71 | |
| 72 | void 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 | |
| 87 | Foam::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 | |
| 109 | Foam::functionObjects::abort::~abort() |
| 110 | {} |
| 111 | |
| 112 | |
| 113 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // |
| 114 | |
| 115 | bool 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 | } |
no test coverage detected