Ejemplo n.º 1
0
//----------------------------------------------------------------------
FLOCK::FLOCK(RTPSSettings* set, CL* c):System(set,c)
{
    //seed random
    srand ( time(NULL) );

    std::vector<FLOCKParameters> vparams(0);
    vparams.push_back(flock_params);
    cl_FLOCKParameters= Buffer<FLOCKParameters>(cli, vparams);

    calculate();
    updateParams();

    spacing = settings->GetSettingAs<float>("spacing");
    dout<<"spacing ="<<spacing<<endl;

    //set up the grid
    setupDomain(flock_params.smoothing_distance/flock_params.simulation_scale,flock_params.simulation_scale);

    //set up the timers
    setupTimers();

    //setup the sorted and unsorted arrays
    prepareSorted();

#ifdef CPU
    dout<<"RUNNING ON THE CPU"<<endl;
#endif
#ifdef GPU
    dout<<"RUNNING ON THE GPU"<<endl;

    //should be more cross platform
    string flock_source_dir = settings->GetSettingAs<string>("rtps_path") + "/" + std::string(FLOCK_CL_SOURCE_DIR);

    cli->addIncludeDir(flock_source_dir);

    rules = Rules(flock_source_dir, cli, timers["rules_gpu"]);
    euler_integration = EulerIntegration(flock_source_dir, cli, timers["euler_gpu"]);
#endif
        //renderer->setParticleRadius(spacing);
}
void KinematicCarModel::propagate(const ob::State *state, const oc::Control* control, const double duration, ob::State *result) const
{
	EulerIntegration(state, control, duration, result);
}