00001 /* This file is part of Cloudy and is copyright (C)1978-2010 by Gary J. Ferland and 00002 * others. For conditions of distribution and use see copyright notice in license.txt */ 00003 /*InitCoreloadPostparse initialization at start, called from cloudy 00004 * after parser one time per core load */ 00005 #include "cddefines.h" 00006 #include "monitor_results.h" 00007 #include "dense.h" 00008 #include "init.h" 00009 #include "iso.h" 00010 #include "lines_service.h" 00011 #include "taulines.h" 00012 00013 /*InitCoreloadPostparse initialization at start, called from cloudy 00014 * after parser, one time per core load */ 00015 void InitCoreloadPostparse( void ) 00016 { 00017 00018 static int nCalled = 0; 00019 00020 DEBUG_ENTRY( "InitCoreloadPostparse()" ); 00021 00022 /* only do this once per coreload */ 00023 if( nCalled > 0 ) 00024 { 00025 return; 00026 } 00027 00028 /* this is first call, increment the nCalled counter so we never do this again */ 00029 ++nCalled; 00030 00031 MonitorResults.SumErrorCaseMonitor = 0.; 00032 MonitorResults.nSumErrorCaseMonitor = 0; 00033 00034 StatesElemNEW.reserve( LIMELM ); 00035 00036 for( long nelem=ipHYDROGEN; nelem<LIMELM; ++nelem) 00037 { 00038 /* only grab core for elements that are turned on */ 00039 if( nelem < 2 || dense.lgElmtOn[nelem] ) 00040 { 00041 StatesElemNEW.reserve( nelem, nelem+1 ); 00042 for( long ion=0; ion<nelem+1; ion++ ) 00043 { 00044 long ipISO = nelem-ion; 00045 if( ipISO < NISO ) 00046 { 00047 iso_update_num_levels( ipISO, nelem ); 00048 ASSERT( iso.numLevels_max[ipISO][nelem] > 0 ); 00049 StatesElemNEW.reserve( nelem, ion, iso.numLevels_max[ipISO][nelem] ); 00050 } 00051 else 00052 { 00053 fixit(); // for now, point non-iso ions to NULL 00054 StatesElemNEW.reserve( nelem, ion, 1 ); 00055 } 00056 } 00057 } 00058 } 00059 00060 StatesElemNEW.alloc(); 00061 00062 for( long ipISO=ipH_LIKE; ipISO<NISO; ++ipISO ) 00063 { 00064 for( long nelem=ipISO; nelem < LIMELM; ++nelem ) 00065 { 00066 /* only grab core for elements that are turned on */ 00067 if( nelem < 2 || dense.lgElmtOn[nelem] ) 00068 { 00069 for( long ipLo=0; ipLo<iso.numLevels_max[ipISO][nelem]; ipLo++ ) 00070 { 00071 StateJunk( &StatesElemNEW[nelem][nelem-ipISO][ipLo] ); 00072 } 00073 } 00074 } 00075 } 00076 00077 return; 00078 }