| 161 | |
| 162 | |
| 163 | void Foam::fvMesh::storeOldVol(const scalarField& V) |
| 164 | { |
| 165 | if (curTimeIndex_ < time().timeIndex()) |
| 166 | { |
| 167 | if (debug) |
| 168 | { |
| 169 | InfoInFunction |
| 170 | << " Storing old time volumes since from time " << curTimeIndex_ |
| 171 | << " and time now " << time().timeIndex() |
| 172 | << " V:" << V.size() |
| 173 | << endl; |
| 174 | } |
| 175 | |
| 176 | |
| 177 | if (V00Ptr_ && V0Ptr_) |
| 178 | { |
| 179 | // Copy V0 into V00 storage |
| 180 | *V00Ptr_ = *V0Ptr_; |
| 181 | } |
| 182 | |
| 183 | if (V0Ptr_) |
| 184 | { |
| 185 | // Copy V into V0 storage |
| 186 | V0Ptr_->scalarField::operator=(V); |
| 187 | } |
| 188 | else |
| 189 | { |
| 190 | // Allocate V0 storage, fill with V |
| 191 | V0Ptr_ = new DimensionedField<scalar, volMesh> |
| 192 | ( |
| 193 | IOobject |
| 194 | ( |
| 195 | "V0", |
| 196 | time().timeName(), |
| 197 | *this, |
| 198 | IOobject::NO_READ, |
| 199 | IOobject::NO_WRITE, |
| 200 | false |
| 201 | ), |
| 202 | *this, |
| 203 | dimVolume |
| 204 | ); |
| 205 | scalarField& V0 = *V0Ptr_; |
| 206 | // Note: V0 now sized with current mesh, not with (potentially |
| 207 | // different size) V. |
| 208 | V0.setSize(V.size()); |
| 209 | V0 = V; |
| 210 | } |
| 211 | |
| 212 | curTimeIndex_ = time().timeIndex(); |
| 213 | |
| 214 | if (debug) |
| 215 | { |
| 216 | InfoInFunction |
| 217 | << " Stored old time volumes V0:" << V0Ptr_->size() |
| 218 | << endl; |
| 219 | if (V00Ptr_) |
| 220 | { |