Geant4 11.1.1
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
PoPs.h File Reference

Go to the source code of this file.

Classes

struct  PoP_s
 

Macros

#define POPS_VERSION_MAJOR   1
 
#define POPS_VERSION_MINOR   0
 
#define POPS_VERSION_PATCHLEVEL   5
 
#define PoPs_packageSymbol   "PoPs (properties of particles)"
 
#define PoPs_packageName   PoPs_packageSymbol " (properties of particles)"
 

Typedefs

typedef struct PoP_s PoP
 

Enumerations

enum  PoPs_errorTokens { PoPs_errorToken_Okay , PoPs_errorToken_badName , PoPs_errorToken_badIndex , PoPs_errorToken_badUnitConversion }
 
enum  PoPs_genre {
  PoPs_genre_invalid , PoPs_genre_unknown , PoPs_genre_alias , PoPs_genre_photon ,
  PoPs_genre_lepton , PoPs_genre_quark , PoPs_genre_meson , PoPs_genre_baryon ,
  PoPs_genre_nucleus , PoPs_genre_atom
}
 

Functions

const char * PoPs_version (void)
 
int PoPs_versionMajor (void)
 
int PoPs_versionMinor (void)
 
int PoPs_versionPatchLevel (void)
 
int PoPs_register (void)
 
int PoPs_readDatabase (statusMessageReporting *smr, char const *fileName)
 
int PoPs_release (statusMessageReporting *smr)
 
PoPPoPs_addParticleIfNeeded (statusMessageReporting *smr, PoP *pop)
 
PoPPoPs_copyAddParticleIfNeeded (statusMessageReporting *smr, PoP *pop)
 
PoPPoPs_addAliasIfNeeded (statusMessageReporting *smr, char const *name, char const *alias)
 
int PoPs_numberOfParticle (void)
 
int PoPs_particleIndex (char const *name)
 
int PoPs_particleIndex_smr (statusMessageReporting *smr, char const *name, char const *file, int line, char const *func)
 
char const * PoPs_getName_atIndex (statusMessageReporting *smr, int index)
 
double PoPs_getMassInUnitOf (statusMessageReporting *smr, char const *name, char const *unit)
 
double PoPs_getMassInUnitOf_atIndex (statusMessageReporting *smr, int index, char const *unit)
 
enum PoPs_genre PoPs_getGenre (statusMessageReporting *smr, char const *name)
 
enum PoPs_genre PoPs_getGenre_atIndex (statusMessageReporting *smr, int index)
 
int PoPs_getZ_A_l (statusMessageReporting *smr, char const *name, int *Z, int *A, int *l)
 
int PoPs_getZ_A_l_atIndex (statusMessageReporting *smr, int index, int *Z, int *A, int *l)
 
int PoPs_hasNucleus (statusMessageReporting *smr, char const *name, int protonIsNucleus)
 
int PoPs_hasNucleus_atIndex (statusMessageReporting *smr, int index, int protonIsNucleus)
 
char const * PoPs_getAtomsName (statusMessageReporting *smr, char const *name)
 
char const * PoPs_getAtomsName_atIndex (statusMessageReporting *smr, int index)
 
int PoPs_getAtomsIndex (statusMessageReporting *smr, char const *name)
 
int PoPs_getAtomsIndex_atIndex (statusMessageReporting *smr, int index)
 
PoPPoPs_getParticle_atIndex (int index)
 
char const * PoPs_genreTokenToString (enum PoPs_genre genre)
 
void PoPs_print (int sorted)
 
void PoPs_write (FILE *f, int sorted)
 
PoPPoP_new (statusMessageReporting *smr)
 
int PoP_initialize (statusMessageReporting *smr, PoP *pop)
 
int PoP_release (PoP *pop)
 
PoPPoP_free (PoP *pop)
 
int PoP_copyParticle (statusMessageReporting *smr, PoP *desc, PoP *src)
 
PoPPoP_makeParticle (statusMessageReporting *smr, enum PoPs_genre genre, char const *name, double mass, char const *massUnit)
 
int PoP_setZ_A_l (statusMessageReporting *smr, PoP *pop, int Z, int A, int l)
 
int PoP_getIndex (PoP *pop)
 
char const * PoP_getName (PoP *pop)
 
int PoPs_particleReadDatabase (statusMessageReporting *smr, char const *name)
 
PoPPoPs_particleCreateLoadInfo (statusMessageReporting *smr, const char *name)
 
int PoPs_particleLoadInfo (statusMessageReporting *smr, const char *name, PoP *pop)
 
double PoP_getMassInUnitOf (statusMessageReporting *smr, PoP *pop, char const *unit)
 
PoPPoP_makeAlias (statusMessageReporting *smr, char const *name, char const *alias)
 
int PoPs_unitConversionRatio (char const *_from, char const *_to, double *ratio)
 
int lPoPs_addParticleIfNeeded (statusMessageReporting *smr, char const *name, char const *special)
 
int PoPs_setBDFLS_File (char const *name)
 

Variables

int PoPs_smr_ID
 

Macro Definition Documentation

◆ PoPs_packageName

#define PoPs_packageName   PoPs_packageSymbol " (properties of particles)"

Definition at line 32 of file PoPs.h.

◆ PoPs_packageSymbol

#define PoPs_packageSymbol   "PoPs (properties of particles)"

Definition at line 31 of file PoPs.h.

◆ POPS_VERSION_MAJOR

#define POPS_VERSION_MAJOR   1

Definition at line 27 of file PoPs.h.

◆ POPS_VERSION_MINOR

#define POPS_VERSION_MINOR   0

Definition at line 28 of file PoPs.h.

◆ POPS_VERSION_PATCHLEVEL

#define POPS_VERSION_PATCHLEVEL   5

Definition at line 29 of file PoPs.h.

Typedef Documentation

◆ PoP

typedef struct PoP_s PoP

Definition at line 33 of file PoPs.h.

Enumeration Type Documentation

◆ PoPs_errorTokens

Enumerator
PoPs_errorToken_Okay 
PoPs_errorToken_badName 
PoPs_errorToken_badIndex 
PoPs_errorToken_badUnitConversion 

Definition at line 35 of file PoPs.h.

@ PoPs_errorToken_Okay
Definition: PoPs.h:35
@ PoPs_errorToken_badIndex
Definition: PoPs.h:35
@ PoPs_errorToken_badName
Definition: PoPs.h:35
@ PoPs_errorToken_badUnitConversion
Definition: PoPs.h:35

◆ PoPs_genre

