Introduced another intermediate function for retrieving integer indexes
This commit is contained in:
parent
7db82b3bb1
commit
523cc8e44e
@ -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)
|
||||
|
@ -1,6 +1,8 @@
|
||||
#ifndef __DETAILS_EUCLIDIAN_SPECTRUM_1D
|
||||
#define __DETAILS_EUCLIDIAN_SPECTRUM_1D
|
||||
|
||||
#include <boost/function.hpp>
|
||||
|
||||
|
||||
namespace CosmoTool
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user