tFix py3 comparison between spherebin objects - sphere - GPU-based 3D discrete element method algorithm with optional fluid coupling
HTML git clone git://src.adamsgaard.dk/sphere
DIR Log
DIR Files
DIR Refs
DIR LICENSE
---
DIR commit c9010365df6b8487979979d26574c26e8f858d3b
DIR parent 93256b5eb3dd7b1cee22f18d94892fe676eebe5d
HTML Author: Anders Damsgaard <anders@adamsgaard.dk>
Date: Thu, 15 Aug 2019 15:58:43 +0200
Fix py3 comparison between spherebin objects
Diffstat:
M python/sphere.py | 196 ++++++++++++++++----------------
1 file changed, 98 insertions(+), 98 deletions(-)
---
DIR diff --git a/python/sphere.py b/python/sphere.py
t@@ -453,282 +453,282 @@ class sim:
# Particle color marker
self.color = numpy.zeros(self.np, dtype=numpy.int32)
- def __cmp__(self, other):
+ def __eq__(self, other):
'''
Called when to sim objects are compared. Returns 0 if the values
are identical.
'''
if self.version != other.version:
print('version')
- return 1
+ return False
elif self.nd != other.nd:
print('nd')
- return 2
+ return False
elif self.np != other.np:
print('np')
- return 4
+ return False
elif self.time_dt != other.time_dt:
print('time_dt')
- return 5
+ return False
elif self.time_current != other.time_current:
print('time_current')
- return 6
+ return False
elif self.time_total != other.time_total:
print('time_total')
- return 7
+ return False
elif self.time_file_dt != other.time_file_dt:
print('time_file_dt')
- return 8
+ return False
elif self.time_step_count != other.time_step_count:
print('time_step_count')
- return 9
+ return False
elif (self.origo != other.origo).any():
print('origo')
- return 10
+ return False
elif (self.L != other.L).any():
print('L')
return 11
elif (self.num != other.num).any():
print('num')
- return 12
+ return False
elif self.periodic != other.periodic:
print('periodic')
- return 13
+ return False
elif self.adaptive != other.adaptive:
print('adaptive')
- return 13.5
+ return False
elif (self.x != other.x).any():
print('x')
- return 14
+ return False
elif (self.radius != other.radius).any():
print('radius')
- return 15
+ return False
elif (self.xyzsum != other.xyzsum).any():
print('xyzsum')
- return 16
+ return False
elif (self.vel != other.vel).any():
print('vel')
- return 17
+ return False
elif (self.fixvel != other.fixvel).any():
print('fixvel')
- return 18
+ return False
elif (self.force != other.force).any():
print('force')
- return 19
+ return False
elif (self.angpos != other.angpos).any():
print('angpos')
- return 20
+ return False
elif (self.angvel != other.angvel).any():
print('angvel')
- return 21
+ return False
elif (self.torque != other.torque).any():
print('torque')
- return 22
+ return False
elif (self.es_dot != other.es_dot).any():
print('es_dot')
- return 23
+ return False
elif (self.es != other.es).any():
print('es')
- return 24
+ return False
elif (self.ev_dot != other.ev_dot).any():
print('ev_dot')
- return 25
+ return False
elif (self.ev != other.ev).any():
print('ev')
- return 26
+ return False
elif (self.p != other.p).any():
print('p')
- return 27
+ return False
elif (self.g != other.g).any():
print('g')
- return 28
+ return False
elif self.k_n != other.k_n:
print('k_n')
- return 29
+ return False
elif self.k_t != other.k_t:
print('k_t')
- return 30
+ return False
elif self.k_r != other.k_r:
print('k_r')
- return 31
+ return False
elif self.E != other.E:
print('E')
- return 31.5
+ return False
elif self.gamma_n != other.gamma_n:
print('gamma_n')
- return 32
+ return False
elif self.gamma_t != other.gamma_t:
print('gamma_t')
- return 33
+ return False
elif self.gamma_r != other.gamma_r:
print('gamma_r')
- return 34
+ return False
elif self.mu_s != other.mu_s:
print('mu_s')
- return 35
+ return False
elif self.mu_d != other.mu_d:
print('mu_d')
- return 36
+ return False
elif self.mu_r != other.mu_r:
print('mu_r')
- return 37
+ return False
elif self.rho != other.rho:
print('rho')
- return 38
+ return False
elif self.contactmodel != other.contactmodel:
print('contactmodel')
- return 39
+ return False
elif self.kappa != other.kappa:
print('kappa')
- return 40
+ return False
elif self.db != other.db:
print('db')
- return 41
+ return False
elif self.V_b != other.V_b:
print('V_b')
- return 42
+ return False
elif self.nw != other.nw:
print('nw')
- return 43
+ return False
elif (self.wmode != other.wmode).any():
print('wmode')
- return 44
+ return False
elif (self.w_n != other.w_n).any():
print('w_n')
- return 45
+ return False
elif (self.w_x != other.w_x).any():
print('w_x')
- return 46
+ return False
elif (self.w_m != other.w_m).any():
print('w_m')
- return 47
+ return False
elif (self.w_vel != other.w_vel).any():
print('w_vel')
- return 48
+ return False
elif (self.w_force != other.w_force).any():
print('w_force')
- return 49
+ return False
elif (self.w_sigma0 != other.w_sigma0).any():
print('w_sigma0')
- return 50
+ return False
elif self.w_sigma0_A != other.w_sigma0_A:
print('w_sigma0_A')
- return 51
+ return False
elif self.w_sigma0_f != other.w_sigma0_f:
print('w_sigma0_f')
- return 52
+ return False
elif self.w_tau_x != other.w_tau_x:
print('w_tau_x')
- return 52.5
+ return False
elif self.gamma_wn != other.gamma_wn:
print('gamma_wn')
- return 53
+ return False
elif self.gamma_wt != other.gamma_wt:
print('gamma_wt')
- return 54
+ return False
elif self.lambda_bar != other.lambda_bar:
print('lambda_bar')
- return 55
+ return False
elif self.nb0 != other.nb0:
print('nb0')
- return 56
+ return False
elif self.sigma_b != other.sigma_b:
print('sigma_b')
- return 57
+ return False
elif self.tau_b != other.tau_b:
print('tau_b')
- return 58
+ return False
elif self.bonds != other.bonds:
print('bonds')
- return 59
+ return False
elif self.bonds_delta_n != other.bonds_delta_n:
print('bonds_delta_n')
- return 60
+ return False
elif self.bonds_delta_t != other.bonds_delta_t:
print('bonds_delta_t')
- return 61
+ return False
elif self.bonds_omega_n != other.bonds_omega_n:
print('bonds_omega_n')
- return 62
+ return False
elif self.bonds_omega_t != other.bonds_omega_t:
print('bonds_omega_t')
- return 63
+ return False
elif self.fluid != other.fluid:
print('fluid')
- return 64
+ return False
if self.fluid:
if self.cfd_solver != other.cfd_solver:
print('cfd_solver')
- return 91
+ return False
elif self.mu != other.mu:
print('mu')
- return 65
+ return False
elif (self.v_f != other.v_f).any():
print('v_f')
- return 66
+ return False
elif (self.p_f != other.p_f).any():
print('p_f')
- return 67
+ return False
#elif self.phi != other.phi).any():
#print('phi')
- #return 68 # Porosities not initialized correctly
+ #return False # Porosities not initialized correctly
elif (self.dphi != other.dphi).any():
print('d_phi')
- return 69
+ return False
elif self.rho_f != other.rho_f:
print('rho_f')
- return 70
+ return False
elif self.p_mod_A != other.p_mod_A:
print('p_mod_A')
- return 71
+ return False
elif self.p_mod_f != other.p_mod_f:
print('p_mod_f')
- return 72
+ return False
elif self.p_mod_phi != other.p_mod_phi:
print('p_mod_phi')
- return 73
+ return False
elif self.bc_bot != other.bc_bot:
print('bc_bot')
- return 74
+ return False
elif self.bc_top != other.bc_top:
print('bc_top')
- return 75
+ return False
elif self.free_slip_bot != other.free_slip_bot:
print('free_slip_bot')
- return 76
+ return False
elif self.free_slip_top != other.free_slip_top:
print('free_slip_top')
- return 77
+ return False
elif self.bc_bot_flux != other.bc_bot_flux:
print('bc_bot_flux')
- return 91
+ return False
elif self.bc_top_flux != other.bc_top_flux:
print('bc_top_flux')
- return 91
+ return False
elif (self.p_f_constant != other.p_f_constant).any():
print('p_f_constant')
- return 96
+ return False
if self.cfd_solver == 0:
if self.gamma != other.gamma:
print('gamma')
- return 78
+ return False
elif self.theta != other.theta:
print('theta')
- return 79
+ return False
elif self.beta != other.beta:
print('beta')
- return 80
+ return False
elif self.tolerance != other.tolerance:
print('tolerance')
- return 81
+ return False
elif self.maxiter != other.maxiter:
print('maxiter')
- return 82
+ return False
elif self.ndem != other.ndem:
print('ndem')
- return 83
+ return False
elif self.c_phi != other.c_phi:
print('c_phi')
return(84)
t@@ -753,13 +753,13 @@ class sim:
if self.cfd_solver == 1:
if self.tolerance != other.tolerance:
print('tolerance')
- return 81
+ return False
elif self.maxiter != other.maxiter:
print('maxiter')
- return 82
+ return False
elif self.ndem != other.ndem:
print('ndem')
- return 83
+ return False
elif self.c_phi != other.c_phi:
print('c_phi')
return(84)
t@@ -774,23 +774,23 @@ class sim:
return(88)
elif (self.bc_xn != other.bc_xn):
print('bc_xn')
- return 92
+ return False
elif (self.bc_xp != other.bc_xp):
print('bc_xp')
- return 93
+ return False
elif (self.bc_yn != other.bc_yn):
print('bc_yn')
- return 94
+ return False
elif (self.bc_yp != other.bc_yp):
print('bc_yp')
- return 95
+ return False
if (self.color != other.color).any():
print('color')
- return 90
+ return False
# All equal
- return 0
+ return True
def id(self, sid=''):
'''