Geant4 11.2.2
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
xDataTOM.cc File Reference
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <errno.h>
#include <unistd.h>
#include "xDataTOM_importXML_private.h"
#include "xDataTOM_private.h"

Go to the source code of this file.

Macros

#define PATH_MAX   4096
 

Functions

xDataTOM_TOMxDataTOM_importFile (statusMessageReporting *smr, const char *fileName)
 
xDataTOM_TOMxDataTOM_mallocTOM (statusMessageReporting *smr)
 
int xDataTOM_initializeTOM (statusMessageReporting *smr, xDataTOM_TOM *TOM)
 
void * xDataTOM_freeTOM (statusMessageReporting *, xDataTOM_TOM **TOM)
 
int xDataTOM_setFileNameTOM (statusMessageReporting *smr, xDataTOM_TOM *TOM, const char *fileName)
 
void xDataTOM_displayTree (statusMessageReporting *smr, xDataTOM_TOM *TOM, int printAttributes)
 
xDataTOM_elementxDataTOM_mallocElement (statusMessageReporting *smr, xDataTOM_element *parent, int ordinal, int index, char const *name)
 
void xDataTOM_freeElement (xDataTOM_element **element)
 
void xDataTOM_releaseElement (xDataTOM_element *element)
 
xDataTOM_elementxDataTOM_addElementInElement (statusMessageReporting *smr, xDataTOM_element *parent, int index, char const *name)
 
xDataTOM_elementxDataTOM_getDocumentsElement (xDataTOM_TOM *TOM)
 
xDataTOM_elementxDataTOME_getFirstElement (xDataTOM_element *element)
 
xDataTOM_elementxDataTOME_getNextElement (xDataTOM_element *element)
 
xDataTOM_elementxDataTOME_getOneElementByName (statusMessageReporting *smr, xDataTOM_element *element, char const *name, int required)
 
int xDataTOM_numberOfElementsByName (statusMessageReporting *, xDataTOM_element *element, char const *name)
 
int xDataTOME_addAttribute (statusMessageReporting *smr, xDataTOM_element *element, char const *name, char const *value)
 
char const * xDataTOM_getAttributesValueInElement (xDataTOM_element *element, char const *name)
 
int xDataTOME_copyAttributionList (statusMessageReporting *smr, xDataTOM_attributionList *desc, xDataTOM_element *element)
 
int xDataTOME_convertAttributeToInteger (statusMessageReporting *smr, xDataTOM_element *element, char const *name, int *n)
 
int xDataTOME_convertAttributeToDouble (statusMessageReporting *smr, xDataTOM_element *element, char const *name, double *d)
 
int xDataTOME_getInterpolation (statusMessageReporting *smr, xDataTOM_element *element, int index, enum xDataTOM_interpolationFlag *independent, enum xDataTOM_interpolationFlag *dependent, enum xDataTOM_interpolationQualifier *qualifier)
 
void xDataTOMAL_initial (statusMessageReporting *, xDataTOM_attributionList *attributes)
 
void xDataTOMAL_release (xDataTOM_attributionList *attributes)
 
int xDataTOMAL_addAttribute (statusMessageReporting *smr, xDataTOM_attributionList *attributes, char const *name, char const *value)
 
char const * xDataTOMAL_getAttributesValue (xDataTOM_attributionList *attributes, char const *name)
 
int xDataTOMAL_copyAttributionList (statusMessageReporting *smr, xDataTOM_attributionList *desc, xDataTOM_attributionList *src)
 
int xDataTOMAL_convertAttributeToInteger (statusMessageReporting *smr, xDataTOM_attributionList *attributes, char const *name, int *n)
 
int xDataTOMAL_convertAttributeToDouble (statusMessageReporting *smr, xDataTOM_attributionList *attributes, char const *name, double *d)
 
void * xData_initializeData (statusMessageReporting *smr, xDataTOM_element *TE, char const *ID, size_t size)
 
int xDataTOM_isXDataID (xDataTOM_element *TE, char const *ID)
 
