Added a test for the healpix/sharp tranform. Basic code compiles and work.

This commit is contained in:
Guilhem Lavaux 2012-11-10 12:22:37 -05:00
parent 707a25bda3
commit 352c6b6eb6
4 changed files with 104 additions and 39 deletions

View file

@ -49,7 +49,9 @@ if (FFTW3_FOUND AND EIGEN3_FOUND)
target_link_libraries(test_fft_calls ${tolink} ${FFTW3_LIBRARIES})
endif (FFTW3_FOUND AND EIGEN3_FOUND)
#if (SHARP_LIBRARY AND SHARP_INCLUDE_PATH AND EIGEN3_FOUND)
# add_executable(test_sharp_calls test_sharp_calls.cpp)
# target_link_libraries(test_sharp_calls ${tolink} ${SHARP_LIBRARY})
#endif (SHARP_LIBRARY AND SHARP_INCLUDE_PATH AND EIGEN3_FOUND)
if (SHARP_LIBRARY AND SHARP_INCLUDE_PATH AND EIGEN3_FOUND)
include_directories(${SHARP_INCLUDE_PATH})
add_executable(test_healpix_calls test_healpix_calls.cpp)
target_link_libraries(test_healpix_calls ${tolink} ${SHARP_LIBRARIES})
set_target_properties(test_healpix_calls PROPERTIES COMPILE_FLAGS ${OpenMP_CXX_FLAGS} LINK_FLAGS ${OpenMP_CXX_FLAGS})
endif (SHARP_LIBRARY AND SHARP_INCLUDE_PATH AND EIGEN3_FOUND)

View file

@ -0,0 +1,20 @@
#include <iostream>
#include "fourier/healpix.hpp"
using namespace CosmoTool;
using namespace std;
int main()
{
HealpixFourierTransform<double> dft(128,3*128,3*128, 40);
long Npix = dft.realSpace().size();
dft.realSpace().eigen().setRandom();
dft.analysis();
cout << "Map dot-product = " << dft.realSpace().dot_product(dft.realSpace()) << endl;
cout << "Fourier dot-product = " << dft.fourierSpace().dot_product(dft.fourierSpace()).real()*Npix/(4*M_PI) << endl;
dft.synthesis();
cout << "Resynthesis dot-product = " << dft.realSpace().dot_product(dft.realSpace()) << endl;
return 0;
}