Changeset 1994 in Sophya for trunk/ArchTOIPipe


Ignore:
Timestamp:
May 13, 2002, 3:11:32 PM (23 years ago)
Author:
ansari
Message:

1/ Ajout classe CGT (Compagnie Generale des Tuyaux) - Assistance a l'assemblage
des TOIProcessors .
2/ Corrections mineures ds FitsTOIReader, correction de smkmflib

Reza 13/5/2002

Location:
trunk/ArchTOIPipe
Files:
2 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/ArchTOIPipe/Kernel/fitstoirdr.cc

    r1836 r1994  
    33//                               Christophe Magneville
    44//                               Reza Ansari
    5 // $Id: fitstoirdr.cc,v 1.26 2001-12-21 17:00:40 aubourg Exp $
     5// $Id: fitstoirdr.cc,v 1.27 2002-05-13 13:11:32 ansari Exp $
    66
    77#include "fitstoirdr.h"
     
    2727}
    2828
    29 void FITSTOIReader::setImplicitSN(int snStart) {
     29void FITSTOIReader::setImplicitSN(long snStart) {
    3030  implicitSN = true;
    3131  implicitSNStart = snStart;
     32}
     33
     34void FITSTOIReader::setBufferSize(int buffsz)
     35{
     36  Buff_Sz = (buffsz>0) ? buffsz: 1024;
     37  return;
    3238}
    3339
     
    144150  for (vector<string>::iterator i=allfn.begin(); i!=allfn.end(); i++) {
    145151    openFile(*i);
    146     //run1();
    147     run2();
     152    if (Buff_Sz > 1) run2();  // Lecture bufferise
     153    else run1();              // Lecture un echantillon a la fois
    148154  }
    149155}
    150156
    151157// run 1 : deprecated. NON MAINTENU. Incompatible avec implicit SN.
     158//                     ^^^^^^^^^^^^  Reza , 13/5/2002 , Je viens de rajouter
     159//                                   implicitSNStart et switvh run1/run2
     160//                                   suivant buffersize
     161 
    152162void FITSTOIReader::run1() {
    153163  // Il faudrait optimiser en fonction de ce qui a ete demande comme samplenum,
     
    165175    double y;
    166176    fits_lock();
    167     fits_read_col_dbl(fptr,1,i+1,1,1,0,&y,&anyNul,&fstatus);
     177    long sn;
     178    if (implicitSN) {
     179      fits_read_col_dbl(fptr,1,i+1,1,1,0,&y,&anyNul,&fstatus);
     180      sn = (long) (y+.1);
     181    }
     182    else sn = implicitSNStart+i;
    168183    //fits_unlock();
    169     long sn = (long) (y+.1);
    170184    TOIManager* mgr = TOIManager::getManager();
    171185    if (sn > mgr->getRequestedEnd()) {fits_unlock(); break;}
     
    228242 long ideb=-1,ifin=-1;
    229243 for(long i=0; i<nrows; i+=Buff_Sz) {
    230 
     244   fits_lock();   // lock en debut de boucle de lecture - Reza 13/05/2002
    231245   // faut-il lire dans le fichier fits ?
    232246   if(i<ideb || i>ifin) { // Toujours vrai avec le += Buff_Sz
     
    244258         samplenum[j] = j+ideb+implicitSNStart;
    245259       }
    246        fits_lock();
     260       //---- Pas la peine, fait en debut de boucle - Reza 13/05/2002  fits_lock();
    247261     } else {
    248        fits_lock();
     262       //---- Pas la peine, fait en debut de boucle - Reza 13/05/2002 fits_lock();
    249263       fits_read_col_dbl(fptr,1,ideb+1,1,n,0,samplenum,&anyNul,&fstatus);
    250264       if (samplenum[0] > mgr->getRequestedEnd()
    251265           || (forcedMaxIn > 0 && samplenum[0] > forcedMaxIn)) {
    252          fits_unlock();
     266         fits_unlock();  // unlock avant de casser la boucle - Reza 13/05/2002
    253267         break;
    254268       }
    255269       if (samplenum[n-1] < mgr->getRequestedBegin()
    256270           || (forcedMinIn > 0 && samplenum[n-1] < forcedMinIn)) {
    257          fits_unlock();
     271         //---- Pas la peine, fait en fin de boucle - Reza 13/05/2002 fits_unlock();
    258272         continue;
    259273       }
     
    268282     if(fstatus!=0) {
    269283       fits_report_error(stderr,fstatus);
     284       fits_unlock(); // On supprime le lock avant le throw - Reza 13/05/2002
    270285       throw RangeCheckError("FITSTOIReader::run2: Error Reading Fits file\n");
    271286     }
    272      fits_unlock();
    273287   }
     288   fits_unlock();   // unlock en debut de boucle de lecture - Reza 13/05/2002
    274289
    275290   long ip = i-ideb; // pointeurs dans les buffers
     
    288303     }
    289304   }
    290    totnscount++;
     305   totnscount += (ifin-ideb+1);
    291306 }
    292307
     
    300315 colval.resize(0); colflg.resize(0);
    301316
    302  cout << "reader done reading... " << pthread_self() << endl;
    303 }
     317 cout << "reader (buffered) done reading... " << pthread_self() << endl;
     318}
  • trunk/ArchTOIPipe/Kernel/fitstoirdr.h

    r1793 r1994  
    55//                               Christophe Magneville
    66//                               Reza Ansari
    7 // $Id: fitstoirdr.h,v 1.10 2001-11-27 12:13:41 aubourg Exp $
     7// $Id: fitstoirdr.h,v 1.11 2002-05-13 13:11:32 ansari Exp $
    88
    99
     
    2121class FITSTOIReader : public TOIProcessor {
    2222public:
    23   FITSTOIReader(string fn,int buff_sz=1000);
     23  FITSTOIReader(string fn,int buff_sz=1024);
    2424  ~FITSTOIReader();
    2525
    26   void         setImplicitSN(int snStart=0);
     26  void         setImplicitSN(long snStart=0);
     27
     28  void         setBufferSize(int buffsz=1024);
     29  inline int   getBufferSize() { return Buff_Sz; }
    2730
    2831  virtual void addFile(string fn);
     
    5457
    5558  bool      implicitSN;
    56   int       implicitSNStart;
     59  long      implicitSNStart;
    5760 
    5861  vector<string> allfn;
  • trunk/ArchTOIPipe/Processors/nooppr.cc

    r1762 r1994  
    33//                               Christophe Magneville
    44//                               Reza Ansari
    5 // $Id: nooppr.cc,v 1.9 2001-11-13 16:22:47 aubourg Exp $
     5// $Id: nooppr.cc,v 1.10 2002-05-13 13:11:32 ansari Exp $
    66
    77#include <typeinfo>
     
    1414NoOpProcessor::NoOpProcessor(int wsz)
    1515{
     16  if (wsz < 1) wsz = 1;
    1617  wsize = wsz;
    1718  totnscount = 0;
     
    4849
    4950
    50   if (!checkInputTOIIndex(0)) {
     51  if (!checkInputTOIIndex(0) && !checkInputTOIIndex(1) &&
     52      !checkOutputTOIIndex(0) && !checkOutputTOIIndex(1) ) {
     53    cerr << " NoOpProcessor::run() - No TOI connected! "
     54         << endl;
     55    throw ParmError("NoOpProcessor::run() No TOI connected!");
     56  }
     57
     58  if (!acceptnoinput && !checkInputTOIIndex(0)) {
    5159    cerr << " NoOpProcessor::run() - Input TOI (in) not connected! "
    5260         << endl;
    5361    throw ParmError("NoOpProcessor::run() Input TOI (in) not connected!");
    5462  }
     63  bool fgin = checkInputTOIIndex(0);
    5564  bool fgin2 = checkInputTOIIndex(1);
    5665
     
    5867  bool fgout2 = checkOutputTOIIndex(1);
    5968
    60   if (fgout2 && !fgin2) {
     69  if (fgout2 && (!fgin2 && !acceptnoinput) ) {
    6170    cerr << " NoOpProcessor::run() - out2 connected without in2!"
    6271         << endl;
     
    7887      vin = new double[wsize];
    7988      vfg = new uint_8[wsize];
    80       if (fgin2) {
     89      for(i=0; i<wsize; i++) {
     90        vin[i] = defval; vfg[i] = defflag;
     91      }
     92      if (fgin2 || fgout2) {
    8193        vin2 = new double[wsize];
    8294        vfg2 = new uint_8[wsize];
     95        for(i=0; i<wsize; i++) {
     96          vin2[i] = defval; vfg2[i] = defflag;
     97        }       
    8398      }
    8499   
     
    86101      // 1er partie, on traite par paquets de wsize
    87102      for(k=snb;k<=sne-wsize+1;k+=wsize) {
    88         for(i=0; i<wsize; i++) {
    89           getData(0, k+i, vin[i], vfg[i]);
    90           if (fgin2)
    91             getData(1, k+i, vin2[i], vfg2[i]);
    92         }
     103        if (fgin)
     104          getData(0, k, wsize, vin, vfg);
     105        if (fgin2)
     106          getData(1, k, wsize, vin2, vfg2);
    93107        totnbblock++;
    94         for(i=0; i<wsize; i++) {
    95           if (fgout)
    96             putData(0,k+i,vin[i],vfg[i]);
    97           if (fgout2) 
    98             putData(1, k+i, vin2[i], vfg2[i]);
    99         }
     108        if (fgout)
     109          putData(0, k, wsize, vin, vfg);
     110        if (fgout2) 
     111          putData(1, k, wsize, vin2, vfg2);
    100112        klast+=wsize;
    101113        totnscount+=wsize;
     114        totnbblock++;
    102115      }
    103116    }
    104117
    105118    // 2eme partie, on traite la fin du bloc d'echantillons si necessaire
    106     double inval;
    107     uint_8 inflg;
     119    double inval = defval;;
     120    uint_8 inflg = defflag;
     121    double inval2 = defval;;
     122    uint_8 inflg2 = defflag;
    108123    if (klast < sne)
    109124      for(k=klast+1; k<=sne; k++) {
    110         getData(0, k, inval, inflg);
     125        if (fgin)
     126          getData(0, k, inval, inflg);
    111127        if (fgout) putData(0, k, inval, inflg);
    112         if (fgin2) {
    113           getData(1, k, inval, inflg);
    114           if (fgout2)
    115             putData(1, k, inval, inflg);
    116         }
     128        if (fgin2) 
     129          getData(1, k, inval2, inflg2);
     130        if (fgout2)
     131            putData(1, k, inval2, inflg2);
    117132        totnscount++;
    118133      }
    119 
    120     totnbblock++;
     134    totnbblock++;
    121135
    122136    cout << " NoOpProcessor::run() - End of processing "
    123          << " TotNbBlocks= " << totnbblock << endl;
     137         << " TotNbBlocks= " << totnbblock << " ProcSamples=" << totnscount << endl;
    124138  }  // Bloc try
    125139
  • trunk/ArchTOIPipe/Processors/nooppr.h

    r1762 r1994  
    55//                               Christophe Magneville
    66//                               Reza Ansari
    7 // $Id: nooppr.h,v 1.5 2001-11-13 16:22:47 aubourg Exp $
     7// $Id: nooppr.h,v 1.6 2002-05-13 13:11:32 ansari Exp $
    88
    99
     
    2525  inline int_8  ProcessedSampleCount() const { return totnscount; }
    2626
     27  inline void   AcceptNoInput(double val=0., long flg=0)
     28         { acceptnoinput = true; defval = val; defflag = flg; }
     29
    2730  virtual void  PrintStatus(::ostream & os) ; // const plus tard
    2831
     
    3336  int_8 totnscount;   // Nombre total d'echantillon processe
    3437  int wsize;         // Taille de fenetre de travail
     38
     39  bool acceptnoinput;
     40  double defval;
     41  long defflag;
    3542};
    3643
  • trunk/ArchTOIPipe/smkmflib

    r1980 r1994  
    2424rm -f $liblist
    2525touch $liblist
    26 ls *.{c,cc} | comm -3 -1 $TMPDIR/exclude.sort - | sed -e 's/\.cc/.o/' | sed -e 's/\.c/.o/' >> $liblist
     26ls -1 *.{c,cc} | comm -3 -1 $TMPDIR/exclude.sort - | sed -e 's/\.cc/.o/' | sed -e 's/\.c/.o/' >> $liblist
    2727unset liblist
    2828
     
    6161
    6262echo $libf ':' \
    63  `ls *.{c,cc} | comm -3 -1 $TMPDIR/exclude.sort - | sed -e 's/\.cc/.o/' | sed -e 's/\.c/.o/' | sed -e 's/^/$(OBJ)/'` >> GNUmakefile
     63 `ls -1 *.{c,cc} | comm -3 -1 $TMPDIR/exclude.sort - | sed -e 's/\.cc/.o/' | sed -e 's/\.c/.o/' | sed -e 's/^/$(OBJ)/'` >> GNUmakefile
    6464echo '  $(ARCXX) $(ARCXXFLAGS) $@ $($(ARARGS))' >> GNUmakefile
    6565#  Pour faire compiler les instantiations automatique de cxx (DEC)
Note: See TracChangeset for help on using the changeset viewer.