Commit ee743866e6d3bf9168869590d7d424c38ae137d6
1 parent
b332d2bb
Improved coordinate caching of GSkyDir (#2148)
Added caching in GSkyDir for coordinates that were not used to initialize the object when those coordinates are requested. Fix indentation in GSkyDir.hpp (#2148) Fixed parameter indentation so that it is aligned again. Integrate code (#2148)
Showing
2 changed files
with
14 additions
and
8 deletions
include/GSkyDir.hpp
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | * GSkyDir.hpp - Sky direction class * |
| 3 | 3 | * ----------------------------------------------------------------------- * |
| 4 | - * copyright (C) 2008-2014 by Juergen Knoedlseder * | |
| 4 | + * copyright (C) 2008-2017 by Juergen Knoedlseder * | |
| 5 | 5 | * ----------------------------------------------------------------------- * |
| 6 | 6 | * * |
| 7 | 7 | * This program is free software: you can redistribute it and/or modify * |
| ... | ... | @@ -101,12 +101,12 @@ private: |
| 101 | 101 | double* xout, double *yout) const; |
| 102 | 102 | |
| 103 | 103 | // Private members |
| 104 | - bool m_has_lb; //!< Has galactic coordinates | |
| 105 | - bool m_has_radec; //!< Has equatorial coordinates | |
| 106 | - double m_l; //!< Galactic longitude in radians | |
| 107 | - double m_b; //!< Galactic latitude in radians | |
| 108 | - double m_ra; //!< Right Ascension in radians | |
| 109 | - double m_dec; //!< Declination in radians | |
| 104 | + mutable bool m_has_lb; //!< Has galactic coordinates | |
| 105 | + mutable bool m_has_radec; //!< Has equatorial coordinates | |
| 106 | + double m_l; //!< Galactic longitude in radians | |
| 107 | + double m_b; //!< Galactic latitude in radians | |
| 108 | + double m_ra; //!< Right Ascension in radians | |
| 109 | + double m_dec; //!< Declination in radians | |
| 110 | 110 | |
| 111 | 111 | // Sincos cache |
| 112 | 112 | #if defined(G_SINCOS_CACHE) | ... | ... |
src/sky/GSkyDir.cpp
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | * GSkyDir.cpp - Sky direction class * |
| 3 | 3 | * ----------------------------------------------------------------------- * |
| 4 | - * copyright (C) 2008-2013 by Juergen Knoedlseder * | |
| 4 | + * copyright (C) 2008-2017 by Juergen Knoedlseder * | |
| 5 | 5 | * ----------------------------------------------------------------------- * |
| 6 | 6 | * * |
| 7 | 7 | * This program is free software: you can redistribute it and/or modify * |
| ... | ... | @@ -811,6 +811,9 @@ void GSkyDir::equ2gal(void) const |
| 811 | 811 | // Convert from equatorial to galactic |
| 812 | 812 | euler(0, m_ra, m_dec, l, b); |
| 813 | 813 | |
| 814 | + // Signal that galactic coordinates are available | |
| 815 | + m_has_lb = true; | |
| 816 | + | |
| 814 | 817 | // Return |
| 815 | 818 | return; |
| 816 | 819 | } |
| ... | ... | @@ -830,6 +833,9 @@ void GSkyDir::gal2equ(void) const |
| 830 | 833 | // Convert from galactic to equatorial |
| 831 | 834 | euler(1, m_l, m_b, ra, dec); |
| 832 | 835 | |
| 836 | + // Signal that equatorial coordinates are available | |
| 837 | + m_has_radec = true; | |
| 838 | + | |
| 833 | 839 | // Return |
| 834 | 840 | return; |
| 835 | 841 | } | ... | ... |