Changeset 2543 for branches


Ignore:
Timestamp:
05/22/12 11:57:08 (13 years ago)
Author:
Takeshi Nakazato
Message:

New Development: No

JIRA Issue: No

Ready for Test: Yes

Interface Changes: No

What Interface Changed: Please list interface changes

Test Programs: List test programs

Put in Release Notes: Yes/No

Module(s): Module Names change impacts.

Description: Describe your changes here...

Defiend STMath::copyRows that is able to skip to copy SPECTRA/FLAGTRA/TSYS
if they are not necessary to copy.


Location:
branches/hpc33/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/hpc33/src/STMath.cpp

    r2542 r2543  
    166166//   double t2 = 0 ;
    167167//   double t3 = 0 ;
     168//   double t4 = 0 ;
     169//   double t5 = 0 ;
    168170//   TableIterator iter(baset, cols);
    169171//   int count = 0 ;
     
    179181    // copy the first row of this selection into the new table
    180182    tout.addRow();
     183//     t4 = mathutil::gettimeofday_sec() ;
    181184    //TableCopy::copyRows(tout, subt, outrowCount, 0, 1);
    182     TableCopy::copyRows(tout, baset, outrowCount, rows[0], 1);
     185    //TableCopy::copyRows(tout, baset, outrowCount, rows[0], 1);
     186    // skip to copy SPECTRA, FLAGTRA, and TSYS since those heavy columns are
     187    // overwritten in the following process
     188    copyRows( tout, baset, outrowCount, rows[0], 1, False, False, False ) ;
     189//     t5 += mathutil::gettimeofday_sec() - t4 ;
    183190    // re-index to 0
    184191    if ( avmode != "SCAN" && avmode != "SOURCE" ) {
     
    408415//    cout << "elapsed time for average(): " << t1-t0 << " sec" << endl ;
    409416//    cout << "   elapsed time for acc.add(): " << t3 << " sec" << endl ;
     417//    cout << "   elapsed time for copyRows(): " << t5 << " sec" << endl ;
    410418
    411419  return out;
     
    53575365  return sp ;
    53585366}
     5367
     5368void STMath::copyRows( Table &out,
     5369                       const Table &in,
     5370                       uInt startout,
     5371                       uInt startin,
     5372                       uInt nrow,
     5373                       Bool copySpectra,
     5374                       Bool copyFlagtra,
     5375                       Bool copyTsys )
     5376{
     5377  uInt nexclude = 0 ;
     5378  Block<String> excludeColsBlock( 3 ) ;
     5379  if ( !copySpectra ) {
     5380    excludeColsBlock[nexclude] = "SPECTRA" ;
     5381    nexclude++ ;
     5382  }
     5383  if ( !copyFlagtra ) {
     5384    excludeColsBlock[nexclude] = "FLAGTRA" ;
     5385    nexclude++ ;
     5386  }
     5387  if ( !copyTsys ) {
     5388    excludeColsBlock[nexclude] = "TSYS" ;
     5389    nexclude++ ;
     5390  }
     5391  //  if ( nexclude < 3 ) {
     5392  //    excludeCols.resize( nexclude, True ) ;
     5393  //  }
     5394  Vector<String> excludeCols( IPosition(1,nexclude),
     5395                              excludeColsBlock.storage(),
     5396                              SHARE ) ;
     5397//   cout << "excludeCols=" << excludeCols << endl ;
     5398  TableRow rowout( out, excludeCols, True ) ;
     5399  ROTableRow rowin( in, excludeCols, True ) ;
     5400  uInt rin = startin ;
     5401  uInt rout = startout ;
     5402  for ( uInt i = 0 ; i < nrow ; i++ ) {
     5403    rowin.get( rin ) ;
     5404    rowout.putMatchingFields( rout, rowin.record() ) ;
     5405    rin++ ;
     5406    rout++ ;
     5407  }
     5408}
  • branches/hpc33/src/STMath.h

    r2532 r2543  
    439439                                        int index ) ;
    440440  double getMJD( string strtime ) ;
     441  void copyRows( casa::Table &out,
     442                 const casa::Table &in,
     443                 casa::uInt startout,
     444                 casa::uInt startin,
     445                 casa::uInt nrow,
     446                 casa::Bool copySpectra=true,
     447                 casa::Bool copyFlagtra=true,
     448                 casa::Bool copyTsys=true ) ;
    441449
    442450  bool insitu_;
Note: See TracChangeset for help on using the changeset viewer.