double test_calculate_chi_bf(void){ rpacket_t rp; storage_model_t sm; init_rpacket(&rp); init_storage_model(&sm); rk_state mt_state; irandom(&mt_state); int64_t j_blue_idx = 0; double D_BOUNDARY = compute_distance2boundary(&rp, &sm); rpacket_set_d_boundary(&rp, D_BOUNDARY); double D_LINE; // FIXME MR: return status of compute_distance2line() is ignored compute_distance2line(&rp, &sm, &D_LINE); rpacket_set_d_line(&rp, D_LINE); move_packet(&rp, &sm, 1e13); double d_line = rpacket_get_d_line(&rp); increment_j_blue_estimator(&rp, &sm, d_line, j_blue_idx); double DISTANCE = 1e13; montecarlo_line_scatter(&rp, &sm, DISTANCE, &mt_state); DISTANCE = 0.95e13; // MR: wrong: move_packet_across_shell_boundary() returns void move_packet_across_shell_boundary(&rp, &sm, DISTANCE, &mt_state); montecarlo_one_packet(&sm, &rp, 1, &mt_state); montecarlo_one_packet_loop(&sm, &rp, 1, &mt_state); DISTANCE = 1e13; montecarlo_thomson_scatter(&rp, &sm, DISTANCE, &mt_state); calculate_chi_bf(&rp, &sm); double res = rpacket_doppler_factor (&rp, &sm); dealloc_storage_model(&sm); return res; }
double test_compute_distance2boundary(void){ rpacket_t rp; storage_model_t sm; init_rpacket(&rp); init_storage_model(&sm); double D_BOUNDARY = compute_distance2boundary(&rp, &sm); rpacket_set_d_boundary(&rp, D_BOUNDARY); dealloc_storage_model(&sm); return D_BOUNDARY; }
static void montecarlo_compute_distances (rpacket_t * packet, storage_model_t * storage) { // Check if the last line was the same nu as the current line. if (rpacket_get_close_line (packet)) { // If so set the distance to the line to 0.0 rpacket_set_d_line (packet, 0.0); // Reset close_line. rpacket_set_close_line (packet, false); } else { compute_distance2boundary(packet, storage); compute_distance2line (packet, storage); // FIXME MR: return status of compute_distance2line() is ignored compute_distance2continuum (packet, storage); } }
extern inline void montecarlo_compute_distances(rpacket_t *packet, storage_model_t *storage) { // Check if the last line was the same nu as the current line. if (rpacket_get_close_line(packet)) { // If so set the distance to the line to 0.0 rpacket_set_d_line(packet, 0.0); // Reset close_line. rpacket_set_close_line(packet, false); } else { rpacket_set_d_boundary(packet, compute_distance2boundary(packet, storage)); double d_line; compute_distance2line(packet, storage, &d_line); rpacket_set_d_line(packet, d_line); rpacket_set_d_electron(packet, compute_distance2electron(packet, storage)); } }
double test_increment_j_blue_estimator(void){ rpacket_t rp; storage_model_t sm; init_rpacket(&rp); init_storage_model(&sm); int64_t j_blue_idx = 0; double D_BOUNDARY = compute_distance2boundary(&rp, &sm); rpacket_set_d_boundary(&rp, D_BOUNDARY); double D_LINE; // FIXME MR: return status of compute_distance2line() is ignored compute_distance2line(&rp, &sm, &D_LINE); rpacket_set_d_line(&rp, D_LINE); move_packet(&rp, &sm, 1e13); double d_line = rpacket_get_d_line(&rp); increment_j_blue_estimator(&rp, &sm, d_line, j_blue_idx); double res = sm.line_lists_j_blues[j_blue_idx]; dealloc_storage_model(&sm); return res; }