Skip to content

Commit e60a9ae

Browse files
committed
added comments
1 parent e992d09 commit e60a9ae

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

examples/custom_integrator/problem.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,16 +46,19 @@ int main(int argc, char* argv[]) {
4646
struct reb_simulation* r_copy= reb_simulation_copy(r);
4747
r_copy->integrator = REB_INTEGRATOR_LEAPFROG;
4848

49+
// Choose CUSTOM integrator and setup function pointers.
50+
r->integrator = REB_INTEGRATOR_CUSTOM;
4951
struct reb_integrator custom = {
5052
.step = leapfrog_step,
5153
.synchronize = NULL, // Not needed. step() always returns particles in synchronized state.
5254
.reset = NULL, // No data stored, thus no reset required.
5355
.data = NULL, // No data stored.
5456
.data_size = 0 // No data stored.
5557
};
56-
57-
r->integrator = REB_INTEGRATOR_CUSTOM;
5858
r->ri_custom = custom;
59+
60+
// This would do the same as above in a more compact form (the pointers/variables default to NULL/0):
61+
// r->ri_custom.step = leapfrog_step;
5962

6063
// Integrate both simulations
6164
reb_simulation_integrate(r,10.);
@@ -71,6 +74,8 @@ int main(int argc, char* argv[]) {
7174
assert(p1.z==p2.z);
7275
}
7376

77+
printf("Simulations complete. Tests passed.\n");
78+
7479
// Cleanup
7580
reb_simulation_free(r);
7681
reb_simulation_free(r_copy);

0 commit comments

Comments
 (0)