13 #if defined __cplusplus    18 #define incrementalSize 1000    22 #define AMU2MeV 931.494028    23 #define AMU2eV ( MeV2eV * 931.494028 )    24 #define K2MeV 8.6173856922566752e-11    25 #define K2eV ( MeV2eV * K2MeV )    49     { 
"MeV", 
"eV", 
MeV2eV }, { 
"MeV", 
"keV", 
MeV2keV }, { 
"K", 
"MeV", 
K2MeV }, { 
"K", 
"eV", 
K2eV } };
    51 static char const *
PoPs_genreStrings[] = { 
"invalid", 
"unknown", 
"alias", 
"photon", 
"lepton", 
"quark", 
"meson", 
"baryon", 
"nucleus", 
"atom" };
    75     if( referenceCount < 0 ) 
return( -1 );
    76     return( ++referenceCount );
    91     if( referenceCount != 0 ) 
return( referenceCount );
   120     if( index >= 0 ) 
return( popsRoot.
pops[PoPs_particleProperIndex( popsRoot.
sorted[index]->
index )] );
   125         if( pops == NULL ) 
return( NULL );
   126         sorted = &(pops[size]);
   128             pops[i] = popsRoot.
pops[i];
   129             sorted[i] = popsRoot.
sorted[i];
   132         popsRoot.
pops = pops;
   163     if( index >= 0 ) 
return( popsRoot.
pops[index] );
   165     if( ( newPoP = (
PoP *) 
smr_malloc2( smr, 
sizeof( 
PoP ), 0, 
"newPoP" ) ) == NULL ) 
return( NULL );
   184         if( pop->
index < 0 ) {
   242     if( high == 0 ) 
return( -1 );
   243     while( ( high - low ) > 1 ) {
   244         mid = ( low + high ) >> 1;
   245         iCmp = strcmp( name, popsRoot.
sorted[mid]->
name );
   246         if( iCmp == 0 ) 
return( mid );
   254         if( !strcmp( name, popsRoot.
sorted[0]->
name ) ) 
return( 0 );            
   255         if( strcmp( name, popsRoot.
sorted[0]->
name ) < 0 ) 
return( -1 );        
   258         if( strcmp( name, popsRoot.
sorted[high]->
name ) == 0 ) 
return( high );
   269     if( index < 0 ) 
return( -1. );
   281     return( popsRoot.
pops[index]->
name );
   329     if( index < 0 ) 
return( -1 );
   353     if( index < 0 ) 
return( -1 );
   369     if( protonIsNucleus ) {
   370         if( strcmp( 
"p", popsRoot.
pops[index]->
name ) == 0 ) 
return( 1 );
   381     if( index < 0 ) 
return( NULL );
   391     if( atomIndex < 0 ) 
return( NULL );
   392     return( popsRoot.
pops[atomIndex]->
name );
   401     if( index < 0 ) 
return( index );
   409     char const *p = NULL;
   418     if(      strcmp( 
"p", popsRoot.
pops[index]->
name ) == 0 ) {
   422         else if( strcmp( 
"h2", popsRoot.
pops[index]->
name ) == 0 ) {
   424         else if( strcmp( 
"h3", popsRoot.
pops[index]->
name ) == 0 ) {
   426         else if( strcmp( 
"he3", popsRoot.
pops[index]->
name ) == 0 ) {
   428         else if( strcmp( 
"he4", popsRoot.
pops[index]->
name ) == 0 ) {
   441     return( popsRoot.
pops[index] );
   450     return( PoPs_genreStrings[genre] );
   467     fprintf( f, 
"Mass units: number of units = %d\n", unitsRoot.
numberOfUnits );
   469         fprintf( f, 
" %s", unitsRoot.
unsorted[i1] );
   471     fprintf( f, 
"\n\n" );
   472     fprintf( f, 
"Particles: number of particles = %d\n", popsRoot.
numberOfParticles );
   473     fprintf( f, 
" name                      index   genre            mass             hasNucleus    alias info\n" );
   474     fprintf( f, 
"                                                                           Z   A l\n" );
   475     fprintf( f, 
" --------------------------------------------------------------------------------------------\n" );
   478             pop = popsRoot.
sorted[i1]; }
   480             pop = popsRoot.
pops[i1];
   486             fprintf( f, 
" T" ); }
   491             fprintf( f, 
" T" ); }
   495         if( pop->
Z + pop->
A > 0 ) {
   496             fprintf( f, 
" %3d %3d", pop->
Z, pop->
A );
   498                 fprintf( f, 
" %d", pop->
l ); }
   506             fprintf( f, 
" %s (%d)", popsRoot.
pops[properIndex]->
name, popsRoot.
pops[properIndex]->
index ); }
   510             for( aliasIndex = pop->
aliasIndex; aliasIndex >= 0; aliasIndex = popsRoot.
pops[aliasIndex]->
aliasIndex ) fprintf( f, 
" %d", aliasIndex );
   526     if( ( pop = (
PoP *) 
smr_malloc2( smr, 
sizeof( 
PoP ), 0, 
"pop" ) ) == NULL ) 
return( NULL );
   589     if( ( pop = 
PoP_new( smr ) ) == NULL ) 
return( NULL );
   614     return( pop->
index );
   628     double mass = -1., ratio;
   635         mass = pop->
mass * ratio;
   652     if( properIndex < 0 ) {
   656     if( aliasIndex >= 0 ) {     
   657         PoP *truePop = popsRoot.
pops[aliasIndex];
   659         for( pop = truePop; strcmp( alias, pop->
name ); pop = popsRoot.
pops[aliasIndex] ) aliasIndex = pop->
aliasIndex;
   666                 alias, truePop->
name, name );
   670         if( ( pop = 
PoP_new( smr ) ) == NULL ) 
return( NULL );
   705         if( strcmp(  unit, unitsRoot.
unsorted[i] ) == 0 ) 
return( unitsRoot.
unsorted[i] );
   709         char const **unsorted = (
char const **) 
smr_malloc2( smr, size * 
sizeof( 
char * ), 0, 
"unsorted" );
   711         if( unsorted == NULL ) 
return( NULL );
   730         if( !strcmp( unit, unitsRoot.
unsorted[i] ) ) 
return( i );
   739     if( ( index < 0 ) || ( index >= unitsRoot.
numberOfUnits ) ) {
   743     return( unitsRoot.
unsorted[index] );
   750     int i, 
n = 
sizeof( 
conversions ) / 
sizeof( conversions[0] );
   753     if( strcmp( _from, _to ) == 0 ) 
return( 0 );
   754     for( i = 0; i < 
n; i++ ) {
   755         if( strcmp( conversions[i]._from, _from ) == 0 ) {
   756             if( strcmp( conversions[i]._to, _to ) == 0 ) {
   757                 *ratio = conversions[i].
ratio;
   760         else if( strcmp( conversions[i]._to, _from ) == 0 ) {
   761             if( strcmp( conversions[i]._from, _to ) == 0 ) {
   762                 *ratio = 1. / conversions[i].
ratio;
   776     return( 
PoPs_Bcast2( smr, comm, rank, &unitsRoot, &popsRoot ) );
   780 #if defined __cplusplus 
int PoPs_unitConversionRatio(char const *_from, char const *_to, double *ratio)
 
#define smr_allocateCopyString2(smr, s, forItem)
 
PoP * PoPs_addAliasIfNeeded(statusMessageReporting *smr, char const *name, char const *alias)
 
static int referenceCount
 
char const  * PoPs_genreTokenToString(enum PoPs_genre genre)
 
#define POPS_VERSION_PATCHLEVEL
 
int PoPs_readDatabase(statusMessageReporting *smr, char const *fileName)
 
int PoPs_versionMinor(void)
 
int PoPs_particleIndex(char const *name)
 
int PoPs_particleReadDatabase(statusMessageReporting *smr, char const *name)
 
static char versionStr[64]
 
int PoP_copyParticle(statusMessageReporting *smr, PoP *desc, PoP *src)
 
static int PoPs_particleProperIndex(int index)
 
#define POPS_VERSION_MINOR
 
enum PoPs_genre PoPs_getGenre(statusMessageReporting *smr, char const *name)
 
int PoPs_numberOfParticle(void)
 
static int unitsDB_release(void)
 
int PoPs_getAtomsIndex(statusMessageReporting *smr, char const *name)
 
static int PoPs_sortedParticleIndex(char const *name)
 
static unitConversions conversions[]
 
enum PoPs_genre PoPs_getGenre_atIndex(statusMessageReporting *smr, int index)
 
int PoPs_hasNucleus(statusMessageReporting *smr, char const *name, int protonIsNucleus)
 
int PoPs_getAtomsIndex_atIndex(statusMessageReporting *smr, int index)
 
double PoPs_getMassInUnitOf(statusMessageReporting *smr, char const *name, char const *unit)
 
int PoPs_Bcast2(statusMessageReporting *smr, MPI_Comm comm, int bossRank, unitsDB *unitsRoot, PoPs *popsRoot)
 
int PoPs_particleIndex_smr(statusMessageReporting *smr, char const *name, char const *file, int line, char const *func)
 
int unitsDB_index(statusMessageReporting *, char const *unit)
 
double A(double temperature)
 
#define smr_setReportError2(smr, libraryID, code, fmt,...)
 
char const  * unitsDB_addUnitIfNeeded(statusMessageReporting *smr, char const *unit)
 
static char const  * PoPs_genreStrings[]
 
const char * PoPs_version(void)
 
int PoPs_getZ_A_l(statusMessageReporting *smr, char const *name, int *Z, int *A, int *l)
 
int PoP_setZ_A_l(statusMessageReporting *, PoP *pop, int Z, int A, int l)
 
int PoPs_releasePrivate(statusMessageReporting *)
 
PoP * PoP_makeAlias(statusMessageReporting *smr, char const *name, char const *alias)
 
#define smr_malloc2(smr, size, zero, forItem)
 
char const  * PoPs_getName_atIndex(statusMessageReporting *smr, int index)
 
char const  * PoP_getName(PoP *pop)
 
#define POPS_VERSION_MAJOR
 
PoP * PoP_makeParticle(statusMessageReporting *smr, enum PoPs_genre genre, char const *name, double mass, char const *massUnit)
 
double PoPs_getMassInUnitOf_atIndex(statusMessageReporting *smr, int index, char const *unit)
 
void * smr_freeMemory(void **p)
 
PoP * PoP_new(statusMessageReporting *smr)
 
int smr_setReportError(statusMessageReporting *smr, void *userInterface, char const *file, int line, char const *function, int libraryID, int code, char const *fmt,...)
 
char const  * unitsDB_stringFromIndex(statusMessageReporting *smr, int index)
 
int PoPs_hasNucleus_atIndex(statusMessageReporting *smr, int index, int protonIsNucleus)
 
int PoPs_versionMajor(void)
 
int PoPs_getZ_A_l_atIndex(statusMessageReporting *smr, int index, int *Z, int *A, int *l)
 
PoP * PoPs_addParticleIfNeeded(statusMessageReporting *smr, PoP *pop)
 
PoP * PoPs_copyAddParticleIfNeeded(statusMessageReporting *smr, PoP *pop)
 
void * MPI_Comm
to pass hd2mpi //////////////////////////////////////////// 
 
int PoPs_release(statusMessageReporting *smr)
 
double PoP_getMassInUnitOf(statusMessageReporting *smr, PoP *pop, char const *unit)
 
int PoPs_versionPatchLevel(void)
 
PoP * PoPs_getParticle_atIndex(int index)
 
int PoP_release(PoP *pop)
 
int PoP_getIndex(PoP *pop)
 
char const  * PoPs_getAtomsName_atIndex(statusMessageReporting *smr, int index)
 
int PoP_initialize(statusMessageReporting *, PoP *pop)
 
char const  * PoPs_getAtomsName(statusMessageReporting *smr, char const *name)
 
void PoPs_print(int sorted)
 
void PoPs_write(FILE *f, int sorted)