6 #include <gsl/gsl_math.h>
28 for(j = 0; j < 3; j++) {
29 pp->
Pos[j] += random_shift[j];
30 while(pp->
Pos[j] > BoxSize) pp->
Pos[j] -= BoxSize;
31 while(pp->
Pos[j] <= 0) pp->
Pos[j] += BoxSize;
45 for(k = 0; k < 3; k++) {
47 if(dx > 0.1 * BoxSize) {
48 endrun(1,
"Drifting blackhole very far, from %g %g %g to %g %g %g id = %ld. Likely due to the time step is too sparse.\n",
62 else if(pp->
Type == 0)
69 endrun(5,
"Part id %ld has bad Hsml %g with DtHsml %g vel %g %g %g\n",
73 const double Maxhsml = BoxSize /2.;
74 if(pp->
Hsml > Maxhsml)
78 for(j = 0; j < 3; j++) {
79 pp->
Pos[j] += pp->
Vel[j] * ddrift + random_shift[j];
82 for(j = 0; j < 3; j ++) {
83 while(pp->
Pos[j] > BoxSize) pp->
Pos[j] -= BoxSize;
84 while(pp->
Pos[j] <= 0) pp->
Pos[j] += BoxSize;
96 endrun(12,
"Trying to reverse time: ti0=%d ti1=%d\n", ti0, ti1);
100 #pragma omp parallel for
int BHGetRepositionEnabled(void)
void drift_all_particles(inttime_t ti0, inttime_t ti1, Cosmology *CP, const double random_shift[3])
void real_drift_particle(struct particle_data *pp, struct slots_manager_type *sman, const double ddrift, const double BoxSize, const double random_shift[3])
void endrun(int where, const char *fmt,...)
struct part_manager_type PartManager[1]
#define NEAREST(x, BoxSize)
static peano_t PEANO(double *Pos, double BoxSize)
struct slots_manager_type SlotsManager[1]
struct particle_data * Base
double get_exact_drift_factor(Cosmology *CP, inttime_t ti0, inttime_t ti1)
#define walltime_measure(name)