/*chLineLbl use information in line transfer arrays to generate a line label */ /* this label is null terminated */ #include "cddefines.h" #include "taulines.h" #include "elementnames.h" #include "chlinelbl.h" char* chLineLbl(EmLine * t ) { static char chLineLbl_v[11]; # ifdef DEBUG_FUN fputs( "<+>chLineLbl()\n", debug_fp ); # endif /* function to use information within the line array * to generate a line label, giving element and * ionization stage * rhs are set in large block data */ /* NB this funciton is profoundly slow due to write statement * also - it cannot be evaluated within a write statement itself*/ if( t->WLAng > 99999. ) { sprintf( chLineLbl_v, "%2.2s%2.2s%5i%c", elementnames.chElementSym[t->nelem -1], elementnames.chIonStage[t->IonStg-1], (int)t->WLAng/10000, 'm' ); } else if( t->WLAng > 9999. ) { sprintf( chLineLbl_v, "%2.2s%2.2s%5.2f%c", elementnames.chElementSym[ t->nelem -1], elementnames.chIonStage[t->IonStg-1], t->WLAng/1e4, 'm' ); } else if( t->WLAng >= 100. ) { sprintf( chLineLbl_v, "%2.2s%2.2s%5i%c", elementnames.chElementSym[ t->nelem -1], elementnames.chIonStage[t->IonStg-1], (int)t->WLAng, 'A' ); } /* the following two formats should be changed for the * wavelength to get more precision */ else if( t->WLAng >= 10. ) { sprintf( chLineLbl_v, "%2.2s%2.2s%5i%c", elementnames.chElementSym[ t->nelem -1], elementnames.chIonStage[t->IonStg-1], (int)t->WLAng, 'A' ); } else { sprintf( chLineLbl_v, "%2.2s%2.2s%5i%c", elementnames.chElementSym[ t->nelem -1], elementnames.chIonStage[t->IonStg-1], (int)t->WLAng, 'A' ); } # ifdef DEBUG_FUN fputs( " <->chLineLbl()\n", debug_fp ); # endif return( chLineLbl_v ); }