| 191 | } |
| 192 | |
| 193 | void |
| 194 | Castro::TimestampParticles (int ngrow) |
| 195 | { |
| 196 | static bool first = true; |
| 197 | static int imax = -1; |
| 198 | if (first) |
| 199 | { |
| 200 | first = false; |
| 201 | |
| 202 | // have to do it here, not in read_particle_params, because Density, ..., are set after |
| 203 | // read_particle_params is called. |
| 204 | if (particles::timestamp_density) { |
| 205 | timestamp_indices.push_back(URHO); |
| 206 | std::cout << "Density = " << URHO << std::endl; |
| 207 | } |
| 208 | if (particles::timestamp_temperature) { |
| 209 | timestamp_indices.push_back(UTEMP); |
| 210 | std::cout << "Temp = " << UTEMP << std::endl; |
| 211 | } |
| 212 | |
| 213 | if (!timestamp_indices.empty()) { |
| 214 | imax = *(std::max_element(timestamp_indices.begin(), timestamp_indices.end())); |
| 215 | } |
| 216 | } |
| 217 | |
| 218 | if ( TracerPC && !particles::timestamp_dir.empty()) |
| 219 | { |
| 220 | std::string basename = particles::timestamp_dir; |
| 221 | |
| 222 | if (basename[basename.length()-1] != '/') basename += '/'; |
| 223 | |
| 224 | basename += "Timestamp"; |
| 225 | |
| 226 | int finest_level = parent->finestLevel(); |
| 227 | Real time = state[State_Type].curTime(); |
| 228 | |
| 229 | for (int lev = level; lev <= finest_level; lev++) |
| 230 | { |
| 231 | if (TracerPC->NumberOfParticlesAtLevel(lev) <= 0) continue; |
| 232 | |
| 233 | MultiFab& S_new = parent->getLevel(lev).get_new_data(State_Type); |
| 234 | |
| 235 | if (imax >= 0) { // FillPatchIterator will fail otherwise |
| 236 | int ng = (lev == level) ? ngrow : 1; |
| 237 | FillPatchIterator fpi(parent->getLevel(lev), S_new, |
| 238 | ng, time, State_Type, 0, imax+1); |
| 239 | const MultiFab& S = fpi.get_mf(); |
| 240 | TracerPC->Timestamp(basename, S , lev, time, timestamp_indices); |
| 241 | } else { |
| 242 | TracerPC->Timestamp(basename, S_new, lev, time, timestamp_indices); |
| 243 | } |
| 244 | } |
| 245 | } |
| 246 | } |
| 247 | |
| 248 | #endif |
| 249 | |