In [1]:
%matplotlib inline
import numpy as np
from matplotlib import pyplot as plt
plt.style.use('bmh')
In [54]:
# function to reallocate active particles to the front of all local arrays
# active_n = "number of active particles after sending, before receiving. aka. particles that stays in its own rank"
def move_active_to_front(particle_local, particle_x_local, particle_active_local, active_n):
particle_local[:active_n] = particle_local[particle_active_local]
particle_x_local[:active_n] = particle_x_local[particle_active_local]
# set the corresponding first particles to active, the rest to false
particle_active_local[:active_n] = True
particle_active_local[active_n:] = False
In [81]:
l = np.arange(6)
a = np.zeros(6, dtype = bool)
a[:] = [True, False, True, True, False, False]
a_n = 3
r = np.arange(6, 9)
r_n = 3
In [85]:
l.resize(7, refcheck=False)
l
Out[85]:
In [86]:
a.resize(7, refcheck=False)
a
Out[86]:
In [87]:
l[:0] = l[a]
In [3]:
a = np.array([1,2,3,4,5,6])
a
Out[3]:
In [5]:
b = a.reshape(2,3)
b
Out[5]:
In [7]:
b[0,0] = 5
a
Out[7]:
In [16]:
h = []
In [17]:
if h:
print('y')
In [ ]: