#include "racquproc.h" #include #include #include #include #include "pexceptions.h" #include "tvector.h" #include "fioarr.h" #include "timestamp.h" #include "ctimer.h" #include "fftpserver.h" #include "fftwserver.h" #include "FFTW/fftw3.h" #include "pciewrap.h" #include "brpaqu.h" #include "brproc.h" //--------------------------------------------------------------- // Classe thread de traitement donnees ADC avec 2 voies par frame //--------------------------------------------------------------- BRProcARaw2C::BRProcARaw2C(RAcqMemZoneMgr& mem, string& path, uint_4 nmean, uint_4 step, uint_4 nmax) : memgr(mem) { nmax_ = nmax; nmean_ = nmean; step_ = step; stop_ = false; path_ = path; } void BRProcARaw2C::Stop() { stop_=true; // cout <<" BRProcARaw2C::Stop ... > STOP " << endl; } static inline r_4 Zmod2(complex z) { return (z.real()*z.real()+z.imag()*z.imag()); } void BRProcARaw2C::run() { setRC(1); try { Timer tm("BRProcARaw2C"); TimeStamp ts; cout << " BRProcARaw2C::run() - Starting " << ts << " NMaxMemZones=" << nmax_ << " NMean=" << nmean_ << " Step=" << step_ << endl; cout << " BRProcARaw2C::run()... - Output Data Path: " << path_ << endl; char fname[512]; // sprintf(fname,"%s/proc.log",path_.c_str()); // ofstream filog(fname); // filog << " BRProcARaw2C::run() - starting log file " << ts << endl; // filog << " ... NMaxMemZones=" << nmax_ << " NMean=" << nmean_ << " Step=" << step_ << endl; // Initialisation pour calcul FFT TVector< complex > cfour; // composant TF uint_4 paqsz = memgr.PaqSize(); uint_4 procpaqsz = memgr.ProcPaqSize(); BRPaquet pq(NULL, NULL, paqsz); TVector vx(pq.DataSize()/2); vx = (r_4)(0.); FFTPackServer ffts; ffts.FFTForward(vx, cfour); TVector spectreV1, spectreV2; spectreV1.ReSize(cfour.Size()); spectreV2.ReSize(cfour.Size()); TVector< complex > visiV12( cfour.Size() ); uint_4 ifile = 0; uint_4 nzm = 0; for (uint_4 kmz=0; kmz NULL" << endl; break; } Byte* procbuff = memgr.GetProcMemZone(mid); if (procbuff == NULL) { cout << " BRProcARaw2C::run()/ERROR memgr.GetProcMemZone(" << mid << ") -> NULL" << endl; break; } BRPaquet paq0(NULL, buff, paqsz); for(uint_4 i=0; i* zp1 = (complex*)(coeff1); for(sa_size_t j=0; j* zp2 = (complex*)(coeff2); for(sa_size_t j=0; j= nmean_) ||(kmz==(nmax_-1))) { spectreV1 /= (r_4)(nzm); spectreV2 /= (r_4)(nzm); visiV12 /= complex((r_4)nzm, 0.); spectreV1.Info()["NPaqMoy"] = nzm; spectreV2.Info()["NPaqMoy"] = nzm; visiV12.Info()["NPaqMoy"] = nzm; { sprintf(fname,"%s_%d.ppf",path_.c_str(),(int)ifile); POutPersist po(fname); po << PPFNameTag("specV1") << spectreV1; po << PPFNameTag("specV2") << spectreV2; po << PPFNameTag("visiV12") << visiV12; } spectreV1 = (r_4)(0.); spectreV2 = (r_4)(0.); visiV12 = complex(0., 0.); nzm = 0; ifile++; // ts.SetNow(); // filog << ts << " : proc file " << fname << endl; cout << " BRProcARaw2C::run() created file " << fname << endl; } memgr.FreeMemZone(mid, MemZS_ProcA); } } catch (PException& exc) { cout << " BRProcARaw2C::run()/catched PException " << exc.Msg() << endl; setRC(3); return; } catch(...) { cout << " BRProcARaw2C::run()/catched unknown ... exception " << endl; setRC(4); return; } setRC(0); return; }