Skip to content

Commit 0743151

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 096fbdc commit 0743151

File tree

4 files changed

+46
-46
lines changed

4 files changed

+46
-46
lines changed

galpy/orbit/Orbits.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1286,7 +1286,7 @@ def check_integrator(method, no_symplec=False):
12861286
"rk6_c",
12871287
"dopr54_c",
12881288
"dop853_c",
1289-
"ias15_c"
1289+
"ias15_c",
12901290
]
12911291
if no_symplec:
12921292
symplec_methods = [

galpy/orbit/integratePlanarOrbit.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -619,7 +619,7 @@ def _parse_integrator(int_method):
619619
elif int_method.lower() == "dop853_c":
620620
int_method_c = 6
621621
elif int_method.lower() == "ias15_c":
622-
int_method_c = 7
622+
int_method_c = 7
623623
else:
624624
int_method_c = 0
625625
return int_method_c

galpy/util/wez_ias15.c

+42-42
Original file line numberDiff line numberDiff line change
@@ -208,18 +208,18 @@ IAS15 integrator
208208
void wez_ias15(void (*func)(double t, double *q, double *a, int nargs, struct potentialArg * potentialArgs),
209209
int dim,
210210
double * yo,
211-
int nt,
212-
double dt,
211+
int nt,
212+
double dt,
213213
double *t,
214-
int nargs,
214+
int nargs,
215215
struct potentialArg * potentialArgs,
216-
double rtol,
216+
double rtol,
217217
double atol,
218-
double *result,
218+
double *result,
219219
int * err){
220220
//Declare and initialize
221221
double *x= (double *) malloc ( dim * sizeof(double) );
222-
double *v= (double *) malloc ( dim * sizeof(double) );
222+
double *v= (double *) malloc ( dim * sizeof(double) );
223223
double *a= (double *) malloc ( dim * sizeof(double) );
224224
double *xs= (double *) malloc ( dim * sizeof(double) ); //x substep
225225

@@ -238,7 +238,7 @@ void wez_ias15(void (*func)(double t, double *q, double *a, int nargs, struct po
238238

239239
x-= dim;
240240
v-= dim;
241-
241+
242242
double diff_G;
243243

244244
save_ias15(dim, x, v, result);
@@ -248,9 +248,9 @@ void wez_ias15(void (*func)(double t, double *q, double *a, int nargs, struct po
248248
//Estimate necessary stepsize, use the returned time interval if the user does not provide
249249
double init_dt= (*(t+1))-(*t);
250250
if ( dt == -9999.99 ) {
251-
dt = init_dt;
251+
dt = init_dt;
252252
}
253-
253+
254254
long ndt= (long) (init_dt/dt);
255255
int timestep_sign;
256256
if(init_dt > 0){
@@ -287,7 +287,7 @@ void wez_ias15(void (*func)(double t, double *q, double *a, int nargs, struct po
287287

288288
while(time_remaining > 0) {
289289
double to_temp;
290-
double dt_temp;
290+
double dt_temp;
291291
if (time_remaining < fabs(dt)){
292292
dt_temp = timestep_sign * time_remaining;
293293
} else {
@@ -304,7 +304,7 @@ void wez_ias15(void (*func)(double t, double *q, double *a, int nargs, struct po
304304

305305
int iterations = 0;
306306
double integrator_error = integrator_error_threshold + 1; //init value above the threshold
307-
while(true){
307+
while(true){
308308
if(iterations == 12){
309309
//TODO: spit the dummy
310310
//printf("Iterations took over 12, break iteration, break iteration loop\n");
@@ -316,7 +316,7 @@ void wez_ias15(void (*func)(double t, double *q, double *a, int nargs, struct po
316316

317317
//at start of each step reset xs
318318
for (int l=0; l < dim; l++) *(xs+l)= *(x+l);
319-
319+
320320
double max_delta_B6 = 0.0; //also = max delta G
321321
double max_a = 0.0;
322322
for (int k=1; k < (order + 1); k++){
@@ -349,7 +349,7 @@ void wez_ias15(void (*func)(double t, double *q, double *a, int nargs, struct po
349349
iterations += 1;
350350
}
351351

352-
//global error strategy for timestep
352+
//global error strategy for timestep
353353
double max_B6 = 0.0;
354354
double max_a = 0.0;
355355
for (int i=0; i < dim; i++){
@@ -367,7 +367,7 @@ void wez_ias15(void (*func)(double t, double *q, double *a, int nargs, struct po
367367

368368
if(fabs(dt_temp) > fabs(dt_required)){
369369
//rejected, try again with dt required
370-
dt = dt_required;
370+
dt = dt_required;
371371
} else {
372372
//accepted, update position/velocity and do next timestep with dt required
373373
time_remaining -= fabs(dt); //will eventually get negative as we stepped forward the minimum of dt and time_remaining
@@ -376,9 +376,9 @@ void wez_ias15(void (*func)(double t, double *q, double *a, int nargs, struct po
376376
update_position(x, x, v, dim, 1, dt_temp, Fs, Bs);
377377
update_velocity(v, v, dim, 1, dt_temp, Fs , Bs);
378378
next_sequence_Bs(1, Bs, Es, BDs, dim);
379-
379+
380380
//finally, update the next step
381-
dt = dt_required;
381+
dt = dt_required;
382382
}
383383
}
384384

@@ -405,36 +405,36 @@ void wez_ias15(void (*func)(double t, double *q, double *a, int nargs, struct po
405405
}
406406

407407
void update_velocity(double *v, double *v1, int dim, double h_n, double T, double * Fs , double * Bs){
408-
for (int ii=0; ii < dim; ii++){
409-
*(v+ii) = *(v1+ii) +
410-
(h_n * T *
411-
(Fs[ii * (order + 1) + 0] + h_n *
412-
(Bs[ii * order + 0]/2 + h_n *
413-
(Bs[ii * order + 1]/3 + h_n *
414-
(Bs[ii * order + 2]/4 + h_n *
415-
(Bs[ii * order + 3]/5 + h_n *
416-
(Bs[ii * order + 4]/6 + h_n *
417-
(Bs[ii * order + 5]/7 + h_n *
418-
(Bs[ii * order + 6]/8 //+ h_n *
408+
for (int ii=0; ii < dim; ii++){
409+
*(v+ii) = *(v1+ii) +
410+
(h_n * T *
411+
(Fs[ii * (order + 1) + 0] + h_n *
412+
(Bs[ii * order + 0]/2 + h_n *
413+
(Bs[ii * order + 1]/3 + h_n *
414+
(Bs[ii * order + 2]/4 + h_n *
415+
(Bs[ii * order + 3]/5 + h_n *
416+
(Bs[ii * order + 4]/6 + h_n *
417+
(Bs[ii * order + 5]/7 + h_n *
418+
(Bs[ii * order + 6]/8 //+ h_n *
419419
//(Bs[ii * order + 7]/9
420420
)))))))));
421421
}
422422
}
423-
423+
424424

425425
void update_position(double *y, double *y1, double *v, int dim, double h_n, double T, double * Fs, double * Bs){
426-
for (int ii=0; ii < dim; ii++){
427-
*(y+ii) = *(y1+ii) +
428-
(*(v+ii) * h_n * T) +
429-
((h_n * T)*(h_n * T)) *
430-
(Fs[ii * (order + 1) + 0]/2 + h_n *
431-
(Bs[ii * order + 0]/6 + h_n *
432-
(Bs[ii * order + 1]/12 + h_n *
433-
(Bs[ii * order + 2]/20 + h_n *
434-
(Bs[ii * order + 3]/30 + h_n *
435-
(Bs[ii * order + 4]/42 + h_n *
436-
(Bs[ii * order + 5]/56 + h_n *
437-
(Bs[ii * order + 6]/72 //+ h_n *
426+
for (int ii=0; ii < dim; ii++){
427+
*(y+ii) = *(y1+ii) +
428+
(*(v+ii) * h_n * T) +
429+
((h_n * T)*(h_n * T)) *
430+
(Fs[ii * (order + 1) + 0]/2 + h_n *
431+
(Bs[ii * order + 0]/6 + h_n *
432+
(Bs[ii * order + 1]/12 + h_n *
433+
(Bs[ii * order + 2]/20 + h_n *
434+
(Bs[ii * order + 3]/30 + h_n *
435+
(Bs[ii * order + 4]/42 + h_n *
436+
(Bs[ii * order + 5]/56 + h_n *
437+
(Bs[ii * order + 6]/72 //+ h_n *
438438
//(Bs[ii * order + 7]/90)
439439
))))))));
440440
}
@@ -532,7 +532,7 @@ void update_Bs_from_Gs(int current_truncation_order, int i, double * Bs, double
532532
Bs[j + 2] += diff_G * c_4_2;
533533
Bs[j + 3] += diff_G * c_4_3;
534534
Bs[j + 4] += diff_G;
535-
}
535+
}
536536
if (current_truncation_order == 6){
537537
Bs[j ] += diff_G * c_5_0;
538538
Bs[j + 1] += diff_G * c_5_1;
@@ -550,4 +550,4 @@ void update_Bs_from_Gs(int current_truncation_order, int i, double * Bs, double
550550
Bs[j + 5] += diff_G * c_6_5;
551551
Bs[j + 6] += diff_G;
552552
}
553-
}
553+
}

tests/test_orbit.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -9477,7 +9477,7 @@ def test_integrate_negative_time():
94779477
"symplec6_c",
94789478
"dopr54_c",
94799479
"dop853_c",
9480-
"ias15_c"
9480+
"ias15_c",
94819481
]
94829482
# negative time to negative time
94839483
times = numpy.linspace(-70.0, -30.0, 1001)
@@ -9514,7 +9514,7 @@ def test_integrate_backwards():
95149514
"symplec6_c",
95159515
"dopr54_c",
95169516
"dop853_c",
9517-
"ias15_c"
9517+
"ias15_c",
95189518
]
95199519
# negative time to negative time
95209520
times = numpy.linspace(-30.0, -70.0, 1001)

0 commit comments

Comments
 (0)