123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138 |
- #include <stdlib.h>
- #include <stdio.h>
- #include <string.h>
- #include <math.h>
- #include <malloc.h>
- #define MAX_KERNELS 50
- #define N_KERNEL_RADII 24
- #define N_KERNEL_ANGLES 48
- #define N_KERNEL_CATEGORIES 5
- #define Mus 5
- #define Nus 5
- #define Qus 5
- #define SUCCESS 1
- #define FAILURE 0
- #define doseCutoffThreshold 0.005
- #define RSAFE 2.0
- #define PI 3.14152654
- #define Y_DOSE_EXTENT 8.0
- #define NPHI 12
- #define NTHETA 6
- #define MAXX(x,y) ((x) > (y) ? (x) : (y))
- typedef enum
- {
- primary_,
- first_scatter_,
- second_scatter_,
- multiple_scatter_,
- brem_annih_
- } KERNEL_CATEGORIES;
- typedef struct
- {
- float x;
- float y;
- float z;
- } POINT;
- typedef struct
- {
- POINT start;
- POINT inc;
- int x_count;
- int y_count;
- int z_count;
- float *matrix;
- } FLOAT_GRID;
- #define GRID_VALUE(GRID_ptr, i, j, k)\
- ((GRID_ptr)->matrix[(i) +\
- (GRID_ptr)->x_count *\
- ((j) + ((k) * (GRID_ptr)->y_count))])
- #define DOT3D(vec1,vec2) ((vec1[0])*(vec2[0])+(vec1[1])*(vec2[1])+(vec1[2])*(vec2[2]))
- typedef struct
- {
- int nradii;
- int ntheta;
- float *radial_boundary;
- float *angular_boundary;
- float *matrix[N_KERNEL_CATEGORIES];
- float *total_matrix;
- } KERNEL;
- #define KERNEL_VALUE(kern_ptr,category,i,j) \
- (kern_ptr)->matrix[category][(i) + (j)*(kern_ptr)->nradii]
- #define KERNEL_TOTAL_VALUE(kern_ptr,i,j) \
- (kern_ptr)->total_matrix[(i) + (j)*(kern_ptr)->nradii]
- typedef struct
- {
- int nkernels;
- float *energy;
- float *fluence;
- float *mu;
- float *mu_en;
- KERNEL kernel[MAX_KERNELS];
- } MONO_KERNELS;
- typedef struct
- {
- float ip[3];
- float jp[3];
- float kp[3];
- float y_vec[3];
-
- float xp;
- float yp;
- float del_xp;
- float del_yp;
-
- float SAD;
-
- int num;
- } BEAM;
- float *fvector(int nl, int nh);
- float **fmatrix(int nrl, int nrh, int ncl, int nch);
- void free_fvector(float *v, int nl, int nh);
- void free_fmatrix(float **m, int nrl, int nrh, int ncl, int nch);
- int copy_grid_geometry(FLOAT_GRID *, FLOAT_GRID *);
- int binSearch(float *, float, int);
- void nrerror(char error_text[]);
|