enum PoPs_genre
Enumerator
PoPs_genre_invalid 
PoPs_genre_unknown 
PoPs_genre_alias 
PoPs_genre_photon 
PoPs_genre_lepton 
PoPs_genre_quark 
PoPs_genre_meson 
PoPs_genre_baryon 
PoPs_genre_nucleus 
PoPs_genre_atom 

Definition at line 36 of file PoPs.h.

@ PoPs_genre_atom
Definition: PoPs.h:37
@ PoPs_genre_photon
Definition: PoPs.h:36
@ PoPs_genre_nucleus
Definition: PoPs.h:37
@ PoPs_genre_alias
Definition: PoPs.h:36
@ PoPs_genre_unknown
Definition: PoPs.h:36
@ PoPs_genre_invalid
Definition: PoPs.h:36
@ PoPs_genre_lepton
Definition: PoPs.h:36
@ PoPs_genre_baryon
Definition: PoPs.h:37
@ PoPs_genre_quark
Definition: PoPs.h:37
@ PoPs_genre_meson
Definition: PoPs.h:37

Function Documentation

◆ lPoPs_addParticleIfNeeded()

int lPoPs_addParticleIfNeeded ( statusMessageReporting smr,
char const *  name,
char const *  special 
)

Definition at line 36 of file lPoPs.cc.

36 {
37
38 int index = PoPs_particleIndex( name ), ZA, Z = 0, A = 0,/* level = 0,*/ ispecial;
39 char *endptr, name_[256], AStr[32];
40 char const *ZStr, *alias = NULL;
41 PoP *pop, *pop_;
42 /* enum PoPs_genre genre = PoPs_genre_unknown; */
43 char const *yiNames[] = { "p", "h2", "h3", "he3", "he4", "photon" };
44 char const *yiAliases[] = { "h1", "d", "t", "he3", "a", "g" };
45 /* enum PoPs_genre yiGenres[] = { PoPs_genre_baryon, PoPs_genre_nucleus, PoPs_genre_nucleus, PoPs_genre_nucleus,
46 PoPs_genre_nucleus, PoPs_genre_photon }; */
47
48 if( special == NULL ) special = "";
49 if( index < 0 ) {
50 if( isdigit( name[0] ) ) {
51 ZA = (int) strtol( name, &endptr, 10 );
52 if( *endptr != 0 ) {
53 smr_setReportError2( smr, PoPs_smr_ID, PoPs_errorToken_badName, "string '%s' not a value ZA", name );
54 return( -1 );
55 }
56 Z = ZA / 1000;
57 A = ZA % 1000;
58 /*level = 0;*/
59 ispecial = 0;
60 if( strcmp( special, "LLNL" ) == 0 ) {
61 if( ( ZA > 1 ) && ( ZA < 8 ) ) {
62 strcpy( name_, yiNames[ZA-2] );
63 alias = yiAliases[ZA-2];
64 /* genre = yiGenres[ZA-2];*/
65 ispecial = 1; }
66 else if( ( ZA == 1801 ) || ( ZA == 1901 ) ) {
67 strcpy( name_, yiNames[0] );
68 alias = yiAliases[0];
69 /* genre = yiGenres[0]; */
70 ispecial = 1; }
71 else if( ZA == 1902 ) {
72 strcpy( name_, yiNames[1] );
73 alias = yiAliases[1];
74 /* genre = yiGenres[1]; */
75 ispecial = 1; }
76 else if( ZA == 4809 ) {
77 strcpy( name_, "Be9" );
78 /* genre = PoPs_genre_atom; */
79 ispecial = 1; }
80 else if( ZA == 4909 ) {
81 strcpy( name_, "Be9" );
82 /* genre = PoPs_genre_atom; */
83 ispecial = 1; }
84 else if( ZA == 6912 ) {
85 strcpy( name_, "C12" );
86 /* genre = PoPs_genre_atom; */
87 ispecial = 1; }
88 else if( ZA == 8916 ) {
89 strcpy( name_, "O16" );
90 /* genre = PoPs_genre_atom; */
91 ispecial = 1; }
92 else if( ZA == 95242 ) {
93 strcpy( name_, "Am242_e2" );
94 /*level = 2;*/
95 /* genre = PoPs_genre_atom; */
96 ispecial = 1; }
97 else if( Z == 99 ) {
98 if( ( 120 <= A ) && ( A < 126 ) ) {
99 snprintf( name_, sizeof name_, "FissionProductENDL99%d", A );
100 /* genre = PoPs_genre_atom; */
101 ispecial = 1;
102 }
103 }
104 }
105 if( ispecial == 0 ) {
106 if( ZA == 1 ) {
107 AStr[0] = 0; }
108 else if( A == 0 ) {
109 strcpy( AStr, "_natural" ); }
110 else {
111 snprintf( AStr, sizeof AStr, "%d", A );
112 }
113 if( ( ZStr = lPoPs_ZSymbol( Z ) ) == NULL ) {
114 smr_setReportError2( smr, PoPs_smr_ID, PoPs_errorToken_badName, "string '%s' not a value ZA; Z = %d is not supported", name, Z );
115 return( -1 );
116 }
117 snprintf( name_, sizeof name_, "%s%s", ZStr, AStr );
118 /* genre = PoPs_genre_atom; */
119 /* if( ZA == 1 ) genre = PoPs_genre_baryon; */
120 } }
121 else {
122 strcpy( name_, name );
123 ZA = -1;
124 if( strcmp( name, "neutron" ) == 0 ) {
125 strcpy( name_, "n" );
126 alias = name;
127 /* genre = PoPs_genre_baryon; */ }
128 else if( strcmp( name, "electron" ) == 0 ) {
129 strcpy( name_, "e-" );
130 alias = name;
131 /* genre = PoPs_genre_lepton; */ }
132 else if( strcmp( name, "positron" ) == 0 ) {
133 strcpy( name_, "e+" );
134 alias = name;
135 /* genre = PoPs_genre_lepton; */ }
136 else if( ( strcmp( name, "h1" ) == 0 ) || ( strcmp( name, "proton" ) == 0 ) ) {
137 ZA = 2; }
138 else if( ( strcmp( name, "d" ) == 0 ) || ( strcmp( name, "deuteron" ) == 0 ) ) {
139 ZA = 3; }
140 else if( ( strcmp( name, "t" ) == 0 ) || ( strcmp( name, "triton" ) == 0 ) ) {
141 ZA = 4; }
142 else if( strcmp( name, "helium3" ) == 0 ) {
143 ZA = 5; }
144 else if( ( strcmp( name, "a" ) == 0 ) || ( strcmp( name, "alpha" ) == 0 ) || ( strcmp( name, "helium4" ) == 0 ) ) {
145 ZA = 6; }
146 else if( ( strcmp( name, "g" ) == 0 ) || ( strcmp( name, "gamma" ) == 0 ) ) {
147 ZA = 7; }
148 else if( strcmp( name, "FP" ) == 0 ) {
149 strcpy( name_, "FissionProductENDL99120" );
150 /* genre = PoPs_genre_atom; */
151 }
152 if( ZA != -1 ) {
153 strcpy( name_, yiNames[ZA-2] );
154 alias = name;
155 /* genre = yiGenres[ZA-2]; */
156 }
157 }
158
159 if( ( pop = PoPs_particleCreateLoadInfo( smr, name_ ) ) == NULL ) {
160 smr_setReportError2( smr, PoPs_smr_ID, PoPs_errorToken_badName, "particle '%s' converted to name '%s' not in database", name, name_ );
161 return( -1 );
162 }
163 if( ( pop_ = PoPs_addParticleIfNeeded( smr, pop ) ) != pop ) PoP_free( pop ); /* Still need to add alias as index was < 0. */
164 index = pop_->index;
165
166 if( PoPs_particleIndex( name ) < 0 ) {
167 if( ( pop = PoP_makeAlias( smr, name_, name ) ) == NULL ) return( -1 );
168 if( ( pop_ = PoPs_addParticleIfNeeded( smr, pop ) ) != pop ) return( -1 ); /* pop_ should be pop as index was < 0. */
169 }
170
171 if( alias != NULL ) {
172 if( PoPs_particleIndex( alias ) < 0 ) {
173 if( ( pop = PoP_makeAlias( smr, name_, alias ) ) == NULL ) return( -1 );
174 if( ( pop_ = PoPs_addParticleIfNeeded( smr, pop ) ) != pop ) return( -1 ); /* Required for some yis. */
175 }
176 }
177 }
178 return( index );
179}
const G4int Z[17]
const G4double A[17]
int PoPs_particleIndex(char const *name)
Definition: PoPs.cc:204
PoP * PoPs_particleCreateLoadInfo(statusMessageReporting *smr, const char *name)
Definition: PoPs_data.cc:61
PoP * PoP_makeAlias(statusMessageReporting *smr, char const *name, char const *alias)
Definition: PoPs.cc:647
int PoPs_smr_ID
Definition: PoPs.cc:35
PoP * PoPs_addParticleIfNeeded(statusMessageReporting *smr, PoP *pop)
Definition: PoPs.cc:113
PoP * PoP_free(PoP *pop)
Definition: PoPs.cc:558
const char * name(G4int ptype)
#define smr_setReportError2(smr, libraryID, code, fmt,...)
Definition: PoPs.h:45
int index
Definition: PoPs.h:46

