Geant4 Cross Reference |
1 /* 2 # <<BEGIN-copyright>> 3 # <<END-copyright>> 4 */ 5 6 #ifndef xDataTOM_h_included 7 #define xDataTOM_h_included 8 9 #include <statusMessageReporting.h> 10 11 #if defined __cplusplus 12 extern "C" { 13 namespace GIDI { 14 #endif 15 16 typedef int xDataTOM_Int; 17 18 /* Note: xDataTOM_interpolationFlag_flat must be last for current logic in xDataTOM_interpolation.c to work. */ 19 enum xDataTOM_interpolationFlag { xDataTOM_interpolationFlag_invalid, xDataTOM_interpolationFlag_linear, xDataTOM_interpolationFlag_log, 20 xDataTOM_interpolationFlag_byRegion, xDataTOM_interpolationFlag_flat }; 21 enum xDataTOM_interpolationQualifier { xDataTOM_interpolationQualifier_invalid, xDataTOM_interpolationQualifier_dependent, 22 xDataTOM_interpolationQualifier_none, xDataTOM_interpolationQualifier_unitBase, xDataTOM_interpolationQualifier_correspondingPoints }; 23 enum xDataTOM_frame { xDataTOM_frame_invalid, xDataTOM_frame_lab, xDataTOM_frame_centerOfMass }; 24 enum xDataTOM_subAxesType { xDataTOM_subAxesType_proxy, xDataTOM_subAxesType_intepolationAxes }; 25 enum xDataTOM_KalbachMannType { xDataTOM_KalbachMannType_fr, xDataTOM_KalbachMannType_fra }; 26 27 typedef struct xDataTOM_interpolation_s xDataTOM_interpolation; 28 typedef struct xDataTOM_axis_s xDataTOM_axis; 29 typedef struct xDataTOM_axes_s xDataTOM_axes; 30 typedef struct xDataTOM_subAxes_s xDataTOM_subAxes; 31 32 typedef struct xDataTOM_XYs_s xDataTOM_XYs; 33 typedef struct xDataTOM_regionsXYs_s xDataTOM_regionsXYs; 34 typedef struct xDataTOM_W_XYs_s xDataTOM_W_XYs; 35 typedef struct xDataTOM_V_W_XYs_s xDataTOM_V_W_XYs; 36 37 typedef struct xDataTOM_LegendreSeries_s xDataTOM_LegendreSeries; 38 typedef struct xDataTOM_W_XYs_LegendreSeries_s xDataTOM_W_XYs_LegendreSeries; 39 typedef struct xDataTOM_regionsW_XYs_LegendreSeries_s xDataTOM_regionsW_XYs_LegendreSeries; 40 typedef struct xDataTOM_V_W_XYs_LegendreSeries_s xDataTOM_V_W_XYs_LegendreSeries; 41 typedef struct xDataTOM_KalbachMannCoefficients_s xDataTOM_KalbachMannCoefficients; 42 typedef struct xDataTOM_KalbachMann_s xDataTOM_KalbachMann; 43 typedef struct xDataTOM_polynomial_s xDataTOM_polynomial; 44 45 typedef struct xDataTOM_xDataInfo_s xDataTOM_xDataInfo; 46 47 typedef struct xDataTOM_attribute_s xDataTOM_attribute; 48 typedef struct xDataTOM_attributionList_s xDataTOM_attributionList; 49 typedef struct xDataTOM_elementListItem_s xDataTOM_elementListItem; 50 typedef struct xDataTOM_elementList_s xDataTOM_elementList; 51 typedef struct xDataTOM_element_s xDataTOM_element; 52 typedef struct xDataTOM_TOM_s xDataTOM_TOM; 53 54 typedef int (*xDataTOM_sortElementFunc)( const void *, const void * ); 55 56 struct xDataTOM_interpolation_s { 57 enum xDataTOM_interpolationFlag independent, dependent; 58 enum xDataTOM_interpolationQualifier qualifier; 59 }; 60 61 struct xDataTOM_axis_s { 62 int index; 63 char *label; 64 char *unit; 65 xDataTOM_interpolation interpolation; 66 }; 67 68 struct xDataTOM_axes_s { 69 int numberOfAxes; 70 xDataTOM_axis *axis; 71 }; 72 73 struct xDataTOM_subAxes_s { 74 enum xDataTOM_subAxesType type; 75 int offset; 76 xDataTOM_axes *axes; 77 xDataTOM_interpolation interpolation; 78 }; 79 80 struct xDataTOM_XYs_s { 81 int index, length; 82 double value, accuracy; 83 xDataTOM_subAxes subAxes; 84 double *data; 85 }; 86 87 struct xDataTOM_regionsXYs_s { 88 int length; 89 xDataTOM_axes *axes; 90 xDataTOM_XYs *XYs; 91 }; 92 93 struct xDataTOM_W_XYs_s { 94 int index, length; 95 double value; 96 xDataTOM_subAxes subAxes; 97 xDataTOM_XYs *XYs; 98 }; 99 100 struct xDataTOM_V_W_XYs_s { 101 int length; 102 xDataTOM_subAxes subAxes; 103 xDataTOM_W_XYs *W_XYs; 104 }; 105 106 struct xDataTOM_LegendreSeries_s { 107 int index, length; 108 double value; 109 double *LegendreSeries; 110 }; 111 112 struct xDataTOM_W_XYs_LegendreSeries_s { 113 int index, length; 114 double value; 115 xDataTOM_subAxes subAxes; 116 xDataTOM_LegendreSeries *LegendreSeries; 117 }; 118 119 struct xDataTOM_regionsW_XYs_LegendreSeries_s { 120 int length; 121 xDataTOM_axes *axes; 122 xDataTOM_W_XYs_LegendreSeries *W_XYs_LegendreSeries; 123 }; 124 125 struct xDataTOM_V_W_XYs_LegendreSeries_s { 126 int length; 127 xDataTOM_subAxes subAxes; 128 xDataTOM_W_XYs_LegendreSeries *W_XYs_LegendreSeries; 129 }; 130 131 struct xDataTOM_KalbachMannCoefficients_s { 132 int index, length; 133 double value; 134 double *coefficients; 135 }; 136 137 struct xDataTOM_KalbachMann_s { 138 enum xDataTOM_KalbachMannType type; 139 int numberOfEnergies; 140 xDataTOM_subAxes subAxes; 141 xDataTOM_KalbachMannCoefficients *coefficients; 142 }; 143 144 struct xDataTOM_polynomial_s { 145 int length; 146 xDataTOM_subAxes subAxes; 147 double *coefficients; 148 }; 149 150 struct xDataTOM_xDataInfo_s { 151 const char *ID; 152 xDataTOM_element *element; 153 xDataTOM_axes axes; 154 void *data; 155 }; 156 157 struct xDataTOM_attribute_s { 158 xDataTOM_attribute *next; 159 char *name; 160 char *value; 161 }; 162 163 struct xDataTOM_attributionList_s { 164 int number; 165 xDataTOM_attribute *attributes; 166 }; 167 168 struct xDataTOM_elementListItem_s { 169 xDataTOM_element *element; 170 const char *sortString; 171 }; 172 173 struct xDataTOM_elementList_s { 174 int n; 175 xDataTOM_elementListItem *items; 176 }; 177 178 struct xDataTOM_element_s { 179 int ordinal; /* Counting from 0. */ 180 int index; /* Value from "index" attribute if present or -1. */ 181 xDataTOM_element *parent; 182 xDataTOM_element *next; 183 char *name; 184 xDataTOM_attributionList attributes; 185 int numberOfChildren; 186 xDataTOM_element *children; 187 xDataTOM_xDataInfo xDataInfo; 188 }; 189 190 struct xDataTOM_TOM_s { 191 char *fileName; 192 char *realFileName; 193 xDataTOM_element root; 194 }; 195 196 /* 197 * Stuff in common/xDataTOM.c 198 */ 199 xDataTOM_TOM *xDataTOM_importFile( statusMessageReporting *smr, const char *fileName ); 200 xDataTOM_TOM *xDataTOM_mallocTOM( statusMessageReporting *smr ); 201 int xDataTOM_initializeTOM( statusMessageReporting *smr, xDataTOM_TOM *doc ); 202 void *xDataTOM_freeTOM( statusMessageReporting *smr, xDataTOM_TOM **TOM ); 203 int xDataTOM_setFileNameTOM( statusMessageReporting *smr, xDataTOM_TOM *doc, const char *fileName ); 204 void xDataTOM_displayTree( statusMessageReporting *smr, xDataTOM_TOM *TOM, int printAttributes ); 205 206 xDataTOM_element *xDataTOM_mallocElement( statusMessageReporting *smr, xDataTOM_element *parent, int ordinal, int index, char const *name ); 207 void xDataTOM_freeElement( xDataTOM_element **element ); 208 void xDataTOM_releaseElement( xDataTOM_element *element ); 209 xDataTOM_element *xDataTOM_addElementInElement( statusMessageReporting *smr, xDataTOM_element *parent, int index, char const *name ); 210 xDataTOM_element *xDataTOM_getDocumentsElement( xDataTOM_TOM *TOM ); 211 xDataTOM_element *xDataTOME_getFirstElement( xDataTOM_element *element ); 212 xDataTOM_element *xDataTOME_getNextElement( xDataTOM_element *element ); 213 xDataTOM_element *xDataTOME_getOneElementByName( statusMessageReporting *smr, xDataTOM_element *element, char const *name, int required ); 214 int xDataTOM_numberOfElementsByName( statusMessageReporting *smr, xDataTOM_element *element, char const *name ); 215 int xDataTOME_addAttribute( statusMessageReporting *smr, xDataTOM_element *element, char const *name, char const *value ); 216 char const *xDataTOM_getAttributesValueInElement( xDataTOM_element *element, char const *name ); 217 int xDataTOME_copyAttributionList( statusMessageReporting *smr, xDataTOM_attributionList *desc, xDataTOM_element *element ); 218 int xDataTOME_convertAttributeToInteger( statusMessageReporting *smr, xDataTOM_element *element, char const *name, int *n ); 219 int xDataTOME_convertAttributeToDouble( statusMessageReporting *smr, xDataTOM_element *element, char const *name, double *d ); 220 int xDataTOME_convertAttributeToDoubleWithUnit( statusMessageReporting *smr, xDataTOM_element *element, char const *name, double *d, char *unit ); 221 int xDataTOME_getInterpolation( statusMessageReporting *smr, xDataTOM_element *element, int index, 222 enum xDataTOM_interpolationFlag *independent, enum xDataTOM_interpolationFlag *dependent, enum xDataTOM_interpolationQualifier *qualifier ); 223 224 void xDataTOMAL_initial( statusMessageReporting *smr, xDataTOM_attributionList *attributes ); 225 void xDataTOMAL_release( xDataTOM_attributionList *attributes ); 226 int xDataTOMAL_addAttribute( statusMessageReporting *smr, xDataTOM_attributionList *attributes, char const *name, char const *value ); 227 char const *xDataTOMAL_getAttributesValue( xDataTOM_attributionList *attributes, char const *name ); 228 int xDataTOMAL_copyAttributionList( statusMessageReporting *smr, xDataTOM_attributionList *desc, xDataTOM_attributionList *src ); 229 int xDataTOMAL_convertAttributeToInteger( statusMessageReporting *smr, xDataTOM_attributionList *attributes, char const *name, int *n ); 230 int xDataTOMAL_convertAttributeToDouble( statusMessageReporting *smr, xDataTOM_attributionList *attributes, char const *name, double *d ); 231 232 void *xData_initializeData( statusMessageReporting *smr, xDataTOM_element *TE, char const *ID, size_t size ); 233 int xDataTOM_isXDataID( xDataTOM_element *TE, char const *ID ); 234 235 /* 236 * Stuff in common/xDataTOMMisc.c 237 */ 238 char *xDataTOMMisc_getAbsPath( statusMessageReporting *smr, const char *fileName ); 239 int xDataTOM_setMessageError_ReturnInt( int value, statusMessageReporting *smr, void *userData, const char *file, int line, int code, const char *fmt, ... ); 240 xDataTOM_element *xDataTOM_getLinksElement( statusMessageReporting *smr, xDataTOM_element *element, char const *link ); 241 242 #define xDataTOMMisc_allocateCopyString2( smr, s, forItem ) xDataTOMMisc_allocateCopyString( smr, s, forItem, __FILE__, __LINE__ ) 243 244 /* 245 * Stuff in common/xDataTOM_interpolation.c 246 */ 247 int xDataTOM_interpolation_set( statusMessageReporting *smr, xDataTOM_interpolation *interpolation, enum xDataTOM_interpolationFlag independent, 248 enum xDataTOM_interpolationFlag dependent, enum xDataTOM_interpolationQualifier qualifier ); 249 int xDataTOM_interpolation_setFromString( statusMessageReporting *smr, xDataTOM_interpolation *interpolation, char const *str ); 250 int xDataTOM_interpolation_copy( statusMessageReporting *smr, xDataTOM_interpolation *desc, xDataTOM_interpolation *src ); 251 252 /* 253 * Stuff in common/xDataTOM_axes.c 254 */ 255 int xDataTOM_axes_initialize( statusMessageReporting *smr, xDataTOM_axes *axes, int numberOfAxes ); 256 int xDataTOM_axes_release( xDataTOM_axes *axes ); 257 char const *xDataTOM_axes_getLabel( statusMessageReporting *smr, xDataTOM_axes *axes, int index ); 258 char const *xDataTOM_axes_getUnit( statusMessageReporting *smr, xDataTOM_axes *axes, int index ); 259 int xDataTOM_axes_getInterpolation( statusMessageReporting *smr, xDataTOM_axes *axes, int index, enum xDataTOM_interpolationFlag *independent, 260 enum xDataTOM_interpolationFlag *dependent, enum xDataTOM_interpolationQualifier *qualifier ); 261 262 int xDataTOM_subAxes_initialize( statusMessageReporting *smr, xDataTOM_subAxes *subAxes, enum xDataTOM_subAxesType type, int offset, 263 xDataTOM_axes *axes, xDataTOM_interpolation *interpolation ); 264 int xDataTOM_subAxes_release( xDataTOM_subAxes *subAxes ); 265 char const *xDataTOM_subAxes_getLabel( statusMessageReporting *smr, xDataTOM_subAxes *subAxes, int index ); 266 char const *xDataTOM_subAxes_getUnit( statusMessageReporting *smr, xDataTOM_subAxes *subAxes, int index ); 267 268 xDataTOM_axis *xDataTOM_axis_new( statusMessageReporting *smr, int index, char const *label, char const *unit, xDataTOM_interpolation *interpolation ); 269 int xDataTOM_axis_initialize( statusMessageReporting *smr, xDataTOM_axis *axis, int index, char const *label, char const *unit, 270 xDataTOM_interpolation *interpolation ); 271 xDataTOM_axis *xDataTOM_axis_release( statusMessageReporting *smr, xDataTOM_axis *axis ); 272 enum xDataTOM_frame xDataTOM_axis_stringToFrame( statusMessageReporting *smr, char const *frame ); 273 char const *xDataTOM_axis_frameToString( statusMessageReporting *smr, enum xDataTOM_frame frame ); 274 275 /* 276 * Stuff in common/xDataTOM_XYs.c 277 */ 278 int xDataTOM_XYs_free( xDataTOM_xDataInfo *xDI ); 279 int xDataTOM_XYs_release( xDataTOM_XYs *XYs ); 280 int xDataTOM_XYs_getData( xDataTOM_XYs *XYs, double **data ); 281 int xDataTOM_XYs_getDataFromXDataInfo( xDataTOM_xDataInfo *xDI, double **data ); 282 283 /* 284 * Stuff in common/xDataTOM_regionsXYs.c 285 */ 286 int xDataTOM_regionsXYs_free( xDataTOM_xDataInfo *xDI ); 287 288 /* 289 * Stuff in common/xDataTOM_W_XYs.c 290 */ 291 xDataTOM_W_XYs *xDataTOM_W_XYs_new( statusMessageReporting *smr, int index, int length, double value, xDataTOM_axes *axes, int axesOffset ); 292 int xDataTOM_W_XYs_initialize( statusMessageReporting *smr, xDataTOM_W_XYs *W_XYs, int index, int length, double value, xDataTOM_axes *axes, 293 int axesOffset ); 294 xDataTOM_W_XYs *xDataTOM_W_XYs_free( xDataTOM_W_XYs *W_XYs ); 295 int xDataTOM_W_XYs_freeFrom_xDataInfo( xDataTOM_xDataInfo *xDI ); 296 int xDataTOM_W_XYs_release( xDataTOM_W_XYs *W_XYs ); 297 xDataTOM_xDataInfo *xDataTOME_getXData( xDataTOM_element *TE ); 298 void *xDataTOME_getXDataIfID( statusMessageReporting *smr, xDataTOM_element *TE, char const *ID ); 299 300 /* 301 * Stuff in common/xDataTOM_V_W_XYs.c 302 */ 303 int xDataTOM_V_W_XYs_initialize( statusMessageReporting *smr, xDataTOM_V_W_XYs *V_W_XYs, int length, xDataTOM_axes *axes ); 304 int xDataTOM_V_W_XYs_free( xDataTOM_xDataInfo *xDI ); 305 306 /* 307 * Stuff in common/xDataTOM_LegendreSeries.c 308 */ 309 int xDataTOM_LegendreSeries_initialize( statusMessageReporting *smr, xDataTOM_LegendreSeries *LegendreSeries, int index, int length, double value ); 310 int xDataTOM_LegendreSeries_release( xDataTOM_LegendreSeries *LegendreSeries ); 311 312 /* 313 * Stuff in common/xDataTOM_W_XYs_LegendreSeries.c 314 */ 315 int xDataTOM_W_XYs_LegendreSeries_initialize( statusMessageReporting *smr, xDataTOM_W_XYs_LegendreSeries *W_XYs_LegendreSeries, int index, 316 int length, double value, enum xDataTOM_subAxesType subAxesType, xDataTOM_axes *axes, xDataTOM_interpolation *interpolation ); 317 int xDataTOM_W_XYs_LegendreSeries_free( xDataTOM_xDataInfo *xDI ); 318 int xDataTOM_W_XYs_LegendreSeries_release( xDataTOM_W_XYs_LegendreSeries *W_XYs_LegendreSeries ); 319 320 /* 321 * Stuff in common/xDataTOM_regionsW_XYs_LegendreSeries.c 322 */ 323 int xDataTOM_regionsW_XYs_LegendreSeries_initialize( statusMessageReporting *smr, xDataTOM_regionsW_XYs_LegendreSeries *regionsW_XYs_LegendreSeries, 324 int length, xDataTOM_axes *axes ); 325 int xDataTOM_regionsW_XYs_LegendreSeries_free( xDataTOM_xDataInfo *xDI ); 326 int xDataTOM_regionsW_XYs_LegendreSeries_release( xDataTOM_regionsW_XYs_LegendreSeries *regionsW_XYs_LegendreSeries ); 327 328 /* 329 * Stuff in common/xDataTOM_V_W_XYs_LegendreSeries.c 330 */ 331 int xDataTOM_V_W_XYs_LegendreSeries_initialize( statusMessageReporting *smr, xDataTOM_V_W_XYs_LegendreSeries *V_W_XYs_LegendreSeries, 332 int length, xDataTOM_axes *axes ); 333 int xDataTOM_V_W_XYs_LegendreSeries_free( xDataTOM_xDataInfo *xDI ); 334 335 /* 336 * Stuff in common/xDataTOM_KalbachMann.c 337 */ 338 int xDataTOM_KalbachMann_initialize( statusMessageReporting *smr, xDataTOM_KalbachMann *KalbachMann, int length, xDataTOM_axes *axes ); 339 int xDataTOM_KalbachMann_free( xDataTOM_xDataInfo *xDI ); 340 int xDataTOM_KalbachMann_release( xDataTOM_KalbachMann *KalbachMann ); 341 342 /* 343 * Stuff in common/xDataTOM_polynomial.c 344 */ 345 int xDataTOM_polynomial_initialize( statusMessageReporting *smr, xDataTOM_polynomial *polynomial, int length, xDataTOM_axes *axes ); 346 int xDataTOM_polynomial_free( xDataTOM_xDataInfo *xDI ); 347 int xDataTOM_polynomial_release( xDataTOM_polynomial *polynomial ); 348 int xDataTOM_polynomial_getData( xDataTOM_polynomial *polynomial, double **data ); 349 int xDataTOM_polynomial_getDataFromXDataInfo( xDataTOM_xDataInfo *xDI, double **data ); 350 351 #if defined __cplusplus 352 } 353 } 354 #endif 355 356 #endif /* End of xDataTOM_h_included. */ 357