Пример #1
0
 def _setup_integrator(self, equations, integrator):
     pytest.importorskip('pysph.base.gpu_nnps')
     kernel = CubicSpline(dim=1)
     arrays = [self.pa]
     from pysph.base.gpu_nnps import BruteForceNNPS as GPUNNPS
     a_eval = AccelerationEval(
          particle_arrays=arrays, equations=equations, kernel=kernel,
          backend='opencl'
     )
     comp = SPHCompiler(a_eval, integrator=integrator)
     comp.compile()
     nnps = GPUNNPS(dim=kernel.dim, particles=arrays, cache=True)
     nnps.update()
     a_eval.set_nnps(nnps)
     integrator.set_nnps(nnps)
Пример #2
0
 def _make_accel_eval(self, equations, cache_nnps=True):
     pytest.importorskip('pysph.base.gpu_nnps')
     from pysph.base.gpu_nnps import ZOrderGPUNNPS as GPUNNPS
     arrays = [self.pa]
     kernel = CubicSpline(dim=self.dim)
     a_eval = AccelerationEval(
         particle_arrays=arrays, equations=equations, kernel=kernel,
         backend='opencl'
     )
     comp = SPHCompiler(a_eval, integrator=None)
     comp.compile()
     self.sph_compiler = comp
     nnps = GPUNNPS(dim=kernel.dim, particles=arrays, cache=cache_nnps)
     nnps.update()
     a_eval.set_nnps(nnps)
     return a_eval