00001
00002
00003
00004 #include "cddefines.h"
00005 #include "thermal.h"
00006 #include "cooling.h"
00007 #define NCOLSAV 100
00008
00009 void coolpr(
00010 FILE * io,
00011
00012 const char *chLabel,
00013
00014 float lambda,
00015
00016 double ratio,
00017
00018 const char *chJOB
00019 )
00020 {
00021 static char chLabsv[NCOLSAV][NCOLNT_LAB_LEN+1];
00022
00023 static char chSig[NCOLSAV];
00024
00025 long int i,
00026 ipAr[NCOLSAV],
00027 j,
00028 limit;
00029
00030 static long int nCoolant;
00031 static float sav[NCOLSAV];
00032
00033 float SavMax,
00034 scratch[NCOLSAV];
00035
00036 static float csav[NCOLSAV];
00037
00038 DEBUG_ENTRY( "coolpr()" );
00039
00040
00041
00042
00043 if( strcmp(chJOB,"ZERO") == 0 )
00044 {
00045
00046
00047 nCoolant = 0;
00048 for( i=0; i<NCOLSAV; ++i )
00049 {
00050 scratch[i] = FLT_MAX;
00051 ipAr[i] = LONG_MAX;
00052 }
00053 }
00054
00055 else if( strcmp(chJOB,"DOIT") == 0 )
00056 {
00057 strcpy( chLabsv[nCoolant], chLabel );
00058
00059 if( lambda < 10000. )
00060 {
00061 sav[nCoolant] = lambda;
00062 }
00063 else
00064 {
00065 sav[nCoolant] = lambda/10000.f;
00066 }
00067
00068 csav[nCoolant] = (float)ratio;
00069
00070 if( ratio < 0. )
00071 {
00072 chSig[nCoolant] = 'n';
00073 }
00074 else
00075 {
00076 chSig[nCoolant] = ' ';
00077 }
00078
00079
00080 ++nCoolant;
00081
00082
00083 if( nCoolant >= NCOLSAV )
00084 {
00085 fprintf( ioQQQ, " coolpr ran out of room, increase NCOLSAV.\n" );
00086 ShowMe();
00087 puts( "[Stop in coolpr]" );
00088 cdEXIT(EXIT_FAILURE);
00089 }
00090 }
00091
00092 else if( strcmp(chJOB,"DONE") == 0 )
00093 {
00094
00095 for( i=0; i < nCoolant; i++ )
00096 {
00097
00098 scratch[i] = (float)fabs(csav[i]);
00099 }
00100
00101 for( i=0; i < nCoolant; i++ )
00102 {
00103 SavMax = 0.;
00104
00105 ipAr[i] = -LONG_MAX;
00106
00107
00108 for( j=0; j < nCoolant; j++ )
00109 {
00110 if( scratch[j] > SavMax )
00111 {
00112 SavMax = scratch[j];
00113
00114 ipAr[i] = j;
00115 }
00116 }
00117
00118 scratch[ipAr[i]] = 0.;
00119 }
00120
00121
00122 for( j=0; j < nCoolant; j += 7 )
00123 {
00124 limit = MIN2(nCoolant,j+7);
00125 fprintf( io, " " );
00126 for( i=j; i < limit; i++ )
00127 {
00128 fprintf( io,
00129 " %s %.2f%c%6.3f",
00130
00131 chLabsv[ipAr[i]],
00132
00133 sav[ipAr[i]],
00134
00135 chSig[ipAr[i]],
00136
00137 csav[ipAr[i]] );
00138 }
00139 fprintf( io, " \n" );
00140 }
00141 }
00142
00143 else
00144 {
00145 fprintf( ioQQQ, " coolpr called with insane job =%s=\n",chJOB );
00146 ShowMe();
00147 puts( "[Stop in coolpr]" );
00148 cdEXIT(EXIT_FAILURE);
00149 }
00150
00151 DEBUG_EXIT( "coolpr()" );
00152 return;
00153 }
00154