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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_pop.cc (Version 11.3.0) and /processes/hadronic/models/lend/src/MCGIDI_pop.cc (Version 10.1)


  1 /*                                                  1 
  2 # <<BEGIN-copyright>>                             
  3 # <<END-copyright>>                               
  4 */                                                
  5                                                   
  6 #include <string.h>                               
  7 #include <PoPs.h>                                 
  8                                                   
  9 #include "MCGIDI.h"                               
 10                                                   
 11 #if defined __cplusplus                           
 12 namespace GIDI {                                  
 13 using namespace GIDI;                             
 14 #endif                                            
 15                                                   
 16 /*                                                
 17 **********************************************    
 18 */                                                
 19 MCGIDI_POPs *MCGIDI_POPs_new( statusMessageRep    
 20                                                   
 21     MCGIDI_POPs *pops;                            
 22                                                   
 23     if( ( pops = (MCGIDI_POPs *) smr_malloc2(     
 24     if( MCGIDI_POPs_initial( smr, pops, size )    
 25     return( pops );                               
 26 }                                                 
 27 /*                                                
 28 **********************************************    
 29 */                                                
 30 int MCGIDI_POPs_initial( statusMessageReportin    
 31                                                   
 32     memset( pops, 0, sizeof( MCGIDI_POPs ) );     
 33     if( size < 10 ) size = 10;                    
 34     pops->increment = size;                       
 35                                                   
 36     return( 0 );                                  
 37 }                                                 
 38 /*                                                
 39 **********************************************    
 40 */                                                
 41 void *MCGIDI_POPs_free( MCGIDI_POPs *pops ) {     
 42                                                   
 43     if( pops == NULL ) return( NULL );            
 44     MCGIDI_POPs_release( pops );                  
 45     smr_freeMemory( (void **) &pops );            
 46     return( NULL );                               
 47 }                                                 
 48 /*                                                
 49 **********************************************    
 50 */                                                
 51 int MCGIDI_POPs_release( MCGIDI_POPs *pops ) {    
 52                                                   
 53     MCGIDI_POP *pop, *next;                       
 54                                                   
 55     if( pops == NULL ) return( 0 );               
 56     for( pop = pops->first; pop != NULL; pop =    
 57         next = pop->next;                         
 58         MCGIDI_POP_free( pop );                   
 59     }                                             
 60     smr_freeMemory( (void **) &(pops->sorted)     
 61     MCGIDI_POPs_initial( NULL, pops, 0 );         
 62     return( 0 );                                  
 63 }                                                 
 64 /*                                                
 65 **********************************************    
 66 */                                                
 67 MCGIDI_POP *MCGIDI_POPs_addParticleIfNeeded( s    
 68         double level_MeV, MCGIDI_POP *parent,     
 69                                                   
 70     int i, index;                                 
 71     MCGIDI_POP *pop;                              
 72                                                   
 73     if( ( index = MCGIDI_POPs_findParticleInde    
 74     if( pops->size == pops->numberOfPOPs ) {      
 75         int size = pops->size + pops->incremen    
 76         MCGIDI_POP **sorted = (MCGIDI_POP **)     
 77                                                   
 78         if( sorted == NULL ) return( NULL );      
 79         for( i = 0; i < pops->numberOfPOPs; i+    
 80         smr_freeMemory( (void **) &(pops->sort    
 81         pops->sorted = sorted;                    
 82         pops->size = size;                        
 83     }                                             
 84     index = -index - 1;                           
 85     if( ( pop = MCGIDI_POP_new( smr, name, mas    
 86     for( i = pops->numberOfPOPs; i > index; i-    
 87     pops->sorted[index] = pop;                    
 88     if( pops->first == NULL ) {                   
 89         pops->first = pop; }                      
 90     else {                                        
 91         pops->last->next = pop;                   
 92     }                                             
 93     pops->last = pop;                             
 94     pops->numberOfPOPs++;                         
 95     pop->globalPoPsIndex = -1;                    
 96     if( globalParticle ) {                        
 97         if( ( pop->globalPoPsIndex = lPoPs_add    
 98     }                                             
 99     return( pop );                                
100 }                                                 
101 /*                                                
102 **********************************************    
103 */                                                
104 int MCGIDI_POPs_findParticleIndex( MCGIDI_POPs    
105                                                   
106     int iCmp = 0, min = 0, mid = 0, max = pops    
107                                                   
108     if( max == 0 ) return( -1 );                  
109     while( ( max - min ) > 1 ) {                  
110         mid = ( min + max ) / 2;                  
111         iCmp = strcmp( name, pops->sorted[mid]    
112         if( iCmp == 0 ) return( mid );            
113         if( iCmp < 0 ) {                          
114             max = mid; }                          
115         else {                                    
116             min = mid;                            
117         }                                         
118     }  // Loop checking, 11.05.2015, T. Koi       
119     if( max == 1 ) {            /* First point    
120         if( strcmp( name, pops->sorted[0]->nam    
121     }                                             
122     if( max < pops->numberOfPOPs ) {              
123         if( strcmp( name, pops->sorted[max]->n    
124     }                                             
125     if( max == 1 ) {                              
126         if( strcmp( name, pops->sorted[0]->nam    
127     }                                             
128     return( -max - 1 );                           
129 }                                                 
130 /*                                                
131 **********************************************    
132 */                                                
133 MCGIDI_POP *MCGIDI_POPs_findParticle( MCGIDI_P    
134                                                   
135     int index = MCGIDI_POPs_findParticleIndex(    
136                                                   
137     if( index < 0 ) return( NULL );               
138     return( pops->sorted[index] );                
139 }                                                 
140 /*                                                
141 **********************************************    
142 */                                                
143 void MCGIDI_POPs_writeSortedList( MCGIDI_POPs     
144                                                   
145     int i;                                        
146                                                   
147     fprintf( f, "POPs Information: n = %d\n",     
148     for( i = 0; i < pops->numberOfPOPs; i++ )     
149 }                                                 
150 /*                                                
151 **********************************************    
152 */                                                
153 void MCGIDI_POPs_printSortedList( MCGIDI_POPs     
154                                                   
155     MCGIDI_POPs_writeSortedList( pops, stdout     
156 }                                                 
157                                                   
158                                                   
159 /*                                                
160 ********* MCGIDI_POP routines *********           
161 */                                                
162 /*                                                
163 **********************************************    
164 */                                                
165 MCGIDI_POP *MCGIDI_POP_new( statusMessageRepor    
166                                                   
167     int Z, A, m, level;                           
168     MCGIDI_POP *pop = (MCGIDI_POP *) smr_mallo    
169                                                   
170     if( pop == NULL ) return( NULL );             
171     pop->next = NULL;                             
172     pop->parent = parent;                         
173     if( ( pop->name = smr_allocateCopyString2(    
174         smr_freeMemory( (void **) &pop );         
175         return( NULL );                           
176     }                                             
177     MCGIDI_miscNameToZAm( smr, name, &Z, &A, &    
178     pop->Z = Z;                                   
179     pop->A = A;                                   
180     pop->level = level;                           
181     pop->m = m;                                   
182     pop->mass_MeV = mass_MeV;                     
183     pop->level_MeV = level_MeV;                   
184     pop->numberOfGammaBranchs = 0;                
185     pop->gammas = NULL;                           
186     return( pop );                                
187 }                                                 
188 /*                                                
189 **********************************************    
190 */                                                
191 MCGIDI_POP *MCGIDI_POP_free( MCGIDI_POP *pop )    
192                                                   
193     if( pop == NULL ) return( NULL );             
194     MCGIDI_POP_release( pop );                    
195     smr_freeMemory( (void **) &pop );             
196     return( NULL );                               
197 }                                                 
198 /*                                                
199 **********************************************    
200 */                                                
201 MCGIDI_POP *MCGIDI_POP_release( MCGIDI_POP *po    
202                                                   
203     if( pop == NULL ) return( NULL );             
204     smr_freeMemory( (void **) &(pop->name) );     
205     pop->numberOfGammaBranchs = 0;                
206     if( pop->gammas != NULL ) smr_freeMemory(     
207     return( NULL );                               
208 }                                                 
209 /*                                                
210 **********************************************    
211 */                                                
212 double MCGIDI_POP_getMass_MeV( MCGIDI_POP *pop    
213                                                   
214     return( pop->mass_MeV );                      
215 }                                                 
216                                                   
217 #if defined __cplusplus                           
218 }                                                 
219 #endif                                            
220                                                   
221