xDataTOM_xDataInfoxDataTOME_getXData (xDataTOM_element *TE)
 
void * xDataTOME_getXDataIfID (statusMessageReporting *smr, xDataTOM_element *TE, char const *ID)
 

Variables

int xDataTOM_smrLibraryID = smr_unknownID
 

Macro Definition Documentation

◆ PATH_MAX

#define PATH_MAX   4096

Definition at line 31 of file xDataTOM.cc.

Function Documentation

◆ xData_initializeData()

void * xData_initializeData ( statusMessageReporting * smr,
xDataTOM_element * TE,
char const * ID,
size_t size )

Definition at line 479 of file xDataTOM.cc.

479 {
480
481 xDataTOM_xDataInfo *xDI = &(TE->xDataInfo);
482
483 xDI->data = NULL;
484 xDI->ID = ID;
485 xDI->element = TE;
486 return( xDI->data = (void *) smr_malloc2( smr, size, 1, "xDI->data" ) );
487}
#define smr_malloc2(smr, size, zero, forItem)
xDataTOM_xDataInfo xDataInfo
Definition xDataTOM.h:187
const char * ID
Definition xDataTOM.h:151
xDataTOM_element * element
Definition xDataTOM.h:152

Referenced by xDataXML_initializeData().

◆ xDataTOM_addElementInElement()

xDataTOM_element * xDataTOM_addElementInElement ( statusMessageReporting * smr,
xDataTOM_element * parent,
int index,
char const * name )

Definition at line 188 of file xDataTOM.cc.

188 {
189
190 xDataTOM_element *element;
191
192 if( ( element = xDataTOM_mallocElement( smr, parent, parent->numberOfChildren, index, name ) ) == NULL ) return( NULL );
193 if( parent->children == NULL ) {
194 parent->children = element; }
195 else {
196 xDataTOM_element *last;
197
198 for( last = parent->children; last->next != NULL; last = last->next ) ;
199 last->next = element;
200 }
201 (parent->numberOfChildren)++;
202 return( element );
203}
xDataTOM_element * children
Definition xDataTOM.h:186
xDataTOM_element * next
Definition xDataTOM.h:182
xDataTOM_element * xDataTOM_mallocElement(statusMessageReporting *smr, xDataTOM_element *parent, int ordinal, int index, char const *name)
Definition xDataTOM.cc:125

◆ xDataTOM_displayTree()

void xDataTOM_displayTree ( statusMessageReporting * smr,
xDataTOM_TOM * TOM,
int printAttributes )

Definition at line 114 of file xDataTOM.cc.

114 {
115
116 if( TOM->root.children != NULL ) xDataTOME_displayTree( smr, TOM->root.children, printAttributes, 0 );
117}
xDataTOM_element root
Definition xDataTOM.h:193

◆ xDataTOM_freeElement()

void xDataTOM_freeElement ( xDataTOM_element ** element)

Definition at line 139 of file xDataTOM.cc.

139 {
140
141 if( element == NULL ) return;
142 xDataTOM_releaseElement( *element );
143 smr_freeMemory( (void **) element );
144}
void * smr_freeMemory(void **p)
void xDataTOM_releaseElement(xDataTOM_element *element)
Definition xDataTOM.cc:148

Referenced by xDataTOM_releaseElement().

◆ xDataTOM_freeTOM()

void * xDataTOM_freeTOM ( statusMessageReporting * smr,
xDataTOM_TOM ** TOM )

Definition at line 78 of file xDataTOM.cc.

78 {
79
80 xDataTOM_TOM *TOMp;
81
82 if( TOM == NULL ) return( NULL );
83 TOMp = *TOM;
84 if( TOMp == NULL ) return( NULL );
85 xDataTOM_releaseElement( &(TOMp->root) );
86 smr_freeMemory( (void **) &(TOMp->fileName) );
87 smr_freeMemory( (void **) &(TOMp->realFileName) );
88 smr_freeMemory( (void **) TOM );
89 return( NULL );
90}
char * fileName
Definition xDataTOM.h:191
char * realFileName
Definition xDataTOM.h:192

