def __call__(self, access, path, lgmaps=None, unroll_map=False): """Override the parent __call__ method in order to special-case global blocks in matrices.""" # One of the path entries was not an Arg. if path == (None, None): assert all(l is None for l in lgmaps) return _make_object('Arg', data=self.handle.getPythonContext().global_, access=access) elif None in path: thispath = path[0] or path[1] return _make_object('Arg', data=self.handle.getPythonContext().dat, map=thispath, access=access) else: return super().__call__(access, path, lgmaps=lgmaps, unroll_map=unroll_map)
def _make(self, kernel, it_space, iterregion, args, info): return _make_object('ParLoop', kernel, it_space.iterset, *args, iterate=iterregion, insp_name=self._insp_name)
def __call__(self, access, path): """Override the parent __call__ method in order to special-case global blocks in matrices.""" try: # Usual case return super(Mat, self).__call__(access, path) except TypeError: # One of the path entries was not an Arg. if path == (None, None): return _make_object('Arg', data=self.handle.getPythonContext().global_, access=access) elif None in path: thispath = path[0] or path[1] return _make_object('Arg', data=self.handle.getPythonContext().dat, map=thispath.map, idx=thispath.idx, access=access) else: raise
def __init__(self, sparsity, dat=None, dset=None): if isinstance(sparsity.dsets[0], GlobalDataSet): self.dset = sparsity.dsets[1] self.sizes = ((None, 1), (sparsity._ncols, None)) elif isinstance(sparsity.dsets[1], GlobalDataSet): self.dset = sparsity.dsets[0] self.sizes = ((sparsity._nrows, None), (None, 1)) else: raise ValueError("Not a DatMat") self.sparsity = sparsity self.dat = dat or _make_object("Dat", self.dset) self.dset = dset
def __init__(self, sparsity, dat=None, dset=None): if isinstance(sparsity.dsets[0], GlobalDataSet): self.dset = sparsity.dsets[1] self.sizes = ((None, 1), (self.dset.size * self.dset.cdim, None)) elif isinstance(sparsity.dsets[1], GlobalDataSet): self.dset = sparsity.dsets[0] self.sizes = ((self.dset.size * self.dset.cdim, None), (None, 1)) else: raise ValueError("Not a DatMat") self.sparsity = sparsity self.dat = dat or _make_object("Dat", self.dset, dtype=PETSc.ScalarType) self.dset = dset
def __init__(self, global_=None, comm=None): self.global_ = global_ or _make_object( "Global", 1, dtype=PETSc.ScalarType, comm=comm)
def __init__(self, global_=None): self.global_ = global_ or _make_object("Global", 1)
def __init__(self, global_=None, comm=None): self.global_ = global_ or _make_object("Global", 1, dtype=PETSc.ScalarType, comm=comm)