18 #define _CELL_SIZE_ 3.0
20 #define _CELL_SIZE_ 1.0
28 char fname[FILENAME_MAX];
30 snprintf(fname, FILENAME_MAX-1,
"SolenoidMap%d.dat",
_MAP_ID_);
33 FILE *fout = fopen(fname,
"w");
37 printf(
"Failed to open '%s' for writing!\n", fname);
44 "PHENIX", &xc, &fc, 34);
60 t_mgrid_direction *dirR = mgrid->dir +
_R_, *dirZ = mgrid->dir +
_Z_;
61 float xmin[3] = { 0.0, 0.0, dirZ->min},
step[3];
62 float xmax[3] = {dirR->max, dirR->max, dirZ->max};
63 printf(
"%f %f %f %f\n", dirR->min, dirR->max, dirZ->min, dirZ->max);
71 nodes[iq] = (int)rint((xmax[iq] - xmin[iq])/
_CELL_SIZE_);
74 step[iq] = (xmax[iq] - xmin[iq])/nodes[iq];
78 fprintf(fout,
"Solenoid\n");
81 fprintf(fout,
"%6.1f %6.1f %3d\n", xmin[iq], xmax[iq], nodes[iq]);
91 for(ix=0; ix<=nodes[
_X_]; ix++)
92 for(iy=0; iy<=nodes[
_Y_]; iy++)
93 for(iz=0; iz<=nodes[
_Z_]; iz++)
97 xmin[
_Z_] + iz*step[
_Z_]}, B;
99 ret = get_cartesian_field_value(mgrid, xx, B);
101 fprintf(fout,
"%10.3f %10.3f %10.3f\n", 2.*B[0], 2.*B[1], 2.*B[2]);
108 unsigned iq, nodes[3] = {101, 101, 401};
111 float xmin[3] = { 0.0, 0.0, -200.0};
112 float xmax[3] = { 100.0, 100.0, 200.0};
115 fprintf(fout,
"Solenoid\n");
116 fprintf(fout,
"G\n");
117 for(iq=0; iq<3; iq++)
118 fprintf(fout,
"%6.1f %6.1f %3d\n", xmin[iq], xmax[iq], nodes[iq]);
125 for(ix=0; ix<nodes[
_X_]; ix++)
126 for(iy=0; iy<nodes[
_Y_]; iy++)
127 for(iz=0; iz<nodes[
_Z_]; iz++)
131 xmin[
_Z_] + iz*_CELL_SIZE_}, B;
133 ret = get_cartesian_field_value(mgrid, xx, B);
135 fprintf(fout,
"%10.3f %10.3f %10.3f\n", B[0], B[1], B[2]);