Skip to content

Commit 37ba7de

Browse files
committed
removed configure_box
1 parent 5798777 commit 37ba7de

41 files changed

Lines changed: 95 additions & 125 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

docs/boundaryconditions.md

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,14 @@ The syntax is as follows:
2727
=== "C"
2828
```c
2929
struct reb_simulation* r = reb_simulation_create();
30-
reb_simulation_configure_box(r, 10., 1, 1, 1); # confine the simulation to a box of size 10
30+
r->root_size = 10.0 # confine the simulation to a box of size 10
3131
r->boundary = REB_BOUNDARY_OPEN;
3232
```
3333

3434
=== "Python"
3535
```python
3636
sim = rebound.Simulation()
37-
sim.configure_box(10.) # confine the simulation to a box of size 10
37+
sim.root_size = 10.0 # confine the simulation to a box of size 10
3838
sim.boundary = "open"
3939
```
4040

@@ -46,14 +46,20 @@ The syntax is as follows:
4646
=== "C"
4747
```c
4848
struct reb_simulation* r = reb_simulation_create();
49-
reb_simulation_configure_box(r, 10., 1, 2, 3); # confine the simulation to a box of size 10x20x30
49+
r->root_size = 10.0
50+
r->N_root_x = 1 // 1 is the default
51+
r->N_root_y = 2
52+
r->N_root_z = 3 // confine the simulation to a box of size 10x20x30
5053
r->boundary = reb_boundary_periodic;
5154
```
5255

5356
=== "python"
5457
```python
5558
sim = rebound.simulation()
56-
sim.configure_box(10., 1, 2, 3) # confine the simulation to a box of size 10x20x30
59+
sim.root_size = 10.0
60+
sim.N_root_x = 1 # 1 is the default
61+
sim.N_root_y = 2
62+
sim.N_root_z = 3 # confine the simulation to a box of size 10x20x30
5763
sim.boundary = "periodic"
5864
```
5965

@@ -94,15 +100,15 @@ For more information on how to setup simulations of planetary rings in REBOUND,
94100
=== "C"
95101
```c
96102
struct reb_simulation* r = reb_simulation_create();
97-
reb_simulation_configure_box(r, 10., 1, 1, 1);
103+
r->root_size = 10.0
98104
r->OMEGA = 1.0;
99105
r->boundary = REB_BOUNDARY_SHEAR;
100106
```
101107

102108
=== "Python"
103109
```python
104110
sim = rebound.Simulation()
105-
sim.configure_box(10.)
111+
sim.root_size = 10.0
106112
sim.OMEGA = 1.0
107113
sim.boundary = "shear"
108114
```

docs/collisions.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,14 +69,14 @@ Below is an example on how to enable the tree based collision search.
6969
=== "C"
7070
```c
7171
struct reb_simulation* r = reb_simulation_create();
72-
reb_simulation_configure_box(r, 10, 1, 1, 1); # confine the simulation to a box of size 10
72+
r->root_size = 10.0; // confine the simulation to a box of size 10
7373
r->collision = REB_COLLISION_TREE;
7474
```
7575

7676
=== "Python"
7777
```python
7878
sim = rebound.Simulation()
79-
sim.configure_box(10) # confine the simulation to a box of size 10
79+
sim.root_size = 10.0 # confine the simulation to a box of size 10
8080
sim.collision = "tree"
8181
```
8282

@@ -92,14 +92,14 @@ Below is an example on how to enable the line-tree collision search.
9292
=== "C"
9393
```c
9494
struct reb_simulation* r = reb_simulation_create();
95-
reb_simulation_configure_box(r, 10, 1, 1, 1); # confine the simulation to a box of size 10
95+
r->root_size = 10.0; // confine the simulation to a box of size 10
9696
r->collision = REB_COLLISION_LINETREE;
9797
```
9898

9999
=== "Python"
100100
```python
101101
sim = rebound.Simulation()
102-
sim.configure_box(10) # confine the simulation to a box of size 10
102+
sim.root_size = 10.0 # confine the simulation to a box of size 10
103103
sim.collision = "linetree"
104104
```
105105

