Geant4 11.2.2
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
MCGIDI_product.cc File Reference
#include <string.h>
#include <cmath>
#include "MCGIDI.h"
#include "MCGIDI_misc.h"
#include "MCGIDI_fromTOM.h"

Go to the source code of this file.

Classes

struct  polynomialCallbackArgs_s
 

Typedefs

typedef struct polynomialCallbackArgs_s polynomialCallbackArgs
 

Functions

MCGIDI_productMCGIDI_product_new (statusMessageReporting *smr)
 
int MCGIDI_product_initialize (statusMessageReporting *, MCGIDI_product *product)
 
MCGIDI_productMCGIDI_product_free (statusMessageReporting *smr, MCGIDI_product *product)
 
int MCGIDI_product_release (statusMessageReporting *smr, MCGIDI_product *product)
 
int MCGIDI_product_parseFromTOM (statusMessageReporting *smr, xDataTOM_element *element, MCGIDI_outputChannel *outputChannel, MCGIDI_POPs *pops, MCGIDI_product *product, int *delayedNeutronIndex)
 
int MCGIDI_product_getDomain (statusMessageReporting *smr, MCGIDI_product *product, double *EMin, double *EMax)
 
int MCGIDI_product_setTwoBodyMasses (statusMessageReporting *smr, MCGIDI_product *product, double projectileMass_MeV, double targetMass_MeV, double productMass_MeV, double residualMass_MeV)
 
double MCGIDI_product_getMass_MeV (statusMessageReporting *, MCGIDI_product *product)
 
MCGIDI_target_heatedMCGIDI_product_getTargetHeated (statusMessageReporting *smr, MCGIDI_product *product)
 
double MCGIDI_product_getProjectileMass_MeV (statusMessageReporting *smr, MCGIDI_product *product)
 
double MCGIDI_product_getTargetMass_MeV (statusMessageReporting *smr, MCGIDI_product *product)
 
int MCGIDI_product_sampleMultiplicity (statusMessageReporting *, MCGIDI_product *product, double e_in, double r)
 
int MCGIDI_product_sampleMu (statusMessageReporting *smr, MCGIDI_product *product, MCGIDI_quantitiesLookupModes &modes, MCGIDI_decaySamplingInfo *decaySamplingInfo)
 
int MCGIDI_sampledProducts_initialize (statusMessageReporting *smr, MCGIDI_sampledProductsDatas *sampledProductsDatas, int incrementSize)
 
int MCGIDI_sampledProducts_release (statusMessageReporting *, MCGIDI_sampledProductsDatas *sampledProductsDatas)
 
int MCGIDI_sampledProducts_remalloc (statusMessageReporting *smr, MCGIDI_sampledProductsDatas *sampledProductsDatas)
 
int MCGIDI_sampledProducts_addProduct (statusMessageReporting *smr, MCGIDI_sampledProductsDatas *sampledProductsDatas, MCGIDI_sampledProductsData *sampledProductsData)
 
int MCGIDI_sampledProducts_number (MCGIDI_sampledProductsDatas *sampledProductsDatas)
 
MCGIDI_sampledProductsDataMCGIDI_sampledProducts_getProductAtIndex (MCGIDI_sampledProductsDatas *sampledProductsDatas, int index)
 

Typedef Documentation

◆ polynomialCallbackArgs

Function Documentation

◆ MCGIDI_product_free()

MCGIDI_product * MCGIDI_product_free ( statusMessageReporting * smr,
MCGIDI_product * product )

Definition at line 51 of file MCGIDI_product.cc.

51 {
52
53 MCGIDI_product_release( smr, product );
54 smr_freeMemory( (void **) &product );
55 return( NULL );
56}
int MCGIDI_product_release(statusMessageReporting *smr, MCGIDI_product *product)
void * smr_freeMemory(void **p)

Referenced by MCGIDI_product_new().

◆ MCGIDI_product_getDomain()

int MCGIDI_product_getDomain ( statusMessageReporting * smr,
MCGIDI_product * product,
double * EMin,
double * EMax )

Definition at line 282 of file MCGIDI_product.cc.

282 {
283
284 return( MCGIDI_outputChannel_getDomain( smr, product->outputChannel, EMin, EMax ) );
285}
int MCGIDI_outputChannel_getDomain(statusMessageReporting *smr, MCGIDI_outputChannel *outputChannel, double *EMin, double *EMax)
MCGIDI_outputChannel * outputChannel
Definition MCGIDI.h:399

