| 125 | |
| 126 | |
| 127 | void Foam::Time::setControls() |
| 128 | { |
| 129 | // default is to resume calculation from "latestTime" |
| 130 | const word startFrom = controlDict_.lookupOrDefault<word> |
| 131 | ( |
| 132 | "startFrom", |
| 133 | "latestTime" |
| 134 | ); |
| 135 | |
| 136 | if (startFrom == "startTime") |
| 137 | { |
| 138 | controlDict_.lookup("startTime") >> startTime_; |
| 139 | } |
| 140 | else |
| 141 | { |
| 142 | // Search directory for valid time directories |
| 143 | instantList timeDirs = findTimes(path(), constant()); |
| 144 | |
| 145 | if (startFrom == "firstTime") |
| 146 | { |
| 147 | if (timeDirs.size()) |
| 148 | { |
| 149 | if (timeDirs[0].name() == constant() && timeDirs.size() >= 2) |
| 150 | { |
| 151 | startTime_ = timeDirs[1].value(); |
| 152 | } |
| 153 | else |
| 154 | { |
| 155 | startTime_ = timeDirs[0].value(); |
| 156 | } |
| 157 | } |
| 158 | } |
| 159 | else if (startFrom == "latestTime") |
| 160 | { |
| 161 | if (timeDirs.size()) |
| 162 | { |
| 163 | startTime_ = timeDirs.last().value(); |
| 164 | } |
| 165 | } |
| 166 | else |
| 167 | { |
| 168 | FatalIOErrorInFunction(controlDict_) |
| 169 | << "expected startTime, firstTime or latestTime" |
| 170 | << " found '" << startFrom << "'" |
| 171 | << exit(FatalIOError); |
| 172 | } |
| 173 | } |
| 174 | |
| 175 | setTime(startTime_, 0); |
| 176 | |
| 177 | readDict(); |
| 178 | deltaTSave_ = deltaT_; |
| 179 | deltaT0_ = deltaT_; |
| 180 | |
| 181 | // Check if time directory exists |
| 182 | // If not increase time precision to see if it is formatted differently. |
| 183 | if (!fileHandler().exists(timePath(), false)) |
| 184 | { |
no test coverage detected