Changeset 2080
- Timestamp:
- Oct 13, 2004, 10:46:57 AM (22 years ago)
- Location:
- trunk/psLib/src
- Files:
-
- 4 edited
-
dataManip/psDataManipErrors.dat (modified) (1 diff)
-
dataManip/psDataManipErrors.h (modified) (2 diffs)
-
dataManip/psVectorFFT.c (modified) (4 diffs)
-
fft/psVectorFFT.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/dataManip/psDataManipErrors.dat
r1864 r2080 17 17 psVectorFFT_NONREAL_NOTSUPPORTED Input psVector type, %s, is required to be either psF32 or psF64. 18 18 psVectorFFT_NONCOMPLEX_NOTSUPPORTED Input psVector type, %s, is required to be either psC32 or psC64. 19 19 psVectorFFT_DIRECTION_NOTSET Must specify the direction as either PS_FFT_FORWARD or PS_FFT_REVERSE. -
trunk/psLib/src/dataManip/psDataManipErrors.h
r1864 r2080 7 7 * @author Robert DeSonia, MHPCC 8 8 * 9 * @version $Revision: 1. 2$ $Name: not supported by cvs2svn $10 * @date $Date: 2004- 09-23 18:31:49$9 * @version $Revision: 1.3 $ $Name: not supported by cvs2svn $ 10 * @date $Date: 2004-10-13 20:46:57 $ 11 11 * 12 12 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 39 39 #define PS_ERRORTEXT_psVectorFFT_NONREAL_NOTSUPPORTED "Input psVector type, %s, is required to be either psF32 or psF64." 40 40 #define PS_ERRORTEXT_psVectorFFT_NONCOMPLEX_NOTSUPPORTED "Input psVector type, %s, is required to be either psC32 or psC64." 41 #define PS_ERRORTEXT_psVectorFFT_DIRECTION_NOTSET "Must specify the direction as either PS_FFT_FORWARD or PS_FFT_REVERSE." 41 42 //~End 42 43 -
trunk/psLib/src/dataManip/psVectorFFT.c
r1864 r2080 5 5 * @author Robert DeSonia, MHPCC 6 6 * 7 * @version $Revision: 1.2 5$ $Name: not supported by cvs2svn $8 * @date $Date: 2004- 09-23 18:31:49$7 * @version $Revision: 1.26 $ $Name: not supported by cvs2svn $ 8 * @date $Date: 2004-10-13 20:46:57 $ 9 9 * 10 10 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 43 43 type = in->type.type; 44 44 45 if ((type != PS_TYPE_F32) && (type != PS_TYPE_C32)) {46 char* typeStr;47 PS_TYPE_NAME(typeStr,type);48 psErrorMsg(PS_ERRORNAME_DOMAIN "psVectorFFT",49 PS_ERR_BAD_PARAMETER_TYPE, true,50 PS_ERRORTEXT_psVectorFFT_IMAGE_TYPE_UNSUPPORTED,51 typeStr);52 psFree(out);53 return NULL;54 }55 56 if ((type != PS_TYPE_C32) && (direction == PS_FFT_REVERSE)) {57 char* typeStr;58 PS_TYPE_NAME(typeStr,type);59 psErrorMsg(PS_ERRORNAME_DOMAIN "psVectorFFT",60 PS_ERR_BAD_PARAMETER_TYPE, true,61 PS_ERRORTEXT_psVectorFFT_REVERSE_NOT_COMPLEX,62 typeStr);63 psFree(out);64 return NULL;65 66 }67 68 if ((type != PS_TYPE_F32) && (direction == PS_FFT_FORWARD)) {69 char* typeStr;70 PS_TYPE_NAME(typeStr,type);71 psErrorMsg(PS_ERRORNAME_DOMAIN "psVectorFFT",72 PS_ERR_BAD_PARAMETER_TYPE, true,73 PS_ERRORTEXT_psVectorFFT_FORWARD_NOT_REAL,74 typeStr);75 psFree(out);76 return NULL;77 }78 79 45 /* make sure the system-level wisdom information is imported. */ 80 46 if (!p_fftwWisdomImported) { … … 85 51 numElements = in->n; 86 52 87 out = psVector Recycle(out, numElements, PS_TYPE_C32);53 out = psVectorCopy(out, in, PS_TYPE_C32); 88 54 out->n = numElements; 89 55 90 if (type == PS_TYPE_F32) { 91 // need to convert to complex 92 psC32* outVec = out->data.C32; 93 psF32* inVec = in->data.F32; 94 95 for (unsigned int i = 0; i < numElements; i++) { 96 outVec[i] = inVec[i]; 97 } 98 } else { 99 psC32* outVec = out->data.C32; 100 psC32* inVec = in->data.C32; 101 102 for (unsigned int i = 0; i < numElements; i++) { 103 outVec[i] = inVec[i]; 104 } 105 } 106 107 plan = fftwf_plan_dft_1d(numElements, 108 (fftwf_complex *) out->data.C32, 109 (fftwf_complex *) out->data.C32, direction, P_FFTW_PLAN_RIGOR); 56 if ((direction & PS_FFT_FORWARD) != 0) { 57 plan = fftwf_plan_dft_1d(numElements, 58 (fftwf_complex *) out->data.C32, 59 (fftwf_complex *) out->data.C32, FFTW_FORWARD, P_FFTW_PLAN_RIGOR); 60 } else if ((direction & PS_FFT_REVERSE) != 0) { 61 plan = fftwf_plan_dft_1d(numElements, 62 (fftwf_complex *) out->data.C32, 63 (fftwf_complex *) out->data.C32, FFTW_BACKWARD, P_FFTW_PLAN_RIGOR); 64 } else { 65 psErrorMsg(PS_ERRORNAME_DOMAIN "psVectorFFT", 66 PS_ERR_BAD_PARAMETER_VALUE, true, 67 PS_ERRORTEXT_psVectorFFT_DIRECTION_NOTSET); 68 psFree(out); 69 return NULL; 70 } 110 71 111 72 /* check if a plan exists now */ … … 122 83 123 84 fftwf_destroy_plan(plan); 85 86 if ((direction & PS_FFT_REAL_RESULT) != 0) { 87 for (int i = 0; i < numElements; i++) { 88 out->data.F32[i] = out->data.C32[i]; 89 } 90 out->type.type = PS_TYPE_F32; 91 out->data.V = psRealloc(out->data.V,PSELEMTYPE_SIZEOF(PS_TYPE_F32)*out->nalloc); 92 } 124 93 125 94 return out; -
trunk/psLib/src/fft/psVectorFFT.c
r1864 r2080 5 5 * @author Robert DeSonia, MHPCC 6 6 * 7 * @version $Revision: 1.2 5$ $Name: not supported by cvs2svn $8 * @date $Date: 2004- 09-23 18:31:49$7 * @version $Revision: 1.26 $ $Name: not supported by cvs2svn $ 8 * @date $Date: 2004-10-13 20:46:57 $ 9 9 * 10 10 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 43 43 type = in->type.type; 44 44 45 if ((type != PS_TYPE_F32) && (type != PS_TYPE_C32)) {46 char* typeStr;47 PS_TYPE_NAME(typeStr,type);48 psErrorMsg(PS_ERRORNAME_DOMAIN "psVectorFFT",49 PS_ERR_BAD_PARAMETER_TYPE, true,50 PS_ERRORTEXT_psVectorFFT_IMAGE_TYPE_UNSUPPORTED,51 typeStr);52 psFree(out);53 return NULL;54 }55 56 if ((type != PS_TYPE_C32) && (direction == PS_FFT_REVERSE)) {57 char* typeStr;58 PS_TYPE_NAME(typeStr,type);59 psErrorMsg(PS_ERRORNAME_DOMAIN "psVectorFFT",60 PS_ERR_BAD_PARAMETER_TYPE, true,61 PS_ERRORTEXT_psVectorFFT_REVERSE_NOT_COMPLEX,62 typeStr);63 psFree(out);64 return NULL;65 66 }67 68 if ((type != PS_TYPE_F32) && (direction == PS_FFT_FORWARD)) {69 char* typeStr;70 PS_TYPE_NAME(typeStr,type);71 psErrorMsg(PS_ERRORNAME_DOMAIN "psVectorFFT",72 PS_ERR_BAD_PARAMETER_TYPE, true,73 PS_ERRORTEXT_psVectorFFT_FORWARD_NOT_REAL,74 typeStr);75 psFree(out);76 return NULL;77 }78 79 45 /* make sure the system-level wisdom information is imported. */ 80 46 if (!p_fftwWisdomImported) { … … 85 51 numElements = in->n; 86 52 87 out = psVector Recycle(out, numElements, PS_TYPE_C32);53 out = psVectorCopy(out, in, PS_TYPE_C32); 88 54 out->n = numElements; 89 55 90 if (type == PS_TYPE_F32) { 91 // need to convert to complex 92 psC32* outVec = out->data.C32; 93 psF32* inVec = in->data.F32; 94 95 for (unsigned int i = 0; i < numElements; i++) { 96 outVec[i] = inVec[i]; 97 } 98 } else { 99 psC32* outVec = out->data.C32; 100 psC32* inVec = in->data.C32; 101 102 for (unsigned int i = 0; i < numElements; i++) { 103 outVec[i] = inVec[i]; 104 } 105 } 106 107 plan = fftwf_plan_dft_1d(numElements, 108 (fftwf_complex *) out->data.C32, 109 (fftwf_complex *) out->data.C32, direction, P_FFTW_PLAN_RIGOR); 56 if ((direction & PS_FFT_FORWARD) != 0) { 57 plan = fftwf_plan_dft_1d(numElements, 58 (fftwf_complex *) out->data.C32, 59 (fftwf_complex *) out->data.C32, FFTW_FORWARD, P_FFTW_PLAN_RIGOR); 60 } else if ((direction & PS_FFT_REVERSE) != 0) { 61 plan = fftwf_plan_dft_1d(numElements, 62 (fftwf_complex *) out->data.C32, 63 (fftwf_complex *) out->data.C32, FFTW_BACKWARD, P_FFTW_PLAN_RIGOR); 64 } else { 65 psErrorMsg(PS_ERRORNAME_DOMAIN "psVectorFFT", 66 PS_ERR_BAD_PARAMETER_VALUE, true, 67 PS_ERRORTEXT_psVectorFFT_DIRECTION_NOTSET); 68 psFree(out); 69 return NULL; 70 } 110 71 111 72 /* check if a plan exists now */ … … 122 83 123 84 fftwf_destroy_plan(plan); 85 86 if ((direction & PS_FFT_REAL_RESULT) != 0) { 87 for (int i = 0; i < numElements; i++) { 88 out->data.F32[i] = out->data.C32[i]; 89 } 90 out->type.type = PS_TYPE_F32; 91 out->data.V = psRealloc(out->data.V,PSELEMTYPE_SIZEOF(PS_TYPE_F32)*out->nalloc); 92 } 124 93 125 94 return out;
Note:
See TracChangeset
for help on using the changeset viewer.