Referenced by MCGIDI_outputChannel_getDomain().

◆ MCGIDI_product_getMass_MeV()

double MCGIDI_product_getMass_MeV ( statusMessageReporting * smr,
MCGIDI_product * product )

Definition at line 297 of file MCGIDI_product.cc.

297 {
298
299 return( MCGIDI_POP_getMass_MeV( product->pop ) );
300}
double MCGIDI_POP_getMass_MeV(MCGIDI_POP *pop)
MCGIDI_POP * pop
Definition MCGIDI.h:397

Referenced by MCGIDI_outputChannel_parseFromTOM(), and MCGIDI_outputChannel_sampleProductsAtE().

◆ MCGIDI_product_getProjectileMass_MeV()

double MCGIDI_product_getProjectileMass_MeV ( statusMessageReporting * smr,
MCGIDI_product * product )

Definition at line 311 of file MCGIDI_product.cc.

311 {
312
314}
double MCGIDI_outputChannel_getProjectileMass_MeV(statusMessageReporting *smr, MCGIDI_outputChannel *outputChannel)

Referenced by MCGIDI_energy_parseFromTOM(), and MCGIDI_outputChannel_getProjectileMass_MeV().

◆ MCGIDI_product_getTargetHeated()

MCGIDI_target_heated * MCGIDI_product_getTargetHeated ( statusMessageReporting * smr,
MCGIDI_product * product )

Definition at line 304 of file MCGIDI_product.cc.

304 {
305
306 return( MCGIDI_outputChannel_getTargetHeated( smr, product->outputChannel ) );
307}
MCGIDI_target_heated * MCGIDI_outputChannel_getTargetHeated(statusMessageReporting *smr, MCGIDI_outputChannel *outputChannel)

Referenced by MCGIDI_KalbachMann_parseFromTOM(), and MCGIDI_outputChannel_getTargetHeated().

◆ MCGIDI_product_getTargetMass_MeV()

double MCGIDI_product_getTargetMass_MeV ( statusMessageReporting * smr,
MCGIDI_product * product )

Definition at line 318 of file MCGIDI_product.cc.

318 {
319
320 return( MCGIDI_outputChannel_getTargetMass_MeV( smr, product->outputChannel ) );
321}
double MCGIDI_outputChannel_getTargetMass_MeV(statusMessageReporting *smr, MCGIDI_outputChannel *outputChannel)

Referenced by MCGIDI_energy_parseFromTOM(), and MCGIDI_outputChannel_getTargetMass_MeV().

◆ MCGIDI_product_initialize()

int MCGIDI_product_initialize ( statusMessageReporting * smr,
MCGIDI_product * product )

Definition at line 42 of file MCGIDI_product.cc.

42 {
43
44 memset( product, 0, sizeof( MCGIDI_product ) );
45 product->delayedNeutronIndex = -1;
46 return( 0 );
47}
int delayedNeutronIndex
Definition MCGIDI.h:401

Referenced by MCGIDI_product_new(), MCGIDI_product_parseFromTOM(), and MCGIDI_product_release().

◆ MCGIDI_product_new()

MCGIDI_product * MCGIDI_product_new ( statusMessageReporting * smr)

Definition at line 31 of file MCGIDI_product.cc.

31 {
32
33 MCGIDI_product *product;
34
35 if( ( product = (MCGIDI_product *) smr_malloc2( smr, sizeof( MCGIDI_product ), 0, "product" ) ) == NULL ) return( NULL );
36 if( MCGIDI_product_initialize( smr, product ) ) product = MCGIDI_product_free( smr, product );
37 return( product );
38}
int MCGIDI_product_initialize(statusMessageReporting *, MCGIDI_product *product)
MCGIDI_product * MCGIDI_product_free(statusMessageReporting *smr, MCGIDI_product *product)
#define smr_malloc2(smr, size, zero, forItem)

◆ MCGIDI_product_parseFromTOM()

int MCGIDI_product_parseFromTOM ( statusMessageReporting * smr,
xDataTOM_element * element,
MCGIDI_outputChannel * outputChannel,
MCGIDI_POPs * pops,
MCGIDI_product * product,
int * delayedNeutronIndex )

Definition at line 82 of file MCGIDI_product.cc.

