Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions c/leapfrog.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
#include <stdlib.h>
#include <math.h>

void integrator_leapfrog_part1(int n_particles, double x[][3], double v[][3], double half_time_step){
void integrator_leapfrog_part1(int n_particles, double x[restrict][3], double v[restrict][3], double half_time_step){
for (int i=0;i<n_particles;i++){
x[i][0] += half_time_step * v[i][0];
x[i][1] += half_time_step * v[i][1];
x[i][2] += half_time_step * v[i][2];
}
}
void integrator_leapfrog_part2(int n_particles, double x[][3], double v[][3], double a[][3], double time_step, double half_time_step){
void integrator_leapfrog_part2(int n_particles, double x[restrict][3], double v[restrict][3], double a[restrict][3], double time_step, double half_time_step){
for (int i=0;i<n_particles;i++){
v[i][0] += time_step * a[i][0];
v[i][1] += time_step * a[i][1];
Expand All @@ -20,7 +20,7 @@ void integrator_leapfrog_part2(int n_particles, double x[][3], double v[][3], do
}
}

void gravity_calculate_acceleration(int n_particles, double m[], double x[][3], double a[][3]) {
void gravity_calculate_acceleration(int n_particles, double m[restrict], double x[restrict][3], double a[restrict][3]) {
double G = 6.6742367e-11; // m^3.kg^-1.s^-2
for (int i=0; i<n_particles; i++){
a[i][0] = 0;
Expand Down