]>
Commit | Line | Data |
---|---|---|
2817d3e2 | 1 | // $Id$ |
2 | // Category: geometry | |
3 | // | |
4 | // See the class description in the header file. | |
5 | ||
6 | #include "TG4GeometryOutputManager.h" | |
7 | #include <iostream.h> | |
8 | #include <iomanip.h> | |
9 | ||
10 | TG4GeometryOutputManager::TG4GeometryOutputManager() { | |
11 | // | |
12 | } | |
13 | ||
14 | TG4GeometryOutputManager::~TG4GeometryOutputManager() { | |
15 | // | |
16 | } | |
17 | ||
18 | // public methods | |
19 | ||
20 | void TG4GeometryOutputManager::OpenFile(G4String filePath) | |
21 | { | |
22 | // Opens output files. | |
23 | // --- | |
24 | ||
25 | G4cout << "TG4GeometryOutputManager::OpenFile: " << filePath << endl; | |
26 | ||
27 | fOutFile.open(filePath, ios::out, filebuf::openprot); | |
28 | ||
29 | if (!fOutFile) { | |
30 | G4String text = "Cannot open "; | |
31 | text = text + filePath; | |
32 | TG4Globals::Warning(text); | |
33 | } | |
34 | ||
35 | // use FORTRAN compatibility output | |
36 | fOutFile << setiosflags(ios::showpoint | ios::uppercase); | |
37 | } | |
38 | ||
39 | ||
40 | void TG4GeometryOutputManager::CloseFile() | |
41 | { | |
42 | // Closess output files. | |
43 | // --- | |
44 | ||
45 | fOutFile.close(); | |
46 | } | |
47 | ||
48 | ||
49 | void TG4GeometryOutputManager::WriteGsvolu( | |
50 | G4String vname, G4String shape, G4int nmed, G4double* Rpar, | |
51 | G4int npar) | |
52 | { | |
53 | // from fortran (g3routines.F) | |
54 | // write(fmt,'(A,I2,A)')'(a4,1x,a6,1x,a4,1x,a4,2i5,',max(npar,1), | |
55 | //> '(1x,e16.8))' | |
56 | // write(lunlist,fmt) context, rname, name, shape, nmed, npar, | |
57 | //+ (par(k),k=1,npar) | |
58 | // --- | |
59 | ||
60 | G4String context("----"); | |
61 | G4String rname("GSVOLU"); | |
62 | G4String space(" "); | |
63 | fOutFile << context << space | |
64 | << rname << space | |
65 | << vname << space | |
66 | << shape | |
67 | << setw(5) << nmed | |
68 | << setw(5) << npar; | |
69 | for (G4int i=0; i<npar; i++) | |
70 | fOutFile << space << setw(16) << setprecision(8) << Rpar[i]; | |
71 | fOutFile << G4endl; | |
72 | } | |
73 | ||
74 | ||
75 | void TG4GeometryOutputManager::WriteGspos( | |
76 | G4String vname, G4int num, G4String vmoth, G4double x, | |
77 | G4double y, G4double z, G4int irot, G4String vonly) | |
78 | { | |
79 | // from fortran (g3routines.F) | |
80 | // write(lunlist, | |
81 | //+ '(a4,1x,a6,1x,a4,i5,1x,a4,3(1x,e16.8),i5,1x,a4)') | |
82 | //+ context, rname, name, num, moth, x, y, z, irot, only | |
83 | // --- | |
84 | ||
85 | G4String context("----"); | |
86 | G4String rname("GSPOS"); | |
87 | G4String space(" "); | |
88 | fOutFile << context << space | |
89 | << rname << space | |
90 | << vname << space | |
91 | << setw(5) << num << space | |
92 | << vmoth << space | |
93 | << setw(16) << setprecision(8) << x << space | |
94 | << setw(16) << setprecision(8) << y << space | |
95 | << setw(16) << setprecision(8) << z | |
96 | << setw(5) << irot << space | |
97 | << vonly | |
98 | << G4endl; | |
99 | } | |
100 | ||
101 | ||
102 | void TG4GeometryOutputManager::WriteGsposp( | |
103 | G4String vname, G4int num, G4String vmoth, G4double x, | |
104 | G4double y, G4double z, G4int irot, G4String vonly, | |
105 | G4double pars[], G4int npar) | |
106 | { | |
107 | // from fortran (g3routines.F) | |
108 | // write(fmt,'(A,A,I2,A)') | |
109 | //+ '(a4,1x,a6,1x,a4,i5,1x,a4,3(1x,e16.8),', | |
110 | //+ 'i5,1x,a4,i5,',max(npar,1),'(1x,e16.8))' | |
111 | // write(lunlist,fmt) | |
112 | //+ context, rname, name, num, moth, x, y, z, irot, only, | |
113 | //+ npar, | |
114 | //+ (par(k),k=1,npar) | |
115 | // --- | |
116 | ||
117 | G4String context("----"); | |
118 | G4String rname("GSPOSP"); | |
119 | G4String space(" "); | |
120 | fOutFile << context << space | |
121 | << rname << space | |
122 | << vname << space | |
123 | << setw(5) << num << space | |
124 | << vmoth << space | |
125 | << setw(16) << setprecision(8) << x << space | |
126 | << setw(16) << setprecision(8) << y << space | |
127 | << setw(16) << setprecision(8) << z | |
128 | << setw(5) << irot << space | |
129 | << vonly | |
130 | << setw(5) << npar; | |
131 | for (G4int i=0; i<npar; i++) | |
132 | fOutFile << space << setw(16) << setprecision(8) << pars[i]; | |
133 | fOutFile << G4endl; | |
134 | } | |
135 | ||
136 | ||
137 | void TG4GeometryOutputManager::WriteGsrotm( | |
138 | G4int irot, G4double theta1, G4double phi1, | |
139 | G4double theta2, G4double phi2, G4double theta3, G4double phi3) | |
140 | { | |
141 | // from fortran (g3routines.F) | |
142 | // write(lunlist, | |
143 | //+ '(a4,1x,a6,i5,6f11.5)') | |
144 | //+ context, rname, irot, theta1, phi1, theta2, phi2, | |
145 | //+ theta3, phi3 | |
146 | // --- | |
147 | ||
148 | G4String context("----"); | |
149 | G4String rname("GSROTM"); | |
150 | G4String space(" "); | |
151 | fOutFile << context << space | |
152 | << rname << space | |
153 | << setw(5) << irot | |
154 | << setw(11) << setprecision(5) << theta1 | |
155 | << setw(11) << setprecision(5) << phi1 | |
156 | << setw(11) << setprecision(5) << theta2 | |
157 | << setw(11) << setprecision(5) << phi2 | |
158 | << setw(11) << setprecision(5) << theta3 | |
159 | << setw(11) << setprecision(5) << phi3 | |
160 | << G4endl; | |
161 | } | |
162 | ||
163 | ||
164 | void TG4GeometryOutputManager::WriteGsdvn( | |
165 | G4String vname, G4String vmoth, G4int ndiv, G4int iaxis) | |
166 | { | |
167 | // from fortran (g3routines.F) | |
168 | // write(lunlist, | |
169 | //+ '(a4,1x,a6,1x,a4,1x,a4,i5,i3)') | |
170 | //+ context, rname, name, moth, ndiv, iaxis | |
171 | // --- | |
172 | ||
173 | G4String context("----"); | |
174 | G4String rname("GSDVN"); | |
175 | G4String space(" "); | |
176 | fOutFile << context << space | |
177 | << rname << space | |
178 | << vname << space | |
179 | << vmoth << space | |
180 | << setw(5) << ndiv | |
181 | << setw(5) << iaxis | |
182 | << G4endl; | |
183 | } | |
184 | ||
185 | ||
186 | void TG4GeometryOutputManager::WriteGsdvn2( | |
187 | G4String vname, G4String vmoth, G4int ndiv, G4int iaxis, | |
188 | G4double c0, G4int numed) | |
189 | { | |
190 | // from fortran (g3routines.F) | |
191 | // write(lunlist, | |
192 | //+ '(a4,1x,a6,1x,a4,1x,a4,i5,i3,(1x,e16.8),i5)') | |
193 | //+ context, rname, name, moth, ndiv, iaxis, c0, numed | |
194 | // --- | |
195 | ||
196 | G4String context("----"); | |
197 | G4String rname("GSDVN2"); | |
198 | G4String space(" "); | |
199 | fOutFile << context << space | |
200 | << rname << space | |
201 | << vname << space | |
202 | << vmoth << space | |
203 | << setw(5) << ndiv | |
204 | << setw(5) << iaxis << " " | |
205 | << setw(16) << setprecision(8) << c0 | |
206 | << setw(5) << numed | |
207 | << G4endl; | |
208 | } | |
209 | ||
210 | ||
211 | void TG4GeometryOutputManager::WriteGsdvt( | |
212 | G4String vname, G4String vmoth, G4double step, G4int iaxis, | |
213 | G4int numed, G4int ndvmx) | |
214 | { | |
215 | // from fortran (g3routines.F) | |
216 | // write(lunlist, | |
217 | // + '(a4,1x,a6,1x,a4,1x,a4,(1x,e16.8),3i5)') | |
218 | // + context, rname, name, moth, step, iaxis, numed, ndvmx | |
219 | // --- | |
220 | ||
221 | G4String context("----"); | |
222 | G4String rname("GSDVT"); | |
223 | G4String space(" "); | |
224 | fOutFile << context << space | |
225 | << rname << space | |
226 | << vname << space | |
227 | << vmoth << space | |
228 | << setw(16) << setprecision(8) << step | |
229 | << setw(5) << iaxis | |
230 | << setw(5) << numed | |
231 | << setw(5) << ndvmx | |
232 | << G4endl; | |
233 | } | |
234 | ||
235 | ||
236 | void TG4GeometryOutputManager::WriteGsdvt2( | |
237 | G4String vname, G4String vmoth, G4double step, G4int iaxis, | |
238 | G4double c0, G4int numed, G4int ndvmx) | |
239 | { | |
240 | // from fortran (g3routines.F) | |
241 | // write(lunlist, | |
242 | //+ '(a4,1x,a6,1x,a4,1x,a4,(1x,e16.8),i3,(1x,e16.8),2i5)') | |
243 | //+ context, rname, name, moth, step, iaxis, c0, numed, ndvmx | |
244 | // --- | |
245 | ||
246 | G4String context("----"); | |
247 | G4String rname("GSDVT2"); | |
248 | G4String space(" "); | |
249 | fOutFile << context << space | |
250 | << rname << space | |
251 | << vname << space | |
252 | << vmoth << space | |
253 | << setw(16) << setprecision(8) << step | |
254 | << setw(3) << iaxis << space | |
255 | << setw(16) << setprecision(8) << c0 | |
256 | << setw(5) << numed | |
257 | << setw(5) << ndvmx | |
258 | << endl; | |
259 | } | |
260 | ||
261 | ||
262 | void TG4GeometryOutputManager::WriteGsdvx( | |
263 | G4String name, G4String moth, G4int ndiv, G4int iaxis, | |
264 | G4double step, G4double c0, G4int numed, G4int ndvmx) | |
265 | { | |
266 | // from fortran (g3routines.F) | |
267 | // write(lunlist, | |
268 | // + '(a4,1x,a6,1x,a4,1x,a4,i5,i3,2(1x,e16.8),2i5)') | |
269 | // + context, rname, name, moth, ndiv, iaxis,step, c0, | |
270 | // + numed, ndvmx | |
271 | // --- | |
272 | ||
273 | G4String context("----"); | |
274 | G4String rname("GSDVX"); | |
275 | G4String space(" "); | |
276 | fOutFile << context << space | |
277 | << rname << space | |
278 | << name << space | |
279 | << moth << space | |
280 | << setw(5) << ndiv | |
281 | << setw(3) << iaxis << space | |
282 | << setw(16) << setprecision(8) << step << space | |
283 | << setw(16) << setprecision(8) << c0 | |
284 | << setw(5) << numed | |
285 | << setw(5) << ndvmx | |
286 | << endl; | |
287 | } | |
288 | ||
289 | ||
290 | void TG4GeometryOutputManager::WriteGsmate( | |
291 | G4int imate, G4String name, G4double ain, G4double zin, | |
292 | G4double densin, G4double radl, G4int nwbf, G4double* ubuf) | |
293 | { | |
294 | // from fortran (g3routines.F) | |
295 | // write(fmt,'(A,I3,A)') | |
296 | //+ '(a4,1x,a6,i5,1x,''"'',a,''"'',4(1x,e16.8),i3,', | |
297 | //+ max(nwbf,1),'(1x,e16.8))' | |
298 | // write(lunlist,fmt) | |
299 | //+ context, rname, imate, name, a, z, dens, radl, | |
300 | //+ nwbf, (ubf(k), k=1,nwbf) | |
301 | // --- | |
302 | ||
303 | G4String context("----"); | |
304 | G4String rname("GSMATE"); | |
305 | G4String space(" "); | |
306 | fOutFile << context << space | |
307 | << rname << space | |
308 | << setw(5) << imate << space | |
309 | << '"' << name << '"' << space | |
310 | << setw(16) << setprecision(8) << ain << space | |
311 | << setw(16) << setprecision(8) << zin << space | |
312 | << setw(16) << setprecision(8) << densin << space | |
313 | << setw(16) << setprecision(8) << radl | |
314 | << setw(3) << nwbf; | |
315 | for (G4int i=0; i<nwbf; i++) | |
316 | fOutFile << space << setw(16) << setprecision(8) << ubuf[i]; | |
317 | fOutFile << endl; | |
318 | } | |
319 | ||
320 | ||
321 | void TG4GeometryOutputManager::WriteGsmixt( | |
322 | G4int imate, G4String name, G4double* a, G4double* z, | |
323 | G4double dens, G4int nlmat, G4double* wmat) | |
324 | { | |
325 | // from fortran (g3routines.F) | |
326 | // write(fmt,'(A,I3,A,I3,A,I3,A)') | |
327 | //+ '(a4,1x,a6,i5,1x,''"'',a,''"'',1x,e16.8,1x,i3,', | |
328 | //+ max(nlmata,1), | |
329 | //+ '(1x,e16.8),',max(nlmata,1),'(1x,e16.8),', | |
330 | //+ max(nlmata,1),'(1x,e16.8))' | |
331 | // write(lunlist,fmt) | |
332 | //+ context, rname, imate, name, dens, | |
333 | //+ nlmat, | |
334 | //+ (a(k), k=1,abs(nlmat)), | |
335 | //+ (z(k), k=1,abs(nlmat)), | |
336 | //+ (wmat(k), k=1,abs(nlmat)) | |
337 | // --- | |
338 | ||
339 | G4String context("----"); | |
340 | G4String rname("GSMIXT"); | |
341 | G4String space(" "); | |
342 | fOutFile << context << space | |
343 | << rname << space | |
344 | << setw(5) << imate << space | |
345 | << '"' << name << '"' << space | |
346 | << setw(16) << setprecision(8) << dens << space | |
347 | << setw(3) << nlmat; | |
348 | G4int i; | |
349 | for (i=0; i<abs(nlmat); i++) | |
350 | fOutFile << space << setw(16) << setprecision(8) << a[i]; | |
351 | for (i=0; i<abs(nlmat); i++) | |
352 | fOutFile << space << setw(16) << setprecision(8) << z[i]; | |
353 | for (i=0; i<abs(nlmat); i++) | |
354 | fOutFile << space << setw(16) << setprecision(8) << wmat[i]; | |
355 | fOutFile << endl; | |
356 | } | |
357 | ||
358 | ||
359 | void TG4GeometryOutputManager::WriteGstmed( | |
360 | G4int itmed, G4String name, G4int nmat, G4int isvol, | |
361 | G4int ifield, G4double fieldm, G4double tmaxfd, | |
362 | G4double stemax, G4double deemax, G4double epsil, | |
363 | G4double stmin, G4double* ubuf, G4int nwbuf) | |
364 | { | |
365 | // from fortran (g3routines.F) | |
366 | // write(fmt,'(A,I3,A)') | |
367 | //> '(a4,1x,a6,i5,1x,''"'',a,''"'',3i3,6(1x,e16.8),i3,', | |
368 | //> max(nwbuf,1),'(1x,e16.8))' | |
369 | // write(lunlist,fmt) | |
370 | //+ context, rname, itmed, name, nmat, isvol, ifield, fieldm, | |
371 | //+ tmaxfd, stemax, deemax, epsil, stmin, | |
372 | //+ nwbuf, (ubuf(k),k=1,nwbuf) | |
373 | // --- | |
374 | ||
375 | G4String context("----"); | |
376 | G4String rname("GSTMED"); | |
377 | G4String space(" "); | |
378 | fOutFile << context << space | |
379 | << rname << space | |
380 | << setw(5) << itmed << space | |
381 | << '"' << name << '"' | |
382 | << setw(3) << nmat | |
383 | << setw(3) << isvol | |
384 | << setw(3) << ifield << space | |
385 | << setw(16) << setprecision(8) << fieldm << space | |
386 | << setw(16) << setprecision(8) << tmaxfd << space | |
387 | << setw(16) << setprecision(8) << stemax << space | |
388 | << setw(16) << setprecision(8) << deemax << space | |
389 | << setw(16) << setprecision(8) << epsil << space | |
390 | << setw(16) << setprecision(8) << stmin << space | |
391 | << setw(3) << nwbuf; | |
392 | for (G4int i=0; i<nwbuf; i++) | |
393 | fOutFile << space << setw(16) << setprecision(8) << ubuf[i]; | |
394 | fOutFile << endl; | |
395 | } | |
396 | ||
397 | ||
398 | void TG4GeometryOutputManager::WriteGstpar( | |
399 | G4int itmed, G4String param, G4double parval) | |
400 | { | |
401 | // from fortran (g3routines.F) | |
402 | // write(lunlist, | |
403 | //+ '(a4,1x,a6,i5,1x,a4,(1x,e16.8))') | |
404 | //+ context, rname, itmed, chpar, parval | |
405 | // --- | |
406 | ||
407 | G4String context("----"); | |
408 | G4String rname("GSTPAR"); | |
409 | G4String space(" "); | |
410 | fOutFile << context << space | |
411 | << rname << space | |
412 | << setw(5) << itmed << space | |
413 | << param << space | |
414 | << setw(16) << setprecision(8) << parval | |
415 | << endl; | |
416 | } | |
417 | ||
418 | ||
419 | void TG4GeometryOutputManager::WriteGgclos() | |
420 | { | |
421 | // Writes GGCLOS token | |
422 | // --- | |
423 | ||
424 | G4String context("----"); | |
425 | G4String rname("GGCLOS"); | |
426 | G4String space(" "); | |
427 | fOutFile << context << space | |
428 | << rname | |
429 | << endl; | |
430 | } |