Example #1
0
void WorkThread::run()
{
    /*********************************************************/
    /* Read input file, and initialize params and vars. This */
    /* function calls SPECIES and LOAD or Restore            */
    start_(argc, argv);

   // init output file
    QString filename = "Qdust(t).txt";
    QFile file(filename);


   // InitWindows(argc, argv);

    history();
    fields();

    int step=0;
    float *pot = phi;
    if (file.open(QIODevice::WriteOnly)) {
        QTextStream stream(&file);
        stream.setRealNumberPrecision(20);

        while(True)
        {
          if(!stop){
//            mutex.lock();
              t += dt;

              move();
              adjust();
              mcc();
              fields();
              history();

              if(((int)(t/dt))%2==0) stream << t<<"\t"<< qdust << "\t"<< energy_flux[0] <<"\t"<<  energy_flux[1] << endl;

              updatePlasmaModel();

             if(step%200==0 && step>0) {
//                 stop=true;
                 std::cout<< "Step "<<step<<": a signal sent to save data\n"<<endl;
                 emit DataChanged();
             }

            } else{
                this->msleep(50);
            }
            step++;
        }
    }
}
Example #2
0
bool BrinK::udp::server::start(const unsigned int& port)
{
    std::unique_lock < std::mutex > lock(mutex_);

    if (started_)
        return false;

    port_ = port;

    shut_down_ = false;

    start_();

    started_ = true;

    return started_;
}
void model::update(double time)
{
    view::update(time);
	
	if(start_)
	{
		start_();
		start_.clear();
	}

	double dt = time - (last_update_ ? *last_update_ : 0);
    if (!cg::eq_zero(dt))
    {

        update_model(time, dt);
#if 0
        if (!manual_controls_)
#endif
        sync_phys(dt);
#if 0
        else
        {
            cg::geo_base_3 base = phys_->get_base(*phys_zone_); 
            decart_position cur_pos = phys_vehicle_->get_position();
            geo_position cur_glb_pos(cur_pos, base);
            set_state(state_t(cur_glb_pos.pos, cur_pos.orien.get_course(), 0)); 
        }
#endif


        sync_nodes_manager(dt);

    }

    last_update_ = time;

}
Example #4
0
 fiber( launch policy, std::allocator_arg_t, StackAllocator salloc, Fn && fn, Args && ... args) :
     impl_{ make_worker_context( policy, salloc, std::forward< Fn >( fn), std::forward< Args >( args) ... ) } {
     start_();
 }