xsuite 0.40.0__cp313-cp313-macosx_11_0_arm64.whl → 0.40.1__cp313-cp313-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 +24857 -24857
- xsuite/lib/default_base_config.cpython-313-darwin.so +0 -0
- xsuite/lib/default_base_config.json +2 -2
- xsuite/lib/default_no_config.c +19616 -19616
- xsuite/lib/default_no_config.cpython-313-darwin.so +0 -0
- xsuite/lib/default_no_config.json +2 -2
- xsuite/lib/non_tracking_kernels.c +847 -847
- xsuite/lib/non_tracking_kernels.cpython-313-darwin.so +0 -0
- xsuite/lib/non_tracking_kernels.json +2 -2
- xsuite/lib/only_xtrack_with_synrad.c +9640 -9640
- xsuite/lib/only_xtrack_with_synrad.cpython-313-darwin.so +0 -0
- xsuite/lib/only_xtrack_with_synrad.json +2 -2
- {xsuite-0.40.0.dist-info → xsuite-0.40.1.dist-info}/METADATA +4 -4
- xsuite-0.40.1.dist-info/RECORD +23 -0
- xsuite-0.40.0.dist-info/RECORD +0 -23
- {xsuite-0.40.0.dist-info → xsuite-0.40.1.dist-info}/WHEEL +0 -0
- {xsuite-0.40.0.dist-info → xsuite-0.40.1.dist-info}/entry_points.txt +0 -0
- {xsuite-0.40.0.dist-info → xsuite-0.40.1.dist-info}/licenses/LICENSE +0 -0
- {xsuite-0.40.0.dist-info → xsuite-0.40.1.dist-info}/top_level.txt +0 -0
|
@@ -3368,679 +3368,244 @@ 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
|
|
3375
|
-
int64_t offset=0;
|
|
3376
|
-
return (RandomUniformData)(( char*) obj+offset);
|
|
3377
|
-
}
|
|
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){
|
|
3371
|
+
#ifndef XOBJ_TYPEDEF_ParticlesMonitorData
|
|
3372
|
+
#define XOBJ_TYPEDEF_ParticlesMonitorData
|
|
3373
|
+
typedef struct ParticlesMonitorData_s * ParticlesMonitorData;
|
|
3374
|
+
static inline ParticlesMonitorData ParticlesMonitorData_getp(ParticlesMonitorData restrict obj){
|
|
3387
3375
|
int64_t offset=0;
|
|
3388
|
-
return (
|
|
3376
|
+
return (ParticlesMonitorData)(( char*) obj+offset);
|
|
3389
3377
|
}
|
|
3390
|
-
static inline
|
|
3378
|
+
static inline int64_t ParticlesMonitorData_get_start_at_turn(const ParticlesMonitorData restrict obj){
|
|
3391
3379
|
int64_t offset=0;
|
|
3392
3380
|
offset+=8;
|
|
3393
|
-
return *(
|
|
3381
|
+
return *( int64_t*)(( char*) obj+offset);
|
|
3394
3382
|
}
|
|
3395
|
-
static inline void
|
|
3383
|
+
static inline void ParticlesMonitorData_set_start_at_turn(ParticlesMonitorData restrict obj, int64_t value){
|
|
3396
3384
|
int64_t offset=0;
|
|
3397
3385
|
offset+=8;
|
|
3398
|
-
*(
|
|
3386
|
+
*( int64_t*)(( char*) obj+offset)=value;
|
|
3399
3387
|
}
|
|
3400
|
-
static inline
|
|
3388
|
+
static inline int64_t* ParticlesMonitorData_getp_start_at_turn(ParticlesMonitorData restrict obj){
|
|
3401
3389
|
int64_t offset=0;
|
|
3402
3390
|
offset+=8;
|
|
3403
|
-
return (
|
|
3391
|
+
return ( int64_t*)(( char*) obj+offset);
|
|
3404
3392
|
}
|
|
3405
|
-
static inline
|
|
3393
|
+
static inline int64_t ParticlesMonitorData_get_stop_at_turn(const ParticlesMonitorData restrict obj){
|
|
3406
3394
|
int64_t offset=0;
|
|
3407
3395
|
offset+=16;
|
|
3408
|
-
return *(
|
|
3396
|
+
return *( int64_t*)(( char*) obj+offset);
|
|
3409
3397
|
}
|
|
3410
|
-
static inline void
|
|
3398
|
+
static inline void ParticlesMonitorData_set_stop_at_turn(ParticlesMonitorData restrict obj, int64_t value){
|
|
3411
3399
|
int64_t offset=0;
|
|
3412
3400
|
offset+=16;
|
|
3413
|
-
*(
|
|
3401
|
+
*( int64_t*)(( char*) obj+offset)=value;
|
|
3414
3402
|
}
|
|
3415
|
-
static inline
|
|
3403
|
+
static inline int64_t* ParticlesMonitorData_getp_stop_at_turn(ParticlesMonitorData restrict obj){
|
|
3416
3404
|
int64_t offset=0;
|
|
3417
3405
|
offset+=16;
|
|
3418
|
-
return (
|
|
3406
|
+
return ( int64_t*)(( char*) obj+offset);
|
|
3419
3407
|
}
|
|
3420
|
-
static inline
|
|
3408
|
+
static inline int64_t ParticlesMonitorData_get_part_id_start(const ParticlesMonitorData restrict obj){
|
|
3421
3409
|
int64_t offset=0;
|
|
3422
3410
|
offset+=24;
|
|
3423
|
-
return *(
|
|
3411
|
+
return *( int64_t*)(( char*) obj+offset);
|
|
3424
3412
|
}
|
|
3425
|
-
static inline void
|
|
3413
|
+
static inline void ParticlesMonitorData_set_part_id_start(ParticlesMonitorData restrict obj, int64_t value){
|
|
3426
3414
|
int64_t offset=0;
|
|
3427
3415
|
offset+=24;
|
|
3428
|
-
*(
|
|
3416
|
+
*( int64_t*)(( char*) obj+offset)=value;
|
|
3429
3417
|
}
|
|
3430
|
-
static inline
|
|
3418
|
+
static inline int64_t* ParticlesMonitorData_getp_part_id_start(ParticlesMonitorData restrict obj){
|
|
3431
3419
|
int64_t offset=0;
|
|
3432
3420
|
offset+=24;
|
|
3433
|
-
return (
|
|
3421
|
+
return ( int64_t*)(( char*) obj+offset);
|
|
3434
3422
|
}
|
|
3435
|
-
static inline
|
|
3423
|
+
static inline int64_t ParticlesMonitorData_get_part_id_end(const ParticlesMonitorData restrict obj){
|
|
3436
3424
|
int64_t offset=0;
|
|
3437
3425
|
offset+=32;
|
|
3438
|
-
return *(
|
|
3426
|
+
return *( int64_t*)(( char*) obj+offset);
|
|
3439
3427
|
}
|
|
3440
|
-
static inline void
|
|
3428
|
+
static inline void ParticlesMonitorData_set_part_id_end(ParticlesMonitorData restrict obj, int64_t value){
|
|
3441
3429
|
int64_t offset=0;
|
|
3442
3430
|
offset+=32;
|
|
3443
|
-
*(
|
|
3431
|
+
*( int64_t*)(( char*) obj+offset)=value;
|
|
3444
3432
|
}
|
|
3445
|
-
static inline
|
|
3433
|
+
static inline int64_t* ParticlesMonitorData_getp_part_id_end(ParticlesMonitorData restrict obj){
|
|
3446
3434
|
int64_t offset=0;
|
|
3447
3435
|
offset+=32;
|
|
3448
|
-
return (
|
|
3436
|
+
return ( int64_t*)(( char*) obj+offset);
|
|
3449
3437
|
}
|
|
3450
|
-
static inline
|
|
3438
|
+
static inline int64_t ParticlesMonitorData_get_ebe_mode(const ParticlesMonitorData restrict obj){
|
|
3451
3439
|
int64_t offset=0;
|
|
3452
3440
|
offset+=40;
|
|
3453
|
-
return *(
|
|
3441
|
+
return *( int64_t*)(( char*) obj+offset);
|
|
3454
3442
|
}
|
|
3455
|
-
static inline void
|
|
3443
|
+
static inline void ParticlesMonitorData_set_ebe_mode(ParticlesMonitorData restrict obj, int64_t value){
|
|
3456
3444
|
int64_t offset=0;
|
|
3457
3445
|
offset+=40;
|
|
3458
|
-
*(
|
|
3446
|
+
*( int64_t*)(( char*) obj+offset)=value;
|
|
3459
3447
|
}
|
|
3460
|
-
static inline
|
|
3448
|
+
static inline int64_t* ParticlesMonitorData_getp_ebe_mode(ParticlesMonitorData restrict obj){
|
|
3461
3449
|
int64_t offset=0;
|
|
3462
3450
|
offset+=40;
|
|
3463
|
-
return (
|
|
3451
|
+
return ( int64_t*)(( char*) obj+offset);
|
|
3464
3452
|
}
|
|
3465
|
-
static inline
|
|
3453
|
+
static inline int64_t ParticlesMonitorData_get_n_records(const ParticlesMonitorData restrict obj){
|
|
3466
3454
|
int64_t offset=0;
|
|
3467
3455
|
offset+=48;
|
|
3468
|
-
return *(
|
|
3456
|
+
return *( int64_t*)(( char*) obj+offset);
|
|
3469
3457
|
}
|
|
3470
|
-
static inline void
|
|
3458
|
+
static inline void ParticlesMonitorData_set_n_records(ParticlesMonitorData restrict obj, int64_t value){
|
|
3471
3459
|
int64_t offset=0;
|
|
3472
3460
|
offset+=48;
|
|
3473
|
-
*(
|
|
3461
|
+
*( int64_t*)(( char*) obj+offset)=value;
|
|
3474
3462
|
}
|
|
3475
|
-
static inline
|
|
3463
|
+
static inline int64_t* ParticlesMonitorData_getp_n_records(ParticlesMonitorData restrict obj){
|
|
3476
3464
|
int64_t offset=0;
|
|
3477
3465
|
offset+=48;
|
|
3478
|
-
return (
|
|
3466
|
+
return ( int64_t*)(( char*) obj+offset);
|
|
3479
3467
|
}
|
|
3480
|
-
static inline
|
|
3468
|
+
static inline int64_t ParticlesMonitorData_get_n_repetitions(const ParticlesMonitorData restrict obj){
|
|
3481
3469
|
int64_t offset=0;
|
|
3482
3470
|
offset+=56;
|
|
3483
|
-
return *(
|
|
3471
|
+
return *( int64_t*)(( char*) obj+offset);
|
|
3484
3472
|
}
|
|
3485
|
-
static inline void
|
|
3473
|
+
static inline void ParticlesMonitorData_set_n_repetitions(ParticlesMonitorData restrict obj, int64_t value){
|
|
3486
3474
|
int64_t offset=0;
|
|
3487
3475
|
offset+=56;
|
|
3488
|
-
*(
|
|
3476
|
+
*( int64_t*)(( char*) obj+offset)=value;
|
|
3489
3477
|
}
|
|
3490
|
-
static inline
|
|
3478
|
+
static inline int64_t* ParticlesMonitorData_getp_n_repetitions(ParticlesMonitorData restrict obj){
|
|
3491
3479
|
int64_t offset=0;
|
|
3492
3480
|
offset+=56;
|
|
3493
|
-
return (
|
|
3481
|
+
return ( int64_t*)(( char*) obj+offset);
|
|
3494
3482
|
}
|
|
3495
|
-
static inline
|
|
3483
|
+
static inline int64_t ParticlesMonitorData_get_repetition_period(const ParticlesMonitorData restrict obj){
|
|
3496
3484
|
int64_t offset=0;
|
|
3497
3485
|
offset+=64;
|
|
3498
|
-
return *(
|
|
3486
|
+
return *( int64_t*)(( char*) obj+offset);
|
|
3499
3487
|
}
|
|
3500
|
-
static inline void
|
|
3488
|
+
static inline void ParticlesMonitorData_set_repetition_period(ParticlesMonitorData restrict obj, int64_t value){
|
|
3501
3489
|
int64_t offset=0;
|
|
3502
3490
|
offset+=64;
|
|
3503
|
-
*(
|
|
3491
|
+
*( int64_t*)(( char*) obj+offset)=value;
|
|
3504
3492
|
}
|
|
3505
|
-
static inline
|
|
3493
|
+
static inline int64_t* ParticlesMonitorData_getp_repetition_period(ParticlesMonitorData restrict obj){
|
|
3506
3494
|
int64_t offset=0;
|
|
3507
3495
|
offset+=64;
|
|
3508
|
-
return (
|
|
3496
|
+
return ( int64_t*)(( char*) obj+offset);
|
|
3509
3497
|
}
|
|
3510
|
-
static inline
|
|
3498
|
+
static inline int64_t ParticlesMonitorData_get_flag_auto_to_numpy(const ParticlesMonitorData restrict obj){
|
|
3511
3499
|
int64_t offset=0;
|
|
3512
3500
|
offset+=72;
|
|
3513
|
-
return *(
|
|
3501
|
+
return *( int64_t*)(( char*) obj+offset);
|
|
3514
3502
|
}
|
|
3515
|
-
static inline void
|
|
3503
|
+
static inline void ParticlesMonitorData_set_flag_auto_to_numpy(ParticlesMonitorData restrict obj, int64_t value){
|
|
3516
3504
|
int64_t offset=0;
|
|
3517
3505
|
offset+=72;
|
|
3518
|
-
*(
|
|
3506
|
+
*( int64_t*)(( char*) obj+offset)=value;
|
|
3519
3507
|
}
|
|
3520
|
-
static inline
|
|
3508
|
+
static inline int64_t* ParticlesMonitorData_getp_flag_auto_to_numpy(ParticlesMonitorData restrict obj){
|
|
3521
3509
|
int64_t offset=0;
|
|
3522
3510
|
offset+=72;
|
|
3523
|
-
return (
|
|
3511
|
+
return ( int64_t*)(( char*) obj+offset);
|
|
3524
3512
|
}
|
|
3525
|
-
|
|
3526
|
-
|
|
3527
|
-
|
|
3528
|
-
|
|
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;
|
|
3513
|
+
static inline ParticlesData ParticlesMonitorData_getp_data(ParticlesMonitorData restrict obj){
|
|
3514
|
+
int64_t offset=0;
|
|
3515
|
+
offset+=152;
|
|
3516
|
+
return (ParticlesData)(( char*) obj+offset);
|
|
3604
3517
|
}
|
|
3605
|
-
|
|
3606
|
-
|
|
3607
|
-
|
|
3608
|
-
|
|
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;
|
|
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);
|
|
3616
3522
|
}
|
|
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;
|
|
3816
|
-
return *( int64_t*)(( char*) obj+offset);
|
|
3817
|
-
}
|
|
3818
|
-
static inline void ParticlesMonitorData_set_start_at_turn(ParticlesMonitorData restrict obj, int64_t value){
|
|
3523
|
+
static inline void ParticlesMonitorData_set_data__capacity(ParticlesMonitorData restrict obj, int64_t value){
|
|
3819
3524
|
int64_t offset=0;
|
|
3820
|
-
offset+=
|
|
3525
|
+
offset+=160;
|
|
3821
3526
|
*( int64_t*)(( char*) obj+offset)=value;
|
|
3822
3527
|
}
|
|
3823
|
-
static inline int64_t*
|
|
3528
|
+
static inline int64_t* ParticlesMonitorData_getp_data__capacity(ParticlesMonitorData restrict obj){
|
|
3824
3529
|
int64_t offset=0;
|
|
3825
|
-
offset+=
|
|
3530
|
+
offset+=160;
|
|
3826
3531
|
return ( int64_t*)(( char*) obj+offset);
|
|
3827
3532
|
}
|
|
3828
|
-
static inline int64_t
|
|
3533
|
+
static inline int64_t ParticlesMonitorData_get_data__num_active_particles(const ParticlesMonitorData restrict obj){
|
|
3829
3534
|
int64_t offset=0;
|
|
3830
|
-
offset+=
|
|
3535
|
+
offset+=168;
|
|
3831
3536
|
return *( int64_t*)(( char*) obj+offset);
|
|
3832
3537
|
}
|
|
3833
|
-
static inline void
|
|
3538
|
+
static inline void ParticlesMonitorData_set_data__num_active_particles(ParticlesMonitorData restrict obj, int64_t value){
|
|
3834
3539
|
int64_t offset=0;
|
|
3835
|
-
offset+=
|
|
3540
|
+
offset+=168;
|
|
3836
3541
|
*( int64_t*)(( char*) obj+offset)=value;
|
|
3837
3542
|
}
|
|
3838
|
-
static inline int64_t*
|
|
3543
|
+
static inline int64_t* ParticlesMonitorData_getp_data__num_active_particles(ParticlesMonitorData restrict obj){
|
|
3839
3544
|
int64_t offset=0;
|
|
3840
|
-
offset+=
|
|
3545
|
+
offset+=168;
|
|
3841
3546
|
return ( int64_t*)(( char*) obj+offset);
|
|
3842
3547
|
}
|
|
3843
|
-
static inline int64_t
|
|
3548
|
+
static inline int64_t ParticlesMonitorData_get_data__num_lost_particles(const ParticlesMonitorData restrict obj){
|
|
3844
3549
|
int64_t offset=0;
|
|
3845
|
-
offset+=
|
|
3550
|
+
offset+=176;
|
|
3846
3551
|
return *( int64_t*)(( char*) obj+offset);
|
|
3847
3552
|
}
|
|
3848
|
-
static inline void
|
|
3553
|
+
static inline void ParticlesMonitorData_set_data__num_lost_particles(ParticlesMonitorData restrict obj, int64_t value){
|
|
3849
3554
|
int64_t offset=0;
|
|
3850
|
-
offset+=
|
|
3555
|
+
offset+=176;
|
|
3851
3556
|
*( int64_t*)(( char*) obj+offset)=value;
|
|
3852
3557
|
}
|
|
3853
|
-
static inline int64_t*
|
|
3558
|
+
static inline int64_t* ParticlesMonitorData_getp_data__num_lost_particles(ParticlesMonitorData restrict obj){
|
|
3854
3559
|
int64_t offset=0;
|
|
3855
|
-
offset+=
|
|
3560
|
+
offset+=176;
|
|
3856
3561
|
return ( int64_t*)(( char*) obj+offset);
|
|
3857
3562
|
}
|
|
3858
|
-
static inline int64_t
|
|
3563
|
+
static inline int64_t ParticlesMonitorData_get_data_start_tracking_at_element(const ParticlesMonitorData restrict obj){
|
|
3859
3564
|
int64_t offset=0;
|
|
3860
|
-
offset+=
|
|
3565
|
+
offset+=184;
|
|
3861
3566
|
return *( int64_t*)(( char*) obj+offset);
|
|
3862
3567
|
}
|
|
3863
|
-
static inline void
|
|
3568
|
+
static inline void ParticlesMonitorData_set_data_start_tracking_at_element(ParticlesMonitorData restrict obj, int64_t value){
|
|
3864
3569
|
int64_t offset=0;
|
|
3865
|
-
offset+=
|
|
3570
|
+
offset+=184;
|
|
3866
3571
|
*( int64_t*)(( char*) obj+offset)=value;
|
|
3867
3572
|
}
|
|
3868
|
-
static inline int64_t*
|
|
3573
|
+
static inline int64_t* ParticlesMonitorData_getp_data_start_tracking_at_element(ParticlesMonitorData restrict obj){
|
|
3869
3574
|
int64_t offset=0;
|
|
3870
|
-
offset+=
|
|
3575
|
+
offset+=184;
|
|
3871
3576
|
return ( int64_t*)(( char*) obj+offset);
|
|
3872
3577
|
}
|
|
3873
|
-
static inline
|
|
3578
|
+
static inline double ParticlesMonitorData_get_data_q0(const ParticlesMonitorData restrict obj){
|
|
3874
3579
|
int64_t offset=0;
|
|
3875
|
-
offset+=
|
|
3876
|
-
return *(
|
|
3580
|
+
offset+=192;
|
|
3581
|
+
return *( double*)(( char*) obj+offset);
|
|
3877
3582
|
}
|
|
3878
|
-
static inline void
|
|
3583
|
+
static inline void ParticlesMonitorData_set_data_q0(ParticlesMonitorData restrict obj, double value){
|
|
3879
3584
|
int64_t offset=0;
|
|
3880
|
-
offset+=
|
|
3881
|
-
*(
|
|
3585
|
+
offset+=192;
|
|
3586
|
+
*( double*)(( char*) obj+offset)=value;
|
|
3882
3587
|
}
|
|
3883
|
-
static inline
|
|
3588
|
+
static inline double* ParticlesMonitorData_getp_data_q0(ParticlesMonitorData restrict obj){
|
|
3884
3589
|
int64_t offset=0;
|
|
3885
|
-
offset+=
|
|
3886
|
-
return (
|
|
3590
|
+
offset+=192;
|
|
3591
|
+
return ( double*)(( char*) obj+offset);
|
|
3887
3592
|
}
|
|
3888
|
-
static inline
|
|
3593
|
+
static inline double ParticlesMonitorData_get_data_mass0(const ParticlesMonitorData restrict obj){
|
|
3889
3594
|
int64_t offset=0;
|
|
3890
|
-
offset+=
|
|
3891
|
-
return *(
|
|
3595
|
+
offset+=200;
|
|
3596
|
+
return *( double*)(( char*) obj+offset);
|
|
3892
3597
|
}
|
|
3893
|
-
static inline void
|
|
3598
|
+
static inline void ParticlesMonitorData_set_data_mass0(ParticlesMonitorData restrict obj, double value){
|
|
3894
3599
|
int64_t offset=0;
|
|
3895
|
-
offset+=
|
|
3896
|
-
*(
|
|
3600
|
+
offset+=200;
|
|
3601
|
+
*( double*)(( char*) obj+offset)=value;
|
|
3897
3602
|
}
|
|
3898
|
-
static inline
|
|
3603
|
+
static inline double* ParticlesMonitorData_getp_data_mass0(ParticlesMonitorData restrict obj){
|
|
3899
3604
|
int64_t offset=0;
|
|
3900
|
-
offset+=
|
|
3901
|
-
return (
|
|
3605
|
+
offset+=200;
|
|
3606
|
+
return ( double*)(( char*) obj+offset);
|
|
3902
3607
|
}
|
|
3903
|
-
static inline
|
|
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){
|
|
3608
|
+
static inline double ParticlesMonitorData_get_data_t_sim(const ParticlesMonitorData restrict obj){
|
|
4044
3609
|
int64_t offset=0;
|
|
4045
3610
|
offset+=208;
|
|
4046
3611
|
return *( double*)(( char*) obj+offset);
|
|
@@ -5104,173 +4669,809 @@ typedef struct ParticlesMonitorData_s * ParticlesMonitorData;
|
|
|
5104
4669
|
offset+=16+i0*4;
|
|
5105
4670
|
return ( uint32_t*)(( char*) obj+offset);
|
|
5106
4671
|
}
|
|
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);
|
|
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
|
+
|
|
5192
|
+
}
|
|
5193
|
+
ParticlesMonitor_track_local_particle(el, part0);
|
|
5194
|
+
// Transform back to global frame
|
|
5195
|
+
if (_sin_rot_s > -2.) {
|
|
5196
|
+
double const _cos_rot_s = ParticlesMonitorData_get__cos_rot_s(el);
|
|
5197
|
+
double const rot_s_rad = atan2(_sin_rot_s, _cos_rot_s);
|
|
5198
|
+
double const shift_x = ParticlesMonitorData_get__shift_x(el);
|
|
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
|
+
}
|
|
5250
|
+
}
|
|
5112
5251
|
}
|
|
5113
|
-
|
|
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){
|
|
5114
5327
|
int64_t offset=0;
|
|
5115
|
-
offset
|
|
5116
|
-
offset+=*( int64_t*)(( char*) obj+offset+304);
|
|
5117
|
-
int64_t* arr = ( int64_t*)(( char*) obj+offset);
|
|
5118
|
-
return arr[1];
|
|
5328
|
+
return (RandomUniformData)(( char*) obj+offset);
|
|
5119
5329
|
}
|
|
5120
|
-
static inline
|
|
5330
|
+
static inline uint8_t RandomUniformData_get__dummy(const RandomUniformData restrict obj){
|
|
5121
5331
|
int64_t offset=0;
|
|
5122
|
-
offset
|
|
5123
|
-
offset+=*( int64_t*)(( char*) obj+offset+304);
|
|
5124
|
-
offset+=16+i0*4;
|
|
5125
|
-
return *( uint32_t*)(( char*) obj+offset);
|
|
5332
|
+
return *(( uint8_t*) obj+offset);
|
|
5126
5333
|
}
|
|
5127
|
-
static inline void
|
|
5334
|
+
static inline void RandomUniformData_set__dummy(RandomUniformData restrict obj, uint8_t value){
|
|
5128
5335
|
int64_t offset=0;
|
|
5129
|
-
offset
|
|
5130
|
-
offset+=*( int64_t*)(( char*) obj+offset+304);
|
|
5131
|
-
offset+=16+i0*4;
|
|
5132
|
-
*( uint32_t*)(( char*) obj+offset)=value;
|
|
5336
|
+
*(( uint8_t*) obj+offset)=value;
|
|
5133
5337
|
}
|
|
5134
|
-
static inline
|
|
5338
|
+
static inline uint8_t* RandomUniformData_getp__dummy(RandomUniformData restrict obj){
|
|
5135
5339
|
int64_t offset=0;
|
|
5136
|
-
offset
|
|
5137
|
-
offset+=*( int64_t*)(( char*) obj+offset+304);
|
|
5138
|
-
offset+=16+i0*4;
|
|
5139
|
-
return ( uint32_t*)(( char*) obj+offset);
|
|
5340
|
+
return ( uint8_t*)(( char*) obj+offset);
|
|
5140
5341
|
}
|
|
5141
|
-
static inline double
|
|
5342
|
+
static inline double RandomUniformData_get__sin_rot_s(const RandomUniformData restrict obj){
|
|
5142
5343
|
int64_t offset=0;
|
|
5143
|
-
offset+=
|
|
5344
|
+
offset+=8;
|
|
5144
5345
|
return *( double*)(( char*) obj+offset);
|
|
5145
5346
|
}
|
|
5146
|
-
static inline void
|
|
5347
|
+
static inline void RandomUniformData_set__sin_rot_s(RandomUniformData restrict obj, double value){
|
|
5147
5348
|
int64_t offset=0;
|
|
5148
|
-
offset+=
|
|
5349
|
+
offset+=8;
|
|
5149
5350
|
*( double*)(( char*) obj+offset)=value;
|
|
5150
5351
|
}
|
|
5151
|
-
static inline double*
|
|
5352
|
+
static inline double* RandomUniformData_getp__sin_rot_s(RandomUniformData restrict obj){
|
|
5152
5353
|
int64_t offset=0;
|
|
5153
|
-
offset+=
|
|
5354
|
+
offset+=8;
|
|
5154
5355
|
return ( double*)(( char*) obj+offset);
|
|
5155
5356
|
}
|
|
5156
|
-
static inline double
|
|
5357
|
+
static inline double RandomUniformData_get__cos_rot_s(const RandomUniformData restrict obj){
|
|
5157
5358
|
int64_t offset=0;
|
|
5158
|
-
offset+=
|
|
5359
|
+
offset+=16;
|
|
5159
5360
|
return *( double*)(( char*) obj+offset);
|
|
5160
5361
|
}
|
|
5161
|
-
static inline void
|
|
5362
|
+
static inline void RandomUniformData_set__cos_rot_s(RandomUniformData restrict obj, double value){
|
|
5162
5363
|
int64_t offset=0;
|
|
5163
|
-
offset+=
|
|
5364
|
+
offset+=16;
|
|
5164
5365
|
*( double*)(( char*) obj+offset)=value;
|
|
5165
5366
|
}
|
|
5166
|
-
static inline double*
|
|
5367
|
+
static inline double* RandomUniformData_getp__cos_rot_s(RandomUniformData restrict obj){
|
|
5167
5368
|
int64_t offset=0;
|
|
5168
|
-
offset+=
|
|
5369
|
+
offset+=16;
|
|
5169
5370
|
return ( double*)(( char*) obj+offset);
|
|
5170
5371
|
}
|
|
5171
|
-
static inline double
|
|
5372
|
+
static inline double RandomUniformData_get__shift_x(const RandomUniformData restrict obj){
|
|
5172
5373
|
int64_t offset=0;
|
|
5173
|
-
offset+=
|
|
5374
|
+
offset+=24;
|
|
5174
5375
|
return *( double*)(( char*) obj+offset);
|
|
5175
5376
|
}
|
|
5176
|
-
static inline void
|
|
5377
|
+
static inline void RandomUniformData_set__shift_x(RandomUniformData restrict obj, double value){
|
|
5177
5378
|
int64_t offset=0;
|
|
5178
|
-
offset+=
|
|
5379
|
+
offset+=24;
|
|
5179
5380
|
*( double*)(( char*) obj+offset)=value;
|
|
5180
5381
|
}
|
|
5181
|
-
static inline double*
|
|
5382
|
+
static inline double* RandomUniformData_getp__shift_x(RandomUniformData restrict obj){
|
|
5182
5383
|
int64_t offset=0;
|
|
5183
|
-
offset+=
|
|
5384
|
+
offset+=24;
|
|
5184
5385
|
return ( double*)(( char*) obj+offset);
|
|
5185
5386
|
}
|
|
5186
|
-
static inline double
|
|
5387
|
+
static inline double RandomUniformData_get__shift_y(const RandomUniformData restrict obj){
|
|
5187
5388
|
int64_t offset=0;
|
|
5188
|
-
offset+=
|
|
5389
|
+
offset+=32;
|
|
5189
5390
|
return *( double*)(( char*) obj+offset);
|
|
5190
5391
|
}
|
|
5191
|
-
static inline void
|
|
5392
|
+
static inline void RandomUniformData_set__shift_y(RandomUniformData restrict obj, double value){
|
|
5192
5393
|
int64_t offset=0;
|
|
5193
|
-
offset+=
|
|
5394
|
+
offset+=32;
|
|
5194
5395
|
*( double*)(( char*) obj+offset)=value;
|
|
5195
5396
|
}
|
|
5196
|
-
static inline double*
|
|
5397
|
+
static inline double* RandomUniformData_getp__shift_y(RandomUniformData restrict obj){
|
|
5197
5398
|
int64_t offset=0;
|
|
5198
|
-
offset+=
|
|
5399
|
+
offset+=32;
|
|
5199
5400
|
return ( double*)(( char*) obj+offset);
|
|
5200
5401
|
}
|
|
5201
|
-
static inline double
|
|
5402
|
+
static inline double RandomUniformData_get__shift_s(const RandomUniformData restrict obj){
|
|
5202
5403
|
int64_t offset=0;
|
|
5203
|
-
offset+=
|
|
5404
|
+
offset+=40;
|
|
5204
5405
|
return *( double*)(( char*) obj+offset);
|
|
5205
5406
|
}
|
|
5206
|
-
static inline void
|
|
5407
|
+
static inline void RandomUniformData_set__shift_s(RandomUniformData restrict obj, double value){
|
|
5207
5408
|
int64_t offset=0;
|
|
5208
|
-
offset+=
|
|
5409
|
+
offset+=40;
|
|
5209
5410
|
*( double*)(( char*) obj+offset)=value;
|
|
5210
5411
|
}
|
|
5211
|
-
static inline double*
|
|
5412
|
+
static inline double* RandomUniformData_getp__shift_s(RandomUniformData restrict obj){
|
|
5212
5413
|
int64_t offset=0;
|
|
5213
|
-
offset+=
|
|
5414
|
+
offset+=40;
|
|
5214
5415
|
return ( double*)(( char*) obj+offset);
|
|
5215
5416
|
}
|
|
5216
|
-
static inline double
|
|
5417
|
+
static inline double RandomUniformData_get__rot_x_rad(const RandomUniformData restrict obj){
|
|
5217
5418
|
int64_t offset=0;
|
|
5218
|
-
offset+=
|
|
5419
|
+
offset+=48;
|
|
5219
5420
|
return *( double*)(( char*) obj+offset);
|
|
5220
5421
|
}
|
|
5221
|
-
static inline void
|
|
5422
|
+
static inline void RandomUniformData_set__rot_x_rad(RandomUniformData restrict obj, double value){
|
|
5222
5423
|
int64_t offset=0;
|
|
5223
|
-
offset+=
|
|
5424
|
+
offset+=48;
|
|
5224
5425
|
*( double*)(( char*) obj+offset)=value;
|
|
5225
5426
|
}
|
|
5226
|
-
static inline double*
|
|
5427
|
+
static inline double* RandomUniformData_getp__rot_x_rad(RandomUniformData restrict obj){
|
|
5227
5428
|
int64_t offset=0;
|
|
5228
|
-
offset+=
|
|
5429
|
+
offset+=48;
|
|
5229
5430
|
return ( double*)(( char*) obj+offset);
|
|
5230
5431
|
}
|
|
5231
|
-
static inline double
|
|
5432
|
+
static inline double RandomUniformData_get__rot_y_rad(const RandomUniformData restrict obj){
|
|
5232
5433
|
int64_t offset=0;
|
|
5233
|
-
offset+=
|
|
5434
|
+
offset+=56;
|
|
5234
5435
|
return *( double*)(( char*) obj+offset);
|
|
5235
5436
|
}
|
|
5236
|
-
static inline void
|
|
5437
|
+
static inline void RandomUniformData_set__rot_y_rad(RandomUniformData restrict obj, double value){
|
|
5237
5438
|
int64_t offset=0;
|
|
5238
|
-
offset+=
|
|
5439
|
+
offset+=56;
|
|
5239
5440
|
*( double*)(( char*) obj+offset)=value;
|
|
5240
5441
|
}
|
|
5241
|
-
static inline double*
|
|
5442
|
+
static inline double* RandomUniformData_getp__rot_y_rad(RandomUniformData restrict obj){
|
|
5242
5443
|
int64_t offset=0;
|
|
5243
|
-
offset+=
|
|
5444
|
+
offset+=56;
|
|
5244
5445
|
return ( double*)(( char*) obj+offset);
|
|
5245
5446
|
}
|
|
5246
|
-
static inline double
|
|
5447
|
+
static inline double RandomUniformData_get__rot_s_rad_no_frame(const RandomUniformData restrict obj){
|
|
5247
5448
|
int64_t offset=0;
|
|
5248
|
-
offset+=
|
|
5449
|
+
offset+=64;
|
|
5249
5450
|
return *( double*)(( char*) obj+offset);
|
|
5250
5451
|
}
|
|
5251
|
-
static inline void
|
|
5452
|
+
static inline void RandomUniformData_set__rot_s_rad_no_frame(RandomUniformData restrict obj, double value){
|
|
5252
5453
|
int64_t offset=0;
|
|
5253
|
-
offset+=
|
|
5454
|
+
offset+=64;
|
|
5254
5455
|
*( double*)(( char*) obj+offset)=value;
|
|
5255
5456
|
}
|
|
5256
|
-
static inline double*
|
|
5457
|
+
static inline double* RandomUniformData_getp__rot_s_rad_no_frame(RandomUniformData restrict obj){
|
|
5257
5458
|
int64_t offset=0;
|
|
5258
|
-
offset+=
|
|
5459
|
+
offset+=64;
|
|
5259
5460
|
return ( double*)(( char*) obj+offset);
|
|
5260
5461
|
}
|
|
5261
|
-
static inline double
|
|
5462
|
+
static inline double RandomUniformData_get_rot_shift_anchor(const RandomUniformData restrict obj){
|
|
5262
5463
|
int64_t offset=0;
|
|
5263
|
-
offset+=
|
|
5464
|
+
offset+=72;
|
|
5264
5465
|
return *( double*)(( char*) obj+offset);
|
|
5265
5466
|
}
|
|
5266
|
-
static inline void
|
|
5467
|
+
static inline void RandomUniformData_set_rot_shift_anchor(RandomUniformData restrict obj, double value){
|
|
5267
5468
|
int64_t offset=0;
|
|
5268
|
-
offset+=
|
|
5469
|
+
offset+=72;
|
|
5269
5470
|
*( double*)(( char*) obj+offset)=value;
|
|
5270
5471
|
}
|
|
5271
|
-
static inline double*
|
|
5472
|
+
static inline double* RandomUniformData_getp_rot_shift_anchor(RandomUniformData restrict obj){
|
|
5272
5473
|
int64_t offset=0;
|
|
5273
|
-
offset+=
|
|
5474
|
+
offset+=72;
|
|
5274
5475
|
return ( double*)(( char*) obj+offset);
|
|
5275
5476
|
}
|
|
5276
5477
|
#endif
|
|
@@ -5483,215 +5684,14 @@ void Drift_single_particle(LocalParticle* part, double length){
|
|
|
5483
5684
|
|
|
5484
5685
|
#endif // XSTUITE_TRACK_FLAGS_H
|
|
5485
5686
|
|
|
5486
|
-
|
|
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
|
-
|
|
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
|
-
|
|
5644
|
-
/* Spin tracking is disabled by the synrad compile flag */
|
|
5645
|
-
#ifndef XTRACK_MULTIPOLE_NO_SYNRAD
|
|
5646
|
-
// Rotate spin
|
|
5647
|
-
|
|
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
|
-
|
|
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
|
|
5654
|
-
|
|
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
|
|
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
|
|
5661
|
-
|
|
5662
|
-
// LocalParticle* part = part0; //only_for_context opencl cuda
|
|
5663
|
-
|
|
5664
|
-
// if (LocalParticle_get_state(part) > 0) { //only_for_context cpu_openmp
|
|
5665
|
-
|
|
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
|
-
|
|
5675
|
-
// } //only_for_context cpu_openmp
|
|
5676
|
-
} //only_for_context cpu_serial cpu_openmp
|
|
5677
|
-
}
|
|
5678
|
-
|
|
5679
|
-
#endif
|
|
5680
|
-
|
|
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
|
-
}
|
|
5687
|
-
|
|
5687
|
+
#include <random/random_src/uniform.h>
|
|
5688
5688
|
|
|
5689
5689
|
|
|
5690
|
-
void
|
|
5691
|
-
|
|
5690
|
+
void sample_uniform(
|
|
5691
|
+
RandomUniformData el,
|
|
5692
5692
|
|
|
5693
5693
|
ParticlesData particles,
|
|
5694
|
-
|
|
5694
|
+
double* samples, int64_t n_samples_per_seed,
|
|
5695
5695
|
int64_t flag_increment_at_element,
|
|
5696
5696
|
int8_t* io_buffer){
|
|
5697
5697
|
|
|
@@ -5736,7 +5736,7 @@ if (_sin_rot_s > -2.) {
|
|
|
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
|
+
RandomUniform_sample(el, &lpart, samples, n_samples_per_seed);
|
|
5740
5740
|
|
|
5741
5741
|
}
|
|
5742
5742
|
if (check_is_active(&lpart)>0 && flag_increment_at_element){
|
|
@@ -5755,6 +5755,25 @@ if (_sin_rot_s > -2.) {
|
|
|
5755
5755
|
// #endif //only_for_context cpu_openmp
|
|
5756
5756
|
}
|
|
5757
5757
|
|
|
5758
|
+
#ifndef XOBJ_TYPEDEF_ElementRefClass
|
|
5759
|
+
#define XOBJ_TYPEDEF_ElementRefClass
|
|
5760
|
+
typedef struct ElementRefClass_s * ElementRefClass;
|
|
5761
|
+
enum ElementRefClass_e{ElementRefClass_ParticlesMonitorData_t};
|
|
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
|
|
5758
5777
|
#ifndef XOBJ_TYPEDEF_RandomNormalData
|
|
5759
5778
|
#define XOBJ_TYPEDEF_RandomNormalData
|
|
5760
5779
|
typedef struct RandomNormalData_s * RandomNormalData;
|
|
@@ -7120,25 +7139,6 @@ void Drift_single_particle(LocalParticle* part, double length){
|
|
|
7120
7139
|
// #endif //only_for_context cpu_openmp
|
|
7121
7140
|
}
|
|
7122
7141
|
|
|
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;
|