File indexing completed on 2026-04-18 07:41:08
0001 #ifndef IAEA_HEADER
0002 #define IAEA_HEADER
0003
0004
0005 #include "iaea_record.h"
0006
0007
0008 #define SEGMENT_BEG_TOKEN '$'
0009 #define SEGMENT_END_TOKEN ':'
0010 #ifndef MAX_STR_LEN
0011 #define MAX_STR_LEN 512
0012 #endif
0013 #define MAX_NUMB_LINES 30
0014
0015 #define MAX_NUMB_EXTRALONG_TYPES 7
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028 #define MAX_NUMB_EXTRAFLOAT_TYPES 3
0029
0030
0031
0032
0033
0034
0035
0036 struct iaea_header_type
0037 {
0038 FILE *fheader;
0039
0040
0041
0042 int file_type;
0043 int byte_order;
0044 int record_contents[9];
0045
0046
0047
0048
0049 float record_constant[7];
0050
0051
0052
0053
0054
0055 int extrafloat_contents[NUM_EXTRA_FLOAT];
0056
0057
0058 int extralong_contents[NUM_EXTRA_LONG];
0059
0060 int record_length;
0061
0062
0063
0064
0065
0066
0067
0068 IAEA_I64 checksum;
0069
0070
0071
0072
0073 char coordinate_system_description[MAX_STR_LEN*MAX_NUMB_LINES+1];
0074
0075
0076 IAEA_I64 orig_histories;
0077 IAEA_I64 nParticles;
0078 IAEA_I64 particle_number[MAX_NUM_PARTICLES];
0079
0080
0081 char input_file_for_event_generator[MAX_STR_LEN*MAX_NUMB_LINES+1];
0082
0083
0084
0085
0086 unsigned int iaea_index;
0087 char title[MAX_STR_LEN*MAX_NUMB_LINES+1];
0088
0089 char machine_type[MAX_STR_LEN*MAX_NUMB_LINES+1];
0090
0091 char MC_code_and_version[MAX_STR_LEN*MAX_NUMB_LINES+1];
0092
0093 float global_photon_energy_cutoff;
0094
0095 float global_particle_energy_cutoff;
0096
0097 char transport_parameters[MAX_STR_LEN*MAX_NUMB_LINES+1];
0098
0099
0100
0101
0102 char beam_name[MAX_STR_LEN*MAX_NUMB_LINES+1];
0103
0104 char field_size[MAX_STR_LEN*MAX_NUMB_LINES+1];
0105
0106 char nominal_SSD[MAX_STR_LEN*MAX_NUMB_LINES+1];
0107
0108 char variance_reduction_techniques[MAX_STR_LEN*MAX_NUMB_LINES+1];
0109
0110 char initial_source_description[MAX_STR_LEN*MAX_NUMB_LINES+1];
0111
0112
0113 char MC_input_filename[MAX_STR_LEN*MAX_NUMB_LINES+1];
0114
0115
0116 char published_reference[MAX_STR_LEN*MAX_NUMB_LINES+1];
0117 char authors[MAX_STR_LEN*MAX_NUMB_LINES+1];
0118
0119 char institution[MAX_STR_LEN*MAX_NUMB_LINES+1];
0120
0121 char link_validation[MAX_STR_LEN*MAX_NUMB_LINES+1];
0122
0123 char additional_notes[MAX_STR_LEN*MAX_NUMB_LINES+1];
0124
0125
0126
0127 double averageKineticEnergy[MAX_NUM_PARTICLES];
0128 double sumParticleWeight[MAX_NUM_PARTICLES];
0129 double maximumKineticEnergy[MAX_NUM_PARTICLES];
0130 double minimumKineticEnergy[MAX_NUM_PARTICLES];
0131 double minimumX, maximumX;
0132 double minimumY, maximumY;
0133 double minimumZ, maximumZ;
0134 double minimumWeight[MAX_NUM_PARTICLES];
0135 double maximumWeight[MAX_NUM_PARTICLES];
0136
0137 IAEA_I64 read_indep_histories;
0138
0139
0140
0141 public:
0142 int read_header();
0143 int write_header();
0144 int print_header();
0145 int set_record_contents(iaea_record_type *p_iaea_record);
0146 int get_record_contents(iaea_record_type *p_iaea_record);
0147 void initialize_counters();
0148 void update_counters(iaea_record_type *p_iaea_record);
0149
0150 private:
0151 int read_block(char *lineread, const char *blockname);
0152 int get_block(char *lineread);
0153 int get_blockname(char *line, const char *blockname);
0154 int write_blockname(const char *blockname);
0155
0156 int check_byte_order();
0157 void print_statistics();
0158 };
0159
0160 #endif