Referenced by MCGIDI_map_findAllOfTarget(), MCGIDI_map_findTarget(), MCGIDI_map_initialize(), MCGIDI_POPs_addParticleIfNeeded(), and PoPs_particleReadDatabase().

◆ PoP_copyParticle()

int PoP_copyParticle ( statusMessageReporting smr,
PoP desc,
PoP src 
)

Definition at line 567 of file PoPs.cc.

567 {
568
569 desc->index = -1;
570 desc->properIndex = src->properIndex;
571 desc->aliasIndex = src->aliasIndex;
572 desc->genre = src->genre;
573 if( ( desc->name = smr_allocateCopyString2( smr, src->name, "desc->name" ) ) == NULL ) return( 1 );
574 desc->Z = src->Z;
575 desc->A = src->A;
576 desc->l = src->l;
577 desc->mass = src->mass;
578 desc->massUnit = src->massUnit;
579
580 return( 0 );
581}
#define smr_allocateCopyString2(smr, s, forItem)
int aliasIndex
Definition: PoPs.h:46
int Z
Definition: PoPs.h:49
int properIndex
Definition: PoPs.h:46
char const * massUnit
Definition: PoPs.h:51
enum PoPs_genre genre
Definition: PoPs.h:47
char const * name
Definition: PoPs.h:48
double mass
Definition: PoPs.h:50
int l
Definition: PoPs.h:49
int A
Definition: PoPs.h:49

Referenced by PoPs_copyAddParticleIfNeeded().

◆ PoP_free()

PoP * PoP_free ( PoP pop)

Definition at line 558 of file PoPs.cc.

558 {
559
560 PoP_release( pop );
561 smr_freeMemory( (void **) &pop );
562 return( NULL );
563}
int PoP_release(PoP *pop)
Definition: PoPs.cc:549
void * smr_freeMemory(void **p)

Referenced by lPoPs_addParticleIfNeeded(), PoP_makeAlias(), PoP_makeParticle(), PoP_new(), PoPs_addAliasIfNeeded(), PoPs_copyAddParticleIfNeeded(), PoPs_particleCreateLoadInfo(), PoPs_particleReadDatabase(), and PoPs_releasePrivate().

◆ PoP_getIndex()

int PoP_getIndex ( PoP pop)

Definition at line 612 of file PoPs.cc.

612 {
613
614 return( pop->index );
615}

◆ PoP_getMassInUnitOf()

double PoP_getMassInUnitOf ( statusMessageReporting smr,
PoP pop,
char const *  unit 
)

Definition at line 626 of file PoPs.cc.

626 {
627
628 double mass = -1., ratio;
629 /* PoP *pop_ = pop;*/
630
631 /*if( pop->genre == PoPs_genre_alias ) pop_ = popsRoot.pops[PoPs_particleProperIndex( pop->index )];*/
632 if( PoPs_unitConversionRatio( pop->massUnit, unit, &ratio ) != 0 ) {
633 smr_setReportError2( smr, PoPs_smr_ID, PoPs_errorToken_badUnitConversion, "could not convert unit '%s' to '%s'", pop->massUnit, unit ); }
634 else {
635 mass = pop->mass * ratio;
636 }
637
638 return( mass );
639}
int PoPs_smr_ID
Definition: PoPs.cc:35
int PoPs_unitConversionRatio(char const *_from, char const *_to, double *ratio)
Definition: PoPs.cc:748

Referenced by PoPs_getMassInUnitOf_atIndex().

◆ PoP_getName()

char const * PoP_getName ( PoP pop)

Definition at line 619 of file PoPs.cc.

619 {
620
621 return( pop->name );
622}

◆ PoP_initialize()

int PoP_initialize ( statusMessageReporting smr,
PoP pop 
)

Definition at line 533 of file PoPs.cc.

