示例#1
0
    def translate_box_multipoles_to_qbx_local(self, multipole_exps):
        queue = multipole_exps.queue
        qbx_expansions = self.qbx_local_expansion_zeros(multipole_exps)
        events = []

        geo_data = self.geo_data
        if geo_data.ncenters == 0:
            return (qbx_expansions, SumpyTimingFuture(queue, events))

        traversal = geo_data.traversal()

        wait_for = multipole_exps.events

        for isrc_level, ssn in enumerate(traversal.from_sep_smaller_by_level):
            m2qbxl = self.tree_indep.m2qbxl(
                    self.level_orders[isrc_level],
                    self.qbx_order)

            source_level_start_ibox, source_mpoles_view = \
                    self.multipole_expansions_view(multipole_exps, isrc_level)

            evt, (qbx_expansions_res,) = m2qbxl(queue,
                    qbx_center_to_target_box_source_level=(
                        geo_data.qbx_center_to_target_box_source_level(isrc_level)
                    ),

                    centers=self.tree.box_centers,
                    qbx_centers=geo_data.flat_centers(),
                    qbx_expansion_radii=geo_data.flat_expansion_radii(),

                    src_expansions=source_mpoles_view,
                    src_base_ibox=source_level_start_ibox,
                    qbx_expansions=qbx_expansions,

                    src_box_starts=ssn.starts,
                    src_box_lists=ssn.lists,

                    src_rscale=level_to_rscale(self.tree, isrc_level),

                    wait_for=wait_for,

                    **self.kernel_extra_kwargs)

            events.append(evt)
            wait_for = [evt]
            assert qbx_expansions_res is qbx_expansions

        qbx_expansions.add_event(evt)

        return (qbx_expansions, SumpyTimingFuture(queue, events))
示例#2
0
文件: fmm.py 项目: inducer/pytential
    def translate_box_multipoles_to_qbx_local(self, multipole_exps):
        qbx_expansions = self.qbx_local_expansion_zeros()
        events = []

        geo_data = self.geo_data
        if geo_data.ncenters == 0:
            return (qbx_expansions, SumpyTimingFuture(self.queue, events))

        traversal = geo_data.traversal()

        wait_for = multipole_exps.events

        for isrc_level, ssn in enumerate(traversal.from_sep_smaller_by_level):
            m2qbxl = self.code.m2qbxl(
                    self.level_orders[isrc_level],
                    self.qbx_order)

            source_level_start_ibox, source_mpoles_view = \
                    self.multipole_expansions_view(multipole_exps, isrc_level)

            evt, (qbx_expansions_res,) = m2qbxl(self.queue,
                    qbx_center_to_target_box_source_level=(
                        geo_data.qbx_center_to_target_box_source_level(isrc_level)
                    ),

                    centers=self.tree.box_centers,
                    qbx_centers=geo_data.centers(),
                    qbx_expansion_radii=geo_data.expansion_radii(),

                    src_expansions=source_mpoles_view,
                    src_base_ibox=source_level_start_ibox,
                    qbx_expansions=qbx_expansions,

                    src_box_starts=ssn.starts,
                    src_box_lists=ssn.lists,

                    src_rscale=level_to_rscale(self.tree, isrc_level),

                    wait_for=wait_for,

                    **self.kernel_extra_kwargs)

            events.append(evt)
            wait_for = [evt]
            assert qbx_expansions_res is qbx_expansions

        qbx_expansions.add_event(evt)

        return (qbx_expansions, SumpyTimingFuture(self.queue, events))
示例#3
0
    def translate_box_local_to_qbx_local(self, local_exps):
        queue = local_exps.queue
        qbx_expansions = self.qbx_local_expansion_zeros(local_exps)

        geo_data = self.geo_data
        events = []

        if geo_data.ncenters == 0:
            return (qbx_expansions, SumpyTimingFuture(queue, events))

        trav = geo_data.traversal()

        wait_for = local_exps.events

        for isrc_level in range(geo_data.tree().nlevels):
            l2qbxl = self.tree_indep.l2qbxl(
                    self.level_orders[isrc_level],
                    self.qbx_order)

            target_level_start_ibox, target_locals_view = \
                    self.local_expansions_view(local_exps, isrc_level)

            evt, (qbx_expansions_res,) = l2qbxl(
                    queue,
                    qbx_center_to_target_box=geo_data.qbx_center_to_target_box(),
                    target_boxes=trav.target_boxes,
                    target_base_ibox=target_level_start_ibox,

                    centers=self.tree.box_centers,
                    qbx_centers=geo_data.flat_centers(),
                    qbx_expansion_radii=geo_data.flat_expansion_radii(),

                    expansions=target_locals_view,
                    qbx_expansions=qbx_expansions,

                    src_rscale=level_to_rscale(self.tree, isrc_level),

                    wait_for=wait_for,

                    **self.kernel_extra_kwargs)

            events.append(evt)
            wait_for = [evt]
            assert qbx_expansions_res is qbx_expansions

        qbx_expansions.add_event(evt)

        return (qbx_expansions, SumpyTimingFuture(queue, events))
示例#4
0
文件: fmm.py 项目: inducer/pytential
    def translate_box_local_to_qbx_local(self, local_exps):
        qbx_expansions = self.qbx_local_expansion_zeros()

        geo_data = self.geo_data
        events = []

        if geo_data.ncenters == 0:
            return (qbx_expansions, SumpyTimingFuture(self.queue, events))

        trav = geo_data.traversal()

        wait_for = local_exps.events

        for isrc_level in range(geo_data.tree().nlevels):
            l2qbxl = self.code.l2qbxl(
                    self.level_orders[isrc_level],
                    self.qbx_order)

            target_level_start_ibox, target_locals_view = \
                    self.local_expansions_view(local_exps, isrc_level)

            evt, (qbx_expansions_res,) = l2qbxl(
                    self.queue,
                    qbx_center_to_target_box=geo_data.qbx_center_to_target_box(),
                    target_boxes=trav.target_boxes,
                    target_base_ibox=target_level_start_ibox,

                    centers=self.tree.box_centers,
                    qbx_centers=geo_data.centers(),
                    qbx_expansion_radii=geo_data.expansion_radii(),

                    expansions=target_locals_view,
                    qbx_expansions=qbx_expansions,

                    src_rscale=level_to_rscale(self.tree, isrc_level),

                    wait_for=wait_for,

                    **self.kernel_extra_kwargs)

            events.append(evt)
            wait_for = [evt]
            assert qbx_expansions_res is qbx_expansions

        qbx_expansions.add_event(evt)

        return (qbx_expansions, SumpyTimingFuture(self.queue, events))