forked from abacusmodeling/abacus-develop
-
Notifications
You must be signed in to change notification settings - Fork 145
Refactor:Replace the current fft with templates and polymorphism #5410
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 21 commits
Commits
Show all changes
31 commits
Select commit
Hold shift + click to select a range
c73bd57
add the basic func of the file
A-006 e838161
modify the Makefile
A-006 75e42ba
delete file
A-006 8d73d7e
modify the position of the new fft
A-006 5304827
modify the Makefile
A-006 4049c76
[pre-commit.ci lite] apply automatic fixes
pre-commit-ci-lite[bot] 5cfd6bc
add the cpu float in the fft floder
A-006 9b8fb19
change the test file
A-006 d7f50df
[pre-commit.ci lite] apply automatic fixes
pre-commit-ci-lite[bot] 9ad3c19
add the func in test
A-006 dfaad66
add the float fft
A-006 b40629d
change ft into ft1
A-006 965d627
add the file of the float_define and the device set
A-006 39e0d0c
delete the memory allocate in the ft
A-006 b183967
[pre-commit.ci lite] apply automatic fixes
pre-commit-ci-lite[bot] 2a45b32
add the Smart Pointer and the logic gate
A-006 28419a6
modify the position of the FFT
A-006 d29b355
change fft_bundle name
A-006 6cc4bac
save version of the pw_test and single version
A-006 2d0b5f3
fix complie bug and change the fftwf logic
A-006 0610758
Merge branch 'develop' into fft1
A-006 da26acc
add comments for the fft class
A-006 9b200a2
modify the fft name and add comments
A-006 f07a97d
modify the Makefile
A-006 2623735
Merge branch 'develop' into fft1
A-006 61bb766
Merge branch 'develop' into fft1
mohanchen 9c1a22d
update the file
A-006 9029453
update the format
A-006 479b178
update the shared_ptr
A-006 76f0d85
Merge branch 'develop' into fft1
A-006 00dfee5
[pre-commit.ci lite] apply automatic fixes
pre-commit-ci-lite[bot] File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,4 +9,4 @@ scf_thr 1e-7 | |
| scf_nmax 100 | ||
| device cpu | ||
| ks_solver dav_subspace | ||
| precision double | ||
| precision single | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,7 +6,6 @@ list (APPEND LIBM_SRC | |
| libm/sincos.cpp | ||
| ) | ||
| endif() | ||
|
|
||
| add_library( | ||
| base | ||
| OBJECT | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| #include "fft_base.h" | ||
| namespace ModulePW | ||
| { | ||
| template <typename FPTYPE> | ||
| FFT_BASE<FPTYPE>::FFT_BASE() | ||
| { | ||
| } | ||
| template <typename FPTYPE> | ||
| FFT_BASE<FPTYPE>::~FFT_BASE() | ||
| { | ||
| } | ||
|
|
||
| template FFT_BASE<float>::FFT_BASE(); | ||
| template FFT_BASE<double>::FFT_BASE(); | ||
| template FFT_BASE<float>::~FFT_BASE(); | ||
| template FFT_BASE<double>::~FFT_BASE(); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
| #include <complex> | ||
| #include <string> | ||
| #include "fftw3.h" | ||
| #ifndef FFT_BASE_H | ||
| #define FFT_BASE_H | ||
| namespace ModulePW | ||
| { | ||
| template <typename FPTYPE> | ||
| class FFT_BASE | ||
| { | ||
| public: | ||
|
|
||
| FFT_BASE(); | ||
| virtual ~FFT_BASE(); | ||
|
|
||
| // init parameters of fft | ||
| virtual __attribute__((weak)) | ||
| void initfft(int nx_in, int ny_in, int nz_in, int lixy_in, int rixy_in, int ns_in, int nplane_in, | ||
| int nproc_in, bool gamma_only_in, bool xprime_in = true, bool mpifft_in = false); | ||
|
|
||
| //init fftw_plans | ||
| virtual void setupFFT()=0; | ||
|
|
||
| //destroy fftw_plans | ||
| virtual void cleanFFT()=0; | ||
| //clear fftw_data | ||
| virtual void clear()=0; | ||
|
|
||
| // access the real space data | ||
| virtual __attribute__((weak)) FPTYPE* get_rspace_data() const; | ||
|
|
||
| virtual __attribute__((weak)) std::complex<FPTYPE>* get_auxr_data() const; | ||
|
|
||
| virtual __attribute__((weak)) std::complex<FPTYPE>* get_auxg_data() const; | ||
|
|
||
| virtual __attribute__((weak)) std::complex<FPTYPE>* get_auxr_3d_data() const; | ||
|
|
||
| //forward fft in x-y direction | ||
| virtual __attribute__((weak)) void fftxyfor(std::complex<FPTYPE>* in, std::complex<FPTYPE>* out) const; | ||
|
|
||
| virtual __attribute__((weak)) void fftxybac(std::complex<FPTYPE>* in, std::complex<FPTYPE>* out) const; | ||
|
|
||
| virtual __attribute__((weak)) void fftzfor(std::complex<FPTYPE>* in, std::complex<FPTYPE>* out) const; | ||
|
|
||
| virtual __attribute__((weak)) void fftzbac(std::complex<FPTYPE>* in, std::complex<FPTYPE>* out) const; | ||
|
|
||
| virtual __attribute__((weak)) void fftxyr2c(FPTYPE* in, std::complex<FPTYPE>* out) const; | ||
|
|
||
| virtual __attribute__((weak)) void fftxyc2r(std::complex<FPTYPE>* in, FPTYPE* out) const; | ||
|
|
||
| virtual __attribute__((weak)) void fft3D_forward(std::complex<FPTYPE>* in, std::complex<FPTYPE>* out) const; | ||
|
|
||
| virtual __attribute__((weak)) void fft3D_backward(std::complex<FPTYPE>* in, std::complex<FPTYPE>* out) const; | ||
|
|
||
| protected: | ||
| int ny=0; | ||
| int nx=0; | ||
| int nz=0; | ||
|
|
||
| }; | ||
| } | ||
| #endif // FFT_BASE_H |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.