def runTest(self):
        nx, ny, nz, str_f, pt0, pt1, is_array, mpi_type = self.args

        slices = common.slice_index_two_points(pt0, pt1)

        # generate random source
        if is_array:
            shape = common.shape_two_points(pt0, pt1)
            value = np.random.rand(*shape).astype(np.float32)
        else:
            value = np.random.ranf()

        # instance
        fields = Fields(nx, ny, nz, '', 'single', 0, mpi_type=mpi_type)

        tfunc = lambda tstep: np.sin(0.03 * tstep)
        incident = DirectIncident(fields, str_f, pt0, pt1, tfunc, value)

        # host allocations
        eh = np.zeros(fields.ns_pitch, dtype=fields.dtype)
        getf = GetFields(fields, str_f, pt0, pt1)

        # verify
        eh[slices] = fields.dtype(value) * fields.dtype(tfunc(1))
        fields.update_e()
        fields.update_h()
        fields.enqueue_barrier()

        original = eh[slices]
        getf.get_event().wait()
        copy = getf.get_fields()
        norm = np.linalg.norm(original - copy)
        self.assertEqual(norm, 0, '%s, %g' % (self.args, norm))
    def runTest(self):
        nx, ny, nz, str_f, pt0, pt1, is_array, mpi_type = self.args

        slices = common.slice_index_two_points(pt0, pt1)

        # generate random source
        if is_array:
            shape = common.shape_two_points(pt0, pt1)
            value = np.random.rand(*shape).astype(np.float32)
        else:
            value = np.random.ranf()

        # instance
        fields = Fields(nx, ny, nz, '', 'single', 0, mpi_type=mpi_type)

        tfunc = lambda tstep: np.sin(0.03*tstep)
        incident = DirectIncident(fields, str_f, pt0, pt1, tfunc, value) 

        # host allocations
        eh = np.zeros(fields.ns_pitch, dtype=fields.dtype)
        getf = GetFields(fields, str_f, pt0, pt1)

        # verify
        eh[slices] = fields.dtype(value) * fields.dtype(tfunc(1))
        fields.update_e()
        fields.update_h()
        fields.enqueue_barrier()

        original = eh[slices]
        getf.get_event().wait()
        copy = getf.get_fields()
        norm = np.linalg.norm(original - copy)
        self.assertEqual(norm, 0, '%s, %g' % (self.args, norm))