Introduced another intermediate function for retrieving integer indexes

This commit is contained in:
Guilhem Lavaux 2012-11-28 22:33:42 -05:00
parent 7db82b3bb1
commit 523cc8e44e
2 changed files with 14 additions and 5 deletions

View File

@ -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<typename Array>
double get_K(const Array& ik)

View File

@ -1,6 +1,8 @@
#ifndef __DETAILS_EUCLIDIAN_SPECTRUM_1D
#define __DETAILS_EUCLIDIAN_SPECTRUM_1D
#include <boost/function.hpp>
namespace CosmoTool
{