Skip to content

Commit b80b01d

Browse files
committed
Adaptation for global / particle tof trains
1 parent d755f6a commit b80b01d

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

mcstas-comps/examples/Prototypes/ODIN_MCPL_TOF_train4/ODIN_MCPL_TOF_train4.instr

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -307,14 +307,14 @@ EXTEND %{
307307
double tZERO = t;
308308
if (total_N_sent == 0) {
309309
#pragma acc atomic
310-
adaptive_N = _particle->N_trains;
310+
adaptive_N = N_trains;
311311
} else {
312312
long tmp = ceil(INSTRUMENT_GETPAR(target_tsplit)*total_N_sent/total_arrived);
313313
#pragma acc atomic
314314
adaptive_N = tmp;
315-
if (adaptive_N > _particle->N_trains) {
315+
if (adaptive_N > N_trains) {
316316
#pragma acc atomic
317-
adaptive_N = _particle->N_trains;
317+
adaptive_N = N_trains;
318318
}
319319
}
320320

@@ -325,13 +325,13 @@ EXTEND %{
325325
// Generate ray as normal with its associated p and t
326326
// Save these to t_offset and p_train
327327

328-
_particle->t_offset[train_index] = t;
329-
_particle->p_trains[train_index] = p/adaptive_N;
330-
_particle->p_last_time_manipulation += _particle->p_trains[train_index];
328+
t_offset[train_index] = t;
329+
p_trains[train_index] = p/adaptive_N;
330+
p_last_time_manipulation += p_trains[train_index];
331331
}
332332
// Set base particle t and p, now p will be decoupled from the source intensity.
333333
t=0;
334-
p=_particle->p_last_time_manipulation;
334+
p=p_last_time_manipulation;
335335

336336
%}
337337

0 commit comments

Comments
 (0)