pystella/fourier/dft.py
def dft(self, fx=None, fk=None, **kwargs):
        """
        Computes the forward Fourier transform.

        :arg fx: The array to be transformed.
            Can be a :class:`pyopencl.array.Array` with or without halo padding
            (which will be removed by
            :meth:`pystella.DomainDecomposition.remove_halos`
            if needed) or a :class:`numpy.ndarray` without halo padding.
            Arrays are copied as necessary.
            Defaults to *None*, in which case :attr:`fx` (attached
            to the transform) is used.

        :arg fk: The array in which to output the result of the transform.
            Can be a :class:`pyopencl.array.Array` or a :class:`numpy.ndarray`.
            Arrays are copied as necessary.
            Defaults to *None*, in which case :attr:`fk` (attached
            to the transform) is used.

        :returns: The forward Fourier transform of ``fx``.
            Either ``fk`` if supplied or :attr:`fk`.

        Any remaining keyword arguments are passed to :meth:`forward_transform`.

        .. note::
            If you need the result of multiple Fourier transforms at once, you must
            either supply an ``fk`` array or copy the output.
            Namely, without passing ``fk`` the same memory (attached to the
            transform object) will be used for output, overwriting any prior
            results.
        """

        if fx is not None:
            if fx.shape != self.shape(False):
                if isinstance(fx, cla.Array):
                    queue = fx.queue
                elif isinstance(self.fx, cla.Array):
                    queue = self.fx.queue
                else:
                    queue = None
                self.decomp.remove_halos(queue, fx, self.fx)
                _fx = self.fx
            elif not isinstance(fx, type(self.fx)):
                _fx = _transfer_array(self.fx, fx)
            else:
                _fx = fx
        else:
            _fx = self.fx

        if fk is not None:
            if not isinstance(fk, type(self.fk)):
                _fk = self.fk
            else:
                _fk = fk
        else:
            _fk = self.fk

        self._debug_barrier("all ranks initiating forward_transform")
        _fk = self.forward_transform(_fx, _fk, **kwargs)
        self._debug_barrier("all ranks finished forward_transform")

        if fk is not None:
            if not isinstance(fk, type(self.fk)):
                _fk = _transfer_array(fk, _fk)
            else:
                _fk = fk
        else:
            _fk = _fk

        return _fk

        Computes the forward Fourier transform.

        :arg fx: The array to be transformed.
            Can be a :class:`pyopencl.array.Array` with or without halo padding
            (which will be removed by
            :meth:`pystella.DomainDecomposition.remove_halos`
            if needed) or a :class:`numpy.ndarray` without halo padding.
            Arrays are copied as necessary.
            Defaults to *None*, in which case :attr:`fx` (attached
            to the transform) is used.

        :arg fk: The array in which to output the result of the transform.
            Can be a :class:`pyopencl.array.Array` or a :class:`numpy.ndarray`.
            Arrays are copied as necessary.
            Defaults to *None*, in which case :attr:`fk` (attached
            to the transform) is used.

        :returns: The forward Fourier transform of ``fx``.
            Either ``fk`` if supplied or :attr:`fk`.

        Any remaining keyword arguments are passed to :meth:`forward_transform`.

        .. note::
            If you need the result of multiple Fourier transforms at once, you must
            either supply an ``fk`` array or copy the output.
            Namely, without passing ``fk`` the same memory (attached to the
            transform object) will be used for output, overwriting any prior
            results.
        
Computes the forward Fourier transform.
Computes the forward Fourier transform .
def dft(self, fx=None, fk=None, **kwargs):
        if fx is not None:
            if fx.shape != self.shape(False):
                if isinstance(fx, cla.Array):
                    queue = fx.queue
                elif isinstance(self.fx, cla.Array):
                    queue = self.fx.queue
                else:
                    queue = None
                self.decomp.remove_halos(queue, fx, self.fx)
                _fx = self.fx
            elif not isinstance(fx, type(self.fx)):
                _fx = _transfer_array(self.fx, fx)
            else:
                _fx = fx
        else:
            _fx = self.fx
        if fk is not None:
            if not isinstance(fk, type(self.fk)):
                _fk = self.fk
            else:
                _fk = fk
        else:
            _fk = self.fk
        self._debug_barrier("all ranks initiating forward_transform")
        _fk = self.forward_transform(_fx, _fk, **kwargs)
        self._debug_barrier("all ranks finished forward_transform")
        if fk is not None:
            if not isinstance(fk, type(self.fk)):
                _fk = _transfer_array(fk, _fk)
            else:
                _fk = fk
        else:
            _fk = _fk
        return _fk
