catsim-test 0.0.5__cp313-cp313-manylinux_2_31_x86_64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (1235) hide show
  1. catsim_test-0.0.5.dist-info/METADATA +5 -0
  2. catsim_test-0.0.5.dist-info/RECORD +1235 -0
  3. catsim_test-0.0.5.dist-info/WHEEL +5 -0
  4. catsim_test-0.0.5.dist-info/licenses/LICENSE +29 -0
  5. catsim_test-0.0.5.dist-info/sboms/auditwheel.cdx.json +1 -0
  6. catsim_test-0.0.5.dist-info/top_level.txt +2 -0
  7. catsim_test.libs/libgomp-98b21ff3.so.1.0.0 +0 -0
  8. dummy.cpython-313-x86_64-linux-gnu.so +0 -0
  9. gecatsim/__init__.py +20 -0
  10. gecatsim/bowtie/large.txt +891 -0
  11. gecatsim/bowtie/medium.txt +891 -0
  12. gecatsim/bowtie/small.txt +891 -0
  13. gecatsim/cfg/Phantom_Default.cfg +7 -0
  14. gecatsim/cfg/Physics_Default.cfg +38 -0
  15. gecatsim/cfg/Protocol_Default.cfg +33 -0
  16. gecatsim/cfg/Recon_Default.cfg +22 -0
  17. gecatsim/cfg/Scanner_Default.cfg +31 -0
  18. gecatsim/clib_build/BuildLinux64 +6 -0
  19. gecatsim/clib_build/BuildWin64.bat +17 -0
  20. gecatsim/clib_build/MakeMacOS +48 -0
  21. gecatsim/clib_build/MakeVariables_1 +19 -0
  22. gecatsim/clib_build/MakeVariables_2 +5 -0
  23. gecatsim/clib_build/MakeVariables_3 +33 -0
  24. gecatsim/clib_build/MakeVariables_3.1 +32 -0
  25. gecatsim/clib_build/MakeWindows64 +45 -0
  26. gecatsim/clib_build/Makefile +41 -0
  27. gecatsim/clib_build/readme.md +13 -0
  28. gecatsim/clib_build/src/BaseObject.cpp +144 -0
  29. gecatsim/clib_build/src/BaseObject.h +74 -0
  30. gecatsim/clib_build/src/ClipPlane.cpp +83 -0
  31. gecatsim/clib_build/src/ClipPlane.h +28 -0
  32. gecatsim/clib_build/src/CrossSection.cpp +179 -0
  33. gecatsim/clib_build/src/CrossSection.hpp +27 -0
  34. gecatsim/clib_build/src/CrossSectionHandler.cpp +160 -0
  35. gecatsim/clib_build/src/CrossSectionHandler.hpp +72 -0
  36. gecatsim/clib_build/src/Cube.cpp +144 -0
  37. gecatsim/clib_build/src/Cube.h +26 -0
  38. gecatsim/clib_build/src/Cylinder.cpp +156 -0
  39. gecatsim/clib_build/src/Cylinder.h +25 -0
  40. gecatsim/clib_build/src/DD2Back.c +332 -0
  41. gecatsim/clib_build/src/DD2ParProj.c +377 -0
  42. gecatsim/clib_build/src/DD2Proj.c +333 -0
  43. gecatsim/clib_build/src/DD2WBack.c +350 -0
  44. gecatsim/clib_build/src/DD3.hpp +423 -0
  45. gecatsim/clib_build/src/DD3Proj.cpp +519 -0
  46. gecatsim/clib_build/src/DD3Proj_roi_notrans_mm.cpp +585 -0
  47. gecatsim/clib_build/src/DD3WBack.c +491 -0
  48. gecatsim/clib_build/src/DD3_roi_notrans_mm.hpp +272 -0
  49. gecatsim/clib_build/src/Detector.cpp +389 -0
  50. gecatsim/clib_build/src/Detector.hpp +134 -0
  51. gecatsim/clib_build/src/Interpolate.cpp +58 -0
  52. gecatsim/clib_build/src/Intersection.cpp +198 -0
  53. gecatsim/clib_build/src/Intersection.h +36 -0
  54. gecatsim/clib_build/src/MatVec.cpp +262 -0
  55. gecatsim/clib_build/src/MatVec.h +68 -0
  56. gecatsim/clib_build/src/Objects.cpp +23 -0
  57. gecatsim/clib_build/src/Objects.hpp +90 -0
  58. gecatsim/clib_build/src/Phantom.cpp +169 -0
  59. gecatsim/clib_build/src/Phantom.hpp +43 -0
  60. gecatsim/clib_build/src/Photon.cpp +168 -0
  61. gecatsim/clib_build/src/Photon.hpp +56 -0
  62. gecatsim/clib_build/src/RD3Back.cpp +357 -0
  63. gecatsim/clib_build/src/RD3Intersections.cpp +154 -0
  64. gecatsim/clib_build/src/RD3bench.cpp +505 -0
  65. gecatsim/clib_build/src/Sphere.cpp +43 -0
  66. gecatsim/clib_build/src/Sphere.h +25 -0
  67. gecatsim/clib_build/src/Transformation.cpp +104 -0
  68. gecatsim/clib_build/src/Transformation.h +37 -0
  69. gecatsim/clib_build/src/TreePhantom.cpp +138 -0
  70. gecatsim/clib_build/src/TreePhantom.h +27 -0
  71. gecatsim/clib_build/src/Volume.cpp +101 -0
  72. gecatsim/clib_build/src/Volume.hpp +28 -0
  73. gecatsim/clib_build/src/analytic_projector.c +2433 -0
  74. gecatsim/clib_build/src/analytic_projector.h +235 -0
  75. gecatsim/clib_build/src/compt.cpp +400 -0
  76. gecatsim/clib_build/src/compt2.cpp +558 -0
  77. gecatsim/clib_build/src/compt3.cpp +607 -0
  78. gecatsim/clib_build/src/ct_nurbs.h +214 -0
  79. gecatsim/clib_build/src/extractsino.c +42 -0
  80. gecatsim/clib_build/src/fm_gethostid.c +23 -0
  81. gecatsim/clib_build/src/fm_getrandpid.c +31 -0
  82. gecatsim/clib_build/src/gemsfilt.c +1084 -0
  83. gecatsim/clib_build/src/getMemorySize.cpp +105 -0
  84. gecatsim/clib_build/src/getMemorySize.h +5 -0
  85. gecatsim/clib_build/src/hull2.c +77 -0
  86. gecatsim/clib_build/src/intersections.c +131 -0
  87. gecatsim/clib_build/src/label.h +10 -0
  88. gecatsim/clib_build/src/main.cpp +609 -0
  89. gecatsim/clib_build/src/make_volume.c +573 -0
  90. gecatsim/clib_build/src/nCAT_main.c +6343 -0
  91. gecatsim/clib_build/src/negative_log.cpp +233 -0
  92. gecatsim/clib_build/src/negative_log.h +23 -0
  93. gecatsim/clib_build/src/pd2dbpcurved.c +98 -0
  94. gecatsim/clib_build/src/pd2dbpflat.c +101 -0
  95. gecatsim/clib_build/src/pd3dbpsemi.c +177 -0
  96. gecatsim/clib_build/src/phantom.l +72 -0
  97. gecatsim/clib_build/src/phantom.lex.c +1770 -0
  98. gecatsim/clib_build/src/phantom.tab.cpp +2126 -0
  99. gecatsim/clib_build/src/phantom.tab.hpp +126 -0
  100. gecatsim/clib_build/src/phantom.y +624 -0
  101. gecatsim/clib_build/src/rndpoi.c +793 -0
  102. gecatsim/clib_build/src/spline.c +81 -0
  103. gecatsim/clib_build/src/spline.h +6 -0
  104. gecatsim/clib_build/src/timer.c +64 -0
  105. gecatsim/clib_build/src/viewshift.c +25 -0
  106. gecatsim/clib_build/src/voxelized_projector.cpp +683 -0
  107. gecatsim/clib_build/src/xybowtie.c +76 -0
  108. gecatsim/dose/data/dosereconkernel_mthd4.mat +0 -0
  109. gecatsim/dose/data/scatter_E_loss_fraction.mat +0 -0
  110. gecatsim/dose/data/weighted_scatter_energy_by_spec.mat +0 -0
  111. gecatsim/dose/examples/dose_doserecon.cfg +16 -0
  112. gecatsim/dose/examples/dose_phantom.cfg +6 -0
  113. gecatsim/dose/examples/dose_physics.cfg +18 -0
  114. gecatsim/dose/examples/dose_protocol.cfg +15 -0
  115. gecatsim/dose/examples/dose_recon.cfg +9 -0
  116. gecatsim/dose/examples/dose_scanner.cfg +29 -0
  117. gecatsim/dose/examples/run.py +37 -0
  118. gecatsim/dose/lib/Dose_Recon_Library_Linux64.so +0 -0
  119. gecatsim/dose/lib/Dose_Recon_Library_Windows64.dll +0 -0
  120. gecatsim/dose/pyfiles/C_DD3Dose.py +84 -0
  121. gecatsim/dose/pyfiles/Combine_Spectrum_Bowtie_FlatFilter.py +15 -0
  122. gecatsim/dose/pyfiles/DoseConv.py +87 -0
  123. gecatsim/dose/pyfiles/GetMuByProcess.py +57 -0
  124. gecatsim/dose/pyfiles/__init__.py +0 -0
  125. gecatsim/dose/pyfiles/brconvol_matlab.py +67 -0
  126. gecatsim/dose/pyfiles/calcDetectorFlux.py +54 -0
  127. gecatsim/dose/pyfiles/catdoserecon.py +225 -0
  128. gecatsim/dose/pyfiles/doseconvol.py +52 -0
  129. gecatsim/dose/pyfiles/get_voxel_stopping_power.py +35 -0
  130. gecatsim/dose/pyfiles/img2vol.py +57 -0
  131. gecatsim/dose/pyfiles/xyfovimg.py +30 -0
  132. gecatsim/dose/readme.md +4 -0
  133. gecatsim/dose/src/DD3.hpp +371 -0
  134. gecatsim/dose/src/DD3Dose.cpp +787 -0
  135. gecatsim/dose/src/DD3Dose.hpp +22 -0
  136. gecatsim/dose/src/DD3Dose.i +23 -0
  137. gecatsim/dose/src/DD3Energy_clean.cpp +1464 -0
  138. gecatsim/dose/src/DD3Proj.cpp +504 -0
  139. gecatsim/dose/src/DD3Proj.hpp +20 -0
  140. gecatsim/dose/src/DD3Proj_mm.cpp +561 -0
  141. gecatsim/dose/src/DD3Proj_mm.hpp +21 -0
  142. gecatsim/dose/src/Win32_Build.bat +17 -0
  143. gecatsim/dose/src/Win64_Build.bat +20 -0
  144. gecatsim/examples/Catvoxel_Sample.py +53 -0
  145. gecatsim/examples/DD3Proj_mm_Sample.py +60 -0
  146. gecatsim/examples/GetMu_Sample.py +24 -0
  147. gecatsim/examples/Sim_Recon_Sample.py +45 -0
  148. gecatsim/examples/Sim_Recon_Sample_PCCT.py +69 -0
  149. gecatsim/examples/Sim_Sample.py +32 -0
  150. gecatsim/examples/Sim_Sample_Analyic.py +44 -0
  151. gecatsim/examples/Sim_Sample_Helical.py +32 -0
  152. gecatsim/examples/Sim_Sample_Hybrid.py +42 -0
  153. gecatsim/examples/Sim_Sample_PCCT.py +72 -0
  154. gecatsim/examples/Sim_Sample_Polygonal.py +47 -0
  155. gecatsim/examples/Sim_Sample_Scatter.py +38 -0
  156. gecatsim/examples/Sim_Sample_XCAT.py +50 -0
  157. gecatsim/examples/cfg/Phantom_Sample.cfg +6 -0
  158. gecatsim/examples/cfg/Phantom_Sample_Analytic.cfg +6 -0
  159. gecatsim/examples/cfg/Phantom_Sample_Hybrid.cfg +7 -0
  160. gecatsim/examples/cfg/Phantom_Sample_Polygonal.cfg +6 -0
  161. gecatsim/examples/cfg/Phantom_Sample_XCAT.cfg +6 -0
  162. gecatsim/examples/cfg/Physics_Sample.cfg +41 -0
  163. gecatsim/examples/cfg/Protocol_Sample_Helical.cfg +33 -0
  164. gecatsim/examples/cfg/Protocol_Sample_axial.cfg +33 -0
  165. gecatsim/examples/cfg/Recon_Sample_2d.cfg +6 -0
  166. gecatsim/examples/cfg/Recon_Sample_Helical.cfg +8 -0
  167. gecatsim/examples/cfg/Scanner_PCCT.cfg +30 -0
  168. gecatsim/examples/cfg/Scanner_Sample_generic.cfg +29 -0
  169. gecatsim/examples/vct_examples/Phantom_Sample_Analytic.cfg +6 -0
  170. gecatsim/examples/vct_examples/Physics_Sample.cfg +41 -0
  171. gecatsim/examples/vct_examples/Protocol_Sample_axial.cfg +33 -0
  172. gecatsim/examples/vct_examples/Recon_Sample_2d.cfg +6 -0
  173. gecatsim/examples/vct_examples/Scanner_Sample_generic.cfg +31 -0
  174. gecatsim/examples/vct_examples/read.md +1 -0
  175. gecatsim/focal_spot/readme.md +31 -0
  176. gecatsim/focal_spot/vct_large_fs.npz +0 -0
  177. gecatsim/focal_spot/vct_small_fs.npz +0 -0
  178. gecatsim/lib/libcatsim.so +0 -0
  179. gecatsim/lib/libcatsim64.dll +0 -0
  180. gecatsim/lib/libcatsim_macos.so +0 -0
  181. gecatsim/lib/pthreadGC2_x64.dll +0 -0
  182. gecatsim/lib/pthreads-2-9-1-release.zip +0 -0
  183. gecatsim/material/Ac +11 -0
  184. gecatsim/material/Ag +11 -0
  185. gecatsim/material/Al +11 -0
  186. gecatsim/material/Ar +11 -0
  187. gecatsim/material/As +11 -0
  188. gecatsim/material/At +11 -0
  189. gecatsim/material/Au +11 -0
  190. gecatsim/material/B +11 -0
  191. gecatsim/material/Ba +11 -0
  192. gecatsim/material/Be +11 -0
  193. gecatsim/material/Bi +11 -0
  194. gecatsim/material/Br +11 -0
  195. gecatsim/material/C +11 -0
  196. gecatsim/material/CIRS_adipose_adult2 +20 -0
  197. gecatsim/material/CIRS_adipose_adult3 +20 -0
  198. gecatsim/material/CIRS_bone_10yo +21 -0
  199. gecatsim/material/CIRS_bone_1yo +21 -0
  200. gecatsim/material/CIRS_bone_5yo +21 -0
  201. gecatsim/material/CIRS_bone_adult_and_15yo +21 -0
  202. gecatsim/material/CIRS_bone_newborn +21 -0
  203. gecatsim/material/CIRS_liver_adult +20 -0
  204. gecatsim/material/CIRS_lung_inhale +20 -0
  205. gecatsim/material/CIRS_plastic_water_LR +20 -0
  206. gecatsim/material/CIRS_spinal_cord +20 -0
  207. gecatsim/material/CZT +5 -0
  208. gecatsim/material/Ca +11 -0
  209. gecatsim/material/Cd +11 -0
  210. gecatsim/material/Ce +11 -0
  211. gecatsim/material/Cl +11 -0
  212. gecatsim/material/Co +11 -0
  213. gecatsim/material/Copyright.txt +7 -0
  214. gecatsim/material/Cr +11 -0
  215. gecatsim/material/Cs +11 -0
  216. gecatsim/material/CsI +16 -0
  217. gecatsim/material/Cu +11 -0
  218. gecatsim/material/Dy +11 -0
  219. gecatsim/material/Er +11 -0
  220. gecatsim/material/Eu +11 -0
  221. gecatsim/material/F +11 -0
  222. gecatsim/material/Fe +11 -0
  223. gecatsim/material/Fr +11 -0
  224. gecatsim/material/GOS +19 -0
  225. gecatsim/material/Ga +11 -0
  226. gecatsim/material/Gd +11 -0
  227. gecatsim/material/Ge +11 -0
  228. gecatsim/material/H +11 -0
  229. gecatsim/material/He +11 -0
  230. gecatsim/material/Hf +11 -0
  231. gecatsim/material/Hg +11 -0
  232. gecatsim/material/Ho +11 -0
  233. gecatsim/material/I +11 -0
  234. gecatsim/material/ICRU_adipose_adult2 +21 -0
  235. gecatsim/material/ICRU_blood_adult +24 -0
  236. gecatsim/material/ICRU_brain_adult +26 -0
  237. gecatsim/material/ICRU_breast_adult2 +22 -0
  238. gecatsim/material/ICRU_eye_lens_adult +22 -0
  239. gecatsim/material/ICRU_kidney_adult +24 -0
  240. gecatsim/material/ICRU_liver_adult +23 -0
  241. gecatsim/material/ICRU_lung_adult_healthy +23 -0
  242. gecatsim/material/ICRU_muscle_adult +23 -0
  243. gecatsim/material/ICRU_pancreas_adult +23 -0
  244. gecatsim/material/ICRU_skeleton_cortical_bone_adult +23 -0
  245. gecatsim/material/ICRU_skin_adult +23 -0
  246. gecatsim/material/ICRU_spleen_adult +23 -0
  247. gecatsim/material/ICRU_testis_adult +23 -0
  248. gecatsim/material/In +11 -0
  249. gecatsim/material/Ir +11 -0
  250. gecatsim/material/K +11 -0
  251. gecatsim/material/Kr +11 -0
  252. gecatsim/material/La +11 -0
  253. gecatsim/material/Li +11 -0
  254. gecatsim/material/Lu +11 -0
  255. gecatsim/material/Lumex +18 -0
  256. gecatsim/material/Mg +11 -0
  257. gecatsim/material/Mn +11 -0
  258. gecatsim/material/Mo +11 -0
  259. gecatsim/material/N +11 -0
  260. gecatsim/material/Na +11 -0
  261. gecatsim/material/NaCl +16 -0
  262. gecatsim/material/Nb +11 -0
  263. gecatsim/material/Nd +11 -0
  264. gecatsim/material/Ne +11 -0
  265. gecatsim/material/Ni +11 -0
  266. gecatsim/material/O +11 -0
  267. gecatsim/material/Os +11 -0
  268. gecatsim/material/P +11 -0
  269. gecatsim/material/PMMA +20 -0
  270. gecatsim/material/PVC_flexible +20 -0
  271. gecatsim/material/PVC_rigid +20 -0
  272. gecatsim/material/Pa +11 -0
  273. gecatsim/material/Pb +11 -0
  274. gecatsim/material/Pd +11 -0
  275. gecatsim/material/Pm +11 -0
  276. gecatsim/material/Po +11 -0
  277. gecatsim/material/Pr +11 -0
  278. gecatsim/material/Pt +11 -0
  279. gecatsim/material/Ra +11 -0
  280. gecatsim/material/Rb +11 -0
  281. gecatsim/material/Re +11 -0
  282. gecatsim/material/Rh +11 -0
  283. gecatsim/material/Rn +11 -0
  284. gecatsim/material/Ru +11 -0
  285. gecatsim/material/S +11 -0
  286. gecatsim/material/Sb +11 -0
  287. gecatsim/material/Sc +11 -0
  288. gecatsim/material/Se +11 -0
  289. gecatsim/material/Si +11 -0
  290. gecatsim/material/Sm +11 -0
  291. gecatsim/material/Sn +11 -0
  292. gecatsim/material/Sr +11 -0
  293. gecatsim/material/Ta +11 -0
  294. gecatsim/material/Tb +11 -0
  295. gecatsim/material/Tc +11 -0
  296. gecatsim/material/Te +11 -0
  297. gecatsim/material/Th +11 -0
  298. gecatsim/material/Ti +11 -0
  299. gecatsim/material/Tl +11 -0
  300. gecatsim/material/Tm +11 -0
  301. gecatsim/material/U +11 -0
  302. gecatsim/material/V +11 -0
  303. gecatsim/material/W +11 -0
  304. gecatsim/material/Xe +11 -0
  305. gecatsim/material/Y +11 -0
  306. gecatsim/material/Yb +11 -0
  307. gecatsim/material/Zn +11 -0
  308. gecatsim/material/Zr +11 -0
  309. gecatsim/material/air +24 -0
  310. gecatsim/material/bone +25 -0
  311. gecatsim/material/brass +18 -0
  312. gecatsim/material/diamond +13 -0
  313. gecatsim/material/edlp/comp/ce-cs-1.dat +124 -0
  314. gecatsim/material/edlp/comp/ce-cs-10.dat +124 -0
  315. gecatsim/material/edlp/comp/ce-cs-100.dat +124 -0
  316. gecatsim/material/edlp/comp/ce-cs-11.dat +124 -0
  317. gecatsim/material/edlp/comp/ce-cs-12.dat +124 -0
  318. gecatsim/material/edlp/comp/ce-cs-13.dat +124 -0
  319. gecatsim/material/edlp/comp/ce-cs-14.dat +124 -0
  320. gecatsim/material/edlp/comp/ce-cs-15.dat +124 -0
  321. gecatsim/material/edlp/comp/ce-cs-16.dat +124 -0
  322. gecatsim/material/edlp/comp/ce-cs-17.dat +124 -0
  323. gecatsim/material/edlp/comp/ce-cs-18.dat +124 -0
  324. gecatsim/material/edlp/comp/ce-cs-19.dat +124 -0
  325. gecatsim/material/edlp/comp/ce-cs-2.dat +124 -0
  326. gecatsim/material/edlp/comp/ce-cs-20.dat +124 -0
  327. gecatsim/material/edlp/comp/ce-cs-21.dat +124 -0
  328. gecatsim/material/edlp/comp/ce-cs-22.dat +124 -0
  329. gecatsim/material/edlp/comp/ce-cs-23.dat +124 -0
  330. gecatsim/material/edlp/comp/ce-cs-24.dat +124 -0
  331. gecatsim/material/edlp/comp/ce-cs-25.dat +124 -0
  332. gecatsim/material/edlp/comp/ce-cs-26.dat +124 -0
  333. gecatsim/material/edlp/comp/ce-cs-27.dat +124 -0
  334. gecatsim/material/edlp/comp/ce-cs-28.dat +124 -0
  335. gecatsim/material/edlp/comp/ce-cs-29.dat +124 -0
  336. gecatsim/material/edlp/comp/ce-cs-3.dat +124 -0
  337. gecatsim/material/edlp/comp/ce-cs-30.dat +124 -0
  338. gecatsim/material/edlp/comp/ce-cs-31.dat +124 -0
  339. gecatsim/material/edlp/comp/ce-cs-32.dat +124 -0
  340. gecatsim/material/edlp/comp/ce-cs-33.dat +124 -0
  341. gecatsim/material/edlp/comp/ce-cs-34.dat +124 -0
  342. gecatsim/material/edlp/comp/ce-cs-35.dat +124 -0
  343. gecatsim/material/edlp/comp/ce-cs-36.dat +124 -0
  344. gecatsim/material/edlp/comp/ce-cs-37.dat +124 -0
  345. gecatsim/material/edlp/comp/ce-cs-38.dat +124 -0
  346. gecatsim/material/edlp/comp/ce-cs-39.dat +124 -0
  347. gecatsim/material/edlp/comp/ce-cs-4.dat +124 -0
  348. gecatsim/material/edlp/comp/ce-cs-40.dat +124 -0
  349. gecatsim/material/edlp/comp/ce-cs-41.dat +124 -0
  350. gecatsim/material/edlp/comp/ce-cs-42.dat +124 -0
  351. gecatsim/material/edlp/comp/ce-cs-43.dat +124 -0
  352. gecatsim/material/edlp/comp/ce-cs-44.dat +124 -0
  353. gecatsim/material/edlp/comp/ce-cs-45.dat +124 -0
  354. gecatsim/material/edlp/comp/ce-cs-46.dat +124 -0
  355. gecatsim/material/edlp/comp/ce-cs-47.dat +124 -0
  356. gecatsim/material/edlp/comp/ce-cs-48.dat +124 -0
  357. gecatsim/material/edlp/comp/ce-cs-49.dat +124 -0
  358. gecatsim/material/edlp/comp/ce-cs-5.dat +124 -0
  359. gecatsim/material/edlp/comp/ce-cs-50.dat +124 -0
  360. gecatsim/material/edlp/comp/ce-cs-51.dat +124 -0
  361. gecatsim/material/edlp/comp/ce-cs-52.dat +124 -0
  362. gecatsim/material/edlp/comp/ce-cs-53.dat +124 -0
  363. gecatsim/material/edlp/comp/ce-cs-54.dat +124 -0
  364. gecatsim/material/edlp/comp/ce-cs-55.dat +124 -0
  365. gecatsim/material/edlp/comp/ce-cs-56.dat +124 -0
  366. gecatsim/material/edlp/comp/ce-cs-57.dat +124 -0
  367. gecatsim/material/edlp/comp/ce-cs-58.dat +124 -0
  368. gecatsim/material/edlp/comp/ce-cs-59.dat +124 -0
  369. gecatsim/material/edlp/comp/ce-cs-6.dat +124 -0
  370. gecatsim/material/edlp/comp/ce-cs-60.dat +124 -0
  371. gecatsim/material/edlp/comp/ce-cs-61.dat +124 -0
  372. gecatsim/material/edlp/comp/ce-cs-62.dat +124 -0
  373. gecatsim/material/edlp/comp/ce-cs-63.dat +124 -0
  374. gecatsim/material/edlp/comp/ce-cs-64.dat +124 -0
  375. gecatsim/material/edlp/comp/ce-cs-65.dat +124 -0
  376. gecatsim/material/edlp/comp/ce-cs-66.dat +124 -0
  377. gecatsim/material/edlp/comp/ce-cs-67.dat +124 -0
  378. gecatsim/material/edlp/comp/ce-cs-68.dat +124 -0
  379. gecatsim/material/edlp/comp/ce-cs-69.dat +124 -0
  380. gecatsim/material/edlp/comp/ce-cs-7.dat +124 -0
  381. gecatsim/material/edlp/comp/ce-cs-70.dat +124 -0
  382. gecatsim/material/edlp/comp/ce-cs-71.dat +124 -0
  383. gecatsim/material/edlp/comp/ce-cs-72.dat +124 -0
  384. gecatsim/material/edlp/comp/ce-cs-73.dat +124 -0
  385. gecatsim/material/edlp/comp/ce-cs-74.dat +124 -0
  386. gecatsim/material/edlp/comp/ce-cs-75.dat +124 -0
  387. gecatsim/material/edlp/comp/ce-cs-76.dat +124 -0
  388. gecatsim/material/edlp/comp/ce-cs-77.dat +124 -0
  389. gecatsim/material/edlp/comp/ce-cs-78.dat +124 -0
  390. gecatsim/material/edlp/comp/ce-cs-79.dat +124 -0
  391. gecatsim/material/edlp/comp/ce-cs-8.dat +124 -0
  392. gecatsim/material/edlp/comp/ce-cs-80.dat +124 -0
  393. gecatsim/material/edlp/comp/ce-cs-81.dat +124 -0
  394. gecatsim/material/edlp/comp/ce-cs-82.dat +124 -0
  395. gecatsim/material/edlp/comp/ce-cs-83.dat +124 -0
  396. gecatsim/material/edlp/comp/ce-cs-84.dat +124 -0
  397. gecatsim/material/edlp/comp/ce-cs-85.dat +124 -0
  398. gecatsim/material/edlp/comp/ce-cs-86.dat +124 -0
  399. gecatsim/material/edlp/comp/ce-cs-87.dat +124 -0
  400. gecatsim/material/edlp/comp/ce-cs-88.dat +124 -0
  401. gecatsim/material/edlp/comp/ce-cs-89.dat +124 -0
  402. gecatsim/material/edlp/comp/ce-cs-9.dat +124 -0
  403. gecatsim/material/edlp/comp/ce-cs-90.dat +124 -0
  404. gecatsim/material/edlp/comp/ce-cs-91.dat +124 -0
  405. gecatsim/material/edlp/comp/ce-cs-92.dat +124 -0
  406. gecatsim/material/edlp/comp/ce-cs-93.dat +124 -0
  407. gecatsim/material/edlp/comp/ce-cs-94.dat +124 -0
  408. gecatsim/material/edlp/comp/ce-cs-95.dat +124 -0
  409. gecatsim/material/edlp/comp/ce-cs-96.dat +124 -0
  410. gecatsim/material/edlp/comp/ce-cs-97.dat +124 -0
  411. gecatsim/material/edlp/comp/ce-cs-98.dat +124 -0
  412. gecatsim/material/edlp/comp/ce-cs-99.dat +124 -0
  413. gecatsim/material/edlp/comp/ce-cs-all.dat +0 -0
  414. gecatsim/material/edlp/comp/ce-sf-1.dat +107 -0
  415. gecatsim/material/edlp/comp/ce-sf-10.dat +179 -0
  416. gecatsim/material/edlp/comp/ce-sf-100.dat +150 -0
  417. gecatsim/material/edlp/comp/ce-sf-11.dat +187 -0
  418. gecatsim/material/edlp/comp/ce-sf-12.dat +180 -0
  419. gecatsim/material/edlp/comp/ce-sf-13.dat +166 -0
  420. gecatsim/material/edlp/comp/ce-sf-14.dat +170 -0
  421. gecatsim/material/edlp/comp/ce-sf-15.dat +166 -0
  422. gecatsim/material/edlp/comp/ce-sf-16.dat +165 -0
  423. gecatsim/material/edlp/comp/ce-sf-17.dat +169 -0
  424. gecatsim/material/edlp/comp/ce-sf-18.dat +161 -0
  425. gecatsim/material/edlp/comp/ce-sf-19.dat +167 -0
  426. gecatsim/material/edlp/comp/ce-sf-2.dat +144 -0
  427. gecatsim/material/edlp/comp/ce-sf-20.dat +168 -0
  428. gecatsim/material/edlp/comp/ce-sf-21.dat +162 -0
  429. gecatsim/material/edlp/comp/ce-sf-22.dat +163 -0
  430. gecatsim/material/edlp/comp/ce-sf-23.dat +162 -0
  431. gecatsim/material/edlp/comp/ce-sf-24.dat +169 -0
  432. gecatsim/material/edlp/comp/ce-sf-25.dat +164 -0
  433. gecatsim/material/edlp/comp/ce-sf-26.dat +167 -0
  434. gecatsim/material/edlp/comp/ce-sf-27.dat +165 -0
  435. gecatsim/material/edlp/comp/ce-sf-28.dat +173 -0
  436. gecatsim/material/edlp/comp/ce-sf-29.dat +167 -0
  437. gecatsim/material/edlp/comp/ce-sf-3.dat +149 -0
  438. gecatsim/material/edlp/comp/ce-sf-30.dat +168 -0
  439. gecatsim/material/edlp/comp/ce-sf-31.dat +166 -0
  440. gecatsim/material/edlp/comp/ce-sf-32.dat +168 -0
  441. gecatsim/material/edlp/comp/ce-sf-33.dat +167 -0
  442. gecatsim/material/edlp/comp/ce-sf-34.dat +169 -0
  443. gecatsim/material/edlp/comp/ce-sf-35.dat +167 -0
  444. gecatsim/material/edlp/comp/ce-sf-36.dat +158 -0
  445. gecatsim/material/edlp/comp/ce-sf-37.dat +160 -0
  446. gecatsim/material/edlp/comp/ce-sf-38.dat +161 -0
  447. gecatsim/material/edlp/comp/ce-sf-39.dat +161 -0
  448. gecatsim/material/edlp/comp/ce-sf-4.dat +151 -0
  449. gecatsim/material/edlp/comp/ce-sf-40.dat +170 -0
  450. gecatsim/material/edlp/comp/ce-sf-41.dat +172 -0
  451. gecatsim/material/edlp/comp/ce-sf-42.dat +167 -0
  452. gecatsim/material/edlp/comp/ce-sf-43.dat +164 -0
  453. gecatsim/material/edlp/comp/ce-sf-44.dat +160 -0
  454. gecatsim/material/edlp/comp/ce-sf-45.dat +160 -0
  455. gecatsim/material/edlp/comp/ce-sf-46.dat +162 -0
  456. gecatsim/material/edlp/comp/ce-sf-47.dat +162 -0
  457. gecatsim/material/edlp/comp/ce-sf-48.dat +164 -0
  458. gecatsim/material/edlp/comp/ce-sf-49.dat +165 -0
  459. gecatsim/material/edlp/comp/ce-sf-5.dat +148 -0
  460. gecatsim/material/edlp/comp/ce-sf-50.dat +158 -0
  461. gecatsim/material/edlp/comp/ce-sf-51.dat +156 -0
  462. gecatsim/material/edlp/comp/ce-sf-52.dat +158 -0
  463. gecatsim/material/edlp/comp/ce-sf-53.dat +163 -0
  464. gecatsim/material/edlp/comp/ce-sf-54.dat +163 -0
  465. gecatsim/material/edlp/comp/ce-sf-55.dat +158 -0
  466. gecatsim/material/edlp/comp/ce-sf-56.dat +161 -0
  467. gecatsim/material/edlp/comp/ce-sf-57.dat +168 -0
  468. gecatsim/material/edlp/comp/ce-sf-58.dat +167 -0
  469. gecatsim/material/edlp/comp/ce-sf-59.dat +162 -0
  470. gecatsim/material/edlp/comp/ce-sf-6.dat +155 -0
  471. gecatsim/material/edlp/comp/ce-sf-60.dat +157 -0
  472. gecatsim/material/edlp/comp/ce-sf-61.dat +169 -0
  473. gecatsim/material/edlp/comp/ce-sf-62.dat +169 -0
  474. gecatsim/material/edlp/comp/ce-sf-63.dat +160 -0
  475. gecatsim/material/edlp/comp/ce-sf-64.dat +166 -0
  476. gecatsim/material/edlp/comp/ce-sf-65.dat +163 -0
  477. gecatsim/material/edlp/comp/ce-sf-66.dat +158 -0
  478. gecatsim/material/edlp/comp/ce-sf-67.dat +168 -0
  479. gecatsim/material/edlp/comp/ce-sf-68.dat +159 -0
  480. gecatsim/material/edlp/comp/ce-sf-69.dat +164 -0
  481. gecatsim/material/edlp/comp/ce-sf-7.dat +174 -0
  482. gecatsim/material/edlp/comp/ce-sf-70.dat +169 -0
  483. gecatsim/material/edlp/comp/ce-sf-71.dat +162 -0
  484. gecatsim/material/edlp/comp/ce-sf-72.dat +163 -0
  485. gecatsim/material/edlp/comp/ce-sf-73.dat +165 -0
  486. gecatsim/material/edlp/comp/ce-sf-74.dat +164 -0
  487. gecatsim/material/edlp/comp/ce-sf-75.dat +161 -0
  488. gecatsim/material/edlp/comp/ce-sf-76.dat +155 -0
  489. gecatsim/material/edlp/comp/ce-sf-77.dat +152 -0
  490. gecatsim/material/edlp/comp/ce-sf-78.dat +150 -0
  491. gecatsim/material/edlp/comp/ce-sf-79.dat +148 -0
  492. gecatsim/material/edlp/comp/ce-sf-8.dat +176 -0
  493. gecatsim/material/edlp/comp/ce-sf-80.dat +153 -0
  494. gecatsim/material/edlp/comp/ce-sf-81.dat +158 -0
  495. gecatsim/material/edlp/comp/ce-sf-82.dat +154 -0
  496. gecatsim/material/edlp/comp/ce-sf-83.dat +159 -0
  497. gecatsim/material/edlp/comp/ce-sf-84.dat +156 -0
  498. gecatsim/material/edlp/comp/ce-sf-85.dat +162 -0
  499. gecatsim/material/edlp/comp/ce-sf-86.dat +154 -0
  500. gecatsim/material/edlp/comp/ce-sf-87.dat +154 -0
  501. gecatsim/material/edlp/comp/ce-sf-88.dat +153 -0
  502. gecatsim/material/edlp/comp/ce-sf-89.dat +151 -0
  503. gecatsim/material/edlp/comp/ce-sf-9.dat +184 -0
  504. gecatsim/material/edlp/comp/ce-sf-90.dat +153 -0
  505. gecatsim/material/edlp/comp/ce-sf-91.dat +151 -0
  506. gecatsim/material/edlp/comp/ce-sf-92.dat +157 -0
  507. gecatsim/material/edlp/comp/ce-sf-93.dat +152 -0
  508. gecatsim/material/edlp/comp/ce-sf-94.dat +154 -0
  509. gecatsim/material/edlp/comp/ce-sf-95.dat +151 -0
  510. gecatsim/material/edlp/comp/ce-sf-96.dat +151 -0
  511. gecatsim/material/edlp/comp/ce-sf-97.dat +150 -0
  512. gecatsim/material/edlp/comp/ce-sf-98.dat +152 -0
  513. gecatsim/material/edlp/comp/ce-sf-99.dat +152 -0
  514. gecatsim/material/edlp/comp/ce-sf-all.dat +0 -0
  515. gecatsim/material/edlp/pair/pp-cs-1.dat +96 -0
  516. gecatsim/material/edlp/pair/pp-cs-10.dat +110 -0
  517. gecatsim/material/edlp/pair/pp-cs-100.dat +126 -0
  518. gecatsim/material/edlp/pair/pp-cs-11.dat +112 -0
  519. gecatsim/material/edlp/pair/pp-cs-12.dat +111 -0
  520. gecatsim/material/edlp/pair/pp-cs-13.dat +112 -0
  521. gecatsim/material/edlp/pair/pp-cs-14.dat +113 -0
  522. gecatsim/material/edlp/pair/pp-cs-15.dat +113 -0
  523. gecatsim/material/edlp/pair/pp-cs-16.dat +114 -0
  524. gecatsim/material/edlp/pair/pp-cs-17.dat +112 -0
  525. gecatsim/material/edlp/pair/pp-cs-18.dat +113 -0
  526. gecatsim/material/edlp/pair/pp-cs-19.dat +113 -0
  527. gecatsim/material/edlp/pair/pp-cs-2.dat +100 -0
  528. gecatsim/material/edlp/pair/pp-cs-20.dat +114 -0
  529. gecatsim/material/edlp/pair/pp-cs-21.dat +115 -0
  530. gecatsim/material/edlp/pair/pp-cs-22.dat +115 -0
  531. gecatsim/material/edlp/pair/pp-cs-23.dat +116 -0
  532. gecatsim/material/edlp/pair/pp-cs-24.dat +115 -0
  533. gecatsim/material/edlp/pair/pp-cs-25.dat +115 -0
  534. gecatsim/material/edlp/pair/pp-cs-26.dat +116 -0
  535. gecatsim/material/edlp/pair/pp-cs-27.dat +117 -0
  536. gecatsim/material/edlp/pair/pp-cs-28.dat +117 -0
  537. gecatsim/material/edlp/pair/pp-cs-29.dat +117 -0
  538. gecatsim/material/edlp/pair/pp-cs-3.dat +104 -0
  539. gecatsim/material/edlp/pair/pp-cs-30.dat +117 -0
  540. gecatsim/material/edlp/pair/pp-cs-31.dat +118 -0
  541. gecatsim/material/edlp/pair/pp-cs-32.dat +118 -0
  542. gecatsim/material/edlp/pair/pp-cs-33.dat +118 -0
  543. gecatsim/material/edlp/pair/pp-cs-34.dat +119 -0
  544. gecatsim/material/edlp/pair/pp-cs-35.dat +119 -0
  545. gecatsim/material/edlp/pair/pp-cs-36.dat +119 -0
  546. gecatsim/material/edlp/pair/pp-cs-37.dat +118 -0
  547. gecatsim/material/edlp/pair/pp-cs-38.dat +119 -0
  548. gecatsim/material/edlp/pair/pp-cs-39.dat +119 -0
  549. gecatsim/material/edlp/pair/pp-cs-4.dat +105 -0
  550. gecatsim/material/edlp/pair/pp-cs-40.dat +119 -0
  551. gecatsim/material/edlp/pair/pp-cs-41.dat +119 -0
  552. gecatsim/material/edlp/pair/pp-cs-42.dat +119 -0
  553. gecatsim/material/edlp/pair/pp-cs-43.dat +119 -0
  554. gecatsim/material/edlp/pair/pp-cs-44.dat +119 -0
  555. gecatsim/material/edlp/pair/pp-cs-45.dat +119 -0
  556. gecatsim/material/edlp/pair/pp-cs-46.dat +119 -0
  557. gecatsim/material/edlp/pair/pp-cs-47.dat +120 -0
  558. gecatsim/material/edlp/pair/pp-cs-48.dat +120 -0
  559. gecatsim/material/edlp/pair/pp-cs-49.dat +120 -0
  560. gecatsim/material/edlp/pair/pp-cs-5.dat +106 -0
  561. gecatsim/material/edlp/pair/pp-cs-50.dat +120 -0
  562. gecatsim/material/edlp/pair/pp-cs-51.dat +120 -0
  563. gecatsim/material/edlp/pair/pp-cs-52.dat +120 -0
  564. gecatsim/material/edlp/pair/pp-cs-53.dat +121 -0
  565. gecatsim/material/edlp/pair/pp-cs-54.dat +121 -0
  566. gecatsim/material/edlp/pair/pp-cs-55.dat +121 -0
  567. gecatsim/material/edlp/pair/pp-cs-56.dat +121 -0
  568. gecatsim/material/edlp/pair/pp-cs-57.dat +122 -0
  569. gecatsim/material/edlp/pair/pp-cs-58.dat +122 -0
  570. gecatsim/material/edlp/pair/pp-cs-59.dat +122 -0
  571. gecatsim/material/edlp/pair/pp-cs-6.dat +107 -0
  572. gecatsim/material/edlp/pair/pp-cs-60.dat +122 -0
  573. gecatsim/material/edlp/pair/pp-cs-61.dat +122 -0
  574. gecatsim/material/edlp/pair/pp-cs-62.dat +123 -0
  575. gecatsim/material/edlp/pair/pp-cs-63.dat +123 -0
  576. gecatsim/material/edlp/pair/pp-cs-64.dat +123 -0
  577. gecatsim/material/edlp/pair/pp-cs-65.dat +124 -0
  578. gecatsim/material/edlp/pair/pp-cs-66.dat +124 -0
  579. gecatsim/material/edlp/pair/pp-cs-67.dat +124 -0
  580. gecatsim/material/edlp/pair/pp-cs-68.dat +124 -0
  581. gecatsim/material/edlp/pair/pp-cs-69.dat +124 -0
  582. gecatsim/material/edlp/pair/pp-cs-7.dat +108 -0
  583. gecatsim/material/edlp/pair/pp-cs-70.dat +124 -0
  584. gecatsim/material/edlp/pair/pp-cs-71.dat +124 -0
  585. gecatsim/material/edlp/pair/pp-cs-72.dat +124 -0
  586. gecatsim/material/edlp/pair/pp-cs-73.dat +125 -0
  587. gecatsim/material/edlp/pair/pp-cs-74.dat +125 -0
  588. gecatsim/material/edlp/pair/pp-cs-75.dat +126 -0
  589. gecatsim/material/edlp/pair/pp-cs-76.dat +126 -0
  590. gecatsim/material/edlp/pair/pp-cs-77.dat +126 -0
  591. gecatsim/material/edlp/pair/pp-cs-78.dat +125 -0
  592. gecatsim/material/edlp/pair/pp-cs-79.dat +125 -0
  593. gecatsim/material/edlp/pair/pp-cs-8.dat +109 -0
  594. gecatsim/material/edlp/pair/pp-cs-80.dat +125 -0
  595. gecatsim/material/edlp/pair/pp-cs-81.dat +126 -0
  596. gecatsim/material/edlp/pair/pp-cs-82.dat +126 -0
  597. gecatsim/material/edlp/pair/pp-cs-83.dat +126 -0
  598. gecatsim/material/edlp/pair/pp-cs-84.dat +126 -0
  599. gecatsim/material/edlp/pair/pp-cs-85.dat +126 -0
  600. gecatsim/material/edlp/pair/pp-cs-86.dat +126 -0
  601. gecatsim/material/edlp/pair/pp-cs-87.dat +126 -0
  602. gecatsim/material/edlp/pair/pp-cs-88.dat +126 -0
  603. gecatsim/material/edlp/pair/pp-cs-89.dat +127 -0
  604. gecatsim/material/edlp/pair/pp-cs-9.dat +109 -0
  605. gecatsim/material/edlp/pair/pp-cs-90.dat +127 -0
  606. gecatsim/material/edlp/pair/pp-cs-91.dat +127 -0
  607. gecatsim/material/edlp/pair/pp-cs-92.dat +127 -0
  608. gecatsim/material/edlp/pair/pp-cs-93.dat +127 -0
  609. gecatsim/material/edlp/pair/pp-cs-94.dat +126 -0
  610. gecatsim/material/edlp/pair/pp-cs-95.dat +126 -0
  611. gecatsim/material/edlp/pair/pp-cs-96.dat +126 -0
  612. gecatsim/material/edlp/pair/pp-cs-97.dat +126 -0
  613. gecatsim/material/edlp/pair/pp-cs-98.dat +126 -0
  614. gecatsim/material/edlp/pair/pp-cs-99.dat +126 -0
  615. gecatsim/material/edlp/pair/pp-cs-all.dat +0 -0
  616. gecatsim/material/edlp/phot/pe-cs-1.dat +87 -0
  617. gecatsim/material/edlp/phot/pe-cs-10.dat +388 -0
  618. gecatsim/material/edlp/phot/pe-cs-100.dat +1513 -0
  619. gecatsim/material/edlp/phot/pe-cs-11.dat +603 -0
  620. gecatsim/material/edlp/phot/pe-cs-12.dat +535 -0
  621. gecatsim/material/edlp/phot/pe-cs-13.dat +819 -0
  622. gecatsim/material/edlp/phot/pe-cs-14.dat +759 -0
  623. gecatsim/material/edlp/phot/pe-cs-15.dat +663 -0
  624. gecatsim/material/edlp/phot/pe-cs-16.dat +659 -0
  625. gecatsim/material/edlp/phot/pe-cs-17.dat +701 -0
  626. gecatsim/material/edlp/phot/pe-cs-18.dat +651 -0
  627. gecatsim/material/edlp/phot/pe-cs-19.dat +795 -0
  628. gecatsim/material/edlp/phot/pe-cs-2.dat +97 -0
  629. gecatsim/material/edlp/phot/pe-cs-20.dat +765 -0
  630. gecatsim/material/edlp/phot/pe-cs-21.dat +912 -0
  631. gecatsim/material/edlp/phot/pe-cs-22.dat +948 -0
  632. gecatsim/material/edlp/phot/pe-cs-23.dat +944 -0
  633. gecatsim/material/edlp/phot/pe-cs-24.dat +904 -0
  634. gecatsim/material/edlp/phot/pe-cs-25.dat +905 -0
  635. gecatsim/material/edlp/phot/pe-cs-26.dat +923 -0
  636. gecatsim/material/edlp/phot/pe-cs-27.dat +863 -0
  637. gecatsim/material/edlp/phot/pe-cs-28.dat +931 -0
  638. gecatsim/material/edlp/phot/pe-cs-29.dat +883 -0
  639. gecatsim/material/edlp/phot/pe-cs-3.dat +193 -0
  640. gecatsim/material/edlp/phot/pe-cs-30.dat +883 -0
  641. gecatsim/material/edlp/phot/pe-cs-31.dat +1018 -0
  642. gecatsim/material/edlp/phot/pe-cs-32.dat +1039 -0
  643. gecatsim/material/edlp/phot/pe-cs-33.dat +980 -0
  644. gecatsim/material/edlp/phot/pe-cs-34.dat +973 -0
  645. gecatsim/material/edlp/phot/pe-cs-35.dat +996 -0
  646. gecatsim/material/edlp/phot/pe-cs-36.dat +981 -0
  647. gecatsim/material/edlp/phot/pe-cs-37.dat +1047 -0
  648. gecatsim/material/edlp/phot/pe-cs-38.dat +975 -0
  649. gecatsim/material/edlp/phot/pe-cs-39.dat +1181 -0
  650. gecatsim/material/edlp/phot/pe-cs-4.dat +188 -0
  651. gecatsim/material/edlp/phot/pe-cs-40.dat +1169 -0
  652. gecatsim/material/edlp/phot/pe-cs-41.dat +1202 -0
  653. gecatsim/material/edlp/phot/pe-cs-42.dat +1181 -0
  654. gecatsim/material/edlp/phot/pe-cs-43.dat +1192 -0
  655. gecatsim/material/edlp/phot/pe-cs-44.dat +1217 -0
  656. gecatsim/material/edlp/phot/pe-cs-45.dat +1218 -0
  657. gecatsim/material/edlp/phot/pe-cs-46.dat +1070 -0
  658. gecatsim/material/edlp/phot/pe-cs-47.dat +1209 -0
  659. gecatsim/material/edlp/phot/pe-cs-48.dat +1202 -0
  660. gecatsim/material/edlp/phot/pe-cs-49.dat +1334 -0
  661. gecatsim/material/edlp/phot/pe-cs-5.dat +365 -0
  662. gecatsim/material/edlp/phot/pe-cs-50.dat +1234 -0
  663. gecatsim/material/edlp/phot/pe-cs-51.dat +1262 -0
  664. gecatsim/material/edlp/phot/pe-cs-52.dat +1166 -0
  665. gecatsim/material/edlp/phot/pe-cs-53.dat +1224 -0
  666. gecatsim/material/edlp/phot/pe-cs-54.dat +1139 -0
  667. gecatsim/material/edlp/phot/pe-cs-55.dat +1117 -0
  668. gecatsim/material/edlp/phot/pe-cs-56.dat +1068 -0
  669. gecatsim/material/edlp/phot/pe-cs-57.dat +1213 -0
  670. gecatsim/material/edlp/phot/pe-cs-58.dat +1230 -0
  671. gecatsim/material/edlp/phot/pe-cs-59.dat +1173 -0
  672. gecatsim/material/edlp/phot/pe-cs-6.dat +369 -0
  673. gecatsim/material/edlp/phot/pe-cs-60.dat +1237 -0
  674. gecatsim/material/edlp/phot/pe-cs-61.dat +1196 -0
  675. gecatsim/material/edlp/phot/pe-cs-62.dat +1210 -0
  676. gecatsim/material/edlp/phot/pe-cs-63.dat +1167 -0
  677. gecatsim/material/edlp/phot/pe-cs-64.dat +1309 -0
  678. gecatsim/material/edlp/phot/pe-cs-65.dat +1140 -0
  679. gecatsim/material/edlp/phot/pe-cs-66.dat +1172 -0
  680. gecatsim/material/edlp/phot/pe-cs-67.dat +1175 -0
  681. gecatsim/material/edlp/phot/pe-cs-68.dat +1168 -0
  682. gecatsim/material/edlp/phot/pe-cs-69.dat +1222 -0
  683. gecatsim/material/edlp/phot/pe-cs-7.dat +367 -0
  684. gecatsim/material/edlp/phot/pe-cs-70.dat +1217 -0
  685. gecatsim/material/edlp/phot/pe-cs-71.dat +1341 -0
  686. gecatsim/material/edlp/phot/pe-cs-72.dat +1317 -0
  687. gecatsim/material/edlp/phot/pe-cs-73.dat +1270 -0
  688. gecatsim/material/edlp/phot/pe-cs-74.dat +1295 -0
  689. gecatsim/material/edlp/phot/pe-cs-75.dat +1257 -0
  690. gecatsim/material/edlp/phot/pe-cs-76.dat +1295 -0
  691. gecatsim/material/edlp/phot/pe-cs-77.dat +1196 -0
  692. gecatsim/material/edlp/phot/pe-cs-78.dat +1198 -0
  693. gecatsim/material/edlp/phot/pe-cs-79.dat +1276 -0
  694. gecatsim/material/edlp/phot/pe-cs-8.dat +396 -0
  695. gecatsim/material/edlp/phot/pe-cs-80.dat +1205 -0
  696. gecatsim/material/edlp/phot/pe-cs-81.dat +1380 -0
  697. gecatsim/material/edlp/phot/pe-cs-82.dat +1355 -0
  698. gecatsim/material/edlp/phot/pe-cs-83.dat +1386 -0
  699. gecatsim/material/edlp/phot/pe-cs-84.dat +1366 -0
  700. gecatsim/material/edlp/phot/pe-cs-85.dat +1379 -0
  701. gecatsim/material/edlp/phot/pe-cs-86.dat +1342 -0
  702. gecatsim/material/edlp/phot/pe-cs-87.dat +1390 -0
  703. gecatsim/material/edlp/phot/pe-cs-88.dat +1248 -0
  704. gecatsim/material/edlp/phot/pe-cs-89.dat +1288 -0
  705. gecatsim/material/edlp/phot/pe-cs-9.dat +384 -0
  706. gecatsim/material/edlp/phot/pe-cs-90.dat +1400 -0
  707. gecatsim/material/edlp/phot/pe-cs-91.dat +1517 -0
  708. gecatsim/material/edlp/phot/pe-cs-92.dat +1571 -0
  709. gecatsim/material/edlp/phot/pe-cs-93.dat +1602 -0
  710. gecatsim/material/edlp/phot/pe-cs-94.dat +1432 -0
  711. gecatsim/material/edlp/phot/pe-cs-95.dat +1456 -0
  712. gecatsim/material/edlp/phot/pe-cs-96.dat +1494 -0
  713. gecatsim/material/edlp/phot/pe-cs-97.dat +1522 -0
  714. gecatsim/material/edlp/phot/pe-cs-98.dat +1498 -0
  715. gecatsim/material/edlp/phot/pe-cs-99.dat +1573 -0
  716. gecatsim/material/edlp/phot/pe-cs-all.dat +0 -0
  717. gecatsim/material/edlp/phot/pe-ss-cs-1.dat +88 -0
  718. gecatsim/material/edlp/phot/pe-ss-cs-10.dat +474 -0
  719. gecatsim/material/edlp/phot/pe-ss-cs-100.dat +2821 -0
  720. gecatsim/material/edlp/phot/pe-ss-cs-11.dat +717 -0
  721. gecatsim/material/edlp/phot/pe-ss-cs-12.dat +693 -0
  722. gecatsim/material/edlp/phot/pe-ss-cs-13.dat +978 -0
  723. gecatsim/material/edlp/phot/pe-ss-cs-14.dat +941 -0
  724. gecatsim/material/edlp/phot/pe-ss-cs-15.dat +884 -0
  725. gecatsim/material/edlp/phot/pe-ss-cs-16.dat +861 -0
  726. gecatsim/material/edlp/phot/pe-ss-cs-17.dat +870 -0
  727. gecatsim/material/edlp/phot/pe-ss-cs-18.dat +853 -0
  728. gecatsim/material/edlp/phot/pe-ss-cs-19.dat +993 -0
  729. gecatsim/material/edlp/phot/pe-ss-cs-2.dat +98 -0
  730. gecatsim/material/edlp/phot/pe-ss-cs-20.dat +959 -0
  731. gecatsim/material/edlp/phot/pe-ss-cs-21.dat +1233 -0
  732. gecatsim/material/edlp/phot/pe-ss-cs-22.dat +1227 -0
  733. gecatsim/material/edlp/phot/pe-ss-cs-23.dat +1225 -0
  734. gecatsim/material/edlp/phot/pe-ss-cs-24.dat +1250 -0
  735. gecatsim/material/edlp/phot/pe-ss-cs-25.dat +1209 -0
  736. gecatsim/material/edlp/phot/pe-ss-cs-26.dat +1209 -0
  737. gecatsim/material/edlp/phot/pe-ss-cs-27.dat +1200 -0
  738. gecatsim/material/edlp/phot/pe-ss-cs-28.dat +1198 -0
  739. gecatsim/material/edlp/phot/pe-ss-cs-29.dat +1204 -0
  740. gecatsim/material/edlp/phot/pe-ss-cs-3.dat +207 -0
  741. gecatsim/material/edlp/phot/pe-ss-cs-30.dat +1199 -0
  742. gecatsim/material/edlp/phot/pe-ss-cs-31.dat +1471 -0
  743. gecatsim/material/edlp/phot/pe-ss-cs-32.dat +1456 -0
  744. gecatsim/material/edlp/phot/pe-ss-cs-33.dat +1419 -0
  745. gecatsim/material/edlp/phot/pe-ss-cs-34.dat +1425 -0
  746. gecatsim/material/edlp/phot/pe-ss-cs-35.dat +1392 -0
  747. gecatsim/material/edlp/phot/pe-ss-cs-36.dat +1395 -0
  748. gecatsim/material/edlp/phot/pe-ss-cs-37.dat +1460 -0
  749. gecatsim/material/edlp/phot/pe-ss-cs-38.dat +1407 -0
  750. gecatsim/material/edlp/phot/pe-ss-cs-39.dat +1819 -0
  751. gecatsim/material/edlp/phot/pe-ss-cs-4.dat +211 -0
  752. gecatsim/material/edlp/phot/pe-ss-cs-40.dat +1807 -0
  753. gecatsim/material/edlp/phot/pe-ss-cs-41.dat +1811 -0
  754. gecatsim/material/edlp/phot/pe-ss-cs-42.dat +1818 -0
  755. gecatsim/material/edlp/phot/pe-ss-cs-43.dat +1792 -0
  756. gecatsim/material/edlp/phot/pe-ss-cs-44.dat +1781 -0
  757. gecatsim/material/edlp/phot/pe-ss-cs-45.dat +1788 -0
  758. gecatsim/material/edlp/phot/pe-ss-cs-46.dat +1611 -0
  759. gecatsim/material/edlp/phot/pe-ss-cs-47.dat +1771 -0
  760. gecatsim/material/edlp/phot/pe-ss-cs-48.dat +1782 -0
  761. gecatsim/material/edlp/phot/pe-ss-cs-49.dat +2033 -0
  762. gecatsim/material/edlp/phot/pe-ss-cs-5.dat +431 -0
  763. gecatsim/material/edlp/phot/pe-ss-cs-50.dat +1943 -0
  764. gecatsim/material/edlp/phot/pe-ss-cs-51.dat +1918 -0
  765. gecatsim/material/edlp/phot/pe-ss-cs-52.dat +1879 -0
  766. gecatsim/material/edlp/phot/pe-ss-cs-53.dat +1861 -0
  767. gecatsim/material/edlp/phot/pe-ss-cs-54.dat +1782 -0
  768. gecatsim/material/edlp/phot/pe-ss-cs-55.dat +1855 -0
  769. gecatsim/material/edlp/phot/pe-ss-cs-56.dat +1813 -0
  770. gecatsim/material/edlp/phot/pe-ss-cs-57.dat +2144 -0
  771. gecatsim/material/edlp/phot/pe-ss-cs-58.dat +2090 -0
  772. gecatsim/material/edlp/phot/pe-ss-cs-59.dat +2071 -0
  773. gecatsim/material/edlp/phot/pe-ss-cs-6.dat +436 -0
  774. gecatsim/material/edlp/phot/pe-ss-cs-60.dat +2066 -0
  775. gecatsim/material/edlp/phot/pe-ss-cs-61.dat +2064 -0
  776. gecatsim/material/edlp/phot/pe-ss-cs-62.dat +2063 -0
  777. gecatsim/material/edlp/phot/pe-ss-cs-63.dat +2043 -0
  778. gecatsim/material/edlp/phot/pe-ss-cs-64.dat +2405 -0
  779. gecatsim/material/edlp/phot/pe-ss-cs-65.dat +2035 -0
  780. gecatsim/material/edlp/phot/pe-ss-cs-66.dat +2023 -0
  781. gecatsim/material/edlp/phot/pe-ss-cs-67.dat +2026 -0
  782. gecatsim/material/edlp/phot/pe-ss-cs-68.dat +2029 -0
  783. gecatsim/material/edlp/phot/pe-ss-cs-69.dat +2018 -0
  784. gecatsim/material/edlp/phot/pe-ss-cs-7.dat +440 -0
  785. gecatsim/material/edlp/phot/pe-ss-cs-70.dat +2048 -0
  786. gecatsim/material/edlp/phot/pe-ss-cs-71.dat +2348 -0
  787. gecatsim/material/edlp/phot/pe-ss-cs-72.dat +2333 -0
  788. gecatsim/material/edlp/phot/pe-ss-cs-73.dat +2320 -0
  789. gecatsim/material/edlp/phot/pe-ss-cs-74.dat +2313 -0
  790. gecatsim/material/edlp/phot/pe-ss-cs-75.dat +2290 -0
  791. gecatsim/material/edlp/phot/pe-ss-cs-76.dat +2280 -0
  792. gecatsim/material/edlp/phot/pe-ss-cs-77.dat +2145 -0
  793. gecatsim/material/edlp/phot/pe-ss-cs-78.dat +2268 -0
  794. gecatsim/material/edlp/phot/pe-ss-cs-79.dat +2262 -0
  795. gecatsim/material/edlp/phot/pe-ss-cs-8.dat +445 -0
  796. gecatsim/material/edlp/phot/pe-ss-cs-80.dat +2271 -0
  797. gecatsim/material/edlp/phot/pe-ss-cs-81.dat +2497 -0
  798. gecatsim/material/edlp/phot/pe-ss-cs-82.dat +2494 -0
  799. gecatsim/material/edlp/phot/pe-ss-cs-83.dat +2467 -0
  800. gecatsim/material/edlp/phot/pe-ss-cs-84.dat +2453 -0
  801. gecatsim/material/edlp/phot/pe-ss-cs-85.dat +2423 -0
  802. gecatsim/material/edlp/phot/pe-ss-cs-86.dat +2379 -0
  803. gecatsim/material/edlp/phot/pe-ss-cs-87.dat +2451 -0
  804. gecatsim/material/edlp/phot/pe-ss-cs-88.dat +2367 -0
  805. gecatsim/material/edlp/phot/pe-ss-cs-89.dat +2696 -0
  806. gecatsim/material/edlp/phot/pe-ss-cs-9.dat +457 -0
  807. gecatsim/material/edlp/phot/pe-ss-cs-90.dat +2694 -0
  808. gecatsim/material/edlp/phot/pe-ss-cs-91.dat +3131 -0
  809. gecatsim/material/edlp/phot/pe-ss-cs-92.dat +3130 -0
  810. gecatsim/material/edlp/phot/pe-ss-cs-93.dat +3142 -0
  811. gecatsim/material/edlp/phot/pe-ss-cs-94.dat +2794 -0
  812. gecatsim/material/edlp/phot/pe-ss-cs-95.dat +2810 -0
  813. gecatsim/material/edlp/phot/pe-ss-cs-96.dat +3103 -0
  814. gecatsim/material/edlp/phot/pe-ss-cs-97.dat +3126 -0
  815. gecatsim/material/edlp/phot/pe-ss-cs-98.dat +2835 -0
  816. gecatsim/material/edlp/phot/pe-ss-cs-99.dat +2851 -0
  817. gecatsim/material/edlp/rayl/re-cs-1.dat +375 -0
  818. gecatsim/material/edlp/rayl/re-cs-10.dat +453 -0
  819. gecatsim/material/edlp/rayl/re-cs-100.dat +1555 -0
  820. gecatsim/material/edlp/rayl/re-cs-11.dat +607 -0
  821. gecatsim/material/edlp/rayl/re-cs-12.dat +561 -0
  822. gecatsim/material/edlp/rayl/re-cs-13.dat +903 -0
  823. gecatsim/material/edlp/rayl/re-cs-14.dat +830 -0
  824. gecatsim/material/edlp/rayl/re-cs-15.dat +745 -0
  825. gecatsim/material/edlp/rayl/re-cs-16.dat +698 -0
  826. gecatsim/material/edlp/rayl/re-cs-17.dat +666 -0
  827. gecatsim/material/edlp/rayl/re-cs-18.dat +597 -0
  828. gecatsim/material/edlp/rayl/re-cs-19.dat +760 -0
  829. gecatsim/material/edlp/rayl/re-cs-2.dat +343 -0
  830. gecatsim/material/edlp/rayl/re-cs-20.dat +796 -0
  831. gecatsim/material/edlp/rayl/re-cs-21.dat +869 -0
  832. gecatsim/material/edlp/rayl/re-cs-22.dat +869 -0
  833. gecatsim/material/edlp/rayl/re-cs-23.dat +839 -0
  834. gecatsim/material/edlp/rayl/re-cs-24.dat +826 -0
  835. gecatsim/material/edlp/rayl/re-cs-25.dat +914 -0
  836. gecatsim/material/edlp/rayl/re-cs-26.dat +913 -0
  837. gecatsim/material/edlp/rayl/re-cs-27.dat +901 -0
  838. gecatsim/material/edlp/rayl/re-cs-28.dat +888 -0
  839. gecatsim/material/edlp/rayl/re-cs-29.dat +844 -0
  840. gecatsim/material/edlp/rayl/re-cs-3.dat +517 -0
  841. gecatsim/material/edlp/rayl/re-cs-30.dat +801 -0
  842. gecatsim/material/edlp/rayl/re-cs-31.dat +1202 -0
  843. gecatsim/material/edlp/rayl/re-cs-32.dat +1113 -0
  844. gecatsim/material/edlp/rayl/re-cs-33.dat +1010 -0
  845. gecatsim/material/edlp/rayl/re-cs-34.dat +928 -0
  846. gecatsim/material/edlp/rayl/re-cs-35.dat +894 -0
  847. gecatsim/material/edlp/rayl/re-cs-36.dat +719 -0
  848. gecatsim/material/edlp/rayl/re-cs-37.dat +892 -0
  849. gecatsim/material/edlp/rayl/re-cs-38.dat +891 -0
  850. gecatsim/material/edlp/rayl/re-cs-39.dat +906 -0
  851. gecatsim/material/edlp/rayl/re-cs-4.dat +493 -0
  852. gecatsim/material/edlp/rayl/re-cs-40.dat +930 -0
  853. gecatsim/material/edlp/rayl/re-cs-41.dat +918 -0
  854. gecatsim/material/edlp/rayl/re-cs-42.dat +1068 -0
  855. gecatsim/material/edlp/rayl/re-cs-43.dat +1085 -0
  856. gecatsim/material/edlp/rayl/re-cs-44.dat +1085 -0
  857. gecatsim/material/edlp/rayl/re-cs-45.dat +1124 -0
  858. gecatsim/material/edlp/rayl/re-cs-46.dat +853 -0
  859. gecatsim/material/edlp/rayl/re-cs-47.dat +1087 -0
  860. gecatsim/material/edlp/rayl/re-cs-48.dat +1001 -0
  861. gecatsim/material/edlp/rayl/re-cs-49.dat +1508 -0
  862. gecatsim/material/edlp/rayl/re-cs-5.dat +619 -0
  863. gecatsim/material/edlp/rayl/re-cs-50.dat +1370 -0
  864. gecatsim/material/edlp/rayl/re-cs-51.dat +1234 -0
  865. gecatsim/material/edlp/rayl/re-cs-52.dat +1138 -0
  866. gecatsim/material/edlp/rayl/re-cs-53.dat +1062 -0
  867. gecatsim/material/edlp/rayl/re-cs-54.dat +925 -0
  868. gecatsim/material/edlp/rayl/re-cs-55.dat +1130 -0
  869. gecatsim/material/edlp/rayl/re-cs-56.dat +1176 -0
  870. gecatsim/material/edlp/rayl/re-cs-57.dat +1172 -0
  871. gecatsim/material/edlp/rayl/re-cs-58.dat +1243 -0
  872. gecatsim/material/edlp/rayl/re-cs-59.dat +1232 -0
  873. gecatsim/material/edlp/rayl/re-cs-6.dat +647 -0
  874. gecatsim/material/edlp/rayl/re-cs-60.dat +1195 -0
  875. gecatsim/material/edlp/rayl/re-cs-61.dat +1229 -0
  876. gecatsim/material/edlp/rayl/re-cs-62.dat +1297 -0
  877. gecatsim/material/edlp/rayl/re-cs-63.dat +1324 -0
  878. gecatsim/material/edlp/rayl/re-cs-64.dat +1384 -0
  879. gecatsim/material/edlp/rayl/re-cs-65.dat +1356 -0
  880. gecatsim/material/edlp/rayl/re-cs-66.dat +1401 -0
  881. gecatsim/material/edlp/rayl/re-cs-67.dat +1374 -0
  882. gecatsim/material/edlp/rayl/re-cs-68.dat +1264 -0
  883. gecatsim/material/edlp/rayl/re-cs-69.dat +1327 -0
  884. gecatsim/material/edlp/rayl/re-cs-7.dat +669 -0
  885. gecatsim/material/edlp/rayl/re-cs-70.dat +1243 -0
  886. gecatsim/material/edlp/rayl/re-cs-71.dat +1384 -0
  887. gecatsim/material/edlp/rayl/re-cs-72.dat +1338 -0
  888. gecatsim/material/edlp/rayl/re-cs-73.dat +1181 -0
  889. gecatsim/material/edlp/rayl/re-cs-74.dat +1009 -0
  890. gecatsim/material/edlp/rayl/re-cs-75.dat +1138 -0
  891. gecatsim/material/edlp/rayl/re-cs-76.dat +1106 -0
  892. gecatsim/material/edlp/rayl/re-cs-77.dat +1040 -0
  893. gecatsim/material/edlp/rayl/re-cs-78.dat +1176 -0
  894. gecatsim/material/edlp/rayl/re-cs-79.dat +1123 -0
  895. gecatsim/material/edlp/rayl/re-cs-8.dat +662 -0
  896. gecatsim/material/edlp/rayl/re-cs-80.dat +1126 -0
  897. gecatsim/material/edlp/rayl/re-cs-81.dat +1668 -0
  898. gecatsim/material/edlp/rayl/re-cs-82.dat +1641 -0
  899. gecatsim/material/edlp/rayl/re-cs-83.dat +1448 -0
  900. gecatsim/material/edlp/rayl/re-cs-84.dat +1338 -0
  901. gecatsim/material/edlp/rayl/re-cs-85.dat +1236 -0
  902. gecatsim/material/edlp/rayl/re-cs-86.dat +1099 -0
  903. gecatsim/material/edlp/rayl/re-cs-87.dat +1368 -0
  904. gecatsim/material/edlp/rayl/re-cs-88.dat +1448 -0
  905. gecatsim/material/edlp/rayl/re-cs-89.dat +1592 -0
  906. gecatsim/material/edlp/rayl/re-cs-9.dat +584 -0
  907. gecatsim/material/edlp/rayl/re-cs-90.dat +1504 -0
  908. gecatsim/material/edlp/rayl/re-cs-91.dat +1547 -0
  909. gecatsim/material/edlp/rayl/re-cs-92.dat +1633 -0
  910. gecatsim/material/edlp/rayl/re-cs-93.dat +1625 -0
  911. gecatsim/material/edlp/rayl/re-cs-94.dat +1427 -0
  912. gecatsim/material/edlp/rayl/re-cs-95.dat +1465 -0
  913. gecatsim/material/edlp/rayl/re-cs-96.dat +1794 -0
  914. gecatsim/material/edlp/rayl/re-cs-97.dat +1638 -0
  915. gecatsim/material/edlp/rayl/re-cs-98.dat +1554 -0
  916. gecatsim/material/edlp/rayl/re-cs-99.dat +1528 -0
  917. gecatsim/material/edlp/rayl/re-cs-all.dat +0 -0
  918. gecatsim/material/edlp/rayl/re-ff-1.dat +103 -0
  919. gecatsim/material/edlp/rayl/re-ff-10.dat +175 -0
  920. gecatsim/material/edlp/rayl/re-ff-100.dat +146 -0
  921. gecatsim/material/edlp/rayl/re-ff-11.dat +183 -0
  922. gecatsim/material/edlp/rayl/re-ff-12.dat +176 -0
  923. gecatsim/material/edlp/rayl/re-ff-13.dat +162 -0
  924. gecatsim/material/edlp/rayl/re-ff-14.dat +166 -0
  925. gecatsim/material/edlp/rayl/re-ff-15.dat +162 -0
  926. gecatsim/material/edlp/rayl/re-ff-16.dat +161 -0
  927. gecatsim/material/edlp/rayl/re-ff-17.dat +165 -0
  928. gecatsim/material/edlp/rayl/re-ff-18.dat +157 -0
  929. gecatsim/material/edlp/rayl/re-ff-19.dat +163 -0
  930. gecatsim/material/edlp/rayl/re-ff-2.dat +140 -0
  931. gecatsim/material/edlp/rayl/re-ff-20.dat +164 -0
  932. gecatsim/material/edlp/rayl/re-ff-21.dat +158 -0
  933. gecatsim/material/edlp/rayl/re-ff-22.dat +159 -0
  934. gecatsim/material/edlp/rayl/re-ff-23.dat +158 -0
  935. gecatsim/material/edlp/rayl/re-ff-24.dat +165 -0
  936. gecatsim/material/edlp/rayl/re-ff-25.dat +160 -0
  937. gecatsim/material/edlp/rayl/re-ff-26.dat +163 -0
  938. gecatsim/material/edlp/rayl/re-ff-27.dat +161 -0
  939. gecatsim/material/edlp/rayl/re-ff-28.dat +169 -0
  940. gecatsim/material/edlp/rayl/re-ff-29.dat +163 -0
  941. gecatsim/material/edlp/rayl/re-ff-3.dat +145 -0
  942. gecatsim/material/edlp/rayl/re-ff-30.dat +164 -0
  943. gecatsim/material/edlp/rayl/re-ff-31.dat +162 -0
  944. gecatsim/material/edlp/rayl/re-ff-32.dat +164 -0
  945. gecatsim/material/edlp/rayl/re-ff-33.dat +163 -0
  946. gecatsim/material/edlp/rayl/re-ff-34.dat +165 -0
  947. gecatsim/material/edlp/rayl/re-ff-35.dat +163 -0
  948. gecatsim/material/edlp/rayl/re-ff-36.dat +154 -0
  949. gecatsim/material/edlp/rayl/re-ff-37.dat +156 -0
  950. gecatsim/material/edlp/rayl/re-ff-38.dat +157 -0
  951. gecatsim/material/edlp/rayl/re-ff-39.dat +157 -0
  952. gecatsim/material/edlp/rayl/re-ff-4.dat +147 -0
  953. gecatsim/material/edlp/rayl/re-ff-40.dat +166 -0
  954. gecatsim/material/edlp/rayl/re-ff-41.dat +168 -0
  955. gecatsim/material/edlp/rayl/re-ff-42.dat +163 -0
  956. gecatsim/material/edlp/rayl/re-ff-43.dat +160 -0
  957. gecatsim/material/edlp/rayl/re-ff-44.dat +156 -0
  958. gecatsim/material/edlp/rayl/re-ff-45.dat +156 -0
  959. gecatsim/material/edlp/rayl/re-ff-46.dat +158 -0
  960. gecatsim/material/edlp/rayl/re-ff-47.dat +158 -0
  961. gecatsim/material/edlp/rayl/re-ff-48.dat +160 -0
  962. gecatsim/material/edlp/rayl/re-ff-49.dat +161 -0
  963. gecatsim/material/edlp/rayl/re-ff-5.dat +144 -0
  964. gecatsim/material/edlp/rayl/re-ff-50.dat +154 -0
  965. gecatsim/material/edlp/rayl/re-ff-51.dat +152 -0
  966. gecatsim/material/edlp/rayl/re-ff-52.dat +154 -0
  967. gecatsim/material/edlp/rayl/re-ff-53.dat +159 -0
  968. gecatsim/material/edlp/rayl/re-ff-54.dat +159 -0
  969. gecatsim/material/edlp/rayl/re-ff-55.dat +154 -0
  970. gecatsim/material/edlp/rayl/re-ff-56.dat +157 -0
  971. gecatsim/material/edlp/rayl/re-ff-57.dat +164 -0
  972. gecatsim/material/edlp/rayl/re-ff-58.dat +163 -0
  973. gecatsim/material/edlp/rayl/re-ff-59.dat +158 -0
  974. gecatsim/material/edlp/rayl/re-ff-6.dat +151 -0
  975. gecatsim/material/edlp/rayl/re-ff-60.dat +153 -0
  976. gecatsim/material/edlp/rayl/re-ff-61.dat +165 -0
  977. gecatsim/material/edlp/rayl/re-ff-62.dat +165 -0
  978. gecatsim/material/edlp/rayl/re-ff-63.dat +156 -0
  979. gecatsim/material/edlp/rayl/re-ff-64.dat +162 -0
  980. gecatsim/material/edlp/rayl/re-ff-65.dat +159 -0
  981. gecatsim/material/edlp/rayl/re-ff-66.dat +154 -0
  982. gecatsim/material/edlp/rayl/re-ff-67.dat +164 -0
  983. gecatsim/material/edlp/rayl/re-ff-68.dat +155 -0
  984. gecatsim/material/edlp/rayl/re-ff-69.dat +160 -0
  985. gecatsim/material/edlp/rayl/re-ff-7.dat +170 -0
  986. gecatsim/material/edlp/rayl/re-ff-70.dat +165 -0
  987. gecatsim/material/edlp/rayl/re-ff-71.dat +158 -0
  988. gecatsim/material/edlp/rayl/re-ff-72.dat +159 -0
  989. gecatsim/material/edlp/rayl/re-ff-73.dat +161 -0
  990. gecatsim/material/edlp/rayl/re-ff-74.dat +160 -0
  991. gecatsim/material/edlp/rayl/re-ff-75.dat +157 -0
  992. gecatsim/material/edlp/rayl/re-ff-76.dat +151 -0
  993. gecatsim/material/edlp/rayl/re-ff-77.dat +148 -0
  994. gecatsim/material/edlp/rayl/re-ff-78.dat +146 -0
  995. gecatsim/material/edlp/rayl/re-ff-79.dat +144 -0
  996. gecatsim/material/edlp/rayl/re-ff-8.dat +172 -0
  997. gecatsim/material/edlp/rayl/re-ff-80.dat +149 -0
  998. gecatsim/material/edlp/rayl/re-ff-81.dat +154 -0
  999. gecatsim/material/edlp/rayl/re-ff-82.dat +150 -0
  1000. gecatsim/material/edlp/rayl/re-ff-83.dat +155 -0
  1001. gecatsim/material/edlp/rayl/re-ff-84.dat +152 -0
  1002. gecatsim/material/edlp/rayl/re-ff-85.dat +158 -0
  1003. gecatsim/material/edlp/rayl/re-ff-86.dat +150 -0
  1004. gecatsim/material/edlp/rayl/re-ff-87.dat +150 -0
  1005. gecatsim/material/edlp/rayl/re-ff-88.dat +149 -0
  1006. gecatsim/material/edlp/rayl/re-ff-89.dat +147 -0
  1007. gecatsim/material/edlp/rayl/re-ff-9.dat +180 -0
  1008. gecatsim/material/edlp/rayl/re-ff-90.dat +149 -0
  1009. gecatsim/material/edlp/rayl/re-ff-91.dat +147 -0
  1010. gecatsim/material/edlp/rayl/re-ff-92.dat +153 -0
  1011. gecatsim/material/edlp/rayl/re-ff-93.dat +148 -0
  1012. gecatsim/material/edlp/rayl/re-ff-94.dat +150 -0
  1013. gecatsim/material/edlp/rayl/re-ff-95.dat +147 -0
  1014. gecatsim/material/edlp/rayl/re-ff-96.dat +147 -0
  1015. gecatsim/material/edlp/rayl/re-ff-97.dat +146 -0
  1016. gecatsim/material/edlp/rayl/re-ff-98.dat +148 -0
  1017. gecatsim/material/edlp/rayl/re-ff-99.dat +148 -0
  1018. gecatsim/material/edlp/rayl/re-ff-all.dat +0 -0
  1019. gecatsim/material/graphite +13 -0
  1020. gecatsim/material/ncat_adipose +19 -0
  1021. gecatsim/material/ncat_air +18 -0
  1022. gecatsim/material/ncat_aluminum +14 -0
  1023. gecatsim/material/ncat_bladder +23 -0
  1024. gecatsim/material/ncat_blood +24 -0
  1025. gecatsim/material/ncat_blood_with_0_7pct_iodine +25 -0
  1026. gecatsim/material/ncat_blood_with_0_8pct_iodine +25 -0
  1027. gecatsim/material/ncat_blood_with_0_9pct_iodine +25 -0
  1028. gecatsim/material/ncat_blood_with_1_0pct_iodine +25 -0
  1029. gecatsim/material/ncat_blood_with_1_1pct_iodine +25 -0
  1030. gecatsim/material/ncat_blood_with_2_0pct_iodine +25 -0
  1031. gecatsim/material/ncat_blood_with_3_0pct_iodine +25 -0
  1032. gecatsim/material/ncat_brain +23 -0
  1033. gecatsim/material/ncat_breast_mammary +22 -0
  1034. gecatsim/material/ncat_cartilage +22 -0
  1035. gecatsim/material/ncat_dry_rib +23 -0
  1036. gecatsim/material/ncat_dry_spine +24 -0
  1037. gecatsim/material/ncat_eye_lens +22 -0
  1038. gecatsim/material/ncat_graphite +14 -0
  1039. gecatsim/material/ncat_heart +23 -0
  1040. gecatsim/material/ncat_intestine +23 -0
  1041. gecatsim/material/ncat_iodine +14 -0
  1042. gecatsim/material/ncat_iodine_blood +25 -0
  1043. gecatsim/material/ncat_iron +14 -0
  1044. gecatsim/material/ncat_kidney +24 -0
  1045. gecatsim/material/ncat_lead +14 -0
  1046. gecatsim/material/ncat_liver +23 -0
  1047. gecatsim/material/ncat_lung +23 -0
  1048. gecatsim/material/ncat_lymph +21 -0
  1049. gecatsim/material/ncat_muscle +23 -0
  1050. gecatsim/material/ncat_ovary +23 -0
  1051. gecatsim/material/ncat_pancreas +23 -0
  1052. gecatsim/material/ncat_pmma +17 -0
  1053. gecatsim/material/ncat_red_marrow +23 -0
  1054. gecatsim/material/ncat_skin +23 -0
  1055. gecatsim/material/ncat_skull +23 -0
  1056. gecatsim/material/ncat_spleen +23 -0
  1057. gecatsim/material/ncat_testis +23 -0
  1058. gecatsim/material/ncat_thyroid +24 -0
  1059. gecatsim/material/ncat_titanium +14 -0
  1060. gecatsim/material/ncat_water +16 -0
  1061. gecatsim/material/ncat_yellow_marrow +21 -0
  1062. gecatsim/material/plexi +21 -0
  1063. gecatsim/material/polyethylene +14 -0
  1064. gecatsim/material/polyethylene_HDPE +16 -0
  1065. gecatsim/material/polyethylene_LDPE +16 -0
  1066. gecatsim/material/polyethylene_MDPE +16 -0
  1067. gecatsim/material/polyethylene_legacy +20 -0
  1068. gecatsim/material/polystyrene +18 -0
  1069. gecatsim/material/polystyrene_legacy +21 -0
  1070. gecatsim/material/pvc_legacy +22 -0
  1071. gecatsim/material/water +16 -0
  1072. gecatsim/material/water_20C +16 -0
  1073. gecatsim/material/water_20C_NaCl_0p9_pct +18 -0
  1074. gecatsim/material/water_20C_iodine_100mg +17 -0
  1075. gecatsim/material/water_20C_iodine_10mg +17 -0
  1076. gecatsim/material/water_20C_iodine_15mg +17 -0
  1077. gecatsim/material/water_20C_iodine_1mg +17 -0
  1078. gecatsim/material/water_20C_iodine_20mg +17 -0
  1079. gecatsim/material/water_20C_iodine_2mg +17 -0
  1080. gecatsim/material/water_20C_iodine_30mg +17 -0
  1081. gecatsim/material/water_20C_iodine_40mg +17 -0
  1082. gecatsim/material/water_20C_iodine_50mg +17 -0
  1083. gecatsim/material/water_20C_iodine_5mg +17 -0
  1084. gecatsim/material/water_37C +16 -0
  1085. gecatsim/phantom/CTDI_16cm_WaterAirPEBoneChambers.ppm +62 -0
  1086. gecatsim/phantom/CatSimLogo_1024/CatSimLogo_1024_128mmZ.json +51 -0
  1087. gecatsim/phantom/CatSimLogo_1024/CatSim_logo_1024.json +51 -0
  1088. gecatsim/phantom/CatSimLogo_1024/CatSim_logo_1024_bone_1024x1024x1.raw +0 -0
  1089. gecatsim/phantom/CatSimLogo_1024/CatSim_logo_1024_water_1024x1024x1.raw +0 -0
  1090. gecatsim/phantom/W20.ppm +22 -0
  1091. gecatsim/phantom/W30.ppm +22 -0
  1092. gecatsim/phantom/W35.ppm +22 -0
  1093. gecatsim/phantom/analyticArtifactPhantom.ppm +41 -0
  1094. gecatsim/phantom/female_adult_average_lung_lesions_reduced.nrb +49874 -0
  1095. gecatsim/phantom/poly_bin/poly10 +0 -0
  1096. gecatsim/phantom/poly_bin/poly100 +0 -0
  1097. gecatsim/phantom/poly_bin/poly12 +0 -0
  1098. gecatsim/phantom/poly_bin/poly14 +0 -0
  1099. gecatsim/phantom/poly_bin/poly17 +0 -0
  1100. gecatsim/phantom/poly_bin/poly20 +0 -0
  1101. gecatsim/phantom/poly_bin/poly21 +0 -0
  1102. gecatsim/phantom/poly_bin/poly22 +0 -0
  1103. gecatsim/phantom/poly_bin/poly23 +0 -0
  1104. gecatsim/phantom/poly_bin/poly24 +0 -0
  1105. gecatsim/phantom/poly_bin/poly25 +0 -0
  1106. gecatsim/phantom/poly_bin/poly26 +0 -0
  1107. gecatsim/phantom/poly_bin/poly28 +0 -0
  1108. gecatsim/phantom/poly_bin/poly32 +0 -0
  1109. gecatsim/phantom/poly_bin/poly33 +0 -0
  1110. gecatsim/phantom/poly_bin/poly34 +0 -0
  1111. gecatsim/phantom/poly_bin/poly36 +0 -0
  1112. gecatsim/phantom/poly_bin/poly38 +0 -0
  1113. gecatsim/phantom/poly_bin/poly4 +0 -0
  1114. gecatsim/phantom/poly_bin/poly40 +0 -0
  1115. gecatsim/phantom/poly_bin/poly41 +0 -0
  1116. gecatsim/phantom/poly_bin/poly44 +0 -0
  1117. gecatsim/phantom/poly_bin/poly49 +0 -0
  1118. gecatsim/phantom/poly_bin/poly5 +0 -0
  1119. gecatsim/phantom/poly_bin/poly50 +0 -0
  1120. gecatsim/phantom/poly_bin/poly52 +0 -0
  1121. gecatsim/phantom/poly_bin/poly55 +0 -0
  1122. gecatsim/phantom/poly_bin/poly58 +0 -0
  1123. gecatsim/phantom/poly_bin/poly6 +0 -0
  1124. gecatsim/phantom/poly_bin/poly60 +0 -0
  1125. gecatsim/phantom/poly_bin/poly62 +0 -0
  1126. gecatsim/phantom/poly_bin/poly66 +0 -0
  1127. gecatsim/phantom/poly_bin/poly68 +0 -0
  1128. gecatsim/phantom/poly_bin/poly7 +0 -0
  1129. gecatsim/phantom/poly_bin/poly71 +0 -0
  1130. gecatsim/phantom/poly_bin/poly75 +0 -0
  1131. gecatsim/phantom/poly_bin/poly77 +0 -0
  1132. gecatsim/phantom/poly_bin/poly79 +0 -0
  1133. gecatsim/phantom/poly_bin/poly86 +0 -0
  1134. gecatsim/phantom/poly_bin/poly9 +0 -0
  1135. gecatsim/phantom/poly_bin/poly92 +0 -0
  1136. gecatsim/phantom/poly_bin/poly96 +0 -0
  1137. gecatsim/phantom/tungsten_wire.ppm +12 -0
  1138. gecatsim/phantom/vmale50_chest_less_surfaces.nrb +41545 -0
  1139. gecatsim/pyfiles/C_DD3Proj.py +57 -0
  1140. gecatsim/pyfiles/C_DD3Proj_mm.py +64 -0
  1141. gecatsim/pyfiles/C_Materials_CrossSectionDB_Initialize.py +18 -0
  1142. gecatsim/pyfiles/C_Materials_CrossSectionMAC_ByProc_Get.py +25 -0
  1143. gecatsim/pyfiles/C_Phantom_Analytic_FORBILD_to_tmp.py +13 -0
  1144. gecatsim/pyfiles/C_Projector_Analytic.py +62 -0
  1145. gecatsim/pyfiles/C_Projector_NCAT.py +66 -0
  1146. gecatsim/pyfiles/C_Projector_Polygon.py +60 -0
  1147. gecatsim/pyfiles/C_Projector_SetData.py +166 -0
  1148. gecatsim/pyfiles/C_Projector_Voxelized.py +75 -0
  1149. gecatsim/pyfiles/C_Source_Analytic_Set.py +17 -0
  1150. gecatsim/pyfiles/C_Source_NCAT_Set.py +17 -0
  1151. gecatsim/pyfiles/C_Source_Voxelized_Set.py +17 -0
  1152. gecatsim/pyfiles/C_Volume_Get.py +24 -0
  1153. gecatsim/pyfiles/C_Volume_NCAT_Get.py +24 -0
  1154. gecatsim/pyfiles/C_Volume_Poly_Get.py +24 -0
  1155. gecatsim/pyfiles/CalcCrossTalk.py +42 -0
  1156. gecatsim/pyfiles/CalcOptCrossTalk.py +39 -0
  1157. gecatsim/pyfiles/CatSim.py +88 -0
  1158. gecatsim/pyfiles/CheckModules.py +59 -0
  1159. gecatsim/pyfiles/Check_Replace_Old_Names.py +85 -0
  1160. gecatsim/pyfiles/CommonTools.py +445 -0
  1161. gecatsim/pyfiles/Detection_DAS.py +25 -0
  1162. gecatsim/pyfiles/Detection_EI.py +84 -0
  1163. gecatsim/pyfiles/Detection_Flux.py +47 -0
  1164. gecatsim/pyfiles/Detection_Lag.py +28 -0
  1165. gecatsim/pyfiles/Detection_PC.py +120 -0
  1166. gecatsim/pyfiles/Detection_prefilter.py +35 -0
  1167. gecatsim/pyfiles/Detector_RayAngles_2D.py +86 -0
  1168. gecatsim/pyfiles/Detector_ThirdgenCurved.py +119 -0
  1169. gecatsim/pyfiles/FlatPanel/Detection_DAS_FlatPanel.py +101 -0
  1170. gecatsim/pyfiles/FlatPanel/Detection_OpticalCrosstalk_FlatPanel.py +39 -0
  1171. gecatsim/pyfiles/FlatPanel/Detector_FlatPanel.py +120 -0
  1172. gecatsim/pyfiles/Gantry_Helical.py +56 -0
  1173. gecatsim/pyfiles/GetMu.py +68 -0
  1174. gecatsim/pyfiles/LowSignalCorr.py +32 -0
  1175. gecatsim/pyfiles/OneScan.py +144 -0
  1176. gecatsim/pyfiles/PhantomProjectorWrapper.py +65 -0
  1177. gecatsim/pyfiles/Phantom_Analytic.py +936 -0
  1178. gecatsim/pyfiles/Phantom_CAD_to_Polygonal.py +82 -0
  1179. gecatsim/pyfiles/Phantom_NCAT.py +96 -0
  1180. gecatsim/pyfiles/Phantom_Polygonal.py +122 -0
  1181. gecatsim/pyfiles/Phantom_Polygonal_ReadPolygon.py +58 -0
  1182. gecatsim/pyfiles/Phantom_Voxelized.py +120 -0
  1183. gecatsim/pyfiles/PrepView.py +56 -0
  1184. gecatsim/pyfiles/Prep_BHC_Accurate.py +69 -0
  1185. gecatsim/pyfiles/ReadMaterialFile.py +29 -0
  1186. gecatsim/pyfiles/Scatter_ConvolutionModel.py +44 -0
  1187. gecatsim/pyfiles/Scatter_Correction.py +52 -0
  1188. gecatsim/pyfiles/SetFocalspot.py +239 -0
  1189. gecatsim/pyfiles/Spectrum.py +130 -0
  1190. gecatsim/pyfiles/Spectrum_heel.py +146 -0
  1191. gecatsim/pyfiles/WriteRawView.py +32 -0
  1192. gecatsim/pyfiles/WriteRawViewChunk.py +40 -0
  1193. gecatsim/pyfiles/Xray_Filter.py +93 -0
  1194. gecatsim/pyfiles/__init__.py +0 -0
  1195. gecatsim/pyfiles/catvoxel.py +161 -0
  1196. gecatsim/pyfiles/randpf.py +27 -0
  1197. gecatsim/reconstruction/lib/fdk_equiAngle.dll +0 -0
  1198. gecatsim/reconstruction/lib/fdk_equiAngle.so +0 -0
  1199. gecatsim/reconstruction/lib/fdk_equiAngle_macos.so +0 -0
  1200. gecatsim/reconstruction/lib/helicalrecon.dll +0 -0
  1201. gecatsim/reconstruction/lib/helicalrecon.so +0 -0
  1202. gecatsim/reconstruction/lib/readme.md +20 -0
  1203. gecatsim/reconstruction/pyfiles/createHSP.py +81 -0
  1204. gecatsim/reconstruction/pyfiles/fdk_equiAngle.py +245 -0
  1205. gecatsim/reconstruction/pyfiles/helical_equiAngle.py +284 -0
  1206. gecatsim/reconstruction/pyfiles/mapConfigVariablesToFDK.py +38 -0
  1207. gecatsim/reconstruction/pyfiles/mapConfigVariablesToHelical.py +50 -0
  1208. gecatsim/reconstruction/pyfiles/recon.py +172 -0
  1209. gecatsim/reconstruction/src/Parallel_FDK_Helical_3DWeighting.c +211 -0
  1210. gecatsim/reconstruction/src/interface_fdk_angle.c +162 -0
  1211. gecatsim/response_matrix/PC_spectral_response_CZT0.25x0.25x1.6.mat +0 -0
  1212. gecatsim/scatter/scatter_kernel.dat +0 -0
  1213. gecatsim/spectrum/XCISTspectrum.m +262 -0
  1214. gecatsim/spectrum/convert.py +21 -0
  1215. gecatsim/spectrum/readme.md +17 -0
  1216. gecatsim/spectrum/tungsten_tar10.0_100_filt.dat +201 -0
  1217. gecatsim/spectrum/tungsten_tar10.0_110_filt.dat +221 -0
  1218. gecatsim/spectrum/tungsten_tar10.0_120_filt.dat +241 -0
  1219. gecatsim/spectrum/tungsten_tar10.0_130_filt.dat +261 -0
  1220. gecatsim/spectrum/tungsten_tar10.0_140_filt.dat +281 -0
  1221. gecatsim/spectrum/tungsten_tar10.0_70_filt.dat +141 -0
  1222. gecatsim/spectrum/tungsten_tar10.0_80_filt.dat +161 -0
  1223. gecatsim/spectrum/tungsten_tar10.0_90_filt.dat +181 -0
  1224. gecatsim/spectrum/tungsten_tar7.0_100_filt.dat +201 -0
  1225. gecatsim/spectrum/tungsten_tar7.0_110_filt.dat +221 -0
  1226. gecatsim/spectrum/tungsten_tar7.0_120_filt.dat +241 -0
  1227. gecatsim/spectrum/tungsten_tar7.0_130_filt.dat +261 -0
  1228. gecatsim/spectrum/tungsten_tar7.0_140_filt.dat +281 -0
  1229. gecatsim/spectrum/tungsten_tar7.0_70_filt.dat +141 -0
  1230. gecatsim/spectrum/tungsten_tar7.0_80_filt.dat +161 -0
  1231. gecatsim/spectrum/tungsten_tar7.0_90_filt.dat +181 -0
  1232. gecatsim/spectrum/xcist_kVp100_tar7_bin1.dat +103 -0
  1233. gecatsim/spectrum/xcist_kVp120_tar7_bin1.dat +123 -0
  1234. gecatsim/spectrum/xcist_kVp140_tar7_bin1.dat +143 -0
  1235. gecatsim/spectrum/xcist_kVp80_tar7_bin1.dat +83 -0