83 {
84
85 char const *name{""}, *label{""}, *delayedNeutron{""}, *multiplicityStr{""}, *multiplicityUnits[2] = { "MeV", "" };
86 xDataTOM_element *multiplicity{nullptr}, *multiplicityTOM{nullptr}, *decayChannelElement{nullptr};
87 nfu_status status{nfu_Okay};
88 ptwXYPoints *multiplicityVsEnergy = NULL, *norms1 = NULL, *norms2 = NULL;
89
90 MCGIDI_product_initialize( smr, product );
91
92 product->outputChannel = outputChannel;
93 if( ( name = xDataTOM_getAttributesValueInElement( element, "name" ) ) == NULL ) goto err;
94 if( ( product->pop = MCGIDI_POPs_findParticle( pops, name ) ) == NULL ) {
95 smr_setReportError2( smr, smr_unknownID, 1, "product '%s' not found in pops", name );
96 goto err;
97 }
98 if( ( label = xDataTOM_getAttributesValueInElement( element, "label" ) ) != NULL ) {
99 if( ( product->label = smr_allocateCopyString2( smr, label, "product->label" ) ) == NULL ) goto err;
100 }
101
102 if( ( delayedNeutron = xDataTOM_getAttributesValueInElement( element, "emissionMode" ) ) != NULL ) {
103 if( strcmp( delayedNeutron, "delayed" ) == 0 ) {
104 if( ( delayedNeutron = xDataTOM_getAttributesValueInElement( element, "decayRate" ) ) == NULL ) {
105 goto err;
106 }
107 if( MCGIDI_misc_PQUStringToDoubleInUnitOf( smr, delayedNeutron, "1/s", &(product->delayedNeutronRate) ) != 0 ) goto err;
108 product->delayedNeutronIndex = *delayedNeutronIndex;
109 (*delayedNeutronIndex)++;
110 }
111 }
112
113 if( ( multiplicityStr = xDataTOM_getAttributesValueInElement( element, "multiplicity" ) ) == NULL ) goto err;
114 if( xDataTOME_convertAttributeToInteger( NULL, element, "multiplicity", &(product->multiplicity) ) ) {
115 if( strcmp( multiplicityStr, "energyDependent" ) ) {
116 smr_setReportError2( smr, smr_unknownID, 1, "invalid multiplicity '%s' for product '%s'", multiplicityStr, name );
117 goto err;
118 }
119 if( ( multiplicity = xDataTOME_getOneElementByName( smr, element, "multiplicity", 1 ) ) == NULL ) goto err;
120 if( ( multiplicityTOM = xDataTOME_getOneElementByName( NULL, multiplicity, "weightedReference", 0 ) ) != NULL ) {
121 if( MCGIDI_product_parseWeightedReferenceMultiplicityFromTOM( smr, multiplicityTOM, product, &multiplicityVsEnergy, &norms1 ) ) goto err; }
122 else if( ( multiplicityTOM = xDataTOME_getOneElementByName( NULL, multiplicity, "piecewise", 0 ) ) != NULL ) {
123 if( MCGIDI_product_parsePiecewiseMultiplicity( smr, multiplicityTOM, product ) ) goto err; }
124 else if( ( multiplicityTOM = xDataTOME_getOneElementByName( NULL, multiplicity, "polynomial", 0 ) ) != NULL ) {
125 if( ( multiplicityVsEnergy = MCGIDI_product_parsePolynomialMultiplicity( smr, multiplicityTOM, product ) ) == NULL ) goto err; }
126 else {
127/* ??????? Need to check interpolation. */
128 if( ( multiplicityTOM = xDataTOME_getOneElementByName( smr, multiplicity, "pointwise", 1 ) ) == NULL ) goto err;
129 if( ( multiplicityVsEnergy = MCGIDI_misc_dataFromElement2ptwXYPointsInUnitsOf( smr, multiplicityTOM, multiplicityUnits ) ) == NULL ) goto err;
130 }
131 }
132
133 if( strcmp( product->pop->name, "gamma" ) == 0 ) {
134 if( ( norms2 = ptwXY_new( ptwXY_interpolationLinLin, NULL, 2., 1e-3, 200, 10, &status, 0 ) ) == NULL ) {
135 smr_setReportError2( smr, smr_unknownID, 1, "ptwXY_new err = %d: %s\n", status, nfu_statusMessage( status ) );
136 goto err;
137 }
138 }
139 if( MCGIDI_distribution_parseFromTOM( smr, element, product, pops, norms2 ) ) goto err;
140 if( norms2 != NULL ) {
141 if( ptwXY_length( norms2 ) < 2 ) {
142 norms2 = ptwXY_free( norms2 ); }
143 else {
144 if( ptwXY_simpleCoalescePoints( norms2 ) != nfu_Okay ) goto err;
145 if( ( ptwXY_getYMin( norms2 ) > 0.99 ) && ( ptwXY_getYMax( norms2 ) < 1.01 ) ) norms2 = ptwXY_free( norms2 );
146 }
147 }
148 if( ( norms1 != NULL ) && ( norms2 != NULL ) ) {
149 smr_setReportError2p( smr, smr_unknownID, 1, "norm1 and norm2 are both not NULL" );
150 goto err;
151 }
152
153 product->multiplicityVsEnergy = multiplicityVsEnergy;
154 product->norms = norms1;
155 if( norms2 != NULL ) product->norms = norms2;
156
157 if( ( decayChannelElement = xDataTOME_getOneElementByName( NULL, element, "decayChannel", 0 ) ) != NULL ) {
158 if( MCGIDI_outputChannel_parseFromTOM( smr, decayChannelElement, pops, &(product->decayChannel), NULL, product ) ) goto err;
159 }
160
161 return( 0 );
162
163err:
164 if( multiplicityVsEnergy != NULL ) ptwXY_free( multiplicityVsEnergy );
165 if( norms1 != NULL ) ptwXY_free( norms1 );
166 if( norms2 != NULL ) ptwXY_free( norms2 );
167 MCGIDI_product_release( smr, product );
168 return( 1 );
169}
MCGIDI_POP * MCGIDI_POPs_findParticle(MCGIDI_POPs *pops, char const *name)
int MCGIDI_distribution_parseFromTOM(statusMessageReporting *smr, xDataTOM_element *element, MCGIDI_product *product, MCGIDI_POPs *pops, ptwXYPoints *norms)
int MCGIDI_outputChannel_parseFromTOM(statusMessageReporting *smr, xDataTOM_element *element, MCGIDI_POPs *pops, MCGIDI_outputChannel *outputChannel, MCGIDI_reaction *reaction, MCGIDI_product *parent)
int MCGIDI_misc_PQUStringToDoubleInUnitOf(statusMessageReporting *smr, char const *str, char const *toUnit, double *value)
ptwXYPoints * MCGIDI_misc_dataFromElement2ptwXYPointsInUnitsOf(statusMessageReporting *smr, xDataTOM_element *linear, char const *toUnits[2])
const char * name(G4int ptype)
@ nfu_Okay
enum nfu_status_e nfu_status
const char * nfu_statusMessage(nfu_status status)
double ptwXY_getYMax(ptwXYPoints *ptwXY)
nfu_status ptwXY_simpleCoalescePoints(ptwXYPoints *ptwXY)
ptwXYPoints * ptwXY_new(ptwXY_interpolation interpolation, ptwXY_interpolationOtherInfo const *interpolationOtherInfo, double biSectionMax, double accuracy, int64_t primarySize, int64_t secondarySize, nfu_status *status, int userFlag)
Definition ptwXY_core.cc:29
@ ptwXY_interpolationLinLin
Definition ptwXY.h:35
int64_t ptwXY_length(ptwXYPoints *ptwXY)
ptwXYPoints * ptwXY_free(ptwXYPoints *ptwXY)
double ptwXY_getYMin(ptwXYPoints *ptwXY)
#define smr_setReportError2(smr, libraryID, code, fmt,...)
#define smr_setReportError2p(smr, libraryID, code, fmt)
#define smr_allocateCopyString2(smr, s, forItem)
#define smr_unknownID
char * name
Definition MCGIDI.h:228
ptwXYPoints * norms
Definition MCGIDI.h:404
double delayedNeutronRate
Definition MCGIDI.h:402
MCGIDI_outputChannel decayChannel
Definition MCGIDI.h:408
ptwXYPoints * multiplicityVsEnergy
Definition MCGIDI.h:403
xDataTOM_element * xDataTOME_getOneElementByName(statusMessageReporting *smr, xDataTOM_element *element, char const *name, int required)
Definition xDataTOM.cc:246
char const * xDataTOM_getAttributesValueInElement(xDataTOM_element *element, char const *name)
Definition xDataTOM.cc:286
int xDataTOME_convertAttributeToInteger(statusMessageReporting *smr, xDataTOM_element *element, char const *name, int *n)
Definition xDataTOM.cc:300

