xsuite 0.40.0__cp310-cp310-macosx_11_0_arm64.whl → 0.40.2__cp310-cp310-macosx_11_0_arm64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of xsuite might be problematic. Click here for more details.
- xsuite/lib/default_base_config.c +48215 -48215
- xsuite/lib/default_base_config.cpython-310-darwin.so +0 -0
- xsuite/lib/default_base_config.json +2 -2
- xsuite/lib/default_no_config.c +31402 -31402
- xsuite/lib/default_no_config.cpython-310-darwin.so +0 -0
- xsuite/lib/default_no_config.json +2 -2
- xsuite/lib/non_tracking_kernels.c +1141 -1141
- xsuite/lib/non_tracking_kernels.cpython-310-darwin.so +0 -0
- xsuite/lib/non_tracking_kernels.json +2 -2
- xsuite/lib/only_xtrack_with_synrad.c +19821 -19821
- xsuite/lib/only_xtrack_with_synrad.cpython-310-darwin.so +0 -0
- xsuite/lib/only_xtrack_with_synrad.json +2 -2
- {xsuite-0.40.0.dist-info → xsuite-0.40.2.dist-info}/METADATA +4 -4
- xsuite-0.40.2.dist-info/RECORD +23 -0
- xsuite-0.40.0.dist-info/RECORD +0 -23
- {xsuite-0.40.0.dist-info → xsuite-0.40.2.dist-info}/WHEEL +0 -0
- {xsuite-0.40.0.dist-info → xsuite-0.40.2.dist-info}/entry_points.txt +0 -0
- {xsuite-0.40.0.dist-info → xsuite-0.40.2.dist-info}/licenses/LICENSE +0 -0
- {xsuite-0.40.0.dist-info → xsuite-0.40.2.dist-info}/top_level.txt +0 -0
|
@@ -3368,244 +3368,679 @@ void LocalParticle_scale_exact_xp_yp(LocalParticle* part, double value_x, double
|
|
|
3368
3368
|
}
|
|
3369
3369
|
|
|
3370
3370
|
|
|
3371
|
-
#ifndef
|
|
3372
|
-
#define
|
|
3373
|
-
typedef struct
|
|
3374
|
-
static inline
|
|
3371
|
+
#ifndef XOBJ_TYPEDEF_RandomUniformData
|
|
3372
|
+
#define XOBJ_TYPEDEF_RandomUniformData
|
|
3373
|
+
typedef struct RandomUniformData_s * RandomUniformData;
|
|
3374
|
+
static inline RandomUniformData RandomUniformData_getp(RandomUniformData restrict obj){
|
|
3375
3375
|
int64_t offset=0;
|
|
3376
|
-
return (
|
|
3376
|
+
return (RandomUniformData)(( char*) obj+offset);
|
|
3377
3377
|
}
|
|
3378
|
-
static inline
|
|
3378
|
+
static inline uint8_t RandomUniformData_get__dummy(const RandomUniformData restrict obj){
|
|
3379
|
+
int64_t offset=0;
|
|
3380
|
+
return *(( uint8_t*) obj+offset);
|
|
3381
|
+
}
|
|
3382
|
+
static inline void RandomUniformData_set__dummy(RandomUniformData restrict obj, uint8_t value){
|
|
3383
|
+
int64_t offset=0;
|
|
3384
|
+
*(( uint8_t*) obj+offset)=value;
|
|
3385
|
+
}
|
|
3386
|
+
static inline uint8_t* RandomUniformData_getp__dummy(RandomUniformData restrict obj){
|
|
3387
|
+
int64_t offset=0;
|
|
3388
|
+
return ( uint8_t*)(( char*) obj+offset);
|
|
3389
|
+
}
|
|
3390
|
+
static inline double RandomUniformData_get__sin_rot_s(const RandomUniformData restrict obj){
|
|
3379
3391
|
int64_t offset=0;
|
|
3380
3392
|
offset+=8;
|
|
3381
|
-
return *(
|
|
3393
|
+
return *( double*)(( char*) obj+offset);
|
|
3382
3394
|
}
|
|
3383
|
-
static inline void
|
|
3395
|
+
static inline void RandomUniformData_set__sin_rot_s(RandomUniformData restrict obj, double value){
|
|
3384
3396
|
int64_t offset=0;
|
|
3385
3397
|
offset+=8;
|
|
3386
|
-
*(
|
|
3398
|
+
*( double*)(( char*) obj+offset)=value;
|
|
3387
3399
|
}
|
|
3388
|
-
static inline
|
|
3400
|
+
static inline double* RandomUniformData_getp__sin_rot_s(RandomUniformData restrict obj){
|
|
3389
3401
|
int64_t offset=0;
|
|
3390
3402
|
offset+=8;
|
|
3391
|
-
return (
|
|
3403
|
+
return ( double*)(( char*) obj+offset);
|
|
3392
3404
|
}
|
|
3393
|
-
static inline
|
|
3405
|
+
static inline double RandomUniformData_get__cos_rot_s(const RandomUniformData restrict obj){
|
|
3394
3406
|
int64_t offset=0;
|
|
3395
3407
|
offset+=16;
|
|
3396
|
-
return *(
|
|
3408
|
+
return *( double*)(( char*) obj+offset);
|
|
3397
3409
|
}
|
|
3398
|
-
static inline void
|
|
3410
|
+
static inline void RandomUniformData_set__cos_rot_s(RandomUniformData restrict obj, double value){
|
|
3399
3411
|
int64_t offset=0;
|
|
3400
3412
|
offset+=16;
|
|
3401
|
-
*(
|
|
3413
|
+
*( double*)(( char*) obj+offset)=value;
|
|
3402
3414
|
}
|
|
3403
|
-
static inline
|
|
3415
|
+
static inline double* RandomUniformData_getp__cos_rot_s(RandomUniformData restrict obj){
|
|
3404
3416
|
int64_t offset=0;
|
|
3405
3417
|
offset+=16;
|
|
3406
|
-
return (
|
|
3418
|
+
return ( double*)(( char*) obj+offset);
|
|
3407
3419
|
}
|
|
3408
|
-
static inline
|
|
3420
|
+
static inline double RandomUniformData_get__shift_x(const RandomUniformData restrict obj){
|
|
3409
3421
|
int64_t offset=0;
|
|
3410
3422
|
offset+=24;
|
|
3411
|
-
return *(
|
|
3423
|
+
return *( double*)(( char*) obj+offset);
|
|
3412
3424
|
}
|
|
3413
|
-
static inline void
|
|
3425
|
+
static inline void RandomUniformData_set__shift_x(RandomUniformData restrict obj, double value){
|
|
3414
3426
|
int64_t offset=0;
|
|
3415
3427
|
offset+=24;
|
|
3416
|
-
*(
|
|
3428
|
+
*( double*)(( char*) obj+offset)=value;
|
|
3417
3429
|
}
|
|
3418
|
-
static inline
|
|
3430
|
+
static inline double* RandomUniformData_getp__shift_x(RandomUniformData restrict obj){
|
|
3419
3431
|
int64_t offset=0;
|
|
3420
3432
|
offset+=24;
|
|
3421
|
-
return (
|
|
3433
|
+
return ( double*)(( char*) obj+offset);
|
|
3422
3434
|
}
|
|
3423
|
-
static inline
|
|
3435
|
+
static inline double RandomUniformData_get__shift_y(const RandomUniformData restrict obj){
|
|
3424
3436
|
int64_t offset=0;
|
|
3425
3437
|
offset+=32;
|
|
3426
|
-
return *(
|
|
3438
|
+
return *( double*)(( char*) obj+offset);
|
|
3427
3439
|
}
|
|
3428
|
-
static inline void
|
|
3440
|
+
static inline void RandomUniformData_set__shift_y(RandomUniformData restrict obj, double value){
|
|
3429
3441
|
int64_t offset=0;
|
|
3430
3442
|
offset+=32;
|
|
3431
|
-
*(
|
|
3443
|
+
*( double*)(( char*) obj+offset)=value;
|
|
3432
3444
|
}
|
|
3433
|
-
static inline
|
|
3445
|
+
static inline double* RandomUniformData_getp__shift_y(RandomUniformData restrict obj){
|
|
3434
3446
|
int64_t offset=0;
|
|
3435
3447
|
offset+=32;
|
|
3436
|
-
return (
|
|
3448
|
+
return ( double*)(( char*) obj+offset);
|
|
3437
3449
|
}
|
|
3438
|
-
static inline
|
|
3450
|
+
static inline double RandomUniformData_get__shift_s(const RandomUniformData restrict obj){
|
|
3439
3451
|
int64_t offset=0;
|
|
3440
3452
|
offset+=40;
|
|
3441
|
-
return *(
|
|
3453
|
+
return *( double*)(( char*) obj+offset);
|
|
3442
3454
|
}
|
|
3443
|
-
static inline void
|
|
3455
|
+
static inline void RandomUniformData_set__shift_s(RandomUniformData restrict obj, double value){
|
|
3444
3456
|
int64_t offset=0;
|
|
3445
3457
|
offset+=40;
|
|
3446
|
-
*(
|
|
3458
|
+
*( double*)(( char*) obj+offset)=value;
|
|
3447
3459
|
}
|
|
3448
|
-
static inline
|
|
3460
|
+
static inline double* RandomUniformData_getp__shift_s(RandomUniformData restrict obj){
|
|
3449
3461
|
int64_t offset=0;
|
|
3450
3462
|
offset+=40;
|
|
3451
|
-
return (
|
|
3463
|
+
return ( double*)(( char*) obj+offset);
|
|
3452
3464
|
}
|
|
3453
|
-
static inline
|
|
3465
|
+
static inline double RandomUniformData_get__rot_x_rad(const RandomUniformData restrict obj){
|
|
3454
3466
|
int64_t offset=0;
|
|
3455
3467
|
offset+=48;
|
|
3456
|
-
return *(
|
|
3468
|
+
return *( double*)(( char*) obj+offset);
|
|
3457
3469
|
}
|
|
3458
|
-
static inline void
|
|
3470
|
+
static inline void RandomUniformData_set__rot_x_rad(RandomUniformData restrict obj, double value){
|
|
3459
3471
|
int64_t offset=0;
|
|
3460
3472
|
offset+=48;
|
|
3461
|
-
*(
|
|
3473
|
+
*( double*)(( char*) obj+offset)=value;
|
|
3462
3474
|
}
|
|
3463
|
-
static inline
|
|
3475
|
+
static inline double* RandomUniformData_getp__rot_x_rad(RandomUniformData restrict obj){
|
|
3464
3476
|
int64_t offset=0;
|
|
3465
3477
|
offset+=48;
|
|
3466
|
-
return (
|
|
3478
|
+
return ( double*)(( char*) obj+offset);
|
|
3467
3479
|
}
|
|
3468
|
-
static inline
|
|
3480
|
+
static inline double RandomUniformData_get__rot_y_rad(const RandomUniformData restrict obj){
|
|
3469
3481
|
int64_t offset=0;
|
|
3470
3482
|
offset+=56;
|
|
3471
|
-
return *(
|
|
3483
|
+
return *( double*)(( char*) obj+offset);
|
|
3472
3484
|
}
|
|
3473
|
-
static inline void
|
|
3485
|
+
static inline void RandomUniformData_set__rot_y_rad(RandomUniformData restrict obj, double value){
|
|
3474
3486
|
int64_t offset=0;
|
|
3475
3487
|
offset+=56;
|
|
3476
|
-
*(
|
|
3488
|
+
*( double*)(( char*) obj+offset)=value;
|
|
3477
3489
|
}
|
|
3478
|
-
static inline
|
|
3490
|
+
static inline double* RandomUniformData_getp__rot_y_rad(RandomUniformData restrict obj){
|
|
3479
3491
|
int64_t offset=0;
|
|
3480
3492
|
offset+=56;
|
|
3481
|
-
return (
|
|
3493
|
+
return ( double*)(( char*) obj+offset);
|
|
3482
3494
|
}
|
|
3483
|
-
static inline
|
|
3495
|
+
static inline double RandomUniformData_get__rot_s_rad_no_frame(const RandomUniformData restrict obj){
|
|
3484
3496
|
int64_t offset=0;
|
|
3485
3497
|
offset+=64;
|
|
3486
|
-
return *(
|
|
3498
|
+
return *( double*)(( char*) obj+offset);
|
|
3487
3499
|
}
|
|
3488
|
-
static inline void
|
|
3500
|
+
static inline void RandomUniformData_set__rot_s_rad_no_frame(RandomUniformData restrict obj, double value){
|
|
3489
3501
|
int64_t offset=0;
|
|
3490
3502
|
offset+=64;
|
|
3491
|
-
*(
|
|
3503
|
+
*( double*)(( char*) obj+offset)=value;
|
|
3492
3504
|
}
|
|
3493
|
-
static inline
|
|
3505
|
+
static inline double* RandomUniformData_getp__rot_s_rad_no_frame(RandomUniformData restrict obj){
|
|
3494
3506
|
int64_t offset=0;
|
|
3495
3507
|
offset+=64;
|
|
3496
|
-
return (
|
|
3508
|
+
return ( double*)(( char*) obj+offset);
|
|
3497
3509
|
}
|
|
3498
|
-
static inline
|
|
3510
|
+
static inline double RandomUniformData_get_rot_shift_anchor(const RandomUniformData restrict obj){
|
|
3499
3511
|
int64_t offset=0;
|
|
3500
3512
|
offset+=72;
|
|
3501
|
-
return *(
|
|
3513
|
+
return *( double*)(( char*) obj+offset);
|
|
3502
3514
|
}
|
|
3503
|
-
static inline void
|
|
3515
|
+
static inline void RandomUniformData_set_rot_shift_anchor(RandomUniformData restrict obj, double value){
|
|
3504
3516
|
int64_t offset=0;
|
|
3505
3517
|
offset+=72;
|
|
3506
|
-
*(
|
|
3518
|
+
*( double*)(( char*) obj+offset)=value;
|
|
3507
3519
|
}
|
|
3508
|
-
static inline
|
|
3520
|
+
static inline double* RandomUniformData_getp_rot_shift_anchor(RandomUniformData restrict obj){
|
|
3509
3521
|
int64_t offset=0;
|
|
3510
3522
|
offset+=72;
|
|
3511
|
-
return (
|
|
3512
|
-
}
|
|
3513
|
-
static inline ParticlesData ParticlesMonitorData_getp_data(ParticlesMonitorData restrict obj){
|
|
3514
|
-
int64_t offset=0;
|
|
3515
|
-
offset+=152;
|
|
3516
|
-
return (ParticlesData)(( char*) obj+offset);
|
|
3517
|
-
}
|
|
3518
|
-
static inline int64_t ParticlesMonitorData_get_data__capacity(const ParticlesMonitorData restrict obj){
|
|
3519
|
-
int64_t offset=0;
|
|
3520
|
-
offset+=160;
|
|
3521
|
-
return *( int64_t*)(( char*) obj+offset);
|
|
3522
|
-
}
|
|
3523
|
-
static inline void ParticlesMonitorData_set_data__capacity(ParticlesMonitorData restrict obj, int64_t value){
|
|
3524
|
-
int64_t offset=0;
|
|
3525
|
-
offset+=160;
|
|
3526
|
-
*( int64_t*)(( char*) obj+offset)=value;
|
|
3527
|
-
}
|
|
3528
|
-
static inline int64_t* ParticlesMonitorData_getp_data__capacity(ParticlesMonitorData restrict obj){
|
|
3529
|
-
int64_t offset=0;
|
|
3530
|
-
offset+=160;
|
|
3531
|
-
return ( int64_t*)(( char*) obj+offset);
|
|
3532
|
-
}
|
|
3533
|
-
static inline int64_t ParticlesMonitorData_get_data__num_active_particles(const ParticlesMonitorData restrict obj){
|
|
3534
|
-
int64_t offset=0;
|
|
3535
|
-
offset+=168;
|
|
3536
|
-
return *( int64_t*)(( char*) obj+offset);
|
|
3523
|
+
return ( double*)(( char*) obj+offset);
|
|
3537
3524
|
}
|
|
3538
|
-
|
|
3539
|
-
|
|
3540
|
-
|
|
3541
|
-
|
|
3525
|
+
#endif
|
|
3526
|
+
// copyright ############################### //
|
|
3527
|
+
// This file is part of the Xtrack Package. //
|
|
3528
|
+
// Copyright (c) CERN, 2021. //
|
|
3529
|
+
// ######################################### //
|
|
3530
|
+
|
|
3531
|
+
#ifndef XTRACK_CONSTANTS_H
|
|
3532
|
+
#define XTRACK_CONSTANTS_H
|
|
3533
|
+
|
|
3534
|
+
#if !defined( C_LIGHT )
|
|
3535
|
+
#define C_LIGHT ( 299792458.0 )
|
|
3536
|
+
#endif /* !defined( C_LIGHT ) */
|
|
3537
|
+
|
|
3538
|
+
#if !defined( EPSILON_0 )
|
|
3539
|
+
#define EPSILON_0 (8.854187817620e-12)
|
|
3540
|
+
#endif /* !defined( EPSILON_0 ) */
|
|
3541
|
+
|
|
3542
|
+
#if !defined( PI )
|
|
3543
|
+
#define PI (3.1415926535897932384626433832795028841971693993751)
|
|
3544
|
+
#endif /* !defined( PI ) */
|
|
3545
|
+
|
|
3546
|
+
#if !defined( MU_0 )
|
|
3547
|
+
#define MU_0 (PI*4.0e-7)
|
|
3548
|
+
#endif /* !defined( MU_0 ) */
|
|
3549
|
+
|
|
3550
|
+
#if !defined( DEG2RAD )
|
|
3551
|
+
#define DEG2RAD (0.0174532925199432957692369076848861271344287188854)
|
|
3552
|
+
#endif /* !defiend( DEG2RAD ) */
|
|
3553
|
+
|
|
3554
|
+
#if !defined( RAD2DEG )
|
|
3555
|
+
#define RAD2DEG (57.29577951308232087679815481410517033240547246656442)
|
|
3556
|
+
#endif /* !defiend( RAD2DEG ) */
|
|
3557
|
+
|
|
3558
|
+
#if !defined( SQRT_PI )
|
|
3559
|
+
#define SQRT_PI (1.7724538509055160272981674833411451827975494561224)
|
|
3560
|
+
#endif /* !defined( SQRT_PI ) */
|
|
3561
|
+
|
|
3562
|
+
#if !defined( QELEM )
|
|
3563
|
+
#define QELEM (1.60217662e-19)
|
|
3564
|
+
#endif /* !defined( QELEM ) */
|
|
3565
|
+
|
|
3566
|
+
#if !defined( DBL_MAX )
|
|
3567
|
+
#define DBL_MAX (1.7976931348623158e+308)
|
|
3568
|
+
#endif /* !defined( DBL_MAX ) */
|
|
3569
|
+
|
|
3570
|
+
#if !defined( DBL_MIN )
|
|
3571
|
+
#define DBL_MIN (2.2250738585072014e-308)
|
|
3572
|
+
#endif /* !defined( DBL_MIN ) */
|
|
3573
|
+
|
|
3574
|
+
#if !defined( DBL_EPSILON )
|
|
3575
|
+
#define DBL_EPSILON (2.2204460492503131e-16)
|
|
3576
|
+
#endif /* !defined( DBL_EPSILON ) */
|
|
3577
|
+
|
|
3578
|
+
#if !defined( RADIUS_ELECTRON )
|
|
3579
|
+
#define RADIUS_ELECTRON (2.8179403262e-15)
|
|
3580
|
+
#endif /* !defined( RADIUS_ELECTRON ) */
|
|
3581
|
+
|
|
3582
|
+
#if !defined( MASS_ELECTRON )
|
|
3583
|
+
#define MASS_ELECTRON (9.1093837e-31)
|
|
3584
|
+
#endif /* !defined( MASS_ELECTRON ) */
|
|
3585
|
+
|
|
3586
|
+
#endif /* XTRACK_CONSTANTS_H */
|
|
3587
|
+
|
|
3588
|
+
// copyright ############################### //
|
|
3589
|
+
// This file is part of the Xtrack Package. //
|
|
3590
|
+
// Copyright (c) CERN, 2023. //
|
|
3591
|
+
// ######################################### //
|
|
3592
|
+
|
|
3593
|
+
#ifndef XTRACK_FUNCTIONS_H
|
|
3594
|
+
#define XTRACK_FUNCTIONS_H
|
|
3595
|
+
|
|
3596
|
+
#include <headers/track.h>
|
|
3597
|
+
|
|
3598
|
+
|
|
3599
|
+
GPUFUN
|
|
3600
|
+
void kill_all_particles(LocalParticle* part0, int64_t kill_state) {
|
|
3601
|
+
START_PER_PARTICLE_BLOCK(part0, part);
|
|
3602
|
+
LocalParticle_kill_particle(part, kill_state);
|
|
3603
|
+
END_PER_PARTICLE_BLOCK;
|
|
3542
3604
|
}
|
|
3543
|
-
|
|
3544
|
-
|
|
3545
|
-
|
|
3546
|
-
|
|
3605
|
+
|
|
3606
|
+
|
|
3607
|
+
GPUFUN
|
|
3608
|
+
int8_t assert_tracking(LocalParticle* part, int64_t kill_state){
|
|
3609
|
+
// Whenever we are not tracking, e.g. in a twiss, the particle will be at_turn < 0.
|
|
3610
|
+
// We test this to distinguish genuine tracking from twiss.
|
|
3611
|
+
if (LocalParticle_get_at_turn(part) < 0){
|
|
3612
|
+
LocalParticle_kill_particle(part, kill_state);
|
|
3613
|
+
return 0;
|
|
3614
|
+
}
|
|
3615
|
+
return 1;
|
|
3547
3616
|
}
|
|
3548
|
-
|
|
3549
|
-
|
|
3550
|
-
|
|
3617
|
+
|
|
3618
|
+
#endif /* XTRACK_FUNCTIONS_H */
|
|
3619
|
+
|
|
3620
|
+
// copyright ############################### //
|
|
3621
|
+
// This file is part of the Xtrack Package. //
|
|
3622
|
+
// Copyright (c) CERN, 2023. //
|
|
3623
|
+
// ######################################### //
|
|
3624
|
+
|
|
3625
|
+
#ifndef XTRACK_PARTICLE_STATES_H
|
|
3626
|
+
#define XTRACK_PARTICLE_STATES_H
|
|
3627
|
+
|
|
3628
|
+
#define XT_LOST_ON_APERTURE 0
|
|
3629
|
+
#define XT_LOST_ON_LONG_CUT -2
|
|
3630
|
+
#define XT_LOST_ALL_E_IN_SYNRAD -10
|
|
3631
|
+
#define RNG_ERR_SEEDS_NOT_SET -20
|
|
3632
|
+
#define RNG_ERR_INVALID_TRACK -21
|
|
3633
|
+
#define RNG_ERR_RUTH_NOT_SET -22
|
|
3634
|
+
#define XT_INVALID_SLICE_TRANSFORM -40
|
|
3635
|
+
#define XT_INVALID_CURVED_SLICE_TRANSFORM -41
|
|
3636
|
+
|
|
3637
|
+
#endif /* XTRACK_PARTICLE_STATES_H */
|
|
3638
|
+
|
|
3639
|
+
// copyright ############################### //
|
|
3640
|
+
// This file is part of the Xtrack Package. //
|
|
3641
|
+
// Copyright (c) CERN, 2025. //
|
|
3642
|
+
// ######################################### //
|
|
3643
|
+
#ifndef XTRACK_TRACK_SROTATION_H
|
|
3644
|
+
#define XTRACK_TRACK_SROTATION_H
|
|
3645
|
+
|
|
3646
|
+
#include <headers/track.h>
|
|
3647
|
+
|
|
3648
|
+
|
|
3649
|
+
GPUFUN
|
|
3650
|
+
void SRotation_single_particle(LocalParticle* part, double sin_z, double cos_z)
|
|
3651
|
+
{
|
|
3652
|
+
double const x = LocalParticle_get_x(part);
|
|
3653
|
+
double const y = LocalParticle_get_y(part);
|
|
3654
|
+
double const px = LocalParticle_get_px(part);
|
|
3655
|
+
double const py = LocalParticle_get_py(part);
|
|
3656
|
+
|
|
3657
|
+
double const x_hat = cos_z * x + sin_z * y;
|
|
3658
|
+
double const y_hat = -sin_z * x + cos_z * y;
|
|
3659
|
+
double const px_hat = cos_z * px + sin_z * py;
|
|
3660
|
+
double const py_hat = -sin_z * px + cos_z * py;
|
|
3661
|
+
|
|
3662
|
+
LocalParticle_set_x(part, x_hat);
|
|
3663
|
+
LocalParticle_set_y(part, y_hat);
|
|
3664
|
+
LocalParticle_set_px(part, px_hat);
|
|
3665
|
+
LocalParticle_set_py(part, py_hat);
|
|
3666
|
+
}
|
|
3667
|
+
|
|
3668
|
+
#endif
|
|
3669
|
+
// copyright ############################### //
|
|
3670
|
+
// This file is part of the Xtrack Package. //
|
|
3671
|
+
// Copyright (c) CERN, 2021. //
|
|
3672
|
+
// ######################################### //
|
|
3673
|
+
|
|
3674
|
+
#ifndef XTRACK_TRACK_DRIFT_H
|
|
3675
|
+
#define XTRACK_TRACK_DRIFT_H
|
|
3676
|
+
|
|
3677
|
+
|
|
3678
|
+
GPUFUN
|
|
3679
|
+
void Drift_single_particle_expanded(LocalParticle* part, double length){
|
|
3680
|
+
double const rpp = LocalParticle_get_rpp(part);
|
|
3681
|
+
double const rv0v = 1./LocalParticle_get_rvv(part);
|
|
3682
|
+
double const xp = LocalParticle_get_px(part) * rpp;
|
|
3683
|
+
double const yp = LocalParticle_get_py(part) * rpp;
|
|
3684
|
+
double const dzeta = 1 - rv0v * ( 1. + ( xp*xp + yp*yp ) / 2. );
|
|
3685
|
+
|
|
3686
|
+
LocalParticle_add_to_x(part, xp * length );
|
|
3687
|
+
LocalParticle_add_to_y(part, yp * length );
|
|
3688
|
+
LocalParticle_add_to_s(part, length);
|
|
3689
|
+
LocalParticle_add_to_zeta(part, length * dzeta );
|
|
3690
|
+
}
|
|
3691
|
+
|
|
3692
|
+
|
|
3693
|
+
GPUFUN
|
|
3694
|
+
void Drift_single_particle_exact(LocalParticle* part, double length){
|
|
3695
|
+
double const px = LocalParticle_get_px(part);
|
|
3696
|
+
double const py = LocalParticle_get_py(part);
|
|
3697
|
+
double const rv0v = 1./LocalParticle_get_rvv(part);
|
|
3698
|
+
double const one_plus_delta = 1. + LocalParticle_get_delta(part);
|
|
3699
|
+
|
|
3700
|
+
double const one_over_pz = 1./sqrt(one_plus_delta*one_plus_delta
|
|
3701
|
+
- px * px - py * py);
|
|
3702
|
+
double const dzeta = 1 - rv0v * one_plus_delta * one_over_pz;
|
|
3703
|
+
|
|
3704
|
+
LocalParticle_add_to_x(part, px * one_over_pz * length);
|
|
3705
|
+
LocalParticle_add_to_y(part, py * one_over_pz * length);
|
|
3706
|
+
LocalParticle_add_to_zeta(part, dzeta * length);
|
|
3707
|
+
LocalParticle_add_to_s(part, length);
|
|
3708
|
+
}
|
|
3709
|
+
|
|
3710
|
+
|
|
3711
|
+
GPUFUN
|
|
3712
|
+
void Drift_single_particle(LocalParticle* part, double length){
|
|
3713
|
+
#ifndef XTRACK_USE_EXACT_DRIFTS
|
|
3714
|
+
Drift_single_particle_expanded(part, length);
|
|
3715
|
+
#else
|
|
3716
|
+
Drift_single_particle_exact(part, length);
|
|
3717
|
+
#endif
|
|
3718
|
+
}
|
|
3719
|
+
|
|
3720
|
+
|
|
3721
|
+
#endif /* XTRACK_TRACK_DRIFT_H */
|
|
3722
|
+
|
|
3723
|
+
|
|
3724
|
+
#ifndef XSTUITE_TRACK_FLAGS_H
|
|
3725
|
+
#define XSTUITE_TRACK_FLAGS_H
|
|
3726
|
+
#define XS_FLAG_BACKTRACK (0)
|
|
3727
|
+
#define XS_FLAG_KILL_CAVITY_KICK (2)
|
|
3728
|
+
#define XS_FLAG_IGNORE_GLOBAL_APERTURE (3)
|
|
3729
|
+
#define XS_FLAG_IGNORE_LOCAL_APERTURE (4)
|
|
3730
|
+
#define XS_FLAG_SR_TAPER (5)
|
|
3731
|
+
#define XS_FLAG_SR_KICK_SAME_AS_FIRST (6)
|
|
3732
|
+
|
|
3733
|
+
#endif // XSTUITE_TRACK_FLAGS_H
|
|
3734
|
+
|
|
3735
|
+
#include <random/random_src/uniform.h>
|
|
3736
|
+
|
|
3737
|
+
|
|
3738
|
+
void sample_uniform(
|
|
3739
|
+
RandomUniformData el,
|
|
3740
|
+
|
|
3741
|
+
ParticlesData particles,
|
|
3742
|
+
double* samples, int64_t n_samples_per_seed,
|
|
3743
|
+
int64_t flag_increment_at_element,
|
|
3744
|
+
int8_t* io_buffer){
|
|
3745
|
+
|
|
3746
|
+
// #define CONTEXT_OPENMP //only_for_context cpu_openmp
|
|
3747
|
+
#ifdef CONTEXT_OPENMP
|
|
3748
|
+
const int64_t capacity = ParticlesData_get__capacity(particles);
|
|
3749
|
+
const int num_threads = omp_get_max_threads();
|
|
3750
|
+
|
|
3751
|
+
#ifndef XT_OMP_SKIP_REORGANIZE
|
|
3752
|
+
const int64_t num_particles_to_track = ParticlesData_get__num_active_particles(particles);
|
|
3753
|
+
|
|
3754
|
+
{
|
|
3755
|
+
LocalParticle lpart;
|
|
3756
|
+
lpart.io_buffer = io_buffer;
|
|
3757
|
+
Particles_to_LocalParticle(particles, &lpart, 0, capacity);
|
|
3758
|
+
check_is_active(&lpart);
|
|
3759
|
+
count_reorganized_particles(&lpart);
|
|
3760
|
+
LocalParticle_to_Particles(&lpart, particles, 0, capacity);
|
|
3761
|
+
}
|
|
3762
|
+
#else // When we skip reorganize, we cannot just batch active particles
|
|
3763
|
+
const int64_t num_particles_to_track = capacity;
|
|
3764
|
+
#endif
|
|
3765
|
+
|
|
3766
|
+
const int64_t chunk_size = (num_particles_to_track + num_threads - 1)/num_threads; // ceil division
|
|
3767
|
+
#endif // CONTEXT_OPENMP
|
|
3768
|
+
|
|
3769
|
+
// #pragma omp parallel for //only_for_context cpu_openmp
|
|
3770
|
+
// for (int64_t batch_id = 0; batch_id < num_threads; batch_id++) { //only_for_context cpu_openmp
|
|
3771
|
+
LocalParticle lpart;
|
|
3772
|
+
lpart.io_buffer = io_buffer;
|
|
3773
|
+
lpart.track_flags = 0;
|
|
3774
|
+
// int64_t part_id = batch_id * chunk_size; //only_for_context cpu_openmp
|
|
3775
|
+
// int64_t end_id = (batch_id + 1) * chunk_size; //only_for_context cpu_openmp
|
|
3776
|
+
// if (end_id > num_particles_to_track) end_id = num_particles_to_track; //only_for_context cpu_openmp
|
|
3777
|
+
|
|
3778
|
+
int64_t part_id = 0; //only_for_context cpu_serial
|
|
3779
|
+
// int64_t part_id = blockDim.x * blockIdx.x + threadIdx.x; //only_for_context cuda
|
|
3780
|
+
// int64_t part_id = get_global_id(0); //only_for_context opencl
|
|
3781
|
+
int64_t end_id = 0; // unused outside of openmp //only_for_context cpu_serial cuda opencl
|
|
3782
|
+
|
|
3783
|
+
int64_t part_capacity = ParticlesData_get__capacity(particles);
|
|
3784
|
+
if (part_id<part_capacity){
|
|
3785
|
+
Particles_to_LocalParticle(particles, &lpart, part_id, end_id);
|
|
3786
|
+
if (check_is_active(&lpart)>0){
|
|
3787
|
+
RandomUniform_sample(el, &lpart, samples, n_samples_per_seed);
|
|
3788
|
+
|
|
3789
|
+
}
|
|
3790
|
+
if (check_is_active(&lpart)>0 && flag_increment_at_element){
|
|
3791
|
+
increment_at_element(&lpart, 1);
|
|
3792
|
+
}
|
|
3793
|
+
}
|
|
3794
|
+
// } //only_for_context cpu_openmp
|
|
3795
|
+
|
|
3796
|
+
// On OpenMP we want to additionally by default reorganize all
|
|
3797
|
+
// the particles.
|
|
3798
|
+
// #ifndef XT_OMP_SKIP_REORGANIZE //only_for_context cpu_openmp
|
|
3799
|
+
// LocalParticle lpart; //only_for_context cpu_openmp
|
|
3800
|
+
// lpart.io_buffer = io_buffer; //only_for_context cpu_openmp
|
|
3801
|
+
// Particles_to_LocalParticle(particles, &lpart, 0, capacity);//only_for_context cpu_openmp
|
|
3802
|
+
// check_is_active(&lpart); //only_for_context cpu_openmp
|
|
3803
|
+
// #endif //only_for_context cpu_openmp
|
|
3804
|
+
}
|
|
3805
|
+
|
|
3806
|
+
#ifndef XOBJ_TYPEDEF_ParticlesMonitorData
|
|
3807
|
+
#define XOBJ_TYPEDEF_ParticlesMonitorData
|
|
3808
|
+
typedef struct ParticlesMonitorData_s * ParticlesMonitorData;
|
|
3809
|
+
static inline ParticlesMonitorData ParticlesMonitorData_getp(ParticlesMonitorData restrict obj){
|
|
3810
|
+
int64_t offset=0;
|
|
3811
|
+
return (ParticlesMonitorData)(( char*) obj+offset);
|
|
3812
|
+
}
|
|
3813
|
+
static inline int64_t ParticlesMonitorData_get_start_at_turn(const ParticlesMonitorData restrict obj){
|
|
3814
|
+
int64_t offset=0;
|
|
3815
|
+
offset+=8;
|
|
3551
3816
|
return *( int64_t*)(( char*) obj+offset);
|
|
3552
3817
|
}
|
|
3553
|
-
static inline void
|
|
3818
|
+
static inline void ParticlesMonitorData_set_start_at_turn(ParticlesMonitorData restrict obj, int64_t value){
|
|
3554
3819
|
int64_t offset=0;
|
|
3555
|
-
offset+=
|
|
3820
|
+
offset+=8;
|
|
3556
3821
|
*( int64_t*)(( char*) obj+offset)=value;
|
|
3557
3822
|
}
|
|
3558
|
-
static inline int64_t*
|
|
3823
|
+
static inline int64_t* ParticlesMonitorData_getp_start_at_turn(ParticlesMonitorData restrict obj){
|
|
3559
3824
|
int64_t offset=0;
|
|
3560
|
-
offset+=
|
|
3825
|
+
offset+=8;
|
|
3561
3826
|
return ( int64_t*)(( char*) obj+offset);
|
|
3562
3827
|
}
|
|
3563
|
-
static inline int64_t
|
|
3828
|
+
static inline int64_t ParticlesMonitorData_get_stop_at_turn(const ParticlesMonitorData restrict obj){
|
|
3564
3829
|
int64_t offset=0;
|
|
3565
|
-
offset+=
|
|
3830
|
+
offset+=16;
|
|
3566
3831
|
return *( int64_t*)(( char*) obj+offset);
|
|
3567
3832
|
}
|
|
3568
|
-
static inline void
|
|
3833
|
+
static inline void ParticlesMonitorData_set_stop_at_turn(ParticlesMonitorData restrict obj, int64_t value){
|
|
3569
3834
|
int64_t offset=0;
|
|
3570
|
-
offset+=
|
|
3835
|
+
offset+=16;
|
|
3571
3836
|
*( int64_t*)(( char*) obj+offset)=value;
|
|
3572
3837
|
}
|
|
3573
|
-
static inline int64_t*
|
|
3838
|
+
static inline int64_t* ParticlesMonitorData_getp_stop_at_turn(ParticlesMonitorData restrict obj){
|
|
3574
3839
|
int64_t offset=0;
|
|
3575
|
-
offset+=
|
|
3840
|
+
offset+=16;
|
|
3576
3841
|
return ( int64_t*)(( char*) obj+offset);
|
|
3577
3842
|
}
|
|
3578
|
-
static inline
|
|
3843
|
+
static inline int64_t ParticlesMonitorData_get_part_id_start(const ParticlesMonitorData restrict obj){
|
|
3579
3844
|
int64_t offset=0;
|
|
3580
|
-
offset+=
|
|
3581
|
-
return *(
|
|
3845
|
+
offset+=24;
|
|
3846
|
+
return *( int64_t*)(( char*) obj+offset);
|
|
3582
3847
|
}
|
|
3583
|
-
static inline void
|
|
3848
|
+
static inline void ParticlesMonitorData_set_part_id_start(ParticlesMonitorData restrict obj, int64_t value){
|
|
3584
3849
|
int64_t offset=0;
|
|
3585
|
-
offset+=
|
|
3586
|
-
*(
|
|
3850
|
+
offset+=24;
|
|
3851
|
+
*( int64_t*)(( char*) obj+offset)=value;
|
|
3587
3852
|
}
|
|
3588
|
-
static inline
|
|
3853
|
+
static inline int64_t* ParticlesMonitorData_getp_part_id_start(ParticlesMonitorData restrict obj){
|
|
3589
3854
|
int64_t offset=0;
|
|
3590
|
-
offset+=
|
|
3591
|
-
return (
|
|
3855
|
+
offset+=24;
|
|
3856
|
+
return ( int64_t*)(( char*) obj+offset);
|
|
3592
3857
|
}
|
|
3593
|
-
static inline
|
|
3858
|
+
static inline int64_t ParticlesMonitorData_get_part_id_end(const ParticlesMonitorData restrict obj){
|
|
3594
3859
|
int64_t offset=0;
|
|
3595
|
-
offset+=
|
|
3596
|
-
return *(
|
|
3860
|
+
offset+=32;
|
|
3861
|
+
return *( int64_t*)(( char*) obj+offset);
|
|
3597
3862
|
}
|
|
3598
|
-
static inline void
|
|
3863
|
+
static inline void ParticlesMonitorData_set_part_id_end(ParticlesMonitorData restrict obj, int64_t value){
|
|
3599
3864
|
int64_t offset=0;
|
|
3600
|
-
offset+=
|
|
3601
|
-
*(
|
|
3865
|
+
offset+=32;
|
|
3866
|
+
*( int64_t*)(( char*) obj+offset)=value;
|
|
3602
3867
|
}
|
|
3603
|
-
static inline
|
|
3868
|
+
static inline int64_t* ParticlesMonitorData_getp_part_id_end(ParticlesMonitorData restrict obj){
|
|
3604
3869
|
int64_t offset=0;
|
|
3605
|
-
offset+=
|
|
3606
|
-
return (
|
|
3870
|
+
offset+=32;
|
|
3871
|
+
return ( int64_t*)(( char*) obj+offset);
|
|
3607
3872
|
}
|
|
3608
|
-
static inline
|
|
3873
|
+
static inline int64_t ParticlesMonitorData_get_ebe_mode(const ParticlesMonitorData restrict obj){
|
|
3874
|
+
int64_t offset=0;
|
|
3875
|
+
offset+=40;
|
|
3876
|
+
return *( int64_t*)(( char*) obj+offset);
|
|
3877
|
+
}
|
|
3878
|
+
static inline void ParticlesMonitorData_set_ebe_mode(ParticlesMonitorData restrict obj, int64_t value){
|
|
3879
|
+
int64_t offset=0;
|
|
3880
|
+
offset+=40;
|
|
3881
|
+
*( int64_t*)(( char*) obj+offset)=value;
|
|
3882
|
+
}
|
|
3883
|
+
static inline int64_t* ParticlesMonitorData_getp_ebe_mode(ParticlesMonitorData restrict obj){
|
|
3884
|
+
int64_t offset=0;
|
|
3885
|
+
offset+=40;
|
|
3886
|
+
return ( int64_t*)(( char*) obj+offset);
|
|
3887
|
+
}
|
|
3888
|
+
static inline int64_t ParticlesMonitorData_get_n_records(const ParticlesMonitorData restrict obj){
|
|
3889
|
+
int64_t offset=0;
|
|
3890
|
+
offset+=48;
|
|
3891
|
+
return *( int64_t*)(( char*) obj+offset);
|
|
3892
|
+
}
|
|
3893
|
+
static inline void ParticlesMonitorData_set_n_records(ParticlesMonitorData restrict obj, int64_t value){
|
|
3894
|
+
int64_t offset=0;
|
|
3895
|
+
offset+=48;
|
|
3896
|
+
*( int64_t*)(( char*) obj+offset)=value;
|
|
3897
|
+
}
|
|
3898
|
+
static inline int64_t* ParticlesMonitorData_getp_n_records(ParticlesMonitorData restrict obj){
|
|
3899
|
+
int64_t offset=0;
|
|
3900
|
+
offset+=48;
|
|
3901
|
+
return ( int64_t*)(( char*) obj+offset);
|
|
3902
|
+
}
|
|
3903
|
+
static inline int64_t ParticlesMonitorData_get_n_repetitions(const ParticlesMonitorData restrict obj){
|
|
3904
|
+
int64_t offset=0;
|
|
3905
|
+
offset+=56;
|
|
3906
|
+
return *( int64_t*)(( char*) obj+offset);
|
|
3907
|
+
}
|
|
3908
|
+
static inline void ParticlesMonitorData_set_n_repetitions(ParticlesMonitorData restrict obj, int64_t value){
|
|
3909
|
+
int64_t offset=0;
|
|
3910
|
+
offset+=56;
|
|
3911
|
+
*( int64_t*)(( char*) obj+offset)=value;
|
|
3912
|
+
}
|
|
3913
|
+
static inline int64_t* ParticlesMonitorData_getp_n_repetitions(ParticlesMonitorData restrict obj){
|
|
3914
|
+
int64_t offset=0;
|
|
3915
|
+
offset+=56;
|
|
3916
|
+
return ( int64_t*)(( char*) obj+offset);
|
|
3917
|
+
}
|
|
3918
|
+
static inline int64_t ParticlesMonitorData_get_repetition_period(const ParticlesMonitorData restrict obj){
|
|
3919
|
+
int64_t offset=0;
|
|
3920
|
+
offset+=64;
|
|
3921
|
+
return *( int64_t*)(( char*) obj+offset);
|
|
3922
|
+
}
|
|
3923
|
+
static inline void ParticlesMonitorData_set_repetition_period(ParticlesMonitorData restrict obj, int64_t value){
|
|
3924
|
+
int64_t offset=0;
|
|
3925
|
+
offset+=64;
|
|
3926
|
+
*( int64_t*)(( char*) obj+offset)=value;
|
|
3927
|
+
}
|
|
3928
|
+
static inline int64_t* ParticlesMonitorData_getp_repetition_period(ParticlesMonitorData restrict obj){
|
|
3929
|
+
int64_t offset=0;
|
|
3930
|
+
offset+=64;
|
|
3931
|
+
return ( int64_t*)(( char*) obj+offset);
|
|
3932
|
+
}
|
|
3933
|
+
static inline int64_t ParticlesMonitorData_get_flag_auto_to_numpy(const ParticlesMonitorData restrict obj){
|
|
3934
|
+
int64_t offset=0;
|
|
3935
|
+
offset+=72;
|
|
3936
|
+
return *( int64_t*)(( char*) obj+offset);
|
|
3937
|
+
}
|
|
3938
|
+
static inline void ParticlesMonitorData_set_flag_auto_to_numpy(ParticlesMonitorData restrict obj, int64_t value){
|
|
3939
|
+
int64_t offset=0;
|
|
3940
|
+
offset+=72;
|
|
3941
|
+
*( int64_t*)(( char*) obj+offset)=value;
|
|
3942
|
+
}
|
|
3943
|
+
static inline int64_t* ParticlesMonitorData_getp_flag_auto_to_numpy(ParticlesMonitorData restrict obj){
|
|
3944
|
+
int64_t offset=0;
|
|
3945
|
+
offset+=72;
|
|
3946
|
+
return ( int64_t*)(( char*) obj+offset);
|
|
3947
|
+
}
|
|
3948
|
+
static inline ParticlesData ParticlesMonitorData_getp_data(ParticlesMonitorData restrict obj){
|
|
3949
|
+
int64_t offset=0;
|
|
3950
|
+
offset+=152;
|
|
3951
|
+
return (ParticlesData)(( char*) obj+offset);
|
|
3952
|
+
}
|
|
3953
|
+
static inline int64_t ParticlesMonitorData_get_data__capacity(const ParticlesMonitorData restrict obj){
|
|
3954
|
+
int64_t offset=0;
|
|
3955
|
+
offset+=160;
|
|
3956
|
+
return *( int64_t*)(( char*) obj+offset);
|
|
3957
|
+
}
|
|
3958
|
+
static inline void ParticlesMonitorData_set_data__capacity(ParticlesMonitorData restrict obj, int64_t value){
|
|
3959
|
+
int64_t offset=0;
|
|
3960
|
+
offset+=160;
|
|
3961
|
+
*( int64_t*)(( char*) obj+offset)=value;
|
|
3962
|
+
}
|
|
3963
|
+
static inline int64_t* ParticlesMonitorData_getp_data__capacity(ParticlesMonitorData restrict obj){
|
|
3964
|
+
int64_t offset=0;
|
|
3965
|
+
offset+=160;
|
|
3966
|
+
return ( int64_t*)(( char*) obj+offset);
|
|
3967
|
+
}
|
|
3968
|
+
static inline int64_t ParticlesMonitorData_get_data__num_active_particles(const ParticlesMonitorData restrict obj){
|
|
3969
|
+
int64_t offset=0;
|
|
3970
|
+
offset+=168;
|
|
3971
|
+
return *( int64_t*)(( char*) obj+offset);
|
|
3972
|
+
}
|
|
3973
|
+
static inline void ParticlesMonitorData_set_data__num_active_particles(ParticlesMonitorData restrict obj, int64_t value){
|
|
3974
|
+
int64_t offset=0;
|
|
3975
|
+
offset+=168;
|
|
3976
|
+
*( int64_t*)(( char*) obj+offset)=value;
|
|
3977
|
+
}
|
|
3978
|
+
static inline int64_t* ParticlesMonitorData_getp_data__num_active_particles(ParticlesMonitorData restrict obj){
|
|
3979
|
+
int64_t offset=0;
|
|
3980
|
+
offset+=168;
|
|
3981
|
+
return ( int64_t*)(( char*) obj+offset);
|
|
3982
|
+
}
|
|
3983
|
+
static inline int64_t ParticlesMonitorData_get_data__num_lost_particles(const ParticlesMonitorData restrict obj){
|
|
3984
|
+
int64_t offset=0;
|
|
3985
|
+
offset+=176;
|
|
3986
|
+
return *( int64_t*)(( char*) obj+offset);
|
|
3987
|
+
}
|
|
3988
|
+
static inline void ParticlesMonitorData_set_data__num_lost_particles(ParticlesMonitorData restrict obj, int64_t value){
|
|
3989
|
+
int64_t offset=0;
|
|
3990
|
+
offset+=176;
|
|
3991
|
+
*( int64_t*)(( char*) obj+offset)=value;
|
|
3992
|
+
}
|
|
3993
|
+
static inline int64_t* ParticlesMonitorData_getp_data__num_lost_particles(ParticlesMonitorData restrict obj){
|
|
3994
|
+
int64_t offset=0;
|
|
3995
|
+
offset+=176;
|
|
3996
|
+
return ( int64_t*)(( char*) obj+offset);
|
|
3997
|
+
}
|
|
3998
|
+
static inline int64_t ParticlesMonitorData_get_data_start_tracking_at_element(const ParticlesMonitorData restrict obj){
|
|
3999
|
+
int64_t offset=0;
|
|
4000
|
+
offset+=184;
|
|
4001
|
+
return *( int64_t*)(( char*) obj+offset);
|
|
4002
|
+
}
|
|
4003
|
+
static inline void ParticlesMonitorData_set_data_start_tracking_at_element(ParticlesMonitorData restrict obj, int64_t value){
|
|
4004
|
+
int64_t offset=0;
|
|
4005
|
+
offset+=184;
|
|
4006
|
+
*( int64_t*)(( char*) obj+offset)=value;
|
|
4007
|
+
}
|
|
4008
|
+
static inline int64_t* ParticlesMonitorData_getp_data_start_tracking_at_element(ParticlesMonitorData restrict obj){
|
|
4009
|
+
int64_t offset=0;
|
|
4010
|
+
offset+=184;
|
|
4011
|
+
return ( int64_t*)(( char*) obj+offset);
|
|
4012
|
+
}
|
|
4013
|
+
static inline double ParticlesMonitorData_get_data_q0(const ParticlesMonitorData restrict obj){
|
|
4014
|
+
int64_t offset=0;
|
|
4015
|
+
offset+=192;
|
|
4016
|
+
return *( double*)(( char*) obj+offset);
|
|
4017
|
+
}
|
|
4018
|
+
static inline void ParticlesMonitorData_set_data_q0(ParticlesMonitorData restrict obj, double value){
|
|
4019
|
+
int64_t offset=0;
|
|
4020
|
+
offset+=192;
|
|
4021
|
+
*( double*)(( char*) obj+offset)=value;
|
|
4022
|
+
}
|
|
4023
|
+
static inline double* ParticlesMonitorData_getp_data_q0(ParticlesMonitorData restrict obj){
|
|
4024
|
+
int64_t offset=0;
|
|
4025
|
+
offset+=192;
|
|
4026
|
+
return ( double*)(( char*) obj+offset);
|
|
4027
|
+
}
|
|
4028
|
+
static inline double ParticlesMonitorData_get_data_mass0(const ParticlesMonitorData restrict obj){
|
|
4029
|
+
int64_t offset=0;
|
|
4030
|
+
offset+=200;
|
|
4031
|
+
return *( double*)(( char*) obj+offset);
|
|
4032
|
+
}
|
|
4033
|
+
static inline void ParticlesMonitorData_set_data_mass0(ParticlesMonitorData restrict obj, double value){
|
|
4034
|
+
int64_t offset=0;
|
|
4035
|
+
offset+=200;
|
|
4036
|
+
*( double*)(( char*) obj+offset)=value;
|
|
4037
|
+
}
|
|
4038
|
+
static inline double* ParticlesMonitorData_getp_data_mass0(ParticlesMonitorData restrict obj){
|
|
4039
|
+
int64_t offset=0;
|
|
4040
|
+
offset+=200;
|
|
4041
|
+
return ( double*)(( char*) obj+offset);
|
|
4042
|
+
}
|
|
4043
|
+
static inline double ParticlesMonitorData_get_data_t_sim(const ParticlesMonitorData restrict obj){
|
|
3609
4044
|
int64_t offset=0;
|
|
3610
4045
|
offset+=208;
|
|
3611
4046
|
return *( double*)(( char*) obj+offset);
|
|
@@ -4614,864 +5049,228 @@ typedef struct ParticlesMonitorData_s * ParticlesMonitorData;
|
|
|
4614
5049
|
int64_t* arr = ( int64_t*)(( char*) obj+offset);
|
|
4615
5050
|
return arr[1];
|
|
4616
5051
|
}
|
|
4617
|
-
static inline uint32_t ParticlesMonitorData_get_data__rng_s2(const ParticlesMonitorData restrict obj, int64_t i0){
|
|
4618
|
-
int64_t offset=0;
|
|
4619
|
-
offset+=152;
|
|
4620
|
-
offset+=*( int64_t*)(( char*) obj+offset+288);
|
|
4621
|
-
offset+=16+i0*4;
|
|
4622
|
-
return *( uint32_t*)(( char*) obj+offset);
|
|
4623
|
-
}
|
|
4624
|
-
static inline void ParticlesMonitorData_set_data__rng_s2(ParticlesMonitorData restrict obj, int64_t i0, uint32_t value){
|
|
4625
|
-
int64_t offset=0;
|
|
4626
|
-
offset+=152;
|
|
4627
|
-
offset+=*( int64_t*)(( char*) obj+offset+288);
|
|
4628
|
-
offset+=16+i0*4;
|
|
4629
|
-
*( uint32_t*)(( char*) obj+offset)=value;
|
|
4630
|
-
}
|
|
4631
|
-
static inline uint32_t* ParticlesMonitorData_getp1_data__rng_s2(ParticlesMonitorData restrict obj, int64_t i0){
|
|
4632
|
-
int64_t offset=0;
|
|
4633
|
-
offset+=152;
|
|
4634
|
-
offset+=*( int64_t*)(( char*) obj+offset+288);
|
|
4635
|
-
offset+=16+i0*4;
|
|
4636
|
-
return ( uint32_t*)(( char*) obj+offset);
|
|
4637
|
-
}
|
|
4638
|
-
static inline ArrNUint32 ParticlesMonitorData_getp_data__rng_s3(ParticlesMonitorData restrict obj){
|
|
4639
|
-
int64_t offset=0;
|
|
4640
|
-
offset+=152;
|
|
4641
|
-
offset+=*( int64_t*)(( char*) obj+offset+296);
|
|
4642
|
-
return (ArrNUint32)(( char*) obj+offset);
|
|
4643
|
-
}
|
|
4644
|
-
static inline int64_t ParticlesMonitorData_len_data__rng_s3(ParticlesMonitorData restrict obj){
|
|
4645
|
-
int64_t offset=0;
|
|
4646
|
-
offset+=152;
|
|
4647
|
-
offset+=*( int64_t*)(( char*) obj+offset+296);
|
|
4648
|
-
int64_t* arr = ( int64_t*)(( char*) obj+offset);
|
|
4649
|
-
return arr[1];
|
|
4650
|
-
}
|
|
4651
|
-
static inline uint32_t ParticlesMonitorData_get_data__rng_s3(const ParticlesMonitorData restrict obj, int64_t i0){
|
|
4652
|
-
int64_t offset=0;
|
|
4653
|
-
offset+=152;
|
|
4654
|
-
offset+=*( int64_t*)(( char*) obj+offset+296);
|
|
4655
|
-
offset+=16+i0*4;
|
|
4656
|
-
return *( uint32_t*)(( char*) obj+offset);
|
|
4657
|
-
}
|
|
4658
|
-
static inline void ParticlesMonitorData_set_data__rng_s3(ParticlesMonitorData restrict obj, int64_t i0, uint32_t value){
|
|
4659
|
-
int64_t offset=0;
|
|
4660
|
-
offset+=152;
|
|
4661
|
-
offset+=*( int64_t*)(( char*) obj+offset+296);
|
|
4662
|
-
offset+=16+i0*4;
|
|
4663
|
-
*( uint32_t*)(( char*) obj+offset)=value;
|
|
4664
|
-
}
|
|
4665
|
-
static inline uint32_t* ParticlesMonitorData_getp1_data__rng_s3(ParticlesMonitorData restrict obj, int64_t i0){
|
|
4666
|
-
int64_t offset=0;
|
|
4667
|
-
offset+=152;
|
|
4668
|
-
offset+=*( int64_t*)(( char*) obj+offset+296);
|
|
4669
|
-
offset+=16+i0*4;
|
|
4670
|
-
return ( uint32_t*)(( char*) obj+offset);
|
|
4671
|
-
}
|
|
4672
|
-
static inline ArrNUint32 ParticlesMonitorData_getp_data__rng_s4(ParticlesMonitorData restrict obj){
|
|
4673
|
-
int64_t offset=0;
|
|
4674
|
-
offset+=152;
|
|
4675
|
-
offset+=*( int64_t*)(( char*) obj+offset+304);
|
|
4676
|
-
return (ArrNUint32)(( char*) obj+offset);
|
|
4677
|
-
}
|
|
4678
|
-
static inline int64_t ParticlesMonitorData_len_data__rng_s4(ParticlesMonitorData restrict obj){
|
|
4679
|
-
int64_t offset=0;
|
|
4680
|
-
offset+=152;
|
|
4681
|
-
offset+=*( int64_t*)(( char*) obj+offset+304);
|
|
4682
|
-
int64_t* arr = ( int64_t*)(( char*) obj+offset);
|
|
4683
|
-
return arr[1];
|
|
4684
|
-
}
|
|
4685
|
-
static inline uint32_t ParticlesMonitorData_get_data__rng_s4(const ParticlesMonitorData restrict obj, int64_t i0){
|
|
4686
|
-
int64_t offset=0;
|
|
4687
|
-
offset+=152;
|
|
4688
|
-
offset+=*( int64_t*)(( char*) obj+offset+304);
|
|
4689
|
-
offset+=16+i0*4;
|
|
4690
|
-
return *( uint32_t*)(( char*) obj+offset);
|
|
4691
|
-
}
|
|
4692
|
-
static inline void ParticlesMonitorData_set_data__rng_s4(ParticlesMonitorData restrict obj, int64_t i0, uint32_t value){
|
|
4693
|
-
int64_t offset=0;
|
|
4694
|
-
offset+=152;
|
|
4695
|
-
offset+=*( int64_t*)(( char*) obj+offset+304);
|
|
4696
|
-
offset+=16+i0*4;
|
|
4697
|
-
*( uint32_t*)(( char*) obj+offset)=value;
|
|
4698
|
-
}
|
|
4699
|
-
static inline uint32_t* ParticlesMonitorData_getp1_data__rng_s4(ParticlesMonitorData restrict obj, int64_t i0){
|
|
4700
|
-
int64_t offset=0;
|
|
4701
|
-
offset+=152;
|
|
4702
|
-
offset+=*( int64_t*)(( char*) obj+offset+304);
|
|
4703
|
-
offset+=16+i0*4;
|
|
4704
|
-
return ( uint32_t*)(( char*) obj+offset);
|
|
4705
|
-
}
|
|
4706
|
-
static inline double ParticlesMonitorData_get__sin_rot_s(const ParticlesMonitorData restrict obj){
|
|
4707
|
-
int64_t offset=0;
|
|
4708
|
-
offset+=80;
|
|
4709
|
-
return *( double*)(( char*) obj+offset);
|
|
4710
|
-
}
|
|
4711
|
-
static inline void ParticlesMonitorData_set__sin_rot_s(ParticlesMonitorData restrict obj, double value){
|
|
4712
|
-
int64_t offset=0;
|
|
4713
|
-
offset+=80;
|
|
4714
|
-
*( double*)(( char*) obj+offset)=value;
|
|
4715
|
-
}
|
|
4716
|
-
static inline double* ParticlesMonitorData_getp__sin_rot_s(ParticlesMonitorData restrict obj){
|
|
4717
|
-
int64_t offset=0;
|
|
4718
|
-
offset+=80;
|
|
4719
|
-
return ( double*)(( char*) obj+offset);
|
|
4720
|
-
}
|
|
4721
|
-
static inline double ParticlesMonitorData_get__cos_rot_s(const ParticlesMonitorData restrict obj){
|
|
4722
|
-
int64_t offset=0;
|
|
4723
|
-
offset+=88;
|
|
4724
|
-
return *( double*)(( char*) obj+offset);
|
|
4725
|
-
}
|
|
4726
|
-
static inline void ParticlesMonitorData_set__cos_rot_s(ParticlesMonitorData restrict obj, double value){
|
|
4727
|
-
int64_t offset=0;
|
|
4728
|
-
offset+=88;
|
|
4729
|
-
*( double*)(( char*) obj+offset)=value;
|
|
4730
|
-
}
|
|
4731
|
-
static inline double* ParticlesMonitorData_getp__cos_rot_s(ParticlesMonitorData restrict obj){
|
|
4732
|
-
int64_t offset=0;
|
|
4733
|
-
offset+=88;
|
|
4734
|
-
return ( double*)(( char*) obj+offset);
|
|
4735
|
-
}
|
|
4736
|
-
static inline double ParticlesMonitorData_get__shift_x(const ParticlesMonitorData restrict obj){
|
|
4737
|
-
int64_t offset=0;
|
|
4738
|
-
offset+=96;
|
|
4739
|
-
return *( double*)(( char*) obj+offset);
|
|
4740
|
-
}
|
|
4741
|
-
static inline void ParticlesMonitorData_set__shift_x(ParticlesMonitorData restrict obj, double value){
|
|
4742
|
-
int64_t offset=0;
|
|
4743
|
-
offset+=96;
|
|
4744
|
-
*( double*)(( char*) obj+offset)=value;
|
|
4745
|
-
}
|
|
4746
|
-
static inline double* ParticlesMonitorData_getp__shift_x(ParticlesMonitorData restrict obj){
|
|
4747
|
-
int64_t offset=0;
|
|
4748
|
-
offset+=96;
|
|
4749
|
-
return ( double*)(( char*) obj+offset);
|
|
4750
|
-
}
|
|
4751
|
-
static inline double ParticlesMonitorData_get__shift_y(const ParticlesMonitorData restrict obj){
|
|
4752
|
-
int64_t offset=0;
|
|
4753
|
-
offset+=104;
|
|
4754
|
-
return *( double*)(( char*) obj+offset);
|
|
4755
|
-
}
|
|
4756
|
-
static inline void ParticlesMonitorData_set__shift_y(ParticlesMonitorData restrict obj, double value){
|
|
4757
|
-
int64_t offset=0;
|
|
4758
|
-
offset+=104;
|
|
4759
|
-
*( double*)(( char*) obj+offset)=value;
|
|
4760
|
-
}
|
|
4761
|
-
static inline double* ParticlesMonitorData_getp__shift_y(ParticlesMonitorData restrict obj){
|
|
4762
|
-
int64_t offset=0;
|
|
4763
|
-
offset+=104;
|
|
4764
|
-
return ( double*)(( char*) obj+offset);
|
|
4765
|
-
}
|
|
4766
|
-
static inline double ParticlesMonitorData_get__shift_s(const ParticlesMonitorData restrict obj){
|
|
4767
|
-
int64_t offset=0;
|
|
4768
|
-
offset+=112;
|
|
4769
|
-
return *( double*)(( char*) obj+offset);
|
|
4770
|
-
}
|
|
4771
|
-
static inline void ParticlesMonitorData_set__shift_s(ParticlesMonitorData restrict obj, double value){
|
|
4772
|
-
int64_t offset=0;
|
|
4773
|
-
offset+=112;
|
|
4774
|
-
*( double*)(( char*) obj+offset)=value;
|
|
4775
|
-
}
|
|
4776
|
-
static inline double* ParticlesMonitorData_getp__shift_s(ParticlesMonitorData restrict obj){
|
|
4777
|
-
int64_t offset=0;
|
|
4778
|
-
offset+=112;
|
|
4779
|
-
return ( double*)(( char*) obj+offset);
|
|
4780
|
-
}
|
|
4781
|
-
static inline double ParticlesMonitorData_get__rot_x_rad(const ParticlesMonitorData restrict obj){
|
|
4782
|
-
int64_t offset=0;
|
|
4783
|
-
offset+=120;
|
|
4784
|
-
return *( double*)(( char*) obj+offset);
|
|
4785
|
-
}
|
|
4786
|
-
static inline void ParticlesMonitorData_set__rot_x_rad(ParticlesMonitorData restrict obj, double value){
|
|
4787
|
-
int64_t offset=0;
|
|
4788
|
-
offset+=120;
|
|
4789
|
-
*( double*)(( char*) obj+offset)=value;
|
|
4790
|
-
}
|
|
4791
|
-
static inline double* ParticlesMonitorData_getp__rot_x_rad(ParticlesMonitorData restrict obj){
|
|
4792
|
-
int64_t offset=0;
|
|
4793
|
-
offset+=120;
|
|
4794
|
-
return ( double*)(( char*) obj+offset);
|
|
4795
|
-
}
|
|
4796
|
-
static inline double ParticlesMonitorData_get__rot_y_rad(const ParticlesMonitorData restrict obj){
|
|
4797
|
-
int64_t offset=0;
|
|
4798
|
-
offset+=128;
|
|
4799
|
-
return *( double*)(( char*) obj+offset);
|
|
4800
|
-
}
|
|
4801
|
-
static inline void ParticlesMonitorData_set__rot_y_rad(ParticlesMonitorData restrict obj, double value){
|
|
4802
|
-
int64_t offset=0;
|
|
4803
|
-
offset+=128;
|
|
4804
|
-
*( double*)(( char*) obj+offset)=value;
|
|
4805
|
-
}
|
|
4806
|
-
static inline double* ParticlesMonitorData_getp__rot_y_rad(ParticlesMonitorData restrict obj){
|
|
4807
|
-
int64_t offset=0;
|
|
4808
|
-
offset+=128;
|
|
4809
|
-
return ( double*)(( char*) obj+offset);
|
|
4810
|
-
}
|
|
4811
|
-
static inline double ParticlesMonitorData_get__rot_s_rad_no_frame(const ParticlesMonitorData restrict obj){
|
|
4812
|
-
int64_t offset=0;
|
|
4813
|
-
offset+=136;
|
|
4814
|
-
return *( double*)(( char*) obj+offset);
|
|
4815
|
-
}
|
|
4816
|
-
static inline void ParticlesMonitorData_set__rot_s_rad_no_frame(ParticlesMonitorData restrict obj, double value){
|
|
4817
|
-
int64_t offset=0;
|
|
4818
|
-
offset+=136;
|
|
4819
|
-
*( double*)(( char*) obj+offset)=value;
|
|
4820
|
-
}
|
|
4821
|
-
static inline double* ParticlesMonitorData_getp__rot_s_rad_no_frame(ParticlesMonitorData restrict obj){
|
|
4822
|
-
int64_t offset=0;
|
|
4823
|
-
offset+=136;
|
|
4824
|
-
return ( double*)(( char*) obj+offset);
|
|
4825
|
-
}
|
|
4826
|
-
static inline double ParticlesMonitorData_get_rot_shift_anchor(const ParticlesMonitorData restrict obj){
|
|
4827
|
-
int64_t offset=0;
|
|
4828
|
-
offset+=144;
|
|
4829
|
-
return *( double*)(( char*) obj+offset);
|
|
4830
|
-
}
|
|
4831
|
-
static inline void ParticlesMonitorData_set_rot_shift_anchor(ParticlesMonitorData restrict obj, double value){
|
|
4832
|
-
int64_t offset=0;
|
|
4833
|
-
offset+=144;
|
|
4834
|
-
*( double*)(( char*) obj+offset)=value;
|
|
4835
|
-
}
|
|
4836
|
-
static inline double* ParticlesMonitorData_getp_rot_shift_anchor(ParticlesMonitorData restrict obj){
|
|
4837
|
-
int64_t offset=0;
|
|
4838
|
-
offset+=144;
|
|
4839
|
-
return ( double*)(( char*) obj+offset);
|
|
4840
|
-
}
|
|
4841
|
-
#endif
|
|
4842
|
-
// copyright ############################### //
|
|
4843
|
-
// This file is part of the Xtrack Package. //
|
|
4844
|
-
// Copyright (c) CERN, 2021. //
|
|
4845
|
-
// ######################################### //
|
|
4846
|
-
|
|
4847
|
-
#ifndef XTRACK_CONSTANTS_H
|
|
4848
|
-
#define XTRACK_CONSTANTS_H
|
|
4849
|
-
|
|
4850
|
-
#if !defined( C_LIGHT )
|
|
4851
|
-
#define C_LIGHT ( 299792458.0 )
|
|
4852
|
-
#endif /* !defined( C_LIGHT ) */
|
|
4853
|
-
|
|
4854
|
-
#if !defined( EPSILON_0 )
|
|
4855
|
-
#define EPSILON_0 (8.854187817620e-12)
|
|
4856
|
-
#endif /* !defined( EPSILON_0 ) */
|
|
4857
|
-
|
|
4858
|
-
#if !defined( PI )
|
|
4859
|
-
#define PI (3.1415926535897932384626433832795028841971693993751)
|
|
4860
|
-
#endif /* !defined( PI ) */
|
|
4861
|
-
|
|
4862
|
-
#if !defined( MU_0 )
|
|
4863
|
-
#define MU_0 (PI*4.0e-7)
|
|
4864
|
-
#endif /* !defined( MU_0 ) */
|
|
4865
|
-
|
|
4866
|
-
#if !defined( DEG2RAD )
|
|
4867
|
-
#define DEG2RAD (0.0174532925199432957692369076848861271344287188854)
|
|
4868
|
-
#endif /* !defiend( DEG2RAD ) */
|
|
4869
|
-
|
|
4870
|
-
#if !defined( RAD2DEG )
|
|
4871
|
-
#define RAD2DEG (57.29577951308232087679815481410517033240547246656442)
|
|
4872
|
-
#endif /* !defiend( RAD2DEG ) */
|
|
4873
|
-
|
|
4874
|
-
#if !defined( SQRT_PI )
|
|
4875
|
-
#define SQRT_PI (1.7724538509055160272981674833411451827975494561224)
|
|
4876
|
-
#endif /* !defined( SQRT_PI ) */
|
|
4877
|
-
|
|
4878
|
-
#if !defined( QELEM )
|
|
4879
|
-
#define QELEM (1.60217662e-19)
|
|
4880
|
-
#endif /* !defined( QELEM ) */
|
|
4881
|
-
|
|
4882
|
-
#if !defined( DBL_MAX )
|
|
4883
|
-
#define DBL_MAX (1.7976931348623158e+308)
|
|
4884
|
-
#endif /* !defined( DBL_MAX ) */
|
|
4885
|
-
|
|
4886
|
-
#if !defined( DBL_MIN )
|
|
4887
|
-
#define DBL_MIN (2.2250738585072014e-308)
|
|
4888
|
-
#endif /* !defined( DBL_MIN ) */
|
|
4889
|
-
|
|
4890
|
-
#if !defined( DBL_EPSILON )
|
|
4891
|
-
#define DBL_EPSILON (2.2204460492503131e-16)
|
|
4892
|
-
#endif /* !defined( DBL_EPSILON ) */
|
|
4893
|
-
|
|
4894
|
-
#if !defined( RADIUS_ELECTRON )
|
|
4895
|
-
#define RADIUS_ELECTRON (2.8179403262e-15)
|
|
4896
|
-
#endif /* !defined( RADIUS_ELECTRON ) */
|
|
4897
|
-
|
|
4898
|
-
#if !defined( MASS_ELECTRON )
|
|
4899
|
-
#define MASS_ELECTRON (9.1093837e-31)
|
|
4900
|
-
#endif /* !defined( MASS_ELECTRON ) */
|
|
4901
|
-
|
|
4902
|
-
#endif /* XTRACK_CONSTANTS_H */
|
|
4903
|
-
|
|
4904
|
-
// copyright ############################### //
|
|
4905
|
-
// This file is part of the Xtrack Package. //
|
|
4906
|
-
// Copyright (c) CERN, 2023. //
|
|
4907
|
-
// ######################################### //
|
|
4908
|
-
|
|
4909
|
-
#ifndef XTRACK_FUNCTIONS_H
|
|
4910
|
-
#define XTRACK_FUNCTIONS_H
|
|
4911
|
-
|
|
4912
|
-
#include <headers/track.h>
|
|
4913
|
-
|
|
4914
|
-
|
|
4915
|
-
GPUFUN
|
|
4916
|
-
void kill_all_particles(LocalParticle* part0, int64_t kill_state) {
|
|
4917
|
-
START_PER_PARTICLE_BLOCK(part0, part);
|
|
4918
|
-
LocalParticle_kill_particle(part, kill_state);
|
|
4919
|
-
END_PER_PARTICLE_BLOCK;
|
|
4920
|
-
}
|
|
4921
|
-
|
|
4922
|
-
|
|
4923
|
-
GPUFUN
|
|
4924
|
-
int8_t assert_tracking(LocalParticle* part, int64_t kill_state){
|
|
4925
|
-
// Whenever we are not tracking, e.g. in a twiss, the particle will be at_turn < 0.
|
|
4926
|
-
// We test this to distinguish genuine tracking from twiss.
|
|
4927
|
-
if (LocalParticle_get_at_turn(part) < 0){
|
|
4928
|
-
LocalParticle_kill_particle(part, kill_state);
|
|
4929
|
-
return 0;
|
|
4930
|
-
}
|
|
4931
|
-
return 1;
|
|
4932
|
-
}
|
|
4933
|
-
|
|
4934
|
-
#endif /* XTRACK_FUNCTIONS_H */
|
|
4935
|
-
|
|
4936
|
-
// copyright ############################### //
|
|
4937
|
-
// This file is part of the Xtrack Package. //
|
|
4938
|
-
// Copyright (c) CERN, 2023. //
|
|
4939
|
-
// ######################################### //
|
|
4940
|
-
|
|
4941
|
-
#ifndef XTRACK_PARTICLE_STATES_H
|
|
4942
|
-
#define XTRACK_PARTICLE_STATES_H
|
|
4943
|
-
|
|
4944
|
-
#define XT_LOST_ON_APERTURE 0
|
|
4945
|
-
#define XT_LOST_ON_LONG_CUT -2
|
|
4946
|
-
#define XT_LOST_ALL_E_IN_SYNRAD -10
|
|
4947
|
-
#define RNG_ERR_SEEDS_NOT_SET -20
|
|
4948
|
-
#define RNG_ERR_INVALID_TRACK -21
|
|
4949
|
-
#define RNG_ERR_RUTH_NOT_SET -22
|
|
4950
|
-
#define XT_INVALID_SLICE_TRANSFORM -40
|
|
4951
|
-
#define XT_INVALID_CURVED_SLICE_TRANSFORM -41
|
|
4952
|
-
|
|
4953
|
-
#endif /* XTRACK_PARTICLE_STATES_H */
|
|
4954
|
-
|
|
4955
|
-
// copyright ############################### //
|
|
4956
|
-
// This file is part of the Xtrack Package. //
|
|
4957
|
-
// Copyright (c) CERN, 2025. //
|
|
4958
|
-
// ######################################### //
|
|
4959
|
-
#ifndef XTRACK_TRACK_SROTATION_H
|
|
4960
|
-
#define XTRACK_TRACK_SROTATION_H
|
|
4961
|
-
|
|
4962
|
-
#include <headers/track.h>
|
|
4963
|
-
|
|
4964
|
-
|
|
4965
|
-
GPUFUN
|
|
4966
|
-
void SRotation_single_particle(LocalParticle* part, double sin_z, double cos_z)
|
|
4967
|
-
{
|
|
4968
|
-
double const x = LocalParticle_get_x(part);
|
|
4969
|
-
double const y = LocalParticle_get_y(part);
|
|
4970
|
-
double const px = LocalParticle_get_px(part);
|
|
4971
|
-
double const py = LocalParticle_get_py(part);
|
|
4972
|
-
|
|
4973
|
-
double const x_hat = cos_z * x + sin_z * y;
|
|
4974
|
-
double const y_hat = -sin_z * x + cos_z * y;
|
|
4975
|
-
double const px_hat = cos_z * px + sin_z * py;
|
|
4976
|
-
double const py_hat = -sin_z * px + cos_z * py;
|
|
4977
|
-
|
|
4978
|
-
LocalParticle_set_x(part, x_hat);
|
|
4979
|
-
LocalParticle_set_y(part, y_hat);
|
|
4980
|
-
LocalParticle_set_px(part, px_hat);
|
|
4981
|
-
LocalParticle_set_py(part, py_hat);
|
|
4982
|
-
}
|
|
4983
|
-
|
|
4984
|
-
#endif
|
|
4985
|
-
// copyright ############################### //
|
|
4986
|
-
// This file is part of the Xtrack Package. //
|
|
4987
|
-
// Copyright (c) CERN, 2021. //
|
|
4988
|
-
// ######################################### //
|
|
4989
|
-
|
|
4990
|
-
#ifndef XTRACK_TRACK_DRIFT_H
|
|
4991
|
-
#define XTRACK_TRACK_DRIFT_H
|
|
4992
|
-
|
|
4993
|
-
|
|
4994
|
-
GPUFUN
|
|
4995
|
-
void Drift_single_particle_expanded(LocalParticle* part, double length){
|
|
4996
|
-
double const rpp = LocalParticle_get_rpp(part);
|
|
4997
|
-
double const rv0v = 1./LocalParticle_get_rvv(part);
|
|
4998
|
-
double const xp = LocalParticle_get_px(part) * rpp;
|
|
4999
|
-
double const yp = LocalParticle_get_py(part) * rpp;
|
|
5000
|
-
double const dzeta = 1 - rv0v * ( 1. + ( xp*xp + yp*yp ) / 2. );
|
|
5001
|
-
|
|
5002
|
-
LocalParticle_add_to_x(part, xp * length );
|
|
5003
|
-
LocalParticle_add_to_y(part, yp * length );
|
|
5004
|
-
LocalParticle_add_to_s(part, length);
|
|
5005
|
-
LocalParticle_add_to_zeta(part, length * dzeta );
|
|
5006
|
-
}
|
|
5007
|
-
|
|
5008
|
-
|
|
5009
|
-
GPUFUN
|
|
5010
|
-
void Drift_single_particle_exact(LocalParticle* part, double length){
|
|
5011
|
-
double const px = LocalParticle_get_px(part);
|
|
5012
|
-
double const py = LocalParticle_get_py(part);
|
|
5013
|
-
double const rv0v = 1./LocalParticle_get_rvv(part);
|
|
5014
|
-
double const one_plus_delta = 1. + LocalParticle_get_delta(part);
|
|
5015
|
-
|
|
5016
|
-
double const one_over_pz = 1./sqrt(one_plus_delta*one_plus_delta
|
|
5017
|
-
- px * px - py * py);
|
|
5018
|
-
double const dzeta = 1 - rv0v * one_plus_delta * one_over_pz;
|
|
5019
|
-
|
|
5020
|
-
LocalParticle_add_to_x(part, px * one_over_pz * length);
|
|
5021
|
-
LocalParticle_add_to_y(part, py * one_over_pz * length);
|
|
5022
|
-
LocalParticle_add_to_zeta(part, dzeta * length);
|
|
5023
|
-
LocalParticle_add_to_s(part, length);
|
|
5024
|
-
}
|
|
5025
|
-
|
|
5026
|
-
|
|
5027
|
-
GPUFUN
|
|
5028
|
-
void Drift_single_particle(LocalParticle* part, double length){
|
|
5029
|
-
#ifndef XTRACK_USE_EXACT_DRIFTS
|
|
5030
|
-
Drift_single_particle_expanded(part, length);
|
|
5031
|
-
#else
|
|
5032
|
-
Drift_single_particle_exact(part, length);
|
|
5033
|
-
#endif
|
|
5034
|
-
}
|
|
5035
|
-
|
|
5036
|
-
|
|
5037
|
-
#endif /* XTRACK_TRACK_DRIFT_H */
|
|
5038
|
-
|
|
5039
|
-
|
|
5040
|
-
#ifndef XSTUITE_TRACK_FLAGS_H
|
|
5041
|
-
#define XSTUITE_TRACK_FLAGS_H
|
|
5042
|
-
#define XS_FLAG_BACKTRACK (0)
|
|
5043
|
-
#define XS_FLAG_KILL_CAVITY_KICK (2)
|
|
5044
|
-
#define XS_FLAG_IGNORE_GLOBAL_APERTURE (3)
|
|
5045
|
-
#define XS_FLAG_IGNORE_LOCAL_APERTURE (4)
|
|
5046
|
-
#define XS_FLAG_SR_TAPER (5)
|
|
5047
|
-
#define XS_FLAG_SR_KICK_SAME_AS_FIRST (6)
|
|
5048
|
-
|
|
5049
|
-
#endif // XSTUITE_TRACK_FLAGS_H
|
|
5050
|
-
|
|
5051
|
-
// copyright ############################### //
|
|
5052
|
-
// This file is part of the Xtrack Package. //
|
|
5053
|
-
// Copyright (c) CERN, 2021. //
|
|
5054
|
-
// ######################################### //
|
|
5055
|
-
|
|
5056
|
-
#ifndef XTRACK_MONITORS_H
|
|
5057
|
-
#define XTRACK_MONITORS_H
|
|
5058
|
-
|
|
5059
|
-
#include <headers/track.h>
|
|
5060
|
-
|
|
5061
|
-
|
|
5062
|
-
GPUFUN
|
|
5063
|
-
void ParticlesMonitor_track_local_particle(ParticlesMonitorData el,
|
|
5064
|
-
LocalParticle* part0){
|
|
5065
|
-
|
|
5066
|
-
int64_t const start_at_turn = ParticlesMonitorData_get_start_at_turn(el);
|
|
5067
|
-
int64_t const stop_at_turn = ParticlesMonitorData_get_stop_at_turn(el);
|
|
5068
|
-
int64_t const part_id_start = ParticlesMonitorData_get_part_id_start(el);
|
|
5069
|
-
int64_t const part_id_end= ParticlesMonitorData_get_part_id_end(el);
|
|
5070
|
-
int64_t const ebe_mode = ParticlesMonitorData_get_ebe_mode(el);
|
|
5071
|
-
int64_t const n_repetitions = ParticlesMonitorData_get_n_repetitions(el);
|
|
5072
|
-
int64_t const repetition_period = ParticlesMonitorData_get_repetition_period(el);
|
|
5073
|
-
ParticlesData data = ParticlesMonitorData_getp_data(el);
|
|
5074
|
-
|
|
5075
|
-
int64_t n_turns_record = stop_at_turn - start_at_turn;
|
|
5076
|
-
|
|
5077
|
-
START_PER_PARTICLE_BLOCK(part0, part);
|
|
5078
|
-
int64_t at_turn;
|
|
5079
|
-
if (ebe_mode){
|
|
5080
|
-
at_turn = LocalParticle_get_at_element(part);
|
|
5081
|
-
}
|
|
5082
|
-
else{
|
|
5083
|
-
if (LocalParticle_check_track_flag(part, XS_FLAG_BACKTRACK)) {
|
|
5084
|
-
return; // do not log (only ebe monitor supported for now in backtrack)
|
|
5085
|
-
}
|
|
5086
|
-
at_turn = LocalParticle_get_at_turn(part);
|
|
5087
|
-
}
|
|
5088
|
-
if (n_repetitions == 1){
|
|
5089
|
-
if (at_turn>=start_at_turn && at_turn<stop_at_turn){
|
|
5090
|
-
int64_t const particle_id = LocalParticle_get_particle_id(part);
|
|
5091
|
-
if (particle_id<part_id_end && particle_id>=part_id_start){
|
|
5092
|
-
int64_t const store_at =
|
|
5093
|
-
n_turns_record * (particle_id - part_id_start)
|
|
5094
|
-
+ at_turn - start_at_turn;
|
|
5095
|
-
LocalParticle_to_Particles(part, data, store_at, 0);
|
|
5096
|
-
}
|
|
5097
|
-
}
|
|
5098
|
-
}
|
|
5099
|
-
else if (n_repetitions > 1){
|
|
5100
|
-
if (at_turn < start_at_turn){
|
|
5101
|
-
// return; //only_for_context cuda opencl
|
|
5102
|
-
break; //only_for_context cpu_serial cpu_openmp
|
|
5103
|
-
}
|
|
5104
|
-
int64_t const i_frame = (at_turn - start_at_turn) / repetition_period;
|
|
5105
|
-
if (i_frame < n_repetitions
|
|
5106
|
-
&& at_turn >= start_at_turn + i_frame*repetition_period
|
|
5107
|
-
&& at_turn < stop_at_turn + i_frame*repetition_period
|
|
5108
|
-
){
|
|
5109
|
-
int64_t const particle_id = LocalParticle_get_particle_id(part);
|
|
5110
|
-
if (particle_id<part_id_end && particle_id>=part_id_start){
|
|
5111
|
-
int64_t const store_at =
|
|
5112
|
-
n_turns_record * (part_id_end - part_id_start) * i_frame
|
|
5113
|
-
+ n_turns_record * (particle_id - part_id_start)
|
|
5114
|
-
+ (at_turn - i_frame * repetition_period) - start_at_turn;
|
|
5115
|
-
LocalParticle_to_Particles(part, data, store_at, 0);
|
|
5116
|
-
}
|
|
5117
|
-
}
|
|
5118
|
-
}
|
|
5119
|
-
|
|
5120
|
-
#ifdef XSUITE_RESTORE_LOSS
|
|
5121
|
-
LocalParticle_set_state(part, 1);
|
|
5122
|
-
#endif
|
|
5123
|
-
END_PER_PARTICLE_BLOCK;
|
|
5124
|
-
}
|
|
5125
|
-
|
|
5126
|
-
#endif
|
|
5127
|
-
|
|
5128
|
-
|
|
5129
|
-
|
|
5130
|
-
#include <headers/track.h>
|
|
5131
|
-
#include <headers/particle_states.h>
|
|
5132
|
-
#include <beam_elements/elements_src/track_misalignments.h>
|
|
5133
|
-
GPUFUN void ParticlesMonitor_track_local_particle_with_transformations(ParticlesMonitorData el, LocalParticle* part0){
|
|
5134
|
-
// Transform to local frame
|
|
5135
|
-
double const _sin_rot_s = ParticlesMonitorData_get__sin_rot_s(el);
|
|
5136
|
-
if (_sin_rot_s > -2.) {
|
|
5137
|
-
double const _cos_rot_s = ParticlesMonitorData_get__cos_rot_s(el);
|
|
5138
|
-
double const rot_s_rad = atan2(_sin_rot_s, _cos_rot_s);
|
|
5139
|
-
double const shift_x = ParticlesMonitorData_get__shift_x(el);
|
|
5140
|
-
double const shift_y = ParticlesMonitorData_get__shift_y(el);
|
|
5141
|
-
double const shift_s = ParticlesMonitorData_get__shift_s(el);
|
|
5142
|
-
double const rot_x_rad = ParticlesMonitorData_get__rot_x_rad(el);
|
|
5143
|
-
double const rot_y_rad = ParticlesMonitorData_get__rot_y_rad(el);
|
|
5144
|
-
double const rot_s_rad_no_frame = ParticlesMonitorData_get__rot_s_rad_no_frame(el);
|
|
5145
|
-
double const length = 0.;
|
|
5146
|
-
;
|
|
5147
|
-
double const anchor = ParticlesMonitorData_get_rot_shift_anchor(el);
|
|
5148
|
-
int8_t const backtrack = LocalParticle_check_track_flag(part0, XS_FLAG_BACKTRACK);
|
|
5149
|
-
|
|
5150
|
-
if (!backtrack) {
|
|
5151
|
-
track_misalignment_entry_straight(part0, shift_x, shift_y, shift_s, rot_y_rad, rot_x_rad, rot_s_rad_no_frame, anchor, length, rot_s_rad, backtrack); } else {
|
|
5152
|
-
track_misalignment_exit_straight(part0, shift_x, shift_y, shift_s, rot_y_rad, rot_x_rad, rot_s_rad_no_frame, anchor, length, rot_s_rad, backtrack);
|
|
5153
|
-
}
|
|
5154
|
-
|
|
5155
|
-
/* Spin tracking is disabled by the synrad compile flag */
|
|
5156
|
-
#ifndef XTRACK_MULTIPOLE_NO_SYNRAD
|
|
5157
|
-
// Rotate spin
|
|
5158
|
-
|
|
5159
|
-
{
|
|
5160
|
-
// const int64_t XT_part_block_start_idx = part0->ipart; //only_for_context cpu_openmp
|
|
5161
|
-
// const int64_t XT_part_block_end_idx = part0->endpart; //only_for_context cpu_openmp
|
|
5162
|
-
|
|
5163
|
-
const int64_t XT_part_block_start_idx = 0; //only_for_context cpu_serial
|
|
5164
|
-
const int64_t XT_part_block_end_idx = LocalParticle_get__num_active_particles(part0); //only_for_context cpu_serial
|
|
5165
|
-
|
|
5166
|
-
//#pragma omp simd // TODO: currently does not work, needs investigating
|
|
5167
|
-
for (int64_t XT_part_block_ii = XT_part_block_start_idx; XT_part_block_ii<XT_part_block_end_idx; XT_part_block_ii++) { //only_for_context cpu_openmp cpu_serial
|
|
5168
|
-
|
|
5169
|
-
LocalParticle lpart = *part0; //only_for_context cpu_serial cpu_openmp
|
|
5170
|
-
LocalParticle* part = &lpart; //only_for_context cpu_serial cpu_openmp
|
|
5171
|
-
part->ipart = XT_part_block_ii; //only_for_context cpu_serial cpu_openmp
|
|
5172
|
-
|
|
5173
|
-
// LocalParticle* part = part0; //only_for_context opencl cuda
|
|
5174
|
-
|
|
5175
|
-
// if (LocalParticle_get_state(part) > 0) { //only_for_context cpu_openmp
|
|
5176
|
-
|
|
5177
|
-
double const spin_x_0 = LocalParticle_get_spin_x(part);
|
|
5178
|
-
double const spin_y_0 = LocalParticle_get_spin_y(part);
|
|
5179
|
-
if ((spin_x_0 != 0) || (spin_y_0 != 0)){
|
|
5180
|
-
double const spin_x_1 = _cos_rot_s*spin_x_0 + _sin_rot_s*spin_y_0;
|
|
5181
|
-
double const spin_y_1 = -_sin_rot_s*spin_x_0 + _cos_rot_s*spin_y_0;
|
|
5182
|
-
LocalParticle_set_spin_x(part, spin_x_1);
|
|
5183
|
-
LocalParticle_set_spin_y(part, spin_y_1);
|
|
5184
|
-
}
|
|
5185
|
-
|
|
5186
|
-
// } //only_for_context cpu_openmp
|
|
5187
|
-
} //only_for_context cpu_serial cpu_openmp
|
|
5188
|
-
}
|
|
5189
|
-
|
|
5190
|
-
#endif
|
|
5191
|
-
|
|
5052
|
+
static inline uint32_t ParticlesMonitorData_get_data__rng_s2(const ParticlesMonitorData restrict obj, int64_t i0){
|
|
5053
|
+
int64_t offset=0;
|
|
5054
|
+
offset+=152;
|
|
5055
|
+
offset+=*( int64_t*)(( char*) obj+offset+288);
|
|
5056
|
+
offset+=16+i0*4;
|
|
5057
|
+
return *( uint32_t*)(( char*) obj+offset);
|
|
5192
5058
|
}
|
|
5193
|
-
|
|
5194
|
-
|
|
5195
|
-
|
|
5196
|
-
|
|
5197
|
-
|
|
5198
|
-
|
|
5199
|
-
double const shift_y = ParticlesMonitorData_get__shift_y(el);
|
|
5200
|
-
double const shift_s = ParticlesMonitorData_get__shift_s(el);
|
|
5201
|
-
double const rot_x_rad = ParticlesMonitorData_get__rot_x_rad(el);
|
|
5202
|
-
double const rot_y_rad = ParticlesMonitorData_get__rot_y_rad(el);
|
|
5203
|
-
double const rot_s_rad_no_frame = ParticlesMonitorData_get__rot_s_rad_no_frame(el);
|
|
5204
|
-
double const length = 0.;
|
|
5205
|
-
;
|
|
5206
|
-
double const anchor = ParticlesMonitorData_get_rot_shift_anchor(el);
|
|
5207
|
-
int8_t const backtrack = LocalParticle_check_track_flag(part0, XS_FLAG_BACKTRACK);
|
|
5208
|
-
|
|
5209
|
-
/* Spin tracking is disabled by the synrad compile flag */
|
|
5210
|
-
#ifndef XTRACK_MULTIPOLE_NO_SYNRAD
|
|
5211
|
-
// Rotate spin
|
|
5212
|
-
|
|
5213
|
-
{
|
|
5214
|
-
// const int64_t XT_part_block_start_idx = part0->ipart; //only_for_context cpu_openmp
|
|
5215
|
-
// const int64_t XT_part_block_end_idx = part0->endpart; //only_for_context cpu_openmp
|
|
5216
|
-
|
|
5217
|
-
const int64_t XT_part_block_start_idx = 0; //only_for_context cpu_serial
|
|
5218
|
-
const int64_t XT_part_block_end_idx = LocalParticle_get__num_active_particles(part0); //only_for_context cpu_serial
|
|
5219
|
-
|
|
5220
|
-
//#pragma omp simd // TODO: currently does not work, needs investigating
|
|
5221
|
-
for (int64_t XT_part_block_ii = XT_part_block_start_idx; XT_part_block_ii<XT_part_block_end_idx; XT_part_block_ii++) { //only_for_context cpu_openmp cpu_serial
|
|
5222
|
-
|
|
5223
|
-
LocalParticle lpart = *part0; //only_for_context cpu_serial cpu_openmp
|
|
5224
|
-
LocalParticle* part = &lpart; //only_for_context cpu_serial cpu_openmp
|
|
5225
|
-
part->ipart = XT_part_block_ii; //only_for_context cpu_serial cpu_openmp
|
|
5226
|
-
|
|
5227
|
-
// LocalParticle* part = part0; //only_for_context opencl cuda
|
|
5228
|
-
|
|
5229
|
-
// if (LocalParticle_get_state(part) > 0) { //only_for_context cpu_openmp
|
|
5230
|
-
|
|
5231
|
-
double const spin_x_0 = LocalParticle_get_spin_x(part);
|
|
5232
|
-
double const spin_y_0 = LocalParticle_get_spin_y(part);
|
|
5233
|
-
if ((spin_x_0 != 0) || (spin_y_0 != 0)){
|
|
5234
|
-
double const spin_x_1 = _cos_rot_s*spin_x_0 - _sin_rot_s*spin_y_0;
|
|
5235
|
-
double const spin_y_1 = _sin_rot_s*spin_x_0 + _cos_rot_s*spin_y_0;
|
|
5236
|
-
LocalParticle_set_spin_x(part, spin_x_1);
|
|
5237
|
-
LocalParticle_set_spin_y(part, spin_y_1);
|
|
5238
|
-
}
|
|
5239
|
-
|
|
5240
|
-
// } //only_for_context cpu_openmp
|
|
5241
|
-
} //only_for_context cpu_serial cpu_openmp
|
|
5242
|
-
}
|
|
5243
|
-
|
|
5244
|
-
#endif
|
|
5245
|
-
|
|
5246
|
-
if (!backtrack) {
|
|
5247
|
-
track_misalignment_exit_straight(part0, shift_x, shift_y, shift_s, rot_y_rad, rot_x_rad, rot_s_rad_no_frame, anchor, length, rot_s_rad, backtrack); } else {
|
|
5248
|
-
track_misalignment_entry_straight(part0, shift_x, shift_y, shift_s, rot_y_rad, rot_x_rad, rot_s_rad_no_frame, anchor, length, rot_s_rad, backtrack);
|
|
5249
|
-
}
|
|
5059
|
+
static inline void ParticlesMonitorData_set_data__rng_s2(ParticlesMonitorData restrict obj, int64_t i0, uint32_t value){
|
|
5060
|
+
int64_t offset=0;
|
|
5061
|
+
offset+=152;
|
|
5062
|
+
offset+=*( int64_t*)(( char*) obj+offset+288);
|
|
5063
|
+
offset+=16+i0*4;
|
|
5064
|
+
*( uint32_t*)(( char*) obj+offset)=value;
|
|
5250
5065
|
}
|
|
5066
|
+
static inline uint32_t* ParticlesMonitorData_getp1_data__rng_s2(ParticlesMonitorData restrict obj, int64_t i0){
|
|
5067
|
+
int64_t offset=0;
|
|
5068
|
+
offset+=152;
|
|
5069
|
+
offset+=*( int64_t*)(( char*) obj+offset+288);
|
|
5070
|
+
offset+=16+i0*4;
|
|
5071
|
+
return ( uint32_t*)(( char*) obj+offset);
|
|
5251
5072
|
}
|
|
5252
|
-
|
|
5253
|
-
|
|
5254
|
-
|
|
5255
|
-
void ParticlesMonitor_track_particles(
|
|
5256
|
-
ParticlesMonitorData el,
|
|
5257
|
-
|
|
5258
|
-
ParticlesData particles,
|
|
5259
|
-
|
|
5260
|
-
int64_t flag_increment_at_element,
|
|
5261
|
-
int8_t* io_buffer){
|
|
5262
|
-
|
|
5263
|
-
// #define CONTEXT_OPENMP //only_for_context cpu_openmp
|
|
5264
|
-
#ifdef CONTEXT_OPENMP
|
|
5265
|
-
const int64_t capacity = ParticlesData_get__capacity(particles);
|
|
5266
|
-
const int num_threads = omp_get_max_threads();
|
|
5267
|
-
|
|
5268
|
-
#ifndef XT_OMP_SKIP_REORGANIZE
|
|
5269
|
-
const int64_t num_particles_to_track = ParticlesData_get__num_active_particles(particles);
|
|
5270
|
-
|
|
5271
|
-
{
|
|
5272
|
-
LocalParticle lpart;
|
|
5273
|
-
lpart.io_buffer = io_buffer;
|
|
5274
|
-
Particles_to_LocalParticle(particles, &lpart, 0, capacity);
|
|
5275
|
-
check_is_active(&lpart);
|
|
5276
|
-
count_reorganized_particles(&lpart);
|
|
5277
|
-
LocalParticle_to_Particles(&lpart, particles, 0, capacity);
|
|
5278
|
-
}
|
|
5279
|
-
#else // When we skip reorganize, we cannot just batch active particles
|
|
5280
|
-
const int64_t num_particles_to_track = capacity;
|
|
5281
|
-
#endif
|
|
5282
|
-
|
|
5283
|
-
const int64_t chunk_size = (num_particles_to_track + num_threads - 1)/num_threads; // ceil division
|
|
5284
|
-
#endif // CONTEXT_OPENMP
|
|
5285
|
-
|
|
5286
|
-
// #pragma omp parallel for //only_for_context cpu_openmp
|
|
5287
|
-
// for (int64_t batch_id = 0; batch_id < num_threads; batch_id++) { //only_for_context cpu_openmp
|
|
5288
|
-
LocalParticle lpart;
|
|
5289
|
-
lpart.io_buffer = io_buffer;
|
|
5290
|
-
lpart.track_flags = 0;
|
|
5291
|
-
// int64_t part_id = batch_id * chunk_size; //only_for_context cpu_openmp
|
|
5292
|
-
// int64_t end_id = (batch_id + 1) * chunk_size; //only_for_context cpu_openmp
|
|
5293
|
-
// if (end_id > num_particles_to_track) end_id = num_particles_to_track; //only_for_context cpu_openmp
|
|
5294
|
-
|
|
5295
|
-
int64_t part_id = 0; //only_for_context cpu_serial
|
|
5296
|
-
// int64_t part_id = blockDim.x * blockIdx.x + threadIdx.x; //only_for_context cuda
|
|
5297
|
-
// int64_t part_id = get_global_id(0); //only_for_context opencl
|
|
5298
|
-
int64_t end_id = 0; // unused outside of openmp //only_for_context cpu_serial cuda opencl
|
|
5299
|
-
|
|
5300
|
-
int64_t part_capacity = ParticlesData_get__capacity(particles);
|
|
5301
|
-
if (part_id<part_capacity){
|
|
5302
|
-
Particles_to_LocalParticle(particles, &lpart, part_id, end_id);
|
|
5303
|
-
if (check_is_active(&lpart)>0){
|
|
5304
|
-
ParticlesMonitor_track_local_particle_with_transformations(el, &lpart);
|
|
5305
|
-
|
|
5306
|
-
}
|
|
5307
|
-
if (check_is_active(&lpart)>0 && flag_increment_at_element){
|
|
5308
|
-
increment_at_element(&lpart, 1);
|
|
5309
|
-
}
|
|
5310
|
-
}
|
|
5311
|
-
// } //only_for_context cpu_openmp
|
|
5312
|
-
|
|
5313
|
-
// On OpenMP we want to additionally by default reorganize all
|
|
5314
|
-
// the particles.
|
|
5315
|
-
// #ifndef XT_OMP_SKIP_REORGANIZE //only_for_context cpu_openmp
|
|
5316
|
-
// LocalParticle lpart; //only_for_context cpu_openmp
|
|
5317
|
-
// lpart.io_buffer = io_buffer; //only_for_context cpu_openmp
|
|
5318
|
-
// Particles_to_LocalParticle(particles, &lpart, 0, capacity);//only_for_context cpu_openmp
|
|
5319
|
-
// check_is_active(&lpart); //only_for_context cpu_openmp
|
|
5320
|
-
// #endif //only_for_context cpu_openmp
|
|
5321
|
-
}
|
|
5322
|
-
|
|
5323
|
-
#ifndef XOBJ_TYPEDEF_RandomUniformData
|
|
5324
|
-
#define XOBJ_TYPEDEF_RandomUniformData
|
|
5325
|
-
typedef struct RandomUniformData_s * RandomUniformData;
|
|
5326
|
-
static inline RandomUniformData RandomUniformData_getp(RandomUniformData restrict obj){
|
|
5073
|
+
static inline ArrNUint32 ParticlesMonitorData_getp_data__rng_s3(ParticlesMonitorData restrict obj){
|
|
5327
5074
|
int64_t offset=0;
|
|
5328
|
-
|
|
5075
|
+
offset+=152;
|
|
5076
|
+
offset+=*( int64_t*)(( char*) obj+offset+296);
|
|
5077
|
+
return (ArrNUint32)(( char*) obj+offset);
|
|
5329
5078
|
}
|
|
5330
|
-
static inline
|
|
5079
|
+
static inline int64_t ParticlesMonitorData_len_data__rng_s3(ParticlesMonitorData restrict obj){
|
|
5331
5080
|
int64_t offset=0;
|
|
5332
|
-
|
|
5081
|
+
offset+=152;
|
|
5082
|
+
offset+=*( int64_t*)(( char*) obj+offset+296);
|
|
5083
|
+
int64_t* arr = ( int64_t*)(( char*) obj+offset);
|
|
5084
|
+
return arr[1];
|
|
5333
5085
|
}
|
|
5334
|
-
static inline
|
|
5086
|
+
static inline uint32_t ParticlesMonitorData_get_data__rng_s3(const ParticlesMonitorData restrict obj, int64_t i0){
|
|
5335
5087
|
int64_t offset=0;
|
|
5336
|
-
|
|
5088
|
+
offset+=152;
|
|
5089
|
+
offset+=*( int64_t*)(( char*) obj+offset+296);
|
|
5090
|
+
offset+=16+i0*4;
|
|
5091
|
+
return *( uint32_t*)(( char*) obj+offset);
|
|
5337
5092
|
}
|
|
5338
|
-
static inline
|
|
5093
|
+
static inline void ParticlesMonitorData_set_data__rng_s3(ParticlesMonitorData restrict obj, int64_t i0, uint32_t value){
|
|
5339
5094
|
int64_t offset=0;
|
|
5340
|
-
|
|
5095
|
+
offset+=152;
|
|
5096
|
+
offset+=*( int64_t*)(( char*) obj+offset+296);
|
|
5097
|
+
offset+=16+i0*4;
|
|
5098
|
+
*( uint32_t*)(( char*) obj+offset)=value;
|
|
5341
5099
|
}
|
|
5342
|
-
static inline
|
|
5100
|
+
static inline uint32_t* ParticlesMonitorData_getp1_data__rng_s3(ParticlesMonitorData restrict obj, int64_t i0){
|
|
5343
5101
|
int64_t offset=0;
|
|
5344
|
-
offset+=
|
|
5102
|
+
offset+=152;
|
|
5103
|
+
offset+=*( int64_t*)(( char*) obj+offset+296);
|
|
5104
|
+
offset+=16+i0*4;
|
|
5105
|
+
return ( uint32_t*)(( char*) obj+offset);
|
|
5106
|
+
}
|
|
5107
|
+
static inline ArrNUint32 ParticlesMonitorData_getp_data__rng_s4(ParticlesMonitorData restrict obj){
|
|
5108
|
+
int64_t offset=0;
|
|
5109
|
+
offset+=152;
|
|
5110
|
+
offset+=*( int64_t*)(( char*) obj+offset+304);
|
|
5111
|
+
return (ArrNUint32)(( char*) obj+offset);
|
|
5112
|
+
}
|
|
5113
|
+
static inline int64_t ParticlesMonitorData_len_data__rng_s4(ParticlesMonitorData restrict obj){
|
|
5114
|
+
int64_t offset=0;
|
|
5115
|
+
offset+=152;
|
|
5116
|
+
offset+=*( int64_t*)(( char*) obj+offset+304);
|
|
5117
|
+
int64_t* arr = ( int64_t*)(( char*) obj+offset);
|
|
5118
|
+
return arr[1];
|
|
5119
|
+
}
|
|
5120
|
+
static inline uint32_t ParticlesMonitorData_get_data__rng_s4(const ParticlesMonitorData restrict obj, int64_t i0){
|
|
5121
|
+
int64_t offset=0;
|
|
5122
|
+
offset+=152;
|
|
5123
|
+
offset+=*( int64_t*)(( char*) obj+offset+304);
|
|
5124
|
+
offset+=16+i0*4;
|
|
5125
|
+
return *( uint32_t*)(( char*) obj+offset);
|
|
5126
|
+
}
|
|
5127
|
+
static inline void ParticlesMonitorData_set_data__rng_s4(ParticlesMonitorData restrict obj, int64_t i0, uint32_t value){
|
|
5128
|
+
int64_t offset=0;
|
|
5129
|
+
offset+=152;
|
|
5130
|
+
offset+=*( int64_t*)(( char*) obj+offset+304);
|
|
5131
|
+
offset+=16+i0*4;
|
|
5132
|
+
*( uint32_t*)(( char*) obj+offset)=value;
|
|
5133
|
+
}
|
|
5134
|
+
static inline uint32_t* ParticlesMonitorData_getp1_data__rng_s4(ParticlesMonitorData restrict obj, int64_t i0){
|
|
5135
|
+
int64_t offset=0;
|
|
5136
|
+
offset+=152;
|
|
5137
|
+
offset+=*( int64_t*)(( char*) obj+offset+304);
|
|
5138
|
+
offset+=16+i0*4;
|
|
5139
|
+
return ( uint32_t*)(( char*) obj+offset);
|
|
5140
|
+
}
|
|
5141
|
+
static inline double ParticlesMonitorData_get__sin_rot_s(const ParticlesMonitorData restrict obj){
|
|
5142
|
+
int64_t offset=0;
|
|
5143
|
+
offset+=80;
|
|
5345
5144
|
return *( double*)(( char*) obj+offset);
|
|
5346
5145
|
}
|
|
5347
|
-
static inline void
|
|
5146
|
+
static inline void ParticlesMonitorData_set__sin_rot_s(ParticlesMonitorData restrict obj, double value){
|
|
5348
5147
|
int64_t offset=0;
|
|
5349
|
-
offset+=
|
|
5148
|
+
offset+=80;
|
|
5350
5149
|
*( double*)(( char*) obj+offset)=value;
|
|
5351
5150
|
}
|
|
5352
|
-
static inline double*
|
|
5151
|
+
static inline double* ParticlesMonitorData_getp__sin_rot_s(ParticlesMonitorData restrict obj){
|
|
5353
5152
|
int64_t offset=0;
|
|
5354
|
-
offset+=
|
|
5153
|
+
offset+=80;
|
|
5355
5154
|
return ( double*)(( char*) obj+offset);
|
|
5356
5155
|
}
|
|
5357
|
-
static inline double
|
|
5156
|
+
static inline double ParticlesMonitorData_get__cos_rot_s(const ParticlesMonitorData restrict obj){
|
|
5358
5157
|
int64_t offset=0;
|
|
5359
|
-
offset+=
|
|
5158
|
+
offset+=88;
|
|
5360
5159
|
return *( double*)(( char*) obj+offset);
|
|
5361
5160
|
}
|
|
5362
|
-
static inline void
|
|
5161
|
+
static inline void ParticlesMonitorData_set__cos_rot_s(ParticlesMonitorData restrict obj, double value){
|
|
5363
5162
|
int64_t offset=0;
|
|
5364
|
-
offset+=
|
|
5163
|
+
offset+=88;
|
|
5365
5164
|
*( double*)(( char*) obj+offset)=value;
|
|
5366
5165
|
}
|
|
5367
|
-
static inline double*
|
|
5166
|
+
static inline double* ParticlesMonitorData_getp__cos_rot_s(ParticlesMonitorData restrict obj){
|
|
5368
5167
|
int64_t offset=0;
|
|
5369
|
-
offset+=
|
|
5168
|
+
offset+=88;
|
|
5370
5169
|
return ( double*)(( char*) obj+offset);
|
|
5371
5170
|
}
|
|
5372
|
-
static inline double
|
|
5171
|
+
static inline double ParticlesMonitorData_get__shift_x(const ParticlesMonitorData restrict obj){
|
|
5373
5172
|
int64_t offset=0;
|
|
5374
|
-
offset+=
|
|
5173
|
+
offset+=96;
|
|
5375
5174
|
return *( double*)(( char*) obj+offset);
|
|
5376
5175
|
}
|
|
5377
|
-
static inline void
|
|
5176
|
+
static inline void ParticlesMonitorData_set__shift_x(ParticlesMonitorData restrict obj, double value){
|
|
5378
5177
|
int64_t offset=0;
|
|
5379
|
-
offset+=
|
|
5178
|
+
offset+=96;
|
|
5380
5179
|
*( double*)(( char*) obj+offset)=value;
|
|
5381
5180
|
}
|
|
5382
|
-
static inline double*
|
|
5181
|
+
static inline double* ParticlesMonitorData_getp__shift_x(ParticlesMonitorData restrict obj){
|
|
5383
5182
|
int64_t offset=0;
|
|
5384
|
-
offset+=
|
|
5183
|
+
offset+=96;
|
|
5385
5184
|
return ( double*)(( char*) obj+offset);
|
|
5386
5185
|
}
|
|
5387
|
-
static inline double
|
|
5186
|
+
static inline double ParticlesMonitorData_get__shift_y(const ParticlesMonitorData restrict obj){
|
|
5388
5187
|
int64_t offset=0;
|
|
5389
|
-
offset+=
|
|
5188
|
+
offset+=104;
|
|
5390
5189
|
return *( double*)(( char*) obj+offset);
|
|
5391
5190
|
}
|
|
5392
|
-
static inline void
|
|
5191
|
+
static inline void ParticlesMonitorData_set__shift_y(ParticlesMonitorData restrict obj, double value){
|
|
5393
5192
|
int64_t offset=0;
|
|
5394
|
-
offset+=
|
|
5193
|
+
offset+=104;
|
|
5395
5194
|
*( double*)(( char*) obj+offset)=value;
|
|
5396
5195
|
}
|
|
5397
|
-
static inline double*
|
|
5196
|
+
static inline double* ParticlesMonitorData_getp__shift_y(ParticlesMonitorData restrict obj){
|
|
5398
5197
|
int64_t offset=0;
|
|
5399
|
-
offset+=
|
|
5198
|
+
offset+=104;
|
|
5400
5199
|
return ( double*)(( char*) obj+offset);
|
|
5401
5200
|
}
|
|
5402
|
-
static inline double
|
|
5201
|
+
static inline double ParticlesMonitorData_get__shift_s(const ParticlesMonitorData restrict obj){
|
|
5403
5202
|
int64_t offset=0;
|
|
5404
|
-
offset+=
|
|
5203
|
+
offset+=112;
|
|
5405
5204
|
return *( double*)(( char*) obj+offset);
|
|
5406
5205
|
}
|
|
5407
|
-
static inline void
|
|
5206
|
+
static inline void ParticlesMonitorData_set__shift_s(ParticlesMonitorData restrict obj, double value){
|
|
5408
5207
|
int64_t offset=0;
|
|
5409
|
-
offset+=
|
|
5208
|
+
offset+=112;
|
|
5410
5209
|
*( double*)(( char*) obj+offset)=value;
|
|
5411
5210
|
}
|
|
5412
|
-
static inline double*
|
|
5211
|
+
static inline double* ParticlesMonitorData_getp__shift_s(ParticlesMonitorData restrict obj){
|
|
5413
5212
|
int64_t offset=0;
|
|
5414
|
-
offset+=
|
|
5213
|
+
offset+=112;
|
|
5415
5214
|
return ( double*)(( char*) obj+offset);
|
|
5416
5215
|
}
|
|
5417
|
-
static inline double
|
|
5216
|
+
static inline double ParticlesMonitorData_get__rot_x_rad(const ParticlesMonitorData restrict obj){
|
|
5418
5217
|
int64_t offset=0;
|
|
5419
|
-
offset+=
|
|
5218
|
+
offset+=120;
|
|
5420
5219
|
return *( double*)(( char*) obj+offset);
|
|
5421
5220
|
}
|
|
5422
|
-
static inline void
|
|
5221
|
+
static inline void ParticlesMonitorData_set__rot_x_rad(ParticlesMonitorData restrict obj, double value){
|
|
5423
5222
|
int64_t offset=0;
|
|
5424
|
-
offset+=
|
|
5223
|
+
offset+=120;
|
|
5425
5224
|
*( double*)(( char*) obj+offset)=value;
|
|
5426
5225
|
}
|
|
5427
|
-
static inline double*
|
|
5226
|
+
static inline double* ParticlesMonitorData_getp__rot_x_rad(ParticlesMonitorData restrict obj){
|
|
5428
5227
|
int64_t offset=0;
|
|
5429
|
-
offset+=
|
|
5228
|
+
offset+=120;
|
|
5430
5229
|
return ( double*)(( char*) obj+offset);
|
|
5431
5230
|
}
|
|
5432
|
-
static inline double
|
|
5231
|
+
static inline double ParticlesMonitorData_get__rot_y_rad(const ParticlesMonitorData restrict obj){
|
|
5433
5232
|
int64_t offset=0;
|
|
5434
|
-
offset+=
|
|
5233
|
+
offset+=128;
|
|
5435
5234
|
return *( double*)(( char*) obj+offset);
|
|
5436
5235
|
}
|
|
5437
|
-
static inline void
|
|
5236
|
+
static inline void ParticlesMonitorData_set__rot_y_rad(ParticlesMonitorData restrict obj, double value){
|
|
5438
5237
|
int64_t offset=0;
|
|
5439
|
-
offset+=
|
|
5238
|
+
offset+=128;
|
|
5440
5239
|
*( double*)(( char*) obj+offset)=value;
|
|
5441
5240
|
}
|
|
5442
|
-
static inline double*
|
|
5241
|
+
static inline double* ParticlesMonitorData_getp__rot_y_rad(ParticlesMonitorData restrict obj){
|
|
5443
5242
|
int64_t offset=0;
|
|
5444
|
-
offset+=
|
|
5243
|
+
offset+=128;
|
|
5445
5244
|
return ( double*)(( char*) obj+offset);
|
|
5446
5245
|
}
|
|
5447
|
-
static inline double
|
|
5246
|
+
static inline double ParticlesMonitorData_get__rot_s_rad_no_frame(const ParticlesMonitorData restrict obj){
|
|
5448
5247
|
int64_t offset=0;
|
|
5449
|
-
offset+=
|
|
5248
|
+
offset+=136;
|
|
5450
5249
|
return *( double*)(( char*) obj+offset);
|
|
5451
5250
|
}
|
|
5452
|
-
static inline void
|
|
5251
|
+
static inline void ParticlesMonitorData_set__rot_s_rad_no_frame(ParticlesMonitorData restrict obj, double value){
|
|
5453
5252
|
int64_t offset=0;
|
|
5454
|
-
offset+=
|
|
5253
|
+
offset+=136;
|
|
5455
5254
|
*( double*)(( char*) obj+offset)=value;
|
|
5456
5255
|
}
|
|
5457
|
-
static inline double*
|
|
5256
|
+
static inline double* ParticlesMonitorData_getp__rot_s_rad_no_frame(ParticlesMonitorData restrict obj){
|
|
5458
5257
|
int64_t offset=0;
|
|
5459
|
-
offset+=
|
|
5258
|
+
offset+=136;
|
|
5460
5259
|
return ( double*)(( char*) obj+offset);
|
|
5461
5260
|
}
|
|
5462
|
-
static inline double
|
|
5261
|
+
static inline double ParticlesMonitorData_get_rot_shift_anchor(const ParticlesMonitorData restrict obj){
|
|
5463
5262
|
int64_t offset=0;
|
|
5464
|
-
offset+=
|
|
5263
|
+
offset+=144;
|
|
5465
5264
|
return *( double*)(( char*) obj+offset);
|
|
5466
5265
|
}
|
|
5467
|
-
static inline void
|
|
5266
|
+
static inline void ParticlesMonitorData_set_rot_shift_anchor(ParticlesMonitorData restrict obj, double value){
|
|
5468
5267
|
int64_t offset=0;
|
|
5469
|
-
offset+=
|
|
5268
|
+
offset+=144;
|
|
5470
5269
|
*( double*)(( char*) obj+offset)=value;
|
|
5471
5270
|
}
|
|
5472
|
-
static inline double*
|
|
5271
|
+
static inline double* ParticlesMonitorData_getp_rot_shift_anchor(ParticlesMonitorData restrict obj){
|
|
5473
5272
|
int64_t offset=0;
|
|
5474
|
-
offset+=
|
|
5273
|
+
offset+=144;
|
|
5475
5274
|
return ( double*)(( char*) obj+offset);
|
|
5476
5275
|
}
|
|
5477
5276
|
#endif
|
|
@@ -5635,63 +5434,264 @@ void Drift_single_particle_expanded(LocalParticle* part, double length){
|
|
|
5635
5434
|
double const yp = LocalParticle_get_py(part) * rpp;
|
|
5636
5435
|
double const dzeta = 1 - rv0v * ( 1. + ( xp*xp + yp*yp ) / 2. );
|
|
5637
5436
|
|
|
5638
|
-
LocalParticle_add_to_x(part, xp * length );
|
|
5639
|
-
LocalParticle_add_to_y(part, yp * length );
|
|
5640
|
-
LocalParticle_add_to_s(part, length);
|
|
5641
|
-
LocalParticle_add_to_zeta(part, length * dzeta );
|
|
5437
|
+
LocalParticle_add_to_x(part, xp * length );
|
|
5438
|
+
LocalParticle_add_to_y(part, yp * length );
|
|
5439
|
+
LocalParticle_add_to_s(part, length);
|
|
5440
|
+
LocalParticle_add_to_zeta(part, length * dzeta );
|
|
5441
|
+
}
|
|
5442
|
+
|
|
5443
|
+
|
|
5444
|
+
GPUFUN
|
|
5445
|
+
void Drift_single_particle_exact(LocalParticle* part, double length){
|
|
5446
|
+
double const px = LocalParticle_get_px(part);
|
|
5447
|
+
double const py = LocalParticle_get_py(part);
|
|
5448
|
+
double const rv0v = 1./LocalParticle_get_rvv(part);
|
|
5449
|
+
double const one_plus_delta = 1. + LocalParticle_get_delta(part);
|
|
5450
|
+
|
|
5451
|
+
double const one_over_pz = 1./sqrt(one_plus_delta*one_plus_delta
|
|
5452
|
+
- px * px - py * py);
|
|
5453
|
+
double const dzeta = 1 - rv0v * one_plus_delta * one_over_pz;
|
|
5454
|
+
|
|
5455
|
+
LocalParticle_add_to_x(part, px * one_over_pz * length);
|
|
5456
|
+
LocalParticle_add_to_y(part, py * one_over_pz * length);
|
|
5457
|
+
LocalParticle_add_to_zeta(part, dzeta * length);
|
|
5458
|
+
LocalParticle_add_to_s(part, length);
|
|
5459
|
+
}
|
|
5460
|
+
|
|
5461
|
+
|
|
5462
|
+
GPUFUN
|
|
5463
|
+
void Drift_single_particle(LocalParticle* part, double length){
|
|
5464
|
+
#ifndef XTRACK_USE_EXACT_DRIFTS
|
|
5465
|
+
Drift_single_particle_expanded(part, length);
|
|
5466
|
+
#else
|
|
5467
|
+
Drift_single_particle_exact(part, length);
|
|
5468
|
+
#endif
|
|
5469
|
+
}
|
|
5470
|
+
|
|
5471
|
+
|
|
5472
|
+
#endif /* XTRACK_TRACK_DRIFT_H */
|
|
5473
|
+
|
|
5474
|
+
|
|
5475
|
+
#ifndef XSTUITE_TRACK_FLAGS_H
|
|
5476
|
+
#define XSTUITE_TRACK_FLAGS_H
|
|
5477
|
+
#define XS_FLAG_BACKTRACK (0)
|
|
5478
|
+
#define XS_FLAG_KILL_CAVITY_KICK (2)
|
|
5479
|
+
#define XS_FLAG_IGNORE_GLOBAL_APERTURE (3)
|
|
5480
|
+
#define XS_FLAG_IGNORE_LOCAL_APERTURE (4)
|
|
5481
|
+
#define XS_FLAG_SR_TAPER (5)
|
|
5482
|
+
#define XS_FLAG_SR_KICK_SAME_AS_FIRST (6)
|
|
5483
|
+
|
|
5484
|
+
#endif // XSTUITE_TRACK_FLAGS_H
|
|
5485
|
+
|
|
5486
|
+
// copyright ############################### //
|
|
5487
|
+
// This file is part of the Xtrack Package. //
|
|
5488
|
+
// Copyright (c) CERN, 2021. //
|
|
5489
|
+
// ######################################### //
|
|
5490
|
+
|
|
5491
|
+
#ifndef XTRACK_MONITORS_H
|
|
5492
|
+
#define XTRACK_MONITORS_H
|
|
5493
|
+
|
|
5494
|
+
#include <headers/track.h>
|
|
5495
|
+
|
|
5496
|
+
|
|
5497
|
+
GPUFUN
|
|
5498
|
+
void ParticlesMonitor_track_local_particle(ParticlesMonitorData el,
|
|
5499
|
+
LocalParticle* part0){
|
|
5500
|
+
|
|
5501
|
+
int64_t const start_at_turn = ParticlesMonitorData_get_start_at_turn(el);
|
|
5502
|
+
int64_t const stop_at_turn = ParticlesMonitorData_get_stop_at_turn(el);
|
|
5503
|
+
int64_t const part_id_start = ParticlesMonitorData_get_part_id_start(el);
|
|
5504
|
+
int64_t const part_id_end= ParticlesMonitorData_get_part_id_end(el);
|
|
5505
|
+
int64_t const ebe_mode = ParticlesMonitorData_get_ebe_mode(el);
|
|
5506
|
+
int64_t const n_repetitions = ParticlesMonitorData_get_n_repetitions(el);
|
|
5507
|
+
int64_t const repetition_period = ParticlesMonitorData_get_repetition_period(el);
|
|
5508
|
+
ParticlesData data = ParticlesMonitorData_getp_data(el);
|
|
5509
|
+
|
|
5510
|
+
int64_t n_turns_record = stop_at_turn - start_at_turn;
|
|
5511
|
+
|
|
5512
|
+
START_PER_PARTICLE_BLOCK(part0, part);
|
|
5513
|
+
int64_t at_turn;
|
|
5514
|
+
if (ebe_mode){
|
|
5515
|
+
at_turn = LocalParticle_get_at_element(part);
|
|
5516
|
+
}
|
|
5517
|
+
else{
|
|
5518
|
+
if (LocalParticle_check_track_flag(part, XS_FLAG_BACKTRACK)) {
|
|
5519
|
+
return; // do not log (only ebe monitor supported for now in backtrack)
|
|
5520
|
+
}
|
|
5521
|
+
at_turn = LocalParticle_get_at_turn(part);
|
|
5522
|
+
}
|
|
5523
|
+
if (n_repetitions == 1){
|
|
5524
|
+
if (at_turn>=start_at_turn && at_turn<stop_at_turn){
|
|
5525
|
+
int64_t const particle_id = LocalParticle_get_particle_id(part);
|
|
5526
|
+
if (particle_id<part_id_end && particle_id>=part_id_start){
|
|
5527
|
+
int64_t const store_at =
|
|
5528
|
+
n_turns_record * (particle_id - part_id_start)
|
|
5529
|
+
+ at_turn - start_at_turn;
|
|
5530
|
+
LocalParticle_to_Particles(part, data, store_at, 0);
|
|
5531
|
+
}
|
|
5532
|
+
}
|
|
5533
|
+
}
|
|
5534
|
+
else if (n_repetitions > 1){
|
|
5535
|
+
if (at_turn < start_at_turn){
|
|
5536
|
+
// return; //only_for_context cuda opencl
|
|
5537
|
+
break; //only_for_context cpu_serial cpu_openmp
|
|
5538
|
+
}
|
|
5539
|
+
int64_t const i_frame = (at_turn - start_at_turn) / repetition_period;
|
|
5540
|
+
if (i_frame < n_repetitions
|
|
5541
|
+
&& at_turn >= start_at_turn + i_frame*repetition_period
|
|
5542
|
+
&& at_turn < stop_at_turn + i_frame*repetition_period
|
|
5543
|
+
){
|
|
5544
|
+
int64_t const particle_id = LocalParticle_get_particle_id(part);
|
|
5545
|
+
if (particle_id<part_id_end && particle_id>=part_id_start){
|
|
5546
|
+
int64_t const store_at =
|
|
5547
|
+
n_turns_record * (part_id_end - part_id_start) * i_frame
|
|
5548
|
+
+ n_turns_record * (particle_id - part_id_start)
|
|
5549
|
+
+ (at_turn - i_frame * repetition_period) - start_at_turn;
|
|
5550
|
+
LocalParticle_to_Particles(part, data, store_at, 0);
|
|
5551
|
+
}
|
|
5552
|
+
}
|
|
5553
|
+
}
|
|
5554
|
+
|
|
5555
|
+
#ifdef XSUITE_RESTORE_LOSS
|
|
5556
|
+
LocalParticle_set_state(part, 1);
|
|
5557
|
+
#endif
|
|
5558
|
+
END_PER_PARTICLE_BLOCK;
|
|
5559
|
+
}
|
|
5560
|
+
|
|
5561
|
+
#endif
|
|
5562
|
+
|
|
5563
|
+
|
|
5564
|
+
|
|
5565
|
+
#include <headers/track.h>
|
|
5566
|
+
#include <headers/particle_states.h>
|
|
5567
|
+
#include <beam_elements/elements_src/track_misalignments.h>
|
|
5568
|
+
GPUFUN void ParticlesMonitor_track_local_particle_with_transformations(ParticlesMonitorData el, LocalParticle* part0){
|
|
5569
|
+
// Transform to local frame
|
|
5570
|
+
double const _sin_rot_s = ParticlesMonitorData_get__sin_rot_s(el);
|
|
5571
|
+
if (_sin_rot_s > -2.) {
|
|
5572
|
+
double const _cos_rot_s = ParticlesMonitorData_get__cos_rot_s(el);
|
|
5573
|
+
double const rot_s_rad = atan2(_sin_rot_s, _cos_rot_s);
|
|
5574
|
+
double const shift_x = ParticlesMonitorData_get__shift_x(el);
|
|
5575
|
+
double const shift_y = ParticlesMonitorData_get__shift_y(el);
|
|
5576
|
+
double const shift_s = ParticlesMonitorData_get__shift_s(el);
|
|
5577
|
+
double const rot_x_rad = ParticlesMonitorData_get__rot_x_rad(el);
|
|
5578
|
+
double const rot_y_rad = ParticlesMonitorData_get__rot_y_rad(el);
|
|
5579
|
+
double const rot_s_rad_no_frame = ParticlesMonitorData_get__rot_s_rad_no_frame(el);
|
|
5580
|
+
double const length = 0.;
|
|
5581
|
+
;
|
|
5582
|
+
double const anchor = ParticlesMonitorData_get_rot_shift_anchor(el);
|
|
5583
|
+
int8_t const backtrack = LocalParticle_check_track_flag(part0, XS_FLAG_BACKTRACK);
|
|
5584
|
+
|
|
5585
|
+
if (!backtrack) {
|
|
5586
|
+
track_misalignment_entry_straight(part0, shift_x, shift_y, shift_s, rot_y_rad, rot_x_rad, rot_s_rad_no_frame, anchor, length, rot_s_rad, backtrack); } else {
|
|
5587
|
+
track_misalignment_exit_straight(part0, shift_x, shift_y, shift_s, rot_y_rad, rot_x_rad, rot_s_rad_no_frame, anchor, length, rot_s_rad, backtrack);
|
|
5588
|
+
}
|
|
5589
|
+
|
|
5590
|
+
/* Spin tracking is disabled by the synrad compile flag */
|
|
5591
|
+
#ifndef XTRACK_MULTIPOLE_NO_SYNRAD
|
|
5592
|
+
// Rotate spin
|
|
5593
|
+
|
|
5594
|
+
{
|
|
5595
|
+
// const int64_t XT_part_block_start_idx = part0->ipart; //only_for_context cpu_openmp
|
|
5596
|
+
// const int64_t XT_part_block_end_idx = part0->endpart; //only_for_context cpu_openmp
|
|
5597
|
+
|
|
5598
|
+
const int64_t XT_part_block_start_idx = 0; //only_for_context cpu_serial
|
|
5599
|
+
const int64_t XT_part_block_end_idx = LocalParticle_get__num_active_particles(part0); //only_for_context cpu_serial
|
|
5600
|
+
|
|
5601
|
+
//#pragma omp simd // TODO: currently does not work, needs investigating
|
|
5602
|
+
for (int64_t XT_part_block_ii = XT_part_block_start_idx; XT_part_block_ii<XT_part_block_end_idx; XT_part_block_ii++) { //only_for_context cpu_openmp cpu_serial
|
|
5603
|
+
|
|
5604
|
+
LocalParticle lpart = *part0; //only_for_context cpu_serial cpu_openmp
|
|
5605
|
+
LocalParticle* part = &lpart; //only_for_context cpu_serial cpu_openmp
|
|
5606
|
+
part->ipart = XT_part_block_ii; //only_for_context cpu_serial cpu_openmp
|
|
5607
|
+
|
|
5608
|
+
// LocalParticle* part = part0; //only_for_context opencl cuda
|
|
5609
|
+
|
|
5610
|
+
// if (LocalParticle_get_state(part) > 0) { //only_for_context cpu_openmp
|
|
5611
|
+
|
|
5612
|
+
double const spin_x_0 = LocalParticle_get_spin_x(part);
|
|
5613
|
+
double const spin_y_0 = LocalParticle_get_spin_y(part);
|
|
5614
|
+
if ((spin_x_0 != 0) || (spin_y_0 != 0)){
|
|
5615
|
+
double const spin_x_1 = _cos_rot_s*spin_x_0 + _sin_rot_s*spin_y_0;
|
|
5616
|
+
double const spin_y_1 = -_sin_rot_s*spin_x_0 + _cos_rot_s*spin_y_0;
|
|
5617
|
+
LocalParticle_set_spin_x(part, spin_x_1);
|
|
5618
|
+
LocalParticle_set_spin_y(part, spin_y_1);
|
|
5619
|
+
}
|
|
5620
|
+
|
|
5621
|
+
// } //only_for_context cpu_openmp
|
|
5622
|
+
} //only_for_context cpu_serial cpu_openmp
|
|
5623
|
+
}
|
|
5624
|
+
|
|
5625
|
+
#endif
|
|
5626
|
+
|
|
5642
5627
|
}
|
|
5628
|
+
ParticlesMonitor_track_local_particle(el, part0);
|
|
5629
|
+
// Transform back to global frame
|
|
5630
|
+
if (_sin_rot_s > -2.) {
|
|
5631
|
+
double const _cos_rot_s = ParticlesMonitorData_get__cos_rot_s(el);
|
|
5632
|
+
double const rot_s_rad = atan2(_sin_rot_s, _cos_rot_s);
|
|
5633
|
+
double const shift_x = ParticlesMonitorData_get__shift_x(el);
|
|
5634
|
+
double const shift_y = ParticlesMonitorData_get__shift_y(el);
|
|
5635
|
+
double const shift_s = ParticlesMonitorData_get__shift_s(el);
|
|
5636
|
+
double const rot_x_rad = ParticlesMonitorData_get__rot_x_rad(el);
|
|
5637
|
+
double const rot_y_rad = ParticlesMonitorData_get__rot_y_rad(el);
|
|
5638
|
+
double const rot_s_rad_no_frame = ParticlesMonitorData_get__rot_s_rad_no_frame(el);
|
|
5639
|
+
double const length = 0.;
|
|
5640
|
+
;
|
|
5641
|
+
double const anchor = ParticlesMonitorData_get_rot_shift_anchor(el);
|
|
5642
|
+
int8_t const backtrack = LocalParticle_check_track_flag(part0, XS_FLAG_BACKTRACK);
|
|
5643
5643
|
|
|
5644
|
+
/* Spin tracking is disabled by the synrad compile flag */
|
|
5645
|
+
#ifndef XTRACK_MULTIPOLE_NO_SYNRAD
|
|
5646
|
+
// Rotate spin
|
|
5644
5647
|
|
|
5645
|
-
|
|
5646
|
-
|
|
5647
|
-
|
|
5648
|
-
double const py = LocalParticle_get_py(part);
|
|
5649
|
-
double const rv0v = 1./LocalParticle_get_rvv(part);
|
|
5650
|
-
double const one_plus_delta = 1. + LocalParticle_get_delta(part);
|
|
5648
|
+
{
|
|
5649
|
+
// const int64_t XT_part_block_start_idx = part0->ipart; //only_for_context cpu_openmp
|
|
5650
|
+
// const int64_t XT_part_block_end_idx = part0->endpart; //only_for_context cpu_openmp
|
|
5651
5651
|
|
|
5652
|
-
|
|
5653
|
-
|
|
5654
|
-
double const dzeta = 1 - rv0v * one_plus_delta * one_over_pz;
|
|
5652
|
+
const int64_t XT_part_block_start_idx = 0; //only_for_context cpu_serial
|
|
5653
|
+
const int64_t XT_part_block_end_idx = LocalParticle_get__num_active_particles(part0); //only_for_context cpu_serial
|
|
5655
5654
|
|
|
5656
|
-
|
|
5657
|
-
|
|
5658
|
-
LocalParticle_add_to_zeta(part, dzeta * length);
|
|
5659
|
-
LocalParticle_add_to_s(part, length);
|
|
5660
|
-
}
|
|
5655
|
+
//#pragma omp simd // TODO: currently does not work, needs investigating
|
|
5656
|
+
for (int64_t XT_part_block_ii = XT_part_block_start_idx; XT_part_block_ii<XT_part_block_end_idx; XT_part_block_ii++) { //only_for_context cpu_openmp cpu_serial
|
|
5661
5657
|
|
|
5658
|
+
LocalParticle lpart = *part0; //only_for_context cpu_serial cpu_openmp
|
|
5659
|
+
LocalParticle* part = &lpart; //only_for_context cpu_serial cpu_openmp
|
|
5660
|
+
part->ipart = XT_part_block_ii; //only_for_context cpu_serial cpu_openmp
|
|
5662
5661
|
|
|
5663
|
-
|
|
5664
|
-
void Drift_single_particle(LocalParticle* part, double length){
|
|
5665
|
-
#ifndef XTRACK_USE_EXACT_DRIFTS
|
|
5666
|
-
Drift_single_particle_expanded(part, length);
|
|
5667
|
-
#else
|
|
5668
|
-
Drift_single_particle_exact(part, length);
|
|
5669
|
-
#endif
|
|
5670
|
-
}
|
|
5662
|
+
// LocalParticle* part = part0; //only_for_context opencl cuda
|
|
5671
5663
|
|
|
5664
|
+
// if (LocalParticle_get_state(part) > 0) { //only_for_context cpu_openmp
|
|
5672
5665
|
|
|
5673
|
-
|
|
5666
|
+
double const spin_x_0 = LocalParticle_get_spin_x(part);
|
|
5667
|
+
double const spin_y_0 = LocalParticle_get_spin_y(part);
|
|
5668
|
+
if ((spin_x_0 != 0) || (spin_y_0 != 0)){
|
|
5669
|
+
double const spin_x_1 = _cos_rot_s*spin_x_0 - _sin_rot_s*spin_y_0;
|
|
5670
|
+
double const spin_y_1 = _sin_rot_s*spin_x_0 + _cos_rot_s*spin_y_0;
|
|
5671
|
+
LocalParticle_set_spin_x(part, spin_x_1);
|
|
5672
|
+
LocalParticle_set_spin_y(part, spin_y_1);
|
|
5673
|
+
}
|
|
5674
5674
|
|
|
5675
|
+
// } //only_for_context cpu_openmp
|
|
5676
|
+
} //only_for_context cpu_serial cpu_openmp
|
|
5677
|
+
}
|
|
5675
5678
|
|
|
5676
|
-
#
|
|
5677
|
-
#define XSTUITE_TRACK_FLAGS_H
|
|
5678
|
-
#define XS_FLAG_BACKTRACK (0)
|
|
5679
|
-
#define XS_FLAG_KILL_CAVITY_KICK (2)
|
|
5680
|
-
#define XS_FLAG_IGNORE_GLOBAL_APERTURE (3)
|
|
5681
|
-
#define XS_FLAG_IGNORE_LOCAL_APERTURE (4)
|
|
5682
|
-
#define XS_FLAG_SR_TAPER (5)
|
|
5683
|
-
#define XS_FLAG_SR_KICK_SAME_AS_FIRST (6)
|
|
5679
|
+
#endif
|
|
5684
5680
|
|
|
5685
|
-
|
|
5681
|
+
if (!backtrack) {
|
|
5682
|
+
track_misalignment_exit_straight(part0, shift_x, shift_y, shift_s, rot_y_rad, rot_x_rad, rot_s_rad_no_frame, anchor, length, rot_s_rad, backtrack); } else {
|
|
5683
|
+
track_misalignment_entry_straight(part0, shift_x, shift_y, shift_s, rot_y_rad, rot_x_rad, rot_s_rad_no_frame, anchor, length, rot_s_rad, backtrack);
|
|
5684
|
+
}
|
|
5685
|
+
}
|
|
5686
|
+
}
|
|
5686
5687
|
|
|
5687
|
-
#include <random/random_src/uniform.h>
|
|
5688
5688
|
|
|
5689
5689
|
|
|
5690
|
-
void
|
|
5691
|
-
|
|
5690
|
+
void ParticlesMonitor_track_particles(
|
|
5691
|
+
ParticlesMonitorData el,
|
|
5692
5692
|
|
|
5693
5693
|
ParticlesData particles,
|
|
5694
|
-
|
|
5694
|
+
|
|
5695
5695
|
int64_t flag_increment_at_element,
|
|
5696
5696
|
int8_t* io_buffer){
|
|
5697
5697
|
|
|
@@ -5736,7 +5736,7 @@ void Drift_single_particle(LocalParticle* part, double length){
|
|
|
5736
5736
|
if (part_id<part_capacity){
|
|
5737
5737
|
Particles_to_LocalParticle(particles, &lpart, part_id, end_id);
|
|
5738
5738
|
if (check_is_active(&lpart)>0){
|
|
5739
|
-
|
|
5739
|
+
ParticlesMonitor_track_local_particle_with_transformations(el, &lpart);
|
|
5740
5740
|
|
|
5741
5741
|
}
|
|
5742
5742
|
if (check_is_active(&lpart)>0 && flag_increment_at_element){
|
|
@@ -5755,178 +5755,219 @@ void Drift_single_particle(LocalParticle* part, double length){
|
|
|
5755
5755
|
// #endif //only_for_context cpu_openmp
|
|
5756
5756
|
}
|
|
5757
5757
|
|
|
5758
|
-
#ifndef
|
|
5759
|
-
#define
|
|
5760
|
-
typedef struct
|
|
5761
|
-
|
|
5762
|
-
static inline ElementRefClass ElementRefClass_getp(ElementRefClass restrict obj){
|
|
5763
|
-
int64_t offset=0;
|
|
5764
|
-
return (ElementRefClass)(( char*) obj+offset);
|
|
5765
|
-
}
|
|
5766
|
-
static inline int64_t ElementRefClass_typeid(const ElementRefClass restrict obj){
|
|
5767
|
-
int64_t offset=0;
|
|
5768
|
-
offset+=8;
|
|
5769
|
-
return *( int64_t*)(( char*) obj+offset);
|
|
5770
|
-
}
|
|
5771
|
-
static inline void* ElementRefClass_member(const ElementRefClass restrict obj){
|
|
5772
|
-
int64_t offset=0;
|
|
5773
|
-
offset+=*( int64_t*)(( char*) obj+offset);
|
|
5774
|
-
return ( void*)(( char*) obj+offset);
|
|
5775
|
-
}
|
|
5776
|
-
#endif
|
|
5777
|
-
#ifndef XOBJ_TYPEDEF_RandomExponentialData
|
|
5778
|
-
#define XOBJ_TYPEDEF_RandomExponentialData
|
|
5779
|
-
typedef struct RandomExponentialData_s * RandomExponentialData;
|
|
5780
|
-
static inline RandomExponentialData RandomExponentialData_getp(RandomExponentialData restrict obj){
|
|
5758
|
+
#ifndef XOBJ_TYPEDEF_RandomRutherfordData
|
|
5759
|
+
#define XOBJ_TYPEDEF_RandomRutherfordData
|
|
5760
|
+
typedef struct RandomRutherfordData_s * RandomRutherfordData;
|
|
5761
|
+
static inline RandomRutherfordData RandomRutherfordData_getp(RandomRutherfordData restrict obj){
|
|
5781
5762
|
int64_t offset=0;
|
|
5782
|
-
return (
|
|
5763
|
+
return (RandomRutherfordData)(( char*) obj+offset);
|
|
5783
5764
|
}
|
|
5784
|
-
static inline
|
|
5765
|
+
static inline double RandomRutherfordData_get_lower_val(const RandomRutherfordData restrict obj){
|
|
5785
5766
|
int64_t offset=0;
|
|
5786
|
-
return *((
|
|
5767
|
+
return *( double*)(( char*) obj+offset);
|
|
5787
5768
|
}
|
|
5788
|
-
static inline void
|
|
5769
|
+
static inline void RandomRutherfordData_set_lower_val(RandomRutherfordData restrict obj, double value){
|
|
5789
5770
|
int64_t offset=0;
|
|
5790
|
-
*((
|
|
5771
|
+
*( double*)(( char*) obj+offset)=value;
|
|
5791
5772
|
}
|
|
5792
|
-
static inline
|
|
5773
|
+
static inline double* RandomRutherfordData_getp_lower_val(RandomRutherfordData restrict obj){
|
|
5793
5774
|
int64_t offset=0;
|
|
5794
|
-
return (
|
|
5775
|
+
return ( double*)(( char*) obj+offset);
|
|
5795
5776
|
}
|
|
5796
|
-
static inline double
|
|
5777
|
+
static inline double RandomRutherfordData_get_upper_val(const RandomRutherfordData restrict obj){
|
|
5797
5778
|
int64_t offset=0;
|
|
5798
5779
|
offset+=8;
|
|
5799
5780
|
return *( double*)(( char*) obj+offset);
|
|
5800
5781
|
}
|
|
5801
|
-
static inline void
|
|
5782
|
+
static inline void RandomRutherfordData_set_upper_val(RandomRutherfordData restrict obj, double value){
|
|
5802
5783
|
int64_t offset=0;
|
|
5803
5784
|
offset+=8;
|
|
5804
5785
|
*( double*)(( char*) obj+offset)=value;
|
|
5805
5786
|
}
|
|
5806
|
-
static inline double*
|
|
5787
|
+
static inline double* RandomRutherfordData_getp_upper_val(RandomRutherfordData restrict obj){
|
|
5807
5788
|
int64_t offset=0;
|
|
5808
5789
|
offset+=8;
|
|
5809
5790
|
return ( double*)(( char*) obj+offset);
|
|
5810
5791
|
}
|
|
5811
|
-
static inline double
|
|
5792
|
+
static inline double RandomRutherfordData_get_A(const RandomRutherfordData restrict obj){
|
|
5812
5793
|
int64_t offset=0;
|
|
5813
5794
|
offset+=16;
|
|
5814
5795
|
return *( double*)(( char*) obj+offset);
|
|
5815
5796
|
}
|
|
5816
|
-
static inline void
|
|
5797
|
+
static inline void RandomRutherfordData_set_A(RandomRutherfordData restrict obj, double value){
|
|
5817
5798
|
int64_t offset=0;
|
|
5818
5799
|
offset+=16;
|
|
5819
5800
|
*( double*)(( char*) obj+offset)=value;
|
|
5820
5801
|
}
|
|
5821
|
-
static inline double*
|
|
5802
|
+
static inline double* RandomRutherfordData_getp_A(RandomRutherfordData restrict obj){
|
|
5822
5803
|
int64_t offset=0;
|
|
5823
5804
|
offset+=16;
|
|
5824
5805
|
return ( double*)(( char*) obj+offset);
|
|
5825
5806
|
}
|
|
5826
|
-
static inline double
|
|
5807
|
+
static inline double RandomRutherfordData_get_B(const RandomRutherfordData restrict obj){
|
|
5827
5808
|
int64_t offset=0;
|
|
5828
5809
|
offset+=24;
|
|
5829
5810
|
return *( double*)(( char*) obj+offset);
|
|
5830
5811
|
}
|
|
5831
|
-
static inline void
|
|
5812
|
+
static inline void RandomRutherfordData_set_B(RandomRutherfordData restrict obj, double value){
|
|
5832
5813
|
int64_t offset=0;
|
|
5833
5814
|
offset+=24;
|
|
5834
5815
|
*( double*)(( char*) obj+offset)=value;
|
|
5835
5816
|
}
|
|
5836
|
-
static inline double*
|
|
5817
|
+
static inline double* RandomRutherfordData_getp_B(RandomRutherfordData restrict obj){
|
|
5837
5818
|
int64_t offset=0;
|
|
5838
5819
|
offset+=24;
|
|
5839
5820
|
return ( double*)(( char*) obj+offset);
|
|
5840
5821
|
}
|
|
5841
|
-
static inline
|
|
5822
|
+
static inline int8_t RandomRutherfordData_get_Newton_iterations(const RandomRutherfordData restrict obj){
|
|
5842
5823
|
int64_t offset=0;
|
|
5843
5824
|
offset+=32;
|
|
5844
|
-
return *(
|
|
5825
|
+
return *(( int8_t*) obj+offset);
|
|
5845
5826
|
}
|
|
5846
|
-
static inline void
|
|
5827
|
+
static inline void RandomRutherfordData_set_Newton_iterations(RandomRutherfordData restrict obj, int8_t value){
|
|
5847
5828
|
int64_t offset=0;
|
|
5848
5829
|
offset+=32;
|
|
5849
|
-
*(
|
|
5830
|
+
*(( int8_t*) obj+offset)=value;
|
|
5850
5831
|
}
|
|
5851
|
-
static inline
|
|
5832
|
+
static inline int8_t* RandomRutherfordData_getp_Newton_iterations(RandomRutherfordData restrict obj){
|
|
5852
5833
|
int64_t offset=0;
|
|
5853
5834
|
offset+=32;
|
|
5854
|
-
return (
|
|
5835
|
+
return ( int8_t*)(( char*) obj+offset);
|
|
5855
5836
|
}
|
|
5856
|
-
static inline double
|
|
5837
|
+
static inline double RandomRutherfordData_get__sin_rot_s(const RandomRutherfordData restrict obj){
|
|
5857
5838
|
int64_t offset=0;
|
|
5858
5839
|
offset+=40;
|
|
5859
5840
|
return *( double*)(( char*) obj+offset);
|
|
5860
5841
|
}
|
|
5861
|
-
static inline void
|
|
5842
|
+
static inline void RandomRutherfordData_set__sin_rot_s(RandomRutherfordData restrict obj, double value){
|
|
5862
5843
|
int64_t offset=0;
|
|
5863
5844
|
offset+=40;
|
|
5864
5845
|
*( double*)(( char*) obj+offset)=value;
|
|
5865
5846
|
}
|
|
5866
|
-
static inline double*
|
|
5847
|
+
static inline double* RandomRutherfordData_getp__sin_rot_s(RandomRutherfordData restrict obj){
|
|
5867
5848
|
int64_t offset=0;
|
|
5868
5849
|
offset+=40;
|
|
5869
5850
|
return ( double*)(( char*) obj+offset);
|
|
5870
5851
|
}
|
|
5871
|
-
static inline double
|
|
5852
|
+
static inline double RandomRutherfordData_get__cos_rot_s(const RandomRutherfordData restrict obj){
|
|
5872
5853
|
int64_t offset=0;
|
|
5873
5854
|
offset+=48;
|
|
5874
5855
|
return *( double*)(( char*) obj+offset);
|
|
5875
5856
|
}
|
|
5876
|
-
static inline void
|
|
5857
|
+
static inline void RandomRutherfordData_set__cos_rot_s(RandomRutherfordData restrict obj, double value){
|
|
5877
5858
|
int64_t offset=0;
|
|
5878
5859
|
offset+=48;
|
|
5879
5860
|
*( double*)(( char*) obj+offset)=value;
|
|
5880
5861
|
}
|
|
5881
|
-
static inline double*
|
|
5862
|
+
static inline double* RandomRutherfordData_getp__cos_rot_s(RandomRutherfordData restrict obj){
|
|
5882
5863
|
int64_t offset=0;
|
|
5883
5864
|
offset+=48;
|
|
5884
5865
|
return ( double*)(( char*) obj+offset);
|
|
5885
5866
|
}
|
|
5886
|
-
static inline double
|
|
5867
|
+
static inline double RandomRutherfordData_get__shift_x(const RandomRutherfordData restrict obj){
|
|
5887
5868
|
int64_t offset=0;
|
|
5888
5869
|
offset+=56;
|
|
5889
5870
|
return *( double*)(( char*) obj+offset);
|
|
5890
5871
|
}
|
|
5891
|
-
static inline void
|
|
5872
|
+
static inline void RandomRutherfordData_set__shift_x(RandomRutherfordData restrict obj, double value){
|
|
5892
5873
|
int64_t offset=0;
|
|
5893
5874
|
offset+=56;
|
|
5894
5875
|
*( double*)(( char*) obj+offset)=value;
|
|
5895
5876
|
}
|
|
5896
|
-
static inline double*
|
|
5877
|
+
static inline double* RandomRutherfordData_getp__shift_x(RandomRutherfordData restrict obj){
|
|
5897
5878
|
int64_t offset=0;
|
|
5898
5879
|
offset+=56;
|
|
5899
5880
|
return ( double*)(( char*) obj+offset);
|
|
5900
5881
|
}
|
|
5901
|
-
static inline double
|
|
5882
|
+
static inline double RandomRutherfordData_get__shift_y(const RandomRutherfordData restrict obj){
|
|
5902
5883
|
int64_t offset=0;
|
|
5903
5884
|
offset+=64;
|
|
5904
5885
|
return *( double*)(( char*) obj+offset);
|
|
5905
5886
|
}
|
|
5906
|
-
static inline void
|
|
5887
|
+
static inline void RandomRutherfordData_set__shift_y(RandomRutherfordData restrict obj, double value){
|
|
5907
5888
|
int64_t offset=0;
|
|
5908
5889
|
offset+=64;
|
|
5909
5890
|
*( double*)(( char*) obj+offset)=value;
|
|
5910
5891
|
}
|
|
5911
|
-
static inline double*
|
|
5892
|
+
static inline double* RandomRutherfordData_getp__shift_y(RandomRutherfordData restrict obj){
|
|
5912
5893
|
int64_t offset=0;
|
|
5913
5894
|
offset+=64;
|
|
5914
5895
|
return ( double*)(( char*) obj+offset);
|
|
5915
5896
|
}
|
|
5916
|
-
static inline double
|
|
5897
|
+
static inline double RandomRutherfordData_get__shift_s(const RandomRutherfordData restrict obj){
|
|
5917
5898
|
int64_t offset=0;
|
|
5918
5899
|
offset+=72;
|
|
5919
5900
|
return *( double*)(( char*) obj+offset);
|
|
5920
5901
|
}
|
|
5921
|
-
static inline void
|
|
5902
|
+
static inline void RandomRutherfordData_set__shift_s(RandomRutherfordData restrict obj, double value){
|
|
5922
5903
|
int64_t offset=0;
|
|
5923
5904
|
offset+=72;
|
|
5924
5905
|
*( double*)(( char*) obj+offset)=value;
|
|
5925
5906
|
}
|
|
5926
|
-
static inline double*
|
|
5907
|
+
static inline double* RandomRutherfordData_getp__shift_s(RandomRutherfordData restrict obj){
|
|
5927
5908
|
int64_t offset=0;
|
|
5928
5909
|
offset+=72;
|
|
5929
5910
|
return ( double*)(( char*) obj+offset);
|
|
5911
|
+
}
|
|
5912
|
+
static inline double RandomRutherfordData_get__rot_x_rad(const RandomRutherfordData restrict obj){
|
|
5913
|
+
int64_t offset=0;
|
|
5914
|
+
offset+=80;
|
|
5915
|
+
return *( double*)(( char*) obj+offset);
|
|
5916
|
+
}
|
|
5917
|
+
static inline void RandomRutherfordData_set__rot_x_rad(RandomRutherfordData restrict obj, double value){
|
|
5918
|
+
int64_t offset=0;
|
|
5919
|
+
offset+=80;
|
|
5920
|
+
*( double*)(( char*) obj+offset)=value;
|
|
5921
|
+
}
|
|
5922
|
+
static inline double* RandomRutherfordData_getp__rot_x_rad(RandomRutherfordData restrict obj){
|
|
5923
|
+
int64_t offset=0;
|
|
5924
|
+
offset+=80;
|
|
5925
|
+
return ( double*)(( char*) obj+offset);
|
|
5926
|
+
}
|
|
5927
|
+
static inline double RandomRutherfordData_get__rot_y_rad(const RandomRutherfordData restrict obj){
|
|
5928
|
+
int64_t offset=0;
|
|
5929
|
+
offset+=88;
|
|
5930
|
+
return *( double*)(( char*) obj+offset);
|
|
5931
|
+
}
|
|
5932
|
+
static inline void RandomRutherfordData_set__rot_y_rad(RandomRutherfordData restrict obj, double value){
|
|
5933
|
+
int64_t offset=0;
|
|
5934
|
+
offset+=88;
|
|
5935
|
+
*( double*)(( char*) obj+offset)=value;
|
|
5936
|
+
}
|
|
5937
|
+
static inline double* RandomRutherfordData_getp__rot_y_rad(RandomRutherfordData restrict obj){
|
|
5938
|
+
int64_t offset=0;
|
|
5939
|
+
offset+=88;
|
|
5940
|
+
return ( double*)(( char*) obj+offset);
|
|
5941
|
+
}
|
|
5942
|
+
static inline double RandomRutherfordData_get__rot_s_rad_no_frame(const RandomRutherfordData restrict obj){
|
|
5943
|
+
int64_t offset=0;
|
|
5944
|
+
offset+=96;
|
|
5945
|
+
return *( double*)(( char*) obj+offset);
|
|
5946
|
+
}
|
|
5947
|
+
static inline void RandomRutherfordData_set__rot_s_rad_no_frame(RandomRutherfordData restrict obj, double value){
|
|
5948
|
+
int64_t offset=0;
|
|
5949
|
+
offset+=96;
|
|
5950
|
+
*( double*)(( char*) obj+offset)=value;
|
|
5951
|
+
}
|
|
5952
|
+
static inline double* RandomRutherfordData_getp__rot_s_rad_no_frame(RandomRutherfordData restrict obj){
|
|
5953
|
+
int64_t offset=0;
|
|
5954
|
+
offset+=96;
|
|
5955
|
+
return ( double*)(( char*) obj+offset);
|
|
5956
|
+
}
|
|
5957
|
+
static inline double RandomRutherfordData_get_rot_shift_anchor(const RandomRutherfordData restrict obj){
|
|
5958
|
+
int64_t offset=0;
|
|
5959
|
+
offset+=104;
|
|
5960
|
+
return *( double*)(( char*) obj+offset);
|
|
5961
|
+
}
|
|
5962
|
+
static inline void RandomRutherfordData_set_rot_shift_anchor(RandomRutherfordData restrict obj, double value){
|
|
5963
|
+
int64_t offset=0;
|
|
5964
|
+
offset+=104;
|
|
5965
|
+
*( double*)(( char*) obj+offset)=value;
|
|
5966
|
+
}
|
|
5967
|
+
static inline double* RandomRutherfordData_getp_rot_shift_anchor(RandomRutherfordData restrict obj){
|
|
5968
|
+
int64_t offset=0;
|
|
5969
|
+
offset+=104;
|
|
5970
|
+
return ( double*)(( char*) obj+offset);
|
|
5930
5971
|
}
|
|
5931
5972
|
#endif
|
|
5932
5973
|
// copyright ############################### //
|
|
@@ -6138,11 +6179,11 @@ void Drift_single_particle(LocalParticle* part, double length){
|
|
|
6138
6179
|
|
|
6139
6180
|
#endif // XSTUITE_TRACK_FLAGS_H
|
|
6140
6181
|
|
|
6141
|
-
#include <random/random_src/
|
|
6182
|
+
#include <random/random_src/rutherford.h>
|
|
6142
6183
|
|
|
6143
6184
|
|
|
6144
|
-
void
|
|
6145
|
-
|
|
6185
|
+
void sample_ruth(
|
|
6186
|
+
RandomRutherfordData el,
|
|
6146
6187
|
|
|
6147
6188
|
ParticlesData particles,
|
|
6148
6189
|
double* samples, int64_t n_samples_per_seed,
|
|
@@ -6190,7 +6231,7 @@ void Drift_single_particle(LocalParticle* part, double length){
|
|
|
6190
6231
|
if (part_id<part_capacity){
|
|
6191
6232
|
Particles_to_LocalParticle(particles, &lpart, part_id, end_id);
|
|
6192
6233
|
if (check_is_active(&lpart)>0){
|
|
6193
|
-
|
|
6234
|
+
RandomRutherford_sample(el, &lpart, samples, n_samples_per_seed);
|
|
6194
6235
|
|
|
6195
6236
|
}
|
|
6196
6237
|
if (check_is_active(&lpart)>0 && flag_increment_at_element){
|
|
@@ -6209,219 +6250,159 @@ void Drift_single_particle(LocalParticle* part, double length){
|
|
|
6209
6250
|
// #endif //only_for_context cpu_openmp
|
|
6210
6251
|
}
|
|
6211
6252
|
|
|
6212
|
-
#ifndef
|
|
6213
|
-
#define
|
|
6214
|
-
typedef struct
|
|
6215
|
-
static inline
|
|
6253
|
+
#ifndef XOBJ_TYPEDEF_RandomNormalData
|
|
6254
|
+
#define XOBJ_TYPEDEF_RandomNormalData
|
|
6255
|
+
typedef struct RandomNormalData_s * RandomNormalData;
|
|
6256
|
+
static inline RandomNormalData RandomNormalData_getp(RandomNormalData restrict obj){
|
|
6216
6257
|
int64_t offset=0;
|
|
6217
|
-
return (
|
|
6258
|
+
return (RandomNormalData)(( char*) obj+offset);
|
|
6218
6259
|
}
|
|
6219
|
-
static inline
|
|
6260
|
+
static inline uint8_t RandomNormalData_get__dummy(const RandomNormalData restrict obj){
|
|
6220
6261
|
int64_t offset=0;
|
|
6221
|
-
return *(
|
|
6262
|
+
return *(( uint8_t*) obj+offset);
|
|
6222
6263
|
}
|
|
6223
|
-
static inline void
|
|
6264
|
+
static inline void RandomNormalData_set__dummy(RandomNormalData restrict obj, uint8_t value){
|
|
6224
6265
|
int64_t offset=0;
|
|
6225
|
-
*(
|
|
6266
|
+
*(( uint8_t*) obj+offset)=value;
|
|
6226
6267
|
}
|
|
6227
|
-
static inline
|
|
6268
|
+
static inline uint8_t* RandomNormalData_getp__dummy(RandomNormalData restrict obj){
|
|
6228
6269
|
int64_t offset=0;
|
|
6229
|
-
return (
|
|
6270
|
+
return ( uint8_t*)(( char*) obj+offset);
|
|
6230
6271
|
}
|
|
6231
|
-
static inline double
|
|
6272
|
+
static inline double RandomNormalData_get__sin_rot_s(const RandomNormalData restrict obj){
|
|
6232
6273
|
int64_t offset=0;
|
|
6233
6274
|
offset+=8;
|
|
6234
6275
|
return *( double*)(( char*) obj+offset);
|
|
6235
6276
|
}
|
|
6236
|
-
static inline void
|
|
6277
|
+
static inline void RandomNormalData_set__sin_rot_s(RandomNormalData restrict obj, double value){
|
|
6237
6278
|
int64_t offset=0;
|
|
6238
6279
|
offset+=8;
|
|
6239
6280
|
*( double*)(( char*) obj+offset)=value;
|
|
6240
6281
|
}
|
|
6241
|
-
static inline double*
|
|
6282
|
+
static inline double* RandomNormalData_getp__sin_rot_s(RandomNormalData restrict obj){
|
|
6242
6283
|
int64_t offset=0;
|
|
6243
6284
|
offset+=8;
|
|
6244
6285
|
return ( double*)(( char*) obj+offset);
|
|
6245
6286
|
}
|
|
6246
|
-
static inline double
|
|
6287
|
+
static inline double RandomNormalData_get__cos_rot_s(const RandomNormalData restrict obj){
|
|
6247
6288
|
int64_t offset=0;
|
|
6248
6289
|
offset+=16;
|
|
6249
6290
|
return *( double*)(( char*) obj+offset);
|
|
6250
6291
|
}
|
|
6251
|
-
static inline void
|
|
6292
|
+
static inline void RandomNormalData_set__cos_rot_s(RandomNormalData restrict obj, double value){
|
|
6252
6293
|
int64_t offset=0;
|
|
6253
6294
|
offset+=16;
|
|
6254
6295
|
*( double*)(( char*) obj+offset)=value;
|
|
6255
6296
|
}
|
|
6256
|
-
static inline double*
|
|
6297
|
+
static inline double* RandomNormalData_getp__cos_rot_s(RandomNormalData restrict obj){
|
|
6257
6298
|
int64_t offset=0;
|
|
6258
6299
|
offset+=16;
|
|
6259
6300
|
return ( double*)(( char*) obj+offset);
|
|
6260
6301
|
}
|
|
6261
|
-
static inline double
|
|
6302
|
+
static inline double RandomNormalData_get__shift_x(const RandomNormalData restrict obj){
|
|
6262
6303
|
int64_t offset=0;
|
|
6263
6304
|
offset+=24;
|
|
6264
6305
|
return *( double*)(( char*) obj+offset);
|
|
6265
6306
|
}
|
|
6266
|
-
static inline void
|
|
6307
|
+
static inline void RandomNormalData_set__shift_x(RandomNormalData restrict obj, double value){
|
|
6267
6308
|
int64_t offset=0;
|
|
6268
6309
|
offset+=24;
|
|
6269
6310
|
*( double*)(( char*) obj+offset)=value;
|
|
6270
6311
|
}
|
|
6271
|
-
static inline double*
|
|
6312
|
+
static inline double* RandomNormalData_getp__shift_x(RandomNormalData restrict obj){
|
|
6272
6313
|
int64_t offset=0;
|
|
6273
6314
|
offset+=24;
|
|
6274
6315
|
return ( double*)(( char*) obj+offset);
|
|
6275
6316
|
}
|
|
6276
|
-
static inline
|
|
6317
|
+
static inline double RandomNormalData_get__shift_y(const RandomNormalData restrict obj){
|
|
6277
6318
|
int64_t offset=0;
|
|
6278
6319
|
offset+=32;
|
|
6279
|
-
return *((
|
|
6320
|
+
return *( double*)(( char*) obj+offset);
|
|
6280
6321
|
}
|
|
6281
|
-
static inline void
|
|
6322
|
+
static inline void RandomNormalData_set__shift_y(RandomNormalData restrict obj, double value){
|
|
6282
6323
|
int64_t offset=0;
|
|
6283
6324
|
offset+=32;
|
|
6284
|
-
*((
|
|
6325
|
+
*( double*)(( char*) obj+offset)=value;
|
|
6285
6326
|
}
|
|
6286
|
-
static inline
|
|
6327
|
+
static inline double* RandomNormalData_getp__shift_y(RandomNormalData restrict obj){
|
|
6287
6328
|
int64_t offset=0;
|
|
6288
6329
|
offset+=32;
|
|
6289
|
-
return (
|
|
6330
|
+
return ( double*)(( char*) obj+offset);
|
|
6290
6331
|
}
|
|
6291
|
-
static inline double
|
|
6332
|
+
static inline double RandomNormalData_get__shift_s(const RandomNormalData restrict obj){
|
|
6292
6333
|
int64_t offset=0;
|
|
6293
6334
|
offset+=40;
|
|
6294
6335
|
return *( double*)(( char*) obj+offset);
|
|
6295
6336
|
}
|
|
6296
|
-
static inline void
|
|
6337
|
+
static inline void RandomNormalData_set__shift_s(RandomNormalData restrict obj, double value){
|
|
6297
6338
|
int64_t offset=0;
|
|
6298
6339
|
offset+=40;
|
|
6299
6340
|
*( double*)(( char*) obj+offset)=value;
|
|
6300
6341
|
}
|
|
6301
|
-
static inline double*
|
|
6342
|
+
static inline double* RandomNormalData_getp__shift_s(RandomNormalData restrict obj){
|
|
6302
6343
|
int64_t offset=0;
|
|
6303
6344
|
offset+=40;
|
|
6304
6345
|
return ( double*)(( char*) obj+offset);
|
|
6305
6346
|
}
|
|
6306
|
-
static inline double
|
|
6347
|
+
static inline double RandomNormalData_get__rot_x_rad(const RandomNormalData restrict obj){
|
|
6307
6348
|
int64_t offset=0;
|
|
6308
6349
|
offset+=48;
|
|
6309
6350
|
return *( double*)(( char*) obj+offset);
|
|
6310
6351
|
}
|
|
6311
|
-
static inline void
|
|
6352
|
+
static inline void RandomNormalData_set__rot_x_rad(RandomNormalData restrict obj, double value){
|
|
6312
6353
|
int64_t offset=0;
|
|
6313
6354
|
offset+=48;
|
|
6314
6355
|
*( double*)(( char*) obj+offset)=value;
|
|
6315
6356
|
}
|
|
6316
|
-
static inline double*
|
|
6357
|
+
static inline double* RandomNormalData_getp__rot_x_rad(RandomNormalData restrict obj){
|
|
6317
6358
|
int64_t offset=0;
|
|
6318
6359
|
offset+=48;
|
|
6319
6360
|
return ( double*)(( char*) obj+offset);
|
|
6320
6361
|
}
|
|
6321
|
-
static inline double
|
|
6362
|
+
static inline double RandomNormalData_get__rot_y_rad(const RandomNormalData restrict obj){
|
|
6322
6363
|
int64_t offset=0;
|
|
6323
6364
|
offset+=56;
|
|
6324
6365
|
return *( double*)(( char*) obj+offset);
|
|
6325
6366
|
}
|
|
6326
|
-
static inline void
|
|
6367
|
+
static inline void RandomNormalData_set__rot_y_rad(RandomNormalData restrict obj, double value){
|
|
6327
6368
|
int64_t offset=0;
|
|
6328
6369
|
offset+=56;
|
|
6329
6370
|
*( double*)(( char*) obj+offset)=value;
|
|
6330
6371
|
}
|
|
6331
|
-
static inline double*
|
|
6372
|
+
static inline double* RandomNormalData_getp__rot_y_rad(RandomNormalData restrict obj){
|
|
6332
6373
|
int64_t offset=0;
|
|
6333
6374
|
offset+=56;
|
|
6334
6375
|
return ( double*)(( char*) obj+offset);
|
|
6335
6376
|
}
|
|
6336
|
-
static inline double
|
|
6377
|
+
static inline double RandomNormalData_get__rot_s_rad_no_frame(const RandomNormalData restrict obj){
|
|
6337
6378
|
int64_t offset=0;
|
|
6338
6379
|
offset+=64;
|
|
6339
6380
|
return *( double*)(( char*) obj+offset);
|
|
6340
6381
|
}
|
|
6341
|
-
static inline void
|
|
6382
|
+
static inline void RandomNormalData_set__rot_s_rad_no_frame(RandomNormalData restrict obj, double value){
|
|
6342
6383
|
int64_t offset=0;
|
|
6343
6384
|
offset+=64;
|
|
6344
6385
|
*( double*)(( char*) obj+offset)=value;
|
|
6345
6386
|
}
|
|
6346
|
-
static inline double*
|
|
6387
|
+
static inline double* RandomNormalData_getp__rot_s_rad_no_frame(RandomNormalData restrict obj){
|
|
6347
6388
|
int64_t offset=0;
|
|
6348
6389
|
offset+=64;
|
|
6349
6390
|
return ( double*)(( char*) obj+offset);
|
|
6350
6391
|
}
|
|
6351
|
-
static inline double
|
|
6392
|
+
static inline double RandomNormalData_get_rot_shift_anchor(const RandomNormalData restrict obj){
|
|
6352
6393
|
int64_t offset=0;
|
|
6353
6394
|
offset+=72;
|
|
6354
6395
|
return *( double*)(( char*) obj+offset);
|
|
6355
6396
|
}
|
|
6356
|
-
static inline void
|
|
6397
|
+
static inline void RandomNormalData_set_rot_shift_anchor(RandomNormalData restrict obj, double value){
|
|
6357
6398
|
int64_t offset=0;
|
|
6358
6399
|
offset+=72;
|
|
6359
6400
|
*( double*)(( char*) obj+offset)=value;
|
|
6360
6401
|
}
|
|
6361
|
-
static inline double*
|
|
6402
|
+
static inline double* RandomNormalData_getp_rot_shift_anchor(RandomNormalData restrict obj){
|
|
6362
6403
|
int64_t offset=0;
|
|
6363
6404
|
offset+=72;
|
|
6364
6405
|
return ( double*)(( char*) obj+offset);
|
|
6365
|
-
}
|
|
6366
|
-
static inline double RandomRutherfordData_get__rot_x_rad(const RandomRutherfordData restrict obj){
|
|
6367
|
-
int64_t offset=0;
|
|
6368
|
-
offset+=80;
|
|
6369
|
-
return *( double*)(( char*) obj+offset);
|
|
6370
|
-
}
|
|
6371
|
-
static inline void RandomRutherfordData_set__rot_x_rad(RandomRutherfordData restrict obj, double value){
|
|
6372
|
-
int64_t offset=0;
|
|
6373
|
-
offset+=80;
|
|
6374
|
-
*( double*)(( char*) obj+offset)=value;
|
|
6375
|
-
}
|
|
6376
|
-
static inline double* RandomRutherfordData_getp__rot_x_rad(RandomRutherfordData restrict obj){
|
|
6377
|
-
int64_t offset=0;
|
|
6378
|
-
offset+=80;
|
|
6379
|
-
return ( double*)(( char*) obj+offset);
|
|
6380
|
-
}
|
|
6381
|
-
static inline double RandomRutherfordData_get__rot_y_rad(const RandomRutherfordData restrict obj){
|
|
6382
|
-
int64_t offset=0;
|
|
6383
|
-
offset+=88;
|
|
6384
|
-
return *( double*)(( char*) obj+offset);
|
|
6385
|
-
}
|
|
6386
|
-
static inline void RandomRutherfordData_set__rot_y_rad(RandomRutherfordData restrict obj, double value){
|
|
6387
|
-
int64_t offset=0;
|
|
6388
|
-
offset+=88;
|
|
6389
|
-
*( double*)(( char*) obj+offset)=value;
|
|
6390
|
-
}
|
|
6391
|
-
static inline double* RandomRutherfordData_getp__rot_y_rad(RandomRutherfordData restrict obj){
|
|
6392
|
-
int64_t offset=0;
|
|
6393
|
-
offset+=88;
|
|
6394
|
-
return ( double*)(( char*) obj+offset);
|
|
6395
|
-
}
|
|
6396
|
-
static inline double RandomRutherfordData_get__rot_s_rad_no_frame(const RandomRutherfordData restrict obj){
|
|
6397
|
-
int64_t offset=0;
|
|
6398
|
-
offset+=96;
|
|
6399
|
-
return *( double*)(( char*) obj+offset);
|
|
6400
|
-
}
|
|
6401
|
-
static inline void RandomRutherfordData_set__rot_s_rad_no_frame(RandomRutherfordData restrict obj, double value){
|
|
6402
|
-
int64_t offset=0;
|
|
6403
|
-
offset+=96;
|
|
6404
|
-
*( double*)(( char*) obj+offset)=value;
|
|
6405
|
-
}
|
|
6406
|
-
static inline double* RandomRutherfordData_getp__rot_s_rad_no_frame(RandomRutherfordData restrict obj){
|
|
6407
|
-
int64_t offset=0;
|
|
6408
|
-
offset+=96;
|
|
6409
|
-
return ( double*)(( char*) obj+offset);
|
|
6410
|
-
}
|
|
6411
|
-
static inline double RandomRutherfordData_get_rot_shift_anchor(const RandomRutherfordData restrict obj){
|
|
6412
|
-
int64_t offset=0;
|
|
6413
|
-
offset+=104;
|
|
6414
|
-
return *( double*)(( char*) obj+offset);
|
|
6415
|
-
}
|
|
6416
|
-
static inline void RandomRutherfordData_set_rot_shift_anchor(RandomRutherfordData restrict obj, double value){
|
|
6417
|
-
int64_t offset=0;
|
|
6418
|
-
offset+=104;
|
|
6419
|
-
*( double*)(( char*) obj+offset)=value;
|
|
6420
|
-
}
|
|
6421
|
-
static inline double* RandomRutherfordData_getp_rot_shift_anchor(RandomRutherfordData restrict obj){
|
|
6422
|
-
int64_t offset=0;
|
|
6423
|
-
offset+=104;
|
|
6424
|
-
return ( double*)(( char*) obj+offset);
|
|
6425
6406
|
}
|
|
6426
6407
|
#endif
|
|
6427
6408
|
// copyright ############################### //
|
|
@@ -6633,11 +6614,11 @@ void Drift_single_particle(LocalParticle* part, double length){
|
|
|
6633
6614
|
|
|
6634
6615
|
#endif // XSTUITE_TRACK_FLAGS_H
|
|
6635
6616
|
|
|
6636
|
-
#include <random/random_src/
|
|
6617
|
+
#include <random/random_src/normal.h>
|
|
6637
6618
|
|
|
6638
6619
|
|
|
6639
|
-
void
|
|
6640
|
-
|
|
6620
|
+
void sample_gauss(
|
|
6621
|
+
RandomNormalData el,
|
|
6641
6622
|
|
|
6642
6623
|
ParticlesData particles,
|
|
6643
6624
|
double* samples, int64_t n_samples_per_seed,
|
|
@@ -6685,7 +6666,7 @@ void Drift_single_particle(LocalParticle* part, double length){
|
|
|
6685
6666
|
if (part_id<part_capacity){
|
|
6686
6667
|
Particles_to_LocalParticle(particles, &lpart, part_id, end_id);
|
|
6687
6668
|
if (check_is_active(&lpart)>0){
|
|
6688
|
-
|
|
6669
|
+
RandomNormal_sample(el, &lpart, samples, n_samples_per_seed);
|
|
6689
6670
|
|
|
6690
6671
|
}
|
|
6691
6672
|
if (check_is_active(&lpart)>0 && flag_increment_at_element){
|
|
@@ -6704,156 +6685,156 @@ void Drift_single_particle(LocalParticle* part, double length){
|
|
|
6704
6685
|
// #endif //only_for_context cpu_openmp
|
|
6705
6686
|
}
|
|
6706
6687
|
|
|
6707
|
-
#ifndef
|
|
6708
|
-
#define
|
|
6709
|
-
typedef struct
|
|
6710
|
-
static inline
|
|
6688
|
+
#ifndef XOBJ_TYPEDEF_RandomExponentialData
|
|
6689
|
+
#define XOBJ_TYPEDEF_RandomExponentialData
|
|
6690
|
+
typedef struct RandomExponentialData_s * RandomExponentialData;
|
|
6691
|
+
static inline RandomExponentialData RandomExponentialData_getp(RandomExponentialData restrict obj){
|
|
6711
6692
|
int64_t offset=0;
|
|
6712
|
-
return (
|
|
6693
|
+
return (RandomExponentialData)(( char*) obj+offset);
|
|
6713
6694
|
}
|
|
6714
|
-
static inline uint8_t
|
|
6695
|
+
static inline uint8_t RandomExponentialData_get__dummy(const RandomExponentialData restrict obj){
|
|
6715
6696
|
int64_t offset=0;
|
|
6716
6697
|
return *(( uint8_t*) obj+offset);
|
|
6717
6698
|
}
|
|
6718
|
-
static inline void
|
|
6699
|
+
static inline void RandomExponentialData_set__dummy(RandomExponentialData restrict obj, uint8_t value){
|
|
6719
6700
|
int64_t offset=0;
|
|
6720
6701
|
*(( uint8_t*) obj+offset)=value;
|
|
6721
6702
|
}
|
|
6722
|
-
static inline uint8_t*
|
|
6703
|
+
static inline uint8_t* RandomExponentialData_getp__dummy(RandomExponentialData restrict obj){
|
|
6723
6704
|
int64_t offset=0;
|
|
6724
6705
|
return ( uint8_t*)(( char*) obj+offset);
|
|
6725
6706
|
}
|
|
6726
|
-
static inline double
|
|
6707
|
+
static inline double RandomExponentialData_get__sin_rot_s(const RandomExponentialData restrict obj){
|
|
6727
6708
|
int64_t offset=0;
|
|
6728
6709
|
offset+=8;
|
|
6729
6710
|
return *( double*)(( char*) obj+offset);
|
|
6730
6711
|
}
|
|
6731
|
-
static inline void
|
|
6712
|
+
static inline void RandomExponentialData_set__sin_rot_s(RandomExponentialData restrict obj, double value){
|
|
6732
6713
|
int64_t offset=0;
|
|
6733
6714
|
offset+=8;
|
|
6734
6715
|
*( double*)(( char*) obj+offset)=value;
|
|
6735
6716
|
}
|
|
6736
|
-
static inline double*
|
|
6717
|
+
static inline double* RandomExponentialData_getp__sin_rot_s(RandomExponentialData restrict obj){
|
|
6737
6718
|
int64_t offset=0;
|
|
6738
6719
|
offset+=8;
|
|
6739
6720
|
return ( double*)(( char*) obj+offset);
|
|
6740
6721
|
}
|
|
6741
|
-
static inline double
|
|
6722
|
+
static inline double RandomExponentialData_get__cos_rot_s(const RandomExponentialData restrict obj){
|
|
6742
6723
|
int64_t offset=0;
|
|
6743
6724
|
offset+=16;
|
|
6744
6725
|
return *( double*)(( char*) obj+offset);
|
|
6745
6726
|
}
|
|
6746
|
-
static inline void
|
|
6727
|
+
static inline void RandomExponentialData_set__cos_rot_s(RandomExponentialData restrict obj, double value){
|
|
6747
6728
|
int64_t offset=0;
|
|
6748
6729
|
offset+=16;
|
|
6749
6730
|
*( double*)(( char*) obj+offset)=value;
|
|
6750
6731
|
}
|
|
6751
|
-
static inline double*
|
|
6732
|
+
static inline double* RandomExponentialData_getp__cos_rot_s(RandomExponentialData restrict obj){
|
|
6752
6733
|
int64_t offset=0;
|
|
6753
6734
|
offset+=16;
|
|
6754
6735
|
return ( double*)(( char*) obj+offset);
|
|
6755
6736
|
}
|
|
6756
|
-
static inline double
|
|
6737
|
+
static inline double RandomExponentialData_get__shift_x(const RandomExponentialData restrict obj){
|
|
6757
6738
|
int64_t offset=0;
|
|
6758
6739
|
offset+=24;
|
|
6759
6740
|
return *( double*)(( char*) obj+offset);
|
|
6760
6741
|
}
|
|
6761
|
-
static inline void
|
|
6742
|
+
static inline void RandomExponentialData_set__shift_x(RandomExponentialData restrict obj, double value){
|
|
6762
6743
|
int64_t offset=0;
|
|
6763
6744
|
offset+=24;
|
|
6764
6745
|
*( double*)(( char*) obj+offset)=value;
|
|
6765
6746
|
}
|
|
6766
|
-
static inline double*
|
|
6747
|
+
static inline double* RandomExponentialData_getp__shift_x(RandomExponentialData restrict obj){
|
|
6767
6748
|
int64_t offset=0;
|
|
6768
6749
|
offset+=24;
|
|
6769
6750
|
return ( double*)(( char*) obj+offset);
|
|
6770
6751
|
}
|
|
6771
|
-
static inline double
|
|
6752
|
+
static inline double RandomExponentialData_get__shift_y(const RandomExponentialData restrict obj){
|
|
6772
6753
|
int64_t offset=0;
|
|
6773
6754
|
offset+=32;
|
|
6774
6755
|
return *( double*)(( char*) obj+offset);
|
|
6775
6756
|
}
|
|
6776
|
-
static inline void
|
|
6757
|
+
static inline void RandomExponentialData_set__shift_y(RandomExponentialData restrict obj, double value){
|
|
6777
6758
|
int64_t offset=0;
|
|
6778
6759
|
offset+=32;
|
|
6779
6760
|
*( double*)(( char*) obj+offset)=value;
|
|
6780
6761
|
}
|
|
6781
|
-
static inline double*
|
|
6762
|
+
static inline double* RandomExponentialData_getp__shift_y(RandomExponentialData restrict obj){
|
|
6782
6763
|
int64_t offset=0;
|
|
6783
6764
|
offset+=32;
|
|
6784
6765
|
return ( double*)(( char*) obj+offset);
|
|
6785
6766
|
}
|
|
6786
|
-
static inline double
|
|
6767
|
+
static inline double RandomExponentialData_get__shift_s(const RandomExponentialData restrict obj){
|
|
6787
6768
|
int64_t offset=0;
|
|
6788
6769
|
offset+=40;
|
|
6789
6770
|
return *( double*)(( char*) obj+offset);
|
|
6790
6771
|
}
|
|
6791
|
-
static inline void
|
|
6772
|
+
static inline void RandomExponentialData_set__shift_s(RandomExponentialData restrict obj, double value){
|
|
6792
6773
|
int64_t offset=0;
|
|
6793
6774
|
offset+=40;
|
|
6794
6775
|
*( double*)(( char*) obj+offset)=value;
|
|
6795
6776
|
}
|
|
6796
|
-
static inline double*
|
|
6777
|
+
static inline double* RandomExponentialData_getp__shift_s(RandomExponentialData restrict obj){
|
|
6797
6778
|
int64_t offset=0;
|
|
6798
6779
|
offset+=40;
|
|
6799
6780
|
return ( double*)(( char*) obj+offset);
|
|
6800
6781
|
}
|
|
6801
|
-
static inline double
|
|
6782
|
+
static inline double RandomExponentialData_get__rot_x_rad(const RandomExponentialData restrict obj){
|
|
6802
6783
|
int64_t offset=0;
|
|
6803
6784
|
offset+=48;
|
|
6804
6785
|
return *( double*)(( char*) obj+offset);
|
|
6805
6786
|
}
|
|
6806
|
-
static inline void
|
|
6787
|
+
static inline void RandomExponentialData_set__rot_x_rad(RandomExponentialData restrict obj, double value){
|
|
6807
6788
|
int64_t offset=0;
|
|
6808
6789
|
offset+=48;
|
|
6809
6790
|
*( double*)(( char*) obj+offset)=value;
|
|
6810
6791
|
}
|
|
6811
|
-
static inline double*
|
|
6792
|
+
static inline double* RandomExponentialData_getp__rot_x_rad(RandomExponentialData restrict obj){
|
|
6812
6793
|
int64_t offset=0;
|
|
6813
6794
|
offset+=48;
|
|
6814
6795
|
return ( double*)(( char*) obj+offset);
|
|
6815
6796
|
}
|
|
6816
|
-
static inline double
|
|
6797
|
+
static inline double RandomExponentialData_get__rot_y_rad(const RandomExponentialData restrict obj){
|
|
6817
6798
|
int64_t offset=0;
|
|
6818
6799
|
offset+=56;
|
|
6819
6800
|
return *( double*)(( char*) obj+offset);
|
|
6820
6801
|
}
|
|
6821
|
-
static inline void
|
|
6802
|
+
static inline void RandomExponentialData_set__rot_y_rad(RandomExponentialData restrict obj, double value){
|
|
6822
6803
|
int64_t offset=0;
|
|
6823
6804
|
offset+=56;
|
|
6824
6805
|
*( double*)(( char*) obj+offset)=value;
|
|
6825
6806
|
}
|
|
6826
|
-
static inline double*
|
|
6807
|
+
static inline double* RandomExponentialData_getp__rot_y_rad(RandomExponentialData restrict obj){
|
|
6827
6808
|
int64_t offset=0;
|
|
6828
6809
|
offset+=56;
|
|
6829
6810
|
return ( double*)(( char*) obj+offset);
|
|
6830
6811
|
}
|
|
6831
|
-
static inline double
|
|
6812
|
+
static inline double RandomExponentialData_get__rot_s_rad_no_frame(const RandomExponentialData restrict obj){
|
|
6832
6813
|
int64_t offset=0;
|
|
6833
6814
|
offset+=64;
|
|
6834
6815
|
return *( double*)(( char*) obj+offset);
|
|
6835
6816
|
}
|
|
6836
|
-
static inline void
|
|
6817
|
+
static inline void RandomExponentialData_set__rot_s_rad_no_frame(RandomExponentialData restrict obj, double value){
|
|
6837
6818
|
int64_t offset=0;
|
|
6838
6819
|
offset+=64;
|
|
6839
6820
|
*( double*)(( char*) obj+offset)=value;
|
|
6840
6821
|
}
|
|
6841
|
-
static inline double*
|
|
6822
|
+
static inline double* RandomExponentialData_getp__rot_s_rad_no_frame(RandomExponentialData restrict obj){
|
|
6842
6823
|
int64_t offset=0;
|
|
6843
6824
|
offset+=64;
|
|
6844
6825
|
return ( double*)(( char*) obj+offset);
|
|
6845
6826
|
}
|
|
6846
|
-
static inline double
|
|
6827
|
+
static inline double RandomExponentialData_get_rot_shift_anchor(const RandomExponentialData restrict obj){
|
|
6847
6828
|
int64_t offset=0;
|
|
6848
6829
|
offset+=72;
|
|
6849
6830
|
return *( double*)(( char*) obj+offset);
|
|
6850
6831
|
}
|
|
6851
|
-
static inline void
|
|
6832
|
+
static inline void RandomExponentialData_set_rot_shift_anchor(RandomExponentialData restrict obj, double value){
|
|
6852
6833
|
int64_t offset=0;
|
|
6853
6834
|
offset+=72;
|
|
6854
6835
|
*( double*)(( char*) obj+offset)=value;
|
|
6855
6836
|
}
|
|
6856
|
-
static inline double*
|
|
6837
|
+
static inline double* RandomExponentialData_getp_rot_shift_anchor(RandomExponentialData restrict obj){
|
|
6857
6838
|
int64_t offset=0;
|
|
6858
6839
|
offset+=72;
|
|
6859
6840
|
return ( double*)(( char*) obj+offset);
|
|
@@ -7068,11 +7049,11 @@ void Drift_single_particle(LocalParticle* part, double length){
|
|
|
7068
7049
|
|
|
7069
7050
|
#endif // XSTUITE_TRACK_FLAGS_H
|
|
7070
7051
|
|
|
7071
|
-
#include <random/random_src/
|
|
7052
|
+
#include <random/random_src/exponential.h>
|
|
7072
7053
|
|
|
7073
7054
|
|
|
7074
|
-
void
|
|
7075
|
-
|
|
7055
|
+
void sample_exp(
|
|
7056
|
+
RandomExponentialData el,
|
|
7076
7057
|
|
|
7077
7058
|
ParticlesData particles,
|
|
7078
7059
|
double* samples, int64_t n_samples_per_seed,
|
|
@@ -7120,7 +7101,7 @@ void Drift_single_particle(LocalParticle* part, double length){
|
|
|
7120
7101
|
if (part_id<part_capacity){
|
|
7121
7102
|
Particles_to_LocalParticle(particles, &lpart, part_id, end_id);
|
|
7122
7103
|
if (check_is_active(&lpart)>0){
|
|
7123
|
-
|
|
7104
|
+
RandomExponential_sample(el, &lpart, samples, n_samples_per_seed);
|
|
7124
7105
|
|
|
7125
7106
|
}
|
|
7126
7107
|
if (check_is_active(&lpart)>0 && flag_increment_at_element){
|
|
@@ -7139,6 +7120,25 @@ void Drift_single_particle(LocalParticle* part, double length){
|
|
|
7139
7120
|
// #endif //only_for_context cpu_openmp
|
|
7140
7121
|
}
|
|
7141
7122
|
|
|
7123
|
+
#ifndef XOBJ_TYPEDEF_ElementRefClass
|
|
7124
|
+
#define XOBJ_TYPEDEF_ElementRefClass
|
|
7125
|
+
typedef struct ElementRefClass_s * ElementRefClass;
|
|
7126
|
+
enum ElementRefClass_e{ElementRefClass_ParticlesMonitorData_t};
|
|
7127
|
+
static inline ElementRefClass ElementRefClass_getp(ElementRefClass restrict obj){
|
|
7128
|
+
int64_t offset=0;
|
|
7129
|
+
return (ElementRefClass)(( char*) obj+offset);
|
|
7130
|
+
}
|
|
7131
|
+
static inline int64_t ElementRefClass_typeid(const ElementRefClass restrict obj){
|
|
7132
|
+
int64_t offset=0;
|
|
7133
|
+
offset+=8;
|
|
7134
|
+
return *( int64_t*)(( char*) obj+offset);
|
|
7135
|
+
}
|
|
7136
|
+
static inline void* ElementRefClass_member(const ElementRefClass restrict obj){
|
|
7137
|
+
int64_t offset=0;
|
|
7138
|
+
offset+=*( int64_t*)(( char*) obj+offset);
|
|
7139
|
+
return ( void*)(( char*) obj+offset);
|
|
7140
|
+
}
|
|
7141
|
+
#endif
|
|
7142
7142
|
#ifndef XOBJ_TYPEDEF_ArrNElementRefClass
|
|
7143
7143
|
#define XOBJ_TYPEDEF_ArrNElementRefClass
|
|
7144
7144
|
typedef struct ArrNElementRefClass_s * ArrNElementRefClass;
|