void service_executor::add_no_count(closure_type&& f) { std::shared_ptr<thread_wrapper_helper> wfp( std::make_shared<thread_wrapper_helper>( this, std::move(f))); pool_->get_io_service().post( util::bind(&thread_wrapper_helper::invoke, wfp)); }
// Schedule the specified function for execution in this executor. // Depending on the subclass implementation, this may block in some // situations. void service_executor::add(closure_type&& f, util::thread_description const& desc, threads::thread_state_enum initial_state, bool run_now, threads::thread_stacksize stacksize, error_code& ec) { ++task_count_; std::shared_ptr<thread_wrapper_helper> wfp( std::make_shared<thread_wrapper_helper>( this, std::move(f))); pool_->get_io_service().post( util::bind(&thread_wrapper_helper::invoke, wfp)); }
// Schedule given function for execution in this executor no sooner // than time abs_time. This call never blocks, and may violate // bounds on the executor's queue size. void service_executor::add_at( boost::chrono::steady_clock::time_point const& abs_time, closure_type&& f, util::thread_description const& desc, threads::thread_stacksize stacksize, error_code& ec) { ++task_count_; std::shared_ptr<delayed_add_helper> wfp( std::make_shared<delayed_add_helper>( this, std::move(f), pool_->get_io_service(), abs_time)); wfp->timer_.async_wait( util::bind(&delayed_add_helper::invoke, wfp)); }
int inline SfluidRotationalObservable::writeViaIndex(int idx) { double iZ = 1.0/Zcount; double multC = 0.5/state->beta*iZ; Zcount = 0; stringstream ss; ss<<idx; string tfname = this->fileName + ss.str(); ofstream wfp(tfname); wfp.precision(FIELDPRECISION); wfp.width(FIELDWIDTH); wfp.setf(FIELDFORMAT); double rhoS_x,rhoS_y,rhoS_z; double rhoA_x,rhoA_y,rhoA_z; rhoS_x = rhoS_y = rhoS_z = 0.0; rhoA_x = rhoA_y = rhoA_z = 0.0; for(int i=0;i<size;i++) { //Find coordinates relative to center of trap int z = siteMap[3*i]; int y = siteMap[3*i+1]; int x = siteMap[3*i+2]; int rz2 = y*y+x*x; int ry2 = x*x+z*z; int rx2 = y*y+z*z; rhoS_z += rho_s[6*i]; rhoA_z += rho_s[6*i+1]; rhoS_y += rho_s[6*i+2]; rhoA_y += rho_s[6*i+3]; rhoS_x += rho_s[6*i+4]; rhoA_x += rho_s[6*i+5]; rho_s[6*i] = (rz2==0) ? 0.0: rho_s[6*i]/rz2*multC; rho_s[6*i + 1] = (rz2==0) ? 0.0: rho_s[6*i+1]/rz2*multC; rho_s[6*i + 2] = (ry2==0) ? 0.0: rho_s[6*i+2]/ry2*multC; rho_s[6*i + 3] = (ry2==0) ? 0.0: rho_s[6*i+3]/ry2*multC; rho_s[6*i + 4] = (rx2==0) ? 0.0: rho_s[6*i+4]/rx2*multC; rho_s[6*i + 5] = (rx2==0) ? 0.0: rho_s[6*i+5]/rx2*multC; wfp<<rho_s[6*i]<<" "<<rho_s[6*i+1]<<" "<<rho_s[6*i+2]<<" "<<rho_s[6*i+3]<<" "<<rho_s[6*i+4]<<" "<<rho_s[6*i+5]<<endl; rho_s[6*i] = rho_s[6*i+1] = rho_s[6*i+2] = rho_s[6*i+3] = rho_s[6*i+4] = rho_s[6*i+5] = 0.0; } wfp.close(); //Write superfluid density wfp.open(this->fileName,std::ofstream::app); wfp<<rhoS_z*multC<<" "<<rhoA_z*multC<<" "<<rhoS_y*multC<<" "<<rhoA_y*multC<<" "<<rhoS_x*multC<<" "<<rhoA_x*multC<<" "<<endl; wfp.close(); }