Ignore:
Timestamp:
07/25/11 14:57:22 (13 years ago)
Author:
Takeshi Nakazato
Message:

merged changes in trunk (r2209,r2202,r2243

Location:
branches/parallel
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/parallel

  • branches/parallel/src

  • branches/parallel/src/FillerBase.cpp

    r1876 r2247  
    1212
    1313#include <casa/Containers/RecordField.h>
     14#include <tables/Tables/ExprNode.h>
    1415
    1516#include "FillerBase.h"
     
    176177}
    177178
     179void FillerBase::setWeather2(Float temperature,
     180                             Float pressure,
     181                             Float humidity,
     182                             Float windspeed,
     183                             Float windaz)
     184{
     185  uInt id ;
     186  Table tab = table_->weather().table() ;
     187  Table subt = tab( tab.col("TEMPERATURE") == temperature \
     188                    && tab.col("PRESSURE") == pressure \
     189                    && tab.col("HUMIDITY") == humidity \
     190                    && tab.col("WINDSPEED") == windspeed \
     191                    && tab.col("WINDAZ") == windaz, 1 ) ;
     192  Int nrow = tab.nrow() ;
     193  Int nrowSel = subt.nrow() ;
     194  if ( nrowSel == 0 ) {
     195    tab.addRow( 1, True ) ;
     196    TableRow row( tab ) ;
     197    TableRecord &rec = row.record() ;
     198    RecordFieldPtr<casa::uInt> rfpi ;
     199    rfpi.attachToRecord( rec, "ID" ) ;
     200    *rfpi = (uInt)nrow ;
     201    RecordFieldPtr<casa::Float> rfp ;
     202    rfp.attachToRecord( rec, "TEMPERATURE" ) ;
     203    *rfp = temperature ;
     204    rfp.attachToRecord( rec, "PRESSURE" ) ;
     205    *rfp = pressure ;
     206    rfp.attachToRecord( rec, "HUMIDITY" ) ;
     207    *rfp = humidity ;
     208    rfp.attachToRecord( rec, "WINDSPEED" ) ;
     209    *rfp = windspeed ;
     210    rfp.attachToRecord( rec, "WINDAZ" ) ;
     211    *rfp = windaz ;
     212    row.put( nrow, rec ) ;
     213    id = (uInt)nrow ;
     214  }
     215  else {
     216    ROTableColumn tc( subt, "ID" ) ;
     217    id = tc.asuInt( 0 ) ;
     218  }
     219  RecordFieldPtr<uInt> mweatheridCol(row_.record(), "WEATHER_ID");
     220  *mweatheridCol = id;
     221}
     222
     223void FillerBase::setTcal2(const String& tcaltime,
     224                          const Vector<Float>& tcal)
     225{
     226  uInt id = 0 ;
     227  Table tab = table_->tcal().table() ;
     228  Table result =
     229    //tab( nelements(tab.col("TCAL")) == uInt (tcal.size()) &&
     230    //     all(tab.col("TCAL")== tcal) &&
     231    //     tab.col("TIME") == tcaltime, 1 ) ;
     232    tab( nelements(tab.col("TCAL")) == uInt (tcal.size()) &&
     233         all(tab.col("TCAL")== tcal), 1 ) ;
     234
     235  if ( result.nrow() > 0 ) {
     236    ROTableColumn tmpCol( result, "ID" ) ;
     237    tmpCol.getScalar( 0, id ) ;
     238  }
     239  else {
     240    uInt rno = tab.nrow();
     241    tab.addRow();
     242    TableColumn idCol( tab, "ID" ) ;
     243    TableColumn tctimeCol( tab, "TIME" ) ;
     244    ArrayColumn<Float> tcalCol( tab, "TCAL" ) ;
     245    // get last assigned _id and increment
     246    if ( rno > 0 ) {
     247      idCol.getScalar(rno-1, id);
     248      id++;
     249    }
     250    tctimeCol.putScalar(rno, tcaltime);
     251    tcalCol.put(rno, tcal);
     252    idCol.putScalar(rno, id);
     253  }
     254
     255  RecordFieldPtr<uInt> mcalidCol(row_.record(), "TCAL_ID");
     256  *mcalidCol = id;
     257}
     258
    178259};
Note: See TracChangeset for help on using the changeset viewer.