Skip to content

Commit

Permalink
copy ok
Browse files Browse the repository at this point in the history
  • Loading branch information
hannorein committed Oct 29, 2023
1 parent 56ccbc0 commit 4196885
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/display.c
Original file line number Diff line number Diff line change
Expand Up @@ -1141,17 +1141,17 @@ int reb_display_copy_data(struct reb_simulation* const r){
if (r->N==0) return 0;
struct reb_display_data* data = r->display_data;
int size_changed = 0;
if (data->r_copy==NULL){
data->r_copy = reb_simulation_create();
}
if (r->N>data->N_allocated){
size_changed = 1;
data->N_allocated = r->N;
data->r_copy = realloc(data->r_copy,sizeof(struct reb_simulation));
data->particles_copy = realloc(data->particles_copy,r->N*sizeof(struct reb_particle));
data->particle_data = realloc(data->particle_data, data->N_allocated*sizeof(struct reb_particle_opengl));
data->orbit_data = realloc(data->orbit_data, data->N_allocated*sizeof(struct reb_orbit_opengl));
}
memcpy(data->r_copy, r, sizeof(struct reb_simulation));
memcpy(data->particles_copy, r->particles, sizeof(struct reb_particle)*r->N);
data->r_copy->particles = data->particles_copy;
enum reb_simulation_binary_error_codes warnings = REB_SIMULATION_BINARY_WARNING_NONE;
reb_simulation_copy_with_messages(data->r_copy,r,&warnings);
if (
(r->integrator==REB_INTEGRATOR_WHFAST && r->ri_whfast.is_synchronized==0)
)
Expand Down

0 comments on commit 4196885

Please sign in to comment.