File: MCPL_merge.instr

package info (click to toggle)
mccode 3.5.19%2Bds5-2
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 1,113,256 kB
  • sloc: ansic: 40,697; python: 25,137; yacc: 8,438; sh: 5,405; javascript: 4,596; lex: 1,632; cpp: 742; perl: 296; lisp: 273; makefile: 226; fortran: 132
file content (126 lines) | stat: -rw-r--r-- 4,127 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
/*******************************************************************************
* Instrument: MCPL_merge
*
* %I
* Written by: Peter Willendrup <pkwi@fysik.dtu.dk>
* Date: 2019-03
* Origin: DTU
* %INSTRUMENT_SITE: Tools
*
* Merge up to 10 MCPL input files regardless of origin/header info
*
* %D
* 
* Example: Merge two input files
* mcrun MCPL_merge f0=my1.mcpl.gz f1=my2.mcpl.gz fout=output
*
* %P
* fout:       [str] Output mcpl filename
* f0:         [str] 1st mcpl input filename
* f1:         [str] 2nd mcpl input filename
* f2:         [str] 3rd mcpl input filename
* f3:         [str] 4th mcpl input filename
* f4:         [str] 5th mcpl input filename
* f5:         [str] 6th mcpl input filename
* f6:         [str] 7th mcpl input filename
* f7:         [str] 8th mcpl input filename
* f8:         [str] 9th mcpl input filename
* f9:         [str] 10th mcpl input filename
*
* %L
* <reference/HTML link>
* MCPL website at <a href="https://mctools.github.io/mcpl/">https://mctools.github.io/mcpl/</a>
* %E
*******************************************************************************/
DEFINE INSTRUMENT MCPL_merge(string fout="output", string f0="NULL", string f1="NULL", string f2="NULL", string f3="NULL", string f4="NULL", string f5="NULL", string f6="NULL", string f7="NULL", string f8="NULL", string f9="NULL")

DECLARE
%{
  long long unsigned int ncount_set;
%}

INITIALIZE
%{
  ncount_set=0;
%}

TRACE

COMPONENT Origin = Progress_bar()
AT (0, 0, 0) ABSOLUTE
EXTEND %{
  if (!ncount_set) {
    if (strcmp(MC_GETPAR(MCPLinput0,filename),"NULL")) ncount_set+= mcpl_hdr_nparticles(MC_GETPAR(MCPLinput0,inputfile));
    if (strcmp(MC_GETPAR(MCPLinput1,filename),"NULL")) ncount_set+= mcpl_hdr_nparticles(MC_GETPAR(MCPLinput0,inputfile));
    if (strcmp(MC_GETPAR(MCPLinput2,filename),"NULL")) ncount_set+= mcpl_hdr_nparticles(MC_GETPAR(MCPLinput0,inputfile));
    if (strcmp(MC_GETPAR(MCPLinput3,filename),"NULL")) ncount_set+= mcpl_hdr_nparticles(MC_GETPAR(MCPLinput0,inputfile));
    if (strcmp(MC_GETPAR(MCPLinput4,filename),"NULL")) ncount_set+= mcpl_hdr_nparticles(MC_GETPAR(MCPLinput0,inputfile));
    if (strcmp(MC_GETPAR(MCPLinput5,filename),"NULL")) ncount_set+= mcpl_hdr_nparticles(MC_GETPAR(MCPLinput0,inputfile));
    if (strcmp(MC_GETPAR(MCPLinput6,filename),"NULL")) ncount_set+= mcpl_hdr_nparticles(MC_GETPAR(MCPLinput0,inputfile));
    if (strcmp(MC_GETPAR(MCPLinput7,filename),"NULL")) ncount_set+= mcpl_hdr_nparticles(MC_GETPAR(MCPLinput0,inputfile));
    if (strcmp(MC_GETPAR(MCPLinput8,filename),"NULL")) ncount_set+= mcpl_hdr_nparticles(MC_GETPAR(MCPLinput0,inputfile));
    if (strcmp(MC_GETPAR(MCPLinput9,filename),"NULL")) ncount_set+= mcpl_hdr_nparticles(MC_GETPAR(MCPLinput0,inputfile));
    printf("\n\n ** NOTA BENE: Estimated maximal neutron count is %g **\n\n",(double)ncount_set);
  }
  mcset_ncount(ncount_set);
%}

/* read neutrons from an mcpl file*/

COMPONENT MCPLinput0 = MCPL_input(filename=f0,verbose=1)
AT(0,0,0) RELATIVE PREVIOUS
GROUP sources

COMPONENT MCPLinput1 = COPY(MCPLinput0)(filename=f1)
AT(0,0,0) RELATIVE PREVIOUS
GROUP sources

COMPONENT MCPLinput2 = COPY(MCPLinput0)(filename=f2)
AT(0,0,0) RELATIVE PREVIOUS
GROUP sources

COMPONENT MCPLinput3 = COPY(MCPLinput0)(filename=f3)
AT(0,0,0) RELATIVE PREVIOUS
GROUP sources

COMPONENT MCPLinput4 = COPY(MCPLinput0)(filename=f4)
AT(0,0,0) RELATIVE PREVIOUS
GROUP sources

COMPONENT MCPLinput5 = COPY(MCPLinput0)(filename=f5)
AT(0,0,0) RELATIVE PREVIOUS
GROUP sources

COMPONENT MCPLinput6 = COPY(MCPLinput0)(filename=f6)
AT(0,0,0) RELATIVE PREVIOUS
GROUP sources

COMPONENT MCPLinput7 = COPY(MCPLinput0)(filename=f7)
AT(0,0,0) RELATIVE PREVIOUS
GROUP sources

COMPONENT MCPLinput8 = COPY(MCPLinput0)(filename=f8)
AT(0,0,0) RELATIVE PREVIOUS
GROUP sources

COMPONENT MCPLinput9 = COPY(MCPLinput0)(filename=f9)
AT(0,0,0) RELATIVE PREVIOUS
GROUP sources

COMPONENT Calc = Arm()
AT(0,0,0) RELATIVE PREVIOUS
GROUP sources
EXTEND %{
  SCATTER;
  printf("Reached last particle!\n");
  mcset_ncount(mcget_run_num());
%}
  
COMPONENT MCPLoutput = MCPL_output(filename=fout)
AT (0,0,0) RELATIVE PREVIOUS
  
FINALLY
%{
%}

END