Ignore:
Timestamp:
01/31/13 16:39:48 (11 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...

Speed up asdm2ASAP by reusing MDirection::Convert object.


File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/external-alma/asdm2ASAP/ASDMReader.cc

    r2705 r2755  
    4848  corrMode_.reset() ;
    4949  timeSampling_.reset() ;
     50  initConvert() ;
    5051}
    5152
     
    224225  for ( casa::uInt i = 0 ; i < 3 ; i++ )
    225226    antennaPosition_[i] = Quantity( casa::Double( antpos[i].get() ), Unit( "m" ) ) ;
     227  mp_ = casa::MPosition( casa::MVPosition( antennaPosition_ ),
     228                         casa::MPosition::ITRF ) ;
     229  mf_.set( mp_ ) ;
    226230
    227231  // create SDMBinData object
     
    887891        String ref( CDirectionReferenceCode::toString( dircode ) ) ;
    888892        double mjd = vmsData_->v_time[dataIndex_] * s2d ;
    889         srcdir = toJ2000( srcdir, ref, mjd, antennaPosition_ ) ;
     893        srcdir = toJ2000( srcdir, ref, mjd ) ;
    890894      }
    891895    }
     
    16701674    }
    16711675   
    1672     toJ2000( dir, az, el, tcen, antennaPosition_ ) ;
     1676    toJ2000( dir, az, el, tcen ) ;
    16731677  }
    16741678
     
    16941698                          double &az,
    16951699                          double &el,
    1696                           double &mjd,
    1697                           casa::Vector<casa::Quantity> &antpos )
    1698 //                          casa::Vector<casa::Double> antpos )
     1700                          double &mjd )
    16991701{
    17001702  String funcName = "toJ2000" ;
     
    17041706  azel[0] = az ;
    17051707  azel[1] = el ;
    1706   dir = toJ2000( azel, ref, mjd, antpos ) ;
     1708  dir = toJ2000( azel, ref, mjd ) ;
    17071709}
    17081710
    17091711vector<double> ASDMReader::toJ2000( vector<double> &dir,
    17101712                                    casa::String &dirref,
    1711                                     double &mjd,
    1712                                     casa::Vector<casa::Quantity> &antpos )
    1713 //                                    casa::Vector<casa::Double> antpos )
     1713                                    double &mjd )
    17141714{
    17151715  casa::String funcName = "toJ2000" ;
     
    17171717  vector<double> newd( dir ) ;
    17181718  if ( dirref != "J2000" ) {
    1719     casa::MEpoch me( casa::Quantity( (casa::Double)mjd, "d" ), casa::MEpoch::UTC ) ;
    1720     casa::MPosition mp( casa::MVPosition( antpos ),
    1721                         casa::MPosition::ITRF ) ;
    1722     //ostringstream oss ;
    1723     //mp.print( oss ) ;
    1724     //logsink_->postLocally( LogMessage(oss.str(),LogOrigin(className_,funcName,WHERE)) ) ;
    1725    
    1726     casa::MeasFrame mf( me, mp ) ;
     1719    me_ = casa::MEpoch( casa::Quantity( (casa::Double)mjd, "d" ), casa::MEpoch::UTC ) ;
     1720    mf_.set( me_ ) ;
    17271721    casa::MDirection::Types dirtype ;
    17281722    casa::Bool b = casa::MDirection::getType( dirtype, dirref ) ;
    17291723    if ( b ) {
    1730       casa::MDirection::Convert toj2000( dirtype,
    1731                                          casa::MDirection::Ref( casa::MDirection::J2000, mf ) ) ;
    1732       casa::Vector<casa::Double> cdir = toj2000( dir ).getAngle( "rad" ).getValue() ;
     1724      casa::Vector<casa::Double> cdir = toj2000_( dir ).getAngle( "rad" ).getValue() ;
    17331725      //logsink_->postLocally( LogMessage("cdir = "+String::toString(cdir),LogOrigin(className_,funcName,WHERE)) ) ;
    17341726      newd[0] = (double)(cdir[0]) ;
     
    18961888  return dir ;
    18971889}
     1890
     1891void ASDMReader::initConvert()
     1892{
     1893  toj2000_ = MDirection::Convert(MDirection::AZELGEO,
     1894                                 MDirection::Ref(MDirection::J2000, mf_));
     1895}
Note: See TracChangeset for help on using the changeset viewer.