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 10.5 ] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

Diff markup

Differences between /processes/hadronic/models/lend/src/MCGIDI_particle.cc (Version 11.3.0) and /processes/hadronic/models/lend/src/MCGIDI_particle.cc (Version 6.0)


  1 /*                                                  1 
  2 # <<BEGIN-copyright>>                             
  3 # <<END-copyright>>                               
  4 */                                                
  5 #include <string.h>                               
  6 #include "MCGIDI.h"                               
  7                                                   
  8 #if defined __cplusplus                           
  9 namespace GIDI {                                  
 10 using namespace GIDI;                             
 11 #endif                                            
 12                                                   
 13 static int initialSizeOfList = 1000, increment    
 14 static int numberOfParticles = 0, sizeOfPartic    
 15 static MCGIDI_particle **particleSortedList =     
 16 static MCGIDI_particle *particleList = NULL, *    
 17 /*                                                
 18 **********************************************    
 19 */                                                
 20 MCGIDI_particle *MCGIDI_particle_new( statusMe    
 21                                                   
 22     MCGIDI_particle *particle = (MCGIDI_partic    
 23                                                   
 24     if( particle == NULL ) return( NULL );        
 25     MCGIDI_particle_initialize( smr, particle     
 26     return( particle );                           
 27 }                                                 
 28 /*                                                
 29 **********************************************    
 30 */                                                
 31 int MCGIDI_particle_initialize( statusMessageR    
 32                                                   
 33     memset( particle, 0, sizeof( MCGIDI_partic    
 34     return( 0 );                                  
 35 }                                                 
 36 /*                                                
 37 **********************************************    
 38 */                                                
 39 MCGIDI_particle *MCGIDI_particle_free( statusM    
 40                                                   
 41     int i, j;                                     
 42     MCGIDI_particle **p;                          
 43                                                   
 44     for( i = 0, p = particleSortedList; i < nu    
 45         if( *p == particle ) {                    
 46             numberOfParticles--;                  
 47             for( j = i; j < numberOfParticles;    
 48             break;                                
 49         }                                         
 50     }                                             
 51     if( particle == particleListEnd ) particle    
 52     if( particle == particleList ) particleLis    
 53     if( particle->prior != NULL ) particle->pr    
 54     if( particle->next != NULL ) particle->nex    
 55     MCGIDI_particle_release( smr, particle );     
 56     smr_freeMemory( (void **) &particle );        
 57     return( NULL );                               
 58 }                                                 
 59 /*                                                
 60 **********************************************    
 61 */                                                
 62 int MCGIDI_particle_release( statusMessageRepo    
 63                                                   
 64     smr_freeMemory( (void **) &(particle->name    
 65     return( 0 );                                  
 66 }                                                 
 67 /*                                                
 68 **********************************************    
 69 */                                                
 70 int MCGIDI_particle_freeInternalList( statusMe    
 71                                                   
 72     while( particleList != NULL ) MCGIDI_parti    
 73     particleSortedList = (MCGIDI_particle **)     
 74     return( 0 );                                  
 75 }                                                 
 76 /*                                                
 77 **********************************************    
 78 */                                                
 79 MCGIDI_particle *MCGIDI_particle_getInternalID    
 80                                                   
 81     int i, iCmp, min, mid, max, Z, A, m, level    
 82     MCGIDI_particle *particle;                    
 83     MCGIDI_POP *pop;                              
 84                                                   
 85     iCmp = 0;                                     
 86     min = mid = 0;                                
 87     max = numberOfParticles;                      
 88     while( min != max ) {  // Loop checking, 1    
 89         mid = ( min + max ) / 2;                  
 90         iCmp = strcmp( name, particleSortedLis    
 91         if( iCmp == 0 ) return( particleSorted    
 92         if( iCmp < 0 ) {                          
 93             max = mid - 1;                        
 94             if( mid == 0 ) max = 0; }             
 95         else {                                    
 96             min = mid + 1;                        
 97             if( min > max ) min = max;            
 98         }                                         
 99     }                                             
100     mid = min;                                    
101     if( numberOfParticles > 0 ) {                 
102         iCmp = strcmp( name, particleSortedLis    
103         if( iCmp == 0 ) return( particleSorted    
104         if( ( iCmp < 0 ) && ( mid != 0 ) ) {      
105             mid--;                                
106             iCmp = strcmp( name, particleSorte    
107         }                                         
108     }                                             
109                                                   
110     if( ( particle = MCGIDI_particle_new( smr     
111     if( ( particle->name = smr_allocateCopyStr    
112     if( MCGIDI_miscNameToZAm( smr, name, &Z, &    
113     particle->prior = NULL;                       
114     particle->next = NULL;                        
115     particle->Z = Z;                              
116     particle->A = A;                              
117     particle->m = m;                              
118     if( ( pop = MCGIDI_POPs_findParticle( pops    
119         particle->mass_MeV = MCGIDI_AMU2MeV *     
120     else {                                        
121         particle->mass_MeV = pop->mass_MeV;       
122     }                                             
123     if( !smr_isOk( smr ) ) goto err;              
124                                                   
125     if( sizeOfParticleSortedList < ( numberOfP    
126         if( sizeOfParticleSortedList == 0 ) {     
127             sizeOfParticleSortedList = initial    
128         else {                                    
129             sizeOfParticleSortedList += increm    
130         }                                         
131         if( ( particleSortedList = (MCGIDI_par    
132             "particleSortedList" ) ) == NULL )    
133     }                                             
134                                                   
135     if( particleList == NULL ) {                  
136         particle->ordinal = 0;                    
137         particleListEnd = particleList = parti    
138     else {                                        
139         particle->ordinal = particleListEnd->o    
140         particle->prior = particleListEnd;        
141         particleListEnd->next = particle;         
142         particleListEnd = particle;               
143     }                                             
144                                                   
145     if( ( mid != 0 ) || ( iCmp > 0 ) ) mid++;     
146     for( i = numberOfParticles; i > mid; i-- )    
147     particleSortedList[mid] = particle;           
148     numberOfParticles++;                          
149                                                   
150     return( particle );                           
151                                                   
152 err:                                              
153     MCGIDI_particle_free( smr, particle );        
154     return( NULL );                               
155 }                                                 
156 /*                                                
157 **********************************************    
158 */                                                
159 int MCGIDI_particle_printInternalSortedList( s    
160                                                   
161     int i;                                        
162                                                   
163     for( i = 0; i < numberOfParticles; i++ ) p    
164     return( 0 );                                  
165 }                                                 
166                                                   
167 #if defined __cplusplus                           
168 }                                                 
169 #endif                                            
170                                                   
171