construction_data_containers.py 文件源码

python
阅读 35 收藏 0 点赞 0 评论 0

项目:yt 作者: yt-project 项目源码 文件源码
def _minimal_box(self, dds):
        LL = self.left_edge.d - self.ds.domain_left_edge.d
        # Nudge in case we're on the edge
        LL += np.finfo(np.float64).eps
        LS = self.right_edge.d - self.ds.domain_left_edge.d
        LS += np.finfo(np.float64).eps
        cell_start = LL / dds  # This is the cell we're inside
        cell_end = LS / dds
        if self.level == 0:
            start_index = np.array(np.floor(cell_start), dtype="int64")
            end_index = np.array(np.ceil(cell_end), dtype="int64")
            dims = np.rint((self.ActiveDimensions * self.dds.d) / dds).astype("int64")
        else:
            # Give us one buffer
            start_index = np.rint(cell_start).astype('int64') - 1
            # How many root cells do we occupy?
            end_index = np.rint(cell_end).astype('int64')
            dims = end_index - start_index + 1
        return start_index, end_index.astype("int64"), dims.astype("int32")
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号