Ejemplo n.º 1
0
    def __init_finalize__(self, *args, **kwargs):
        super(AbstractSparseFunction, self).__init_finalize__(*args, **kwargs)
        self._npoint = kwargs['npoint']
        self._space_order = kwargs.get('space_order', 0)

        # Dynamically add derivative short-cuts
        self._fd = generate_fd_shortcuts(self)
Ejemplo n.º 2
0
 def __fd_setup__(self):
     """
     Dynamically add derivative short-cuts.
     """
     return generate_fd_shortcuts(self.dimensions,
                                  self.space_order,
                                  to=self.time_order)
Ejemplo n.º 3
0
    def __init__(self, *args, **kwargs):
        if not self._cached():
            super(AbstractSparseFunction, self).__init__(*args, **kwargs)
            self._npoint = kwargs['npoint']
            self._space_order = kwargs.get('space_order', 0)

            # Dynamically add derivative short-cuts
            self._fd = generate_fd_shortcuts(self)
Ejemplo n.º 4
0
    def __init__(self, *args, **kwargs):
        if not self._cached():
            super(Function, self).__init__(*args, **kwargs)

            # Space order
            space_order = kwargs.get('space_order', 1)
            if isinstance(space_order, int):
                self._space_order = space_order
            elif isinstance(space_order, tuple) and len(space_order) == 3:
                self._space_order, _, _ = space_order
            else:
                raise TypeError("`space_order` must be int or 3-tuple of ints")

            # Dynamically add derivative short-cuts
            self._fd = generate_fd_shortcuts(self)