Changeset 2267 for branches/parallel/src


Ignore:
Timestamp:
08/10/11 11:11:34 (13 years ago)
Author:
Kana Sugimoto
Message:

New Development: No

JIRA Issue: No (speedup)

Ready for Test: Yes

Interface Changes: No

What Interface Changed:

Test Programs: CASA: a unit tests of task, sdcoadd

Put in Release Notes: No

Module(s): asapmath.merge and sdcoadd (in CASA)

Description:

Reduced redundant call to addEntry and getEntry functions which are slow.


File:
1 edited

Legend:

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

    r2145 r2267  
    24172417    out->appendToHistoryTable((*it)->history());
    24182418    const Table& tab = (*it)->table();
     2419
     2420    Block<String> cols(3);
     2421    cols[0] = String("FREQ_ID");
     2422    cols[1] = String("MOLECULE_ID");
     2423    cols[2] = String("FOCUS_ID");
     2424
    24192425    TableIterator scanit(tab, "SCANNO");
    24202426    while (!scanit.pastEnd()) {
    2421       TableIterator freqit(scanit.table(), "FREQ_ID");
    2422       while ( !freqit.pastEnd() ) {
    2423         Table thetab = freqit.table();
     2427      ScalarColumn<uInt> thescannocol(scanit.table(),"SCANNO");
     2428      Vector<uInt> thescannos(thescannocol.nrow(),newscanno);
     2429      thescannocol.putColumn(thescannos);
     2430      TableIterator subit(scanit.table(), cols);
     2431      while ( !subit.pastEnd() ) {
    24242432        uInt nrow = tout.nrow();
     2433        Table thetab = subit.table();
     2434        ROTableRow row(thetab);
     2435        Vector<uInt> thecolvals(thetab.nrow());
     2436        ScalarColumn<uInt> thefreqidcol(thetab,"FREQ_ID");
     2437        ScalarColumn<uInt> themolidcol(thetab, "MOLECULE_ID");
     2438        ScalarColumn<uInt> thefocusidcol(thetab,"FOCUS_ID");
     2439        // The selected subset of table should have
     2440        // the equal FREQ_ID, MOLECULE_ID, and FOCUS_ID values.
     2441        const TableRecord& rec = row.get(0);
     2442        // Set the proper FREQ_ID
     2443        Double rv,rp,inc;
     2444        (*it)->frequencies().getEntry(rp, rv, inc, rec.asuInt("FREQ_ID"));
     2445        uInt id;
     2446        id = out->frequencies().addEntry(rp, rv, inc);
     2447        thecolvals = id;
     2448        thefreqidcol.putColumn(thecolvals);
     2449        // Set the proper MOLECULE_ID
     2450        Vector<String> name,fname;Vector<Double> rf;
     2451        (*it)->molecules().getEntry(rf, name, fname, rec.asuInt("MOLECULE_ID"));
     2452        id = out->molecules().addEntry(rf, name, fname);
     2453        thecolvals = id;
     2454        themolidcol.putColumn(thecolvals);
     2455        // Set the proper FOCUS_ID
     2456        Float fpa,frot,fax,ftan,fhand,fmount,fuser, fxy, fxyp;
     2457        (*it)->focus().getEntry(fpa, fax, ftan, frot, fhand, fmount,fuser,
     2458                                fxy, fxyp, rec.asuInt("FOCUS_ID"));
     2459        id = out->focus().addEntry(fpa, fax, ftan, frot, fhand, fmount,fuser,
     2460                                   fxy, fxyp);
     2461        thecolvals = id;
     2462        thefocusidcol.putColumn(thecolvals);
     2463
    24252464        tout.addRow(thetab.nrow());
    24262465        TableCopy::copyRows(tout, thetab, nrow, 0, thetab.nrow());
    2427         ROTableRow row(thetab);
    2428         for ( uInt i=0; i<thetab.nrow(); ++i) {
    2429           uInt k = nrow+i;
    2430           scannocol.put(k, newscanno);
    2431           const TableRecord& rec = row.get(i);
    2432           Double rv,rp,inc;
    2433           (*it)->frequencies().getEntry(rp, rv, inc, rec.asuInt("FREQ_ID"));
    2434           uInt id;
    2435           id = out->frequencies().addEntry(rp, rv, inc);
    2436           freqidcol.put(k,id);
    2437           //String name,fname;Double rf;
    2438           Vector<String> name,fname;Vector<Double> rf;
    2439           (*it)->molecules().getEntry(rf, name, fname, rec.asuInt("MOLECULE_ID"));
    2440           id = out->molecules().addEntry(rf, name, fname);
    2441           molidcol.put(k, id);
    2442           Float fpa,frot,fax,ftan,fhand,fmount,fuser, fxy, fxyp;
    2443           (*it)->focus().getEntry(fpa, fax, ftan, frot, fhand,
    2444                                   fmount,fuser, fxy, fxyp,
    2445                                   rec.asuInt("FOCUS_ID"));
    2446           id = out->focus().addEntry(fpa, fax, ftan, frot, fhand,
    2447                                      fmount,fuser, fxy, fxyp);
    2448           focusidcol.put(k, id);
    2449         }
    2450         ++freqit;
     2466
     2467        ++subit;
    24512468      }
    24522469      ++newscanno;
Note: See TracChangeset for help on using the changeset viewer.