Esempio n. 1
0
void evol_f(real *fin, real *fout)
{
	int id, ip;
	double Cf1, Cf2;
	
//	cal_sigma();
	cal_p();
	streaming(fin,fout);
	
	cal_feqf_diff(fin,Cf);
	for (id=0; id<points*15; id++) {
		Cf1      = -itau_f * Cf[id] + p[id];
		ip       = nextf[id];
		fin[id] += 0.5 * dt * Cf1;
		fout[ip]+= dt * Cf1;
	}
	
//	cal_rho(fout);
	cal_u(fout);
//	cal_sigma();
	cal_p();
	cal_feqf_diff(fout,fout);
	for (id=0; id<points*15; id++) {
		ip       = nextf[id];
		Cf2      = -itau_f * fout[ip] + p[ip];
		fin[id] += dt * 0.5 * Cf2;
	}
	
	streaming(fin,fout);
	
//	cal_rho(fout);
	cal_u(fout);
}
Esempio n. 2
0
void main(){
  port = "/dev/ttyUSB0";
  open_port();
  setup_port();
  streaming();
  // return;
}
Esempio n. 3
0
void MainWindow::stopStreaming()
{
    shareDesktopUpdateTimer_.stop();
    frameRateLabel_.setText("");

    delete dcStream_;
    dcStream_ = 0;

    emit streaming(false);
}
Esempio n. 4
0
KangarooChannel::KangarooChannel(KangarooSerial& serial, char name, byte address)
  : _serial(serial), _name(), _address(address), _echoCode(), _monitorCode(), _monitoredSequenceCode(), _monitoredSequenceCodeIsReady()
{
  // Simplified Serial autocapitalizes, but Packet Serial does not. So, we do it here.
  // If the compiler does LTO this should constant fold to use no code space.
  if (name >= 'a' && name <= 'z')
  {
    name += 'A' - 'a';
  }
  
  if ((name >= 'A' && name <= 'Z') ||
      (name >= '0' && name <= '9'))
  {
    _name = name;
  }
  
  commandRetryInterval(KANGAROO_DEFAULT_COMMAND_RETRY_INTERVAL);
  commandTimeout      (KANGAROO_DEFAULT_COMMAND_TIMEOUT       );
  
  streaming(false);
}
Esempio n. 5
0
KangarooMonitor KangarooChannel::set(KangarooCommand        command,
                                     KangarooCommandWriter& contents,
                                     KangarooMoveFlags      moveFlags,
                                     KangarooGetType        getType)
{
  KangarooMonitor monitor(this, ++_monitorCode);
  
  if (streaming())
  {
    setNoReply(command, contents, moveFlags);
    
    // Motions from other commands cannot be tracked through.
  }
  else
  {
    KangarooTimeout timeout(commandTimeout());
    moveFlags = (KangarooMoveFlags)(moveFlags | KANGAROO_MOVE_SEQUENCE_CODE);

    // Invalidate the older command monitor and set up a new one.
    if (!getInitialSequenceCodeIfNecessary(timeout, _monitoredGetResult))
    {
      // If we have a proper initial sequence code, send the command.
      _monitoredGetType = getType;
      _monitoredGetFlags = (KangarooGetFlags)moveFlags;
      _monitoredSequenceCode = nextCode(_monitoredSequenceCode);

      do
      {
        setNoReply(command, contents, moveFlags);
      }
      // Make sure the packet was received correctly -- proper sequence code and the like. If not, we'll resend.
      while (!updateMonitoredResult(timeout, false));
    }
  }
  
  return monitor;
}
Esempio n. 6
0
void evol_f(real f1[Nx][Ny][Nz][15], real f2[Nx][Ny][Nz][15], real Q0[Nx][Ny][Nz][3][3])
{
	int i,j,k,ii,jj;
	int ip, jp, kp;
	real Cf1, Cf2, CG1, CG2;
	real temp;

	cal_feqf_new(f_eq, f1, sigma);
	cal_p(p, f1, f_eq);

	streaming(f1,f2);
	if(particle_on!=0)p_bc(f1,f2);
	
	for(i=0;i<Nx;i++){
	    for(j=0;j<Ny;j++){
	    	for(k=0;k<Nz;k++){
				for(ii=0;ii<15;ii++) {
					Cf[i][j][k][ii] = - itau_f * (f1[i][j][k][ii] - f_eq[i][j][k][ii]) + p[i][j][k][ii];
					ip = i + e[ii][0];
					jp = j + e[ii][1];
					kp = k + e[ii][2];					
					if ( ((kp>=0 && kp <Nz) || wall_on==0) && (particle_on==0 || particle_on !=0 && link_point2[i][j][k][ii]==0) ) {
						if (ip >= Nx) {
							ip -= Nx;
						} else if (ip<0) {
							ip += Nx;
						}
						if (jp >= Ny) {
							jp -= Ny;
						} else if (jp<0) {
							jp += Ny;
						}
						jj = ii;
					}
					else {
						ip = i;
						jp = j;
						kp = k;
						jj = bounce(ii);
					}
					f2[ip][jp][kp][jj] += dt * Cf[i][j][k][ii] ;
					
				}
			}
		}
	}

	cal_rho(Rho,f2);
	cal_u(u,f2);
	cal_sigma(Q0);
	cal_feqf_new(f_eq,f2,sigma);
	cal_p(p,f2,f_eq);

	for(k=0;k<Nz;k++){
		for(i=0;i<Nx;i++){
		    for(j=0;j<Ny;j++){
				for(ii=0;ii<15;ii++) {
					ip = i + e[ii][0];
					jp = j + e[ii][1];
					kp = k + e[ii][2];
					if ( ((kp>=0 && kp <Nz) || wall_on==0) && (particle_on==0 || particle_on !=0 && link_point2[i][j][k][ii]==0) ) {
						if (ip >= Nx) {
							ip -= Nx;
						} else if (ip<0) {
							ip += Nx;
						}
						if (jp >= Ny) {
							jp -= Ny;
						} else if (jp<0) {
							jp += Ny;
						}
						jj = ii;
					}
					else {
						ip = i;
						jp = j;
						kp = k;
						jj = bounce(ii);
					}
					Cf1 = Cf[i][j][k][ii];
					Cf2 = - itau_f * (f2[ip][jp][kp][jj] - f_eq[ip][jp][kp][jj]) + p[ip][jp][kp][jj];
					f1[i][j][k][ii] = f1[i][j][k][ii] + dt * 0.5 * (Cf1 + Cf2);
				}
			}
		}
	}


	streaming(f1,f2);
	if(particle_on!=0)p_bc(f1,f2);

	cal_rho(Rho,f2);
	cal_u(u, f2);
//	cal_W(u);
//	cal_sigma();
}