static inline mwvector exponentialDiskAccel(const Disk* disk, mwvector pos, real r) { const real b = disk->scaleLength; const real expPiece = mw_exp(-r / b) * (r + b) / b; const real factor = disk->mass * (expPiece - 1.0) / cube(r); return mw_mulvs(pos, factor); }
/* get stream & background weight constants */ static real get_stream_bg_weight_consts(StreamStats* ss, const Streams* streams) { unsigned int i; real epsilon_b; real denom = 1.0; for (i = 0; i < streams->number_streams; i++) denom += mw_exp(streams->parameters[i].epsilon); for (i = 0; i < streams->number_streams; i++) { ss[i].epsilon_s = mw_exp(streams->parameters[i].epsilon) / denom; printf("epsilon_s[%d]: %lf\n", i, ss[i].epsilon_s); } epsilon_b = 1.0 / denom; printf("epsilon_b: %lf\n", epsilon_b); return epsilon_b; }
void setExpStreamWeights(const AstronomyParameters* ap, Streams* streams) { int i; streams->sumExpWeights = ap->exp_background_weight; for (i = 0; i < streams->number_streams; i++) { streams->parameters[i].epsilonExp = mw_exp(streams->parameters[i].epsilon); streams->sumExpWeights += streams->parameters[i].epsilonExp; } streams->sumExpWeights *= 0.001; }
int setAstronomyParameters(AstronomyParameters* ap, const BackgroundParameters* bgp) { ap->alpha = bgp->alpha; ap->q = bgp->q; ap->r0 = bgp->r0; ap->delta = bgp->delta; ap->q_inv = inv(ap->q); ap->q_inv_sqr = inv(sqr(ap->q)); ap->aux_bg_profile = (bgp->a != 0.0) || (bgp->b != 0.0) || (bgp->c != 0.0); ap->bg_a = bgp->a; ap->bg_b = bgp->b; ap->bg_c = bgp->c; if (ap->convolve == 0 || ap->convolve > MAX_CONVOLVE || !mwEven(ap->convolve)) { mw_printf("convolve (%u) must be > 0, <= 256 and even\n", ap->convolve); return 1; } // ap->coeff = 1.0 / (stdev * SQRT_2PI); ap->alpha_delta3 = 3.0 - ap->alpha + ap->delta; ap->exp_background_weight = mw_exp(bgp->epsilon); //Check if we need to use fast or slow hernquist if we are not using Broken Power Law which doesn't care. if(ap->background_profile != BROKEN_POWER_LAW) { if(ap->alpha == 1.0 && ap->delta == 1.0) { ap->background_profile = FAST_HERNQUIST; } else { ap->background_profile = SLOW_HERNQUIST; } } ap->sun_r0 = const_sun_r0; ap->m_sun_r0 = -ap->sun_r0; return 0; }
int setAstronomyParameters(AstronomyParameters* ap, const BackgroundParameters* bgp) { #ifdef ANDROID int armExt = mwDetectARMExt(); #endif ap->alpha = bgp->alpha; ap->q = bgp->q; ap->r0 = bgp->r0; ap->delta = bgp->delta; ap->q_inv = inv(ap->q); ap->q_inv_sqr = inv(sqr(ap->q)); ap->aux_bg_profile = (bgp->a != 0.0) || (bgp->b != 0.0) || (bgp->c != 0.0); ap->bg_a = bgp->a; ap->bg_b = bgp->b; ap->bg_c = bgp->c; if (ap->convolve == 0 || ap->convolve > 256 || !mwEven(ap->convolve)) { warn("convolve (%u) must be > 0, <= 256 and even\n", ap->convolve); return 1; } ap->coeff = 1.0 / (stdev * SQRT_2PI); ap->alpha_delta3 = 3.0 - ap->alpha + ap->delta; ap->exp_background_weight = mw_exp(bgp->epsilon); ap->fast_h_prob = (ap->alpha == 1.0 && ap->delta == 1.0); ap->sun_r0 = const_sun_r0; ap->m_sun_r0 = -ap->sun_r0; #ifdef ANDROID if (armExt==ARM_CPU_NOVFP && ap->fast_h_prob && ap->r0 < 0.0) { warn("IntFp Engine cant handle r0<0.0\n"); return 1; } #endif return 0; }