Fixed fft_calls test and dimensions of fourier space

This commit is contained in:
Guilhem Lavaux 2012-11-10 10:56:47 -05:00
parent 414edbd28a
commit 72f658c7cf
2 changed files with 13 additions and 4 deletions

View file

@ -179,7 +179,9 @@ namespace CosmoTool
{
for (long p = 0; p < plane_size; p++)
{
result += 2*(conj(d1[q0+N0*p]) * d2[q0+N0*p]).real();
long idx = q0+N0*p;
assert(idx < this->size());
result += 2*(conj(d1[idx]) * d2[idx]).real();
}
}
for (long p = 0; p < plane_size; p++)
@ -205,7 +207,7 @@ namespace CosmoTool
typename calls::plan_type m_analysis, m_synthesis;
double volume;
long N;
DimArray m_dims;
DimArray m_dims, m_dims_hc;
std::vector<double> m_L;
public:
EuclidianFourierTransform(const DimArray& dims, const std::vector<double>& L)
@ -214,6 +216,8 @@ namespace CosmoTool
std::vector<double> dk(L.size());
m_dims = dims;
m_dims_hc = dims;
m_dims_hc[0] = dims[0]/2+1;
m_L = L;
N = 1;
@ -228,11 +232,11 @@ namespace CosmoTool
realMap = new EuclidianFourierMapReal<T>(
boost::shared_ptr<T>(calls::alloc_real(N),
std::ptr_fun(calls::free)),
dims);
m_dims);
fourierMap = new EuclidianFourierMapComplex<T>(
boost::shared_ptr<std::complex<T> >((std::complex<T>*)calls::alloc_complex(N),
std::ptr_fun(calls::free)),
dims, dk);
m_dims_hc, dk);
m_analysis = calls::plan_dft_r2c(dims.size(), &dims[0],
realMap->data(), (typename calls::complex_type *)fourierMap->data(),
FFTW_MEASURE);