mirror of
https://github.com/smyalygames/FiniteVolumeGPU.git
synced 2026-01-14 15:48:43 +01:00
Refactoring - broke 2nd order
This commit is contained in:
@@ -22,6 +22,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#Import packages we need
|
||||
from GPUSimulators import Simulator, Common
|
||||
from GPUSimulators.Simulator import BaseSimulator, BoundaryCondition
|
||||
import numpy as np
|
||||
|
||||
|
||||
@@ -57,6 +58,7 @@ class FORCE (Simulator.BaseSimulator):
|
||||
nx, ny, \
|
||||
dx, dy, dt, \
|
||||
g, \
|
||||
boundary_conditions=BoundaryCondition(), \
|
||||
block_width=16, block_height=16):
|
||||
|
||||
# Call super constructor
|
||||
@@ -65,10 +67,11 @@ class FORCE (Simulator.BaseSimulator):
|
||||
dx, dy, dt, \
|
||||
block_width, block_height);
|
||||
self.g = np.float32(g)
|
||||
self.boundary_conditions = boundary_conditions.asCodedInt()
|
||||
|
||||
#Get kernels
|
||||
self.kernel = context.get_prepared_kernel("cuda/SWE2D_FORCE.cu", "FORCEKernel", \
|
||||
"iiffffPiPiPiPiPiPi", \
|
||||
"iiffffiPiPiPiPiPiPi", \
|
||||
defines={
|
||||
'BLOCK_WIDTH': self.block_size[0],
|
||||
'BLOCK_HEIGHT': self.block_size[1]
|
||||
@@ -89,14 +92,12 @@ class FORCE (Simulator.BaseSimulator):
|
||||
1, 1, \
|
||||
[None, None, None])
|
||||
|
||||
def simulate(self, t_end):
|
||||
return super().simulateEuler(t_end)
|
||||
|
||||
def stepEuler(self, dt):
|
||||
def step(self, dt):
|
||||
self.kernel.prepared_async_call(self.grid_size, self.block_size, self.stream, \
|
||||
self.nx, self.ny, \
|
||||
self.dx, self.dy, dt, \
|
||||
self.g, \
|
||||
self.boundary_conditions, \
|
||||
self.u0[0].data.gpudata, self.u0[0].data.strides[0], \
|
||||
self.u0[1].data.gpudata, self.u0[1].data.strides[0], \
|
||||
self.u0[2].data.gpudata, self.u0[2].data.strides[0], \
|
||||
|
||||
Reference in New Issue
Block a user