Ejemplo n.º 1
0
void _grid2_threaded(Array<complex<T> > *data, Array<T> *crds, Array<T> *weight, Array<complex<T> > *outdata, Array<T> *kernel, T dx, T dy, int num_threads)

{
    /* Make sure output array is initialized */
    *outdata = complex<T>(0.0);
    
    /* start threads */
    create_threads7(num_threads,
                    itself(_grid2_thread<T>),
                    data,
                    crds,
                    weight,
                    outdata,
                    kernel,
                    dx,
                    dy);
    
} // end grid2_threaded()
Ejemplo n.º 2
0
void _degrid2_threaded(Array<complex<T> > *data,
                      Array<T> *crds,
                      Array<complex<T> > *outdata,
                      Array<T> *kernel,
                      int num_threads)

{
    /* Make sure output array is initialized */
    *outdata = complex<T>(0.0);
    
    /* start threads */
    create_threads4(num_threads,
                    itself(_degrid2_thread<T>),
                    data,
                    crds,
                    outdata,
                    kernel);
    
} // end degrid2_threaded()
Ejemplo n.º 3
0
void Replay::load_from_file(const Filename& fn)
{
    clear();

    level_filename   = fn; // Standardwert: Annahme, Level in Replaydatei
    unsigned long vm = 0;  // version_min erst spaeter setzen wegen add()

    std::vector <IO::Line> lines;
    if (!IO::fill_vector_from_file(lines, fn.get_rootful())) {
        file_not_found = true;
        holds_level    = false;
        return;
    }

    for (IO::LineIt i = lines.begin(); i != lines.end(); ++i) switch(i->type) {
    case '$':
        if      (i->text1 == gloB->replay_built_required) built_required = i->text2;
        else if (i->text1 == gloB->replay_permu         ) permu          = Permu   (i->text2);
        else if (i->text1 == gloB->replay_level_filename) {
            // We changed the names of the directories on 2012-04-12. Probably
            // a year from this time on, there shouldn't be any important
            // replays with the old path anymore. Then, remove this erase()
            // to finally allow a directory (levels-dir)/levels/ in theory.
            std::string filestr = i->text2;
            if (filestr.substr(0, 7) == "levels/") filestr.erase(0, 7);
            level_filename = Filename(
                gloB->dir_levels.get_dir_rootless() + filestr);
        }
        break;

    case '#':
        if      (i->text1 == gloB->replay_version_min   ) vm = i->nr1;
        break;

    case '+':
        if (i->text1 == gloB->replay_player
         || i->text1 == gloB->replay_friend) {
            add_player(i->nr1, LixEn::string_to_style(i->text2), i->text3);
            if (i->text1 == gloB->replay_player) player_local = i->nr1;
        }
        break;

    case '!': {
        Data d;
        d.update = i->nr1; // d.player ist zwar ein char, aber wir lesen ja
        d.player = i->nr2; // nicht aktiv longs ein, sondern weisen nur zu.
        d.what   = i->nr3;
        if      (i->text1 == gloB->replay_spawnint     ) d.action = SPAWNINT;
        else if (i->text1 == gloB->replay_skill        ) d.action = SKILL;
        else if (i->text1 == gloB->replay_assign       ) d.action = ASSIGN;
        else if (i->text1 == gloB->replay_assign_legacy) d.action = ASSIGN;
        else if (i->text1 == gloB->replay_aim          ) d.action = AIM;
        else if (i->text1 == gloB->replay_nuke         ) d.action = NUKE;
        add(d);
        break; }

    default:
        break;
    }

    // Variablen nach dem Laden zuweisen, damit add() nichts kaputtmacht
    version_min = vm;

    // check whether the pointed-to level exists, otherwise use itself
    // as a fallback level
    Level pointedto(level_filename);
    if (pointedto.get_status() == Level::BAD_FILE_NOT_FOUND
     || pointedto.get_status() == Level::BAD_EMPTY) {
        level_filename = fn;
    }

    // load the replay file itself as a level, to see whether there's a level
    // in the file itself. This is important e.g. for the extract button.
    Level itself(fn);
    if (itself.get_status() == Level::BAD_FILE_NOT_FOUND
     || itself.get_status() == Level::BAD_EMPTY) {
        holds_level = false;
    }
    else {
        holds_level = true;
        if (level_filename == fn) {
            built_required = Level::get_built(level_filename);
        }
    }

}