docs/mpi.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,9 @@ struct reb_simulation* r = reb_simulation_create();
3131
r->gravity = REB_GRAVITY_TREE;
3232
r->collision = REB_COLLISION_TREE;
3333
// other configuration options
34-
reb_simulation_configure_box(r, boxsize, 2, 2, 1);
34+
r->root_size = boxsize;
35+
r->N_root_x = 2;
36+
r->N_root_y = 2;
3537
```
3638

3739
The number of root trees needs to be an integer multiple of the number of MPI processes.

docs/simulation.md

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -42,25 +42,3 @@ It's the one structure you will work with most when using REBOUND.
4242
sim = None # free simulation
4343
print(sim.particles) # segmentation fault
4444
```
45-
46-
There are several instances where you need to initialize a simulation's root boxes:
47-
48-
- If you use a tree code for collision detection or for calculating gravity.
49-
- If you want to use open, periodic or shear-periodic boundary conditions.
50-
51-
Initializing root boxes is done after the simulation is created:
52-
=== "C"
53-
```c
54-
struct reb_simulation* r = reb_simulation_create();
55-
double size = 100.;
56-
reb_simulation_configure_box(r, size, 1, 2, 3);
57-
```
58-
=== "Python"
59-
```python
60-
sim = rebound.Simulation()
61-
size = 100.
62-
sim.configure_box(size, 1, 2, 3);
63-
```
64-
In the above example, there is one root box in the x direction, there are two in the y direction, and three in the z direction.
65-
In most cases you want exactly one root box in each direction.
66-

examples/animation_saturns_rings/problem.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,10 @@ int main(int argc, char* argv[]) {
5050
r->G = 6.67428e-11; // N / (1e-5 kg)^2 m^2
5151
r->softening = 0.1; // m
5252
r->dt = 1e-3*2.*M_PI/r->ri_sei.OMEGA; // s
53-
54-
reb_simulation_configure_box(r, 100, 2, 2, 1); // 100m box
53+
54+
r->root_size = 100.0;
55+
r->N_root_x = 2;
56+
r->N_root_y = 2;
5557
r->N_ghost_x = 2; r->N_ghost_y = 2; r->N_ghost_z = 0;
5658

5759
// Add all ring particles

examples/bouncing_balls/problem.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ int main(int argc, char* argv[]){
2424
r->usleep = 1000; // Slow down integration (for visualization only)
2525
r->dt = 1e-2;
2626

27-
reb_simulation_configure_box(r, 3.0, 1, 1, 1);
27+
r->root_size = 3;
2828

2929
// Initial conditions
3030
{

examples/bouncing_balls_corners/problem.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ int main(int argc, char* argv[]){
2626
r->dt = 1e-3;
2727
r->boundary = REB_BOUNDARY_PERIODIC;
2828
r->usleep = 1000; // Slow down integration (for visualization only)
29-
reb_simulation_configure_box(r,3.,1,1,1);
29+
r->root_size = 3;
3030

3131
// Initial conditions
3232
int problem_id = 1;

examples/bouncing_string/problem.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,10 @@ int main(int argc, char* argv[]){
2626
r->gravity = REB_GRAVITY_NONE;
2727
r->usleep = 5000; // Slow down integration (for visualization only)
2828

29-
reb_simulation_configure_box(r,10.,3,1,1); // boxsize 10., three root boxes in x direction, one in y and z
29+
// boxsize 10., three root boxes in x direction, one in y and z
30+
r->root_size = 10.0;
31+
r->N_root_x = 2;
32+
3033
r->N_ghost_x = 1;
3134
r->N_ghost_y = 1;
3235
r->N_ghost_z = 0;

examples/granulardynamics/problem.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ int main(int argc, char* argv[]){
3232
// Override default collision handling to account for border particles
3333
r->collision_resolve = collision_resolve_hardsphere_withborder;
3434
r->heartbeat = heartbeat;
35-
reb_simulation_configure_box(r, 20., 1, 1, 4);
35+
r->root_size = 20.0;
36+
r->N_root_z = 4;
3637

3738
r->N_ghost_x = 1; r->N_ghost_y = 1; r->N_ghost_z = 0;
3839
struct reb_vec3d boxsize = {

examples/mpi_unittests/problem.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,9 @@ void test_twobody(){
3232
r->opening_angle2 = 1.5;
3333
r->G = 1;
3434
r->dt = 0.1;
35-
reb_simulation_configure_box(r,30,2,2,1);
35+
r->root_size = 30;
36+
r->N_root_x = 2;
37+
r->N_root_y = 2;
3638

3739
printf("MPI init...\n");
3840
reb_mpi_init(r);

0 commit comments

Comments
 (0)