Fixup for sph

This commit is contained in:
Guilhem Lavaux 2024-04-26 08:53:38 +02:00
parent 924047de22
commit fb51ffd35e

View File

@ -40,8 +40,8 @@ namespace CosmoTool {
uint32_t requested = newNngb; uint32_t requested = newNngb;
if (state != 0) { if (state != 0) {
state->distances = boost::shared_ptr<CoordType[]>(new CoordType[Nsph]); state->distances = boost::shared_ptr<CoordType[]>(new CoordType[newNngb]);
state->ngb = boost::shared_ptr<SPHCell *[]>(new SPHCell *[Nsph]); state->ngb = boost::shared_ptr<SPHCell *[]>(new SPHCell *[newNngb]);
} else { } else {
state = &internal; state = &internal;
if (requested > maxNgb) { if (requested > maxNgb) {
@ -212,7 +212,7 @@ namespace CosmoTool {
ComputePrecision d = state->distances[i]; ComputePrecision d = state->distances[i];
SPHCell &cell = *(state->ngb[i]); SPHCell &cell = *(state->ngb[i]);
double kernel_value = getKernel(d / state->smoothRadius) / r3; double kernel_value = getKernel(d / state->smoothRadius) / r3;
#pragma omp atomic #pragma omp atomic update
cell.val.weight += kernel_value; cell.val.weight += kernel_value;
} }
} }