Ejemplo n.º 1
0
 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)
Ejemplo n.º 2
0
 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)
Ejemplo n.º 3
0
 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)
Ejemplo n.º 4
0
 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
Ejemplo n.º 5
0
 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
Ejemplo n.º 6
0
    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
Ejemplo n.º 7
0
    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
Ejemplo n.º 8
0
    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
Ejemplo n.º 9
0
    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
Ejemplo n.º 10
0
 def __init__(self, global_=None, comm=None):
     self.global_ = global_ or _make_object(
         "Global", 1, dtype=PETSc.ScalarType, comm=comm)
Ejemplo n.º 11
0
 def __init__(self, global_=None):
     self.global_ = global_ or _make_object("Global", 1)
Ejemplo n.º 12
0
 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)
Ejemplo n.º 13
0
 def __init__(self, global_=None, comm=None):
     self.global_ = global_ or _make_object("Global", 1, dtype=PETSc.ScalarType, comm=comm)
Ejemplo n.º 14
0
 def __init__(self, global_=None):
     self.global_ = global_ or _make_object("Global", 1)