use floor division of integers

1/2 = 0.5 in python3 (would be 0 in python2)
This commit is contained in:
Martin Diehl 2018-11-15 12:28:36 +01:00
parent efd29e62f7
commit 8f80152a03
1 changed files with 4 additions and 4 deletions

View File

@ -245,8 +245,8 @@ class MPIEspectral_result: # mimic py_post result object
b = self.grid[1]+1
c = self.grid[2]+1
return vector([self.size[0] * (n%a) / self.grid[0],
self.size[1] * ((n/a)%b) / self.grid[1],
self.size[2] * ((n/a/b)%c) / self.grid[2],
self.size[1] * ((n//a)%b) / self.grid[1],
self.size[2] * ((n//a//b)%c) / self.grid[2],
])
def element_sequence(self,e):
@ -258,7 +258,7 @@ class MPIEspectral_result: # mimic py_post result object
def element(self,e):
a = self.grid[0]+1
b = self.grid[1]+1
basenode = 1 + e+e/self.grid[0] + e/self.grid[0]/self.grid[1]*a
basenode = 1 + e+e//self.grid[0] + e//self.grid[0]//self.grid[1]*a
basenode2 = basenode+a*b
return (element([basenode ,basenode +1,basenode +a+1,basenode +a,
basenode2 ,basenode2+1,basenode2+a+1,basenode2+a,