121 lines
2.6 KiB
C++
121 lines
2.6 KiB
C++
#pragma once
|
|
#include <cmath>
|
|
#include <new>
|
|
|
|
#ifdef __x86_64__
|
|
#include "immintrin.h"
|
|
#endif
|
|
|
|
//
|
|
// $\frac{1}{\tau_{\alpha}}$; $\tau_{\alpha} = 0.5s$
|
|
//
|
|
const double tau_alpha_inv = 2.0;
|
|
|
|
// $V^0_{\alpha \beta}$
|
|
const double V0_AB = 2.1;
|
|
|
|
// $\sigma$
|
|
const double SIGMA = 0.3;
|
|
|
|
//
|
|
// $\frac{-1}{2\sigma}$
|
|
//
|
|
const double NEG_TWO_SIGMA_INV = -1.0 / (2 * SIGMA);
|
|
|
|
//
|
|
// $\frac{-V^0_{\alpha\beta}}{2\sigma}$
|
|
//
|
|
const double NEG_V0_AB_div_TWO_SIGMA = V0_AB * NEG_TWO_SIGMA_INV;
|
|
|
|
// $U^0_{\alpha B}$
|
|
const double U0_AB = 10.0;
|
|
|
|
// $R$
|
|
const double R = 0.2;
|
|
|
|
//
|
|
// $\frac{-1}{R}$
|
|
//
|
|
const double NEG_R_INV = -1.0 / R;
|
|
|
|
//
|
|
// $\frac{-U^0_{\alpha B}}{R}$
|
|
//
|
|
const double NEG_U0_AB_div_R = -U0_AB / R;
|
|
|
|
// $-c$
|
|
const double c_neg = -0.5;
|
|
|
|
// $\varphi$
|
|
const double phi = 100.0 / 180.0 * M_PI;
|
|
|
|
// $cos(\varphi)$
|
|
const double cos_phi = cos(phi);
|
|
|
|
//
|
|
// $\frac{1}{cos(\varphi)}$
|
|
//
|
|
const double cos_phi_inv = 1 / cos(phi);
|
|
|
|
// $<v^0>$
|
|
const double v0_mean = 1.34;
|
|
|
|
// $\sqrt{\theta}$
|
|
const double v0_std_dev = 0.26;
|
|
|
|
// $\varDelta_{t}$
|
|
const double delta_t = 2;
|
|
|
|
// $\varDelta_{t}^2$
|
|
const double delta_t_sq = delta_t * delta_t;
|
|
|
|
// $dt$
|
|
const double dt = 0.02;
|
|
|
|
// $-dt$
|
|
const double dt_neg = -dt;
|
|
|
|
// $-c \cdot dt$
|
|
const double c_neg_times_dt = c_neg * dt;
|
|
|
|
//
|
|
// $\frac{1}{\tau_{\alpha}} \cdot dt$
|
|
//
|
|
const double dt_times_tau_alpha_inv = dt * tau_alpha_inv;
|
|
|
|
const double cost_add = 1;
|
|
const double cost_mult = 1;
|
|
const double cost_div = 1;
|
|
|
|
// https://acl.inf.ethz.ch/teaching/fastcode/knowledgebase/#:~:text=How%20do%20exp(x)%2C%20sin(x)%2C%20etc.%20count%20in%20the%20flopcount%20of%20an%20algorithm%3F
|
|
const double cost_exp = 30;
|
|
|
|
// -O3 maps each sqrt() call to an instruction
|
|
const double cost_sqrt = 1;
|
|
|
|
// Numerical tolerance used to avoid division by zero and unstable operations
|
|
// when distances or norms are extremely small.
|
|
const double EPS = 1e-9;
|
|
|
|
// Squared numerical tolerance
|
|
const double EPS_SQ = EPS * EPS;
|
|
|
|
#ifdef __AVX512F__
|
|
const __m512d LN2_VEC = _mm512_set1_pd(log(2));
|
|
const __m512d ZERO_VEC = _mm512_setzero_pd();
|
|
const __m512d NEG_TWO_SIGMA_INV_VEC = _mm512_set1_pd(NEG_TWO_SIGMA_INV);
|
|
const __m512d NEG_V0_AB_DIV_TWO_SIGMA_VEC = _mm512_set1_pd(NEG_V0_AB_div_TWO_SIGMA);
|
|
const __m512d c_neg_times_dt_vec = _mm512_set1_pd(c_neg_times_dt);
|
|
const __m512d cos_phi_inv_vec = _mm512_set1_pd(cos_phi_inv);
|
|
const __m512d dt_neg_vec = _mm512_set1_pd(dt_neg);
|
|
#endif
|
|
|
|
// Cutoff for pedestrian-pedestrian repulsion
|
|
const double CUTOFF = 12.0;
|
|
const double CUTOFF_SQ = CUTOFF * CUTOFF;
|
|
|
|
|
|
const double cos_phi_sq = cos_phi * cos_phi;
|
|
|
|
const size_t CACHE_BLOCK_SIZE = std::hardware_destructive_interference_size;
|