533 {
534
535 pop->index = -1;
536 pop->properIndex = -1;
537 pop->aliasIndex = -1;
539 pop->name = NULL;
540 pop->Z = 0;
541 pop->A = 0;
542 pop->mass = 0.0;
543 pop->massUnit = NULL;
544 return( 0 );
545}

Referenced by PoP_new(), and PoP_release().

◆ PoP_makeAlias()

PoP * PoP_makeAlias ( statusMessageReporting smr,
char const *  name,
char const *  alias 
)

Definition at line 647 of file PoPs.cc.

647 {
648
649 int properIndex = PoPs_particleIndex( name ), aliasIndex = PoPs_particleIndex( alias );
650 PoP *pop;
651
652 if( properIndex < 0 ) {
653 smr_setReportError2( smr, PoPs_smr_ID, PoPs_errorToken_badName, "proper particle '%s' not in PoPs for alias '%s'", name, alias );
654 return( NULL );
655 }
656 if( aliasIndex >= 0 ) { /* alias has already been defined. */
657 PoP *truePop = popsRoot.pops[aliasIndex];
658
659 for( pop = truePop; strcmp( alias, pop->name ); pop = popsRoot.pops[aliasIndex] ) aliasIndex = pop->aliasIndex;
660 if( pop->genre != PoPs_genre_alias ) {
661 smr_setReportError2( smr, PoPs_smr_ID, PoPs_errorToken_badName, "particle '%s' already in PoPs and not an alias", alias );
662 return( NULL );
663 }
664 if( pop->properIndex != properIndex ) {
665 smr_setReportError2( smr, PoPs_smr_ID, PoPs_errorToken_badName, "particle '%s' already an alias for '%s', cannot re-alias to '%s'",
666 alias, truePop->name, name );
667 return( NULL );
668 } }
669 else {
670 if( ( pop = PoP_new( smr ) ) == NULL ) return( NULL );
671 if( ( pop->name = smr_allocateCopyString2( smr, alias, "name" ) ) == NULL ) {
672 PoP_free( pop );
673 return( NULL );
674 }
675 pop->properIndex = properIndex;
676 pop->genre = PoPs_genre_alias;
677 }
678 return( pop );
679}
PoP * PoP_new(statusMessageReporting *smr)
Definition: PoPs.cc:522
int PoPs_particleIndex(char const *name)
Definition: PoPs.cc:204
PoP * PoP_free(PoP *pop)
Definition: PoPs.cc:558
PoP ** pops
Definition: PoPs_private.h:26

Referenced by lPoPs_addParticleIfNeeded(), and PoPs_addAliasIfNeeded().

◆ PoP_makeParticle()

PoP * PoP_makeParticle ( statusMessageReporting smr,
enum PoPs_genre  genre,
char const *  name,
double  mass,
char const *  massUnit 
)

Definition at line 585 of file PoPs.cc.

585 {
586
587 PoP *pop;
588
589 if( ( pop = PoP_new( smr ) ) == NULL ) return( NULL );
590 if( ( pop->name = smr_allocateCopyString2( smr, name, "name" ) ) == NULL ) {
591 PoP_free( pop );
592 return( NULL );
593 }
594 pop->genre = genre;
595 pop->mass = mass;
596 if( ( pop->massUnit = unitsDB_addUnitIfNeeded( smr, massUnit ) ) == NULL ) pop = PoP_free( pop );
597 return( pop );
598}
char const * unitsDB_addUnitIfNeeded(statusMessageReporting *smr, char const *unit)
Definition: PoPs.cc:700

◆ PoP_new()

PoP * PoP_new ( statusMessageReporting smr)

Definition at line 522 of file PoPs.cc.

522 {
523
524 PoP *pop;
525
526 if( ( pop = (PoP *) smr_malloc2( smr, sizeof( PoP ), 0, "pop" ) ) == NULL ) return( NULL );
527 if( PoP_initialize( smr, pop ) != 0 ) pop = PoP_free( pop );
528 return( pop );
529}
int PoP_initialize(statusMessageReporting *, PoP *pop)
Definition: PoPs.cc:533
#define smr_malloc2(smr, size, zero, forItem)

Referenced by PoP_makeAlias(), PoP_makeParticle(), and PoPs_particleCreateLoadInfo().

◆ PoP_release()

int PoP_release ( PoP pop)

Definition at line 549 of file PoPs.cc.

549 {
550
551 if( pop->name != NULL ) smr_freeMemory( (void **) &(pop->name ) );
552 PoP_initialize( NULL, pop ); /* Make it clean in case someone trys to use if. */
553 return( 0 );
554}

Referenced by PoP_free().

◆ PoP_setZ_A_l()

int PoP_setZ_A_l ( statusMessageReporting smr,
PoP pop,
int  Z,
int  A,
int  l 
)

Definition at line 602 of file PoPs.cc.

602 {
603
604 pop->Z = Z;
605 pop->A = A;
606 pop->l = l;
607 return( 0 );
608}

◆ PoPs_addAliasIfNeeded()

PoP * PoPs_addAliasIfNeeded ( statusMessageReporting smr,
char const *  name,
char const *  alias 
)

Definition at line 179 of file PoPs.cc.

179 {
180
181 PoP *pop = PoP_makeAlias( smr, name, alias );
182
183 if( pop != NULL ) {
184 if( pop->index < 0 ) {
185 if( PoPs_addParticleIfNeeded( smr, pop ) == NULL ) {
186 PoP_free( pop );
187 return( NULL );
188 }
189 }
190 }
191
192 return( pop );
193}
PoP * PoP_makeAlias(statusMessageReporting *smr, char const *name, char const *alias)
Definition: PoPs.cc:647
PoP * PoPs_addParticleIfNeeded(statusMessageReporting *smr, PoP *pop)
Definition: PoPs.cc:113

Referenced by MCGIDI_map_initialize().

◆ PoPs_addParticleIfNeeded()

PoP * PoPs_addParticleIfNeeded ( statusMessageReporting smr,
PoP pop 
)

Definition at line 113 of file PoPs.cc.

