Show
Ignore:
Timestamp:
04/12/08 09:30:35 (9 months ago)
Author:
rjrw
Message:

Merged from trunk r1917:1941

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • branches/newmole/source/assert_results.cpp

    r1918 r1942  
    1010#include "iso.h" 
    1111#include "called.h" 
     12#include "atmdat.h" 
    1213#include "hcmap.h" 
    1314#include "thermal.h" 
     
    4748static char **chAssertLineLabel; 
    4849 
     50/* element to assert H-like case B */ 
     51static char chElemLabelCaseB[5]; 
     52static long int nelemCaseB , nISOCaseB; 
     53 
    4954/* this will be = for equal, < or > for limit */ 
    5055static char *chAssertLimit; 
     
    344349 
    345350        /* assert line "LINE"  --  key is ine_ since linear option appears on some commands */ 
    346         else if( nMatch("INE ",input.chCARDCAPS ) ) 
     351        else if( nMatch(" LINE ",input.chCARDCAPS ) ) 
    347352        { 
    348353                if(  nMatch("LUMI",input.chCARDCAPS ) || nMatch("INTE",input.chCARDCAPS )) 
     
    440445 
    441446        /* assert departure coefficients */ 
     447        else if( nMatch("CASE",input.chCARDCAPS ) ) 
     448        { 
     449                /* this is Case B for some element */ 
     450                strcpy( chAssertType[nAsserts] , "CB" ); 
     451                i = 5; 
     452                /* this is relative error */ 
     453                AssertError[nAsserts] = 
     454                        FFmtRead(input.chCARDCAPS ,&i, INPUT_LINE_LENGTH,&lgEOL); 
     455                if( lgEOL ) 
     456                        /* default error was set in define above */ 
     457                        AssertError[nAsserts] = DEF_ERROR; 
     458                AssertQuantity[nAsserts] = 0; 
     459                strcpy( chAssertLineLabel[nAsserts] , "Ca B" );  
     460                wavelength[nAsserts] = 0.; 
     461 
     462                /* assert case b for H or He */ 
     463                if( nMatch("H-LI",input.chCARDCAPS ) ) 
     464                { 
     465                        /* H-like - now get an element */ 
     466                        if( (nelem = GetElem( input.chCARDCAPS )) < 0 ) 
     467                        { 
     468                                /* no name found */ 
     469                                fprintf(ioQQQ, "assert H-like case B did not find an element on this line, sorry %s\n", 
     470                                        input.chCARDCAPS ); 
     471                                cdEXIT(EXIT_FAILURE); 
     472                        } 
     473                        if( nelem>7 ) 
     474                        { 
     475                                /* beyond reach of tables */ 
     476                                fprintf(ioQQQ, "assert H-like cannot do elements heavier than O, sorry %s\n", 
     477                                        input.chCARDCAPS ); 
     478                                cdEXIT(EXIT_FAILURE); 
     479                        } 
     480                        nelemCaseB = nelem; 
     481                        nISOCaseB = 0; 
     482                        strcpy( chElemLabelCaseB , elementnames.chElementSym[nelem] ); 
     483                        char chNumb[4]; 
     484                        sprintf( chNumb , "%2li" , nelem+1 ); 
     485                        strcat( chElemLabelCaseB , chNumb ); 
     486                } 
     487                else if( nMatch("HE-L",input.chCARDCAPS ) ) 
     488                { 
     489                        /* He-like - only helium itself */ 
     490                        nelemCaseB = ipHELIUM; 
     491                        nISOCaseB = 0; 
     492                        strcpy( chElemLabelCaseB , "He 1" ); 
     493                        /* beyond reach of tables */ 
     494                        fprintf(ioQQQ, "assert He-like case b not implemented yet %s\n", 
     495                                input.chCARDCAPS ); 
     496                        cdEXIT(EXIT_FAILURE); 
     497                } 
     498        } 
    442499        else if( nMatch("DEPA",input.chCARDCAPS ) ) 
    443500        { 
     
    447504                        FFmtRead(input.chCARDCAPS ,&i, INPUT_LINE_LENGTH,&lgEOL); 
    448505                if( lgEOL ) 
    449                 { 
    450506                        NoNumb(input.chOrgCard); 
    451                 } 
    452507 
    453508                /* this is relative error, max departure from unity of any level or std */ 
     
    455510                        FFmtRead(input.chCARDCAPS ,&i, INPUT_LINE_LENGTH,&lgEOL); 
    456511                if( lgEOL ) 
    457                 { 
    458512                        /* default error was set in define above */ 
    459513                        AssertError[nAsserts] = DEF_ERROR; 
    460                 } 
    461514 
    462515                /* H-like key means do one of the hydrogenic ions */ 
     
    18281881                        /* uncertainty in difference is zero */ 
    18291882                        AssertError[i] = 0.; 
     1883                } 
     1884 
     1885                else if( strcmp( chAssertType[i] , "CB") == 0 ) 
     1886                { 
     1887                        int iCase = 1; 
     1888                        RelError[i] = 0.; 
     1889                        fprintf(ioQQQ,"        Species  nHi nLo  Wl  Computed  Asserted       error\n"); 
     1890                        long nHighestPrinted = StatesElem[nISOCaseB][nelemCaseB][iso.numPrintLevels[nISOCaseB][nelemCaseB]-1].n; 
     1891                        for( long int ipLo=1+iCase; ipLo< MIN2(24,nHighestPrinted-1); ++ipLo ) 
     1892                        { 
     1893                                for( long int ipHi=ipLo+1; ipHi< MIN2(25,nHighestPrinted); ++ipHi ) 
     1894                                { 
     1895                                        /* assert the line */ 
     1896                                        realnum wl = atmdat.WaveLengthCaseB[nelemCaseB][ipHi][ipLo]; 
     1897                                        double relint , absint,CBrelint , CBabsint; 
     1898                                        cdLine( "Ca B" , wl , &CBrelint , &CBabsint ); 
     1899                                        CBabsint = pow( 10., CBabsint ); 
     1900                                        double error; 
     1901                                        if( cdLine( chElemLabelCaseB , wl , &relint , &absint ) >0) 
     1902                                        { 
     1903                                                absint = pow( 10., absint ); 
     1904                                                error = (CBabsint - absint)/MAX2(CBabsint , absint); 
     1905                                                fprintf(ioQQQ,"ChkAssert %s %3li %3li ",  
     1906                                                        chElemLabelCaseB , ipHi , ipLo ); 
     1907                                                prt_wl(ioQQQ, wl ); 
     1908                                                fprintf(ioQQQ," %.2e %.2e %10.3f",  
     1909                                                        absint , CBabsint , error ); 
     1910                                        } 
     1911                                        else 
     1912                                                TotalInsanity(); 
     1913                                        if( fabs(error) > AssertError[i]  ) 
     1914                                                fprintf(ioQQQ , " BOTCH \n"); 
     1915                                        else 
     1916                                                fprintf(ioQQQ , "\n"); 
     1917 
     1918                                        PredQuan[i] = 0; 
     1919                                        AssertQuantity[i] = 0.; 
     1920                                        RelError[i] = MAX2( RelError[i] , fabs(error) ); 
     1921                                } 
     1922                        } 
     1923                        fprintf(ioQQQ,"\n"); 
    18301924                } 
    18311925 
     
    23922486 
    23932487                                { 
    2394                                         /*@-redef@*/ 
    23952488                                        enum {DEBUG_LOC=false}; 
    2396                                         /*@+redef@*/ 
    23972489 
    23982490                                        if( DEBUG_LOC )