fork download
  1. Boolean HitTumBoundary(PhotonStruct * Photon_Ptr,
  2. InputStruct * In_Ptr)
  3. {
  4. short layer = Photon_Ptr->layer;
  5. double ux = Photon_Ptr->ux;
  6. double uy = Photon_Ptr->uy;
  7. double uz = Photon_Ptr->uz;
  8. double x0 = Photon_Ptr->x;
  9. double y0 = Photon_Ptr->y;
  10. double z0 = Photon_Ptr->z;
  11. double x1 = 0;
  12. double y1 = 0;
  13. double z1 = Photon_Ptr->z;
  14. //double z1 = In_Ptr->tz;
  15. double rt = In_Ptr->rtum;
  16. double a, b, c, mut;
  17. double dl_b;
  18. double L1,L2;
  19. double t, lr, zz1, zz2;
  20. double zb1 = In_Ptr->layerspecs[In_Ptr->ntum].z0;
  21. double zb2 = In_Ptr->tz;
  22. double rr = sqrt(x0*x0+y0*y0);
  23. //double mut;
  24. Boolean hit;
  25. /* Distance to the boundary. */
  26. t=((x1-x0)*ux+(y1-y0)*uy); //the length of vector(x1-x0),(y1-y0),(z1-z0) projects onto the photon packet trajectory
  27. lr=sqrt((x0-x1)*(x0-x1)+2*(x0-x1)*ux*t+ux*ux*t*t //distance from the tumor center to the photon packet trajectory
  28. +(y0-y1)*(y0-y1)+2*(y0-y1)*uy*t+uy*uy*t*t
  29. +(z0-z1)*(z0-z1)+2*(z0-z1)*uz*t+uz*uz*t*t);
  30.  
  31.  
  32.  
  33.  
  34. a=ux*ux+uy*uy; //(x+L*ux)^2+(y+L*uy)^2=rsb^2
  35. b=2*x0*ux+2*y0*uy;
  36. c=x0*x0+y0*y0-rt*rt;
  37. //u1if(a!=1.0)printf("a=%lf\n",a);//yk 20130225
  38. if(a!=0 && b*b-4*a*c>=0){
  39. L1=(-b+sqrt(b*b-4*a*c))/(2*a); //length of the photon position to the boundary
  40. L2=(-b-sqrt(b*b-4*a*c))/(2*a); //length of the photon position to the boundary
  41. }else{
  42. L1=0; //length of the photon position to the boundary
  43. L2=0; //length of the photon position to the boundary
  44. }
  45. zz1 = z0+L1*uz;
  46. zz2 = z0+L2*uz;
  47. if(Photon_Ptr->layer == In_Ptr->num_layers+1 && lr<rt && lr>0 && uz != 0.0 && Photon_Ptr->s > L1 && zz1>In_Ptr->layerspecs[In_Ptr->ntum].z0 && L1>0){//在tumor內
  48.  
  49.  
  50. mut = In_Ptr->tmua //yk 20130223
  51. + In_Ptr->tmus;
  52.  
  53. Photon_Ptr->sleft = (Photon_Ptr->s - L1)*mut;
  54. Photon_Ptr->s = L1;
  55. if(L1<0) printf("L1=%lf\n",L1);//yk 20130225
  56. //if(Photon_Ptr->s<0) printf("s1=%lf\n",Photon_Ptr->s);//yk 20130225
  57. Photon_Ptr->hitsideboundary = 1;
  58. hit = 1;
  59.  
  60. //printf("hit1=%d\n",hit);//yk 20130305
  61. }
  62. else if(Photon_Ptr->layer == In_Ptr->ntum && lr<rt && lr>0 &&uz != 0.0 && Photon_Ptr->s > L2 && zz2<In_Ptr->tz && zz2>In_Ptr->layerspecs[In_Ptr->ntum].z0 && L2>0){//在tumor外
  63.  
  64.  
  65. mut = In_Ptr->layerspecs[layer].mua //yk 20130223
  66. + In_Ptr->layerspecs[layer].mus;
  67.  
  68. Photon_Ptr->sleft = (Photon_Ptr->s - L2)*mut;
  69. Photon_Ptr->s = L2;
  70. if(L2<0) printf("L2=%lf\n",L2);//yk 20130225
  71.  
  72. //if(Photon_Ptr->s<0) printf("s2=%lf\n",Photon_Ptr->s);//yk 20130225
  73. Photon_Ptr->hitsideboundary = 1;
  74. hit = 1;
  75.  
  76.  
  77. }
  78. else{
  79. hit = 0;
  80. Photon_Ptr->hitsideboundary = 0;
  81. }
  82.  
  83. return(hit);
  84. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:1:1: error: ‘Boolean’ does not name a type
stdout
Standard output is empty