dats d; static const float zoff=1948.07; static const int wnum=40; ices * iced[wnum]; struct ini{ ini(){ { // initialize random numbers int size; ifstream inFile; inFile.open("rnd.txt", ifstream::in); vector rx; if(!inFile.fail()){ unsigned int a; unsigned long long b,c; while(inFile>>a>>b>>c) rx.push_back(a); if(rx.size()<1){ cerr<<"File rnd.txt did not contain valid data"< float dh, hdh, rdh, hmin; // step, 1/step, min and max depth ifstream inFile; bool flag=true; inFile.open("wv.dat", ifstream::in); vector wx, wy; if(!inFile.fail()){ float xa, ya, xo=0, yo=0; int num=0; while(inFile>>xa>>ya){ if(( xa<0 || 10 && ( xa<=xo || ya<=yo )){ flag=false; break; } wx.push_back(xa); wy.push_back(ya); xo=xa; yo=ya; num++; } if(xo!=1 || wx.size()<2) flag=false; inFile.close(); if(flag){ cerr<<"Loaded "< dp, be, ba, td; inFile.open("icemodel.par", ifstream::in); if(flag=!inFile.fail()){ if(flag) flag=(inFile >> a >> ae); if(flag) flag=(inFile >> k >> ke); if(flag) flag=(inFile >> A >> Ae); if(flag) flag=(inFile >> B >> Be); if(flag) flag=(inFile >> D >> De); if(flag) flag=(inFile >> E >> Ee); if(!flag) cerr << "File icemodel.par found, but is corrupt" << endl; inFile.close(); if(!flag) exit(1); } else{ cerr << "File icemodel.par was not found" << endl; exit(1); } inFile.open("icemodel.dat", ifstream::in); if(!inFile.fail()){ size=0; float dpa, bea, baa, tda; while(inFile >> dpa >> bea >> baa >> tda){ dp.push_back(dpa); be.push_back(bea); ba.push_back(baa); td.push_back(tda); size++; } inFile.close(); if(size<2){ cerr << "File icemodel.dat found, but is corrupt" << endl; exit(1); } } else{ cerr << "File icemodel.dat was not found" << endl; exit(1); } dh=dp[1]-dp[0]; if(dh<=0){ cerr << "Ice table does not use increasing depth spacing" << endl; exit(1); } for(int i=0; i0) if(fabsf(dp[i]-dp[i-1]-dh)>dh*xx){ cerr << "Ice table does not use uniform depth spacing" << endl; exit(1); } cerr<<"Loaded "<z[i].sca=be[j]*l_a/(1-g); w->z[i].abs=(D*ba[j]+E)*l_k+ABl*(1+0.01*td[j]); if(w->z[i].sca<=0 || w->z[i].abs<=0){ cerr << "Invalid value of ice parameter, cannot proceed" << endl; exit(1); } } float wv=wva*1.e-3; float wv2=wv*wv; float wv3=wv*wv2; float wv4=wv*wv3; float np=1.55749-1.57988*wv+3.99993*wv2-4.68271*wv3+2.09354*wv4; float ng=np*(1+0.227106-0.954648*wv+1.42568*wv2-0.711832*wv3); float c=0.299792458; d.ocv=1/c; w->ocm=ng/c; w->coschr=1/np; w->sinchr=sqrt(1-w->coschr*w->coschr); } d.w=iced[nfla]; } { // initialize geometry ifstream inFile; inFile.open("geo-f2k", ifstream::in); vector oms; if(!inFile.fail()){ DOM dom; string mbid; int om, str; unsigned long long omid; while(inFile>>mbid>>hex>>omid>>dec>>dom.r[0]>>dom.r[1]>>dom.r[2]>>str>>om) if(str>0 && om>=1 && om<=60){ dom.r[2]+=zoff; dom.n.dom=om; dom.n.str=str; oms.push_back(dom); } inFile.close(); } d.gsize = oms.size(); d.oms = new DOM[d.gsize]; for(int n=0; n cells[cx][cy][cz]; for(int i=0; ich[m]) ch[m]=oms[n].r[m]; } for(int m=0; m<3; m++){ float diff=ch[m]-cl[m]; if(diff=d.cn[m]){ cerr<<"Error in cell initialization"<