00001
00002
00003
00004 #include "cddefines.h"
00005 #include "geometry.h"
00006 #include "dense.h"
00007 #include "mean.h"
00008 #include "elementnames.h"
00009 #include "prt.h"
00010
00011 void PrtMeanIon(
00012
00013 char chType,
00014
00015 bool lgDensity,
00016
00017
00018 FILE *ioMEAN )
00019 {
00020 long int i,
00021 limit,
00022 n,
00023 nelem;
00024
00025
00026 bool lgPrtLots=false;
00027
00028 realnum aa[LIMELM+1];
00029
00030 DEBUG_ENTRY( "PrtMeanIon()" );
00031
00032
00033
00034
00035 const char* type[3] = { "radius", "area", "volume" };
00036
00037 for( int d=2; d >= 0; --d )
00038 {
00039
00040
00041
00042
00043 if( geometry.lgGeoPP && d > 0 )
00044 continue;
00045
00046
00047 mean.MeanIon(chType,ipHYDROGEN,d,&n,aa,lgDensity);
00048
00049
00050 fprintf( ioMEAN, "\n Hydrogen " );
00051 for( i=0; i < 3; i++ )
00052 {
00053 fprintf( ioMEAN, "%7.3f", aa[i] );
00054 }
00055 fprintf(ioMEAN," (H2)");
00056 if( chType=='i' && lgDensity )
00057 {
00058 fprintf( ioMEAN,
00059 " Log10 Mean Ionisation (over %s*electron density)\n", type[d] );
00060 }
00061 else if( chType=='i' )
00062 {
00063 fprintf( ioMEAN,
00064 " Log10 Mean Ionisation (over %s)\n", type[d] );
00065 }
00066 else if( chType=='t' && lgDensity )
00067 {
00068 fprintf( ioMEAN,
00069 " Log10 Mean Temperature (over %s*electron density)\n", type[d] );
00070 }
00071 else if( chType=='t' )
00072 {
00073 fprintf( ioMEAN,
00074 " Log10 Mean Temperature (over %s)\n", type[d] );
00075 }
00076 else
00077 {
00078 fprintf( ioQQQ, " PrtMeanIon called with insane job: %c\n", chType );
00079 TotalInsanity();
00080 }
00081
00082
00083 for( nelem=ipHELIUM; nelem < LIMELM; nelem++ )
00084 {
00085 if( dense.lgElmtOn[nelem] )
00086 {
00087 mean.MeanIon(chType,nelem,d,&n,aa,lgDensity);
00088 limit = MIN2(17,n);
00089 fprintf( ioMEAN, " %10.10s", elementnames.chElementName[nelem] );
00090
00091 for( i=0; i < limit; i++ )
00092 {
00093 fprintf( ioMEAN, "%7.3f", aa[i] );
00094 }
00095 fprintf( ioMEAN, "\n" );
00096
00097 if( n > 17 )
00098 {
00099 lgPrtLots = true;
00100 fprintf( ioMEAN, " " );
00101 for( i=17; i < n; i++ )
00102 {
00103 fprintf( ioMEAN, "%7.3f", aa[i] );
00104 }
00105 fprintf( ioMEAN, "\n" );
00106 }
00107 }
00108 }
00109
00110 fprintf( ioMEAN, "\n " );
00111 for( i=1; i <= 17; i++ )
00112 {
00113 fprintf( ioMEAN, "%7ld", i );
00114 }
00115 fprintf( ioMEAN, "\n" );
00116 if( lgPrtLots )
00117 {
00118 fprintf( ioMEAN, " " );
00119 for( i=18; i <= LIMELM; i++ )
00120 {
00121 fprintf( ioMEAN, "%7ld", i );
00122 }
00123 fprintf( ioMEAN, "\n" );
00124 }
00125 }
00126 return;
00127 }