Referenced by MCGIDI_target_heated_read(), and xDataXML_importFile().

◆ xDataTOM_getAttributesValueInElement()

char const * xDataTOM_getAttributesValueInElement ( xDataTOM_element * element,
char const * name )

◆ xDataTOM_getDocumentsElement()

xDataTOM_element * xDataTOM_getDocumentsElement ( xDataTOM_TOM * TOM)

Definition at line 223 of file xDataTOM.cc.

223 {
224
225 return( TOM->root.children );
226}

Referenced by MCGIDI_target_heated_read().

◆ xDataTOM_importFile()

xDataTOM_TOM * xDataTOM_importFile ( statusMessageReporting * smr,
const char * fileName )

Definition at line 44 of file xDataTOM.cc.

44 {
45/*
46* Returns NULL is an error occurred.
47*/
48
49 return( xDataXML_importFile( smr, fileName ) );
50}
xDataTOM_TOM * xDataXML_importFile(statusMessageReporting *smr, char const *fileName)

Referenced by MCGIDI_target_heated_read().

◆ xDataTOM_initializeTOM()

int xDataTOM_initializeTOM ( statusMessageReporting * smr,
xDataTOM_TOM * TOM )

Definition at line 68 of file xDataTOM.cc.

68 {
69
70 TOM->fileName = NULL;
71 TOM->realFileName = NULL;
72 xDataTOME_initializeElement( smr, &(TOM->root), NULL, 0, 0, "" );
73 return( !smr_isOk( smr ) );
74}
int smr_isOk(statusMessageReporting *smr)

Referenced by xDataTOM_mallocTOM().

◆ xDataTOM_isXDataID()

int xDataTOM_isXDataID ( xDataTOM_element * TE,
char const * ID )

Definition at line 491 of file xDataTOM.cc.

491 {
492
493 xDataTOM_xDataInfo *xDI = &(TE->xDataInfo);
494
495 if( xDI->ID != NULL ) {
496 return( !strcmp( xDI->ID, ID ) );
497 }
498
499 return( 0 );
500}

◆ xDataTOM_mallocElement()

xDataTOM_element * xDataTOM_mallocElement ( statusMessageReporting * smr,
xDataTOM_element * parent,
int ordinal,
int index,
char const * name )

Definition at line 125 of file xDataTOM.cc.

125 {
126/*
127* Returns NULL is an error occurred.
128*/
129 xDataTOM_element *element;
130
131 if( ( element = (xDataTOM_element *) smr_malloc2( smr, sizeof( xDataTOM_element ), 1, "xDataTOM_elelument" ) ) != NULL ) {
132 if( xDataTOME_initializeElement( smr, element, parent, ordinal, index, name ) ) smr_freeMemory( (void **) &element );
133 }
134 return( element );
135}

Referenced by xDataTOM_addElementInElement().

◆ xDataTOM_mallocTOM()

xDataTOM_TOM * xDataTOM_mallocTOM ( statusMessageReporting * smr)

Definition at line 54 of file xDataTOM.cc.

54 {
55/*
56* Returns NULL is an error occurred.
57*/
58 xDataTOM_TOM *TOM;
59
60 if( ( TOM = (xDataTOM_TOM *) smr_malloc2( smr, sizeof( xDataTOM_TOM ), 1, "xDataTOM_TOM" ) ) != NULL ) {
61 if( xDataTOM_initializeTOM( smr, TOM ) ) smr_freeMemory( (void **) &TOM );
62 }
63 return( TOM );
64}
int xDataTOM_initializeTOM(statusMessageReporting *smr, xDataTOM_TOM *TOM)
Definition xDataTOM.cc:68

Referenced by xDataXML_importFile().

◆ xDataTOM_numberOfElementsByName()

int xDataTOM_numberOfElementsByName ( statusMessageReporting * smr,
xDataTOM_element * element,
char const * name )

Definition at line 268 of file xDataTOM.cc.

