| 1477 | } |
| 1478 | |
| 1479 | void |
| 1480 | Castro::init (AmrLevel &old) |
| 1481 | { |
| 1482 | BL_PROFILE("Castro::init(old)"); |
| 1483 | |
| 1484 | auto* oldlev = dynamic_cast<Castro*>(&old); |
| 1485 | |
| 1486 | // |
| 1487 | // Create new grid data by fillpatching from old. |
| 1488 | // |
| 1489 | Real dt_new = parent->dtLevel(level); |
| 1490 | Real cur_time = oldlev->state[State_Type].curTime(); |
| 1491 | Real prev_time = oldlev->state[State_Type].prevTime(); |
| 1492 | Real dt_old = cur_time - prev_time; |
| 1493 | setTimeLevel(cur_time,dt_old,dt_new); |
| 1494 | |
| 1495 | for (int s = 0; s < num_state_type; ++s) { |
| 1496 | MultiFab& state_MF = get_new_data(s); |
| 1497 | FillPatch(old, state_MF, state_MF.nGrow(), cur_time, s, 0, state_MF.nComp()); |
| 1498 | if (oldlev->state[s].hasOldData()) { |
| 1499 | if (!state[s].hasOldData()) { |
| 1500 | state[s].allocOldData(); |
| 1501 | } |
| 1502 | MultiFab& old_state_MF = get_old_data(s); |
| 1503 | FillPatch(old, old_state_MF, old_state_MF.nGrow(), prev_time, s, 0, old_state_MF.nComp()); |
| 1504 | } |
| 1505 | } |
| 1506 | |
| 1507 | // Copy some other data we need from the old class. |
| 1508 | // One reason this is necessary is if we are doing |
| 1509 | // a post-timestep regrid -- then we're going to need |
| 1510 | // to save information about whether there was a retry |
| 1511 | // during the timestep. |
| 1512 | |
| 1513 | iteration = oldlev->iteration; |
| 1514 | sub_iteration = oldlev->sub_iteration; |
| 1515 | |
| 1516 | sub_ncycle = oldlev->sub_ncycle; |
| 1517 | dt_subcycle = oldlev->dt_subcycle; |
| 1518 | dt_advance = oldlev->dt_advance; |
| 1519 | |
| 1520 | keep_prev_state = oldlev->keep_prev_state; |
| 1521 | |
| 1522 | in_retry = oldlev->in_retry; |
| 1523 | |
| 1524 | } |
| 1525 | |
| 1526 | // |
| 1527 | // This version inits the data on a new level that did not |