Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3,844 changes: 3,844 additions & 0 deletions mcxtrace-comps/share/Geometry_functions.c

Large diffs are not rendered by default.

4,574 changes: 4,574 additions & 0 deletions mcxtrace-comps/share/Union_functions.c

Large diffs are not rendered by default.

70 changes: 70 additions & 0 deletions mcxtrace-comps/share/Union_initialization.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
/*******************************************************************************
*
* McXtrace, photon ray-tracing package
* Copyright(C) 2007 Risoe National Laboratory.
*
* %I
* Written by: Mads Bertelsen
* Date: 20.08.15
* Version: $Revision: 0.1 $
* Origin: Svanevej 19
*
* A sample component to separate geometry and phsysics
*
* %D
* Alpha version, no input system yet
* Hardcode input to geometry engine
* Allows complicated geometry by combination of simple shapes
*
* Algorithm:
* Described elsewhere
*
* %P
* INPUT PARAMETERS:
* radius: [m] Outer radius of sample in (x,z) plane
*
* OUTPUT PARAMETERS:
* V_rho: [AA^-3] Atomic density
*
* %L
* The test/example instrument <a href="../examples/Test_Phonon.instr">Test_Phonon.instr</a>.
*
* %E
******************************************************************************/


// This file sets up global lists needed for Union components to communicate with each other
// These all have dynamically allocated memory somewhere in the structure, which is deallocated
// by the last Union_master.


// 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 = {0,NULL};
struct global_rotations_to_transform_list_struct global_rotations_to_transform_list = {0,NULL};

// 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 = {0,NULL};

// 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 = {0,NULL};

// 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 = {0,NULL};

// 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 = {0,NULL};
struct pointer_to_global_logger_list global_specific_volumes_logger_list = {0,NULL};

// 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 = {0,0,NULL};

// Initialize global_master_list
// Used to facilitate communication between Master components (mainly for deallocation)
struct pointer_to_global_master_list global_master_list = {0,NULL};
113 changes: 113 additions & 0 deletions mcxtrace-comps/share/Union_last_functions.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
/*
TODO

update Union master to use the flexible functions

deal with loggers and conditionals
*/

int physics_my(enum process choice, double *my,double *k_initial, union data_transfer_union data_transfer, struct focus_data_struct *focus_data, _class_particle *_particle) {

int output = 0; // Error return value
#ifdef PROCESS_DETECTOR
switch(choice) {
#ifdef PROCESS_INCOHERENT_DETECTOR
case Incoherent:
output = Incoherent_physics_my(my, k_initial, data_transfer, focus_data, _particle);
break;
#endif
#ifdef PROCESS_COMPTON_XRL_DETECTOR
case Compton_xrl:
output = Compton_xrl_physics_my(my, k_initial, data_transfer, focus_data, _particle);
break;
#endif
#ifdef PROCESS_KN_XRL_DETECTOR
case KN_xrl:
output = KN_xrl_physics_my(my, k_initial, data_transfer, focus_data, _particle);
break;
#endif
#ifdef PROCESS_RAYLEIGH_XRL_DETECTOR
case Rayleigh_xrl:
output = Rayleigh_xrl_physics_my(my, k_initial, data_transfer, focus_data, _particle);
break;
#endif
#ifdef PROCESS_POWDER_DETECTOR
case Powder:
output = Powder_physics_my(my, k_initial, data_transfer, focus_data, _particle);
break;
#endif
#ifdef PROCESS_SINGLE_CRYSTAL_DETECTOR
case Single_crystal:
output = Single_crystal_physics_my(my, k_initial, data_transfer, focus_data, _particle);
break;
#endif
#ifdef PROCESS_NCRYSTAL_DETECTOR
case NCrystal:
output = NCrystal_physics_my(my, k_initial, data_transfer, focus_data, _particle);
break;
#endif
#ifdef PROCESS_TEMPLATE_DETECTOR
case Template:
output = Template_physics_my(my, k_initial, data_transfer, focus_data, _particle);
break;
#endif
default:
printf("physics_my: No scattering process matches input!\n");
break;
}
#endif
return output;
}


int physics_scattering(enum process choice, double *k_final, double *k_initial, double *weight, union data_transfer_union data_transfer, struct focus_data_struct *focus_data, _class_particle *_particle) {

int output = 0; // Error return value
#ifdef PROCESS_DETECTOR
switch(choice) {
#ifdef PROCESS_INCOHERENT_DETECTOR
case Incoherent:
output = Incoherent_physics_scattering(k_final, k_initial, weight, data_transfer, focus_data, _particle);
break;
#endif
#ifdef PROCESS_COMPTON_XRL_DETECTOR
case Compton_xrl:
output = Compton_xrl_physics_scattering(k_final, k_initial, weight, data_transfer, focus_data, _particle);
break;
#endif
#ifdef PROCESS_KN_XRL_DETECTOR
case KN_xrl:
output = KN_xrl_physics_scattering(k_final, k_initial, weight, data_transfer, focus_data, _particle);
break;
#endif
#ifdef PROCESS_RAYLEIGH_XRL_DETECTOR
case Rayleigh_xrl:
output = Rayleigh_xrl_physics_scattering(k_final, k_initial, weight, data_transfer, focus_data, _particle);
break;
#endif
#ifdef PROCESS_POWDER_DETECTOR
case Powder:
output = Powder_physics_scattering(k_final, k_initial, weight, data_transfer, focus_data, _particle);
break;
#endif
#ifdef PROCESS_SINGLE_CRYSTAL_DETECTOR
case Single_crystal:
output = Single_crystal_physics_scattering(k_final, k_initial, weight, data_transfer, focus_data, _particle);
break;
#endif
#ifdef PROCESS_NCRYSTAL_DETECTOR
case NCrystal:
output = NCrystal_physics_scattering(k_final, k_initial, weight, data_transfer, focus_data, _particle);
break;
#endif
#ifdef PROCESS_TEMPLATE_DETECTOR
case Template:
output = Incoherent_physics_scattering(k_final, k_initial, weight, data_transfer, focus_data, _particle);
break;
#endif
default: printf("physics_scattering: No scattering process matches input!\n");
break;
}
#endif
return output;
}
Loading