// // C++ Implementation: cuvemission // // $Id: cuvemission.cpp,v 1.2 2010/09/17 15:19:37 thernis Exp $ // #include "cuvemission.h" #include #include #include #include #include #include #include #include "rtmiscfunc.h" const unsigned int CUVEmission::NBSAMP; const unsigned int CUVEmission::NBLINES; CUVEmission::CUVEmission() { isgood=false; char *ppathtoxdr; string pathtoxdr; // ---- get the path where emission files are located ppathtoxdr=getenv("RT_UVEMISSIONPATH"); if (ppathtoxdr!=NULL) pathtoxdr.assign(ppathtoxdr); if (pathtoxdr.empty()) { cout << "The RT_UVEMISSIONPATH environment variable is not defined\nI just use the current directory" << endl; pathtoxdr="~/work/cpp/scraytrace/data"; } //pathtoxdr="/home/arnaud/work/cpp"; // ---- load the emission vs temperature tables // -- yisel FILE *pFile; string filename=pathtoxdr+"/yisel.xdr"; pFile = fopen (filename.c_str() , "r"); if (pFile == NULL) { cout << "Error opening file "<< filename << endl; exit(1); } XDR xdrs; xdrstdio_create(&xdrs, pFile, XDR_DECODE); float a; for (unsigned int j=0;j 4) return 0.; unsigned int klineoffset=kline-1; float logte=log10(te); float yif=nearestneighbor1dinterp(logte,ti,NBSAMP,&yisel[klineoffset*NBSAMP]); float emiss=nearestneighbor1dinterp(logte,teg,NBSAMP,&emis[klineoffset*NBSAMP]); return(pow(float(10.),yif)*pow(float(10.),emiss)); } // $Log: cuvemission.cpp,v $ // Revision 1.2 2010/09/17 15:19:37 thernis // Add declaration of static constants. // // Revision 1.1 2008/12/12 19:54:03 thernis // Implement UV emission raytracing //