Exemplo n.º 1
0
        /// <summary>
        /// Executes a CUFTT transorm as defined by the cufftType.
        /// This method does an in‐place transform.<para/>
        /// This method is only valid for transform types where transorm direction is implicitly
        /// given by the type (i.e. not C2C and not Z2Z)
        /// </summary>
        /// <param name="iodata"></param>
        public void Exec(CUdeviceptr iodata)
        {
            switch (_type)
            {
            case cufftType.R2C:
                res = CudaFFTNativeMethods.cufftExecR2C(_handle, iodata, iodata);
                Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "cufftExecR2C", res));
                break;

            case cufftType.C2R:
                res = CudaFFTNativeMethods.cufftExecC2R(_handle, iodata, iodata);
                Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "cufftExecC2R", res));
                break;

            case cufftType.D2Z:
                res = CudaFFTNativeMethods.cufftExecD2Z(_handle, iodata, iodata);
                Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "cufftExecD2Z", res));
                break;

            case cufftType.Z2D:
                res = CudaFFTNativeMethods.cufftExecZ2D(_handle, iodata, iodata);
                Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "cufftExecZ2D", res));
                break;

            default:
                throw new ArgumentException("For transformation not of type R2C, C2R, D2Z or Z2D, you must specify a transform direction.");
            }
            if (res != cufftResult.Success)
            {
                throw new CudaFFTException(res);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Executes a CUFTT transorm as defined by the cufftType.
        /// This method does an in‐place transform.
        /// </summary>
        /// <param name="iodata"></param>
        /// <param name="direction">Only unsed for transformations where direction is not implicitly given by type</param>
        public void Exec(CUdeviceptr iodata, TransformDirection direction)
        {
            switch (_type)
            {
            case cufftType.R2C:
                res = CudaFFTNativeMethods.cufftExecR2C(_handle, iodata, iodata);
                Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "cufftExecR2C", res));
                break;

            case cufftType.C2R:
                res = CudaFFTNativeMethods.cufftExecC2R(_handle, iodata, iodata);
                Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "cufftExecC2R", res));
                break;

            case cufftType.C2C:
                res = CudaFFTNativeMethods.cufftExecC2C(_handle, iodata, iodata, direction);
                Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "cufftExecC2C", res));
                break;

            case cufftType.D2Z:
                res = CudaFFTNativeMethods.cufftExecD2Z(_handle, iodata, iodata);
                Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "cufftExecD2Z", res));
                break;

            case cufftType.Z2D:
                res = CudaFFTNativeMethods.cufftExecZ2D(_handle, iodata, iodata);
                Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "cufftExecZ2D", res));
                break;

            case cufftType.Z2Z:
                res = CudaFFTNativeMethods.cufftExecZ2Z(_handle, iodata, iodata, direction);
                Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "cufftExecZ2Z", res));
                break;

            default:
                break;
            }
            if (res != cufftResult.Success)
            {
                throw new CudaFFTException(res);
            }
        }