def dft ( self , fx = None , fk = None , ** kwargs ) : if fx is not None : if fx . shape != self . shape ( False ) : if isinstance ( fx , cla . Array ) : queue = fx . queue elif isinstance ( self . fx , cla . Array ) : queue = self . fx . queue else : queue = None self . decomp . remove_halos ( queue , fx , self . fx ) _fx = self . fx elif not isinstance ( fx , type ( self . fx ) ) : _fx = _transfer_array ( self . fx , fx ) else : _fx = fx else : _fx = self . fx if fk is not None : if not isinstance ( fk , type ( self . fk ) ) : _fk = self . fk else : _fk = fk else : _fk = self . fk self . _debug_barrier ( "all ranks initiating forward_transform" ) _fk = self . forward_transform ( _fx , _fk , ** kwargs ) self . _debug_barrier ( "all ranks finished forward_transform" ) if fk is not None : if not isinstance ( fk , type ( self . fk ) ) : _fk = _transfer_array ( fk , _fk ) else : _fk = fk else : _fk = _fk return _fk
Computes the forward Fourier transform.
Computes the forward Fourier transform .
"""
        Computes the forward Fourier transform.

        :arg fx: The array to be transformed.
            Can be a :class:`pyopencl.array.Array` with or without halo padding
            (which will be removed by
            :meth:`pystella.DomainDecomposition.remove_halos`
            if needed) or a :class:`numpy.ndarray` without halo padding.
            Arrays are copied as necessary.
            Defaults to *None*, in which case :attr:`fx` (attached
            to the transform) is used.

        :arg fk: The array in which to output the result of the transform.
            Can be a :class:`pyopencl.array.Array` or a :class:`numpy.ndarray`.
            Arrays are copied as necessary.
            Defaults to *None*, in which case :attr:`fk` (attached
            to the transform) is used.

        :returns: The forward Fourier transform of ``fx``.
            Either ``fk`` if supplied or :attr:`fk`.

        Any remaining keyword arguments are passed to :meth:`forward_transform`.

        .. note::
            If you need the result of multiple Fourier transforms at once, you must
            either supply an ``fk`` array or copy the output.
            Namely, without passing ``fk`` the same memory (attached to the
            transform object) will be used for output, overwriting any prior
            results.
        """
The forward Fourier transform of ``fx``.
Either ``fk`` if supplied or :attr:`fk`.

Any remaining keyword arguments are passed to :meth:`forward_transform`.

:
If you need the result of multiple Fourier transforms at once, you must
either supply an ``fk`` array or copy the output.
Namely, without passing ``fk`` the same memory (attached to the
transform object) will be used for output, overwriting any prior
results.
The forward Fourier transform of ` ` fx ` ` . Either ` ` fk ` ` if supplied or : attr : ` fk ` . Any remaining keyword arguments are passed to : meth : ` forward_transform ` . : If you need the result of multiple Fourier transforms at once you must either supply an ` ` fk ` ` array or copy the output . Namely without passing ` ` fk ` ` the same memory ( attached to the transform object ) will be used for output overwriting any prior results .
self
fx
The array to be transformed.
Can be a :class:`pyopencl.array.Array` with or without halo padding
(which will be removed by
:meth:`pystella.DomainDecomposition.remove_halos`
if needed) or a :class:`numpy.ndarray` without halo padding.
Arrays are copied as necessary.
Defaults to *None*, in which case :attr:`fx` (attached
to the transform) is used.
The array to be transformed . Can be a : class : ` pyopencl . array . Array ` with or without halo padding ( which will be removed by : meth : ` pystella . DomainDecomposition . remove_halos ` if needed ) or a : class : ` numpy . ndarray ` without halo padding . Arrays are copied as necessary . Defaults to * None * in which case : attr : ` fx ` ( attached to the transform ) is used .
fk
The array in which to output the result of the transform.
Can be a :class:`pyopencl.array.Array` or a :class:`numpy.ndarray`.
Arrays are copied as necessary.
Defaults to *None*, in which case :attr:`fk` (attached
to the transform) is used.
The array in which to output the result of the transform . Can be a : class : ` pyopencl . array . Array ` or a : class : ` numpy . ndarray ` . Arrays are copied as necessary . Defaults to * None * in which case : attr : ` fk ` ( attached to the transform ) is used .