| | 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 | } |
| | 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"); |