Exemple #1
0
//returns unLog10
__device__ double bilinInterpVal(double* interpMat, double y, double z, int energyBin, double* tempGrid, double* metalGrid, constants theConst){
	int y1, y2, z1, z2;
	double temp1, temp2, R1, R2, interpValue; 
	double ten11, ten12, ten21, ten22;
	double y1val, y2val, z1val, z2val;
	int nx = theConst.binCenterSize; 
	int ny = theConst.tGridSize;
	int nz = theConst.mGridSize;
	
	y1 = getLowerIndex(tempGrid, __powf(10,y), theConst.tGridSize);
	y2 = y1+1;
	z1 = getLowerIndex(metalGrid, __powf(10,z), theConst.mGridSize);
	z2 = z1+1;

	y1val = tempGrid[y1];
	y2val = tempGrid[y2];
	z1val = metalGrid[z1];
	z2val = metalGrid[z2];
	y = __powf(10,y);
    z = __powf(10,z);
	temp1 = (y2val-y)/(y2val-y1val);
	temp2 = (y-y1val)/(y2val-y1val);
	ten11 = __powf(10,tenRetrieve(interpMat, nx, ny, nz, energyBin, y1, z1));
	ten21 = __powf(10,tenRetrieve(interpMat, nx, ny, nz, energyBin, y2, z1));
	ten12 = __powf(10,tenRetrieve(interpMat, nx, ny, nz, energyBin, y1, z2));
	ten22 = __powf(10,tenRetrieve(interpMat, nx, ny, nz, energyBin, y2, z2));
	R1 = temp1*ten11 + temp2*ten21;
	R2 = temp1*ten12 + temp2*ten22;
	interpValue = ((z2val-z)/(z2val-z1val))*R1 + ((z-z1val)/(z2val-z1val))*R2;
	
	return interpValue;
}
Exemple #2
0
int second_tree(int inU[7], int inS[7], int inZ[7], struct node **head,
                solution *US)
{
  int late_index[7], outZ[7]; //zero case variables
  int i[7]; //index variable
  int u[7], v[7], s[7];
  getLateIndices(late_index, inZ, 17);
  int matrix[7][4];
  solution *VS = malloc(sizeof(solution));
  init_level(VS);
  int branches = 0;
  int vc = 0, l2c = 0, pc = 0;
  for (i[0] = 0; i[0] < 5; i[0]++)
  {//open loop 0
    tree2(0, i[0], matrix, inZ, outZ, inU, inS, u, s, v);
    for (i[1] = 0; i[1] < 5; i[1]++)
    {//open loop 1
      tree2(1, i[1], matrix, inZ, outZ, inU, inS, u, s, v);
      for (i[2] = 0; i[2] < 5; i[2]++)
      {//open loop 2
        tree2(2, i[2], matrix, inZ, outZ, inU, inS, u, s, v);
        for (i[3] = 0; i[3] < 5; i[3]++)
        {//open loop 3
          tree2(3, i[3], matrix, inZ, outZ, inU, inS, u, s, v);
          for (i[4] = 0; i[4] < late_index[4]; i[4]++)
          {//open loop 3
            tree2(4, i[4], matrix, inZ, outZ, inU, inS, u, s, v);
            for (i[5] = getLowerIndex(i[4], inZ, 5);
                 i[5] < late_index[5]; i[5]++)
            {//open loop 3
              tree2(5, i[5], matrix, inZ, outZ, inU, inS, u, s, v);
              for (i[6] = getLowerIndex(i[5], inZ, 6);
                   i[6] < late_index[6]; i[6]++)
              {//open loop 3
                tree2(6, i[6], matrix, inZ, outZ, inU, inS, u, s, v);
                vc = vCheck(v);
                l2c = levelTWOcheck(matrix);
                if (l2c) {
                  pc = prunecheck(US, VS, matrix, 1);
                  if (pc) {
                    branches++;
                    third_tree(u, v, s, outZ, VS, US, head);
                  }
                }
              }//close loop 6
            }//close loop 5
          }//close loop 4
        }//close loop 3
      }//close loop 2
    }//close loop 1
  }//close loop 0
  free(VS);
  return branches;
}