113 {
114/*
115 If particle with name pop->name is already in popsRoot, returns the pointer to the existing particle.
116 A NULL is returned if adding particle to popsRoot fails.
117*/
118 int i, index = PoPs_sortedParticleIndex( pop->name );
119
120 if( index >= 0 ) return( popsRoot.pops[PoPs_particleProperIndex( popsRoot.sorted[index]->index )] );
121 if( popsRoot.numberOfParticles == popsRoot.allocated ) {
122 int size = popsRoot.allocated + incrementalSize;
123 PoP **sorted, **pops = (PoP **) smr_malloc2( smr, 2 * size * sizeof( PoPs * ), 0, "pops" );
124
125 if( pops == NULL ) return( NULL );
126 sorted = &(pops[size]);
127 for( i = 0; i < popsRoot.numberOfParticles; i++ ) {
128 pops[i] = popsRoot.pops[i];
129 sorted[i] = popsRoot.sorted[i];
130 }
131 smr_freeMemory( (void **) &(popsRoot.pops) );
132 popsRoot.pops = pops;
133 popsRoot.sorted = sorted;
134 popsRoot.allocated = size;
135 }
136 popsRoot.pops[popsRoot.numberOfParticles] = pop;
137 index = -index - 1;
138 for( i = popsRoot.numberOfParticles; i > index; i-- ) popsRoot.sorted[i] = popsRoot.sorted[i-1];
139 popsRoot.sorted[index] = pop;
140 pop->index = popsRoot.numberOfParticles;
141 popsRoot.numberOfParticles++;
142 if( pop->genre == PoPs_genre_alias ) { /* Add pop->index to end of list of particles aliased by pop->properIndex. */
143 PoP *pop2;
144
145 for( pop2 = popsRoot.pops[pop->properIndex]; pop2->aliasIndex >= 0; pop2 = popsRoot.pops[pop2->aliasIndex] ) ;
146 pop2->aliasIndex = pop->index;
147 }
148 return( pop );
149}
#define incrementalSize
Definition: PoPs.cc:18
int allocated
Definition: PoPs_private.h:25
int numberOfParticles
Definition: PoPs_private.h:24
PoP ** sorted
Definition: PoPs_private.h:27

Referenced by lPoPs_addParticleIfNeeded(), PoPs_addAliasIfNeeded(), PoPs_copyAddParticleIfNeeded(), and PoPs_particleReadDatabase().

◆ PoPs_copyAddParticleIfNeeded()

PoP * PoPs_copyAddParticleIfNeeded ( statusMessageReporting smr,
PoP pop 
)

Definition at line 153 of file PoPs.cc.

153 {
154/*
155 If particle with name pop->name is already in popsRoot, return the address of the existing particle.
156 If particle is not in popsRoot then copy particle to a new 'PoP *', add the copied PoP to popsRoot and return its address.
157 A NULL is return if particle coping fails or adding particle to popsRoot fails.
158*/
159
160 int index = PoPs_particleIndex( pop->name );
161 PoP *newPoP;
162
163 if( index >= 0 ) return( popsRoot.pops[index] );
164
165 if( ( newPoP = (PoP *) smr_malloc2( smr, sizeof( PoP ), 0, "newPoP" ) ) == NULL ) return( NULL );
166 if( PoP_copyParticle( smr, newPoP, pop ) ) {
167 smr_freeMemory( (void **) &newPoP );
168 return( NULL );
169 }
170 if( PoPs_addParticleIfNeeded( smr, newPoP ) == NULL ) {
171 PoP_free( newPoP );
172 return( NULL );
173 }
174 return( newPoP );
175}
int PoP_copyParticle(statusMessageReporting *smr, PoP *desc, PoP *src)
Definition: PoPs.cc:567

◆ PoPs_genreTokenToString()

char const * PoPs_genreTokenToString ( enum PoPs_genre  genre)

Definition at line 446 of file PoPs.cc.

446 {
447
448 if( genre < PoPs_genre_invalid ) return( NULL );
449 if( genre > PoPs_genre_atom ) return( NULL );
450 return( PoPs_genreStrings[genre] );
451}

Referenced by PoPs_write().

◆ PoPs_getAtomsIndex()

int PoPs_getAtomsIndex ( statusMessageReporting smr,
char const *  name 
)

Definition at line 397 of file PoPs.cc.

397 {
398
399 int index = PoPs_particleIndex_smr( smr, name, __FILE__, __LINE__, __func__ );
400
401 if( index < 0 ) return( index );
402 return( PoPs_getAtomsIndex_atIndex( smr, index ) );
403}
int PoPs_particleIndex_smr(statusMessageReporting *smr, char const *name, char const *file, int line, char const *func)
Definition: PoPs.cc:216
int PoPs_getAtomsIndex_atIndex(statusMessageReporting *smr, int index)
Definition: PoPs.cc:407

◆ PoPs_getAtomsIndex_atIndex()

int PoPs_getAtomsIndex_atIndex ( statusMessageReporting smr,
int  index 
)

Definition at line 407 of file PoPs.cc.

407 {
408
409 char const *p = NULL;
410
411 if( ( index < 0 ) || ( index >= popsRoot.numberOfParticles ) ) {
412 smr_setReportError2( smr, PoPs_smr_ID, PoPs_errorToken_badIndex, "index %d not in PoPs", index );
413 return( -1 );
414 }
415
416 if( popsRoot.pops[index]->genre == PoPs_genre_atom ) return( index );
417
418 if( strcmp( "p", popsRoot.pops[index]->name ) == 0 ) {
419 p = "H1"; }
420 else {
421 if( popsRoot.pops[index]->genre != PoPs_genre_nucleus ) return( -1 );
422 else if( strcmp( "h2", popsRoot.pops[index]->name ) == 0 ) {
423 p = "H2"; }
424 else if( strcmp( "h3", popsRoot.pops[index]->name ) == 0 ) {
425 p = "H3"; }
426 else if( strcmp( "he3", popsRoot.pops[index]->name ) == 0 ) {
427 p = "He3"; }
428 else if( strcmp( "he4", popsRoot.pops[index]->name ) == 0 ) {
429 p = "He4";
430 }
431 }
432 if( p != NULL ) return( PoPs_particleIndex_smr( smr, p, __FILE__, __LINE__, __func__ ) );
433 return( -1 );
434}

Referenced by PoPs_getAtomsIndex(), and PoPs_getAtomsName_atIndex().

◆ PoPs_getAtomsName()

char const * PoPs_getAtomsName ( statusMessageReporting smr,
char const *  name 
)

Definition at line 377 of file PoPs.cc.

377 {
378
379 int index = PoPs_particleIndex_smr( smr, name, __FILE__, __LINE__, __func__ );
380
381 if( index < 0 ) return( NULL );
382 return( PoPs_getAtomsName_atIndex( smr, index ) );
383}
char const * PoPs_getAtomsName_atIndex(statusMessageReporting *smr, int index)
Definition: PoPs.cc:387

◆ PoPs_getAtomsName_atIndex()

char const * PoPs_getAtomsName_atIndex ( statusMessageReporting smr,
int  index 
)

