Some fixups

This commit is contained in:
Guilhem Lavaux 2019-11-11 10:32:40 +01:00
parent 1bd685e9c5
commit 71691956cc
6 changed files with 24 additions and 10 deletions

View File

@ -171,6 +171,7 @@ void CosmoTool_compute_bispectrum(
size_t *Ntriangles,
double* B, double delta_k, size_t Nk )
{
#if 0
// First remap to multi_array for easy access
size_t kNz = Nz/2+1;
#ifdef _OPENMP
@ -246,6 +247,7 @@ void CosmoTool_compute_bispectrum(
#else
#warning Serial version not implemented
#endif
#endif
}
@ -255,6 +257,7 @@ void CosmoTool_compute_powerspectrum(
size_t *Ncounts,
double* P, double delta_k, size_t Nk )
{
#if 0
// First remap to multi_array for easy access
size_t kNz = Nz/2+1;
boost::multi_array_ref<std::complex<double>, 3> a_delta(reinterpret_cast<std::complex<double>*>(delta_hat), boost::extents[Nx][Ny][kNz]);
@ -275,4 +278,5 @@ void CosmoTool_compute_powerspectrum(
a_Nc[q1] ++;
a_P[q1] += std::norm(v1);
}
#endif
}

View File

@ -65,18 +65,30 @@ cdef class CosmologyPower:
cdef CosmoPower power
def __init__(self,**cosmo):
"""Constructor
Keyword arguments:
* omega_B_0
* omega_M_0
* h
* ns
* T27
"""
self.power = CosmoPower()
self.power.OMEGA_B = cosmo['omega_B_0']
self.power.OMEGA_C = cosmo['omega_M_0']-cosmo['omega_B_0']
self.power.h = cosmo['h']
if 'ns' in cosmo:
self.power.n = cosmo['ns']
if 'T27' in cosmo:
self.power.THETA_27 = cosmo['T27']
assert self.power.OMEGA_C > 0
self.power.updateCosmology()
def setNormalization(self,A):
"""Set manual normalization for A_S"""
self.power.setNormalization(A)
def normalize(self,s8,k_min=-1,k_max=-1):

View File

@ -509,19 +509,17 @@ cdef void INTERNAL_project_cic_with_mass_periodic(DTYPE_t[:,:,:] g,
cdef int b1[3]
for i in range(x.shape[0]):
for j in range(3):
a[j] = (x[i,j]+shifter)*delta_Box
b[j] = int(floor(a[j]))
b1[j] = b[j]+1
while b1[j] < 0:
b1[j] += Ngrid
while b1[j] >= Ngrid:
b1[j] -= Ngrid
b1[j] = (b[j]+1) % Ngrid
a[j] -= b[j]
c[j] = 1-a[j]
b[j] %= Ngrid
m0 = mass[i]
g[b[0],b[1],b[2]] += c[0]*c[1]*c[2]*m0
g[b1[0],b[1],b[2]] += a[0]*c[1]*c[2]*m0

View File

@ -146,7 +146,7 @@ int main(int argc, char **argv)
if (rx < 0 || rx >= Nres || ry < 0 || ry >= Nres || rz < 0 || rz >= Nres)
continue;
#pragma omp atomic update
//#pragma omp atomic update
bins[rx][ry][rz]++;
}
v1_data.resize(boost::extents[1][1]);

View File

@ -218,7 +218,7 @@ class BuildCMakeExt(build_ext):
CosmoTool_extension = CMakeExtension(name="cosmotool")
setup(name='cosmotool',
version='1.0.0a0',
version='1.0.0a2',
packages=["cosmotool"],
package_dir={'cosmotool': 'python/cosmotool'},
setup_requires=['cython','cffi','numexpr'],

View File

@ -277,7 +277,7 @@ namespace CosmoTool {
coords tmpBound;
NodeIntType nodeId;
#pragma omp atomic capture
//#pragma omp atomic capture
nodeId = (this->lastNode)++;
node = &nodes[nodeId];
@ -293,7 +293,7 @@ namespace CosmoTool {
tmpBound[axis] = node->value->coord[axis];
depth++;
#pragma omp task private(tmpBound)
//#pragma omp task private(tmpBound)
{
node->children[0] = buildTree(cell0, mid, depth, minBound, tmpBound);
}