File tree Expand file tree Collapse file tree 1 file changed +11
-6
lines changed
Expand file tree Collapse file tree 1 file changed +11
-6
lines changed Original file line number Diff line number Diff line change @@ -187,14 +187,19 @@ void BiorthCyl::initialize_cuda
187187 // Add background arrays
188188 //
189189 std::vector<thrust::host_vector<cuFP_t>> tt (ndim2);
190- for (auto & v : tt) v.resize (numr);
190+ for (auto & v : tt) {
191+ v.resize (numr);
192+ thrust::fill (v.begin (), v.end (), 0.0 );
193+ }
191194
192- double dx0 = (xmax - xmin)/(numr - 1 );
195+ if (disk) {
196+ double dx0 = (xmax - xmin)/(numr - 1 );
193197
194- for (int i=0 ; i<numr; i++) {
195- double r = xi_to_r (xmin + dx0*i);
196- tt[0 ][i] = disk->pot (r);
197- tt[1 ][i] = disk->dpot (r);
198+ for (int i=0 ; i<numr; i++) {
199+ double r = xi_to_r (xmin + dx0*i);
200+ tt[0 ][i] = disk->pot (r);
201+ tt[1 ][i] = disk->dpot (r);
202+ }
198203 }
199204
200205 // Allocate CUDA array in device memory (a one-dimension 'channel')
You can’t perform that action at this time.
0 commit comments