Changeset 1502 in Sophya


Ignore:
Timestamp:
May 18, 2001, 7:29:04 PM (24 years ago)
Author:
cmv
Message:

definition des flags pour TOI flagtoidef.h (added)
Un peu plus pour GenWindowTOIProcessor.
commit mais classe inutilisable en l'etat. cmv 18/5/2001

Location:
trunk/ArchTOIPipe
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/ArchTOIPipe/ProcWSophya/genwproc.cc

    r1496 r1502  
    66#include "ctimer.h"
    77
    8 
    9 // #define DEBUGGENW 1
    10 
    118// -------------------------------------------------------------
    129//   Class GenWindowTOIProcessor : generic processor with window
     
    1411
    1512////////////////////////////////////////////////////////////////
    16 GenWindowTOIProcessor::GenWindowTOIProcessor(int nbinput,int nboutput
    17                                    ,int wsz, int wstep, int wsztot)
     13GenWindowTOIProcessor::GenWindowTOIProcessor(int_4 nbinput,int_4 nboutput
     14                                   ,int_4 wsz, int_4 wstep, int_4 wsztot)
    1815{
    1916  if(nbinput<1) throw ParmError("GenWindowTOIProcessor::Creator nbinput<1 !");
    2017  if(nboutput<0) nboutput=0;
    2118  if(wsz<2) throw ParmError("GenWindowTOIProcessor::Creator wsz<2 !");
    22   if(wsz%2==0) wsz++;
     19  if(wsz%2==0) {if(wsztot==wsz) wsztot++; wsz++;}
    2320  if(wstep<1) wstep=1;
    24   if(wsztot<wsz) wsztot = 2*wsz;  // CMV prise de decision wsztot / wstep
     21  if(wsztot<wsz) wsztot = 2*wsz;
     22  // cas sans intersection entre 2 samples successifs
     23  if(wstep>=wsz) wsztot = wsz;
    2524
    2625  NbInput = nbinput;
     
    3029  WSizeTot = wsztot;
    3130
    32   SNdeb = SNend = StartSample = CurWtIndex = -1;
    33   TotNsCount = 0;
    34 
     31  CurWtIndex = -1;
     32  SNbegin = SNend = StartSample = LastFilledSn = -1;
     33  TotNsCount = TotDecalCount = 0;
     34
     35  SetDbgLevel();
     36  SetWSizeLCR();
    3537  SetDefaultValue();
    3638
     
    3840  TVector<int_8> vi8(1);   // constructeur copie de TArray (taille nulle)
    3941 
    40   int k;
     42  int_4 k;
    4143  for(k=0;k<NbInput;k++) {
    4244    WDataIn.push_back(vr8);
     
    4446    WInFlg.push_back(false);
    4547  }
    46   if(NbOutput) for(k=0;k<NbOutput;k++) {
    47     WDataOut.push_back(vr8);
    48     WFlagOut.push_back(vi8);
    49     WOutFlg.push_back(false);
    50     WPutOutFlg.push_back(false);
    51     WPutOutOwnVector.push_back(false);
    52     OutSample.push_back(0);
    53   }
     48  if(NbOutput)
     49    for(k=0;k<NbOutput;k++) {
     50      WDataOut.push_back(vr8);
     51      WFlagOut.push_back(vi8);
     52      WOutFlg.push_back(false);
     53      WPutOutFlg.push_back(false);
     54      WPutOutOwnVector.push_back(false);
     55      OutSample.push_back(0);
     56    }
    5457}
    5558
     
    5962
    6063////////////////////////////////////////////////////////////////
    61 void GenWindowTOIProcessor::PrintStatus(ostream & os)
    62 {
    63   os<<"\n ------------------------------------------------------ \n"
    64     <<" GenWindowTOIProcessor::PrintStatus() - ["
    65     <<NbInput<<","<<NbOutput<<"] (wtot="<<WSizeTot
    66     <<" WindowSize="<<GetWSize()
    67     <<" WStep= "<<GetWStep()<<endl;
    68   TOIProcessor::PrintStatus(os);
    69   os<<"ProcessedSampleCount="<<ProcessedSampleCount()<<endl;
    70   os<<"------------------------------------------------------ "<<endl;
    71 }
    72 
    73 ////////////////////////////////////////////////////////////////
    74 TVector<r_8> GenWindowTOIProcessor::GetWData(int numtoi)
     64void GenWindowTOIProcessor::PrintStatus(ostream & os,int lp)
     65{
     66os<<"\n ------------------------------------------------------ \n"
     67  <<" GenWindowTOIProcessor::PrintStatus() - ["<<NbInput<<","<<NbOutput<<"]"<<endl
     68  <<" WSizeTot="<<WSizeTot<<" WSize="<<GetWSize()<<" WStep= "<<GetWStep()<<endl;
     69if(lp>0) {
     70  os<<" WindowLCR: "
     71    <<" L=("<<W0Left<<","<<GetWSize('l')<<")"
     72    <<" C=("<<W0Center<<","<<GetWSize('c')<<")"
     73    <<" R=("<<W0Right<<","<<GetWSize('r')<<")"
     74    <<endl;
     75}
     76TOIProcessor::PrintStatus(os);
     77os<<"ProcessedSampleCount="<<ProcessedSampleCount()<<" NbDecal="<<TotDecalCount<<endl;
     78os<<"------------------------------------------------------ "<<endl;
     79}
     80
     81////////////////////////////////////////////////////////////////
     82TVector<r_8> GenWindowTOIProcessor::GetWData(int_4 numtoi)
    7583{
    7684  if(numtoi<0 || numtoi>=NbInput)
     
    8189}
    8290
    83 TVector<int_8> GenWindowTOIProcessor::GetWFlag(int numtoi)
     91TVector<int_8> GenWindowTOIProcessor::GetWFlag(int_4 numtoi)
    8492{
    8593  if(numtoi<0 || numtoi>=NbInput)
     
    9098}
    9199
    92 r_8 * GenWindowTOIProcessor::GetWDataPointer(int numtoi)
     100r_8 * GenWindowTOIProcessor::GetWDataPointer(int_4 numtoi)
    93101{
    94102  if(numtoi<0 || numtoi>=NbInput)
     
    100108}
    101109 
    102 int_8 * GenWindowTOIProcessor::GetWFlagPointer(int numtoi)
     110int_8 * GenWindowTOIProcessor::GetWFlagPointer(int_4 numtoi)
    103111{
    104112  if(numtoi<0 || numtoi>=NbInput)
     
    109117}
    110118
    111 void GenWindowTOIProcessor::GetData(int numtoi, int_8 numsample, r_8 & data, int_8 & flag)
     119void GenWindowTOIProcessor::GetData(int_4 numtoi, int_8 numsample, r_8 & data, int_8 & flag)
    112120{
    113121  if(numtoi<0 || numtoi>=NbInput)
     
    115123  if(!WInFlg[numtoi])
    116124    throw ParmError("GenWindowTOIProcessor::GetData : toi not connected!");
    117   int_8 k = numsample-GetStartSample();
     125  int_8 k = numsample-GetWStartSample();
    118126  if ((k<0) || (k >= GetWSize()))
    119127    throw RangeCheckError("GenWindowTOIProcessor::GetData : numsample out of window!");
     
    127135                                    ,TVector<r_8>& data,TVector<int_8>& flag)
    128136{
    129   if(numtoi<0 || numtoi>=NbOutput)
     137  if(numtoi<0 || numtoi>=NbOutput || NbOutput<=0)
    130138    throw RangeCheckError("GenWindowTOIProcessor::PutWFlag : toi out of range !");
    131139  if(!WOutFlg[numtoi])
     
    145153                                    ,r_8 data,int_8 flag)
    146154{
    147   if(numtoi<0 || numtoi>=NbOutput)
     155  if(numtoi<0 || numtoi>=NbOutput || NbOutput<=0)
    148156    throw RangeCheckError("GenWindowTOIProcessor::PutWFlag : toi out of range !");
    149157  if(!WOutFlg[numtoi])
     
    160168}
    161169
     170/******* cmv routines
     171void GenWindowTOIProcessor::PutWData(int_4 numtoi,int_8 numsample
     172                                    ,TVector<r_8>& data,TVector<int_8>& flag)
     173{
     174  if(numtoi<0 || numtoi>=NbOutput || NbOutput<=0)
     175    throw RangeCheckError("GenWindowTOIProcessor::PutWData : toi out of range !");
     176  if(!WOutFlg[numtoi])
     177    throw ParmError("GenWindowTOIProcessor::PutWData : toi not connected!");
     178  if(data.Size()!=flag.Size())
     179    throw ParmError("GenWindowTOIProcessor::PutWData : data.Size()!=flag.Size()!");
     180  if(data.Size() == 0)
     181    throw ParmError("GenWindowTOIProcessor::PutWData : data.Size()==0 !");
     182
     183  for(int_4 k=0;k<data.Size(); k++)
     184     putData(numtoi,numsample+k,data(k),flag(k));
     185}
     186
     187void GenWindowTOIProcessor::PutWData(int_4 numtoi,int_8 numsample
     188                                    ,r_8 data,int_8 flag)
     189{
     190  if(numtoi<0 || numtoi>=NbOutput || NbOutput<=0)
     191    throw RangeCheckError("GenWindowTOIProcessor::PutWData : toi out of range !");
     192  if(!WOutFlg[numtoi])
     193    throw ParmError("GenWindowTOIProcessor::PutWData : toi not connected!");
     194
     195  putData(numtoi,numsample,data,flag);
     196}
     197*********/
     198
     199////////////////////////////////////////////////////////////////
     200void GenWindowTOIProcessor::SetWSizeLCR(int_4 wszl,int_4 wszc,int_4 wszr)
     201// Fenetre a gauche, au centre et a droite du pixel central
     202// Selon la logique:
     203//-----------------------------------------------
     204//                     | pixel central
     205//                     |
     206//                     |
     207//          | wszl | wszc | wszr |
     208//                     |
     209//       |           WSize           |
     210//-----------------------------------------------
     211// wszc toujours impair SVP.
     212// Default: 0,0,0 : WSize/2,1,WSize/2
     213{
     214 int_4 wsz2 = WSize/2;
     215 // Default
     216 if(wszl<=0 && wszc<=0 && wszr<=0) {
     217   WSizeLeft = WSizeRight = wsz2; WSizeCenter = 1;
     218   W0Left = 0; W0Center = wsz2;   W0Right = wsz2+1;
     219   return;
     220 }
     221
     222 // Fenetre centrale
     223 if(wszc<=0)    wszc = 1;
     224 if(wszc%2==0)  wszc++;
     225 if(wszc>WSize) wszc = WSize;
     226 WSizeCenter = wszc;
     227 W0Center = wsz2 - WSizeCenter/2;
     228
     229 // Fenetre de gauche
     230 if(wszl<=0) wszl = WSize;
     231 W0Left = W0Center - wszl;
     232 if(W0Left<0) W0Left = 0;
     233 WSizeLeft = W0Center - W0Left;
     234 if(WSizeLeft<=0) WSizeLeft = 1;
     235
     236 // Fenetre de droite
     237 if(wszr<=0) wszr = WSize;
     238 W0Right = W0Center + WSizeCenter;
     239 if(W0Right>=WSize) W0Right = WSize - 1;
     240 int_4 dum = W0Right + wszr; if(dum>WSize) dum = WSize;
     241 WSizeRight = dum - W0Right;
     242 if(WSizeRight<=0) WSizeRight = 1;
     243}
     244
     245TVector<r_8> GenWindowTOIProcessor::GetWData(char cw,int_4 numtoi)
     246// cr='l' fenetre de gauche, 'c' du centre, 'r' de droite, autre = tout
     247{
     248 if(numtoi<0 || numtoi>=NbInput)
     249    throw RangeCheckError("GenWindowTOIProcessor::GetWData(lcr) : toi out of range !");
     250 if(!WInFlg[numtoi])
     251   throw ParmError("GenWindowTOIProcessor::GetWData(lcr) : toi not connected!");
     252 return (WDataIn[numtoi])(Range(StartWtIndex(cw),0,GetWSize(cw)));
     253}
     254
     255TVector<int_8> GenWindowTOIProcessor::GetWFlag(char cw,int_4 numtoi)
     256// cr='l' fenetre de gauche, 'c' du centre, 'r' de droite, autre = tout
     257{
     258 if(numtoi<0 || numtoi>=NbInput)
     259   throw RangeCheckError("GenWindowTOIProcessor::GetWFlag(lcr) : toi out of range !");
     260 if(!WInFlg[numtoi])
     261   throw ParmError("GenWindowTOIProcessor::GetWFlag(lcr) : toi not connected!");
     262 return (WFlagIn[numtoi])(Range(StartWtIndex(cw),0,GetWSize(cw)));
     263}
     264
     265r_8 * GenWindowTOIProcessor::GetWDataPointer(char cw,int_4 numtoi,int_4& n)
     266// cr='l' fenetre de gauche, 'c' du centre, 'r' de droite, autre = tout
     267{
     268 if(numtoi<0 || numtoi>=NbInput)
     269   throw RangeCheckError("GenWindowTOIProcessor::GetWDataPointe(lcr)r : toi out of range !");
     270 if(!WInFlg[numtoi])
     271   throw ParmError("GenWindowTOIProcessor::GetWDataPointer(lcr) : toi not connected!");
     272 n = GetWSize(cw);
     273 return (WDataIn[numtoi].Data()+StartWtIndex(cw));
     274
     275}
     276 
     277int_8 * GenWindowTOIProcessor::GetWFlagPointer(char cw,int_4 numtoi,int_4& n)
     278// cr='l' fenetre de gauche, 'c' du centre, 'r' de droite, autre = tout
     279{
     280 if(numtoi<0 || numtoi>=NbInput)
     281   throw RangeCheckError("GenWindowTOIProcessor::GetWFlagPointer(lcr) : toi out of range !");
     282 if(!WInFlg[numtoi])
     283   throw ParmError("GenWindowTOIProcessor::GetWFlagPointer(lcr) : toi not connected!");
     284 n = GetWSize(cw);
     285 return (WFlagIn[numtoi].Data()+StartWtIndex(cw));
     286}
     287
    162288////////////////////////////////////////////////////////////////
    163289void GenWindowTOIProcessor::UserInit(int_8 kstart)
     
    181307  cout << "GenWindowTOIProcessor::init" << endl;
    182308  char buff[64];
    183   int k;
     309  int_4 k;
    184310  for(k=0; k<NbInput; k++) {
    185311    sprintf(buff,"in%d", k);
    186312    declareInput(buff);
    187313  }
    188   for(k=0; k<NbOutput; k++) {
    189     sprintf(buff,"out%d",k);
    190     declareOutput(buff);
    191   }
     314  if(NbOutput)
     315    for(k=0; k<NbOutput; k++) {
     316      sprintf(buff,"out%d",k);
     317      declareOutput(buff);
     318    }
    192319  name = "GenWindowTOIProcessor";
    193320  // upExtra = 1; $CHECK a quoi ca sert EA?
     
    197324{
    198325  //  TOIManager* mgr = TOIManager::getManager();
    199   SNdeb = getMinIn();
    200   SNend = getMaxIn();
    201   if(SNend-SNdeb<WSize)
     326  SNbegin = getMinIn();
     327  SNend   = getMaxIn();
     328
     329  if(SNend-SNbegin<WSize)
    202330    throw ParmError("GenWindowTOIProcessor::run : sne-snb<WSize !");
    203331
    204332  // Allocation des tailles pour les vecteurs
    205   int kc, nc=0;
     333  int_4 kc, nc=0;
    206334  for(kc=0;kc<NbInput;kc++) {
    207335    if( !(WInFlg[kc]=checkInputTOIIndex(kc)) ) continue;
     
    214342    throw ParmError("GenWindowTOIProcessor::run() No input TOI connected!");
    215343  }
    216   for(kc=0;kc<NbOutput;kc++) WOutFlg[kc] = checkOutputTOIIndex(kc);
     344  if(NbOutput)
     345    for(kc=0;kc<NbOutput;kc++) WOutFlg[kc] = checkOutputTOIIndex(kc);
    217346
    218347  // Lecture des samples et remplissage des vecteurs
    219   cout<<"GenWindowTOIProcessor::run() SNRange="<<SNdeb<<" - "<<SNend<<endl;
     348  cout<<"GenWindowTOIProcessor::run() SNRange="<<SNbegin<<" - "<<SNend<<endl;
    220349  try {
    221350    Timer tm("GenWindowTOIProcessor::run()");
    222     for(int_8 ks=SNdeb;ks<=SNend;ks++) {  // CMV gerer le += step
     351    int_4 wsz2=WSize/2;
     352    int_8 ksend = SNbegin;
     353    for(int_8 ks=SNbegin; ks<=SNend; ks+=WStep) {
     354
    223355      Remplissage(ks);
    224       if (ks == SNdeb) {
    225         UserInit(ks);
    226         Ecriture();
    227       }
    228       if ((ks-SNdeb)%WStep == 0) {
    229         UserProc(ks);
    230         // Il faut traiter les ecritures en sortie
    231         Ecriture();
    232       }
     356      if(DbgLevel) test_avec_print(ks);
     357
     358      if(ks == SNbegin) {UserInit(ks); Ecriture();}
     359
     360      UserProc(ks);
     361      Ecriture();
     362
     363      ksend = ks;
    233364      TotNsCount++;
    234365    }
    235     UserEnd(SNend);
    236     Ecriture();
     366    UserEnd(ksend); Ecriture();
    237367    cout << " GenWindowTOIProcessor::run() - End of processing " << endl;
    238368
     
    249379//      samples :   sn-ws/2        sn          sn+ws/2
    250380//      fenetre :   0              ws/2+1      ws-1
    251 {
    252 #ifdef DEBUGGENW
    253  cout << "GenWindowTOIProcessor::Remplissage(" << ks << ") CurWtIndex=" << CurWtIndex << endl;
    254 #endif
    255 
    256 if(ks<SNdeb || ks>SNend) {
    257   cerr << "GenWindowTOIProcessor::remplissage/Erreur : ks(=" << ks << ") <"
    258        << SNdeb << " || ks>" << SNend << endl;
    259   throw RangeCheckError("GenWindowTOIProcessor::remplissage : ks<SNdeb || ks>SNend !");
    260  }
    261 int_8 wsz2=WSize/2;
    262 
    263 StartSample = ks - wsz2; // peut etre < snb au debut
    264 
    265 // Premier remplissage ???? Gestion de la borne inferieure
     381// Cette routine doit etre utilisee dans une boucle:
     382//      for(int k=???; k<???; k+=WStep) .....
     383// Dans le grand buffer WSizeTot il doit y avoir WSize samples
     384//      entre ks1=ks-wsz2 et ks2=ks-wsz2  (ks1<=k<=ks2)
     385// En ENTREE de cette routine :
     386// - CurWtIndex = c'est l'index du tableau WSizeTot qui doit etre rempli
     387//                (le dernier index qui a ete rempli par l'appel precedent
     388//                 est donc CurWtIndex-1)
     389// - LastFilledSn = c'est le dernier numero de sample qui a ete rempli
     390//                  dans le tableau WSizeTot par l'appel precedent
     391{
     392int_4 wsz2=WSize/2;
     393
     394// Numero de sample du premier element du tableau WSize
     395//   (peut etre < SNbegin au debut)
     396StartSample = ks - wsz2;
     397
     398// on doit avoir les samples [ks1,ks2] dans le buffer
     399// (mais selon le step, certain peuvent etre deja remplis)
     400int_8 ks1 = ks-wsz2, ks2 = ks+wsz2;
     401
     402if(DbgLevel>1)
     403  cout<<"DBG-GenWindowTOIProcessor::Remplissage("<<ks
     404      <<") ["<<ks1<<","<<ks2<<"]"
     405      <<" CurWtIndex="<<CurWtIndex<<" LastFilledSn="<<LastFilledSn<<endl;
     406
     407//--------------------------------------------------------
     408// Premier remplissage ????
     409// Gestion de la borne inferieure pour le permier sample
     410//--------------------------------------------------------
    266411if(CurWtIndex<0) {
    267 #ifdef DEBUGGENW
    268   cout << "GenWindowTOIProcessor::Remplissage 1ere fois" << endl;
    269 #endif
     412  if(DbgLevel>1)
     413    cout<<"DBG-GenWindowTOIProcessor::Remplissage 1ere fois"<<endl;
     414  for(int_4 ntoi=0; ntoi<NbInput; ntoi++) {
     415    if(!WInFlg[ntoi]) continue;
     416    for(int_8 k=ks1, j=0; k<=ks2; k++, j++) {
     417      if(k>=SNbegin && k<=SNend) {
     418        getData(ntoi,k,(WDataIn[ntoi])(j),(WFlagIn[ntoi])(j));
     419      } else {
     420        (WDataIn[ntoi])(j) = R8DefVal; (WFlagIn[ntoi])(j) = I8DefVal;
     421      }
     422    }
     423  }
     424  CurWtIndex = ks2 - ks1 + 1;
     425  LastFilledSn = ks2;
     426  return;
     427}
     428
     429//--------------------------------------------------------
     430// Faut-il decaler ????
     431//--------------------------------------------------------
     432if(WStep>=WSize) {
     433  // On ne decale pas puisque entre 2 appels a la routine
     434  // il faut TOUT recharger (aucun sample deja charge n'est utile)
    270435  CurWtIndex = 0;
    271   for(int_8 k=ks-wsz2; k<=ks+wsz2; k++) { // Lecture TOI
    272     for(int kc=0; kc<NbInput; kc++) {
    273       if(!WInFlg[kc]) continue;
    274       if(k>=SNdeb && k<=SNend) {
    275         getData(kc,k,(WDataIn[kc])(CurWtIndex), (WFlagIn[kc])(CurWtIndex));
    276       } else {
    277         (WDataIn[kc])(CurWtIndex) = R8DefVal;
    278         (WFlagIn[kc])(CurWtIndex) = I8DefVal;
     436} else {
     437  // Certains samples deja charges sont utiles
     438  int_8 ifin = ks2 - LastFilledSn + CurWtIndex-1;
     439  if(ifin >= WSizeTot) { // On decale
     440    int_8 ideb = CurWtIndex-1 - LastFilledSn + ks1;
     441    if(DbgLevel>1)
     442      cout<<"DBG-GenWindowTOIProcessor::Remplissage ... Decalage ideb="<<ideb
     443          <<" ifin="<<ifin<< endl;
     444    for(int_4 ntoi=0; ntoi<NbInput; ntoi++) {
     445      if(!WInFlg[ntoi]) continue;
     446      for(int_4 i=ideb, j=0; i<CurWtIndex; i++, j++) {
     447        (WDataIn[ntoi])(j) = (WDataIn[ntoi])(i);
     448        (WFlagIn[ntoi])(j) = (WFlagIn[ntoi])(i);
    279449      }
    280450    }
    281     CurWtIndex++;
    282   }
    283   return;
    284 }
    285 
    286 // CMV gere decalage seulement si step < wsize sinon copie.
    287 // Faut-il decaler ????
    288 if(CurWtIndex == WSizeTot) { // On decale
    289 #ifdef DEBUGGENW
    290   cout << "GenWindowTOIProcessor::Remplissage Decalage " << endl;
    291 #endif
    292   for(int kc=0; kc<NbInput; kc++) {
    293     if(!WInFlg[kc]) continue;
    294       for(int_8 k=1;k<WSize;k++) { // un en moins car on va remplir apres
    295         (WDataIn[kc])(k-1) = (WDataIn[kc])(WSizeTot-WSize+k);
    296         (WFlagIn[kc])(k-1) = (WFlagIn[kc])(WSizeTot-WSize+k);
    297       }
    298   }
    299   CurWtIndex = WSize-1;
    300 }
    301 
    302 // Remplissage de ks+wsz2 (dernier element de la fenetre pour ks central)
    303 int_8 kse = ks+wsz2;
    304 #ifdef DEBUGGENW
    305   cout << "GenWindowTOIProcessor::Normal fill " << endl;
    306 #endif
    307 for(int kc=0; kc<NbInput; kc++) {
    308   if(!WInFlg[kc]) continue;
    309   if(kse>=SNdeb && kse<=SNend) {
    310     getData(kc,kse,(WDataIn[kc])(CurWtIndex),(WFlagIn[kc])(CurWtIndex));
    311   } else {
    312     (WDataIn[kc])(CurWtIndex) = R8DefVal;
    313     (WFlagIn[kc])(CurWtIndex) = I8DefVal;
    314   }
    315 }
    316 CurWtIndex++;
     451    CurWtIndex = CurWtIndex-ideb;
     452    TotDecalCount++;
     453  }
     454}
     455
     456// Remplissage des samples utiles pour ks
     457if(ks1<=LastFilledSn) ks1 = LastFilledSn+1;
     458if(DbgLevel>1)
     459  cout<<"DBG-GenWindowTOIProcessor::Normal fill de ["<<ks1<<","<<ks2<<"]"<<endl;
     460for(int_4 ntoi=0; ntoi<NbInput; ntoi++) {
     461  if(!WInFlg[ntoi]) continue;
     462  for(int_4 k=ks1, j=CurWtIndex; k<=ks2; k++, j++) {
     463    if(k>=SNbegin && k<=SNend) {
     464      getData(ntoi,k,(WDataIn[ntoi])(j),(WFlagIn[ntoi])(j));
     465    } else {
     466      (WDataIn[ntoi])(j) = R8DefVal; (WFlagIn[ntoi])(j) = I8DefVal;
     467    }
     468  }
     469}
     470CurWtIndex += ks2 - ks1 + 1;
     471LastFilledSn = ks2;
    317472
    318473return;
     
    337492  for(kc=0; kc<NbOutput; kc++)  WPutOutFlg[kc] = false;
    338493}
     494
     495////////////////////////////////////////////////////////////////
     496void  GenWindowTOIProcessor::test_avec_print(int_8 ks)
     497{
     498if(DbgLevel<=0) return;
     499
     500int i,ii=0;
     501r_8   * datatot = WDataIn[0].Data();
     502int_8 * flagtot = WFlagIn[0].Data();
     503r_8   * data = GetWDataPointer();
     504int_8 * flag = GetWFlagPointer();
     505int_4 nl,nc,nr;
     506r_8   * datal = GetWDataPointer('l',nl);
     507int_8 * flagl = GetWFlagPointer('l',nl);
     508r_8   * datac = GetWDataPointer('c',nc);
     509int_8 * flagc = GetWFlagPointer('c',nc);
     510r_8   * datar = GetWDataPointer('r',nr);
     511int_8 * flagr = GetWFlagPointer('r',nr);
     512
     513cout<<"-------- ks = "<<ks<<endl;
     514
     515if(DbgLevel>2) {
     516  cout<<"datatot = ";
     517  for(i=0;i<WSizeTot;i++) {ii=0; cout<<" "<<datatot[i]; if(i%10==9) {cout<<endl; ii=1;}}
     518        if(ii==0) cout<<endl;
     519  cout<<"flagtot = ";
     520  for(i=0;i<WSizeTot;i++) {ii=0; cout<<" "<<flagtot[i]; if(i%10==9) {cout<<endl; ii=1;}}
     521        if(ii==0) cout<<endl;
     522}
     523
     524cout<<"data = ";
     525for(i=0;i<GetWSize();i++) {ii=0; cout<<" "<<data[i]; if(i%10==9) {cout<<endl; ii=1;}}
     526        if(ii==0) cout<<endl;
     527cout<<"flag = ";
     528for(i=0;i<GetWSize();i++) {ii=0; cout<<" "<<flag[i]; if(i%10==9) {cout<<endl; ii=1;}}
     529        if(ii==0) cout<<endl;
     530
     531if(DbgLevel>2) {
     532  cout<<"datal = ";
     533  for(i=0;i<nl;i++) {ii=0; cout<<" "<<datal[i]; if(i%10==9) {cout<<endl; ii=1;}}
     534        if(ii==0) cout<<endl;
     535  cout<<"flagl = ";
     536  for(i=0;i<nl;i++) {ii=0; cout<<" "<<flagl[i]; if(i%10==9) {cout<<endl; ii=1;}}
     537        if(ii==0) cout<<endl;
     538  cout<<"datac = ";
     539  for(i=0;i<nc;i++) {ii=0; cout<<" "<<datac[i]; if(i%10==9) {cout<<endl; ii=1;}}
     540        if(ii==0) cout<<endl;
     541  cout<<"flagc = ";
     542  for(i=0;i<nc;i++) {ii=0; cout<<" "<<flagc[i]; if(i%10==9) {cout<<endl; ii=1;}}
     543        if(ii==0) cout<<endl;
     544  cout<<"datar = ";
     545  for(i=0;i<nr;i++) {ii=0; cout<<" "<<datar[i]; if(i%10==9) {cout<<endl; ii=1;}}
     546        if(ii==0) cout<<endl;
     547  cout<<"flagr = ";
     548  for(i=0;i<nr;i++) {ii=0; cout<<" "<<flagr[i]; if(i%10==9) {cout<<endl; ii=1;}}
     549        if(ii==0) cout<<endl;
     550}
     551}
  • trunk/ArchTOIPipe/ProcWSophya/genwproc.h

    r1496 r1502  
    1212class GenWindowTOIProcessor : public TOIProcessor {
    1313public:
    14   GenWindowTOIProcessor(int nbinput,int nboutput,int wsz, int wstep=1, int wsztot=-1);
     14  GenWindowTOIProcessor(int_4 nbinput,int_4 nboutput,int_4 wsz, int_4 wstep=1, int_4 wsztot=-1);
    1515  virtual ~GenWindowTOIProcessor();
    1616
    17   inline int_8 GetWSize() const { return WSize; }
    18   inline int_8 GetWStep() const { return WStep; }
    19   inline int_8 ProcessedSampleCount() const { return TotNsCount; }
     17  inline int_4 GetWSize() const { return WSize; }
     18  inline int_4 GetWStep() const { return WStep; }
     19  inline int_4 ProcessedSampleCount() const { return TotNsCount; }
    2020
    21   inline int_8 GetStartSample()  {return StartSample;}
    22   inline int_8 GetCenterSample() {return StartSample + WSize/2;}
    23   inline int_8 StartSampleNum() { return SNdeb; }
    24   inline int_8 EndSampleNum() { return SNend; }
     21  // DbgLevel = 0 : No debug
     22  // DbgLevel = 1 : Print fenetre WSize
     23  // DbgLevel = 2 : 1 + Print logique remplissage/decalage
     24  // DbgLevel = 3 : 2 + Print fenetre WSizeTot et WSizeL,C,R
     25  inline void SetDbgLevel(int_2 lp=0) {DbgLevel = (lp>0) ? lp : 0;}
     26
     27  void SetWSizeLCR(int_4 wszl=0,int_4 wszc=0,int_4 wszr=0);
     28  inline int_4 GetWSize(char cw)
     29               {if     (cw=='l') return WSizeLeft;
     30                else if(cw=='c') return WSizeCenter;
     31                else if(cw=='r') return WSizeRight;
     32                                 return WSize;}
     33
     34  inline int_8 GetWStartSample()  {return StartSample;}
     35  inline int_8 GetWCenterSample() {return StartSample + WSize/2;}
     36  inline int_8 GetWCenterIndex()  {return WSize/2;}
     37  inline int_8 StartSampleNum()   {return SNbegin;}
     38  inline int_8 EndSampleNum()     {return SNend;}
    2539
    2640  inline void SetDefaultValue(r_8 r8dval=0., int_8 i8dval=0)
    2741                      {R8DefVal = r8dval; I8DefVal = i8dval;}
    2842
    29   TVector<r_8> GetWData(int numtoi=0);
    30   TVector<int_8> GetWFlag(int numtoi=0);
    31   r_8 * GetWDataPointer(int numtoi=0);
    32   int_8 * GetWFlagPointer(int numtoi=0);
    33   void GetData(int numtoi, int_8 numsample, r_8 & data, int_8 & flag);
     43  TVector<r_8> GetWData(int_4 numtoi=0);
     44  TVector<int_8> GetWFlag(int_4 numtoi=0);
     45  r_8 * GetWDataPointer(int_4 numtoi=0);
     46  int_8 * GetWFlagPointer(int_4 numtoi=0);
     47  void GetData(int_4 numtoi, int_8 numsample, r_8 & data, int_8 & flag);
    3448  inline void GetData(int_8 numsample, r_8 & data, int_8 & flag)
    3549                      { GetData(0, numsample, data, flag); }
    3650
    37   void PutWData(int numtoi,int_8 numsample,TVector<r_8>& data,TVector<int_8>& flag);
    38   void PutWData(int numtoi,int_8 numsample,r_8 data,int_8 flag);
     51  TVector<r_8> GetWData(char cw,int_4 numtoi=0);
     52  TVector<int_8> GetWFlag(char cw,int_4 numtoi=0);
     53  r_8   * GetWDataPointer(char cw,int_4 numtoi,int_4& n);
     54  int_8 * GetWFlagPointer(char cw,int_4 numtoi,int_4& n);
     55  inline   r_8 * GetWDataPointer(char cw,int_4& n)
     56                 {return GetWDataPointer(cw,0,n);}
     57  inline int_8 * GetWFlagPointer(char cw,int_4& n)
     58                 {return GetWFlagPointer(cw,0,n);}
     59
     60  void PutWData(int_4 numtoi,int_8 numsample,TVector<r_8>& data,TVector<int_8>& flag);
     61  void PutWData(int_4 numtoi,int_8 numsample,r_8 data,int_8 flag);
    3962  inline void PutWData(int_8 numsample,TVector<r_8>& data,TVector<int_8>& flag)
    4063                      {PutWData(0,numsample,data,flag);}
     
    4265                      {PutWData(0,numsample,data,flag);}
    4366
    44   virtual void PrintStatus(ostream & os);
     67  virtual void PrintStatus(ostream & os,int lp=0);
    4568
    4669  virtual void UserInit(int_8 kstart);
     
    5477  void Remplissage(int_8 ks);
    5578  void Ecriture();
    56   inline int_8 StartWtIndex()
    57          {if(CurWtIndex<0) return -1; else return CurWtIndex-WSize;}
    58   inline int_8 CenterWtIndex()
    59          {if(CurWtIndex<0) return -1; else return CurWtIndex-(WSize+1)/2;}
     79  void test_avec_print(int_8 ks);
     80  inline int_4 StartWtIndex()  {return CurWtIndex-WSize;}
     81  inline int_4 CenterWtIndex() {return CurWtIndex-(WSize+1)/2;}
     82  inline int_4 StartWtIndex(char cw)
     83         {if     (cw=='l') return StartWtIndex()+W0Left;
     84          else if(cw=='c') return StartWtIndex()+W0Center;
     85          else if(cw=='r') return StartWtIndex()+W0Right;
     86                           return StartWtIndex();}
    6087
    61   int NbInput,NbOutput;
    62   int_8 WSizeTot,WSize,WStep;
    63   int_8 SNdeb,SNend;
    64   int_8 StartSample,CurWtIndex;
    65   int_8 TotNsCount;
    66   r_8 R8DefVal;
     88  int_2 DbgLevel;
     89  int_4 NbInput,NbOutput;
     90  int_4 WSizeTot,WSize,WStep;
     91  int_4 WSizeLeft,WSizeCenter,WSizeRight, W0Left,W0Center,W0Right;
     92  int_8 SNbegin,SNend;
     93  int_8 TotNsCount,TotDecalCount;
     94  r_8   R8DefVal;
    6795  int_8 I8DefVal;
     96
     97  int_4 CurWtIndex;   // Prochain index a remplir dans le buffer WSizeTot
     98  int_8 LastFilledSn; // Numero du dernier sample remplie
     99  int_8 StartSample;  // Numero de sample du 1er element du buffer WSize
     100
    68101  vector< TVector<r_8>   > WDataIn;
    69102  vector< TVector<int_8> > WFlagIn;
     103  vector< bool > WInFlg;
    70104  vector< TVector<r_8>   > WDataOut;
    71105  vector< TVector<int_8> > WFlagOut;
    72   vector< bool > WInFlg;
    73106  vector< bool > WOutFlg;
    74107  vector< bool > WPutOutFlg;
  • trunk/ArchTOIPipe/TestPipes/tgenw.cc

    r1497 r1502  
    11/*   Test de GenWindowTOIProcessor (generic processor with window)
    2 
    32----------------   Exemple d'appel  ---------------------
    4 csh> time ./tgenw -intoi bolo -start 1 -end 50000 -wgen 128,1,256 \
    5            bols.fits xx.fits
    6 // CMV tester wgen 16,64,...
     3csh> time ./tgenw -intoi bolo -start 1 -end 50000 -wgen 16,1,64 -wlcr 0,0,0 \
     4           -dbg 0 toto.fits xx.fits
    75*/
    8 
    9 
    106
    117#include "machdefs.h"
     
    2723class TGenWProc : public GenWindowTOIProcessor {
    2824public:
    29   TGenWProc(int wsz, int step, int wt);
     25  TGenWProc(int ntoiout, int wsz, int step, int wt);
    3026  virtual void UserInit(int_8 kstart);
    3127  virtual void UserProc(int_8 ks);
    3228  virtual void UserEnd(int_8 kend);
    33 
     29protected:
     30  int_8 SNRunning;
    3431};
    3532
    36 TGenWProc::TGenWProc(int wsz, int step, int wt)
    37   : GenWindowTOIProcessor(1,1,wsz,step,wt)
    38 {
     33TGenWProc::TGenWProc(int ntoiout,int wsz, int step, int wt)
     34  : GenWindowTOIProcessor(1,ntoiout,wsz,step,wt)
     35{
     36  SNRunning = 1;
    3937}
    4038void TGenWProc::UserInit(int_8 kstart)
     
    4947void TGenWProc::UserProc(int_8 ks)
    5048{
    51   if ( (ks == StartSampleNum()) || (ks >= EndSampleNum()-1) || (ks%1000 == 0) )
    52     cout << "TGenWProc::UserProc(" << ks << ") CenterSample=" << GetCenterSample() << endl;
    53   if (GetWStep() > 1) {
     49  if( ks==StartSampleNum() || ks>=EndSampleNum()-1 || ks%1000==0 )
     50    cout<<"TGenWProc::UserProc("<<ks<<") CenterSample="<<GetWCenterSample()<<endl;
     51
     52  // Test pour fichier cmv toto.fits (sn=100000+i, bolo=i)
     53  r_8 * datatest = GetWDataPointer();
     54  for(int_4 i=0;i<WSize;i++) {
     55    int_8 k=ks-WSize/2+i;
     56    if(k<SNbegin || k>SNend) continue;
     57    if(datatest[i]!=k-100000) {cout<<"PROBLEME ks="<<ks<<endl; break;}
     58  }
     59
     60  if(!NbOutput) return;
     61
     62  if(GetWStep()==1) {
     63    // Cas ou on a un step de 1
     64    r_8 data;
     65    int_8 flag;
     66    GetData(ks,data,flag);
     67    PutWData(ks,data,flag);
     68
     69  } else if(GetWStep()<GetWSize()) {
     70    // Cas ou on a un step plus petit que la fenetre:
     71    // on peut donc reconstituer le TOI original en sortie
     72    // (ca marche aussi pour WStep==1 mais test different)
     73    // ATTENTION: l'ordre d'ecriture depend de la taille relative
     74    // de WSize et WStep.
     75    // Il faut en plus faire attention au premier echantillon et au dernier
     76    // Visiblement il faut ecrire autant de donnees en sortie que lues en entree (??)
     77    // ===> Conduit a une logique d'une simplicite extreme:
     78    // ATTENTION: dans certains cas ca bloque car il peut arriver que
     79    // SNend ne soit jamais atteint selon les valeurs de WSize/WStep !
     80    // et on ne peut donc pas ecrire autant de valeurs en sortie que lues en entree
    5481    TVector<r_8> data;
    5582    TVector<int_8> flag;
    56     data = GetWData()(Range(GetWSize()/2,0,GetWStep()));
    57     flag = GetWFlag()(Range(GetWSize()/2,0,GetWStep()));
    58     PutWData(GetCenterSample(), data, flag);
    59   }
    60   else {
    61     //    PutWData(GetCenterSample(), GetWData()(GetWSize()/2), GetWFlag()(GetWSize()/2));
    62     r_8 data;
    63     int_8 flag;
    64     GetData(GetCenterSample(), data, flag);
    65     PutWData(GetCenterSample(), data, flag);
    66   }
     83    int_4 ideb,ifin,isndeb;
     84    if(GetWStep()<=GetWSize()/2+1) {
     85      //  ------|------
     86      //      ------|------
     87      //        :   :
     88      //        WStep
     89      //        :  :
     90      //        d..f
     91      ideb = GetWCenterIndex();
     92      isndeb = GetWCenterSample();
     93      ifin = ideb + GetWStep()-1;
     94    } else {
     95      //  ------|------
     96      //             ------|------
     97      //        :          :
     98      //            WStep
     99      //  :         :
     100      //  d.........f
     101      ifin = GetWSize()-1;
     102      ideb = ifin - GetWStep()+1;
     103      isndeb = GetWStartSample() + ideb;
     104    }
     105    if(isndeb<StartSampleNum()) {
     106      cout<<"........ ideb="<<ideb<<" isndeb="<<isndeb<<endl;
     107      ideb = StartSampleNum() - GetWStartSample();
     108      isndeb = StartSampleNum();
     109    }
     110    if(GetWStartSample()+ifin>EndSampleNum()) {
     111      cout<<"........ ifin="<<ifin<<endl;
     112      ifin = EndSampleNum() - GetWStartSample();
     113    }
     114    cout<<".... ideb="<<ideb<<" ifin="<<ifin<<" isndeb="<<isndeb<<endl;
     115    data = GetWData()(Range(ideb,ifin));
     116    flag = GetWFlag()(Range(ideb,ifin));
     117    PutWData(isndeb,data,flag);
     118  } else {
     119    // Cas ou on ne peut reproduire le TOI initial
     120    // On renumerote les samples
     121    // ATTENTION: faut en mettre autant en sortie que lu en entree (???)
     122    // ATTENTION: dans certains cas ca bloque car il peut arriver que
     123    // SNend ne soit jamais atteint selon les valeurs de WSize/WStep !
     124    // et on ne peut donc pas ecrire autant de valeurs en sortie que lues en entree
     125    // CA NE MARCHE PAS DANS CE CAS
     126    TVector<r_8> data;
     127    TVector<int_8> flag;
     128    int_4 ideb=0, ifin=GetWSize()-1;
     129    int_8 ilen = EndSampleNum() - StartSampleNum() + 1;
     130    if(GetWStartSample()+ideb<StartSampleNum()) {
     131      cout<<"........ ideb="<<ideb<<endl;
     132      ideb = StartSampleNum() - GetWStartSample();
     133    }
     134    if(GetWStartSample()+ifin>EndSampleNum()) {
     135      cout<<"........ ifin="<<ifin<<endl;
     136      ifin = EndSampleNum() - GetWStartSample();
     137    }
     138    data = GetWData()(Range(ideb,ifin));
     139    flag = GetWFlag()(Range(ideb,ifin));
     140    cout<<".... ideb="<<ideb<<" ifin="<<ifin<<" SNRunning="<<SNRunning<<endl;
     141    PutWData(SNRunning,data,flag);
     142    SNRunning += ifin-ideb+1;
     143    if(SNRunning<=ilen && GetWStep()-GetWSize()>0) {
     144      for(int_4 i=0;i<GetWStep()-GetWSize() && SNRunning<=ilen;i++)
     145        {PutWData(SNRunning,0.,0); SNRunning++;}
     146      // De toute facon impossible a faire puisque
     147      // ce putwdata efface le vecteur du putwdata precedent
     148    }
     149    cout<<".................... SNRunning="<<SNRunning<<endl;
     150  }
     151  // Oh que voila une logique simple et utilisable par tout un chacun !!!
    67152}
    68153
     
    75160  }
    76161  else {
    77     cout << "\n Usage : tgenw [-dbg] [-start snb] [-end sne] [-intoi name] \n"
     162    cout << "\n Usage : tgenw [-prt] [-dbg dbg] [-start snb] [-end sne] [-intoi name] \n"
    78163         << "         [-wtoi sz] [-wgen sz,step,szt] inFitsName outFitsName \n"
    79          << "   -dbg : sets TOISeqBuffered debug level to 1 \n"
     164         << "   -prt : sets TOISeqBuffered debug level to 1 \n"
     165         << "   -dbg : debug level for GenWProc \n"
    80166         << "   -start snb : sets the start sample num \n"
    81167         << "   -end sne : sets the end sample num \n"
     
    83169         << "   -wtoi sz : sets TOISeqBuff buffer size (def= 8192)\n"
    84170         << "   -wgen sz,step,szt : sets GenWProc window size, step total size \n"
     171         << "   -wlcr szl,szc,szr : sets LCR Window \n"
    85172         << endl;
    86173    exit(0);
     
    96183  bool fgdbg = false;
    97184  bool fgsetstart = false;
     185  int dbglevel = 0;
    98186  int wtoi = 8192;
    99187  int wgen = 16;
    100188  int stepgen = 1;
     189  int wgl = 0, wgc = 0, wgr = 0;
    101190  int wtotgen = 0;
    102191  int istart = 0;
    103192  int iend = 0;
    104193  string infile;
    105   string outfile;
     194  string outfile = "";
    106195  string outppfname;
    107196  string intoi = "boloMuV_27";
    108197
    109   if (narg < 3) Usage(true);
     198  if (narg < 2) Usage(true);
    110199  int ko=1;
    111200  // decoding arguments
     
    128217      sscanf(arg[ia+1],"%d,%d,%d",&wgen,&stepgen,&wtotgen); ia++;
    129218    }   
     219    else if (strcmp(arg[ia],"-wlcr") == 0) {
     220      if (ia == narg-1) Usage(true); 
     221      sscanf(arg[ia+1],"%d,%d,%d",&wgl,&wgc,&wgr); ia++;
     222    }   
    130223    else if (strcmp(arg[ia],"-intoi") == 0) {
    131224      if (ia == narg-1) Usage(true); 
    132225      intoi = arg[ia+1]; ia++;
    133226    }   
    134     else if (strcmp(arg[ia],"-dbg") == 0)  fgdbg = true;
     227    else if (strcmp(arg[ia],"-dbg") == 0) {
     228      if (ia == narg-1) Usage(true); 
     229      sscanf(arg[ia+1],"%d",&dbglevel); ia++;
     230    }   
     231    else if (strcmp(arg[ia],"-prt") == 0)  fgdbg = true;
    135232
    136233    else { ko = ia; break; }  // Debut des noms
     
    138235
    139236  if (iend < istart) iend = istart+wtoi*10;
    140   if ((narg-ko) < 2)  Usage(true);
     237  if ((narg-ko) < 1)  Usage(true);
    141238  infile = arg[ko];
    142   outfile = arg[ko+1];
    143   //  outppfname = arg[ko+2];
     239  if(ko+1<narg) outfile = arg[ko+1];
     240  // outppfname = arg[ko+2];
    144241
    145242  cout << " Initializing SOPHYA ... " << endl;
     
    150247       << outfile << endl;
    151248  cout << ">>> Window Size WTOI= " << wtoi << " WGenSz= " << wgen
    152        << " StepGen=" << stepgen << " WTot=" << wtotgen << endl;
     249       << " StepGen=" << stepgen << " WTot=" << wtotgen
     250       << " Wglcr=" << wgl << "," << wgc <<  "," << wgr << endl;
    153251  cout << ">>>> InTOIName= " << intoi
    154252       << "  iStart= " << istart << " iEnd= " << iend << endl;
     
    159257    //  mgr->setRequestedSample(11680920,11710584);
    160258    //  mgr->setRequestedSample(104121000, 104946120);
    161     if (fgsetstart) 
     259    if (fgsetstart)
    162260      mgr->setRequestedSample(istart, iend);
    163261 
    164262    FITSTOIReader r(infile);
    165263    cout << "reader created" << endl;
    166     FITSTOIWriter w(outfile);
    167     cout << "fits writer created" << endl;
    168 
     264
     265    int ntoiout=0;
     266    FITSTOIWriter* w=NULL;
     267    if(outfile.size()>0) {
     268      ntoiout=1;
     269      w = new FITSTOIWriter(outfile);
     270      w->setOutFlags(true);
     271      cout << "fits writer created" << endl;
     272    }
    169273
    170274    TOISeqBuffered * toiin = new TOISeqBuffered("f2in", wtoi);
    171275    if (fgdbg) toiin->setDebugLevel(1);
    172      
     276
     277    TOISeqBuffered * toiout = NULL;
     278    if(w) {
     279      toiout = new TOISeqBuffered("genout", wtoi);
     280      if (fgdbg) toiout->setDebugLevel(1);
     281    }
     282
     283    TGenWProc tgenp(ntoiout, wgen, stepgen, wtotgen);
     284    tgenp.SetWSizeLCR(wgl,wgc,wgr);
     285    tgenp.SetDbgLevel(dbglevel);
     286
    173287    cout << " Connecting to FitsReader ... " << endl;
    174288    r.addOutput(intoi, toiin);
    175289
    176     TOISeqBuffered * toiout = new TOISeqBuffered("genout", wtoi);
    177     if (fgdbg) toiout->setDebugLevel(1);
    178     TGenWProc tgenp(wgen, stepgen, wtotgen);
     290    if(w && toiout) {
     291      cout << " Connecting to FitsWriter ... " << endl;
     292      w->addInput("genout",toiout);
     293    }
    179294
    180295    cout << " Connecting  TGenWProc ... " << endl;
    181296    tgenp.addInput("in0",toiin);
    182     tgenp.addOutput("out0",toiout);
    183    
    184     cout << tgenp;
    185 
    186     w.addInput("genout", toiout);
     297    if(toiout) tgenp.addOutput("out0",toiout);
     298    tgenp.PrintStatus(cout,1);
    187299
    188300    PrtTim("starting threads");
    189301    r.start();
    190302    tgenp.start();
    191     w.start();
    192 
     303    if(w) w->start();
    193304
    194305    /*       
    195306    for(int jj=0; jj<3; jj++) {
    196307      cout << *toiin;
    197       cout << *toiout;
     308      if(toiout) cout << *toiout;
    198309      sleep(1);
    199310    }
    200311    */
    201    
    202    
    203    
    204312
    205313    mgr->joinAll();
     
    209317    //    r.PrintStatus(cout); 
    210318    //    cout << "----- FITSWriterTOI::PrintStatus() : ----- " << endl;
    211     //    w.PrintStatus(cout); 
     319    //    w->PrintStatus(cout); 
    212320
    213321    cout << " ------ toiin, toiout Status information ------- " << endl;
    214322    cout << *toiin;
    215     cout << *toiout;
    216    
    217     cout << tgenp;
    218    
     323    if(toiout) cout << *toiout;
     324    tgenp.PrintStatus(cout);
     325
     326    // Fermeture du fitswriter
     327    if(w) delete w;;
     328
    219329  }
    220330  catch (PThrowable & exc) {
Note: See TracChangeset for help on using the changeset viewer.