38 #define NBIPATH "/nbi/nbi_XXXXXXXXXX/"
43 f, qid, __FILE__, __LINE__) ) {
return 1;}
47 int nbeamlet_total = 0;
48 int*
id = (
int*) malloc( ninj*
sizeof(
int) );
49 int* anum = (
int*) malloc( ninj*
sizeof(
int) );
50 int* znum = (
int*) malloc( ninj*
sizeof(
int) );
51 int* nbeamlet = (
int*) malloc( ninj*
sizeof(
int) );
60 real* div_halo_frac = (
real*) malloc( ninj*
sizeof(
real) );
61 for(
int i = 0; i < ninj; i++) {
62 sprintf(path, NBIPATH
"inj%d/%s", i+1,
"ids");
64 f, qid, __FILE__, __LINE__) ) {
return 1;}
66 sprintf(path, NBIPATH
"inj%d/%s", i+1,
"nbeamlet");
68 f, qid, __FILE__, __LINE__) ) {
return 1;}
70 sprintf(path, NBIPATH
"inj%d/%s", i+1,
"power");
72 f, qid, __FILE__, __LINE__) ) {
return 1;}
73 sprintf(path, NBIPATH
"inj%d/%s", i+1,
"energy");
75 f, qid, __FILE__, __LINE__) ) {
return 1;}
76 sprintf(path, NBIPATH
"inj%d/%s", i+1,
"efrac");
78 f, qid, __FILE__, __LINE__) ) {
return 1;}
80 sprintf(path, NBIPATH
"inj%d/%s", i+1,
"divh");
82 f, qid, __FILE__, __LINE__) ) {
return 1;}
83 sprintf(path, NBIPATH
"inj%d/%s", i+1,
"divv");
85 f, qid, __FILE__, __LINE__) ) {
return 1;}
86 sprintf(path, NBIPATH
"inj%d/%s", i+1,
"divhalofrac");
88 f, qid, __FILE__, __LINE__) ) {
return 1;}
89 sprintf(path, NBIPATH
"inj%d/%s", i+1,
"divhaloh");
91 f, qid, __FILE__, __LINE__) ) {
return 1;}
92 sprintf(path, NBIPATH
"inj%d/%s", i+1,
"divhalov");
94 f, qid, __FILE__, __LINE__) ) {
return 1;}
96 sprintf(path, NBIPATH
"inj%d/%s", i+1,
"anum");
98 f, qid, __FILE__, __LINE__) ) {
return 1;}
99 sprintf(path, NBIPATH
"inj%d/%s", i+1,
"znum");
101 f, qid, __FILE__, __LINE__) ) {
return 1;}
102 sprintf(path, NBIPATH
"inj%d/%s", i+1,
"mass");
104 f, qid, __FILE__, __LINE__) ) {
return 1;}
110 nbeamlet_total += 6 * nbeamlet[i];
115 real* beamlet_xyz = (
real*) malloc( nbeamlet_total *
sizeof(
real) );
117 for(
int i = 0; i < data->
ninj; i++) {
119 sprintf(path, NBIPATH
"inj%d/%s", i+1,
"beamletx");
121 f, qid, __FILE__, __LINE__) ) {
return 1;}
122 sprintf(path, NBIPATH
"inj%d/%s", i+1,
"beamlety");
124 f, qid, __FILE__, __LINE__) ) {
return 1;}
125 sprintf(path, NBIPATH
"inj%d/%s", i+1,
"beamletz");
127 f, qid, __FILE__, __LINE__) ) {
return 1;}
128 sprintf(path, NBIPATH
"inj%d/%s", i+1,
"beamletdx");
130 f, qid, __FILE__, __LINE__) ) {
return 1;}
131 sprintf(path, NBIPATH
"inj%d/%s", i+1,
"beamletdy");
133 f, qid, __FILE__, __LINE__) ) {
return 1;}
134 sprintf(path, NBIPATH
"inj%d/%s", i+1,
"beamletdz");
136 f, qid, __FILE__, __LINE__) ) {
return 1;}
141 int err =
nbi_init(data, ninj,
id, anum, znum, mass, power, efrac, energy,
142 div_h, div_v, div_halo_v, div_halo_h, div_halo_frac,
143 nbeamlet, beamlet_xyz);
int nbi_init(nbi_data *data, int ninj, int *id, int *anum, int *znum, real *mass, real *power, real *efrac, real *energy, real *div_h, real *div_v, real *div_halo_v, real *div_halo_h, real *div_halo_frac, int *nbeamlet, real *beamlet_xyz)
Initialize NBI data struct on target.