| 34 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // |
| 35 | |
| 36 | bool 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(); |
no test coverage detected