Definition at line 387 of file PoPs.cc.

387 {
388
389 int atomIndex = PoPs_getAtomsIndex_atIndex( smr, index );
390
391 if( atomIndex < 0 ) return( NULL );
392 return( popsRoot.pops[atomIndex]->name );
393}

Referenced by PoPs_getAtomsName().

◆ PoPs_getGenre()

enum PoPs_genre PoPs_getGenre ( statusMessageReporting smr,
char const *  name 
)

Definition at line 301 of file PoPs.cc.

301 {
302
303 int index = PoPs_particleIndex_smr( smr, name, __FILE__, __LINE__, __func__ );
304
305 if( index < 0 ) return( PoPs_genre_invalid );
306 return( popsRoot.pops[index]->genre );
307}

◆ PoPs_getGenre_atIndex()

enum PoPs_genre PoPs_getGenre_atIndex ( statusMessageReporting smr,
int  index 
)

Definition at line 311 of file PoPs.cc.

311 {
312
313 enum PoPs_genre genre = PoPs_genre_invalid;
314
315 if( ( index < 0 ) || ( index >= popsRoot.numberOfParticles ) ) {
316 smr_setReportError2( smr, PoPs_smr_ID, PoPs_errorToken_badIndex, "index %d not in PoPs", index ); }
317 else {
318 genre = popsRoot.pops[index]->genre;
319 }
320 return( genre );
321}
PoPs_genre
Definition: PoPs.h:36

◆ PoPs_getMassInUnitOf()

double PoPs_getMassInUnitOf ( statusMessageReporting smr,
char const *  name,
char const *  unit 
)

Definition at line 265 of file PoPs.cc.

265 {
266
267 int index = PoPs_particleIndex_smr( smr, name, __FILE__, __LINE__, __func__ );
268
269 if( index < 0 ) return( -1. );
270 return( PoPs_getMassInUnitOf_atIndex( smr, index, unit ) );
271}
double PoPs_getMassInUnitOf_atIndex(statusMessageReporting *smr, int index, char const *unit)
Definition: PoPs.cc:286

◆ PoPs_getMassInUnitOf_atIndex()

double PoPs_getMassInUnitOf_atIndex ( statusMessageReporting smr,
int  index,
char const *  unit 
)

Definition at line 286 of file PoPs.cc.

286 {
287
288 double mass = -1.;
289
290 if( ( index < 0 ) || ( index >= popsRoot.numberOfParticles ) ) {
291 smr_setReportError2( smr, PoPs_smr_ID, PoPs_errorToken_badIndex, "index %d not in PoPs", index ); }
292 else {
293 mass = PoP_getMassInUnitOf( smr, popsRoot.pops[index], unit );
294 }
295
296 return( mass );
297}
double PoP_getMassInUnitOf(statusMessageReporting *smr, PoP *pop, char const *unit)
Definition: PoPs.cc:626

Referenced by PoPs_getMassInUnitOf().

◆ PoPs_getName_atIndex()

char const * PoPs_getName_atIndex ( statusMessageReporting smr,
int  index 
)

Definition at line 275 of file PoPs.cc.

275 {
276
277 if( ( index < 0 ) || ( index >= popsRoot.numberOfParticles ) ) {
278 smr_setReportError2( smr, PoPs_smr_ID, PoPs_errorToken_badIndex, "index %d not in PoPs", index );
279 return( NULL );
280 }
281 return( popsRoot.pops[index]->name );
282}

Referenced by MCGIDI_map_findTargetViaPoPIDs().

◆ PoPs_getParticle_atIndex()

PoP * PoPs_getParticle_atIndex ( int  index)

Definition at line 438 of file PoPs.cc.

438 {
439
440 if( ( index < 0 ) || ( index >= popsRoot.numberOfParticles ) ) return( NULL );
441 return( popsRoot.pops[index] );
442}

◆ PoPs_getZ_A_l()

int PoPs_getZ_A_l ( statusMessageReporting smr,
char const *  name,
int *  Z,
int *  A,
int *  l 
)

Definition at line 325 of file PoPs.cc.

325 {
326
327 int index = PoPs_particleIndex_smr( smr, name, __FILE__, __LINE__, __func__ );
328
329 if( index < 0 ) return( -1 );
330 return( PoPs_getZ_A_l_atIndex( smr, index, Z, A, l ) );
331}
int PoPs_getZ_A_l_atIndex(statusMessageReporting *smr, int index, int *Z, int *A, int *l)
Definition: PoPs.cc:335

◆ PoPs_getZ_A_l_atIndex()

int PoPs_getZ_A_l_atIndex ( statusMessageReporting smr,
int  index,
int *  Z,
int *  A,
int *  l 
)

Definition at line 335 of file PoPs.cc.

335 {
336
337 if( ( index < 0 ) || ( index >= popsRoot.numberOfParticles ) ) {
338 smr_setReportError2( smr, PoPs_smr_ID, PoPs_errorToken_badIndex, "index %d not in PoPs", index );
339 return( -1 );
340 }
341 *Z = popsRoot.pops[index]->Z;
342 *A = popsRoot.pops[index]->A;
343 *l = 0;
344 return( 0 );
345}

Referenced by PoPs_getZ_A_l().

◆ PoPs_hasNucleus()

int PoPs_hasNucleus ( statusMessageReporting smr,
char const *  name,
int  protonIsNucleus 
)

Definition at line 349 of file PoPs.cc.

349 {
350
351 int index = PoPs_particleIndex_smr( smr, name, __FILE__, __LINE__, __func__ );
352
353 if( index < 0 ) return( -1 );
354 return( PoPs_hasNucleus_atIndex( smr, index, protonIsNucleus ) );
355}
int PoPs_hasNucleus_atIndex(statusMessageReporting *smr, int index, int protonIsNucleus)
Definition: PoPs.cc:359

Referenced by PoPs_write().

◆ PoPs_hasNucleus_atIndex()

int PoPs_hasNucleus_atIndex ( statusMessageReporting smr,
int  index,
int  protonIsNucleus 
)

Definition at line 359 of file PoPs.cc.

359 {
360/*
361* If an error is encountered, a negative value is returned. A value greater than 0 means the particle
362* contains a nucleus (is an atom, ion or nucleus). Otherwise, a 0 is returned.
363*/
364 if( ( index < 0 ) || ( index >= popsRoot.numberOfParticles ) ) {
365 smr_setReportError2( smr, PoPs_smr_ID, PoPs_errorToken_badIndex, "index %d not in PoPs", index );
366 return( -1 );
367 }
368 if( ( popsRoot.pops[index]->genre == PoPs_genre_nucleus ) || ( popsRoot.pops[index]->genre == PoPs_genre_atom ) ) return( 1 );
369 if( protonIsNucleus ) {
370 if( strcmp( "p", popsRoot.pops[index]->name ) == 0 ) return( 1 );
371 }
372 return( 0 );
373}

