1 /* 2 * Copyright (c) 2016-2021, The OSKAR Developers. 3 * See the LICENSE file at the top-level directory of this distribution. 4 */ 5 6 #ifndef OSKAR_GRID_WEIGHTS_H_ 7 #define OSKAR_GRID_WEIGHTS_H_ 8 9 /** 10 * @file oskar_grid_weights.h 11 */ 12 13 #include <oskar_global.h> 14 #include <stddef.h> 15 16 #ifdef __cplusplus 17 extern "C" { 18 #endif 19 20 /** 21 * @brief 22 * Updates gridded weights (double precision). 23 * 24 * @details 25 * Updates gridded weights for the supplied visibility points. 26 * 27 * @param[in] num_points Number of data points. 28 * @param[in] uu Baseline uu coordinates, in wavelengths. 29 * @param[in] vv Baseline vv coordinates, in wavelengths. 30 * @param[in] weight Input visibility weights. 31 * @param[in] cell_size_rad Cell size, in radians. 32 * @param[in] grid_size Side length of grid. 33 * @param[out] num_skipped Number of points that fell outside the grid. 34 * @param[in,out] grid Gridded weights. 35 */ 36 OSKAR_EXPORT 37 void oskar_grid_weights_write_d(const size_t num_points, 38 const double* RESTRICT uu, const double* RESTRICT vv, 39 const double* RESTRICT weight, const double cell_size_rad, 40 const int grid_size, size_t* RESTRICT num_skipped, 41 double* RESTRICT grid); 42 43 /** 44 * @brief 45 * Re-weights visibilities using gridded weights (double precision). 46 * 47 * @details 48 * Re-weights supplied visibilities using gridded weights, for 49 * uniform weighting. 50 * 51 * @param[in] num_points Number of data points. 52 * @param[in] uu Baseline uu coordinates, in wavelengths. 53 * @param[in] vv Baseline vv coordinates, in wavelengths. 54 * @param[in] weight Input visibility weights. 55 * @param[in] cell_size_rad Cell size, in radians. 56 * @param[in] grid_size Side length of grid. 57 * @param[out] num_skipped Number of points that fell outside the grid. 58 * @param[in] grid Gridded weights. 59 */ 60 OSKAR_EXPORT 61 void oskar_grid_weights_read_d(const size_t num_points, 62 const double* RESTRICT uu, const double* RESTRICT vv, 63 const double* RESTRICT weight_in, double* RESTRICT weight_out, 64 const double cell_size_rad, const int grid_size, 65 size_t* RESTRICT num_skipped, const double* RESTRICT grid); 66 67 /** 68 * @brief 69 * Updates gridded weights (single precision). 70 * 71 * @details 72 * Updates gridded weights for the supplied visibility points. 73 * 74 * @param[in] num_points Number of data points. 75 * @param[in] uu Baseline uu coordinates, in wavelengths. 76 * @param[in] vv Baseline vv coordinates, in wavelengths. 77 * @param[in] weight Input visibility weights. 78 * @param[in] cell_size_rad Cell size, in radians. 79 * @param[in] grid_size Side length of grid. 80 * @param[out] num_skipped Number of points that fell outside the grid. 81 * @param[in,out] grid Gridded weights. 82 * @param[in,out] grid_guard Guard digits for gridded weights. 83 */ 84 OSKAR_EXPORT 85 void oskar_grid_weights_write_f(const size_t num_points, 86 const float* RESTRICT uu, const float* RESTRICT vv, 87 const float* RESTRICT weight, const float cell_size_rad, 88 const int grid_size, size_t* RESTRICT num_skipped, 89 float* RESTRICT grid, float* RESTRICT grid_guard); 90 91 /** 92 * @brief 93 * Re-weights visibilities using gridded weights (single precision). 94 * 95 * @details 96 * Re-weights supplied visibilities using gridded weights, for 97 * uniform weighting. 98 * 99 * @param[in] num_points Number of data points. 100 * @param[in] uu Baseline uu coordinates, in wavelengths. 101 * @param[in] vv Baseline vv coordinates, in wavelengths. 102 * @param[in] weight Input visibility weights. 103 * @param[in] cell_size_rad Cell size, in radians. 104 * @param[in] grid_size Side length of grid. 105 * @param[out] num_skipped Number of points that fell outside the grid. 106 * @param[in] grid Gridded weights. 107 */ 108 OSKAR_EXPORT 109 void oskar_grid_weights_read_f(const size_t num_points, 110 const float* RESTRICT uu, const float* RESTRICT vv, 111 const float* RESTRICT weight_in, float* RESTRICT weight_out, 112 const float cell_size_rad, const int grid_size, 113 size_t* RESTRICT num_skipped, const float* RESTRICT grid); 114 115 #ifdef __cplusplus 116 } 117 #endif 118 119 #endif /* include guard */ 120