From 33d7800a62ee99fd7b7e9d8ae7af31f6401f5964 Mon Sep 17 00:00:00 2001 From: "Timur A. Fatkhullin" Date: Fri, 11 Apr 2025 18:16:32 +0300 Subject: [PATCH] ... --- cxx/mount.h | 63 +++++++++++++++++++++++++++++++++------------- cxx/mount_astrom.h | 6 ++++- 2 files changed, 51 insertions(+), 18 deletions(-) diff --git a/cxx/mount.h b/cxx/mount.h index 9a3220d..44ca65a 100644 --- a/cxx/mount.h +++ b/cxx/mount.h @@ -101,38 +101,50 @@ struct MccMountSiteInfo { typedef double mnt_site_coord_t; typedef double mnt_site_elev_t; - mnt_site_coord_t latitude; // in radians - mnt_site_coord_t longitude; // in radians (positive to the East) - mnt_site_elev_t elevation; // in meters + mnt_site_coord_t latitude{0.0}; // in radians + mnt_site_coord_t longitude{0.0}; // in radians (positive to the East) + mnt_site_elev_t elevation{0.0}; // in meters - std::string_view name; + std::string_view name{"ALL-ZERO"}; // just a human-readable name +}; + + + +enum class MccMountType : uint8_t { GERMAN_TYPE, FORK_TYPE, CROSSAXIS_TYPE, ALTAZ_TYPE }; + +template +static constexpr std::string_view MccMountTypeStr = TYPE == MccMountType::GERMAN_TYPE ? "GERMAN" + : TYPE == MccMountType::FORK_TYPE ? "FORK" + : TYPE == MccMountType::CROSSAXIS_TYPE ? "CROSSAXIS" + : TYPE == MccMountType::ALTAZ_TYPE ? "ALTAZ" + : "UNKNOWN"; + + +/* MOUNT CONFIGURATION BASE CLASS */ + +struct MccMountConfig { + std::string leap_seconds_filename{}; // empty to use hardcoded default value! + std::string earth_orient_filename{}; // empty to use hardcoded default value! + + MccMountSiteInfo siteInfo{.latitude = 0.0, .longitude = 0.0, .elevation = 0.0, .name{"ALL-ZERO"}}; }; /* MOUNT BASE TEMPLATED CLASS WITH BASIC FUNCTIONALITY */ -enum class MccMountType : uint8_t { GERMAN_TYPE, FORK_TYPE, CROSSAXIS_TYPE, ALTAZ_TYPE }; - // implements a Finite State Machine Pattern -template +template CONFIG_TYPE = MccMountConfig> class MccMount : public utils::MccSpdlogLogger { - typedef double mnt_coord_t; - typedef double mnt_speed_t; - typedef double time_point_t; - public: static constexpr MccMountType mountType = MOUNT_TYPE; + static constexpr std::string_view mountTypeStr = MccMountTypeStr; + + typedef CONFIG_TYPE mount_config_t; enum IersDatabaseType { IERS_DB_LEAPSECS, IERS_DB_EARTH_ORIENT }; - struct mount_config_t { - std::string leap_seconds_filename{}; // empty to use hardcoded default value! - std::string earth_orient_filename{}; // empty to use hardcoded default value! - }; - - /* Constructors and destructor */ MccMount(traits::mcc_input_char_range auto const& logger_mark = "[MOUNT]", @@ -237,6 +249,23 @@ public: } + // prohibited zone related methods + + bool pzCheck(traits::mcc_real_or_char_range auto const& xcoord, traits::mcc_real_or_char_range auto const& ycoord) + { + return true; + } + + auto pzPredict(traits::mcc_systime_c auto const& time_point, + traits::mcc_real_or_char_range auto const& xcoord, + traits::mcc_real_or_char_range auto const& ycoord) + { + using d_t = std::remove_cvref_t::duration; + + return d_t::max(); + } + + // IERS databases updater bool updateIERSDatabase(IersDatabaseType type) diff --git a/cxx/mount_astrom.h b/cxx/mount_astrom.h index f3098e3..3b9772a 100644 --- a/cxx/mount_astrom.h +++ b/cxx/mount_astrom.h @@ -8,7 +8,10 @@ #include #include + +#ifdef VEC_XSIMD #include +#endif #include "mcc_traits.h" #include "mount_astrom_default.h" @@ -23,9 +26,10 @@ namespace erfa namespace mcc::traits { +#ifdef VEC_XSIMD template concept mcc_scalar_or_simd_c = xsimd::is_batch::value || std::is_arithmetic_v; - +#endif template concept mcc_real_scalar_or_real_range_c =