Referenced by PoPs_hasNucleus().

◆ PoPs_numberOfParticle()

int PoPs_numberOfParticle ( void  )

Definition at line 197 of file PoPs.cc.

197 {
198
199 return( popsRoot.numberOfParticles );
200}

◆ PoPs_particleCreateLoadInfo()

PoP * PoPs_particleCreateLoadInfo ( statusMessageReporting smr,
const char *  name 
)

Definition at line 61 of file PoPs_data.cc.

61 {
62
63 PoP *pop;
64
65 if( ( pop = PoP_new( smr ) ) != NULL ) {
66 if( PoPs_particleLoadInfo( smr, name, pop ) != 0 ) pop = PoP_free( pop );
67 }
68 return( pop );
69}
PoP * PoP_new(statusMessageReporting *smr)
Definition: PoPs.cc:522
int PoPs_particleLoadInfo(statusMessageReporting *smr, const char *name, PoP *pop)
Definition: PoPs_data.cc:73

Referenced by lPoPs_addParticleIfNeeded(), and PoPs_particleReadDatabase().

◆ PoPs_particleIndex()

int PoPs_particleIndex ( char const *  name)

Definition at line 204 of file PoPs.cc.

204 {
205/*
206 A negative number is return if particle is not in popsRoot. Else, the Id of the real (not aliased) particle is returned.
207*/
208 int index = PoPs_sortedParticleIndex( name );
209
210 if( index >= 0 ) index = PoPs_particleProperIndex( popsRoot.sorted[index]->index );
211 return( index );
212}

Referenced by lPoPs_addParticleIfNeeded(), PoP_makeAlias(), PoPs_copyAddParticleIfNeeded(), and PoPs_particleIndex_smr().

◆ PoPs_particleIndex_smr()

int PoPs_particleIndex_smr ( statusMessageReporting smr,
char const *  name,
char const *  file,
int  line,
char const *  func 
)

Definition at line 216 of file PoPs.cc.

216 {
217
218 int index = PoPs_particleIndex( name );
219
220 if( index < 0 )
221 smr_setReportError( smr, NULL, file, line, func, PoPs_smr_ID, PoPs_errorToken_badName, "particle '%s' not in PoPs", name );
222 return( index );
223}
int smr_setReportError(statusMessageReporting *smr, void *userInterface, char const *file, int line, char const *function, int libraryID, int code, char const *fmt,...)

Referenced by PoPs_getAtomsIndex(), PoPs_getAtomsIndex_atIndex(), PoPs_getAtomsName(), PoPs_getGenre(), PoPs_getMassInUnitOf(), PoPs_getZ_A_l(), and PoPs_hasNucleus().

◆ PoPs_particleLoadInfo()

int PoPs_particleLoadInfo ( statusMessageReporting smr,
const char *  name,
PoP pop 
)

Definition at line 73 of file PoPs_data.cc.

73 {
74
75 int i, n = sizeof( PoPDatas ) / sizeof( PoPDatas[0] );
76
77 if( ( pop->name = smr_allocateCopyString2( smr, name, "name" ) ) == NULL ) return( -1 );
78 for( i = 0; i < n; i++ ) {
79 if( strcmp( PoPDatas[i].name, name ) == 0 ) {
80 pop->genre = PoPDatas[i].genre;
81 pop->Z = PoPDatas[i].Z;
82 pop->A = 0;
83 if( PoPDatas[i].N >= 0 ) pop->A = pop->Z + PoPDatas[i].N;
84 pop->l = PoPDatas[i].nuclearLevel;
85 pop->mass = PoPs_getBDFLS_mass( name, pop, PoPDatas[i].mass );
86 pop->massUnit = unitsDB_addUnitIfNeeded( smr, "amu" );
87 return( 0 );
88 }
89 }
90 smr_freeMemory( (void **) &(pop->name) );
91 smr_setReportError2( smr, smr_unknownID, 1, "particle %s not in database", name );
92 return( -1 );
93}
char const * unitsDB_addUnitIfNeeded(statusMessageReporting *smr, char const *unit)
Definition: PoPs.cc:700
#define N
Definition: crc32.c:56
#define smr_unknownID
enum PoPs_genre genre
Definition: PoPs_data.h:181
int nuclearLevel
Definition: PoPs_data.h:182

Referenced by PoPs_particleCreateLoadInfo().

◆ PoPs_particleReadDatabase()

int PoPs_particleReadDatabase ( statusMessageReporting smr,
char const *  name 
)

Definition at line 36 of file PoPs_data.cc.

36 {
37
38 int i1, n1 = sizeof( PoPDatas ) / sizeof( PoPDatas[0] );
39 PoP *pop;
40 char ZAName[32];
41
42 for( i1 = 0; i1 < n1; ++i1 ) {
43 if( ( pop = PoPs_particleCreateLoadInfo( smr, PoPDatas[i1].name ) ) == NULL ) return( 1 );
44 if( PoPs_addParticleIfNeeded( smr, pop ) == pop ) {
45 if( ( pop->genre == PoPs_genre_atom ) && ( pop->Z < 110 ) ) {
46 snprintf( ZAName, sizeof ZAName, "%d%.3d", pop->Z, pop->A );
47 if( lPoPs_addParticleIfNeeded( smr, ZAName, "LLNL" ) < 0 ) return( 1 );
48 } }
49 else {
50 PoP_free( pop );
51 }
52 if( smr_isOk( smr ) == 0 ) return( 1 );
53 }
54 if( lPoPs_addParticleIfNeeded( smr, "gamma", "LLNL" ) < 0 ) return( 1 );
55 if( lPoPs_addParticleIfNeeded( smr, "g", "LLNL" ) < 0 ) return( 1 );
56 return( 0 );
57}
int lPoPs_addParticleIfNeeded(statusMessageReporting *smr, char const *name, char const *special)
Definition: lPoPs.cc:36
PoP * PoPs_particleCreateLoadInfo(statusMessageReporting *smr, const char *name)
Definition: PoPs_data.cc:61
int smr_isOk(statusMessageReporting *smr)

Referenced by PoPs_readDatabase().

◆ PoPs_print()

void PoPs_print ( int  sorted)

Definition at line 455 of file PoPs.cc.