Referenced by MCGIDI_outputChannel_parseFromTOM().

◆ MCGIDI_product_release()

int MCGIDI_product_release ( statusMessageReporting * smr,
MCGIDI_product * product )

Definition at line 60 of file MCGIDI_product.cc.

60 {
61
62 int i;
63
64 if( product->label != NULL ) smr_freeMemory( (void **) &(product->label) );
65
66 if( product->multiplicityVsEnergy != NULL ) ptwXY_free( product->multiplicityVsEnergy );
67 if( product->piecewiseMultiplicities != NULL ) {
68 for( i = 0; i < product->numberOfPiecewiseMultiplicities; i++ ) ptwXY_free( product->piecewiseMultiplicities[i] );
69 smr_freeMemory( (void **) &(product->piecewiseMultiplicities) );
70 }
71 if( product->norms != NULL ) ptwXY_free( product->norms );
72
73 MCGIDI_distribution_release( smr, &(product->distribution) );
75
76 MCGIDI_product_initialize( smr, product );
77 return( 0 );
78}
int MCGIDI_distribution_release(statusMessageReporting *smr, MCGIDI_distribution *distribution)
int MCGIDI_outputChannel_release(statusMessageReporting *smr, MCGIDI_outputChannel *outputChannel)
MCGIDI_distribution distribution
Definition MCGIDI.h:407
int numberOfPiecewiseMultiplicities
Definition MCGIDI.h:405
ptwXYPoints ** piecewiseMultiplicities
Definition MCGIDI.h:406

