diff --git a/PunctureTracker/schedule.ccl b/PunctureTracker/schedule.ccl index 4d4cb402..523d46e6 100644 --- a/PunctureTracker/schedule.ccl +++ b/PunctureTracker/schedule.ccl @@ -23,6 +23,7 @@ SCHEDULE PunctureTracker_Setup IN PunctureTracker_SetupGroup OPTIONS: GLOBAL READS: pt_loc READS: pt_vel + READS: BoxInBox::positions WRITES: BoxInBox::positions } "Calculate initial location of punctures" @@ -31,6 +32,7 @@ SCHEDULE PunctureTracker_Track AT evol AFTER ODESolvers_Solve LANG: C OPTIONS: GLOBAL READS: ADMBaseX::shift(everywhere) + READS: BoxInBox::positions WRITES: pt_loc WRITES: pt_vel WRITES: BoxInBox::positions diff --git a/PunctureTracker/src/puncture_tracker.cxx b/PunctureTracker/src/puncture_tracker.cxx index b76f9020..0b971be1 100644 --- a/PunctureTracker/src/puncture_tracker.cxx +++ b/PunctureTracker/src/puncture_tracker.cxx @@ -81,6 +81,7 @@ extern "C" void PunctureTracker_Setup(CCTK_ARGUMENTS) { // enabled if refinement regions should follow the punctures if (track_boxes) { + assert(nPunctures <= 3); // BoxInBox currently hardcodes position[3] const std::array, Loop::dim> &location = g_punctures->getLocation(); for (int n = 0; n < nPunctures; ++n) { @@ -164,15 +165,26 @@ extern "C" void PunctureTracker_Track(CCTK_ARGUMENTS) { g_punctures->broadcast(CCTK_PASS_CTOC); // Write to pt_loc_foo and pt_vel_foo - for (int i = 0; i < nPunctures; ++i) { - pt_loc_t[i] = time[i]; - pt_loc_x[i] = location[0][i]; - pt_loc_y[i] = location[1][i]; - pt_loc_z[i] = location[2][i]; - pt_vel_t[i] = time[i]; - pt_vel_x[i] = velocity[0][i]; - pt_vel_y[i] = velocity[1][i]; - pt_vel_z[i] = velocity[2][i]; + for (int i = 0; i < max_num_tracked; ++i) { + if (i < nPunctures) { + pt_loc_t[i] = time[i]; + pt_loc_x[i] = location[0][i]; + pt_loc_y[i] = location[1][i]; + pt_loc_z[i] = location[2][i]; + pt_vel_t[i] = time[i]; + pt_vel_x[i] = velocity[0][i]; + pt_vel_y[i] = velocity[1][i]; + pt_vel_z[i] = velocity[2][i]; + } else { + pt_loc_t[i] = 0.0; + pt_loc_x[i] = 0.0; + pt_loc_y[i] = 0.0; + pt_loc_z[i] = 0.0; + pt_vel_t[i] = 0.0; + pt_vel_x[i] = 0.0; + pt_vel_y[i] = 0.0; + pt_vel_z[i] = 0.0; + } } if (track_boxes) {