/*opacin add opacity due to single species to main opacity array * ipOpac is opacity pointer within opac * ipLowLim is lower freq limit * ipUpLim is upper limit * abundance is abundance */ #include "cddefines.h" #include "opac.h" #include "rfield.h" #include "opacin.h" void opacin( /* opacity offset for this species */ long int ipOpac, /* lower limit to opacity range on energy mesh */ long int ipLowLim, /* upper limit to opacity range on energy mesh */ long int ipUpLim, /* abundance, we bail if zero */ float abundance, /* either static 's' or volitile 'v' */ char chStat ) { long int i , ipOffset, limit; # ifdef DEBUG_FUN fputs( "<+>opacin()\n", debug_fp ); # endif /* code spends roughly 20% of its time in this loop*/ assert( chStat == 's' || chStat == 'v' ); ipOffset = ipOpac - ipLowLim; assert( ipLowLim > 0 ); assert( ipOffset >= 0 ); limit = MIN2(ipUpLim,rfield.nflux); /* do nothing if abundance is zero, or if static opacities do not * need to be redone */ if( abundance <= 0. || (chStat=='s' && !opac.lgRedoStatic) ) { # ifdef DEBUG_FUN fputs( " <->opacin()\n", debug_fp ); # endif return; } /* volative (outer shell, constantly reevaluated) or static opacity? */ if( chStat=='v' ) { for( i=ipLowLim-1; i < limit; i++ ) { opac.opac[i] += opac.OpacStack[i+ipOffset]*abundance; } } else { for( i=ipLowLim-1; i < limit; i++ ) { opac.OpacStatic[i] += opac.OpacStack[i+ipOffset]*abundance; } } # ifdef DEBUG_FUN fputs( " <->opacin()\n", debug_fp ); # endif return; }