コード例 #1
0
void oskar_interferometer_set_sky_model(oskar_Interferometer* h,
        const oskar_Sky* sky, int* status)
{
    int i;
    if (*status || !h || !sky) return;

    /* Clear the old chunk set. */
    for (i = 0; i < h->num_sky_chunks; ++i)
        oskar_sky_free(h->sky_chunks[i], status);
    free(h->sky_chunks);
    h->sky_chunks = 0;
    h->num_sky_chunks = 0;

    /* Split up the sky model into chunks and store them. */
    h->num_sources_total = oskar_sky_num_sources(sky);
    if (h->num_sources_total > 0)
        oskar_sky_append_to_set(&h->num_sky_chunks, &h->sky_chunks,
                h->max_sources_per_chunk, sky, status);
    h->init_sky = 0;

    /* Print summary data. */
    if (h->log)
    {
        oskar_log_section(h->log, 'M', "Sky model summary");
        oskar_log_value(h->log, 'M', 0, "Num. sources", "%d",
                h->num_sources_total);
        oskar_log_value(h->log, 'M', 0, "Num. chunks", "%d",
                h->num_sky_chunks);
    }
}
コード例 #2
0
void oskar_simulator_set_sky_model(oskar_Simulator* h, const oskar_Sky* sky,
        int max_sources_per_chunk, int* status)
{
    int i;
    if (*status) return;

    /* Clear the old chunk set. */
    for (i = 0; i < h->num_sky_chunks; ++i)
        oskar_sky_free(h->sky_chunks[i], status);
    free(h->sky_chunks);
    h->sky_chunks = 0;
    h->num_sky_chunks = 0;

    /* Split up the sky model into chunks and store them. */
    h->max_sources_per_chunk = max_sources_per_chunk;
    if (oskar_sky_num_sources(sky) > 0)
        oskar_sky_append_to_set(&h->num_sky_chunks, &h->sky_chunks,
                max_sources_per_chunk, sky, status);
    h->init_sky = 0;
}