Referenced by MCGIDI_outputChannel_release(), MCGIDI_product_free(), and MCGIDI_product_parseFromTOM().

◆ MCGIDI_product_sampleMu()

int MCGIDI_product_sampleMu ( statusMessageReporting * smr,
MCGIDI_product * product,
MCGIDI_quantitiesLookupModes & modes,
MCGIDI_decaySamplingInfo * decaySamplingInfo )

Definition at line 348 of file MCGIDI_product.cc.

349 {
350
352 smr_setReportError2( smr, smr_unknownID, 1, "product distribution is not angular: type = %d", product->distribution.type );
353 return( 1 );
354 }
355 return( MCGIDI_angular_sampleMu( smr, product->distribution.angular, modes, decaySamplingInfo ) );
356}
@ MCGIDI_distributionType_angular_e
Definition MCGIDI.h:204
int MCGIDI_angular_sampleMu(statusMessageReporting *smr, MCGIDI_angular *angular, MCGIDI_quantitiesLookupModes &modes, MCGIDI_decaySamplingInfo *decaySamplingInfo)
MCGIDI_angular * angular
Definition MCGIDI.h:379
enum MCGIDI_distributionType type
Definition MCGIDI.h:378

Referenced by G4GIDI_target::getElasticFinalState().

◆ MCGIDI_product_sampleMultiplicity()

int MCGIDI_product_sampleMultiplicity ( statusMessageReporting * smr,
MCGIDI_product * product,
double e_in,
double r )

Definition at line 325 of file MCGIDI_product.cc.

325 {
326
327 int i, multiplicity;
328 double y, norm = 1.0;
329 ptwXYPoints *ptwXY = product->multiplicityVsEnergy;
330
331 if( product->piecewiseMultiplicities != NULL ) {
332 for( i = 0; i < product->numberOfPiecewiseMultiplicities - 1; i++ ) {
333 if( e_in < ptwXY_getXMax( product->piecewiseMultiplicities[i] ) ) break;
334 }
335 ptwXY = product->piecewiseMultiplicities[i];
336 }
337 y = MCGIDI_sampling_ptwXY_getValueAtX( ptwXY, e_in );
338 if( product->norms != NULL ) norm = MCGIDI_sampling_ptwXY_getValueAtX( product->norms, e_in );
339 y *= norm;
340 multiplicity = (int) y;
341 if( r < ( y - multiplicity ) ) multiplicity++;
342
343 return( multiplicity );
344}
double MCGIDI_sampling_ptwXY_getValueAtX(ptwXYPoints *ptwXY, double x1)
double ptwXY_getXMax(ptwXYPoints *ptwXY)

Referenced by MCGIDI_outputChannel_sampleProductsAtE().

◆ MCGIDI_product_setTwoBodyMasses()

int MCGIDI_product_setTwoBodyMasses ( statusMessageReporting * smr,
MCGIDI_product * product,
double projectileMass_MeV,
double targetMass_MeV,
double productMass_MeV,
double residualMass_MeV )

Definition at line 289 of file MCGIDI_product.cc.

