diff --git a/src/cudaBiorthCyl.cu b/src/cudaBiorthCyl.cu index 468a7888..5a579020 100644 --- a/src/cudaBiorthCyl.cu +++ b/src/cudaBiorthCyl.cu @@ -187,14 +187,19 @@ void BiorthCyl::initialize_cuda // Add background arrays // std::vector> tt(ndim2); - for (auto & v : tt) v.resize(numr); + for (auto & v : tt) { + v.resize(numr); + thrust::fill(v.begin(), v.end(), 0.0); + } - double dx0 = (xmax - xmin)/(numr - 1); + if (disk) { + double dx0 = (xmax - xmin)/(numr - 1); - for (int i=0; ipot(r); - tt[1][i] = disk->dpot(r); + for (int i=0; ipot(r); + tt[1][i] = disk->dpot(r); + } } // Allocate CUDA array in device memory (a one-dimension 'channel')