Changeset 1994 in Sophya
- Timestamp:
- May 13, 2002, 3:11:32 PM (23 years ago)
- Location:
- trunk/ArchTOIPipe
- Files:
-
- 2 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/ArchTOIPipe/Kernel/fitstoirdr.cc
r1836 r1994 3 3 // Christophe Magneville 4 4 // Reza Ansari 5 // $Id: fitstoirdr.cc,v 1.2 6 2001-12-21 17:00:40 aubourgExp $5 // $Id: fitstoirdr.cc,v 1.27 2002-05-13 13:11:32 ansari Exp $ 6 6 7 7 #include "fitstoirdr.h" … … 27 27 } 28 28 29 void FITSTOIReader::setImplicitSN( intsnStart) {29 void FITSTOIReader::setImplicitSN(long snStart) { 30 30 implicitSN = true; 31 31 implicitSNStart = snStart; 32 } 33 34 void FITSTOIReader::setBufferSize(int buffsz) 35 { 36 Buff_Sz = (buffsz>0) ? buffsz: 1024; 37 return; 32 38 } 33 39 … … 144 150 for (vector<string>::iterator i=allfn.begin(); i!=allfn.end(); i++) { 145 151 openFile(*i); 146 //run1();147 run2();152 if (Buff_Sz > 1) run2(); // Lecture bufferise 153 else run1(); // Lecture un echantillon a la fois 148 154 } 149 155 } 150 156 151 157 // 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 152 162 void FITSTOIReader::run1() { 153 163 // Il faudrait optimiser en fonction de ce qui a ete demande comme samplenum, … … 165 175 double y; 166 176 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; 168 183 //fits_unlock(); 169 long sn = (long) (y+.1);170 184 TOIManager* mgr = TOIManager::getManager(); 171 185 if (sn > mgr->getRequestedEnd()) {fits_unlock(); break;} … … 228 242 long ideb=-1,ifin=-1; 229 243 for(long i=0; i<nrows; i+=Buff_Sz) { 230 244 fits_lock(); // lock en debut de boucle de lecture - Reza 13/05/2002 231 245 // faut-il lire dans le fichier fits ? 232 246 if(i<ideb || i>ifin) { // Toujours vrai avec le += Buff_Sz … … 244 258 samplenum[j] = j+ideb+implicitSNStart; 245 259 } 246 fits_lock();260 //---- Pas la peine, fait en debut de boucle - Reza 13/05/2002 fits_lock(); 247 261 } else { 248 fits_lock();262 //---- Pas la peine, fait en debut de boucle - Reza 13/05/2002 fits_lock(); 249 263 fits_read_col_dbl(fptr,1,ideb+1,1,n,0,samplenum,&anyNul,&fstatus); 250 264 if (samplenum[0] > mgr->getRequestedEnd() 251 265 || (forcedMaxIn > 0 && samplenum[0] > forcedMaxIn)) { 252 fits_unlock(); 266 fits_unlock(); // unlock avant de casser la boucle - Reza 13/05/2002 253 267 break; 254 268 } 255 269 if (samplenum[n-1] < mgr->getRequestedBegin() 256 270 || (forcedMinIn > 0 && samplenum[n-1] < forcedMinIn)) { 257 fits_unlock();271 //---- Pas la peine, fait en fin de boucle - Reza 13/05/2002 fits_unlock(); 258 272 continue; 259 273 } … … 268 282 if(fstatus!=0) { 269 283 fits_report_error(stderr,fstatus); 284 fits_unlock(); // On supprime le lock avant le throw - Reza 13/05/2002 270 285 throw RangeCheckError("FITSTOIReader::run2: Error Reading Fits file\n"); 271 286 } 272 fits_unlock();273 287 } 288 fits_unlock(); // unlock en debut de boucle de lecture - Reza 13/05/2002 274 289 275 290 long ip = i-ideb; // pointeurs dans les buffers … … 288 303 } 289 304 } 290 totnscount ++;305 totnscount += (ifin-ideb+1); 291 306 } 292 307 … … 300 315 colval.resize(0); colflg.resize(0); 301 316 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 5 5 // Christophe Magneville 6 6 // Reza Ansari 7 // $Id: fitstoirdr.h,v 1.1 0 2001-11-27 12:13:41 aubourgExp $7 // $Id: fitstoirdr.h,v 1.11 2002-05-13 13:11:32 ansari Exp $ 8 8 9 9 … … 21 21 class FITSTOIReader : public TOIProcessor { 22 22 public: 23 FITSTOIReader(string fn,int buff_sz=10 00);23 FITSTOIReader(string fn,int buff_sz=1024); 24 24 ~FITSTOIReader(); 25 25 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; } 27 30 28 31 virtual void addFile(string fn); … … 54 57 55 58 bool implicitSN; 56 intimplicitSNStart;59 long implicitSNStart; 57 60 58 61 vector<string> allfn; -
trunk/ArchTOIPipe/Processors/nooppr.cc
r1762 r1994 3 3 // Christophe Magneville 4 4 // Reza Ansari 5 // $Id: nooppr.cc,v 1. 9 2001-11-13 16:22:47 aubourgExp $5 // $Id: nooppr.cc,v 1.10 2002-05-13 13:11:32 ansari Exp $ 6 6 7 7 #include <typeinfo> … … 14 14 NoOpProcessor::NoOpProcessor(int wsz) 15 15 { 16 if (wsz < 1) wsz = 1; 16 17 wsize = wsz; 17 18 totnscount = 0; … … 48 49 49 50 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)) { 51 59 cerr << " NoOpProcessor::run() - Input TOI (in) not connected! " 52 60 << endl; 53 61 throw ParmError("NoOpProcessor::run() Input TOI (in) not connected!"); 54 62 } 63 bool fgin = checkInputTOIIndex(0); 55 64 bool fgin2 = checkInputTOIIndex(1); 56 65 … … 58 67 bool fgout2 = checkOutputTOIIndex(1); 59 68 60 if (fgout2 && !fgin2) {69 if (fgout2 && (!fgin2 && !acceptnoinput) ) { 61 70 cerr << " NoOpProcessor::run() - out2 connected without in2!" 62 71 << endl; … … 78 87 vin = new double[wsize]; 79 88 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) { 81 93 vin2 = new double[wsize]; 82 94 vfg2 = new uint_8[wsize]; 95 for(i=0; i<wsize; i++) { 96 vin2[i] = defval; vfg2[i] = defflag; 97 } 83 98 } 84 99 … … 86 101 // 1er partie, on traite par paquets de wsize 87 102 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); 93 107 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); 100 112 klast+=wsize; 101 113 totnscount+=wsize; 114 totnbblock++; 102 115 } 103 116 } 104 117 105 118 // 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; 108 123 if (klast < sne) 109 124 for(k=klast+1; k<=sne; k++) { 110 getData(0, k, inval, inflg); 125 if (fgin) 126 getData(0, k, inval, inflg); 111 127 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); 117 132 totnscount++; 118 133 } 119 120 totnbblock++; 134 totnbblock++; 121 135 122 136 cout << " NoOpProcessor::run() - End of processing " 123 << " TotNbBlocks= " << totnbblock << endl;137 << " TotNbBlocks= " << totnbblock << " ProcSamples=" << totnscount << endl; 124 138 } // Bloc try 125 139 -
trunk/ArchTOIPipe/Processors/nooppr.h
r1762 r1994 5 5 // Christophe Magneville 6 6 // Reza Ansari 7 // $Id: nooppr.h,v 1. 5 2001-11-13 16:22:47 aubourgExp $7 // $Id: nooppr.h,v 1.6 2002-05-13 13:11:32 ansari Exp $ 8 8 9 9 … … 25 25 inline int_8 ProcessedSampleCount() const { return totnscount; } 26 26 27 inline void AcceptNoInput(double val=0., long flg=0) 28 { acceptnoinput = true; defval = val; defflag = flg; } 29 27 30 virtual void PrintStatus(::ostream & os) ; // const plus tard 28 31 … … 33 36 int_8 totnscount; // Nombre total d'echantillon processe 34 37 int wsize; // Taille de fenetre de travail 38 39 bool acceptnoinput; 40 double defval; 41 long defflag; 35 42 }; 36 43 -
trunk/ArchTOIPipe/smkmflib
r1980 r1994 24 24 rm -f $liblist 25 25 touch $liblist 26 ls *.{c,cc} | comm -3 -1 $TMPDIR/exclude.sort - | sed -e 's/\.cc/.o/' | sed -e 's/\.c/.o/' >> $liblist26 ls -1 *.{c,cc} | comm -3 -1 $TMPDIR/exclude.sort - | sed -e 's/\.cc/.o/' | sed -e 's/\.c/.o/' >> $liblist 27 27 unset liblist 28 28 … … 61 61 62 62 echo $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)/'` >> GNUmakefile63 `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 64 64 echo ' $(ARCXX) $(ARCXXFLAGS) $@ $($(ARARGS))' >> GNUmakefile 65 65 # Pour faire compiler les instantiations automatique de cxx (DEC)
Note:
See TracChangeset
for help on using the changeset viewer.