Exemplo n.º 1
0
//----------------------- RefPropSPthPH -----------------------------
// dv_dP = v/P * dlog10(v)_dlog10(P)
// A constant added to y does not propagate through the derivative.
double RefPropSPthPH::dy_dx1(int prop,double P,double h) 
{
#ifdef REFPROP_LOG10_2D
	double y,dydx1,dydx2;
	Evaluate_y_dy(prop,IN1(P),IN2(h),2,&y,&dydx1,&dydx2);
	return pow(10,y)/P*dydx1;
#else
	return 1e-3*Evaluate_dydx1(prop,IN1(P),IN2(h));
#endif
}
Exemplo n.º 2
0
// dv_dh = v/(h+1e6) * dlog10(v)_dlog10(h+1e6)
// A constant added to y does not propagate through the derivative.
double RefPropSPthPH::dy_dx2(int prop,double P,double h) 
{
#ifdef REFPROP_LOG10_2D
	double y,dydx1,dydx2;
	Evaluate_y_dy(prop,IN1(P),IN2(h),3,&y,&dydx1,&dydx2);
	return pow(10,y)/(h+1e6)*dydx2;
#else
	return Evaluate_dydx2(prop,IN1(P),IN2(h));
#endif
}
Exemplo n.º 3
0
double RefPropSPthPH::T(double P,double h)
{
	double T = OUT_T(Evaluate_y(0,IN1(P),IN2(h)));
	if(errorLog.IsError()) {
		char str[128];
		sprintf(str,"T(P=%lf,h=%lf)=%lf (%s)",P,h,T,filename);
		errorLog.Add("RefPropSPthPH::T",str);
		return 0;
	}
	return T;
}
Exemplo n.º 4
0
void RefPropSPthPH::rhoPlusDerivatives(double P,double h,double* rho,double* drho_dP,double* drho_dh)
{
	Evaluate_y_dy(4,IN1(P),IN2(h),3,rho,drho_dP,drho_dh);
	if(errorLog.IsError()) {
		char str[128];
		sprintf(str,"rhoPlusDerivatives(P=%lf,h=%lf) (%s)",P,h,filename);
		errorLog.Add("RefPropSPthPH::rhoPlusDerivatives",str);
	}
	printf("drho_dP=%le,drho_dh=%le\n",*drho_dP,*drho_dh);
#ifdef REFPROP_LOG10_2D
	(*drho_dP) *= pow(10,*rho)/P;
	(*drho_dh) *= pow(10,*rho)/(h+1e6);
	(*rho) = OUT(*rho);
#else
	(*drho_dP) *= 1e-3;
#endif
}
Exemplo n.º 5
0
void FB_ADD_INT::alg_REQ(void){
OUT() = static_cast<TForteInt16>(IN1()+IN2());
}
Exemplo n.º 6
0
static inline int
NCR5380_pread(struct Scsi_Host *instance, unsigned char *addr, int len)
{
  int *ctrl = &((struct NCR5380_hostdata *)instance->hostdata)->ctrl;
  int oldctrl = *ctrl;
  unsigned long *laddr;
#ifdef NOT_EFFICIENT
  int iobase = instance->io_port;
  int dma_io = iobase & ~(0x3C0000>>2);
#else
  volatile unsigned char *iobase = (unsigned char *)ioaddr(instance->io_port);
  volatile unsigned char *dma_io = (unsigned char *)((int)iobase & ~0x3C0000);
#endif

  if(!len) return 0;

  CTRL(iobase, 0x00);
  laddr = (unsigned long *)addr;
  while(len >= 32)
  {
    int status;
    status = STAT(iobase);
    if(status & 0x80)
      goto end;
    if(!(status & 0x40))
      continue;
    *laddr++ = IN2(dma_io)|(IN2(dma_io)<<16);
    *laddr++ = IN2(dma_io)|(IN2(dma_io)<<16);
    *laddr++ = IN2(dma_io)|(IN2(dma_io)<<16);
    *laddr++ = IN2(dma_io)|(IN2(dma_io)<<16);
    *laddr++ = IN2(dma_io)|(IN2(dma_io)<<16);
    *laddr++ = IN2(dma_io)|(IN2(dma_io)<<16);
    *laddr++ = IN2(dma_io)|(IN2(dma_io)<<16);
    *laddr++ = IN2(dma_io)|(IN2(dma_io)<<16);
    len -= 32;
    if(len == 0)
      break;
  }

  addr = (unsigned char *)laddr;
  CTRL(iobase, 0x10);
  while(len > 0)
  {
    int status;
    status = STAT(iobase);
    if(status & 0x80)
      goto end;
    if(status & 0x40)
    {
      *addr++ = IN(dma_io);
      if(--len == 0)
        break;
    }

    status = STAT(iobase);
    if(status & 0x80)
      goto end;
    if(status & 0x40)
    {
      *addr++ = IN(dma_io);
      if(--len == 0)
        break;
    }
  }
end:
  CTRL(iobase, oldctrl|0x40);
  return len;
}
Exemplo n.º 7
0
void FORTE_F_ADD_TOD_TIME::executeEvent(int pa_nEIID){
  if(scm_nEventREQID == pa_nEIID){
    OUT() = ADD_TOD_TIME(IN1(), IN2());
    sendOutputEvent(scm_nEventCNFID);
  }
}
Exemplo n.º 8
0
void FB_MUL_REAL::alg_REQ(void){
OUT() = IN1()*IN2();
}
Exemplo n.º 9
0
void FORTE_F_SUB_DATE_DATE::executeEvent(int pa_nEIID){
  if(scm_nEventREQID == pa_nEIID){
    OUT() = SUB_DATE_DATE(IN1(), IN2());
    sendOutputEvent(scm_nEventCNFID);
  }
}
Exemplo n.º 10
0
void wilson_dslash_trick(double *outf, double *in0, double *in1, double *in2, double *in3, 
			 double sign, int accum)
{
  int c;

  if(accum == 0) {
    for(c=0;c<3;c++){
      /* trick into spin component 0*/
      OUTF(0,c,0) =          IN0(0,c,0) + IN1(0,c,0) + IN2(0,c,0) + IN3(0,c,0);
      OUTF(1,c,0) =          IN0(1,c,0) + IN1(1,c,0) + IN2(1,c,0) + IN3(1,c,0); 
      
      /* trick into spin component 1*/
      OUTF(0,c,1) =          IN0(0,c,1) + IN1(0,c,1) + IN2(0,c,1) + IN3(0,c,1); 
      OUTF(1,c,1) =          IN0(1,c,1) + IN1(1,c,1) + IN2(1,c,1) + IN3(1,c,1); 
      
      /* trick into spin component 2*/
      OUTF(0,c,2) = sign * ( IN0(1,c,1) + IN1(0,c,1) + IN2(1,c,0) + IN3(0,c,0) );
      OUTF(1,c,2) = sign * (-IN0(0,c,1) + IN1(1,c,1) - IN2(0,c,0) + IN3(1,c,0) );
      
      /* trick into spin component 3*/
      OUTF(0,c,3) = sign * ( IN0(1,c,0) - IN1(0,c,0) - IN2(1,c,1) + IN3(0,c,1) );
      OUTF(1,c,3) = sign * (-IN0(0,c,0) - IN1(1,c,0) + IN2(0,c,1) + IN3(1,c,1) );
    }

  } else {
    for(c=0;c<3;c++){
      /* trick and accumulate into spin component 0*/
      OUTF(0,c,0) = OUTF(0,c,0) +          IN0(0,c,0) + IN1(0,c,0) + IN2(0,c,0) + IN3(0,c,0);
      OUTF(1,c,0) = OUTF(1,c,0) +          IN0(1,c,0) + IN1(1,c,0) + IN2(1,c,0) + IN3(1,c,0); 
      
      /* trick and accumulate into spin component 1*/
      OUTF(0,c,1) = OUTF(0,c,1) +          IN0(0,c,1) + IN1(0,c,1) + IN2(0,c,1) + IN3(0,c,1); 
      OUTF(1,c,1) = OUTF(1,c,1) +          IN0(1,c,1) + IN1(1,c,1) + IN2(1,c,1) + IN3(1,c,1); 
      
      /* trick and accumulate into spin component 2*/
      OUTF(0,c,2) = OUTF(0,c,2) + sign * ( IN0(1,c,1) + IN1(0,c,1) + IN2(1,c,0) + IN3(0,c,0) );
      OUTF(1,c,2) = OUTF(1,c,2) + sign * (-IN0(0,c,1) + IN1(1,c,1) - IN2(0,c,0) + IN3(1,c,0) );
      
      /* trick and accumulate into spin component 3*/
      OUTF(0,c,3) = OUTF(0,c,3) + sign * ( IN0(1,c,0) - IN1(0,c,0) - IN2(1,c,1) + IN3(0,c,1) );
      OUTF(1,c,3) = OUTF(1,c,3) + sign * (-IN0(0,c,0) - IN1(1,c,0) + IN2(0,c,1) + IN3(1,c,1) );
    }

  }

}
Exemplo n.º 11
0
void FB_ADD_LREAL::alg_REQ(void){
OUT() = IN1()+IN2();
}