290 {
291
292 return( MCGIDI_angular_setTwoBodyMasses( smr, product->distribution.angular, projectileMass_MeV, targetMass_MeV, productMass_MeV, residualMass_MeV ) );
293}
int MCGIDI_angular_setTwoBodyMasses(statusMessageReporting *smr, MCGIDI_angular *angular, double projectileMass_MeV, double targetMass_MeV, double productMass_MeV, double residualMass_MeV)

Referenced by MCGIDI_outputChannel_parseFromTOM().

◆ MCGIDI_sampledProducts_addProduct()

int MCGIDI_sampledProducts_addProduct ( statusMessageReporting * smr,
MCGIDI_sampledProductsDatas * sampledProductsDatas,
MCGIDI_sampledProductsData * sampledProductsData )

Definition at line 398 of file MCGIDI_product.cc.

398 {
399
400 if( sampledProductsDatas->numberOfProducts == sampledProductsDatas->numberAllocated ) {
401 if( ( MCGIDI_sampledProducts_remalloc( smr, sampledProductsDatas ) ) != 0 ) return( 1 );
402 }
403 sampledProductsDatas->products[sampledProductsDatas->numberOfProducts] = *sampledProductsData;
404 sampledProductsDatas->numberOfProducts++;
405 return( 0 );
406}
int MCGIDI_sampledProducts_remalloc(statusMessageReporting *smr, MCGIDI_sampledProductsDatas *sampledProductsDatas)
MCGIDI_sampledProductsData * products
Definition MCGIDI.h:290

Referenced by MCGIDI_outputChannel_sampleProductsAtE(), and MCGIDI_target_sampleNullReactionProductsAtE().

◆ MCGIDI_sampledProducts_getProductAtIndex()

MCGIDI_sampledProductsData * MCGIDI_sampledProducts_getProductAtIndex ( MCGIDI_sampledProductsDatas * sampledProductsDatas,
int index )

Definition at line 417 of file MCGIDI_product.cc.

417 {
418
419 if( index < 0 ) return( NULL );
420 if( index >= sampledProductsDatas->numberOfProducts ) return( NULL );
421 return( &(sampledProductsDatas->products[index]) );
422}

◆ MCGIDI_sampledProducts_initialize()

int MCGIDI_sampledProducts_initialize ( statusMessageReporting * smr,
MCGIDI_sampledProductsDatas * sampledProductsDatas,
int incrementSize )

Definition at line 362 of file MCGIDI_product.cc.

362 {
363
364 if( incrementSize < 10 ) incrementSize = 10;
365 sampledProductsDatas->numberOfProducts = 0;
366 sampledProductsDatas->numberAllocated = 0;
367 sampledProductsDatas->incrementSize = incrementSize;
368 sampledProductsDatas->products = NULL;
369 return( MCGIDI_sampledProducts_remalloc( smr, sampledProductsDatas ) );
370}

Referenced by G4GIDI_target::getFinalState().

◆ MCGIDI_sampledProducts_number()

int MCGIDI_sampledProducts_number ( MCGIDI_sampledProductsDatas * sampledProductsDatas)

Definition at line 410 of file MCGIDI_product.cc.

410 {
411
412 return( sampledProductsDatas->numberOfProducts );
413}

◆ MCGIDI_sampledProducts_release()

int MCGIDI_sampledProducts_release ( statusMessageReporting * smr,
MCGIDI_sampledProductsDatas * sampledProductsDatas )

Definition at line 374 of file MCGIDI_product.cc.

374 {
375
376 smr_freeMemory( (void **) &(sampledProductsDatas->products) );
377 return( 0 );
378}

Referenced by G4GIDI_target::getFinalState().

◆ MCGIDI_sampledProducts_remalloc()

int MCGIDI_sampledProducts_remalloc ( statusMessageReporting * smr,
MCGIDI_sampledProductsDatas * sampledProductsDatas )

Definition at line 382 of file MCGIDI_product.cc.

382 {
383
384 int size = sampledProductsDatas->numberAllocated + sampledProductsDatas->incrementSize;
385
386 if( ( sampledProductsDatas->products = (MCGIDI_sampledProductsData *) smr_realloc2( smr, sampledProductsDatas->products,
387 size * sizeof( MCGIDI_sampledProductsData ), "products" ) ) != NULL ) {
388 sampledProductsDatas->numberAllocated = size;
389 return( 0 );
390 }
391 sampledProductsDatas->numberOfProducts = 0;
392 sampledProductsDatas->numberAllocated = 0;
393 return( 1 );
394}
#define smr_realloc2(smr, old, size, forItem)

Referenced by MCGIDI_sampledProducts_addProduct(), and MCGIDI_sampledProducts_initialize().