| [3695] | 1 | // Utilisation de SOPHYA pour faciliter les tests ... | 
|---|
|  | 2 | #include "sopnamsp.h" | 
|---|
|  | 3 | #include "machdefs.h" | 
|---|
|  | 4 |  | 
|---|
|  | 5 | /* ---------------------------------------------------------- | 
|---|
|  | 6 | Programme de lecture / calcul de visibilite multi-canaux | 
|---|
|  | 7 | BAORadio -   LAL/IRFU      R. Ansari, C. Magneville | 
|---|
|  | 8 | V1 : Nov 2009 | 
|---|
|  | 9 | ---------------------------------------------------------- */ | 
|---|
|  | 10 |  | 
|---|
|  | 11 | // include standard c/c++ | 
|---|
|  | 12 | #include <iostream> | 
|---|
|  | 13 | #include <string> | 
|---|
|  | 14 | #include <exception> | 
|---|
|  | 15 |  | 
|---|
|  | 16 | // include sophya mesure ressource CPU/memoire ... | 
|---|
|  | 17 | #include "resusage.h" | 
|---|
|  | 18 | #include "ctimer.h" | 
|---|
|  | 19 | #include "timing.h" | 
|---|
|  | 20 | #include "timestamp.h" | 
|---|
|  | 21 | #include "strutilxx.h" | 
|---|
|  | 22 | #include "tarrinit.h" | 
|---|
|  | 23 | #include "histinit.h" | 
|---|
|  | 24 |  | 
|---|
|  | 25 | #include "brpaqu.h" | 
|---|
|  | 26 | #include "brfitsrd.h" | 
|---|
|  | 27 | #include "brproc.h" | 
|---|
| [3872] | 28 | #include "brviscalc.h" | 
|---|
| [3695] | 29 | #include "brdiskw.h" | 
|---|
|  | 30 |  | 
|---|
|  | 31 | #include "branap.h" | 
|---|
|  | 32 |  | 
|---|
|  | 33 |  | 
|---|
|  | 34 |  | 
|---|
|  | 35 | //---------------------------------------------------- | 
|---|
|  | 36 | //---------------------------------------------------- | 
|---|
|  | 37 | int main(int narg, char* arg[]) | 
|---|
|  | 38 | { | 
|---|
|  | 39 |  | 
|---|
|  | 40 | TArrayInitiator  _inia; | 
|---|
|  | 41 |  | 
|---|
|  | 42 | int rc = 0; | 
|---|
|  | 43 | try { | 
|---|
|  | 44 | // Decodage parametres | 
|---|
|  | 45 | BRAnaParam par; | 
|---|
| [3872] | 46 | cout << " ===> visimfib.cc: decoding command line arguments " << endl; | 
|---|
| [3695] | 47 | rc = par.DecodeArgs(narg, arg); | 
|---|
|  | 48 | if (rc) return rc; | 
|---|
|  | 49 | rc = par.PaqSizeFromFits(); | 
|---|
|  | 50 | if (rc) return rc; | 
|---|
|  | 51 | par.Print(cout); | 
|---|
|  | 52 |  | 
|---|
|  | 53 |  | 
|---|
|  | 54 | cout << " ---------- visimfib.cc Start - Action= " << par.action_ << " ------------- " << endl; | 
|---|
|  | 55 | ResourceUsage resu; | 
|---|
|  | 56 |  | 
|---|
|  | 57 | cout << " visimfib: Creating MemZoneMgr/threads - PaqSz= " << par.paqsize_ << endl; | 
|---|
|  | 58 |  | 
|---|
|  | 59 | RAcqMemZoneMgr mmgr(par.nzones_, par.dirlist_.size(), par.npaqinzone_, par.paqsize_); | 
|---|
|  | 60 | if (par.action_ == "cube3d")  mmgr.SetFinalizedMask((uint_4)MemZS_Saved); | 
|---|
| [3776] | 61 | else  { | 
|---|
|  | 62 | if (par.nbcalgrp_==2) | 
|---|
|  | 63 | mmgr.SetFinalizedMask((uint_4)MemZS_ProcA|(uint_4)MemZS_ProcB); | 
|---|
|  | 64 | else if (par.nbcalgrp_==3) | 
|---|
|  | 65 | mmgr.SetFinalizedMask((uint_4)MemZS_ProcA|(uint_4)MemZS_ProcB|(uint_4)MemZS_ProcC); | 
|---|
|  | 66 | else if (par.nbcalgrp_==4) | 
|---|
|  | 67 | mmgr.SetFinalizedMask((uint_4)MemZS_ProcA|(uint_4)MemZS_ProcB|(uint_4)MemZS_ProcC|(uint_4)MemZS_ProcD); | 
|---|
| [3780] | 68 | else if (par.nbcalgrp_==5) | 
|---|
|  | 69 | mmgr.SetFinalizedMask((uint_4)MemZS_ProcA|(uint_4)MemZS_ProcB|(uint_4)MemZS_ProcC|(uint_4)MemZS_ProcD|(uint_4)MemZS_ProcE); | 
|---|
|  | 70 | else if (par.nbcalgrp_==6) | 
|---|
|  | 71 | mmgr.SetFinalizedMask((uint_4)MemZS_ProcA|(uint_4)MemZS_ProcB|(uint_4)MemZS_ProcC| | 
|---|
|  | 72 | (uint_4)MemZS_ProcD|(uint_4)MemZS_ProcE|(uint_4)MemZS_ProcF); | 
|---|
| [3776] | 73 | else mmgr.SetFinalizedMask((uint_4)MemZS_ProcA); | 
|---|
|  | 74 | } | 
|---|
| [3695] | 75 | BRMultiFitsReader reader(mmgr, par.dirlist_, true, par.imin_, par.imax_, par.istep_); | 
|---|
|  | 76 | reader.SetPrintLevel(par.prtlevel_); | 
|---|
|  | 77 |  | 
|---|
| [3776] | 78 | /*    BRVisibilityCalculator proc(mmgr, par.outpath_, par.nmean_, par.nthreads_); | 
|---|
|  | 79 | proc.SelectFreqBinning(par.freqmin_, par.freqmax_, par.nbinfreq_);  */ | 
|---|
|  | 80 | BRVisCalcGroup procg(par.nbcalgrp_, mmgr, par.outpath_, par.nmean_, par.nthreads_); | 
|---|
|  | 81 | procg.SelectFreqBinning(par.freqmin_, par.freqmax_, par.nbinfreq_); | 
|---|
|  | 82 |  | 
|---|
|  | 83 | if (par.action_ == "viscktt")  procg.ActivateTimeTagCheck(par.TotalNPaquets()); | 
|---|
| [3774] | 84 | BRMeanSpecCalculator procms(mmgr, par.outpath_, par.nmean_); | 
|---|
| [3776] | 85 |  | 
|---|
| [3695] | 86 | FitsCubeWriter wrt(mmgr, par.outpath_, par.nbloc_); | 
|---|
|  | 87 | //    BRBaseProcessor proc(mmgr); | 
|---|
|  | 88 |  | 
|---|
|  | 89 | cout << " visimfib: Starting threads (reader procVisi) ... " << endl; | 
|---|
|  | 90 | reader.start(); | 
|---|
|  | 91 | if (par.action_ == "cube3d")   wrt.start(); | 
|---|
| [3774] | 92 | else if (par.action_ == "mspec")   procms.start(); | 
|---|
| [3776] | 93 | else  procg.start(); | 
|---|
| [3695] | 94 | usleep(200000); | 
|---|
|  | 95 | reader.join(); | 
|---|
|  | 96 | if (par.action_ == "cube3d")  wrt.join(); | 
|---|
| [3774] | 97 | else if (par.action_ == "mspec")  procms.join(); | 
|---|
| [3776] | 98 | else procg.join(); | 
|---|
| [3695] | 99 | mmgr.Print(cout); | 
|---|
|  | 100 | cout << resu ; | 
|---|
|  | 101 | } | 
|---|
|  | 102 | catch (std::exception& sex) { | 
|---|
|  | 103 | cerr << "\n visimfib.cc std::exception :"  << (string)typeid(sex).name() | 
|---|
|  | 104 | << "\n msg= " << sex.what() << endl; | 
|---|
|  | 105 | rc = 78; | 
|---|
|  | 106 | } | 
|---|
|  | 107 | catch (...) { | 
|---|
|  | 108 | cerr << " visimfib.cc catched unknown (...) exception  " << endl; | 
|---|
|  | 109 | rc = 79; | 
|---|
|  | 110 | } | 
|---|
|  | 111 |  | 
|---|
|  | 112 | cout << ">>>> visimfib.cc ------- END ----------- RC=" << rc << endl; | 
|---|
|  | 113 | return rc; | 
|---|
|  | 114 |  | 
|---|
|  | 115 | } | 
|---|
|  | 116 |  | 
|---|
|  | 117 |  | 
|---|