Changeset 18820


Ignore:
Timestamp:
04/14/17 12:18:40 (8 years ago)
Author:
tbretz
Message:
Slightly modified the interface to access the observatory. This allows simpler calles than before if any other than the default observatory should be used.
Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/FACT++/src/InterpreterV8.cc

    r18614 r18820  
    21832183    const Time utc(v/1000, v%1000);
    21842184
    2185     Nova::LnLatPosn obs = Nova::ORM();
     2185    Nova::LnLatPosn obs = Nova::kORM;
    21862186
    21872187    ln_rst_time sun;
     
    21952195{
    21962196    if (args.Length()>1)
    2197         return ThrowException(String::New("Moon.horizon must not be called with one argument."));
     2197        return ThrowException(String::New("Moon.horizon must not be called with more than one argument."));
    21982198
    21992199    if (args.Length()==1 && !args[0]->IsDate())
     
    22102210    const Time utc(v/1000, v%1000);
    22112211
    2212     Nova::LnLatPosn obs = Nova::ORM();
     2212    Nova::LnLatPosn obs = Nova::kORM;
    22132213
    22142214    ln_rst_time moon;
  • trunk/FACT++/src/Time.cc

    r18445 r18820  
    314314{
    315315#ifdef HAVE_LIBNOVA
    316     Nova::LnLatPosn obs = Nova::ORM();
     316    Nova::LnLatPosn obs = Nova::kORM;
    317317
    318318    ln_rst_time sun_day;
     
    347347{
    348348#ifdef HAVE_LIBNOVA
    349     Nova::LnLatPosn obs = Nova::ORM();
     349    Nova::LnLatPosn obs = Nova::kORM;
    350350
    351351    ln_rst_time sun_day;
  • trunk/FACT++/src/drivectrl.cc

    r18805 r18820  
    368368        out.mjd = _mjd;
    369369
    370         const double elong  = Nova::ORM().lng * M_PI/180;
    371         const double lat    = Nova::ORM().lat * M_PI/180;
     370        const double elong  = Nova::kORM.lng * M_PI/180;
     371        const double lat    = Nova::kORM.lat * M_PI/180;
    372372        const double height = 2200;
    373373
     
    23732373            fTrackingCounter = 0;
    23742374
    2375         const double ha = fmod(fDrive.GetSeTime(),1)*24 - Nova::ORM().lng/15;
     2375        const double ha = fmod(fDrive.GetSeTime(),1)*24 - Nova::kORM.lng/15;
    23762376
    23772377        array<double, 12> dim;
  • trunk/Mars/mcore/nova.h

    r17952 r18820  
    11#ifndef MARS_Nova
    22#define MARS_Nova
     3
     4#include <map>
     5#include <string>
    36
    47#include <libnova/solar.h>
     
    1013namespace Nova
    1114{
    12     typedef ln_lnlat_posn LnLatPosn;
    13     typedef ln_rst_time   RstTime; // Note that times are in JD not Mjd
    14     //typedef ln_hrz_posn   HrzPosn;
    15     //typedef ln_equ_posn   EquPosn;
     15    typedef ln_rst_time RstTime; // Note that times are in JD not Mjd
    1616
    1717    struct ZdAzPosn;
    1818    struct RaDecPosn;
    1919
     20    const static ln_lnlat_posn kORM
     21#ifndef __CINT__
     22        = { -(17.+53./60+26.525/3600), 28.+45./60+42.462/3600 } // 2200m
     23#endif
     24    ;
     25    const static ln_lnlat_posn kHAWC
     26#ifndef __CINT__
     27        = { -97.3084, 18.9947 } // 4100m;
     28#endif
     29    ;
     30    const static ln_lnlat_posn kSPM
     31#ifndef __CINT__
     32        = { -115.4637, 31.0439 } // 2800m;
     33#endif
     34    ;
     35
     36    struct LnLatPosn : public ln_lnlat_posn
     37    {
     38        LnLatPosn() { }
     39        LnLatPosn(const ln_lnlat_posn &pos) : ln_lnlat_posn(pos) { }
     40        LnLatPosn(const std::string &obs)
     41        {
     42#ifndef __CINT__
     43            static const std::map<std::string, ln_lnlat_posn> lut =
     44            {
     45                { "orm",  kORM  },
     46                { "hawc", kHAWC },
     47                { "spm",  kSPM  },
     48            };
     49
     50            const auto it = lut.find(obs);
     51            *this = it==lut.end() ? ln_lnlat_posn({0,0}) : it->second;
     52#endif
     53        }
     54    };
    2055
    2156    // Warning: 0deg=South, 90deg=W
     
    6196
    6297    EquPosn::EquPosn(const RaDecPosn &rd) { ra = rd.ra*15; dec = rd.dec; }
    63 
    64 
    65 
    66     const LnLatPosn &ORM()
    67     {
    68         //static LnLatPosn obs;
    69         //obs.lng = -(17.+53./60+26.525/3600);
    70         //obs.lat =   28.+45./60+42.462/3600;
    71         const static LnLatPosn obs = { -(17.+53./60+26.525/3600), 28.+45./60+42.462/3600 };
    72         return obs;
    73     }
    7498
    7599    HrzPosn GetHrzFromEqu(const EquPosn &equ, const LnLatPosn &obs, double jd)
     
    81105    HrzPosn GetHrzFromEqu(const EquPosn &equ, double jd)
    82106    {
    83         return GetHrzFromEqu(equ, ORM(), jd);
     107        return GetHrzFromEqu(equ, kORM, jd);
    84108    }
    85109
     
    92116    EquPosn GetEquFromHrz(const HrzPosn &hrz, double jd)
    93117    {
    94         return GetEquFromHrz(hrz, ORM(), jd);
     118        return GetEquFromHrz(hrz, kORM, jd);
    95119    }
    96120
     
    103127    RstTime GetSolarRst(double jd, double hrz=LN_SOLAR_STANDART_HORIZON)
    104128    {
    105         return GetSolarRst(jd, ORM(), hrz);
    106     }
    107 
    108     RstTime GetLunarRst(double jd, const LnLatPosn &obs=ORM())
     129        return GetSolarRst(jd, kORM, hrz);
     130    }
     131
     132    RstTime GetLunarRst(double jd, const LnLatPosn &obs=kORM)
    109133    {
    110134        RstTime rst;
     
    171195        double fEarthDist;
    172196
    173         SolarObjects(const double &jd, const LnLatPosn &obs=Nova::ORM())
     197        SolarObjects(const double &jd, const LnLatPosn &obs=Nova::kORM)
    174198        {
    175199            fJD = jd;
Note: See TracChangeset for help on using the changeset viewer.