Modernise TPM_FFTW#405
Conversation
There was a problem hiding this comment.
Pull request overview
This PR modernises tpm_fftw.F90 by switching from the legacy FFTW Fortran interface (SFFTW_*/DFFTW_*) to the FFTW3 iso_c_binding interface (FFTW_*/FFTWF_*). It also performs an extensive readability refactor: the two near-identical executors EXEC_FFTW and EXEC_EFFTW are unified into a single EXEC_FFTW_IMPL parameterised by a LD_TRANSPOSED flag, magic literals are pulled out as module parameters, and small precision-dispatch wrappers and generic interfaces remove inline IF(JPRB==JPRD) branches. Plan handles change type from INTEGER(KIND=JPIB) to TYPE(C_PTR) accordingly.
Changes:
- Replace legacy FFTW API with the FFTW3
iso_c_bindingAPI, including newTPM_FFTW_*precision-dispatch helpers and genericINTERFACEblocks; change plan handle type fromINTEGER(JPIB)toTYPE(C_PTR). - Deduplicate
EXEC_FFTW/EXEC_EFFTWintoEXEC_FFTW_IMPLdriven byLD_TRANSPOSED; factor input/output staging intoCOPY_PREEL_TO_ZFFT,COPY_ZFFT_TO_PREEL, and rank-1 variants. - Introduce named constants (
NTYPE_C2R,NTYPE_R2C,TPM_FFTW_PLAN_FLAGS,NPLAN_ID_UNINITIALISED,NPLAN_ID_DESTROYED) and add Doxygen-style documentation throughout.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
It came to my attention that there is a FFTW API for FFT992 here: https://github.com/pmarguinaud/fftw992 which does not implement the modern FFTW API. I will adapt this PR to still use the legacy API. |
|
Just had a brief look. Looks good and very nice work. Let me know when you want a full review by marking the PR as ready. |
f08f4b2 to
edbeac6
Compare
|
TPM_FFTW has been adapted to use the LEGACY interface again. |
edbeac6 to
6ef0edf
Compare
|
@samhatfield This is now ready for final review. |
…ssor definition LEGACY_FFTW_INTERFACE hardcoded in tpm_fftw.F90
6ef0edf to
42f1238
Compare
Description
SFFTW_*andDFFTW_*) to the FFTW3 API (FFTW_*andFFTWF_*).IF(JPRB==JPRD)obfuscating the control flow.Contributor Declaration
By opening this pull request, I affirm the following: