Geant4 9.6.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
tpia_target.cc File Reference
#include <string.h>
#include <tpia_target.h>
#include <tpia_misc.h>

Go to the source code of this file.

Functions

tpia_targettpia_target_create (statusMessageReporting *smr)
 
int tpia_target_initialize (statusMessageReporting *smr, tpia_target *target)
 
tpia_targettpia_target_createRead (statusMessageReporting *smr, const char *fileName)
 
int tpia_target_readFromMap (statusMessageReporting *smr, tpia_target *target, tpia_map *map, const char *evaluation, const char *projectileName, const char *targetName)
 
tpia_targettpia_target_createReadFromMap (statusMessageReporting *smr, tpia_map *map, const char *evaluation, const char *projectileName, const char *targetName)
 
tpia_targettpia_target_free (statusMessageReporting *smr, tpia_target *target)
 
int tpia_target_release (statusMessageReporting *smr, tpia_target *target)
 
int tpia_target_read (statusMessageReporting *smr, tpia_target *target, const char *fileName)
 
char * tpia_target_getAttributesValue (statusMessageReporting *, tpia_target *target, char const *name)
 
int tpia_target_getTemperatures (statusMessageReporting *, tpia_target *target, double *temperatures)
 
int tpia_target_readHeatedTarget (statusMessageReporting *smr, tpia_target *target, int index, int checkElememtsForAccess)
 
tpia_target_heatedtpia_target_getHeatedTargetAtIndex_ReadIfNeeded (statusMessageReporting *smr, tpia_target *target, int index)
 
tpia_target_heatedtpia_target_getHeatedTargetAtTIndex (statusMessageReporting *smr, tpia_target *target, int index)
 
int tpia_target_numberOfChannels (statusMessageReporting *smr, tpia_target *target)
 
int tpia_target_numberOfProductionChannels (statusMessageReporting *smr, tpia_target *target)
 
xData_Int tpia_target_getEnergyGridAtTIndex (statusMessageReporting *smr, tpia_target *target, int index, double **energyGrid)
 
tpia_1dDatatpia_target_getTotalCrossSectionAtTIndex (statusMessageReporting *smr, tpia_target *target, int index, int crossSectionType)
 
double tpia_target_getTotalCrossSectionAtTAndE (statusMessageReporting *smr, tpia_target *target, double T, xData_Int iEg, double e_in, int crossSectionType)
 
double tpia_target_getIndexChannelCrossSectionAtE (statusMessageReporting *smr, tpia_target *target, int index, double T, xData_Int iEg, double e_in, int crossSectionType)
 
int tpia_target_sampleIndexChannelProductsAtE (statusMessageReporting *smr, tpia_target *target, int index, double, tpia_decaySamplingInfo *decaySamplingInfo, int nProductData, tpia_productOutgoingData *productData)
 

Function Documentation

◆ tpia_target_create()

tpia_target * tpia_target_create ( statusMessageReporting smr)

Definition at line 49 of file tpia_target.cc.

49 {
50
51 tpia_target *target;
52
53 //if( ( target = xData_malloc2( smr, sizeof( tpia_target ), 0, "target" ) ) == NULL ) return( NULL );
54 if( ( target = (tpia_target*) xData_malloc2( smr, sizeof( tpia_target ), 0, "target" ) ) == NULL ) return( NULL );
55 if( tpia_target_initialize( smr, target ) ) target = tpia_target_free( smr, target );
56 return( target );
57}
int tpia_target_initialize(statusMessageReporting *smr, tpia_target *target)
Definition: tpia_target.cc:61
tpia_target * tpia_target_free(statusMessageReporting *smr, tpia_target *target)
Definition: tpia_target.cc:108
#define xData_malloc2(smr, size, zero, forItem)
Definition: xData.h:313

Referenced by tpia_target_createRead().

◆ tpia_target_createRead()

tpia_target * tpia_target_createRead ( statusMessageReporting smr,
const char *  fileName 
)

Definition at line 70 of file tpia_target.cc.

70 {
71
72 tpia_target *target;
73
74 if( ( target = tpia_target_create( smr ) ) == NULL ) return( NULL );
75 //if( tpia_target_read( smr, target, fileName ) != 0 ) target = xData_free( smr, target );
76 if( tpia_target_read( smr, target, fileName ) != 0 ) target = (tpia_target*) xData_free( smr, target );
77 return( target );
78}
int tpia_target_read(statusMessageReporting *smr, tpia_target *target, const char *fileName)
Definition: tpia_target.cc:143
tpia_target * tpia_target_create(statusMessageReporting *smr)
Definition: tpia_target.cc:49
void * xData_free(statusMessageReporting *smr, void *p)
Definition: xDataMisc.cc:89

Referenced by G4GIDI_target::init(), and tpia_target_createReadFromMap().

◆ tpia_target_createReadFromMap()

tpia_target * tpia_target_createReadFromMap ( statusMessageReporting smr,
tpia_map map,
const char *  evaluation,
const char *  projectileName,
const char *  targetName 
)

Definition at line 93 of file tpia_target.cc.

94 {
95
96 char *targetPath;
97 tpia_target *target;
98
99 targetPath = tpia_map_findTarget( smr, map, evaluation, projectileName, targetName );
100 if( targetPath == NULL ) return( NULL );
101 target = tpia_target_createRead( smr, targetPath );
102 xData_free( smr, targetPath );
103 return( target );
104}
char * tpia_map_findTarget(statusMessageReporting *smr, tpia_map *map, const char *evaluation, const char *projectile, const char *targetName)
Definition: tpia_map.cc:327
tpia_target * tpia_target_createRead(statusMessageReporting *smr, const char *fileName)
Definition: tpia_target.cc:70

Referenced by tpia_depot_addTargetFromMap().

◆ tpia_target_free()

tpia_target * tpia_target_free ( statusMessageReporting smr,
tpia_target target 
)

Definition at line 108 of file tpia_target.cc.

108 {
109
110 tpia_target_release( smr, target );
111 xData_free( smr, target );
112 return( NULL );
113}
int tpia_target_release(statusMessageReporting *smr, tpia_target *target)
Definition: tpia_target.cc:117

Referenced by tpia_depot_release(), tpia_target_create(), and G4GIDI_target::~G4GIDI_target().

◆ tpia_target_getAttributesValue()

char * tpia_target_getAttributesValue ( statusMessageReporting smr,
tpia_target target,
char const name 
)

Definition at line 248 of file tpia_target.cc.

248 {
249
250 return( xData_getAttributesValue( &(target->attributes), name ) );
251}
xData_attributionList attributes
Definition: tpia_target.h:299
char * xData_getAttributesValue(xData_attributionList *attributes, const char *name)
Definition: xData.cc:530

◆ tpia_target_getEnergyGridAtTIndex()

xData_Int tpia_target_getEnergyGridAtTIndex ( statusMessageReporting smr,
tpia_target target,
int  index,
double **  energyGrid 
)

Definition at line 331 of file tpia_target.cc.

331 {
332
333 tpia_target_heated *heated = tpia_target_getHeatedTargetAtTIndex( smr, target, index );
334
335 if( !smr_isOk( smr ) ) return( -1 );
336 return( tpia_target_heated_getEnergyGrid( smr, heated, energyGrid ) );
337}
int smr_isOk(statusMessageReporting *smr)
tpia_target_heated * tpia_target_getHeatedTargetAtTIndex(statusMessageReporting *smr, tpia_target *target, int index)
Definition: tpia_target.cc:302
xData_Int tpia_target_heated_getEnergyGrid(statusMessageReporting *smr, tpia_target_heated *target, double **energyGrid)

Referenced by G4GIDI_target::getEnergyGridAtTIndex().

◆ tpia_target_getHeatedTargetAtIndex_ReadIfNeeded()

tpia_target_heated * tpia_target_getHeatedTargetAtIndex_ReadIfNeeded ( statusMessageReporting smr,
tpia_target target,
int  index 
)

Definition at line 290 of file tpia_target.cc.

290 {
291
292 if( ( index < 0 ) || ( index >= target->nHeatedTargets ) ) {
293 smr_setMessageError( smr, NULL, __FILE__, __LINE__, 1, "temperature index = %d out of range (0 <= index < %d", index, target->nHeatedTargets );
294 return( NULL );
295 }
296 if( target->heatedTargets[index].heatedTarget == NULL ) tpia_target_readHeatedTarget( smr, target, index, 0 );
297 return( target->heatedTargets[index].heatedTarget );
298}
int smr_setMessageError(statusMessageReporting *smr, void *userInterface, const char *file, int line, int code, const char *fmt,...)
tpia_target_heated * heatedTarget
Definition: tpia_target.h:291
tpia_target_heated_info * heatedTargets
Definition: tpia_target.h:303
int tpia_target_readHeatedTarget(statusMessageReporting *smr, tpia_target *target, int index, int checkElememtsForAccess)
Definition: tpia_target.cc:266

◆ tpia_target_getHeatedTargetAtTIndex()

tpia_target_heated * tpia_target_getHeatedTargetAtTIndex ( statusMessageReporting smr,
tpia_target target,
int  index 
)

Definition at line 302 of file tpia_target.cc.

302 {
303
304 if( ( index < 0 ) || ( index >= target->nHeatedTargets ) ) {
305 smr_setMessageError( smr, NULL, __FILE__, __LINE__, 1, "temperature index = %d out of range (0 <= index < %d", index, target->nHeatedTargets );
306 return( NULL );
307 }
308 if( target->heatedTargets[index].heatedTarget == NULL ) {
309 smr_setMessageError( smr, NULL, __FILE__, __LINE__, 1, "temperature index = %d not read in", index );
310 return( NULL );
311 }
312 return( target->heatedTargets[index].heatedTarget );
313}

Referenced by tpia_target_getEnergyGridAtTIndex(), and tpia_target_getTotalCrossSectionAtTIndex().

◆ tpia_target_getIndexChannelCrossSectionAtE()

double tpia_target_getIndexChannelCrossSectionAtE ( statusMessageReporting smr,
tpia_target target,
int  index,
double  T,
xData_Int  iEg,
double  e_in,
int  crossSectionType 
)

Definition at line 380 of file tpia_target.cc.

381 {
382
383 int i;
384 double xsec = 0., xsec1, xsec2;
385
386 for( i = 0; i < target->nReadHeatedTargets; i++ ) if( target->readHeatedTargets[i]->temperature > T ) break;
387 if( i == 0 ) {
388 xsec = tpia_target_heated_getIndexChannelCrossSectionAtE( smr, target->readHeatedTargets[0]->heatedTarget, index, iEg, e_in, crossSectionType ); }
389 else if( i == target->nReadHeatedTargets ) {
390 xsec = tpia_target_heated_getIndexChannelCrossSectionAtE( smr, target->readHeatedTargets[i-1]->heatedTarget, index, iEg, e_in, crossSectionType ); }
391 else {
392 xsec1 = tpia_target_heated_getIndexChannelCrossSectionAtE(smr, target->readHeatedTargets[i-1]->heatedTarget, index, iEg, e_in, crossSectionType);
393 xsec2 = tpia_target_heated_getIndexChannelCrossSectionAtE(smr, target->readHeatedTargets[i ]->heatedTarget, index, iEg, e_in, crossSectionType);
394 xsec = ( ( target->readHeatedTargets[i]->temperature - T ) * xsec1 + ( T - target->readHeatedTargets[i-1]->temperature ) * xsec2 ) /
395 ( target->readHeatedTargets[i]->temperature - target->readHeatedTargets[i-1]->temperature );
396 }
397
398 return( xsec );
399}
int nReadHeatedTargets
Definition: tpia_target.h:301
tpia_target_heated_info ** readHeatedTargets
Definition: tpia_target.h:304
double tpia_target_heated_getIndexChannelCrossSectionAtE(statusMessageReporting *smr, tpia_target_heated *target, int index, xData_Int iEg, double e_in, int crossSectionType)

Referenced by G4GIDI_target::sampleChannelCrossSectionAtE(), and G4GIDI_target::sumChannelCrossSectionAtE().

◆ tpia_target_getTemperatures()

int tpia_target_getTemperatures ( statusMessageReporting smr,
tpia_target target,
double *  temperatures 
)

Definition at line 256 of file tpia_target.cc.

256 {
257
258 int i;
259
260 if( temperatures != NULL ) for( i = 0; i < target->nHeatedTargets; i++ ) temperatures[i] = target->heatedTargets[i].temperature;
261 return( target->nHeatedTargets );
262}

Referenced by G4GIDI_target::getTemperatures().

◆ tpia_target_getTotalCrossSectionAtTAndE()

double tpia_target_getTotalCrossSectionAtTAndE ( statusMessageReporting smr,
tpia_target target,
double  T,
xData_Int  iEg,
double  e_in,
int  crossSectionType 
)

Definition at line 357 of file tpia_target.cc.

358 {
359
360 int i;
361 double xsec = 0., xsec1, xsec2;
362
363 for( i = 0; i < target->nReadHeatedTargets; i++ ) if( target->readHeatedTargets[i]->temperature > T ) break;
364 if( i == 0 ) {
365 xsec = tpia_target_heated_getTotalCrossSectionAtE( smr, target->readHeatedTargets[0]->heatedTarget, iEg, e_in, crossSectionType ); }
366 else if( i == target->nReadHeatedTargets ) {
367 xsec = tpia_target_heated_getTotalCrossSectionAtE( smr, target->readHeatedTargets[i-1]->heatedTarget, iEg, e_in, crossSectionType ); }
368 else {
369 xsec1 = tpia_target_heated_getTotalCrossSectionAtE( smr, target->readHeatedTargets[i-1]->heatedTarget, iEg, e_in, crossSectionType );
370 xsec2 = tpia_target_heated_getTotalCrossSectionAtE( smr, target->readHeatedTargets[i ]->heatedTarget, iEg, e_in, crossSectionType );
371 xsec = ( ( target->readHeatedTargets[i]->temperature - T ) * xsec1 + ( T - target->readHeatedTargets[i-1]->temperature ) * xsec2 ) /
372 ( target->readHeatedTargets[i]->temperature - target->readHeatedTargets[i-1]->temperature );
373 }
374
375 return( xsec );
376}
double tpia_target_heated_getTotalCrossSectionAtE(statusMessageReporting *smr, tpia_target_heated *target, xData_Int gE, double e_in, int crossSectionType)

Referenced by G4GIDI_target::getTotalCrossSectionAtE().

◆ tpia_target_getTotalCrossSectionAtTIndex()

tpia_1dData * tpia_target_getTotalCrossSectionAtTIndex ( statusMessageReporting smr,
tpia_target target,
int  index,
int  crossSectionType 
)

Definition at line 341 of file tpia_target.cc.

341 {
342
343 tpia_target_heated *heated = tpia_target_getHeatedTargetAtTIndex( smr, target, index );
344
345 if( !smr_isOk( smr ) ) return( NULL );
346 if( crossSectionType == tpia_crossSectionType_grouped ) {
347 return( &(heated->totalCrossSectionGrouped) ); }
348 else if( crossSectionType == tpia_crossSectionType_pointwise ) {
349 return( &(heated->totalCrossSectionPointwise) );
350 }
351 smr_setMessageError( smr, NULL, __FILE__, __LINE__, 1, "Invalue crossSectionType = %d", crossSectionType );
352 return( NULL );
353}
tpia_1dData totalCrossSectionPointwise
Definition: tpia_target.h:276
tpia_1dData totalCrossSectionGrouped
Definition: tpia_target.h:277
#define tpia_crossSectionType_grouped
Definition: tpia_target.h:88
#define tpia_crossSectionType_pointwise
Definition: tpia_target.h:89

◆ tpia_target_initialize()

int tpia_target_initialize ( statusMessageReporting smr,
tpia_target target 
)

Definition at line 61 of file tpia_target.cc.

61 {
62
63 memset( target, 0, sizeof( tpia_target ) );
65 return( 0 );
66}
tpia_samplingMethods samplingMethods
Definition: tpia_target.h:300
int tpia_samplingMethods_initialize(statusMessageReporting *smr, tpia_samplingMethods *samplingMethods)

Referenced by tpia_target_create(), tpia_target_read(), and tpia_target_release().

◆ tpia_target_numberOfChannels()

int tpia_target_numberOfChannels ( statusMessageReporting smr,
tpia_target target 
)

Definition at line 317 of file tpia_target.cc.

317 {
318
320}
tpia_target_heated * baseHeatedTarget
Definition: tpia_target.h:302
int tpia_target_heated_numberOfChannels(statusMessageReporting *smr, tpia_target_heated *target)

Referenced by G4GIDI_target::getChannelIDs(), G4GIDI_target::getNumberOfChannels(), and G4GIDI_target::init().

◆ tpia_target_numberOfProductionChannels()

int tpia_target_numberOfProductionChannels ( statusMessageReporting smr,
tpia_target target 
)

Definition at line 324 of file tpia_target.cc.

324 {
325
327}
int tpia_target_heated_numberOfProductionChannels(statusMessageReporting *smr, tpia_target_heated *target)

Referenced by G4GIDI_target::getNumberOfProductionChannels(), and G4GIDI_target::getProductionChannelIDs().

◆ tpia_target_read()

int tpia_target_read ( statusMessageReporting smr,
tpia_target target,
const char *  fileName 
)

Definition at line 143 of file tpia_target.cc.

143 {
144/*
145* If a target has already been read into this target, user must have called tpia_target_release before calling this routine.
146* Otherwise, there will be memory leaks.
147*/
148 xData_document *doc;
149 xData_element *element, *child;
150 int i, iHeated, nHeated = 0, status = 1;
151 double temperature;
152 //fix for gcc4.6 warings 110602
153 //char *pReturnValue, *name;
154 char *name;
155 char const *contents;
156
157 tpia_target_initialize( smr, target );
158 if( ( target->path = xDataMisc_allocateCopyString2( smr, fileName, "path" ) ) == NULL ) return( status );
159 if( ( target->absPath = xDataMisc_getAbsPath( smr, fileName ) ) == NULL ) return( _tpia_target_releaseAndReturnOne( smr, target ) );
160 if( ( doc = xData_parseReadFile( smr, fileName, NULL, NULL ) ) == NULL ) return( _tpia_target_releaseAndReturnOne( smr, target ) );
161 element = xData_getDocumentsElement( doc );
162 if( strcmp( element->name, "xTarget" ) != 0 ) {
163 tpia_misc_setMessageError_Element( smr, NULL, element, __FILE__, __LINE__, 1, "input file's top element must be xTarget and not %s", element->name ); }
164 else {
165 //pReturnValue = ( xData_copyAttributionList( smr, &(target->attributes), &(element->attributes) ) ) ? NULL : target->path;
166 //fix for gcc4.6 warings 110602
167 xData_copyAttributionList( smr, &(target->attributes),&(element->attributes) );
168 name = tpia_misc_pointerToAttributeIfAllOk2( smr, element, 1, &(target->attributes), "projectile" );
169 if( smr_isOk( smr ) ) target->projectileID = tpia_particle_getInternalID( smr, name );
170 if( smr_isOk( smr ) && ( name = tpia_misc_pointerToAttributeIfAllOk2( smr, element, 1, &(target->attributes), "target" ) ) != NULL ) {
171 if( smr_isOk( smr ) && ( target->targetID = tpia_particle_getInternalID( smr, name ) ) != NULL ) {
172 status = 0;
173 for( nHeated = 0, child = xData_getFirstElement( element ); child != NULL; nHeated++, child = xData_getNextElement( child ) ) {
174 if( strcmp( child->name, "target" ) != 0 ) {
175 tpia_misc_setMessageError_Element( smr, NULL, element, __FILE__, __LINE__, 1, "element can only have target sub-elements%s",
176 element->name );
177 status = 1;
178 break;
179 }
180 }
181 if( status == 0 ) {
182 //if( ( target->heatedTargets = xData_malloc2( smr, nHeated * sizeof( tpia_target_heated_info ), 1, "heatedTargets" ) ) == NULL ) {
183 if( ( target->heatedTargets = (tpia_target_heated_info*) xData_malloc2( smr, nHeated * sizeof( tpia_target_heated_info ), 1, "heatedTargets" ) ) == NULL ) {
184 status = 1; }
185 else {
186 //if( ( target->readHeatedTargets = xData_malloc2( smr, nHeated * sizeof( tpia_target_heated_info * ), 1, "heatedTargets" ) ) == NULL )
187 if( ( target->readHeatedTargets = (tpia_target_heated_info**) xData_malloc2( smr, nHeated * sizeof( tpia_target_heated_info * ), 1, "heatedTargets" ) ) == NULL )
188 status = 1;
189 }
190 for( nHeated = 0, child = xData_getFirstElement( element ); ( status == 0 ) && ( child != NULL );
191 nHeated++, child = xData_getNextElement( child ) ) {
192 if( ( i = xData_convertAttributeToDouble( smr, child, "temperature", &temperature ) ) != 0 ) {
193 if( i > 0 ) smr_setMessageError( smr, NULL, __FILE__, __LINE__, 1, "target does not have a temperature attribute" );
194 status = 1;
195 break;
196 }
197 for( iHeated = 0; iHeated < nHeated; iHeated++ ) if( target->heatedTargets[iHeated].temperature > temperature ) break;
198 if( iHeated < nHeated ) for( i = nHeated; i >= iHeated; i-- ) target->heatedTargets[i+1] = target->heatedTargets[i];
199 target->heatedTargets[iHeated].temperature = temperature;
200 target->heatedTargets[iHeated].path = NULL;
201 target->heatedTargets[iHeated].contents = NULL;
202 target->heatedTargets[iHeated].heatedTarget = NULL;
203 if( ( contents = xData_getAttributesValueInElement( child, "contents" ) ) != NULL ) {
204 if( ( target->heatedTargets[iHeated].contents = xDataMisc_allocateCopyString2( smr, contents, "contents" ) ) == NULL ) {
205 status = 1;
206 break;
207 }
208 }
209 if( ( contents = xData_getAttributesValueInElement( child, "file" ) ) == NULL ) {
210 status = 1;
211 break;
212 }
213 //if((target->heatedTargets[iHeated].path = xData_malloc2(smr, strlen( target->absPath ) + strlen( contents ) + 2, 0, "path")) == NULL) {
214 if((target->heatedTargets[iHeated].path = (char*) xData_malloc2(smr, strlen( target->absPath ) + strlen( contents ) + 2, 0, "path")) == NULL) {
215 status = 1;
216 break;
217 }
218 strcpy( target->heatedTargets[iHeated].path, target->absPath );
219 *strrchr( target->heatedTargets[iHeated].path, '/' ) = 0;
220 strcat( target->heatedTargets[iHeated].path, "/" );
221 strcat( target->heatedTargets[iHeated].path, contents );
222 target->nHeatedTargets++;
223 }
224 }
225 }
226 }
227 }
228 xData_parseFree( smr, doc );
229 if( status == 0 ) {
230 for( i = 0; i < nHeated; i++ ) target->heatedTargets[i].ordinal = i;
231 for( i = 0; i < nHeated; i++ ) if( target->heatedTargets[i].contents == NULL ) break;
232 if( i == nHeated ) i = 0; /* All heated targets are crossSection only. */
233 if( tpia_target_readHeatedTarget( smr, target, i, 0 ) == 0 ) {
234 target->baseHeatedTarget = target->heatedTargets[i].heatedTarget; }
235 else {
236 tpia_target_release( NULL, target );
237 status = 1;
238 } }
239 else {
240 tpia_target_release( smr, target );
241 }
242 return( status );
243}
tpia_particle * projectileID
Definition: tpia_target.h:297
char * absPath
Definition: tpia_target.h:296
tpia_particle * targetID
Definition: tpia_target.h:298
xData_attributionList attributes
Definition: xData.h:186
char * name
Definition: xData.h:184
int tpia_misc_setMessageError_Element(statusMessageReporting *smr, void *userInterface, xData_element *element, const char *file, int line, int code, const char *fmt,...)
Definition: tpia_misc.cc:183
#define tpia_misc_pointerToAttributeIfAllOk2(smr, element, required, attributes, name)
Definition: tpia_misc.h:42
tpia_particle * tpia_particle_getInternalID(statusMessageReporting *smr, const char *const name)
int xData_convertAttributeToDouble(statusMessageReporting *smr, xData_element *element, const char *name, double *d)
Definition: xData.cc:730
char * xDataMisc_getAbsPath(statusMessageReporting *smr, const char *fileName)
Definition: xDataMisc.cc:112
#define xDataMisc_allocateCopyString2(smr, s, forItem)
Definition: xData.h:315
int xData_copyAttributionList(statusMessageReporting *smr, xData_attributionList *dest, xData_attributionList *src)
Definition: xData.cc:564
const char * xData_getAttributesValueInElement(xData_element *element, const char *name)
Definition: xData.cc:546
void * xData_parseFree(statusMessageReporting *smr, xData_document *xData_doc)
Definition: xData.cc:208
xData_element * xData_getNextElement(xData_element *element)
Definition: xData.cc:478
xData_element * xData_getDocumentsElement(xData_document *xData_doc)
Definition: xData.cc:476
xData_element * xData_getFirstElement(xData_element *element)
Definition: xData.cc:477
xData_document * xData_parseReadFile(statusMessageReporting *smr, const char *fileName, xData_xDataTypeOk func, void *userData)
Definition: xData.cc:84

Referenced by tpia_target_createRead(), and tpia_target_readFromMap().

◆ tpia_target_readFromMap()

int tpia_target_readFromMap ( statusMessageReporting smr,
tpia_target target,
tpia_map map,
const char *  evaluation,
const char *  projectileName,
const char *  targetName 
)

Definition at line 82 of file tpia_target.cc.

83 {
84
85 char *targetPath;
86
87 if( ( targetPath = tpia_map_findTarget( smr, map, evaluation, projectileName, targetName ) ) == NULL ) return( 1 );
88 return( tpia_target_read( smr, target, targetPath ) );
89}

◆ tpia_target_readHeatedTarget()

int tpia_target_readHeatedTarget ( statusMessageReporting smr,
tpia_target target,
int  index,
int  checkElememtsForAccess 
)

Definition at line 266 of file tpia_target.cc.

266 {
267
268 int i;
269
270 if( ( index < 0 ) || ( index >= target->nHeatedTargets ) ) {
271 smr_setMessageError( smr, NULL, __FILE__, __LINE__, 1, "temperature index = %d out of range (0 <= index < %d", index, target->nHeatedTargets );
272 return( -1 );
273 }
274 if( target->heatedTargets[index].heatedTarget != NULL ) return( 1 );
275 target->heatedTargets[index].heatedTarget = tpia_target_heated_createRead( smr, target->heatedTargets[index].path, checkElememtsForAccess );
276 if( target->heatedTargets[index].heatedTarget != NULL ) {
277 target->heatedTargets[index].heatedTarget->ordinal = target->heatedTargets[index].ordinal;
278 for( i = target->nReadHeatedTargets; i > 0; i-- ) {
279 if( target->readHeatedTargets[i-1]->temperature < target->heatedTargets[index].temperature ) break;
280 target->readHeatedTargets[i] = target->readHeatedTargets[i-1];
281 }
282 target->readHeatedTargets[i] = &(target->heatedTargets[i]);
283 target->nReadHeatedTargets++;
284 }
285 return( ( target->heatedTargets[index].heatedTarget == NULL ? -1 : 0 ) );
286}
tpia_target_heated * tpia_target_heated_createRead(statusMessageReporting *smr, const char *fileName, int checkElememtsForAccess)

Referenced by G4GIDI_target::readTemperature(), tpia_target_getHeatedTargetAtIndex_ReadIfNeeded(), and tpia_target_read().

◆ tpia_target_release()

int tpia_target_release ( statusMessageReporting smr,
tpia_target target 
)

Definition at line 117 of file tpia_target.cc.

117 {
118
119 int i;
120
121 //target->path = xData_free( smr, target->path );
122 target->path = (char*) xData_free( smr, target->path );
123 //target->absPath = xData_free( smr, target->absPath );
124 target->absPath = (char*) xData_free( smr, target->absPath );
125 xData_releaseAttributionList( smr, &(target->attributes) );
126 for( i = 0; i < target->nHeatedTargets; i++ ) {
127 //target->heatedTargets[i].path = xData_free( smr, target->heatedTargets[i].path );
128 target->heatedTargets[i].path = (char*) xData_free( smr, target->heatedTargets[i].path );
129 //target->heatedTargets[i].contents = xData_free( smr, target->heatedTargets[i].contents );
130 target->heatedTargets[i].contents = (char*) xData_free( smr, target->heatedTargets[i].contents );
131 if( target->heatedTargets[i].heatedTarget != NULL ) tpia_target_heated_free( smr, target->heatedTargets[i].heatedTarget );
132 }
133 //target->heatedTargets = xData_free( smr, target->heatedTargets );
135 //target->readHeatedTargets = xData_free( smr, target->readHeatedTargets );
137 tpia_target_initialize( smr, target );
138 return( 0 );
139}
tpia_target_heated * tpia_target_heated_free(statusMessageReporting *smr, tpia_target_heated *target)
int xData_releaseAttributionList(statusMessageReporting *smr, xData_attributionList *attributes)
Definition: xData.cc:611

Referenced by tpia_target_free(), and tpia_target_read().

◆ tpia_target_sampleIndexChannelProductsAtE()

int tpia_target_sampleIndexChannelProductsAtE ( statusMessageReporting smr,
tpia_target target,
int  index,
double  T,
tpia_decaySamplingInfo decaySamplingInfo,
int  nProductData,
tpia_productOutgoingData productData 
)

Definition at line 404 of file tpia_target.cc.

405 {
406
407 return( tpia_target_heated_sampleIndexChannelProductsAtE( smr, target->baseHeatedTarget, index, decaySamplingInfo,
408 nProductData, productData ) );
409}
int tpia_target_heated_sampleIndexChannelProductsAtE(statusMessageReporting *smr, tpia_target_heated *target, int index, tpia_decaySamplingInfo *decaySamplingInfo, int nProductData, tpia_productOutgoingData *productData)