@@ -0,0 +1,2433 @@
1
+ // Copyright 2020, General Electric Company. All rights reserved. See https://github.com/xcist/code/blob/master/LICENSE
2
+
3
+ #define MAX(a,b) (((a) > (b)) ? (a) : (b))
4
+ #define MIN(a,b) (((a) > (b)) ? (b) : (a))
5
+ #define VERY_BIG 1e300
6
+ #define MATERIAL_INDEX_BASIS 1 //can be 1 or zero
7
+ #ifdef WIN32
8
+ #define DLLEXPORT __declspec(dllexport)
9
+ #else
10
+ #define DLLEXPORT
11
+ //#define LIMIT_LOAD
12
+ #endif
13
+
14
+ #include <math.h>
15
+ #include <stdio.h>
16
+ #include <string.h>
17
+ #include <stdlib.h>
18
+ #include <time.h>
19
+ #include <stdarg.h>
20
+ #include <pthread.h>
21
+ #include <unistd.h>
22
+
23
+ // Global Variable Definitions /////////////
24
+
25
+ int COMPARISON_NUMBER = 0;
26
+
27
+ //Parameters for Accurate Detector Model, Mingye
28
+ int Accurate_Detector_Model_is_ON = 0;
29
+ int n_col_oversample = 1;
30
+ int n_row_oversample = 1;
31
+ int n_col_oversample_add_xtalk = 1;
32
+ int n_row_oversample_add_xtalk = 1;
33
+
34
+
35
+ struct module_info
36
+ {
37
+ double *Height;
38
+ double *Width;
39
+ int *Pix;
40
+ double *Coords;
41
+ int *Sub;
42
+ double *Sampling;
43
+ double *Weight;
44
+ double *sourceWeights;
45
+ int nSubSources;
46
+ int maxPixPerModule;
47
+ int maxSubDets;
48
+ int moduleOverlapType;
49
+ };
50
+
51
+ struct module_info modules = {NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0};
52
+
53
+ struct pnt
54
+ {
55
+ double x;
56
+ double y;
57
+ double tan_angle;
58
+ double distance;
59
+ int index;
60
+ };
61
+
62
+ struct bounding_info
63
+ {
64
+ int *vertexStartIndex;
65
+ double *vertexLocations;
66
+ };
67
+
68
+ struct bounding_info bounding = {NULL,NULL};
69
+
70
+ struct phantom_info
71
+ {
72
+ int numObjects;
73
+ int *objectType;
74
+ double *objectCenter;
75
+ double *shape;
76
+ double *Qmatrix;
77
+ int *clipStartIndex;
78
+ double *clipNormalVector;
79
+ double *clipDistance;
80
+ int *nClipPlanes;
81
+ double *density;
82
+ int *materialInd;
83
+ double xbounds[2];
84
+ };
85
+
86
+ struct phantom_info phantom = {0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,{0,0}};
87
+
88
+ struct material_info
89
+ {
90
+ int materialCount;
91
+ int eBinCount;
92
+ double *muTable;
93
+ };
94
+
95
+ struct material_info materials = {0,0,NULL};
96
+
97
+ struct projector_args
98
+ {
99
+ double *Paras; //parameters for Accurate Detector Model, Mingye
100
+ double subviewWeight;
101
+ double *thisView;
102
+ double *sourcePoints;
103
+ int nSubSources;
104
+ double *srcHullPoints;
105
+ int nSrcHullPoints;
106
+ int *firstDetIndex;
107
+ int nModulesIn;
108
+ int *modTypeInds;
109
+ double *Up;
110
+ double *Right;
111
+ double *Center;
112
+ int UNUSED_tvLength;
113
+ };
114
+
115
+ struct height_lims
116
+ {
117
+ double min;
118
+ double max;
119
+ };
120
+
121
+ struct box_lims
122
+ {
123
+ double minR;
124
+ double maxR;
125
+ double minU;
126
+ double maxU;
127
+ };
128
+
129
+ double limitLoadAverage = 0;
130
+ static int nextModuleInQ;
131
+ static int modulesInQ;
132
+ static pthread_mutex_t QLock = PTHREAD_MUTEX_INITIALIZER;
133
+ static int thread_count;
134
+ static pthread_t *t_id = NULL;
135
+ static int planB_warned = 0;
136
+ static int debug_flag = 0;
137
+
138
+ struct indexed_list
139
+ {
140
+ double value;
141
+ double originalIndex;
142
+ };
143
+
144
+ //////////////////////////////////////////////
145
+
146
+ static void dbug(int level,const char *s,...)
147
+
148
+ {
149
+ if (debug_flag >= level)
150
+ {
151
+ va_list ap;
152
+ va_start(ap,s);
153
+ vprintf(s,ap);
154
+ va_end(ap);
155
+ fflush(stdout);
156
+ }
157
+ }
158
+
159
+ double solve_cubic(double *a)
160
+
161
+ {
162
+ double a12,Q,Q3,R,D,theta,srD,S,T;
163
+
164
+ a[0] = a[0]*(1.0/3.0);
165
+ a12 = a[0]*a[0];
166
+ Q = (1.0/3.0)*a[1]-a12;
167
+ Q3 = Q*Q*Q;
168
+ R = 0.5*(a[0]*a[1]-a[2])-a12*a[0];
169
+ D = Q3+R*R;
170
+ if (D<0) {
171
+ theta = acos(R/sqrt(-Q3));
172
+ return 2*sqrt(-Q)*cos(theta*(1.0/3.0))-a[0];
173
+ } else {
174
+ srD = sqrt(D);
175
+ S = cbrt(R+srD);
176
+ T = cbrt(R-srD);
177
+ return S+T-a[0];
178
+ }
179
+
180
+ }
181
+
182
+ void cross(double *vec1, double *vec2, double *vecOut)
183
+
184
+ {
185
+ vecOut[0] = vec1[1] * vec2[2] - vec1[2] * vec2[1];
186
+ vecOut[1] = vec1[2] * vec2[0] - vec1[0] * vec2[2];
187
+ vecOut[2] = vec1[0] * vec2[1] - vec1[1] * vec2[0];
188
+ }
189
+
190
+ double magnitude(double r, double i)
191
+
192
+ {
193
+ return sqrt(r*r+i*i);
194
+ }
195
+
196
+ void sqrtm(double in_r,double in_i,double *out_r,double *out_i)
197
+
198
+ {
199
+ double ang,mag;
200
+ ang = atan2(-in_i,-in_r)/2.0;
201
+ mag = sqrt(magnitude(in_r,in_i));
202
+ out_r[0] = mag*cos(ang);
203
+ out_i[0] = mag*sin(ang);
204
+ }
205
+
206
+ void complex_multiply(double r1, double i1, double r2, double i2,double *real_out, double *imag_out)
207
+
208
+ {
209
+ real_out[0] = r1*r2-i1*i2;
210
+ imag_out[0] = r1*i2+r2*i1;
211
+ }
212
+
213
+ void solve_cubic_all(double *a,double *zr,double *zi)
214
+
215
+ {
216
+ double a0,a1,a2,p,q,tmp,tmpr,tmpi,ur[3],ui[3],mag,ang,rmag2,pi = 3.141592653589793;
217
+ int i;
218
+ //Uses Cardano's method
219
+
220
+ a2 = a[0];
221
+ a1 = a[1];
222
+ a0 = a[2];
223
+
224
+ p = a1-a2*a2/3.0;
225
+ q = a0+(2.0*a2*a2*a2-9.0*a2*a1)/27.0;
226
+
227
+ tmp = q*q/4.0+p*p*p/27.0;
228
+ //printf("P Q TMP: %1.12lf %1.12lf %1.12lf\n\r",p,q,tmp);
229
+ if (q>0.0)
230
+ if(tmp >= 0)
231
+ {ur[0] = cbrt(q/2.0+sqrt(tmp));ui[0] = 0;mag = ur[0];ang = 0;}
232
+ else
233
+ {
234
+ tmpr = q/2.0;tmpi = sqrt(-tmp);
235
+ mag = cbrt(sqrt(tmpr*tmpr+tmpi*tmpi));
236
+ ang = atan2(tmpi,tmpr)/3.0;
237
+ ur[0] = mag*cos(ang);
238
+ ui[0] = mag*sin(ang);
239
+ }
240
+ else
241
+ if(tmp >= 0)
242
+ {ur[0] = cbrt(q/2.0-sqrt(tmp));ui[0] = 0;mag = ur[0];ang = 0;}
243
+ else
244
+ {
245
+ tmpr = q/2.0;tmpi = -sqrt(-tmp);
246
+ mag = cbrt(magnitude(tmpr,tmpi));
247
+ ang = atan2(tmpi,tmpr)/3.0;
248
+ ur[0] = mag*cos(ang);
249
+ ui[0] = mag*sin(ang);
250
+ }
251
+ ang += 2.0*pi/3.0;
252
+ ur[1] = mag*cos(ang);
253
+ ui[1] = mag*sin(ang);
254
+
255
+ ang += 2.0*pi/3.0;
256
+ ur[2] = mag*cos(ang);
257
+ ui[2] = mag*sin(ang);
258
+
259
+ // for(i = 0;i<3;i++) printf("%1.12lf %1.12lf %1.12lf\r\n",ur[i],ui[i],magnitude(ui[i],ur[i]));
260
+
261
+ rmag2 = 1.0/(mag*mag);
262
+
263
+ for(i = 0;i<3;i++) {
264
+ zr[i] = p/3.0*(ur[i]*rmag2)-ur[i]-a2/3;
265
+ zi[i] = p/3.0*(-ui[i]*rmag2)-ui[i];
266
+ }
267
+ // for(i = 0;i<3;i++) printf("%1.12lf %1.12lf %1.12lf\r\n",zr[i],zi[i],magnitude(zi[i],zr[i]));
268
+ }
269
+
270
+ int compare_doubles (const void *a, const void *b)
271
+
272
+ {
273
+ const double *da = (const double *) a;
274
+ const double *db = (const double *) b;
275
+
276
+ return (*da > *db) - (*da < *db);
277
+ }
278
+
279
+ int compIL (const void *a, const void *b)
280
+
281
+ {
282
+ const struct indexed_list da = * (const struct indexed_list *) a;
283
+ const struct indexed_list db = * (const struct indexed_list *) b;
284
+
285
+ return (da.value > db.value) - (da.value < db.value);
286
+ }
287
+
288
+
289
+ DLLEXPORT int solve_quartic2(double *a,double *z)
290
+
291
+ {
292
+ // Faucette's method:
293
+ // Faucette, W. M. "A Geometric Interpretation of the Solution of the General Quartic Polynomial."
294
+ // Amer. Math. Monthly 103, 51-57, 1996.
295
+
296
+ double yr[3],yi[3],a0,a1,a2,a3,p,q,r,cub[3],sr[3],si[3],zr[4],zi[4],errr,erri,err,errt = 0;
297
+ int num_real,i;
298
+
299
+ a3 = a[0];
300
+ a2 = a[1];
301
+ a1 = a[2];
302
+ a0 = a[3];
303
+
304
+ // First we solve the resolvent cubic:
305
+ p = a2-0.375*a3*a3;
306
+ q = a1-0.5*a2*a3+0.125*a3*a3*a3;
307
+ r = a0-0.25*a1*a3+0.0625*a2*a3*a3-(3.0/256.0)*a3*a3*a3*a3;
308
+ cub[0] = -2.0*p;
309
+ cub[1] = p*p-4.0*r;
310
+ cub[2] = q*q;
311
+
312
+ // for(i = 0;i<3;i++) printf("input: %1.12lf\n\r",cub[i]);
313
+
314
+ solve_cubic_all(cub,yr,yi);
315
+
316
+ // for(i = 0;i<3;i++) printf("Y%d : %1.12lf +i %1.12lf\n\r",i,yr[i],yi[i]);
317
+
318
+ for(i = 0;i<3;i++) sqrtm(yr[i],yi[i],&sr[i],&si[i]);
319
+
320
+ //for(i = 0;i<3;i++) printf("S%d : %1.12lf +i %1.12lf\n\r",i,sr[i],si[i]);
321
+
322
+ zr[0] = (sr[0]+sr[1]-sr[2])*0.5;
323
+ zr[1] = (sr[2]+sr[0]-sr[1])*0.5;
324
+ zr[2] = (sr[2]+sr[1]-sr[0])*0.5;
325
+ zr[3] = -zr[0]-zr[1]-zr[2];
326
+
327
+ zi[0] = (si[0]+si[1]-si[2])*0.5;
328
+ zi[1] = (si[2]+si[0]-si[1])*0.5;
329
+ zi[2] = (si[2]+si[1]-si[0])*0.5;
330
+ zi[3] = -zi[0]-zi[1]-zi[2];
331
+
332
+ for(i = 0;i<4;i++){
333
+ complex_multiply(zr[i],zi[i],zr[i],zi[i],&errr,&erri);
334
+ errr += p;
335
+ complex_multiply(errr,erri,zr[i],zi[i],&errr,&erri);
336
+ errr += q;
337
+ complex_multiply(errr,erri,zr[i],zi[i],&errr,&erri);
338
+ errr += r;
339
+ errr = magnitude(errr,erri);
340
+ errt += errr*errr;
341
+ }
342
+ errt = sqrt(errt);
343
+
344
+ if (errt>1e-5){
345
+ zr[0] += sr[2];
346
+ zr[1] -= sr[2];
347
+ zr[2] -= sr[2];
348
+ zr[3] += sr[2];
349
+ zi[0] += si[2];
350
+ zi[1] -= si[2];
351
+ zi[2] -= si[2];
352
+ zi[3] += si[2];
353
+ }
354
+ for(i = 0;i<4;i++) zr[i] -= a3/4;
355
+ num_real = 0;
356
+ for(i = 0;i<4;i++) if ((fabs(zi[i])/fabs(zr[i]))<1e-10) {z[num_real] = zr[i];num_real++;}
357
+ qsort(z,num_real,sizeof(double),compare_doubles);
358
+ return num_real;
359
+ }
360
+
361
+ //function z = solve_quartic(a)
362
+ //
363
+ // -----------------------------------------------------------------------
364
+ //
365
+ // Routine
366
+ // solve_quartic : Computes the roots of a quartic equation.
367
+ //
368
+ // Author
369
+ // Jed Pack (GE Global Research)
370
+ // packj@research.ge.com
371
+ //
372
+ // Inputs
373
+ // a : Vector containing [a_4, a_3, a_2, a_1, a_0] where the equation to
374
+ // be solved is:
375
+ //
376
+ // a_4 x^4 + a_3 x^3 + a_2 x^2 + a_1 x + a_0 = 0
377
+ //
378
+ // Note: If only four parameters are given, it is assumed a_4 is 1.
379
+ //
380
+ //
381
+ // Outputs
382
+ // z : The roots of the equation
383
+ // -----------------------------------------------------------------------
384
+
385
+
386
+ DLLEXPORT int solve_quartic(double *a,double *z)
387
+
388
+ {
389
+ // Equations found in:
390
+ // Weisstein, Eric W. "Quartic Equation." From MathWorld--A Wolfram Web Resource.
391
+ // http://mathworld.wolfram.com/QuarticEquation.html
392
+
393
+ double tmp,y1,tmp2,R,alpha,beta,D,E,Dt,Et,cub[3];
394
+ int i;
395
+
396
+ tmp = a[0];
397
+ for(i = 0;i<4;i++) a[i] = a[i+1]/tmp;
398
+
399
+ tmp = 0.25*a[0]*a[0]-a[1];
400
+ cub[0] = -a[1];
401
+ cub[1] = a[2]*a[0]-4.0*a[3];
402
+ cub[2] = 4.0*a[1]*a[3]-a[2]*a[2]-a[0]*a[0]*a[3];
403
+ y1 = solve_cubic(cub);
404
+
405
+
406
+ // Next we compute R, D, and E:
407
+ tmp2 = tmp+y1;
408
+ //printf("y1 = %1.12lf\n\rtmp = %1.12lf %1.12lf\n\r",y1,tmp,fabs(tmp2)/MAX(1.0,fabs(tmp)));
409
+ if (fabs(tmp2)/MAX(1.0,fabs(tmp))>1e-4){
410
+ if (tmp2>0){
411
+ R = sqrt(tmp2);
412
+ alpha = 0.75*a[0]*a[0]-R*R-2.0*a[1];
413
+ beta = 0.25*(4.0*a[0]*a[1]-8.0*a[2]-a[0]*a[0]*a[0])/R;
414
+ Dt = alpha+beta;
415
+ Et = alpha-beta;
416
+ // printf("Dt = %1.12f\n\rEt = %1.12f\n\r",Dt,Et);
417
+
418
+ if (Dt>0){
419
+ D = sqrt(Dt);
420
+ z[1] = -0.25*a[0]+0.5*R+0.5*D;
421
+ z[0] = -0.25*a[0]+0.5*R-0.5*D;
422
+ //printf(" E = %1.12lf %1.12lf %1.12lf\n\r",D,R,z[0]);
423
+ if (Et>0){
424
+ E = sqrt(Et);
425
+ z[3] = -0.25*a[0]-0.5*R+0.5*E;
426
+ z[2] = -0.25*a[0]-0.5*R-0.5*E;
427
+ if (z[2]<z[1]){
428
+ tmp = z[1];z[1] = z[2];z[2] = tmp;
429
+ if (z[1]<z[0]){tmp = z[0];z[0] = z[1];z[1] = tmp;}
430
+ if (z[3]<z[2]){tmp = z[2];z[2] = z[3];z[3] = tmp;if (z[2]<z[1]){tmp = z[1];z[1] = z[2];z[2] = tmp;}}
431
+ }
432
+ return 4;
433
+ } else return 2;
434
+ } else{
435
+ if (Et>0){
436
+ E = sqrt(Et);
437
+ z[1] = -0.25*a[0]-0.5*R+0.5*E;
438
+ z[0] = -0.25*a[0]-0.5*R-0.5*E;
439
+ return 2;
440
+ } else return 0;
441
+ }
442
+ }
443
+ else return 0;
444
+ }
445
+ else {
446
+ //for(i = 0;i<4;i++) printf("input: %1.12lf\n\r",a[i]);
447
+ return solve_quartic2(a,z);
448
+ // return -1;
449
+ }
450
+ }
451
+
452
+ double quadratic_form(double *vec1,double *matrix, double *vec2)
453
+ {
454
+ int i;
455
+ double x = 0;
456
+ for(i = 0;i<3;i++){x += (matrix[i]*vec2[0]+matrix[i+3]*vec2[1]+matrix[i+6]*vec2[2])*vec1[i];}
457
+ return x;
458
+ }
459
+
460
+ /*
461
+ int quartic_intersect_C(double *a0,double *Qlp,double *Qrp,double shp,double *alpha,double *tc,int obj)
462
+ {
463
+ int i,out;
464
+ double scale,displ,a0t[3],tmp[3],aa,b,c,d,e,f,C[5],*Ql,*Qr,sh;
465
+
466
+ Ql = &phantom.Qmatrix[obj*18];
467
+ // printf("%1.12lf %1.12lf",phantom.Qmatrix[obj);
468
+ // for(i = 1;i<9;i++) printf("L %1.12lf %1.12lf diff: %1.12lf\r\n",Ql[i],Qlp[i],Ql[i]-Qlp[i]);
469
+ Qr = &phantom.Qmatrix[obj*18+9];
470
+ // for(i = 1;i<9;i++) printf("R %1.12lf %1.12lf diff: %1.12lf\r\n",Qr[i],Qrp[i],Qr[i]-Qrp[i]);
471
+ sh = phantom.shape[obj];
472
+ // printf("s diff: %1.12lf\r\n",sh-shp);
473
+
474
+ scale = 1.0;
475
+ displ = 0;
476
+ for(i = 0;i<3;i++) displ += a0[i]*a0[i];
477
+ displ = sqrt(displ); // scaling/displacement done only f0r numerical reasons
478
+
479
+ for(i = 0;i<3;i++) a0t[i] = (a0[i]+displ*alpha[i])/scale;
480
+
481
+ // The quartic formula is of the form A t^4 + B t^3 + C t^2 + D t + E = 0
482
+ aa = quadratic_form(alpha,Ql,alpha);
483
+ b = 2.0*quadratic_form(a0t,Ql,alpha);
484
+ //c = 1-sh*sh+quadratic_form(a0t,Ql,a0t);
485
+ c = sh+quadratic_form(a0t,Ql,a0t);
486
+ d = 4.0*quadratic_form(alpha,Qr,alpha);
487
+ e = 8.0*quadratic_form(a0t,Qr,alpha);
488
+ f = 4.0*quadratic_form(a0t,Qr,a0t);
489
+
490
+ C[0] = aa*aa;
491
+ C[1] = 2*aa*b;
492
+ C[2] = b*b+2*aa*c-d;
493
+ C[3] = 2*b*c-e;
494
+ C[4] = c*c-f;
495
+
496
+ out = solve_quartic(C,tc);
497
+ for(i = 0;i<out;i++) tc[i] = tc[i]*scale+displ;
498
+ return out;
499
+ }
500
+ */
501
+
502
+ int quartic_intersect(double *a0,double *alpha,double *tc,int obj)
503
+
504
+ {
505
+ int i,out;
506
+ double scale,displ,a0t[3],tmp[3],aa,b,c,d,e,f,C[5],*Ql,*Qr,sh;
507
+
508
+ Ql = &phantom.Qmatrix[obj*18];
509
+ Qr = &phantom.Qmatrix[obj*18+9];
510
+ sh = phantom.shape[obj];
511
+ scale = 1.0;
512
+ displ = 0;
513
+ for(i = 0;i<3;i++) displ += a0[i]*a0[i];
514
+ displ = sqrt(displ); // scaling/displacement done only f0r numerical reasons
515
+
516
+ for(i = 0;i<3;i++) a0t[i] = (a0[i]+displ*alpha[i])/scale;
517
+
518
+ // The quartic formula is of the form A t^4 + B t^3 + C t^2 + D t + E = 0
519
+ aa = quadratic_form(alpha,Ql,alpha);
520
+ b = 2.0*quadratic_form(a0t,Ql,alpha);
521
+ //c = 1-sh*sh+quadratic_form(a0t,Ql,a0t);
522
+ c = sh+quadratic_form(a0t,Ql,a0t);
523
+ d = 4.0*quadratic_form(alpha,Qr,alpha);
524
+ e = 8.0*quadratic_form(a0t,Qr,alpha);
525
+ f = 4.0*quadratic_form(a0t,Qr,a0t);
526
+
527
+ C[0] = aa*aa;
528
+ C[1] = 2*aa*b;
529
+ C[2] = b*b+2*aa*c-d;
530
+ C[3] = 2*b*c-e;
531
+ C[4] = c*c-f;
532
+
533
+ out = solve_quartic(C,tc);
534
+ for(i = 0;i<out;i++) tc[i] = tc[i]*scale+displ;
535
+ return out;
536
+ }
537
+
538
+ DLLEXPORT int clip_all(double *a,double *alpha,double rayLength,double *tc2,int out,double *st_list,double *en_list,double *den_list,int *pri_list,int *mat_list,int num_int,int i)
539
+
540
+ {
541
+ double b[3], s1, s2, tcrit, tmin, tmax, *eta, *s, den;
542
+ int j, cp, firstPlane, materialIndex;
543
+
544
+ firstPlane = phantom.clipStartIndex[i];
545
+ eta = &phantom.clipNormalVector[firstPlane*3];
546
+ s = &phantom.clipDistance[firstPlane];
547
+ cp = phantom.nClipPlanes[i];
548
+ den = phantom.density[i];
549
+ materialIndex = phantom.materialInd[i];
550
+ tmin = -VERY_BIG;tmax = VERY_BIG;
551
+ for(j = 0;j<3;j++) b[j] = a[j]+rayLength*alpha[j];
552
+
553
+ for(j = 0;j<cp;j++){
554
+ s1 = (eta[j*3]*a[0]+eta[j*3+1]*a[1]+eta[j*3+2]*a[2]-s[j]);
555
+ s2 = (eta[j*3]*b[0]+eta[j*3+1]*b[1]+eta[j*3+2]*b[2]-s[j]);
556
+ if(s1*s2<0){
557
+ tcrit = fabs(s1)/(fabs(s1)+fabs(s2))*rayLength;
558
+ if (s1<s2)
559
+ {if (tcrit<tmax) tmax = tcrit;}
560
+ else
561
+ {if (tcrit>tmin) tmin = tcrit;}
562
+ }
563
+ else
564
+ if ((s1+s2)>0){
565
+ tmin = 0;tmax = 0;
566
+ break;
567
+ }
568
+ }
569
+
570
+ if(out>2) {
571
+ if(tmax<tc2[2])
572
+ out = 2;
573
+ else
574
+ if(tmin>tc2[1]) {
575
+ tc2[0] = tc2[2];
576
+ tc2[1] = tc2[3];
577
+ }
578
+ else{
579
+ tc2[3] = MIN(tmax,tc2[3]);
580
+ st_list[num_int] = tc2[2];
581
+ en_list[num_int] = tc2[3];
582
+ den_list[num_int] = den;
583
+ pri_list[num_int] = i;
584
+ mat_list[num_int] = materialIndex;
585
+ num_int = num_int+1;
586
+ }
587
+ }
588
+ tc2[1] = MIN(tmax,tc2[1]);
589
+ tc2[0] = MAX(tmin,tc2[0]);
590
+ if (tc2[1]>tc2[0]){
591
+ st_list[num_int] = tc2[0];
592
+ en_list[num_int] = tc2[1];
593
+ den_list[num_int] = den;
594
+ pri_list[num_int] = i;
595
+ mat_list[num_int] = materialIndex;
596
+ num_int = num_int+1;
597
+ }
598
+ return num_int;
599
+ }
600
+
601
+ DLLEXPORT int quadratic_intersect(double *a0,double *alpha,int pars11,double *tc2,int obj)
602
+
603
+ {
604
+ int out;
605
+ double A,B,C,tmp,*Q,k;
606
+ // The quadratic formula is of the form A t^2 + B t + C = 0
607
+ Q = &phantom.Qmatrix[obj*18];
608
+ k = phantom.shape[obj];
609
+ C = quadratic_form(a0,Q,a0)-k;
610
+ B = 2.0*quadratic_form(alpha,Q,a0);
611
+ A = quadratic_form(alpha,Q,alpha);
612
+ if ((B*B)>(4.0*A*C)) { // If sign of determinant is positive there is an intersection with the
613
+ // non-clipped quadratic
614
+ if(A >= 0.0){
615
+ tmp = sqrt(B*B-4.0*A*C);
616
+ tc2[0] = (-B-tmp)/(2.0*A);
617
+ tc2[1] = (-B+tmp)/(2.0*A);
618
+ out = 2;
619
+ } else { // For cones and hyperboloids the segment bounded by the roots may be the part
620
+ // outside the object instead of the part inside the object (i.e., when A<0)
621
+ tmp = sqrt(B*B-4.0*A*C);
622
+ tc2[0] = -VERY_BIG;
623
+ tc2[1] = (-B+tmp)/(2.0*A);
624
+ tc2[2] = (-B-tmp)/(2.0*A);
625
+ tc2[3] = VERY_BIG;
626
+ out = 4;
627
+ }
628
+ }
629
+ else
630
+ if((pars11 == 5) && (C<0)){
631
+ tc2[0] = -VERY_BIG; // For hyperboloid of one sheet the entire ray may be inside the quadratic surface
632
+ tc2[1] = VERY_BIG;
633
+ out = 2;
634
+ }
635
+ else out = 0;
636
+ return out;
637
+ }
638
+
639
+ int* my_memcpyi(int *src, int *dest, int bytes)
640
+
641
+ {
642
+ if (dest != NULL)
643
+ {
644
+ free(dest);
645
+ dest = NULL;
646
+ }
647
+ dest = (int *) malloc(bytes);
648
+ memcpy(dest, src, bytes);
649
+ return dest;
650
+ }
651
+
652
+ double* my_memcpyd(double *src, double *dest, int bytes)
653
+
654
+ {
655
+ if (dest != NULL)
656
+ {
657
+ free(dest);
658
+ dest = NULL;
659
+ }
660
+ dest = (double *) malloc(bytes);
661
+ memcpy(dest, src, bytes);
662
+ return dest;
663
+ }
664
+
665
+ DLLEXPORT void set_src_info(double *sourceWeights, int nSubSources)
666
+
667
+ {
668
+ modules.sourceWeights = my_memcpyd(sourceWeights, modules.sourceWeights, nSubSources*sizeof(double));
669
+ modules.nSubSources = nSubSources;
670
+ }
671
+
672
+ DLLEXPORT void set_module_info(double *Height, double *Width, int *Pix, double *Coords, int *Sub, double *Sampling, double *Weight, int nModuleTypes, int maxPix, int maxSubDets, int moduleOverlapType)
673
+
674
+ {
675
+ int i;
676
+ modules.Height = my_memcpyd(Height, modules.Height, nModuleTypes*sizeof(double));
677
+ modules.Width = my_memcpyd(Width, modules.Width, nModuleTypes*sizeof(double));
678
+ for(i = 0; i < nModuleTypes; i++)
679
+ {
680
+ modules.Height[i] = MAX(1e-7,modules.Height[i]);
681
+ modules.Width[i] = MAX(1e-7,modules.Width[i]);
682
+ }
683
+ modules.Pix = my_memcpyi(Pix, modules.Pix, nModuleTypes*sizeof(int));
684
+ modules.Coords = my_memcpyd(Coords, modules.Coords, maxPix*2*nModuleTypes*sizeof(double));
685
+ modules.Sub = my_memcpyi(Sub, modules.Sub, nModuleTypes*sizeof(int));
686
+ modules.Sampling = my_memcpyd(Sampling, modules.Sampling, 2*maxSubDets*nModuleTypes*sizeof(double));
687
+ modules.Weight = my_memcpyd(Weight, modules.Weight, maxSubDets*nModuleTypes*sizeof(double));
688
+ modules.maxPixPerModule = maxPix;
689
+ modules.maxSubDets = maxSubDets;
690
+ modules.moduleOverlapType = moduleOverlapType;
691
+ }
692
+
693
+ DLLEXPORT void set_bounding_info(int numObjs, int *vertexStartInd, double *vertLocs, int numVerts)
694
+
695
+ {
696
+ int i;
697
+
698
+ bounding.vertexStartIndex = my_memcpyi(vertexStartInd, bounding.vertexStartIndex, (numObjs+1)*sizeof(int));
699
+ bounding.vertexLocations = my_memcpyd(vertLocs, bounding.vertexLocations, sizeof(double)*numVerts*3);
700
+ phantom.xbounds[0]=VERY_BIG;
701
+ phantom.xbounds[1]=-VERY_BIG;
702
+ for(i=0;i<numVerts;i++) {
703
+ if (bounding.vertexLocations[i*3]>phantom.xbounds[1]) phantom.xbounds[1]=bounding.vertexLocations[i*3];
704
+ if (bounding.vertexLocations[i*3]<phantom.xbounds[0]) phantom.xbounds[0]=bounding.vertexLocations[i*3];
705
+ }
706
+ }
707
+
708
+ DLLEXPORT void set_phantom_info(int numObjs, int *objType, int *clipStInd, int *nPlanes, int *matInd, double *objCent, double *shp, double *Qmat, double *clipNormVec, double *clipDist, double *den, int totalNumPlanes)
709
+
710
+ {
711
+ phantom.numObjects = numObjs;
712
+
713
+ phantom.objectType = my_memcpyi(objType, phantom.objectType, numObjs*sizeof(int));
714
+ phantom.clipStartIndex = my_memcpyi(clipStInd, phantom.clipStartIndex, (numObjs+1)*sizeof(int));
715
+ phantom.nClipPlanes = my_memcpyi(nPlanes, phantom.nClipPlanes, numObjs*sizeof(int));
716
+ phantom.materialInd = my_memcpyi(matInd, phantom.materialInd, numObjs*sizeof(int));
717
+
718
+ phantom.objectCenter = my_memcpyd(objCent, phantom.objectCenter, numObjs*sizeof(double)*3);
719
+ phantom.shape = my_memcpyd(shp, phantom.shape, numObjs*sizeof(double));
720
+ phantom.Qmatrix = my_memcpyd(Qmat, phantom.Qmatrix, numObjs*sizeof(double)*18);
721
+ phantom.clipNormalVector = my_memcpyd(clipNormVec, phantom.clipNormalVector, sizeof(double)*totalNumPlanes*3);
722
+ phantom.clipDistance = my_memcpyd(clipDist, phantom.clipDistance, sizeof(double)*totalNumPlanes);
723
+ phantom.density = my_memcpyd(den, phantom.density, numObjs*sizeof(double));
724
+ }
725
+
726
+ DLLEXPORT void set_material_info(int materialCount, int eBinCount, double *muTable)
727
+
728
+ {
729
+ materials.materialCount = materialCount;
730
+ materials.eBinCount = eBinCount;
731
+ materials.muTable = my_memcpyd(muTable, materials.muTable, eBinCount*materialCount*sizeof(double));
732
+ }
733
+
734
+ DLLEXPORT void intersections_full_list(int *objlist, int lenObjList,double *a,double *alpha,double rayLength,double *t_ends,int *matls,double *dens,int *num_segs)
735
+
736
+ {
737
+ int i,n,p11,j,pri_list[lenObjList*2],mat_list[lenObjList*2],num_int = 0,out,*ibuff,sp,ep,lm,ibuffs,p,ip,nn,ii,seg = 0;
738
+ double tc2[4],a0[3],st_list[lenObjList*2],en_list[lenObjList*2],den_list[lenObjList*2],lc,ld; //fixme: malloc instead of lenObjList
739
+ /* int *ien, *ist;
740
+ double *el, *sl;*/ // replaced these with structures startList and endList
741
+ struct indexed_list *startList;
742
+ struct indexed_list *endList;
743
+
744
+ for(n = 0;n<lenObjList;n++){
745
+ i = objlist[n]; // Loop over objects of interest
746
+ p11 = phantom.objectType[i];
747
+ for(j = 0;j<3;j++) a0[j] = (a[j]-phantom.objectCenter[i*3+j]); // vector pointing from obj. center to src
748
+ for(j = 0;j<4;j++) tc2[j] = 0.0;
749
+ if((p11 != 3) && (p11 != 7)) // If not a torus or vessel segment
750
+ out = quadratic_intersect(a0,alpha,p11,tc2,i);
751
+ else // The torus ca$e requires solving a quartic
752
+ out = quartic_intersect(a0,alpha,tc2,i);
753
+ if(out) // At least part of the ray is inside the quadratic/quartic surface
754
+ num_int = clip_all(a,alpha,rayLength,tc2,out,st_list,en_list,den_list,pri_list,mat_list,num_int,i);
755
+ } // Loop over objects is done
756
+
757
+ if(num_int){
758
+ /* ien = malloc(sizeof(double)*num_int);
759
+ ist = malloc(sizeof(double)*num_int);
760
+ el = malloc(sizeof(double)*num_int);
761
+ sl = malloc(sizeof(double)*(num_int+1));*/ // replaced ien and el with endList, etc.
762
+ endList = malloc(sizeof(struct indexed_list)*num_int);
763
+ startList = malloc(sizeof(struct indexed_list)*(num_int+1));
764
+ ibuff = malloc(sizeof(int)*num_int);
765
+ for(i = 0;i<num_int;i++) ibuff[i] = 0;
766
+ if (num_int>1){
767
+ //for(i = 0;i<num_int;i++) {ien[i] = i;ist[i] = i;}
768
+ for(i = 0;i<num_int;i++)
769
+ {
770
+ endList[i].value = en_list[i];
771
+ startList[i].value = st_list[i];
772
+ endList[i].originalIndex = i;
773
+ startList[i].originalIndex = i;
774
+ }
775
+ //vector = en_list;//for(i = 0;i<num_int;i++) printf("en_vector: %1.12f\r\n",vector[i]);
776
+ qsort(endList,num_int,sizeof(struct indexed_list),compIL);
777
+ //vector = st_list;//for(i = 0;i<num_int;i++) printf("st_vector: %1.12f\r\n",vector[i]);
778
+ qsort(startList,num_int,sizeof(struct indexed_list),compIL);
779
+ //for(i = 0;i<num_int;i++)
780
+ //{
781
+ // el[i] = en_list[ien[i]];sl[i] = st_list[ist[i]];
782
+ // //printf("sl %1.12lf el %1.12lf ist: %d ien: %d\r\n",sl[i],el[i],ist[i],ien[i]);
783
+ // //if (i>0) if(sl[i]<sl[i-1]) printf("ERROR!! %1.12lf\r\n",a0[10000]);
784
+ //}
785
+ //printf("b%d\r\n",num_int);
786
+ }
787
+ else {
788
+ /* sl[0] = st_list[0];
789
+ el[0] = en_list[0];
790
+ ien[0] = 0;
791
+ ist[0] = 0;*/
792
+ startList[0].value = st_list[0];
793
+ endList[0].value = en_list[0];
794
+ startList[0].originalIndex = 0;
795
+ endList[0].originalIndex = 0;
796
+ }
797
+ //printf("c%d\r\n",num_int);
798
+ // sl[num_int] = el[num_int-1]+1;
799
+ startList[num_int].value = endList[num_int-1].value+1;
800
+ sp = 0;ep = 0;lc = 0;ld = 0;lm = MATERIAL_INDEX_BASIS;ibuffs = 0; // sp points to the current interval start
801
+ // ep points to the current interval End
802
+ // lc : last change (transition from one object to another)
803
+ // ld : last density
804
+ // lm : last material
805
+ while(ep<num_int){
806
+ //printf("E %1.12lf %1.12lf %1.12lf %d %d\r\n",sl[0],el[0],sl[1],sp,ep);
807
+ //if (sl[sp]<el[ep]){
808
+ if (startList[sp].value<endList[ep].value){
809
+ //printf("f%d\r\n",num_int);
810
+ p = startList[sp].originalIndex;
811
+ // push into ibuff
812
+ ip = 0;
813
+ while(ibuffs>ip){
814
+ if(pri_list[p]>pri_list[ibuff[ip]])
815
+ break;
816
+ ip++;
817
+ }
818
+ for(i = ibuffs;i>ip;i--) ibuff[i] = ibuff[i-1];
819
+ ibuff[ip] = p;
820
+ ibuffs++;
821
+ if(ip == 0) {
822
+ // mb[lm-MATERIAL_INDEX_BASIS] = mb[lm-MATERIAL_INDEX_BASIS]+ld*(st_list[p]-lc);
823
+ t_ends[seg] = st_list[p];
824
+ matls[seg] = lm;
825
+ dens[seg] = ld;
826
+ // printf("dens[%d]: %1.12lf\r\n",seg,dens[seg]);
827
+ // printf("t_ends[%d]: %1.12lf\r\n",seg,t_ends[seg]);
828
+ seg++;
829
+ lc = st_list[p];
830
+ ld = den_list[p];
831
+ lm = mat_list[p];
832
+ }
833
+ sp++;
834
+ }
835
+ else {
836
+ p = endList[ep].originalIndex;
837
+ // pull out of ibuff
838
+ ip = 0;
839
+ while(ibuff[ip] != p) ip++;
840
+ for(i = ip;i<(ibuffs-1);i++) ibuff[i] = ibuff[i+1];
841
+ ibuffs--;
842
+ if(ip == 0){
843
+ // mb[lm-MATERIAL_INDEX_BASIS] = mb[lm-MATERIAL_INDEX_BASIS]+ld*(en_list[p]-lc);
844
+ t_ends[seg] = en_list[p];
845
+ matls[seg] = lm;
846
+ dens[seg] = ld;
847
+ // printf("dens[%d]: %1.12lf\r\n",seg,dens[seg]);
848
+ // printf("t_ends[%d]: %1.12lf\r\n",seg,t_ends[seg]);
849
+ seg++;
850
+ lc = en_list[p];
851
+ if(ibuffs) {
852
+ ld = den_list[ibuff[0]];
853
+ lm = mat_list[ibuff[0]];
854
+ }
855
+ else
856
+ ld = 0; // lm shouldn't matter when ld = 0 so we leave it alone
857
+ }
858
+ ep++;
859
+ }
860
+ }
861
+ /* free(ien);
862
+ free(ist);
863
+ free(el);
864
+ free(sl);*/
865
+ free(startList);
866
+ free(endList);
867
+ free(ibuff);
868
+ }
869
+ num_segs[0] = seg;
870
+ }
871
+
872
+ DLLEXPORT void make_vol(float *volume, int Nx, double xoff, double dx, int Ny, double yoff, double dy, int Nz, double zoff, double dz, int oversampling, int UNUSED_num_volumes, int material_volumes)
873
+
874
+ {
875
+ int i, j, k, l, m, p, *matls, *objlist, num_segs, energyBinsToSkip = 0, volume_offset;
876
+ double a[3], alpha[3], *t_ends, *dens, rayLength, xbrd, *matl_tabl;
877
+
878
+ matl_tabl = malloc(sizeof(double)*materials.materialCount);
879
+ matls = malloc(sizeof(int)*phantom.numObjects*4);
880
+ objlist = malloc(sizeof(int)*phantom.numObjects);
881
+ t_ends = malloc(sizeof(double)*phantom.numObjects*4);
882
+ dens = malloc(sizeof(double)*phantom.numObjects*4);
883
+ for(i = 0;i<materials.materialCount;i++) {
884
+ if (material_volumes)
885
+ matl_tabl[i] = 1.0/(oversampling*oversampling);
886
+ else
887
+ matl_tabl[i] = materials.muTable[i+materials.materialCount*energyBinsToSkip]/(oversampling*oversampling);
888
+ printf("\n\rmat%d: %1.12lf\n\r",i,matl_tabl[i]*oversampling*oversampling);
889
+ }
890
+ dy = dy/oversampling;
891
+ yoff = oversampling*(yoff-1)+(oversampling+1)*0.5;
892
+ dz = dz/oversampling;
893
+ zoff = oversampling*(zoff-1)+(oversampling+1)*0.5;
894
+ for(i = 0;i<phantom.numObjects;i++) objlist[i] = i;
895
+
896
+ alpha[0] = 1;
897
+ alpha[1] = 0;
898
+ alpha[2] = 0;
899
+ a[0] = phantom.xbounds[0] - 1;
900
+ rayLength = phantom.xbounds[1] + 1 - phantom.xbounds[0];
901
+ dbug(1,"\n\n\rphantom.xbounds[0]: %1.12lf \n\r phantom.xbounds[0]: %1.12lf \n\rmaterial_volumes: %d",phantom.xbounds[0],phantom.xbounds[1],material_volumes);
902
+ for(l = 0;l<Nz;l++)
903
+ for(k = l*oversampling;k<l*oversampling+oversampling;k++){
904
+ a[2] = (k+1-zoff)*dz;
905
+ for(m = 0;m<Ny;m++)
906
+ for(j = m*oversampling;j<m*oversampling+oversampling;j++){
907
+ a[1] = (j+1-yoff)*dy;
908
+ num_segs = 0;
909
+ intersections_full_list(objlist, phantom.numObjects, a, alpha, rayLength, t_ends, matls, dens, &num_segs);
910
+ for(i = 0;i<num_segs;i++){
911
+ t_ends[i] = t_ends[i]+a[0];
912
+ //printf("%1.12lf\r\n",t_ends[i]);
913
+ }
914
+ //printf("%d %d %d\r\n",j,k,num_segs);
915
+ //printf("%d",j);
916
+ i = 0;p = 0;
917
+ xbrd = (i+0.5-xoff)*dx;
918
+ while((t_ends[p]<xbrd) && (p<num_segs)) p++;
919
+ while((i<Nx) && (p<num_segs)){
920
+ volume_offset = Nx*m+Nx*Ny*l+Nx*Ny*Nz*(matls[p]-MATERIAL_INDEX_BASIS)*material_volumes;
921
+ // dbug(1,"%d ",volume_offset);
922
+ while((xbrd<t_ends[p]) && (i<Nx)) {
923
+ volume[i+volume_offset] += dens[p]*matl_tabl[matls[p]-MATERIAL_INDEX_BASIS];
924
+ // dbug(1,"%d ",matls[p]-MATERIAL_INDEX_BASIS);
925
+ //printf("%1.12lf %1.12lf %d\r\n",xbrd,volume[i+Nx*m+Nx*Ny*l],i+Nx*m+Nx*Ny*l);
926
+ xbrd += dx;i++;
927
+ }
928
+ // Remove patrial volume contributions
929
+ if (xbrd>t_ends[p]){
930
+ i--;xbrd -= dx;
931
+ volume[i+volume_offset] -= dens[p]*matl_tabl[matls[p]-MATERIAL_INDEX_BASIS]*(dx+xbrd-t_ends[p])/dx;
932
+ //printf("B %1.12lf %1.12lf\r\n",xbrd,volume[i+Nx*m+Nx*Ny*l]);
933
+ if (p+1<num_segs){
934
+ volume_offset = Nx*m+Nx*Ny*l+Nx*Ny*Nz*(matls[p+1]-MATERIAL_INDEX_BASIS)*material_volumes;
935
+ volume[i+volume_offset] -= dens[p+1]*matl_tabl[matls[p+1]-MATERIAL_INDEX_BASIS]*(t_ends[p]-xbrd)/dx;
936
+ }
937
+ //printf("C %1.12lf %1.12lf %d\r\n",xbrd,volume[i+Nx*m+Nx*Ny*l],i+Nx*m+Nx*Ny*l);
938
+ }
939
+ p++;
940
+ }
941
+ }
942
+ }
943
+ free(matl_tabl);
944
+ free(matls);
945
+ free(objlist);
946
+ free(t_ends);
947
+ free(dens);
948
+ }
949
+
950
+ DLLEXPORT void intersections(int *objlist,int lenObjList,double *a,double *alpha,double rayLength,double *mb)
951
+
952
+ {
953
+ int i,n,p11,j,pri_list[lenObjList*2],mat_list[lenObjList*2],num_int = 0,out,*ibuff,sp,ep,lm,ibuffs,p,ip,nn,ii;
954
+ double tc2[4],a0[3],st_list[lenObjList*2],en_list[lenObjList*2],den_list[lenObjList*2],lc,ld; //fixme: malloc instead of lenObjList
955
+ /* int *ien, *ist;
956
+ double *el, *sl;*/ // replaced these with structures startList and endList
957
+ struct indexed_list *startList;
958
+ struct indexed_list *endList;
959
+
960
+ // printf("objlist: %d lenObjList: %d a = [%lf %lf %lf] alpha = [%lf %lf %lf] maxD: %lf mb[0]: %lf\n",objlist[0],lenObjList,a[0],a[1],a[2],alpha[0],alpha[1],alpha[2],maxD,mb[0]);
961
+ for(n = 0;n<lenObjList;n++){
962
+ i = objlist[n]; // Loop over objects of interest
963
+ // if((i == 4) && (prnt)) pnt = 1; else pnt = 0;
964
+ p11 = phantom.objectType[i];
965
+ for(j = 0;j<3;j++) a0[j] = (a[j]-phantom.objectCenter[i*3+j]); // vector pointing from obj. center to src
966
+ for(j = 0;j<4;j++) tc2[j] = 0.0;
967
+ if((p11 != 3) && (p11 != 7)) // If not a torus or vessel segment
968
+ out = quadratic_intersect(a0,alpha,p11,tc2,i);
969
+ else // The torus ca$e requires solving a quartic
970
+ out = quartic_intersect(a0,alpha,tc2,i);
971
+ //if((pnt) && (tc2[0]>100.0))
972
+ // printf("Intersection points for object 5, module 181:\r\n %1.12lf %1.12lf\r\n\r\n",tc2[0],tc2[1]);
973
+ //if (out != 0) {for(ii = 0;ii<out;ii++) printf("%1.12lf ",tc2[ii]); printf("\r\n");}
974
+ if(out) // At least part of the ray is inside the quadratic/quartic surface
975
+ num_int = clip_all(a,alpha,rayLength,tc2,out,st_list,en_list,den_list,pri_list,mat_list,num_int,i);
976
+ } // Loop over objects is done
977
+ //printf("%d\r\n",num_int);
978
+
979
+ if(num_int){
980
+ /* ien = malloc(sizeof(double)*num_int);
981
+ ist = malloc(sizeof(double)*num_int);
982
+ el = malloc(sizeof(double)*num_int);
983
+ sl = malloc(sizeof(double)*(num_int+1));*/ // replaced ien and el with endList, etc.
984
+ endList = malloc(sizeof(struct indexed_list)*num_int);
985
+ startList = malloc(sizeof(struct indexed_list)*(num_int+1));
986
+ ibuff = malloc(sizeof(int)*num_int);
987
+ for(i = 0;i<num_int;i++) ibuff[i] = 0;
988
+ //printf("a%d\r\n",num_int);
989
+ if (num_int>1){
990
+ //for(i = 0;i<num_int;i++) {ien[i] = i;ist[i] = i;}
991
+ for(i = 0;i<num_int;i++)
992
+ {
993
+ endList[i].value = en_list[i];
994
+ startList[i].value = st_list[i];
995
+ endList[i].originalIndex = i;
996
+ startList[i].originalIndex = i;
997
+ }
998
+ //vector = en_list;//for(i = 0;i<num_int;i++) printf("en_vector: %1.12f\r\n",vector[i]);
999
+ qsort(endList,num_int,sizeof(struct indexed_list),compIL);
1000
+ //vector = st_list;//for(i = 0;i<num_int;i++) printf("st_vector: %1.12f\r\n",vector[i]);
1001
+ qsort(startList,num_int,sizeof(struct indexed_list),compIL);
1002
+ //for(i = 0;i<num_int;i++)
1003
+ //{
1004
+ // el[i] = en_list[ien[i]];sl[i] = st_list[ist[i]];
1005
+ // //printf("sl %1.12lf el %1.12lf ist: %d ien: %d\r\n",sl[i],el[i],ist[i],ien[i]);
1006
+ // //if (i>0) if(sl[i]<sl[i-1]) printf("ERROR!! %1.12lf\r\n",a0[10000]);
1007
+ //}
1008
+ //printf("b%d\r\n",num_int);
1009
+ }
1010
+ else {
1011
+ /* sl[0] = st_list[0];
1012
+ el[0] = en_list[0];
1013
+ ien[0] = 0;
1014
+ ist[0] = 0;*/
1015
+ startList[0].value = st_list[0];
1016
+ endList[0].value = en_list[0];
1017
+ startList[0].originalIndex = 0;
1018
+ endList[0].originalIndex = 0;
1019
+ }
1020
+ //printf("c%d\r\n",num_int);
1021
+ // sl[num_int] = el[num_int-1]+1;
1022
+ startList[num_int].value = endList[num_int-1].value+1;
1023
+ sp = 0;ep = 0;lc = 0;ld = 0;lm = MATERIAL_INDEX_BASIS;ibuffs = 0; // sp points to the current interval start
1024
+ // ep points to the current interval End
1025
+ // lc : last change (transition from one object to another)
1026
+ // ld : last density
1027
+ // lm : last material
1028
+ //printf("d%d\r\n",num_int);
1029
+ while(ep<num_int){
1030
+ //printf("E %1.12lf %1.12lf %1.12lf %d %d\r\n",sl[0],el[0],sl[1],sp,ep);
1031
+ //if (sl[sp]<el[ep]){
1032
+ if (startList[sp].value<endList[ep].value){
1033
+ //printf("f%d\r\n",num_int);
1034
+ p = startList[sp].originalIndex;
1035
+ // push into ibuff
1036
+ ip = 0;
1037
+ while(ibuffs>ip){
1038
+ if(pri_list[p]>pri_list[ibuff[ip]])
1039
+ break;
1040
+ ip++;
1041
+ }
1042
+ for(i = ibuffs;i>ip;i--) ibuff[i] = ibuff[i-1];
1043
+ ibuff[ip] = p;
1044
+ ibuffs++;
1045
+ //for(i = 0;i<ibuffs;i++) printf("Ibuff: %d\n\r",ibuff[i]);
1046
+ if(ip == 0) {
1047
+ mb[lm-MATERIAL_INDEX_BASIS] = mb[lm-MATERIAL_INDEX_BASIS]+ld*(st_list[p]-lc);
1048
+ lc = st_list[p];
1049
+ ld = den_list[p];
1050
+ lm = mat_list[p];
1051
+ }
1052
+ sp++;
1053
+ }
1054
+ else {
1055
+ //printf("g%d\r\n",num_int);
1056
+ //printf("g%d%d\r\n",num_int,ibuff[0]);
1057
+ p = endList[ep].originalIndex;
1058
+ // pull out of ibuff
1059
+ ip = 0;
1060
+ //printf("h%d %d\r\n",p,ibuffs);
1061
+ //for(i = 0;i<ibuffs;i++) printf("ibuff/w: %d\n\r",ibuff[i]);
1062
+ while(ibuff[ip] != p) ip++;
1063
+ //printf("i%d\r\n",num_int);
1064
+ for(i = ip;i<(ibuffs-1);i++) ibuff[i] = ibuff[i+1];
1065
+ //printf("j%d\r\n",num_int);
1066
+ ibuffs--;
1067
+ //for(i = 0;i<ibuffs;i++) printf("ibuff/wo: %d\n\r",ibuff[i]);
1068
+ //printf("k%d\r\n",num_int);
1069
+ if(ip == 0){
1070
+ //printf("l %1.12lf %d %1.12lf %1.12lf %d %1.12lf\r\n",mb[0],lm,ld,en_list[0],p,lc);
1071
+ mb[lm-MATERIAL_INDEX_BASIS] = mb[lm-MATERIAL_INDEX_BASIS]+ld*(en_list[p]-lc);
1072
+ // printf("ld: %1.12lf diff: %1.12lf\r\n",ld,en_list[p]-lc);
1073
+ //printf("m%d\r\n",num_int);
1074
+ lc = en_list[p];
1075
+ //printf("n%d\r\n",num_int);
1076
+ if(ibuffs) {
1077
+ //printf("o%d\r\n",num_int);
1078
+ ld = den_list[ibuff[0]];
1079
+ //printf("p%d\r\n",num_int);
1080
+ lm = mat_list[ibuff[0]];
1081
+ //printf("q%d\r\n",num_int);
1082
+ }
1083
+ else
1084
+ ld = 0; // lm shouldn't matter when ld = 0 so we leave it alone
1085
+ }
1086
+ ep++;
1087
+ }
1088
+ }
1089
+ /* free(ien);
1090
+ free(ist);
1091
+ free(el);
1092
+ free(sl);*/
1093
+ free(startList);
1094
+ free(endList);
1095
+ free(ibuff);
1096
+ }
1097
+ }
1098
+
1099
+ int compare_pts (const void *a, const void *b)
1100
+
1101
+ {
1102
+ int prelim_return;
1103
+
1104
+ const struct pnt *da = (const struct pnt *) a;
1105
+ const struct pnt *db = (const struct pnt *) b;
1106
+
1107
+ prelim_return = (da[0].tan_angle > db[0].tan_angle) - (da[0].tan_angle < db[0].tan_angle);
1108
+
1109
+ // dbug(2,"\n\rcompare_pts: %f %f %d",da[0].tan_angle,db[0].tan_angle,prelim_return);
1110
+
1111
+ if (prelim_return == 0)
1112
+ {
1113
+ prelim_return = (da[0].distance > db[0].distance) - (da[0].distance < db[0].distance);
1114
+ // dbug(2,"\n\r compare_pts2: %f %f %d",da[0].distance,db[0].distance,prelim_return);
1115
+ }
1116
+ return prelim_return;
1117
+ }
1118
+
1119
+ int compute_convex_hull_2d(double* x,double* y,int pts,int* list)
1120
+
1121
+ /* we use the graham scan algorithm (http://en.wikipedia.org/wiki/Graham_scan) */
1122
+
1123
+ {
1124
+ int min_index = 0,i,list_length = 2;
1125
+ double min_y = y[0];
1126
+ struct pnt *points;
1127
+ const int one_based = 0;
1128
+
1129
+ for(i=0;i<pts;i++)
1130
+ dbug(2,"x[%d] = %12.4lf y[%d] = %12.4lf\r\n",i,x[i],i,y[i]);
1131
+ //dbug(3,"a\n\r");
1132
+ //
1133
+ // First we find the point with lowest y coordinate
1134
+ //
1135
+ for(i = 1;i<pts;i++)
1136
+ if (y[i]<min_y)
1137
+ {min_y = y[i];min_index = i;}
1138
+ //dbug(3,"f %d %d\n\n\r",sizeof(struct pnt),pts);
1139
+ points = malloc(sizeof(struct pnt)*pts);
1140
+ //dbug(3,"g\n\r");
1141
+ for(i = 0;i<pts;i++)
1142
+ {
1143
+ //dbug(3,"e (%d/%d)\n\r",i,pts-1);
1144
+ points[i].x = x[i];
1145
+ points[i].y = y[i];
1146
+ points[i].index = i;
1147
+ points[i].tan_angle = -(x[i] - x[min_index]) / (y[i] - y[min_index]);
1148
+ points[i].distance = sqrt((x[i] - x[min_index]) * (x[i] - x[min_index]) + (y[i] - y[min_index]) * (y[i] - y[min_index]));
1149
+ }
1150
+ points[min_index].tan_angle = -1.0 / 0.0; //-inf (this ensures we get the right starting point)
1151
+
1152
+ //dbug(3,"m\n\r");
1153
+
1154
+ //
1155
+ // Next, we sort by angle, breaking ties by comparing the distance (this is the only step that is O(n log n), the others are O(n))
1156
+ //
1157
+ qsort(points,pts,sizeof(struct pnt),compare_pts);
1158
+
1159
+ for(i = 0;i<pts;i++)
1160
+ dbug(2,"points[%d].x = %12.4lf points[%d].y = %12.4lf\r\n",i,points[i].x,i,points[i].y);
1161
+
1162
+ //
1163
+ // Finally, we loop through the points discarding one whenever we encounter a left turn instead of a right turn
1164
+ //
1165
+
1166
+ list[0] = 0;list[1] = 1;
1167
+
1168
+ for(i = 2;i<pts;i++)
1169
+ {
1170
+ while ((list_length >= 2) && (((points[list[list_length-1]].x - points[list[list_length-2]].x) * (points[i].y - points[list[list_length-2]].y) - (points[list[list_length-1]].y - points[list[list_length-2]].y) * (points[i].x - points[list[list_length-2]].x)) <= 0))
1171
+ list_length--;
1172
+ list[list_length] = i;
1173
+ list_length++;
1174
+ }
1175
+ //dbug(3,"q\n\r");
1176
+
1177
+ for(i = 0;i<list_length;i++)
1178
+ list[i] = points[list[i]].index + one_based;
1179
+
1180
+ for(i = 0;i<list_length;i++)
1181
+ dbug(2,"i: %d list[i]: %d points[list[i]].x: %5.4lf points[list[i]].y: %5.4lf\n\r",i,list[i],points[list[i]].x,points[list[i]].y);// this line may have a bug
1182
+
1183
+ free(points);points = NULL;
1184
+ //dbug(3,"z\n\r");
1185
+ return list_length;
1186
+ }
1187
+
1188
+ void crop_polygon_FMtest(double *x, double *y, int *indexList, int *listLength, double height, double width, int projPoints)
1189
+
1190
+ {
1191
+ int i,j,currentIndex;
1192
+ //dbug(3,"Point A\n\r");
1193
+ double halfHeight = height/2;
1194
+ double halfWidth = width/2;
1195
+ double *distOutside = NULL;
1196
+ int numOutside, lastOutside;
1197
+ int *nextIndex = NULL;
1198
+ int *prevIndex = NULL;
1199
+ int startInside, startOutside;
1200
+ int choppedPoints = 0;
1201
+ double frac;
1202
+
1203
+
1204
+ //dbug(3,"Point B\n\r");
1205
+ distOutside = malloc(sizeof(double)*(listLength[0]+8)); // the +8 is to allow up to two new points for each module edge
1206
+ nextIndex = malloc(sizeof(int)*(listLength[0]+8));
1207
+ prevIndex = malloc(sizeof(int)*(listLength[0]+8));
1208
+
1209
+ for(i = 0;i<listLength[0]-1;i++)
1210
+ {
1211
+ nextIndex[i] = i+1;
1212
+ prevIndex[i+1] = i;
1213
+ }
1214
+ nextIndex[listLength[0]-1] = 0;
1215
+ prevIndex[0] = listLength[0]-1;
1216
+ currentIndex = 0;
1217
+
1218
+ for(j = 0;j<4;j++)
1219
+ {
1220
+ //dbug(3,"Point %d, currentIndex: %d\n\r",j,currentIndex);
1221
+ switch(j)
1222
+ {
1223
+ case 0:
1224
+ distOutside[currentIndex] = x[indexList[currentIndex]] - halfWidth;
1225
+ break;
1226
+ case 1:
1227
+ distOutside[currentIndex] = - x[indexList[currentIndex]] - halfWidth;
1228
+ break;
1229
+ case 2:
1230
+ distOutside[currentIndex] = y[indexList[currentIndex]] - halfHeight;
1231
+ break;
1232
+ case 3:
1233
+ distOutside[currentIndex] = - y[indexList[currentIndex]] - halfHeight;
1234
+ break;
1235
+ }
1236
+ //dbug(3,"Point %d\n\r",j);
1237
+ lastOutside = (distOutside[currentIndex] > 0);
1238
+ numOutside = lastOutside;
1239
+ startInside = -1;
1240
+ startOutside = -1;
1241
+ currentIndex = nextIndex[currentIndex];
1242
+ for(i = 1; i<listLength[0]-choppedPoints; i++, currentIndex = nextIndex[currentIndex])
1243
+ {
1244
+ //dbug(3,"Point j: %d , i: %d\n\r",j,i);
1245
+ switch(j)
1246
+ {
1247
+ case 0:
1248
+ distOutside[currentIndex] = x[indexList[currentIndex]] - halfWidth;
1249
+ break;
1250
+ case 1:
1251
+ distOutside[currentIndex] = - x[indexList[currentIndex]] - halfWidth;
1252
+ break;
1253
+ case 2:
1254
+ distOutside[currentIndex] = y[indexList[currentIndex]] - halfHeight;
1255
+ break;
1256
+ case 3:
1257
+ distOutside[currentIndex] = - y[indexList[currentIndex]] - halfHeight;
1258
+ break;
1259
+ }
1260
+ numOutside += (distOutside[currentIndex] > 0);
1261
+ if ((lastOutside == 0) && (distOutside[currentIndex] > 0))
1262
+ startOutside = currentIndex;
1263
+ if ((lastOutside == 1) && (distOutside[currentIndex] < 0))
1264
+ startInside = currentIndex;
1265
+ //dbug(2,"lastOutside: %d currentIndex: %d nextindex[currentindex]: %d\n\r",lastOutside,currentIndex, nextIndex[currentIndex]);
1266
+ lastOutside = (distOutside[currentIndex] > 0);
1267
+ }
1268
+ if ((lastOutside == 0) && (distOutside[currentIndex] > 0))
1269
+ startOutside = currentIndex;
1270
+ if ((lastOutside == 1) && (distOutside[currentIndex] < 0))
1271
+ startInside = currentIndex;
1272
+ //dbug(3,"startOutside: %d startInside: %d, currentIndex: %d\n\r",startOutside,startInside,currentIndex);
1273
+ if (numOutside == listLength[0] - choppedPoints)
1274
+ {
1275
+ free(distOutside);distOutside = NULL;
1276
+ free(nextIndex);nextIndex = NULL;
1277
+ free(prevIndex);prevIndex = NULL;
1278
+ //dbug(3,"**********************************free %d\n\r",j);
1279
+ listLength[0] = 0;
1280
+ return;
1281
+ }
1282
+ //dbug(3,"Point %d\n\r",j);
1283
+ choppedPoints += numOutside;
1284
+ if (startOutside != -1)
1285
+ {
1286
+ //Find new polygon vertex
1287
+ frac = distOutside[startOutside] / (distOutside[startOutside] - distOutside[prevIndex[startOutside]]);
1288
+ switch(j)
1289
+ {
1290
+ case 0:
1291
+ y[projPoints] = y[indexList[startOutside]] + frac * (y[indexList[prevIndex[startOutside]]] - y[indexList[startOutside]]);
1292
+ x[projPoints] = halfWidth;
1293
+ break;
1294
+ case 1:
1295
+ y[projPoints] = y[indexList[startOutside]] + frac * (y[indexList[prevIndex[startOutside]]] - y[indexList[startOutside]]);
1296
+ x[projPoints] = - halfWidth;
1297
+ break;
1298
+ case 2:
1299
+ x[projPoints] = x[indexList[startOutside]] + frac * (x[indexList[prevIndex[startOutside]]] - x[indexList[startOutside]]);
1300
+ y[projPoints] = halfHeight;
1301
+ break;
1302
+ case 3:
1303
+ x[projPoints] = x[indexList[startOutside]] + frac * (x[indexList[prevIndex[startOutside]]] - x[indexList[startOutside]]);
1304
+ y[projPoints] = - halfHeight;
1305
+ break;
1306
+ }
1307
+ //Expand index list and update nextIndex and prevIndex
1308
+ indexList[listLength[0]] = projPoints;
1309
+ nextIndex[prevIndex[startOutside]] = listLength[0];
1310
+ prevIndex[listLength[0]] = prevIndex[startOutside];
1311
+ nextIndex[listLength[0]] = listLength[0] + 1;
1312
+ //Increment counters
1313
+ listLength[0]++;
1314
+ projPoints++;
1315
+
1316
+ //Find other new polygon vertex
1317
+ frac = distOutside[startInside] / (distOutside[startInside] - distOutside[prevIndex[startInside]]);
1318
+ switch(j)
1319
+ {
1320
+ case 0:
1321
+ y[projPoints] = y[indexList[startInside]] + frac * (y[indexList[prevIndex[startInside]]] - y[indexList[startInside]]);
1322
+ x[projPoints] = halfWidth;
1323
+ break;
1324
+ case 1:
1325
+ y[projPoints] = y[indexList[startInside]] + frac * (y[indexList[prevIndex[startInside]]] - y[indexList[startInside]]);
1326
+ x[projPoints] = - halfWidth;
1327
+ break;
1328
+ case 2:
1329
+ x[projPoints] = x[indexList[startInside]] + frac * (x[indexList[prevIndex[startInside]]] - x[indexList[startInside]]);
1330
+ y[projPoints] = halfHeight;
1331
+ break;
1332
+ case 3:
1333
+ x[projPoints] = x[indexList[startInside]] + frac * (x[indexList[prevIndex[startInside]]] - x[indexList[startInside]]);
1334
+ y[projPoints] = - halfHeight;
1335
+ break;
1336
+ }
1337
+ //Expand index list and update nextIndex and prevIndex
1338
+ indexList[listLength[0]] = projPoints;
1339
+ prevIndex[startInside] = listLength[0];
1340
+ prevIndex[listLength[0]] = listLength[0] - 1;
1341
+ nextIndex[listLength[0]] = startInside;
1342
+ //Increment counters
1343
+ listLength[0]++;
1344
+ projPoints++;
1345
+ currentIndex = startInside;
1346
+ }
1347
+ //for(i=0;i<listLength[0];i++)
1348
+ // dbug(3,"x: %1.4f y: %1.4f\n\r",x[indexList[i]],y[indexList[i]]);
1349
+ }
1350
+
1351
+ listLength[0] = listLength[0] - choppedPoints;
1352
+ indexList[0] = currentIndex;
1353
+ for(i=1;i<listLength[0];i++)
1354
+ {
1355
+ currentIndex = nextIndex[currentIndex];
1356
+ indexList[i] = currentIndex;
1357
+ }
1358
+ free(distOutside);distOutside = NULL;
1359
+ free(nextIndex);nextIndex = NULL;
1360
+ free(prevIndex);prevIndex = NULL;
1361
+ }
1362
+
1363
+ void crop_polygon(double *x, double *y, int *indexList, int *listLength, double height, double width, int projPoints)
1364
+
1365
+ {
1366
+ int i,j,currentIndex;
1367
+ double halfHeight = height/2;
1368
+ double halfWidth = width/2;
1369
+ double *distOutside = NULL;
1370
+ int numOutside, lastOutside;
1371
+ int *nextIndex = NULL;
1372
+ int *prevIndex = NULL;
1373
+ int *tempList = NULL;
1374
+ int startInside, startOutside;
1375
+ int choppedPoints = 0;
1376
+ double frac;
1377
+ double maxabsy = 0,maxabsx = 0;
1378
+ // int ci;
1379
+
1380
+ for(i=0;i<listLength[0];i++)
1381
+ {
1382
+ maxabsy=MAX(maxabsy,fabs(y[indexList[i]]));
1383
+ maxabsx=MAX(maxabsx,fabs(x[indexList[i]]));
1384
+ //dbug(2,"i:%4d x[%d] = %12.4lf y[%d] = %12.4lf\r\n",i,indexList[i],x[indexList[i]],indexList[i],y[indexList[i]]);
1385
+ }
1386
+ //dbug(3,"mx: %8.4lf my: %8.4lf",maxabsx,maxabsy);
1387
+ //dbug(2,"ll:%d\n\r",listLength[0]);
1388
+ distOutside = malloc(sizeof(double)*(listLength[0]+8)); // the +8 is to allow up to two new points for each module edge
1389
+ nextIndex = malloc(sizeof(int)*(listLength[0]+8));
1390
+ prevIndex = malloc(sizeof(int)*(listLength[0]+8));
1391
+
1392
+ for(i = 0;i<listLength[0]-1;i++)
1393
+ {
1394
+ nextIndex[i] = i+1;
1395
+ prevIndex[i+1] = i;
1396
+ }
1397
+ nextIndex[listLength[0]-1] = 0;
1398
+ prevIndex[0] = listLength[0]-1;
1399
+ currentIndex = 0;
1400
+
1401
+ for(j = 0;j<4;j++)
1402
+ {
1403
+ //dbug(2,"-------------------- j :%d\n\r",j);
1404
+ switch(j)
1405
+ {
1406
+ case 0:
1407
+ distOutside[currentIndex] = x[indexList[currentIndex]] - halfWidth;
1408
+ break;
1409
+ case 1:
1410
+ distOutside[currentIndex] = - x[indexList[currentIndex]] - halfWidth;
1411
+ break;
1412
+ case 2:
1413
+ distOutside[currentIndex] = y[indexList[currentIndex]] - halfHeight;
1414
+ break;
1415
+ case 3:
1416
+ distOutside[currentIndex] = - y[indexList[currentIndex]] - halfHeight;
1417
+ break;
1418
+ }
1419
+ //dbug(2,"currentIndex:%d\n\r",currentIndex);
1420
+ //if (x[currentIndex]>0) dbug(3,":");
1421
+ //if (y[currentIndex]>0) dbug(3,":");
1422
+ //if (distOutside[currentIndex]>0) dbug(3,":");
1423
+ //if (currentIndex>0) dbug(3,"*");
1424
+ lastOutside = (distOutside[currentIndex] > 0);
1425
+ numOutside = lastOutside;
1426
+ startInside = -1;
1427
+ startOutside = -1;
1428
+ currentIndex = nextIndex[currentIndex];
1429
+ //dbug(2,"currentIndex:%d\n\r",currentIndex);
1430
+ for(i = 1; i<listLength[0]-choppedPoints; i++, currentIndex = nextIndex[currentIndex])
1431
+ {
1432
+ //if (choppedPoints>0) dbug(3,"|");
1433
+ switch(j)
1434
+ {
1435
+ case 0:
1436
+ distOutside[currentIndex] = x[indexList[currentIndex]] - halfWidth;
1437
+ break;
1438
+ case 1:
1439
+ distOutside[currentIndex] = - x[indexList[currentIndex]] - halfWidth;
1440
+ break;
1441
+ case 2:
1442
+ distOutside[currentIndex] = y[indexList[currentIndex]] - halfHeight;
1443
+ break;
1444
+ case 3:
1445
+ distOutside[currentIndex] = - y[indexList[currentIndex]] - halfHeight;
1446
+ break;
1447
+ }
1448
+ numOutside += (distOutside[currentIndex] > 0);
1449
+ if ((lastOutside == 0) && (distOutside[currentIndex] > 0))
1450
+ startOutside = currentIndex;
1451
+ if ((lastOutside == 1) && (distOutside[currentIndex] <= 0))
1452
+ startInside = currentIndex;
1453
+ lastOutside = (distOutside[currentIndex] > 0);
1454
+ //dbug(2,"currentIndex:%d i:%d distOutside: %1.12lf outside: %d prevIndex: %d nextIndex: %d\n\r",currentIndex,i,distOutside[currentIndex],distOutside[currentIndex] > 0, prevIndex[currentIndex], nextIndex[currentIndex]);
1455
+ }
1456
+ if ((lastOutside == 0) && (distOutside[currentIndex] > 0))
1457
+ startOutside = currentIndex;
1458
+ if ((lastOutside == 1) && (distOutside[currentIndex] <= 0))
1459
+ startInside = currentIndex;
1460
+ //dbug(2,"currentIndex:%d i:%d distOutside: %1.12lf outside: %d prevIndex: %d nextIndex: %d\n\r",currentIndex,i,distOutside[currentIndex],distOutside[currentIndex] > 0, prevIndex[currentIndex], nextIndex[currentIndex]);
1461
+ //dbug(2,"numOutside: %d\n\r",numOutside);
1462
+ if (numOutside == listLength[0] - choppedPoints)
1463
+ {
1464
+ free(distOutside);distOutside = NULL;
1465
+ free(nextIndex);nextIndex = NULL;
1466
+ free(prevIndex);prevIndex = NULL;
1467
+ listLength[0] = 0;
1468
+ return;
1469
+ }
1470
+ // if (numOutside>0) dbug(2,".");
1471
+ choppedPoints += numOutside;
1472
+ if (startOutside != -1)
1473
+ {
1474
+ //Find new polygon vertex
1475
+ frac = distOutside[startOutside] / (distOutside[startOutside] - distOutside[prevIndex[startOutside]]);
1476
+ switch(j)
1477
+ {
1478
+ case 0:
1479
+ y[projPoints] = y[indexList[startOutside]] + frac * (y[indexList[prevIndex[startOutside]]] - y[indexList[startOutside]]);
1480
+ x[projPoints] = halfWidth;
1481
+ break;
1482
+ case 1:
1483
+ y[projPoints] = y[indexList[startOutside]] + frac * (y[indexList[prevIndex[startOutside]]] - y[indexList[startOutside]]);
1484
+ x[projPoints] = - halfWidth;
1485
+ break;
1486
+ case 2:
1487
+ x[projPoints] = x[indexList[startOutside]] + frac * (x[indexList[prevIndex[startOutside]]] - x[indexList[startOutside]]);
1488
+ y[projPoints] = halfHeight;
1489
+ break;
1490
+ case 3:
1491
+ x[projPoints] = x[indexList[startOutside]] + frac * (x[indexList[prevIndex[startOutside]]] - x[indexList[startOutside]]);
1492
+ y[projPoints] = - halfHeight;
1493
+ break;
1494
+ }
1495
+ //Expand index list and update nextIndex and prevIndex
1496
+ indexList[listLength[0]] = projPoints;
1497
+ nextIndex[prevIndex[startOutside]] = listLength[0];
1498
+ prevIndex[listLength[0]] = prevIndex[startOutside];
1499
+ nextIndex[listLength[0]] = listLength[0] + 1;
1500
+ //Increment counters
1501
+ listLength[0]++;
1502
+ //dbug(2,"ll1:%d\n\r",listLength[0]);
1503
+ projPoints++;
1504
+
1505
+ //Find other new polygon vertex
1506
+ frac = distOutside[startInside] / (distOutside[startInside] - distOutside[prevIndex[startInside]]);
1507
+ switch(j)
1508
+ {
1509
+ case 0:
1510
+ //dbug(2,"ll0:%d\n\r",listLength[0]);
1511
+ y[projPoints] = y[indexList[startInside]] + frac * (y[indexList[prevIndex[startInside]]] - y[indexList[startInside]]);
1512
+ x[projPoints] = halfWidth;
1513
+ //dbug(2,"ll0:%d\n\r",listLength[0]);
1514
+ break;
1515
+ case 1:
1516
+ //dbug(2,"ll1:%d\n\r",listLength[0]);
1517
+ y[projPoints] = y[indexList[startInside]] + frac * (y[indexList[prevIndex[startInside]]] - y[indexList[startInside]]);
1518
+ x[projPoints] = - halfWidth;
1519
+ //dbug(2,"ll1:%d\n\r",listLength[0]);
1520
+ break;
1521
+ case 2:
1522
+ //dbug(2,"pp %d si %d\r\n",projPoints,startInside);
1523
+ x[projPoints] = x[indexList[startInside]] + frac * (x[indexList[prevIndex[startInside]]] - x[indexList[startInside]]);
1524
+ y[projPoints] = halfHeight;
1525
+ //dbug(2,"ll2:%d\n\r",listLength[0]);
1526
+ break;
1527
+ case 3:
1528
+ //dbug(2,"ll3:%d\n\r",listLength[0]);
1529
+ x[projPoints] = x[indexList[startInside]] + frac * (x[indexList[prevIndex[startInside]]] - x[indexList[startInside]]);
1530
+ y[projPoints] = - halfHeight;
1531
+ //dbug(2,"ll3:%d\n\r",listLength[0]);
1532
+ break;
1533
+ }
1534
+ //dbug(2,"ll1:%d\n\r",listLength[0]);
1535
+ //Expand index list and update nextIndex and prevIndex
1536
+ indexList[listLength[0]] = projPoints;
1537
+ prevIndex[startInside] = listLength[0];
1538
+ prevIndex[listLength[0]] = listLength[0] - 1;
1539
+ nextIndex[listLength[0]] = startInside;
1540
+ //Increment counters
1541
+ listLength[0]++;
1542
+ dbug(2,"ll2:%d\n\r",listLength[0]);
1543
+ projPoints++;
1544
+ currentIndex = startInside;
1545
+ }
1546
+ //ci = currentIndex;
1547
+ //for(i=0;i<listLength[0]-choppedPoints;i++)
1548
+ // {
1549
+ // dbug(2,"ci:%4d x[%d] = %12.4lf y[%d] = %12.4lf\r\n",ci,indexList[ci],x[indexList[ci]],indexList[ci],y[indexList[ci]]);
1550
+ // ci=nextIndex[ci];
1551
+ // }
1552
+ }
1553
+
1554
+ listLength[0] = listLength[0] - choppedPoints;
1555
+ //dbug(2,"ll3:%d\n\r",listLength[0]);
1556
+ tempList = malloc(listLength[0]*sizeof(int));
1557
+ tempList[0] = indexList[currentIndex];
1558
+ for(i=1;i<listLength[0];i++)
1559
+ {
1560
+ currentIndex = nextIndex[currentIndex];
1561
+ tempList[i] = indexList[currentIndex];
1562
+ }
1563
+ for(i=0;i<listLength[0];i++)
1564
+ {
1565
+ indexList[i] = tempList[i];
1566
+ //dbug(2,"i: %8d, indexList:%4d x[]: %4.2lf y[]:%4.2lf \r\n",i,indexList[i],x[indexList[i]],y[indexList[i]]);
1567
+ }
1568
+ //dbug(2,"prefree\n\r");
1569
+ free(distOutside);distOutside = NULL;
1570
+ free(nextIndex);nextIndex = NULL;
1571
+ free(prevIndex);prevIndex = NULL;
1572
+ free(tempList);tempList = NULL;
1573
+ //dbug(2,"postfree\n\r");
1574
+ }
1575
+
1576
+ void store_height_lims(double *pixel_U, int *indexList, int listLength, int objectNumber, void *boundaries)
1577
+
1578
+ {
1579
+ int i;
1580
+ double minHt = pixel_U[indexList[0]];
1581
+ double maxHt = pixel_U[indexList[0]];
1582
+ struct height_lims *heightLims = (struct height_lims *) boundaries;
1583
+
1584
+ if (listLength == 0)
1585
+ {
1586
+ heightLims[objectNumber].min = -VERY_BIG;
1587
+ heightLims[objectNumber].max = -VERY_BIG;
1588
+ return;
1589
+ }
1590
+ for(i = 1;i<listLength;i++)
1591
+ {
1592
+ if (maxHt < pixel_U[indexList[i]])
1593
+ maxHt = pixel_U[indexList[i]];
1594
+ if (minHt > pixel_U[indexList[i]])
1595
+ minHt = pixel_U[indexList[i]];
1596
+ }
1597
+ heightLims[objectNumber].min = minHt;
1598
+ heightLims[objectNumber].max = maxHt;
1599
+ //dbug(1,"store -- minHt: %8.4lf maxHt: %8.4lf \n\r",minHt,maxHt);
1600
+ }
1601
+
1602
+ void store_box_lims(double *pixel_R, double *pixel_U, int *indexList, int listLength, int objectNumber, void *boundaries)
1603
+
1604
+ {
1605
+ int i;
1606
+ double minHt = pixel_U[indexList[0]];
1607
+ double maxHt = pixel_U[indexList[0]];
1608
+ double minWd = pixel_R[indexList[0]];
1609
+ double maxWd = pixel_R[indexList[0]];
1610
+ struct box_lims *boxLims = (struct box_lims *) boundaries;
1611
+
1612
+ dbug(3,"store_box_lims -- listLength: %d",listLength);
1613
+ if (listLength == 0)
1614
+ {
1615
+ boxLims[objectNumber].minR = -VERY_BIG;
1616
+ boxLims[objectNumber].maxR = -VERY_BIG;
1617
+ boxLims[objectNumber].minU = -VERY_BIG;
1618
+ boxLims[objectNumber].maxU = -VERY_BIG;
1619
+ return;
1620
+ }
1621
+ for(i = 1;i<listLength;i++)
1622
+ {
1623
+ if (maxHt < pixel_U[indexList[i]])
1624
+ maxHt = pixel_U[indexList[i]];
1625
+ if (minHt > pixel_U[indexList[i]])
1626
+ minHt = pixel_U[indexList[i]];
1627
+ if (maxWd < pixel_R[indexList[i]])
1628
+ maxWd = pixel_R[indexList[i]];
1629
+ if (minWd > pixel_R[indexList[i]])
1630
+ minWd = pixel_R[indexList[i]];
1631
+ }
1632
+ boxLims[objectNumber].minU = minHt;
1633
+ boxLims[objectNumber].maxU = maxHt;
1634
+ boxLims[objectNumber].minR = minWd;
1635
+ boxLims[objectNumber].maxR = maxWd;
1636
+ }
1637
+
1638
+ void store_half_planes(double *pixel_R, double *pixel_U, int *indexList, int listLength, int objectNumber, void *boundaries)
1639
+
1640
+ {
1641
+ printf("ERROR: This type of overlap specification is not yet supported!\n\r");
1642
+ }
1643
+
1644
+ void store(double *pixel_R, double *pixel_U, int *indexList, int listLength, int objectNumber, void *boundaries)
1645
+
1646
+ {
1647
+ switch(modules.moduleOverlapType)
1648
+ {
1649
+ case 1:
1650
+ store_height_lims(pixel_U, indexList, listLength, objectNumber, boundaries);
1651
+ break;
1652
+ case 2:
1653
+ store_box_lims(pixel_R, pixel_U, indexList, listLength, objectNumber, boundaries);
1654
+ break;
1655
+ case 3:
1656
+ store_half_planes(pixel_R, pixel_U, indexList, listLength, objectNumber, boundaries);
1657
+ break;
1658
+ default:
1659
+ printf("\nERROR: Unrecognized overlap specification!\n\r");
1660
+ break;
1661
+ }
1662
+ }
1663
+
1664
+
1665
+ void compute_object_projections(double *srcHullPoints, int nSrcHullPoints, int moduleTypeIndex, double *up, double *right, double *center, void *boundaries)
1666
+
1667
+ {
1668
+ int i, j, k, n;
1669
+ int startIndex;
1670
+ double *vertex_XYZ, vertex_RUN[3], source_RUN[3]; // RUN : right, up, normal (module coordinates)
1671
+ double normal[3];
1672
+ double posRelToModule[3];
1673
+ double *pixel_R = NULL;
1674
+ double *pixel_U = NULL;
1675
+ double scale, Ndist;
1676
+ int *indexList = NULL;
1677
+ int maxVertexPoints = 0, projPoints, listLength;
1678
+ const int moduleEdges = 4;
1679
+ int *vertexPoints = NULL;
1680
+ int planB;
1681
+
1682
+ vertexPoints = malloc(sizeof(int)*phantom.numObjects);
1683
+ //dbug(3,"COP1\r\n");
1684
+ cross(right,up,normal);
1685
+
1686
+ // Compute the maximum number of vertex points on a bounding polyhedron
1687
+ for(i = 0;i<phantom.numObjects;i++)
1688
+ {
1689
+ vertexPoints[i] = bounding.vertexStartIndex[i+1] - bounding.vertexStartIndex[i];
1690
+ if (vertexPoints[i]>maxVertexPoints) maxVertexPoints = vertexPoints[i];
1691
+ }
1692
+ //dbug(2,"COP1\r\n");
1693
+ pixel_R = malloc(sizeof(double)*(maxVertexPoints*nSrcHullPoints+moduleEdges*2)); // Each module edge can introduce 2 new points during the cropping of the convex hull.
1694
+ pixel_U = malloc(sizeof(double)*(maxVertexPoints*nSrcHullPoints+moduleEdges*2));
1695
+ indexList = malloc(sizeof(int)*(maxVertexPoints*nSrcHullPoints+moduleEdges*2));
1696
+
1697
+ //dbug(3,"COP1\r\n");
1698
+ for(i = 0;i<phantom.numObjects;i++)
1699
+ {
1700
+ //dbug(3,"Loop %d\r\n",i);
1701
+ planB = 0;
1702
+ startIndex = bounding.vertexStartIndex[i];
1703
+ vertex_XYZ = &bounding.vertexLocations[startIndex*3];
1704
+ //dbug(2,"\n\n\rvertex_XYZ:\n\r");
1705
+ //for(j=0;j<vertexPoints[i];j++)
1706
+ // dbug(2,"%d: x[] = %12.4lf y[] = %12.4lf z[] = %12.4lf\r\n",j,vertex_XYZ[j*3],vertex_XYZ[j*3+1],vertex_XYZ[j*3+2]);
1707
+ //dbug(2,"\n\n\rsource_hull_XYZ:\n\r");
1708
+ //for(j=0;j<nSrcHullPoints;j++)
1709
+ // dbug(2,"%d: x[] = %12.4lf y[] = %12.4lf z[] = %12.4lf\r\n",j,srcHullPoints[j*3],srcHullPoints[j*3+1],srcHullPoints[j*3+2]);
1710
+ projPoints = 0;
1711
+ //dbug(3,"loopbeg %d %d\r\n",j,nSrcHullPoints);
1712
+ for(j = 0;j<nSrcHullPoints;j++)
1713
+ {
1714
+ //dbug(3,"loop %d %d\r\n",j,nSrcHullPoints);
1715
+ for(n=0;n<3;n++)
1716
+ posRelToModule[n] = srcHullPoints[3*j+n] - center[n];
1717
+ source_RUN[0] = right[0] * posRelToModule[0] + right[1] * posRelToModule[1] + right[2] * posRelToModule[2];
1718
+ source_RUN[1] = up[0] * posRelToModule[0] + up[1] * posRelToModule[1] + up[2] * posRelToModule[2];
1719
+ source_RUN[2] = normal[0] * posRelToModule[0] + normal[1] * posRelToModule[1] + normal[2] * posRelToModule[2];
1720
+ // Project object onto module
1721
+ for(k = 0;k<vertexPoints[i];k++)
1722
+ {
1723
+ for(n=0;n<3;n++)
1724
+ posRelToModule[n] = vertex_XYZ[3*k+n] - center[n];
1725
+ dbug(2,"posRel_X: %5.4lf posRel_Y: %5.4lf posRel_Z: %5.4lf\n\r",posRelToModule[0],posRelToModule[1],posRelToModule[2]);
1726
+ vertex_RUN[0] = right[0] * posRelToModule[0] + right[1] * posRelToModule[1] + right[2] * posRelToModule[2];
1727
+ vertex_RUN[1] = up[0] * posRelToModule[0] + up[1] * posRelToModule[1] + up[2] * posRelToModule[2];
1728
+ vertex_RUN[2] = normal[0] * posRelToModule[0] + normal[1] * posRelToModule[1] + normal[2] * posRelToModule[2];
1729
+ dbug(2,"posRel_R: %5.4lf posRel_U: %5.4lf posRel_N: %5.4lf\n\r",vertex_RUN[0],vertex_RUN[1],vertex_RUN[2]);
1730
+ //dbug(2,"posRel_R: %5.4lf \n\r",vertex_RUN[0]);
1731
+ scale = source_RUN[2] / (source_RUN[2] - vertex_RUN[2]);
1732
+ if (fabs(source_RUN[2]) - fabs(vertex_RUN[2]) < 1e-7)
1733
+ {
1734
+ dbug(2,"center: %5.4lf %5.4lf %5.4lf\n\r",center[0],center[1],center[2]);
1735
+ dbug(2,"src_pt: %5.4lf %5.4lf %5.4lf\n\r",srcHullPoints[3*j],srcHullPoints[3*j+1],srcHullPoints[3*j+2]);
1736
+ dbug(2,"sourceRUN_R: %5.4lf sourceRUN_U: %5.4lf sourceRUN_N: %5.4lf\n\r",source_RUN[0],source_RUN[1],source_RUN[2]);
1737
+ dbug(2,"vertexRUN_R: %5.4lf vertexRUN_U: %5.4lf vertexRUN_N: %5.4lf\n\r",vertex_RUN[0],vertex_RUN[1],vertex_RUN[2]);
1738
+ dbug(2,"vertexXYZ_X: %5.4lf vertexXYZ_Y: %5.4lf vertexXYZ_Z: %5.4lf\n\r",vertex_XYZ[0],vertex_XYZ[1],vertex_XYZ[2]);
1739
+ if (planB_warned == 0)
1740
+ {
1741
+ printf("\rWarning : Bounding polygon vertex is farther from a detector module than the source along the module normal vector direction. This may indicate that the phantom is too big. Please ensure that phantom_scale is not too large. You may also want to check the detector and focal spot geometry. In any case, this can slow the simulation down if it occurs frequently.\n\r");
1742
+ planB_warned = 1;
1743
+ }
1744
+ // printf("|%d,%d,%d,%d|",i,j,k,(int)center[2]);
1745
+ planB = 1;
1746
+ projPoints=4;
1747
+ pixel_R[0] = -VERY_BIG;pixel_U[0] = -VERY_BIG;
1748
+ pixel_R[1] = -VERY_BIG;pixel_U[1] = VERY_BIG;
1749
+ pixel_R[2] = VERY_BIG;pixel_U[2] = VERY_BIG;
1750
+ pixel_R[3] = VERY_BIG;pixel_U[3] = -VERY_BIG;
1751
+ break;
1752
+ }
1753
+ pixel_R[projPoints] = source_RUN[0] + (vertex_RUN[0] - source_RUN[0]) * scale;
1754
+ pixel_U[projPoints] = source_RUN[1] + (vertex_RUN[1] - source_RUN[1]) * scale;
1755
+ projPoints++;
1756
+ }
1757
+ if (planB) break;
1758
+ }
1759
+ //dbug(3,"loopend %d %d\r\n",j,nSrcHullPoints);
1760
+ //dbug(3,"loopend %d %d\r\n",j,projPoints);
1761
+ listLength = compute_convex_hull_2d(pixel_R, pixel_U, projPoints, indexList);
1762
+ //dbug(2,"loopend %d %d\r\n",j,nSrcHullPoints);
1763
+ //dbug(3,"loopend2 %d %d\r\n",j,nSrcHullPoints);
1764
+ //dbug(3,"listLength: %d \r\n",listLength);
1765
+ //if ((moduleTypeIndex == 146)||(moduleTypeIndex == 147)) debug_flag=2; else debug_flag = 1;
1766
+ crop_polygon(pixel_R, pixel_U, indexList, &listLength, modules.Height[moduleTypeIndex], modules.Width[moduleTypeIndex], projPoints);
1767
+ //dbug(2,"loopend %d %d\r\n",j,nSrcHullPoints);
1768
+ //debug_flag=1;
1769
+ //if (listLength>0) dbug(2,"listLength: %d\r\n",listLength);
1770
+ store(pixel_R, pixel_U, indexList, listLength, i, boundaries);
1771
+ //dbug(2,"loopend %d %d\r\n",j,nSrcHullPoints);
1772
+ //dbug(3,"loopend4 %d %d\r\n",j,nSrcHullPoints);
1773
+ }
1774
+ //dbug(2,"free0\r\n");
1775
+ free(pixel_R);pixel_R = NULL;
1776
+ //dbug(2,"free0\r\n");
1777
+ free(pixel_U);pixel_U = NULL;
1778
+ //dbug(2,"free0\r\n");
1779
+ free(indexList);indexList = NULL;
1780
+ //dbug(2,"free0\r\n");
1781
+ free(vertexPoints);vertexPoints = NULL;
1782
+ //dbug(2,"free0\r\n");
1783
+ }
1784
+
1785
+ int any_objects_1(int moduleNumber, void *boundaries)
1786
+
1787
+ {
1788
+ int any_objs = 0, i;
1789
+ struct height_lims *heightLims = (struct height_lims *) boundaries;
1790
+
1791
+ for(i = 0;i < phantom.numObjects;i++)
1792
+ {
1793
+ //dbug(3,"Module number: %d minHeight[%d] = %lf maxHeight[%d] = %lf Different? %d",moduleNumber,i,heightLims.min[i],i,heightLims.max[i],(int)(heightLims.min[i] != heightLims.max[i]));
1794
+ if (heightLims[i].min != heightLims[i].max)
1795
+ {any_objs++;break;}
1796
+ }
1797
+ return any_objs;
1798
+ }
1799
+
1800
+ int any_objects_2(int moduleNumber, void *boundaries)
1801
+
1802
+ {
1803
+ int any_objs = 0, i;
1804
+ struct box_lims *boxLims = (struct box_lims *) boundaries;
1805
+
1806
+ for(i = 0;i < phantom.numObjects;i++)
1807
+ {
1808
+ if (boxLims[i].minR != boxLims[i].maxR)
1809
+ {any_objs++;break;}
1810
+ }
1811
+ return any_objs;
1812
+ }
1813
+
1814
+ void build_object_list1(double *pix_vlims, int *objectList, int *n_objlist, int moduleNumber, double v, void *boundaries)
1815
+
1816
+ {
1817
+ int i;
1818
+ struct height_lims *heightLims = (struct height_lims *) boundaries;
1819
+
1820
+ for(i = 0;i<phantom.numObjects;i++)
1821
+ if((heightLims[i].min <= v+pix_vlims[1]) && (heightLims[i].max >= v+pix_vlims[0]))
1822
+ {objectList[n_objlist[0]] = i;n_objlist[0]++;}
1823
+ }
1824
+
1825
+ void build_object_list2(double *pix_ulims, double *pix_vlims, int *objectList, int *n_objlist, int moduleNumber, double *uv, void *boundaries)
1826
+
1827
+ {
1828
+ int i;
1829
+ struct box_lims *boxLims = (struct box_lims *) boundaries;
1830
+
1831
+ for(i = 0;i<phantom.numObjects;i++)
1832
+ {
1833
+ dbug(3,"if statement parts: %d %d %d %d\n\r",(int) (boxLims[i].minU <= uv[1]+pix_vlims[1]),(int) (boxLims[i].maxU >= uv[1]+pix_vlims[0]),(int) (boxLims[i].minR <= uv[0]+pix_ulims[1]),(int) (boxLims[i].maxR >= uv[0]+pix_ulims[0]));
1834
+ dbug(3,"parts for third one: %1.5lf %1.5lf %1.5lf %1.5lf \r\n ",boxLims[0].minR,uv[0],pix_ulims[1],uv[0]+pix_ulims[1]);
1835
+ if((boxLims[i].minU <= uv[1]+pix_vlims[1]) && (boxLims[i].maxU >= uv[1]+pix_vlims[0]) && (boxLims[i].minR <= uv[0]+pix_ulims[1]) && (boxLims[i].maxR >= uv[0]+pix_ulims[0]))
1836
+ {objectList[n_objlist[0]] = i;n_objlist[0]++;}
1837
+ }
1838
+ }
1839
+
1840
+ void build_object_list3()
1841
+
1842
+ {
1843
+ printf("ERROR: this moduleOverlapType not yet implemented!\n\n");
1844
+ }
1845
+
1846
+ void intersections_loop(double *detCenter, double *right, double *up, double *sampling, int nSubDets, double *sourcePoints, int *objectList, int nListObjects, double *thisView, int detIndex, double subviewWeight, double *detWeights)
1847
+
1848
+ {
1849
+ int i, k, l, m, n; //loop counters
1850
+ double subDetCenter[3];
1851
+ double alpha[3];
1852
+ double rayLength;
1853
+ double *materialBuffer = NULL;
1854
+ double *pValueSpectrum = NULL;
1855
+
1856
+ materialBuffer = malloc(sizeof(double)*materials.materialCount);
1857
+ pValueSpectrum = malloc(sizeof(double)*materials.eBinCount);
1858
+ for(l = 0;l<nSubDets;l++)
1859
+ {
1860
+ for(i = 0;i<3;i++)
1861
+ subDetCenter[i] = detCenter[i]+right[i]*sampling[2*l]+up[i]*sampling[2*l+1];
1862
+ for(k = 0;k<modules.nSubSources;k++)
1863
+ {
1864
+ for(i = 0;i<3;i++)
1865
+ alpha[i] = subDetCenter[i]-sourcePoints[3*k+i];
1866
+ rayLength = sqrt(alpha[0]*alpha[0]+alpha[1]*alpha[1]+alpha[2]*alpha[2]);
1867
+ alpha[0] /= rayLength;
1868
+ alpha[1] /= rayLength;
1869
+ alpha[2] /= rayLength;
1870
+ for(i = 0;i<materials.materialCount;i++) materialBuffer[i] = 0.0;
1871
+ //dbug(3,"sourcePoints: [%4.4lf %4.4lf %4.4lf]\r\n",sourcePoints[3*k],sourcePoints[3*k+1],sourcePoints[3*k+2]);
1872
+ //dbug(3,"alpha: [%4.4lf %4.4lf %4.4lf]\r\n",alpha[0],alpha[1],alpha[2]);
1873
+ //dbug(3,"rayLength: [%4.4lf]\r\n",rayLength);
1874
+ //dbug(3,"phantom.objectCenter: [%4.4lf %4.4lf %4.4lf]\r\n",phantom.objectCenter[0],phantom.objectCenter[1],phantom.objectCenter[2]);
1875
+ intersections(&objectList[0],nListObjects,&sourcePoints[3*k],alpha,rayLength,&materialBuffer[0]);
1876
+ //if (materialBuffer[0]>0.0) dbug(1,"materialBuffer[0]: %4.4lf\r\n",materialBuffer[0]);
1877
+ for(m = 0;m<materials.eBinCount;m++){
1878
+ pValueSpectrum[m] = 0;
1879
+ for(n = 0;n<materials.materialCount;n++)
1880
+ pValueSpectrum[m] += materialBuffer[n]*materials.muTable[n+materials.materialCount*m];
1881
+ }
1882
+ //if (pValueSpectrum[0]>0.0) dbug(1,"pValueSpectrum[0]: %4.4lf\r\n",pValueSpectrum[0]);
1883
+
1884
+ //------------------- Accurate Detector Model, Mingye
1885
+ if(Accurate_Detector_Model_is_ON)
1886
+ {
1887
+ for(m = 0;m < materials.eBinCount;m++)
1888
+ {
1889
+ int the_index = (detIndex*n_col_oversample + (int)(l/n_row_oversample_add_xtalk))*materials.eBinCount + m;
1890
+ thisView[the_index] += subviewWeight*detWeights[l]*modules.sourceWeights[k]*exp(-pValueSpectrum[m]);
1891
+ }
1892
+ }
1893
+ //-------------------
1894
+ else
1895
+ {
1896
+ for(m = 0;m < materials.eBinCount;m++)
1897
+ thisView[detIndex*materials.eBinCount+m] += subviewWeight*detWeights[l]*modules.sourceWeights[k]*exp(-pValueSpectrum[m]);
1898
+ }
1899
+ }
1900
+ }
1901
+ free(materialBuffer);materialBuffer = NULL;
1902
+ free(pValueSpectrum);pValueSpectrum = NULL;
1903
+ }
1904
+
1905
+ //initialize parameters for Accurate Detector Model, Mingye
1906
+ void set_Accurate_Detector_Model(double *Paras)
1907
+ {
1908
+ if(Paras[1]==1 && Paras[2]==1) //first view and first subview
1909
+ {
1910
+ Accurate_Detector_Model_is_ON=1;
1911
+ n_col_oversample=Paras[3];
1912
+ n_row_oversample=Paras[4];
1913
+ n_col_oversample_add_xtalk=Paras[6];
1914
+ n_row_oversample_add_xtalk=Paras[8];
1915
+ }
1916
+
1917
+ if(Paras[5]==1 && Paras[1]<3 && Paras[2]==1) //col_xtalk>0, first subview in the first two views
1918
+ if(modules.Sub[0]>n_col_oversample*n_row_oversample_add_xtalk)
1919
+ {
1920
+ int n1;
1921
+
1922
+ modules.maxSubDets-=2*n_row_oversample_add_xtalk;
1923
+ modules.Sub[0]-=2*n_row_oversample_add_xtalk;
1924
+
1925
+ double sum_weights=0;
1926
+ for(n1=0;n1<modules.maxSubDets;n1++)
1927
+ {
1928
+ modules.Weight[n1]=modules.Weight[n1+n_row_oversample_add_xtalk];
1929
+ sum_weights+=modules.Weight[n1];
1930
+ }
1931
+ for(n1=0;n1<modules.maxSubDets;n1++)
1932
+ modules.Weight[n1]/=sum_weights;
1933
+
1934
+ for(n1=0;n1<2*modules.maxSubDets;n1++)
1935
+ modules.Sampling[n1]=modules.Sampling[n1+2*n_row_oversample_add_xtalk];
1936
+ }
1937
+
1938
+ }
1939
+
1940
+ DLLEXPORT void Projector(double *Paras, double subviewWeight, double *thisView, double *sourcePoints, int nSubSources, double *srcHullPoints, int nSrcHullPoints, int *firstDetIndex, int nModulesIn, int *modTypeInds, double *Up, double *Right, double *Center, int UNUSED_tvLength)
1941
+
1942
+ {
1943
+ //------------------- Accurate Detector Model, Mingye
1944
+ if(Paras[0]==1)
1945
+ set_Accurate_Detector_Model(Paras);
1946
+ else if(Paras[0]==0)
1947
+ Accurate_Detector_Model_is_ON=0;
1948
+
1949
+ //FILE *fp;
1950
+ //fp=fopen("flag_2.txt","a");
1951
+ //if(fp)
1952
+ //{
1953
+ // fprintf(fp,"%f %d %d %d %d %d %d %d %f %f\n",
1954
+ // Paras[0],Accurate_Detector_Model_is_ON,
1955
+ // n_col_oversample,n_row_oversample,
1956
+ // n_col_oversample_add_xtalk,n_row_oversample_add_xtalk,
1957
+ // modules.Sub[0],modules.maxSubDets,
1958
+ // modules.Weight[0],modules.Sampling[0]);
1959
+ // fclose(fp);
1960
+ //}
1961
+ //-------------------
1962
+
1963
+
1964
+ int i, moduleNumber, k, l, m, n, nListObjects, *objectList = NULL, nSubDets, detIndex, timing = 0;
1965
+ double *detWeights, *UV, *sampling, detCenter[3], pix_vlims[2], pix_ulims[2], *center, *right, *up;
1966
+ double elapsedTime, min_val;
1967
+ clock_t clk;
1968
+ int moduleTypeIndex;
1969
+ void *boundaries;
1970
+ int any_objs;
1971
+
1972
+ if (timing != 0){
1973
+ clk = clock();
1974
+ elapsedTime = (double)( (clk + 0.0) / CLOCKS_PER_SEC);
1975
+ }
1976
+
1977
+ objectList = malloc(phantom.numObjects*sizeof(int));
1978
+
1979
+ switch(modules.moduleOverlapType)
1980
+ {
1981
+ case 1:
1982
+ boundaries = malloc(sizeof(struct height_lims)*phantom.numObjects);
1983
+ break;
1984
+ case 2:
1985
+ boundaries = malloc(sizeof(struct box_lims)*phantom.numObjects);
1986
+ break;
1987
+ case 3:
1988
+ //boundaries = malloc(sizeof(struct polygon)*phantom.numObjects);
1989
+ break;
1990
+ }
1991
+
1992
+ //dbug(2,"Number of modules: %d modules.moduleOverlapType : %d\r\n",nModulesIn, modules.moduleOverlapType);
1993
+ for(moduleNumber = 0;moduleNumber<nModulesIn;moduleNumber++)
1994
+ {
1995
+ moduleTypeIndex = modTypeInds[moduleNumber];
1996
+ detWeights = &modules.Weight[moduleTypeIndex*modules.maxSubDets];//Weight should be transposed before being passed in
1997
+ UV = &modules.Coords[2*modules.maxPixPerModule*moduleTypeIndex];
1998
+ //if ((moduleNumber%20)==0)
1999
+ // dbug(1,"moduleTypeIndex: %d, modules.Pix[moduleTypeIndex]: %d\n\r",moduleTypeIndex,modules.Pix[moduleTypeIndex]);
2000
+ sampling = &modules.Sampling[2*modules.maxSubDets*moduleTypeIndex];
2001
+ //dbug(2,"Module %d mti:%d\n\r",moduleNumber,moduleTypeIndex);
2002
+ nSubDets = modules.Sub[moduleTypeIndex];
2003
+ //dbug(2,"Module %db %d\n\r",moduleNumber,moduleTypeIndex);
2004
+ pix_vlims[0] = VERY_BIG;pix_vlims[1] = -VERY_BIG;
2005
+ pix_ulims[0] = VERY_BIG;pix_ulims[1] = -VERY_BIG;
2006
+ for(i = 0;i<modules.Sub[moduleTypeIndex];i++){
2007
+ if(sampling[2*i+1]<pix_vlims[0]) pix_vlims[0] = sampling[2*i+1];
2008
+ if(sampling[2*i+1]>pix_vlims[1]) pix_vlims[1] = sampling[2*i+1];
2009
+ if(sampling[2*i]<pix_ulims[0]) pix_ulims[0] = sampling[2*i];
2010
+ if(sampling[2*i]>pix_ulims[1]) pix_ulims[1] = sampling[2*i];
2011
+ }
2012
+ //dbug(2,"here %db\n\r",moduleNumber);
2013
+ center = &Center[3*moduleNumber];
2014
+ right = &Right[3*moduleNumber];
2015
+ up = &Up[3*moduleNumber];
2016
+ //dbug(2,"Module %db\n\r",moduleNumber);
2017
+
2018
+ compute_object_projections(srcHullPoints, nSrcHullPoints, moduleTypeIndex, up, right, center, boundaries);
2019
+ //dbug(2,"Module %dc\n\r",moduleNumber);
2020
+ switch(modules.moduleOverlapType)
2021
+ {
2022
+ case 1:
2023
+ any_objs = any_objects_1(moduleNumber,boundaries);
2024
+ break;
2025
+ case 2:
2026
+ any_objs = any_objects_2(moduleNumber,boundaries);
2027
+ break;
2028
+ default:
2029
+ printf("\nERROR: Unrecognized moduleOverlapType!\n\r");
2030
+ }
2031
+ if (any_objs) {
2032
+ dbug(1,"There are objects that may project onto module %d. (%d)\n\r",moduleNumber,modules.moduleOverlapType);
2033
+ // dbug(2,"max : %1.12lf min : %1.12lf\r\n",boundaries[0].max,boundaries[0].min);
2034
+ for(k = 0;k<modules.Pix[moduleTypeIndex];k++){
2035
+
2036
+ // Compute pixel center locations
2037
+ detIndex = firstDetIndex[moduleNumber]+k;
2038
+ for(i = 0;i<3;i++)
2039
+ detCenter[i] = center[i]+UV[k*2]*right[i]+UV[k*2+1]*up[i];
2040
+
2041
+ // Build object list
2042
+ nListObjects = 0;
2043
+ switch(modules.moduleOverlapType)
2044
+ {
2045
+ case 1:
2046
+ build_object_list1(pix_vlims, objectList, &nListObjects, moduleNumber, UV[k*2+1], boundaries);
2047
+ //if (nListObjects > phantom.numObjects)
2048
+ //dbug(2,"nListObjects = %d, phantom.numObjects = %d\r\n", nListObjects, phantom.numObjects);
2049
+ //if (nListObjects > 0)
2050
+ //dbug(2,"nListObjects = %d, k = %d\r\n", nListObjects, k);
2051
+ break;
2052
+ case 2:
2053
+ build_object_list2(pix_ulims, pix_vlims, objectList, &nListObjects, moduleNumber, &UV[k*2], boundaries);
2054
+ break;
2055
+ case 3:
2056
+ build_object_list3();
2057
+ break;
2058
+ default:
2059
+ printf("\nERROR: Unrecognized moduleOverlapType!\n\r");
2060
+ }
2061
+
2062
+ //dbug(2,"nListObjects : %d.\n\r",nListObjects);
2063
+ //dbug(2,"pix_vlims : %1.5lf %1.5lf.\n\r",pix_vlims[0],pix_vlims[1]);
2064
+ //dbug(2,"pix_ulims : %1.5lf %1.5lf.\n\r",pix_ulims[0],pix_ulims[1]);
2065
+ //dbug(2,"UV : %1.5lf %1.5lf.\n\r",UV[0],UV[1]);
2066
+ //struct box_lims *bl = (struct box_lims *) boundaries;
2067
+ //dbug(2,"wd lims : %1.5lf %1.5lf.\n\r",bl[0].minR,bl[0].maxR);
2068
+ //dbug(2,"ht lims : %1.5lf %1.5lf.\n\r",bl[0].minU,bl[0].maxU);
2069
+
2070
+ // Compute relative intensities
2071
+ if(nListObjects){
2072
+ intersections_loop(detCenter, right, up, sampling, nSubDets, sourcePoints, objectList, nListObjects, thisView, detIndex, subviewWeight, detWeights);
2073
+ }
2074
+ else {
2075
+ // for(l = 0;l<nSubDets;l++)
2076
+ // We are assuming the detector weights sum to one and that the sourceWeights sum to one also.
2077
+
2078
+ //------------------- Accurate Detector Model, Mingye
2079
+ if(Accurate_Detector_Model_is_ON)
2080
+ {
2081
+ for(m = 0;m<materials.eBinCount;m++)
2082
+ for(l = 0;l<nSubDets;l++)
2083
+ {
2084
+ int the_index=(detIndex*n_col_oversample+(int)(l/n_row_oversample_add_xtalk))*materials.eBinCount+m;
2085
+ thisView[the_index] += subviewWeight*detWeights[l];
2086
+ }
2087
+ }
2088
+ //-------------------
2089
+ else
2090
+ {
2091
+ for(m = 0;m<materials.eBinCount;m++)
2092
+ thisView[detIndex*materials.eBinCount+m] += subviewWeight;
2093
+ }
2094
+
2095
+ // thisView[detIndex*materials.eBinCount+m] = thisView[detIndex*materials.eBinCount+m]+subviewWeight[n]*detWeights[l]*sourceWeights;
2096
+ } // else
2097
+ } // Loop over pixels (not subpixels)
2098
+ } // if any_objects
2099
+ else {
2100
+ // sum_det_w = 0;
2101
+ // for(l = 0;l<nSubDets;l++) sum_det_w += detWeights[l];
2102
+ // We are assuming the detector weights sum to one and that the sourceWeights sum to one also.
2103
+ for(k = 0;k<modules.Pix[moduleTypeIndex];k++){
2104
+ detIndex = firstDetIndex[moduleNumber]+k;
2105
+
2106
+ //------------------- Accurate Detector Model, Mingye
2107
+ if(Accurate_Detector_Model_is_ON)
2108
+ {
2109
+ for(m = 0;m<materials.eBinCount;m++)
2110
+ for(l = 0;l<nSubDets;l++)
2111
+ {
2112
+ int the_index=(detIndex*n_col_oversample+(int)(l/n_row_oversample_add_xtalk))*materials.eBinCount+m;
2113
+ thisView[the_index] += subviewWeight*detWeights[l];
2114
+ }
2115
+ }
2116
+ //-------------------
2117
+ else
2118
+ {
2119
+ for(m = 0;m<materials.eBinCount;m++)
2120
+ thisView[detIndex*materials.eBinCount+m] += subviewWeight;
2121
+ }
2122
+
2123
+ }
2124
+ }
2125
+ if (debug_flag>0)
2126
+ {
2127
+ min_val = VERY_BIG;
2128
+ for(k = 0;k<modules.Pix[moduleTypeIndex];k++){
2129
+ detIndex = firstDetIndex[moduleNumber]+k;
2130
+ for(m = 0;m<materials.eBinCount;m++)
2131
+ if (thisView[detIndex*materials.eBinCount+m]<min_val) min_val = thisView[detIndex*materials.eBinCount+m];
2132
+ }
2133
+ dbug(1,"minval: %f (module #%d)\n\r", min_val,moduleNumber);
2134
+ }
2135
+ //dbug(2,"Module %dd\n\r",moduleNumber);
2136
+ }
2137
+
2138
+ // Print timing, if requested
2139
+ if (timing != 0)
2140
+ {
2141
+ clk = clock();
2142
+ elapsedTime = (double)( (clk + 0.0) / CLOCKS_PER_SEC)-elapsedTime;
2143
+ printf("End module loop time = %1.12f\r\n",elapsedTime);
2144
+ }
2145
+
2146
+ //dbug(2,"freebefore\n\r",UV[0],UV[1]);
2147
+ free(objectList);objectList = NULL;
2148
+ free(boundaries);boundaries = NULL;
2149
+ //dbug(2,"freeafter\n\r",UV[0],UV[1]);
2150
+ }
2151
+
2152
+ void *projector_wrapper(void *pointerIn)
2153
+
2154
+ {
2155
+ struct projector_args *projectorArgs;
2156
+ FILE *fid;
2157
+ int valuesRead;
2158
+ int goToSleep;
2159
+ int module;
2160
+ int notFirstTimeThrough;
2161
+ double oneMinuteLoadAverage = 0;
2162
+ double loadAdjust;
2163
+ pthread_t my_id = pthread_self();
2164
+ int threadNumber = -1;
2165
+ int i;
2166
+
2167
+ for (i=0;i<thread_count;i++)
2168
+ if (pthread_equal(my_id,t_id[i]))
2169
+ threadNumber = i;
2170
+ loadAdjust = (threadNumber - thread_count/2 + 0.5) * 0.1;
2171
+
2172
+ //printf("Start thread %d\r\n", threadNumber);
2173
+ projectorArgs = (struct projector_args *) pointerIn;
2174
+
2175
+ while (nextModuleInQ < modulesInQ)
2176
+ {
2177
+ goToSleep = 0;
2178
+ #ifdef LIMIT_LOAD
2179
+ if (limitLoadAverage != 0)
2180
+ {
2181
+ fid = fopen("/proc/loadavg","r");
2182
+ valuesRead = fscanf(fid,"%lf",&oneMinuteLoadAverage);
2183
+ fclose(fid);
2184
+ if (valuesRead == 0)
2185
+ goToSleep = 1;
2186
+ //else
2187
+ // printf(" One Minute Load Average = %1.2lf limit: %1.2lf \n\r",oneMinuteLoadAverage,limitLoadAverage);
2188
+ if (oneMinuteLoadAverage > limitLoadAverage + loadAdjust)
2189
+ goToSleep = 1;
2190
+ }
2191
+ if (goToSleep)
2192
+ {dbug(2,"tic\n");_sleep(6);dbug(2,"toc\n");}
2193
+ else
2194
+ {
2195
+ #endif
2196
+ //printf("Thread #%d is tyring to get a module.\n\r",threadNumber);
2197
+ pthread_mutex_lock(&QLock);
2198
+ module = nextModuleInQ;
2199
+ nextModuleInQ++;
2200
+ pthread_mutex_unlock(&QLock);
2201
+
2202
+ if (module < modulesInQ)
2203
+ {
2204
+ dbug(1,"Thread #%d acquired module #%d.\n\r",threadNumber,module);
2205
+ //if ((module == 32)) debug_flag = 2; else debug_flag = 1;
2206
+ Projector(projectorArgs[0].Paras, projectorArgs[0].subviewWeight, projectorArgs[0].thisView, projectorArgs[0].sourcePoints, projectorArgs[0].nSubSources, projectorArgs[0].srcHullPoints, projectorArgs[0].nSrcHullPoints, &(projectorArgs[0].firstDetIndex[module]), 1, &(projectorArgs[0].modTypeInds[module]), &(projectorArgs[0].Up[3*module]), &(projectorArgs[0].Right[3*module]), &(projectorArgs[0].Center[3*module]), projectorArgs[0].UNUSED_tvLength);
2207
+ dbug(1,"Thread #%d finished module #%d.\n\r",threadNumber,module);
2208
+ }
2209
+ #ifdef LIMIT_LOAD
2210
+ }
2211
+ #endif
2212
+ }
2213
+ }
2214
+
2215
+ DLLEXPORT void Projector_threaded(double *Paras, double subviewWeight, double *thisView, double *sourcePoints, int nSubSources, double *srcHullPoints, int nSrcHullPoints, int *firstDetIndex, int nModulesIn, int *modTypeInds, double *Up, double *Right, double *Center, int UNUSED_tvLength, int numThreads, double maxLoadAverage)
2216
+
2217
+ {
2218
+ //------------------- Accurate Detector Model, Mingye
2219
+ if(Paras[0]==1)
2220
+ {
2221
+ set_Accurate_Detector_Model(Paras);
2222
+ Paras[0]=-1;
2223
+ }
2224
+ else if(Paras[0]==0)
2225
+ Accurate_Detector_Model_is_ON=0;
2226
+
2227
+ //FILE *fp;
2228
+ //fp=fopen("flag_1.txt","a");
2229
+ //if(fp)
2230
+ //{
2231
+ // fprintf(fp,"%f %d %d %d %d %d %d %d %f %f\n",
2232
+ // Paras[0],Accurate_Detector_Model_is_ON,
2233
+ // n_col_oversample,n_row_oversample,
2234
+ // n_col_oversample_add_xtalk,n_row_oversample_add_xtalk,
2235
+ // modules.Sub[0],modules.maxSubDets,
2236
+ // modules.Weight[0],modules.Sampling[0]);
2237
+ // fclose(fp);
2238
+ //}
2239
+ //-------------------
2240
+
2241
+
2242
+ int i;
2243
+ struct projector_args projectorArgs[1];
2244
+
2245
+ //printf("Point T0\n\r");
2246
+ thread_count = numThreads;
2247
+ limitLoadAverage = maxLoadAverage;
2248
+
2249
+ projectorArgs[0].Paras = Paras; //parameters for Accurate Detector Model
2250
+ projectorArgs[0].subviewWeight = subviewWeight;
2251
+ projectorArgs[0].thisView = thisView;
2252
+ projectorArgs[0].sourcePoints = sourcePoints;
2253
+ projectorArgs[0].nSubSources = nSubSources;
2254
+ projectorArgs[0].srcHullPoints = srcHullPoints;
2255
+ projectorArgs[0].nSrcHullPoints = nSrcHullPoints;
2256
+ projectorArgs[0].firstDetIndex = firstDetIndex;
2257
+ projectorArgs[0].nModulesIn = nModulesIn;
2258
+ projectorArgs[0].modTypeInds = modTypeInds;
2259
+ projectorArgs[0].Up = Up;
2260
+ projectorArgs[0].Right = Right;
2261
+ projectorArgs[0].Center = Center;
2262
+ projectorArgs[0].UNUSED_tvLength = UNUSED_tvLength;
2263
+
2264
+ nextModuleInQ = 0;
2265
+ modulesInQ = nModulesIn;
2266
+
2267
+ //dbug(2,"Point T1\n\r");
2268
+ // Create the threads
2269
+ t_id = malloc(sizeof(pthread_t)*thread_count);
2270
+ for (i=0;i<thread_count;i++)
2271
+ {
2272
+ pthread_create(&t_id[i],NULL,projector_wrapper,projectorArgs);
2273
+ //printf("Created thread %d",i);
2274
+ }
2275
+ //dbug(2,"Point T2\n\r");
2276
+ // Wait for them to complete
2277
+ for (i=0;i<thread_count;i++)
2278
+ {
2279
+ pthread_join(t_id[i],NULL);
2280
+ //printf("Finished thread %d",i);
2281
+ }
2282
+ free(t_id);
2283
+ }
2284
+
2285
+ void diff(double *d1,double *d2,int len)
2286
+ {
2287
+ int i;
2288
+ double nrm = 0;
2289
+ for(i = 0;i<len;i++)
2290
+ nrm += (d1[i]-d2[i])*(d1[i]-d2[i]);
2291
+ printf("%.10f ",nrm);
2292
+ }
2293
+
2294
+
2295
+ void CO(double *c_values)
2296
+
2297
+ {
2298
+ int n,i,imax = -1;
2299
+ double *dat,mx_diff = 0,nrm_diff = 0,tmp;
2300
+ FILE *fid;
2301
+ char *fname;
2302
+
2303
+ if (debug_flag){
2304
+ COMPARISON_NUMBER++;
2305
+ fname = malloc(sizeof(char)*1280);
2306
+ sprintf(fname,"CO");
2307
+ sprintf(&fname[2],"%d",COMPARISON_NUMBER);
2308
+ sprintf(&fname[3],".dat");
2309
+ fid = fopen(fname,"r");
2310
+ fread(&n,sizeof(int),1,fid);
2311
+ printf("\r\n%d\r\n\n\n\n\n\n",n);
2312
+ dat = malloc(sizeof(double)*n);
2313
+ fread(dat,sizeof(double),n,fid);
2314
+ fclose(fid);
2315
+ for(i = 0;i<n;i++)
2316
+ {
2317
+ tmp = fabs(c_values[i]-dat[i]);
2318
+ if (tmp>mx_diff) {mx_diff = tmp;imax = i;}
2319
+ nrm_diff += tmp*tmp;
2320
+ }
2321
+ printf("\r\n\n Comparison number %d:\r\n mx_diff : %1.12lf\r\n (at index #%d)\r\n nrm_diff : %1.12lf\r\n\n",COMPARISON_NUMBER,mx_diff,imax,nrm_diff);
2322
+ free(dat);
2323
+ }
2324
+ }
2325
+
2326
+ void COf(float *c_values)
2327
+
2328
+ {
2329
+ int n,i,imax = -1;
2330
+ float *dat,mx_diff = 0,nrm_diff = 0,tmp;
2331
+ FILE *fid;
2332
+ char *fname;
2333
+
2334
+ if (debug_flag){
2335
+ COMPARISON_NUMBER++;
2336
+ fname = malloc(sizeof(char)*1280);
2337
+ sprintf(fname,"CO");
2338
+ sprintf(&fname[2],"%d",COMPARISON_NUMBER);
2339
+ sprintf(&fname[3],".dat");
2340
+ fid = fopen(fname,"r");
2341
+ fread(&n,sizeof(int),1,fid);
2342
+ printf("\r\n%d\r\n\n\n\n\n\n",n);
2343
+ dat = malloc(sizeof(float)*n);
2344
+ fread(dat,sizeof(float),n,fid);
2345
+ fclose(fid);
2346
+ for(i = 0;i<n;i++)
2347
+ {
2348
+ tmp = fabs(c_values[i]-dat[i]);
2349
+ if (tmp>mx_diff) {mx_diff = tmp;imax = i;}
2350
+ nrm_diff += tmp*tmp;
2351
+ }
2352
+ printf("\r\n\n Comparison number %d:\r\n mx_diff : %1.12f\r\n (at index #%d)\r\n nrm_diff : %1.12f\r\n\n",COMPARISON_NUMBER,mx_diff,imax,nrm_diff);
2353
+ free(dat);
2354
+ }
2355
+ }
2356
+
2357
+ void COi(int *c_values)
2358
+
2359
+ {
2360
+ int n,i,imax = -1;
2361
+ int *dat,mx_diff = 0,nrm_diff = 0,tmp;
2362
+ FILE *fid;
2363
+ char *fname;
2364
+
2365
+ if (debug_flag){
2366
+ COMPARISON_NUMBER++;
2367
+ fname = malloc(sizeof(char)*1280);
2368
+ sprintf(fname,"CO");
2369
+ sprintf(&fname[2],"%d",COMPARISON_NUMBER);
2370
+ sprintf(&fname[3],".dat");
2371
+ fid = fopen(fname,"r");
2372
+ fread(&n,sizeof(int),1,fid);
2373
+ printf("\r\n%d\r\n\n\n\n\n\n",n);
2374
+ dat = malloc(sizeof(int)*n);
2375
+ fread(dat,sizeof(int),n,fid);
2376
+ fclose(fid);
2377
+ if (n<32){
2378
+ printf("\r\n\n Comparison number %d:\r\n\n",COMPARISON_NUMBER);
2379
+ for(i = 0;i<n;i++)
2380
+ {
2381
+ tmp = abs(c_values[i]-dat[i]);
2382
+ printf("FreeMat: %d C: %d\r\n",dat[i],c_values[i]);
2383
+ }
2384
+ }
2385
+ else {
2386
+ for(i = 0;i<n;i++)
2387
+ {
2388
+ tmp = abs(c_values[i]-dat[i]);
2389
+ if (tmp>mx_diff) {mx_diff = tmp;imax = i;}
2390
+ nrm_diff += tmp*tmp;
2391
+ }
2392
+ printf("\r\n\n Comparison number %d:\r\n mx_diff : %d\r\n (at index #%d)\r\n nrm_diff : %d\r\n\n",COMPARISON_NUMBER,mx_diff,imax,nrm_diff);
2393
+ }
2394
+ free(dat);
2395
+ }
2396
+ }
2397
+
2398
+ void COs(short *c_values)
2399
+
2400
+ {
2401
+ int n,i,imax = -1;
2402
+ short *dat;
2403
+ int mx_diff = 0,nrm_diff = 0,tmp;
2404
+ FILE *fid;
2405
+ char *fname;
2406
+
2407
+ if (debug_flag){
2408
+ COMPARISON_NUMBER++;
2409
+ fname = malloc(sizeof(char)*1280);
2410
+ sprintf(fname,"CO");
2411
+ sprintf(&fname[2],"%d",COMPARISON_NUMBER);
2412
+ sprintf(&fname[3],".dat");
2413
+ fid = fopen(fname,"r");
2414
+ fread(&n,sizeof(int),1,fid);
2415
+ printf("\r\n%d\r\n\n\n\n\n\n",n);
2416
+ dat = malloc(sizeof(short)*n);
2417
+ fread(dat,sizeof(short),n,fid);
2418
+ fclose(fid);
2419
+ for(i = 0;i<n;i++)
2420
+ {
2421
+ tmp = abs(c_values[i]-dat[i]);
2422
+ if (tmp>mx_diff) {mx_diff = tmp;imax = i;}
2423
+ nrm_diff += tmp*tmp;
2424
+ }
2425
+ printf("\r\n\n Comparison number %d:\r\n mx_diff : %d\r\n (at index #%d)\r\n nrm_diff : %d\r\n\n",COMPARISON_NUMBER,mx_diff,imax,nrm_diff);
2426
+ free(dat);
2427
+ }
2428
+ }
2429
+
2430
+ // gcc -shared -fPIC -O3 -mfpmath=sse -msse -o YYcode64.so YYcode.c
2431
+ // gcc -shared -fPIC -O3 -mfpmath=sse -msse -m32 -o YYcode.so YYcode.c
2432
+
2433
+