Skip to content

Commit d81a002

Browse files
authored
Merge pull request #1841 from McStasMcXtrace/dmsc-school-qens-patches
Union-related fixes and imports from DMSC school issue
2 parents cee98ea + dc0d6ee commit d81a002

File tree

3 files changed

+538
-11
lines changed

3 files changed

+538
-11
lines changed

mcstas-comps/share/union-lib.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,7 @@ union abs_logger_data_union{
220220
struct a_event_abs_storage_struct *p_event_abs_storage;
221221
struct a_1D_event_abs_storage_struct *p_1D_event_abs_storage;
222222
struct a_nD_abs_storage_struct *p_nD_abs_storage;
223+
struct a_time_abs_storage_struct *p_time_abs_storage;
223224
// Additional logger storage structs to be addedd
224225
};
225226

mcstas-comps/union/Union_abs_logger_1D_space_event.comp

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -329,11 +329,11 @@ void write_temp_to_perm_abs_1D_event(union abs_logger_data_union *data_union) {
329329
storage = data_union->p_1D_event_abs_storage;
330330

331331
int index;
332-
// Add all data points to the historgram, they are saved as index / weight combinations
332+
// Add all data points to the histogram, they are saved as index / weight combinations
333333
for (index=0;index<storage->temp_abs_1D_event_data.num_elements;index++) {
334334

335335
_class_particle _localparticle;
336-
336+
337337
_localparticle.x = storage->temp_abs_1D_event_data.elements[index].x_pos;
338338
_localparticle.y = storage->temp_abs_1D_event_data.elements[index].y_pos;
339339
_localparticle.z = storage->temp_abs_1D_event_data.elements[index].z_pos;
@@ -362,11 +362,11 @@ void write_temp_to_perm_final_p_abs_1D_event(union abs_logger_data_union *data_u
362362
storage = data_union->p_1D_event_abs_storage;
363363

364364
int index;
365-
// Add all data points to the historgram, they are saved as index / weight combinations
365+
// Add all data points to the histogram, they are saved as index / weight combinations
366366
for (index=0;index<storage->temp_abs_1D_event_data.num_elements;index++) {
367-
367+
368368
_class_particle _localparticle;
369-
369+
370370
_localparticle.x = storage->temp_abs_1D_event_data.elements[index].x_pos;
371371
_localparticle.y = storage->temp_abs_1D_event_data.elements[index].y_pos;
372372
_localparticle.z = storage->temp_abs_1D_event_data.elements[index].z_pos;
@@ -391,9 +391,9 @@ void write_temp_to_perm_final_p_abs_1D_event(union abs_logger_data_union *data_u
391391
// Only need to define linking function for loggers once.
392392
#ifndef UNION_ABS_LOGGER
393393
#define UNION_ABS_LOGGER Dummy
394-
// Linking function for loggers, finds the indicies of the specified geometries on the global_geometry_list
394+
// Linking function for loggers, finds the indices of the specified geometries on the global_geometry_list
395395
void manual_linking_function_abs_logger_volumes(char *input_string, struct pointer_to_global_geometry_list *global_geometry_list, struct pointer_to_1d_int_list *accepted_volumes, char *component_name) {
396-
// Need to check a input_string of text for an occurance of name. If it is in the inputstring, yes return 1, otherwise 0.
396+
// Need to check a input_string of text for an occurrence of name. If it is in the inputstring, yes return 1, otherwise 0.
397397
char *token;
398398
int loop_index;
399399
char local_string[512];
@@ -529,7 +529,7 @@ exit(-1);
529529
// Adding fake event to combat MPI writing bug
530530
if (fake_event) {
531531
_class_particle _localparticle;
532-
532+
533533
_localparticle.x = 0.0;
534534
_localparticle.y = 0.0;
535535
_localparticle.z = -1.0;
@@ -573,11 +573,11 @@ exit(-1);
573573
struct pointer_to_global_geometry_list *global_geometry_list = COMP_GETPAR3(Union_init, init, global_geometry_list);
574574
struct pointer_to_global_abs_logger_list *global_specific_volumes_abs_logger_list = COMP_GETPAR3(Union_init, init, global_specific_volumes_abs_logger_list);
575575
// In order to run the logger at the right times, pointers to this logger is stored in each volume it logs,
576-
// and additionally for each avaiable process. If a process is not logged, the pointer is simply not stored.
576+
// and additionally for each available process. If a process is not logged, the pointer is simply not stored.
577577
int process_index;
578578
// Need to find the volumes for which the processes should have a reference to this logger
579579
if (target_geometry && strlen(target_geometry) && strcmp(target_geometry,"NULL") && strcmp(target_geometry, "0")) {
580-
// Certain volumes were selected, find the indicies in the global_geometry_list
580+
// Certain volumes were selected, find the indices in the global_geometry_list
581581
manual_linking_function_abs_logger_volumes(target_geometry, global_geometry_list, &accepted_volumes, NAME_CURRENT_COMP);
582582
// Add this logger to the global_specific_volumes_logger_list (so that conditionals can affect it)
583583
add_element_to_abs_logger_list(global_specific_volumes_abs_logger_list, abs_logger_list_element);
@@ -637,4 +637,3 @@ MCDISPLAY
637637
%}
638638

639639
END
640-

0 commit comments

Comments
 (0)