diff --git a/src/fourier/details/euclidian_maps.hpp b/src/fourier/details/euclidian_maps.hpp index 67b141b..cfadc72 100644 --- a/src/fourier/details/euclidian_maps.hpp +++ b/src/fourier/details/euclidian_maps.hpp @@ -136,14 +136,21 @@ namespace CosmoTool { const DimArray& dims = this->getDims(); DimArray d(delta_k.size()); - for (int q = 0; q < d.size(); q++) - { - d[q] = p%dims[q]; - p = (p-d[q])/dims[q]; - } + get_IKvec(p, d); get_Kvec(d, kvec); } + void get_IKvec(long p, DimArray& ikvec) + { + const DimArray& dims = this->getDims(); + assert(dims.size()==ikvec.size()); + for (int q = 0; q < ikvec.size(); q++) + { + ikvec[q] = p%dims[q]; + p = (p-ikvec[q])/dims[q]; + } + } + template double get_K(const Array& ik) diff --git a/src/fourier/details/euclidian_spectrum_1d.hpp b/src/fourier/details/euclidian_spectrum_1d.hpp index b12864b..291470d 100644 --- a/src/fourier/details/euclidian_spectrum_1d.hpp +++ b/src/fourier/details/euclidian_spectrum_1d.hpp @@ -1,6 +1,8 @@ #ifndef __DETAILS_EUCLIDIAN_SPECTRUM_1D #define __DETAILS_EUCLIDIAN_SPECTRUM_1D +#include + namespace CosmoTool {