File: Union_init.comp

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 (155 lines) | stat: -rwxr-xr-x 4,901 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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
/*******************************************************************************
*
*  McStas, neutron ray-tracing package
*  Copyright(C) 2007 Risoe National Laboratory.
*
* %I
* Written by: Mads Bertelsen
* Date: 20.08.15
* Version: $Revision: 0.1 $
* Origin: ESS DMSC
*
* Initialize component that needs to be place before any Union component
*
* %D
* Part of the Union components, a set of components that work together and thus
*  sperates geometry and physics within McStas.
* The use of this component requires other components to be used.
*
* 1) One specifies a number of processes using process components
* 2) These are gathered into material definitions using this component
* 3) Geometries are placed using Union_box/cylinder/sphere, assigned a material
* 4) A Union_master component placed after all of the above
*
* Only in step 4 will any simulation happen, and per default all geometries
*  defined before the master, but after the previous will be simulated here.
*
* There is a dedicated manual available for the Union_components
*
* Algorithm:
* Described elsewhere
*
* %P
* INPUT PARAMETERS:
*
* CALCULATED PARAMETERS:
*
* GLOBAL PARAMETERS:
* global_material_list:     List of all defined materials, available in the global scope
*
* %L
*
* %E
******************************************************************************/

DEFINE COMPONENT Union_init

SETTING PARAMETERS()



/* Neutron parameters: (x,y,z,vx,vy,vz,t,sx,sy,sz,p) */

SHARE
%{

#ifdef Union
#error "The Union_init component needs to be the first Union component!"
//printf("ERROR: The Union_init component needs to be the first Union component!\n");
//exit(1);
#else
#define Union $Revision: 0.8 $
%include "union-lib.c"
#endif
%}

DECLARE
%{
// Initialize global positions / rotations to transform lists
  // These are lists of pointers to positons / rotations, that will be updated from global frame
  //  to the frame of the master component that uses them in that masters initialize section.
  struct global_positions_to_transform_list_struct global_positions_to_transform_list;
  struct global_rotations_to_transform_list_struct global_rotations_to_transform_list;

// Initialize global_process_list
  // Used to facilitate communication between processes and the other types of Union components
  struct pointer_to_global_process_list global_process_list;

// Initialize global_material_list
  // Used to facilitate communication between materials and the other types of Union components
  struct pointer_to_global_material_list global_material_list;

// Initialize global_geometry_list
  // Used to facilitate communication between geometries and the other types of Union components
  struct pointer_to_global_geometry_list global_geometry_list;

// Initialize global_logger_lists
  // Used to facilitate communication between loggers and the other types of Union components
  struct pointer_to_global_logger_list global_all_volume_logger_list;
  struct pointer_to_global_logger_list global_specific_volumes_logger_list;

// Initialize global_abs_logger_lists
  struct pointer_to_global_abs_logger_list global_all_volume_abs_logger_list;
  struct pointer_to_global_abs_logger_list global_specific_volumes_abs_logger_list;

// Initialize global_tagging_conditional_list
  // Used to facilitate communication between conditionals and the other types of Union components
  struct global_tagging_conditional_list_struct global_tagging_conditional_list;

// Initialize global_master_list
  // Used to facilitate communication between Master components (mainly for deallocation)
  struct pointer_to_global_master_list global_master_list;

// Initialize global_mantid_min_pixel_id
  // Used for ensuring pixel id's on Mantid monitors do not overlap
  int global_mantid_min_pixel_id;
%}

INITIALIZE
%{
global_positions_to_transform_list.num_elements = 0;
global_positions_to_transform_list.positions = NULL;

global_rotations_to_transform_list.num_elements = 0;
global_rotations_to_transform_list.rotations = NULL;

global_process_list.num_elements = 0;
global_process_list.elements = NULL;

global_material_list.num_elements = 0;
global_material_list.elements = NULL;

global_geometry_list.num_elements = 0;
global_geometry_list.elements = NULL;

global_all_volume_logger_list.num_elements = 0;
global_all_volume_logger_list.elements = NULL;

global_specific_volumes_logger_list.num_elements = 0;
global_specific_volumes_logger_list.elements = NULL;

global_all_volume_abs_logger_list.num_elements = 0;
global_all_volume_abs_logger_list.elements = NULL;

global_specific_volumes_abs_logger_list.num_elements = 0;
global_specific_volumes_abs_logger_list.elements = NULL;

global_tagging_conditional_list.num_elements = 0;
global_tagging_conditional_list.elements = NULL;

global_master_list.num_elements = 0;
global_master_list.elements = NULL;

global_mantid_min_pixel_id = 0;
%}

TRACE
%{
%}

FINALLY
%{
%}

END