455 {
456
457 PoPs_write( stdout, sorted );
458}
void PoPs_write(FILE *f, int sorted)
Definition: PoPs.cc:462

◆ PoPs_readDatabase()

int PoPs_readDatabase ( statusMessageReporting smr,
char const *  fileName 
)

Definition at line 81 of file PoPs.cc.

81 {
82
83 return( PoPs_particleReadDatabase( smr, fileName ) );
84}
int PoPs_particleReadDatabase(statusMessageReporting *smr, char const *name)
Definition: PoPs_data.cc:36

◆ PoPs_register()

int PoPs_register ( void  )

Definition at line 73 of file PoPs.cc.

73 {
74
75 if( referenceCount < 0 ) return( -1 );
76 return( ++referenceCount );
77}

◆ PoPs_release()

int PoPs_release ( statusMessageReporting smr)

Definition at line 88 of file PoPs.cc.

88 {
89
90 referenceCount--;
91 if( referenceCount != 0 ) return( referenceCount );
93 return( 0 );
94}
int PoPs_releasePrivate(statusMessageReporting *)
Definition: PoPs.cc:98

◆ PoPs_setBDFLS_File()

int PoPs_setBDFLS_File ( char const *  name)

Definition at line 121 of file PoPs_data.cc.

121 {
122
123#ifdef POPS_BDFLS
124
125 cbdfls_file *p;
126 cbdflsErrors Error;
127
128 if( BDFLS_Data != NULL ) cbdflsRelease( (cbdfls_file *) BDFLS_Data );
129 BDFLS_Data = NULL;
130 if( name != NULL ) {
131 if( ( p = cbdflsOpen( name, &Error ) ) == NULL ) return( 1 );
132 BDFLS_Data = (void *) p;
133 }
134#else
135 if( name == NULL ) BDFLS_Data = NULL; /* Do something with name so compilers do not complain. */
136#endif
137 return( 0 );
138}

◆ PoPs_unitConversionRatio()

int PoPs_unitConversionRatio ( char const *  _from,
char const *  _to,
double *  ratio 
)

Definition at line 748 of file PoPs.cc.

748 {
749
750 int i, n = sizeof( conversions ) / sizeof( conversions[0] );
751
752 *ratio = 1.;
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;
758 return( 0 );
759 } }
760 else if( strcmp( conversions[i]._to, _from ) == 0 ) {
761 if( strcmp( conversions[i]._from, _to ) == 0 ) {
762 *ratio = 1. / conversions[i].ratio;
763 return( 0 );
764 }
765 }
766 }
767 return( 1 );
768}
double ratio
Definition: PoPs.cc:32

Referenced by PoP_getMassInUnitOf().

◆ PoPs_version()

const char * PoPs_version ( void  )

Definition at line 59 of file PoPs.cc.

59 {
60
61 if( versionStr[0] == 0 ) snprintf( versionStr, sizeof versionStr, "PoPs version %d.%d.%d", POPS_VERSION_MAJOR, POPS_VERSION_MINOR, POPS_VERSION_PATCHLEVEL );
62 return( versionStr );
63}
#define POPS_VERSION_MAJOR
Definition: PoPs.h:27
#define POPS_VERSION_MINOR
Definition: PoPs.h:28
#define POPS_VERSION_PATCHLEVEL
Definition: PoPs.h:29

◆ PoPs_versionMajor()

int PoPs_versionMajor ( void  )

Definition at line 67 of file PoPs.cc.

67{ return( POPS_VERSION_MAJOR ); }

◆ PoPs_versionMinor()

int PoPs_versionMinor ( void  )

Definition at line 68 of file PoPs.cc.

68{ return( POPS_VERSION_MINOR ); }

◆ PoPs_versionPatchLevel()

int PoPs_versionPatchLevel ( void  )

Definition at line 69 of file PoPs.cc.

69{ return( POPS_VERSION_PATCHLEVEL ); }

◆ PoPs_write()

void PoPs_write ( FILE *  f,
int  sorted 
)

Definition at line 462 of file PoPs.cc.

462 {
463
464 int i1, properIndex;
465 PoP *pop;
466
467 fprintf( f, "Mass units: number of units = %d\n", unitsRoot.numberOfUnits );
468 for( i1 = 0; i1 < unitsRoot.numberOfUnits; i1++ ) {
469 fprintf( f, " %s", unitsRoot.unsorted[i1] );
470 }
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" );
476 for( i1 = 0; i1 < popsRoot.numberOfParticles; i1++ ) {
477 if( sorted ) {
478 pop = popsRoot.sorted[i1]; }
479 else {
480 pop = popsRoot.pops[i1];
481 }
482 properIndex = PoPs_particleProperIndex( pop->index );
483 fprintf( f, " %-24s %6d %-10s %15.8e %-6s", pop->name, pop->index, PoPs_genreTokenToString( pop->genre ),
484 popsRoot.pops[properIndex]->mass, popsRoot.pops[properIndex]->massUnit );
485 if( PoPs_hasNucleus( NULL, pop->name, 0 ) ) {
486 fprintf( f, " T" ); }
487 else {
488 fprintf( f, " " );
489 }
490 if( PoPs_hasNucleus( NULL, pop->name, 1 ) ) {
491 fprintf( f, " T" ); }
492 else {
493 fprintf( f, " " );
494 }
495 if( pop->Z + pop->A > 0 ) {
496 fprintf( f, " %3d %3d", pop->Z, pop->A );
497 if( pop->l > 0 ) {
498 fprintf( f, " %d", pop->l ); }
499 else {
500 fprintf( f, " " );
501 } }
502 else {
503 fprintf( f, " " );
504 }
505 if( pop->genre == PoPs_genre_alias ) {
506 fprintf( f, " %s (%d)", popsRoot.pops[properIndex]->name, popsRoot.pops[properIndex]->index ); }
507 else {
508 int aliasIndex;
509
510 for( aliasIndex = pop->aliasIndex; aliasIndex >= 0; aliasIndex = popsRoot.pops[aliasIndex]->aliasIndex ) fprintf( f, " %d", aliasIndex );
511 }
512 fprintf( f, "\n" );
513 }
514}
char const * PoPs_genreTokenToString(enum PoPs_genre genre)
Definition: PoPs.cc:446
int PoPs_hasNucleus(statusMessageReporting *smr, char const *name, int protonIsNucleus)
Definition: PoPs.cc:349
int numberOfUnits
Definition: PoPs_private.h:18
char const ** unsorted
Definition: PoPs_private.h:20

Referenced by PoPs_print().

Variable Documentation

◆ PoPs_smr_ID