268 {
269
270 int n = 0;
271 xDataTOM_element *child;
272
273 for( child = xDataTOME_getFirstElement( element ); child != NULL; child = xDataTOME_getNextElement( child ) ) if( !strcmp( child->name, name ) ) n++;
274 return( n );
275}
xDataTOM_element * xDataTOME_getNextElement(xDataTOM_element *element)
Definition xDataTOM.cc:238
xDataTOM_element * xDataTOME_getFirstElement(xDataTOM_element *element)
Definition xDataTOM.cc:230

Referenced by MCGIDI_outputChannel_parseFromTOM(), and MCGIDI_target_heated_read().

◆ xDataTOM_releaseElement()

void xDataTOM_releaseElement ( xDataTOM_element * element)

Definition at line 148 of file xDataTOM.cc.

148 {
149
150 xDataTOM_element *child, *nextChild;
151
152 if( element == NULL ) return;
153 xDataTOMAL_release( &(element->attributes) );
154 for( child = element->children; child != NULL; child = nextChild ) {
155 nextChild = child->next;
156 xDataTOM_freeElement( &child );
157 }
158 if( element->xDataInfo.ID != NULL ) {
159 xDataTOM_axes_release( &(element->xDataInfo.axes) );
160 if( strcmp( element->xDataInfo.ID, xDataTOM_XYs_ID ) == 0 ) {
161 xDataTOM_XYs_free( &(element->xDataInfo ) ); }
162 else if( strcmp( element->xDataInfo.ID, xDataTOM_regionsXYs_ID ) == 0 ) {
163 xDataTOM_regionsXYs_free( &(element->xDataInfo ) ); }
164 else if( strcmp( element->xDataInfo.ID, xDataTOM_W_XYs_ID ) == 0 ) {
166 else if( strcmp( element->xDataInfo.ID, xDataTOM_V_W_XYs_ID ) == 0 ) {
167 xDataTOM_V_W_XYs_free( &(element->xDataInfo ) ); }
168 else if( strcmp( element->xDataInfo.ID, xDataTOM_W_XYs_LegendreSeries_ID ) == 0 ) {
170 else if( strcmp( element->xDataInfo.ID, xDataTOM_regionsW_XYs_LegendreSeries_ID ) == 0 ) {
172 else if( strcmp( element->xDataInfo.ID, xDataTOM_V_W_XYs_LegendreSeries_ID ) == 0 ) {
174 else if( strcmp( element->xDataInfo.ID, xDataTOM_KalbachMann_ID ) == 0 ) {
175 xDataTOM_KalbachMann_free( &(element->xDataInfo ) ); }
176 else if( strcmp( element->xDataInfo.ID, xDataTOM_polynomial_ID ) == 0 ) {
177 xDataTOM_polynomial_free( &(element->xDataInfo ) ); }
178 else {
179 printf( "not freed for %s\n", element->xDataInfo.ID );
180 }
181 }
182 element->parent = NULL;
183 smr_freeMemory( (void **) &(element->name) );
184}
xDataTOM_element * parent
Definition xDataTOM.h:181
xDataTOM_axes axes
Definition xDataTOM.h:153
void xDataTOM_freeElement(xDataTOM_element **element)
Definition xDataTOM.cc:139
void xDataTOMAL_release(xDataTOM_attributionList *attributes)
Definition xDataTOM.cc:361
int xDataTOM_V_W_XYs_LegendreSeries_free(xDataTOM_xDataInfo *xDI)
int xDataTOM_regionsXYs_free(xDataTOM_xDataInfo *xDI)
int xDataTOM_regionsW_XYs_LegendreSeries_free(xDataTOM_xDataInfo *xDI)
int xDataTOM_V_W_XYs_free(xDataTOM_xDataInfo *xDI)
int xDataTOM_XYs_free(xDataTOM_xDataInfo *xDI)
int xDataTOM_W_XYs_freeFrom_xDataInfo(xDataTOM_xDataInfo *xDI)
int xDataTOM_KalbachMann_free(xDataTOM_xDataInfo *xDI)
int xDataTOM_W_XYs_LegendreSeries_free(xDataTOM_xDataInfo *xDI)
int xDataTOM_axes_release(xDataTOM_axes *axes)
int xDataTOM_polynomial_free(xDataTOM_xDataInfo *xDI)
char const * xDataTOM_KalbachMann_ID
char const * xDataTOM_V_W_XYs_ID
char const * xDataTOM_regionsW_XYs_LegendreSeries_ID
char const * xDataTOM_polynomial_ID
char const * xDataTOM_W_XYs_ID
char const * xDataTOM_regionsXYs_ID
char const * xDataTOM_W_XYs_LegendreSeries_ID
char const * xDataTOM_XYs_ID
char const * xDataTOM_V_W_XYs_LegendreSeries_ID

Referenced by xDataTOM_freeElement(), and xDataTOM_freeTOM().

◆ xDataTOM_setFileNameTOM()

int xDataTOM_setFileNameTOM ( statusMessageReporting * smr,
xDataTOM_TOM * TOM,
const char * fileName )

Definition at line 94 of file xDataTOM.cc.

94 {
95/*
96* Returns not zero value if error occurred.
97*/
98
99 char realPath[PATH_MAX+1];
100
101 smr_freeMemory( (void **) &(TOM->fileName) );
102 smr_freeMemory( (void **) &(TOM->realFileName) );
103 if( fileName != NULL ) {
104 if( ( TOM->fileName = smr_allocateCopyString2( smr, fileName, "fileName" ) ) == NULL ) return( 1 );
105 if( realpath( fileName, realPath ) != NULL ) {
106 if( ( TOM->realFileName = smr_allocateCopyString2( smr, realPath, "realFileName" ) ) == NULL ) return( 1 );
107 }
108 }
109 return( 0 );
110}
#define smr_allocateCopyString2(smr, s, forItem)
#define PATH_MAX
Definition xDataTOM.cc:31

Referenced by xDataXML_importFile().

◆ xDataTOMAL_addAttribute()

int xDataTOMAL_addAttribute ( statusMessageReporting * smr,
xDataTOM_attributionList * attributes,
char const * name,
char const * value )

Definition at line 376 of file xDataTOM.cc.

376 {
377
378 xDataTOM_attribute *attribute;
379
380 if( ( attribute = (xDataTOM_attribute *) smr_malloc2( smr, sizeof( xDataTOM_attribute ), 1, "xDataTOM_attribute" ) ) == NULL ) return( 1 );
381 if( ( attribute->name = smr_allocateCopyString2( smr, name, "name" ) ) == NULL ) goto err;
382 if( ( attribute->value = smr_allocateCopyString2( smr, value, "value" ) ) == NULL ) goto err;
383 if( attributes->attributes == NULL ) {
384 attributes->attributes = attribute; }
385 else {
386 xDataTOM_attribute *last;
387
388 for( last = attributes->attributes; last->next != NULL; last = last->next ) ;
389 last->next = attribute;
390 }
391 attributes->number++;
392 return( 0 );
393
394err:
395 smr_freeMemory( (void **) &(attribute->name) );
396 smr_freeMemory( (void **) &(attribute->value) );
397 smr_freeMemory( (void **) &(attribute) );
398 return( 1 );
399}
xDataTOM_attribute * next
Definition xDataTOM.h:158
xDataTOM_attribute * attributes
Definition xDataTOM.h:165

Referenced by MCGIDI_misc_copyXMLAttributesToTOM(), xDataTOMAL_copyAttributionList(), and xDataTOME_addAttribute().

◆ xDataTOMAL_convertAttributeToDouble()

int xDataTOMAL_convertAttributeToDouble ( statusMessageReporting * smr,
xDataTOM_attributionList * attributes,
char const * name,
double * d )

Definition at line 450 of file xDataTOM.cc.

450 {
451
452 char const *value = xDataTOMAL_getAttributesValue( attributes, name );
453 char *e;
454
455 if( value != NULL ) {
456 *d = strtod( value, &e );
457 if( *e == 0 ) return( 0 );
458 smr_setReportError2( smr, xDataTOM_smrLibraryID, 1, "could not convert attribute %s's values = '%s' to a double", name, value ); }
459 else {
460 smr_setReportError2( smr, xDataTOM_smrLibraryID, 1, "no attribute named '%s'", name );
461 }
462 return( 1 );
463}
#define smr_setReportError2(smr, libraryID, code, fmt,...)
int xDataTOM_smrLibraryID
Definition xDataTOM.cc:34

Referenced by xDataTOME_convertAttributeToDouble().

◆ xDataTOMAL_convertAttributeToInteger()

int xDataTOMAL_convertAttributeToInteger ( statusMessageReporting * smr,
xDataTOM_attributionList * attributes,
char const * name,
int * n )

Definition at line 433 of file xDataTOM.cc.

433 {
434
435 char const *value = xDataTOMAL_getAttributesValue( attributes, name );
436 char *e;
437
438 if( value != NULL ) {
439 *n = (int) strtoll( value, &e, 10 );
440 if( *e == 0 ) return( 0 );
441 smr_setReportError2( smr, xDataTOM_smrLibraryID, 1, "could not convert attribute %s's value = '%s' to an integer", name, value ); }
442 else {
443 smr_setReportError2( smr, xDataTOM_smrLibraryID, 1, "no attribute named '%s'", name );
444 }
445 return( 1 );
446}

Referenced by xDataTOME_convertAttributeToInteger().

◆ xDataTOMAL_copyAttributionList()

int xDataTOMAL_copyAttributionList ( statusMessageReporting * smr,
xDataTOM_attributionList * desc,
xDataTOM_attributionList * src )

Definition at line 415 of file xDataTOM.cc.

415 {
416
417 xDataTOM_attribute *attribute;
418
419 xDataTOMAL_initial( smr, desc );
420 for( attribute = src->attributes; attribute != NULL; attribute = attribute->next ) {
421 if( xDataTOMAL_addAttribute( smr, desc, attribute->name, attribute->value ) != 0 ) goto err;
422
423 }
424 return( 0 );
425
426err:
427 xDataTOMAL_release( desc );
428 return( 1 );
429}
void xDataTOMAL_initial(statusMessageReporting *, xDataTOM_attributionList *attributes)
Definition xDataTOM.cc:353
int xDataTOMAL_addAttribute(statusMessageReporting *smr, xDataTOM_attributionList *attributes, char const *name, char const *value)
Definition xDataTOM.cc:376

Referenced by MCGIDI_target_heated_read(), and xDataTOME_copyAttributionList().

◆ xDataTOMAL_getAttributesValue()

char const * xDataTOMAL_getAttributesValue ( xDataTOM_attributionList * attributes,
char const * name )

Definition at line 403 of file xDataTOM.cc.

403 {
404
405 xDataTOM_attribute *attribute;
406
407 for( attribute = attributes->attributes; attribute != NULL; attribute = attribute->next ) {
408 if( !strcmp( attribute->name, name ) ) return( attribute->value );
409 }
410 return( NULL );
411}

Referenced by MCGIDI_misc_pointerToAttributeIfAllOk(), MCGIDI_misc_pointerToTOMAttributeIfAllOk(), MCGIDI_target_getAttributesValue(), xDataTOM_getAttributesValueInElement(), xDataTOMAL_convertAttributeToDouble(), and xDataTOMAL_convertAttributeToInteger().

◆ xDataTOMAL_initial()

void xDataTOMAL_initial ( statusMessageReporting * smr,
xDataTOM_attributionList * attributes )

Definition at line 353 of file xDataTOM.cc.

353 {
354
355 attributes->number = 0;
356 attributes->attributes = NULL;
357}

Referenced by MCGIDI_misc_copyXMLAttributesToTOM(), xDataTOMAL_copyAttributionList(), and xDataTOMAL_release().

◆ xDataTOMAL_release()

void xDataTOMAL_release ( xDataTOM_attributionList * attributes)

Definition at line 361 of file xDataTOM.cc.

361 {
362
363 xDataTOM_attribute *attribute, *next;
364
365 for( attribute = attributes->attributes; attribute != NULL; attribute = next ) {
366 next = attribute->next;
367 smr_freeMemory( (void **) &(attribute->name) );
368 smr_freeMemory( (void **) &(attribute->value) );
369 smr_freeMemory( (void **) &(attribute) );
370 }
371 xDataTOMAL_initial( NULL, attributes );
372}

Referenced by MCGIDI_misc_copyXMLAttributesToTOM(), MCGIDI_reaction_release(), MCGIDI_target_heated_release(), MCGIDI_target_release(), xDataTOM_releaseElement(), and xDataTOMAL_copyAttributionList().

◆ xDataTOME_addAttribute()

int xDataTOME_addAttribute ( statusMessageReporting * smr,
xDataTOM_element * element,
char const * name,
char const * value )

Definition at line 279 of file xDataTOM.cc.

279 {
280
281 return( xDataTOMAL_addAttribute( smr, &(element->attributes), name, value ) );
282}

◆ xDataTOME_convertAttributeToDouble()

int xDataTOME_convertAttributeToDouble ( statusMessageReporting * smr,
xDataTOM_element * element,
char const * name,
double * d )

Definition at line 307 of file xDataTOM.cc.

307 {
308
309 return( xDataTOMAL_convertAttributeToDouble( smr, &(element->attributes), name, d ) );
310}
int xDataTOMAL_convertAttributeToDouble(statusMessageReporting *smr, xDataTOM_attributionList *attributes, char const *name, double *d)
Definition xDataTOM.cc:450

◆ xDataTOME_convertAttributeToInteger()

int xDataTOME_convertAttributeToInteger ( statusMessageReporting * smr,
xDataTOM_element * element,
char const * name,
int * n )

Definition at line 300 of file xDataTOM.cc.

300 {
301
302 return( xDataTOMAL_convertAttributeToInteger( smr, &(element->attributes), name, n ) );
303}
int xDataTOMAL_convertAttributeToInteger(statusMessageReporting *smr, xDataTOM_attributionList *attributes, char const *name, int *n)
Definition xDataTOM.cc:433

Referenced by MCGIDI_product_parseFromTOM(), and MCGIDI_reaction_parseFromTOM().

◆ xDataTOME_copyAttributionList()

int xDataTOME_copyAttributionList ( statusMessageReporting * smr,
xDataTOM_attributionList * desc,
xDataTOM_element * element )

Definition at line 293 of file xDataTOM.cc.

293 {
294
295 return( xDataTOMAL_copyAttributionList( smr, desc, &(element->attributes) ) );
296}
int xDataTOMAL_copyAttributionList(statusMessageReporting *smr, xDataTOM_attributionList *desc, xDataTOM_attributionList *src)
Definition xDataTOM.cc:415

Referenced by MCGIDI_reaction_parseFromTOM().

◆ xDataTOME_getFirstElement()

xDataTOM_element * xDataTOME_getFirstElement ( xDataTOM_element * element)

Definition at line 230 of file xDataTOM.cc.

230 {
231
232 if( element != NULL ) element = element->children;
233 return( element );
234}

Referenced by MCGIDI_outputChannel_parseFromTOM(), MCGIDI_target_heated_read(), xDataTOM_numberOfElementsByName(), and xDataTOME_getOneElementByName().

◆ xDataTOME_getInterpolation()

int xDataTOME_getInterpolation ( statusMessageReporting * smr,
xDataTOM_element * element,
int index,
enum xDataTOM_interpolationFlag * independent,
enum xDataTOM_interpolationFlag * dependent,
enum xDataTOM_interpolationQualifier * qualifier )

Definition at line 314 of file xDataTOM.cc.

315 {
316
317 xDataTOM_xDataInfo *xDI = &(element->xDataInfo);
318
319 if( xDI->ID == NULL ) return( 1 );
320
321 return( xDataTOM_axes_getInterpolation( smr, &(xDI->axes), index, independent, dependent, qualifier ) );
322}
int xDataTOM_axes_getInterpolation(statusMessageReporting *smr, xDataTOM_axes *axes, int index, enum xDataTOM_interpolationFlag *independent, enum xDataTOM_interpolationFlag *dependent, enum xDataTOM_interpolationQualifier *qualifier)

Referenced by MCGIDI_fromTOM_interpolation(), and MCGIDI_reaction_parseFromTOM().

◆ xDataTOME_getNextElement()

xDataTOM_element * xDataTOME_getNextElement ( xDataTOM_element * element)

Definition at line 238 of file xDataTOM.cc.

238 {
239
240 if( element != NULL ) element = element->next;
241 return( element );
242}

Referenced by MCGIDI_outputChannel_parseFromTOM(), MCGIDI_target_heated_read(), xDataTOM_numberOfElementsByName(), and xDataTOME_getOneElementByName().

◆ xDataTOME_getOneElementByName()

xDataTOM_element * xDataTOME_getOneElementByName ( statusMessageReporting * smr,
xDataTOM_element * element,
char const * name,
int required )

Definition at line 246 of file xDataTOM.cc.

246 {
247
248 int n = 0;
249 xDataTOM_element *child, *desired = NULL;
250
251 for( child = xDataTOME_getFirstElement( element ); child != NULL; child = xDataTOME_getNextElement( child ) ) {
252 if( strcmp( child->name, name ) == 0 ) {
253 if( n == 0 ) desired = child;
254 n++;
255 }
256 }
257 if( n == 0 ) {
258 if( required ) smr_setReportError2( smr, smr_unknownID, 1, "elements '%s' not found in element '%s'", name, element->name ); }
259 else if( n > 1 ) {
260 smr_setReportError2( smr, smr_unknownID, 1, "multiple (= %d) elements '%s' found in element '%s'", name, element->name );
261 desired = NULL;
262 }
263 return( desired );
264}
#define smr_unknownID

Referenced by MCGIDI_angular_parseFromTOM(), MCGIDI_angularEnergy_parseFromTOM(), MCGIDI_distribution_parseFromTOM(), MCGIDI_energy_parseFromTOM(), MCGIDI_energyAngular_parseFromTOM(), MCGIDI_KalbachMann_parseFromTOM(), MCGIDI_LLNLAngular_angularEnergy_parseFromTOM(), MCGIDI_product_parseFromTOM(), MCGIDI_reaction_parseFromTOM(), MCGIDI_target_heated_read(), and MCGIDI_uncorrelated_parseFromTOM().

◆ xDataTOME_getXData()

xDataTOM_xDataInfo * xDataTOME_getXData ( xDataTOM_element * TE)

Definition at line 504 of file xDataTOM.cc.

504 {
505
506 if( TE->xDataInfo.ID == NULL ) return( NULL );
507 return( &(TE->xDataInfo) );
508}

Referenced by xDataTOME_getXDataIfID().

◆ xDataTOME_getXDataIfID()

void * xDataTOME_getXDataIfID ( statusMessageReporting * smr,
xDataTOM_element * TE,
char const * ID )

Definition at line 512 of file xDataTOM.cc.

512 {
513
515
516 if( xDI == NULL ) {
517 smr_setReportError2( smr, xDataTOM_smrLibraryID, 1, "element '%s' does not have xData", TE->name );
518 return( NULL );
519 }
520 if( strcmp( ID, xDI->ID ) ) {
521 smr_setReportError2( smr, xDataTOM_smrLibraryID, 1, "xData has ID = '%s' not '%s' for element %s", xDI->ID, ID, TE->name );
522 return( NULL );
523 }
524 return( xDI->data );
525
526}
xDataTOM_xDataInfo * xDataTOME_getXData(xDataTOM_element *TE)
Definition xDataTOM.cc:504

Referenced by MCGIDI_angular_parseFromTOM(), and MCGIDI_fromTOM_pdfsOfXGivenW().

Variable Documentation

◆ xDataTOM_smrLibraryID